@rspack/core 0.7.6-canary-1a0d77d-20240627143904 → 1.0.0-alpha.0
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/README.md +2 -2
- package/compiled/webpack-sources/index.d.ts +130 -0
- package/compiled/webpack-sources/index.js +3520 -0
- package/compiled/webpack-sources/license +21 -0
- package/compiled/webpack-sources/package.json +1 -0
- package/dist/Chunk.d.ts +19 -14
- package/dist/Chunk.js +22 -17
- package/dist/ChunkGraph.d.ts +1 -1
- package/dist/ChunkGraph.js +5 -5
- package/dist/ChunkGroup.d.ts +17 -7
- package/dist/ChunkGroup.js +12 -2
- package/dist/Compilation.d.ts +19 -23
- package/dist/Compilation.js +20 -43
- package/dist/Compiler.d.ts +1 -1
- package/dist/Compiler.js +32 -2
- package/dist/Entrypoint.d.ts +1 -1
- package/dist/Entrypoint.js +2 -2
- package/dist/Module.d.ts +12 -7
- package/dist/Module.js +1 -0
- package/dist/NormalModule.d.ts +0 -1
- package/dist/NormalModule.js +0 -7
- package/dist/NormalModuleFactory.d.ts +1 -0
- package/dist/NormalModuleFactory.js +1 -22
- package/dist/RspackError.d.ts +8 -0
- package/dist/RspackError.js +21 -0
- package/dist/Stats.d.ts +2 -2
- package/dist/Template.d.ts +1 -1
- package/dist/Template.js +2 -2
- package/dist/builtin-loader/swc/index.d.ts +0 -4
- package/dist/builtin-loader/swc/index.js +1 -5
- package/dist/builtin-loader/swc/preact.d.ts +3 -4
- package/dist/builtin-loader/swc/types.d.ts +2 -17
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -0
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.js +1 -0
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +0 -28
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +20 -69
- package/dist/builtin-plugin/css-extract/index.d.ts +2 -2
- package/dist/config/adapter.js +23 -10
- package/dist/config/adapterRuleUse.js +0 -11
- package/dist/config/defaults.js +22 -30
- package/dist/config/normalization.js +13 -5
- package/dist/config/zod.d.ts +168 -43
- package/dist/config/zod.js +23 -11
- package/dist/container/ModuleFederationPlugin.js +1 -1
- package/dist/container/default.runtime.js +1 -170
- package/dist/exports.d.ts +1 -1
- package/dist/exports.js +1 -1
- package/dist/lite-tapable/index.js +2 -2
- package/dist/loader-runner/index.js +28 -7
- package/dist/rspackOptionsApply.js +3 -0
- package/dist/stats/DefaultStatsFactoryPlugin.js +35 -11
- package/dist/stats/DefaultStatsPrinterPlugin.js +2 -2
- package/dist/stats/statsFactoryUtils.d.ts +13 -4
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.js +4 -3
- package/dist/util/memoize.js +5 -1
- package/dist/util/source.d.ts +1 -1
- package/dist/util/source.js +1 -1
- package/package.json +12 -7
- package/dist/builtin-loader/swc/emotion.d.ts +0 -17
- package/dist/builtin-loader/swc/emotion.js +0 -22
- package/dist/builtin-loader/swc/relay.d.ts +0 -5
- package/dist/builtin-loader/swc/relay.js +0 -48
- package/dist/container/default.runtime.d.ts +0 -2
package/dist/config/zod.js
CHANGED
|
@@ -194,7 +194,6 @@ const output = zod_1.z.strictObject({
|
|
|
194
194
|
libraryExport: libraryExport.optional(),
|
|
195
195
|
libraryTarget: libraryType.optional(),
|
|
196
196
|
umdNamedDefine: umdNamedDefine.optional(),
|
|
197
|
-
amdContainer: amdContainer.optional(),
|
|
198
197
|
auxiliaryComment: auxiliaryComment.optional(),
|
|
199
198
|
module: outputModule.optional(),
|
|
200
199
|
strictModuleExceptionHandling: strictModuleExceptionHandling.optional(),
|
|
@@ -230,10 +229,11 @@ const resolveAlias = zod_1.z.record(zod_1.z
|
|
|
230
229
|
.literal(false)
|
|
231
230
|
.or(zod_1.z.string())
|
|
232
231
|
.or(zod_1.z.array(zod_1.z.string().or(zod_1.z.literal(false)))));
|
|
233
|
-
const
|
|
234
|
-
|
|
232
|
+
const resolveTsConfigFile = zod_1.z.string();
|
|
233
|
+
const resolveTsConfig = resolveTsConfigFile.or(zod_1.z.strictObject({
|
|
234
|
+
configFile: resolveTsConfigFile,
|
|
235
235
|
references: zod_1.z.array(zod_1.z.string()).or(zod_1.z.literal("auto")).optional()
|
|
236
|
-
});
|
|
236
|
+
}));
|
|
237
237
|
const baseResolveOptions = zod_1.z.strictObject({
|
|
238
238
|
alias: resolveAlias.optional(),
|
|
239
239
|
conditionNames: zod_1.z.array(zod_1.z.string()).optional(),
|
|
@@ -248,8 +248,7 @@ const baseResolveOptions = zod_1.z.strictObject({
|
|
|
248
248
|
enforceExtension: zod_1.z.boolean().optional(),
|
|
249
249
|
importsFields: zod_1.z.array(zod_1.z.string()).optional(),
|
|
250
250
|
descriptionFiles: zod_1.z.array(zod_1.z.string()).optional(),
|
|
251
|
-
|
|
252
|
-
tsConfig: resolveTsconfig.optional(),
|
|
251
|
+
tsConfig: resolveTsConfig.optional(),
|
|
253
252
|
fullySpecified: zod_1.z.boolean().optional(),
|
|
254
253
|
exportsFields: zod_1.z.array(zod_1.z.string()).optional(),
|
|
255
254
|
extensionAlias: zod_1.z.record(zod_1.z.string().or(zod_1.z.array(zod_1.z.string()))).optional(),
|
|
@@ -345,6 +344,7 @@ const reexportExportsPresence = zod_1.z
|
|
|
345
344
|
.enum(["error", "warn", "auto"])
|
|
346
345
|
.or(zod_1.z.literal(false));
|
|
347
346
|
const strictExportPresence = zod_1.z.boolean();
|
|
347
|
+
const worker = zod_1.z.array(zod_1.z.string()).or(zod_1.z.boolean());
|
|
348
348
|
const javascriptParserOptions = zod_1.z.strictObject({
|
|
349
349
|
dynamicImportMode: dynamicImportMode.optional(),
|
|
350
350
|
dynamicImportPreload: dynamicImportPreload.optional(),
|
|
@@ -355,7 +355,8 @@ const javascriptParserOptions = zod_1.z.strictObject({
|
|
|
355
355
|
exportsPresence: exportsPresence.optional(),
|
|
356
356
|
importExportsPresence: importExportsPresence.optional(),
|
|
357
357
|
reexportExportsPresence: reexportExportsPresence.optional(),
|
|
358
|
-
strictExportPresence: strictExportPresence.optional()
|
|
358
|
+
strictExportPresence: strictExportPresence.optional(),
|
|
359
|
+
worker: worker.optional()
|
|
359
360
|
});
|
|
360
361
|
const parserOptionsByModuleTypeKnown = zod_1.z.strictObject({
|
|
361
362
|
asset: assetParserOptions.optional(),
|
|
@@ -470,7 +471,13 @@ const allowTarget = zod_1.z
|
|
|
470
471
|
.or(zod_1.z.custom(value => typeof value === "string" && /^electron\d+\.\d+-renderer$/.test(value)))
|
|
471
472
|
.or(zod_1.z.literal("electron-preload"))
|
|
472
473
|
.or(zod_1.z.custom(value => typeof value === "string" && /^electron\d+-preload$/.test(value)))
|
|
473
|
-
.or(zod_1.z.custom(value => typeof value === "string" && /^electron\d+\.\d+-preload$/.test(value)))
|
|
474
|
+
.or(zod_1.z.custom(value => typeof value === "string" && /^electron\d+\.\d+-preload$/.test(value)))
|
|
475
|
+
.or(zod_1.z.literal("nwjs"))
|
|
476
|
+
.or(zod_1.z.custom(value => typeof value === "string" && /^nwjs\d+$/.test(value)))
|
|
477
|
+
.or(zod_1.z.custom(value => typeof value === "string" && /^nwjs\d+\.\d+$/.test(value)))
|
|
478
|
+
.or(zod_1.z.literal("node-webkit"))
|
|
479
|
+
.or(zod_1.z.custom(value => typeof value === "string" && /^node-webkit\d+$/.test(value)))
|
|
480
|
+
.or(zod_1.z.custom(value => typeof value === "string" && /^node-webkit\d+\.\d+$/.test(value)));
|
|
474
481
|
const target = zod_1.z.literal(false).or(allowTarget).or(allowTarget.array());
|
|
475
482
|
//#endregion
|
|
476
483
|
//#region ExternalsType
|
|
@@ -534,7 +541,8 @@ const externalsPresets = zod_1.z.strictObject({
|
|
|
534
541
|
electron: zod_1.z.boolean().optional(),
|
|
535
542
|
electronMain: zod_1.z.boolean().optional(),
|
|
536
543
|
electronPreload: zod_1.z.boolean().optional(),
|
|
537
|
-
electronRenderer: zod_1.z.boolean().optional()
|
|
544
|
+
electronRenderer: zod_1.z.boolean().optional(),
|
|
545
|
+
nwjs: zod_1.z.boolean().optional()
|
|
538
546
|
});
|
|
539
547
|
//#endregion
|
|
540
548
|
//#region InfrastructureLogging
|
|
@@ -736,7 +744,10 @@ const optimizationSplitChunksName = zod_1.z
|
|
|
736
744
|
const optimizationSplitChunksChunks = zod_1.z
|
|
737
745
|
.enum(["initial", "async", "all"])
|
|
738
746
|
.or(zod_1.z.instanceof(RegExp))
|
|
739
|
-
.or(zod_1.z
|
|
747
|
+
.or(zod_1.z
|
|
748
|
+
.function()
|
|
749
|
+
.args(zod_1.z.instanceof(Chunk_1.Chunk, { message: "Input not instance of Chunk" }))
|
|
750
|
+
.returns(zod_1.z.boolean()));
|
|
740
751
|
const optimizationSplitChunksSizes = zod_1.z.number();
|
|
741
752
|
const optimizationSplitChunksDefaultSizeTypes = zod_1.z.array(zod_1.z.string());
|
|
742
753
|
const sharedOptimizationSplitChunksCacheGroup = {
|
|
@@ -810,9 +821,10 @@ const rspackFutureOptions = zod_1.z.strictObject({
|
|
|
810
821
|
bundlerInfo: zod_1.z
|
|
811
822
|
.strictObject({
|
|
812
823
|
version: zod_1.z.string().optional(),
|
|
824
|
+
bundler: zod_1.z.string().optional(),
|
|
813
825
|
force: zod_1.z
|
|
814
826
|
.boolean()
|
|
815
|
-
.or(zod_1.z.array(zod_1.z.enum(["version"])))
|
|
827
|
+
.or(zod_1.z.array(zod_1.z.enum(["version", "uniqueId"])))
|
|
816
828
|
.optional()
|
|
817
829
|
})
|
|
818
830
|
.optional()
|
|
@@ -131,6 +131,6 @@ function getDefaultEntryRuntime(paths, options, compiler) {
|
|
|
131
131
|
`const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
|
|
132
132
|
`const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
|
|
133
133
|
compiler.webpack.Template.getFunctionContent(require("./default.runtime"))
|
|
134
|
-
].join("
|
|
134
|
+
].join(";");
|
|
135
135
|
return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
|
|
136
136
|
}
|
|
@@ -1,170 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
var __module_federation_bundler_runtime__, __module_federation_runtime_plugins__, __module_federation_remote_infos__, __module_federation_container_name__;
|
|
4
|
-
module.exports = function () {
|
|
5
|
-
if ((__webpack_require__.initializeSharingData ||
|
|
6
|
-
__webpack_require__.initializeExposesData) &&
|
|
7
|
-
__webpack_require__.federation) {
|
|
8
|
-
const override = (obj, key, value) => {
|
|
9
|
-
if (!obj)
|
|
10
|
-
return;
|
|
11
|
-
if (obj[key])
|
|
12
|
-
obj[key] = value;
|
|
13
|
-
};
|
|
14
|
-
const merge = (obj, key, fn) => {
|
|
15
|
-
const value = fn();
|
|
16
|
-
if (Array.isArray(value)) {
|
|
17
|
-
obj[key] ??= [];
|
|
18
|
-
obj[key].push(...value);
|
|
19
|
-
}
|
|
20
|
-
else if (typeof value === "object" && value !== null) {
|
|
21
|
-
obj[key] ??= {};
|
|
22
|
-
Object.assign(obj[key], value);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const early = (obj, key, initial) => {
|
|
26
|
-
obj[key] ??= initial();
|
|
27
|
-
};
|
|
28
|
-
const remotesLoadingChunkMapping = __webpack_require__.remotesLoadingData?.chunkMapping ?? {};
|
|
29
|
-
const remotesLoadingModuleIdToRemoteDataMapping = __webpack_require__.remotesLoadingData?.moduleIdToRemoteDataMapping ?? {};
|
|
30
|
-
const initializeSharingScopeToInitDataMapping = __webpack_require__.initializeSharingData?.scopeToSharingDataMapping ??
|
|
31
|
-
{};
|
|
32
|
-
const consumesLoadingChunkMapping = __webpack_require__.consumesLoadingData?.chunkMapping ?? {};
|
|
33
|
-
const consumesLoadingModuleToConsumeDataMapping = __webpack_require__.consumesLoadingData?.moduleIdToConsumeDataMapping ??
|
|
34
|
-
{};
|
|
35
|
-
const consumesLoadinginstalledModules = {};
|
|
36
|
-
const initializeSharingInitPromises = [];
|
|
37
|
-
const initializeSharingInitTokens = [];
|
|
38
|
-
const containerShareScope = __webpack_require__.initializeExposesData?.shareScope;
|
|
39
|
-
for (const key in __module_federation_bundler_runtime__) {
|
|
40
|
-
__webpack_require__.federation[key] =
|
|
41
|
-
__module_federation_bundler_runtime__[key];
|
|
42
|
-
}
|
|
43
|
-
early(__webpack_require__.federation, "consumesLoadingModuleToHandlerMapping", () => {
|
|
44
|
-
const consumesLoadingModuleToHandlerMapping = {};
|
|
45
|
-
for (let [moduleId, data] of Object.entries(consumesLoadingModuleToConsumeDataMapping)) {
|
|
46
|
-
consumesLoadingModuleToHandlerMapping[moduleId] = {
|
|
47
|
-
getter: data.fallback,
|
|
48
|
-
shareInfo: {
|
|
49
|
-
shareConfig: {
|
|
50
|
-
fixedDependencies: false,
|
|
51
|
-
requiredVersion: data.requiredVersion,
|
|
52
|
-
strictVersion: data.strictVersion,
|
|
53
|
-
singleton: data.singleton,
|
|
54
|
-
eager: data.eager
|
|
55
|
-
},
|
|
56
|
-
scope: [data.shareScope]
|
|
57
|
-
},
|
|
58
|
-
shareKey: data.shareKey
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
return consumesLoadingModuleToHandlerMapping;
|
|
62
|
-
});
|
|
63
|
-
early(__webpack_require__.federation, "initOptions", () => ({}));
|
|
64
|
-
early(__webpack_require__.federation.initOptions, "name", () => __module_federation_container_name__);
|
|
65
|
-
early(__webpack_require__.federation.initOptions, "shared", () => {
|
|
66
|
-
const shared = {};
|
|
67
|
-
for (let [scope, stages] of Object.entries(initializeSharingScopeToInitDataMapping)) {
|
|
68
|
-
for (let stage of stages) {
|
|
69
|
-
if (typeof stage === "object" && stage !== null) {
|
|
70
|
-
const { name, version, factory, eager } = stage;
|
|
71
|
-
const options = { version, scope: [scope], get: factory };
|
|
72
|
-
if (shared[name]) {
|
|
73
|
-
shared[name].push(options);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
shared[name] = [options];
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return shared;
|
|
82
|
-
});
|
|
83
|
-
merge(__webpack_require__.federation.initOptions, "remotes", () => Object.values(__module_federation_remote_infos__)
|
|
84
|
-
.flat()
|
|
85
|
-
.filter(remote => remote.externalType === "script"));
|
|
86
|
-
merge(__webpack_require__.federation.initOptions, "plugins", () => __module_federation_runtime_plugins__);
|
|
87
|
-
early(__webpack_require__.federation, "bundlerRuntimeOptions", () => ({}));
|
|
88
|
-
early(__webpack_require__.federation.bundlerRuntimeOptions, "remotes", () => ({}));
|
|
89
|
-
early(__webpack_require__.federation.bundlerRuntimeOptions.remotes, "chunkMapping", () => remotesLoadingChunkMapping);
|
|
90
|
-
early(__webpack_require__.federation.bundlerRuntimeOptions.remotes, "idToExternalAndNameMapping", () => {
|
|
91
|
-
const remotesLoadingIdToExternalAndNameMappingMapping = {};
|
|
92
|
-
for (let [moduleId, data] of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)) {
|
|
93
|
-
remotesLoadingIdToExternalAndNameMappingMapping[moduleId] = [
|
|
94
|
-
data.shareScope,
|
|
95
|
-
data.name,
|
|
96
|
-
data.externalModuleId,
|
|
97
|
-
data.remoteName
|
|
98
|
-
];
|
|
99
|
-
}
|
|
100
|
-
return remotesLoadingIdToExternalAndNameMappingMapping;
|
|
101
|
-
});
|
|
102
|
-
early(__webpack_require__.federation.bundlerRuntimeOptions.remotes, "webpackRequire", () => __webpack_require__);
|
|
103
|
-
merge(__webpack_require__.federation.bundlerRuntimeOptions.remotes, "idToRemoteMap", () => {
|
|
104
|
-
const idToRemoteMap = {};
|
|
105
|
-
for (let [id, remoteData] of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)) {
|
|
106
|
-
const info = __module_federation_remote_infos__[remoteData.remoteName];
|
|
107
|
-
if (info)
|
|
108
|
-
idToRemoteMap[id] = info;
|
|
109
|
-
}
|
|
110
|
-
return idToRemoteMap;
|
|
111
|
-
});
|
|
112
|
-
override(__webpack_require__, "S", __webpack_require__.federation.bundlerRuntime.S);
|
|
113
|
-
if (__webpack_require__.federation.attachShareScopeMap) {
|
|
114
|
-
__webpack_require__.federation.attachShareScopeMap(__webpack_require__);
|
|
115
|
-
}
|
|
116
|
-
override(__webpack_require__.f, "remotes", (chunkId, promises) => __webpack_require__.federation.bundlerRuntime.remotes({
|
|
117
|
-
chunkId,
|
|
118
|
-
promises,
|
|
119
|
-
chunkMapping: remotesLoadingChunkMapping,
|
|
120
|
-
idToExternalAndNameMapping: __webpack_require__.federation.bundlerRuntimeOptions.remotes
|
|
121
|
-
.idToExternalAndNameMapping,
|
|
122
|
-
idToRemoteMap: __webpack_require__.federation.bundlerRuntimeOptions.remotes
|
|
123
|
-
.idToRemoteMap,
|
|
124
|
-
webpackRequire: __webpack_require__
|
|
125
|
-
}));
|
|
126
|
-
override(__webpack_require__.f, "consumes", (chunkId, promises) => __webpack_require__.federation.bundlerRuntime.consumes({
|
|
127
|
-
chunkId,
|
|
128
|
-
promises,
|
|
129
|
-
chunkMapping: consumesLoadingChunkMapping,
|
|
130
|
-
moduleToHandlerMapping: __webpack_require__.federation.consumesLoadingModuleToHandlerMapping,
|
|
131
|
-
installedModules: consumesLoadinginstalledModules,
|
|
132
|
-
webpackRequire: __webpack_require__
|
|
133
|
-
}));
|
|
134
|
-
override(__webpack_require__, "I", (name, initScope) => __webpack_require__.federation.bundlerRuntime.I({
|
|
135
|
-
shareScopeName: name,
|
|
136
|
-
initScope,
|
|
137
|
-
initPromises: initializeSharingInitPromises,
|
|
138
|
-
initTokens: initializeSharingInitTokens,
|
|
139
|
-
webpackRequire: __webpack_require__
|
|
140
|
-
}));
|
|
141
|
-
override(__webpack_require__, "initContainer", (shareScope, initScope, remoteEntryInitOptions) => __webpack_require__.federation.bundlerRuntime.initContainerEntry({
|
|
142
|
-
shareScope,
|
|
143
|
-
initScope,
|
|
144
|
-
remoteEntryInitOptions,
|
|
145
|
-
shareScopeKey: containerShareScope,
|
|
146
|
-
webpackRequire: __webpack_require__
|
|
147
|
-
}));
|
|
148
|
-
override(__webpack_require__, "getContainer", (module, getScope) => {
|
|
149
|
-
var moduleMap = __webpack_require__.initializeExposesData.moduleMap;
|
|
150
|
-
__webpack_require__.R = getScope;
|
|
151
|
-
getScope = Object.prototype.hasOwnProperty.call(moduleMap, module)
|
|
152
|
-
? moduleMap[module]()
|
|
153
|
-
: Promise.resolve().then(() => {
|
|
154
|
-
throw new Error('Module "' + module + '" does not exist in container.');
|
|
155
|
-
});
|
|
156
|
-
__webpack_require__.R = undefined;
|
|
157
|
-
return getScope;
|
|
158
|
-
});
|
|
159
|
-
__webpack_require__.federation.instance =
|
|
160
|
-
__webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);
|
|
161
|
-
if (__webpack_require__.consumesLoadingData?.initialConsumes) {
|
|
162
|
-
__webpack_require__.federation.bundlerRuntime.installInitialConsumes({
|
|
163
|
-
webpackRequire: __webpack_require__,
|
|
164
|
-
installedModules: consumesLoadinginstalledModules,
|
|
165
|
-
initialConsumes: __webpack_require__.consumesLoadingData.initialConsumes,
|
|
166
|
-
moduleToHandlerMapping: __webpack_require__.federation.consumesLoadingModuleToHandlerMapping
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
};
|
|
1
|
+
var __module_federation_bundler_runtime__,__module_federation_runtime_plugins__,__module_federation_remote_infos__,__module_federation_container_name__;module.exports=function(){if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){const override=(obj,key,value)=>{if(!obj)return;if(obj[key])obj[key]=value};const merge=(obj,key,fn)=>{const value=fn();if(Array.isArray(value)){obj[key]??=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){obj[key]??={};Object.assign(obj[key],value)}};const early=(obj,key,initial)=>{obj[key]??=initial()};const remotesLoadingChunkMapping=__webpack_require__.remotesLoadingData?.chunkMapping??{};const remotesLoadingModuleIdToRemoteDataMapping=__webpack_require__.remotesLoadingData?.moduleIdToRemoteDataMapping??{};const initializeSharingScopeToInitDataMapping=__webpack_require__.initializeSharingData?.scopeToSharingDataMapping??{};const consumesLoadingChunkMapping=__webpack_require__.consumesLoadingData?.chunkMapping??{};const consumesLoadingModuleToConsumeDataMapping=__webpack_require__.consumesLoadingData?.moduleIdToConsumeDataMapping??{};const consumesLoadinginstalledModules={};const initializeSharingInitPromises=[];const initializeSharingInitTokens=[];const containerShareScope=__webpack_require__.initializeExposesData?.shareScope;for(const key in __module_federation_bundler_runtime__){__webpack_require__.federation[key]=__module_federation_bundler_runtime__[key]}early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",(()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){consumesLoadingModuleToHandlerMapping[moduleId]={getter:data.fallback,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey}}return consumesLoadingModuleToHandlerMapping}));early(__webpack_require__.federation,"initOptions",(()=>({})));early(__webpack_require__.federation.initOptions,"name",(()=>__module_federation_container_name__));early(__webpack_require__.federation.initOptions,"shared",(()=>{const shared={};for(let[scope,stages]of Object.entries(initializeSharingScopeToInitDataMapping)){for(let stage of stages){if(typeof stage==="object"&&stage!==null){const{name:name,version:version,factory:factory,eager:eager}=stage;const options={version:version,scope:[scope],get:factory};if(shared[name]){shared[name].push(options)}else{shared[name]=[options]}}}}return shared}));merge(__webpack_require__.federation.initOptions,"remotes",(()=>Object.values(__module_federation_remote_infos__).flat().filter((remote=>remote.externalType==="script"))));merge(__webpack_require__.federation.initOptions,"plugins",(()=>__module_federation_runtime_plugins__));early(__webpack_require__.federation,"bundlerRuntimeOptions",(()=>({})));early(__webpack_require__.federation.bundlerRuntimeOptions,"remotes",(()=>({})));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"chunkMapping",(()=>remotesLoadingChunkMapping));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",(()=>{const remotesLoadingIdToExternalAndNameMappingMapping={};for(let[moduleId,data]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){remotesLoadingIdToExternalAndNameMappingMapping[moduleId]=[data.shareScope,data.name,data.externalModuleId,data.remoteName]}return remotesLoadingIdToExternalAndNameMappingMapping}));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"webpackRequire",(()=>__webpack_require__));merge(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",(()=>{const idToRemoteMap={};for(let[id,remoteData]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){const info=__module_federation_remote_infos__[remoteData.remoteName];if(info)idToRemoteMap[id]=info}return idToRemoteMap}));override(__webpack_require__,"S",__webpack_require__.federation.bundlerRuntime.S);if(__webpack_require__.federation.attachShareScopeMap){__webpack_require__.federation.attachShareScopeMap(__webpack_require__)}override(__webpack_require__.f,"remotes",((chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.remotes({chunkId:chunkId,promises:promises,chunkMapping:remotesLoadingChunkMapping,idToExternalAndNameMapping:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:__webpack_require__})));override(__webpack_require__.f,"consumes",((chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.consumes({chunkId:chunkId,promises:promises,chunkMapping:consumesLoadingChunkMapping,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping,installedModules:consumesLoadinginstalledModules,webpackRequire:__webpack_require__})));override(__webpack_require__,"I",((name,initScope)=>__webpack_require__.federation.bundlerRuntime.I({shareScopeName:name,initScope:initScope,initPromises:initializeSharingInitPromises,initTokens:initializeSharingInitTokens,webpackRequire:__webpack_require__})));override(__webpack_require__,"initContainer",((shareScope,initScope,remoteEntryInitOptions)=>__webpack_require__.federation.bundlerRuntime.initContainerEntry({shareScope:shareScope,initScope:initScope,remoteEntryInitOptions:remoteEntryInitOptions,shareScopeKey:containerShareScope,webpackRequire:__webpack_require__})));override(__webpack_require__,"getContainer",((module,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module)?moduleMap[module]():Promise.resolve().then((()=>{throw new Error('Module "'+module+'" does not exist in container.')}));__webpack_require__.R=undefined;return getScope}));__webpack_require__.federation.instance=__webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);if(__webpack_require__.consumesLoadingData?.initialConsumes){__webpack_require__.federation.bundlerRuntime.installInitialConsumes({webpackRequire:__webpack_require__,installedModules:consumesLoadinginstalledModules,initialConsumes:__webpack_require__.consumesLoadingData.initialConsumes,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping})}}};
|
package/dist/exports.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ import Template = require("./Template");
|
|
|
22
22
|
export { Template };
|
|
23
23
|
export declare const WebpackError: ErrorConstructor;
|
|
24
24
|
export type { Watching } from "./Watching";
|
|
25
|
-
|
|
25
|
+
import sources = require("../compiled/webpack-sources");
|
|
26
26
|
export { sources };
|
|
27
27
|
import { applyRspackOptionsDefaults, getNormalizedRspackOptions } from "./config";
|
|
28
28
|
type Config = {
|
package/dist/exports.js
CHANGED
|
@@ -55,7 +55,7 @@ exports.ModuleFilenameHelpers = ModuleFilenameHelpers;
|
|
|
55
55
|
const Template = require("./Template");
|
|
56
56
|
exports.Template = Template;
|
|
57
57
|
exports.WebpackError = Error;
|
|
58
|
-
const sources = require("webpack-sources");
|
|
58
|
+
const sources = require("../compiled/webpack-sources");
|
|
59
59
|
exports.sources = sources;
|
|
60
60
|
const config_1 = require("./config");
|
|
61
61
|
exports.config = {
|
|
@@ -163,10 +163,10 @@ class QueriedHook {
|
|
|
163
163
|
const [from, to] = stageRange;
|
|
164
164
|
for (let tap of hook.taps) {
|
|
165
165
|
const stage = tap.stage ?? 0;
|
|
166
|
-
if (from
|
|
166
|
+
if (from <= stage && stage < to) {
|
|
167
167
|
tapsInRange.push(tap);
|
|
168
168
|
}
|
|
169
|
-
else if (
|
|
169
|
+
else if (to === exports.maxStage && stage === exports.maxStage) {
|
|
170
170
|
tapsInRange.push(tap);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
@@ -29,9 +29,10 @@ const node_querystring_1 = __importDefault(require("node:querystring"));
|
|
|
29
29
|
const assert_1 = __importDefault(require("assert"));
|
|
30
30
|
const util_1 = require("util");
|
|
31
31
|
const binding_1 = require("@rspack/binding");
|
|
32
|
-
const webpack_sources_1 = require("webpack-sources");
|
|
32
|
+
const webpack_sources_1 = require("../../compiled/webpack-sources");
|
|
33
33
|
const Module_1 = require("../Module");
|
|
34
34
|
const NormalModule_1 = require("../NormalModule");
|
|
35
|
+
const RspackError_1 = require("../RspackError");
|
|
35
36
|
const adapterRuleUse_1 = require("../config/adapterRuleUse");
|
|
36
37
|
const util_2 = require("../util");
|
|
37
38
|
const createHash_1 = require("../util/createHash");
|
|
@@ -517,14 +518,34 @@ async function runLoaders(compiler, context) {
|
|
|
517
518
|
};
|
|
518
519
|
loaderContext.rootContext = compiler.context;
|
|
519
520
|
loaderContext.emitError = function emitError(error) {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
521
|
+
if (!(error instanceof Error)) {
|
|
522
|
+
error = new RspackError_1.NonErrorEmittedError(error);
|
|
523
|
+
}
|
|
524
|
+
let hasStack = !!error.stack;
|
|
525
|
+
error.name = "ModuleError";
|
|
526
|
+
error.message = `${error.message} (from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`;
|
|
527
|
+
hasStack && Error.captureStackTrace(error);
|
|
528
|
+
error = (0, util_2.concatErrorMsgAndStack)(error);
|
|
529
|
+
error.moduleIdentifier = this._module.identifier();
|
|
530
|
+
compiler._lastCompilation.__internal__pushDiagnostic({
|
|
531
|
+
error,
|
|
532
|
+
severity: binding_1.JsRspackSeverity.Error
|
|
533
|
+
});
|
|
523
534
|
};
|
|
524
535
|
loaderContext.emitWarning = function emitWarning(warning) {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
536
|
+
if (!(warning instanceof Error)) {
|
|
537
|
+
warning = new RspackError_1.NonErrorEmittedError(warning);
|
|
538
|
+
}
|
|
539
|
+
let hasStack = !!warning.stack;
|
|
540
|
+
warning.name = "ModuleWarning";
|
|
541
|
+
warning.message = `${warning.message} (from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`;
|
|
542
|
+
hasStack && Error.captureStackTrace(warning);
|
|
543
|
+
warning = (0, util_2.concatErrorMsgAndStack)(warning);
|
|
544
|
+
warning.moduleIdentifier = this._module.identifier();
|
|
545
|
+
compiler._lastCompilation.__internal__pushDiagnostic({
|
|
546
|
+
error: warning,
|
|
547
|
+
severity: binding_1.JsRspackSeverity.Warn
|
|
548
|
+
});
|
|
528
549
|
};
|
|
529
550
|
loaderContext.emitFile = function emitFile(name, content, sourceMap, assetInfo) {
|
|
530
551
|
let source;
|
|
@@ -53,6 +53,9 @@ class RspackOptionsApply {
|
|
|
53
53
|
!options.externalsPresets.electronRenderer) {
|
|
54
54
|
new builtin_plugin_1.ElectronTargetPlugin().apply(compiler);
|
|
55
55
|
}
|
|
56
|
+
if (options.externalsPresets.nwjs) {
|
|
57
|
+
new builtin_plugin_1.ExternalsPlugin("node-commonjs", "nw.gui").apply(compiler);
|
|
58
|
+
}
|
|
56
59
|
if (options.externalsPresets.web ||
|
|
57
60
|
options.externalsPresets.webAsync ||
|
|
58
61
|
(options.externalsPresets.node && options.experiments.css)) {
|
|
@@ -277,13 +277,23 @@ const SORTERS = {
|
|
|
277
277
|
_: comparators => {
|
|
278
278
|
comparators.push((0, comparators_1.compareSelect)((c) => c.id, compareIds));
|
|
279
279
|
}
|
|
280
|
-
}
|
|
280
|
+
},
|
|
281
281
|
// "compilation.modules": MODULES_SORTER,
|
|
282
282
|
// "chunk.rootModules": MODULES_SORTER,
|
|
283
283
|
// "chunk.modules": MODULES_SORTER,
|
|
284
284
|
// "module.modules": MODULES_SORTER,
|
|
285
285
|
// not support module.reasons (missing Module.identifier())
|
|
286
|
-
|
|
286
|
+
"chunk.origins": {
|
|
287
|
+
_: comparators => {
|
|
288
|
+
comparators.push(
|
|
289
|
+
// compareSelect(
|
|
290
|
+
// origin =>
|
|
291
|
+
// origin.module ? chunkGraph.getModuleId(origin.module) : undefined,
|
|
292
|
+
// compareIds
|
|
293
|
+
// ),
|
|
294
|
+
(0, comparators_1.compareSelect)((origin) => origin.loc, compareIds), (0, comparators_1.compareSelect)((origin) => origin.request, compareIds));
|
|
295
|
+
}
|
|
296
|
+
}
|
|
287
297
|
};
|
|
288
298
|
const SIMPLE_EXTRACTORS = {
|
|
289
299
|
compilation: {
|
|
@@ -499,9 +509,11 @@ const SIMPLE_EXTRACTORS = {
|
|
|
499
509
|
object.modules = limited.children;
|
|
500
510
|
object.filteredModules = limited.filteredChildren;
|
|
501
511
|
},
|
|
502
|
-
entrypoints: (object, compilation, context,
|
|
512
|
+
entrypoints: (object, compilation, context, { chunkGroupAuxiliary, chunkGroupChildren }, _factory) => {
|
|
503
513
|
// const { type } = context;
|
|
504
|
-
const array = context
|
|
514
|
+
const array = context
|
|
515
|
+
.getInner(compilation)
|
|
516
|
+
.getEntrypoints(chunkGroupAuxiliary, chunkGroupChildren);
|
|
505
517
|
// object.entrypoints = factory.create(
|
|
506
518
|
// `${type}.entrypoints`,
|
|
507
519
|
// array,
|
|
@@ -512,11 +524,11 @@ const SIMPLE_EXTRACTORS = {
|
|
|
512
524
|
return acc;
|
|
513
525
|
}, {});
|
|
514
526
|
},
|
|
515
|
-
chunkGroups: (object, compilation, context,
|
|
527
|
+
chunkGroups: (object, compilation, context, { chunkGroupAuxiliary, chunkGroupChildren }, factory) => {
|
|
516
528
|
// const { type } = context;
|
|
517
529
|
const namedChunkGroups = context
|
|
518
530
|
.getInner(compilation)
|
|
519
|
-
.getNamedChunkGroups();
|
|
531
|
+
.getNamedChunkGroups(chunkGroupAuxiliary, chunkGroupChildren);
|
|
520
532
|
// object.namedChunkGroups = factory.create(
|
|
521
533
|
// `${type}.namedChunkGroups`,
|
|
522
534
|
// namedChunkGroups,
|
|
@@ -555,7 +567,10 @@ const SIMPLE_EXTRACTORS = {
|
|
|
555
567
|
object.name = asset.name;
|
|
556
568
|
object.size = asset.size;
|
|
557
569
|
object.emitted = asset.emitted;
|
|
558
|
-
object.info =
|
|
570
|
+
object.info = {
|
|
571
|
+
...asset.info,
|
|
572
|
+
related: Object.fromEntries(asset.info.related.map(i => [i.name, i.value]))
|
|
573
|
+
};
|
|
559
574
|
Object.assign(object, factory.create(`${context.type}$visible`, asset, context));
|
|
560
575
|
}
|
|
561
576
|
},
|
|
@@ -590,12 +605,14 @@ const SIMPLE_EXTRACTORS = {
|
|
|
590
605
|
object.identifier = module.identifier;
|
|
591
606
|
object.name = module.name;
|
|
592
607
|
object.nameForCondition = module.nameForCondition;
|
|
608
|
+
object.index = module.preOrderIndex;
|
|
593
609
|
object.preOrderIndex = module.preOrderIndex;
|
|
610
|
+
object.index2 = module.postOrderIndex;
|
|
594
611
|
object.postOrderIndex = module.postOrderIndex;
|
|
595
612
|
object.cacheable = module.cacheable;
|
|
596
613
|
object.optional = module.optional;
|
|
597
614
|
object.orphan = module.orphan;
|
|
598
|
-
|
|
615
|
+
object.dependent = module.dependent;
|
|
599
616
|
object.issuer = module.issuer;
|
|
600
617
|
object.issuerName = module.issuerName;
|
|
601
618
|
object.issuerPath = factory.create(`${type.slice(0, -8)}.issuerPath`, module.issuerPath, context);
|
|
@@ -667,12 +684,10 @@ const SIMPLE_EXTRACTORS = {
|
|
|
667
684
|
profile: {
|
|
668
685
|
_: (object, profile) => {
|
|
669
686
|
const factory = (0, statsFactoryUtils_1.resolveStatsMillisecond)(profile.factory);
|
|
670
|
-
const integration = (0, statsFactoryUtils_1.resolveStatsMillisecond)(profile.integration);
|
|
671
687
|
const building = (0, statsFactoryUtils_1.resolveStatsMillisecond)(profile.building);
|
|
672
688
|
const statsProfile = {
|
|
673
|
-
total: factory +
|
|
689
|
+
total: factory + building,
|
|
674
690
|
resolving: factory,
|
|
675
|
-
integration,
|
|
676
691
|
building
|
|
677
692
|
};
|
|
678
693
|
Object.assign(object, statsProfile);
|
|
@@ -701,12 +716,18 @@ const SIMPLE_EXTRACTORS = {
|
|
|
701
716
|
chunk: {
|
|
702
717
|
_: (object, chunk) => {
|
|
703
718
|
object.type = chunk.type;
|
|
719
|
+
object.rendered = chunk.rendered;
|
|
704
720
|
object.initial = chunk.initial;
|
|
705
721
|
object.entry = chunk.entry;
|
|
722
|
+
object.reason = chunk.reason;
|
|
706
723
|
object.size = chunk.size;
|
|
724
|
+
object.sizes = Object.fromEntries(chunk.sizes.map(({ sourceType, size }) => [sourceType, size]));
|
|
707
725
|
object.names = chunk.names;
|
|
726
|
+
object.idHints = chunk.idHints;
|
|
727
|
+
object.runtime = chunk.runtime;
|
|
708
728
|
object.files = chunk.files;
|
|
709
729
|
object.auxiliaryFiles = chunk.auxiliaryFiles;
|
|
730
|
+
object.hash = chunk.hash;
|
|
710
731
|
object.childrenByOrder = chunk.childrenByOrder;
|
|
711
732
|
},
|
|
712
733
|
ids: (object, chunk) => {
|
|
@@ -720,6 +741,9 @@ const SIMPLE_EXTRACTORS = {
|
|
|
720
741
|
chunkModules: (object, chunk, context, options, factory) => {
|
|
721
742
|
const { type } = context;
|
|
722
743
|
object.modules = factory.create(`${type}.modules`, chunk.modules, context);
|
|
744
|
+
},
|
|
745
|
+
chunkOrigins: (object, chunk, context, options, factory) => {
|
|
746
|
+
object.origins = chunk.origins;
|
|
723
747
|
}
|
|
724
748
|
}
|
|
725
749
|
};
|
|
@@ -357,13 +357,13 @@ const SIMPLE_PRINTERS = {
|
|
|
357
357
|
// chunkEntry ? formatFlag("entry") : undefined,
|
|
358
358
|
// "error.chunkInitial": (chunkInitial, { formatFlag }) =>
|
|
359
359
|
// chunkInitial ? formatFlag("initial") : undefined,
|
|
360
|
-
|
|
360
|
+
"error.file": (file, { bold }) => bold(file),
|
|
361
361
|
"error.moduleName": (moduleName, { bold }) => {
|
|
362
362
|
return moduleName.includes("!")
|
|
363
363
|
? `${bold(moduleName.replace(/^(\s|\S)*!/, ""))} (${moduleName})`
|
|
364
364
|
: `${bold(moduleName)}`;
|
|
365
365
|
},
|
|
366
|
-
|
|
366
|
+
"error.loc": (loc, { green }) => green(loc),
|
|
367
367
|
"error.message": (message, { bold, formatError }) => message.includes("\u001b[") ? message : bold(formatError(message)),
|
|
368
368
|
// "error.details": (details, { formatError }) => formatError(details),
|
|
369
369
|
// "error.stack": stack => stack,
|
|
@@ -3,9 +3,16 @@ import type { Compilation, NormalizedStatsOptions } from "../Compilation";
|
|
|
3
3
|
import { type Comparator } from "../util/comparators";
|
|
4
4
|
import type { StatsFactory, StatsFactoryContext } from "./StatsFactory";
|
|
5
5
|
export type KnownStatsChunkGroup = binding.JsStatsChunkGroup;
|
|
6
|
-
export type KnownStatsChunk = binding.JsStatsChunk
|
|
6
|
+
export type KnownStatsChunk = Omit<binding.JsStatsChunk, "sizes"> & {
|
|
7
|
+
sizes: Record<string, number>;
|
|
8
|
+
};
|
|
9
|
+
export type KnownStatsAssetInfo = Omit<binding.JsStatsAssetInfo, "related"> & {
|
|
10
|
+
related: Record<string, string[]>;
|
|
11
|
+
};
|
|
7
12
|
export type StatsChunkGroup = binding.JsStatsChunkGroup & Record<string, any>;
|
|
8
|
-
export type KnownStatsAsset = binding.JsStatsAsset
|
|
13
|
+
export type KnownStatsAsset = Omit<binding.JsStatsAsset, "info"> & {
|
|
14
|
+
info: KnownStatsAssetInfo;
|
|
15
|
+
};
|
|
9
16
|
export type StatsAsset = KnownStatsAsset & Record<string, any>;
|
|
10
17
|
export type StatsChunk = KnownStatsChunk & Record<string, any>;
|
|
11
18
|
export type KnownStatsModule = Omit<binding.JsStatsModule, "usedExports" | "providedExports" | "optimizationBailout" | "sizes"> & {
|
|
@@ -14,12 +21,13 @@ export type KnownStatsModule = Omit<binding.JsStatsModule, "usedExports" | "prov
|
|
|
14
21
|
providedExports?: null | string[];
|
|
15
22
|
optimizationBailout?: null | string[];
|
|
16
23
|
sizes: Record<string, number>;
|
|
24
|
+
index?: number;
|
|
25
|
+
index2?: number;
|
|
17
26
|
};
|
|
18
27
|
export type StatsProfile = KnownStatsProfile & Record<string, any>;
|
|
19
28
|
export type KnownStatsProfile = {
|
|
20
29
|
total: number;
|
|
21
30
|
resolving: number;
|
|
22
|
-
integration: number;
|
|
23
31
|
building: number;
|
|
24
32
|
};
|
|
25
33
|
export type StatsModule = KnownStatsModule & Record<string, any>;
|
|
@@ -85,6 +93,7 @@ type ExtractorsByOption<T, O> = {
|
|
|
85
93
|
type PreprocessedAsset = StatsAsset & {
|
|
86
94
|
type: string;
|
|
87
95
|
related: PreprocessedAsset[];
|
|
96
|
+
info: binding.JsStatsAssetInfo;
|
|
88
97
|
};
|
|
89
98
|
export type SimpleExtractors = {
|
|
90
99
|
compilation: ExtractorsByOption<Compilation, StatsCompilation>;
|
|
@@ -95,7 +104,7 @@ export type SimpleExtractors = {
|
|
|
95
104
|
moduleIssuer: ExtractorsByOption<binding.JsStatsModuleIssuer, StatsModuleIssuer>;
|
|
96
105
|
profile: ExtractorsByOption<binding.JsStatsModuleProfile, StatsProfile>;
|
|
97
106
|
moduleReason: ExtractorsByOption<binding.JsStatsModuleReason, StatsModuleReason>;
|
|
98
|
-
chunk: ExtractorsByOption<
|
|
107
|
+
chunk: ExtractorsByOption<binding.JsStatsChunk, KnownStatsChunk>;
|
|
99
108
|
};
|
|
100
109
|
export declare const uniqueArray: <T, I>(items: Iterable<T>, selector: (arg: T) => Iterable<I>) => I[];
|
|
101
110
|
export declare const uniqueOrderedArray: <T, I>(items: Iterable<T>, selector: (arg: T) => Iterable<I>, comparator: Comparator) => I[];
|
package/dist/util/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { JsStatsError } from "@rspack/binding";
|
|
2
|
+
import type { JsRspackError, JsStatsError } from "@rspack/binding";
|
|
3
3
|
import { LoaderObject } from "../loader-runner";
|
|
4
4
|
export declare function mapValues(record: Record<string, string>, fn: (key: string) => string): {
|
|
5
5
|
[k: string]: string;
|
|
@@ -10,7 +10,7 @@ export declare const toObject: (input: string | Buffer | object) => object;
|
|
|
10
10
|
export declare function serializeObject(map: string | object | undefined | null): Buffer | undefined;
|
|
11
11
|
export declare function isPromiseLike(value: unknown): value is Promise<any>;
|
|
12
12
|
export declare function isJsStatsError(err: any): err is JsStatsError;
|
|
13
|
-
export declare function concatErrorMsgAndStack(err: Error |
|
|
13
|
+
export declare function concatErrorMsgAndStack(err: Error | JsRspackError | string): JsRspackError;
|
|
14
14
|
export declare function indent(str: string, prefix: string): string;
|
|
15
15
|
export declare function stringifyLoaderObject(o: LoaderObject): string;
|
|
16
16
|
export declare function asArray<T>(item: T[]): T[];
|
package/dist/util/index.js
CHANGED
|
@@ -61,12 +61,13 @@ function isJsStatsError(err) {
|
|
|
61
61
|
exports.isJsStatsError = isJsStatsError;
|
|
62
62
|
function concatErrorMsgAndStack(err) {
|
|
63
63
|
if (typeof err === "string") {
|
|
64
|
-
return err;
|
|
64
|
+
return new Error(err);
|
|
65
65
|
}
|
|
66
66
|
if ("stack" in err) {
|
|
67
|
-
|
|
67
|
+
err.message = err.stack || err.message;
|
|
68
|
+
return err;
|
|
68
69
|
}
|
|
69
|
-
return err
|
|
70
|
+
return err;
|
|
70
71
|
}
|
|
71
72
|
exports.concatErrorMsgAndStack = concatErrorMsgAndStack;
|
|
72
73
|
function indent(str, prefix) {
|
package/dist/util/memoize.js
CHANGED
|
@@ -37,7 +37,11 @@ function memoizeValue(fn) {
|
|
|
37
37
|
const getValue = (0, exports.memoize)(fn);
|
|
38
38
|
return new Proxy({}, {
|
|
39
39
|
get(_, property) {
|
|
40
|
-
|
|
40
|
+
let res = getValue()[property];
|
|
41
|
+
if (typeof res === "function") {
|
|
42
|
+
res = res.bind(getValue());
|
|
43
|
+
}
|
|
44
|
+
return res;
|
|
41
45
|
},
|
|
42
46
|
set(_, property, newValue) {
|
|
43
47
|
getValue()[property] = newValue;
|
package/dist/util/source.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { JsCompatSource } from "@rspack/binding";
|
|
3
|
-
import { Source } from "webpack-sources";
|
|
3
|
+
import { Source } from "../../compiled/webpack-sources";
|
|
4
4
|
declare class JsSource extends Source {
|
|
5
5
|
static __from_binding(source: JsCompatSource): Source;
|
|
6
6
|
static __to_binding(source: Source): {
|
package/dist/util/source.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.JsSource = void 0;
|
|
4
|
-
const webpack_sources_1 = require("webpack-sources");
|
|
4
|
+
const webpack_sources_1 = require("../../compiled/webpack-sources");
|
|
5
5
|
const index_1 = require("./index");
|
|
6
6
|
class JsSource extends webpack_sources_1.Source {
|
|
7
7
|
static __from_binding(source) {
|