@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/defaults.js
CHANGED
|
@@ -126,6 +126,7 @@ const applyExperimentsDefaults = (experiments) => {
|
|
|
126
126
|
D(experiments, "lazyCompilation", false);
|
|
127
127
|
D(experiments, "asyncWebAssembly", experiments.futureDefaults);
|
|
128
128
|
D(experiments, "css", experiments.futureDefaults ? true : undefined);
|
|
129
|
+
D(experiments, "layers", false);
|
|
129
130
|
D(experiments, "topLevelAwait", true);
|
|
130
131
|
// IGNORE(experiments.rspackFuture): Rspack specific configuration
|
|
131
132
|
D(experiments, "rspackFuture", {});
|
|
@@ -152,6 +153,7 @@ const applyJavascriptParserOptionsDefaults = (parserOptions, fallback) => {
|
|
|
152
153
|
D(parserOptions, "strictExportPresence", fallback?.strictExportPresence ?? false);
|
|
153
154
|
D(parserOptions, "worker", fallback?.worker ?? ["..."]);
|
|
154
155
|
D(parserOptions, "overrideStrict", fallback?.overrideStrict ?? undefined);
|
|
156
|
+
D(parserOptions, "importMeta", fallback?.importMeta ?? true);
|
|
155
157
|
};
|
|
156
158
|
const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties }) => {
|
|
157
159
|
(0, assertNotNil_1.assertNotNill)(module.parser);
|
|
@@ -316,16 +318,10 @@ const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties }
|
|
|
316
318
|
type: "asset/resource"
|
|
317
319
|
}
|
|
318
320
|
]
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
// },
|
|
324
|
-
// {
|
|
325
|
-
// with: { type: "json" },
|
|
326
|
-
// type: "json"
|
|
327
|
-
// }
|
|
328
|
-
);
|
|
321
|
+
}, {
|
|
322
|
+
with: { type: "json" },
|
|
323
|
+
type: "json"
|
|
324
|
+
});
|
|
329
325
|
return rules;
|
|
330
326
|
});
|
|
331
327
|
};
|
|
@@ -407,8 +403,9 @@ const applyOutputDefaults = (output, { context, outputModule, targetProperties:
|
|
|
407
403
|
D(output, "hotUpdateChunkFilename", `[id].[fullhash].hot-update.${output.module ? "mjs" : "js"}`);
|
|
408
404
|
D(output, "hotUpdateMainFilename", "[runtime].[fullhash].hot-update.json");
|
|
409
405
|
const uniqueNameId = Template_1.Template.toIdentifier(output.uniqueName);
|
|
410
|
-
F(output, "hotUpdateGlobal", () =>
|
|
411
|
-
F(output, "chunkLoadingGlobal", () =>
|
|
406
|
+
F(output, "hotUpdateGlobal", () => `webpackHotUpdate${uniqueNameId}`);
|
|
407
|
+
F(output, "chunkLoadingGlobal", () => `webpackChunk${uniqueNameId}`);
|
|
408
|
+
D(output, "cssHeadDataCompression", !development);
|
|
412
409
|
D(output, "assetModuleFilename", "[hash][ext][query]");
|
|
413
410
|
D(output, "webassemblyModuleFilename", "[hash].module.wasm");
|
|
414
411
|
F(output, "path", () => node_path_1.default.join(process.cwd(), "dist"));
|
|
@@ -431,10 +428,7 @@ const applyOutputDefaults = (output, { context, outputModule, targetProperties:
|
|
|
431
428
|
return "module";
|
|
432
429
|
if (tp.document)
|
|
433
430
|
return "array-push";
|
|
434
|
-
throw new Error(
|
|
435
|
-
"ESM exports can be chosen when 'import()' is available.\n" +
|
|
436
|
-
"JSONP Array push can be chosen when 'document' is available.\n" +
|
|
437
|
-
helpMessage);
|
|
431
|
+
throw new Error(`For the selected environment is no default ESM chunk format available:\nESM exports can be chosen when 'import()' is available.\nJSONP Array push can be chosen when 'document' is available.\n${helpMessage}`);
|
|
438
432
|
}
|
|
439
433
|
if (tp.document)
|
|
440
434
|
return "array-push";
|
|
@@ -444,10 +438,7 @@ const applyOutputDefaults = (output, { context, outputModule, targetProperties:
|
|
|
444
438
|
return "commonjs";
|
|
445
439
|
if (tp.importScripts)
|
|
446
440
|
return "array-push";
|
|
447
|
-
throw new Error(
|
|
448
|
-
"JSONP Array push can be chosen when 'document' or 'importScripts' is available.\n" +
|
|
449
|
-
"CommonJs exports can be chosen when 'require' or node builtins are available.\n" +
|
|
450
|
-
helpMessage);
|
|
441
|
+
throw new Error(`For the selected environment is no default script chunk format available:\nJSONP Array push can be chosen when 'document' or 'importScripts' is available.\nCommonJs exports can be chosen when 'require' or node builtins are available.\n${helpMessage}`);
|
|
451
442
|
}
|
|
452
443
|
throw new Error("Chunk format can't be selected by default when no target is specified");
|
|
453
444
|
});
|
|
@@ -530,6 +521,7 @@ const applyOutputDefaults = (output, { context, outputModule, targetProperties:
|
|
|
530
521
|
return "self";
|
|
531
522
|
});
|
|
532
523
|
D(output, "importFunctionName", "import");
|
|
524
|
+
D(output, "importMetaName", "import.meta");
|
|
533
525
|
// IGNORE(output.clean): The default value of `output.clean` in webpack is undefined, but it has the same effect as false.
|
|
534
526
|
F(output, "clean", () => !!output.clean);
|
|
535
527
|
D(output, "crossOriginLoading", false);
|
|
@@ -595,8 +587,8 @@ const applyOutputDefaults = (output, { context, outputModule, targetProperties:
|
|
|
595
587
|
const environment = output.environment;
|
|
596
588
|
const optimistic = (v) => v || v === undefined;
|
|
597
589
|
const conditionallyOptimistic = (v, c) => (v === undefined && c) || v;
|
|
598
|
-
F(environment, "globalThis", () => tp
|
|
599
|
-
F(environment, "bigIntLiteral", () => tp
|
|
590
|
+
F(environment, "globalThis", () => tp?.globalThis);
|
|
591
|
+
F(environment, "bigIntLiteral", () => tp?.bigIntLiteral);
|
|
600
592
|
F(environment, "const", () => tp && optimistic(tp.const));
|
|
601
593
|
F(environment, "arrowFunction", () => tp && optimistic(tp.arrowFunction));
|
|
602
594
|
F(environment, "asyncFunction", () => tp && optimistic(tp.asyncFunction));
|
|
@@ -605,25 +597,19 @@ const applyOutputDefaults = (output, { context, outputModule, targetProperties:
|
|
|
605
597
|
F(environment, "optionalChaining", () => tp && optimistic(tp.optionalChaining));
|
|
606
598
|
F(environment, "nodePrefixForCoreModules", () => tp && optimistic(tp.nodePrefixForCoreModules));
|
|
607
599
|
F(environment, "templateLiteral", () => tp && optimistic(tp.templateLiteral));
|
|
608
|
-
F(environment, "dynamicImport", () => conditionallyOptimistic(tp
|
|
609
|
-
F(environment, "dynamicImportInWorker", () => conditionallyOptimistic(tp
|
|
610
|
-
F(environment, "module", () => conditionallyOptimistic(tp
|
|
600
|
+
F(environment, "dynamicImport", () => conditionallyOptimistic(tp?.dynamicImport, output.module));
|
|
601
|
+
F(environment, "dynamicImportInWorker", () => conditionallyOptimistic(tp?.dynamicImportInWorker, output.module));
|
|
602
|
+
F(environment, "module", () => conditionallyOptimistic(tp?.module, output.module));
|
|
611
603
|
F(environment, "document", () => tp && optimistic(tp.document));
|
|
612
604
|
};
|
|
613
605
|
const applyExternalsPresetsDefaults = (externalsPresets, { targetProperties }) => {
|
|
614
|
-
D(externalsPresets, "web", targetProperties
|
|
615
|
-
D(externalsPresets, "node", targetProperties
|
|
616
|
-
D(externalsPresets, "electron", targetProperties
|
|
617
|
-
D(externalsPresets, "electronMain", targetProperties &&
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
D(externalsPresets, "
|
|
621
|
-
targetProperties.electron &&
|
|
622
|
-
targetProperties.electronPreload);
|
|
623
|
-
D(externalsPresets, "electronRenderer", targetProperties &&
|
|
624
|
-
targetProperties.electron &&
|
|
625
|
-
targetProperties.electronRenderer);
|
|
626
|
-
D(externalsPresets, "nwjs", targetProperties && targetProperties.nwjs);
|
|
606
|
+
D(externalsPresets, "web", targetProperties?.web);
|
|
607
|
+
D(externalsPresets, "node", targetProperties?.node);
|
|
608
|
+
D(externalsPresets, "electron", targetProperties?.electron);
|
|
609
|
+
D(externalsPresets, "electronMain", targetProperties?.electron && targetProperties.electronMain);
|
|
610
|
+
D(externalsPresets, "electronPreload", targetProperties?.electron && targetProperties.electronPreload);
|
|
611
|
+
D(externalsPresets, "electronRenderer", targetProperties?.electron && targetProperties.electronRenderer);
|
|
612
|
+
D(externalsPresets, "nwjs", targetProperties?.nwjs);
|
|
627
613
|
};
|
|
628
614
|
const applyLoaderDefaults = (loader, { targetProperties, environment }) => {
|
|
629
615
|
F(loader, "target", () => {
|
|
@@ -652,19 +638,19 @@ const applyNodeDefaults = (node, { targetProperties }) => {
|
|
|
652
638
|
return;
|
|
653
639
|
// IGNORE(node.global): The default value of `global` is determined by `futureDefaults` in webpack.
|
|
654
640
|
F(node, "global", () => {
|
|
655
|
-
if (targetProperties
|
|
641
|
+
if (targetProperties?.global)
|
|
656
642
|
return false;
|
|
657
643
|
return "warn";
|
|
658
644
|
});
|
|
659
645
|
// IGNORE(node.__dirname): The default value of `__dirname` is determined by `futureDefaults` in webpack.
|
|
660
646
|
F(node, "__dirname", () => {
|
|
661
|
-
if (targetProperties
|
|
647
|
+
if (targetProperties?.node)
|
|
662
648
|
return "eval-only";
|
|
663
649
|
return "warn-mock";
|
|
664
650
|
});
|
|
665
651
|
// IGNORE(node.__filename): The default value of `__filename` is determined by `futureDefaults` in webpack.
|
|
666
652
|
F(node, "__filename", () => {
|
|
667
|
-
if (targetProperties
|
|
653
|
+
if (targetProperties?.node)
|
|
668
654
|
return "eval-only";
|
|
669
655
|
return "warn-mock";
|
|
670
656
|
});
|
|
@@ -775,7 +761,7 @@ const getResolveDefaults = ({ context, targetProperties, mode, css }) => {
|
|
|
775
761
|
}
|
|
776
762
|
const jsExtensions = [".js", ".json", ".wasm"];
|
|
777
763
|
const tp = targetProperties;
|
|
778
|
-
const browserField = tp
|
|
764
|
+
const browserField = tp?.web && (!tp.node || (tp.electron && tp.electronRenderer));
|
|
779
765
|
const aliasFields = browserField ? ["browser"] : [];
|
|
780
766
|
const mainFields = browserField
|
|
781
767
|
? ["browser", "module", "..."]
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
10
|
import type { Compilation } from "../Compilation";
|
|
11
|
-
import type { AssetModuleFilename, Bail, CacheOptions, ChunkFilename, ChunkLoading, ChunkLoadingGlobal, Clean, Context, CrossOriginLoading, CssChunkFilename, CssFilename, Dependencies, DevServer, DevTool, DevtoolFallbackModuleFilenameTemplate, DevtoolModuleFilenameTemplate, DevtoolNamespace, EnabledLibraryTypes, EnabledWasmLoadingTypes, EntryFilename, EntryRuntime, Environment, Externals, ExternalsPresets, ExternalsType, Filename, GeneratorOptionsByModuleType, GlobalObject, HashDigest, HashDigestLength, HashFunction, HashSalt, HotUpdateChunkFilename, HotUpdateGlobal, HotUpdateMainFilename, Iife, ImportFunctionName, InfrastructureLogging, LazyCompilationOptions, LibraryOptions, Loader, Mode, Name, NoParseOption, Node, Optimization, OutputModule, ParserOptionsByModuleType, Path, Performance, Plugins, Profile, PublicPath, Resolve, RspackFutureOptions, RspackOptions, RuleSetRules, ScriptType, SnapshotOptions, SourceMapFilename, StatsValue, StrictModuleErrorHandling, Target, TrustedTypes, UniqueName, WasmLoading, Watch, WatchOptions, WebassemblyModuleFilename, WorkerPublicPath } from "./zod";
|
|
11
|
+
import type { AssetModuleFilename, AsyncChunks, Bail, BaseUri, CacheOptions, ChunkFilename, ChunkLoading, ChunkLoadingGlobal, Clean, Context, CrossOriginLoading, CssChunkFilename, CssFilename, Dependencies, DevServer, DevTool, DevtoolFallbackModuleFilenameTemplate, DevtoolModuleFilenameTemplate, DevtoolNamespace, EnabledLibraryTypes, EnabledWasmLoadingTypes, EntryFilename, EntryRuntime, Environment, Externals, ExternalsPresets, ExternalsType, Filename, GeneratorOptionsByModuleType, GlobalObject, HashDigest, HashDigestLength, HashFunction, HashSalt, HotUpdateChunkFilename, HotUpdateGlobal, HotUpdateMainFilename, Iife, ImportFunctionName, ImportMetaName, InfrastructureLogging, Layer, LazyCompilationOptions, LibraryOptions, Loader, Mode, Name, NoParseOption, Node, Optimization, OutputModule, ParserOptionsByModuleType, Path, Performance, Plugins, Profile, PublicPath, Resolve, RspackFutureOptions, RspackOptions, RuleSetRules, ScriptType, SnapshotOptions, SourceMapFilename, StatsValue, StrictModuleErrorHandling, Target, TrustedTypes, UniqueName, WasmLoading, Watch, WatchOptions, WebassemblyModuleFilename, WorkerPublicPath } from "./zod";
|
|
12
12
|
export declare const getNormalizedRspackOptions: (config: RspackOptions) => RspackOptionsNormalized;
|
|
13
13
|
export type EntryDynamicNormalized = () => Promise<EntryStaticNormalized>;
|
|
14
14
|
export type EntryNormalized = EntryDynamicNormalized | EntryStaticNormalized;
|
|
@@ -19,12 +19,13 @@ export interface EntryDescriptionNormalized {
|
|
|
19
19
|
import?: string[];
|
|
20
20
|
runtime?: EntryRuntime;
|
|
21
21
|
chunkLoading?: ChunkLoading;
|
|
22
|
-
asyncChunks?:
|
|
22
|
+
asyncChunks?: AsyncChunks;
|
|
23
23
|
publicPath?: PublicPath;
|
|
24
|
-
baseUri?:
|
|
24
|
+
baseUri?: BaseUri;
|
|
25
25
|
filename?: EntryFilename;
|
|
26
26
|
library?: LibraryOptions;
|
|
27
27
|
dependOn?: string[];
|
|
28
|
+
layer?: Layer;
|
|
28
29
|
}
|
|
29
30
|
export interface OutputNormalized {
|
|
30
31
|
path?: Path;
|
|
@@ -48,6 +49,7 @@ export interface OutputNormalized {
|
|
|
48
49
|
strictModuleErrorHandling?: StrictModuleErrorHandling;
|
|
49
50
|
globalObject?: GlobalObject;
|
|
50
51
|
importFunctionName?: ImportFunctionName;
|
|
52
|
+
importMetaName?: ImportMetaName;
|
|
51
53
|
iife?: Iife;
|
|
52
54
|
wasmLoading?: WasmLoading;
|
|
53
55
|
enabledWasmLoadingTypes?: EnabledWasmLoadingTypes;
|
|
@@ -72,6 +74,7 @@ export interface OutputNormalized {
|
|
|
72
74
|
environment?: Environment;
|
|
73
75
|
charset?: boolean;
|
|
74
76
|
chunkLoadTimeout?: number;
|
|
77
|
+
cssHeadDataCompression?: boolean;
|
|
75
78
|
}
|
|
76
79
|
export interface ModuleOptionsNormalized {
|
|
77
80
|
defaultRules?: RuleSetRules;
|
|
@@ -86,6 +89,7 @@ export interface ExperimentsNormalized {
|
|
|
86
89
|
outputModule?: boolean;
|
|
87
90
|
topLevelAwait?: boolean;
|
|
88
91
|
css?: boolean;
|
|
92
|
+
layers?: boolean;
|
|
89
93
|
futureDefaults?: boolean;
|
|
90
94
|
rspackFuture?: RspackFutureOptions;
|
|
91
95
|
}
|
|
@@ -54,6 +54,7 @@ const getNormalizedRspackOptions = (config) => {
|
|
|
54
54
|
chunkLoading: output.chunkLoading,
|
|
55
55
|
chunkFilename: output.chunkFilename,
|
|
56
56
|
crossOriginLoading: output.crossOriginLoading,
|
|
57
|
+
cssHeadDataCompression: output.cssHeadDataCompression,
|
|
57
58
|
cssFilename: output.cssFilename,
|
|
58
59
|
cssChunkFilename: output.cssChunkFilename,
|
|
59
60
|
hotUpdateMainFilename: output.hotUpdateMainFilename,
|
|
@@ -75,6 +76,7 @@ const getNormalizedRspackOptions = (config) => {
|
|
|
75
76
|
: ["..."],
|
|
76
77
|
globalObject: output.globalObject,
|
|
77
78
|
importFunctionName: output.importFunctionName,
|
|
79
|
+
importMetaName: output.importMetaName,
|
|
78
80
|
iife: output.iife,
|
|
79
81
|
module: output.module,
|
|
80
82
|
sourceMapFilename: output.sourceMapFilename,
|
|
@@ -240,6 +242,7 @@ const getNormalizedEntryStatic = (entry) => {
|
|
|
240
242
|
asyncChunks: value.asyncChunks,
|
|
241
243
|
filename: value.filename,
|
|
242
244
|
library: value.library,
|
|
245
|
+
layer: value.layer,
|
|
243
246
|
dependOn: Array.isArray(value.dependOn)
|
|
244
247
|
? value.dependOn
|
|
245
248
|
: value.dependOn
|
|
@@ -280,8 +283,10 @@ const cloneObject = (value) => ({ ...value });
|
|
|
280
283
|
const keyedNestedConfig = (value, fn, customKeys) => {
|
|
281
284
|
const result = value === undefined
|
|
282
285
|
? {}
|
|
283
|
-
: Object.keys(value).reduce((obj, key) =>
|
|
284
|
-
obj
|
|
286
|
+
: Object.keys(value).reduce((obj, key) => {
|
|
287
|
+
obj[key] = (customKeys && key in customKeys ? customKeys[key] : fn)(value[key]);
|
|
288
|
+
return obj;
|
|
289
|
+
}, {});
|
|
285
290
|
if (customKeys) {
|
|
286
291
|
for (const key of Object.keys(customKeys)) {
|
|
287
292
|
if (!(key in result)) {
|