@rspack/core 1.0.9 → 1.0.11
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/Dependency.d.ts +7 -6
- package/dist/Module.d.ts +19 -17
- package/dist/builtin-plugin/css-extract/utils.d.ts +1 -0
- package/dist/config/types.d.ts +545 -0
- package/dist/config/zod.d.ts +202 -1347
- package/dist/cssExtractHmr.js +224 -0
- package/dist/cssExtractLoader.js +277 -0
- package/dist/index.js +23347 -31
- package/dist/{builtin-plugin/css-extract/hmr/hotModuleReplacement.d.ts → runtime/cssExtractHmr.d.ts} +1 -0
- package/dist/runtime/moduleFederationDefaultRuntime.d.ts +2 -0
- package/dist/stats/statsFactoryUtils.d.ts +1 -0
- package/package.json +8 -5
- package/compiled/json-parse-even-better-errors/index.d.ts +0 -1
- package/compiled/json-parse-even-better-errors/index.js +0 -193
- package/compiled/json-parse-even-better-errors/package.json +0 -1
- package/compiled/neo-async/index.d.ts +0 -685
- package/compiled/neo-async/index.js +0 -9207
- package/compiled/neo-async/license +0 -22
- package/compiled/neo-async/package.json +0 -1
- package/compiled/zod-validation-error/index.d.ts +0 -41
- package/compiled/zod-validation-error/index.js +0 -335
- package/compiled/zod-validation-error/license +0 -9
- package/compiled/zod-validation-error/package.json +0 -1
- package/dist/Chunk.js +0 -118
- package/dist/ChunkGraph.js +0 -27
- package/dist/ChunkGroup.js +0 -76
- package/dist/Compilation.js +0 -854
- package/dist/Compiler.js +0 -920
- package/dist/ContextModuleFactory.js +0 -36
- package/dist/DependenciesBlock.js +0 -30
- package/dist/Dependency.js +0 -32
- package/dist/Entrypoint.js +0 -21
- package/dist/ErrorHelpers.js +0 -62
- package/dist/ExecuteModulePlugin.js +0 -46
- package/dist/FileSystem.js +0 -34
- package/dist/FileSystemInfo.js +0 -2
- package/dist/Module.js +0 -143
- package/dist/ModuleTypeConstants.js +0 -92
- package/dist/MultiCompiler.js +0 -440
- package/dist/MultiStats.js +0 -161
- package/dist/MultiWatching.js +0 -62
- package/dist/NormalModule.js +0 -97
- package/dist/NormalModuleFactory.js +0 -43
- package/dist/Resolver.js +0 -39
- package/dist/ResolverFactory.js +0 -61
- package/dist/RspackError.js +0 -21
- package/dist/RuleSetCompiler.js +0 -10
- package/dist/RuntimeGlobals.js +0 -357
- package/dist/RuntimeModule.js +0 -58
- package/dist/Stats.js +0 -161
- package/dist/Template.js +0 -206
- package/dist/Watching.js +0 -290
- package/dist/builtin-loader/index.js +0 -17
- package/dist/builtin-loader/lightningcss/index.js +0 -175
- package/dist/builtin-loader/swc/index.js +0 -5
- package/dist/builtin-loader/swc/pluginImport.js +0 -35
- package/dist/builtin-loader/swc/react.js +0 -7
- package/dist/builtin-loader/swc/types.js +0 -2
- package/dist/builtin-plugin/APIPlugin.js +0 -6
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.js +0 -6
- package/dist/builtin-plugin/AssetModulesPlugin.js +0 -6
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.js +0 -6
- package/dist/builtin-plugin/BannerPlugin.js +0 -22
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.js +0 -12
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.js +0 -6
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.js +0 -6
- package/dist/builtin-plugin/ContextReplacementPlugin.js +0 -43
- package/dist/builtin-plugin/CopyRspackPlugin.js +0 -21
- package/dist/builtin-plugin/CssModulesPlugin.js +0 -6
- package/dist/builtin-plugin/DataUriPlugin.js +0 -6
- package/dist/builtin-plugin/DefinePlugin.js +0 -44
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.js +0 -6
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.js +0 -6
- package/dist/builtin-plugin/DynamicEntryPlugin.js +0 -36
- package/dist/builtin-plugin/ElectronTargetPlugin.js +0 -6
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.js +0 -6
- package/dist/builtin-plugin/EnableLibraryPlugin.js +0 -39
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.js +0 -6
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.js +0 -6
- package/dist/builtin-plugin/EntryPlugin.js +0 -34
- package/dist/builtin-plugin/EvalDevToolModulePlugin.js +0 -6
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.js +0 -16
- package/dist/builtin-plugin/ExternalsPlugin.js +0 -51
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.js +0 -6
- package/dist/builtin-plugin/FileUriPlugin.js +0 -6
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.js +0 -6
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.js +0 -6
- package/dist/builtin-plugin/HotModuleReplacementPlugin.js +0 -18
- package/dist/builtin-plugin/HtmlRspackPlugin.js +0 -285
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.js +0 -11
- package/dist/builtin-plugin/IgnorePlugin.js +0 -20
- package/dist/builtin-plugin/InferAsyncModulesPlugin.js +0 -6
- package/dist/builtin-plugin/JavascriptModulesPlugin.js +0 -55
- package/dist/builtin-plugin/JsLoaderRspackPlugin.js +0 -9
- package/dist/builtin-plugin/JsonModulesPlugin.js +0 -6
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +0 -30
- package/dist/builtin-plugin/LimitChunkCountPlugin.js +0 -8
- package/dist/builtin-plugin/MangleExportsPlugin.js +0 -6
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.js +0 -6
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.js +0 -6
- package/dist/builtin-plugin/ModuleConcatenationPlugin.js +0 -6
- package/dist/builtin-plugin/NamedChunkIdsPlugin.js +0 -6
- package/dist/builtin-plugin/NamedModuleIdsPlugin.js +0 -6
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.js +0 -6
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.js +0 -6
- package/dist/builtin-plugin/NoEmitOnErrorsPlugin.js +0 -6
- package/dist/builtin-plugin/NodeTargetPlugin.js +0 -6
- package/dist/builtin-plugin/ProgressPlugin.js +0 -15
- package/dist/builtin-plugin/ProvidePlugin.js +0 -14
- package/dist/builtin-plugin/RealContentHashPlugin.js +0 -6
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.js +0 -6
- package/dist/builtin-plugin/RuntimeChunkPlugin.js +0 -6
- package/dist/builtin-plugin/RuntimePlugin.js +0 -6
- package/dist/builtin-plugin/SideEffectsFlagPlugin.js +0 -6
- package/dist/builtin-plugin/SizeLimitsPlugin.js +0 -9
- package/dist/builtin-plugin/SourceMapDevToolPlugin.js +0 -14
- package/dist/builtin-plugin/SplitChunksPlugin.js +0 -92
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +0 -80
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.js +0 -6
- package/dist/builtin-plugin/WebWorkerTemplatePlugin.js +0 -6
- package/dist/builtin-plugin/WorkerPlugin.js +0 -31
- package/dist/builtin-plugin/base.js +0 -58
- package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +0 -182
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.d.ts +0 -2
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.js +0 -31
- package/dist/builtin-plugin/css-extract/index.js +0 -105
- package/dist/builtin-plugin/css-extract/loader.js +0 -204
- package/dist/builtin-plugin/css-extract/utils.js +0 -51
- package/dist/builtin-plugin/index.js +0 -84
- package/dist/builtin-plugin/lazy-compilation/backend.js +0 -139
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.js +0 -6
- package/dist/builtin-plugin/lazy-compilation/plugin.js +0 -60
- package/dist/config/adapter.js +0 -691
- package/dist/config/adapterRuleUse.js +0 -107
- package/dist/config/browserslistTargetHandler.js +0 -345
- package/dist/config/defaults.js +0 -876
- package/dist/config/index.js +0 -20
- package/dist/config/normalization.js +0 -299
- package/dist/config/target.js +0 -318
- package/dist/config/types.js +0 -3
- package/dist/config/zod.js +0 -1028
- package/dist/container/ContainerPlugin.js +0 -50
- package/dist/container/ContainerReferencePlugin.js +0 -49
- package/dist/container/ModuleFederationPlugin.js +0 -137
- package/dist/container/ModuleFederationPluginV1.js +0 -63
- package/dist/container/ModuleFederationRuntimePlugin.js +0 -6
- package/dist/container/options.js +0 -48
- package/dist/error/ConcurrentCompilationError.js +0 -20
- package/dist/exports.js +0 -183
- package/dist/lib/AbstractMethodError.js +0 -51
- package/dist/lib/Cache.js +0 -111
- package/dist/lib/CacheFacade.js +0 -321
- package/dist/lib/Dependency.js +0 -11
- package/dist/lib/EntryOptionPlugin.js +0 -89
- package/dist/lib/EnvironmentPlugin.js +0 -57
- package/dist/lib/HookWebpackError.js +0 -83
- package/dist/lib/IgnoreWarningsPlugin.js +0 -35
- package/dist/lib/LoaderOptionsPlugin.js +0 -74
- package/dist/lib/LoaderTargetPlugin.js +0 -37
- package/dist/lib/ModuleFilenameHelpers.js +0 -83
- package/dist/lib/NormalModuleReplacementPlugin.js +0 -85
- package/dist/lib/WebpackError.js +0 -20
- package/dist/lib/cache/MemoryCachePlugin.js +0 -40
- package/dist/lib/cache/getLazyHashedEtag.js +0 -73
- package/dist/lib/cache/mergeEtags.js +0 -74
- package/dist/lib/formatLocation.js +0 -64
- package/dist/loader-runner/LoaderLoadingError.js +0 -19
- package/dist/loader-runner/index.js +0 -735
- package/dist/loader-runner/loadLoader.js +0 -64
- package/dist/logging/Logger.js +0 -143
- package/dist/logging/createConsoleLogger.js +0 -176
- package/dist/logging/runtime.js +0 -37
- package/dist/logging/truncateArgs.js +0 -81
- package/dist/node/NodeEnvironmentPlugin.js +0 -50
- package/dist/node/NodeTemplatePlugin.js +0 -26
- package/dist/node/NodeWatchFileSystem.js +0 -144
- package/dist/node/nodeConsole.js +0 -146
- package/dist/rspack.js +0 -123
- package/dist/rspackOptionsApply.js +0 -274
- package/dist/sharing/ConsumeSharedPlugin.js +0 -69
- package/dist/sharing/ProvideSharedPlugin.js +0 -50
- package/dist/sharing/SharePlugin.js +0 -66
- package/dist/sharing/ShareRuntimePlugin.js +0 -26
- package/dist/sharing/utils.js +0 -8
- package/dist/stats/DefaultStatsFactoryPlugin.js +0 -1173
- package/dist/stats/DefaultStatsPresetPlugin.js +0 -305
- package/dist/stats/DefaultStatsPrinterPlugin.js +0 -1069
- package/dist/stats/StatsFactory.js +0 -167
- package/dist/stats/StatsPrinter.js +0 -142
- package/dist/stats/statsFactoryUtils.js +0 -341
- package/dist/util/ArrayQueue.js +0 -108
- package/dist/util/AssetInfo.js +0 -39
- package/dist/util/IterableHelpers.js +0 -35
- package/dist/util/MergeCaller.js +0 -24
- package/dist/util/SizeFormatHelpers.js +0 -24
- package/dist/util/SplitChunkSize.js +0 -18
- package/dist/util/assertNotNil.js +0 -9
- package/dist/util/assetCondition.js +0 -2
- package/dist/util/bindingVersionCheck.js +0 -124
- package/dist/util/cleverMerge.js +0 -504
- package/dist/util/comparators.js +0 -108
- package/dist/util/createHash.js +0 -161
- package/dist/util/createReadonlyMap.js +0 -29
- package/dist/util/fake.js +0 -28
- package/dist/util/fs.js +0 -120
- package/dist/util/hash/BatchedHash.js +0 -69
- package/dist/util/hash/index.js +0 -39
- package/dist/util/hash/md4.js +0 -27
- package/dist/util/hash/wasm-hash.js +0 -167
- package/dist/util/hash/xxhash64.js +0 -27
- package/dist/util/identifier.js +0 -330
- package/dist/util/index.js +0 -123
- package/dist/util/memoize.js +0 -61
- package/dist/util/scheme.js +0 -57
- package/dist/util/smartGrouping.js +0 -148
- package/dist/util/source.js +0 -42
- package/dist/util/validate.js +0 -77
- package/dist/util/webpack.js +0 -27
- /package/dist/{container/default.runtime.js → moduleFederationDefaultRuntime.js} +0 -0
package/dist/config/adapter.js
DELETED
|
@@ -1,691 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getRawChunkLoading = exports.getRawLibrary = exports.getRawResolve = exports.getRawOptions = void 0;
|
|
7
|
-
const node_assert_1 = __importDefault(require("node:assert"));
|
|
8
|
-
const binding_1 = require("@rspack/binding");
|
|
9
|
-
const Stats_1 = require("../Stats");
|
|
10
|
-
const util_1 = require("../util");
|
|
11
|
-
const identifier_1 = require("../util/identifier");
|
|
12
|
-
const adapterRuleUse_1 = require("./adapterRuleUse");
|
|
13
|
-
const getRawOptions = (options, compiler) => {
|
|
14
|
-
(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");
|
|
15
|
-
const devtool = options.devtool === false ? "" : options.devtool;
|
|
16
|
-
const mode = options.mode;
|
|
17
|
-
const experiments = getRawExperiments(options.experiments);
|
|
18
|
-
return {
|
|
19
|
-
mode,
|
|
20
|
-
target: getRawTarget(options.target),
|
|
21
|
-
context: options.context,
|
|
22
|
-
output: getRawOutput(options.output),
|
|
23
|
-
resolve: getRawResolve(options.resolve),
|
|
24
|
-
resolveLoader: getRawResolve(options.resolveLoader),
|
|
25
|
-
module: getRawModule(options.module, {
|
|
26
|
-
compiler,
|
|
27
|
-
devtool,
|
|
28
|
-
mode,
|
|
29
|
-
context: options.context,
|
|
30
|
-
experiments
|
|
31
|
-
}),
|
|
32
|
-
devtool,
|
|
33
|
-
optimization: getRawOptimization(options.optimization),
|
|
34
|
-
stats: getRawStats(options.stats),
|
|
35
|
-
snapshot: getRawSnapshotOptions(options.snapshot),
|
|
36
|
-
cache: {
|
|
37
|
-
type: options.cache ? "memory" : "disable",
|
|
38
|
-
// TODO: implement below cache options
|
|
39
|
-
maxGenerations: 0,
|
|
40
|
-
maxAge: 0,
|
|
41
|
-
profile: false,
|
|
42
|
-
buildDependencies: [],
|
|
43
|
-
cacheDirectory: "",
|
|
44
|
-
cacheLocation: "",
|
|
45
|
-
name: "",
|
|
46
|
-
version: ""
|
|
47
|
-
},
|
|
48
|
-
experiments,
|
|
49
|
-
node: getRawNode(options.node),
|
|
50
|
-
// SAFETY: applied default value in `applyRspackOptionsDefaults`.
|
|
51
|
-
profile: options.profile,
|
|
52
|
-
// SAFETY: applied default value in `applyRspackOptionsDefaults`.
|
|
53
|
-
bail: options.bail,
|
|
54
|
-
__references: {}
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
exports.getRawOptions = getRawOptions;
|
|
58
|
-
function getRawTarget(target) {
|
|
59
|
-
if (!target) {
|
|
60
|
-
return [];
|
|
61
|
-
}
|
|
62
|
-
if (typeof target === "string") {
|
|
63
|
-
return [target];
|
|
64
|
-
}
|
|
65
|
-
return target;
|
|
66
|
-
}
|
|
67
|
-
function getRawExtensionAlias(alias = {}) {
|
|
68
|
-
const entries = Object.entries(alias).map(([key, value]) => {
|
|
69
|
-
if (Array.isArray(value)) {
|
|
70
|
-
return [key, value];
|
|
71
|
-
}
|
|
72
|
-
return [key, [value]];
|
|
73
|
-
});
|
|
74
|
-
return Object.fromEntries(entries);
|
|
75
|
-
}
|
|
76
|
-
function getRawAlias(alias = {}) {
|
|
77
|
-
return Object.entries(alias).map(([key, value]) => ({
|
|
78
|
-
path: key,
|
|
79
|
-
redirect: Array.isArray(value) ? value : [value]
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
function getRawResolveByDependency(byDependency) {
|
|
83
|
-
if (byDependency === undefined)
|
|
84
|
-
return byDependency;
|
|
85
|
-
return Object.fromEntries(Object.entries(byDependency).map(([k, v]) => [k, getRawResolve(v)]));
|
|
86
|
-
}
|
|
87
|
-
function getRawTsConfig(tsConfig) {
|
|
88
|
-
(0, node_assert_1.default)(typeof tsConfig !== "string", "should resolve string tsConfig in normalization");
|
|
89
|
-
if (tsConfig === undefined)
|
|
90
|
-
return tsConfig;
|
|
91
|
-
const { configFile, references } = tsConfig;
|
|
92
|
-
return {
|
|
93
|
-
configFile,
|
|
94
|
-
referencesType: references === "auto" ? "auto" : references ? "manual" : "disabled",
|
|
95
|
-
references: references === "auto" ? undefined : references
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
function getRawResolve(resolve) {
|
|
99
|
-
return {
|
|
100
|
-
...resolve,
|
|
101
|
-
alias: getRawAlias(resolve.alias),
|
|
102
|
-
fallback: getRawAlias(resolve.fallback),
|
|
103
|
-
extensionAlias: getRawExtensionAlias(resolve.extensionAlias),
|
|
104
|
-
tsconfig: getRawTsConfig(resolve.tsConfig),
|
|
105
|
-
byDependency: getRawResolveByDependency(resolve.byDependency)
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
exports.getRawResolve = getRawResolve;
|
|
109
|
-
function getRawCrossOriginLoading(crossOriginLoading) {
|
|
110
|
-
if (typeof crossOriginLoading === "boolean") {
|
|
111
|
-
return { type: "bool", boolPayload: crossOriginLoading };
|
|
112
|
-
}
|
|
113
|
-
return { type: "string", stringPayload: crossOriginLoading };
|
|
114
|
-
}
|
|
115
|
-
function getRawOutput(output) {
|
|
116
|
-
const chunkLoading = output.chunkLoading;
|
|
117
|
-
const wasmLoading = output.wasmLoading;
|
|
118
|
-
const workerChunkLoading = output.workerChunkLoading;
|
|
119
|
-
const workerWasmLoading = output.workerWasmLoading;
|
|
120
|
-
return {
|
|
121
|
-
path: output.path,
|
|
122
|
-
pathinfo: output.pathinfo,
|
|
123
|
-
publicPath: output.publicPath,
|
|
124
|
-
clean: output.clean,
|
|
125
|
-
assetModuleFilename: output.assetModuleFilename,
|
|
126
|
-
filename: output.filename,
|
|
127
|
-
chunkFilename: output.chunkFilename,
|
|
128
|
-
chunkLoading: getRawChunkLoading(chunkLoading),
|
|
129
|
-
crossOriginLoading: getRawCrossOriginLoading(output.crossOriginLoading),
|
|
130
|
-
cssFilename: output.cssFilename,
|
|
131
|
-
cssChunkFilename: output.cssChunkFilename,
|
|
132
|
-
cssHeadDataCompression: output.cssHeadDataCompression,
|
|
133
|
-
hotUpdateChunkFilename: output.hotUpdateChunkFilename,
|
|
134
|
-
hotUpdateMainFilename: output.hotUpdateMainFilename,
|
|
135
|
-
hotUpdateGlobal: output.hotUpdateGlobal,
|
|
136
|
-
uniqueName: output.uniqueName,
|
|
137
|
-
chunkLoadingGlobal: output.chunkLoadingGlobal,
|
|
138
|
-
enabledLibraryTypes: output.enabledLibraryTypes,
|
|
139
|
-
library: output.library && getRawLibrary(output.library),
|
|
140
|
-
strictModuleErrorHandling: output.strictModuleErrorHandling,
|
|
141
|
-
globalObject: output.globalObject,
|
|
142
|
-
importFunctionName: output.importFunctionName,
|
|
143
|
-
importMetaName: output.importMetaName,
|
|
144
|
-
iife: output.iife,
|
|
145
|
-
module: output.module,
|
|
146
|
-
wasmLoading: wasmLoading === false ? "false" : wasmLoading,
|
|
147
|
-
enabledWasmLoadingTypes: output.enabledWasmLoadingTypes,
|
|
148
|
-
enabledChunkLoadingTypes: output.enabledChunkLoadingTypes,
|
|
149
|
-
webassemblyModuleFilename: output.webassemblyModuleFilename,
|
|
150
|
-
trustedTypes: output.trustedTypes,
|
|
151
|
-
sourceMapFilename: output.sourceMapFilename,
|
|
152
|
-
hashFunction: output.hashFunction,
|
|
153
|
-
hashDigest: output.hashDigest,
|
|
154
|
-
hashDigestLength: output.hashDigestLength,
|
|
155
|
-
hashSalt: output.hashSalt,
|
|
156
|
-
asyncChunks: output.asyncChunks,
|
|
157
|
-
workerChunkLoading: workerChunkLoading === false ? "false" : workerChunkLoading,
|
|
158
|
-
workerWasmLoading: workerWasmLoading === false ? "false" : workerWasmLoading,
|
|
159
|
-
workerPublicPath: output.workerPublicPath,
|
|
160
|
-
scriptType: output.scriptType === false ? "false" : output.scriptType,
|
|
161
|
-
charset: output.charset,
|
|
162
|
-
chunkLoadTimeout: output.chunkLoadTimeout,
|
|
163
|
-
environment: output.environment
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
function getRawLibrary(library) {
|
|
167
|
-
const { type, name, export: libraryExport, umdNamedDefine, auxiliaryComment, amdContainer } = library;
|
|
168
|
-
return {
|
|
169
|
-
amdContainer,
|
|
170
|
-
auxiliaryComment: typeof auxiliaryComment === "string"
|
|
171
|
-
? {
|
|
172
|
-
commonjs: auxiliaryComment,
|
|
173
|
-
commonjs2: auxiliaryComment,
|
|
174
|
-
amd: auxiliaryComment,
|
|
175
|
-
root: auxiliaryComment
|
|
176
|
-
}
|
|
177
|
-
: auxiliaryComment,
|
|
178
|
-
libraryType: type,
|
|
179
|
-
name: (0, util_1.isNil)(name) ? name : getRawLibraryName(name),
|
|
180
|
-
export: Array.isArray(libraryExport) || libraryExport == null
|
|
181
|
-
? libraryExport
|
|
182
|
-
: [libraryExport],
|
|
183
|
-
umdNamedDefine
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
exports.getRawLibrary = getRawLibrary;
|
|
187
|
-
function getRawLibraryName(name) {
|
|
188
|
-
if (typeof name === "string") {
|
|
189
|
-
return {
|
|
190
|
-
type: "string",
|
|
191
|
-
stringPayload: name
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
if (Array.isArray(name)) {
|
|
195
|
-
return {
|
|
196
|
-
type: "array",
|
|
197
|
-
arrayPayload: name
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
if (typeof name === "object" && !Array.isArray(name)) {
|
|
201
|
-
return {
|
|
202
|
-
type: "umdObject",
|
|
203
|
-
umdObjectPayload: {
|
|
204
|
-
commonjs: name.commonjs,
|
|
205
|
-
root: Array.isArray(name.root) || (0, util_1.isNil)(name.root)
|
|
206
|
-
? name.root
|
|
207
|
-
: [name.root],
|
|
208
|
-
amd: name.amd
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
throw new Error("unreachable");
|
|
213
|
-
}
|
|
214
|
-
function getRawModule(module, options) {
|
|
215
|
-
(0, node_assert_1.default)(!(0, util_1.isNil)(module.defaultRules), "module.defaultRules should not be nil after defaults");
|
|
216
|
-
// "..." in defaultRules will be flatten in `applyModuleDefaults`, and "..." in rules is empty, so it's safe to use `as RuleSetRule[]` at here
|
|
217
|
-
const ruleSet = [
|
|
218
|
-
{ rules: module.defaultRules },
|
|
219
|
-
{ rules: module.rules }
|
|
220
|
-
];
|
|
221
|
-
const rules = ruleSet.map((rule, index) => getRawModuleRule(rule, `ruleSet[${index}]`, options, "javascript/auto"));
|
|
222
|
-
return {
|
|
223
|
-
rules,
|
|
224
|
-
parser: getRawParserOptionsMap(module.parser),
|
|
225
|
-
generator: getRawGeneratorOptionsMap(module.generator),
|
|
226
|
-
noParse: module.noParse
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
function tryMatch(payload, condition) {
|
|
230
|
-
if (typeof condition === "string") {
|
|
231
|
-
return payload.startsWith(condition);
|
|
232
|
-
}
|
|
233
|
-
if (condition instanceof RegExp) {
|
|
234
|
-
return condition.test(payload);
|
|
235
|
-
}
|
|
236
|
-
if (typeof condition === "function") {
|
|
237
|
-
return condition(payload);
|
|
238
|
-
}
|
|
239
|
-
if (Array.isArray(condition)) {
|
|
240
|
-
return condition.some(c => tryMatch(payload, c));
|
|
241
|
-
}
|
|
242
|
-
if (condition && typeof condition === "object") {
|
|
243
|
-
if (condition.and) {
|
|
244
|
-
return condition.and.every(c => tryMatch(payload, c));
|
|
245
|
-
}
|
|
246
|
-
if (condition.or) {
|
|
247
|
-
return condition.or.some(c => tryMatch(payload, c));
|
|
248
|
-
}
|
|
249
|
-
if (condition.not) {
|
|
250
|
-
return !tryMatch(payload, condition.not);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
return false;
|
|
254
|
-
}
|
|
255
|
-
const getRawModuleRule = (rule, path, options, upperType) => {
|
|
256
|
-
// Rule.loader is a shortcut to Rule.use: [ { loader } ].
|
|
257
|
-
// See: https://webpack.js.org/configuration/module/#ruleloader
|
|
258
|
-
if (rule.loader) {
|
|
259
|
-
rule.use = [
|
|
260
|
-
{
|
|
261
|
-
loader: rule.loader,
|
|
262
|
-
options: rule.options
|
|
263
|
-
}
|
|
264
|
-
];
|
|
265
|
-
}
|
|
266
|
-
let funcUse;
|
|
267
|
-
if (typeof rule.use === "function") {
|
|
268
|
-
const use = rule.use;
|
|
269
|
-
funcUse = (rawContext) => {
|
|
270
|
-
const context = {
|
|
271
|
-
...rawContext,
|
|
272
|
-
compiler: options.compiler
|
|
273
|
-
};
|
|
274
|
-
const uses = use(context);
|
|
275
|
-
return (0, adapterRuleUse_1.createRawModuleRuleUses)(uses ?? [], `${path}.use`, options);
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
const rawModuleRule = {
|
|
279
|
-
test: rule.test ? getRawRuleSetCondition(rule.test) : undefined,
|
|
280
|
-
include: rule.include ? getRawRuleSetCondition(rule.include) : undefined,
|
|
281
|
-
exclude: rule.exclude ? getRawRuleSetCondition(rule.exclude) : undefined,
|
|
282
|
-
issuer: rule.issuer ? getRawRuleSetCondition(rule.issuer) : undefined,
|
|
283
|
-
issuerLayer: rule.issuerLayer
|
|
284
|
-
? getRawRuleSetCondition(rule.issuerLayer)
|
|
285
|
-
: undefined,
|
|
286
|
-
dependency: rule.dependency
|
|
287
|
-
? getRawRuleSetCondition(rule.dependency)
|
|
288
|
-
: undefined,
|
|
289
|
-
descriptionData: rule.descriptionData
|
|
290
|
-
? Object.fromEntries(Object.entries(rule.descriptionData).map(([k, v]) => [
|
|
291
|
-
k,
|
|
292
|
-
getRawRuleSetCondition(v)
|
|
293
|
-
]))
|
|
294
|
-
: undefined,
|
|
295
|
-
with: rule.with
|
|
296
|
-
? Object.fromEntries(Object.entries(rule.with).map(([k, v]) => [
|
|
297
|
-
k,
|
|
298
|
-
getRawRuleSetCondition(v)
|
|
299
|
-
]))
|
|
300
|
-
: undefined,
|
|
301
|
-
resource: rule.resource ? getRawRuleSetCondition(rule.resource) : undefined,
|
|
302
|
-
resourceQuery: rule.resourceQuery
|
|
303
|
-
? getRawRuleSetCondition(rule.resourceQuery)
|
|
304
|
-
: undefined,
|
|
305
|
-
resourceFragment: rule.resourceFragment
|
|
306
|
-
? getRawRuleSetCondition(rule.resourceFragment)
|
|
307
|
-
: undefined,
|
|
308
|
-
scheme: rule.scheme ? getRawRuleSetCondition(rule.scheme) : undefined,
|
|
309
|
-
mimetype: rule.mimetype ? getRawRuleSetCondition(rule.mimetype) : undefined,
|
|
310
|
-
sideEffects: rule.sideEffects,
|
|
311
|
-
use: typeof rule.use === "function"
|
|
312
|
-
? funcUse
|
|
313
|
-
: (0, adapterRuleUse_1.createRawModuleRuleUses)(rule.use ?? [], `${path}.use`, options),
|
|
314
|
-
type: rule.type,
|
|
315
|
-
layer: rule.layer,
|
|
316
|
-
parser: rule.parser
|
|
317
|
-
? getRawParserOptions(rule.parser, rule.type ?? upperType)
|
|
318
|
-
: undefined,
|
|
319
|
-
generator: rule.generator
|
|
320
|
-
? getRawGeneratorOptions(rule.generator, rule.type ?? upperType)
|
|
321
|
-
: undefined,
|
|
322
|
-
resolve: rule.resolve ? getRawResolve(rule.resolve) : undefined,
|
|
323
|
-
oneOf: rule.oneOf
|
|
324
|
-
? rule.oneOf.map((rule, index) => getRawModuleRule(rule, `${path}.oneOf[${index}]`, options, rule.type ?? upperType))
|
|
325
|
-
: undefined,
|
|
326
|
-
rules: rule.rules
|
|
327
|
-
? rule.rules.map((rule, index) => getRawModuleRule(rule, `${path}.rules[${index}]`, options, rule.type ?? upperType))
|
|
328
|
-
: undefined,
|
|
329
|
-
enforce: rule.enforce
|
|
330
|
-
};
|
|
331
|
-
// Function calls may contain side-effects when interoperating with single-threaded environment.
|
|
332
|
-
// In order to mitigate the issue, Rspack tries to merge these calls together.
|
|
333
|
-
// See: https://github.com/web-infra-dev/rspack/issues/4003#issuecomment-1689662380
|
|
334
|
-
if (typeof rule.test === "function" ||
|
|
335
|
-
typeof rule.resource === "function" ||
|
|
336
|
-
typeof rule.resourceQuery === "function" ||
|
|
337
|
-
typeof rule.resourceFragment === "function") {
|
|
338
|
-
delete rawModuleRule.test;
|
|
339
|
-
delete rawModuleRule.resource;
|
|
340
|
-
delete rawModuleRule.resourceQuery;
|
|
341
|
-
delete rawModuleRule.resourceFragment;
|
|
342
|
-
rawModuleRule.rspackResource = getRawRuleSetCondition(resourceQueryFragment => {
|
|
343
|
-
const { path, query, fragment } = (0, identifier_1.parseResource)(resourceQueryFragment);
|
|
344
|
-
if (rule.test && !tryMatch(path, rule.test)) {
|
|
345
|
-
return false;
|
|
346
|
-
}
|
|
347
|
-
if (rule.resource && !tryMatch(path, rule.resource)) {
|
|
348
|
-
return false;
|
|
349
|
-
}
|
|
350
|
-
if (rule.resourceQuery && !tryMatch(query, rule.resourceQuery)) {
|
|
351
|
-
return false;
|
|
352
|
-
}
|
|
353
|
-
if (rule.resourceFragment &&
|
|
354
|
-
!tryMatch(fragment, rule.resourceFragment)) {
|
|
355
|
-
return false;
|
|
356
|
-
}
|
|
357
|
-
return true;
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
return rawModuleRule;
|
|
361
|
-
};
|
|
362
|
-
function getRawRuleSetCondition(condition) {
|
|
363
|
-
if (typeof condition === "string") {
|
|
364
|
-
return {
|
|
365
|
-
type: binding_1.RawRuleSetConditionType.string,
|
|
366
|
-
string: condition
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
if (condition instanceof RegExp) {
|
|
370
|
-
return {
|
|
371
|
-
type: binding_1.RawRuleSetConditionType.regexp,
|
|
372
|
-
regexp: {
|
|
373
|
-
source: condition.source,
|
|
374
|
-
flags: condition.flags
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
if (typeof condition === "function") {
|
|
379
|
-
return {
|
|
380
|
-
type: binding_1.RawRuleSetConditionType.func,
|
|
381
|
-
func: condition
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
if (Array.isArray(condition)) {
|
|
385
|
-
return {
|
|
386
|
-
type: binding_1.RawRuleSetConditionType.array,
|
|
387
|
-
array: condition.map(i => getRawRuleSetCondition(i))
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
if (typeof condition === "object" && condition !== null) {
|
|
391
|
-
return {
|
|
392
|
-
type: binding_1.RawRuleSetConditionType.logical,
|
|
393
|
-
logical: [getRawRuleSetLogicalConditions(condition)]
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
throw new Error("unreachable: condition should be one of string, RegExp, Array, Object");
|
|
397
|
-
}
|
|
398
|
-
function getRawRuleSetLogicalConditions(logical) {
|
|
399
|
-
return {
|
|
400
|
-
and: logical.and
|
|
401
|
-
? logical.and.map(i => getRawRuleSetCondition(i))
|
|
402
|
-
: undefined,
|
|
403
|
-
or: logical.or ? logical.or.map(i => getRawRuleSetCondition(i)) : undefined,
|
|
404
|
-
not: logical.not ? getRawRuleSetCondition(logical.not) : undefined
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
function getRawParserOptionsMap(parser) {
|
|
408
|
-
return Object.fromEntries(Object.entries(parser)
|
|
409
|
-
.map(([k, v]) => [k, getRawParserOptions(v, k)])
|
|
410
|
-
.filter(([k, v]) => v !== undefined));
|
|
411
|
-
}
|
|
412
|
-
function getRawGeneratorOptionsMap(generator) {
|
|
413
|
-
return Object.fromEntries(Object.entries(generator)
|
|
414
|
-
.map(([k, v]) => [k, getRawGeneratorOptions(v, k)])
|
|
415
|
-
.filter(([k, v]) => v !== undefined));
|
|
416
|
-
}
|
|
417
|
-
function getRawParserOptions(parser, type) {
|
|
418
|
-
if (type === "asset") {
|
|
419
|
-
return {
|
|
420
|
-
type: "asset",
|
|
421
|
-
asset: getRawAssetParserOptions(parser)
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
if (type === "javascript") {
|
|
425
|
-
return {
|
|
426
|
-
type: "javascript",
|
|
427
|
-
javascript: getRawJavascriptParserOptions(parser)
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
if (type === "javascript/auto") {
|
|
431
|
-
return {
|
|
432
|
-
type: "javascript/auto",
|
|
433
|
-
javascript: getRawJavascriptParserOptions(parser)
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
if (type === "javascript/dynamic") {
|
|
437
|
-
return {
|
|
438
|
-
type: "javascript/dynamic",
|
|
439
|
-
javascript: getRawJavascriptParserOptions(parser)
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
if (type === "javascript/esm") {
|
|
443
|
-
return {
|
|
444
|
-
type: "javascript/esm",
|
|
445
|
-
javascript: getRawJavascriptParserOptions(parser)
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
if (type === "css") {
|
|
449
|
-
return {
|
|
450
|
-
type: "css",
|
|
451
|
-
css: getRawCssParserOptions(parser)
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
if (type === "css/auto") {
|
|
455
|
-
return {
|
|
456
|
-
type: "css/auto",
|
|
457
|
-
cssAuto: getRawCssParserOptions(parser)
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
|
-
if (type === "css/module") {
|
|
461
|
-
return {
|
|
462
|
-
type: "css/module",
|
|
463
|
-
cssModule: getRawCssParserOptions(parser)
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
// FIXME: shouldn't depend on module type, for example: `rules: [{ test: /\.css/, generator: {..} }]` will error
|
|
467
|
-
throw new Error(`unreachable: unknow module type: ${type}`);
|
|
468
|
-
}
|
|
469
|
-
function getRawJavascriptParserOptions(parser) {
|
|
470
|
-
return {
|
|
471
|
-
dynamicImportMode: parser.dynamicImportMode,
|
|
472
|
-
dynamicImportPreload: parser.dynamicImportPreload?.toString(),
|
|
473
|
-
dynamicImportPrefetch: parser.dynamicImportPrefetch?.toString(),
|
|
474
|
-
dynamicImportFetchPriority: parser.dynamicImportFetchPriority,
|
|
475
|
-
importMeta: parser.importMeta,
|
|
476
|
-
url: parser.url?.toString(),
|
|
477
|
-
exprContextCritical: parser.exprContextCritical,
|
|
478
|
-
wrappedContextCritical: parser.wrappedContextCritical,
|
|
479
|
-
exportsPresence: parser.exportsPresence === false ? "false" : parser.exportsPresence,
|
|
480
|
-
importExportsPresence: parser.importExportsPresence === false
|
|
481
|
-
? "false"
|
|
482
|
-
: parser.importExportsPresence,
|
|
483
|
-
reexportExportsPresence: parser.reexportExportsPresence === false
|
|
484
|
-
? "false"
|
|
485
|
-
: parser.reexportExportsPresence,
|
|
486
|
-
strictExportPresence: parser.strictExportPresence,
|
|
487
|
-
worker: typeof parser.worker === "boolean"
|
|
488
|
-
? parser.worker
|
|
489
|
-
? ["..."]
|
|
490
|
-
: []
|
|
491
|
-
: parser.worker,
|
|
492
|
-
overrideStrict: parser.overrideStrict,
|
|
493
|
-
requireAsExpression: parser.requireAsExpression,
|
|
494
|
-
requireDynamic: parser.requireDynamic,
|
|
495
|
-
requireResolve: parser.requireResolve,
|
|
496
|
-
importDynamic: parser.importDynamic
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
function getRawAssetParserOptions(parser) {
|
|
500
|
-
return {
|
|
501
|
-
dataUrlCondition: parser.dataUrlCondition
|
|
502
|
-
? getRawAssetParserDataUrl(parser.dataUrlCondition)
|
|
503
|
-
: undefined
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
|
-
function getRawAssetParserDataUrl(dataUrlCondition) {
|
|
507
|
-
if (typeof dataUrlCondition === "object" && dataUrlCondition !== null) {
|
|
508
|
-
return {
|
|
509
|
-
type: "options",
|
|
510
|
-
options: {
|
|
511
|
-
maxSize: dataUrlCondition.maxSize
|
|
512
|
-
}
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
throw new Error(`unreachable: AssetParserDataUrl type should be one of "options", but got ${dataUrlCondition}`);
|
|
516
|
-
}
|
|
517
|
-
function getRawCssParserOptions(parser) {
|
|
518
|
-
return {
|
|
519
|
-
namedExports: parser.namedExports
|
|
520
|
-
};
|
|
521
|
-
}
|
|
522
|
-
function getRawGeneratorOptions(generator, type) {
|
|
523
|
-
if (type === "asset") {
|
|
524
|
-
return {
|
|
525
|
-
type: "asset",
|
|
526
|
-
asset: generator ? getRawAssetGeneratorOptions(generator) : undefined
|
|
527
|
-
};
|
|
528
|
-
}
|
|
529
|
-
if (type === "asset/inline") {
|
|
530
|
-
return {
|
|
531
|
-
type: "asset/inline",
|
|
532
|
-
assetInline: generator
|
|
533
|
-
? getRawAssetInlineGeneratorOptions(generator)
|
|
534
|
-
: undefined
|
|
535
|
-
};
|
|
536
|
-
}
|
|
537
|
-
if (type === "asset/resource") {
|
|
538
|
-
return {
|
|
539
|
-
type: "asset/resource",
|
|
540
|
-
assetResource: generator
|
|
541
|
-
? getRawAssetResourceGeneratorOptions(generator)
|
|
542
|
-
: undefined
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
|
-
if (type === "css") {
|
|
546
|
-
return {
|
|
547
|
-
type: "css",
|
|
548
|
-
css: getRawCssGeneratorOptions(generator)
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
if (type === "css/auto") {
|
|
552
|
-
return {
|
|
553
|
-
type: "css/auto",
|
|
554
|
-
cssAuto: getRawCssAutoOrModuleGeneratorOptions(generator)
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
if (type === "css/module") {
|
|
558
|
-
return {
|
|
559
|
-
type: "css/module",
|
|
560
|
-
cssModule: getRawCssAutoOrModuleGeneratorOptions(generator)
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
if ([
|
|
564
|
-
"javascript",
|
|
565
|
-
"javascript/auto",
|
|
566
|
-
"javascript/dynamic",
|
|
567
|
-
"javascript/esm"
|
|
568
|
-
].includes(type)) {
|
|
569
|
-
return undefined;
|
|
570
|
-
}
|
|
571
|
-
throw new Error(`unreachable: unknow module type: ${type}`);
|
|
572
|
-
}
|
|
573
|
-
function getRawAssetGeneratorOptions(options) {
|
|
574
|
-
return {
|
|
575
|
-
...getRawAssetInlineGeneratorOptions(options),
|
|
576
|
-
...getRawAssetResourceGeneratorOptions(options)
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
function getRawAssetInlineGeneratorOptions(options) {
|
|
580
|
-
return {
|
|
581
|
-
dataUrl: options.dataUrl
|
|
582
|
-
? getRawAssetGeneratorDataUrl(options.dataUrl)
|
|
583
|
-
: undefined
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
function getRawAssetResourceGeneratorOptions(options) {
|
|
587
|
-
return {
|
|
588
|
-
emit: options.emit,
|
|
589
|
-
filename: options.filename,
|
|
590
|
-
publicPath: options.publicPath
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
function getRawAssetGeneratorDataUrl(dataUrl) {
|
|
594
|
-
if (typeof dataUrl === "object" && dataUrl !== null) {
|
|
595
|
-
const encoding = dataUrl.encoding === false ? "false" : dataUrl.encoding;
|
|
596
|
-
return {
|
|
597
|
-
encoding,
|
|
598
|
-
mimetype: dataUrl.mimetype
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
if (typeof dataUrl === "function" && dataUrl !== null) {
|
|
602
|
-
return dataUrl;
|
|
603
|
-
}
|
|
604
|
-
throw new Error(`unreachable: AssetGeneratorDataUrl type should be one of "options", "function", but got ${dataUrl}`);
|
|
605
|
-
}
|
|
606
|
-
function getRawCssGeneratorOptions(options) {
|
|
607
|
-
return {
|
|
608
|
-
exportsOnly: options.exportsOnly,
|
|
609
|
-
esModule: options.esModule
|
|
610
|
-
};
|
|
611
|
-
}
|
|
612
|
-
function getRawCssAutoOrModuleGeneratorOptions(options) {
|
|
613
|
-
return {
|
|
614
|
-
localIdentName: options.localIdentName,
|
|
615
|
-
exportsConvention: options.exportsConvention,
|
|
616
|
-
exportsOnly: options.exportsOnly,
|
|
617
|
-
esModule: options.esModule
|
|
618
|
-
};
|
|
619
|
-
}
|
|
620
|
-
function getRawOptimization(optimization) {
|
|
621
|
-
(0, node_assert_1.default)(!(0, util_1.isNil)(optimization.removeAvailableModules) &&
|
|
622
|
-
!(0, util_1.isNil)(optimization.sideEffects) &&
|
|
623
|
-
!(0, util_1.isNil)(optimization.realContentHash) &&
|
|
624
|
-
!(0, util_1.isNil)(optimization.providedExports) &&
|
|
625
|
-
!(0, util_1.isNil)(optimization.usedExports) &&
|
|
626
|
-
!(0, util_1.isNil)(optimization.innerGraph) &&
|
|
627
|
-
"optimization.moduleIds, optimization.removeAvailableModules, optimization.removeEmptyChunks, optimization.sideEffects, optimization.realContentHash, optimization.providedExports, optimization.usedExports, optimization.innerGraph, optimization.concatenateModules should not be nil after defaults");
|
|
628
|
-
return {
|
|
629
|
-
removeAvailableModules: optimization.removeAvailableModules,
|
|
630
|
-
sideEffects: String(optimization.sideEffects),
|
|
631
|
-
usedExports: String(optimization.usedExports),
|
|
632
|
-
providedExports: optimization.providedExports,
|
|
633
|
-
innerGraph: optimization.innerGraph,
|
|
634
|
-
concatenateModules: !!optimization.concatenateModules,
|
|
635
|
-
mangleExports: String(optimization.mangleExports)
|
|
636
|
-
};
|
|
637
|
-
}
|
|
638
|
-
function getRawSnapshotOptions(_snapshot) {
|
|
639
|
-
return {};
|
|
640
|
-
}
|
|
641
|
-
function getRawExperiments(experiments) {
|
|
642
|
-
const { topLevelAwait, layers, incremental, rspackFuture } = experiments;
|
|
643
|
-
(0, node_assert_1.default)(!(0, util_1.isNil)(topLevelAwait) &&
|
|
644
|
-
!(0, util_1.isNil)(rspackFuture) &&
|
|
645
|
-
!(0, util_1.isNil)(layers) &&
|
|
646
|
-
!(0, util_1.isNil)(incremental));
|
|
647
|
-
return {
|
|
648
|
-
layers,
|
|
649
|
-
topLevelAwait,
|
|
650
|
-
incremental: getRawIncremental(incremental),
|
|
651
|
-
rspackFuture: getRawRspackFutureOptions(rspackFuture)
|
|
652
|
-
};
|
|
653
|
-
}
|
|
654
|
-
function getRawIncremental(incremental) {
|
|
655
|
-
if (incremental === false) {
|
|
656
|
-
return undefined;
|
|
657
|
-
}
|
|
658
|
-
return {
|
|
659
|
-
make: incremental.make,
|
|
660
|
-
emitAssets: incremental.emitAssets,
|
|
661
|
-
inferAsyncModules: incremental.inferAsyncModules,
|
|
662
|
-
providedExports: incremental.providedExports,
|
|
663
|
-
moduleHashes: incremental.moduleHashes,
|
|
664
|
-
moduleCodegen: incremental.moduleCodegen,
|
|
665
|
-
moduleRuntimeRequirements: incremental.moduleRuntimeRequirements
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
function getRawRspackFutureOptions(future) {
|
|
669
|
-
return {};
|
|
670
|
-
}
|
|
671
|
-
function getRawNode(node) {
|
|
672
|
-
if (node === false) {
|
|
673
|
-
return undefined;
|
|
674
|
-
}
|
|
675
|
-
(0, node_assert_1.default)(!(0, util_1.isNil)(node.__dirname) && !(0, util_1.isNil)(node.global) && !(0, util_1.isNil)(node.__filename));
|
|
676
|
-
return {
|
|
677
|
-
dirname: String(node.__dirname),
|
|
678
|
-
filename: String(node.__filename),
|
|
679
|
-
global: String(node.global)
|
|
680
|
-
};
|
|
681
|
-
}
|
|
682
|
-
function getRawStats(stats) {
|
|
683
|
-
const statsOptions = (0, Stats_1.normalizeStatsPreset)(stats);
|
|
684
|
-
return {
|
|
685
|
-
colors: statsOptions.colors ?? false
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
function getRawChunkLoading(chunkLoading) {
|
|
689
|
-
return chunkLoading === false ? "false" : chunkLoading;
|
|
690
|
-
}
|
|
691
|
-
exports.getRawChunkLoading = getRawChunkLoading;
|