@rspack/core 1.0.0-beta.5 → 1.0.0-rc.1

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.
@@ -27,6 +27,7 @@ import { Logger } from "./logging/Logger";
27
27
  import { StatsFactory } from "./stats/StatsFactory";
28
28
  import { StatsPrinter } from "./stats/StatsPrinter";
29
29
  import { type AssetInfo } from "./util/AssetInfo";
30
+ import type { InputFileSystem } from "./util/fs";
30
31
  import type Hash from "./util/hash";
31
32
  export { type AssetInfo } from "./util/AssetInfo";
32
33
  export type Assets = Record<string, Source>;
@@ -175,7 +176,7 @@ export declare class Compilation {
175
176
  endTime?: number;
176
177
  compiler: Compiler;
177
178
  resolverFactory: ResolverFactory;
178
- inputFileSystem: any;
179
+ inputFileSystem: InputFileSystem | null;
179
180
  options: RspackOptionsNormalized;
180
181
  outputOptions: OutputNormalized;
181
182
  logging: Map<string, LogEntry[]>;
@@ -227,8 +228,6 @@ export declare class Compilation {
227
228
  createStatsPrinter(options: StatsOptions): StatsPrinter;
228
229
  /**
229
230
  * Update an existing asset. Trying to update an asset that doesn't exist will throw an error.
230
- *
231
- * FIXME: *AssetInfo* may be undefined in update fn for webpack impl, but still not implemented in rspack
232
231
  */
233
232
  updateAsset(filename: string, newSourceOrFunction: Source | ((source: Source) => Source), assetInfoUpdateOrFunction?: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo)): void;
234
233
  /**
@@ -297,8 +297,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
297
297
  }
298
298
  /**
299
299
  * Update an existing asset. Trying to update an asset that doesn't exist will throw an error.
300
- *
301
- * FIXME: *AssetInfo* may be undefined in update fn for webpack impl, but still not implemented in rspack
302
300
  */
303
301
  updateAsset(filename, newSourceOrFunction, assetInfoUpdateOrFunction) {
304
302
  let compatNewSourceOrFunction;
@@ -27,7 +27,7 @@ import type { Source } from "../compiled/webpack-sources";
27
27
  import type { CompilationParams } from "./Compilation";
28
28
  import type { FileSystemInfoEntry } from "./FileSystemInfo";
29
29
  import type { EntryNormalized, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance } from "./config";
30
- import type { OutputFileSystem, WatchFileSystem } from "./util/fs";
30
+ import type { InputFileSystem, OutputFileSystem, WatchFileSystem } from "./util/fs";
31
31
  export interface AssetEmittedInfo {
32
32
  content: Buffer;
33
33
  source: Source;
@@ -79,7 +79,7 @@ declare class Compiler {
79
79
  resolverFactory: ResolverFactory;
80
80
  infrastructureLogger: any;
81
81
  watching?: Watching;
82
- inputFileSystem: any;
82
+ inputFileSystem: InputFileSystem | null;
83
83
  intermediateFileSystem: any;
84
84
  outputFileSystem: OutputFileSystem | null;
85
85
  watchFileSystem: WatchFileSystem | null;
package/dist/Compiler.js CHANGED
@@ -372,9 +372,7 @@ class Compiler {
372
372
  });
373
373
  }
374
374
  purgeInputFileSystem() {
375
- if (this.inputFileSystem?.purge) {
376
- this.inputFileSystem.purge();
377
- }
375
+ this.inputFileSystem?.purge?.();
378
376
  }
379
377
  /**
380
378
  * @param compilation - the compilation
@@ -12,7 +12,7 @@ import type { Compiler, RspackOptions } from ".";
12
12
  import MultiStats from "./MultiStats";
13
13
  import MultiWatching from "./MultiWatching";
14
14
  import type { WatchOptions } from "./config";
15
- import type { WatchFileSystem } from "./util/fs";
15
+ import type { InputFileSystem, WatchFileSystem } from "./util/fs";
16
16
  export interface MultiCompilerOptions {
17
17
  /**
18
18
  * how many Compilers are allows to run at the same time in parallel
@@ -37,11 +37,11 @@ export declare class MultiCompiler {
37
37
  constructor(compilers: Compiler[] | Record<string, Compiler>, options?: MultiCompilerOptions);
38
38
  get options(): import(".").RspackOptionsNormalized[] & MultiCompilerOptions;
39
39
  get outputPath(): string;
40
- get inputFileSystem(): void;
40
+ get inputFileSystem(): InputFileSystem;
41
41
  get outputFileSystem(): typeof import("fs");
42
42
  get watchFileSystem(): WatchFileSystem;
43
43
  get intermediateFileSystem(): void;
44
- set inputFileSystem(value: void);
44
+ set inputFileSystem(value: InputFileSystem);
45
45
  set outputFileSystem(value: typeof import("fs"));
46
46
  set watchFileSystem(value: WatchFileSystem);
47
47
  set intermediateFileSystem(value: void);
@@ -275,9 +275,7 @@ class MultiCompiler {
275
275
  }
276
276
  purgeInputFileSystem() {
277
277
  for (const compiler of this.compilers) {
278
- if (compiler.inputFileSystem?.purge) {
279
- compiler.inputFileSystem.purge();
280
- }
278
+ compiler.inputFileSystem?.purge?.();
281
279
  }
282
280
  }
283
281
  close(callback) {
@@ -78,6 +78,7 @@ export type FeatureOptions = {
78
78
  color?: boolean;
79
79
  };
80
80
  export type LoaderOptions = {
81
+ minify?: boolean;
81
82
  errorRecovery?: boolean;
82
83
  targets?: Targets | string[] | string;
83
84
  include?: FeatureOptions;
@@ -0,0 +1,10 @@
1
+ import { BuiltinPluginName } from "@rspack/binding";
2
+ export declare const NoEmitOnErrorsPlugin: {
3
+ new (): {
4
+ name: BuiltinPluginName;
5
+ _args: [];
6
+ affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
7
+ raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
8
+ apply(compiler: import("../Compiler").Compiler): void;
9
+ };
10
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NoEmitOnErrorsPlugin = void 0;
4
+ const binding_1 = require("@rspack/binding");
5
+ const base_1 = require("./base");
6
+ exports.NoEmitOnErrorsPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.NoEmitOnErrorsPlugin, () => undefined);
@@ -13,6 +13,7 @@ export type SwcJsMinimizerRspackPluginOptions = {
13
13
  include?: AssetConditions;
14
14
  extractComments?: ExtractCommentsOptions | undefined;
15
15
  minimizerOptions?: {
16
+ minify?: boolean;
16
17
  compress?: TerserCompressOptions | boolean;
17
18
  mangle?: TerserMangleOptions | boolean;
18
19
  format?: JsFormatOptions & ToSnakeCaseProperties<JsFormatOptions>;
@@ -203,12 +204,7 @@ export type TerserManglePropertiesOptions = {};
203
204
  export declare const SwcJsMinimizerRspackPlugin: {
204
205
  new (options?: SwcJsMinimizerRspackPluginOptions | undefined): {
205
206
  name: BuiltinPluginName;
206
- _args: [options?: SwcJsMinimizerRspackPluginOptions | undefined]; /**
207
- * - `false`: removes all comments
208
- * - `'some'`: preserves some comments
209
- * - `'all'`: preserves all comments
210
- * @default false
211
- */
207
+ _args: [options?: SwcJsMinimizerRspackPluginOptions | undefined];
212
208
  affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
213
209
  raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
214
210
  apply(compiler: import("../Compiler").Compiler): void;
@@ -73,6 +73,7 @@ exports.SwcJsMinimizerRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginN
73
73
  compress,
74
74
  mangle,
75
75
  format,
76
+ minify: options?.minimizerOptions?.minify,
76
77
  module: options?.minimizerOptions?.module
77
78
  }
78
79
  };
