@rspack/core 0.7.4-canary-8ea6579-20240613100825 → 0.7.4-canary-de24e64-20240614130907
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
# @rspack/core
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
The fast Rust-based web bundler with webpack-compatible API.
|
|
9
9
|
|
|
10
10
|
## Documentation
|
|
11
11
|
|
|
12
|
-
See
|
|
12
|
+
See <https://rspack.dev> for details.
|
|
13
13
|
|
|
14
14
|
## License
|
|
15
15
|
|
package/dist/config/defaults.js
CHANGED
|
@@ -43,11 +43,15 @@ const applyRspackOptionsDefaults = (options) => {
|
|
|
43
43
|
F(options.entry[key], "import", () => ["./src"]);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
+
// IGNORE(devtool): devtool is default to "eval" in webpack when mode is development
|
|
46
47
|
F(options, "devtool", () => false);
|
|
47
48
|
D(options, "watch", false);
|
|
48
49
|
D(options, "profile", false);
|
|
50
|
+
// IGNORE(bail): bail is default to false in webpack, but it's set in `Compilation`
|
|
49
51
|
D(options, "bail", false);
|
|
50
52
|
const futureDefaults = options.experiments.futureDefaults ?? false;
|
|
53
|
+
// IGNORE(cache): cache is default to { type: "memory" } in webpack when the mode is development,
|
|
54
|
+
// but Rspack currently does not support this option
|
|
51
55
|
F(options, "cache", () => development);
|
|
52
56
|
applyExperimentsDefaults(options.experiments, {
|
|
53
57
|
cache: options.cache
|
|
@@ -122,10 +126,14 @@ const applyInfrastructureLoggingDefaults = (infrastructureLogging) => {
|
|
|
122
126
|
D(infrastructureLogging, "appendOnly", !tty);
|
|
123
127
|
};
|
|
124
128
|
const applyExperimentsDefaults = (experiments, { cache }) => {
|
|
129
|
+
// IGNORE(experiments.lazyCompilation): In webpack, lazyCompilation is undefined by default
|
|
125
130
|
D(experiments, "lazyCompilation", false);
|
|
131
|
+
// IGNORE(experiments.asyncWebAssembly): The default value of `asyncWebAssembly` is determined by `futureDefaults` in webpack.
|
|
126
132
|
D(experiments, "asyncWebAssembly", false);
|
|
127
|
-
|
|
133
|
+
// IGNORE(experiments.css): Rspack will switch to `false` when reach 1.0 and `css-extract` is stable enough
|
|
134
|
+
D(experiments, "css", true);
|
|
128
135
|
D(experiments, "topLevelAwait", true);
|
|
136
|
+
// IGNORE(experiments.rspackFuture): Rspack specific configuration
|
|
129
137
|
D(experiments, "rspackFuture", {});
|
|
130
138
|
if (typeof experiments.rspackFuture === "object") {
|
|
131
139
|
D(experiments.rspackFuture, "bundlerInfo", {});
|
|
@@ -169,6 +177,8 @@ const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties }
|
|
|
169
177
|
F(module.parser, "javascript/esm", () => ({}));
|
|
170
178
|
(0, assertNotNil_1.assertNotNill)(module.parser["javascript/esm"]);
|
|
171
179
|
applyJavascriptParserOptionsDefaults(module.parser["javascript/esm"], module.parser.javascript);
|
|
180
|
+
// IGNORE(module.generator): Rspack enables `experiments.css` by default currently
|
|
181
|
+
// IGNORE(module.parser): Rspack enables `experiments.css` by default currently
|
|
172
182
|
if (css) {
|
|
173
183
|
F(module.parser, "css", () => ({}));
|
|
174
184
|
(0, assertNotNil_1.assertNotNill)(module.parser.css);
|
|
@@ -196,6 +206,8 @@ const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties }
|
|
|
196
206
|
D(module.generator["css/module"], "localIdentName", "[uniqueName]-[id]-[local]");
|
|
197
207
|
D(module.generator["css/module"], "esModule", true);
|
|
198
208
|
}
|
|
209
|
+
// IGNORE(module.defaultRules): Rspack does not support `rule.assert`
|
|
210
|
+
// https://github.com/webpack/webpack/blob/main/lib/config/defaults.js#L839
|
|
199
211
|
A(module, "defaultRules", () => {
|
|
200
212
|
const esm = {
|
|
201
213
|
type: "javascript/esm",
|
|
@@ -307,7 +319,16 @@ const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties }
|
|
|
307
319
|
type: "asset/resource"
|
|
308
320
|
}
|
|
309
321
|
]
|
|
310
|
-
}
|
|
322
|
+
}
|
|
323
|
+
// {
|
|
324
|
+
// assert: { type: "json" },
|
|
325
|
+
// type: "json"
|
|
326
|
+
// },
|
|
327
|
+
// {
|
|
328
|
+
// with: { type: "json" },
|
|
329
|
+
// type: "json"
|
|
330
|
+
// }
|
|
331
|
+
);
|
|
311
332
|
return rules;
|
|
312
333
|
});
|
|
313
334
|
};
|
|
@@ -515,9 +536,11 @@ const applyOutputDefaults = (output, { context, outputModule, targetProperties:
|
|
|
515
536
|
return "self";
|
|
516
537
|
});
|
|
517
538
|
D(output, "importFunctionName", "import");
|
|
539
|
+
// IGNORE(output.clean): The default value of `output.clean` in webpack is undefined, but it has the same effect as false.
|
|
518
540
|
F(output, "clean", () => !!output.clean);
|
|
519
541
|
D(output, "crossOriginLoading", false);
|
|
520
542
|
D(output, "workerPublicPath", "");
|
|
543
|
+
// IGNORE(output.sourceMapFilename): In webpack, sourceMapFilename is [file].map[query] by default
|
|
521
544
|
F(output, "sourceMapFilename", () => {
|
|
522
545
|
return "[file].map";
|
|
523
546
|
});
|
|
@@ -633,16 +656,19 @@ const applyLoaderDefaults = (loader, { targetProperties, environment }) => {
|
|
|
633
656
|
const applyNodeDefaults = (node, { targetProperties }) => {
|
|
634
657
|
if (node === false)
|
|
635
658
|
return;
|
|
659
|
+
// IGNORE(node.global): The default value of `global` is determined by `futureDefaults` in webpack.
|
|
636
660
|
F(node, "global", () => {
|
|
637
661
|
if (targetProperties && targetProperties.global)
|
|
638
662
|
return false;
|
|
639
663
|
return "warn";
|
|
640
664
|
});
|
|
665
|
+
// IGNORE(node.__dirname): The default value of `__dirname` is determined by `futureDefaults` in webpack.
|
|
641
666
|
F(node, "__dirname", () => {
|
|
642
667
|
if (targetProperties && targetProperties.node)
|
|
643
668
|
return "eval-only";
|
|
644
669
|
return "warn-mock";
|
|
645
670
|
});
|
|
671
|
+
// IGNORE(node.__filename): The default value of `__filename` is determined by `futureDefaults` in webpack.
|
|
646
672
|
F(node, "__filename", () => {
|
|
647
673
|
if (targetProperties && targetProperties.node)
|
|
648
674
|
return "eval-only";
|
|
@@ -657,23 +683,24 @@ const applyPerformanceDefaults = (performance, { production }) => {
|
|
|
657
683
|
F(performance, "hints", () => (production ? "warning" : false));
|
|
658
684
|
};
|
|
659
685
|
const applyOptimizationDefaults = (optimization, { production, development, css }) => {
|
|
686
|
+
// IGNORE(optimization.removeAvailableModules): In webpack, removeAvailableModules is false by default
|
|
660
687
|
D(optimization, "removeAvailableModules", true);
|
|
661
688
|
D(optimization, "removeEmptyChunks", true);
|
|
662
689
|
D(optimization, "mergeDuplicateChunks", true);
|
|
690
|
+
// IGNORE(optimization.moduleIds): set to "natural" by default in rspack 1.0
|
|
663
691
|
F(optimization, "moduleIds", () => {
|
|
664
692
|
if (production)
|
|
665
693
|
return "deterministic";
|
|
666
694
|
if (development)
|
|
667
695
|
return "named";
|
|
668
|
-
// TODO(rspack@1.0): change to `"natural"`
|
|
669
696
|
return "named";
|
|
670
697
|
});
|
|
698
|
+
// IGNORE(optimization.chunkIds): set to "natural" by default in rspack 1.0
|
|
671
699
|
F(optimization, "chunkIds", () => {
|
|
672
700
|
if (production)
|
|
673
701
|
return "deterministic";
|
|
674
702
|
if (development)
|
|
675
703
|
return "named";
|
|
676
|
-
// TODO(rspack@1.0): change to `"natural"`
|
|
677
704
|
return "named";
|
|
678
705
|
});
|
|
679
706
|
F(optimization, "sideEffects", () => (production ? true : "flag"));
|
|
@@ -684,7 +711,10 @@ const applyOptimizationDefaults = (optimization, { production, development, css
|
|
|
684
711
|
D(optimization, "runtimeChunk", false);
|
|
685
712
|
D(optimization, "realContentHash", production);
|
|
686
713
|
D(optimization, "minimize", production);
|
|
714
|
+
// IGNORE(optimization.concatenateModules): webpack sets this option as true by default when the mode is production,
|
|
715
|
+
// but rspack is in the experimental stage and sets it to false by default
|
|
687
716
|
D(optimization, "concatenateModules", false);
|
|
717
|
+
// IGNORE(optimization.minimizer): Rspack use `SwcJsMinimizerRspackPlugin` and `SwcCssMinimizerRspackPlugin` by default
|
|
688
718
|
A(optimization, "minimizer", () => [
|
|
689
719
|
new SwcJsMinimizerPlugin_1.SwcJsMinimizerRspackPlugin(),
|
|
690
720
|
new SwcCssMinimizerPlugin_1.SwcCssMinimizerRspackPlugin()
|
|
@@ -698,6 +728,7 @@ const applyOptimizationDefaults = (optimization, { production, development, css
|
|
|
698
728
|
});
|
|
699
729
|
const { splitChunks } = optimization;
|
|
700
730
|
if (splitChunks) {
|
|
731
|
+
// IGNORE(optimization.splitChunks.defaultSizeTypes): Rspack enables `experiments.css` by default currently
|
|
701
732
|
A(splitChunks, "defaultSizeTypes", () => css ? ["javascript", "css", "unknown"] : ["javascript", "unknown"]);
|
|
702
733
|
D(splitChunks, "hidePathInfo", production);
|
|
703
734
|
D(splitChunks, "chunks", "async");
|
|
@@ -805,6 +836,7 @@ const getResolveDefaults = ({ context, targetProperties, mode, css }) => {
|
|
|
805
836
|
styleConditions.push("webpack");
|
|
806
837
|
styleConditions.push(mode === "development" ? "development" : "production");
|
|
807
838
|
styleConditions.push("style");
|
|
839
|
+
// IGNORE(resolve.byDependency.css-import): Rspack enables `experiments.css` by default currently
|
|
808
840
|
resolveOptions.byDependency["css-import"] = {
|
|
809
841
|
// We avoid using any main files because we have to be consistent with CSS `@import`
|
|
810
842
|
// and CSS `@import` does not handle `main` files in directories,
|
|
@@ -278,7 +278,6 @@ const SORTERS = {
|
|
|
278
278
|
comparators.push((0, comparators_1.compareSelect)((c) => c.id, compareIds));
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
// not support compilation.modules / chunk.rootModules / chunk.modules / module.modules (missing Module.moduleGraph)
|
|
282
281
|
// "compilation.modules": MODULES_SORTER,
|
|
283
282
|
// "chunk.rootModules": MODULES_SORTER,
|
|
284
283
|
// "chunk.modules": MODULES_SORTER,
|
|
@@ -574,6 +573,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
574
573
|
object.type = module.type;
|
|
575
574
|
object.moduleType = module.moduleType;
|
|
576
575
|
object.size = module.size;
|
|
576
|
+
object.sizes = Object.fromEntries(module.sizes.map(({ sourceType, size }) => [sourceType, size]));
|
|
577
577
|
Object.assign(object, factory.create(`${type}$visible`, module, context));
|
|
578
578
|
}
|
|
579
579
|
},
|
|
@@ -587,6 +587,16 @@ const SIMPLE_EXTRACTORS = {
|
|
|
587
587
|
object.issuerName = module.issuerName;
|
|
588
588
|
object.issuerPath = factory.create(`${type.slice(0, -8)}.issuerPath`, module.issuerPath, context);
|
|
589
589
|
object.orphan = module.orphan;
|
|
590
|
+
object.preOrderIndex = module.preOrderIndex;
|
|
591
|
+
object.postOrderIndex = module.postOrderIndex;
|
|
592
|
+
object.cacheable = module.cacheable;
|
|
593
|
+
object.built = module.built;
|
|
594
|
+
object.codeGenerated = module.codeGenerated;
|
|
595
|
+
object.cached = module.cached;
|
|
596
|
+
object.optional = module.optional;
|
|
597
|
+
object.failed = module.failed;
|
|
598
|
+
object.errors = module.errors;
|
|
599
|
+
object.warnings = module.warnings;
|
|
590
600
|
const profile = module.profile;
|
|
591
601
|
if (profile) {
|
|
592
602
|
object.profile = factory.create(`${type}.profile`, profile, context);
|
|
@@ -8,11 +8,12 @@ export type StatsChunkGroup = binding.JsStatsChunkGroup & Record<string, any>;
|
|
|
8
8
|
export type KnownStatsAsset = binding.JsStatsAsset;
|
|
9
9
|
export type StatsAsset = KnownStatsAsset & Record<string, any>;
|
|
10
10
|
export type StatsChunk = KnownStatsChunk & Record<string, any>;
|
|
11
|
-
export type KnownStatsModule = Omit<binding.JsStatsModule, "usedExports" | "providedExports" | "optimizationBailout"> & {
|
|
11
|
+
export type KnownStatsModule = Omit<binding.JsStatsModule, "usedExports" | "providedExports" | "optimizationBailout" | "sizes"> & {
|
|
12
12
|
profile?: StatsProfile;
|
|
13
13
|
usedExports?: null | string[] | boolean;
|
|
14
14
|
providedExports?: null | string[];
|
|
15
15
|
optimizationBailout?: null | string[];
|
|
16
|
+
sizes: Record<string, number>;
|
|
16
17
|
};
|
|
17
18
|
export type StatsProfile = KnownStatsProfile & Record<string, any>;
|
|
18
19
|
export type KnownStatsProfile = {
|
|
@@ -117,7 +118,7 @@ export declare const assetGroup: (children: StatsAsset[]) => {
|
|
|
117
118
|
};
|
|
118
119
|
export declare const moduleGroup: (children: KnownStatsModule[]) => {
|
|
119
120
|
size: number;
|
|
120
|
-
sizes:
|
|
121
|
+
sizes: Record<string, number>;
|
|
121
122
|
};
|
|
122
123
|
export declare const mergeToObject: (items: {
|
|
123
124
|
[key: string]: any;
|
|
@@ -257,9 +257,9 @@ const moduleGroup = (children) => {
|
|
|
257
257
|
const sizes = {};
|
|
258
258
|
for (const module of children) {
|
|
259
259
|
size += module.size;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
for (const key of Object.keys(module.sizes)) {
|
|
261
|
+
sizes[key] = (sizes[key] || 0) + module.sizes[key];
|
|
262
|
+
}
|
|
263
263
|
}
|
|
264
264
|
return {
|
|
265
265
|
size,
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "0.7.4-canary-
|
|
3
|
+
"version": "0.7.4-canary-de24e64-20240614130907",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
@@ -74,15 +74,15 @@
|
|
|
74
74
|
"watchpack": "^2.4.0",
|
|
75
75
|
"zod": "^3.21.4",
|
|
76
76
|
"zod-validation-error": "1.3.1",
|
|
77
|
-
"@rspack/
|
|
78
|
-
"@rspack/
|
|
77
|
+
"@rspack/plugin-minify": "^0.7.4-canary-de24e64-20240614130907",
|
|
78
|
+
"@rspack/core": "0.7.4-canary-de24e64-20240614130907"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@module-federation/runtime-tools": "0.1.6",
|
|
82
82
|
"caniuse-lite": "^1.0.30001616",
|
|
83
83
|
"tapable": "2.2.1",
|
|
84
84
|
"webpack-sources": "3.2.3",
|
|
85
|
-
"@rspack/binding": "0.7.4-canary-
|
|
85
|
+
"@rspack/binding": "0.7.4-canary-de24e64-20240614130907"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"@swc/helpers": ">=0.5.1"
|