@rspack/core 0.3.8 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/Compiler.d.ts +1 -0
  2. package/dist/Compiler.d.ts.map +1 -1
  3. package/dist/Compiler.js +48 -11
  4. package/dist/Compiler.js.map +1 -1
  5. package/dist/ModuleTypeConstants.d.ts +117 -0
  6. package/dist/ModuleTypeConstants.d.ts.map +1 -0
  7. package/dist/ModuleTypeConstants.js +145 -0
  8. package/dist/ModuleTypeConstants.js.map +1 -0
  9. package/dist/MultiStats.d.ts.map +1 -1
  10. package/dist/MultiStats.js +5 -4
  11. package/dist/MultiStats.js.map +1 -1
  12. package/dist/Template.d.ts +193 -0
  13. package/dist/Template.d.ts.map +1 -0
  14. package/dist/Template.js +384 -0
  15. package/dist/Template.js.map +1 -0
  16. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +15 -0
  17. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts.map +1 -0
  18. package/dist/builtin-plugin/LimitChunkCountPlugin.js +7 -0
  19. package/dist/builtin-plugin/LimitChunkCountPlugin.js.map +1 -0
  20. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +10 -0
  21. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts.map +1 -0
  22. package/dist/builtin-plugin/WebWorkerTemplatePlugin.js +5 -0
  23. package/dist/builtin-plugin/WebWorkerTemplatePlugin.js.map +1 -0
  24. package/dist/builtin-plugin/base.d.ts +3 -1
  25. package/dist/builtin-plugin/base.d.ts.map +1 -1
  26. package/dist/builtin-plugin/base.js +2 -0
  27. package/dist/builtin-plugin/base.js.map +1 -1
  28. package/dist/builtin-plugin/index.d.ts +2 -0
  29. package/dist/builtin-plugin/index.d.ts.map +1 -1
  30. package/dist/builtin-plugin/index.js +21 -9
  31. package/dist/builtin-plugin/index.js.map +1 -1
  32. package/dist/config/adapter.d.ts +2 -2
  33. package/dist/config/adapter.d.ts.map +1 -1
  34. package/dist/config/adapter.js.map +1 -1
  35. package/dist/config/defaults.d.ts.map +1 -1
  36. package/dist/config/defaults.js +3 -2
  37. package/dist/config/defaults.js.map +1 -1
  38. package/dist/index.d.ts +10 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +3 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/loader-runner/index.d.ts +1 -1
  43. package/dist/loader-runner/index.d.ts.map +1 -1
  44. package/dist/loader-runner/index.js +54 -30
  45. package/dist/loader-runner/index.js.map +1 -1
  46. package/dist/loader-runner/loadLoader.d.ts.map +1 -1
  47. package/dist/loader-runner/loadLoader.js +8 -3
  48. package/dist/loader-runner/loadLoader.js.map +1 -1
  49. package/dist/util/assertNotNil.d.ts +1 -0
  50. package/dist/util/assertNotNil.d.ts.map +1 -0
  51. package/dist/util/assertNotNil.js +9 -0
  52. package/dist/util/assertNotNil.js.map +1 -0
  53. package/dist/util/index.d.ts +2 -0
  54. package/dist/util/index.d.ts.map +1 -1
  55. package/dist/util/index.js +13 -3
  56. package/dist/util/index.js.map +1 -1
  57. package/package.json +13 -6
