@ohos-ports/rspack-core 2.2.2-beta.0 → 2.2.9-beta.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 +10 -0
- package/compiled/@rspack/lite-tapable/dist/index.d.ts +20 -6
- package/compiled/@rspack/lite-tapable/package.json +1 -1
- package/compiled/open/package.json +1 -1
- package/compiled/tinypool/README.md +4 -4
- package/compiled/tinypool/dist/index.d.ts +3 -2
- package/compiled/tinypool/dist/index.js +3 -3
- package/compiled/tinypool/package.json +1 -1
- package/compiled/webpack-sources/index.d.ts +61 -0
- package/compiled/webpack-sources/index.js +858 -224
- package/compiled/webpack-sources/package.json +8 -1
- package/compiled/webpack-sources/types/CachedSource.d.ts +192 -0
- package/compiled/webpack-sources/types/CompatSource.d.ts +87 -0
- package/compiled/webpack-sources/types/ConcatSource.d.ts +75 -0
- package/compiled/webpack-sources/types/OriginalSource.d.ts +87 -0
- package/compiled/webpack-sources/types/PrefixSource.d.ts +59 -0
- package/compiled/webpack-sources/types/RawSource.d.ts +75 -0
- package/compiled/webpack-sources/types/ReplaceSource.d.ts +107 -0
- package/compiled/webpack-sources/types/SizeOnlySource.d.ts +24 -0
- package/compiled/webpack-sources/types/Source.d.ts +189 -0
- package/compiled/webpack-sources/types/SourceMapSource.d.ts +136 -0
- package/compiled/webpack-sources/types/helpers/createMappingsSerializer.d.ts +60 -0
- package/compiled/webpack-sources/types/helpers/getFromStreamChunks.d.ts +16 -0
- package/compiled/webpack-sources/types/helpers/getGeneratedSourceInfo.d.ts +31 -0
- package/compiled/webpack-sources/types/helpers/getName.d.ts +15 -0
- package/compiled/webpack-sources/types/helpers/getSource.d.ts +15 -0
- package/compiled/webpack-sources/types/helpers/readMappings.d.ts +19 -0
- package/compiled/webpack-sources/types/helpers/scopes.d.ts +119 -0
- package/compiled/webpack-sources/types/helpers/splitIntoLines.d.ts +6 -0
- package/compiled/webpack-sources/types/helpers/splitIntoPotentialTokens.d.ts +37 -0
- package/compiled/webpack-sources/types/helpers/streamAndGetSourceAndMap.d.ts +39 -0
- package/compiled/webpack-sources/types/helpers/streamChunks.d.ts +56 -0
- package/compiled/webpack-sources/types/helpers/streamChunksOfCombinedSourceMap.d.ts +42 -0
- package/compiled/webpack-sources/types/helpers/streamChunksOfRawSource.d.ts +16 -0
- package/compiled/webpack-sources/types/helpers/streamChunksOfSourceMap.d.ts +19 -0
- package/compiled/webpack-sources/types/helpers/stringBufferUtils.d.ts +55 -0
- package/compiled/webpack-sources/types/index.d.ts +50 -0
- package/dist/BuildInfo.d.ts +6 -4
- package/dist/Chunk.d.ts +3 -3
- package/dist/ChunkGraph.d.ts +2 -2
- package/dist/Chunks.d.ts +2 -2
- package/dist/CodeGenerationResults.d.ts +6 -1
- package/dist/Compilation.d.ts +13 -52
- package/dist/Compiler.d.ts +5 -5
- package/dist/ConcatenatedModule.d.ts +1 -1
- package/dist/ContextModule.d.ts +1 -1
- package/dist/Diagnostics.d.ts +2 -6
- package/dist/Entrypoint.d.ts +1 -1
- package/dist/ExportsInfo.d.ts +1 -1
- package/dist/ExternalModule.d.ts +1 -1
- package/dist/FileSystem.d.ts +3 -1
- package/dist/FileSystemDependencies.d.ts +15 -0
- package/dist/Module.d.ts +10 -6
- package/dist/ModuleGraph.d.ts +6 -6
- package/dist/ModuleGraphConnection.d.ts +1 -1
- package/dist/Modules.d.ts +3 -0
- package/dist/NativeWatchFileSystem.d.ts +1 -1
- package/dist/NormalModule.d.ts +2 -2
- package/dist/NormalModuleFactory.d.ts +2 -1
- package/dist/Resolver.d.ts +10 -2
- package/dist/ResolverFactory.d.ts +1 -1
- package/dist/RspackError.d.ts +2 -2
- package/dist/RuntimeGlobals.d.ts +4 -3
- package/dist/RuntimeModule.d.ts +1 -1
- package/dist/builtin-loader/lightningcss/target.d.ts +1 -1
- package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BannerPlugin.d.ts +2 -2
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CaseSensitivePlugin.d.ts +1 -1
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CircularCheckRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CircularModulesInfoPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CompactHashedChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CompactHashedModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +2 -2
- package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssHttpExternalsRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DllEntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +2 -2
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EntryPlugin.d.ts +2 -2
- package/dist/builtin-plugin/EsmNodeTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +2 -2
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +2 -2
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
- package/dist/builtin-plugin/HashedModuleIdsPlugin.d.ts +2 -2
- package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +1 -1
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/HttpUriPlugin.d.ts +5 -1
- package/dist/builtin-plugin/IgnorePlugin.d.ts +2 -2
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/InlineExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LibManifestPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +1 -1
- package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +2 -2
- package/dist/builtin-plugin/ProgressPlugin.d.ts +2 -2
- package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +2 -2
- package/dist/builtin-plugin/RslibPlugin.d.ts +4 -4
- package/dist/builtin-plugin/RstestPlugin.d.ts +2 -2
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +2 -2
- package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +2 -2
- package/dist/builtin-plugin/SplitChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +2 -2
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SyncModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/URLPlugin.d.ts +1 -1
- package/dist/builtin-plugin/WorkerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/base.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/index.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/utils.d.ts +4 -1
- package/dist/builtin-plugin/html-plugin/hooks.d.ts +1 -1
- package/dist/builtin-plugin/html-plugin/plugin.d.ts +2 -2
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +3 -3
- package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +1 -1
- package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +1 -1
- package/dist/config/adapter.d.ts +1 -1
- package/dist/config/adapterRuleUse.d.ts +3 -2
- package/dist/config/normalization.d.ts +6 -9
- package/dist/config/types.d.ts +79 -16
- package/dist/container/ContainerPlugin.d.ts +1 -1
- package/dist/container/ContainerReferencePlugin.d.ts +1 -1
- package/dist/container/ModuleFederationManifestPlugin.d.ts +1 -1
- package/dist/container/ModuleFederationPluginV1.d.ts +5 -1
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
- package/dist/cssExtractLoader.js +7 -5
- package/dist/exports.d.ts +5 -5
- package/dist/index.js +885 -408
- package/dist/lib/Cache.d.ts +3 -0
- package/dist/lib/DllReferencePlugin.d.ts +1 -1
- package/dist/lib/WebpackError.d.ts +1 -1
- package/dist/loader-runner/cache.d.ts +11 -2
- package/dist/loader-runner/dependencies.d.ts +4 -3
- package/dist/loader-runner/index.d.ts +1 -1
- package/dist/loader-runner/service.d.ts +6 -1
- package/dist/loader-runner/worker.d.ts +1 -1
- package/dist/l~0.js +34 -0
- package/dist/l~3.js +34 -0
- package/dist/sharing/CollectSharedEntryPlugin.d.ts +1 -1
- package/dist/sharing/ConsumeSharedPlugin.d.ts +1 -1
- package/dist/sharing/ProvideSharedPlugin.d.ts +1 -1
- package/dist/sharing/SharePlugin.d.ts +13 -1
- package/dist/sharing/ShareRuntimePlugin.d.ts +1 -1
- package/dist/sharing/SharedContainerPlugin.d.ts +1 -1
- package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +2 -2
- package/dist/stats/StatsFactory.d.ts +4 -2
- package/dist/stats/StatsPrinter.d.ts +5 -5
- package/dist/stats/statsFactoryUtils.d.ts +5 -6
- package/dist/swc.d.ts +1 -1
- package/dist/taps/compilation.d.ts +1 -1
- package/dist/taps/types.d.ts +1 -1
- package/dist/util/SplitChunkSize.d.ts +1 -1
- package/dist/util/bindingHelpers.d.ts +7 -0
- package/dist/util/fs.d.ts +9 -9
- package/dist/util/source.d.ts +3 -3
- package/dist/util/watchTimeInfo.d.ts +7 -0
- package/dist/worker.js +78 -43
- package/package.json +8 -32
- package/compiled/webpack-sources/types.d.ts +0 -500
- package/dist/612~0.js +0 -32
- package/dist/612~3.js +0 -32
- package/dist/util/MergeCaller.d.ts +0 -10
- package/dist/util/fake.d.ts +0 -11
package/dist/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
let _computedKey, _computedKey1, _computedKey2, createMd4, createXxhash64, service_pool, loadLoader_url, ArrayQueue_computedKey;
|
|
1
|
+
let _computedKey, _computedKey1, _computedKey2, FileSystemDependencies_computedKey, FileSystemDependencies_computedKey1, FileSystemDependencies_computedKey2, Compilation_computedKey, Compilation_computedKey1, Compilation_computedKey2, createMd4, createXxhash64, service_pool, loadLoader_url, ArrayQueue_computedKey;
|
|
2
|
+
import { rspackRequire, moduleFactories, definePropertyGetters, makeNamespaceObject, compatGetDefaultExport } from "./l~0.js";
|
|
2
3
|
import node_util, { inspect, promisify } from "node:util";
|
|
3
4
|
import { createRequire, createRequire as __rspack_createRequire } from "node:module";
|
|
4
5
|
import node_path, { isAbsolute, join, relative, resolve as external_node_path_resolve, sep } from "node:path";
|
|
5
6
|
import node_fs, { readFileSync } from "node:fs";
|
|
6
7
|
import node_querystring from "node:querystring";
|
|
8
|
+
import { MessageChannel } from "node:worker_threads";
|
|
7
9
|
import { EventEmitter } from "node:events";
|
|
8
|
-
import { __webpack_require__ } from "./612~0.js";
|
|
9
10
|
let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
10
11
|
import * as __rspack_external_node_util_ac04460e from "node:util";
|
|
11
|
-
|
|
12
|
-
"../../node_modules/.pnpm/enhanced-resolve@5.
|
|
13
|
-
let firstCallback, firstResult, { nextTick } =
|
|
12
|
+
moduleFactories.add({
|
|
13
|
+
"../../node_modules/.pnpm/enhanced-resolve@5.26.0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js" (module) {
|
|
14
|
+
let firstCallback, firstResult, { nextTick } = __rspack_createRequire_require("process"), dirname = (path)=>{
|
|
14
15
|
let idx = path.length - 1;
|
|
15
16
|
for(; idx >= 0;){
|
|
16
17
|
let char = path.charCodeAt(idx);
|
|
@@ -268,8 +269,8 @@ __webpack_require__.add({
|
|
|
268
269
|
"./moduleFederationDefaultRuntime.js" (module) {
|
|
269
270
|
module.exports = __rspack_createRequire_require("./moduleFederationDefaultRuntime.js");
|
|
270
271
|
},
|
|
271
|
-
"@
|
|
272
|
-
module.exports = __rspack_createRequire_require(process.env.RSPACK_BINDING || "@
|
|
272
|
+
"@rspack/binding" (module) {
|
|
273
|
+
module.exports = __rspack_createRequire_require(process.env.RSPACK_BINDING || "@rspack/binding");
|
|
273
274
|
},
|
|
274
275
|
"node:crypto" (module) {
|
|
275
276
|
module.exports = __rspack_createRequire_require("node:crypto");
|
|
@@ -280,9 +281,6 @@ __webpack_require__.add({
|
|
|
280
281
|
"node:https" (module) {
|
|
281
282
|
module.exports = __rspack_createRequire_require("node:https");
|
|
282
283
|
},
|
|
283
|
-
"node:os" (module) {
|
|
284
|
-
module.exports = __rspack_createRequire_require("node:os");
|
|
285
|
-
},
|
|
286
284
|
"node:url" (module) {
|
|
287
285
|
module.exports = __rspack_createRequire_require("node:url");
|
|
288
286
|
},
|
|
@@ -291,17 +289,14 @@ __webpack_require__.add({
|
|
|
291
289
|
},
|
|
292
290
|
"node:zlib" (module) {
|
|
293
291
|
module.exports = __rspack_createRequire_require("node:zlib");
|
|
294
|
-
},
|
|
295
|
-
process (module) {
|
|
296
|
-
module.exports = __rspack_createRequire_require("process");
|
|
297
292
|
}
|
|
298
293
|
});
|
|
299
294
|
var RuntimeGlobals, key, StatsErrorCode, browserslistTargetHandler_namespaceObject = {};
|
|
300
|
-
|
|
295
|
+
makeNamespaceObject(browserslistTargetHandler_namespaceObject), definePropertyGetters(browserslistTargetHandler_namespaceObject, {
|
|
301
296
|
resolve: ()=>browserslistTargetHandler_resolve
|
|
302
297
|
});
|
|
303
298
|
var exports_namespaceObject = {};
|
|
304
|
-
|
|
299
|
+
makeNamespaceObject(exports_namespaceObject), definePropertyGetters(exports_namespaceObject, {
|
|
305
300
|
AsyncDependenciesBlock: ()=>binding_.AsyncDependenciesBlock,
|
|
306
301
|
BannerPlugin: ()=>BannerPlugin,
|
|
307
302
|
CaseSensitivePlugin: ()=>CaseSensitivePlugin,
|
|
@@ -385,7 +380,7 @@ function _define_property(obj, key, value) {
|
|
|
385
380
|
writable: !0
|
|
386
381
|
}) : obj[key] = value, obj;
|
|
387
382
|
}
|
|
388
|
-
|
|
383
|
+
makeNamespaceObject(ModuleFilenameHelpers_namespaceObject), definePropertyGetters(ModuleFilenameHelpers_namespaceObject, {
|
|
389
384
|
asRegExp: ()=>asRegExp,
|
|
390
385
|
matchObject: ()=>matchObject,
|
|
391
386
|
matchPart: ()=>matchPart
|
|
@@ -500,12 +495,22 @@ class HookBase {
|
|
|
500
495
|
}
|
|
501
496
|
this.taps[i] = item;
|
|
502
497
|
}
|
|
498
|
+
_tapsInAllStages() {
|
|
499
|
+
let cached = this._allStageTaps;
|
|
500
|
+
if (void 0 !== cached && cached.source === this.taps && cached.length === this.taps.length) return cached.taps;
|
|
501
|
+
let taps = this.queryStageRange(allStageRange).tapsInRange;
|
|
502
|
+
return this._allStageTaps = {
|
|
503
|
+
source: this.taps,
|
|
504
|
+
length: this.taps.length,
|
|
505
|
+
taps
|
|
506
|
+
}, taps;
|
|
507
|
+
}
|
|
503
508
|
_prepareArgs(args) {
|
|
504
509
|
let len = this.args.length;
|
|
505
510
|
return args.length < len ? (args.length = len, args.fill(void 0, args.length, len)) : (args.length > len && (args.length = len), args);
|
|
506
511
|
}
|
|
507
512
|
constructor(args = [], name){
|
|
508
|
-
_define_property(this, "args", void 0), _define_property(this, "name", void 0), _define_property(this, "taps", void 0), _define_property(this, "interceptors", void 0), this.args = args, this.name = name, this.taps = [], this.interceptors = [];
|
|
513
|
+
_define_property(this, "args", void 0), _define_property(this, "name", void 0), _define_property(this, "taps", void 0), _define_property(this, "interceptors", void 0), _define_property(this, "_allStageTaps", void 0), this.args = args, this.name = name, this.taps = [], this.interceptors = [], this._allStageTaps = void 0;
|
|
509
514
|
}
|
|
510
515
|
}
|
|
511
516
|
let allStageRange = [
|
|
@@ -550,7 +555,13 @@ class SyncHook extends HookBase {
|
|
|
550
555
|
1 / 0 === to && (this._runDoneInterceptors(), cb(null));
|
|
551
556
|
}
|
|
552
557
|
call(...args) {
|
|
553
|
-
return this.callStageRange(this.queryStageRange(allStageRange), ...args);
|
|
558
|
+
if (this.interceptors.length > 0) return this.callStageRange(this.queryStageRange(allStageRange), ...args);
|
|
559
|
+
let taps = this._tapsInAllStages(), args2 = this._prepareArgs(args);
|
|
560
|
+
try {
|
|
561
|
+
for(let i = 0; i < taps.length; i++)taps[i].fn(...args2);
|
|
562
|
+
} catch (e) {
|
|
563
|
+
if (e) throw e;
|
|
564
|
+
}
|
|
554
565
|
}
|
|
555
566
|
callStageRange(queried, ...args) {
|
|
556
567
|
let result, error;
|
|
@@ -582,7 +593,16 @@ class SyncBailHook extends HookBase {
|
|
|
582
593
|
1 / 0 === to && (this._runDoneInterceptors(), cb(null));
|
|
583
594
|
}
|
|
584
595
|
call(...args) {
|
|
585
|
-
return this.callStageRange(this.queryStageRange(allStageRange), ...args);
|
|
596
|
+
if (this.interceptors.length > 0) return this.callStageRange(this.queryStageRange(allStageRange), ...args);
|
|
597
|
+
let taps = this._tapsInAllStages(), args2 = this._prepareArgs(args);
|
|
598
|
+
try {
|
|
599
|
+
for(let i = 0; i < taps.length; i++){
|
|
600
|
+
let r = taps[i].fn(...args2);
|
|
601
|
+
if (void 0 !== r) return r;
|
|
602
|
+
}
|
|
603
|
+
} catch (e) {
|
|
604
|
+
if (e) throw e;
|
|
605
|
+
}
|
|
586
606
|
}
|
|
587
607
|
callStageRange(queried, ...args) {
|
|
588
608
|
let result, error;
|
|
@@ -613,7 +633,18 @@ class SyncWaterfallHook extends HookBase {
|
|
|
613
633
|
1 / 0 === to && (this._runDoneInterceptors(), cb(null, args2[0]));
|
|
614
634
|
}
|
|
615
635
|
call(...args) {
|
|
616
|
-
return this.callStageRange(this.queryStageRange(allStageRange), ...args);
|
|
636
|
+
if (this.interceptors.length > 0) return this.callStageRange(this.queryStageRange(allStageRange), ...args);
|
|
637
|
+
let taps = this._tapsInAllStages(), args2 = this._prepareArgs(args);
|
|
638
|
+
try {
|
|
639
|
+
for(let i = 0; i < taps.length; i++){
|
|
640
|
+
let r = taps[i].fn(...args2);
|
|
641
|
+
void 0 !== r && (args2[0] = r);
|
|
642
|
+
}
|
|
643
|
+
} catch (e) {
|
|
644
|
+
if (e) throw e;
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
return args2[0];
|
|
617
648
|
}
|
|
618
649
|
callStageRange(queried, ...args) {
|
|
619
650
|
let result, error;
|
|
@@ -860,8 +891,8 @@ class MultiHook {
|
|
|
860
891
|
_define_property(this, "hooks", void 0), _define_property(this, "name", void 0), this.hooks = hooks, this.name = name;
|
|
861
892
|
}
|
|
862
893
|
}
|
|
863
|
-
let binding_ =
|
|
864
|
-
var binding__default =
|
|
894
|
+
let binding_ = rspackRequire("@rspack/binding");
|
|
895
|
+
var binding__default = compatGetDefaultExport(binding_), AsyncDependenciesBlock = binding_.AsyncDependenciesBlock, ConcatenatedModule = binding_.ConcatenatedModule, ContextModule = binding_.ContextModule, Dependency = binding_.Dependency, EntryDependency = binding_.EntryDependency, Module = binding_.Module, NormalModule = binding_.NormalModule;
|
|
865
896
|
Object.defineProperty(binding_.Chunk.prototype, 'files', {
|
|
866
897
|
enumerable: !0,
|
|
867
898
|
configurable: !0,
|
|
@@ -1570,6 +1601,7 @@ class StatsFactory {
|
|
|
1570
1601
|
hooks;
|
|
1571
1602
|
_caches;
|
|
1572
1603
|
_inCreate;
|
|
1604
|
+
_itemTypes;
|
|
1573
1605
|
constructor(){
|
|
1574
1606
|
this.hooks = Object.freeze({
|
|
1575
1607
|
extract: new HookMap(()=>new SyncBailHook([
|
|
@@ -1626,7 +1658,14 @@ class StatsFactory {
|
|
|
1626
1658
|
});
|
|
1627
1659
|
let hooks = this.hooks, caches = {};
|
|
1628
1660
|
for (let key of Object.keys(hooks))caches[key] = new Map();
|
|
1629
|
-
this._caches = caches, this._inCreate = !1;
|
|
1661
|
+
this._caches = caches, this._inCreate = !1, this._itemTypes = new Map();
|
|
1662
|
+
}
|
|
1663
|
+
_getItemTypes(type) {
|
|
1664
|
+
let itemTypes = this._itemTypes.get(type);
|
|
1665
|
+
return void 0 === itemTypes && (itemTypes = {
|
|
1666
|
+
itemType: `${type}[]`,
|
|
1667
|
+
innerTypeByItemName: new Map()
|
|
1668
|
+
}, this._itemTypes.set(type, itemTypes)), itemTypes;
|
|
1630
1669
|
}
|
|
1631
1670
|
_getAllLevelHooks(hookMap, cache, type) {
|
|
1632
1671
|
let cacheEntry = cache.get(type);
|
|
@@ -1677,13 +1716,16 @@ class StatsFactory {
|
|
|
1677
1716
|
if (Array.isArray(data)) {
|
|
1678
1717
|
let items = this._forEachLevelFilter(this.hooks.filter, this._caches.filter, type, data, (h, r, idx, i)=>h.call(r, context, idx, i), !0), comparators = [];
|
|
1679
1718
|
this._forEachLevel(this.hooks.sort, this._caches.sort, type, (h)=>h.call(comparators, context)), comparators.length > 0 && items.sort(concatComparators(...comparators));
|
|
1680
|
-
let
|
|
1719
|
+
let items2 = this._forEachLevelFilter(this.hooks.filterSorted, this._caches.filterSorted, type, items, (h, r, idx, i)=>h.call(r, context, idx, i), !1), itemTypes = this._getItemTypes(type), resultItems = items2.map((item, i)=>{
|
|
1681
1720
|
let itemContext = {
|
|
1682
1721
|
...context,
|
|
1683
1722
|
_index: i
|
|
1684
|
-
}, itemName = this._forEachLevel(this.hooks.getItemName, this._caches.getItemName,
|
|
1685
|
-
|
|
1686
|
-
|
|
1723
|
+
}, itemName = this._forEachLevel(this.hooks.getItemName, this._caches.getItemName, itemTypes.itemType, (h)=>h.call(item, itemContext)), innerType = itemTypes.itemType;
|
|
1724
|
+
if (itemName) {
|
|
1725
|
+
itemContext[itemName] = item;
|
|
1726
|
+
let namedType = itemTypes.innerTypeByItemName.get(itemName);
|
|
1727
|
+
void 0 === namedType && (namedType = `${itemTypes.itemType}.${itemName}`, itemTypes.innerTypeByItemName.set(itemName, namedType)), innerType = namedType;
|
|
1728
|
+
}
|
|
1687
1729
|
return (this._forEachLevel(this.hooks.getItemFactory, this._caches.getItemFactory, innerType, (h)=>h.call(item, itemContext)) || this).create(innerType, item, itemContext);
|
|
1688
1730
|
}), comparators2 = [];
|
|
1689
1731
|
this._forEachLevel(this.hooks.sortResults, this._caches.sortResults, type, (h)=>h.call(comparators2, context)), comparators2.length > 0 && resultItems.sort(concatComparators(...comparators2));
|
|
@@ -1917,59 +1959,131 @@ function createReadonlyMap(obj) {
|
|
|
1917
1959
|
}
|
|
1918
1960
|
};
|
|
1919
1961
|
}
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1962
|
+
function _to_property_key(arg) {
|
|
1963
|
+
var key = function(input, hint) {
|
|
1964
|
+
if ("object" !== _type_of(input) || null === input) return input;
|
|
1965
|
+
var prim = input[Symbol.toPrimitive];
|
|
1966
|
+
if (void 0 !== prim) {
|
|
1967
|
+
var res = prim.call(input, hint || "default");
|
|
1968
|
+
if ("object" !== _type_of(res)) return res;
|
|
1969
|
+
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
1970
|
+
}
|
|
1971
|
+
return ("string" === hint ? String : Number)(input);
|
|
1972
|
+
}(arg, "string");
|
|
1973
|
+
return "symbol" === _type_of(key) ? key : String(key);
|
|
1974
|
+
}
|
|
1975
|
+
function _type_of(obj) {
|
|
1976
|
+
return obj && "u" > typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1977
|
+
}
|
|
1978
|
+
_computedKey = _to_property_key(Symbol.iterator), _computedKey1 = _to_property_key(Symbol.toStringTag), _computedKey2 = _to_property_key(node_util.inspect.custom);
|
|
1979
|
+
class ModulesWrapper {
|
|
1980
|
+
#inner;
|
|
1981
|
+
constructor(inner){
|
|
1982
|
+
this.#inner = inner;
|
|
1925
1983
|
}
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
this.callArgs = [], this.callFn(args);
|
|
1929
|
-
};
|
|
1930
|
-
pendingData() {
|
|
1931
|
-
return this.callArgs;
|
|
1984
|
+
get size() {
|
|
1985
|
+
return this.#inner.size();
|
|
1932
1986
|
}
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
for(let i = 0; i < data.length; i++)this.callArgs.push(data[i]);
|
|
1987
|
+
has(value) {
|
|
1988
|
+
return this.#inner.has(value);
|
|
1936
1989
|
}
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1990
|
+
keys() {
|
|
1991
|
+
return this.values();
|
|
1992
|
+
}
|
|
1993
|
+
values() {
|
|
1994
|
+
return this.#inner.values().values();
|
|
1995
|
+
}
|
|
1996
|
+
*entries() {
|
|
1997
|
+
for (let value of this.#inner.values())yield [
|
|
1998
|
+
value,
|
|
1999
|
+
value
|
|
2000
|
+
];
|
|
2001
|
+
}
|
|
2002
|
+
*[_computedKey]() {
|
|
2003
|
+
yield* this.#inner.values();
|
|
2004
|
+
}
|
|
2005
|
+
forEach(callback, thisArg) {
|
|
2006
|
+
if ('function' != typeof callback) throw TypeError('callback must be a function');
|
|
2007
|
+
for (let value of this.#inner.values())callback.call(thisArg, value, value, this);
|
|
2008
|
+
}
|
|
2009
|
+
get [_computedKey1]() {
|
|
2010
|
+
return 'Set';
|
|
2011
|
+
}
|
|
2012
|
+
[_computedKey2]() {
|
|
2013
|
+
return new Set(this.values());
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
for (let name of [
|
|
2017
|
+
'union',
|
|
2018
|
+
'intersection',
|
|
2019
|
+
'difference',
|
|
2020
|
+
'symmetricDifference',
|
|
2021
|
+
'isSubsetOf',
|
|
2022
|
+
'isSupersetOf',
|
|
2023
|
+
'isDisjointFrom'
|
|
2024
|
+
]){
|
|
2025
|
+
let method = Reflect.get(Set.prototype, name);
|
|
2026
|
+
'function' == typeof method && Object.defineProperty(ModulesWrapper.prototype, name, {
|
|
2027
|
+
configurable: !0,
|
|
2028
|
+
writable: !0,
|
|
2029
|
+
value (other) {
|
|
2030
|
+
return method.call(new Set(this.values()), other);
|
|
1966
2031
|
}
|
|
1967
|
-
};
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
2034
|
+
let index_js_namespaceObject = __rspack_createRequire_require("../compiled/webpack-sources/index.js"), sourceCacheSymbol = Symbol.for('rspack.originalSource'), sourceMapOverrides = new WeakMap();
|
|
2035
|
+
function replaceSourceMap(source, value) {
|
|
2036
|
+
return !!Object.getOwnPropertyDescriptor(source, '_sourceMapAsString')?.configurable && (Object.defineProperty(source, '_sourceMapAsString', {
|
|
2037
|
+
value,
|
|
2038
|
+
writable: !0,
|
|
2039
|
+
configurable: !0,
|
|
2040
|
+
enumerable: !0
|
|
2041
|
+
}), delete source[sourceCacheSymbol], !0);
|
|
2042
|
+
}
|
|
2043
|
+
function setSourceMap(value) {
|
|
2044
|
+
if (!replaceSourceMap(this, value)) {
|
|
2045
|
+
if (Object.isFrozen(this)) throw TypeError("Cannot assign to read only property '_sourceMapAsString'");
|
|
2046
|
+
sourceMapOverrides.set(this, {
|
|
2047
|
+
value
|
|
2048
|
+
});
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
function getSourceMap() {
|
|
2052
|
+
let override = sourceMapOverrides.get(this);
|
|
2053
|
+
if (override) return override.value;
|
|
2054
|
+
let cache = this[sourceCacheSymbol];
|
|
2055
|
+
if (!cache) return this._sourceMapAsString;
|
|
2056
|
+
let map = cache.map, json = 'string' == typeof map ? map : map();
|
|
2057
|
+
return cache.map = json, replaceSourceMap(this, json), json;
|
|
2058
|
+
}
|
|
2059
|
+
function clearSourceCache(options, visited) {
|
|
2060
|
+
'function' == typeof this[sourceCacheSymbol]?.map && (options = {
|
|
2061
|
+
...options,
|
|
2062
|
+
maps: !1
|
|
2063
|
+
}), index_js_namespaceObject.SourceMapSource.prototype.clearCache.call(this, options, visited);
|
|
1968
2064
|
}
|
|
1969
|
-
let index_js_namespaceObject = __rspack_createRequire_require("../compiled/webpack-sources/index.js");
|
|
1970
2065
|
class SourceAdapter {
|
|
1971
|
-
static fromBinding(
|
|
1972
|
-
|
|
2066
|
+
static fromBinding(cache) {
|
|
2067
|
+
if (!cache.map) return new index_js_namespaceObject.RawSource(cache.source);
|
|
2068
|
+
if ('string' == typeof cache.map) return new index_js_namespaceObject.SourceMapSource(cache.source, 'inmemory://from rust', cache.map);
|
|
2069
|
+
let source = new index_js_namespaceObject.SourceMapSource(cache.source, 'inmemory://from rust');
|
|
2070
|
+
return source._hasSourceMap = !0, Object.defineProperties(source, {
|
|
2071
|
+
[sourceCacheSymbol]: {
|
|
2072
|
+
value: cache,
|
|
2073
|
+
configurable: !0
|
|
2074
|
+
},
|
|
2075
|
+
clearCache: {
|
|
2076
|
+
value: clearSourceCache,
|
|
2077
|
+
writable: !0,
|
|
2078
|
+
configurable: !0
|
|
2079
|
+
},
|
|
2080
|
+
_sourceMapAsString: {
|
|
2081
|
+
get: getSourceMap,
|
|
2082
|
+
set: setSourceMap,
|
|
2083
|
+
configurable: !0,
|
|
2084
|
+
enumerable: !0
|
|
2085
|
+
}
|
|
2086
|
+
}), source;
|
|
1973
2087
|
}
|
|
1974
2088
|
static toBinding(source) {
|
|
1975
2089
|
let content = source.source();
|
|
@@ -2077,9 +2191,10 @@ Object.defineProperty(binding_.Chunks.prototype, 'entries', {
|
|
|
2077
2191
|
return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
|
|
2078
2192
|
}
|
|
2079
2193
|
});
|
|
2080
|
-
let
|
|
2194
|
+
let proxies = new WeakMap();
|
|
2081
2195
|
function createDiagnosticArray(adm) {
|
|
2082
|
-
|
|
2196
|
+
let cached = proxies.get(adm);
|
|
2197
|
+
if (cached) return cached;
|
|
2083
2198
|
let array = [];
|
|
2084
2199
|
array[node_util.inspect.custom] = ()=>adm.values();
|
|
2085
2200
|
let splice = function(index, deleteCount, ...newItems) {
|
|
@@ -2126,22 +2241,128 @@ function createDiagnosticArray(adm) {
|
|
|
2126
2241
|
return 'symbol' == typeof name || Number.isNaN(Number.parseInt(name, 10)) ? target[name] = value : adm.set(Number.parseInt(name, 10), value), !0;
|
|
2127
2242
|
}
|
|
2128
2243
|
});
|
|
2129
|
-
return adm
|
|
2244
|
+
return proxies.set(adm, proxy), proxy;
|
|
2130
2245
|
}
|
|
2131
|
-
function
|
|
2246
|
+
function FileSystemDependencies_to_property_key(arg) {
|
|
2132
2247
|
var key = function(input, hint) {
|
|
2133
|
-
if ("object" !==
|
|
2248
|
+
if ("object" !== FileSystemDependencies_type_of(input) || null === input) return input;
|
|
2134
2249
|
var prim = input[Symbol.toPrimitive];
|
|
2135
2250
|
if (void 0 !== prim) {
|
|
2136
2251
|
var res = prim.call(input, hint || "default");
|
|
2137
|
-
if ("object" !==
|
|
2252
|
+
if ("object" !== FileSystemDependencies_type_of(res)) return res;
|
|
2138
2253
|
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
2139
2254
|
}
|
|
2140
2255
|
return ("string" === hint ? String : Number)(input);
|
|
2141
2256
|
}(arg, "string");
|
|
2142
|
-
return "symbol" ===
|
|
2257
|
+
return "symbol" === FileSystemDependencies_type_of(key) ? key : String(key);
|
|
2143
2258
|
}
|
|
2144
|
-
function
|
|
2259
|
+
function FileSystemDependencies_type_of(obj) {
|
|
2260
|
+
return obj && "u" > typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
2261
|
+
}
|
|
2262
|
+
let wrappers = new WeakMap();
|
|
2263
|
+
FileSystemDependencies_computedKey = FileSystemDependencies_to_property_key(Symbol.iterator), FileSystemDependencies_computedKey1 = FileSystemDependencies_to_property_key(Symbol.toStringTag), FileSystemDependencies_computedKey2 = FileSystemDependencies_to_property_key(node_util.inspect.custom);
|
|
2264
|
+
class FileSystemDependenciesWrapper {
|
|
2265
|
+
#inner;
|
|
2266
|
+
#pendingAdditions = new Set();
|
|
2267
|
+
#pendingDeletions = new Set();
|
|
2268
|
+
#flushScheduled = !1;
|
|
2269
|
+
constructor(inner){
|
|
2270
|
+
this.#inner = inner;
|
|
2271
|
+
}
|
|
2272
|
+
#scheduleFlush() {
|
|
2273
|
+
this.#flushScheduled || (this.#flushScheduled = !0, queueMicrotask(()=>{
|
|
2274
|
+
this.#flushScheduled = !1, this.#flush();
|
|
2275
|
+
}));
|
|
2276
|
+
}
|
|
2277
|
+
#flush() {
|
|
2278
|
+
if (0 === this.#pendingAdditions.size && 0 === this.#pendingDeletions.size) return;
|
|
2279
|
+
let additions = Array.from(this.#pendingAdditions), deletions = Array.from(this.#pendingDeletions);
|
|
2280
|
+
this.#pendingAdditions.clear(), this.#pendingDeletions.clear(), this.#inner.update(additions, deletions);
|
|
2281
|
+
}
|
|
2282
|
+
#getValues() {
|
|
2283
|
+
return this.#flush(), this.#inner.values();
|
|
2284
|
+
}
|
|
2285
|
+
get size() {
|
|
2286
|
+
return this.#flush(), this.#inner.size();
|
|
2287
|
+
}
|
|
2288
|
+
has(value) {
|
|
2289
|
+
return 'string' == typeof value && (this.#flush(), this.#inner.has(value));
|
|
2290
|
+
}
|
|
2291
|
+
add(value) {
|
|
2292
|
+
return this.#pendingDeletions.delete(value), this.#pendingAdditions.add(value), this.#scheduleFlush(), this;
|
|
2293
|
+
}
|
|
2294
|
+
addAll(deps) {
|
|
2295
|
+
for (let value of deps)this.add(value);
|
|
2296
|
+
}
|
|
2297
|
+
delete(value) {
|
|
2298
|
+
return !('string' != typeof value || this.#pendingDeletions.has(value)) && (!!this.#pendingAdditions.has(value) || !!this.#inner.has(value)) && (this.#pendingDeletions.add(value), this.#scheduleFlush(), !0);
|
|
2299
|
+
}
|
|
2300
|
+
clear() {
|
|
2301
|
+
this.#flush(), this.#inner.clear();
|
|
2302
|
+
}
|
|
2303
|
+
keys() {
|
|
2304
|
+
return this.values();
|
|
2305
|
+
}
|
|
2306
|
+
values() {
|
|
2307
|
+
return this.#getValues().values();
|
|
2308
|
+
}
|
|
2309
|
+
entries() {
|
|
2310
|
+
return this.#getValues().map((value)=>[
|
|
2311
|
+
value,
|
|
2312
|
+
value
|
|
2313
|
+
]).values();
|
|
2314
|
+
}
|
|
2315
|
+
*[FileSystemDependencies_computedKey]() {
|
|
2316
|
+
yield* this.#getValues();
|
|
2317
|
+
}
|
|
2318
|
+
forEach(callback, thisArg) {
|
|
2319
|
+
for (let value of this.#getValues())callback.call(thisArg, value, value, this);
|
|
2320
|
+
}
|
|
2321
|
+
get [FileSystemDependencies_computedKey1]() {
|
|
2322
|
+
return 'Set';
|
|
2323
|
+
}
|
|
2324
|
+
[FileSystemDependencies_computedKey2]() {
|
|
2325
|
+
return new Set(this.values());
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
for (let name of [
|
|
2329
|
+
'union',
|
|
2330
|
+
'intersection',
|
|
2331
|
+
'difference',
|
|
2332
|
+
'symmetricDifference',
|
|
2333
|
+
'isSubsetOf',
|
|
2334
|
+
'isSupersetOf',
|
|
2335
|
+
'isDisjointFrom'
|
|
2336
|
+
]){
|
|
2337
|
+
let method = Reflect.get(Set.prototype, name);
|
|
2338
|
+
'function' == typeof method && Object.defineProperty(FileSystemDependenciesWrapper.prototype, name, {
|
|
2339
|
+
configurable: !0,
|
|
2340
|
+
writable: !0,
|
|
2341
|
+
value (other) {
|
|
2342
|
+
return method.call(new Set(this.values()), other);
|
|
2343
|
+
}
|
|
2344
|
+
});
|
|
2345
|
+
}
|
|
2346
|
+
function createFileSystemDependencies(binding) {
|
|
2347
|
+
let cached = wrappers.get(binding);
|
|
2348
|
+
if (cached) return cached;
|
|
2349
|
+
let wrapper = new FileSystemDependenciesWrapper(binding);
|
|
2350
|
+
return wrappers.set(binding, wrapper), wrapper;
|
|
2351
|
+
}
|
|
2352
|
+
function Compilation_to_property_key(arg) {
|
|
2353
|
+
var key = function(input, hint) {
|
|
2354
|
+
if ("object" !== Compilation_type_of(input) || null === input) return input;
|
|
2355
|
+
var prim = input[Symbol.toPrimitive];
|
|
2356
|
+
if (void 0 !== prim) {
|
|
2357
|
+
var res = prim.call(input, hint || "default");
|
|
2358
|
+
if ("object" !== Compilation_type_of(res)) return res;
|
|
2359
|
+
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
2360
|
+
}
|
|
2361
|
+
return ("string" === hint ? String : Number)(input);
|
|
2362
|
+
}(arg, "string");
|
|
2363
|
+
return "symbol" === Compilation_type_of(key) ? key : String(key);
|
|
2364
|
+
}
|
|
2365
|
+
function Compilation_type_of(obj) {
|
|
2145
2366
|
return obj && "u" > typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
2146
2367
|
}
|
|
2147
2368
|
function normalizePathData(data = {}) {
|
|
@@ -2160,19 +2381,26 @@ function normalizePathData(data = {}) {
|
|
|
2160
2381
|
}
|
|
2161
2382
|
return pathData;
|
|
2162
2383
|
}
|
|
2163
|
-
let
|
|
2384
|
+
let logEntryTraceDescriptor = Object.getOwnPropertyDescriptor({
|
|
2385
|
+
get trace () {
|
|
2386
|
+
return cutOffLoaderExecution(Error('Trace').stack).split('\n').slice(3);
|
|
2387
|
+
}
|
|
2388
|
+
}, 'trace'), logEntryNoTraceDescriptor = Object.getOwnPropertyDescriptor({
|
|
2389
|
+
get trace () {}
|
|
2390
|
+
}, 'trace'), checkCompilation = (compilation)=>{
|
|
2164
2391
|
if (!(compilation instanceof Compilation)) throw TypeError('The \'compilation\' argument must be an instance of Compilation. This usually occurs when multiple versions of "@rspack/core" are used, or when the code in "@rspack/core" is executed multiple times.');
|
|
2165
2392
|
}, getOrCreateCompilationHooks = (compilation, key, createHooks)=>{
|
|
2166
2393
|
let compilationHooksMap = compilation[binding__default().COMPILATION_HOOKS_MAP_SYMBOL], hooks = compilationHooksMap.get(key);
|
|
2167
2394
|
return void 0 === hooks && (hooks = createHooks(), compilationHooksMap.set(key, hooks)), hooks;
|
|
2168
2395
|
};
|
|
2169
|
-
|
|
2396
|
+
Compilation_computedKey = Compilation_to_property_key(binding__default().COMPILATION_HOOKS_MAP_SYMBOL);
|
|
2170
2397
|
class Compilation {
|
|
2171
2398
|
#inner;
|
|
2172
2399
|
#shutdown;
|
|
2173
2400
|
#errors;
|
|
2174
2401
|
#warnings;
|
|
2175
2402
|
#chunks;
|
|
2403
|
+
#modules;
|
|
2176
2404
|
#assetsProxy;
|
|
2177
2405
|
hooks;
|
|
2178
2406
|
name;
|
|
@@ -2193,13 +2421,21 @@ class Compilation {
|
|
|
2193
2421
|
createSnapshot: ()=>null
|
|
2194
2422
|
};
|
|
2195
2423
|
needAdditionalPass;
|
|
2424
|
+
#fileSystemDependencies;
|
|
2196
2425
|
#addIncludeDispatcher;
|
|
2197
2426
|
#addEntryDispatcher;
|
|
2198
|
-
[
|
|
2427
|
+
[Compilation_computedKey];
|
|
2199
2428
|
constructor(compiler, inner){
|
|
2200
2429
|
var name, stage, getArgs;
|
|
2201
2430
|
let errorMessage, getOptions;
|
|
2202
|
-
this.#inner = inner
|
|
2431
|
+
this.#inner = inner;
|
|
2432
|
+
let fileSystemDependencies = this.#fileSystemDependencies = {
|
|
2433
|
+
fileDependencies: inner.fileDependencies,
|
|
2434
|
+
contextDependencies: inner.contextDependencies,
|
|
2435
|
+
missingDependencies: inner.missingDependencies,
|
|
2436
|
+
buildDependencies: inner.buildDependencies
|
|
2437
|
+
};
|
|
2438
|
+
this.fileDependencies = createFileSystemDependencies(fileSystemDependencies.fileDependencies), this.contextDependencies = createFileSystemDependencies(fileSystemDependencies.contextDependencies), this.missingDependencies = createFileSystemDependencies(fileSystemDependencies.missingDependencies), this.buildDependencies = createFileSystemDependencies(fileSystemDependencies.buildDependencies), this.#shutdown = !1;
|
|
2203
2439
|
let processAssetsHook = new AsyncSeriesHook([
|
|
2204
2440
|
'assets'
|
|
2205
2441
|
]);
|
|
@@ -2360,7 +2596,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2360
2596
|
});
|
|
2361
2597
|
}
|
|
2362
2598
|
get modules() {
|
|
2363
|
-
return new
|
|
2599
|
+
return this.#modules || (this.#modules = new ModulesWrapper(this.#inner.modules)), this.#modules;
|
|
2364
2600
|
}
|
|
2365
2601
|
get builtModules() {
|
|
2366
2602
|
return new Set(this.#inner.builtModules);
|
|
@@ -2500,19 +2736,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2500
2736
|
let logEntry = {
|
|
2501
2737
|
time: Date.now(),
|
|
2502
2738
|
type,
|
|
2503
|
-
args
|
|
2504
|
-
get trace () {
|
|
2505
|
-
switch(type){
|
|
2506
|
-
case LogType.warn:
|
|
2507
|
-
case LogType.error:
|
|
2508
|
-
case LogType.trace:
|
|
2509
|
-
return cutOffLoaderExecution(Error('Trace').stack).split('\n').slice(3);
|
|
2510
|
-
default:
|
|
2511
|
-
return;
|
|
2512
|
-
}
|
|
2513
|
-
}
|
|
2739
|
+
args
|
|
2514
2740
|
};
|
|
2515
|
-
void 0 === this.hooks.log.call(logName, logEntry) && (logEntry.type === LogType.profileEnd && 'function' == typeof console.profileEnd && console.profileEnd(`[${logName}] ${logEntry.args[0]}`), void 0 === logEntries && void 0 === (logEntries = this.logging.get(logName)) && (logEntries = [], this.logging.set(logName, logEntries)), logEntries.push(logEntry), logEntry.type === LogType.profile && 'function' == typeof console.profile && console.profile(`[${logName}] ${logEntry.args[0]}`));
|
|
2741
|
+
Object.defineProperty(logEntry, 'trace', type === LogType.warn || type === LogType.error || type === LogType.trace ? logEntryTraceDescriptor : logEntryNoTraceDescriptor), void 0 === this.hooks.log.call(logName, logEntry) && (logEntry.type === LogType.profileEnd && 'function' == typeof console.profileEnd && console.profileEnd(`[${logName}] ${logEntry.args[0]}`), void 0 === logEntries && void 0 === (logEntries = this.logging.get(logName)) && (logEntries = [], this.logging.set(logName, logEntries)), logEntries.push(logEntry), logEntry.type === LogType.profile && 'function' == typeof console.profile && console.profile(`[${logName}] ${logEntry.args[0]}`));
|
|
2516
2742
|
}, (childName)=>{
|
|
2517
2743
|
let normalizedChildName = childName;
|
|
2518
2744
|
return 'function' == typeof logName ? 'function' == typeof normalizedChildName ? this.getLogger(()=>{
|
|
@@ -2528,28 +2754,28 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
2528
2754
|
}) : this.getLogger(`${logName}/${normalizedChildName}`);
|
|
2529
2755
|
});
|
|
2530
2756
|
}
|
|
2531
|
-
fileDependencies = createFakeCompilationDependencies(()=>this.#inner.dependencies().fileDependencies, (d)=>this.#inner.addFileDependencies(d));
|
|
2532
2757
|
get __internal__addedFileDependencies() {
|
|
2533
|
-
return this.#
|
|
2758
|
+
return this.#fileSystemDependencies.fileDependencies.added;
|
|
2534
2759
|
}
|
|
2535
2760
|
get __internal__removedFileDependencies() {
|
|
2536
|
-
return this.#
|
|
2761
|
+
return this.#fileSystemDependencies.fileDependencies.removed;
|
|
2537
2762
|
}
|
|
2538
2763
|
get __internal__addedContextDependencies() {
|
|
2539
|
-
return this.#
|
|
2764
|
+
return this.#fileSystemDependencies.contextDependencies.added;
|
|
2540
2765
|
}
|
|
2541
2766
|
get __internal__removedContextDependencies() {
|
|
2542
|
-
return this.#
|
|
2767
|
+
return this.#fileSystemDependencies.contextDependencies.removed;
|
|
2543
2768
|
}
|
|
2544
2769
|
get __internal__addedMissingDependencies() {
|
|
2545
|
-
return this.#
|
|
2770
|
+
return this.#fileSystemDependencies.missingDependencies.added;
|
|
2546
2771
|
}
|
|
2547
2772
|
get __internal__removedMissingDependencies() {
|
|
2548
|
-
return this.#
|
|
2773
|
+
return this.#fileSystemDependencies.missingDependencies.removed;
|
|
2549
2774
|
}
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2775
|
+
fileDependencies;
|
|
2776
|
+
contextDependencies;
|
|
2777
|
+
missingDependencies;
|
|
2778
|
+
buildDependencies;
|
|
2553
2779
|
getStats() {
|
|
2554
2780
|
return new Stats(this);
|
|
2555
2781
|
}
|
|
@@ -2676,7 +2902,7 @@ class EntryData {
|
|
|
2676
2902
|
this.dependencies = binding.dependencies, this.includeDependencies = binding.includeDependencies, this.options = binding.options;
|
|
2677
2903
|
}
|
|
2678
2904
|
}
|
|
2679
|
-
|
|
2905
|
+
Compilation_computedKey1 = Compilation_to_property_key(Symbol.iterator), Compilation_computedKey2 = Compilation_to_property_key(Symbol.toStringTag);
|
|
2680
2906
|
class Entries {
|
|
2681
2907
|
#data;
|
|
2682
2908
|
constructor(data){
|
|
@@ -2703,10 +2929,10 @@ class Entries {
|
|
|
2703
2929
|
values() {
|
|
2704
2930
|
return this.#data.values().map(EntryData.__from_binding)[Symbol.iterator]();
|
|
2705
2931
|
}
|
|
2706
|
-
[
|
|
2932
|
+
[Compilation_computedKey1]() {
|
|
2707
2933
|
return this.entries();
|
|
2708
2934
|
}
|
|
2709
|
-
[
|
|
2935
|
+
[Compilation_computedKey2] = 'Map';
|
|
2710
2936
|
has(key) {
|
|
2711
2937
|
return this.#data.has(key);
|
|
2712
2938
|
}
|
|
@@ -2904,43 +3130,7 @@ let ContextReplacementPlugin = base_create(binding_.BuiltinPluginName.ContextRep
|
|
|
2904
3130
|
cssIndex && splitChunks.defaultSizeTypes.splice(cssIndex, 1);
|
|
2905
3131
|
}
|
|
2906
3132
|
return options;
|
|
2907
|
-
}), CssHttpExternalsRspackPlugin = base_create(binding_.BuiltinPluginName.CssHttpExternalsRspackPlugin, ()=>void 0), CssModulesPlugin = base_create(binding_.BuiltinPluginName.CssModulesPlugin, ()=>{}, 'compilation');
|
|
2908
|
-
Object.defineProperty(binding__default().NormalModule.prototype, 'identifier', {
|
|
2909
|
-
enumerable: !0,
|
|
2910
|
-
configurable: !0,
|
|
2911
|
-
value () {
|
|
2912
|
-
return this[binding__default().MODULE_IDENTIFIER_SYMBOL];
|
|
2913
|
-
}
|
|
2914
|
-
}), Object.defineProperty(binding__default().NormalModule.prototype, 'originalSource', {
|
|
2915
|
-
enumerable: !0,
|
|
2916
|
-
configurable: !0,
|
|
2917
|
-
value () {
|
|
2918
|
-
let originalSource = this._originalSource();
|
|
2919
|
-
return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
|
|
2920
|
-
}
|
|
2921
|
-
}), Object.defineProperty(binding__default().NormalModule.prototype, 'emitFile', {
|
|
2922
|
-
enumerable: !0,
|
|
2923
|
-
configurable: !0,
|
|
2924
|
-
value (filename, source, assetInfo) {
|
|
2925
|
-
return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
|
|
2926
|
-
}
|
|
2927
|
-
}), Object.defineProperty(binding__default().NormalModule, 'getCompilationHooks', {
|
|
2928
|
-
enumerable: !0,
|
|
2929
|
-
configurable: !0,
|
|
2930
|
-
value (compilation) {
|
|
2931
|
-
if (!(binding__default().COMPILATION_HOOKS_MAP_SYMBOL in compilation)) throw TypeError("The 'compilation' argument must be an instance of Compilation");
|
|
2932
|
-
return getOrCreateCompilationHooks(compilation, compilation, ()=>({
|
|
2933
|
-
loader: new SyncHook([
|
|
2934
|
-
'loaderContext',
|
|
2935
|
-
'module'
|
|
2936
|
-
]),
|
|
2937
|
-
readResource: new HookMap(()=>new AsyncSeriesBailHook([
|
|
2938
|
-
'loaderContext'
|
|
2939
|
-
]))
|
|
2940
|
-
}));
|
|
2941
|
-
}
|
|
2942
|
-
});
|
|
2943
|
-
let utils_PLUGIN_NAME = 'css-extract-rspack-plugin', utils_pluginSymbol = Symbol.for(utils_PLUGIN_NAME), DEFAULT_FILENAME = '[name].css', LOADER_PATH = join(import.meta.dirname, 'cssExtractLoader.js');
|
|
3133
|
+
}), CssHttpExternalsRspackPlugin = base_create(binding_.BuiltinPluginName.CssHttpExternalsRspackPlugin, ()=>void 0), CssModulesPlugin = base_create(binding_.BuiltinPluginName.CssModulesPlugin, ()=>{}, 'compilation'), utils_PLUGIN_NAME = 'css-extract-rspack-plugin', utils_pluginSymbol = Symbol.for(utils_PLUGIN_NAME), DEFAULT_FILENAME = '[name].css', LOADER_PATH = join(import.meta.dirname, 'cssExtractLoader.js');
|
|
2944
3134
|
class CssExtractRspackPlugin {
|
|
2945
3135
|
static pluginName = utils_PLUGIN_NAME;
|
|
2946
3136
|
static loader = LOADER_PATH;
|
|
@@ -2950,11 +3140,9 @@ class CssExtractRspackPlugin {
|
|
|
2950
3140
|
}
|
|
2951
3141
|
apply(compiler) {
|
|
2952
3142
|
compiler.hooks.thisCompilation.tap(utils_PLUGIN_NAME, (compilation)=>{
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
};
|
|
2957
|
-
});
|
|
3143
|
+
compilation[utils_pluginSymbol] = {
|
|
3144
|
+
runtime: !1 !== this.options.runtime
|
|
3145
|
+
};
|
|
2958
3146
|
});
|
|
2959
3147
|
let { splitChunks } = compiler.options.optimization;
|
|
2960
3148
|
splitChunks && splitChunks.defaultSizeTypes.includes('...') && splitChunks.defaultSizeTypes.push('css/mini-extract'), compiler.options.output.pathinfo && void 0 === this.options.pathinfo && (this.options.pathinfo = !0), compiler.__internal__registerBuiltinPlugin({
|
|
@@ -3139,6 +3327,8 @@ class SplitChunksPlugin extends RspackBuiltinPlugin {
|
|
|
3139
3327
|
}
|
|
3140
3328
|
function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler, enableNameBatch = !1) {
|
|
3141
3329
|
if (!sc) return;
|
|
3330
|
+
let { dedupDepth } = sc;
|
|
3331
|
+
if (void 0 !== dedupDepth && (!Number.isInteger(dedupDepth) || dedupDepth < 0 || dedupDepth > 0xffffffff)) throw Error(`Invalid Rspack configuration: "optimization.splitChunks.dedupDepth" must be an integer between 0 and 4294967295, get \`${dedupDepth}\`.`);
|
|
3142
3332
|
function getName(name) {
|
|
3143
3333
|
if ('function' == typeof name) {
|
|
3144
3334
|
var name1;
|
|
@@ -3203,7 +3393,8 @@ function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler, enableNameBatch
|
|
|
3203
3393
|
maxSize: JsSplitChunkSizes.__to_binding(maxSize),
|
|
3204
3394
|
maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
|
|
3205
3395
|
maxInitialSize: JsSplitChunkSizes.__to_binding(maxInitialSize),
|
|
3206
|
-
...passThrough
|
|
3396
|
+
...passThrough,
|
|
3397
|
+
dedupDepth: dedupDepth ?? +('development' !== compiler.options.mode && 'none' !== compiler.options.mode)
|
|
3207
3398
|
};
|
|
3208
3399
|
}
|
|
3209
3400
|
let EnableLibraryPlugin_enabledTypes = new WeakMap(), EnableLibraryPlugin_getEnabledTypes = (compiler)=>{
|
|
@@ -3233,7 +3424,7 @@ class EnableLibraryPlugin extends RspackBuiltinPlugin {
|
|
|
3233
3424
|
}
|
|
3234
3425
|
let EnableWasmLoadingPlugin = base_create(binding_.BuiltinPluginName.EnableWasmLoadingPlugin, (type)=>type), EnsureChunkConditionsPlugin = base_create(binding_.BuiltinPluginName.EnsureChunkConditionsPlugin, ()=>{}), RemoveDuplicateModulesPlugin_RemoveDuplicateModulesPlugin = base_create(binding_.BuiltinPluginName.RemoveDuplicateModulesPlugin, ()=>({}));
|
|
3235
3426
|
function applyLimits(options, logger) {
|
|
3236
|
-
if (options.optimization.concatenateModules = !1, options.
|
|
3427
|
+
if (options.optimization.concatenateModules = !1, options.output.chunkFormat = !1, options.output.module = !0, options.output.chunkLoading && 'import' !== options.output.chunkLoading && (options.output.chunkLoading = 'import'), void 0 === options.output.chunkLoading && (options.output.chunkLoading = 'import'), logger && 'string' == typeof options.devtool) {
|
|
3237
3428
|
let fallbackDevtool, previousDevtool = options.devtool;
|
|
3238
3429
|
'eval' === previousDevtool ? fallbackDevtool = !1 : previousDevtool.startsWith('eval-') && previousDevtool.includes('source-map') && (fallbackDevtool = previousDevtool.slice(5)), void 0 !== fallbackDevtool && (options.devtool = fallbackDevtool, logger.warn(`\`devtool: "${previousDevtool}"\` is not supported with \`library.type: "modern-module"\` because its modules are rendered as top-level code. Rspack has changed \`devtool\` to \`${JSON.stringify(fallbackDevtool)}\`.`));
|
|
3239
3430
|
}
|
|
@@ -3264,15 +3455,21 @@ let unsupported = (name, issue)=>{
|
|
|
3264
3455
|
function deprecate(message) {
|
|
3265
3456
|
warnedMessages.has(message) || (warnedMessages.add(message), console.warn(`[Rspack Deprecation] ${message}`));
|
|
3266
3457
|
}
|
|
3267
|
-
let WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g,
|
|
3458
|
+
let WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, getWindowsDosDevicePathPrefixLength = (identifier)=>{
|
|
3459
|
+
if (identifier.length >= 4 && 92 === identifier.charCodeAt(0) && 92 === identifier.charCodeAt(1) && 92 === identifier.charCodeAt(3)) {
|
|
3460
|
+
let namespace = identifier.charCodeAt(2);
|
|
3461
|
+
if (63 === namespace || 46 === namespace) return 4;
|
|
3462
|
+
}
|
|
3463
|
+
return 0;
|
|
3464
|
+
}, isWindowsAbsolutePath = (identifier)=>WINDOWS_ABS_PATH_REGEXP.test(identifier) || 0 !== getWindowsDosDevicePathPrefixLength(identifier), getQuerySplitPosition = (identifier)=>identifier.indexOf('?', getWindowsDosDevicePathPrefixLength(identifier)), relativePathToRequest = (relativePath)=>'' === relativePath ? './.' : '..' === relativePath ? '../.' : relativePath.startsWith('../') ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
|
|
3268
3465
|
if ('/' === maybeAbsolutePath[0]) {
|
|
3269
3466
|
if (maybeAbsolutePath.length > 1 && '/' === maybeAbsolutePath[maybeAbsolutePath.length - 1]) return maybeAbsolutePath;
|
|
3270
|
-
let querySplitPos = maybeAbsolutePath
|
|
3467
|
+
let querySplitPos = getQuerySplitPosition(maybeAbsolutePath), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
|
|
3271
3468
|
return resource = relativePathToRequest(node_path.posix.relative(context, resource)), -1 === querySplitPos ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
|
|
3272
3469
|
}
|
|
3273
|
-
if (
|
|
3274
|
-
let querySplitPos = maybeAbsolutePath
|
|
3275
|
-
return resource = node_path.win32.relative(context, resource)
|
|
3470
|
+
if (isWindowsAbsolutePath(maybeAbsolutePath)) {
|
|
3471
|
+
let querySplitPos = getQuerySplitPosition(maybeAbsolutePath), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
|
|
3472
|
+
return isWindowsAbsolutePath(resource = node_path.win32.relative(context, resource)) || (resource = relativePathToRequest(resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, '/'))), -1 === querySplitPos ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
|
|
3276
3473
|
}
|
|
3277
3474
|
return maybeAbsolutePath;
|
|
3278
3475
|
}, makeCacheable = (realFn)=>{
|
|
@@ -3330,14 +3527,15 @@ let WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])
|
|
|
3330
3527
|
};
|
|
3331
3528
|
}, cachedFn;
|
|
3332
3529
|
}, makePathsRelative = makeCacheableWithContext((context, identifier)=>identifier.split(SEGMENTS_SPLIT_REGEXP).map((str)=>absoluteToRequest(context, str)).join('')), contextify = makeCacheableWithContext((context, request)=>request.split('!').map((r)=>absoluteToRequest(context, r)).join('!')), absolutify = makeCacheableWithContext((context, request)=>request.split('!').map((r)=>r.startsWith('./') || r.startsWith('../') ? node_path.join(context, r) : r).join('!')), PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/, PATH_QUERY_REGEXP = /^((?:\u200b.|[^?\u200b])*)(\?.*)?$/, parseResource = makeCacheable(function(str) {
|
|
3333
|
-
|
|
3530
|
+
let prefixLength = getWindowsDosDevicePathPrefixLength(str), resource = str.slice(prefixLength);
|
|
3531
|
+
if (!resource.includes('?') && !resource.includes('#') && !resource.includes('\u200b')) return {
|
|
3334
3532
|
path: str,
|
|
3335
3533
|
query: '',
|
|
3336
3534
|
fragment: ''
|
|
3337
3535
|
};
|
|
3338
|
-
let match = PATH_QUERY_FRAGMENT_REGEXP.exec(
|
|
3536
|
+
let match = PATH_QUERY_FRAGMENT_REGEXP.exec(resource);
|
|
3339
3537
|
return match ? {
|
|
3340
|
-
path: match[1].replace(/\u200b(.)/g, '$1'),
|
|
3538
|
+
path: str.slice(0, prefixLength) + match[1].replace(/\u200b(.)/g, '$1'),
|
|
3341
3539
|
query: match[2] ? match[2].replace(/\u200b(.)/g, '$1') : '',
|
|
3342
3540
|
fragment: match[3] || ''
|
|
3343
3541
|
} : {
|
|
@@ -3346,16 +3544,16 @@ let WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])
|
|
|
3346
3544
|
fragment: ''
|
|
3347
3545
|
};
|
|
3348
3546
|
}), parseResourceWithoutFragment = makeCacheable((str)=>{
|
|
3349
|
-
let match = PATH_QUERY_REGEXP.exec(str);
|
|
3547
|
+
let prefixLength = getWindowsDosDevicePathPrefixLength(str), match = PATH_QUERY_REGEXP.exec(str.slice(prefixLength));
|
|
3350
3548
|
return {
|
|
3351
|
-
path: match[1].replace(/\u200b(.)/g, '$1'),
|
|
3549
|
+
path: str.slice(0, prefixLength) + match[1].replace(/\u200b(.)/g, '$1'),
|
|
3352
3550
|
query: match[2] ? match[2].replace(/\u200b(.)/g, '$1') : ''
|
|
3353
3551
|
};
|
|
3354
3552
|
});
|
|
3355
3553
|
function isStatsColorSupported() {
|
|
3356
3554
|
if ("u" < typeof process) return !1;
|
|
3357
3555
|
let env = process.env ?? {}, argv = process.argv ?? [];
|
|
3358
|
-
return !('NO_COLOR' in env || argv.includes('--no-color')) && ('FORCE_COLOR' in env || argv.includes('--color') || 'win32' === process.platform || process.stdout?.isTTY && 'dumb' !== env.TERM ||
|
|
3556
|
+
return !('NO_COLOR' in env || argv.includes('--no-color')) && ('FORCE_COLOR' in env || argv.includes('--color') || 'win32' === process.platform || process.stdout?.isTTY && 'dumb' !== env.TERM || !!env.CI && 'false' !== env.CI);
|
|
3359
3557
|
}
|
|
3360
3558
|
function encodeVersion(version) {
|
|
3361
3559
|
let [major, minor = 0, patch = 0] = version.split('-')[0].split('.').map((v)=>parseInt(v, 10));
|
|
@@ -3494,7 +3692,7 @@ function createRawModuleRuleUses(uses, path, options) {
|
|
|
3494
3692
|
...uses
|
|
3495
3693
|
].map(normalizeRuleSetUseItem) : [
|
|
3496
3694
|
normalizeRuleSetUseItem(uses)
|
|
3497
|
-
], path1 = path, options1 = options, uses1.length ? uses1.filter(
|
|
3695
|
+
], path1 = path, options1 = options, uses1.length ? uses1.filter((use)=>!!use).map((use, index)=>{
|
|
3498
3696
|
let o, fingerprintOptions = use.options, isBuiltin = !1;
|
|
3499
3697
|
if (use.loader.startsWith(BUILTIN_LOADER_PREFIX)) {
|
|
3500
3698
|
let temp = function(identifier, o, options) {
|
|
@@ -3539,7 +3737,9 @@ function createRawModuleRuleUses(uses, path, options) {
|
|
|
3539
3737
|
})(o, options);
|
|
3540
3738
|
if (identifier.startsWith(`${BUILTIN_LOADER_PREFIX}lightningcss-loader`)) {
|
|
3541
3739
|
let options1;
|
|
3542
|
-
return 'object' == typeof (options1 =
|
|
3740
|
+
return 'object' == typeof (options1 = 'object' == typeof o && null !== o ? {
|
|
3741
|
+
...o
|
|
3742
|
+
} : o ?? {}) && ('string' == typeof options1.targets ? options1.targets = [
|
|
3543
3743
|
options1.targets
|
|
3544
3744
|
] : 'object' != typeof options1.targets || Array.isArray(options1.targets) ? void 0 === options1.targets && options.compiler.target?.targets && (options1.targets = defaultTargetsFromRspackTargets(options.compiler.target.targets)) : options1.targets = encodeTargets(options1.targets), options1.include && 'object' == typeof options1.include && (options1.include = toFeatures(options1.include)), options1.exclude && 'object' == typeof options1.exclude && (options1.exclude = toFeatures(options1.exclude))), options1;
|
|
3545
3745
|
}
|
|
@@ -3548,13 +3748,13 @@ function createRawModuleRuleUses(uses, path, options) {
|
|
|
3548
3748
|
fingerprintOptions = temp, o = isNil(temp) ? void 0 : 'string' == typeof temp ? temp : JSON.stringify(temp, null, 2), isBuiltin = !0;
|
|
3549
3749
|
}
|
|
3550
3750
|
return {
|
|
3551
|
-
loader: function(use, path, compiler, isBuiltin) {
|
|
3751
|
+
loader: function(use, path, compiler, isBuiltin, normalizedOptions) {
|
|
3552
3752
|
let obj = parseResource(use.loader), ident = use.ident;
|
|
3553
3753
|
null === use.options || void 0 === use.options || ('string' == typeof use.options ? obj.query = `?${use.options}` : use.ident ? obj.query = `??${ident = use.ident}` : 'object' == typeof use.options && use.options.ident ? obj.query = `??${ident = use.options.ident}` : 'object' == typeof use.options ? obj.query = `??${ident = path}` : obj.query = `?${JSON.stringify(use.options)}`);
|
|
3554
3754
|
let parallelism = use.parallel;
|
|
3555
3755
|
if (parallelism && (!use.options || 'object' != typeof use.options)) throw Error(`\`Rule.use.parallel\` requires \`Rule.use.options\` to be an object.\nHowever the received value is \`${use.options}\` under option path \`${path}\`\nInternally, parallelism is provided by passing \`Rule.use.ident\` to the loader as an identifier to ident the parallelism option\nYou can either replace the \`Rule.use.loader\` with \`Rule.use.options = {}\` or remove \`Rule.use.parallel\`.`);
|
|
3556
|
-
return use.options && 'object' == typeof use.options && (ident || (ident = '[[missing ident]]'), compiler.__internal__ruleSet.references.set(ident, use.options), compiler.__internal__ruleSet.references.set(`${ident}$$parallelism`, parallelism), isBuiltin && compiler.__internal__ruleSet.builtinReferences.set(ident,
|
|
3557
|
-
}(use, `${path1}[${index}]`, options1.compiler, isBuiltin),
|
|
3756
|
+
return use.options && 'object' == typeof use.options && (ident || (ident = '[[missing ident]]'), compiler.__internal__ruleSet.references.set(ident, use.options), compiler.__internal__ruleSet.references.set(`${ident}$$parallelism`, parallelism), isBuiltin && compiler.__internal__ruleSet.builtinReferences.set(ident, normalizedOptions)), obj.path + obj.query + obj.fragment;
|
|
3757
|
+
}(use, `${path1}[${index}]`, options1.compiler, isBuiltin, fingerprintOptions),
|
|
3558
3758
|
options: o,
|
|
3559
3759
|
cache: use.cache ?? !1,
|
|
3560
3760
|
optionsCacheKey: use.cache ? JSON.stringify(fingerprintOptions) ?? '' : ''
|
|
@@ -3594,7 +3794,7 @@ function getRawResolve(resolve) {
|
|
|
3594
3794
|
if (void 0 === tsConfig) return tsConfig;
|
|
3595
3795
|
let { configFile, references } = tsConfig;
|
|
3596
3796
|
return {
|
|
3597
|
-
configFile,
|
|
3797
|
+
configFile: node_path.resolve(configFile),
|
|
3598
3798
|
referencesType: 'auto' === references ? 'auto' : references ? 'manual' : 'disabled',
|
|
3599
3799
|
references: 'auto' === references ? void 0 : references
|
|
3600
3800
|
};
|
|
@@ -3955,7 +4155,7 @@ class ExternalsPlugin extends RspackBuiltinPlugin {
|
|
|
3955
4155
|
#getRawExternalItem = (item)=>{
|
|
3956
4156
|
if ('string' == typeof item || item instanceof RegExp) return item;
|
|
3957
4157
|
if ('function' == typeof item) {
|
|
3958
|
-
let processResolveResult = this.#processResolveResult;
|
|
4158
|
+
let processResolveResult = this.#processResolveResult, processRequest = this.#processRequest;
|
|
3959
4159
|
return async (ctx)=>new Promise((resolve, reject)=>{
|
|
3960
4160
|
let data = ctx.data(), promise = item({
|
|
3961
4161
|
request: data.request,
|
|
@@ -3967,13 +4167,13 @@ class ExternalsPlugin extends RspackBuiltinPlugin {
|
|
|
3967
4167
|
},
|
|
3968
4168
|
getResolve: (options)=>{
|
|
3969
4169
|
let rawResolve = options ? getRawResolve(options) : void 0, resolve = ctx.getResolve(rawResolve);
|
|
3970
|
-
return (context, request, callback)
|
|
4170
|
+
return function(context, request, callback) {
|
|
3971
4171
|
if (!callback) return new Promise((promiseResolve, promiseReject)=>{
|
|
3972
4172
|
resolve(context, request, (error, text)=>{
|
|
3973
4173
|
if (error) promiseReject(error);
|
|
3974
4174
|
else {
|
|
3975
4175
|
let req = processResolveResult(text);
|
|
3976
|
-
promiseResolve(req ?
|
|
4176
|
+
promiseResolve(req ? processRequest(req) : void 0);
|
|
3977
4177
|
}
|
|
3978
4178
|
});
|
|
3979
4179
|
});
|
|
@@ -3981,7 +4181,7 @@ class ExternalsPlugin extends RspackBuiltinPlugin {
|
|
|
3981
4181
|
if (error) callback(error);
|
|
3982
4182
|
else {
|
|
3983
4183
|
let req = processResolveResult(text);
|
|
3984
|
-
callback(null, !!req &&
|
|
4184
|
+
callback(null, !!req && processRequest(req), req);
|
|
3985
4185
|
}
|
|
3986
4186
|
});
|
|
3987
4187
|
};
|
|
@@ -4048,9 +4248,9 @@ let HttpExternalsRspackPlugin = base_create(binding_.BuiltinPluginName.HttpExter
|
|
|
4048
4248
|
}, memoizeFn = (fn)=>{
|
|
4049
4249
|
let cache = null;
|
|
4050
4250
|
return (...args)=>(cache || (cache = fn()), cache(...args));
|
|
4051
|
-
}, getHttp = memoize(()=>
|
|
4251
|
+
}, getHttp = memoize(()=>rspackRequire("node:http")), getHttps = memoize(()=>rspackRequire("node:https")), defaultHttpClientForNode = async (url, headers)=>{
|
|
4052
4252
|
let { res, body } = await function(url, options) {
|
|
4053
|
-
let send = 'https:' === new URL(url).protocol ? getHttps() : getHttp(), { createBrotliDecompress, createGunzip, createInflate } =
|
|
4253
|
+
let send = 'https:' === new URL(url).protocol ? getHttps() : getHttp(), { createBrotliDecompress, createGunzip, createInflate } = rspackRequire("node:zlib");
|
|
4054
4254
|
return new Promise((resolve, reject)=>{
|
|
4055
4255
|
send.get(url, options, (res)=>{
|
|
4056
4256
|
let contentEncoding = res.headers['content-encoding'], stream = res;
|
|
@@ -4090,6 +4290,7 @@ class HttpUriPlugin extends RspackBuiltinPlugin {
|
|
|
4090
4290
|
lockfileLocation,
|
|
4091
4291
|
cacheLocation,
|
|
4092
4292
|
upgrade: options.upgrade ?? !1,
|
|
4293
|
+
frozen: options.frozen ?? !1,
|
|
4093
4294
|
httpClient: options.httpClient ?? defaultHttpClientForNode
|
|
4094
4295
|
};
|
|
4095
4296
|
return createBuiltinPlugin(this.name, raw);
|
|
@@ -4326,7 +4527,47 @@ let knownBuildInfoFields = new Set([
|
|
|
4326
4527
|
'contextDependencies',
|
|
4327
4528
|
'missingDependencies',
|
|
4328
4529
|
'buildDependencies'
|
|
4329
|
-
])
|
|
4530
|
+
]), pickCustomBuildInfoFields = (buildInfo)=>{
|
|
4531
|
+
if (!buildInfo) return {};
|
|
4532
|
+
let custom = {};
|
|
4533
|
+
for (let key of Object.keys(buildInfo))knownBuildInfoFields.has(key) || (custom[key] = buildInfo[key]);
|
|
4534
|
+
return custom;
|
|
4535
|
+
};
|
|
4536
|
+
Object.defineProperty(binding__default().NormalModule.prototype, 'identifier', {
|
|
4537
|
+
enumerable: !0,
|
|
4538
|
+
configurable: !0,
|
|
4539
|
+
value () {
|
|
4540
|
+
return this[binding__default().MODULE_IDENTIFIER_SYMBOL];
|
|
4541
|
+
}
|
|
4542
|
+
}), Object.defineProperty(binding__default().NormalModule.prototype, 'originalSource', {
|
|
4543
|
+
enumerable: !0,
|
|
4544
|
+
configurable: !0,
|
|
4545
|
+
value () {
|
|
4546
|
+
let originalSource = this._originalSource();
|
|
4547
|
+
return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
|
|
4548
|
+
}
|
|
4549
|
+
}), Object.defineProperty(binding__default().NormalModule.prototype, 'emitFile', {
|
|
4550
|
+
enumerable: !0,
|
|
4551
|
+
configurable: !0,
|
|
4552
|
+
value (filename, source, assetInfo) {
|
|
4553
|
+
return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
|
|
4554
|
+
}
|
|
4555
|
+
}), Object.defineProperty(binding__default().NormalModule, 'getCompilationHooks', {
|
|
4556
|
+
enumerable: !0,
|
|
4557
|
+
configurable: !0,
|
|
4558
|
+
value (compilation) {
|
|
4559
|
+
if (!(binding__default().COMPILATION_HOOKS_MAP_SYMBOL in compilation)) throw TypeError("The 'compilation' argument must be an instance of Compilation");
|
|
4560
|
+
return getOrCreateCompilationHooks(compilation, compilation, ()=>({
|
|
4561
|
+
loader: new SyncHook([
|
|
4562
|
+
'loaderContext',
|
|
4563
|
+
'module'
|
|
4564
|
+
]),
|
|
4565
|
+
readResource: new HookMap(()=>new AsyncSeriesBailHook([
|
|
4566
|
+
'loaderContext'
|
|
4567
|
+
]))
|
|
4568
|
+
}));
|
|
4569
|
+
}
|
|
4570
|
+
});
|
|
4330
4571
|
class NonErrorEmittedError extends Error {
|
|
4331
4572
|
constructor(error){
|
|
4332
4573
|
super(), this.name = 'NonErrorEmittedError', this.message = `(Emitted value instead of an instance of Error) ${error}`;
|
|
@@ -4470,7 +4711,6 @@ class Hash {
|
|
|
4470
4711
|
throw new AbstractMethodError();
|
|
4471
4712
|
}
|
|
4472
4713
|
}
|
|
4473
|
-
let MAX_SHORT_STRING = -4 & Math.floor(16368);
|
|
4474
4714
|
class WasmHash {
|
|
4475
4715
|
exports;
|
|
4476
4716
|
instancesPool;
|
|
@@ -4488,7 +4728,7 @@ class WasmHash {
|
|
|
4488
4728
|
update(data, encoding) {
|
|
4489
4729
|
if ('string' == typeof data) {
|
|
4490
4730
|
let normalizedData = data;
|
|
4491
|
-
for(; normalizedData.length >
|
|
4731
|
+
for(; normalizedData.length > 16368;)this._updateWithShortString(normalizedData.slice(0, 16368), encoding), normalizedData = normalizedData.slice(16368);
|
|
4492
4732
|
return this._updateWithShortString(normalizedData, encoding), this;
|
|
4493
4733
|
}
|
|
4494
4734
|
return this._updateWithBuffer(data), this;
|
|
@@ -4611,12 +4851,12 @@ let createHash_createHash = (algorithm)=>{
|
|
|
4611
4851
|
})());
|
|
4612
4852
|
case 'native-md4':
|
|
4613
4853
|
return new BulkUpdateDecorator(()=>{
|
|
4614
|
-
let { createHash } =
|
|
4854
|
+
let { createHash } = rspackRequire("node:crypto");
|
|
4615
4855
|
return createHash('md4');
|
|
4616
4856
|
}, 'md4');
|
|
4617
4857
|
default:
|
|
4618
4858
|
return new BulkUpdateDecorator(()=>{
|
|
4619
|
-
let { createHash } =
|
|
4859
|
+
let { createHash } = rspackRequire("node:crypto");
|
|
4620
4860
|
return createHash(algorithm);
|
|
4621
4861
|
}, algorithm);
|
|
4622
4862
|
}
|
|
@@ -4651,20 +4891,30 @@ class LoaderCache {
|
|
|
4651
4891
|
let context = this.#context, loader = context.loaderItems[loaderIndex];
|
|
4652
4892
|
if (!context.cacheable || !loader || isNil(content) || !isNil(additionalData) || Object.keys(context.__internal__parseMeta).length > 0 || this.#dependencies.contextDependencies().length > 0 || this.#dependencies.missingDependencies().length > 0) return;
|
|
4653
4893
|
let hit = await this.#api.get(loaderIndex, content, this.#dependencies.existing);
|
|
4654
|
-
return hit && this.#dependencies.addDependencies(hit.addedDependencies), hit;
|
|
4894
|
+
return hit && (this.#dependencies.addDependencies(hit.addedDependencies), Object.assign(context.__internal__parseMeta, hit.parseMeta)), hit;
|
|
4655
4895
|
}
|
|
4656
4896
|
async store(loaderIndex, content, sourceMap, additionalData) {
|
|
4657
4897
|
let context = this.#context;
|
|
4658
|
-
context.cacheable && isNil(additionalData) &&
|
|
4898
|
+
context.cacheable && isNil(additionalData) && await this.#api.store(loaderIndex, {
|
|
4659
4899
|
content: isNil(content) ? null : content,
|
|
4660
4900
|
sourceMap,
|
|
4661
4901
|
addedDependencies: this.#dependencies.added,
|
|
4662
|
-
removedDependencies: this.#dependencies.removed
|
|
4902
|
+
removedDependencies: this.#dependencies.removed,
|
|
4903
|
+
parseMeta: {
|
|
4904
|
+
...context.__internal__parseMeta
|
|
4905
|
+
}
|
|
4663
4906
|
});
|
|
4664
4907
|
}
|
|
4665
4908
|
async workerGet(loaderIndex, content, additionalData) {
|
|
4666
4909
|
let hit = await this.get(loaderIndex, content, additionalData);
|
|
4667
|
-
|
|
4910
|
+
return void 0 === hit ? {
|
|
4911
|
+
type: 'disabled'
|
|
4912
|
+
} : null === hit ? {
|
|
4913
|
+
type: 'miss'
|
|
4914
|
+
} : {
|
|
4915
|
+
type: 'hit',
|
|
4916
|
+
entry: hit
|
|
4917
|
+
};
|
|
4668
4918
|
}
|
|
4669
4919
|
async workerStore(loaderIndex, content, sourceMap, additionalData) {
|
|
4670
4920
|
await this.store(loaderIndex, content, sourceMap, additionalData);
|
|
@@ -4675,29 +4925,48 @@ let DEPENDENCY_KEYS = [
|
|
|
4675
4925
|
'contextDependencies',
|
|
4676
4926
|
'missingDependencies',
|
|
4677
4927
|
'buildDependencies'
|
|
4678
|
-
],
|
|
4679
|
-
fileDependencies:
|
|
4680
|
-
contextDependencies:
|
|
4681
|
-
missingDependencies:
|
|
4682
|
-
buildDependencies:
|
|
4683
|
-
}),
|
|
4684
|
-
|
|
4685
|
-
|
|
4928
|
+
], createSets = ()=>({
|
|
4929
|
+
fileDependencies: new Set(),
|
|
4930
|
+
contextDependencies: new Set(),
|
|
4931
|
+
missingDependencies: new Set(),
|
|
4932
|
+
buildDependencies: new Set()
|
|
4933
|
+
}), arraysFrom = (sets)=>({
|
|
4934
|
+
fileDependencies: Array.from(sets.fileDependencies),
|
|
4935
|
+
contextDependencies: Array.from(sets.contextDependencies),
|
|
4936
|
+
missingDependencies: Array.from(sets.missingDependencies),
|
|
4937
|
+
buildDependencies: Array.from(sets.buildDependencies)
|
|
4938
|
+
});
|
|
4686
4939
|
class LoaderDependenciesState {
|
|
4687
4940
|
existing;
|
|
4688
|
-
|
|
4689
|
-
|
|
4941
|
+
#existingSets;
|
|
4942
|
+
#addedSets = createSets();
|
|
4943
|
+
#removedSets = createSets();
|
|
4690
4944
|
constructor(existing){
|
|
4691
|
-
this.existing = existing
|
|
4945
|
+
this.existing = existing, this.#existingSets = {
|
|
4946
|
+
fileDependencies: new Set(existing.fileDependencies),
|
|
4947
|
+
contextDependencies: new Set(existing.contextDependencies),
|
|
4948
|
+
missingDependencies: new Set(existing.missingDependencies),
|
|
4949
|
+
buildDependencies: new Set(existing.buildDependencies)
|
|
4950
|
+
};
|
|
4951
|
+
}
|
|
4952
|
+
get added() {
|
|
4953
|
+
return arraysFrom(this.#addedSets);
|
|
4954
|
+
}
|
|
4955
|
+
get removed() {
|
|
4956
|
+
return arraysFrom(this.#removedSets);
|
|
4692
4957
|
}
|
|
4693
4958
|
resetChanges() {
|
|
4694
|
-
for (let key of DEPENDENCY_KEYS)
|
|
4959
|
+
for (let key of DEPENDENCY_KEYS)this.#addedSets[key].clear(), this.#removedSets[key].clear();
|
|
4695
4960
|
}
|
|
4696
4961
|
mergeChanges() {
|
|
4697
4962
|
for (let key of DEPENDENCY_KEYS){
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4963
|
+
let added = this.#addedSets[key], removed = this.#removedSets[key];
|
|
4964
|
+
if (0 === added.size && 0 === removed.size) continue;
|
|
4965
|
+
let existing = this.#existingSets[key];
|
|
4966
|
+
for (let dependency of removed)existing.delete(dependency);
|
|
4967
|
+
for (let dependency of added)existing.add(dependency);
|
|
4968
|
+
let target = this.existing[key];
|
|
4969
|
+
for (let dependency of (target.length = 0, existing))target.push(dependency);
|
|
4701
4970
|
}
|
|
4702
4971
|
this.resetChanges();
|
|
4703
4972
|
}
|
|
@@ -4729,20 +4998,22 @@ class LoaderDependenciesState {
|
|
|
4729
4998
|
this.clear('fileDependencies'), this.clear('contextDependencies'), this.clear('missingDependencies');
|
|
4730
4999
|
}
|
|
4731
5000
|
add(key, dependency) {
|
|
4732
|
-
|
|
4733
|
-
for(let index = removed.length - 1; index >= 0; index--)removed[index] === dependency && removed.splice(index, 1);
|
|
4734
|
-
this.added[key].includes(dependency) || this.added[key].push(dependency);
|
|
5001
|
+
this.#removedSets[key].delete(dependency), this.#addedSets[key].add(dependency);
|
|
4735
5002
|
}
|
|
4736
5003
|
get(key) {
|
|
4737
|
-
let removed = new Set(
|
|
4738
|
-
|
|
5004
|
+
let removed = this.#removedSets[key], dependencies = new Set();
|
|
5005
|
+
for (let dependency of this.#existingSets[key])removed.has(dependency) || dependencies.add(dependency);
|
|
5006
|
+
for (let dependency of this.#addedSets[key])dependencies.add(dependency);
|
|
5007
|
+
return Array.from(dependencies);
|
|
4739
5008
|
}
|
|
4740
5009
|
clear(key) {
|
|
4741
|
-
|
|
5010
|
+
let removed = this.#removedSets[key];
|
|
5011
|
+
for (let dependency of (removed.clear(), this.#existingSets[key]))removed.add(dependency);
|
|
5012
|
+
this.#addedSets[key].clear();
|
|
4742
5013
|
}
|
|
4743
5014
|
}
|
|
4744
5015
|
let ensureLoaderWorkerPool = async (workerOptions)=>service_pool || (service_pool = import("../compiled/tinypool/dist/index.js").then(({ Tinypool })=>{
|
|
4745
|
-
let availableThreads = Math.max(
|
|
5016
|
+
let availableThreads = Math.max(__rspack_createRequire_require("node:os").cpus().length - 1, 1), maxWorkers = workerOptions?.maxWorkers ? Math.max(workerOptions.maxWorkers, 1) : void 0, maxWorkersFromEnv = parseInt(process.env.RSPACK_LOADER_WORKER_THREADS || '', 10);
|
|
4746
5017
|
return new Tinypool({
|
|
4747
5018
|
filename: node_path.resolve(import.meta.dirname, 'worker.js'),
|
|
4748
5019
|
useAtomics: !1,
|
|
@@ -4751,21 +5022,49 @@ let ensureLoaderWorkerPool = async (workerOptions)=>service_pool || (service_poo
|
|
|
4751
5022
|
concurrentTasksPerWorker: 1
|
|
4752
5023
|
});
|
|
4753
5024
|
}));
|
|
4754
|
-
function
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
5025
|
+
function serializeAggregateErrorMember(value) {
|
|
5026
|
+
return value instanceof Error ? {
|
|
5027
|
+
__internal__type: 'error',
|
|
5028
|
+
value: serializeErrorWithoutCloneCheck(value)
|
|
5029
|
+
} : {
|
|
5030
|
+
__internal__type: 'value',
|
|
5031
|
+
value
|
|
4760
5032
|
};
|
|
5033
|
+
}
|
|
5034
|
+
function serializeErrorWithoutCloneCheck(error) {
|
|
5035
|
+
if (error instanceof Error || error && 'object' == typeof error && 'message' in error) {
|
|
5036
|
+
let serializedError = {
|
|
5037
|
+
...error,
|
|
5038
|
+
name: error.name,
|
|
5039
|
+
stack: error.stack,
|
|
5040
|
+
message: error.message
|
|
5041
|
+
};
|
|
5042
|
+
return error instanceof AggregateError ? (serializedError.__internal__isAggregateError = !0, serializedError.errors = error.errors.map(serializeAggregateErrorMember)) : delete serializedError.__internal__isAggregateError, serializedError;
|
|
5043
|
+
}
|
|
4761
5044
|
if ('string' == typeof error) return {
|
|
4762
5045
|
name: 'Error',
|
|
4763
5046
|
message: error
|
|
4764
5047
|
};
|
|
4765
5048
|
throw Error('Failed to serialize error, only string, Error instances and objects with a message property are supported');
|
|
4766
5049
|
}
|
|
4767
|
-
|
|
4768
|
-
|
|
5050
|
+
function serializeError(error) {
|
|
5051
|
+
try {
|
|
5052
|
+
let serializedError = serializeErrorWithoutCloneCheck(error);
|
|
5053
|
+
return structuredClone(serializedError), serializedError;
|
|
5054
|
+
} catch (serializationError) {
|
|
5055
|
+
let reason = serializationError instanceof Error ? serializationError.message : 'unknown reason';
|
|
5056
|
+
return serializeErrorWithoutCloneCheck(Error(`Failed to serialize error: ${reason}`));
|
|
5057
|
+
}
|
|
5058
|
+
}
|
|
5059
|
+
function deserializeAggregateErrorMember(member) {
|
|
5060
|
+
return 'error' === member.__internal__type ? deserializeError(member.value) : member.value;
|
|
5061
|
+
}
|
|
5062
|
+
function deserializeError(error) {
|
|
5063
|
+
let { __internal__isAggregateError, errors, ...properties } = error, shouldDeserializeAsAggregate = !0 === __internal__isAggregateError && Array.isArray(errors), deserializedError = shouldDeserializeAsAggregate ? AggregateError(errors.map(deserializeAggregateErrorMember), error.message) : Error(error.message);
|
|
5064
|
+
return Object.assign(deserializedError, properties), shouldDeserializeAsAggregate || void 0 === errors || (deserializedError.errors = errors), deserializedError;
|
|
5065
|
+
}
|
|
5066
|
+
let service_run = async (loaderName, task, options, workerOptions)=>ensureLoaderWorkerPool(workerOptions).then((pool)=>{
|
|
5067
|
+
let { port1: mainPort, port2: workerPort } = new MessageChannel(), { port1: mainSyncPort, port2: workerSyncPort } = new MessageChannel();
|
|
4769
5068
|
return new Promise((resolve, reject)=>{
|
|
4770
5069
|
let handleError = (error)=>{
|
|
4771
5070
|
mainPort.close(), mainSyncPort.close(), reject(error);
|
|
@@ -4801,7 +5100,7 @@ let service_run = async (loaderName, task, options, workerOptions)=>ensureLoader
|
|
|
4801
5100
|
'done' === message.type ? Promise.allSettled(pendingRequests.values()).then(()=>{
|
|
4802
5101
|
mainPort.close(), mainSyncPort.close(), resolve(message.data);
|
|
4803
5102
|
}) : 'done-error' === message.type ? Promise.allSettled(pendingRequests.values()).then(()=>{
|
|
4804
|
-
mainPort.close(), mainSyncPort.close(), reject(message.error);
|
|
5103
|
+
mainPort.close(), mainSyncPort.close(), reject(deserializeError(message.error));
|
|
4805
5104
|
}) : 'request' === message.type ? pendingRequests.set(message.id, Promise.resolve().then(()=>options.handleIncomingRequest(message.requestType, ...message.data)).then((result)=>(mainPort.postMessage({
|
|
4806
5105
|
type: 'response',
|
|
4807
5106
|
id: message.id,
|
|
@@ -4814,19 +5113,28 @@ let service_run = async (loaderName, task, options, workerOptions)=>ensureLoader
|
|
|
4814
5113
|
});
|
|
4815
5114
|
})) : 'request-sync' === message.type && handleSyncRequest(message);
|
|
4816
5115
|
}), mainPort.on('messageerror', handleError);
|
|
4817
|
-
let
|
|
4818
|
-
for (let key of Object.keys(task))
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
5116
|
+
let found = [];
|
|
5117
|
+
for (let key of Object.keys(task)){
|
|
5118
|
+
let uncloneable = function findUncloneablePath(value, path, depth) {
|
|
5119
|
+
try {
|
|
5120
|
+
structuredClone(value);
|
|
5121
|
+
return;
|
|
5122
|
+
} catch (e) {
|
|
5123
|
+
if (depth > 0 && 'object' == typeof value && null !== value) for (let key of Object.keys(value)){
|
|
5124
|
+
let deeper = findUncloneablePath(value[key], `${path}.${key}`, depth - 1);
|
|
5125
|
+
if (deeper) return deeper;
|
|
5126
|
+
}
|
|
5127
|
+
return {
|
|
5128
|
+
path,
|
|
5129
|
+
reason: e.message
|
|
5130
|
+
};
|
|
5131
|
+
}
|
|
5132
|
+
}(task[key], key, 6);
|
|
5133
|
+
uncloneable && found.push(uncloneable);
|
|
4826
5134
|
}
|
|
4827
|
-
if (
|
|
4828
|
-
let
|
|
4829
|
-
throw Error(
|
|
5135
|
+
if (found.length > 0) {
|
|
5136
|
+
let details = found.map((item)=>` ${item.path.replace(/^loaderContext\._module\.buildInfo/, 'module.buildInfo').replace(/^loaderContext\.loaders\.\d+\.options/, 'options').replace(/^loaderContext\.?/, '')}: ${item.reason}`).join('\n');
|
|
5137
|
+
throw Error(`${loaderName} cannot run with \`parallel: true\`. A parallel loader runs in a worker thread and receives its loader context through a structured clone, so the loader options and the custom \`module.buildInfo\` fields the module already carries all have to be cloneable:\n${details}\nEither remove \`parallel\` from this loader, or keep the value above out of the loader options and \`module.buildInfo\`.`);
|
|
4830
5138
|
}
|
|
4831
5139
|
pool.run({
|
|
4832
5140
|
...task,
|
|
@@ -4854,7 +5162,7 @@ function loadLoader(loader, compiler, callback) {
|
|
|
4854
5162
|
if ('module' === loader.type) try {
|
|
4855
5163
|
let modulePromise = modulePromiseCache.get(cacheKey);
|
|
4856
5164
|
if (void 0 === modulePromise) {
|
|
4857
|
-
void 0 === loadLoader_url && (loadLoader_url =
|
|
5165
|
+
void 0 === loadLoader_url && (loadLoader_url = rspackRequire("node:url"));
|
|
4858
5166
|
let loaderUrl = loaderUrlCache.get(loader.path);
|
|
4859
5167
|
void 0 === loaderUrl && (loaderUrl = loadLoader_url.pathToFileURL(loader.path).toString(), loaderUrlCache.set(loader.path, loaderUrl)), modulePromise = import(loaderUrl).then((module)=>(loadLoader_moduleCache.set(cacheKey, module), modulePromiseCache.delete(cacheKey), module), (err)=>{
|
|
4860
5168
|
throw modulePromiseCache.delete(cacheKey), err;
|
|
@@ -5052,12 +5360,20 @@ async function runLoaders(compiler, context) {
|
|
|
5052
5360
|
for (let dep of res.contextDependencies)loaderContext.addContextDependency(dep);
|
|
5053
5361
|
for (let dep of res.missingDependencies)loaderContext.addMissingDependency(dep);
|
|
5054
5362
|
for (let dep of res.fileDependencies)loaderContext.addDependency(dep);
|
|
5055
|
-
!1 === res.cacheable && loaderContext.cacheable(!1), traceData && JavaScriptTracer.endAsync({
|
|
5363
|
+
if (!1 === res.cacheable && loaderContext.cacheable(!1), traceData && JavaScriptTracer.endAsync({
|
|
5056
5364
|
name: 'importModule',
|
|
5057
5365
|
processName: LOADER_PROCESS_NAME,
|
|
5058
5366
|
uuid: traceData.uuid,
|
|
5059
5367
|
args: traceData.args
|
|
5060
|
-
}), res.
|
|
5368
|
+
}), res.errors.length > 0) {
|
|
5369
|
+
let executionError = compiler.__internal__takeModuleExecutionResult(res.id);
|
|
5370
|
+
if (null != executionError) onError(executionError);
|
|
5371
|
+
else if (1 === res.errors.length) onError(res.errors[0]);
|
|
5372
|
+
else {
|
|
5373
|
+
let error = AggregateError(res.errors, res.errors.map((error)=>error.message).join('\n'));
|
|
5374
|
+
error.hideStack = !0, onError(error);
|
|
5375
|
+
}
|
|
5376
|
+
} else onDone(compiler.__internal__takeModuleExecutionResult(res.id));
|
|
5061
5377
|
}
|
|
5062
5378
|
};
|
|
5063
5379
|
}
|
|
@@ -5173,10 +5489,7 @@ async function runLoaders(compiler, context) {
|
|
|
5173
5489
|
}
|
|
5174
5490
|
else options = node_querystring.parse(options);
|
|
5175
5491
|
return null == options && (options = {}), options;
|
|
5176
|
-
}
|
|
5177
|
-
let compilation = compiler._lastCompilation, step = 0;
|
|
5178
|
-
for(; compilation;)if (binding_.NormalModule.getCompilationHooks(compilation).loader.call(loaderContext, loaderContext._module), compilation = compilation.compiler.parentCompilation, ++step > 1000) throw Error('Too many nested child compiler, exceeded max limitation 1000');
|
|
5179
|
-
dependencies.mergeChanges(), Object.defineProperty(loaderContext, 'loaderIndex', {
|
|
5492
|
+
}, Object.defineProperty(loaderContext, 'loaderIndex', {
|
|
5180
5493
|
enumerable: !0,
|
|
5181
5494
|
get: ()=>context.loaderIndex,
|
|
5182
5495
|
set: (loaderIndex)=>context.loaderIndex = loaderIndex
|
|
@@ -5192,6 +5505,9 @@ async function runLoaders(compiler, context) {
|
|
|
5192
5505
|
}), loaderContext.__internal__setParseMeta = (key, value)=>{
|
|
5193
5506
|
context.__internal__parseMeta[key] = value;
|
|
5194
5507
|
};
|
|
5508
|
+
let compilation = compiler._lastCompilation, step = 0;
|
|
5509
|
+
for(; compilation;)if (binding_.NormalModule.getCompilationHooks(compilation).loader.call(loaderContext, loaderContext._module), compilation = compilation.compiler.parentCompilation, ++step > 1000) throw Error('Too many nested child compiler, exceeded max limitation 1000');
|
|
5510
|
+
dependencies.mergeChanges();
|
|
5195
5511
|
let enableParallelism = (currentLoaderObject)=>!(process.env.WASM && currentLoaderObject?.loaderItem.cache) && currentLoaderObject?.parallel, isomorphoicRun = async (fn, args)=>{
|
|
5196
5512
|
let loaderName, result, currentLoaderObject = getCurrentLoader(loaderContext), parallelism = enableParallelism(currentLoaderObject);
|
|
5197
5513
|
if ((traceData || parallelism) && (loaderName = function(loaderPath, cwd = '') {
|
|
@@ -5266,7 +5582,8 @@ async function runLoaders(compiler, context) {
|
|
|
5266
5582
|
matchResource: normalModule?.matchResource,
|
|
5267
5583
|
request: normalModule?.request,
|
|
5268
5584
|
userRequest: normalModule?.userRequest,
|
|
5269
|
-
rawRequest: normalModule?.rawRequest
|
|
5585
|
+
rawRequest: normalModule?.rawRequest,
|
|
5586
|
+
buildInfo: pickCustomBuildInfoFields(normalModule?.buildInfo)
|
|
5270
5587
|
}
|
|
5271
5588
|
}, compiler.options.loader), workerLoaderContext),
|
|
5272
5589
|
loaderState,
|
|
@@ -5364,6 +5681,15 @@ async function runLoaders(compiler, context) {
|
|
|
5364
5681
|
});
|
|
5365
5682
|
break;
|
|
5366
5683
|
}
|
|
5684
|
+
case "UpdateBuildInfo":
|
|
5685
|
+
{
|
|
5686
|
+
let buildInfo = loaderContext._module?.buildInfo;
|
|
5687
|
+
buildInfo && ((buildInfo, custom)=>{
|
|
5688
|
+
for (let key of Object.keys(buildInfo))knownBuildInfoFields.has(key) || Object.hasOwn(custom, key) || delete buildInfo[key];
|
|
5689
|
+
Object.assign(buildInfo, custom);
|
|
5690
|
+
})(buildInfo, pickCustomBuildInfoFields(args[0]));
|
|
5691
|
+
break;
|
|
5692
|
+
}
|
|
5367
5693
|
case "LoaderCacheGet":
|
|
5368
5694
|
{
|
|
5369
5695
|
let [loaderIndex, content, additionalData] = args;
|
|
@@ -5440,7 +5766,7 @@ async function runLoaders(compiler, context) {
|
|
|
5440
5766
|
}
|
|
5441
5767
|
if (args.some((value)=>void 0 !== value)) {
|
|
5442
5768
|
let [content, sourceMap, additionalData] = args;
|
|
5443
|
-
context.content = isNil(content) ? null : toBuffer(content), context.sourceMap = serializeObject(sourceMap), context.additionalData = additionalData || void 0;
|
|
5769
|
+
context.content = isNil(content) ? null : 'string' == typeof content ? content : toBuffer(content), context.sourceMap = serializeObject(sourceMap), context.additionalData = additionalData || void 0;
|
|
5444
5770
|
break;
|
|
5445
5771
|
}
|
|
5446
5772
|
}
|
|
@@ -5475,7 +5801,7 @@ async function runLoaders(compiler, context) {
|
|
|
5475
5801
|
dependencies.mergeChanges();
|
|
5476
5802
|
}
|
|
5477
5803
|
}
|
|
5478
|
-
context.content = isNil(content) ? null : toBuffer(content), context.sourceMap = sourceMapParsed ? JsSourceMap.__to_binding(sourceMap) : rawSourceMap, context.additionalData =
|
|
5804
|
+
context.content = isNil(content) ? null : 'string' == typeof content ? content : toBuffer(content), context.sourceMap = sourceMapParsed ? JsSourceMap.__to_binding(sourceMap) : rawSourceMap, context.additionalData = loaderContext.loaderIndex < 0 ? void 0 : additionalData || void 0;
|
|
5479
5805
|
break;
|
|
5480
5806
|
}
|
|
5481
5807
|
default:
|
|
@@ -5530,12 +5856,12 @@ let JsLoaderRspackPlugin = base_create(binding_.BuiltinPluginName.JsLoaderRspack
|
|
|
5530
5856
|
pseudoClasses
|
|
5531
5857
|
}
|
|
5532
5858
|
};
|
|
5533
|
-
}), LimitChunkCountPlugin = base_create(binding_.BuiltinPluginName.LimitChunkCountPlugin, (options)=>options), BuiltinLazyCompilationPlugin = base_create(binding_.BuiltinPluginName.LazyCompilationPlugin, (
|
|
5859
|
+
}), LimitChunkCountPlugin = base_create(binding_.BuiltinPluginName.LimitChunkCountPlugin, (options)=>options), BuiltinLazyCompilationPlugin = base_create(binding_.BuiltinPluginName.LazyCompilationPlugin, (takeNewlyActiveModules, entries, imports, client, reservedExternals, test)=>({
|
|
5534
5860
|
imports,
|
|
5535
5861
|
entries,
|
|
5536
5862
|
test,
|
|
5537
5863
|
client,
|
|
5538
|
-
|
|
5864
|
+
takeNewlyActiveModules,
|
|
5539
5865
|
reservedExternals
|
|
5540
5866
|
}), 'thisCompilation'), middleware_require = createRequire(import.meta.url), LAZY_COMPILATION_PREFIX = '/_rspack/lazy/trigger', noop = (_req, _res, next)=>{
|
|
5541
5867
|
'function' == typeof next && next();
|
|
@@ -5548,8 +5874,8 @@ let JsLoaderRspackPlugin = base_create(binding_.BuiltinPluginName.JsLoaderRspack
|
|
|
5548
5874
|
...c.options.lazyCompilation
|
|
5549
5875
|
}, prefix = options.prefix || LAZY_COMPILATION_PREFIX;
|
|
5550
5876
|
options.prefix = `${prefix}__${i++}`;
|
|
5551
|
-
let
|
|
5552
|
-
middlewareByCompiler.set(options.prefix, lazyCompilationMiddlewareInternal(c,
|
|
5877
|
+
let newlyActiveModules = new Set();
|
|
5878
|
+
middlewareByCompiler.set(options.prefix, lazyCompilationMiddlewareInternal(c, newlyActiveModules, options.prefix)), applyPlugin(c, options, newlyActiveModules);
|
|
5553
5879
|
}
|
|
5554
5880
|
let keys = [
|
|
5555
5881
|
...middlewareByCompiler.keys()
|
|
@@ -5562,15 +5888,15 @@ let JsLoaderRspackPlugin = base_create(binding_.BuiltinPluginName.JsLoaderRspack
|
|
|
5562
5888
|
};
|
|
5563
5889
|
}
|
|
5564
5890
|
if (!compiler.options.lazyCompilation) return noop;
|
|
5565
|
-
let
|
|
5891
|
+
let newlyActiveModules = new Set(), options = {
|
|
5566
5892
|
...compiler.options.lazyCompilation
|
|
5567
5893
|
};
|
|
5568
|
-
return applyPlugin(compiler, options,
|
|
5894
|
+
return applyPlugin(compiler, options, newlyActiveModules), lazyCompilationMiddlewareInternal(compiler, newlyActiveModules, options.prefix || LAZY_COMPILATION_PREFIX);
|
|
5569
5895
|
};
|
|
5570
|
-
function applyPlugin(compiler, options,
|
|
5896
|
+
function applyPlugin(compiler, options, newlyActiveModules) {
|
|
5571
5897
|
new BuiltinLazyCompilationPlugin(()=>{
|
|
5572
|
-
let res = new Set(
|
|
5573
|
-
return
|
|
5898
|
+
let res = new Set(newlyActiveModules);
|
|
5899
|
+
return newlyActiveModules.clear(), res;
|
|
5574
5900
|
}, options.entries ?? !0, options.imports ?? !0, `${options.client || middleware_require.resolve(`../hot/lazy-compilation-${compiler.options.externalsPresets.node ? 'node' : 'web'}.js`)}?${encodeURIComponent((({ serverUrl, prefix })=>{
|
|
5575
5901
|
let lazyCompilationPrefix = prefix || LAZY_COMPILATION_PREFIX;
|
|
5576
5902
|
return serverUrl ? serverUrl + (serverUrl.endsWith('/') ? lazyCompilationPrefix.slice(1) : lazyCompilationPrefix) : lazyCompilationPrefix;
|
|
@@ -5586,7 +5912,7 @@ function applyPlugin(compiler, options, activeModules) {
|
|
|
5586
5912
|
];
|
|
5587
5913
|
}(compiler.options.externals), options.test).apply(compiler);
|
|
5588
5914
|
}
|
|
5589
|
-
let lazyCompilationMiddlewareInternal = (compiler,
|
|
5915
|
+
let lazyCompilationMiddlewareInternal = (compiler, newlyActiveModules, lazyCompilationPrefix)=>{
|
|
5590
5916
|
let logger = compiler.getInfrastructureLogger('LazyCompilation');
|
|
5591
5917
|
return async (req, res, next)=>{
|
|
5592
5918
|
if (!req.url?.startsWith(lazyCompilationPrefix) || 'POST' !== req.method) return next?.();
|
|
@@ -5621,10 +5947,7 @@ let lazyCompilationMiddlewareInternal = (compiler, activeModules, lazyCompilatio
|
|
|
5621
5947
|
return;
|
|
5622
5948
|
}
|
|
5623
5949
|
let moduleActivated = [];
|
|
5624
|
-
for (let key of modules){
|
|
5625
|
-
let activated = activeModules.has(key);
|
|
5626
|
-
activeModules.add(key), activated || (logger.log(`${key} is now in use and will be compiled.`), moduleActivated.push(key));
|
|
5627
|
-
}
|
|
5950
|
+
for (let key of modules)newlyActiveModules.has(key) || (newlyActiveModules.add(key), logger.log(`${key} is now in use and will be compiled.`), moduleActivated.push(key));
|
|
5628
5951
|
moduleActivated.length && compiler.watching && compiler.watching.invalidate(), res.writeHead(200), res.write('\n'), res.end();
|
|
5629
5952
|
};
|
|
5630
5953
|
};
|
|
@@ -5662,9 +5985,43 @@ class NaturalModuleIdsPlugin extends RspackBuiltinPlugin {
|
|
|
5662
5985
|
return createBuiltinPlugin(this.name, void 0);
|
|
5663
5986
|
}
|
|
5664
5987
|
}
|
|
5665
|
-
let NodeTargetPlugin = base_create(binding_.BuiltinPluginName.NodeTargetPlugin, ()=>void 0), NoEmitOnErrorsPlugin = base_create(binding_.BuiltinPluginName.NoEmitOnErrorsPlugin, ()=>void 0)
|
|
5988
|
+
let NodeTargetPlugin = base_create(binding_.BuiltinPluginName.NodeTargetPlugin, ()=>void 0), NoEmitOnErrorsPlugin = base_create(binding_.BuiltinPluginName.NoEmitOnErrorsPlugin, ()=>void 0);
|
|
5989
|
+
function createResolveData(data) {
|
|
5990
|
+
return data.fileDependencies = [], data.contextDependencies = [], data.missingDependencies = [], data;
|
|
5991
|
+
}
|
|
5992
|
+
class NormalModuleFactory {
|
|
5993
|
+
hooks;
|
|
5994
|
+
resolverFactory;
|
|
5995
|
+
constructor(resolverFactory){
|
|
5996
|
+
this.hooks = {
|
|
5997
|
+
resolveForScheme: new HookMap(()=>new AsyncSeriesBailHook([
|
|
5998
|
+
'resourceData'
|
|
5999
|
+
])),
|
|
6000
|
+
beforeResolve: new AsyncSeriesBailHook([
|
|
6001
|
+
'resolveData'
|
|
6002
|
+
]),
|
|
6003
|
+
factorize: new AsyncSeriesBailHook([
|
|
6004
|
+
'resolveData'
|
|
6005
|
+
]),
|
|
6006
|
+
resolve: new AsyncSeriesBailHook([
|
|
6007
|
+
'resolveData'
|
|
6008
|
+
]),
|
|
6009
|
+
afterResolve: new AsyncSeriesBailHook([
|
|
6010
|
+
'resolveData'
|
|
6011
|
+
]),
|
|
6012
|
+
createModule: new AsyncSeriesBailHook([
|
|
6013
|
+
'createData',
|
|
6014
|
+
'resolveData'
|
|
6015
|
+
])
|
|
6016
|
+
}, this.resolverFactory = resolverFactory;
|
|
6017
|
+
}
|
|
6018
|
+
getResolver(type, resolveOptions) {
|
|
6019
|
+
return this.resolverFactory.get(type, resolveOptions);
|
|
6020
|
+
}
|
|
6021
|
+
}
|
|
6022
|
+
let NormalModuleReplacementPlugin = base_create(binding_.BuiltinPluginName.NormalModuleReplacementPlugin, (resourceRegExp, newResource)=>({
|
|
5666
6023
|
resourceRegExp,
|
|
5667
|
-
newResource: 'function' == typeof newResource ? (data)=>(newResource(data), data) : newResource
|
|
6024
|
+
newResource: 'function' == typeof newResource ? (data)=>(newResource(createResolveData(data)), data) : newResource
|
|
5668
6025
|
})), OccurrenceChunkIdsPlugin = base_create(binding_.BuiltinPluginName.OccurrenceChunkIdsPlugin, (options)=>({
|
|
5669
6026
|
...options
|
|
5670
6027
|
}), 'compilation'), ProgressPlugin = base_create(binding_.BuiltinPluginName.ProgressPlugin, (progress = {})=>'function' == typeof progress ? {
|
|
@@ -5719,7 +6076,7 @@ RsdoctorPluginImpl.getCompilationHooks = (compilation)=>{
|
|
|
5719
6076
|
])
|
|
5720
6077
|
}, RsdoctorPlugin_compilationHooksMap.set(compilation, hooks)), hooks;
|
|
5721
6078
|
};
|
|
5722
|
-
let RslibPlugin = base_create(binding_.BuiltinPluginName.RslibPlugin, (rslib)=>rslib), RstestPlugin = base_create(binding_.BuiltinPluginName.RstestPlugin, (rstest)=>rstest), RuntimeChunkPlugin = base_create(binding_.BuiltinPluginName.RuntimeChunkPlugin, (options)=>options, 'thisCompilation'), RuntimePlugin = base_create(binding__default().BuiltinPluginName.RuntimePlugin, ()=>{}, 'compilation'), RuntimePlugin_compilationHooksMap = new WeakMap();
|
|
6079
|
+
let RslibPlugin = base_create(binding_.BuiltinPluginName.RslibPlugin, (rslib = {})=>rslib), RstestPlugin = base_create(binding_.BuiltinPluginName.RstestPlugin, (rstest)=>rstest), RuntimeChunkPlugin = base_create(binding_.BuiltinPluginName.RuntimeChunkPlugin, (options)=>options, 'thisCompilation'), RuntimePlugin = base_create(binding__default().BuiltinPluginName.RuntimePlugin, ()=>{}, 'compilation'), RuntimePlugin_compilationHooksMap = new WeakMap();
|
|
5723
6080
|
RuntimePlugin.getCompilationHooks = (compilation)=>{
|
|
5724
6081
|
checkCompilation(compilation);
|
|
5725
6082
|
let hooks = RuntimePlugin_compilationHooksMap.get(compilation);
|
|
@@ -5898,7 +6255,7 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
|
|
|
5898
6255
|
src = relative(protocolRelativePublicPath.startsWith('//') ? `http:${protocolRelativePublicPath}` : protocolRelativePublicPath, decodeURIComponent(tagSrcWithScheme));
|
|
5899
6256
|
} else src = relative(publicPath, decodeURIComponent(tagSrc));
|
|
5900
6257
|
tag.attributes.integrity = this.getIntegrityChecksumForAsset(src) || function(hashFuncNames, source) {
|
|
5901
|
-
let { createHash } =
|
|
6258
|
+
let { createHash } = rspackRequire("node:crypto");
|
|
5902
6259
|
return hashFuncNames.map((hashFuncName)=>`${hashFuncName}-${createHash(hashFuncName).update('string' == typeof source ? Buffer.from(source, 'utf-8') : source).digest('base64')}`).join(' ');
|
|
5903
6260
|
}(this.options.hashFuncNames, readFileSync(join(outputPath, src))), tag.attributes.crossorigin = crossOriginLoading || 'anonymous';
|
|
5904
6261
|
}
|
|
@@ -6003,22 +6360,7 @@ let SwcJsMinimizerRspackPlugin = base_create(binding_.BuiltinPluginName.SwcJsMin
|
|
|
6003
6360
|
module: options?.minimizerOptions?.module
|
|
6004
6361
|
}
|
|
6005
6362
|
};
|
|
6006
|
-
}, 'compilation');
|
|
6007
|
-
class SyncModuleIdsPlugin extends RspackBuiltinPlugin {
|
|
6008
|
-
options;
|
|
6009
|
-
name = binding_.BuiltinPluginName.SyncModuleIdsPlugin;
|
|
6010
|
-
affectedHooks = 'compilation';
|
|
6011
|
-
constructor(options){
|
|
6012
|
-
super(), this.options = options;
|
|
6013
|
-
}
|
|
6014
|
-
raw() {
|
|
6015
|
-
let options = {
|
|
6016
|
-
...this.options
|
|
6017
|
-
};
|
|
6018
|
-
return createBuiltinPlugin(this.name, options);
|
|
6019
|
-
}
|
|
6020
|
-
}
|
|
6021
|
-
let URLPlugin = base_create(binding_.BuiltinPluginName.URLPlugin, ()=>{}, 'compilation');
|
|
6363
|
+
}, 'compilation'), URLPlugin = base_create(binding_.BuiltinPluginName.URLPlugin, ()=>{}, 'compilation');
|
|
6022
6364
|
class WorkerPlugin extends RspackBuiltinPlugin {
|
|
6023
6365
|
chunkLoading;
|
|
6024
6366
|
wasmLoading;
|
|
@@ -6046,6 +6388,21 @@ class ContextModuleFactory {
|
|
|
6046
6388
|
};
|
|
6047
6389
|
}
|
|
6048
6390
|
}
|
|
6391
|
+
let bindingHelpers = {
|
|
6392
|
+
applyIndexedArrayUpdates: function(source, target, commands) {
|
|
6393
|
+
let mode = commands[0], length = commands[1];
|
|
6394
|
+
if (0 === mode) {
|
|
6395
|
+
target.length = length;
|
|
6396
|
+
for(let i = 0, cursor = 2; cursor < commands.length; i++, cursor++)target[i] = source[commands[cursor]];
|
|
6397
|
+
} else for(let cursor = 2; cursor < commands.length; cursor += 2)target[commands[cursor]] = source[commands[cursor + 1]];
|
|
6398
|
+
target.length = length;
|
|
6399
|
+
},
|
|
6400
|
+
swapRemoveArrayElements: function(array, removedIndices) {
|
|
6401
|
+
let length = array.length;
|
|
6402
|
+
for (let index of removedIndices)index !== --length && (array[index] = array[length]);
|
|
6403
|
+
array.length = length;
|
|
6404
|
+
}
|
|
6405
|
+
};
|
|
6049
6406
|
function assertNotNill(value) {
|
|
6050
6407
|
if (null == value) throw Error(`${value} should not be undefined or null`);
|
|
6051
6408
|
}
|
|
@@ -7156,7 +7513,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7156
7513
|
(hasTrue || hasFalse) && (result[key] = hasFalse && hasTrue ? null : hasTrue);
|
|
7157
7514
|
}
|
|
7158
7515
|
return result;
|
|
7159
|
-
})(targets.map((t)=>getTargetProperties(t, context))), applyRspackOptionsDefaults = (options, compilerIndex)=>{
|
|
7516
|
+
})(targets.map((t)=>getTargetProperties(t, context))), ERROR_PREFIX = 'Invalid Rspack configuration:', applyRspackOptionsDefaults = (options, compilerIndex)=>{
|
|
7160
7517
|
F(options, 'context', ()=>process.cwd()), F(options, 'target', ()=>hasBrowserslistConfig(options.context) ? 'browserslist' : 'web');
|
|
7161
7518
|
let { mode, target } = options;
|
|
7162
7519
|
if (isNil(target)) throw Error('target should not be nil after defaults');
|
|
@@ -7164,9 +7521,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7164
7521
|
if ('function' != typeof options.entry) for (let key of Object.keys(options.entry))F(options.entry[key], 'import', ()=>[
|
|
7165
7522
|
'./src'
|
|
7166
7523
|
]);
|
|
7167
|
-
|
|
7168
|
-
type: 'memory'
|
|
7169
|
-
snapshot: {}
|
|
7524
|
+
if (F(options, 'devtool', ()=>!!development && 'cheap-module-source-map'), D(options, 'watch', !1), D(options, 'lazyCompilation', !1), D(options, 'bail', !1), F(options, 'cache', ()=>!!development && {
|
|
7525
|
+
type: 'memory'
|
|
7170
7526
|
}), applyCacheDefaults(options.cache, {
|
|
7171
7527
|
context: options.context,
|
|
7172
7528
|
name: options.name || '',
|
|
@@ -7174,6 +7530,10 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7174
7530
|
compilerIndex
|
|
7175
7531
|
}), applyIncrementalDefaults(options), applyExperimentsDefaults(options.experiments, {
|
|
7176
7532
|
production
|
|
7533
|
+
}), options.cache && 'filesystem' === options.cache.type && !options.experiments.newCache) throw Error(`${ERROR_PREFIX} "cache.type: 'filesystem'" requires "experiments.newCache" to be enabled.`);
|
|
7534
|
+
return applySnapshotDefaults(options.snapshot, {
|
|
7535
|
+
production,
|
|
7536
|
+
newCache: !!options.experiments.newCache
|
|
7177
7537
|
}), applyOptimizationDefaults(options.optimization, {
|
|
7178
7538
|
production,
|
|
7179
7539
|
development
|
|
@@ -7220,19 +7580,44 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7220
7580
|
targets: targetProperties.targets
|
|
7221
7581
|
};
|
|
7222
7582
|
}, applyCacheDefaults = (cache, { context, name, mode, compilerIndex })=>{
|
|
7223
|
-
if (!1 !== cache) switch(
|
|
7224
|
-
|
|
7225
|
-
|
|
7583
|
+
if (!1 !== cache) switch(('persistent' === cache.type || 'filesystem' === cache.type) && (F(cache, 'name', ()=>{
|
|
7584
|
+
let cacheName = name ? `${name}-${mode}` : mode;
|
|
7585
|
+
return void 0 !== compilerIndex && compilerIndex > 0 ? `${cacheName}-${compilerIndex}` : cacheName;
|
|
7586
|
+
}), D(cache, 'version', ''), D(cache, 'maxMemoryGenerations', 'development' === mode ? 5 : 1 / 0), D(cache, 'readonly', !1)), cache.type){
|
|
7226
7587
|
case 'memory':
|
|
7227
7588
|
break;
|
|
7228
7589
|
case 'persistent':
|
|
7229
|
-
F(cache, 'name', ()=>
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7590
|
+
D(cache.storage, 'type', 'filesystem'), F(cache.storage, 'directory', ()=>node_path.resolve(context, 'node_modules/.cache/rspack')), F(cache.storage, 'location', ()=>node_path.resolve(cache.storage.directory, cache.name)), D(cache, 'maxAge', 604800), F(cache, 'buildDependencies', ()=>[]), D(cache, 'portable', !1);
|
|
7591
|
+
break;
|
|
7592
|
+
case 'filesystem':
|
|
7593
|
+
F(cache, 'cacheDirectory', ()=>node_path.resolve(context, 'node_modules/.cache/rspack')), F(cache, 'cacheLocation', ()=>node_path.resolve(cache.cacheDirectory, cache.name)), F(cache, 'buildDependencies', ()=>({})), D(cache, 'idleTimeout', 60000), D(cache, 'idleTimeoutForInitialStore', 5000), D(cache, 'idleTimeoutAfterLargeChanges', 1000);
|
|
7233
7594
|
}
|
|
7595
|
+
}, applySnapshotDefaults = (snapshot, { production, newCache })=>{
|
|
7596
|
+
F(snapshot, 'immutablePaths', ()=>[]), F(snapshot, 'unmanagedPaths', ()=>[]), F(snapshot, 'managedPaths', ()=>newCache ? [
|
|
7597
|
+
/^(.+?[\\/]node_modules[\\/])/
|
|
7598
|
+
] : [
|
|
7599
|
+
/[\\/]node_modules[\\/][^.]/
|
|
7600
|
+
]), F(snapshot, 'resolveBuildDependencies', ()=>({
|
|
7601
|
+
timestamp: !0,
|
|
7602
|
+
hash: !0
|
|
7603
|
+
})), F(snapshot, 'buildDependencies', ()=>({
|
|
7604
|
+
timestamp: !0,
|
|
7605
|
+
hash: !0
|
|
7606
|
+
})), F(snapshot, 'module', ()=>production ? {
|
|
7607
|
+
timestamp: !0,
|
|
7608
|
+
hash: !0
|
|
7609
|
+
} : {
|
|
7610
|
+
timestamp: !0
|
|
7611
|
+
}), F(snapshot, 'contextModule', ()=>({
|
|
7612
|
+
timestamp: !0
|
|
7613
|
+
})), F(snapshot, 'resolve', ()=>production ? {
|
|
7614
|
+
timestamp: !0,
|
|
7615
|
+
hash: !0
|
|
7616
|
+
} : {
|
|
7617
|
+
timestamp: !0
|
|
7618
|
+
});
|
|
7234
7619
|
}, applyExperimentsDefaults = (experiments, { production })=>{
|
|
7235
|
-
D(experiments, 'futureDefaults', !1), D(experiments, 'newCache', !1), 'object' == typeof experiments.newCache && (D(experiments.newCache, 'codeGeneration', !0), D(experiments.newCache, 'devtool', !0), D(experiments.newCache, 'loader', !0), D(experiments.newCache, 'minimize', !0)), D(experiments, 'asyncWebAssembly', !0), D(experiments, 'deferImport', !1), D(experiments, 'sourceImport', !1), D(experiments, 'buildHttp', void 0), experiments.buildHttp && 'object' == typeof experiments.buildHttp && D(experiments.buildHttp, 'upgrade', !1), D(experiments, 'useInputFileSystem', !1), D(experiments, 'pureFunctions', production), D(experiments, 'runtimeMode', 'webpack');
|
|
7620
|
+
D(experiments, 'futureDefaults', !1), D(experiments, 'newCache', !1), 'object' == typeof experiments.newCache && (D(experiments.newCache, 'codeGeneration', !0), D(experiments.newCache, 'module', !0), D(experiments.newCache, 'devtool', !0), D(experiments.newCache, 'loader', !0), D(experiments.newCache, 'minimize', !0), D(experiments.newCache, 'resolver', !1)), D(experiments, 'asyncWebAssembly', !0), D(experiments, 'deferImport', !1), D(experiments, 'sourceImport', !1), D(experiments, 'buildHttp', void 0), experiments.buildHttp && 'object' == typeof experiments.buildHttp && (D(experiments.buildHttp, 'upgrade', !1), D(experiments.buildHttp, 'frozen', production)), D(experiments, 'useInputFileSystem', !1), D(experiments, 'pureFunctions', production), D(experiments, 'runtimeMode', 'webpack');
|
|
7236
7621
|
}, applyIncrementalDefaults = (options)=>{
|
|
7237
7622
|
D(options, 'incremental', {}), 'object' == typeof options.incremental && (D(options.incremental, 'silent', !0), D(options.incremental, 'buildModuleGraph', !0), D(options.incremental, 'finishModules', !0), D(options.incremental, 'optimizeDependencies', !0), D(options.incremental, 'buildChunkGraph', !0), D(options.incremental, 'optimizeChunkModules', !0), D(options.incremental, 'moduleIds', !0), D(options.incremental, 'chunkIds', !0), D(options.incremental, 'modulesHashes', !0), D(options.incremental, 'modulesCodegen', !0), D(options.incremental, 'modulesRuntimeRequirements', !0), D(options.incremental, 'chunksRuntimeRequirements', !0), D(options.incremental, 'chunksHashes', !0), D(options.incremental, 'chunkAsset', !0), D(options.incremental, 'emitAssets', !0));
|
|
7238
7623
|
}, applyCssParserOptionsDefaults = (parserOptions)=>{
|
|
@@ -7464,7 +7849,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7464
7849
|
}), D(output, 'hotUpdateChunkFilename', `[id].[fullhash].hot-update.${output.module ? 'mjs' : 'js'}`), F(output, 'hotUpdateMainFilename', ()=>`[runtime].[fullhash].hot-update.${output.module ? 'json.mjs' : 'json'}`);
|
|
7465
7850
|
let uniqueNameId = Template.toIdentifier(output.uniqueName);
|
|
7466
7851
|
if (F(output, 'hotUpdateGlobal', ()=>`rspackHotUpdate${uniqueNameId}`), F(output, 'chunkLoadingGlobal', ()=>`rspackChunk${uniqueNameId}`), D(output, 'assetModuleFilename', '[hash][ext][query]'), D(output, 'webassemblyModuleFilename', '[hash].module.wasm'), D(output, 'wasmStreamingFallback', !0), D(output, 'compareBeforeEmit', !0), output.path && !node_path.isAbsolute(output.path)) {
|
|
7467
|
-
if (!context) throw Error(
|
|
7852
|
+
if (!context) throw Error(`${ERROR_PREFIX} "context" must be a non-empty absolute path when "output.path" is relative, get "${context ?? ''}".`);
|
|
7468
7853
|
output.path = node_path.resolve(context, output.path);
|
|
7469
7854
|
}
|
|
7470
7855
|
F(output, 'path', ()=>node_path.join(process.cwd(), 'dist')), F(output, 'pathinfo', ()=>!1), D(output, 'publicPath', tp && (tp.document || tp.importScripts) ? 'auto' : ''), D(output, 'hashFunction', 'xxhash64'), D(output, 'hashDigest', 'hex'), D(output, 'hashDigestLength', 16), D(output, 'strictModuleErrorHandling', !1), F(output, 'chunkFormat', ()=>{
|
|
@@ -7539,7 +7924,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7539
7924
|
return output.wasmLoading && enabledWasmLoadingTypes.add(output.wasmLoading), output.workerWasmLoading && enabledWasmLoadingTypes.add(output.workerWasmLoading), forEachEntry((desc)=>{
|
|
7540
7925
|
desc.wasmLoading && enabledWasmLoadingTypes.add(desc.wasmLoading);
|
|
7541
7926
|
}), Array.from(enabledWasmLoadingTypes);
|
|
7542
|
-
}), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.2.
|
|
7927
|
+
}), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.2.9"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !1));
|
|
7543
7928
|
}, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp, outputModule })=>{
|
|
7544
7929
|
let isUniversal = (key)=>!!(outputModule && targetProperties && null === targetProperties[key]);
|
|
7545
7930
|
D(externalsPresets, 'web', !buildHttp && targetProperties && (targetProperties.web || isUniversal('node'))), D(externalsPresets, 'node', targetProperties && (targetProperties.node || isUniversal('node'))), D(externalsPresets, 'electron', targetProperties && targetProperties.electron || isUniversal('electron')), D(externalsPresets, 'electronMain', targetProperties && !!targetProperties.electron && (targetProperties.electronMain || isUniversal('electronMain'))), D(externalsPresets, 'electronPreload', targetProperties && !!targetProperties.electron && (targetProperties.electronPreload || isUniversal('electronPreload'))), D(externalsPresets, 'electronRenderer', targetProperties && !!targetProperties.electron && (targetProperties.electronRenderer || isUniversal('electronRenderer'))), D(externalsPresets, 'nwjs', targetProperties && (targetProperties.nwjs || isUniversal('nwjs')));
|
|
@@ -7572,7 +7957,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7572
7957
|
]), F(optimization, 'nodeEnv', ()=>production ? 'production' : !!development && 'development');
|
|
7573
7958
|
let { splitChunks } = optimization;
|
|
7574
7959
|
if (splitChunks) {
|
|
7575
|
-
A(splitChunks, 'defaultSizeTypes', ()=>[
|
|
7960
|
+
D(splitChunks, 'dedupDepth', +!!production), A(splitChunks, 'defaultSizeTypes', ()=>[
|
|
7576
7961
|
"javascript",
|
|
7577
7962
|
'css',
|
|
7578
7963
|
'unknown'
|
|
@@ -7844,17 +8229,34 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7844
8229
|
cache: optionalNestedConfig(config.cache, (cache)=>{
|
|
7845
8230
|
if (!1 === cache) return !1;
|
|
7846
8231
|
if (!0 === cache) return {
|
|
7847
|
-
type: 'memory'
|
|
7848
|
-
snapshot: getNormalizedCacheSnapshot()
|
|
8232
|
+
type: 'memory'
|
|
7849
8233
|
};
|
|
7850
|
-
switch(cache.type){
|
|
8234
|
+
switch('persistent' === cache.type && config.experiments?.newCache && (cache = convertPersistentCacheOptions(cache)), cache.type){
|
|
7851
8235
|
case void 0:
|
|
7852
8236
|
case 'memory':
|
|
7853
8237
|
return {
|
|
7854
|
-
|
|
7855
|
-
type: 'memory',
|
|
7856
|
-
snapshot: getNormalizedCacheSnapshot(cache.snapshot)
|
|
8238
|
+
type: 'memory'
|
|
7857
8239
|
};
|
|
8240
|
+
case 'filesystem':
|
|
8241
|
+
{
|
|
8242
|
+
let context = config.context || process.cwd();
|
|
8243
|
+
return {
|
|
8244
|
+
type: 'filesystem',
|
|
8245
|
+
name: cache.name,
|
|
8246
|
+
version: cache.version,
|
|
8247
|
+
readonly: cache.readonly,
|
|
8248
|
+
maxMemoryGenerations: cache.maxMemoryGenerations,
|
|
8249
|
+
idleTimeout: cache.idleTimeout,
|
|
8250
|
+
idleTimeoutForInitialStore: cache.idleTimeoutForInitialStore,
|
|
8251
|
+
idleTimeoutAfterLargeChanges: cache.idleTimeoutAfterLargeChanges,
|
|
8252
|
+
cacheDirectory: optionalNestedConfig(cache.cacheDirectory, (directory)=>node_path.resolve(context, directory)),
|
|
8253
|
+
cacheLocation: optionalNestedConfig(cache.cacheLocation, (location)=>node_path.resolve(context, location)),
|
|
8254
|
+
buildDependencies: Object.fromEntries(Object.entries(cache.buildDependencies || {}).map(([key, deps])=>[
|
|
8255
|
+
key,
|
|
8256
|
+
deps.map((dependency)=>node_path.resolve(context, dependency))
|
|
8257
|
+
]))
|
|
8258
|
+
};
|
|
8259
|
+
}
|
|
7858
8260
|
case 'persistent':
|
|
7859
8261
|
{
|
|
7860
8262
|
let hasMaxVersions = Object.hasOwn(cache, 'maxVersions');
|
|
@@ -7865,13 +8267,13 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7865
8267
|
name: cache.name,
|
|
7866
8268
|
version: cache.version,
|
|
7867
8269
|
maxAge: cache.maxAge,
|
|
8270
|
+
maxMemoryGenerations: cache.maxMemoryGenerations,
|
|
7868
8271
|
...hasMaxVersions ? {
|
|
7869
8272
|
maxVersions: cache.maxVersions
|
|
7870
8273
|
} : {},
|
|
7871
8274
|
portable: cache.portable,
|
|
7872
8275
|
readonly: cache.readonly,
|
|
7873
8276
|
buildDependencies: nestedArray(cache.buildDependencies, (deps)=>deps.map((d)=>node_path.resolve(context, d))),
|
|
7874
|
-
snapshot: getNormalizedCacheSnapshot(cache.snapshot),
|
|
7875
8277
|
storage: nestedConfig(cache.storage, (storage)=>({
|
|
7876
8278
|
type: storage.type,
|
|
7877
8279
|
directory: optionalNestedConfig(storage.directory, (directory)=>node_path.resolve(context, directory)),
|
|
@@ -7883,6 +8285,10 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7883
8285
|
throw Error(`Not implemented cache.type ${cache.type}`);
|
|
7884
8286
|
}
|
|
7885
8287
|
}),
|
|
8288
|
+
snapshot: getNormalizedSnapshot({
|
|
8289
|
+
...'object' == typeof config.cache && 'persistent' === config.cache.type ? config.cache.snapshot : void 0,
|
|
8290
|
+
...config.snapshot
|
|
8291
|
+
}),
|
|
7886
8292
|
stats: nestedConfig(config.stats, (stats)=>!1 === stats ? {
|
|
7887
8293
|
preset: 'none'
|
|
7888
8294
|
} : !0 === stats ? {
|
|
@@ -7994,7 +8400,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7994
8400
|
emitAssets: !0
|
|
7995
8401
|
} : !0 === incremental || 'advance-silent' === incremental ? {} : 'advance' === incremental ? {
|
|
7996
8402
|
silent: !1
|
|
7997
|
-
} : incremental), getNormalizedNewCacheOptions = (newCache)=>!1 !== newCache && (!0 === newCache ? {} : newCache),
|
|
8403
|
+
} : incremental), getNormalizedNewCacheOptions = (newCache)=>!1 !== newCache && (!0 === newCache ? {} : newCache), getNormalizedSnapshot = (snapshot)=>nestedConfig(snapshot, (snapshot)=>({
|
|
7998
8404
|
immutablePaths: optionalNestedArray(snapshot.immutablePaths, (p)=>[
|
|
7999
8405
|
...p
|
|
8000
8406
|
]),
|
|
@@ -8003,8 +8409,24 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
8003
8409
|
]),
|
|
8004
8410
|
managedPaths: optionalNestedArray(snapshot.managedPaths, (p)=>[
|
|
8005
8411
|
...p
|
|
8006
|
-
])
|
|
8007
|
-
|
|
8412
|
+
]),
|
|
8413
|
+
buildDependencies: optionalNestedConfig(snapshot.buildDependencies, cloneObject),
|
|
8414
|
+
resolveBuildDependencies: optionalNestedConfig(snapshot.resolveBuildDependencies, cloneObject),
|
|
8415
|
+
module: optionalNestedConfig(snapshot.module, cloneObject),
|
|
8416
|
+
contextModule: optionalNestedConfig(snapshot.contextModule, cloneObject),
|
|
8417
|
+
resolve: optionalNestedConfig(snapshot.resolve, cloneObject)
|
|
8418
|
+
})), convertPersistentCacheOptions = (cache)=>({
|
|
8419
|
+
type: 'filesystem',
|
|
8420
|
+
name: cache.name,
|
|
8421
|
+
version: cache.version,
|
|
8422
|
+
readonly: cache.readonly,
|
|
8423
|
+
maxMemoryGenerations: cache.maxMemoryGenerations,
|
|
8424
|
+
buildDependencies: void 0 === cache.buildDependencies ? void 0 : {
|
|
8425
|
+
config: cache.buildDependencies
|
|
8426
|
+
},
|
|
8427
|
+
cacheDirectory: cache.storage?.directory,
|
|
8428
|
+
cacheLocation: cache.storage?.location
|
|
8429
|
+
}), nestedConfig = (value, fn)=>fn(void 0 === value ? {} : value), optionalNestedConfig = (value, fn)=>void 0 === value ? void 0 : fn(value), nestedArray = (value, fn)=>fn(Array.isArray(value) ? value : []), optionalNestedArray = (value, fn)=>Array.isArray(value) ? fn(value) : void 0, cloneObject = (value)=>({
|
|
8008
8430
|
...value
|
|
8009
8431
|
}), keyedNestedConfig = (value, fn, customKeys)=>{
|
|
8010
8432
|
let result = void 0 === value ? {} : Object.keys(value).reduce((obj, key)=>(obj[key] = (customKeys && key in customKeys ? customKeys[key] : fn)(value[key]), obj), {});
|
|
@@ -8029,7 +8451,7 @@ function __to_binding_runtime_globals(runtimeRequirements, compilerRuntimeGlobal
|
|
|
8029
8451
|
}
|
|
8030
8452
|
return res;
|
|
8031
8453
|
}
|
|
8032
|
-
var RuntimeGlobals_RuntimeGlobals = ((RuntimeGlobals = RuntimeGlobals_RuntimeGlobals || {})[RuntimeGlobals.require = 0] = "require", RuntimeGlobals[RuntimeGlobals.requireScope = 1] = "requireScope", RuntimeGlobals[RuntimeGlobals.exports = 2] = "exports", RuntimeGlobals[RuntimeGlobals.thisAsExports = 3] = "thisAsExports", RuntimeGlobals[RuntimeGlobals.returnExportsFromRuntime = 4] = "returnExportsFromRuntime", RuntimeGlobals[RuntimeGlobals.module = 5] = "module", RuntimeGlobals[RuntimeGlobals.moduleId = 6] = "moduleId", RuntimeGlobals[RuntimeGlobals.moduleLoaded = 7] = "moduleLoaded", RuntimeGlobals[RuntimeGlobals.publicPath = 8] = "publicPath", RuntimeGlobals[RuntimeGlobals.entryModuleId = 9] = "entryModuleId", RuntimeGlobals[RuntimeGlobals.moduleCache = 10] = "moduleCache", RuntimeGlobals[RuntimeGlobals.moduleFactories = 11] = "moduleFactories", RuntimeGlobals[RuntimeGlobals.moduleFactoriesAddOnly = 12] = "moduleFactoriesAddOnly", RuntimeGlobals[RuntimeGlobals.ensureChunk = 13] = "ensureChunk", RuntimeGlobals[RuntimeGlobals.ensureChunkHandlers = 14] = "ensureChunkHandlers", RuntimeGlobals[RuntimeGlobals.ensureChunkIncludeEntries = 15] = "ensureChunkIncludeEntries", RuntimeGlobals[RuntimeGlobals.prefetchChunk = 16] = "prefetchChunk", RuntimeGlobals[RuntimeGlobals.prefetchChunkHandlers = 17] = "prefetchChunkHandlers", RuntimeGlobals[RuntimeGlobals.preloadChunk = 18] = "preloadChunk", RuntimeGlobals[RuntimeGlobals.preloadChunkHandlers = 19] = "preloadChunkHandlers", RuntimeGlobals[RuntimeGlobals.definePropertyGetters = 20] = "definePropertyGetters", RuntimeGlobals[RuntimeGlobals.makeNamespaceObject = 21] = "makeNamespaceObject", RuntimeGlobals[RuntimeGlobals.createFakeNamespaceObject = 22] = "createFakeNamespaceObject", RuntimeGlobals[RuntimeGlobals.compatGetDefaultExport = 23] = "compatGetDefaultExport", RuntimeGlobals[RuntimeGlobals.harmonyModuleDecorator = 24] = "harmonyModuleDecorator", RuntimeGlobals[RuntimeGlobals.nodeModuleDecorator = 25] = "nodeModuleDecorator", RuntimeGlobals[RuntimeGlobals.getFullHash = 26] = "getFullHash", RuntimeGlobals[RuntimeGlobals.wasmInstances = 27] = "wasmInstances", RuntimeGlobals[RuntimeGlobals.instantiateWasm = 28] = "instantiateWasm", RuntimeGlobals[RuntimeGlobals.compileWasm = 29] = "compileWasm", RuntimeGlobals[RuntimeGlobals.uncaughtErrorHandler = 30] = "uncaughtErrorHandler", RuntimeGlobals[RuntimeGlobals.scriptNonce = 31] = "scriptNonce", RuntimeGlobals[RuntimeGlobals.loadScript = 32] = "loadScript", RuntimeGlobals[RuntimeGlobals.createScript = 33] = "createScript", RuntimeGlobals[RuntimeGlobals.createScriptUrl = 34] = "createScriptUrl", RuntimeGlobals[RuntimeGlobals.getTrustedTypesPolicy = 35] = "getTrustedTypesPolicy", RuntimeGlobals[RuntimeGlobals.hasFetchPriority = 36] = "hasFetchPriority", RuntimeGlobals[RuntimeGlobals.chunkName = 37] = "chunkName", RuntimeGlobals[RuntimeGlobals.runtimeId = 38] = "runtimeId", RuntimeGlobals[RuntimeGlobals.getChunkScriptFilename = 39] = "getChunkScriptFilename", RuntimeGlobals[RuntimeGlobals.getChunkCssFilename = 40] = "getChunkCssFilename", RuntimeGlobals[RuntimeGlobals.rspackVersion = 41] = "rspackVersion", RuntimeGlobals[RuntimeGlobals.hasCssModules = 42] = "hasCssModules", RuntimeGlobals[RuntimeGlobals.rspackUniqueId = 43] = "rspackUniqueId", RuntimeGlobals[RuntimeGlobals.getChunkUpdateScriptFilename = 44] = "getChunkUpdateScriptFilename", RuntimeGlobals[RuntimeGlobals.getChunkUpdateCssFilename = 45] = "getChunkUpdateCssFilename", RuntimeGlobals[RuntimeGlobals.startup = 46] = "startup", RuntimeGlobals[RuntimeGlobals.startupNoDefault = 47] = "startupNoDefault", RuntimeGlobals[RuntimeGlobals.startupOnlyAfter = 48] = "startupOnlyAfter", RuntimeGlobals[RuntimeGlobals.startupOnlyBefore = 49] = "startupOnlyBefore", RuntimeGlobals[RuntimeGlobals.chunkCallback = 50] = "chunkCallback", RuntimeGlobals[RuntimeGlobals.startupEntrypoint = 51] = "startupEntrypoint", RuntimeGlobals[RuntimeGlobals.startupChunkDependencies = 52] = "startupChunkDependencies", RuntimeGlobals[RuntimeGlobals.onChunksLoaded = 53] = "onChunksLoaded", RuntimeGlobals[RuntimeGlobals.externalInstallChunk = 54] = "externalInstallChunk", RuntimeGlobals[RuntimeGlobals.interceptModuleExecution = 55] = "interceptModuleExecution", RuntimeGlobals[RuntimeGlobals.global = 56] = "global", RuntimeGlobals[RuntimeGlobals.shareScopeMap = 57] = "shareScopeMap", RuntimeGlobals[RuntimeGlobals.initializeSharing = 58] = "initializeSharing", RuntimeGlobals[RuntimeGlobals.currentRemoteGetScope = 59] = "currentRemoteGetScope", RuntimeGlobals[RuntimeGlobals.getUpdateManifestFilename = 60] = "getUpdateManifestFilename", RuntimeGlobals[RuntimeGlobals.hmrDownloadManifest = 61] = "hmrDownloadManifest", RuntimeGlobals[RuntimeGlobals.hmrDownloadUpdateHandlers = 62] = "hmrDownloadUpdateHandlers", RuntimeGlobals[RuntimeGlobals.hmrModuleData = 63] = "hmrModuleData", RuntimeGlobals[RuntimeGlobals.hmrInvalidateModuleHandlers = 64] = "hmrInvalidateModuleHandlers", RuntimeGlobals[RuntimeGlobals.hmrRuntimeStatePrefix = 65] = "hmrRuntimeStatePrefix", RuntimeGlobals[RuntimeGlobals.amdDefine = 66] = "amdDefine", RuntimeGlobals[RuntimeGlobals.amdOptions = 67] = "amdOptions", RuntimeGlobals[RuntimeGlobals.system = 68] = "system", RuntimeGlobals[RuntimeGlobals.hasOwnProperty = 69] = "hasOwnProperty", RuntimeGlobals[RuntimeGlobals.systemContext = 70] = "systemContext", RuntimeGlobals[RuntimeGlobals.baseURI = 71] = "baseURI", RuntimeGlobals[RuntimeGlobals.relativeUrl = 72] = "relativeUrl", RuntimeGlobals[RuntimeGlobals.asyncModule = 73] = "asyncModule", RuntimeGlobals[RuntimeGlobals.asyncModuleExportSymbol = 74] = "asyncModuleExportSymbol", RuntimeGlobals[RuntimeGlobals.makeDeferredNamespaceObject = 75] = "makeDeferredNamespaceObject", RuntimeGlobals[RuntimeGlobals.makeDeferredNamespaceObjectSymbol = 76] = "makeDeferredNamespaceObjectSymbol", RuntimeGlobals);
|
|
8454
|
+
var RuntimeGlobals_RuntimeGlobals = ((RuntimeGlobals = RuntimeGlobals_RuntimeGlobals || {})[RuntimeGlobals.require = 0] = "require", RuntimeGlobals[RuntimeGlobals.requireScope = 1] = "requireScope", RuntimeGlobals[RuntimeGlobals.exports = 2] = "exports", RuntimeGlobals[RuntimeGlobals.thisAsExports = 3] = "thisAsExports", RuntimeGlobals[RuntimeGlobals.returnExportsFromRuntime = 4] = "returnExportsFromRuntime", RuntimeGlobals[RuntimeGlobals.module = 5] = "module", RuntimeGlobals[RuntimeGlobals.moduleId = 6] = "moduleId", RuntimeGlobals[RuntimeGlobals.moduleLoaded = 7] = "moduleLoaded", RuntimeGlobals[RuntimeGlobals.publicPath = 8] = "publicPath", RuntimeGlobals[RuntimeGlobals.entryModuleId = 9] = "entryModuleId", RuntimeGlobals[RuntimeGlobals.moduleCache = 10] = "moduleCache", RuntimeGlobals[RuntimeGlobals.moduleFactories = 11] = "moduleFactories", RuntimeGlobals[RuntimeGlobals.moduleFactoriesAddOnly = 12] = "moduleFactoriesAddOnly", RuntimeGlobals[RuntimeGlobals.ensureChunk = 13] = "ensureChunk", RuntimeGlobals[RuntimeGlobals.ensureChunkHandlers = 14] = "ensureChunkHandlers", RuntimeGlobals[RuntimeGlobals.ensureChunkIncludeEntries = 15] = "ensureChunkIncludeEntries", RuntimeGlobals[RuntimeGlobals.prefetchChunk = 16] = "prefetchChunk", RuntimeGlobals[RuntimeGlobals.prefetchChunkHandlers = 17] = "prefetchChunkHandlers", RuntimeGlobals[RuntimeGlobals.preloadChunk = 18] = "preloadChunk", RuntimeGlobals[RuntimeGlobals.preloadChunkHandlers = 19] = "preloadChunkHandlers", RuntimeGlobals[RuntimeGlobals.definePropertyGetters = 20] = "definePropertyGetters", RuntimeGlobals[RuntimeGlobals.makeNamespaceObject = 21] = "makeNamespaceObject", RuntimeGlobals[RuntimeGlobals.createFakeNamespaceObject = 22] = "createFakeNamespaceObject", RuntimeGlobals[RuntimeGlobals.compatGetDefaultExport = 23] = "compatGetDefaultExport", RuntimeGlobals[RuntimeGlobals.harmonyModuleDecorator = 24] = "harmonyModuleDecorator", RuntimeGlobals[RuntimeGlobals.nodeModuleDecorator = 25] = "nodeModuleDecorator", RuntimeGlobals[RuntimeGlobals.getFullHash = 26] = "getFullHash", RuntimeGlobals[RuntimeGlobals.wasmInstances = 27] = "wasmInstances", RuntimeGlobals[RuntimeGlobals.instantiateWasm = 28] = "instantiateWasm", RuntimeGlobals[RuntimeGlobals.compileWasm = 29] = "compileWasm", RuntimeGlobals[RuntimeGlobals.uncaughtErrorHandler = 30] = "uncaughtErrorHandler", RuntimeGlobals[RuntimeGlobals.scriptNonce = 31] = "scriptNonce", RuntimeGlobals[RuntimeGlobals.loadScript = 32] = "loadScript", RuntimeGlobals[RuntimeGlobals.createScript = 33] = "createScript", RuntimeGlobals[RuntimeGlobals.createScriptUrl = 34] = "createScriptUrl", RuntimeGlobals[RuntimeGlobals.getTrustedTypesPolicy = 35] = "getTrustedTypesPolicy", RuntimeGlobals[RuntimeGlobals.hasFetchPriority = 36] = "hasFetchPriority", RuntimeGlobals[RuntimeGlobals.chunkName = 37] = "chunkName", RuntimeGlobals[RuntimeGlobals.runtimeId = 38] = "runtimeId", RuntimeGlobals[RuntimeGlobals.getChunkScriptFilename = 39] = "getChunkScriptFilename", RuntimeGlobals[RuntimeGlobals.getChunkCssFilename = 40] = "getChunkCssFilename", RuntimeGlobals[RuntimeGlobals.rspackVersion = 41] = "rspackVersion", RuntimeGlobals[RuntimeGlobals.hasCssModules = 42] = "hasCssModules", RuntimeGlobals[RuntimeGlobals.rspackUniqueId = 43] = "rspackUniqueId", RuntimeGlobals[RuntimeGlobals.getChunkUpdateScriptFilename = 44] = "getChunkUpdateScriptFilename", RuntimeGlobals[RuntimeGlobals.getChunkUpdateCssFilename = 45] = "getChunkUpdateCssFilename", RuntimeGlobals[RuntimeGlobals.startup = 46] = "startup", RuntimeGlobals[RuntimeGlobals.startupNoDefault = 47] = "startupNoDefault", RuntimeGlobals[RuntimeGlobals.startupOnlyAfter = 48] = "startupOnlyAfter", RuntimeGlobals[RuntimeGlobals.startupOnlyBefore = 49] = "startupOnlyBefore", RuntimeGlobals[RuntimeGlobals.chunkCallback = 50] = "chunkCallback", RuntimeGlobals[RuntimeGlobals.startupEntrypoint = 51] = "startupEntrypoint", RuntimeGlobals[RuntimeGlobals.startupChunkDependencies = 52] = "startupChunkDependencies", RuntimeGlobals[RuntimeGlobals.onChunksLoaded = 53] = "onChunksLoaded", RuntimeGlobals[RuntimeGlobals.externalInstallChunk = 54] = "externalInstallChunk", RuntimeGlobals[RuntimeGlobals.interceptModuleExecution = 55] = "interceptModuleExecution", RuntimeGlobals[RuntimeGlobals.global = 56] = "global", RuntimeGlobals[RuntimeGlobals.shareScopeMap = 57] = "shareScopeMap", RuntimeGlobals[RuntimeGlobals.initializeSharing = 58] = "initializeSharing", RuntimeGlobals[RuntimeGlobals.currentRemoteGetScope = 59] = "currentRemoteGetScope", RuntimeGlobals[RuntimeGlobals.getUpdateManifestFilename = 60] = "getUpdateManifestFilename", RuntimeGlobals[RuntimeGlobals.hmrDownloadManifest = 61] = "hmrDownloadManifest", RuntimeGlobals[RuntimeGlobals.hmrDownloadUpdateHandlers = 62] = "hmrDownloadUpdateHandlers", RuntimeGlobals[RuntimeGlobals.hmrModuleData = 63] = "hmrModuleData", RuntimeGlobals[RuntimeGlobals.hmrInvalidateModuleHandlers = 64] = "hmrInvalidateModuleHandlers", RuntimeGlobals[RuntimeGlobals.hmrRuntimeStatePrefix = 65] = "hmrRuntimeStatePrefix", RuntimeGlobals[RuntimeGlobals.amdDefine = 66] = "amdDefine", RuntimeGlobals[RuntimeGlobals.amdOptions = 67] = "amdOptions", RuntimeGlobals[RuntimeGlobals.system = 68] = "system", RuntimeGlobals[RuntimeGlobals.hasOwnProperty = 69] = "hasOwnProperty", RuntimeGlobals[RuntimeGlobals.systemContext = 70] = "systemContext", RuntimeGlobals[RuntimeGlobals.baseURI = 71] = "baseURI", RuntimeGlobals[RuntimeGlobals.relativeUrl = 72] = "relativeUrl", RuntimeGlobals[RuntimeGlobals.asyncModule = 73] = "asyncModule", RuntimeGlobals[RuntimeGlobals.asyncModuleExportSymbol = 74] = "asyncModuleExportSymbol", RuntimeGlobals[RuntimeGlobals.makeDeferredNamespaceObject = 75] = "makeDeferredNamespaceObject", RuntimeGlobals[RuntimeGlobals.makeDeferredNamespaceObjectSymbol = 76] = "makeDeferredNamespaceObjectSymbol", RuntimeGlobals[RuntimeGlobals.deferredModuleExports = 77] = "deferredModuleExports", RuntimeGlobals);
|
|
8033
8455
|
function renderRuntimeVariables(variable, compilerOptions) {
|
|
8034
8456
|
if (compilerOptions?.experiments.runtimeMode === 'rspack') switch(variable){
|
|
8035
8457
|
case 0:
|
|
@@ -8091,6 +8513,8 @@ function createCompilerRuntimeGlobals(compilerOptions) {
|
|
|
8091
8513
|
return `${scope_name}.s`;
|
|
8092
8514
|
case 10:
|
|
8093
8515
|
return `${scope_name}.c`;
|
|
8516
|
+
case 77:
|
|
8517
|
+
return `${scope_name}.zD`;
|
|
8094
8518
|
case 11:
|
|
8095
8519
|
return `${scope_name}.m`;
|
|
8096
8520
|
case 12:
|
|
@@ -8234,7 +8658,7 @@ class ExecuteModulePlugin {
|
|
|
8234
8658
|
apply(compiler) {
|
|
8235
8659
|
compiler.hooks.thisCompilation.tap('executeModule', (compilation)=>{
|
|
8236
8660
|
compiler.__internal__get_module_execution_results_map().clear(), compilation.hooks.executeModule.tap('executeModule', (options, context)=>{
|
|
8237
|
-
let vm =
|
|
8661
|
+
let vm = rspackRequire("node:vm"), moduleObject = options.moduleObject, source = options.codeGenerationResult.get("javascript");
|
|
8238
8662
|
if (void 0 !== source) try {
|
|
8239
8663
|
let isRspackRuntimeMode = compiler.options.experiments?.runtimeMode === 'rspack', moduleArgument = renderRuntimeVariables(4, compiler.options), exportsArgument = renderRuntimeVariables(5, compiler.options), requireArgument = renderRuntimeVariables(0, compiler.options), runtimeContextArgument = renderRuntimeVariables(1, compiler.options), runtimeContext = context[runtimeContextArgument], runtimeModeArguments = isRspackRuntimeMode ? `, ${runtimeContextArgument}` : '';
|
|
8240
8664
|
vm.runInThisContext(`(function(module, ${moduleArgument}, ${exportsArgument}, exports, ${requireArgument}${runtimeModeArguments}) {\n${source}\n})`, {
|
|
@@ -8297,6 +8721,7 @@ let fs_join = (fs, rootPath, filename)=>{
|
|
|
8297
8721
|
readFile: ASYNC_NOOP,
|
|
8298
8722
|
stat: ASYNC_NOOP,
|
|
8299
8723
|
lstat: ASYNC_NOOP,
|
|
8724
|
+
readlink: ASYNC_NOOP,
|
|
8300
8725
|
chmod: ASYNC_NOOP,
|
|
8301
8726
|
realpath: ASYNC_NOOP,
|
|
8302
8727
|
open: ASYNC_NOOP,
|
|
@@ -8334,6 +8759,7 @@ class ThreadsafeInputNodeFS {
|
|
|
8334
8759
|
readFile;
|
|
8335
8760
|
stat;
|
|
8336
8761
|
lstat;
|
|
8762
|
+
readlink;
|
|
8337
8763
|
chmod;
|
|
8338
8764
|
realpath;
|
|
8339
8765
|
open;
|
|
@@ -8359,7 +8785,7 @@ class ThreadsafeInputNodeFS {
|
|
|
8359
8785
|
if (err) return reject(err);
|
|
8360
8786
|
resolve(stats && __to_binding_stat(stats));
|
|
8361
8787
|
});
|
|
8362
|
-
})), this.realpath = memoizeFn(()=>(name)=>new Promise((resolve, reject)=>{
|
|
8788
|
+
})), this.readlink = memoizeFn(()=>node_util.promisify(fs.readlink.bind(fs))), this.realpath = memoizeFn(()=>(name)=>new Promise((resolve, reject)=>{
|
|
8363
8789
|
fs.realpath ? fs.realpath(name, (err, path)=>{
|
|
8364
8790
|
if (err) return reject(err);
|
|
8365
8791
|
resolve(path);
|
|
@@ -8383,6 +8809,7 @@ class ThreadsafeOutputNodeFS {
|
|
|
8383
8809
|
readFile;
|
|
8384
8810
|
stat;
|
|
8385
8811
|
lstat;
|
|
8812
|
+
readlink;
|
|
8386
8813
|
chmod;
|
|
8387
8814
|
realpath;
|
|
8388
8815
|
open;
|
|
@@ -8496,6 +8923,7 @@ class Cache {
|
|
|
8496
8923
|
static STAGE_MEMORY = -10;
|
|
8497
8924
|
static STAGE_DEFAULT = 0;
|
|
8498
8925
|
static STAGE_NETWORK = 20;
|
|
8926
|
+
#binding;
|
|
8499
8927
|
hooks;
|
|
8500
8928
|
constructor(){
|
|
8501
8929
|
this.hooks = {
|
|
@@ -8516,6 +8944,11 @@ class Cache {
|
|
|
8516
8944
|
endIdle: new AsyncParallelHook([]),
|
|
8517
8945
|
shutdown: new AsyncParallelHook([])
|
|
8518
8946
|
};
|
|
8947
|
+
let { JsCache } = rspackRequire("@rspack/binding");
|
|
8948
|
+
this.#binding = new JsCache();
|
|
8949
|
+
}
|
|
8950
|
+
static __to_binding(cache) {
|
|
8951
|
+
return cache.#binding;
|
|
8519
8952
|
}
|
|
8520
8953
|
get(identifier, etag, callback) {
|
|
8521
8954
|
let gotHandlers = [];
|
|
@@ -8536,13 +8969,15 @@ class Cache {
|
|
|
8536
8969
|
this.hooks.storeBuildDependencies.callAsync(dependencies, makeWebpackErrorCallback(callback, 'Cache.hooks.storeBuildDependencies'));
|
|
8537
8970
|
}
|
|
8538
8971
|
beginIdle() {
|
|
8539
|
-
this.hooks.beginIdle.call();
|
|
8972
|
+
this.hooks.beginIdle.call(), this.#binding.beginIdle();
|
|
8540
8973
|
}
|
|
8541
8974
|
endIdle(callback) {
|
|
8542
|
-
this.hooks.endIdle.callAsync(makeWebpackErrorCallback(callback, 'Cache.hooks.endIdle'));
|
|
8975
|
+
this.#binding.endIdle(), this.hooks.endIdle.callAsync(makeWebpackErrorCallback(callback, 'Cache.hooks.endIdle'));
|
|
8543
8976
|
}
|
|
8544
8977
|
shutdown(callback) {
|
|
8545
|
-
this.
|
|
8978
|
+
this.#binding.shutdown().then(()=>{
|
|
8979
|
+
this.hooks.shutdown.callAsync(makeWebpackErrorCallback(callback, 'Cache.hooks.shutdown'));
|
|
8980
|
+
});
|
|
8546
8981
|
}
|
|
8547
8982
|
}
|
|
8548
8983
|
class LazyHashedEtag {
|
|
@@ -8709,36 +9144,6 @@ let lib_CacheFacade = class CacheFacade {
|
|
|
8709
9144
|
return await this.storePromise(identifier, etag, result), result;
|
|
8710
9145
|
}
|
|
8711
9146
|
};
|
|
8712
|
-
class NormalModuleFactory {
|
|
8713
|
-
hooks;
|
|
8714
|
-
resolverFactory;
|
|
8715
|
-
constructor(resolverFactory){
|
|
8716
|
-
this.hooks = {
|
|
8717
|
-
resolveForScheme: new HookMap(()=>new AsyncSeriesBailHook([
|
|
8718
|
-
'resourceData'
|
|
8719
|
-
])),
|
|
8720
|
-
beforeResolve: new AsyncSeriesBailHook([
|
|
8721
|
-
'resolveData'
|
|
8722
|
-
]),
|
|
8723
|
-
factorize: new AsyncSeriesBailHook([
|
|
8724
|
-
'resolveData'
|
|
8725
|
-
]),
|
|
8726
|
-
resolve: new AsyncSeriesBailHook([
|
|
8727
|
-
'resolveData'
|
|
8728
|
-
]),
|
|
8729
|
-
afterResolve: new AsyncSeriesBailHook([
|
|
8730
|
-
'resolveData'
|
|
8731
|
-
]),
|
|
8732
|
-
createModule: new AsyncSeriesBailHook([
|
|
8733
|
-
'createData',
|
|
8734
|
-
'resolveData'
|
|
8735
|
-
])
|
|
8736
|
-
}, this.resolverFactory = resolverFactory;
|
|
8737
|
-
}
|
|
8738
|
-
getResolver(type, resolveOptions) {
|
|
8739
|
-
return this.resolverFactory.get(type, resolveOptions);
|
|
8740
|
-
}
|
|
8741
|
-
}
|
|
8742
9147
|
class Resolver {
|
|
8743
9148
|
#binding;
|
|
8744
9149
|
constructor(binding){
|
|
@@ -8759,7 +9164,9 @@ class Resolver {
|
|
|
8759
9164
|
});
|
|
8760
9165
|
}
|
|
8761
9166
|
}
|
|
8762
|
-
let EMPTY_RESOLVE_OPTIONS = {}
|
|
9167
|
+
let EMPTY_RESOLVE_OPTIONS = {}, keepRegExpInCacheKey = (_key, value)=>value instanceof RegExp ? {
|
|
9168
|
+
regexp: String(value)
|
|
9169
|
+
} : value;
|
|
8763
9170
|
class ResolverFactory {
|
|
8764
9171
|
#binding;
|
|
8765
9172
|
#cache = new Map();
|
|
@@ -8790,7 +9197,7 @@ class ResolverFactory {
|
|
|
8790
9197
|
}, this.#cache.set(type, typedCaches));
|
|
8791
9198
|
let cachedResolver = typedCaches.direct.get(resolveOptions);
|
|
8792
9199
|
if (cachedResolver) return cachedResolver;
|
|
8793
|
-
let ident = JSON.stringify(resolveOptions), resolver = typedCaches.stringified.get(ident);
|
|
9200
|
+
let ident = JSON.stringify(resolveOptions, keepRegExpInCacheKey), resolver = typedCaches.stringified.get(ident);
|
|
8794
9201
|
if (resolver) return typedCaches.direct.set(resolveOptions, resolver), resolver;
|
|
8795
9202
|
let newResolver = this.#create(type, resolveOptions);
|
|
8796
9203
|
return typedCaches.direct.set(resolveOptions, newResolver), typedCaches.stringified.set(ident, newResolver), newResolver;
|
|
@@ -8847,7 +9254,7 @@ class MultiStats {
|
|
|
8847
9254
|
obj.children = this.stats.map((stat, idx)=>{
|
|
8848
9255
|
let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
|
|
8849
9256
|
return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
|
|
8850
|
-
}), childOptions.version && (obj.rspackVersion = "2.2.
|
|
9257
|
+
}), childOptions.version && (obj.rspackVersion = "2.2.9", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
|
|
8851
9258
|
let mapError = (j, obj)=>({
|
|
8852
9259
|
...obj,
|
|
8853
9260
|
compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
|
|
@@ -9001,9 +9408,14 @@ class MultiCompiler {
|
|
|
9001
9408
|
let compiler = this.compilers[index], compilerIndex = index, compilerDone = !1;
|
|
9002
9409
|
compiler.hooks.done.tap('MultiCompiler', (stats)=>{
|
|
9003
9410
|
!compilerDone && (compilerDone = !0, doneCompilers++), compilerStats[compilerIndex] = stats, doneCompilers === this.compilers.length && this.hooks.done.call(new MultiStats(compilerStats));
|
|
9004
|
-
}), compiler.hooks.invalid.tap('MultiCompiler', ()=>{
|
|
9005
|
-
compilerDone && (compilerDone = !1, doneCompilers--);
|
|
9006
9411
|
});
|
|
9412
|
+
let resetDoneState = ()=>{
|
|
9413
|
+
compilerDone && (compilerDone = !1, doneCompilers--);
|
|
9414
|
+
};
|
|
9415
|
+
compiler.hooks.invalid.tap('MultiCompiler', resetDoneState), compiler.hooks.watchRun.tap({
|
|
9416
|
+
name: 'MultiCompiler',
|
|
9417
|
+
stage: -1 / 0
|
|
9418
|
+
}, resetDoneState);
|
|
9007
9419
|
}
|
|
9008
9420
|
}
|
|
9009
9421
|
set unsafeFastDrop(value) {
|
|
@@ -9248,8 +9660,7 @@ class NativeWatchFileSystem {
|
|
|
9248
9660
|
aggregateTimeout: options.aggregateTimeout,
|
|
9249
9661
|
pollInterval: 'boolean' == typeof options.poll ? 0 : options.poll,
|
|
9250
9662
|
ignored: ((ignored)=>{
|
|
9251
|
-
if (Array.isArray(ignored) || 'string' == typeof ignored || ignored instanceof RegExp) return ignored;
|
|
9252
|
-
if ('function' == typeof ignored) throw Error("NativeWatcher does not support using a function for the 'ignored' option");
|
|
9663
|
+
if (Array.isArray(ignored) || 'string' == typeof ignored || ignored instanceof RegExp || 'function' == typeof ignored) return ignored;
|
|
9253
9664
|
})(options.ignored)
|
|
9254
9665
|
}, nativeWatcher = new (binding__default()).NativeWatcher(nativeWatcherOptions);
|
|
9255
9666
|
return this.#inner = nativeWatcher, nativeWatcher;
|
|
@@ -9280,6 +9691,7 @@ class NativeWatchFileSystem {
|
|
|
9280
9691
|
];
|
|
9281
9692
|
}
|
|
9282
9693
|
}
|
|
9694
|
+
let internalCallbacks = new WeakSet();
|
|
9283
9695
|
class NodeWatchFileSystem {
|
|
9284
9696
|
inputFileSystem;
|
|
9285
9697
|
watcherOptions;
|
|
@@ -9298,7 +9710,7 @@ class NodeWatchFileSystem {
|
|
|
9298
9710
|
if ('number' != typeof startTime && startTime) throw Error("Invalid arguments: 'startTime'");
|
|
9299
9711
|
if ('object' != typeof options) throw Error("Invalid arguments: 'options'");
|
|
9300
9712
|
if ('function' != typeof callbackUndelayed && callbackUndelayed) throw Error("Invalid arguments: 'callbackUndelayed'");
|
|
9301
|
-
let oldWatcher = this.watcher, Watchpack =
|
|
9713
|
+
let oldWatcher = this.watcher, Watchpack = rspackRequire("watchpack");
|
|
9302
9714
|
this.watcher = new Watchpack(options), callbackUndelayed && this.watcher?.once('change', callbackUndelayed), this.watcher?.on('change', (filename, mtime)=>{
|
|
9303
9715
|
this.#events.emit('change', filename, mtime);
|
|
9304
9716
|
}), this.watcher?.on('remove', (filename)=>{
|
|
@@ -9319,6 +9731,7 @@ class NodeWatchFileSystem {
|
|
|
9319
9731
|
for (let item of changes)fs.purge?.(item);
|
|
9320
9732
|
for (let item of removals)fs.purge?.(item);
|
|
9321
9733
|
}
|
|
9734
|
+
if (internalCallbacks.has(callback)) return void callback(null, void 0, void 0, changes, removals);
|
|
9322
9735
|
let { fileTimeInfoEntries, contextTimeInfoEntries } = fetchTimeInfo();
|
|
9323
9736
|
callback(null, fileTimeInfoEntries, contextTimeInfoEntries, changes, removals);
|
|
9324
9737
|
}), this.watcher?.watch({
|
|
@@ -9403,8 +9816,8 @@ let arraySum = (array)=>{
|
|
|
9403
9816
|
let str = `${a}`, length = lengths[i];
|
|
9404
9817
|
return str.length === length ? str : length > 5 ? `...${str.slice(-length + 3)}` : length > 0 ? str.slice(-length) : '';
|
|
9405
9818
|
});
|
|
9406
|
-
}
|
|
9407
|
-
var CachedInputFileSystem_default =
|
|
9819
|
+
};
|
|
9820
|
+
var CachedInputFileSystem_default = compatGetDefaultExport(rspackRequire("../../node_modules/.pnpm/enhanced-resolve@5.26.0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js"));
|
|
9408
9821
|
class NodeEnvironmentPlugin {
|
|
9409
9822
|
options;
|
|
9410
9823
|
constructor(options){
|
|
@@ -10169,7 +10582,7 @@ let iterateConfig = (config, options, fn)=>{
|
|
|
10169
10582
|
object.hash = context.getStatsCompilation(compilation).hash;
|
|
10170
10583
|
},
|
|
10171
10584
|
version: (object)=>{
|
|
10172
|
-
object.version = "5.75.0", object.rspackVersion = "2.2.
|
|
10585
|
+
object.version = "5.75.0", object.rspackVersion = "2.2.9";
|
|
10173
10586
|
},
|
|
10174
10587
|
env: (object, _compilation, _context, { _env })=>{
|
|
10175
10588
|
object.env = _env;
|
|
@@ -11421,6 +11834,7 @@ class RspackOptionsApply {
|
|
|
11421
11834
|
fallbackModuleFilenameTemplate: options.output.devtoolFallbackModuleFilenameTemplate,
|
|
11422
11835
|
append: !hidden && void 0,
|
|
11423
11836
|
module: !!moduleMaps || !cheap,
|
|
11837
|
+
test: evalWrapped ? void 0 : /\.((c|m)?js|css)($|\?)/i,
|
|
11424
11838
|
columns: !cheap,
|
|
11425
11839
|
noSources: noSources,
|
|
11426
11840
|
namespace: options.output.devtoolNamespace,
|
|
@@ -11862,7 +12276,7 @@ class TraceHookPlugin {
|
|
|
11862
12276
|
});
|
|
11863
12277
|
}
|
|
11864
12278
|
}
|
|
11865
|
-
let CORE_VERSION = "2.2.
|
|
12279
|
+
let CORE_VERSION = "2.2.9", VFILES_BY_COMPILER = new WeakMap();
|
|
11866
12280
|
class VirtualModulesPlugin {
|
|
11867
12281
|
#staticModules;
|
|
11868
12282
|
#compiler;
|
|
@@ -11937,10 +12351,11 @@ class Watching {
|
|
|
11937
12351
|
});
|
|
11938
12352
|
}
|
|
11939
12353
|
watch(files, dirs, missing) {
|
|
11940
|
-
|
|
12354
|
+
var callback;
|
|
12355
|
+
this.pausedWatcher = void 0, this.watcher = this.compiler.watchFileSystem.watch(files, dirs, missing, this.lastWatcherStartTime, this.watchOptions, (callback = (err, fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles)=>{
|
|
11941
12356
|
if (err) return this.compiler.fileTimestamps = void 0, this.compiler.contextTimestamps = void 0, this.compiler.modifiedFiles = void 0, this.compiler.removedFiles = void 0, this.handler(err);
|
|
11942
12357
|
this.#invalidate(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles), this.onChange();
|
|
11943
|
-
}, (fileName, changeTime)=>{
|
|
12358
|
+
}, internalCallbacks.add(callback), callback), (fileName, changeTime)=>{
|
|
11944
12359
|
this.#invalidReported || (this.#invalidReported = !0, this.compiler.hooks.invalid.call(fileName, changeTime)), this.onInvalid();
|
|
11945
12360
|
});
|
|
11946
12361
|
}
|
|
@@ -11979,26 +12394,34 @@ class Watching {
|
|
|
11979
12394
|
let { changes, removals, fileTimeInfoEntries, contextTimeInfoEntries } = this.pausedWatcher.getInfo();
|
|
11980
12395
|
this.#mergeWithCollected(changes, removals), this.compiler.fileTimestamps = fileTimeInfoEntries, this.compiler.contextTimestamps = contextTimeInfoEntries;
|
|
11981
12396
|
}
|
|
11982
|
-
this.compiler.modifiedFiles = this.#collectedChangedFiles, this.compiler.removedFiles = this.#collectedRemovedFiles, this.#collectedChangedFiles = void 0, this.#collectedRemovedFiles = void 0
|
|
11983
|
-
|
|
11984
|
-
|
|
12397
|
+
this.compiler.modifiedFiles = this.#collectedChangedFiles, this.compiler.removedFiles = this.#collectedRemovedFiles, this.#collectedChangedFiles = void 0, this.#collectedRemovedFiles = void 0;
|
|
12398
|
+
let run = ()=>{
|
|
12399
|
+
if (this.compiler.idle) return this.compiler.cache.endIdle((err)=>{
|
|
12400
|
+
if (err) return this._done(err);
|
|
12401
|
+
this.compiler.idle = !1, run();
|
|
12402
|
+
});
|
|
12403
|
+
this.invalid = !1, this.#invalidReported = !1, this.compiler.hooks.watchRun.callAsync(this.compiler, (err)=>{
|
|
11985
12404
|
if (err) return this._done(err);
|
|
11986
|
-
|
|
11987
|
-
|
|
11988
|
-
|
|
11989
|
-
|
|
11990
|
-
|
|
11991
|
-
this.compiler.hooks.
|
|
12405
|
+
let onCompiled = (err, _compilation)=>{
|
|
12406
|
+
if (err) return this._done(err);
|
|
12407
|
+
if (_compilation.hooks.needAdditionalPass.call()) {
|
|
12408
|
+
_compilation.needAdditionalPass = !0, _compilation.startTime = this.startTime, _compilation.endTime = Date.now();
|
|
12409
|
+
let stats = new Stats(_compilation);
|
|
12410
|
+
this.compiler.hooks.done.callAsync(stats, (err)=>{
|
|
11992
12411
|
if (err) return this._done(err, _compilation);
|
|
11993
|
-
this.compiler.
|
|
12412
|
+
this.compiler.hooks.additionalPass.callAsync((err)=>{
|
|
12413
|
+
if (err) return this._done(err, _compilation);
|
|
12414
|
+
this.compiler.compile(onCompiled);
|
|
12415
|
+
});
|
|
11994
12416
|
});
|
|
11995
|
-
|
|
11996
|
-
|
|
11997
|
-
|
|
11998
|
-
|
|
11999
|
-
|
|
12000
|
-
|
|
12001
|
-
}
|
|
12417
|
+
return;
|
|
12418
|
+
}
|
|
12419
|
+
this._done(null, this.compiler._lastCompilation);
|
|
12420
|
+
};
|
|
12421
|
+
this.compiler.compile(onCompiled);
|
|
12422
|
+
});
|
|
12423
|
+
};
|
|
12424
|
+
run();
|
|
12002
12425
|
}
|
|
12003
12426
|
#accumulateWatchDeps(compilation) {
|
|
12004
12427
|
let pending = this.#pendingWatchDeps ??= {
|
|
@@ -12021,7 +12444,7 @@ class Watching {
|
|
|
12021
12444
|
let stats;
|
|
12022
12445
|
this.running = !1;
|
|
12023
12446
|
let handleError = (err, cbs)=>{
|
|
12024
|
-
for (let cb of (this.compiler.hooks.failed.call(err), this.handler(err, stats), cbs || this.callbacks.splice(0)))cb(err);
|
|
12447
|
+
for (let cb of (this.compiler.hooks.failed.call(err), this.compiler.cache.beginIdle(), this.compiler.idle = !0, this.handler(err, stats), cbs || this.callbacks.splice(0)))cb(err);
|
|
12025
12448
|
};
|
|
12026
12449
|
if (error) return handleError(error);
|
|
12027
12450
|
if (!compilation) throw Error('compilation is required if no error');
|
|
@@ -12034,7 +12457,7 @@ class Watching {
|
|
|
12034
12457
|
let cbs = this.callbacks;
|
|
12035
12458
|
this.callbacks = [], this.compiler.hooks.done.callAsync(stats, (err)=>{
|
|
12036
12459
|
if (err) return handleError(err, cbs);
|
|
12037
|
-
for (let cb of (this.handler(null, stats), process.nextTick(()=>{
|
|
12460
|
+
for (let cb of (this.handler(null, stats), this.compiler.cache.beginIdle(), this.compiler.idle = !0, process.nextTick(()=>{
|
|
12038
12461
|
if (!this.#closed) {
|
|
12039
12462
|
this.#accumulateWatchDeps(compilation);
|
|
12040
12463
|
let pending = this.#pendingWatchDeps;
|
|
@@ -12308,7 +12731,7 @@ class Compiler {
|
|
|
12308
12731
|
let startTime = Date.now();
|
|
12309
12732
|
this.running = !0;
|
|
12310
12733
|
let finalCallback = (err, stats)=>{
|
|
12311
|
-
this.idle = !0, this.cache.beginIdle(), this.
|
|
12734
|
+
this.idle = !0, this.cache.beginIdle(), this.running = !1, err && this.hooks.failed.call(err), callback && callback(err, stats), this.hooks.afterDone.call(stats);
|
|
12312
12735
|
}, onCompiled = (err, _compilation)=>{
|
|
12313
12736
|
if (err) return finalCallback(err);
|
|
12314
12737
|
if (_compilation.hooks.needAdditionalPass.call()) {
|
|
@@ -12336,7 +12759,7 @@ class Compiler {
|
|
|
12336
12759
|
});
|
|
12337
12760
|
};
|
|
12338
12761
|
this.idle ? this.cache.endIdle((err)=>{
|
|
12339
|
-
if (err) return
|
|
12762
|
+
if (err) return finalCallback(err);
|
|
12340
12763
|
this.idle = !1, run();
|
|
12341
12764
|
}) : run();
|
|
12342
12765
|
}
|
|
@@ -12390,14 +12813,16 @@ class Compiler {
|
|
|
12390
12813
|
});
|
|
12391
12814
|
}
|
|
12392
12815
|
close(callback) {
|
|
12393
|
-
this.watching
|
|
12816
|
+
if (this.watching) return void this.watching.close(()=>{
|
|
12394
12817
|
this.close(callback);
|
|
12395
|
-
})
|
|
12396
|
-
|
|
12397
|
-
this
|
|
12398
|
-
|
|
12399
|
-
|
|
12400
|
-
|
|
12818
|
+
});
|
|
12819
|
+
let instanceCallback = (error)=>{
|
|
12820
|
+
let close = this.#instance?.close();
|
|
12821
|
+
close ? close.then(()=>callback(error), (closeError)=>callback(error || closeError)) : callback(error);
|
|
12822
|
+
};
|
|
12823
|
+
this.hooks.shutdown.callAsync((err)=>{
|
|
12824
|
+
if (err) return instanceCallback(err);
|
|
12825
|
+
this.cache.shutdown(instanceCallback);
|
|
12401
12826
|
});
|
|
12402
12827
|
}
|
|
12403
12828
|
#build(callback) {
|
|
@@ -12436,16 +12861,16 @@ class Compiler {
|
|
|
12436
12861
|
return this.#compilationParams = params, params;
|
|
12437
12862
|
}
|
|
12438
12863
|
#getInstance(callback) {
|
|
12439
|
-
var output;
|
|
12440
|
-
let coreVersion, expectedCoreVersion, statsOptions, mode, experiments, cache, error = CORE_VERSION === binding__default().EXPECTED_RSPACK_CORE_VERSION || CORE_VERSION.includes('canary') ? null : Error((coreVersion = CORE_VERSION, expectedCoreVersion = binding__default().EXPECTED_RSPACK_CORE_VERSION, process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
|
|
12864
|
+
var output, snapshot;
|
|
12865
|
+
let coreVersion, expectedCoreVersion, statsOptions, strategy, mode, experiments, cache, error = CORE_VERSION === binding__default().EXPECTED_RSPACK_CORE_VERSION || CORE_VERSION.includes('canary') ? null : Error((coreVersion = CORE_VERSION, expectedCoreVersion = binding__default().EXPECTED_RSPACK_CORE_VERSION, process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
|
|
12441
12866
|
|
|
12442
12867
|
Help:
|
|
12443
12868
|
Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
|
|
12444
12869
|
The expected version of @rspack/core to the current binding is ${expectedCoreVersion}.
|
|
12445
|
-
` : `Unmatched version @rspack/core@${coreVersion} and @
|
|
12870
|
+
` : `Unmatched version @rspack/core@${coreVersion} and @rspack/binding@${expectedCoreVersion}.
|
|
12446
12871
|
|
|
12447
12872
|
Help:
|
|
12448
|
-
Please ensure the version of @
|
|
12873
|
+
Please ensure the version of @rspack/binding and @rspack/core is the same.
|
|
12449
12874
|
The expected version of @rspack/core to the current binding is ${expectedCoreVersion}.
|
|
12450
12875
|
`));
|
|
12451
12876
|
if (error) return callback(error);
|
|
@@ -12522,17 +12947,35 @@ Help:
|
|
|
12522
12947
|
}(options.stats)).colors ? isStatsColorSupported() : !!statsOptions.colors
|
|
12523
12948
|
},
|
|
12524
12949
|
cache: function(cache) {
|
|
12525
|
-
var snapshot;
|
|
12526
12950
|
if (!1 === cache) return !1;
|
|
12527
|
-
|
|
12528
|
-
|
|
12529
|
-
unmanagedPaths: snapshot.unmanagedPaths,
|
|
12530
|
-
managedPaths: snapshot.managedPaths
|
|
12951
|
+
if ('memory' === cache.type) return {
|
|
12952
|
+
type: cache.type
|
|
12531
12953
|
};
|
|
12532
|
-
|
|
12533
|
-
|
|
12534
|
-
|
|
12535
|
-
|
|
12954
|
+
let toRawMemoryGenerations = (value)=>{
|
|
12955
|
+
if (1 / 0 !== value) {
|
|
12956
|
+
if (!Number.isSafeInteger(value) || value < 0 || value > 0xffffffff) throw Error(`Invalid Rspack configuration: "cache.maxMemoryGenerations" must be a non-negative integer (0..4294967295) or Infinity, get \`${value}\`.`);
|
|
12957
|
+
return value;
|
|
12958
|
+
}
|
|
12959
|
+
};
|
|
12960
|
+
if ('filesystem' === cache.type) {
|
|
12961
|
+
let toRawTimeout = (name, value)=>{
|
|
12962
|
+
if (!Number.isSafeInteger(value) || value < 0) throw Error(`Invalid Rspack configuration: "${name}" must be a non-negative safe integer in milliseconds, get \`${value}\`.`);
|
|
12963
|
+
return value;
|
|
12964
|
+
};
|
|
12965
|
+
return {
|
|
12966
|
+
type: cache.type,
|
|
12967
|
+
buildDependencies: Object.values(cache.buildDependencies).flat(),
|
|
12968
|
+
cacheDirectory: cache.cacheDirectory,
|
|
12969
|
+
cacheLocation: cache.cacheLocation,
|
|
12970
|
+
version: cache.version,
|
|
12971
|
+
readonly: cache.readonly,
|
|
12972
|
+
maxMemoryGenerations: toRawMemoryGenerations(cache.maxMemoryGenerations),
|
|
12973
|
+
idleTimeout: toRawTimeout('cache.idleTimeout', cache.idleTimeout),
|
|
12974
|
+
idleTimeoutForInitialStore: toRawTimeout('cache.idleTimeoutForInitialStore', cache.idleTimeoutForInitialStore),
|
|
12975
|
+
idleTimeoutAfterLargeChanges: toRawTimeout('cache.idleTimeoutAfterLargeChanges', cache.idleTimeoutAfterLargeChanges)
|
|
12976
|
+
};
|
|
12977
|
+
}
|
|
12978
|
+
return {
|
|
12536
12979
|
type: cache.type,
|
|
12537
12980
|
buildDependencies: cache.buildDependencies,
|
|
12538
12981
|
version: cache.version,
|
|
@@ -12541,15 +12984,28 @@ Help:
|
|
|
12541
12984
|
if (!Number.isSafeInteger(value) || value < 1 || value > 0xffffffff) throw Error(`Invalid Rspack configuration: "${name}" must be a positive integer (1..4294967295) or Infinity, get \`${value}\`.`);
|
|
12542
12985
|
return value;
|
|
12543
12986
|
})('cache.maxAge', cache.maxAge),
|
|
12987
|
+
maxMemoryGenerations: toRawMemoryGenerations(cache.maxMemoryGenerations),
|
|
12544
12988
|
storage: {
|
|
12545
12989
|
type: cache.storage.type,
|
|
12546
12990
|
directory: cache.storage.location
|
|
12547
12991
|
},
|
|
12548
|
-
snapshot: snapshot1,
|
|
12549
12992
|
portable: cache.portable,
|
|
12550
12993
|
readonly: cache.readonly
|
|
12551
12994
|
};
|
|
12552
12995
|
}(cache),
|
|
12996
|
+
snapshot: (snapshot = options.snapshot, strategy = (value)=>({
|
|
12997
|
+
hash: value?.hash ?? !1,
|
|
12998
|
+
timestamp: value?.timestamp ?? !1
|
|
12999
|
+
}), {
|
|
13000
|
+
immutablePaths: snapshot.immutablePaths,
|
|
13001
|
+
unmanagedPaths: snapshot.unmanagedPaths,
|
|
13002
|
+
managedPaths: snapshot.managedPaths,
|
|
13003
|
+
buildDependencies: strategy(snapshot.buildDependencies),
|
|
13004
|
+
resolveBuildDependencies: strategy(snapshot.resolveBuildDependencies),
|
|
13005
|
+
module: strategy(snapshot.module),
|
|
13006
|
+
contextModule: strategy(snapshot.contextModule),
|
|
13007
|
+
resolve: strategy(snapshot.resolve)
|
|
13008
|
+
}),
|
|
12553
13009
|
experiments,
|
|
12554
13010
|
incremental: 'development' === mode && options.incremental,
|
|
12555
13011
|
node: function(node) {
|
|
@@ -12566,14 +13022,14 @@ Help:
|
|
|
12566
13022
|
bail: options.bail,
|
|
12567
13023
|
__references: {}
|
|
12568
13024
|
}), this.#rawOptions.__references = Object.fromEntries(this.#ruleSet.builtinReferences.entries()), this.#rawOptions.__virtual_files = VirtualModulesPlugin.__internal__take_virtual_files(this);
|
|
12569
|
-
let instanceBinding =
|
|
13025
|
+
let instanceBinding = rspackRequire("@rspack/binding");
|
|
12570
13026
|
this.#registers = this.#createHooksRegisters();
|
|
12571
13027
|
let inputFileSystem = this.inputFileSystem && ThreadsafeInputNodeFS.needsBinding(options.experiments.useInputFileSystem) ? ThreadsafeInputNodeFS.__to_binding(this.inputFileSystem) : void 0, compilerRef = new WeakRef(this);
|
|
12572
13028
|
try {
|
|
12573
13029
|
this.#instance = new instanceBinding.JsCompiler(this.compilerPath, this.#rawOptions, this.#builtinPlugins, this.#registers, ThreadsafeOutputNodeFS.__to_binding(this.outputFileSystem), this.intermediateFileSystem ? ThreadsafeIntermediateNodeFS.__to_binding(this.intermediateFileSystem) : void 0, inputFileSystem, ResolverFactory.__to_binding(this.resolverFactory), this.unsafeFastDrop, this.#platform, (logs)=>{
|
|
12574
13030
|
let compiler = compilerRef.deref();
|
|
12575
13031
|
compiler && compiler.#logInfrastructureBatch(logs);
|
|
12576
|
-
}), callback(null, this.#instance);
|
|
13032
|
+
}, Cache.__to_binding(this.cache), bindingHelpers), callback(null, this.#instance);
|
|
12577
13033
|
} catch (err) {
|
|
12578
13034
|
err instanceof Error && delete err.stack, callback(Error('Failed to create Rspack compiler instance, check the Rspack configuration.', {
|
|
12579
13035
|
cause: err
|
|
@@ -12644,17 +13100,21 @@ Help:
|
|
|
12644
13100
|
return getCompiler().hooks.assetEmitted;
|
|
12645
13101
|
}, function(queried) {
|
|
12646
13102
|
return async function({ filename, targetPath, outputPath }) {
|
|
13103
|
+
let source, content;
|
|
12647
13104
|
return queried.promise(filename, {
|
|
12648
13105
|
compilation: getCompiler().__internal__get_compilation(),
|
|
12649
13106
|
targetPath,
|
|
12650
13107
|
outputPath,
|
|
12651
13108
|
get source () {
|
|
12652
|
-
|
|
12653
|
-
|
|
13109
|
+
if (void 0 === source) {
|
|
13110
|
+
let assetSource = getCompiler().__internal__get_compilation().getAsset(filename)?.source;
|
|
13111
|
+
if (!assetSource) throw Error(`Asset ${filename} not found`);
|
|
13112
|
+
source = assetSource;
|
|
13113
|
+
}
|
|
12654
13114
|
return source;
|
|
12655
13115
|
},
|
|
12656
13116
|
get content () {
|
|
12657
|
-
return this.source
|
|
13117
|
+
return content ??= this.source.buffer();
|
|
12658
13118
|
}
|
|
12659
13119
|
});
|
|
12660
13120
|
};
|
|
@@ -12898,7 +13358,7 @@ Help:
|
|
|
12898
13358
|
}, function(queried) {
|
|
12899
13359
|
return async function(resolveData) {
|
|
12900
13360
|
return [
|
|
12901
|
-
await queried.promise(resolveData),
|
|
13361
|
+
await queried.promise(createResolveData(resolveData)),
|
|
12902
13362
|
resolveData
|
|
12903
13363
|
];
|
|
12904
13364
|
};
|
|
@@ -12907,14 +13367,14 @@ Help:
|
|
|
12907
13367
|
return getCompiler().__internal__get_compilation_params().normalModuleFactory.hooks.factorize;
|
|
12908
13368
|
}, function(queried) {
|
|
12909
13369
|
return async function(resolveData) {
|
|
12910
|
-
return await queried.promise(resolveData), resolveData;
|
|
13370
|
+
return await queried.promise(createResolveData(resolveData)), resolveData;
|
|
12911
13371
|
};
|
|
12912
13372
|
}),
|
|
12913
13373
|
registerNormalModuleFactoryResolveTaps: createTap(binding__default().RegisterJsTapKind.NormalModuleFactoryResolve, function() {
|
|
12914
13374
|
return getCompiler().__internal__get_compilation_params().normalModuleFactory.hooks.resolve;
|
|
12915
13375
|
}, function(queried) {
|
|
12916
13376
|
return async function(resolveData) {
|
|
12917
|
-
return await queried.promise(resolveData), resolveData;
|
|
13377
|
+
return await queried.promise(createResolveData(resolveData)), resolveData;
|
|
12918
13378
|
};
|
|
12919
13379
|
}),
|
|
12920
13380
|
registerNormalModuleFactoryResolveForSchemeTaps: createMapTap(binding__default().RegisterJsTapKind.NormalModuleFactoryResolveForScheme, function() {
|
|
@@ -12932,7 +13392,7 @@ Help:
|
|
|
12932
13392
|
}, function(queried) {
|
|
12933
13393
|
return async function(resolveData) {
|
|
12934
13394
|
return [
|
|
12935
|
-
await queried.promise(resolveData),
|
|
13395
|
+
await queried.promise(createResolveData(resolveData)),
|
|
12936
13396
|
resolveData
|
|
12937
13397
|
];
|
|
12938
13398
|
};
|
|
@@ -13977,8 +14437,11 @@ class IndependentSharedPlugin {
|
|
|
13977
14437
|
(parentConfig.plugins || []).forEach((plugin)=>{
|
|
13978
14438
|
void 0 !== plugin && 'string' != typeof plugin && ((plugin, excludedPlugins = [])=>{
|
|
13979
14439
|
if (!plugin) return !0;
|
|
13980
|
-
let
|
|
13981
|
-
|
|
14440
|
+
let pluginNames = [
|
|
14441
|
+
plugin.name,
|
|
14442
|
+
plugin.constructor?.name
|
|
14443
|
+
];
|
|
14444
|
+
return ![
|
|
13982
14445
|
'TreeShakingSharedPlugin',
|
|
13983
14446
|
'IndependentSharedPlugin',
|
|
13984
14447
|
'ModuleFederationPlugin',
|
|
@@ -13987,7 +14450,7 @@ class IndependentSharedPlugin {
|
|
|
13987
14450
|
'HtmlRspackPlugin',
|
|
13988
14451
|
'RsbuildHtmlPlugin',
|
|
13989
14452
|
...excludedPlugins
|
|
13990
|
-
].includes(
|
|
14453
|
+
].some((excludedPluginName)=>pluginNames.includes(excludedPluginName));
|
|
13991
14454
|
})(plugin, treeShakingSharedExcludePlugins) && finalPlugins.push(plugin);
|
|
13992
14455
|
}), plugins.forEach((plugin)=>{
|
|
13993
14456
|
finalPlugins.push(plugin);
|
|
@@ -14065,6 +14528,7 @@ class TreeShakingSharedPlugin {
|
|
|
14065
14528
|
}
|
|
14066
14529
|
apply(compiler) {
|
|
14067
14530
|
let { mfConfig, outputDir, secondary } = this, { name, shared, library, treeShakingSharedPlugins } = mfConfig;
|
|
14531
|
+
if (!name) throw Error('[TreeShakingSharedPlugin] Shared dependency tree shaking requires a non-empty "name" in the Module Federation configuration. Set it to a unique name for this application.');
|
|
14068
14532
|
if (!shared) return;
|
|
14069
14533
|
let sharedOptions = normalizeSharedOptions(shared);
|
|
14070
14534
|
sharedOptions.length && sharedOptions.some(([_, config])=>config.treeShaking && !1 !== config.import) && (secondary || new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectTreeShakingUsedExports, mfConfig.manifest).apply(compiler), this._independentSharePlugin = new IndependentSharedPlugin({
|
|
@@ -14162,7 +14626,7 @@ function getDefaultEntryRuntimeSource(paths, options, compiler, treeShakingShare
|
|
|
14162
14626
|
let paramsCode = void 0 === pluginParams ? 'undefined' : JSON.stringify(pluginParams);
|
|
14163
14627
|
runtimePluginVars.push(`{ plugin: ${runtimePluginVar}, params: ${paramsCode} }`);
|
|
14164
14628
|
}
|
|
14165
|
-
let defaultRuntimeSource = compiler.rspack.Template.getFunctionContent(
|
|
14629
|
+
let defaultRuntimeSource = compiler.rspack.Template.getFunctionContent(rspackRequire("./moduleFederationDefaultRuntime.js").default), compilerRuntimeGlobals = createCompilerRuntimeGlobals(compiler.options), runtimeSource = (source = defaultRuntimeSource, runtimeRequire = 'rspack' === compiler.options.experiments.runtimeMode ? `new Proxy(function (moduleId) {
|
|
14166
14630
|
return ${compilerRuntimeGlobals.require}(moduleId);
|
|
14167
14631
|
}, {
|
|
14168
14632
|
get(_target, key) {
|
|
@@ -14198,7 +14662,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
|
|
|
14198
14662
|
name = binding_.BuiltinPluginName.ContainerPlugin;
|
|
14199
14663
|
_options;
|
|
14200
14664
|
constructor(options){
|
|
14201
|
-
super();
|
|
14665
|
+
if (super(), 'string' != typeof options.name) throw Error('[ContainerPlugin] name must be a string.');
|
|
14202
14666
|
let shareScope = options.shareScope || 'default', enhanced = options.enhanced ?? !1;
|
|
14203
14667
|
validateShareScope(shareScope, enhanced, 'ContainerPlugin'), this._options = {
|
|
14204
14668
|
name: options.name,
|
|
@@ -14296,7 +14760,7 @@ async function transform(source, options) {
|
|
|
14296
14760
|
let _options = JSON.stringify(options || {});
|
|
14297
14761
|
return binding__default().transform(source, _options);
|
|
14298
14762
|
}
|
|
14299
|
-
let exports_rspackVersion = "2.2.
|
|
14763
|
+
let exports_rspackVersion = "2.2.9", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
|
|
14300
14764
|
getNormalizedRspackOptions: getNormalizedRspackOptions,
|
|
14301
14765
|
applyRspackOptionsDefaults: applyRspackOptionsDefaults,
|
|
14302
14766
|
getNormalizedWebpackOptions: getNormalizedRspackOptions,
|
|
@@ -14517,7 +14981,20 @@ let exports_rspackVersion = "2.2.2", exports_version = "5.75.0", exports_Webpack
|
|
|
14517
14981
|
},
|
|
14518
14982
|
VirtualModulesPlugin: VirtualModulesPlugin,
|
|
14519
14983
|
ids: {
|
|
14520
|
-
SyncModuleIdsPlugin:
|
|
14984
|
+
SyncModuleIdsPlugin: class extends RspackBuiltinPlugin {
|
|
14985
|
+
options;
|
|
14986
|
+
name = binding_.BuiltinPluginName.SyncModuleIdsPlugin;
|
|
14987
|
+
affectedHooks = 'compilation';
|
|
14988
|
+
constructor(options){
|
|
14989
|
+
super(), this.options = options;
|
|
14990
|
+
}
|
|
14991
|
+
raw() {
|
|
14992
|
+
let options = {
|
|
14993
|
+
...this.options
|
|
14994
|
+
};
|
|
14995
|
+
return createBuiltinPlugin(this.name, options);
|
|
14996
|
+
}
|
|
14997
|
+
}
|
|
14521
14998
|
},
|
|
14522
14999
|
rsc: {
|
|
14523
15000
|
createPlugins: ()=>{
|