@rspack/core 1.0.0-alpha.3 → 1.0.0-alpha.4
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/compiled/browserslist/index.js +17 -17
- package/compiled/enhanced-resolve/index.js +107 -107
- package/compiled/graceful-fs/index.js +8 -8
- package/compiled/json-parse-even-better-errors/index.js +2 -2
- package/compiled/neo-async/index.js +2 -2
- package/compiled/watchpack/index.js +15 -15
- package/compiled/webpack-sources/index.js +76 -76
- package/compiled/zod/index.js +30 -30
- package/compiled/zod-validation-error/index.js +6 -6
- package/dist/Compilation.js +2 -3
- package/dist/ErrorHelpers.d.ts +16 -7
- package/dist/ErrorHelpers.js +34 -33
- package/dist/ExecuteModulePlugin.js +1 -1
- package/dist/Module.d.ts +1 -2
- package/dist/Module.js +2 -6
- package/dist/MultiCompiler.js +1 -1
- package/dist/ResolverFactory.d.ts +5 -1
- package/dist/ResolverFactory.js +7 -1
- package/dist/RuntimeGlobals.js +3 -3
- package/dist/Stats.js +4 -4
- package/dist/Template.js +2 -2
- package/dist/builtin-plugin/DefinePlugin.js +2 -2
- package/dist/builtin-plugin/EntryPlugin.js +1 -1
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +10 -2
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.js +7 -1
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +2 -2
- package/dist/builtin-plugin/WorkerPlugin.js +5 -1
- package/dist/builtin-plugin/base.js +1 -1
- package/dist/builtin-plugin/css-extract/loader.js +3 -3
- package/dist/config/adapter.d.ts +1 -1
- package/dist/config/adapter.js +20 -9
- package/dist/config/adapterRuleUse.js +1 -1
- package/dist/config/browserslistTargetHandler.js +1 -1
- package/dist/config/defaults.js +4 -3
- package/dist/config/zod.d.ts +110 -3
- package/dist/config/zod.js +42 -39
- package/dist/container/ModuleFederationPlugin.js +2 -2
- package/dist/loader-runner/index.js +6 -6
- package/dist/logging/runtime.js +1 -1
- package/dist/rspack.js +1 -1
- package/dist/sharing/ConsumeSharedPlugin.js +1 -1
- package/dist/stats/DefaultStatsFactoryPlugin.js +246 -46
- package/dist/stats/DefaultStatsPresetPlugin.js +17 -17
- package/dist/stats/DefaultStatsPrinterPlugin.js +1 -1
- package/dist/stats/statsFactoryUtils.d.ts +15 -0
- package/dist/util/identifier.d.ts +65 -62
- package/dist/util/identifier.js +30 -55
- package/package.json +6 -3
package/dist/config/adapter.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { RawLibraryOptions, RawOptions } from "@rspack/binding";
|
|
|
2
2
|
import type { Compiler } from "../Compiler";
|
|
3
3
|
import { type LoaderContext, type LoaderDefinition, type LoaderDefinitionFunction } from "./adapterRuleUse";
|
|
4
4
|
import type { RspackOptionsNormalized } from "./normalization";
|
|
5
|
-
import {
|
|
5
|
+
import type { ChunkLoading, LibraryOptions, Resolve } from "./zod";
|
|
6
6
|
export type { LoaderContext, LoaderDefinition, LoaderDefinitionFunction };
|
|
7
7
|
export declare const getRawOptions: (options: RspackOptionsNormalized, compiler: Compiler) => RawOptions;
|
|
8
8
|
export declare function getRawResolve(resolve: Resolve): RawOptions["resolve"];
|
package/dist/config/adapter.js
CHANGED
|
@@ -262,7 +262,7 @@ const getRawModuleRule = (rule, path, options, upperType) => {
|
|
|
262
262
|
}
|
|
263
263
|
let funcUse;
|
|
264
264
|
if (typeof rule.use === "function") {
|
|
265
|
-
|
|
265
|
+
const use = rule.use;
|
|
266
266
|
funcUse = (rawContext) => {
|
|
267
267
|
const context = {
|
|
268
268
|
...rawContext,
|
|
@@ -272,7 +272,7 @@ const getRawModuleRule = (rule, path, options, upperType) => {
|
|
|
272
272
|
return (0, adapterRuleUse_1.createRawModuleRuleUses)(uses ?? [], `${path}.use`, options);
|
|
273
273
|
};
|
|
274
274
|
}
|
|
275
|
-
|
|
275
|
+
const rawModuleRule = {
|
|
276
276
|
test: rule.test ? getRawRuleSetCondition(rule.test) : undefined,
|
|
277
277
|
include: rule.include ? getRawRuleSetCondition(rule.include) : undefined,
|
|
278
278
|
exclude: rule.exclude ? getRawRuleSetCondition(rule.exclude) : undefined,
|
|
@@ -392,10 +392,14 @@ function getRawRuleSetLogicalConditions(logical) {
|
|
|
392
392
|
};
|
|
393
393
|
}
|
|
394
394
|
function getRawParserOptionsByModuleType(parser) {
|
|
395
|
-
return Object.fromEntries(Object.entries(parser)
|
|
395
|
+
return Object.fromEntries(Object.entries(parser)
|
|
396
|
+
.map(([k, v]) => [k, getRawParserOptions(v, k)])
|
|
397
|
+
.filter(([k, v]) => v !== undefined));
|
|
396
398
|
}
|
|
397
399
|
function getRawGeneratorOptionsByModuleType(parser) {
|
|
398
|
-
return Object.fromEntries(Object.entries(parser)
|
|
400
|
+
return Object.fromEntries(Object.entries(parser)
|
|
401
|
+
.map(([k, v]) => [k, getRawGeneratorOptions(v, k)])
|
|
402
|
+
.filter(([k, v]) => v !== undefined));
|
|
399
403
|
}
|
|
400
404
|
function getRawParserOptions(parser, type) {
|
|
401
405
|
if (type === "asset") {
|
|
@@ -405,10 +409,8 @@ function getRawParserOptions(parser, type) {
|
|
|
405
409
|
};
|
|
406
410
|
}
|
|
407
411
|
else if (type === "javascript") {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
javascript: getRawJavascriptParserOptions(parser)
|
|
411
|
-
};
|
|
412
|
+
// Filter this out, since `parser["javascript"]` already merge into `parser["javascript/*"]` in default.ts
|
|
413
|
+
return;
|
|
412
414
|
}
|
|
413
415
|
else if (type === "javascript/auto") {
|
|
414
416
|
return {
|
|
@@ -470,7 +472,8 @@ function getRawJavascriptParserOptions(parser) {
|
|
|
470
472
|
? "false"
|
|
471
473
|
: parser.reexportExportsPresence,
|
|
472
474
|
strictExportPresence: parser.strictExportPresence ?? false,
|
|
473
|
-
worker: getRawJavascriptParserOptionsWorker(parser.worker)
|
|
475
|
+
worker: getRawJavascriptParserOptionsWorker(parser.worker),
|
|
476
|
+
overrideStrict: parser.overrideStrict
|
|
474
477
|
};
|
|
475
478
|
}
|
|
476
479
|
function getRawJavascriptParserOptionsWorker(worker) {
|
|
@@ -546,6 +549,14 @@ function getRawGeneratorOptions(generator, type) {
|
|
|
546
549
|
cssModule: getRawCssAutoOrModuleGeneratorOptions(generator)
|
|
547
550
|
};
|
|
548
551
|
}
|
|
552
|
+
if ([
|
|
553
|
+
"javascript",
|
|
554
|
+
"javascript/auto",
|
|
555
|
+
"javascript/dynamic",
|
|
556
|
+
"javascript/esm"
|
|
557
|
+
].includes(type)) {
|
|
558
|
+
return undefined;
|
|
559
|
+
}
|
|
549
560
|
throw new Error(`unreachable: unknow module type: ${type}`);
|
|
550
561
|
}
|
|
551
562
|
function getRawAssetGeneratorOptions(options) {
|
|
@@ -15,7 +15,7 @@ function createRawModuleRuleUses(uses, path, options) {
|
|
|
15
15
|
exports.createRawModuleRuleUses = createRawModuleRuleUses;
|
|
16
16
|
const getSwcLoaderOptions = (o, options) => {
|
|
17
17
|
if (o && typeof o === "object" && o.rspackExperiments) {
|
|
18
|
-
|
|
18
|
+
const expr = o.rspackExperiments;
|
|
19
19
|
if (expr.import || expr.pluginImport) {
|
|
20
20
|
expr.import = (0, builtin_loader_1.resolvePluginImport)(expr.import || expr.pluginImport);
|
|
21
21
|
}
|
|
@@ -83,7 +83,7 @@ const resolve = browsers => {
|
|
|
83
83
|
const [parsedMajor, parserMinor] =
|
|
84
84
|
// safari TP supports all features for normal safari
|
|
85
85
|
parsedVersion === "TP"
|
|
86
|
-
? [
|
|
86
|
+
? [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY]
|
|
87
87
|
: parsedVersion.includes("-")
|
|
88
88
|
? parsedVersion.split("-")[0].split(".")
|
|
89
89
|
: parsedVersion.split(".");
|
package/dist/config/defaults.js
CHANGED
|
@@ -30,7 +30,7 @@ const applyRspackOptionsDefaults = (options) => {
|
|
|
30
30
|
});
|
|
31
31
|
const { mode, target } = options;
|
|
32
32
|
(0, assert_1.default)(!(0, util_1.isNil)(target));
|
|
33
|
-
|
|
33
|
+
const targetProperties = target === false
|
|
34
34
|
? false
|
|
35
35
|
: typeof target === "string"
|
|
36
36
|
? (0, target_1.getTargetProperties)(target, options.context)
|
|
@@ -151,6 +151,7 @@ const applyJavascriptParserOptionsDefaults = (parserOptions, fallback) => {
|
|
|
151
151
|
D(parserOptions, "reexportExportsPresence", fallback?.reexportExportsPresence);
|
|
152
152
|
D(parserOptions, "strictExportPresence", fallback?.strictExportPresence ?? false);
|
|
153
153
|
D(parserOptions, "worker", fallback?.worker ?? ["..."]);
|
|
154
|
+
D(parserOptions, "overrideStrict", fallback?.overrideStrict ?? undefined);
|
|
154
155
|
};
|
|
155
156
|
const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties }) => {
|
|
156
157
|
(0, assertNotNil_1.assertNotNill)(module.parser);
|
|
@@ -726,8 +727,8 @@ const applyOptimizationDefaults = (optimization, { production, development, css
|
|
|
726
727
|
F(splitChunks, "minSize", () => (production ? 20000 : 10000));
|
|
727
728
|
// F(splitChunks, "minRemainingSize", () => (development ? 0 : undefined));
|
|
728
729
|
// F(splitChunks, "enforceSizeThreshold", () => (production ? 50000 : 30000));
|
|
729
|
-
F(splitChunks, "maxAsyncRequests", () =>
|
|
730
|
-
F(splitChunks, "maxInitialRequests", () =>
|
|
730
|
+
F(splitChunks, "maxAsyncRequests", () => production ? 30 : Number.POSITIVE_INFINITY);
|
|
731
|
+
F(splitChunks, "maxInitialRequests", () => production ? 30 : Number.POSITIVE_INFINITY);
|
|
731
732
|
D(splitChunks, "automaticNameDelimiter", "-");
|
|
732
733
|
const { cacheGroups } = splitChunks;
|
|
733
734
|
if (cacheGroups) {
|