@rspack/core 1.0.2 → 1.0.4
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.
- package/compiled/graceful-fs/index.js +9 -9
- package/dist/ChunkGroup.d.ts +2 -1
- package/dist/ChunkGroup.js +3 -0
- package/dist/Compilation.d.ts +2 -2
- package/dist/Compilation.js +7 -6
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +16 -16
- package/dist/builtin-plugin/css-extract/loader.js +4 -8
- package/dist/config/adapter.js +14 -17
- package/dist/config/adapterRuleUse.js +5 -5
- package/dist/config/defaults.js +14 -23
- package/dist/loader-runner/loadLoader.js +1 -6
- package/dist/stats/DefaultStatsPrinterPlugin.js +6 -1
- package/dist/util/createReadonlyMap.d.ts +1 -0
- package/dist/util/createReadonlyMap.js +29 -0
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******/ (() => { // webpackBootstrap
|
|
2
2
|
/******/ var __webpack_modules__ = ({
|
|
3
3
|
|
|
4
|
-
/***/
|
|
4
|
+
/***/ 129:
|
|
5
5
|
/***/ ((module) => {
|
|
6
6
|
|
|
7
7
|
"use strict";
|
|
@@ -32,13 +32,13 @@ function clone (obj) {
|
|
|
32
32
|
|
|
33
33
|
/***/ }),
|
|
34
34
|
|
|
35
|
-
/***/
|
|
35
|
+
/***/ 545:
|
|
36
36
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
37
37
|
|
|
38
38
|
var fs = __nccwpck_require__(147)
|
|
39
|
-
var polyfills = __nccwpck_require__(
|
|
40
|
-
var legacy = __nccwpck_require__(
|
|
41
|
-
var clone = __nccwpck_require__(
|
|
39
|
+
var polyfills = __nccwpck_require__(325)
|
|
40
|
+
var legacy = __nccwpck_require__(560)
|
|
41
|
+
var clone = __nccwpck_require__(129)
|
|
42
42
|
|
|
43
43
|
var util = __nccwpck_require__(837)
|
|
44
44
|
|
|
@@ -216,7 +216,7 @@ function patch (fs) {
|
|
|
216
216
|
|
|
217
217
|
function go$copyFile (src, dest, flags, cb, startTime) {
|
|
218
218
|
return fs$copyFile(src, dest, flags, function (err) {
|
|
219
|
-
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
219
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE' || err.code === 'EBUSY'))
|
|
220
220
|
enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()])
|
|
221
221
|
else {
|
|
222
222
|
if (typeof cb === 'function')
|
|
@@ -487,7 +487,7 @@ function retry () {
|
|
|
487
487
|
|
|
488
488
|
/***/ }),
|
|
489
489
|
|
|
490
|
-
/***/
|
|
490
|
+
/***/ 560:
|
|
491
491
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
492
492
|
|
|
493
493
|
var Stream = (__nccwpck_require__(781).Stream)
|
|
@@ -612,7 +612,7 @@ function legacy (fs) {
|
|
|
612
612
|
|
|
613
613
|
/***/ }),
|
|
614
614
|
|
|
615
|
-
/***/
|
|
615
|
+
/***/ 325:
|
|
616
616
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
617
617
|
|
|
618
618
|
var constants = __nccwpck_require__(57)
|
|
@@ -1056,7 +1056,7 @@ module.exports = require("util");
|
|
|
1056
1056
|
/******/ // startup
|
|
1057
1057
|
/******/ // Load entry module and return exports
|
|
1058
1058
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
1059
|
-
/******/ var __webpack_exports__ = __nccwpck_require__(
|
|
1059
|
+
/******/ var __webpack_exports__ = __nccwpck_require__(545);
|
|
1060
1060
|
/******/ module.exports = __webpack_exports__;
|
|
1061
1061
|
/******/
|
|
1062
1062
|
/******/ })()
|
package/dist/ChunkGroup.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type JsChunkGroup, type JsCompilation } from "@rspack/binding";
|
|
1
|
+
import { type JsChunkGroup, type JsChunkGroupOrigin, type JsCompilation } from "@rspack/binding";
|
|
2
2
|
import { Chunk } from "./Chunk";
|
|
3
3
|
export declare class ChunkGroup {
|
|
4
4
|
#private;
|
|
@@ -10,6 +10,7 @@ export declare class ChunkGroup {
|
|
|
10
10
|
get chunks(): ReadonlyArray<Chunk>;
|
|
11
11
|
get index(): Readonly<number | undefined>;
|
|
12
12
|
get name(): Readonly<string | undefined>;
|
|
13
|
+
get origins(): ReadonlyArray<JsChunkGroupOrigin>;
|
|
13
14
|
/**
|
|
14
15
|
* Note: This is not a webpack public API, maybe removed in future.
|
|
15
16
|
*
|
package/dist/ChunkGroup.js
CHANGED
|
@@ -52,6 +52,9 @@ class ChunkGroup {
|
|
|
52
52
|
get name() {
|
|
53
53
|
return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").name;
|
|
54
54
|
}
|
|
55
|
+
get origins() {
|
|
56
|
+
return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").origins;
|
|
57
|
+
}
|
|
55
58
|
/**
|
|
56
59
|
* Note: This is not a webpack public API, maybe removed in future.
|
|
57
60
|
*
|
package/dist/Compilation.d.ts
CHANGED
|
@@ -201,7 +201,7 @@ export declare class Compilation {
|
|
|
201
201
|
/**
|
|
202
202
|
* Get the named chunk groups.
|
|
203
203
|
*
|
|
204
|
-
* Note: This is a proxy for webpack internal API, only method `get` and `
|
|
204
|
+
* Note: This is a proxy for webpack internal API, only method `get`, `keys`, `values` and `entries` are supported now.
|
|
205
205
|
*/
|
|
206
206
|
get namedChunkGroups(): ReadonlyMap<string, Readonly<ChunkGroup>>;
|
|
207
207
|
get modules(): ReadonlySet<Module>;
|
|
@@ -209,7 +209,7 @@ export declare class Compilation {
|
|
|
209
209
|
/**
|
|
210
210
|
* Get the named chunks.
|
|
211
211
|
*
|
|
212
|
-
* Note: This is a proxy for webpack internal API, only method `get` and `
|
|
212
|
+
* Note: This is a proxy for webpack internal API, only method `get`, `keys`, `values` and `entries` are supported now.
|
|
213
213
|
*/
|
|
214
214
|
get namedChunks(): ReadonlyMap<string, Readonly<Chunk>>;
|
|
215
215
|
get entries(): Map<string, EntryData>;
|
package/dist/Compilation.js
CHANGED
|
@@ -54,6 +54,7 @@ const StatsFactory_1 = require("./stats/StatsFactory");
|
|
|
54
54
|
const StatsPrinter_1 = require("./stats/StatsPrinter");
|
|
55
55
|
const AssetInfo_1 = require("./util/AssetInfo");
|
|
56
56
|
const MergeCaller_1 = __importDefault(require("./util/MergeCaller"));
|
|
57
|
+
const createReadonlyMap_1 = require("./util/createReadonlyMap");
|
|
57
58
|
const fake_1 = require("./util/fake");
|
|
58
59
|
const memoize_1 = require("./util/memoize");
|
|
59
60
|
const source_1 = require("./util/source");
|
|
@@ -199,10 +200,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
199
200
|
/**
|
|
200
201
|
* Get the named chunk groups.
|
|
201
202
|
*
|
|
202
|
-
* Note: This is a proxy for webpack internal API, only method `get` and `
|
|
203
|
+
* Note: This is a proxy for webpack internal API, only method `get`, `keys`, `values` and `entries` are supported now.
|
|
203
204
|
*/
|
|
204
205
|
get namedChunkGroups() {
|
|
205
|
-
return {
|
|
206
|
+
return (0, createReadonlyMap_1.createReadonlyMap)({
|
|
206
207
|
keys: () => {
|
|
207
208
|
const names = __classPrivateFieldGet(this, _Compilation_inner, "f").getNamedChunkGroupKeys();
|
|
208
209
|
return names[Symbol.iterator]();
|
|
@@ -213,7 +214,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
213
214
|
return chunk && ChunkGroup_1.ChunkGroup.__from_binding(chunk, __classPrivateFieldGet(this, _Compilation_inner, "f"));
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
|
-
};
|
|
217
|
+
});
|
|
217
218
|
}
|
|
218
219
|
get modules() {
|
|
219
220
|
return new Set(__classPrivateFieldGet(this, _Compilation_inner, "f").modules.map(module => Module_1.Module.__from_binding(module, this)));
|
|
@@ -224,10 +225,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
224
225
|
/**
|
|
225
226
|
* Get the named chunks.
|
|
226
227
|
*
|
|
227
|
-
* Note: This is a proxy for webpack internal API, only method `get` and `
|
|
228
|
+
* Note: This is a proxy for webpack internal API, only method `get`, `keys`, `values` and `entries` are supported now.
|
|
228
229
|
*/
|
|
229
230
|
get namedChunks() {
|
|
230
|
-
return {
|
|
231
|
+
return (0, createReadonlyMap_1.createReadonlyMap)({
|
|
231
232
|
keys: () => {
|
|
232
233
|
const names = __classPrivateFieldGet(this, _Compilation_inner, "f").getNamedChunkKeys();
|
|
233
234
|
return names[Symbol.iterator]();
|
|
@@ -238,7 +239,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
238
239
|
return chunk && Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compilation_inner, "f"));
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
|
-
};
|
|
242
|
+
});
|
|
242
243
|
}
|
|
243
244
|
get entries() {
|
|
244
245
|
return new Entries(__classPrivateFieldGet(this, _Compilation_inner, "f").entries);
|
|
@@ -34,14 +34,14 @@ declare const htmlRspackPluginOptions: z.ZodObject<{
|
|
|
34
34
|
publicPath?: string | undefined;
|
|
35
35
|
hash?: boolean | undefined;
|
|
36
36
|
chunks?: string[] | undefined;
|
|
37
|
-
template?: string | undefined;
|
|
38
|
-
templateContent?: string | ((args_0: Record<string, any>, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
39
|
-
templateParameters?: boolean | Record<string, string> | ((args_0: Record<string, any>, ...args_1: unknown[]) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
40
|
-
inject?: boolean | "head" | "body" | undefined;
|
|
41
37
|
base?: string | {
|
|
42
38
|
target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
|
|
43
39
|
href?: string | undefined;
|
|
44
40
|
} | undefined;
|
|
41
|
+
template?: string | undefined;
|
|
42
|
+
templateContent?: string | ((args_0: Record<string, any>, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
43
|
+
templateParameters?: boolean | Record<string, string> | ((args_0: Record<string, any>, ...args_1: unknown[]) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
44
|
+
inject?: boolean | "head" | "body" | undefined;
|
|
45
45
|
scriptLoading?: "module" | "blocking" | "defer" | "systemjs-module" | undefined;
|
|
46
46
|
excludeChunks?: string[] | undefined;
|
|
47
47
|
sri?: "sha256" | "sha384" | "sha512" | undefined;
|
|
@@ -54,14 +54,14 @@ declare const htmlRspackPluginOptions: z.ZodObject<{
|
|
|
54
54
|
publicPath?: string | undefined;
|
|
55
55
|
hash?: boolean | undefined;
|
|
56
56
|
chunks?: string[] | undefined;
|
|
57
|
-
template?: string | undefined;
|
|
58
|
-
templateContent?: string | ((args_0: Record<string, any>, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
59
|
-
templateParameters?: boolean | Record<string, string> | ((args_0: Record<string, any>, ...args_1: unknown[]) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
60
|
-
inject?: boolean | "head" | "body" | undefined;
|
|
61
57
|
base?: string | {
|
|
62
58
|
target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
|
|
63
59
|
href?: string | undefined;
|
|
64
60
|
} | undefined;
|
|
61
|
+
template?: string | undefined;
|
|
62
|
+
templateContent?: string | ((args_0: Record<string, any>, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
63
|
+
templateParameters?: boolean | Record<string, string> | ((args_0: Record<string, any>, ...args_1: unknown[]) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
64
|
+
inject?: boolean | "head" | "body" | undefined;
|
|
65
65
|
scriptLoading?: "module" | "blocking" | "defer" | "systemjs-module" | undefined;
|
|
66
66
|
excludeChunks?: string[] | undefined;
|
|
67
67
|
sri?: "sha256" | "sha384" | "sha512" | undefined;
|
|
@@ -100,14 +100,14 @@ declare const HtmlRspackPlugin: {
|
|
|
100
100
|
publicPath?: string | undefined;
|
|
101
101
|
hash?: boolean | undefined;
|
|
102
102
|
chunks?: string[] | undefined;
|
|
103
|
-
template?: string | undefined;
|
|
104
|
-
templateContent?: string | ((args_0: Record<string, any>, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
105
|
-
templateParameters?: boolean | Record<string, string> | ((args_0: Record<string, any>, ...args_1: unknown[]) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
106
|
-
inject?: boolean | "head" | "body" | undefined;
|
|
107
103
|
base?: string | {
|
|
108
104
|
target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
|
|
109
105
|
href?: string | undefined;
|
|
110
106
|
} | undefined;
|
|
107
|
+
template?: string | undefined;
|
|
108
|
+
templateContent?: string | ((args_0: Record<string, any>, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
109
|
+
templateParameters?: boolean | Record<string, string> | ((args_0: Record<string, any>, ...args_1: unknown[]) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
110
|
+
inject?: boolean | "head" | "body" | undefined;
|
|
111
111
|
scriptLoading?: "module" | "blocking" | "defer" | "systemjs-module" | undefined;
|
|
112
112
|
excludeChunks?: string[] | undefined;
|
|
113
113
|
sri?: "sha256" | "sha384" | "sha512" | undefined;
|
|
@@ -122,14 +122,14 @@ declare const HtmlRspackPlugin: {
|
|
|
122
122
|
publicPath?: string | undefined;
|
|
123
123
|
hash?: boolean | undefined;
|
|
124
124
|
chunks?: string[] | undefined;
|
|
125
|
-
template?: string | undefined;
|
|
126
|
-
templateContent?: string | ((args_0: Record<string, any>, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
127
|
-
templateParameters?: boolean | Record<string, string> | ((args_0: Record<string, any>, ...args_1: unknown[]) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
128
|
-
inject?: boolean | "head" | "body" | undefined;
|
|
129
125
|
base?: string | {
|
|
130
126
|
target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
|
|
131
127
|
href?: string | undefined;
|
|
132
128
|
} | undefined;
|
|
129
|
+
template?: string | undefined;
|
|
130
|
+
templateContent?: string | ((args_0: Record<string, any>, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
131
|
+
templateParameters?: boolean | Record<string, string> | ((args_0: Record<string, any>, ...args_1: unknown[]) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
132
|
+
inject?: boolean | "head" | "body" | undefined;
|
|
133
133
|
scriptLoading?: "module" | "blocking" | "defer" | "systemjs-module" | undefined;
|
|
134
134
|
excludeChunks?: string[] | undefined;
|
|
135
135
|
sri?: "sha256" | "sha384" | "sha512" | undefined;
|
|
@@ -66,9 +66,7 @@ const pitch = function (request, _, data) {
|
|
|
66
66
|
const emit = typeof options.emit !== "undefined" ? options.emit : true;
|
|
67
67
|
const callback = this.async();
|
|
68
68
|
const filepath = this.resourcePath;
|
|
69
|
-
let { publicPath } =
|
|
70
|
-
/** @type {Compilation} */
|
|
71
|
-
this._compilation.outputOptions;
|
|
69
|
+
let { publicPath } = this._compilation.outputOptions;
|
|
72
70
|
if (typeof options.publicPath === "string") {
|
|
73
71
|
// eslint-disable-next-line prefer-destructuring
|
|
74
72
|
publicPath = options.publicPath;
|
|
@@ -90,7 +88,6 @@ const pitch = function (request, _, data) {
|
|
|
90
88
|
publicPathForExtract = publicPath;
|
|
91
89
|
}
|
|
92
90
|
const handleExports = (originalExports) => {
|
|
93
|
-
/** @type {Locals | undefined} */
|
|
94
91
|
let locals;
|
|
95
92
|
let namedExport;
|
|
96
93
|
const esModule = typeof options.esModule !== "undefined" ? options.esModule : true;
|
|
@@ -110,7 +107,7 @@ const pitch = function (request, _, data) {
|
|
|
110
107
|
if (!locals) {
|
|
111
108
|
locals = {};
|
|
112
109
|
}
|
|
113
|
-
|
|
110
|
+
locals[key] = originalExports[key];
|
|
114
111
|
}
|
|
115
112
|
}
|
|
116
113
|
}
|
|
@@ -158,8 +155,7 @@ const pitch = function (request, _, data) {
|
|
|
158
155
|
}
|
|
159
156
|
})());
|
|
160
157
|
const localsString = identifiers
|
|
161
|
-
.map(([id, key]) => `\nvar ${id} = ${(0, utils_1.stringifyLocal)(
|
|
162
|
-
/** @type {Locals} */ locals[key])};`)
|
|
158
|
+
.map(([id, key]) => `\nvar ${id} = ${(0, utils_1.stringifyLocal)(locals[key])};`)
|
|
163
159
|
.join("");
|
|
164
160
|
const exportsString = `export { ${identifiers
|
|
165
161
|
.map(([id, key]) => `${id} as ${JSON.stringify(key)}`)
|
|
@@ -198,7 +194,7 @@ const pitch = function (request, _, data) {
|
|
|
198
194
|
};
|
|
199
195
|
this.importModule(`${this.resourcePath}.webpack[javascript/auto]!=!!!${request}`, {
|
|
200
196
|
layer: options.layer,
|
|
201
|
-
publicPath:
|
|
197
|
+
publicPath: publicPathForExtract,
|
|
202
198
|
baseUri: `${exports.BASE_URI}/`
|
|
203
199
|
}, (error, exports) => {
|
|
204
200
|
if (error) {
|
package/dist/config/adapter.js
CHANGED
|
@@ -221,8 +221,8 @@ function getRawModule(module, options) {
|
|
|
221
221
|
const rules = ruleSet.map((rule, index) => getRawModuleRule(rule, `ruleSet[${index}]`, options, "javascript/auto"));
|
|
222
222
|
return {
|
|
223
223
|
rules,
|
|
224
|
-
parser:
|
|
225
|
-
generator:
|
|
224
|
+
parser: getRawParserOptionsMap(module.parser),
|
|
225
|
+
generator: getRawGeneratorOptionsMap(module.generator),
|
|
226
226
|
noParse: module.noParse
|
|
227
227
|
};
|
|
228
228
|
}
|
|
@@ -404,13 +404,13 @@ function getRawRuleSetLogicalConditions(logical) {
|
|
|
404
404
|
not: logical.not ? getRawRuleSetCondition(logical.not) : undefined
|
|
405
405
|
};
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function getRawParserOptionsMap(parser) {
|
|
408
408
|
return Object.fromEntries(Object.entries(parser)
|
|
409
409
|
.map(([k, v]) => [k, getRawParserOptions(v, k)])
|
|
410
410
|
.filter(([k, v]) => v !== undefined));
|
|
411
411
|
}
|
|
412
|
-
function
|
|
413
|
-
return Object.fromEntries(Object.entries(
|
|
412
|
+
function getRawGeneratorOptionsMap(generator) {
|
|
413
|
+
return Object.fromEntries(Object.entries(generator)
|
|
414
414
|
.map(([k, v]) => [k, getRawGeneratorOptions(v, k)])
|
|
415
415
|
.filter(([k, v]) => v !== undefined));
|
|
416
416
|
}
|
|
@@ -422,8 +422,10 @@ function getRawParserOptions(parser, type) {
|
|
|
422
422
|
};
|
|
423
423
|
}
|
|
424
424
|
if (type === "javascript") {
|
|
425
|
-
|
|
426
|
-
|
|
425
|
+
return {
|
|
426
|
+
type: "javascript",
|
|
427
|
+
javascript: getRawJavascriptParserOptions(parser)
|
|
428
|
+
};
|
|
427
429
|
}
|
|
428
430
|
if (type === "javascript/auto") {
|
|
429
431
|
return {
|
|
@@ -486,19 +488,14 @@ function getRawJavascriptParserOptions(parser) {
|
|
|
486
488
|
? "false"
|
|
487
489
|
: parser.reexportExportsPresence,
|
|
488
490
|
strictExportPresence: parser.strictExportPresence ?? false,
|
|
489
|
-
worker:
|
|
491
|
+
worker: typeof parser.worker === "boolean"
|
|
492
|
+
? parser.worker
|
|
493
|
+
? ["..."]
|
|
494
|
+
: []
|
|
495
|
+
: parser.worker ?? ["..."],
|
|
490
496
|
overrideStrict: parser.overrideStrict
|
|
491
497
|
};
|
|
492
498
|
}
|
|
493
|
-
function getRawJavascriptParserOptionsWorker(worker) {
|
|
494
|
-
const DEFAULT_SYNTAX = [
|
|
495
|
-
"Worker",
|
|
496
|
-
"SharedWorker",
|
|
497
|
-
"navigator.serviceWorker.register()",
|
|
498
|
-
"Worker from worker_threads"
|
|
499
|
-
];
|
|
500
|
-
return (worker === false ? [] : Array.isArray(worker) ? worker : ["..."]).flatMap(item => (item === "..." ? DEFAULT_SYNTAX : item));
|
|
501
|
-
}
|
|
502
499
|
function getRawAssetParserOptions(parser) {
|
|
503
500
|
return {
|
|
504
501
|
dataUrlCondition: parser.dataUrlCondition
|
|
@@ -54,13 +54,13 @@ function createRawModuleRuleUsesImpl(uses, path, options) {
|
|
|
54
54
|
let o;
|
|
55
55
|
let isBuiltin = false;
|
|
56
56
|
if (use.loader.startsWith(exports.BUILTIN_LOADER_PREFIX)) {
|
|
57
|
-
|
|
57
|
+
const temp = getBuiltinLoaderOptions(use.loader, use.options, options);
|
|
58
58
|
// keep json with indent so miette can show pretty error
|
|
59
|
-
o = (0, util_1.isNil)(
|
|
59
|
+
o = (0, util_1.isNil)(temp)
|
|
60
60
|
? undefined
|
|
61
|
-
: typeof
|
|
62
|
-
?
|
|
63
|
-
: JSON.stringify(
|
|
61
|
+
: typeof temp === "string"
|
|
62
|
+
? temp
|
|
63
|
+
: JSON.stringify(temp, null, 2);
|
|
64
64
|
isBuiltin = true;
|
|
65
65
|
}
|
|
66
66
|
return {
|
package/dist/config/defaults.js
CHANGED
|
@@ -152,20 +152,20 @@ const applybundlerInfoDefaults = (rspackFuture, library) => {
|
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
154
|
const applySnapshotDefaults = (_snapshot, _env) => { };
|
|
155
|
-
const applyJavascriptParserOptionsDefaults = (parserOptions
|
|
156
|
-
D(parserOptions, "dynamicImportMode",
|
|
157
|
-
D(parserOptions, "dynamicImportPrefetch",
|
|
158
|
-
D(parserOptions, "dynamicImportPreload",
|
|
159
|
-
D(parserOptions, "url",
|
|
160
|
-
D(parserOptions, "exprContextCritical",
|
|
161
|
-
D(parserOptions, "wrappedContextCritical",
|
|
162
|
-
D(parserOptions, "exportsPresence",
|
|
163
|
-
D(parserOptions, "importExportsPresence",
|
|
164
|
-
D(parserOptions, "reexportExportsPresence",
|
|
165
|
-
D(parserOptions, "strictExportPresence",
|
|
166
|
-
D(parserOptions, "worker",
|
|
167
|
-
D(parserOptions, "overrideStrict",
|
|
168
|
-
D(parserOptions, "importMeta",
|
|
155
|
+
const applyJavascriptParserOptionsDefaults = (parserOptions) => {
|
|
156
|
+
D(parserOptions, "dynamicImportMode", "lazy");
|
|
157
|
+
D(parserOptions, "dynamicImportPrefetch", false);
|
|
158
|
+
D(parserOptions, "dynamicImportPreload", false);
|
|
159
|
+
D(parserOptions, "url", true);
|
|
160
|
+
D(parserOptions, "exprContextCritical", true);
|
|
161
|
+
D(parserOptions, "wrappedContextCritical", false);
|
|
162
|
+
D(parserOptions, "exportsPresence", undefined);
|
|
163
|
+
D(parserOptions, "importExportsPresence", undefined);
|
|
164
|
+
D(parserOptions, "reexportExportsPresence", undefined);
|
|
165
|
+
D(parserOptions, "strictExportPresence", false);
|
|
166
|
+
D(parserOptions, "worker", ["..."]);
|
|
167
|
+
D(parserOptions, "overrideStrict", undefined);
|
|
168
|
+
D(parserOptions, "importMeta", true);
|
|
169
169
|
};
|
|
170
170
|
const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties }) => {
|
|
171
171
|
(0, assertNotNil_1.assertNotNill)(module.parser);
|
|
@@ -180,15 +180,6 @@ const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties }
|
|
|
180
180
|
F(module.parser, "javascript", () => ({}));
|
|
181
181
|
(0, assertNotNil_1.assertNotNill)(module.parser.javascript);
|
|
182
182
|
applyJavascriptParserOptionsDefaults(module.parser.javascript);
|
|
183
|
-
F(module.parser, "javascript/auto", () => ({}));
|
|
184
|
-
(0, assertNotNil_1.assertNotNill)(module.parser["javascript/auto"]);
|
|
185
|
-
applyJavascriptParserOptionsDefaults(module.parser["javascript/auto"], module.parser.javascript);
|
|
186
|
-
F(module.parser, "javascript/dynamic", () => ({}));
|
|
187
|
-
(0, assertNotNil_1.assertNotNill)(module.parser["javascript/dynamic"]);
|
|
188
|
-
applyJavascriptParserOptionsDefaults(module.parser["javascript/dynamic"], module.parser.javascript);
|
|
189
|
-
F(module.parser, "javascript/esm", () => ({}));
|
|
190
|
-
(0, assertNotNil_1.assertNotNill)(module.parser["javascript/esm"]);
|
|
191
|
-
applyJavascriptParserOptionsDefaults(module.parser["javascript/esm"], module.parser.javascript);
|
|
192
183
|
if (css) {
|
|
193
184
|
F(module.parser, "css", () => ({}));
|
|
194
185
|
(0, assertNotNil_1.assertNotNill)(module.parser.css);
|
|
@@ -41,12 +41,7 @@ function loadLoader(loader, callback) {
|
|
|
41
41
|
if (e instanceof Error &&
|
|
42
42
|
e.code === "EMFILE") {
|
|
43
43
|
const retry = loadLoader.bind(null, loader, callback);
|
|
44
|
-
|
|
45
|
-
// node >= 0.9.0
|
|
46
|
-
return void setImmediate(retry);
|
|
47
|
-
}
|
|
48
|
-
// node < 0.9.0
|
|
49
|
-
return process.nextTick(retry);
|
|
44
|
+
return void setImmediate(retry);
|
|
50
45
|
}
|
|
51
46
|
return callback(e);
|
|
52
47
|
}
|
|
@@ -33,7 +33,12 @@ const getResourceName = (resource) => {
|
|
|
33
33
|
return `${resource.slice(0, Math.min(resource.length - /* '..'.length */ 2, len))}..`;
|
|
34
34
|
};
|
|
35
35
|
const getModuleName = (name) => {
|
|
36
|
-
const
|
|
36
|
+
const matchResourceMatch = /^([^!]+)!=!/.exec(name);
|
|
37
|
+
const n = matchResourceMatch
|
|
38
|
+
? matchResourceMatch[0] +
|
|
39
|
+
getResourceName(name.slice(matchResourceMatch[0].length))
|
|
40
|
+
: name;
|
|
41
|
+
const [, prefix, resource] = /^(.*!)?([^!]*)$/.exec(n) || [];
|
|
37
42
|
return [prefix, getResourceName(resource)];
|
|
38
43
|
};
|
|
39
44
|
const mapLines = (str, fn) => str.split("\n").map(fn).join("\n");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createReadonlyMap<T>(obj: Pick<ReadonlyMap<string, T>, "get" | "keys">): ReadonlyMap<string, Readonly<T>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createReadonlyMap = void 0;
|
|
4
|
+
function createReadonlyMap(obj) {
|
|
5
|
+
return {
|
|
6
|
+
...obj,
|
|
7
|
+
*values() {
|
|
8
|
+
const keys = this.keys();
|
|
9
|
+
for (const key of keys) {
|
|
10
|
+
yield this.get(key);
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
*entries() {
|
|
14
|
+
const keys = this.keys();
|
|
15
|
+
for (const key of keys) {
|
|
16
|
+
yield [key, this.get(key)];
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
forEach(callback, thisArg) {
|
|
20
|
+
for (const [key, value] of this) {
|
|
21
|
+
callback.call(thisArg, value, key, this);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
[Symbol.iterator]() {
|
|
25
|
+
return this.entries();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.createReadonlyMap = createReadonlyMap;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@module-federation/runtime-tools": "0.5.1",
|
|
61
61
|
"@rspack/lite-tapable": "1.0.0",
|
|
62
62
|
"caniuse-lite": "^1.0.30001616",
|
|
63
|
-
"@rspack/binding": "1.0.
|
|
63
|
+
"@rspack/binding": "1.0.4"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@swc/helpers": ">=0.5.1"
|