@@ -62,3 +62,4 @@ export * from "./WarnCaseSensitiveModulesPlugin";
62
62
  export * from "./WebWorkerTemplatePlugin";
63
63
  export * from "./WorkerPlugin";
64
64
  export * from "./FetchCompileAsyncWasmPlugin";
65
+ export * from "./NoEmitOnErrorsPlugin";
@@ -80,3 +80,4 @@ __exportStar(require("./WarnCaseSensitiveModulesPlugin"), exports);
80
80
  __exportStar(require("./WebWorkerTemplatePlugin"), exports);
81
81
  __exportStar(require("./WorkerPlugin"), exports);
82
82
  __exportStar(require("./FetchCompileAsyncWasmPlugin"), exports);
83
+ __exportStar(require("./NoEmitOnErrorsPlugin"), exports);
@@ -650,8 +650,10 @@ function getRawExperiments(experiments) {
650
650
  rspackFuture: getRawRspackFutureOptions(rspackFuture)
651
651
  };
652
652
  }
653
- function getRawRspackFutureOptions(_future) {
654
- return {};
653
+ function getRawRspackFutureOptions(future) {
654
+ return {
655
+ newIncremental: future.newIncremental
656
+ };
655
657
  }
656
658
  function getRawNode(node) {
657
659
  if (node === false) {
@@ -136,6 +136,9 @@ const applyExperimentsDefaults = (experiments) => {
136
136
  // IGNORE(experiments.rspackFuture): Rspack specific configuration
137
137
  D(experiments, "rspackFuture", {});
138
138
  // rspackFuture.bundlerInfo default value is applied after applyDefaults
139
+ if (typeof experiments.rspackFuture === "object") {
140
+ D(experiments.rspackFuture, "newIncremental", false);
141
+ }
139
142
  };
140
143
  const applybundlerInfoDefaults = (rspackFuture, library) => {
141
144
  if (typeof rspackFuture === "object") {
@@ -597,7 +600,7 @@ const applyOutputDefaults = (output, { context, outputModule, targetProperties:
597
600
  const optimistic = (v) => v || v === undefined;
598
601
  const conditionallyOptimistic = (v, c) => (v === undefined && c) || v;
599
602
  F(environment, "globalThis", () => tp?.globalThis);
600
- F(environment, "bigIntLiteral", () => tp?.bigIntLiteral);
603
+ F(environment, "bigIntLiteral", () => tp && optimistic(tp.bigIntLiteral));
601
604
  F(environment, "const", () => tp && optimistic(tp.const));
602
605
  F(environment, "arrowFunction", () => tp && optimistic(tp.arrowFunction));
603
606
  F(environment, "asyncFunction", () => tp && optimistic(tp.asyncFunction));
@@ -694,6 +697,7 @@ const applyOptimizationDefaults = (optimization, { production, development, css
694
697
  D(optimization, "providedExports", true);
695
698
  D(optimization, "usedExports", production);
696
699
  D(optimization, "innerGraph", production);
700
+ D(optimization, "emitOnErrors", !production);
697
701
  D(optimization, "runtimeChunk", false);
698
702
  D(optimization, "realContentHash", production);
699
703
  D(optimization, "minimize", production);
@@ -5818,6 +5818,7 @@ declare const optimization: z.ZodObject<{
5818
5818
  usedExports: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["global"]>, z.ZodBoolean]>>;
5819
5819
  mangleExports: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["size", "deterministic"]>, z.ZodBoolean]>>;
5820
5820
  nodeEnv: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<false>]>>;
5821
+ emitOnErrors: z.ZodOptional<z.ZodBoolean>;
5821
5822
  }, "strict", z.ZodTypeAny, {
5822
5823
  moduleIds?: "named" | "natural" | "deterministic" | undefined;
5823
5824
  chunkIds?: "named" | "natural" | "deterministic" | undefined;
@@ -5883,6 +5884,7 @@ declare const optimization: z.ZodObject<{
5883
5884
  innerGraph?: boolean | undefined;
5884
5885
  mangleExports?: boolean | "deterministic" | "size" | undefined;
5885
5886
  nodeEnv?: string | false | undefined;
5887
+ emitOnErrors?: boolean | undefined;
5886
5888
  }, {
5887
5889
  moduleIds?: "named" | "natural" | "deterministic" | undefined;
5888
5890
  chunkIds?: "named" | "natural" | "deterministic" | undefined;
@@ -5948,6 +5950,7 @@ declare const optimization: z.ZodObject<{
5948
5950
  innerGraph?: boolean | undefined;
5949
5951
  mangleExports?: boolean | "deterministic" | "size" | undefined;
5950
5952
  nodeEnv?: string | false | undefined;
5953
+ emitOnErrors?: boolean | undefined;
5951
5954
  }>;
5952
5955
  export type Optimization = z.infer<typeof optimization>;
5953
5956
  declare const rspackFutureOptions: z.ZodObject<{
@@ -5964,18 +5967,21 @@ declare const rspackFutureOptions: z.ZodObject<{
5964
5967
  version?: string | undefined;
5965
5968
  bundler?: string | undefined;
5966
5969
  }>>;
5970
+ newIncremental: z.ZodOptional<z.ZodBoolean>;
5967
5971
  }, "strict", z.ZodTypeAny, {
5968
5972
  bundlerInfo?: {
5969
5973
  force?: boolean | ("version" | "uniqueId")[] | undefined;
5970
5974
  version?: string | undefined;
5971
5975
  bundler?: string | undefined;
5972
5976
  } | undefined;
5977
+ newIncremental?: boolean | undefined;
5973
5978
  }, {
5974
5979
  bundlerInfo?: {
5975
5980
  force?: boolean | ("version" | "uniqueId")[] | undefined;
5976
5981
  version?: string | undefined;
5977
5982
  bundler?: string | undefined;
5978
5983
  } | undefined;
5984
+ newIncremental?: boolean | undefined;
5979
5985
  }>;
5980
5986
  export type RspackFutureOptions = z.infer<typeof rspackFutureOptions>;
5981
5987
  declare const lazyCompilationOptions: z.ZodObject<{
@@ -6198,18 +6204,21 @@ declare const experiments: z.ZodObject<{
6198
6204
  version?: string | undefined;
6199
6205
  bundler?: string | undefined;
6200
6206
  }>>;
6207
+ newIncremental: z.ZodOptional<z.ZodBoolean>;
6201
6208
  }, "strict", z.ZodTypeAny, {
6202
6209
  bundlerInfo?: {
6203
6210
  force?: boolean | ("version" | "uniqueId")[] | undefined;
6204
6211
  version?: string | undefined;
6205
6212
  bundler?: string | undefined;
6206
6213
  } | undefined;
6214
+ newIncremental?: boolean | undefined;
6207
6215
  }, {
6208
6216
  bundlerInfo?: {
6209
6217
  force?: boolean | ("version" | "uniqueId")[] | undefined;
6210
6218
  version?: string | undefined;
6211
6219
  bundler?: string | undefined;
6212
6220
  } | undefined;
6221
+ newIncremental?: boolean | undefined;
6213
6222
  }>>;
6214
6223
  }, "strict", z.ZodTypeAny, {
6215
6224
  css?: boolean | undefined;
@@ -6243,6 +6252,7 @@ declare const experiments: z.ZodObject<{
6243
6252
  version?: string | undefined;
6244
6253
  bundler?: string | undefined;
6245
6254
  } | undefined;
6255
+ newIncremental?: boolean | undefined;
6246
6256
  } | undefined;
6247
6257
  }, {
6248
6258
  css?: boolean | undefined;
@@ -6276,6 +6286,7 @@ declare const experiments: z.ZodObject<{
6276
6286
  version?: string | undefined;
6277
6287
  bundler?: string | undefined;
6278
6288
  } | undefined;
6289
+ newIncremental?: boolean | undefined;
6279
6290
  } | undefined;
6280
6291
  }>;
6281
6292
  export type Experiments = z.infer<typeof experiments>;
@@ -7242,18 +7253,21 @@ export declare const rspackOptions: z.ZodObject<{
7242
7253
  version?: string | undefined;
7243
7254
  bundler?: string | undefined;
7244
7255
  }>>;
7256
+ newIncremental: z.ZodOptional<z.ZodBoolean>;
7245
7257
  }, "strict", z.ZodTypeAny, {
7246
7258
  bundlerInfo?: {
7247
7259
  force?: boolean | ("version" | "uniqueId")[] | undefined;
7248
7260
  version?: string | undefined;
7249
7261
  bundler?: string | undefined;
7250
7262
  } | undefined;
7263
+ newIncremental?: boolean | undefined;
7251
7264
  }, {
7252
7265
  bundlerInfo?: {
7253
7266
  force?: boolean | ("version" | "uniqueId")[] | undefined;
7254
7267
  version?: string | undefined;
7255
7268
  bundler?: string | undefined;
7256
7269
  } | undefined;
7270
+ newIncremental?: boolean | undefined;
7257
7271
  }>>;
7258
7272
  }, "strict", z.ZodTypeAny, {
7259
7273
  css?: boolean | undefined;
@@ -7287,6 +7301,7 @@ export declare const rspackOptions: z.ZodObject<{
7287
7301
  version?: string | undefined;
7288
7302
  bundler?: string | undefined;
7289
7303
  } | undefined;
7304
+ newIncremental?: boolean | undefined;
7290
7305
  } | undefined;
7291
7306
  }, {
7292
7307
  css?: boolean | undefined;
@@ -7320,6 +7335,7 @@ export declare const rspackOptions: z.ZodObject<{
7320
7335
  version?: string | undefined;
7321
7336
  bundler?: string | undefined;
7322
7337
  } | undefined;
7338
+ newIncremental?: boolean | undefined;
7323
7339
  } | undefined;
7324
7340
  }>>;
7325
7341
  externals: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodBoolean]>, z.ZodArray<z.ZodString, "many">]>, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>]>>]>, z.ZodFunction<z.ZodTuple<[z.ZodObject<{
@@ -7962,6 +7978,7 @@ export declare const rspackOptions: z.ZodObject<{
7962
7978
  usedExports: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["global"]>, z.ZodBoolean]>>;
7963
7979
  mangleExports: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["size", "deterministic"]>, z.ZodBoolean]>>;
7964
7980
  nodeEnv: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<false>]>>;
