@rspack/core 1.0.0-beta.3 → 1.0.0-beta.5
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/Compilation.d.ts +1 -7
- package/dist/Compilation.js +5 -13
- package/dist/DependenciesBlock.d.ts +8 -0
- package/dist/DependenciesBlock.js +30 -0
- package/dist/Dependency.d.ts +8 -0
- package/dist/Dependency.js +32 -0
- package/dist/Module.d.ts +6 -3
- package/dist/Module.js +13 -0
- package/dist/NormalModule.d.ts +2 -1
- package/dist/NormalModule.js +1 -1
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +4 -4
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +41 -10
- package/dist/builtin-plugin/HtmlRspackPlugin.js +16 -4
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +2 -2
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +1 -7
- package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +18 -11
- package/dist/builtin-plugin/css-extract/loader.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/loader.js +2 -10
- package/dist/builtin-plugin/index.d.ts +0 -1
- package/dist/builtin-plugin/index.js +0 -1
- package/dist/config/adapterRuleUse.d.ts +1 -0
- package/dist/config/adapterRuleUse.js +2 -6
- package/dist/config/defaults.js +22 -13
- package/dist/config/zod.d.ts +199 -79
- package/dist/config/zod.js +10 -5
- package/dist/container/ContainerReferencePlugin.d.ts +1 -1
- package/dist/exports.d.ts +0 -1
- package/dist/exports.js +7 -10
- package/dist/loader-runner/index.js +3 -3
- package/dist/node/NodeWatchFileSystem.d.ts +3 -3
- package/dist/node/NodeWatchFileSystem.js +6 -6
- package/dist/stats/DefaultStatsFactoryPlugin.d.ts +0 -10
- package/dist/stats/DefaultStatsFactoryPlugin.js +130 -90
- package/dist/stats/DefaultStatsPresetPlugin.js +16 -15
- package/dist/stats/StatsFactory.js +5 -6
- package/dist/stats/statsFactoryUtils.d.ts +14 -1
- package/dist/stats/statsFactoryUtils.js +62 -1
- package/dist/util/fs.d.ts +245 -22
- package/package.json +3 -3
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +0 -16
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.js +0 -12
package/dist/config/defaults.js
CHANGED
|
@@ -69,6 +69,8 @@ const applyRspackOptionsDefaults = (options) => {
|
|
|
69
69
|
entry: options.entry,
|
|
70
70
|
futureDefaults: options.experiments.futureDefaults
|
|
71
71
|
});
|
|
72
|
+
// bundlerInfo is affected by outputDefaults so must be executed after outputDefaults
|
|
73
|
+
applybundlerInfoDefaults(options.experiments.rspackFuture, options.output.library);
|
|
72
74
|
applyExternalsPresetsDefaults(options.externalsPresets, {
|
|
73
75
|
targetProperties
|
|
74
76
|
});
|
|
@@ -77,10 +79,13 @@ const applyRspackOptionsDefaults = (options) => {
|
|
|
77
79
|
return options.output.library
|
|
78
80
|
? options.output.library.type
|
|
79
81
|
: options.output.module
|
|
80
|
-
? "module"
|
|
82
|
+
? "module-import"
|
|
81
83
|
: "var";
|
|
82
84
|
});
|
|
83
|
-
applyNodeDefaults(options.node, {
|
|
85
|
+
applyNodeDefaults(options.node, {
|
|
86
|
+
targetProperties,
|
|
87
|
+
outputModule: options.output.module
|
|
88
|
+
});
|
|
84
89
|
applyLoaderDefaults(options.loader, {
|
|
85
90
|
targetProperties,
|
|
86
91
|
environment: options.output.environment
|
|
@@ -130,12 +135,16 @@ const applyExperimentsDefaults = (experiments) => {
|
|
|
130
135
|
D(experiments, "topLevelAwait", true);
|
|
131
136
|
// IGNORE(experiments.rspackFuture): Rspack specific configuration
|
|
132
137
|
D(experiments, "rspackFuture", {});
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
// rspackFuture.bundlerInfo default value is applied after applyDefaults
|
|
139
|
+
};
|
|
140
|
+
const applybundlerInfoDefaults = (rspackFuture, library) => {
|
|
141
|
+
if (typeof rspackFuture === "object") {
|
|
142
|
+
D(rspackFuture, "bundlerInfo", {});
|
|
143
|
+
if (typeof rspackFuture.bundlerInfo === "object") {
|
|
144
|
+
D(rspackFuture.bundlerInfo, "version", require("../../package.json").version);
|
|
145
|
+
D(rspackFuture.bundlerInfo, "bundler", "rspack");
|
|
146
|
+
// don't inject for library mode
|
|
147
|
+
D(rspackFuture.bundlerInfo, "force", !library);
|
|
139
148
|
}
|
|
140
149
|
}
|
|
141
150
|
};
|
|
@@ -633,7 +642,7 @@ const applyLoaderDefaults = (loader, { targetProperties, environment }) => {
|
|
|
633
642
|
});
|
|
634
643
|
D(loader, "environment", environment);
|
|
635
644
|
};
|
|
636
|
-
const applyNodeDefaults = (node, { targetProperties }) => {
|
|
645
|
+
const applyNodeDefaults = (node, { outputModule, targetProperties }) => {
|
|
637
646
|
if (node === false)
|
|
638
647
|
return;
|
|
639
648
|
// IGNORE(node.global): The default value of `global` is determined by `futureDefaults` in webpack.
|
|
@@ -645,13 +654,13 @@ const applyNodeDefaults = (node, { targetProperties }) => {
|
|
|
645
654
|
// IGNORE(node.__dirname): The default value of `__dirname` is determined by `futureDefaults` in webpack.
|
|
646
655
|
F(node, "__dirname", () => {
|
|
647
656
|
if (targetProperties?.node)
|
|
648
|
-
return "eval-only";
|
|
657
|
+
return outputModule ? "node-module" : "eval-only";
|
|
649
658
|
return "warn-mock";
|
|
650
659
|
});
|
|
651
660
|
// IGNORE(node.__filename): The default value of `__filename` is determined by `futureDefaults` in webpack.
|
|
652
661
|
F(node, "__filename", () => {
|
|
653
662
|
if (targetProperties?.node)
|
|
654
|
-
return "eval-only";
|
|
663
|
+
return outputModule ? "node-module" : "eval-only";
|
|
655
664
|
return "warn-mock";
|
|
656
665
|
});
|
|
657
666
|
};
|
|
@@ -689,7 +698,7 @@ const applyOptimizationDefaults = (optimization, { production, development, css
|
|
|
689
698
|
D(optimization, "realContentHash", production);
|
|
690
699
|
D(optimization, "minimize", production);
|
|
691
700
|
D(optimization, "concatenateModules", production);
|
|
692
|
-
// IGNORE(optimization.minimizer): Rspack use `SwcJsMinimizerRspackPlugin` and `
|
|
701
|
+
// IGNORE(optimization.minimizer): Rspack use `SwcJsMinimizerRspackPlugin` and `LightningCssMinimizerRspackPlugin` by default
|
|
693
702
|
A(optimization, "minimizer", () => [
|
|
694
703
|
new builtin_plugin_1.SwcJsMinimizerRspackPlugin(),
|
|
695
704
|
new builtin_plugin_1.LightningCssMinimizerRspackPlugin()
|
|
@@ -707,7 +716,7 @@ const applyOptimizationDefaults = (optimization, { production, development, css
|
|
|
707
716
|
A(splitChunks, "defaultSizeTypes", () => css ? ["javascript", "css", "unknown"] : ["javascript", "unknown"]);
|
|
708
717
|
D(splitChunks, "hidePathInfo", production);
|
|
709
718
|
D(splitChunks, "chunks", "async");
|
|
710
|
-
|
|
719
|
+
D(splitChunks, "usedExports", optimization.usedExports === true);
|
|
711
720
|
D(splitChunks, "minChunks", 1);
|
|
712
721
|
F(splitChunks, "minSize", () => (production ? 20000 : 10000));
|
|
713
722
|
// F(splitChunks, "minRemainingSize", () => (development ? 0 : undefined));
|