main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
868 bytes
|
Line | |
---|
1 | /*
|
---|
2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
3 | */
|
---|
4 |
|
---|
5 | "use strict";
|
---|
6 |
|
---|
7 | const RuntimeGlobals = require("../RuntimeGlobals");
|
---|
8 | const RuntimeModule = require("../RuntimeModule");
|
---|
9 |
|
---|
10 | /** @typedef {import("../Chunk")} Chunk */
|
---|
11 | /** @typedef {import("../ChunkGraph")} ChunkGraph */
|
---|
12 |
|
---|
13 | class RuntimeIdRuntimeModule extends RuntimeModule {
|
---|
14 | constructor() {
|
---|
15 | super("runtimeId");
|
---|
16 | }
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * @returns {string | null} runtime code
|
---|
20 | */
|
---|
21 | generate() {
|
---|
22 | const chunkGraph = /** @type {ChunkGraph} */ (this.chunkGraph);
|
---|
23 | const chunk = /** @type {Chunk} */ (this.chunk);
|
---|
24 | const runtime = chunk.runtime;
|
---|
25 | if (typeof runtime !== "string")
|
---|
26 | throw new Error("RuntimeIdRuntimeModule must be in a single runtime");
|
---|
27 | const id = chunkGraph.getRuntimeId(runtime);
|
---|
28 | return `${RuntimeGlobals.runtimeId} = ${JSON.stringify(id)};`;
|
---|
29 | }
|
---|
30 | }
|
---|
31 |
|
---|
32 | module.exports = RuntimeIdRuntimeModule;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.