@rspack/core 1.0.0-alpha.2 → 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/ChunkGraph.d.ts +1 -1
- package/dist/Compilation.d.ts +9 -9
- package/dist/Compilation.js +27 -24
- package/dist/Compiler.d.ts +6 -6
- package/dist/Compiler.js +5 -6
- package/dist/ContextModuleFactory.d.ts +1 -1
- package/dist/ErrorHelpers.d.ts +16 -7
- package/dist/ErrorHelpers.js +34 -33
- package/dist/ExecuteModulePlugin.js +1 -1
- package/dist/FileSystem.d.ts +2 -2
- package/dist/Module.d.ts +5 -5
- package/dist/Module.js +3 -6
- package/dist/MultiCompiler.d.ts +3 -3
- package/dist/MultiCompiler.js +1 -1
- package/dist/MultiStats.d.ts +2 -2
- package/dist/MultiWatching.d.ts +2 -2
- package/dist/NormalModule.d.ts +1 -1
- package/dist/NormalModuleFactory.d.ts +1 -1
- package/dist/Resolver.d.ts +19 -0
- package/dist/Resolver.js +39 -0
- package/dist/ResolverFactory.d.ts +12 -46
- package/dist/ResolverFactory.js +55 -120
- package/dist/RspackError.d.ts +1 -1
- package/dist/RuntimeGlobals.d.ts +1 -1
- package/dist/RuntimeGlobals.js +3 -3
- package/dist/Stats.d.ts +2 -2
- package/dist/Stats.js +4 -4
- package/dist/Template.js +2 -2
- package/dist/Watching.d.ts +3 -3
- package/dist/builtin-loader/swc/index.d.ts +0 -2
- package/dist/builtin-loader/swc/index.js +1 -3
- package/dist/builtin-loader/swc/pluginImport.d.ts +17 -1
- package/dist/builtin-loader/swc/react.d.ts +11 -1
- package/dist/builtin-plugin/APIPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +3 -3
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/BannerPlugin.d.ts +25 -4
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +3 -3
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +3 -3
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DataUriPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DefinePlugin.d.ts +10 -4
- package/dist/builtin-plugin/DefinePlugin.js +42 -8
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +5 -5
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +2 -2
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EntryPlugin.d.ts +5 -5
- package/dist/builtin-plugin/EntryPlugin.js +1 -1
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +4 -4
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +5 -5
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +22 -6
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FileUriPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +3 -3
- package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +2 -2
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +19 -4
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/IgnorePlugin.d.ts +4 -4
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +2 -2
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +4 -4
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ProgressPlugin.d.ts +4 -4
- package/dist/builtin-plugin/ProvidePlugin.d.ts +3 -3
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +3 -3
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +3 -3
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +4 -4
- package/dist/builtin-plugin/RuntimePlugin.d.ts +3 -3
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +3 -3
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +9 -4
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +4 -4
- package/dist/builtin-plugin/SplitChunksPlugin.d.ts +3 -3
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +12 -4
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.js +7 -1
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +4 -4
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +2 -2
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +3 -3
- package/dist/builtin-plugin/WorkerPlugin.d.ts +3 -3
- package/dist/builtin-plugin/WorkerPlugin.js +5 -1
- package/dist/builtin-plugin/base.d.ts +6 -6
- package/dist/builtin-plugin/base.js +4 -4
- package/dist/builtin-plugin/css-extract/index.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/loader.js +15 -5
- package/dist/builtin-plugin/css-extract/utils.d.ts +1 -1
- package/dist/builtin-plugin/index.d.ts +1 -7
- package/dist/builtin-plugin/index.js +3 -17
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +11 -17
- package/dist/builtin-plugin/lazy-compilation/plugin.d.ts +2 -2
- package/dist/config/adapter.d.ts +5 -4
- package/dist/config/adapter.js +23 -11
- package/dist/config/adapterRuleUse.d.ts +7 -7
- package/dist/config/adapterRuleUse.js +1 -1
- package/dist/config/browserslistTargetHandler.js +1 -1
- package/dist/config/defaults.d.ts +1 -1
- package/dist/config/defaults.js +4 -3
- package/dist/config/zod.d.ts +491 -384
- package/dist/config/zod.js +44 -42
- package/dist/container/ContainerPlugin.d.ts +3 -3
- package/dist/container/ContainerReferencePlugin.d.ts +4 -4
- package/dist/container/ModuleFederationPlugin.d.ts +2 -2
- package/dist/container/ModuleFederationPlugin.js +2 -2
- package/dist/container/ModuleFederationPluginV1.d.ts +5 -5
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +3 -3
- package/dist/container/default.runtime.js +1 -1
- package/dist/lib/EntryOptionPlugin.d.ts +2 -2
- package/dist/lib/NormalModuleReplacementPlugin.d.ts +2 -2
- package/dist/loader-runner/index.d.ts +2 -2
- package/dist/loader-runner/index.js +38 -51
- package/dist/loader-runner/loadLoader.js +1 -1
- package/dist/logging/runtime.js +1 -1
- package/dist/node/NodeTemplatePlugin.d.ts +1 -1
- package/dist/node/NodeWatchFileSystem.d.ts +1 -1
- package/dist/rspack.d.ts +3 -3
- package/dist/rspack.js +1 -1
- package/dist/rspackOptionsApply.d.ts +1 -1
- package/dist/rspackOptionsApply.js +1 -19
- package/dist/sharing/ConsumeSharedPlugin.d.ts +2 -2
- package/dist/sharing/ConsumeSharedPlugin.js +1 -1
- package/dist/sharing/ProvideSharedPlugin.d.ts +2 -2
- package/dist/sharing/SharePlugin.d.ts +1 -1
- package/dist/sharing/ShareRuntimePlugin.d.ts +2 -2
- package/dist/stats/DefaultStatsFactoryPlugin.js +246 -46
- package/dist/stats/DefaultStatsPresetPlugin.js +17 -17
- package/dist/stats/DefaultStatsPrinterPlugin.js +1 -1
- package/dist/stats/StatsFactory.d.ts +2 -2
- package/dist/stats/statsFactoryUtils.d.ts +16 -1
- package/dist/util/SplitChunkSize.d.ts +1 -1
- package/dist/util/bindingVersionCheck.js +1 -1
- package/dist/util/comparators.d.ts +1 -1
- package/dist/util/fs.d.ts +1 -1
- package/dist/util/identifier.d.ts +65 -62
- package/dist/util/identifier.js +30 -55
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.js +4 -2
- package/dist/util/validate.d.ts +1 -1
- package/package.json +7 -34
package/dist/config/zod.js
CHANGED
|
@@ -259,7 +259,6 @@ const baseResolveOptions = zod_1.z.strictObject({
|
|
|
259
259
|
const resolveOptions = baseResolveOptions.extend({
|
|
260
260
|
byDependency: zod_1.z.lazy(() => zod_1.z.record(resolveOptions)).optional()
|
|
261
261
|
});
|
|
262
|
-
const resolve = resolveOptions;
|
|
263
262
|
//#endregion
|
|
264
263
|
//#region Module
|
|
265
264
|
const baseRuleSetCondition = zod_1.z
|
|
@@ -346,6 +345,7 @@ const reexportExportsPresence = zod_1.z
|
|
|
346
345
|
.or(zod_1.z.literal(false));
|
|
347
346
|
const strictExportPresence = zod_1.z.boolean();
|
|
348
347
|
const worker = zod_1.z.array(zod_1.z.string()).or(zod_1.z.boolean());
|
|
348
|
+
const overrideStrict = zod_1.z.enum(["strict", "non-strict"]);
|
|
349
349
|
const javascriptParserOptions = zod_1.z.strictObject({
|
|
350
350
|
dynamicImportMode: dynamicImportMode.optional(),
|
|
351
351
|
dynamicImportPreload: dynamicImportPreload.optional(),
|
|
@@ -358,7 +358,8 @@ const javascriptParserOptions = zod_1.z.strictObject({
|
|
|
358
358
|
importExportsPresence: importExportsPresence.optional(),
|
|
359
359
|
reexportExportsPresence: reexportExportsPresence.optional(),
|
|
360
360
|
strictExportPresence: strictExportPresence.optional(),
|
|
361
|
-
worker: worker.optional()
|
|
361
|
+
worker: worker.optional(),
|
|
362
|
+
overrideStrict: overrideStrict.optional()
|
|
362
363
|
});
|
|
363
364
|
const parserOptionsByModuleTypeKnown = zod_1.z.strictObject({
|
|
364
365
|
asset: assetParserOptions.optional(),
|
|
@@ -443,44 +444,45 @@ const moduleOptions = zod_1.z.strictObject({
|
|
|
443
444
|
});
|
|
444
445
|
//#endregion
|
|
445
446
|
//#region Target
|
|
446
|
-
const allowTarget = zod_1.z
|
|
447
|
-
.enum([
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
])
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
447
|
+
const allowTarget = zod_1.z.union([
|
|
448
|
+
zod_1.z.enum([
|
|
449
|
+
"web",
|
|
450
|
+
"webworker",
|
|
451
|
+
"es3",
|
|
452
|
+
"es5",
|
|
453
|
+
"es2015",
|
|
454
|
+
"es2016",
|
|
455
|
+
"es2017",
|
|
456
|
+
"es2018",
|
|
457
|
+
"es2019",
|
|
458
|
+
"es2020",
|
|
459
|
+
"es2021",
|
|
460
|
+
"es2022",
|
|
461
|
+
"browserslist"
|
|
462
|
+
]),
|
|
463
|
+
zod_1.z.literal("node"),
|
|
464
|
+
zod_1.z.literal("async-node"),
|
|
465
|
+
zod_1.z.custom(value => typeof value === "string" && /^node\d+$/.test(value)),
|
|
466
|
+
zod_1.z.custom(value => typeof value === "string" && /^async-node\d+$/.test(value)),
|
|
467
|
+
zod_1.z.custom(value => typeof value === "string" && /^node\d+\.\d+$/.test(value)),
|
|
468
|
+
zod_1.z.custom(value => typeof value === "string" && /^async-node\d+\.\d+$/.test(value)),
|
|
469
|
+
zod_1.z.literal("electron-main"),
|
|
470
|
+
zod_1.z.custom(value => typeof value === "string" && /^electron\d+-main$/.test(value)),
|
|
471
|
+
zod_1.z.custom(value => typeof value === "string" && /^electron\d+\.\d+-main$/.test(value)),
|
|
472
|
+
zod_1.z.literal("electron-renderer"),
|
|
473
|
+
zod_1.z.custom(value => typeof value === "string" && /^electron\d+-renderer$/.test(value)),
|
|
474
|
+
zod_1.z.custom(value => typeof value === "string" && /^electron\d+\.\d+-renderer$/.test(value)),
|
|
475
|
+
zod_1.z.literal("electron-preload"),
|
|
476
|
+
zod_1.z.custom(value => typeof value === "string" && /^electron\d+-preload$/.test(value)),
|
|
477
|
+
zod_1.z.custom(value => typeof value === "string" && /^electron\d+\.\d+-preload$/.test(value)),
|
|
478
|
+
zod_1.z.literal("nwjs"),
|
|
479
|
+
zod_1.z.custom(value => typeof value === "string" && /^nwjs\d+$/.test(value)),
|
|
480
|
+
zod_1.z.custom(value => typeof value === "string" && /^nwjs\d+\.\d+$/.test(value)),
|
|
481
|
+
zod_1.z.literal("node-webkit"),
|
|
482
|
+
zod_1.z.custom(value => typeof value === "string" && /^node-webkit\d+$/.test(value)),
|
|
483
|
+
zod_1.z.custom(value => typeof value === "string" && /^node-webkit\d+\.\d+$/.test(value))
|
|
484
|
+
]);
|
|
485
|
+
const target = zod_1.z.union([zod_1.z.literal(false), allowTarget, allowTarget.array()]);
|
|
484
486
|
//#endregion
|
|
485
487
|
//#region ExternalsType
|
|
486
488
|
exports.externalsType = zod_1.z.enum([
|
|
@@ -915,8 +917,8 @@ exports.rspackOptions = zod_1.z.strictObject({
|
|
|
915
917
|
stats: statsValue.optional(),
|
|
916
918
|
snapshot: snapshotOptions.optional(),
|
|
917
919
|
optimization: optimization.optional(),
|
|
918
|
-
resolve:
|
|
919
|
-
resolveLoader:
|
|
920
|
+
resolve: resolveOptions.optional(),
|
|
921
|
+
resolveLoader: resolveOptions.optional(),
|
|
920
922
|
plugins: plugins.optional(),
|
|
921
923
|
devServer: devServer.optional(),
|
|
922
924
|
module: moduleOptions.optional(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
import { Compiler } from "../Compiler";
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
3
|
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
4
|
-
import { EntryRuntime, FilenameTemplate, LibraryOptions } from "../config";
|
|
4
|
+
import { type EntryRuntime, type FilenameTemplate, type LibraryOptions } from "../config";
|
|
5
5
|
export type ContainerPluginOptions = {
|
|
6
6
|
exposes: Exposes;
|
|
7
7
|
filename?: FilenameTemplate;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
import { Compiler } from "../Compiler";
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
3
|
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
4
|
-
import { ExternalsType } from "../config";
|
|
4
|
+
import type { ExternalsType } from "../config";
|
|
5
5
|
export type ContainerReferencePluginOptions = {
|
|
6
6
|
remoteType: ExternalsType;
|
|
7
7
|
remotes: Remotes;
|
|
@@ -21,7 +21,7 @@ export type RemotesConfig = {
|
|
|
21
21
|
export declare class ContainerReferencePlugin extends RspackBuiltinPlugin {
|
|
22
22
|
name: BuiltinPluginName;
|
|
23
23
|
_options: {
|
|
24
|
-
remoteType: "
|
|
24
|
+
remoteType: "promise" | "module" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "system" | "script" | "node-commonjs";
|
|
25
25
|
remotes: [string, {
|
|
26
26
|
external: string[];
|
|
27
27
|
shareScope: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Compiler } from "../Compiler";
|
|
2
|
-
import {
|
|
1
|
+
import type { Compiler } from "../Compiler";
|
|
2
|
+
import type { ModuleFederationPluginV1Options } from "./ModuleFederationPluginV1";
|
|
3
3
|
export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPluginV1Options, "enhanced"> {
|
|
4
4
|
runtimePlugins?: RuntimePlugins;
|
|
5
5
|
implementation?: string;
|
|
@@ -71,8 +71,8 @@ function getRemoteInfos(options) {
|
|
|
71
71
|
shareScope: item.shareScope || options.shareScope || "default"
|
|
72
72
|
}));
|
|
73
73
|
const remoteInfos = {};
|
|
74
|
-
for (
|
|
75
|
-
for (
|
|
74
|
+
for (const [key, config] of remotes) {
|
|
75
|
+
for (const external of config.external) {
|
|
76
76
|
const [externalType, externalRequest] = getExternal(external);
|
|
77
77
|
remoteInfos[key] ??= [];
|
|
78
78
|
if (externalType === "script") {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Compiler } from "../Compiler";
|
|
2
|
-
import { EntryRuntime, ExternalsType, LibraryOptions } from "../config";
|
|
3
|
-
import { Shared } from "../sharing/SharePlugin";
|
|
4
|
-
import { Exposes } from "./ContainerPlugin";
|
|
5
|
-
import { Remotes } from "./ContainerReferencePlugin";
|
|
1
|
+
import type { Compiler } from "../Compiler";
|
|
2
|
+
import { type EntryRuntime, type ExternalsType, type LibraryOptions } from "../config";
|
|
3
|
+
import { type Shared } from "../sharing/SharePlugin";
|
|
4
|
+
import { type Exposes } from "./ContainerPlugin";
|
|
5
|
+
import { type Remotes } from "./ContainerReferencePlugin";
|
|
6
6
|
export interface ModuleFederationPluginV1Options {
|
|
7
7
|
exposes?: Exposes;
|
|
8
8
|
filename?: string;
|
|
@@ -2,9 +2,9 @@ import { BuiltinPluginName } from "@rspack/binding";
|
|
|
2
2
|
export declare const ModuleFederationRuntimePlugin: {
|
|
3
3
|
new (): {
|
|
4
4
|
name: BuiltinPluginName;
|
|
5
|
-
|
|
6
|
-
affectedHooks: "
|
|
7
|
-
raw(): import("@rspack/binding").BuiltinPlugin;
|
|
5
|
+
_args: [];
|
|
6
|
+
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
|
+
raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
8
8
|
apply(compiler: import("../Compiler").Compiler): void;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __module_federation_bundler_runtime__,__module_federation_runtime_plugins__,__module_federation_remote_infos__,__module_federation_container_name__;module.exports=function(){if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){const override=(obj,key,value)=>{if(!obj)return;if(obj[key])obj[key]=value};const merge=(obj,key,fn)=>{const value=fn();if(Array.isArray(value)){obj[key]
|
|
1
|
+
var __module_federation_bundler_runtime__,__module_federation_runtime_plugins__,__module_federation_remote_infos__,__module_federation_container_name__;module.exports=function(){if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){var __webpack_require___remotesLoadingData,__webpack_require___remotesLoadingData1,__webpack_require___initializeSharingData,__webpack_require___consumesLoadingData,__webpack_require___consumesLoadingData1,__webpack_require___initializeExposesData,__webpack_require___consumesLoadingData2;const override=(obj,key,value)=>{if(!obj)return;if(obj[key])obj[key]=value};const merge=(obj,key,fn)=>{const value=fn();if(Array.isArray(value)){var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){var _obj1,_key1;var _1;(_1=(_obj1=obj)[_key1=key])!==null&&_1!==void 0?_1:_obj1[_key1]={};Object.assign(obj[key],value)}};const early=(obj,key,initial)=>{var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=initial()};var __webpack_require___remotesLoadingData_chunkMapping;const remotesLoadingChunkMapping=(__webpack_require___remotesLoadingData_chunkMapping=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&__webpack_require___remotesLoadingData_chunkMapping!==void 0?__webpack_require___remotesLoadingData_chunkMapping:{};var __webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping;const remotesLoadingModuleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping!==void 0?__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping:{};var __webpack_require___initializeSharingData_scopeToSharingDataMapping;const initializeSharingScopeToInitDataMapping=(__webpack_require___initializeSharingData_scopeToSharingDataMapping=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&__webpack_require___initializeSharingData_scopeToSharingDataMapping!==void 0?__webpack_require___initializeSharingData_scopeToSharingDataMapping:{};var __webpack_require___consumesLoadingData_chunkMapping;const consumesLoadingChunkMapping=(__webpack_require___consumesLoadingData_chunkMapping=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&__webpack_require___consumesLoadingData_chunkMapping!==void 0?__webpack_require___consumesLoadingData_chunkMapping:{};var __webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping;const consumesLoadingModuleToConsumeDataMapping=(__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping!==void 0?__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping:{};const consumesLoadinginstalledModules={};const initializeSharingInitPromises=[];const initializeSharingInitTokens=[];const containerShareScope=(__webpack_require___initializeExposesData=__webpack_require__.initializeExposesData)===null||__webpack_require___initializeExposesData===void 0?void 0:__webpack_require___initializeExposesData.shareScope;for(const key in __module_federation_bundler_runtime__){__webpack_require__.federation[key]=__module_federation_bundler_runtime__[key]}early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){consumesLoadingModuleToHandlerMapping[moduleId]={getter:data.fallback,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey}}return consumesLoadingModuleToHandlerMapping});early(__webpack_require__.federation,"initOptions",()=>({}));early(__webpack_require__.federation.initOptions,"name",()=>__module_federation_container_name__);early(__webpack_require__.federation.initOptions,"shared",()=>{const shared={};for(let[scope,stages]of Object.entries(initializeSharingScopeToInitDataMapping)){for(let stage of stages){if(typeof stage==="object"&&stage!==null){const{name,version,factory,eager}=stage;const options={version,scope:[scope],get:factory};if(shared[name]){shared[name].push(options)}else{shared[name]=[options]}}}}return shared});merge(__webpack_require__.federation.initOptions,"remotes",()=>Object.values(__module_federation_remote_infos__).flat().filter(remote=>remote.externalType==="script"));merge(__webpack_require__.federation.initOptions,"plugins",()=>__module_federation_runtime_plugins__);early(__webpack_require__.federation,"bundlerRuntimeOptions",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions,"remotes",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"chunkMapping",()=>remotesLoadingChunkMapping);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",()=>{const remotesLoadingIdToExternalAndNameMappingMapping={};for(let[moduleId,data]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){remotesLoadingIdToExternalAndNameMappingMapping[moduleId]=[data.shareScope,data.name,data.externalModuleId,data.remoteName]}return remotesLoadingIdToExternalAndNameMappingMapping});early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"webpackRequire",()=>__webpack_require__);merge(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",()=>{const idToRemoteMap={};for(let[id,remoteData]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){const info=__module_federation_remote_infos__[remoteData.remoteName];if(info)idToRemoteMap[id]=info}return idToRemoteMap});override(__webpack_require__,"S",__webpack_require__.federation.bundlerRuntime.S);if(__webpack_require__.federation.attachShareScopeMap){__webpack_require__.federation.attachShareScopeMap(__webpack_require__)}override(__webpack_require__.f,"remotes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.remotes({chunkId,promises,chunkMapping:remotesLoadingChunkMapping,idToExternalAndNameMapping:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:__webpack_require__}));override(__webpack_require__.f,"consumes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.consumes({chunkId,promises,chunkMapping:consumesLoadingChunkMapping,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping,installedModules:consumesLoadinginstalledModules,webpackRequire:__webpack_require__}));override(__webpack_require__,"I",(name,initScope)=>__webpack_require__.federation.bundlerRuntime.I({shareScopeName:name,initScope,initPromises:initializeSharingInitPromises,initTokens:initializeSharingInitTokens,webpackRequire:__webpack_require__}));override(__webpack_require__,"initContainer",(shareScope,initScope,remoteEntryInitOptions)=>__webpack_require__.federation.bundlerRuntime.initContainerEntry({shareScope,initScope,remoteEntryInitOptions,shareScopeKey:containerShareScope,webpackRequire:__webpack_require__}));override(__webpack_require__,"getContainer",(module1,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module1)?moduleMap[module1]():Promise.resolve().then(()=>{throw new Error('Module "'+module1+'" does not exist in container.')});__webpack_require__.R=undefined;return getScope});__webpack_require__.federation.instance=__webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);if((__webpack_require___consumesLoadingData2=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData2===void 0?void 0:__webpack_require___consumesLoadingData2.initialConsumes){__webpack_require__.federation.bundlerRuntime.installInitialConsumes({webpackRequire:__webpack_require__,installedModules:consumesLoadinginstalledModules,initialConsumes:__webpack_require__.consumesLoadingData.initialConsumes,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping})}}};
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import { Compiler, EntryDescriptionNormalized, EntryNormalized } from "..";
|
|
11
|
-
import { EntryOptions } from "../builtin-plugin";
|
|
10
|
+
import type { Compiler, EntryDescriptionNormalized, EntryNormalized } from "..";
|
|
11
|
+
import { type EntryOptions } from "../builtin-plugin";
|
|
12
12
|
export default class EntryOptionPlugin {
|
|
13
13
|
apply(compiler: Compiler): void;
|
|
14
14
|
static applyEntryOption(compiler: Compiler, context: string, entry: EntryNormalized): void;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed with [MIT License]{@link http://www.opensource.org/licenses/mit-license.php}
|
|
4
4
|
* Original Author Tobias Koppers @sokra
|
|
5
5
|
*/
|
|
6
|
-
import { Compiler } from "../Compiler";
|
|
7
|
-
import { ResolveData } from "../Module";
|
|
6
|
+
import type { Compiler } from "../Compiler";
|
|
7
|
+
import type { ResolveData } from "../Module";
|
|
8
8
|
type ModuleReplacer = (createData: ResolveData) => void;
|
|
9
9
|
export declare class NormalModuleReplacementPlugin {
|
|
10
10
|
readonly resourceRegExp: RegExp;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/loader-runner/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import { JsLoaderContext, JsLoaderItem } from "@rspack/binding";
|
|
11
|
-
import { Compiler } from "../Compiler";
|
|
10
|
+
import { type JsLoaderContext, type JsLoaderItem } from "@rspack/binding";
|
|
11
|
+
import type { Compiler } from "../Compiler";
|
|
12
12
|
export declare class LoaderObject {
|
|
13
13
|
#private;
|
|
14
14
|
request: string;
|
|
@@ -55,16 +55,14 @@ function createLoaderObject(loader, compiler) {
|
|
|
55
55
|
};
|
|
56
56
|
Object.defineProperty(obj, "request", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
set: function (value) {
|
|
64
|
-
var splittedRequest = (0, identifier_1.parseResourceWithoutFragment)(value.request);
|
|
58
|
+
get: () => obj.path.replace(/#/g, "\u200b#") +
|
|
59
|
+
obj.query.replace(/#/g, "\u200b#") +
|
|
60
|
+
obj.fragment,
|
|
61
|
+
set: value => {
|
|
62
|
+
const splittedRequest = (0, identifier_1.parseResourceWithoutFragment)(value.request);
|
|
65
63
|
obj.path = splittedRequest.path;
|
|
66
64
|
obj.query = splittedRequest.query;
|
|
67
|
-
obj.fragment =
|
|
65
|
+
obj.fragment = "";
|
|
68
66
|
obj.options =
|
|
69
67
|
obj.options === null
|
|
70
68
|
? splittedRequest.query
|
|
@@ -191,7 +189,7 @@ const runSyncOrAsync = (0, util_1.promisify)(function runSyncOrAsync(fn, context
|
|
|
191
189
|
isSync = false;
|
|
192
190
|
return innerCallback;
|
|
193
191
|
};
|
|
194
|
-
const innerCallback = (context.callback =
|
|
192
|
+
const innerCallback = (context.callback = (err, ...args) => {
|
|
195
193
|
if (isDone) {
|
|
196
194
|
if (reportedError)
|
|
197
195
|
return; // ignore
|
|
@@ -222,7 +220,7 @@ const runSyncOrAsync = (0, util_1.promisify)(function runSyncOrAsync(fn, context
|
|
|
222
220
|
if (result &&
|
|
223
221
|
typeof result === "object" &&
|
|
224
222
|
typeof result.then === "function") {
|
|
225
|
-
result.then(
|
|
223
|
+
result.then((r) => {
|
|
226
224
|
callback(null, [r]);
|
|
227
225
|
}, callback);
|
|
228
226
|
return;
|
|
@@ -232,6 +230,11 @@ const runSyncOrAsync = (0, util_1.promisify)(function runSyncOrAsync(fn, context
|
|
|
232
230
|
}
|
|
233
231
|
}
|
|
234
232
|
catch (e) {
|
|
233
|
+
// use string for napi getter
|
|
234
|
+
const err = e;
|
|
235
|
+
if ("hideStack" in err && err.hideStack) {
|
|
236
|
+
err.hideStack = "true";
|
|
237
|
+
}
|
|
235
238
|
if (isError)
|
|
236
239
|
throw e;
|
|
237
240
|
if (isDone) {
|
|
@@ -388,14 +391,14 @@ async function runLoaders(compiler, context) {
|
|
|
388
391
|
};
|
|
389
392
|
Object.defineProperty(loaderContext, "resource", {
|
|
390
393
|
enumerable: true,
|
|
391
|
-
get:
|
|
394
|
+
get: () => {
|
|
392
395
|
if (loaderContext.resourcePath === undefined)
|
|
393
396
|
return undefined;
|
|
394
397
|
return (loaderContext.resourcePath.replace(/#/g, "\u200b#") +
|
|
395
398
|
loaderContext.resourceQuery.replace(/#/g, "\u200b#") +
|
|
396
399
|
loaderContext.resourceFragment);
|
|
397
400
|
},
|
|
398
|
-
set:
|
|
401
|
+
set: value => {
|
|
399
402
|
const splittedResource = value && parsePathQueryFragment(value);
|
|
400
403
|
loaderContext.resourcePath = splittedResource
|
|
401
404
|
? splittedResource.path
|
|
@@ -410,56 +413,42 @@ async function runLoaders(compiler, context) {
|
|
|
410
413
|
});
|
|
411
414
|
Object.defineProperty(loaderContext, "request", {
|
|
412
415
|
enumerable: true,
|
|
413
|
-
get:
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
})
|
|
418
|
-
.concat(loaderContext.resource || "")
|
|
419
|
-
.join("!");
|
|
420
|
-
}
|
|
416
|
+
get: () => loaderContext.loaders
|
|
417
|
+
.map(o => o.request)
|
|
418
|
+
.concat(loaderContext.resource || "")
|
|
419
|
+
.join("!")
|
|
421
420
|
});
|
|
422
421
|
Object.defineProperty(loaderContext, "remainingRequest", {
|
|
423
422
|
enumerable: true,
|
|
424
|
-
get:
|
|
423
|
+
get: () => {
|
|
425
424
|
if (loaderContext.loaderIndex >= loaderContext.loaders.length - 1 &&
|
|
426
425
|
!loaderContext.resource)
|
|
427
426
|
return "";
|
|
428
427
|
return loaderContext.loaders
|
|
429
428
|
.slice(loaderContext.loaderIndex + 1)
|
|
430
|
-
.map(
|
|
431
|
-
return o.request;
|
|
432
|
-
})
|
|
429
|
+
.map(o => o.request)
|
|
433
430
|
.concat(loaderContext.resource || "")
|
|
434
431
|
.join("!");
|
|
435
432
|
}
|
|
436
433
|
});
|
|
437
434
|
Object.defineProperty(loaderContext, "currentRequest", {
|
|
438
435
|
enumerable: true,
|
|
439
|
-
get:
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
})
|
|
445
|
-
.concat(loaderContext.resource || "")
|
|
446
|
-
.join("!");
|
|
447
|
-
}
|
|
436
|
+
get: () => loaderContext.loaders
|
|
437
|
+
.slice(loaderContext.loaderIndex)
|
|
438
|
+
.map(o => o.request)
|
|
439
|
+
.concat(loaderContext.resource || "")
|
|
440
|
+
.join("!")
|
|
448
441
|
});
|
|
449
442
|
Object.defineProperty(loaderContext, "previousRequest", {
|
|
450
443
|
enumerable: true,
|
|
451
|
-
get:
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
return o.request;
|
|
456
|
-
})
|
|
457
|
-
.join("!");
|
|
458
|
-
}
|
|
444
|
+
get: () => loaderContext.loaders
|
|
445
|
+
.slice(0, loaderContext.loaderIndex)
|
|
446
|
+
.map(o => o.request)
|
|
447
|
+
.join("!")
|
|
459
448
|
});
|
|
460
449
|
Object.defineProperty(loaderContext, "query", {
|
|
461
450
|
enumerable: true,
|
|
462
|
-
get:
|
|
451
|
+
get: () => {
|
|
463
452
|
const entry = loaderContext.loaders[loaderContext.loaderIndex];
|
|
464
453
|
return entry.options && typeof entry.options === "object"
|
|
465
454
|
? entry.options
|
|
@@ -494,7 +483,7 @@ async function runLoaders(compiler, context) {
|
|
|
494
483
|
}
|
|
495
484
|
};
|
|
496
485
|
};
|
|
497
|
-
const resolver = compiler.resolverFactory.get("normal");
|
|
486
|
+
const resolver = compiler._lastCompilation.resolverFactory.get("normal");
|
|
498
487
|
loaderContext.resolve = function resolve(context, request, callback) {
|
|
499
488
|
resolver.resolve({}, context, request, getResolveContext(), callback);
|
|
500
489
|
};
|
|
@@ -525,10 +514,10 @@ async function runLoaders(compiler, context) {
|
|
|
525
514
|
if (!(error instanceof Error)) {
|
|
526
515
|
error = new RspackError_1.NonErrorEmittedError(error);
|
|
527
516
|
}
|
|
528
|
-
|
|
517
|
+
const hasStack = !!error.stack;
|
|
529
518
|
error.name = "ModuleError";
|
|
530
519
|
error.message = `${error.message} (from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`;
|
|
531
|
-
hasStack && Error.captureStackTrace(error);
|
|
520
|
+
!hasStack && Error.captureStackTrace(error);
|
|
532
521
|
error = (0, util_2.concatErrorMsgAndStack)(error);
|
|
533
522
|
error.moduleIdentifier = this._module.identifier();
|
|
534
523
|
compiler._lastCompilation.__internal__pushDiagnostic({
|
|
@@ -540,7 +529,7 @@ async function runLoaders(compiler, context) {
|
|
|
540
529
|
if (!(warning instanceof Error)) {
|
|
541
530
|
warning = new RspackError_1.NonErrorEmittedError(warning);
|
|
542
531
|
}
|
|
543
|
-
|
|
532
|
+
const hasStack = !!warning.stack;
|
|
544
533
|
warning.name = "ModuleWarning";
|
|
545
534
|
warning.message = `${warning.message} (from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`;
|
|
546
535
|
hasStack && Error.captureStackTrace(warning);
|
|
@@ -598,7 +587,7 @@ async function runLoaders(compiler, context) {
|
|
|
598
587
|
loaderContext._compiler = compiler;
|
|
599
588
|
loaderContext._compilation = compiler._lastCompilation;
|
|
600
589
|
loaderContext._module = Module_1.Module.__from_binding(context._module, compiler._lastCompilation);
|
|
601
|
-
loaderContext.getOptions =
|
|
590
|
+
loaderContext.getOptions = () => {
|
|
602
591
|
const loader = getCurrentLoader(loaderContext);
|
|
603
592
|
let options = loader?.options;
|
|
604
593
|
if (typeof options === "string") {
|
|
@@ -669,9 +658,7 @@ async function runLoaders(compiler, context) {
|
|
|
669
658
|
loaderContext.previousRequest,
|
|
670
659
|
currentLoaderObject.data
|
|
671
660
|
])) || [];
|
|
672
|
-
const hasArg = args.some(
|
|
673
|
-
return value !== undefined;
|
|
674
|
-
});
|
|
661
|
+
const hasArg = args.some(value => value !== undefined);
|
|
675
662
|
if (hasArg) {
|
|
676
663
|
const [content, sourceMap, additionalData] = args;
|
|
677
664
|
context.content = (0, util_2.isNil)(content) ? null : (0, util_2.toBuffer)(content);
|
|
@@ -699,7 +686,7 @@ async function runLoaders(compiler, context) {
|
|
|
699
686
|
currentLoaderObject.normalExecuted = true;
|
|
700
687
|
if (!fn)
|
|
701
688
|
continue;
|
|
702
|
-
|
|
689
|
+
const args = [content, sourceMap, additionalData];
|
|
703
690
|
convertArgs(args, !!currentLoaderObject.raw);
|
|
704
691
|
[content, sourceMap, additionalData] =
|
|
705
692
|
(await runSyncOrAsync(fn, loaderContext, args)) || [];
|
|
@@ -20,7 +20,7 @@ module.exports = function loadLoader(loader, callback) {
|
|
|
20
20
|
var loaderUrl = url.pathToFileURL(loader.path);
|
|
21
21
|
/** @type {Promise<any>} */
|
|
22
22
|
var modulePromise = eval("import(" + JSON.stringify(loaderUrl.toString()) + ")");
|
|
23
|
-
modulePromise.then(
|
|
23
|
+
modulePromise.then(module => {
|
|
24
24
|
handleResult(loader, module, callback);
|
|
25
25
|
}, callback);
|
|
26
26
|
return;
|
package/dist/logging/runtime.js
CHANGED
|
@@ -14,7 +14,7 @@ const SyncBailHook = require("tapable/lib/SyncBailHook");
|
|
|
14
14
|
const { Logger } = require("./Logger");
|
|
15
15
|
const createConsoleLogger = require("./createConsoleLogger");
|
|
16
16
|
/** @type {createConsoleLogger.LoggerOptions} */
|
|
17
|
-
|
|
17
|
+
const currentDefaultLoggerOptions = {
|
|
18
18
|
level: "info",
|
|
19
19
|
debug: false,
|
|
20
20
|
console
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import { Compiler } from "../Compiler";
|
|
10
|
+
import type { Compiler } from "../Compiler";
|
|
11
11
|
export type NodeTemplatePluginOptions = {
|
|
12
12
|
asyncChunkLoading?: boolean;
|
|
13
13
|
};
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
10
|
import Watchpack from "../../compiled/watchpack";
|
|
11
|
-
import { FileSystemInfoEntry, WatchFileSystem, Watcher } from "../util/fs";
|
|
11
|
+
import type { FileSystemInfoEntry, WatchFileSystem, Watcher } from "../util/fs";
|
|
12
12
|
export default class NodeWatchFileSystem implements WatchFileSystem {
|
|
13
13
|
inputFileSystem: any;
|
|
14
14
|
watcherOptions: Watchpack.WatchOptions;
|
package/dist/rspack.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Callback } from "@rspack/lite-tapable";
|
|
1
|
+
import type { Callback } from "@rspack/lite-tapable";
|
|
2
2
|
import { Compiler } from "./Compiler";
|
|
3
|
-
import { MultiCompiler, MultiRspackOptions } from "./MultiCompiler";
|
|
3
|
+
import { MultiCompiler, type MultiRspackOptions } from "./MultiCompiler";
|
|
4
4
|
import MultiStats from "./MultiStats";
|
|
5
5
|
import { Stats } from "./Stats";
|
|
6
|
-
import { RspackOptions } from "./config";
|
|
6
|
+
import { type RspackOptions } from "./config";
|
|
7
7
|
declare function createMultiCompiler(options: MultiRspackOptions): MultiCompiler;
|
|
8
8
|
declare function createCompiler(userOptions: RspackOptions): Compiler;
|
|
9
9
|
declare function rspack(options: MultiRspackOptions): MultiCompiler;
|
package/dist/rspack.js
CHANGED
|
@@ -23,7 +23,6 @@ const DefaultStatsFactoryPlugin_1 = require("./stats/DefaultStatsFactoryPlugin")
|
|
|
23
23
|
const DefaultStatsPresetPlugin_1 = require("./stats/DefaultStatsPresetPlugin");
|
|
24
24
|
const DefaultStatsPrinterPlugin_1 = require("./stats/DefaultStatsPrinterPlugin");
|
|
25
25
|
const assertNotNil_1 = require("./util/assertNotNil");
|
|
26
|
-
const cleverMerge_1 = require("./util/cleverMerge");
|
|
27
26
|
class RspackOptionsApply {
|
|
28
27
|
constructor() { }
|
|
29
28
|
process(options, compiler) {
|
|
@@ -171,9 +170,7 @@ class RspackOptionsApply {
|
|
|
171
170
|
// this is only for test
|
|
172
171
|
// @ts-expect-error cacheable is hide
|
|
173
172
|
lazyOptions.cacheable ?? true, lazyOptions.entries ?? true, lazyOptions.imports ?? true, typeof lazyOptions.test === "function"
|
|
174
|
-
?
|
|
175
|
-
return lazyOptions.test.call(lazyOptions, new Module_1.Module(jsModule));
|
|
176
|
-
}
|
|
173
|
+
? jsModule => lazyOptions.test.call(lazyOptions, new Module_1.Module(jsModule))
|
|
177
174
|
: lazyOptions.test
|
|
178
175
|
? {
|
|
179
176
|
source: lazyOptions.test.source,
|
|
@@ -267,21 +264,6 @@ class RspackOptionsApply {
|
|
|
267
264
|
if (!compiler.inputFileSystem) {
|
|
268
265
|
throw new Error("No input filesystem provided");
|
|
269
266
|
}
|
|
270
|
-
compiler.resolverFactory.hooks.resolveOptions
|
|
271
|
-
.for("normal")
|
|
272
|
-
.tap("RspackOptionsApply", resolveOptions => {
|
|
273
|
-
resolveOptions = (0, cleverMerge_1.cleverMerge)(options.resolve, resolveOptions);
|
|
274
|
-
resolveOptions.fileSystem = compiler.inputFileSystem;
|
|
275
|
-
return resolveOptions;
|
|
276
|
-
});
|
|
277
|
-
compiler.resolverFactory.hooks.resolveOptions
|
|
278
|
-
.for("context")
|
|
279
|
-
.tap("RspackOptionsApply", resolveOptions => {
|
|
280
|
-
resolveOptions = (0, cleverMerge_1.cleverMerge)(options.resolve, resolveOptions);
|
|
281
|
-
resolveOptions.fileSystem = compiler.inputFileSystem;
|
|
282
|
-
resolveOptions.resolveToContext = true;
|
|
283
|
-
return resolveOptions;
|
|
284
|
-
});
|
|
285
267
|
compiler.hooks.afterResolvers.call(compiler);
|
|
286
268
|
}
|
|
287
269
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
import { Compiler } from "../Compiler";
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
3
|
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
4
4
|
export type ConsumeSharedPluginOptions = {
|
|
5
5
|
consumes: Consumes;
|
|
@@ -14,7 +14,7 @@ class ConsumeSharedPlugin extends base_1.RspackBuiltinPlugin {
|
|
|
14
14
|
consumes: (0, options_1.parseOptions)(options.consumes, (item, key) => {
|
|
15
15
|
if (Array.isArray(item))
|
|
16
16
|
throw new Error("Unexpected array in options");
|
|
17
|
-
|
|
17
|
+
const result = item === key || !(0, utils_1.isRequiredVersion)(item)
|
|
18
18
|
? // item is a request/key
|
|
19
19
|
{
|
|
20
20
|
import: key,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
import { Compiler } from "../Compiler";
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
3
|
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
4
4
|
export type ProvideSharedPluginOptions = {
|
|
5
5
|
provides: Provides;
|