@rspack/core 1.0.0-beta.1 → 1.0.0-beta.3
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/dist/ChunkGroup.d.ts +1 -0
- package/dist/ChunkGroup.js +3 -0
- package/dist/Compilation.d.ts +38 -1
- package/dist/Compilation.js +109 -44
- package/dist/Compiler.d.ts +1 -0
- package/dist/Compiler.js +31 -26
- package/dist/ExecuteModulePlugin.d.ts +0 -1
- package/dist/ExecuteModulePlugin.js +0 -1
- package/dist/Module.d.ts +1 -2
- package/dist/Module.js +0 -1
- package/dist/MultiCompiler.js +11 -7
- package/dist/MultiStats.d.ts +1 -1
- package/dist/MultiStats.js +19 -16
- package/dist/NormalModule.js +3 -4
- package/dist/Resolver.d.ts +1 -2
- package/dist/RspackError.js +1 -1
- package/dist/Stats.d.ts +1 -1
- package/dist/Stats.js +22 -2
- package/dist/Template.d.ts +4 -4
- package/dist/Template.js +8 -6
- package/dist/Watching.js +3 -5
- package/dist/builtin-loader/lightningcss/index.js +1 -1
- package/dist/builtin-plugin/DefinePlugin.js +1 -1
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +11 -10
- package/dist/builtin-plugin/DynamicEntryPlugin.js +26 -15
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +2 -2
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.js +1 -1
- package/dist/builtin-plugin/EnableLibraryPlugin.js +1 -6
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +2 -2
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.js +1 -1
- package/dist/builtin-plugin/EntryPlugin.d.ts +2 -2
- package/dist/builtin-plugin/ExternalsPlugin.js +1 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +0 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.js +1 -1
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +21 -4
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +29 -5
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +4 -6
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +17 -12
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +11 -9
- package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +13 -11
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.js +9 -7
- package/dist/builtin-plugin/css-extract/loader.js +5 -12
- package/dist/builtin-plugin/lazy-compilation/backend.js +4 -4
- package/dist/config/adapter.d.ts +2 -2
- package/dist/config/adapter.js +1 -0
- package/dist/config/adapterRuleUse.d.ts +2 -6
- package/dist/config/adapterRuleUse.js +7 -6
- package/dist/config/defaults.js +21 -32
- package/dist/config/normalization.d.ts +1 -0
- package/dist/config/normalization.js +5 -2
- package/dist/config/zod.d.ts +762 -114
- package/dist/config/zod.js +29 -6
- package/dist/container/default.runtime.js +1 -1
- package/dist/exports.d.ts +4 -3
- package/dist/exports.js +5 -2
- package/dist/lib/AbstractMethodError.js +2 -3
- package/dist/lib/Cache.d.ts +1 -1
- package/dist/lib/Cache.js +6 -4
- package/dist/lib/CacheFacade.js +8 -9
- package/dist/lib/Dependency.d.ts +23 -0
- package/dist/lib/Dependency.js +11 -0
- package/dist/lib/EnvironmentPlugin.js +1 -3
- package/dist/lib/LoaderOptionsPlugin.d.ts +4 -2
- package/dist/lib/LoaderOptionsPlugin.js +0 -2
- package/dist/lib/ModuleFilenameHelpers.js +1 -1
- package/dist/lib/WebpackError.d.ts +0 -6
- package/dist/lib/WebpackError.js +0 -8
- package/dist/lib/cache/MemoryCachePlugin.d.ts +5 -0
- package/dist/lib/cache/MemoryCachePlugin.js +40 -0
- package/dist/lib/cache/mergeEtags.d.ts +3 -3
- package/dist/lib/cache/mergeEtags.js +5 -3
- package/dist/lib/formatLocation.d.ts +1 -1
- package/dist/loader-runner/index.js +10 -9
- package/dist/loader-runner/loadLoader.js +8 -11
- package/dist/logging/Logger.js +3 -3
- package/dist/logging/createConsoleLogger.d.ts +26 -6
- package/dist/logging/createConsoleLogger.js +21 -58
- package/dist/logging/runtime.d.ts +4 -10
- package/dist/logging/runtime.js +8 -23
- package/dist/logging/truncateArgs.d.ts +4 -4
- package/dist/logging/truncateArgs.js +5 -10
- package/dist/node/NodeEnvironmentPlugin.js +2 -2
- package/dist/node/NodeWatchFileSystem.js +6 -6
- package/dist/node/nodeConsole.d.ts +7 -21
- package/dist/node/nodeConsole.js +31 -38
- package/dist/rspackOptionsApply.d.ts +0 -1
- package/dist/rspackOptionsApply.js +8 -7
- package/dist/sharing/ProvideSharedPlugin.d.ts +20 -19
- package/dist/sharing/ProvideSharedPlugin.js +26 -17
- package/dist/sharing/SharePlugin.d.ts +3 -0
- package/dist/sharing/SharePlugin.js +4 -1
- package/dist/stats/DefaultStatsFactoryPlugin.js +187 -96
- package/dist/stats/DefaultStatsPresetPlugin.js +2 -5
- package/dist/stats/DefaultStatsPrinterPlugin.js +18 -19
- package/dist/stats/StatsFactory.d.ts +2 -1
- package/dist/stats/StatsFactory.js +5 -10
- package/dist/stats/StatsPrinter.js +3 -4
- package/dist/stats/statsFactoryUtils.d.ts +155 -28
- package/dist/util/SizeFormatHelpers.js +1 -1
- package/dist/util/assertNotNil.d.ts +1 -1
- package/dist/util/assetCondition.d.ts +2 -0
- package/dist/util/assetCondition.js +2 -0
- package/dist/util/bindingVersionCheck.js +3 -3
- package/dist/util/cleverMerge.js +8 -6
- package/dist/util/comparators.d.ts +1 -1
- package/dist/util/comparators.js +5 -4
- package/dist/util/createHash.js +11 -6
- package/dist/util/fs.js +2 -2
- package/dist/util/hash/wasm-hash.js +5 -4
- package/dist/util/identifier.d.ts +4 -4
- package/dist/util/identifier.js +10 -10
- package/dist/util/index.js +1 -1
- package/dist/util/memoize.js +4 -6
- package/dist/util/smartGrouping.js +4 -6
- package/dist/util/webpack.d.ts +1 -1
- package/dist/util/webpack.js +2 -1
- package/module.d.ts +1 -1
- package/package.json +3 -3
- package/dist/builtin-plugin/css-extract/loader-options.json +0 -37
- package/dist/builtin-plugin/css-extract/plugin-options.json +0 -79
package/dist/config/zod.js
CHANGED
|
@@ -114,7 +114,10 @@ const entryDescription = zod_1.z.strictObject({
|
|
|
114
114
|
const entryUnnamed = entryItem;
|
|
115
115
|
const entryObject = zod_1.z.record(entryItem.or(entryDescription));
|
|
116
116
|
const entryStatic = entryObject.or(entryUnnamed);
|
|
117
|
-
const
|
|
117
|
+
const entryDynamic = zod_1.z
|
|
118
|
+
.function()
|
|
119
|
+
.returns(entryStatic.or(zod_1.z.promise(entryStatic)));
|
|
120
|
+
const entry = entryStatic.or(entryDynamic);
|
|
118
121
|
//#endregion
|
|
119
122
|
//#region Output
|
|
120
123
|
const path = zod_1.z.string();
|
|
@@ -184,6 +187,7 @@ const output = zod_1.z.strictObject({
|
|
|
184
187
|
chunkFilename: chunkFilename.optional(),
|
|
185
188
|
crossOriginLoading: crossOriginLoading.optional(),
|
|
186
189
|
cssFilename: cssFilename.optional(),
|
|
190
|
+
cssHeadDataCompression: zod_1.z.boolean().optional(),
|
|
187
191
|
cssChunkFilename: cssChunkFilename.optional(),
|
|
188
192
|
hotUpdateMainFilename: hotUpdateMainFilename.optional(),
|
|
189
193
|
hotUpdateChunkFilename: hotUpdateChunkFilename.optional(),
|
|
@@ -466,8 +470,7 @@ const allowTarget = zod_1.z.union([
|
|
|
466
470
|
"es2019",
|
|
467
471
|
"es2020",
|
|
468
472
|
"es2021",
|
|
469
|
-
"es2022"
|
|
470
|
-
"browserslist"
|
|
473
|
+
"es2022"
|
|
471
474
|
]),
|
|
472
475
|
zod_1.z.literal("node"),
|
|
473
476
|
zod_1.z.literal("async-node"),
|
|
@@ -489,7 +492,9 @@ const allowTarget = zod_1.z.union([
|
|
|
489
492
|
zod_1.z.custom(value => typeof value === "string" && /^nwjs\d+\.\d+$/.test(value)),
|
|
490
493
|
zod_1.z.literal("node-webkit"),
|
|
491
494
|
zod_1.z.custom(value => typeof value === "string" && /^node-webkit\d+$/.test(value)),
|
|
492
|
-
zod_1.z.custom(value => typeof value === "string" && /^node-webkit\d+\.\d+$/.test(value))
|
|
495
|
+
zod_1.z.custom(value => typeof value === "string" && /^node-webkit\d+\.\d+$/.test(value)),
|
|
496
|
+
zod_1.z.literal("browserslist"),
|
|
497
|
+
zod_1.z.custom(value => typeof value === "string" && /^browserslist:(.+)$/.test(value))
|
|
493
498
|
]);
|
|
494
499
|
const target = zod_1.z.union([zod_1.z.literal(false), allowTarget, allowTarget.array()]);
|
|
495
500
|
//#endregion
|
|
@@ -732,11 +737,12 @@ const statsOptions = zod_1.z.strictObject({
|
|
|
732
737
|
groupReasonsByOrigin: zod_1.z.boolean().optional(),
|
|
733
738
|
errorDetails: zod_1.z.boolean().optional(),
|
|
734
739
|
errorStack: zod_1.z.boolean().optional(),
|
|
735
|
-
moduleTrace: zod_1.z.boolean().optional()
|
|
740
|
+
moduleTrace: zod_1.z.boolean().optional(),
|
|
741
|
+
cachedModules: zod_1.z.boolean().optional(),
|
|
742
|
+
cached: zod_1.z.boolean().optional()
|
|
736
743
|
});
|
|
737
744
|
const statsValue = zod_1.z.boolean().or(statsPresets).or(statsOptions);
|
|
738
745
|
const plugin = zod_1.z.union([
|
|
739
|
-
zod_1.z.custom(),
|
|
740
746
|
zod_1.z.custom(),
|
|
741
747
|
falsy
|
|
742
748
|
]);
|
|
@@ -851,7 +857,24 @@ const rspackFutureOptions = zod_1.z.strictObject({
|
|
|
851
857
|
})
|
|
852
858
|
.optional()
|
|
853
859
|
});
|
|
860
|
+
const listenOptions = zod_1.z.object({
|
|
861
|
+
port: zod_1.z.number().optional(),
|
|
862
|
+
host: zod_1.z.string().optional(),
|
|
863
|
+
backlog: zod_1.z.number().optional(),
|
|
864
|
+
path: zod_1.z.string().optional(),
|
|
865
|
+
exclusive: zod_1.z.boolean().optional(),
|
|
866
|
+
readableAll: zod_1.z.boolean().optional(),
|
|
867
|
+
writableAll: zod_1.z.boolean().optional(),
|
|
868
|
+
ipv6Only: zod_1.z.boolean().optional()
|
|
869
|
+
});
|
|
854
870
|
const lazyCompilationOptions = zod_1.z.object({
|
|
871
|
+
backend: zod_1.z
|
|
872
|
+
.object({
|
|
873
|
+
client: zod_1.z.string().optional(),
|
|
874
|
+
listen: zod_1.z.number().optional().or(listenOptions),
|
|
875
|
+
protocol: zod_1.z.enum(["http", "https"]).optional()
|
|
876
|
+
})
|
|
877
|
+
.optional(),
|
|
855
878
|
imports: zod_1.z.boolean().optional(),
|
|
856
879
|
entries: zod_1.z.boolean().optional(),
|
|
857
880
|
test: zod_1.z
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __module_federation_bundler_runtime__,__module_federation_runtime_plugins__,__module_federation_remote_infos__,__module_federation_container_name__;module.exports=function(){if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){var __webpack_require___remotesLoadingData,__webpack_require___remotesLoadingData1,__webpack_require___initializeSharingData,__webpack_require___consumesLoadingData,__webpack_require___consumesLoadingData1,__webpack_require___initializeExposesData,__webpack_require___consumesLoadingData2;const override=(obj,key,value)=>{if(!obj)return;if(obj[key])obj[key]=value};const merge=(obj,key,fn)=>{const value=fn();if(Array.isArray(value)){var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){var _obj1,_key1;var _1;(_1=(_obj1=obj)[_key1=key])!==null&&_1!==void 0?_1:_obj1[_key1]={};Object.assign(obj[key],value)}};const early=(obj,key,initial)=>{var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=initial()};var __webpack_require___remotesLoadingData_chunkMapping;const remotesLoadingChunkMapping=(__webpack_require___remotesLoadingData_chunkMapping=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&__webpack_require___remotesLoadingData_chunkMapping!==void 0?__webpack_require___remotesLoadingData_chunkMapping:{};var __webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping;const remotesLoadingModuleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping!==void 0?__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping:{};var __webpack_require___initializeSharingData_scopeToSharingDataMapping;const initializeSharingScopeToInitDataMapping=(__webpack_require___initializeSharingData_scopeToSharingDataMapping=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&__webpack_require___initializeSharingData_scopeToSharingDataMapping!==void 0?__webpack_require___initializeSharingData_scopeToSharingDataMapping:{};var __webpack_require___consumesLoadingData_chunkMapping;const consumesLoadingChunkMapping=(__webpack_require___consumesLoadingData_chunkMapping=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&__webpack_require___consumesLoadingData_chunkMapping!==void 0?__webpack_require___consumesLoadingData_chunkMapping:{};var __webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping;const consumesLoadingModuleToConsumeDataMapping=(__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping!==void 0?__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping:{};const consumesLoadinginstalledModules={};const initializeSharingInitPromises=[];const initializeSharingInitTokens=[];const containerShareScope=(__webpack_require___initializeExposesData=__webpack_require__.initializeExposesData)===null||__webpack_require___initializeExposesData===void 0?void 0:__webpack_require___initializeExposesData.shareScope;for(const key in __module_federation_bundler_runtime__){__webpack_require__.federation[key]=__module_federation_bundler_runtime__[key]}early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){consumesLoadingModuleToHandlerMapping[moduleId]={getter:data.fallback,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey}}return consumesLoadingModuleToHandlerMapping});early(__webpack_require__.federation,"initOptions",()=>({}));early(__webpack_require__.federation.initOptions,"name",()=>__module_federation_container_name__);early(__webpack_require__.federation.initOptions,"shared",()=>{const shared={};for(let[scope,stages]of Object.entries(initializeSharingScopeToInitDataMapping)){for(let stage of stages){if(typeof stage==="object"&&stage!==null){const{name,version,factory,eager}=stage;const options={version,scope:[scope],get:factory};if(shared[name]){shared[name].push(options)}else{shared[name]=[options]}}}}return shared});merge(__webpack_require__.federation.initOptions,"remotes",()=>Object.values(__module_federation_remote_infos__).flat().filter(remote=>remote.externalType==="script"));merge(__webpack_require__.federation.initOptions,"plugins",()=>__module_federation_runtime_plugins__);early(__webpack_require__.federation,"bundlerRuntimeOptions",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions,"remotes",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"chunkMapping",()=>remotesLoadingChunkMapping);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",()=>{const remotesLoadingIdToExternalAndNameMappingMapping={};for(let[moduleId,data]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){remotesLoadingIdToExternalAndNameMappingMapping[moduleId]=[data.shareScope,data.name,data.externalModuleId,data.remoteName]}return remotesLoadingIdToExternalAndNameMappingMapping});early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"webpackRequire",()=>__webpack_require__);merge(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",()=>{const idToRemoteMap={};for(let[id,remoteData]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){const info=__module_federation_remote_infos__[remoteData.remoteName];if(info)idToRemoteMap[id]=info}return idToRemoteMap});override(__webpack_require__,"S",__webpack_require__.federation.bundlerRuntime.S);if(__webpack_require__.federation.attachShareScopeMap){__webpack_require__.federation.attachShareScopeMap(__webpack_require__)}override(__webpack_require__.f,"remotes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.remotes({chunkId,promises,chunkMapping:remotesLoadingChunkMapping,idToExternalAndNameMapping:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:__webpack_require__}));override(__webpack_require__.f,"consumes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.consumes({chunkId,promises,chunkMapping:consumesLoadingChunkMapping,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping,installedModules:consumesLoadinginstalledModules,webpackRequire:__webpack_require__}));override(__webpack_require__,"I",(name,initScope)=>__webpack_require__.federation.bundlerRuntime.I({shareScopeName:name,initScope,initPromises:initializeSharingInitPromises,initTokens:initializeSharingInitTokens,webpackRequire:__webpack_require__}));override(__webpack_require__,"initContainer",(shareScope,initScope,remoteEntryInitOptions)=>__webpack_require__.federation.bundlerRuntime.initContainerEntry({shareScope,initScope,remoteEntryInitOptions,shareScopeKey:containerShareScope,webpackRequire:__webpack_require__}));override(__webpack_require__,"getContainer",(module1,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module1)?moduleMap[module1]():Promise.resolve().then(()=>{throw new Error('Module "'+module1+'" does not exist in container.')});__webpack_require__.R=undefined;return getScope});__webpack_require__.federation.instance=__webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);if((__webpack_require___consumesLoadingData2=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData2===void 0?void 0:__webpack_require___consumesLoadingData2.initialConsumes){__webpack_require__.federation.bundlerRuntime.installInitialConsumes({webpackRequire:__webpack_require__,installedModules:consumesLoadinginstalledModules,initialConsumes:__webpack_require__.consumesLoadingData.initialConsumes,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping})}}};
|
|
1
|
+
var __module_federation_bundler_runtime__,__module_federation_runtime_plugins__,__module_federation_remote_infos__,__module_federation_container_name__;module.exports=function(){if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){var __webpack_require___remotesLoadingData,__webpack_require___remotesLoadingData1,__webpack_require___initializeSharingData,__webpack_require___consumesLoadingData,__webpack_require___consumesLoadingData1,__webpack_require___initializeExposesData,__webpack_require___consumesLoadingData2;const override=(obj,key,value)=>{if(!obj)return;if(obj[key])obj[key]=value};const merge=(obj,key,fn)=>{const value=fn();if(Array.isArray(value)){var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){var _obj1,_key1;var _1;(_1=(_obj1=obj)[_key1=key])!==null&&_1!==void 0?_1:_obj1[_key1]={};Object.assign(obj[key],value)}};const early=(obj,key,initial)=>{var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=initial()};var __webpack_require___remotesLoadingData_chunkMapping;const remotesLoadingChunkMapping=(__webpack_require___remotesLoadingData_chunkMapping=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&__webpack_require___remotesLoadingData_chunkMapping!==void 0?__webpack_require___remotesLoadingData_chunkMapping:{};var __webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping;const remotesLoadingModuleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping!==void 0?__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping:{};var __webpack_require___initializeSharingData_scopeToSharingDataMapping;const initializeSharingScopeToInitDataMapping=(__webpack_require___initializeSharingData_scopeToSharingDataMapping=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&__webpack_require___initializeSharingData_scopeToSharingDataMapping!==void 0?__webpack_require___initializeSharingData_scopeToSharingDataMapping:{};var __webpack_require___consumesLoadingData_chunkMapping;const consumesLoadingChunkMapping=(__webpack_require___consumesLoadingData_chunkMapping=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&__webpack_require___consumesLoadingData_chunkMapping!==void 0?__webpack_require___consumesLoadingData_chunkMapping:{};var __webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping;const consumesLoadingModuleToConsumeDataMapping=(__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping!==void 0?__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping:{};const consumesLoadinginstalledModules={};const initializeSharingInitPromises=[];const initializeSharingInitTokens=[];const containerShareScope=(__webpack_require___initializeExposesData=__webpack_require__.initializeExposesData)===null||__webpack_require___initializeExposesData===void 0?void 0:__webpack_require___initializeExposesData.shareScope;for(const key in __module_federation_bundler_runtime__){__webpack_require__.federation[key]=__module_federation_bundler_runtime__[key]}early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){consumesLoadingModuleToHandlerMapping[moduleId]={getter:data.fallback,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey}}return consumesLoadingModuleToHandlerMapping});early(__webpack_require__.federation,"initOptions",()=>({}));early(__webpack_require__.federation.initOptions,"name",()=>__module_federation_container_name__);early(__webpack_require__.federation.initOptions,"shared",()=>{const shared={};for(let[scope,stages]of Object.entries(initializeSharingScopeToInitDataMapping)){for(let stage of stages){if(typeof stage==="object"&&stage!==null){const{name,version,factory,eager,singleton,requiredVersion,strictVersion}=stage;const options={version,scope:[scope],eager,singleton,requiredVersion,strictVersion,get:factory};if(shared[name]){shared[name].push(options)}else{shared[name]=[options]}}}}return shared});merge(__webpack_require__.federation.initOptions,"remotes",()=>Object.values(__module_federation_remote_infos__).flat().filter(remote=>remote.externalType==="script"));merge(__webpack_require__.federation.initOptions,"plugins",()=>__module_federation_runtime_plugins__);early(__webpack_require__.federation,"bundlerRuntimeOptions",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions,"remotes",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"chunkMapping",()=>remotesLoadingChunkMapping);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",()=>{const remotesLoadingIdToExternalAndNameMappingMapping={};for(let[moduleId,data]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){remotesLoadingIdToExternalAndNameMappingMapping[moduleId]=[data.shareScope,data.name,data.externalModuleId,data.remoteName]}return remotesLoadingIdToExternalAndNameMappingMapping});early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"webpackRequire",()=>__webpack_require__);merge(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",()=>{const idToRemoteMap={};for(let[id,remoteData]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){const info=__module_federation_remote_infos__[remoteData.remoteName];if(info)idToRemoteMap[id]=info}return idToRemoteMap});override(__webpack_require__,"S",__webpack_require__.federation.bundlerRuntime.S);if(__webpack_require__.federation.attachShareScopeMap){__webpack_require__.federation.attachShareScopeMap(__webpack_require__)}override(__webpack_require__.f,"remotes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.remotes({chunkId,promises,chunkMapping:remotesLoadingChunkMapping,idToExternalAndNameMapping:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:__webpack_require__}));override(__webpack_require__.f,"consumes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.consumes({chunkId,promises,chunkMapping:consumesLoadingChunkMapping,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping,installedModules:consumesLoadinginstalledModules,webpackRequire:__webpack_require__}));override(__webpack_require__,"I",(name,initScope)=>__webpack_require__.federation.bundlerRuntime.I({shareScopeName:name,initScope,initPromises:initializeSharingInitPromises,initTokens:initializeSharingInitTokens,webpackRequire:__webpack_require__}));override(__webpack_require__,"initContainer",(shareScope,initScope,remoteEntryInitOptions)=>__webpack_require__.federation.bundlerRuntime.initContainerEntry({shareScope,initScope,remoteEntryInitOptions,shareScopeKey:containerShareScope,webpackRequire:__webpack_require__}));override(__webpack_require__,"getContainer",(module1,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module1)?moduleMap[module1]():Promise.resolve().then(()=>{throw new Error('Module "'+module1+'" does not exist in container.')});__webpack_require__.R=undefined;return getScope});__webpack_require__.federation.instance=__webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);if((__webpack_require___consumesLoadingData2=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData2===void 0?void 0:__webpack_require___consumesLoadingData2.initialConsumes){__webpack_require__.federation.bundlerRuntime.installInitialConsumes({webpackRequire:__webpack_require__,installedModules:consumesLoadinginstalledModules,initialConsumes:__webpack_require__.consumesLoadingData.initialConsumes,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping})}}};
|
package/dist/exports.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
declare const rspackVersion:
|
|
2
|
-
|
|
1
|
+
declare const rspackVersion: string;
|
|
2
|
+
declare const version: string;
|
|
3
|
+
export { rspackVersion, version };
|
|
3
4
|
export type { Asset, AssetInfo, Assets, CompilationParams, LogEntry } from "./Compilation";
|
|
4
5
|
export { Compilation } from "./Compilation";
|
|
5
6
|
export { Compiler } from "./Compiler";
|
|
@@ -14,7 +15,7 @@ export { MultiStats } from "./MultiStats";
|
|
|
14
15
|
export { NormalModule } from "./NormalModule";
|
|
15
16
|
export type { NormalModuleFactory } from "./NormalModuleFactory";
|
|
16
17
|
export { RuntimeGlobals } from "./RuntimeGlobals";
|
|
17
|
-
export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule
|
|
18
|
+
export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule } from "./Stats";
|
|
18
19
|
export { Stats } from "./Stats";
|
|
19
20
|
import * as ModuleFilenameHelpers from "./lib/ModuleFilenameHelpers";
|
|
20
21
|
export { ModuleFilenameHelpers };
|
package/dist/exports.js
CHANGED
|
@@ -28,9 +28,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.CssExtractRspackPlugin = exports.EvalDevToolModulePlugin = exports.EvalSourceMapDevToolPlugin = exports.SourceMapDevToolPlugin = exports.CopyRspackPlugin = exports.LightningCssMinimizerRspackPlugin = exports.SwcCssMinimizerRspackPlugin = exports.SwcJsMinimizerRspackPlugin = exports.HtmlRspackPlugin = exports.sharing = exports.container = exports.optimize = exports.webworker = exports.javascript = exports.wasm = exports.library = exports.electron = exports.node = exports.web = exports.NormalModuleReplacementPlugin = exports.LoaderTargetPlugin = exports.LoaderOptionsPlugin = exports.EnvironmentPlugin = exports.HotModuleReplacementPlugin = exports.ExternalsPlugin = exports.DynamicEntryPlugin = exports.EntryPlugin = exports.ProgressPlugin = exports.DefinePlugin = exports.ProvidePlugin = exports.IgnorePlugin = exports.BannerPlugin = exports.EntryOptionPlugin = exports.util = exports.config = exports.sources = exports.WebpackError = exports.Template = exports.ModuleFilenameHelpers = exports.Stats = exports.RuntimeGlobals = exports.NormalModule = exports.MultiStats = exports.WebpackOptionsApply = exports.RspackOptionsApply = exports.MultiCompiler = exports.Compiler = exports.Compilation = exports.version = exports.rspackVersion = void 0;
|
|
30
30
|
exports.experiments = void 0;
|
|
31
|
-
const
|
|
31
|
+
const package_json_1 = require("../package.json");
|
|
32
|
+
// this is a hack to be compatible with plugin which detect webpack's version
|
|
33
|
+
const rspackVersion = package_json_1.version;
|
|
32
34
|
exports.rspackVersion = rspackVersion;
|
|
33
|
-
|
|
35
|
+
const version = package_json_1.webpackVersion;
|
|
36
|
+
exports.version = version;
|
|
34
37
|
var Compilation_1 = require("./Compilation");
|
|
35
38
|
Object.defineProperty(exports, "Compilation", { enumerable: true, get: function () { return Compilation_1.Compilation; } });
|
|
36
39
|
var Compiler_1 = require("./Compiler");
|
|
@@ -20,7 +20,7 @@ const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
|
|
|
20
20
|
* @returns message
|
|
21
21
|
*/
|
|
22
22
|
function createMessage(method) {
|
|
23
|
-
return `Abstract method${method ?
|
|
23
|
+
return `Abstract method${method ? ` ${method}` : ""}. Must be overridden.`;
|
|
24
24
|
}
|
|
25
25
|
class Message extends Error {
|
|
26
26
|
constructor() {
|
|
@@ -28,8 +28,7 @@ class Message extends Error {
|
|
|
28
28
|
this.stack = undefined;
|
|
29
29
|
Error.captureStackTrace(this);
|
|
30
30
|
const match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP);
|
|
31
|
-
this.message =
|
|
32
|
-
match && match[1] ? createMessage(match[1]) : createMessage();
|
|
31
|
+
this.message = match?.[1] ? createMessage(match[1]) : createMessage();
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
/**
|
package/dist/lib/Cache.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface Etag {
|
|
|
13
13
|
toString(): string;
|
|
14
14
|
}
|
|
15
15
|
export type CallbackCache<T> = (err?: WebpackError | null, result?: T) => void;
|
|
16
|
-
type GotHandler<T = any> = (result: any | null, callback: (error: Error) => void) => void;
|
|
16
|
+
type GotHandler<T = any> = (result: any | null, callback: (error: Error | null) => void) => void;
|
|
17
17
|
export declare class Cache {
|
|
18
18
|
static STAGE_DISK: number;
|
|
19
19
|
static STAGE_MEMORY: number;
|
package/dist/lib/Cache.js
CHANGED
|
@@ -13,12 +13,13 @@ exports.Cache = void 0;
|
|
|
13
13
|
const lite_tapable_1 = require("@rspack/lite-tapable");
|
|
14
14
|
const HookWebpackError_1 = require("./HookWebpackError");
|
|
15
15
|
const needCalls = (times, callback) => {
|
|
16
|
+
let leftTimes = times;
|
|
16
17
|
return err => {
|
|
17
|
-
if (--
|
|
18
|
+
if (--leftTimes === 0) {
|
|
18
19
|
return callback();
|
|
19
20
|
}
|
|
20
|
-
if (err &&
|
|
21
|
-
|
|
21
|
+
if (err && leftTimes > 0) {
|
|
22
|
+
leftTimes = 0;
|
|
22
23
|
return callback();
|
|
23
24
|
}
|
|
24
25
|
};
|
|
@@ -42,11 +43,12 @@ class Cache {
|
|
|
42
43
|
*/
|
|
43
44
|
get(identifier, etag, callback) {
|
|
44
45
|
const gotHandlers = [];
|
|
45
|
-
this.hooks.get.callAsync(identifier, etag, gotHandlers, (err,
|
|
46
|
+
this.hooks.get.callAsync(identifier, etag, gotHandlers, (err, res) => {
|
|
46
47
|
if (err) {
|
|
47
48
|
callback((0, HookWebpackError_1.makeWebpackError)(err, "Cache.hooks.get"));
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
51
|
+
let result = res;
|
|
50
52
|
if (result === null) {
|
|
51
53
|
result = undefined;
|
|
52
54
|
}
|
package/dist/lib/CacheFacade.js
CHANGED
|
@@ -63,15 +63,14 @@ class MultiItemCache {
|
|
|
63
63
|
/**
|
|
64
64
|
* @returns promise with the data
|
|
65
65
|
*/
|
|
66
|
-
getPromise() {
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return next(0);
|
|
66
|
+
async getPromise() {
|
|
67
|
+
for (let i = 0; i < this._items.length; i++) {
|
|
68
|
+
const result = await this._items[i].getPromise();
|
|
69
|
+
if (result !== undefined) {
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
75
74
|
}
|
|
76
75
|
/**
|
|
77
76
|
* @param data the value to store
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/Dependency.js
|
|
4
|
+
*
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
* Author Tobias Koppers @sokra
|
|
7
|
+
* Copyright (c) JS Foundation and other contributors
|
|
8
|
+
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
|
+
*/
|
|
10
|
+
export type SourcePosition = {
|
|
11
|
+
line: number;
|
|
12
|
+
column?: number;
|
|
13
|
+
};
|
|
14
|
+
export type RealDependencyLocation = {
|
|
15
|
+
start: SourcePosition;
|
|
16
|
+
end?: SourcePosition;
|
|
17
|
+
index?: number;
|
|
18
|
+
};
|
|
19
|
+
export type SyntheticDependencyLocation = {
|
|
20
|
+
name: string;
|
|
21
|
+
index?: number;
|
|
22
|
+
};
|
|
23
|
+
export type DependencyLocation = SyntheticDependencyLocation | RealDependencyLocation;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The following code is modified based on
|
|
4
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/Dependency.js
|
|
5
|
+
*
|
|
6
|
+
* MIT Licensed
|
|
7
|
+
* Author Tobias Koppers @sokra
|
|
8
|
+
* Copyright (c) JS Foundation and other contributors
|
|
9
|
+
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -43,9 +43,7 @@ class EnvironmentPlugin {
|
|
|
43
43
|
: this.defaultValues[key];
|
|
44
44
|
if (value === undefined) {
|
|
45
45
|
compiler.hooks.thisCompilation.tap("EnvironmentPlugin", compilation => {
|
|
46
|
-
const error = new WebpackError_1.default(`EnvironmentPlugin - ${key} environment variable is undefined.\n\
|
|
47
|
-
"You can pass an object with default values to suppress this warning.\n" +
|
|
48
|
-
"See https://webpack.js.org/plugins/environment-plugin for example.");
|
|
46
|
+
const error = new WebpackError_1.default(`EnvironmentPlugin - ${key} environment variable is undefined.\n\nYou can pass an object with default values to suppress this warning.\nSee https://webpack.js.org/plugins/environment-plugin for example.`);
|
|
49
47
|
error.name = "EnvVariableNotDefinedError";
|
|
50
48
|
compilation.errors.push(error);
|
|
51
49
|
});
|
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Compiler } from "../Compiler";
|
|
11
11
|
import type { MatchObject } from "./ModuleFilenameHelpers";
|
|
12
|
-
type LoaderOptionsPluginOptions =
|
|
12
|
+
type LoaderOptionsPluginOptions = MatchObject & {
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
};
|
|
13
15
|
export declare class LoaderOptionsPlugin {
|
|
14
|
-
options:
|
|
16
|
+
options: LoaderOptionsPluginOptions;
|
|
15
17
|
/**
|
|
16
18
|
* @param options options object
|
|
17
19
|
*/
|
|
@@ -25,7 +25,7 @@ const asRegExp = (test) => {
|
|
|
25
25
|
if (typeof test === "string") {
|
|
26
26
|
// Escape special characters in the string to prevent them from being interpreted as special characters in a regular expression. Do this by
|
|
27
27
|
// adding a backslash before each special character
|
|
28
|
-
return new RegExp(
|
|
28
|
+
return new RegExp(`^${test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")}`);
|
|
29
29
|
}
|
|
30
30
|
return test;
|
|
31
31
|
};
|
|
@@ -19,12 +19,6 @@ export declare class WebpackError extends Error {
|
|
|
19
19
|
module?: Module;
|
|
20
20
|
details?: string;
|
|
21
21
|
hideStack?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Creates an instance of WebpackError.
|
|
24
|
-
* @param message error message
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
constructor(message?: string);
|
|
28
22
|
[inspect.custom](): string;
|
|
29
23
|
}
|
|
30
24
|
export default WebpackError;
|
package/dist/lib/WebpackError.js
CHANGED
|
@@ -12,14 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.WebpackError = void 0;
|
|
13
13
|
const node_util_1 = require("node:util");
|
|
14
14
|
class WebpackError extends Error {
|
|
15
|
-
/**
|
|
16
|
-
* Creates an instance of WebpackError.
|
|
17
|
-
* @param message error message
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
constructor(message) {
|
|
21
|
-
super(message);
|
|
22
|
-
}
|
|
23
15
|
[node_util_1.inspect.custom]() {
|
|
24
16
|
return this.stack + (this.details ? `\n${this.details}` : "");
|
|
25
17
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Cache_1 = require("../Cache");
|
|
4
|
+
class MemoryCachePlugin {
|
|
5
|
+
apply(compiler) {
|
|
6
|
+
const cache = new Map();
|
|
7
|
+
compiler.cache.hooks.store.tap({ name: MemoryCachePlugin.PLUGIN_NAME, stage: Cache_1.Cache.STAGE_MEMORY }, (identifier, etag, data) => {
|
|
8
|
+
const dataEtag = typeof etag?.toString === "function"
|
|
9
|
+
? etag.toString()
|
|
10
|
+
: etag;
|
|
11
|
+
cache.set(identifier, { etag: dataEtag, data });
|
|
12
|
+
});
|
|
13
|
+
compiler.cache.hooks.get.tap({ name: MemoryCachePlugin.PLUGIN_NAME, stage: Cache_1.Cache.STAGE_MEMORY }, (identifier, etag, gotHandlers) => {
|
|
14
|
+
const cacheEntry = cache.get(identifier);
|
|
15
|
+
const dataEtag = typeof etag?.toString === "function"
|
|
16
|
+
? etag.toString()
|
|
17
|
+
: etag;
|
|
18
|
+
if (cacheEntry === null) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
if (cacheEntry !== undefined) {
|
|
22
|
+
return cacheEntry.etag === dataEtag ? cacheEntry.data : null;
|
|
23
|
+
}
|
|
24
|
+
gotHandlers.push((result, callback) => {
|
|
25
|
+
if (result === undefined) {
|
|
26
|
+
cache.set(identifier, null);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
cache.set(identifier, { etag: dataEtag, data: result });
|
|
30
|
+
}
|
|
31
|
+
return callback(null);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
compiler.cache.hooks.shutdown.tap({ name: MemoryCachePlugin.PLUGIN_NAME, stage: Cache_1.Cache.STAGE_MEMORY }, () => {
|
|
35
|
+
cache.clear();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
MemoryCachePlugin.PLUGIN_NAME = "MemoryCachePlugin";
|
|
40
|
+
exports.default = MemoryCachePlugin;
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Etag } from "../Cache";
|
|
11
11
|
/**
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
12
|
+
* @param first first
|
|
13
|
+
* @param second second
|
|
14
14
|
* @returns result
|
|
15
15
|
*/
|
|
16
|
-
export declare const mergeEtags: (
|
|
16
|
+
export declare const mergeEtags: (first: Etag, second: Etag) => Etag;
|
|
17
17
|
export default mergeEtags;
|
|
@@ -26,11 +26,13 @@ class MergedEtag {
|
|
|
26
26
|
const dualObjectMap = new WeakMap();
|
|
27
27
|
const objectStringMap = new WeakMap();
|
|
28
28
|
/**
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
29
|
+
* @param first first
|
|
30
|
+
* @param second second
|
|
31
31
|
* @returns result
|
|
32
32
|
*/
|
|
33
|
-
const mergeEtags = (
|
|
33
|
+
const mergeEtags = (first, second) => {
|
|
34
|
+
let a = first;
|
|
35
|
+
let b = second;
|
|
34
36
|
if (typeof a === "string") {
|
|
35
37
|
if (typeof b === "string") {
|
|
36
38
|
return `${a}|${b}`;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
type DependencyLocation
|
|
10
|
+
import type { DependencyLocation } from "./Dependency";
|
|
11
11
|
/**
|
|
12
12
|
* @param loc location
|
|
13
13
|
* @returns formatted location
|
|
@@ -40,7 +40,7 @@ const identifier_1 = require("../util/identifier");
|
|
|
40
40
|
const memoize_1 = require("../util/memoize");
|
|
41
41
|
const loadLoader_1 = __importDefault(require("./loadLoader"));
|
|
42
42
|
function createLoaderObject(loader, compiler) {
|
|
43
|
-
|
|
43
|
+
const obj = {
|
|
44
44
|
path: null,
|
|
45
45
|
query: null,
|
|
46
46
|
fragment: null,
|
|
@@ -88,13 +88,13 @@ function createLoaderObject(loader, compiler) {
|
|
|
88
88
|
else if (obj.options === undefined)
|
|
89
89
|
obj.query = "";
|
|
90
90
|
else if (typeof obj.options === "string")
|
|
91
|
-
obj.query =
|
|
91
|
+
obj.query = `?${obj.options}`;
|
|
92
92
|
else if (obj.ident)
|
|
93
|
-
obj.query =
|
|
93
|
+
obj.query = `??${obj.ident}`;
|
|
94
94
|
else if (typeof obj.options === "object" && obj.options.ident)
|
|
95
|
-
obj.query =
|
|
95
|
+
obj.query = `??${obj.options.ident}`;
|
|
96
96
|
else
|
|
97
|
-
obj.query =
|
|
97
|
+
obj.query = `?${JSON.stringify(obj.options)}`;
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
obj.request = loader;
|
|
@@ -268,8 +268,7 @@ function dirname(path) {
|
|
|
268
268
|
return path.slice(0, idx);
|
|
269
269
|
}
|
|
270
270
|
function getCurrentLoader(loaderContext, index = loaderContext.loaderIndex) {
|
|
271
|
-
if (loaderContext.loaders &&
|
|
272
|
-
loaderContext.loaders.length &&
|
|
271
|
+
if (loaderContext.loaders?.length &&
|
|
273
272
|
index < loaderContext.loaders.length &&
|
|
274
273
|
index >= 0 &&
|
|
275
274
|
loaderContext.loaders[index]) {
|
|
@@ -507,7 +506,8 @@ async function runLoaders(compiler, context) {
|
|
|
507
506
|
return compiler._lastCompilation.getLogger([name, resource].filter(Boolean).join("|"));
|
|
508
507
|
};
|
|
509
508
|
loaderContext.rootContext = compiler.context;
|
|
510
|
-
loaderContext.emitError = function emitError(
|
|
509
|
+
loaderContext.emitError = function emitError(err) {
|
|
510
|
+
let error = err;
|
|
511
511
|
if (!(error instanceof Error)) {
|
|
512
512
|
error = new RspackError_1.NonErrorEmittedError(error);
|
|
513
513
|
}
|
|
@@ -522,7 +522,8 @@ async function runLoaders(compiler, context) {
|
|
|
522
522
|
severity: binding_1.JsRspackSeverity.Error
|
|
523
523
|
});
|
|
524
524
|
};
|
|
525
|
-
loaderContext.emitWarning = function emitWarning(
|
|
525
|
+
loaderContext.emitWarning = function emitWarning(warn) {
|
|
526
|
+
let warning = warn;
|
|
526
527
|
if (!(warning instanceof Error)) {
|
|
527
528
|
warning = new RspackError_1.NonErrorEmittedError(warning);
|
|
528
529
|
}
|
|
@@ -13,14 +13,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const LoaderLoadingError_1 = __importDefault(require("./LoaderLoadingError"));
|
|
16
|
-
|
|
16
|
+
let url = undefined;
|
|
17
17
|
function loadLoader(loader, callback) {
|
|
18
18
|
if (loader.type === "module") {
|
|
19
19
|
try {
|
|
20
20
|
if (url === undefined)
|
|
21
21
|
url = require("node:url");
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const loaderUrl = url.pathToFileURL(loader.path);
|
|
23
|
+
const modulePromise = eval(`import(${JSON.stringify(loaderUrl.toString())})`);
|
|
24
24
|
modulePromise.then((module) => {
|
|
25
25
|
handleResult(loader, module, callback);
|
|
26
26
|
}, callback);
|
|
@@ -31,15 +31,16 @@ function loadLoader(loader, callback) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
|
+
let module;
|
|
34
35
|
try {
|
|
35
|
-
|
|
36
|
+
module = require(loader.path);
|
|
36
37
|
}
|
|
37
38
|
catch (e) {
|
|
38
39
|
// it is possible for node to choke on a require if the FD descriptor
|
|
39
40
|
// limit has been reached. give it a chance to recover.
|
|
40
41
|
if (e instanceof Error &&
|
|
41
42
|
e.code === "EMFILE") {
|
|
42
|
-
|
|
43
|
+
const retry = loadLoader.bind(null, loader, callback);
|
|
43
44
|
if (typeof setImmediate === "function") {
|
|
44
45
|
// node >= 0.9.0
|
|
45
46
|
return void setImmediate(retry);
|
|
@@ -55,18 +56,14 @@ function loadLoader(loader, callback) {
|
|
|
55
56
|
exports.default = loadLoader;
|
|
56
57
|
function handleResult(loader, module, callback) {
|
|
57
58
|
if (typeof module !== "function" && typeof module !== "object") {
|
|
58
|
-
return callback(new LoaderLoadingError_1.default(
|
|
59
|
-
loader.path +
|
|
60
|
-
"' is not a loader (export function or es6 module)"));
|
|
59
|
+
return callback(new LoaderLoadingError_1.default(`Module '${loader.path}' is not a loader (export function or es6 module)`));
|
|
61
60
|
}
|
|
62
61
|
loader.normal = typeof module === "function" ? module : module.default;
|
|
63
62
|
loader.pitch = module.pitch;
|
|
64
63
|
loader.raw = module.raw;
|
|
65
64
|
if (typeof loader.normal !== "function" &&
|
|
66
65
|
typeof loader.pitch !== "function") {
|
|
67
|
-
return callback(new LoaderLoadingError_1.default(
|
|
68
|
-
loader.path +
|
|
69
|
-
"' is not a loader (must have normal or pitch function)"));
|
|
66
|
+
return callback(new LoaderLoadingError_1.default(`Module '${loader.path}' is not a loader (must have normal or pitch function)`));
|
|
70
67
|
}
|
|
71
68
|
callback();
|
|
72
69
|
}
|
package/dist/logging/Logger.js
CHANGED
|
@@ -92,7 +92,7 @@ class Logger {
|
|
|
92
92
|
this[TIMERS_SYMBOL].set(label, process.hrtime());
|
|
93
93
|
}
|
|
94
94
|
timeLog(label) {
|
|
95
|
-
const prev = this[TIMERS_SYMBOL]
|
|
95
|
+
const prev = this[TIMERS_SYMBOL]?.get(label);
|
|
96
96
|
if (!prev) {
|
|
97
97
|
throw new Error(`No such label '${label}' for WebpackLogger.timeLog()`);
|
|
98
98
|
}
|
|
@@ -100,7 +100,7 @@ class Logger {
|
|
|
100
100
|
this[LOG_SYMBOL](exports.LogType.time, [label, ...time]);
|
|
101
101
|
}
|
|
102
102
|
timeEnd(label) {
|
|
103
|
-
const prev = this[TIMERS_SYMBOL]
|
|
103
|
+
const prev = this[TIMERS_SYMBOL]?.get(label);
|
|
104
104
|
if (!prev) {
|
|
105
105
|
throw new Error(`No such label '${label}' for WebpackLogger.timeEnd()`);
|
|
106
106
|
}
|
|
@@ -109,7 +109,7 @@ class Logger {
|
|
|
109
109
|
this[LOG_SYMBOL](exports.LogType.time, [label, ...time]);
|
|
110
110
|
}
|
|
111
111
|
timeAggregate(label) {
|
|
112
|
-
const prev = this[TIMERS_SYMBOL]
|
|
112
|
+
const prev = this[TIMERS_SYMBOL]?.get(label);
|
|
113
113
|
if (!prev) {
|
|
114
114
|
throw new Error(`No such label '${label}' for WebpackLogger.timeAggregate()`);
|
|
115
115
|
}
|
|
@@ -7,9 +7,29 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
import type { FilterTypes } from "../config";
|
|
11
|
+
import { type LogTypeEnum } from "./Logger";
|
|
12
|
+
export type FilterFunction = (ident: string) => boolean;
|
|
13
|
+
export type LoggerConsole = {
|
|
14
|
+
clear: () => void;
|
|
15
|
+
trace: () => void;
|
|
16
|
+
info: (...args: any[]) => void;
|
|
17
|
+
log: (...args: any[]) => void;
|
|
18
|
+
warn: (...args: any[]) => void;
|
|
19
|
+
error: (...args: any[]) => void;
|
|
20
|
+
debug?: (...args: any[]) => void;
|
|
21
|
+
group?: (...args: any[]) => void;
|
|
22
|
+
groupCollapsed?: (...args: any[]) => void;
|
|
23
|
+
groupEnd?: (...args: any[]) => void;
|
|
24
|
+
status?: (...args: any[]) => void;
|
|
25
|
+
profile?: (...args: any[]) => void;
|
|
26
|
+
profileEnd?: (...args: any[]) => void;
|
|
27
|
+
logTime?: (...args: any[]) => void;
|
|
28
|
+
};
|
|
29
|
+
export type LoggerOptions = {
|
|
30
|
+
level: "none" | "error" | "warn" | "info" | "log" | "verbose" | boolean;
|
|
31
|
+
debug: FilterTypes | boolean;
|
|
32
|
+
console: LoggerConsole;
|
|
33
|
+
};
|
|
34
|
+
declare const createConsoleLogger: ({ level, debug, console }: LoggerOptions) => (name: string, type: LogTypeEnum, args: any[]) => void;
|
|
35
|
+
export { createConsoleLogger };
|