7981
+ emitOnErrors: z.ZodOptional<z.ZodBoolean>;
7965
7982
  }, "strict", z.ZodTypeAny, {
7966
7983
  moduleIds?: "named" | "natural" | "deterministic" | undefined;
7967
7984
  chunkIds?: "named" | "natural" | "deterministic" | undefined;
@@ -8027,6 +8044,7 @@ export declare const rspackOptions: z.ZodObject<{
8027
8044
  innerGraph?: boolean | undefined;
8028
8045
  mangleExports?: boolean | "deterministic" | "size" | undefined;
8029
8046
  nodeEnv?: string | false | undefined;
8047
+ emitOnErrors?: boolean | undefined;
8030
8048
  }, {
8031
8049
  moduleIds?: "named" | "natural" | "deterministic" | undefined;
8032
8050
  chunkIds?: "named" | "natural" | "deterministic" | undefined;
@@ -8092,6 +8110,7 @@ export declare const rspackOptions: z.ZodObject<{
8092
8110
  innerGraph?: boolean | undefined;
8093
8111
  mangleExports?: boolean | "deterministic" | "size" | undefined;
8094
8112
  nodeEnv?: string | false | undefined;
8113
+ emitOnErrors?: boolean | undefined;
8095
8114
  }>>;
8096
8115
  resolve: z.ZodOptional<z.ZodType<ResolveOptions, z.ZodTypeDef, ResolveOptions>>;
8097
8116
  resolveLoader: z.ZodOptional<z.ZodType<ResolveOptions, z.ZodTypeDef, ResolveOptions>>;
@@ -9348,6 +9367,7 @@ export declare const rspackOptions: z.ZodObject<{
9348
9367
  version?: string | undefined;
9349
9368
  bundler?: string | undefined;
9350
9369
  } | undefined;
9370
+ newIncremental?: boolean | undefined;
9351
9371
  } | undefined;
9352
9372
  } | undefined;