@@ -0,0 +1,193 @@
1
+ export = Template;
2
+ /**
3
+ * @typedef {Object} RenderManifestOptions
4
+ * @property {Chunk} chunk the chunk used to render
5
+ * @property {string} hash
6
+ * @property {string} fullHash
7
+ * @property {OutputOptions} outputOptions
8
+ * @property {CodeGenerationResults} codeGenerationResults
9
+ * @property {{javascript: ModuleTemplate}} moduleTemplates
10
+ * @property {DependencyTemplates} dependencyTemplates
11
+ * @property {RuntimeTemplate} runtimeTemplate
12
+ * @property {ModuleGraph} moduleGraph
13
+ * @property {ChunkGraph} chunkGraph
14
+ */
15
+ /** @typedef {RenderManifestEntryTemplated | RenderManifestEntryStatic} RenderManifestEntry */
16
+ /**
17
+ * @typedef {Object} RenderManifestEntryTemplated
18
+ * @property {function(): Source} render
19
+ * @property {string | function(PathData, AssetInfo=): string} filenameTemplate
20
+ * @property {PathData=} pathOptions
21
+ * @property {AssetInfo=} info
22
+ * @property {string} identifier
23
+ * @property {string=} hash
24
+ * @property {boolean=} auxiliary
25
+ */
26
+ /**
27
+ * @typedef {Object} RenderManifestEntryStatic
28
+ * @property {function(): Source} render
29
+ * @property {string} filename
30
+ * @property {AssetInfo} info
31
+ * @property {string} identifier
32
+ * @property {string=} hash
33
+ * @property {boolean=} auxiliary
34
+ */
35
+ /**
36
+ * @typedef {Object} HasId
37
+ * @property {number | string} id
38
+ */
39
+ /**
40
+ * @typedef {function(Module, number): boolean} ModuleFilterPredicate
41
+ */
42
+ declare class Template {
43
+ /**
44
+ *
45
+ * @param {Function} fn a runtime function (.runtime.js) "template"
46
+ * @returns {string} the updated and normalized function string
47
+ */
48
+ static getFunctionContent(fn: Function): string;
49
+ /**
50
+ * @param {any} str the string converted to identifier
51
+ * @returns {string} created identifier
52
+ */
53
+ static toIdentifier(str: any): string;
54
+ /**
55
+ *
56
+ * @param {string} str string to be converted to commented in bundle code
57
+ * @returns {string} returns a commented version of string
58
+ */
59
+ static toComment(str: string): string;
60
+ /**
61
+ *
62
+ * @param {string} str string to be converted to "normal comment"
63
+ * @returns {string} returns a commented version of string
64
+ */
65
+ static toNormalComment(str: string): string;
66
+ /**
67
+ * @param {string} str string path to be normalized
68
+ * @returns {string} normalized bundle-safe path
69
+ */
70
+ static toPath(str: string): string;
71
+ /**
72
+ * @param {number} n number to convert to ident
73
+ * @returns {string} returns single character ident
74
+ */
75
+ static numberToIdentifier(n: number): string;
76
+ /**
77
+ * @param {number} n number to convert to ident
78
+ * @returns {string} returns single character ident
79
+ */
80
+ static numberToIdentifierContinuation(n: number): string;
81
+ /**
82
+ *
83
+ * @param {string | string[]} s string to convert to identity
84
+ * @returns {string} converted identity
85
+ */
86
+ static indent(s: string | string[]): string;
87
+ /**
88
+ *
89
+ * @param {string|string[]} s string to create prefix for
90
+ * @param {string} prefix prefix to compose
91
+ * @returns {string} returns new prefix string
92
+ */
93
+ static prefix(s: string | string[], prefix: string): string;
94
+ /**
95
+ *
96
+ * @param {string|string[]} str string or string collection
97
+ * @returns {string} returns a single string from array
98
+ */
99
+ static asString(str: string | string[]): string;
100
+ /**
101
+ * @typedef {Object} WithId
102
+ * @property {string|number} id
103
+ */
104
+ /**
105
+ * @param {WithId[]} modules a collection of modules to get array bounds for
106
+ * @returns {[number, number] | false} returns the upper and lower array bounds
107
+ * or false if not every module has a number based id
108
+ */
109
+ static getModulesArrayBounds(modules: {
110
+ id: string | number;
111
+ }[]): [number, number] | false;
112
+ /**
113
+ * @param {ChunkRenderContext} renderContext render context
114
+ * @param {Module[]} modules modules to render (should be ordered by identifier)
115
+ * @param {function(Module): Source} renderModule function to render a module
116
+ * @param {string=} prefix applying prefix strings
117
+ * @returns {Source | null} rendered chunk modules in a Source object or null if no modules
118
+ */
119
+ static renderChunkModules(renderContext: any, modules: Module[], renderModule: (arg0: Module) => Source, prefix?: string | undefined): Source | null;
120
+ /**
121
+ * @param {RuntimeModule[]} runtimeModules array of runtime modules in order
122
+ * @param {RenderContext & { codeGenerationResults?: CodeGenerationResults }} renderContext render context
123
+ * @returns {Source} rendered runtime modules in a Source object
124
+ */
125
+ static renderRuntimeModules(runtimeModules: RuntimeModule[], renderContext: RenderContext & {
126
+ codeGenerationResults?: CodeGenerationResults;
127
+ }): Source;
128
+ /**
129
+ * @param {RuntimeModule[]} runtimeModules array of runtime modules in order
130
+ * @param {RenderContext} renderContext render context
131
+ * @returns {Source} rendered chunk runtime modules in a Source object
132
+ */
133
+ static renderChunkRuntimeModules(runtimeModules: RuntimeModule[], renderContext: any): Source;
134
+ }
135
+ declare namespace Template {
136
+ export { NUMBER_OF_IDENTIFIER_START_CHARS, NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS, Source, OutputOptions, Chunk, ChunkGraph, CodeGenerationResults, AssetInfo, PathData, DependencyTemplates, Module, ModuleGraph, ModuleTemplate, RuntimeModule, RuntimeTemplate, ChunkRenderContext, RenderContext, RenderManifestOptions, RenderManifestEntry, RenderManifestEntryTemplated, RenderManifestEntryStatic, HasId, ModuleFilterPredicate };
137
+ }
138
+ type Module = any;
139
+ type Source = import("webpack-sources").Source;
140
+ type RuntimeModule = any;
141
+ type RenderContext = any;
142
+ type CodeGenerationResults = any;
143
+ declare const NUMBER_OF_IDENTIFIER_START_CHARS: number;
144
+ declare const NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS: number;
145
+ type OutputOptions = any;
146
+ type Chunk = any;
147
+ type ChunkGraph = any;
148
+ type AssetInfo = import("./Compilation").AssetInfo;
149
+ type PathData = import("./Compilation").PathData;
150
+ type DependencyTemplates = any;
151
+ type ModuleGraph = any;
152
+ type ModuleTemplate = any;
153
+ type RuntimeTemplate = any;
154
+ type ChunkRenderContext = any;
155
+ type RenderManifestOptions = {
156
+ /**
157
+ * the chunk used to render
158
+ */
159
+ chunk: any;
160
+ hash: string;
161
+ fullHash: string;
162
+ outputOptions: any;
163
+ codeGenerationResults: any;
164
+ moduleTemplates: {
165
+ javascript: ModuleTemplate;
166
+ };
167
+ dependencyTemplates: any;
168
+ runtimeTemplate: any;
169
+ moduleGraph: any;
170
+ chunkGraph: any;
171
+ };
172
+ type RenderManifestEntry = RenderManifestEntryTemplated | RenderManifestEntryStatic;
173
+ type RenderManifestEntryTemplated = {
174
+ render: () => Source;
175
+ filenameTemplate: string | ((arg0: PathData, arg1: AssetInfo | undefined) => string);
176
+ pathOptions?: PathData | undefined;
177
+ info?: AssetInfo | undefined;
178
+ identifier: string;
179
+ hash?: string | undefined;
180
+ auxiliary?: boolean | undefined;
181
+ };
182
+ type RenderManifestEntryStatic = {
183
+ render: () => Source;
184
+ filename: string;
185
+ info: AssetInfo;
186
+ identifier: string;
187
+ hash?: string | undefined;
188
+ auxiliary?: boolean | undefined;
189
+ };
190
+ type HasId = {
191
+ id: number | string;
192
+ };
193
+ type ModuleFilterPredicate = (arg0: Module, arg1: number) => boolean;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Template.d.ts","sourceRoot":"","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gBACjC,OAAO,eAAe,EAAE,QAAQ;;;;;;;;;;;UA4BhC,MAAM;cACN,MAAM;;;qBAGN;QAAC,UAAU,EAAE,cAAc,CAAA;KAAC;;;;;;2BAO5B,4BAA4B,GAAG,yBAAyB;;kBAI5C,MAAM;sBAClB,MAAM,WAAY,QAAQ,QAAE,SAAS,iBAAI,MAAM,CAAA;kBAC/C,QAAQ;WACR,SAAS;gBACT,MAAM;WACN,MAAM;gBACN,OAAO;;;kBAKK,MAAM;cAClB,MAAM;UACN,SAAS;gBACT,MAAM;WACN,MAAM;gBACN,OAAO;;;QAKP,MAAM,GAAG,MAAM;;oCAIP,MAAM,QAAE,MAAM,KAAG,OAAO"}
@@ -0,0 +1,384 @@
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra
4
+ */
5
+ "use strict";
6
+ const { ConcatSource, PrefixSource } = require("webpack-sources");
7
+ const { WEBPACK_MODULE_TYPE_RUNTIME } = require("./ModuleTypeConstants");
8
+ const RuntimeGlobals = require("./RuntimeGlobals");
9
+ /** @typedef {import("webpack-sources").Source} Source */
10
+ /** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */
11
+ /** @typedef {import("./Chunk")} Chunk */
12
+ /** @typedef {import("./ChunkGraph")} ChunkGraph */
13
+ /** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */
14
+ /** @typedef {import("./Compilation").AssetInfo} AssetInfo */
15
+ /** @typedef {import("./Compilation").PathData} PathData */
16
+ /** @typedef {import("./DependencyTemplates")} DependencyTemplates */
17
+ /** @typedef {import("./Module")} Module */
18
+ /** @typedef {import("./ModuleGraph")} ModuleGraph */
19
+ /** @typedef {import("./ModuleTemplate")} ModuleTemplate */
20
+ /** @typedef {import("./RuntimeModule")} RuntimeModule */
21
+ /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
22
+ /** @typedef {import("./javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */
23
+ /** @typedef {import("./javascript/JavascriptModulesPlugin").RenderContext} RenderContext */
24
+ const START_LOWERCASE_ALPHABET_CODE = "a".charCodeAt(0);
25
+ const START_UPPERCASE_ALPHABET_CODE = "A".charCodeAt(0);
26
+ const DELTA_A_TO_Z = "z".charCodeAt(0) - START_LOWERCASE_ALPHABET_CODE + 1;
27
+ const NUMBER_OF_IDENTIFIER_START_CHARS = DELTA_A_TO_Z * 2 + 2; // a-z A-Z _ $
28
+ const NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS = NUMBER_OF_IDENTIFIER_START_CHARS + 10; // a-z A-Z _ $ 0-9
29
+ const FUNCTION_CONTENT_REGEX = /^function\s?\(\)\s?\{\r?\n?|\r?\n?\}$/g;
30
+ const INDENT_MULTILINE_REGEX = /^\t/gm;
31
+ const LINE_SEPARATOR_REGEX = /\r?\n/g;
32
+ const IDENTIFIER_NAME_REPLACE_REGEX = /^([^a-zA-Z$_])/;
33
+ const IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX = /[^a-zA-Z0-9$]+/g;
34
+ const COMMENT_END_REGEX = /\*\//g;
35
+ const PATH_NAME_NORMALIZE_REPLACE_REGEX = /[^a-zA-Z0-9_!§$()=\-^°]+/g;
36
+ const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g;
37
+ /**
38
+ * @typedef {Object} RenderManifestOptions
39
+ * @property {Chunk} chunk the chunk used to render
40
+ * @property {string} hash
41
+ * @property {string} fullHash
42
+ * @property {OutputOptions} outputOptions
43
+ * @property {CodeGenerationResults} codeGenerationResults
44
+ * @property {{javascript: ModuleTemplate}} moduleTemplates
45
+ * @property {DependencyTemplates} dependencyTemplates
46
+ * @property {RuntimeTemplate} runtimeTemplate
47
+ * @property {ModuleGraph} moduleGraph
48
+ * @property {ChunkGraph} chunkGraph
49
+ */
50
+ /** @typedef {RenderManifestEntryTemplated | RenderManifestEntryStatic} RenderManifestEntry */
51
+ /**
52
+ * @typedef {Object} RenderManifestEntryTemplated
53
+ * @property {function(): Source} render
54
+ * @property {string | function(PathData, AssetInfo=): string} filenameTemplate
55
+ * @property {PathData=} pathOptions
56
+ * @property {AssetInfo=} info
57
+ * @property {string} identifier
58
+ * @property {string=} hash
59
+ * @property {boolean=} auxiliary
60
+ */
61
+ /**
62
+ * @typedef {Object} RenderManifestEntryStatic
63
+ * @property {function(): Source} render
64
+ * @property {string} filename
65
+ * @property {AssetInfo} info
66
+ * @property {string} identifier
67
+ * @property {string=} hash
68
+ * @property {boolean=} auxiliary
69
+ */
70
+ /**
71
+ * @typedef {Object} HasId
72
+ * @property {number | string} id
73
+ */
74
+ /**
75
+ * @typedef {function(Module, number): boolean} ModuleFilterPredicate
76
+ */
77
+ class Template {
78
+ /**
79
+ *
80
+ * @param {Function} fn a runtime function (.runtime.js) "template"
81
+ * @returns {string} the updated and normalized function string
82
+ */
83
+ static getFunctionContent(fn) {
84
+ return fn
85
+ .toString()
86
+ .replace(FUNCTION_CONTENT_REGEX, "")
87
+ .replace(INDENT_MULTILINE_REGEX, "")
88
+ .replace(LINE_SEPARATOR_REGEX, "\n");
89
+ }
90
+ /**
91
+ * @param {any} str the string converted to identifier
92
+ * @returns {string} created identifier
93
+ */
94
+ static toIdentifier(str) {
95
+ if (typeof str !== "string")
96
+ return "";
97
+ return str
98
+ .replace(IDENTIFIER_NAME_REPLACE_REGEX, "_$1")
99
+ .replace(IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX, "_");
100
+ }
101
+ /**
102
+ *
103
+ * @param {string} str string to be converted to commented in bundle code
104
+ * @returns {string} returns a commented version of string
105
+ */
106
+ static toComment(str) {
107
+ if (!str)
108
+ return "";
109
+ return `/*! ${str.replace(COMMENT_END_REGEX, "* /")} */`;
110
+ }
111
+ /**
112
+ *
113
+ * @param {string} str string to be converted to "normal comment"
114
+ * @returns {string} returns a commented version of string
115
+ */
116
+ static toNormalComment(str) {
117
+ if (!str)
118
+ return "";
119
+ return `/* ${str.replace(COMMENT_END_REGEX, "* /")} */`;
120
+ }
121
+ /**
122
+ * @param {string} str string path to be normalized
123
+ * @returns {string} normalized bundle-safe path
124
+ */
125
+ static toPath(str) {
126
+ if (typeof str !== "string")
127
+ return "";
128
+ return str
129
+ .replace(PATH_NAME_NORMALIZE_REPLACE_REGEX, "-")
130
+ .replace(MATCH_PADDED_HYPHENS_REPLACE_REGEX, "");
131
+ }
132
+ // map number to a single character a-z, A-Z or multiple characters if number is too big
133
+ /**
134
+ * @param {number} n number to convert to ident
135
+ * @returns {string} returns single character ident
136
+ */
137
+ static numberToIdentifier(n) {
138
+ if (n >= NUMBER_OF_IDENTIFIER_START_CHARS) {
139
+ // use multiple letters
140
+ return (Template.numberToIdentifier(n % NUMBER_OF_IDENTIFIER_START_CHARS) +
141
+ Template.numberToIdentifierContinuation(Math.floor(n / NUMBER_OF_IDENTIFIER_START_CHARS)));
142
+ }
143
+ // lower case
144
+ if (n < DELTA_A_TO_Z) {
145
+ return String.fromCharCode(START_LOWERCASE_ALPHABET_CODE + n);
146
+ }
147
+ n -= DELTA_A_TO_Z;
148
+ // upper case
149
+ if (n < DELTA_A_TO_Z) {
150
+ return String.fromCharCode(START_UPPERCASE_ALPHABET_CODE + n);
151
+ }
152
+ if (n === DELTA_A_TO_Z)
153
+ return "_";
154
+ return "$";
155
+ }
156
+ /**
157
+ * @param {number} n number to convert to ident
158
+ * @returns {string} returns single character ident
159
+ */
160
+ static numberToIdentifierContinuation(n) {
161
+ if (n >= NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS) {
162
+ // use multiple letters
163
+ return (Template.numberToIdentifierContinuation(n % NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS) +
164
+ Template.numberToIdentifierContinuation(Math.floor(n / NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS)));
165
+ }
166
+ // lower case
167
+ if (n < DELTA_A_TO_Z) {
168
+ return String.fromCharCode(START_LOWERCASE_ALPHABET_CODE + n);
169
+ }
170
+ n -= DELTA_A_TO_Z;
171
+ // upper case
172
+ if (n < DELTA_A_TO_Z) {
173
+ return String.fromCharCode(START_UPPERCASE_ALPHABET_CODE + n);
174
+ }
175
+ n -= DELTA_A_TO_Z;
176
+ // numbers
177
+ if (n < 10) {
178
+ return `${n}`;
179
+ }
180
+ if (n === 10)
181
+ return "_";
182
+ return "$";
183
+ }
184
+ /**
185
+ *
186
+ * @param {string | string[]} s string to convert to identity
187
+ * @returns {string} converted identity
188
+ */
189
+ static indent(s) {
190
+ if (Array.isArray(s)) {
191
+ return s.map(Template.indent).join("\n");
192
+ }
193
+ else {
194
+ const str = s.trimEnd();
195
+ if (!str)
196
+ return "";
197
+ const ind = str[0] === "\n" ? "" : "\t";
198
+ return ind + str.replace(/\n([^\n])/g, "\n\t$1");
199
+ }
200
+ }
201
+ /**
202
+ *
203
+ * @param {string|string[]} s string to create prefix for
204
+ * @param {string} prefix prefix to compose
205
+ * @returns {string} returns new prefix string
206
+ */
207
+ static prefix(s, prefix) {
208
+ const str = Template.asString(s).trim();
209
+ if (!str)
210
+ return "";
211
+ const ind = str[0] === "\n" ? "" : prefix;
212
+ return ind + str.replace(/\n([^\n])/g, "\n" + prefix + "$1");
213
+ }
214
+ /**
215
+ *
216
+ * @param {string|string[]} str string or string collection
217
+ * @returns {string} returns a single string from array
218
+ */
219
+ static asString(str) {
220
+ if (Array.isArray(str)) {
221
+ return str.join("\n");
222
+ }
223
+ return str;
224
+ }
225
+ /**
226
+ * @typedef {Object} WithId
227
+ * @property {string|number} id
228
+ */
229
+ /**
230
+ * @param {WithId[]} modules a collection of modules to get array bounds for
231
+ * @returns {[number, number] | false} returns the upper and lower array bounds
232
+ * or false if not every module has a number based id
233
+ */
234
+ static getModulesArrayBounds(modules) {
235
+ let maxId = -Infinity;
236
+ let minId = Infinity;
237
+ for (const module of modules) {
238
+ const moduleId = module.id;
239
+ if (typeof moduleId !== "number")
240
+ return false;
241
+ if (maxId < moduleId)
242
+ maxId = moduleId;
243
+ if (minId > moduleId)
244
+ minId = moduleId;
245
+ }
246
+ if (minId < 16 + ("" + minId).length) {
247
+ // add minId x ',' instead of 'Array(minId).concat(…)'
248
+ minId = 0;
249
+ }
250
+ // start with -1 because the first module needs no comma
251
+ let objectOverhead = -1;
252
+ for (const module of modules) {
253
+ // module id + colon + comma
254
+ objectOverhead += `${module.id}`.length + 2;
255
+ }
256
+ // number of commas, or when starting non-zero the length of Array(minId).concat()
257
+ const arrayOverhead = minId === 0 ? maxId : 16 + `${minId}`.length + maxId;
258
+ return arrayOverhead < objectOverhead ? [minId, maxId] : false;
259
+ }
260
+ /**
261
+ * @param {ChunkRenderContext} renderContext render context
262
+ * @param {Module[]} modules modules to render (should be ordered by identifier)
263
+ * @param {function(Module): Source} renderModule function to render a module
264
+ * @param {string=} prefix applying prefix strings
265
+ * @returns {Source | null} rendered chunk modules in a Source object or null if no modules
266
+ */
267
+ static renderChunkModules(renderContext, modules, renderModule, prefix = "") {
268
+ const { chunkGraph } = renderContext;
269
+ var source = new ConcatSource();
270
+ if (modules.length === 0) {
271
+ return null;
272
+ }
273
+ /** @type {{id: string|number, source: Source|string}[]} */
274
+ const allModules = modules.map(module => {
275
+ return {
276
+ id: chunkGraph.getModuleId(module),
277
+ source: renderModule(module) || "false"
278
+ };
279
+ });
280
+ const bounds = Template.getModulesArrayBounds(allModules);
281
+ if (bounds) {
282
+ // Render a spare array
283
+ const minId = bounds[0];
284
+ const maxId = bounds[1];
285
+ if (minId !== 0) {
286
+ source.add(`Array(${minId}).concat(`);
287
+ }
288
+ source.add("[\n");
289
+ /** @type {Map<string|number, {id: string|number, source: Source|string}>} */
290
+ const modules = new Map();
291
+ for (const module of allModules) {
292
+ modules.set(module.id, module);
293
+ }
294
+ for (let idx = minId; idx <= maxId; idx++) {
295
+ const module = modules.get(idx);
296
+ if (idx !== minId) {
297
+ source.add(",\n");
298
+ }
299
+ source.add(`/* ${idx} */`);
300
+ if (module) {
301
+ source.add("\n");
302
+ source.add(module.source);
303
+ }
304
+ }
305
+ source.add("\n" + prefix + "]");
306
+ if (minId !== 0) {
307
+ source.add(")");
308
+ }
309
+ }
310
+ else {
311
+ // Render an object
312
+ source.add("{\n");
313
+ for (let i = 0; i < allModules.length; i++) {
314
+ const module = allModules[i];
315
+ if (i !== 0) {
316
+ source.add(",\n");
317
+ }
318
+ source.add(`\n/***/ ${JSON.stringify(module.id)}:\n`);
319
+ source.add(module.source);
320
+ }
321
+ source.add(`\n\n${prefix}}`);
322
+ }
323
+ return source;
324
+ }
325
+ /**
326
+ * @param {RuntimeModule[]} runtimeModules array of runtime modules in order
327
+ * @param {RenderContext & { codeGenerationResults?: CodeGenerationResults }} renderContext render context
328
+ * @returns {Source} rendered runtime modules in a Source object
329
+ */
330
+ static renderRuntimeModules(runtimeModules, renderContext) {
331
+ const source = new ConcatSource();
332
+ for (const module of runtimeModules) {
333
+ const codeGenerationResults = renderContext.codeGenerationResults;
334
+ let runtimeSource;
335
+ if (codeGenerationResults) {
336
+ runtimeSource = codeGenerationResults.getSource(module, renderContext.chunk.runtime, WEBPACK_MODULE_TYPE_RUNTIME);
337
+ }
338
+ else {
339
+ const codeGenResult = module.codeGeneration({
340
+ chunkGraph: renderContext.chunkGraph,
341
+ dependencyTemplates: renderContext.dependencyTemplates,
342
+ moduleGraph: renderContext.moduleGraph,
343
+ runtimeTemplate: renderContext.runtimeTemplate,
344
+ runtime: renderContext.chunk.runtime,
345
+ codeGenerationResults
346
+ });
347
+ if (!codeGenResult)
348
+ continue;
349
+ runtimeSource = codeGenResult.sources.get("runtime");
350
+ }
351
+ if (runtimeSource) {
352
+ source.add(Template.toNormalComment(module.identifier()) + "\n");
353
+ if (!module.shouldIsolate()) {
354
+ source.add(runtimeSource);
355
+ source.add("\n\n");
356
+ }
357
+ else if (renderContext.runtimeTemplate.supportsArrowFunction()) {
358
+ source.add("(() => {\n");
359
+ source.add(new PrefixSource("\t", runtimeSource));
360
+ source.add("\n})();\n\n");
361
+ }
362
+ else {
363
+ source.add("!function() {\n");
364
+ source.add(new PrefixSource("\t", runtimeSource));
365
+ source.add("\n}();\n\n");
366
+ }
367
+ }
368
+ }
369
+ return source;
370
+ }
371
+ /**
372
+ * @param {RuntimeModule[]} runtimeModules array of runtime modules in order
373
+ * @param {RenderContext} renderContext render context
374
+ * @returns {Source} rendered chunk runtime modules in a Source object
375
+ */
376
+ static renderChunkRuntimeModules(runtimeModules, renderContext) {
377
+ return new PrefixSource("/******/ ", new ConcatSource(`function(${RuntimeGlobals.require}) { // webpackRuntimeModules\n`, this.renderRuntimeModules(runtimeModules, renderContext), "}\n"));
378
+ }
379
+ }
380
+ module.exports = Template;
381
+ module.exports.NUMBER_OF_IDENTIFIER_START_CHARS =
382
+ NUMBER_OF_IDENTIFIER_START_CHARS;
383
+ module.exports.NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS =
384
+ NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Template.js","sourceRoot":"","sources":["../src/Template.js"],"names":[],"mappings":"AAAA;;;EAGE;AAEF,YAAY,CAAC;AAEb,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAClE,MAAM,EAAE,2BAA2B,EAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACzE,MAAM,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEnD,yDAAyD;AACzD,+EAA+E;AAC/E,yCAAyC;AACzC,mDAAmD;AACnD,yEAAyE;AACzE,6DAA6D;AAC7D,2DAA2D;AAC3D,qEAAqE;AACrE,2CAA2C;AAC3C,qDAAqD;AACrD,2DAA2D;AAC3D,yDAAyD;AACzD,6DAA6D;AAC7D,sGAAsG;AACtG,4FAA4F;AAE5F,MAAM,6BAA6B,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AACxD,MAAM,6BAA6B,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AACxD,MAAM,YAAY,GAAG,G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,EAAE;oBAC5B,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;oBAC1B,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;iBACnB;qBAAM,IAAI,aAAa,CAAC,eAAe,CAAC,qBAAqB,EAAE,EAAE;oBACjE,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;oBACzB,MAAM,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;oBAClD,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;iBAC1B;qBAAM;oBACN,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;oBAC9B,MAAM,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;oBAClD,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;iBACzB;aACD;SACD;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,yBAAyB,CAAC,cAAc,EAAE,aAAa;QAC7D,OAAO,IAAI,YAAY,CACtB,WAAW,EACX,IAAI,YAAY,CACf,YAAY,cAAc,CAAC,OAAO,gCAAgC,EAClE,IAAI,CAAC,oBAAoB,CAAC,cAAc,EAAE,aAAa,CAAC,EACxD,KAAK,CACL,CACD,CAAC;IACH,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC;AAC1B,MAAM,CAAC,OAAO,CAAC,gCAAgC;IAC9C,gCAAgC,CAAC;AAClC,MAAM,CAAC,OAAO,CAAC,uCAAuC;IACrD,uCAAuC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { RawLimitChunkCountPluginOptions } from "@rspack/binding";
2
+ import { BuiltinPluginName } from "./base";
3
+ export type LimitChunkCountOptions = {
4
+ chunkOverhead?: number;
5
+ entryChunkMultiplicator?: number;
6
+ maxChunks: number;
7
+ };
8
+ export declare const LimitChunkCountPlugin: {
9
+ new (options: LimitChunkCountOptions): {
10
+ name: BuiltinPluginName;
11
+ _options: RawLimitChunkCountPluginOptions;
12
+ raw(): import("@rspack/binding").BuiltinPlugin;
13
+ apply(compiler: import("../Compiler").Compiler): void;
14
+ };
15
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LimitChunkCountPlugin.d.ts","sourceRoot":"","sources":["../../src/builtin-plugin/LimitChunkCountPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAU,MAAM,QAAQ,CAAC;AAEnD,MAAM,MAAM,sBAAsB,GAAG;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;CAKjC,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LimitChunkCountPlugin = void 0;
4
+ const base_1 = require("./base");
5
+ exports.LimitChunkCountPlugin = (0, base_1.create)(base_1.BuiltinPluginName.LimitChunkCountPlugin, (options) => {
6
+ return options;
7
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LimitChunkCountPlugin.js","sourceRoot":"","sources":["../../src/builtin-plugin/LimitChunkCountPlugin.ts"],"names":[],"mappings":";;;AACA,iCAAmD;AAQtC,QAAA,qBAAqB,GAAG,IAAA,aAAM,EAC1C,wBAAiB,CAAC,qBAAqB,EACvC,CAAC,OAA+B,EAAmC,EAAE;IACpE,OAAO,OAAO,CAAC;AAChB,CAAC,CACD,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { BuiltinPluginName } from "./base";
2
+ export type WebWorkerTemplateOptions = {};
3
+ export declare const WebWorkerTemplatePlugin: {
4
+ new (): {
5
+ name: BuiltinPluginName;
6
+ _options: undefined;
7
+ raw(): import("@rspack/binding").BuiltinPlugin;
8
+ apply(compiler: import("../Compiler").Compiler): void;
9
+ };
10
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebWorkerTemplatePlugin.d.ts","sourceRoot":"","sources":["../../src/builtin-plugin/WebWorkerTemplatePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAU,MAAM,QAAQ,CAAC;AAEnD,MAAM,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAE1C,eAAO,MAAM,uBAAuB;;;;;;;CAGnC,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WebWorkerTemplatePlugin = void 0;
4
+ const base_1 = require("./base");
5
+ exports.WebWorkerTemplatePlugin = (0, base_1.create)(base_1.BuiltinPluginName.WebWorkerTemplatePlugin, () => undefined);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebWorkerTemplatePlugin.js","sourceRoot":"","sources":["../../src/builtin-plugin/WebWorkerTemplatePlugin.ts"],"names":[],"mappings":";;;AAAA,iCAAmD;AAItC,QAAA,uBAAuB,GAAG,IAAA,aAAM,EAC5C,wBAAiB,CAAC,uBAAuB,EACzC,GAAG,EAAE,CAAC,SAAS,CACf,CAAC"}
@@ -20,7 +20,9 @@ export declare enum BuiltinPluginName {
20
20
  CopyRspackPlugin = "CopyRspackPlugin",
21
21
  HtmlRspackPlugin = "HtmlRspackPlugin",
22
22
  SwcJsMinimizerRspackPlugin = "SwcJsMinimizerRspackPlugin",
23
- SwcCssMinimizerRspackPlugin = "SwcCssMinimizerRspackPlugin"
23
+ SwcCssMinimizerRspackPlugin = "SwcCssMinimizerRspackPlugin",
24
+ LimitChunkCountPlugin = "LimitChunkCountPlugin",
25
+ WebWorkerTemplatePlugin = "WebWorkerTemplatePlugin"
24
26
  }
25
27
  export declare abstract class RspackBuiltinPlugin implements RspackPluginInstance {
26
28
  abstract raw(): binding.BuiltinPlugin;