@rspack/core 1.0.0-alpha.3 → 1.0.0-alpha.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/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/FileSystem.js +6 -6
- package/dist/Module.d.ts +1 -2
- package/dist/Module.js +2 -6
- package/dist/MultiCompiler.js +1 -1
- package/dist/NormalModule.js +6 -6
- 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/Watching.js +2 -2
- package/dist/builtin-plugin/DefinePlugin.js +2 -2
- package/dist/builtin-plugin/EntryPlugin.js +1 -1
- package/dist/builtin-plugin/SplitChunksPlugin.js +2 -2
- 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 +5 -5
- package/dist/builtin-plugin/css-extract/utils.js +3 -3
- package/dist/builtin-plugin/lazy-compilation/backend.d.ts +3 -3
- package/dist/builtin-plugin/lazy-compilation/backend.js +1 -1
- package/dist/config/adapter.d.ts +1 -1
- package/dist/config/adapter.js +27 -16
- package/dist/config/adapterRuleUse.js +1 -1
- package/dist/config/browserslistTargetHandler.js +2 -2
- package/dist/config/defaults.js +11 -10
- package/dist/config/zod.d.ts +119 -12
- package/dist/config/zod.js +43 -40
- package/dist/container/ModuleFederationPlugin.js +2 -2
- package/dist/lib/EntryOptionPlugin.js +2 -2
- package/dist/lib/WebpackError.js +1 -1
- package/dist/loader-runner/index.js +22 -22
- package/dist/loader-runner/loadLoader.js +1 -1
- package/dist/logging/runtime.js +1 -1
- package/dist/node/NodeWatchFileSystem.js +5 -5
- package/dist/node/nodeConsole.js +1 -1
- package/dist/rspack.js +6 -6
- package/dist/rspackOptionsApply.js +3 -3
- package/dist/sharing/ConsumeSharedPlugin.js +1 -1
- package/dist/stats/DefaultStatsFactoryPlugin.js +285 -50
- package/dist/stats/DefaultStatsPresetPlugin.js +17 -17
- package/dist/stats/DefaultStatsPrinterPlugin.js +2 -2
- package/dist/stats/statsFactoryUtils.d.ts +24 -10
- package/dist/util/bindingVersionCheck.js +6 -6
- package/dist/util/createHash.js +2 -2
- package/dist/util/fs.js +11 -11
- package/dist/util/identifier.d.ts +65 -62
- package/dist/util/identifier.js +30 -55
- package/package.json +6 -3
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SplitChunksPlugin = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
8
8
|
const binding_1 = require("@rspack/binding");
|
|
9
9
|
const Chunk_1 = require("../Chunk");
|
|
10
10
|
const Module_1 = require("../Module");
|
|
@@ -19,7 +19,7 @@ class SplitChunksPlugin extends base_1.RspackBuiltinPlugin {
|
|
|
19
19
|
}
|
|
20
20
|
raw(compiler) {
|
|
21
21
|
const rawOptions = toRawSplitChunksOptions(this.options, compiler);
|
|
22
|
-
(0,
|
|
22
|
+
(0, node_assert_1.default)(typeof rawOptions !== "undefined");
|
|
23
23
|
return (0, base_1.createBuiltinPlugin)(this.name, rawOptions);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
type MinifyCondition = string | RegExp;
|
|
3
|
+
type MinifyConditions = MinifyCondition | MinifyCondition[];
|
|
4
|
+
export type SwcCssMinimizerRspackPluginOptions = {
|
|
5
|
+
test?: MinifyConditions;
|
|
6
|
+
exclude?: MinifyConditions;
|
|
7
|
+
include?: MinifyConditions;
|
|
8
|
+
};
|
|
2
9
|
export declare const SwcCssMinimizerRspackPlugin: {
|
|
3
|
-
new (options?:
|
|
10
|
+
new (options?: SwcCssMinimizerRspackPluginOptions | undefined): {
|
|
4
11
|
name: BuiltinPluginName;
|
|
5
|
-
_args: [options?:
|
|
12
|
+
_args: [options?: SwcCssMinimizerRspackPluginOptions | undefined];
|
|
6
13
|
affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
7
14
|
raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
8
15
|
apply(compiler: import("../Compiler").Compiler): void;
|
|
9
16
|
};
|
|
10
17
|
};
|
|
18
|
+
export {};
|
|
@@ -3,4 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SwcCssMinimizerRspackPlugin = void 0;
|
|
4
4
|
const binding_1 = require("@rspack/binding");
|
|
5
5
|
const base_1 = require("./base");
|
|
6
|
-
exports.SwcCssMinimizerRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.SwcCssMinimizerRspackPlugin, (options
|
|
6
|
+
exports.SwcCssMinimizerRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.SwcCssMinimizerRspackPlugin, (options) => {
|
|
7
|
+
return {
|
|
8
|
+
test: options?.test,
|
|
9
|
+
include: options?.include,
|
|
10
|
+
exclude: options?.exclude
|
|
11
|
+
};
|
|
12
|
+
});
|
|
@@ -56,8 +56,8 @@ function getRawExtractCommentsOptions(extractComments) {
|
|
|
56
56
|
}
|
|
57
57
|
exports.SwcJsMinimizerRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.SwcJsMinimizerRspackPlugin, (options) => {
|
|
58
58
|
let compress = options?.compress ?? true;
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const mangle = options?.mangle ?? true;
|
|
60
|
+
const format = {
|
|
61
61
|
comments: false,
|
|
62
62
|
...options?.format
|
|
63
63
|
};
|
|
@@ -6,7 +6,11 @@ const EnableChunkLoadingPlugin_1 = require("./EnableChunkLoadingPlugin");
|
|
|
6
6
|
const EnableWasmLoadingPlugin_1 = require("./EnableWasmLoadingPlugin");
|
|
7
7
|
const base_1 = require("./base");
|
|
8
8
|
class WorkerPlugin extends base_1.RspackBuiltinPlugin {
|
|
9
|
-
constructor(chunkLoading, wasmLoading,
|
|
9
|
+
constructor(chunkLoading, wasmLoading,
|
|
10
|
+
// @ts-expect-error not implemented
|
|
11
|
+
module,
|
|
12
|
+
// @ts-expect-error not implemented
|
|
13
|
+
workerPublicPath) {
|
|
10
14
|
super();
|
|
11
15
|
this.chunkLoading = chunkLoading;
|
|
12
16
|
this.wasmLoading = wasmLoading;
|
|
@@ -22,7 +22,7 @@ function canInherentFromParent(affectedHooks) {
|
|
|
22
22
|
exports.canInherentFromParent = canInherentFromParent;
|
|
23
23
|
class RspackBuiltinPlugin {
|
|
24
24
|
apply(compiler) {
|
|
25
|
-
|
|
25
|
+
const raw = this.raw(compiler);
|
|
26
26
|
if (raw) {
|
|
27
27
|
raw.canInherentFromParent = canInherentFromParent(this.affectedHooks);
|
|
28
28
|
compiler.__internal__registerBuiltinPlugin(raw);
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.pitch = exports.SINGLE_DOT_PATH_SEGMENT = exports.BASE_URI = exports.ABSOLUTE_PUBLIC_PATH = exports.AUTO_PUBLIC_PATH = exports.MODULE_TYPE = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const index_1 = require("./index");
|
|
9
9
|
const loader_options_json_1 = __importDefault(require("./loader-options.json"));
|
|
10
10
|
const utils_1 = require("./utils");
|
|
@@ -21,7 +21,7 @@ function hotLoader(content, context) {
|
|
|
21
21
|
return `${content}
|
|
22
22
|
if(module.hot) {
|
|
23
23
|
// ${Date.now()}
|
|
24
|
-
var cssReload = require(${(0, utils_1.stringifyRequest)(context.loaderContext,
|
|
24
|
+
var cssReload = require(${(0, utils_1.stringifyRequest)(context.loaderContext, node_path_1.default.join(__dirname, "./hmr/hotModuleReplacement.js"))})(module.id, ${JSON.stringify({
|
|
25
25
|
...context.options,
|
|
26
26
|
locals: !!context.locals
|
|
27
27
|
})});
|
|
@@ -53,7 +53,7 @@ const pitch = function (request, _, data) {
|
|
|
53
53
|
this._module.type === "css/auto" ||
|
|
54
54
|
this._module.type === "css/global" ||
|
|
55
55
|
this._module.type === "css/module")) {
|
|
56
|
-
|
|
56
|
+
const e = new Error(`use type 'css' and \`CssExtractRspackPlugin\` together, please set \`experiments.css\` to \`false\` or set \`{ type: "javascript/auto" }\` for rules with \`CssExtractRspackPlugin\` in your rspack config (now \`CssExtractRspackPlugin\` does nothing).`);
|
|
57
57
|
e.stack = undefined;
|
|
58
58
|
this.emitWarning(e);
|
|
59
59
|
return;
|
|
@@ -117,8 +117,8 @@ const pitch = function (request, _, data) {
|
|
|
117
117
|
const identifierCountMap = new Map();
|
|
118
118
|
dependencies = exports
|
|
119
119
|
.map(([id, content, media, sourceMap, supports, layer]) => {
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
const identifier = id;
|
|
121
|
+
const context = this.rootContext;
|
|
122
122
|
const count = identifierCountMap.get(identifier) || 0;
|
|
123
123
|
identifierCountMap.set(identifier, count + 1);
|
|
124
124
|
return {
|
|
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.stringifyLocal = exports.stringifyRequest = exports.isRelativePath = exports.isAbsolutePath = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
function isAbsolutePath(str) {
|
|
9
|
-
return
|
|
9
|
+
return node_path_1.default.posix.isAbsolute(str) || node_path_1.default.win32.isAbsolute(str);
|
|
10
10
|
}
|
|
11
11
|
exports.isAbsolutePath = isAbsolutePath;
|
|
12
12
|
const RELATIVE_PATH_REGEXP = /^\.\.?[/\\]/;
|
|
@@ -28,7 +28,7 @@ function stringifyRequest(loaderContext, request) {
|
|
|
28
28
|
const query = splittedPart ? splittedPart[2] : "";
|
|
29
29
|
let singlePath = splittedPart ? splittedPart[1] : part;
|
|
30
30
|
if (isAbsolutePath(singlePath) && context) {
|
|
31
|
-
singlePath =
|
|
31
|
+
singlePath = node_path_1.default.relative(context, singlePath);
|
|
32
32
|
if (isAbsolutePath(singlePath)) {
|
|
33
33
|
// If singlePath still matches an absolute path, singlePath was on a different drive than context.
|
|
34
34
|
// In this case, we leave the path platform-specific without replacing any separators.
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
/// <reference types="node" />
|
|
5
|
-
import type { IncomingMessage, ServerOptions as ServerOptionsImport, ServerResponse } from "http";
|
|
6
|
-
import type { ListenOptions, Server } from "net";
|
|
7
|
-
import type { SecureContextOptions, TlsOptions } from "tls";
|
|
5
|
+
import type { IncomingMessage, ServerOptions as ServerOptionsImport, ServerResponse } from "node:http";
|
|
6
|
+
import type { ListenOptions, Server } from "node:net";
|
|
7
|
+
import type { SecureContextOptions, TlsOptions } from "node:tls";
|
|
8
8
|
import type { Compiler } from "../..";
|
|
9
9
|
export interface LazyCompilationDefaultBackendOptions {
|
|
10
10
|
/**
|
|
@@ -16,7 +16,7 @@ const getBackend = (options) => (compiler, callback) => {
|
|
|
16
16
|
const createServer = typeof options.server === "function"
|
|
17
17
|
? options.server
|
|
18
18
|
: (() => {
|
|
19
|
-
const http = isHttps ? require("https") : require("http");
|
|
19
|
+
const http = isHttps ? require("node:https") : require("node:http");
|
|
20
20
|
return http.createServer.bind(http, options.server);
|
|
21
21
|
})();
|
|
22
22
|
const listen = typeof options.listen === "function"
|
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
|
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getRawChunkLoading = exports.getRawLibrary = exports.getRawResolve = exports.getRawOptions = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
8
8
|
const Stats_1 = require("../Stats");
|
|
9
9
|
const util_1 = require("../util");
|
|
10
10
|
const identifier_1 = require("../util/identifier");
|
|
11
11
|
const adapterRuleUse_1 = require("./adapterRuleUse");
|
|
12
12
|
const getRawOptions = (options, compiler) => {
|
|
13
|
-
(0,
|
|
13
|
+
(0, node_assert_1.default)(!(0, util_1.isNil)(options.context) && !(0, util_1.isNil)(options.devtool) && !(0, util_1.isNil)(options.cache), "context, devtool, cache should not be nil after defaults");
|
|
14
14
|
const devtool = options.devtool === false ? "" : options.devtool;
|
|
15
15
|
const mode = options.mode;
|
|
16
16
|
const experiments = getRawExperiments(options.experiments);
|
|
@@ -86,7 +86,7 @@ function getRawResolveByDependency(byDependency) {
|
|
|
86
86
|
return Object.fromEntries(Object.entries(byDependency).map(([k, v]) => [k, getRawResolve(v)]));
|
|
87
87
|
}
|
|
88
88
|
function getRawTsConfig(tsConfig) {
|
|
89
|
-
(0,
|
|
89
|
+
(0, node_assert_1.default)(typeof tsConfig !== "string", "should resolve string tsConfig in normalization");
|
|
90
90
|
if (tsConfig === undefined)
|
|
91
91
|
return tsConfig;
|
|
92
92
|
const { configFile, references } = tsConfig;
|
|
@@ -209,7 +209,7 @@ function getRawLibraryName(name) {
|
|
|
209
209
|
throw new Error("unreachable");
|
|
210
210
|
}
|
|
211
211
|
function getRawModule(module, options) {
|
|
212
|
-
(0,
|
|
212
|
+
(0, node_assert_1.default)(!(0, util_1.isNil)(module.defaultRules), "module.defaultRules should not be nil after defaults");
|
|
213
213
|
// "..." in defaultRules will be flatten in `applyModuleDefaults`, and "..." in rules is empty, so it's safe to use `as RuleSetRule[]` at here
|
|
214
214
|
const ruleSet = [
|
|
215
215
|
{ rules: module.defaultRules },
|
|
@@ -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) {
|
|
@@ -596,7 +607,7 @@ function getRawCssAutoOrModuleGeneratorOptions(options) {
|
|
|
596
607
|
};
|
|
597
608
|
}
|
|
598
609
|
function getRawOptimization(optimization) {
|
|
599
|
-
(0,
|
|
610
|
+
(0, node_assert_1.default)(!(0, util_1.isNil)(optimization.removeAvailableModules) &&
|
|
600
611
|
!(0, util_1.isNil)(optimization.sideEffects) &&
|
|
601
612
|
!(0, util_1.isNil)(optimization.realContentHash) &&
|
|
602
613
|
!(0, util_1.isNil)(optimization.providedExports) &&
|
|
@@ -618,7 +629,7 @@ function getRawSnapshotOptions(_snapshot) {
|
|
|
618
629
|
}
|
|
619
630
|
function getRawExperiments(experiments) {
|
|
620
631
|
const { topLevelAwait, rspackFuture } = experiments;
|
|
621
|
-
(0,
|
|
632
|
+
(0, node_assert_1.default)(!(0, util_1.isNil)(topLevelAwait) && !(0, util_1.isNil)(rspackFuture));
|
|
622
633
|
return {
|
|
623
634
|
topLevelAwait,
|
|
624
635
|
rspackFuture: getRawRspackFutureOptions(rspackFuture)
|
|
@@ -631,7 +642,7 @@ function getRawNode(node) {
|
|
|
631
642
|
if (node === false) {
|
|
632
643
|
return undefined;
|
|
633
644
|
}
|
|
634
|
-
(0,
|
|
645
|
+
(0, node_assert_1.default)(!(0, util_1.isNil)(node.__dirname) && !(0, util_1.isNil)(node.global) && !(0, util_1.isNil)(node.__filename));
|
|
635
646
|
return {
|
|
636
647
|
dirname: String(node.__dirname),
|
|
637
648
|
filename: String(node.__filename),
|
|
@@ -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
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
const browserslist = require("../../compiled/browserslist");
|
|
12
|
-
const path = require("path");
|
|
12
|
+
const path = require("node:path");
|
|
13
13
|
/** @typedef {import("./target").ApiTargetProperties} ApiTargetProperties */
|
|
14
14
|
/** @typedef {import("./target").EcmaTargetProperties} EcmaTargetProperties */
|
|
15
15
|
/** @typedef {import("./target").PlatformTargetProperties} PlatformTargetProperties */
|
|
@@ -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
|
@@ -13,9 +13,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.applyRspackOptionsBaseDefaults = exports.applyRspackOptionsDefaults = void 0;
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
16
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
17
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
18
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
19
19
|
const ModuleTypeConstants_1 = require("../ModuleTypeConstants");
|
|
20
20
|
const builtin_plugin_1 = require("../builtin-plugin");
|
|
21
21
|
const util_1 = require("../util");
|
|
@@ -29,8 +29,8 @@ const applyRspackOptionsDefaults = (options) => {
|
|
|
29
29
|
return (0, target_1.getDefaultTarget)(options.context);
|
|
30
30
|
});
|
|
31
31
|
const { mode, target } = options;
|
|
32
|
-
(0,
|
|
33
|
-
|
|
32
|
+
(0, node_assert_1.default)(!(0, util_1.isNil)(target));
|
|
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);
|
|
@@ -356,9 +357,9 @@ const applyOutputDefaults = (output, { context, outputModule, targetProperties:
|
|
|
356
357
|
});
|
|
357
358
|
if (libraryName)
|
|
358
359
|
return libraryName;
|
|
359
|
-
const pkgPath =
|
|
360
|
+
const pkgPath = node_path_1.default.resolve(context, "package.json");
|
|
360
361
|
try {
|
|
361
|
-
const packageInfo = JSON.parse(
|
|
362
|
+
const packageInfo = JSON.parse(node_fs_1.default.readFileSync(pkgPath, "utf-8"));
|
|
362
363
|
return packageInfo.name || "";
|
|
363
364
|
}
|
|
364
365
|
catch (err) {
|
|
@@ -411,7 +412,7 @@ const applyOutputDefaults = (output, { context, outputModule, targetProperties:
|
|
|
411
412
|
F(output, "chunkLoadingGlobal", () => "webpackChunk" + uniqueNameId);
|
|
412
413
|
D(output, "assetModuleFilename", "[hash][ext][query]");
|
|
413
414
|
D(output, "webassemblyModuleFilename", "[hash].module.wasm");
|
|
414
|
-
F(output, "path", () =>
|
|
415
|
+
F(output, "path", () => node_path_1.default.join(process.cwd(), "dist"));
|
|
415
416
|
F(output, "pathinfo", () => development);
|
|
416
417
|
D(output, "publicPath", tp && (tp.document || tp.importScripts) ? "auto" : "");
|
|
417
418
|
D(output, "hashFunction", futureDefaults ? "xxhash64" : "md4");
|
|
@@ -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) {
|