9353
9373
  externals?: string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
@@ -9552,6 +9572,7 @@ export declare const rspackOptions: z.ZodObject<{
9552
9572
  innerGraph?: boolean | undefined;
9553
9573
  mangleExports?: boolean | "deterministic" | "size" | undefined;
9554
9574
  nodeEnv?: string | false | undefined;
9575
+ emitOnErrors?: boolean | undefined;
9555
9576
  } | undefined;
9556
9577
  resolveLoader?: ResolveOptions | undefined;
9557
9578
  plugins?: (false | "" | 0 | RspackPluginInstance | RspackPluginFunction | WebpackPluginInstance | WebpackPluginFunction | null | undefined)[] | undefined;
@@ -9920,6 +9941,7 @@ export declare const rspackOptions: z.ZodObject<{
9920
9941
  version?: string | undefined;
9921
9942
  bundler?: string | undefined;
9922
9943
  } | undefined;
9944
+ newIncremental?: boolean | undefined;
9923
9945
  } | undefined;
9924
9946
  } | undefined;
9925
9947
  externals?: string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
@@ -10124,6 +10146,7 @@ export declare const rspackOptions: z.ZodObject<{
10124
10146
  innerGraph?: boolean | undefined;
10125
10147
  mangleExports?: boolean | "deterministic" | "size" | undefined;
10126
10148
  nodeEnv?: string | false | undefined;
10149
+ emitOnErrors?: boolean | undefined;
10127
10150
  } | undefined;
10128
10151
  resolveLoader?: ResolveOptions | undefined;
10129
10152
  plugins?: (false | "" | 0 | RspackPluginInstance | RspackPluginFunction | WebpackPluginInstance | WebpackPluginFunction | null | undefined)[] | undefined;
