@rspack/core 1.0.0-beta.0 → 1.0.0-beta.2
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 +19 -1
- package/dist/Compiler.d.ts +11 -10
- package/dist/Compiler.js +16 -16
- package/dist/ExecuteModulePlugin.d.ts +0 -1
- package/dist/ExecuteModulePlugin.js +0 -1
- package/dist/Module.d.ts +2 -2
- package/dist/Module.js +1 -1
- package/dist/MultiCompiler.js +1 -1
- package/dist/NormalModule.d.ts +1 -0
- package/dist/NormalModule.js +1 -0
- package/dist/Resolver.d.ts +1 -2
- package/dist/RspackError.js +1 -1
- package/dist/Stats.js +22 -2
- package/dist/Template.js +2 -2
- package/dist/builtin-loader/lightningcss/index.js +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 +31 -31
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CopyRspackPlugin.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/DefinePlugin.js +1 -1
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
- 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 +3 -3
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.js +1 -1
- package/dist/builtin-plugin/EnableLibraryPlugin.js +1 -6
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.js +1 -1
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EntryPlugin.d.ts +3 -2
- package/dist/builtin-plugin/EntryPlugin.js +1 -0
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +5 -5
- package/dist/builtin-plugin/ExternalsPlugin.js +1 -1
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FileUriPlugin.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/HtmlRspackPlugin.d.ts +9 -9
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/IgnorePlugin.d.ts +1 -1
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +0 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.js +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +4 -11
- 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/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/NodeTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
- 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 +1 -1
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +2 -3
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +1 -1
- package/dist/builtin-plugin/base.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +3 -5
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.js +7 -5
- package/dist/builtin-plugin/css-extract/loader.d.ts +8 -3
- package/dist/builtin-plugin/css-extract/loader.js +27 -22
- package/dist/builtin-plugin/lazy-compilation/backend.js +4 -4
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +1 -1
- package/dist/config/adapter.js +16 -2
- package/dist/config/adapterRuleUse.d.ts +2 -6
- package/dist/config/adapterRuleUse.js +10 -9
- package/dist/config/defaults.js +28 -42
- package/dist/config/normalization.d.ts +7 -3
- package/dist/config/normalization.js +7 -2
- package/dist/config/zod.d.ts +1634 -1093
- package/dist/config/zod.js +31 -2
- package/dist/container/ContainerReferencePlugin.d.ts +1 -1
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
- package/dist/container/default.runtime.js +1 -1
- package/dist/exports.d.ts +1 -1
- package/dist/lib/AbstractMethodError.d.ts +12 -3
- package/dist/lib/AbstractMethodError.js +29 -22
- package/dist/lib/Cache.d.ts +40 -46
- package/dist/lib/Cache.js +43 -78
- package/dist/lib/CacheFacade.d.ts +119 -143
- package/dist/lib/CacheFacade.js +123 -124
- package/dist/lib/Dependency.d.ts +23 -0
- package/dist/lib/Dependency.js +11 -0
- package/dist/lib/EntryOptionPlugin.d.ts +19 -2
- package/dist/lib/EntryOptionPlugin.js +22 -6
- package/dist/lib/EnvironmentPlugin.d.ts +17 -10
- package/dist/lib/EnvironmentPlugin.js +16 -17
- package/dist/lib/HookWebpackError.d.ts +27 -33
- package/dist/lib/HookWebpackError.js +33 -34
- package/dist/lib/IgnoreWarningsPlugin.d.ts +25 -0
- package/dist/lib/{ignoreWarningsPlugin.js → IgnoreWarningsPlugin.js} +17 -0
- package/dist/lib/LoaderOptionsPlugin.d.ts +18 -9
- package/dist/lib/LoaderOptionsPlugin.js +38 -14
- package/dist/lib/LoaderTargetPlugin.d.ts +17 -8
- package/dist/lib/LoaderTargetPlugin.js +17 -15
- package/dist/lib/ModuleFilenameHelpers.d.ts +10 -1
- package/dist/lib/ModuleFilenameHelpers.js +10 -1
- package/dist/lib/NormalModuleReplacementPlugin.d.ts +15 -5
- package/dist/lib/NormalModuleReplacementPlugin.js +15 -5
- package/dist/lib/WebpackError.d.ts +23 -22
- package/dist/lib/WebpackError.js +15 -35
- package/dist/lib/cache/MemoryCachePlugin.d.ts +5 -0
- package/dist/lib/cache/MemoryCachePlugin.js +40 -0
- package/dist/lib/cache/getLazyHashedEtag.d.ts +24 -24
- package/dist/lib/cache/getLazyHashedEtag.js +20 -23
- package/dist/lib/cache/mergeEtags.d.ts +15 -9
- package/dist/lib/cache/mergeEtags.js +18 -11
- package/dist/lib/formatLocation.d.ts +14 -9
- package/dist/lib/formatLocation.js +17 -15
- package/dist/loader-runner/index.js +6 -7
- 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 +29 -36
- package/dist/rspackOptionsApply.d.ts +0 -1
- package/dist/rspackOptionsApply.js +10 -9
- 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 +1 -2
- package/dist/stats/DefaultStatsPrinterPlugin.js +18 -19
- package/dist/stats/StatsFactory.d.ts +2 -1
- package/dist/stats/StatsFactory.js +2 -6
- package/dist/stats/statsFactoryUtils.d.ts +63 -23
- package/dist/util/SizeFormatHelpers.js +1 -1
- package/dist/util/bindingVersionCheck.js +3 -3
- package/dist/util/cleverMerge.js +3 -2
- package/dist/util/comparators.d.ts +2 -2
- package/dist/util/comparators.js +5 -4
- package/dist/util/createHash.js +1 -1
- package/dist/util/fs.js +2 -2
- package/dist/util/identifier.js +2 -2
- package/dist/util/index.js +1 -1
- package/dist/util/memoize.js +1 -4
- 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/compiled/enhanced-resolve/index.js +0 -5566
- package/dist/lib/ignoreWarningsPlugin.d.ts +0 -7
package/dist/config/zod.js
CHANGED
|
@@ -93,6 +93,7 @@ const libraryOptions = zod_1.z.strictObject({
|
|
|
93
93
|
umdNamedDefine: umdNamedDefine.optional()
|
|
94
94
|
});
|
|
95
95
|
const library = libraryName.or(libraryOptions).optional();
|
|
96
|
+
const layer = zod_1.z.string().or(zod_1.z.null());
|
|
96
97
|
const entryFilename = filename;
|
|
97
98
|
const entryRuntime = zod_1.z.literal(false).or(zod_1.z.string());
|
|
98
99
|
const entryItem = zod_1.z.string().or(zod_1.z.array(zod_1.z.string()));
|
|
@@ -107,7 +108,8 @@ const entryDescription = zod_1.z.strictObject({
|
|
|
107
108
|
wasmLoading: wasmLoading.optional(),
|
|
108
109
|
filename: entryFilename.optional(),
|
|
109
110
|
library: libraryOptions.optional(),
|
|
110
|
-
dependOn: entryDependOn.optional()
|
|
111
|
+
dependOn: entryDependOn.optional(),
|
|
112
|
+
layer: layer.optional()
|
|
111
113
|
});
|
|
112
114
|
const entryUnnamed = entryItem;
|
|
113
115
|
const entryObject = zod_1.z.record(entryItem.or(entryDescription));
|
|
@@ -138,6 +140,7 @@ const strictModuleErrorHandling = zod_1.z.boolean();
|
|
|
138
140
|
const globalObject = zod_1.z.string();
|
|
139
141
|
const enabledWasmLoadingTypes = zod_1.z.array(wasmLoadingType);
|
|
140
142
|
const importFunctionName = zod_1.z.string();
|
|
143
|
+
const importMetaName = zod_1.z.string();
|
|
141
144
|
const iife = zod_1.z.boolean();
|
|
142
145
|
const enabledChunkLoadingTypes = zod_1.z.array(chunkLoadingType);
|
|
143
146
|
const chunkFormat = zod_1.z.literal(false).or(zod_1.z.string());
|
|
@@ -181,6 +184,7 @@ const output = zod_1.z.strictObject({
|
|
|
181
184
|
chunkFilename: chunkFilename.optional(),
|
|
182
185
|
crossOriginLoading: crossOriginLoading.optional(),
|
|
183
186
|
cssFilename: cssFilename.optional(),
|
|
187
|
+
cssHeadDataCompression: zod_1.z.boolean().optional(),
|
|
184
188
|
cssChunkFilename: cssChunkFilename.optional(),
|
|
185
189
|
hotUpdateMainFilename: hotUpdateMainFilename.optional(),
|
|
186
190
|
hotUpdateChunkFilename: hotUpdateChunkFilename.optional(),
|
|
@@ -199,6 +203,7 @@ const output = zod_1.z.strictObject({
|
|
|
199
203
|
strictModuleErrorHandling: strictModuleErrorHandling.optional(),
|
|
200
204
|
globalObject: globalObject.optional(),
|
|
201
205
|
importFunctionName: importFunctionName.optional(),
|
|
206
|
+
importMetaName: importMetaName.optional(),
|
|
202
207
|
iife: iife.optional(),
|
|
203
208
|
wasmLoading: wasmLoading.optional(),
|
|
204
209
|
enabledWasmLoadingTypes: enabledWasmLoadingTypes.optional(),
|
|
@@ -291,6 +296,7 @@ const baseRuleSetRule = zod_1.z.strictObject({
|
|
|
291
296
|
exclude: ruleSetCondition.optional(),
|
|
292
297
|
include: ruleSetCondition.optional(),
|
|
293
298
|
issuer: ruleSetCondition.optional(),
|
|
299
|
+
issuerLayer: ruleSetCondition.optional(),
|
|
294
300
|
dependency: ruleSetCondition.optional(),
|
|
295
301
|
resource: ruleSetCondition.optional(),
|
|
296
302
|
resourceFragment: ruleSetCondition.optional(),
|
|
@@ -298,7 +304,9 @@ const baseRuleSetRule = zod_1.z.strictObject({
|
|
|
298
304
|
scheme: ruleSetCondition.optional(),
|
|
299
305
|
mimetype: ruleSetCondition.optional(),
|
|
300
306
|
descriptionData: zod_1.z.record(ruleSetCondition).optional(),
|
|
307
|
+
with: zod_1.z.record(ruleSetCondition).optional(),
|
|
301
308
|
type: zod_1.z.string().optional(),
|
|
309
|
+
layer: zod_1.z.string().optional(),
|
|
302
310
|
loader: ruleSetLoader.optional(),
|
|
303
311
|
options: ruleSetLoaderOptions.optional(),
|
|
304
312
|
use: ruleSetUse.optional(),
|
|
@@ -352,6 +360,7 @@ const javascriptParserOptions = zod_1.z.strictObject({
|
|
|
352
360
|
dynamicImportPreload: dynamicImportPreload.optional(),
|
|
353
361
|
dynamicImportPrefetch: dynamicImportPrefetch.optional(),
|
|
354
362
|
dynamicImportFetchPriority: dynamicImportFetchPriority.optional(),
|
|
363
|
+
importMeta: zod_1.z.boolean().optional(),
|
|
355
364
|
url: javascriptParserUrl.optional(),
|
|
356
365
|
exprContextCritical: exprContextCritical.optional(),
|
|
357
366
|
wrappedContextCritical: wrappedContextCritical.optional(),
|
|
@@ -724,7 +733,9 @@ const statsOptions = zod_1.z.strictObject({
|
|
|
724
733
|
groupReasonsByOrigin: zod_1.z.boolean().optional(),
|
|
725
734
|
errorDetails: zod_1.z.boolean().optional(),
|
|
726
735
|
errorStack: zod_1.z.boolean().optional(),
|
|
727
|
-
moduleTrace: zod_1.z.boolean().optional()
|
|
736
|
+
moduleTrace: zod_1.z.boolean().optional(),
|
|
737
|
+
cachedModules: zod_1.z.boolean().optional(),
|
|
738
|
+
cached: zod_1.z.boolean().optional()
|
|
728
739
|
});
|
|
729
740
|
const statsValue = zod_1.z.boolean().or(statsPresets).or(statsOptions);
|
|
730
741
|
const plugin = zod_1.z.union([
|
|
@@ -843,7 +854,24 @@ const rspackFutureOptions = zod_1.z.strictObject({
|
|
|
843
854
|
})
|
|
844
855
|
.optional()
|
|
845
856
|
});
|
|
857
|
+
const listenOptions = zod_1.z.object({
|
|
858
|
+
port: zod_1.z.number().optional(),
|
|
859
|
+
host: zod_1.z.string().optional(),
|
|
860
|
+
backlog: zod_1.z.number().optional(),
|
|
861
|
+
path: zod_1.z.string().optional(),
|
|
862
|
+
exclusive: zod_1.z.boolean().optional(),
|
|
863
|
+
readableAll: zod_1.z.boolean().optional(),
|
|
864
|
+
writableAll: zod_1.z.boolean().optional(),
|
|
865
|
+
ipv6Only: zod_1.z.boolean().optional()
|
|
866
|
+
});
|
|
846
867
|
const lazyCompilationOptions = zod_1.z.object({
|
|
868
|
+
backend: zod_1.z
|
|
869
|
+
.object({
|
|
870
|
+
client: zod_1.z.string().optional(),
|
|
871
|
+
listen: zod_1.z.number().optional().or(listenOptions),
|
|
872
|
+
protocol: zod_1.z.enum(["http", "https"]).optional()
|
|
873
|
+
})
|
|
874
|
+
.optional(),
|
|
847
875
|
imports: zod_1.z.boolean().optional(),
|
|
848
876
|
entries: zod_1.z.boolean().optional(),
|
|
849
877
|
test: zod_1.z
|
|
@@ -857,6 +885,7 @@ const experiments = zod_1.z.strictObject({
|
|
|
857
885
|
outputModule: zod_1.z.boolean().optional(),
|
|
858
886
|
topLevelAwait: zod_1.z.boolean().optional(),
|
|
859
887
|
css: zod_1.z.boolean().optional(),
|
|
888
|
+
layers: zod_1.z.boolean().optional(),
|
|
860
889
|
futureDefaults: zod_1.z.boolean().optional(),
|
|
861
890
|
rspackFuture: rspackFutureOptions.optional()
|
|
862
891
|
});
|
|
@@ -21,7 +21,7 @@ export type RemotesConfig = {
|
|
|
21
21
|
export declare class ContainerReferencePlugin extends RspackBuiltinPlugin {
|
|
22
22
|
name: BuiltinPluginName;
|
|
23
23
|
_options: {
|
|
24
|
-
remoteType: "
|
|
24
|
+
remoteType: "module" | "global" | "system" | "promise" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "script" | "node-commonjs";
|
|
25
25
|
remotes: [string, {
|
|
26
26
|
external: string[];
|
|
27
27
|
shareScope: string;
|
|
@@ -3,7 +3,7 @@ export declare const ModuleFederationRuntimePlugin: {
|
|
|
3
3
|
new (): {
|
|
4
4
|
name: BuiltinPluginName;
|
|
5
5
|
_args: [];
|
|
6
|
-
affectedHooks: "done" | "
|
|
6
|
+
affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
7
7
|
raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
8
8
|
apply(compiler: import("../Compiler").Compiler): void;
|
|
9
9
|
};
|
|
@@ -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
|
@@ -33,7 +33,7 @@ type Config = {
|
|
|
33
33
|
export declare const config: Config;
|
|
34
34
|
export type * from "./config";
|
|
35
35
|
export declare const util: {
|
|
36
|
-
createHash: (algorithm:
|
|
36
|
+
createHash: (algorithm: (string & {}) | "debug" | "xxhash64" | "md4" | "native-md4" | (new () => import("./util/hash").default)) => import("./util/hash").default;
|
|
37
37
|
cleverMerge: <First, Second>(first: First, second: Second) => First | Second | (First & Second);
|
|
38
38
|
};
|
|
39
39
|
export { default as EntryOptionPlugin } from "./lib/EntryOptionPlugin";
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/AbstractMethodError.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
|
+
import WebpackError from "./WebpackError";
|
|
2
11
|
/**
|
|
3
12
|
* Error for abstract method
|
|
4
13
|
* @example
|
|
@@ -9,7 +18,7 @@ export = AbstractMethodError;
|
|
|
9
18
|
* }
|
|
10
19
|
*
|
|
11
20
|
*/
|
|
12
|
-
declare class AbstractMethodError extends WebpackError {
|
|
21
|
+
export declare class AbstractMethodError extends WebpackError {
|
|
13
22
|
constructor();
|
|
14
23
|
}
|
|
15
|
-
|
|
24
|
+
export default AbstractMethodError;
|
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Ivan Kopeykin @vankop
|
|
4
|
-
*/
|
|
5
1
|
"use strict";
|
|
6
|
-
|
|
2
|
+
/**
|
|
3
|
+
* The following code is modified based on
|
|
4
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/AbstractMethodError.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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AbstractMethodError = void 0;
|
|
16
|
+
const WebpackError_1 = __importDefault(require("./WebpackError"));
|
|
7
17
|
const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
|
|
8
18
|
/**
|
|
9
|
-
* @param
|
|
10
|
-
* @returns
|
|
19
|
+
* @param method method name
|
|
20
|
+
* @returns message
|
|
11
21
|
*/
|
|
12
22
|
function createMessage(method) {
|
|
13
|
-
return `Abstract method${method ?
|
|
23
|
+
return `Abstract method${method ? ` ${method}` : ""}. Must be overridden.`;
|
|
14
24
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/** @type {RegExpMatchArray} */
|
|
24
|
-
// @ts-expect-error
|
|
25
|
-
const match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP);
|
|
26
|
-
this.message = match && match[1] ? createMessage(match[1]) : createMessage();
|
|
25
|
+
class Message extends Error {
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
this.stack = undefined;
|
|
29
|
+
Error.captureStackTrace(this);
|
|
30
|
+
const match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP);
|
|
31
|
+
this.message = match?.[1] ? createMessage(match[1]) : createMessage();
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
34
|
/**
|
|
29
35
|
* Error for abstract method
|
|
@@ -35,10 +41,11 @@ function Message() {
|
|
|
35
41
|
* }
|
|
36
42
|
*
|
|
37
43
|
*/
|
|
38
|
-
class AbstractMethodError extends
|
|
44
|
+
class AbstractMethodError extends WebpackError_1.default {
|
|
39
45
|
constructor() {
|
|
40
46
|
super(new Message().message);
|
|
41
47
|
this.name = "AbstractMethodError";
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
|
-
|
|
50
|
+
exports.AbstractMethodError = AbstractMethodError;
|
|
51
|
+
exports.default = AbstractMethodError;
|
package/dist/lib/Cache.d.ts
CHANGED
|
@@ -1,71 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/Cache.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
|
+
import { AsyncParallelHook, AsyncSeriesBailHook, SyncHook } from "@rspack/lite-tapable";
|
|
11
|
+
import type { WebpackError } from "./WebpackError";
|
|
12
|
+
export interface Etag {
|
|
13
|
+
toString(): string;
|
|
14
|
+
}
|
|
15
|
+
export type CallbackCache<T> = (err?: WebpackError | null, result?: T) => void;
|
|
16
|
+
type GotHandler<T = any> = (result: any | null, callback: (error: Error | null) => void) => void;
|
|
17
|
+
export declare class Cache {
|
|
18
|
+
static STAGE_DISK: number;
|
|
19
|
+
static STAGE_MEMORY: number;
|
|
20
|
+
static STAGE_DEFAULT: number;
|
|
21
|
+
static STAGE_NETWORK: number;
|
|
3
22
|
hooks: {
|
|
4
|
-
/** @type {AsyncSeriesBailHook<[string, Etag | null, GotHandler[]], any>} */
|
|
5
23
|
get: AsyncSeriesBailHook<[string, Etag | null, GotHandler[]], any>;
|
|
6
|
-
/** @type {AsyncParallelHook<[string, Etag | null, any]>} */
|
|
7
24
|
store: AsyncParallelHook<[string, Etag | null, any]>;
|
|
8
|
-
/** @type {AsyncParallelHook<[Iterable<string>]>} */
|
|
9
25
|
storeBuildDependencies: AsyncParallelHook<[Iterable<string>]>;
|
|
10
|
-
/** @type {SyncHook<[]>} */
|
|
11
26
|
beginIdle: SyncHook<[]>;
|
|
12
|
-
/** @type {AsyncParallelHook<[]>} */
|
|
13
27
|
endIdle: AsyncParallelHook<[]>;
|
|
14
|
-
/** @type {AsyncParallelHook<[]>} */
|
|
15
28
|
shutdown: AsyncParallelHook<[]>;
|
|
16
29
|
};
|
|
30
|
+
constructor();
|
|
17
31
|
/**
|
|
18
|
-
* @
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @
|
|
22
|
-
* @returns {void}
|
|
32
|
+
* @param identifier the cache identifier
|
|
33
|
+
* @param etag the etag
|
|
34
|
+
* @param callback signals when the value is retrieved
|
|
35
|
+
* @returns
|
|
23
36
|
*/
|
|
24
37
|
get<T>(identifier: string, etag: Etag | null, callback: CallbackCache<T>): void;
|
|
25
38
|
/**
|
|
26
|
-
* @
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @
|
|
31
|
-
* @returns {void}
|
|
39
|
+
* @param identifier the cache identifier
|
|
40
|
+
* @param etag the etag
|
|
41
|
+
* @param data the value to store
|
|
42
|
+
* @param callback signals when the value is stored
|
|
43
|
+
* @returns
|
|
32
44
|
*/
|
|
33
|
-
store<
|
|
45
|
+
store<T>(identifier: string, etag: Etag | null, data: T, callback: CallbackCache<void>): void;
|
|
34
46
|
/**
|
|
35
47
|
* After this method has succeeded the cache can only be restored when build dependencies are
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @returns
|
|
48
|
+
* @param dependencies list of all build dependencies
|
|
49
|
+
* @param callback signals when the dependencies are stored
|
|
50
|
+
* @returns
|
|
39
51
|
*/
|
|
40
52
|
storeBuildDependencies(dependencies: Iterable<string>, callback: CallbackCache<void>): void;
|
|
41
|
-
/**
|
|
42
|
-
* @returns {void}
|
|
43
|
-
*/
|
|
44
53
|
beginIdle(): void;
|
|
45
54
|
/**
|
|
46
|
-
* @param
|
|
47
|
-
* @returns
|
|
55
|
+
* @param callback signals when the call finishes
|
|
56
|
+
* @returns
|
|
48
57
|
*/
|
|
49
58
|
endIdle(callback: CallbackCache<void>): void;
|
|
50
59
|
/**
|
|
51
|
-
* @param
|
|
52
|
-
* @returns
|
|
60
|
+
* @param callback signals when the call finishes
|
|
61
|
+
* @returns
|
|
53
62
|
*/
|
|
54
63
|
shutdown(callback: CallbackCache<void>): void;
|
|
55
64
|
}
|
|
56
|
-
|
|
57
|
-
export { STAGE_MEMORY, STAGE_DEFAULT, STAGE_DISK, STAGE_NETWORK, WebpackError, Etag, CallbackCache, GotHandler };
|
|
58
|
-
}
|
|
59
|
-
import { AsyncSeriesBailHook } from "@rspack/lite-tapable";
|
|
60
|
-
type Etag = {
|
|
61
|
-
toString: () => string;
|
|
62
|
-
};
|
|
63
|
-
type GotHandler = (result: any, callback: (arg0: Error | undefined) => void) => void;
|
|
64
|
-
import { AsyncParallelHook } from "@rspack/lite-tapable";
|
|
65
|
-
import { SyncHook } from "@rspack/lite-tapable";
|
|
66
|
-
type CallbackCache<T> = (err?: (WebpackError | null) | undefined, result?: T | undefined) => void;
|
|
67
|
-
declare var STAGE_MEMORY: number;
|
|
68
|
-
declare var STAGE_DEFAULT: number;
|
|
69
|
-
declare var STAGE_DISK: number;
|
|
70
|
-
declare var STAGE_NETWORK: number;
|
|
71
|
-
type WebpackError = import("./WebpackError");
|
|
65
|
+
export default Cache;
|
package/dist/lib/Cache.js
CHANGED
|
@@ -1,72 +1,50 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
1
|
"use strict";
|
|
6
|
-
const { AsyncParallelHook, AsyncSeriesBailHook, SyncHook } = require("@rspack/lite-tapable");
|
|
7
|
-
const { makeWebpackError, makeWebpackErrorCallback } = require("./HookWebpackError.js");
|
|
8
|
-
/** @typedef {import("./WebpackError")} WebpackError */
|
|
9
2
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
3
|
+
* The following code is modified based on
|
|
4
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/Cache.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
|
|
12
10
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* @param {T=} result
|
|
18
|
-
* @returns {void}
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* @callback GotHandler
|
|
22
|
-
* @param {any} result
|
|
23
|
-
* @param {function(Error=): void} callback
|
|
24
|
-
* @returns {void}
|
|
25
|
-
*/
|
|
26
|
-
// @ts-expect-error
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Cache = void 0;
|
|
13
|
+
const lite_tapable_1 = require("@rspack/lite-tapable");
|
|
14
|
+
const HookWebpackError_1 = require("./HookWebpackError");
|
|
27
15
|
const needCalls = (times, callback) => {
|
|
28
|
-
// @ts-expect-error
|
|
29
16
|
return err => {
|
|
30
17
|
if (--times === 0) {
|
|
31
|
-
return callback(
|
|
18
|
+
return callback();
|
|
32
19
|
}
|
|
33
20
|
if (err && times > 0) {
|
|
34
21
|
times = 0;
|
|
35
|
-
return callback(
|
|
22
|
+
return callback();
|
|
36
23
|
}
|
|
37
24
|
};
|
|
38
25
|
};
|
|
39
26
|
class Cache {
|
|
40
27
|
constructor() {
|
|
41
28
|
this.hooks = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/** @type {SyncHook<[]>} */
|
|
49
|
-
beginIdle: new SyncHook([]),
|
|
50
|
-
/** @type {AsyncParallelHook<[]>} */
|
|
51
|
-
endIdle: new AsyncParallelHook([]),
|
|
52
|
-
/** @type {AsyncParallelHook<[]>} */
|
|
53
|
-
shutdown: new AsyncParallelHook([])
|
|
29
|
+
get: new lite_tapable_1.AsyncSeriesBailHook(["identifier", "etag", "gotHandlers"]),
|
|
30
|
+
store: new lite_tapable_1.AsyncParallelHook(["identifier", "etag", "data"]),
|
|
31
|
+
storeBuildDependencies: new lite_tapable_1.AsyncParallelHook(["dependencies"]),
|
|
32
|
+
beginIdle: new lite_tapable_1.SyncHook([]),
|
|
33
|
+
endIdle: new lite_tapable_1.AsyncParallelHook([]),
|
|
34
|
+
shutdown: new lite_tapable_1.AsyncParallelHook([])
|
|
54
35
|
};
|
|
55
36
|
}
|
|
56
37
|
/**
|
|
57
|
-
* @
|
|
58
|
-
* @param
|
|
59
|
-
* @param
|
|
60
|
-
* @
|
|
61
|
-
* @returns {void}
|
|
38
|
+
* @param identifier the cache identifier
|
|
39
|
+
* @param etag the etag
|
|
40
|
+
* @param callback signals when the value is retrieved
|
|
41
|
+
* @returns
|
|
62
42
|
*/
|
|
63
43
|
get(identifier, etag, callback) {
|
|
64
|
-
// @ts-expect-error
|
|
65
44
|
const gotHandlers = [];
|
|
66
|
-
// @ts-expect-error
|
|
67
45
|
this.hooks.get.callAsync(identifier, etag, gotHandlers, (err, result) => {
|
|
68
46
|
if (err) {
|
|
69
|
-
callback(makeWebpackError(err, "Cache.hooks.get"));
|
|
47
|
+
callback((0, HookWebpackError_1.makeWebpackError)(err, "Cache.hooks.get"));
|
|
70
48
|
return;
|
|
71
49
|
}
|
|
72
50
|
if (result === null) {
|
|
@@ -74,13 +52,11 @@ class Cache {
|
|
|
74
52
|
}
|
|
75
53
|
if (gotHandlers.length > 1) {
|
|
76
54
|
const innerCallback = needCalls(gotHandlers.length, () => callback(null, result));
|
|
77
|
-
// @ts-expect-error
|
|
78
55
|
for (const gotHandler of gotHandlers) {
|
|
79
56
|
gotHandler(result, innerCallback);
|
|
80
57
|
}
|
|
81
58
|
}
|
|
82
59
|
else if (gotHandlers.length === 1) {
|
|
83
|
-
// @ts-expect-error
|
|
84
60
|
gotHandlers[0](result, () => callback(null, result));
|
|
85
61
|
}
|
|
86
62
|
else {
|
|
@@ -89,56 +65,45 @@ class Cache {
|
|
|
89
65
|
});
|
|
90
66
|
}
|
|
91
67
|
/**
|
|
92
|
-
* @
|
|
93
|
-
* @param
|
|
94
|
-
* @param
|
|
95
|
-
* @param
|
|
96
|
-
* @
|
|
97
|
-
* @returns {void}
|
|
68
|
+
* @param identifier the cache identifier
|
|
69
|
+
* @param etag the etag
|
|
70
|
+
* @param data the value to store
|
|
71
|
+
* @param callback signals when the value is stored
|
|
72
|
+
* @returns
|
|
98
73
|
*/
|
|
99
74
|
store(identifier, etag, data, callback) {
|
|
100
|
-
this.hooks.store.callAsync(identifier, etag, data,
|
|
101
|
-
// @ts-expect-error
|
|
102
|
-
makeWebpackErrorCallback(callback, "Cache.hooks.store"));
|
|
75
|
+
this.hooks.store.callAsync(identifier, etag, data, (0, HookWebpackError_1.makeWebpackErrorCallback)(callback, "Cache.hooks.store"));
|
|
103
76
|
}
|
|
104
77
|
/**
|
|
105
78
|
* After this method has succeeded the cache can only be restored when build dependencies are
|
|
106
|
-
* @param
|
|
107
|
-
* @param
|
|
108
|
-
* @returns
|
|
79
|
+
* @param dependencies list of all build dependencies
|
|
80
|
+
* @param callback signals when the dependencies are stored
|
|
81
|
+
* @returns
|
|
109
82
|
*/
|
|
110
83
|
storeBuildDependencies(dependencies, callback) {
|
|
111
|
-
this.hooks.storeBuildDependencies.callAsync(dependencies,
|
|
112
|
-
// @ts-expect-error
|
|
113
|
-
makeWebpackErrorCallback(callback, "Cache.hooks.storeBuildDependencies"));
|
|
84
|
+
this.hooks.storeBuildDependencies.callAsync(dependencies, (0, HookWebpackError_1.makeWebpackErrorCallback)(callback, "Cache.hooks.storeBuildDependencies"));
|
|
114
85
|
}
|
|
115
|
-
/**
|
|
116
|
-
* @returns {void}
|
|
117
|
-
*/
|
|
118
86
|
beginIdle() {
|
|
119
87
|
this.hooks.beginIdle.call();
|
|
120
88
|
}
|
|
121
89
|
/**
|
|
122
|
-
* @param
|
|
123
|
-
* @returns
|
|
90
|
+
* @param callback signals when the call finishes
|
|
91
|
+
* @returns
|
|
124
92
|
*/
|
|
125
93
|
endIdle(callback) {
|
|
126
|
-
this.hooks.endIdle.callAsync(
|
|
127
|
-
// @ts-expect-error
|
|
128
|
-
makeWebpackErrorCallback(callback, "Cache.hooks.endIdle"));
|
|
94
|
+
this.hooks.endIdle.callAsync((0, HookWebpackError_1.makeWebpackErrorCallback)(callback, "Cache.hooks.endIdle"));
|
|
129
95
|
}
|
|
130
96
|
/**
|
|
131
|
-
* @param
|
|
132
|
-
* @returns
|
|
97
|
+
* @param callback signals when the call finishes
|
|
98
|
+
* @returns
|
|
133
99
|
*/
|
|
134
100
|
shutdown(callback) {
|
|
135
|
-
this.hooks.shutdown.callAsync(
|
|
136
|
-
// @ts-expect-error
|
|
137
|
-
makeWebpackErrorCallback(callback, "Cache.hooks.shutdown"));
|
|
101
|
+
this.hooks.shutdown.callAsync((0, HookWebpackError_1.makeWebpackErrorCallback)(callback, "Cache.hooks.shutdown"));
|
|
138
102
|
}
|
|
139
103
|
}
|
|
104
|
+
Cache.STAGE_DISK = 10;
|
|
140
105
|
Cache.STAGE_MEMORY = -10;
|
|
141
106
|
Cache.STAGE_DEFAULT = 0;
|
|
142
|
-
Cache.STAGE_DISK = 10;
|
|
143
107
|
Cache.STAGE_NETWORK = 20;
|
|
144
|
-
|
|
108
|
+
exports.Cache = Cache;
|
|
109
|
+
exports.default = Cache;
|