@@ -846,7 +846,8 @@ const optimization = zod_1.z.strictObject({
846
846
  innerGraph: zod_1.z.boolean().optional(),
847
847
  usedExports: zod_1.z.enum(["global"]).or(zod_1.z.boolean()).optional(),
848
848
  mangleExports: zod_1.z.enum(["size", "deterministic"]).or(zod_1.z.boolean()).optional(),
849
- nodeEnv: zod_1.z.union([zod_1.z.string(), zod_1.z.literal(false)]).optional()
849
+ nodeEnv: zod_1.z.union([zod_1.z.string(), zod_1.z.literal(false)]).optional(),
850
+ emitOnErrors: zod_1.z.boolean().optional()
850
851
  });
851
852
  //#endregion
852
853
  //#region Experiments
@@ -860,7 +861,8 @@ const rspackFutureOptions = zod_1.z.strictObject({
860
861
  .or(zod_1.z.array(zod_1.z.enum(["version", "uniqueId"])))
861
862
  .optional()
862
863
  })
863
- .optional()
864
+ .optional(),
865
+ newIncremental: zod_1.z.boolean().optional()
864
866
  });
865
867
  const listenOptions = zod_1.z.object({
866
868
  port: zod_1.z.number().optional(),
@@ -3,6 +3,7 @@ import type { ModuleFederationPluginV1Options } from "./ModuleFederationPluginV1
3
3
  export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPluginV1Options, "enhanced"> {
4
4
  runtimePlugins?: RuntimePlugins;
5
5
  implementation?: string;
6
+ shareStrategy?: "version-first" | "loaded-first";
6
7
  }
7
8
  export type RuntimePlugins = string[];
8
9
  export declare class ModuleFederationPlugin {
@@ -130,6 +130,7 @@ function getDefaultEntryRuntime(paths, options, compiler) {
130
130
  `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
131
131
  `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
132
132
  `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
133
+ `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
133
134
  compiler.webpack.Template.getFunctionContent(require("./default.runtime"))
134
135
  ].join(";");
135
136
  return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
@@ -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){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,singleton,requiredVersion,strictVersion}=stage;const options={version,scope:[scope],eager,singleton,requiredVersion,strictVersion,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})}}};
1
+ var __module_federation_bundler_runtime__,__module_federation_runtime_plugins__,__module_federation_remote_infos__,__module_federation_container_name__,__module_federation_share_strategy__;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,"shareStrategy",()=>__module_federation_share_strategy__);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,singleton,requiredVersion,strictVersion}=stage;const shareConfig={};const isValidValue=function(val){return typeof val!=="undefined"};if(isValidValue(singleton)){shareConfig.singleton=singleton}if(isValidValue(requiredVersion)){shareConfig.requiredVersion=requiredVersion}if(isValidValue(eager)){shareConfig.eager=eager}if(isValidValue(strictVersion)){shareConfig.strictVersion=strictVersion}const options={version,scope:[scope],shareConfig,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})}}};
package/dist/exports.d.ts CHANGED
@@ -53,6 +53,7 @@ export { EntryPlugin } from "./builtin-plugin";
53
53
  export { DynamicEntryPlugin } from "./builtin-plugin";
54
54
  export { ExternalsPlugin } from "./builtin-plugin";
55
55
  export { HotModuleReplacementPlugin } from "./builtin-plugin";
56
+ export { NoEmitOnErrorsPlugin } from "./builtin-plugin";
56
57
  export { EnvironmentPlugin } from "./lib/EnvironmentPlugin";
57
58
  export { LoaderOptionsPlugin } from "./lib/LoaderOptionsPlugin";
58
59
  export { LoaderTargetPlugin } from "./lib/LoaderTargetPlugin";
package/dist/exports.js CHANGED
@@ -26,7 +26,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.experiments = exports.CssExtractRspackPlugin = exports.EvalDevToolModulePlugin = exports.EvalSourceMapDevToolPlugin = exports.SourceMapDevToolPlugin = exports.CopyRspackPlugin = exports.LightningCssMinimizerRspackPlugin = exports.SwcJsMinimizerRspackPlugin = exports.HtmlRspackPlugin = exports.sharing = exports.container = exports.optimize = exports.webworker = exports.javascript = exports.wasm = exports.library = exports.electron = exports.node = exports.web = exports.NormalModuleReplacementPlugin = exports.LoaderTargetPlugin = exports.LoaderOptionsPlugin = exports.EnvironmentPlugin = exports.HotModuleReplacementPlugin = exports.ExternalsPlugin = exports.DynamicEntryPlugin = exports.EntryPlugin = exports.ProgressPlugin = exports.DefinePlugin = exports.ProvidePlugin = exports.IgnorePlugin = exports.BannerPlugin = exports.EntryOptionPlugin = exports.util = exports.config = exports.sources = exports.WebpackError = exports.Template = exports.ModuleFilenameHelpers = exports.Stats = exports.RuntimeGlobals = exports.NormalModule = exports.MultiStats = exports.WebpackOptionsApply = exports.RspackOptionsApply = exports.MultiCompiler = exports.Compiler = exports.Compilation = exports.version = exports.rspackVersion = void 0;
29
+ exports.CssExtractRspackPlugin = exports.EvalDevToolModulePlugin = exports.EvalSourceMapDevToolPlugin = exports.SourceMapDevToolPlugin = exports.CopyRspackPlugin = exports.LightningCssMinimizerRspackPlugin = exports.SwcJsMinimizerRspackPlugin = exports.HtmlRspackPlugin = exports.sharing = exports.container = exports.optimize = exports.webworker = exports.javascript = exports.wasm = exports.library = exports.electron = exports.node = exports.web = exports.NormalModuleReplacementPlugin = exports.LoaderTargetPlugin = exports.LoaderOptionsPlugin = exports.EnvironmentPlugin = exports.NoEmitOnErrorsPlugin = exports.HotModuleReplacementPlugin = exports.ExternalsPlugin = exports.DynamicEntryPlugin = exports.EntryPlugin = exports.ProgressPlugin = exports.DefinePlugin = exports.ProvidePlugin = exports.IgnorePlugin = exports.BannerPlugin = exports.EntryOptionPlugin = exports.util = exports.config = exports.sources = exports.WebpackError = exports.Template = exports.ModuleFilenameHelpers = exports.Stats = exports.RuntimeGlobals = exports.NormalModule = exports.MultiStats = exports.WebpackOptionsApply = exports.RspackOptionsApply = exports.MultiCompiler = exports.Compiler = exports.Compilation = exports.version = exports.rspackVersion = void 0;
30
+ exports.experiments = void 0;
30
31
  const package_json_1 = require("../package.json");
31
32
  // this is a hack to be compatible with plugin which detect webpack's version
32
33
  const rspackVersion = package_json_1.version;
@@ -89,6 +90,8 @@ var builtin_plugin_8 = require("./builtin-plugin");
89
90
  Object.defineProperty(exports, "ExternalsPlugin", { enumerable: true, get: function () { return builtin_plugin_8.ExternalsPlugin; } });
90
91
  var builtin_plugin_9 = require("./builtin-plugin");
91
92
  Object.defineProperty(exports, "HotModuleReplacementPlugin", { enumerable: true, get: function () { return builtin_plugin_9.HotModuleReplacementPlugin; } });
93
+ var builtin_plugin_10 = require("./builtin-plugin");
94
+ Object.defineProperty(exports, "NoEmitOnErrorsPlugin", { enumerable: true, get: function () { return builtin_plugin_10.NoEmitOnErrorsPlugin; } });
92
95
  var EnvironmentPlugin_1 = require("./lib/EnvironmentPlugin");
93
96
  Object.defineProperty(exports, "EnvironmentPlugin", { enumerable: true, get: function () { return EnvironmentPlugin_1.EnvironmentPlugin; } });
94
97
  var LoaderOptionsPlugin_1 = require("./lib/LoaderOptionsPlugin");
@@ -97,38 +100,38 @@ var LoaderTargetPlugin_1 = require("./lib/LoaderTargetPlugin");
97
100
  Object.defineProperty(exports, "LoaderTargetPlugin", { enumerable: true, get: function () { return LoaderTargetPlugin_1.LoaderTargetPlugin; } });
98
101
  var NormalModuleReplacementPlugin_1 = require("./lib/NormalModuleReplacementPlugin");
99
102
  Object.defineProperty(exports, "NormalModuleReplacementPlugin", { enumerable: true, get: function () { return NormalModuleReplacementPlugin_1.NormalModuleReplacementPlugin; } });
100
- const builtin_plugin_10 = require("./builtin-plugin");
103
+ const builtin_plugin_11 = require("./builtin-plugin");
101
104
  exports.web = {
102
- FetchCompileAsyncWasmPlugin: builtin_plugin_10.FetchCompileAsyncWasmPlugin
105
+ FetchCompileAsyncWasmPlugin: builtin_plugin_11.FetchCompileAsyncWasmPlugin
103
106
  };
104
- const builtin_plugin_11 = require("./builtin-plugin");
107
+ const builtin_plugin_12 = require("./builtin-plugin");
105
108
  const NodeEnvironmentPlugin_1 = __importDefault(require("./node/NodeEnvironmentPlugin"));
106
109
  const NodeTemplatePlugin_1 = __importDefault(require("./node/NodeTemplatePlugin"));
107
110
  exports.node = {
108
- NodeTargetPlugin: builtin_plugin_11.NodeTargetPlugin,
111
+ NodeTargetPlugin: builtin_plugin_12.NodeTargetPlugin,
109
112
  NodeTemplatePlugin: NodeTemplatePlugin_1.default,
110
113
  NodeEnvironmentPlugin: NodeEnvironmentPlugin_1.default
111
114
  };
112
- const builtin_plugin_12 = require("./builtin-plugin");
113
- exports.electron = { ElectronTargetPlugin: builtin_plugin_12.ElectronTargetPlugin };
114
115
  const builtin_plugin_13 = require("./builtin-plugin");
115
- exports.library = { EnableLibraryPlugin: builtin_plugin_13.EnableLibraryPlugin };
116
+ exports.electron = { ElectronTargetPlugin: builtin_plugin_13.ElectronTargetPlugin };
116
117
  const builtin_plugin_14 = require("./builtin-plugin");
117
- exports.wasm = { EnableWasmLoadingPlugin: builtin_plugin_14.EnableWasmLoadingPlugin };
118
+ exports.library = { EnableLibraryPlugin: builtin_plugin_14.EnableLibraryPlugin };
118
119
  const builtin_plugin_15 = require("./builtin-plugin");
120
+ exports.wasm = { EnableWasmLoadingPlugin: builtin_plugin_15.EnableWasmLoadingPlugin };
121
+ const builtin_plugin_16 = require("./builtin-plugin");
119
122
  exports.javascript = {
120
- EnableChunkLoadingPlugin: builtin_plugin_15.EnableChunkLoadingPlugin,
121
- JavascriptModulesPlugin: builtin_plugin_15.JavascriptModulesPlugin
123
+ EnableChunkLoadingPlugin: builtin_plugin_16.EnableChunkLoadingPlugin,
124
+ JavascriptModulesPlugin: builtin_plugin_16.JavascriptModulesPlugin
122
125
  };
123
- const builtin_plugin_16 = require("./builtin-plugin");
124
- exports.webworker = { WebWorkerTemplatePlugin: builtin_plugin_16.WebWorkerTemplatePlugin };
125
126
  const builtin_plugin_17 = require("./builtin-plugin");
127
+ exports.webworker = { WebWorkerTemplatePlugin: builtin_plugin_17.WebWorkerTemplatePlugin };
126
128
  const builtin_plugin_18 = require("./builtin-plugin");
127
129
  const builtin_plugin_19 = require("./builtin-plugin");
130
+ const builtin_plugin_20 = require("./builtin-plugin");
128
131
  exports.optimize = {
129
- LimitChunkCountPlugin: builtin_plugin_17.LimitChunkCountPlugin,
130
- RuntimeChunkPlugin: builtin_plugin_18.RuntimeChunkPlugin,
131
- SplitChunksPlugin: builtin_plugin_19.SplitChunksPlugin
132
+ LimitChunkCountPlugin: builtin_plugin_18.LimitChunkCountPlugin,
133
+ RuntimeChunkPlugin: builtin_plugin_19.RuntimeChunkPlugin,
134
+ SplitChunksPlugin: builtin_plugin_20.SplitChunksPlugin
132
135
  };
133
136
  const ModuleFederationPlugin_1 = require("./container/ModuleFederationPlugin");
134
137
  const ModuleFederationPluginV1_1 = require("./container/ModuleFederationPluginV1");
@@ -148,22 +151,22 @@ exports.sharing = {
148
151
  ConsumeSharedPlugin: ConsumeSharedPlugin_1.ConsumeSharedPlugin,
149
152
  SharePlugin: SharePlugin_1.SharePlugin
150
153
  };
151
- var builtin_plugin_20 = require("./builtin-plugin");
152
- Object.defineProperty(exports, "HtmlRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_20.HtmlRspackPlugin; } });
153
154
  var builtin_plugin_21 = require("./builtin-plugin");
154
- Object.defineProperty(exports, "SwcJsMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_21.SwcJsMinimizerRspackPlugin; } });
155
+ Object.defineProperty(exports, "HtmlRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_21.HtmlRspackPlugin; } });
155
156
  var builtin_plugin_22 = require("./builtin-plugin");
156
- Object.defineProperty(exports, "LightningCssMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_22.LightningCssMinimizerRspackPlugin; } });
157
+ Object.defineProperty(exports, "SwcJsMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_22.SwcJsMinimizerRspackPlugin; } });
157
158
  var builtin_plugin_23 = require("./builtin-plugin");
158
- Object.defineProperty(exports, "CopyRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_23.CopyRspackPlugin; } });
159
+ Object.defineProperty(exports, "LightningCssMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_23.LightningCssMinimizerRspackPlugin; } });
159
160
  var builtin_plugin_24 = require("./builtin-plugin");
160
- Object.defineProperty(exports, "SourceMapDevToolPlugin", { enumerable: true, get: function () { return builtin_plugin_24.SourceMapDevToolPlugin; } });
161
+ Object.defineProperty(exports, "CopyRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_24.CopyRspackPlugin; } });
161
162
  var builtin_plugin_25 = require("./builtin-plugin");
162
- Object.defineProperty(exports, "EvalSourceMapDevToolPlugin", { enumerable: true, get: function () { return builtin_plugin_25.EvalSourceMapDevToolPlugin; } });
163
+ Object.defineProperty(exports, "SourceMapDevToolPlugin", { enumerable: true, get: function () { return builtin_plugin_25.SourceMapDevToolPlugin; } });
163
164
  var builtin_plugin_26 = require("./builtin-plugin");
164
- Object.defineProperty(exports, "EvalDevToolModulePlugin", { enumerable: true, get: function () { return builtin_plugin_26.EvalDevToolModulePlugin; } });
165
+ Object.defineProperty(exports, "EvalSourceMapDevToolPlugin", { enumerable: true, get: function () { return builtin_plugin_26.EvalSourceMapDevToolPlugin; } });
165
166
  var builtin_plugin_27 = require("./builtin-plugin");
166
- Object.defineProperty(exports, "CssExtractRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_27.CssExtractRspackPlugin; } });
167
+ Object.defineProperty(exports, "EvalDevToolModulePlugin", { enumerable: true, get: function () { return builtin_plugin_27.EvalDevToolModulePlugin; } });
168
+ var builtin_plugin_28 = require("./builtin-plugin");
169
+ Object.defineProperty(exports, "CssExtractRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_28.CssExtractRspackPlugin; } });
167
170
  ///// Experiments Stuff /////
168
171
  const binding_1 = require("@rspack/binding");
169
172
  exports.experiments = {
@@ -10,8 +10,8 @@
10
10
  import type { Compiler } from "../Compiler";
11
11
  declare class EnvironmentPlugin {
12
12
  keys: string[];
13
- defaultValues: Record<string, string>;
14
- constructor(...keys: string[] | [Record<string, string> | string]);
13
+ defaultValues: Record<string, string | undefined | null>;
14
+ constructor(...keys: string[] | [Record<string, string | undefined | null> | string | string[]]);
15
15
  /**
16
16
  * Apply the plugin
17
17
  * @param compiler the compiler instance
@@ -43,7 +43,7 @@ class EnvironmentPlugin {
43
43
  : this.defaultValues[key];
44
44
  if (value === undefined) {
45
45
  compiler.hooks.thisCompilation.tap("EnvironmentPlugin", compilation => {
46
- const error = new WebpackError_1.default(`EnvironmentPlugin - ${key} environment variable is undefined.\n\nYou can pass an object with default values to suppress this warning.\nSee https://webpack.js.org/plugins/environment-plugin for example.`);
46
+ const error = new WebpackError_1.default(`EnvironmentPlugin - ${key} environment variable is undefined.\n\nYou can pass an object with default values to suppress this warning.\nSee https://rspack.dev/plugins/webpack/environment-plugin for example.`);
47
47
  error.name = "EnvVariableNotDefinedError";
48
48
  compilation.errors.push(error);
49
49
  });
@@ -82,7 +82,9 @@ function createLoaderObject(loader, compiler) {
82
82
  }
83
83
  obj.ident = ident;
84
84
  }
85
- obj.type = value.type;
85
+ // CHANGE: `rspack_core` returns empty string for `undefined` type.
86
+ // Comply to webpack test case: tests/webpack-test/cases/loaders/cjs-loader-type/index.js
87
+ obj.type = value.type === "" ? undefined : value.type;
86
88
  if (obj.options === null)
87
89
  obj.query = "";
88
90
  else if (obj.options === undefined)
@@ -20,7 +20,7 @@ function loadLoader(loader, callback) {
20
20
  if (url === undefined)
21
21
  url = require("node:url");
22
22
  const loaderUrl = url.pathToFileURL(loader.path);
23
- const modulePromise = eval(`import(${JSON.stringify(loaderUrl.toString())})`);
23
+ const modulePromise = import(loaderUrl.toString());
24
24
  modulePromise.then((module) => {
25
25
  handleResult(loader, module, callback);
26
26
  }, callback);
@@ -34,15 +34,15 @@ class NodeEnvironmentPlugin {
34
34
  stream: infrastructureLogging.stream
35
35
  })
36
36
  });
37
- compiler.inputFileSystem = new CachedInputFileSystem_1.default(graceful_fs_1.default, 60000);
38
- const inputFileSystem = compiler.inputFileSystem;
37
+ const inputFileSystem = new CachedInputFileSystem_1.default(graceful_fs_1.default, 60000);
38
+ compiler.inputFileSystem = inputFileSystem;
39
39
  compiler.outputFileSystem = graceful_fs_1.default;
40
40
  compiler.intermediateFileSystem = graceful_fs_1.default;
41
- compiler.watchFileSystem = new NodeWatchFileSystem_1.default(compiler.inputFileSystem);
41
+ compiler.watchFileSystem = new NodeWatchFileSystem_1.default(inputFileSystem);
42
42
  compiler.hooks.beforeRun.tap("NodeEnvironmentPlugin", compiler => {
43
43
  if (compiler.inputFileSystem === inputFileSystem) {
44
44
  compiler.fsStartTime = Date.now();
45
- inputFileSystem.purge();
45
+ inputFileSystem.purge?.();
46
46
  }
47
47
  });
48
48
  }
@@ -93,7 +93,7 @@ class NodeWatchFileSystem {
93
93
  },
94
94
  getAggregatedRemovals: node_util_1.default.deprecate(() => {
95
95
  const items = this.watcher?.aggregatedRemovals;
96
- if (items && this.inputFileSystem && this.inputFileSystem.purge) {
96
+ if (items && this.inputFileSystem?.purge) {
97
97
  const fs = this.inputFileSystem;
98
98
  for (const item of items) {
99
99
  fs.purge?.(item);
@@ -103,7 +103,7 @@ class NodeWatchFileSystem {
103
103
  }, "Watcher.getAggregatedRemovals is deprecated in favor of Watcher.getInfo since that's more performant.", "DEP_WEBPACK_WATCHER_GET_AGGREGATED_REMOVALS"),
104
104
  getAggregatedChanges: node_util_1.default.deprecate(() => {
105
105
  const items = this.watcher?.aggregatedChanges;
106
- if (items && this.inputFileSystem && this.inputFileSystem.purge) {
106
+ if (items && this.inputFileSystem?.purge) {
107
107
  const fs = this.inputFileSystem;
108
108
  for (const item of items) {
109
109
  fs.purge?.(item);
@@ -96,6 +96,9 @@ class RspackOptionsApply {
96
96
  if (runtimeChunk) {
97
97
  new builtin_plugin_1.RuntimeChunkPlugin(runtimeChunk).apply(compiler);
98
98
  }
99
+ if (!options.optimization.emitOnErrors) {
100
+ new builtin_plugin_1.NoEmitOnErrorsPlugin().apply(compiler);
101
+ }
99
102
  if (options.devtool) {
100
103
  if (options.devtool.includes("source-map")) {
101
104
  const hidden = options.devtool.includes("hidden");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "1.0.0-beta.5",
3
+ "version": "1.0.0-rc.1",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -57,10 +57,10 @@
57
57
  "zod-validation-error": "1.3.1"
58
58
  },
59
59
  "dependencies": {
60
- "@module-federation/runtime-tools": "0.2.3",
60
+ "@module-federation/runtime-tools": "0.5.1",
61
61
  "@rspack/lite-tapable": "1.0.0",
62
62
  "caniuse-lite": "^1.0.30001616",
63
- "@rspack/binding": "1.0.0-beta.5"
63
+ "@rspack/binding": "1.0.0-rc.1"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@swc/helpers": ">=0.5.1"