@rspack/core 0.7.0-beta.2-canary-89c6913-20240527004336 → 0.7.0-canary-c216972-20240528031643

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.
Files changed (39) hide show
  1. package/compiled/browserslist/index.js +2 -22
  2. package/dist/Compiler.js +13 -16
  3. package/dist/MultiCompiler.js +1 -1
  4. package/dist/Watching.js +1 -1
  5. package/dist/builtin-loader/swc/emotion.js +4 -5
  6. package/dist/builtin-loader/swc/react.js +1 -1
  7. package/dist/builtin-loader/swc/relay.js +1 -1
  8. package/dist/builtin-plugin/BannerPlugin.d.ts +7 -0
  9. package/dist/builtin-plugin/BannerPlugin.js +2 -0
  10. package/dist/builtin-plugin/BundlerInfoRspackPlugin.js +1 -2
  11. package/dist/builtin-plugin/CopyRspackPlugin.js +4 -5
  12. package/dist/builtin-plugin/ElectronTargetPlugin.js +1 -1
  13. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.js +3 -4
  14. package/dist/builtin-plugin/HtmlRspackPlugin.js +2 -3
  15. package/dist/builtin-plugin/ProgressPlugin.js +4 -7
  16. package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +19 -22
  17. package/dist/builtin-plugin/base.js +1 -1
  18. package/dist/builtin-plugin/css-extract/index.js +3 -4
  19. package/dist/config/adapter.js +12 -16
  20. package/dist/config/defaults.js +7 -9
  21. package/dist/config/normalization.js +2 -2
  22. package/dist/container/ContainerPlugin.js +1 -2
  23. package/dist/container/ContainerReferencePlugin.js +1 -2
  24. package/dist/container/ModuleFederationPlugin.js +5 -8
  25. package/dist/container/ModuleFederationPluginV1.js +1 -2
  26. package/dist/container/default.runtime.js +12 -13
  27. package/dist/lite-tapable/index.js +5 -8
  28. package/dist/loader-runner/index.js +4 -4
  29. package/dist/loader-runner/loadLoader.js +1 -2
  30. package/dist/rspackOptionsApply.js +1 -2
  31. package/dist/sharing/ConsumeSharedPlugin.js +1 -2
  32. package/dist/sharing/ProvideSharedPlugin.js +1 -2
  33. package/dist/sharing/SharePlugin.js +1 -2
  34. package/dist/stats/DefaultStatsFactoryPlugin.js +1 -2
  35. package/dist/stats/DefaultStatsPrinterPlugin.js +1 -1
  36. package/dist/util/index.js +1 -2
  37. package/dist/util/source.js +7 -7
  38. package/dist/util/validate.js +2 -3
  39. package/package.json +4 -4
@@ -1421,7 +1421,7 @@ module.exports = {
1421
1421
  if (!ctx.dangerousExtend && !process.env.BROWSERSLIST_DANGEROUS_EXTEND) {
1422
1422
  checkExtend(name)
1423
1423
  }
1424
- var queries = require(__nccwpck_require__(775).resolve(name, { paths: ['.', ctx.path] }))
1424
+ var queries = eval("require")(require.resolve(name, { paths: ['.', ctx.path] }))
1425
1425
  if (queries) {
1426
1426
  if (Array.isArray(queries)) {
1427
1427
  return queries
@@ -1442,7 +1442,7 @@ module.exports = {
1442
1442
  if (!ctx.dangerousExtend && !process.env.BROWSERSLIST_DANGEROUS_EXTEND) {
1443
1443
  checkExtend(name)
1444
1444
  }
1445
- var stats = require(__nccwpck_require__(775).resolve(
1445
+ var stats = eval("require")(require.resolve(
1446
1446
  path.join(name, 'browserslist-stats.json'),
1447
1447
  { paths: ['.'] }
1448
1448
  ))
@@ -1903,21 +1903,6 @@ module.exports = {
1903
1903
 
1904
1904
  /***/ }),
1905
1905
 
1906
- /***/ 775:
1907
- /***/ ((module) => {
1908
-
1909
- function webpackEmptyContext(req) {
1910
- var e = new Error("Cannot find module '" + req + "'");
1911
- e.code = 'MODULE_NOT_FOUND';
1912
- throw e;
1913
- }
1914
- webpackEmptyContext.keys = () => ([]);
1915
- webpackEmptyContext.resolve = webpackEmptyContext;
1916
- webpackEmptyContext.id = 775;
1917
- module.exports = webpackEmptyContext;
1918
-
1919
- /***/ }),
1920
-
1921
1906
  /***/ 768:
1922
1907
  /***/ ((module) => {
1923
1908
 
@@ -2007,11 +1992,6 @@ module.exports = JSON.parse('{"v0.8":{"start":"2012-06-25","end":"2014-07-31"},"
2007
1992
  /******/ }
2008
1993
  /******/
2009
1994
  /************************************************************************/
2010
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
2011
- /******/ (() => {
2012
- /******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
2013
- /******/ })();
2014
- /******/
2015
1995
  /******/ /* webpack/runtime/compat */
2016
1996
  /******/
2017
1997
  /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
package/dist/Compiler.js CHANGED
@@ -491,13 +491,13 @@ class Compiler {
491
491
  __internal__rebuild(modifiedFiles, removedFiles, callback) {
492
492
  __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
493
493
  if (error) {
494
- return callback === null || callback === void 0 ? void 0 : callback(error);
494
+ return callback?.(error);
495
495
  }
496
496
  instance.rebuild(Array.from(modifiedFiles || []), Array.from(removedFiles || []), error => {
497
497
  if (error) {
498
- return callback === null || callback === void 0 ? void 0 : callback(error);
498
+ return callback?.(error);
499
499
  }
500
- callback === null || callback === void 0 ? void 0 : callback(null);
500
+ callback?.(null);
501
501
  });
502
502
  });
503
503
  }
@@ -512,23 +512,23 @@ exports.Compiler = Compiler;
512
512
  _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler_compilation = new WeakMap(), _Compiler_compilationParams = new WeakMap(), _Compiler_builtinPlugins = new WeakMap(), _Compiler_moduleExecutionResultsMap = new WeakMap(), _Compiler_nonSkippableRegisters = new WeakMap(), _Compiler_registers = new WeakMap(), _Compiler_ruleSet = new WeakMap(), _Compiler_instances = new WeakSet(), _Compiler_build = function _Compiler_build(callback) {
513
513
  __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
514
514
  if (error) {
515
- return callback === null || callback === void 0 ? void 0 : callback(error);
515
+ return callback?.(error);
516
516
  }
517
517
  if (!__classPrivateFieldGet(this, _Compiler_initial, "f")) {
518
518
  instance.rebuild(Array.from(this.modifiedFiles || []), Array.from(this.removedFiles || []), error => {
519
519
  if (error) {
520
- return callback === null || callback === void 0 ? void 0 : callback(error);
520
+ return callback?.(error);
521
521
  }
522
- callback === null || callback === void 0 ? void 0 : callback(null);
522
+ callback?.(null);
523
523
  });
524
524
  return;
525
525
  }
526
526
  __classPrivateFieldSet(this, _Compiler_initial, false, "f");
527
527
  instance.build(error => {
528
528
  if (error) {
529
- return callback === null || callback === void 0 ? void 0 : callback(error);
529
+ return callback?.(error);
530
530
  }
531
- callback === null || callback === void 0 ? void 0 : callback(null);
531
+ callback?.(null);
532
532
  });
533
533
  });
534
534
  }, _Compiler_createCompilation = function _Compiler_createCompilation(native) {
@@ -584,20 +584,17 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
584
584
  targetPath,
585
585
  outputPath,
586
586
  get source() {
587
- var _a;
588
- return (_a = this.compilation.getAsset(filename)) === null || _a === void 0 ? void 0 : _a.source;
587
+ return this.compilation.getAsset(filename)?.source;
589
588
  },
590
589
  get content() {
591
- var _a;
592
- return (_a = this.source) === null || _a === void 0 ? void 0 : _a.buffer();
590
+ return this.source?.buffer();
593
591
  }
594
592
  });
595
593
  }),
596
594
  registerCompilationRuntimeModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationRuntimeModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.runtimeModule, queried => ({ module, chunk }) => {
597
- var _a, _b;
598
- const originSource = (_a = module.source) === null || _a === void 0 ? void 0 : _a.source;
595
+ const originSource = module.source?.source;
599
596
  queried.call(module, Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")));
600
- const newSource = (_b = module.source) === null || _b === void 0 ? void 0 : _b.source;
597
+ const newSource = module.source?.source;
601
598
  if (newSource && newSource !== originSource) {
602
599
  return module;
603
600
  }
@@ -729,7 +726,7 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
729
726
  }, _Compiler_updateNonSkippableRegisters = function _Compiler_updateNonSkippableRegisters() {
730
727
  const kinds = [];
731
728
  for (const { getHook, getHookMap, registerKind } of Object.values(__classPrivateFieldGet(this, _Compiler_registers, "f"))) {
732
- const get = getHook !== null && getHook !== void 0 ? getHook : getHookMap;
729
+ const get = getHook ?? getHookMap;
733
730
  const hookOrMap = get();
734
731
  if (hookOrMap.isUsed()) {
735
732
  kinds.push(registerKind);
@@ -50,7 +50,7 @@ class MultiCompiler {
50
50
  };
51
51
  this.compilers = compilers;
52
52
  this._options = {
53
- parallelism: (options === null || options === void 0 ? void 0 : options.parallelism) || Infinity
53
+ parallelism: options?.parallelism || Infinity
54
54
  };
55
55
  this.dependencies = new WeakMap();
56
56
  this.running = false;
package/dist/Watching.js CHANGED
@@ -266,7 +266,7 @@ _Watching_invalidReported = new WeakMap(), _Watching_closeCallbacks = new WeakMa
266
266
  this.compiler.hooks.watchRun.callAsync(this.compiler, err => {
267
267
  if (err)
268
268
  return this._done(err, null);
269
- const canRebuild = !__classPrivateFieldGet(this, _Watching_initial, "f") && ((modifiedFiles === null || modifiedFiles === void 0 ? void 0 : modifiedFiles.size) || (deleteFiles === null || deleteFiles === void 0 ? void 0 : deleteFiles.size));
269
+ const canRebuild = !__classPrivateFieldGet(this, _Watching_initial, "f") && (modifiedFiles?.size || deleteFiles?.size);
270
270
  const onCompile = (err) => {
271
271
  if (err)
272
272
  return this._done(err, null);
@@ -2,21 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveEmotion = void 0;
4
4
  function resolveEmotion(emotion, isProduction) {
5
- var _a, _b, _c;
6
5
  if (!emotion) {
7
6
  return undefined;
8
7
  }
9
8
  if (emotion === true) {
10
9
  emotion = {};
11
10
  }
12
- const autoLabel = (_a = emotion === null || emotion === void 0 ? void 0 : emotion.autoLabel) !== null && _a !== void 0 ? _a : "dev-only";
11
+ const autoLabel = emotion?.autoLabel ?? "dev-only";
13
12
  const emotionConfig = {
14
13
  enabled: true,
15
14
  // @ts-expect-error autoLabel is string for JavaScript interface, however is boolean for Rust interface
16
15
  autoLabel: autoLabel === "dev-only" ? !isProduction : autoLabel === "always",
17
- importMap: emotion === null || emotion === void 0 ? void 0 : emotion.importMap,
18
- labelFormat: (_b = emotion === null || emotion === void 0 ? void 0 : emotion.labelFormat) !== null && _b !== void 0 ? _b : "[local]",
19
- sourcemap: isProduction ? false : (_c = emotion === null || emotion === void 0 ? void 0 : emotion.sourceMap) !== null && _c !== void 0 ? _c : true
16
+ importMap: emotion?.importMap,
17
+ labelFormat: emotion?.labelFormat ?? "[local]",
18
+ sourcemap: isProduction ? false : emotion?.sourceMap ?? true
20
19
  };
21
20
  return emotionConfig;
22
21
  }
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveReact = void 0;
4
4
  function resolveReact(react) {
5
- return react !== null && react !== void 0 ? react : {};
5
+ return react ?? {};
6
6
  }
7
7
  exports.resolveReact = resolveReact;
@@ -16,7 +16,7 @@ function getRelayConfigFromProject(rootDir) {
16
16
  let config = require(configPath);
17
17
  let finalConfig;
18
18
  if (configName === "package.json") {
19
- finalConfig = config === null || config === void 0 ? void 0 : config.relay;
19
+ finalConfig = config?.relay;
20
20
  }
21
21
  else {
22
22
  finalConfig = config;
@@ -51,6 +51,7 @@ declare const bannerPluginOptions: z.ZodObject<{
51
51
  include: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">]>>;
52
52
  raw: z.ZodOptional<z.ZodBoolean>;
53
53
  footer: z.ZodOptional<z.ZodBoolean>;
54
+ stage: z.ZodOptional<z.ZodNumber>;
54
55
  test: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">]>>;
55
56
  }, "strict", z.ZodTypeAny, {
56
57
  banner: (string | ((args_0: {
@@ -67,6 +68,7 @@ declare const bannerPluginOptions: z.ZodObject<{
67
68
  include?: string | RegExp | (string | RegExp)[] | undefined;
68
69
  raw?: boolean | undefined;
69
70
  footer?: boolean | undefined;
71
+ stage?: number | undefined;
70
72
  test?: string | RegExp | (string | RegExp)[] | undefined;
71
73
  }, {
72
74
  banner: (string | ((args_0: {
@@ -83,6 +85,7 @@ declare const bannerPluginOptions: z.ZodObject<{
83
85
  include?: string | RegExp | (string | RegExp)[] | undefined;
84
86
  raw?: boolean | undefined;
85
87
  footer?: boolean | undefined;
88
+ stage?: number | undefined;
86
89
  test?: string | RegExp | (string | RegExp)[] | undefined;
87
90
  }>;
88
91
  export type BannerPluginOptions = z.infer<typeof bannerPluginOptions>;
@@ -117,6 +120,7 @@ declare const bannerPluginArgument: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodFu
117
120
  include: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">]>>;
118
121
  raw: z.ZodOptional<z.ZodBoolean>;
119
122
  footer: z.ZodOptional<z.ZodBoolean>;
123
+ stage: z.ZodOptional<z.ZodNumber>;
120
124
  test: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">]>>;
121
125
  }, "strict", z.ZodTypeAny, {
122
126
  banner: (string | ((args_0: {
@@ -133,6 +137,7 @@ declare const bannerPluginArgument: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodFu
133
137
  include?: string | RegExp | (string | RegExp)[] | undefined;
134
138
  raw?: boolean | undefined;
135
139
  footer?: boolean | undefined;
140
+ stage?: number | undefined;
136
141
  test?: string | RegExp | (string | RegExp)[] | undefined;
137
142
  }, {
138
143
  banner: (string | ((args_0: {
@@ -149,6 +154,7 @@ declare const bannerPluginArgument: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodFu
149
154
  include?: string | RegExp | (string | RegExp)[] | undefined;
150
155
  raw?: boolean | undefined;
151
156
  footer?: boolean | undefined;
157
+ stage?: number | undefined;
152
158
  test?: string | RegExp | (string | RegExp)[] | undefined;
153
159
  }>]>;
154
160
  export type BannerPluginArgument = z.infer<typeof bannerPluginArgument>;
@@ -172,6 +178,7 @@ export declare const BannerPlugin: {
172
178
  include?: string | RegExp | (string | RegExp)[] | undefined;
173
179
  raw?: boolean | undefined;
174
180
  footer?: boolean | undefined;
181
+ stage?: number | undefined;
175
182
  test?: string | RegExp | (string | RegExp)[] | undefined;
176
183
  }): {
177
184
  name: BuiltinPluginName;
@@ -22,6 +22,7 @@ const bannerPluginOptions = zod_1.z.strictObject({
22
22
  include: rules.optional(),
23
23
  raw: zod_1.z.boolean().optional(),
24
24
  footer: zod_1.z.boolean().optional(),
25
+ stage: zod_1.z.number().optional(),
25
26
  test: rules.optional()
26
27
  });
27
28
  const bannerPluginArgument = bannerContent.or(bannerPluginOptions);
@@ -37,6 +38,7 @@ exports.BannerPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.BannerPlug
37
38
  footer: args.footer,
38
39
  raw: args.raw,
39
40
  test: args.test,
41
+ stage: args.stage,
40
42
  include: args.include,
41
43
  exclude: args.exclude
42
44
  };
@@ -4,9 +4,8 @@ exports.BundlerInfoRspackPlugin = void 0;
4
4
  const binding_1 = require("@rspack/binding");
5
5
  const base_1 = require("./base");
6
6
  exports.BundlerInfoRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.BundlerInfoRspackPlugin, (options) => {
7
- var _a;
8
7
  return {
9
8
  version: options.version || "unknown",
10
- force: (_a = options.force) !== null && _a !== void 0 ? _a : false
9
+ force: options.force ?? false
11
10
  };
12
11
  });
@@ -8,14 +8,13 @@ exports.CopyRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.CopyRs
8
8
  patterns: []
9
9
  };
10
10
  ret.patterns = (copy.patterns || []).map(pattern => {
11
- var _a, _b, _c, _d;
12
11
  if (typeof pattern === "string") {
13
12
  pattern = { from: pattern };
14
13
  }
15
- (_a = pattern.force) !== null && _a !== void 0 ? _a : (pattern.force = false);
16
- (_b = pattern.noErrorOnMissing) !== null && _b !== void 0 ? _b : (pattern.noErrorOnMissing = false);
17
- (_c = pattern.priority) !== null && _c !== void 0 ? _c : (pattern.priority = 0);
18
- (_d = pattern.globOptions) !== null && _d !== void 0 ? _d : (pattern.globOptions = {});
14
+ pattern.force ??= false;
15
+ pattern.noErrorOnMissing ??= false;
16
+ pattern.priority ??= 0;
17
+ pattern.globOptions ??= {};
19
18
  return pattern;
20
19
  });
21
20
  return ret;
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ElectronTargetPlugin = void 0;
4
4
  const binding_1 = require("@rspack/binding");
5
5
  const base_1 = require("./base");
6
- exports.ElectronTargetPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.ElectronTargetPlugin, (context) => context !== null && context !== void 0 ? context : "none");
6
+ exports.ElectronTargetPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.ElectronTargetPlugin, (context) => context ?? "none");
@@ -4,13 +4,12 @@ exports.EvalSourceMapDevToolPlugin = void 0;
4
4
  const binding_1 = require("@rspack/binding");
5
5
  const base_1 = require("./base");
6
6
  exports.EvalSourceMapDevToolPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.EvalSourceMapDevToolPlugin, (options) => {
7
- var _a, _b, _c;
8
7
  return {
9
8
  filename: options.filename || undefined,
10
9
  append: options.append,
11
- namespace: (_a = options.namespace) !== null && _a !== void 0 ? _a : "",
12
- columns: (_b = options.columns) !== null && _b !== void 0 ? _b : true,
13
- noSources: (_c = options.noSources) !== null && _c !== void 0 ? _c : false,
10
+ namespace: options.namespace ?? "",
11
+ columns: options.columns ?? true,
12
+ noSources: options.noSources ?? false,
14
13
  publicPath: options.publicPath,
15
14
  module: options.module
16
15
  };
@@ -22,7 +22,6 @@ const htmlRspackPluginOptions = zod_1.z.strictObject({
22
22
  meta: zod_1.z.record(zod_1.z.string().or(zod_1.z.record(zod_1.z.string()))).optional()
23
23
  });
24
24
  exports.HtmlRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.HtmlRspackPlugin, (c = {}) => {
25
- var _a, _b;
26
25
  (0, validate_1.validate)(c, htmlRspackPluginOptions);
27
26
  const meta = {};
28
27
  for (const key in c.meta) {
@@ -40,8 +39,8 @@ exports.HtmlRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.HtmlRs
40
39
  };
41
40
  }
42
41
  }
43
- const scriptLoading = (_a = c.scriptLoading) !== null && _a !== void 0 ? _a : "defer";
44
- const configInject = (_b = c.inject) !== null && _b !== void 0 ? _b : true;
42
+ const scriptLoading = c.scriptLoading ?? "defer";
43
+ const configInject = c.inject ?? true;
45
44
  const inject = configInject === true
46
45
  ? scriptLoading === "blocking"
47
46
  ? "body"
@@ -3,10 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProgressPlugin = void 0;
4
4
  const binding_1 = require("@rspack/binding");
5
5
  const base_1 = require("./base");
6
- exports.ProgressPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.ProgressPlugin, (progress = {}) => {
7
- var _a, _b;
8
- return ({
9
- prefix: (_a = progress.prefix) !== null && _a !== void 0 ? _a : "",
10
- profile: (_b = progress.profile) !== null && _b !== void 0 ? _b : false
11
- });
12
- });
6
+ exports.ProgressPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.ProgressPlugin, (progress = {}) => ({
7
+ prefix: progress.prefix ?? "",
8
+ profile: progress.profile ?? false
9
+ }));
@@ -5,19 +5,18 @@ const binding_1 = require("@rspack/binding");
5
5
  const base_1 = require("./base");
6
6
  function getRawCompressOptions(options) {
7
7
  function _inner() {
8
- var _a, _b, _c;
9
8
  const _default = {
10
- passes: (_a = options === null || options === void 0 ? void 0 : options.passes) !== null && _a !== void 0 ? _a : 1,
11
- pure_funcs: (_b = options === null || options === void 0 ? void 0 : options.pureFuncs) !== null && _b !== void 0 ? _b : [],
12
- drop_console: (_c = options === null || options === void 0 ? void 0 : options.dropConsole) !== null && _c !== void 0 ? _c : false
9
+ passes: options?.passes ?? 1,
10
+ pure_funcs: options?.pureFuncs ?? [],
11
+ drop_console: options?.dropConsole ?? false
13
12
  };
14
- if ((options === null || options === void 0 ? void 0 : options.compress) === true) {
13
+ if (options?.compress === true) {
15
14
  return _default;
16
15
  }
17
- if ((options === null || options === void 0 ? void 0 : options.compress) === false) {
16
+ if (options?.compress === false) {
18
17
  return false;
19
18
  }
20
- if ((options === null || options === void 0 ? void 0 : options.compress) && typeof options.compress === "object") {
19
+ if (options?.compress && typeof options.compress === "object") {
21
20
  return {
22
21
  // TODO: deprecate default merging in 0.4
23
22
  ..._default,
@@ -31,18 +30,17 @@ function getRawCompressOptions(options) {
31
30
  }
32
31
  function getRawMangleOptions(options) {
33
32
  function _inner() {
34
- var _a, _b;
35
33
  const _default = {
36
- keep_classnames: (_a = options === null || options === void 0 ? void 0 : options.keepClassNames) !== null && _a !== void 0 ? _a : false,
37
- keep_fnames: (_b = options === null || options === void 0 ? void 0 : options.keepFnNames) !== null && _b !== void 0 ? _b : false
34
+ keep_classnames: options?.keepClassNames ?? false,
35
+ keep_fnames: options?.keepFnNames ?? false
38
36
  };
39
- if ((options === null || options === void 0 ? void 0 : options.mangle) === true) {
37
+ if (options?.mangle === true) {
40
38
  return _default;
41
39
  }
42
- if ((options === null || options === void 0 ? void 0 : options.mangle) === false) {
40
+ if (options?.mangle === false) {
43
41
  return false;
44
42
  }
45
- if ((options === null || options === void 0 ? void 0 : options.mangle) && typeof options.mangle === "object") {
43
+ if (options?.mangle && typeof options.mangle === "object") {
46
44
  return {
47
45
  // TODO: deprecate default merging in 0.4
48
46
  ..._default,
@@ -56,12 +54,11 @@ function getRawMangleOptions(options) {
56
54
  }
57
55
  function getRawFormatOptions(options) {
58
56
  function _inner() {
59
- var _a;
60
57
  const _default = {
61
- comments: (options === null || options === void 0 ? void 0 : options.comments) ? options === null || options === void 0 ? void 0 : options.comments : false,
62
- asciiOnly: (_a = options === null || options === void 0 ? void 0 : options.asciiOnly) !== null && _a !== void 0 ? _a : false
58
+ comments: options?.comments ? options?.comments : false,
59
+ asciiOnly: options?.asciiOnly ?? false
63
60
  };
64
- if ((options === null || options === void 0 ? void 0 : options.format) && typeof options.format === "object") {
61
+ if (options?.format && typeof options.format === "object") {
65
62
  // TODO: deprecate default merging in 0.4
66
63
  return {
67
64
  ..._default,
@@ -125,13 +122,13 @@ function getRawExtractCommentsOptions(extractComments) {
125
122
  }
126
123
  exports.SwcJsMinimizerRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.SwcJsMinimizerRspackPlugin, (options) => {
127
124
  return {
128
- extractComments: getRawExtractCommentsOptions(options === null || options === void 0 ? void 0 : options.extractComments),
125
+ extractComments: getRawExtractCommentsOptions(options?.extractComments),
129
126
  compress: getRawCompressOptions(options),
130
127
  mangle: getRawMangleOptions(options),
131
128
  format: getRawFormatOptions(options),
132
- module: options === null || options === void 0 ? void 0 : options.module,
133
- test: options === null || options === void 0 ? void 0 : options.test,
134
- include: options === null || options === void 0 ? void 0 : options.include,
135
- exclude: options === null || options === void 0 ? void 0 : options.exclude
129
+ module: options?.module,
130
+ test: options?.test,
131
+ include: options?.include,
132
+ exclude: options?.exclude
136
133
  };
137
134
  }, "compilation");
@@ -33,7 +33,7 @@ exports.RspackBuiltinPlugin = RspackBuiltinPlugin;
33
33
  function createBuiltinPlugin(name, options) {
34
34
  return {
35
35
  name: name,
36
- options: options !== null && options !== void 0 ? options : false // undefined or null will cause napi error, so false for fallback
36
+ options: options ?? false // undefined or null will cause napi error, so false for fallback
37
37
  };
38
38
  }
39
39
  exports.createBuiltinPlugin = createBuiltinPlugin;
@@ -43,7 +43,6 @@ class CssExtractRspackPlugin {
43
43
  });
44
44
  }
45
45
  normalizeOptions(options) {
46
- var _a, _b, _c;
47
46
  let chunkFilename = options.chunkFilename;
48
47
  if (!chunkFilename) {
49
48
  const filename = options.filename || DEFAULT_FILENAME;
@@ -74,8 +73,8 @@ class CssExtractRspackPlugin {
74
73
  const normalzedOptions = {
75
74
  filename: options.filename || DEFAULT_FILENAME,
76
75
  chunkFilename: chunkFilename,
77
- ignoreOrder: (_a = options.ignoreOrder) !== null && _a !== void 0 ? _a : false,
78
- runtime: (_b = options.runtime) !== null && _b !== void 0 ? _b : true,
76
+ ignoreOrder: options.ignoreOrder ?? false,
77
+ runtime: options.runtime ?? true,
79
78
  insert: typeof options.insert === "function"
80
79
  ? options.insert.toString()
81
80
  : JSON.stringify(options.insert),
@@ -96,7 +95,7 @@ class CssExtractRspackPlugin {
96
95
  return obj;
97
96
  }, {})
98
97
  : {},
99
- pathinfo: (_c = options.pathinfo) !== null && _c !== void 0 ? _c : false
98
+ pathinfo: options.pathinfo ?? false
100
99
  };
101
100
  return normalzedOptions;
102
101
  }
@@ -85,9 +85,8 @@ function getRawResolveByDependency(byDependency) {
85
85
  return Object.fromEntries(Object.entries(byDependency).map(([k, v]) => [k, getRawResolve(v)]));
86
86
  }
87
87
  function getRawResolve(resolve) {
88
- var _a, _b, _c;
89
- let references = (_a = resolve.tsConfig) === null || _a === void 0 ? void 0 : _a.references;
90
- let tsconfigConfigFile = (_b = resolve.tsConfigPath) !== null && _b !== void 0 ? _b : (_c = resolve.tsConfig) === null || _c === void 0 ? void 0 : _c.configFile;
88
+ let references = resolve.tsConfig?.references;
89
+ let tsconfigConfigFile = resolve.tsConfigPath ?? resolve.tsConfig?.configFile;
91
90
  return {
92
91
  ...resolve,
93
92
  alias: getRawAlias(resolve.alias),
@@ -246,7 +245,6 @@ function tryMatch(payload, condition) {
246
245
  return false;
247
246
  }
248
247
  const getRawModuleRule = (rule, path, options) => {
249
- var _a, _b, _c;
250
248
  // Rule.loader is a shortcut to Rule.use: [ { loader } ].
251
249
  // See: https://webpack.js.org/configuration/module/#ruleloader
252
250
  if (rule.loader) {
@@ -265,7 +263,7 @@ const getRawModuleRule = (rule, path, options) => {
265
263
  compiler: options.compiler
266
264
  };
267
265
  const uses = rule.use(context);
268
- return (0, adapterRuleUse_1.createRawModuleRuleUses)(uses !== null && uses !== void 0 ? uses : [], `${path}.use`, options);
266
+ return (0, adapterRuleUse_1.createRawModuleRuleUses)(uses ?? [], `${path}.use`, options);
269
267
  };
270
268
  }
271
269
  let rawModuleRule = {
@@ -296,14 +294,14 @@ const getRawModuleRule = (rule, path, options) => {
296
294
  ? { type: "function", funcUse }
297
295
  : {
298
296
  type: "array",
299
- arrayUse: (0, adapterRuleUse_1.createRawModuleRuleUses)((_a = rule.use) !== null && _a !== void 0 ? _a : [], `${path}.use`, options)
297
+ arrayUse: (0, adapterRuleUse_1.createRawModuleRuleUses)(rule.use ?? [], `${path}.use`, options)
300
298
  },
301
299
  type: rule.type,
302
300
  parser: rule.parser
303
- ? getRawParserOptions(rule.parser, (_b = rule.type) !== null && _b !== void 0 ? _b : "javascript/auto")
301
+ ? getRawParserOptions(rule.parser, rule.type ?? "javascript/auto")
304
302
  : undefined,
305
303
  generator: rule.generator
306
- ? getRawGeneratorOptions(rule.generator, (_c = rule.type) !== null && _c !== void 0 ? _c : "javascript/auto")
304
+ ? getRawGeneratorOptions(rule.generator, rule.type ?? "javascript/auto")
307
305
  : undefined,
308
306
  resolve: rule.resolve ? getRawResolve(rule.resolve) : undefined,
309
307
  oneOf: rule.oneOf
@@ -449,18 +447,17 @@ function getRawParserOptions(parser, type) {
449
447
  throw new Error(`unreachable: unknow module type: ${type}`);
450
448
  }
451
449
  function getRawJavascriptParserOptions(parser) {
452
- var _a, _b, _c, _d, _e, _f, _g;
453
450
  return {
454
- dynamicImportMode: (_a = parser.dynamicImportMode) !== null && _a !== void 0 ? _a : "lazy",
455
- dynamicImportPreload: (_c = (_b = parser.dynamicImportPreload) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : "false",
456
- dynamicImportPrefetch: (_e = (_d = parser.dynamicImportPrefetch) === null || _d === void 0 ? void 0 : _d.toString()) !== null && _e !== void 0 ? _e : "false",
451
+ dynamicImportMode: parser.dynamicImportMode ?? "lazy",
452
+ dynamicImportPreload: parser.dynamicImportPreload?.toString() ?? "false",
453
+ dynamicImportPrefetch: parser.dynamicImportPrefetch?.toString() ?? "false",
457
454
  url: parser.url === false
458
455
  ? "false"
459
456
  : parser.url === "relative"
460
457
  ? parser.url
461
458
  : "true",
462
- exprContextCritical: (_f = parser.exprContextCritical) !== null && _f !== void 0 ? _f : true,
463
- wrappedContextCritical: (_g = parser.wrappedContextCritical) !== null && _g !== void 0 ? _g : false
459
+ exprContextCritical: parser.exprContextCritical ?? true,
460
+ wrappedContextCritical: parser.wrappedContextCritical ?? false
464
461
  };
465
462
  }
466
463
  function getRawAssetParserOptions(parser) {
@@ -620,10 +617,9 @@ function getRawNode(node) {
620
617
  };
621
618
  }
622
619
  function getRawStats(stats) {
623
- var _a;
624
620
  const statsOptions = (0, Stats_1.normalizeStatsPreset)(stats);
625
621
  return {
626
- colors: (_a = statsOptions.colors) !== null && _a !== void 0 ? _a : false
622
+ colors: statsOptions.colors ?? false
627
623
  };
628
624
  }
629
625
  function getRawChunkLoading(chunkLoading) {
@@ -25,7 +25,6 @@ const SwcJsMinimizerPlugin_1 = require("../builtin-plugin/SwcJsMinimizerPlugin")
25
25
  const ModuleTypeConstants_1 = require("../ModuleTypeConstants");
26
26
  const assertNotNil_1 = require("../util/assertNotNil");
27
27
  const applyRspackOptionsDefaults = (options) => {
28
- var _a;
29
28
  F(options, "context", () => process.cwd());
30
29
  F(options, "target", () => {
31
30
  return (0, target_1.getDefaultTarget)(options.context);
@@ -48,7 +47,7 @@ const applyRspackOptionsDefaults = (options) => {
48
47
  D(options, "watch", false);
49
48
  D(options, "profile", false);
50
49
  D(options, "bail", false);
51
- const futureDefaults = (_a = options.experiments.futureDefaults) !== null && _a !== void 0 ? _a : false;
50
+ const futureDefaults = options.experiments.futureDefaults ?? false;
52
51
  F(options, "cache", () => development);
53
52
  applyExperimentsDefaults(options.experiments, {
54
53
  cache: options.cache
@@ -134,13 +133,12 @@ const applyExperimentsDefaults = (experiments, { cache }) => {
134
133
  };
135
134
  const applySnapshotDefaults = (_snapshot, _env) => { };
136
135
  const applyJavascriptParserOptionsDefaults = (parserOptions, fallback) => {
137
- var _a, _b, _c, _d, _e, _f;
138
- D(parserOptions, "dynamicImportMode", (_a = fallback === null || fallback === void 0 ? void 0 : fallback.dynamicImportMode) !== null && _a !== void 0 ? _a : "lazy");
139
- D(parserOptions, "dynamicImportPrefetch", (_b = fallback === null || fallback === void 0 ? void 0 : fallback.dynamicImportPrefetch) !== null && _b !== void 0 ? _b : false);
140
- D(parserOptions, "dynamicImportPreload", (_c = fallback === null || fallback === void 0 ? void 0 : fallback.dynamicImportPreload) !== null && _c !== void 0 ? _c : false);
141
- D(parserOptions, "url", (_d = fallback === null || fallback === void 0 ? void 0 : fallback.url) !== null && _d !== void 0 ? _d : true);
142
- D(parserOptions, "exprContextCritical", (_e = fallback === null || fallback === void 0 ? void 0 : fallback.exprContextCritical) !== null && _e !== void 0 ? _e : true);
143
- D(parserOptions, "wrappedContextCritical", (_f = fallback === null || fallback === void 0 ? void 0 : fallback.wrappedContextCritical) !== null && _f !== void 0 ? _f : false);
136
+ D(parserOptions, "dynamicImportMode", fallback?.dynamicImportMode ?? "lazy");
137
+ D(parserOptions, "dynamicImportPrefetch", fallback?.dynamicImportPrefetch ?? false);
138
+ D(parserOptions, "dynamicImportPreload", fallback?.dynamicImportPreload ?? false);
139
+ D(parserOptions, "url", fallback?.url ?? true);
140
+ D(parserOptions, "exprContextCritical", fallback?.exprContextCritical ?? true);
141
+ D(parserOptions, "wrappedContextCritical", fallback?.wrappedContextCritical ?? false);
144
142
  };
145
143
  const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties }) => {
146
144
  (0, assertNotNil_1.assertNotNill)(module.parser);
@@ -34,7 +34,6 @@ const getNormalizedRspackOptions = (config) => {
34
34
  ? (fn => () => Promise.resolve().then(fn).then(getNormalizedEntryStatic))(config.entry)
35
35
  : getNormalizedEntryStatic(config.entry),
36
36
  output: nestedConfig(config.output, output => {
37
- var _a;
38
37
  const { library } = output;
39
38
  const libraryAsName = library;
40
39
  const libraryBase = typeof library === "object" &&
@@ -99,7 +98,8 @@ const getNormalizedRspackOptions = (config) => {
99
98
  ? output.umdNamedDefine
100
99
  : libraryBase.umdNamedDefine
101
100
  },
102
- strictModuleErrorHandling: (_a = output.strictModuleErrorHandling) !== null && _a !== void 0 ? _a : output.strictModuleExceptionHandling,
101
+ strictModuleErrorHandling: output.strictModuleErrorHandling ??
102
+ output.strictModuleExceptionHandling,
103
103
  trustedTypes: optionalNestedConfig(output.trustedTypes, trustedTypes => {
104
104
  if (trustedTypes === true)
105
105
  return {};
@@ -8,7 +8,6 @@ const options_1 = require("../container/options");
8
8
  const ShareRuntimePlugin_1 = require("../sharing/ShareRuntimePlugin");
9
9
  class ContainerPlugin extends base_1.RspackBuiltinPlugin {
10
10
  constructor(options) {
11
- var _a;
12
11
  super();
13
12
  this.name = binding_1.BuiltinPluginName.ContainerPlugin;
14
13
  this._options = {
@@ -27,7 +26,7 @@ class ContainerPlugin extends base_1.RspackBuiltinPlugin {
27
26
  import: Array.isArray(item.import) ? item.import : [item.import],
28
27
  name: item.name || undefined
29
28
  })),
30
- enhanced: (_a = options.enhanced) !== null && _a !== void 0 ? _a : false
29
+ enhanced: options.enhanced ?? false
31
30
  };
32
31
  }
33
32
  raw(compiler) {
@@ -8,7 +8,6 @@ const ShareRuntimePlugin_1 = require("../sharing/ShareRuntimePlugin");
8
8
  const options_1 = require("./options");
9
9
  class ContainerReferencePlugin extends base_1.RspackBuiltinPlugin {
10
10
  constructor(options) {
11
- var _a;
12
11
  super();
13
12
  this.name = binding_1.BuiltinPluginName.ContainerReferencePlugin;
14
13
  this._options = {
@@ -22,7 +21,7 @@ class ContainerReferencePlugin extends base_1.RspackBuiltinPlugin {
22
21
  : [item.external],
23
22
  shareScope: item.shareScope || options.shareScope || "default"
24
23
  })),
25
- enhanced: (_a = options.enhanced) !== null && _a !== void 0 ? _a : false
24
+ enhanced: options.enhanced ?? false
26
25
  };
27
26
  }
28
27
  raw(compiler) {
@@ -29,7 +29,6 @@ class ModuleFederationPlugin {
29
29
  }
30
30
  exports.ModuleFederationPlugin = ModuleFederationPlugin;
31
31
  function getRemoteInfos(options) {
32
- var _a;
33
32
  if (!options.remotes) {
34
33
  return {};
35
34
  }
@@ -75,7 +74,7 @@ function getRemoteInfos(options) {
75
74
  for (let [key, config] of remotes) {
76
75
  for (let external of config.external) {
77
76
  const [externalType, externalRequest] = getExternal(external);
78
- (_a = remoteInfos[key]) !== null && _a !== void 0 ? _a : (remoteInfos[key] = []);
77
+ remoteInfos[key] ??= [];
79
78
  if (externalType === "script") {
80
79
  const [url, global] = extractUrlAndGlobal(externalRequest);
81
80
  remoteInfos[key].push({
@@ -100,12 +99,11 @@ function getRemoteInfos(options) {
100
99
  return remoteInfos;
101
100
  }
102
101
  function getRuntimePlugins(options) {
103
- var _a;
104
- return (_a = options.runtimePlugins) !== null && _a !== void 0 ? _a : [];
102
+ return options.runtimePlugins ?? [];
105
103
  }
106
104
  function getPaths(options) {
107
- var _a;
108
- const runtimeToolsPath = (_a = options.implementation) !== null && _a !== void 0 ? _a : require.resolve("@module-federation/runtime-tools");
105
+ const runtimeToolsPath = options.implementation ??
106
+ require.resolve("@module-federation/runtime-tools");
109
107
  const bundlerRuntimePath = require.resolve("@module-federation/webpack-bundler-runtime", { paths: [runtimeToolsPath] });
110
108
  const runtimePath = require.resolve("@module-federation/runtime", {
111
109
  paths: [runtimeToolsPath]
@@ -117,7 +115,6 @@ function getPaths(options) {
117
115
  };
118
116
  }
119
117
  function getDefaultEntryRuntime(paths, options, compiler) {
120
- var _a;
121
118
  const runtimePlugins = getRuntimePlugins(options);
122
119
  const remoteInfos = getRemoteInfos(options);
123
120
  const runtimePluginImports = [];
@@ -132,7 +129,7 @@ function getDefaultEntryRuntime(paths, options, compiler) {
132
129
  ...runtimePluginImports,
133
130
  `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
134
131
  `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
135
- `const __module_federation_container_name__ = ${JSON.stringify((_a = options.name) !== null && _a !== void 0 ? _a : compiler.options.output.uniqueName)}`,
132
+ `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
136
133
  compiler.webpack.Template.getFunctionContent(require("./default.runtime"))
137
134
  ].join("\n");
138
135
  // use "data:text/javascript" to use moduleType "javascript/auto"
@@ -12,9 +12,8 @@ class ModuleFederationPluginV1 {
12
12
  this._options = _options;
13
13
  }
14
14
  apply(compiler) {
15
- var _a;
16
15
  const { _options: options } = this;
17
- const enhanced = (_a = options.enhanced) !== null && _a !== void 0 ? _a : false;
16
+ const enhanced = options.enhanced ?? false;
18
17
  const library = options.library || { type: "var", name: options.name };
19
18
  const remoteType = options.remoteType ||
20
19
  (options.library && (0, validate_1.isValidate)(options.library.type, config_1.externalsType)
@@ -2,7 +2,6 @@
2
2
  // @ts-nocheck
3
3
  var __module_federation_bundler_runtime__, __module_federation_runtime_plugins__, __module_federation_remote_infos__, __module_federation_container_name__;
4
4
  module.exports = function () {
5
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
6
5
  if ((__webpack_require__.initializeSharingData ||
7
6
  __webpack_require__.initializeExposesData) &&
8
7
  __webpack_require__.federation) {
@@ -13,30 +12,30 @@ module.exports = function () {
13
12
  obj[key] = value;
14
13
  };
15
14
  const merge = (obj, key, fn) => {
16
- var _a, _b;
17
15
  const value = fn();
18
16
  if (Array.isArray(value)) {
19
- (_a = obj[key]) !== null && _a !== void 0 ? _a : (obj[key] = []);
17
+ obj[key] ??= [];
20
18
  obj[key].push(...value);
21
19
  }
22
20
  else if (typeof value === "object" && value !== null) {
23
- (_b = obj[key]) !== null && _b !== void 0 ? _b : (obj[key] = {});
21
+ obj[key] ??= {};
24
22
  Object.assign(obj[key], value);
25
23
  }
26
24
  };
27
25
  const early = (obj, key, initial) => {
28
- var _a;
29
- (_a = obj[key]) !== null && _a !== void 0 ? _a : (obj[key] = initial());
26
+ obj[key] ??= initial();
30
27
  };
31
- const remotesLoadingChunkMapping = (_b = (_a = __webpack_require__.remotesLoadingData) === null || _a === void 0 ? void 0 : _a.chunkMapping) !== null && _b !== void 0 ? _b : {};
32
- const remotesLoadingModuleIdToRemoteDataMapping = (_d = (_c = __webpack_require__.remotesLoadingData) === null || _c === void 0 ? void 0 : _c.moduleIdToRemoteDataMapping) !== null && _d !== void 0 ? _d : {};
33
- const initializeSharingScopeToInitDataMapping = (_f = (_e = __webpack_require__.initializeSharingData) === null || _e === void 0 ? void 0 : _e.scopeToSharingDataMapping) !== null && _f !== void 0 ? _f : {};
34
- const consumesLoadingChunkMapping = (_h = (_g = __webpack_require__.consumesLoadingData) === null || _g === void 0 ? void 0 : _g.chunkMapping) !== null && _h !== void 0 ? _h : {};
35
- const consumesLoadingModuleToConsumeDataMapping = (_k = (_j = __webpack_require__.consumesLoadingData) === null || _j === void 0 ? void 0 : _j.moduleIdToConsumeDataMapping) !== null && _k !== void 0 ? _k : {};
28
+ const remotesLoadingChunkMapping = __webpack_require__.remotesLoadingData?.chunkMapping ?? {};
29
+ const remotesLoadingModuleIdToRemoteDataMapping = __webpack_require__.remotesLoadingData?.moduleIdToRemoteDataMapping ?? {};
30
+ const initializeSharingScopeToInitDataMapping = __webpack_require__.initializeSharingData?.scopeToSharingDataMapping ??
31
+ {};
32
+ const consumesLoadingChunkMapping = __webpack_require__.consumesLoadingData?.chunkMapping ?? {};
33
+ const consumesLoadingModuleToConsumeDataMapping = __webpack_require__.consumesLoadingData?.moduleIdToConsumeDataMapping ??
34
+ {};
36
35
  const consumesLoadinginstalledModules = {};
37
36
  const initializeSharingInitPromises = [];
38
37
  const initializeSharingInitTokens = [];
39
- const containerShareScope = (_l = __webpack_require__.initializeExposesData) === null || _l === void 0 ? void 0 : _l.shareScope;
38
+ const containerShareScope = __webpack_require__.initializeExposesData?.shareScope;
40
39
  for (const key in __module_federation_bundler_runtime__) {
41
40
  __webpack_require__.federation[key] =
42
41
  __module_federation_bundler_runtime__[key];
@@ -159,7 +158,7 @@ module.exports = function () {
159
158
  });
160
159
  __webpack_require__.federation.instance =
161
160
  __webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);
162
- if ((_m = __webpack_require__.consumesLoadingData) === null || _m === void 0 ? void 0 : _m.initialConsumes) {
161
+ if (__webpack_require__.consumesLoadingData?.initialConsumes) {
163
162
  __webpack_require__.federation.bundlerRuntime.installInitialConsumes({
164
163
  webpackRequire: __webpack_require__,
165
164
  installedModules: consumesLoadinginstalledModules,
@@ -159,11 +159,10 @@ const safeStage = (stage) => {
159
159
  exports.safeStage = safeStage;
160
160
  class QueriedHook {
161
161
  constructor(stageRange, hook) {
162
- var _a;
163
162
  const tapsInRange = [];
164
163
  const [from, to] = stageRange;
165
164
  for (let tap of hook.taps) {
166
- const stage = (_a = tap.stage) !== null && _a !== void 0 ? _a : 0;
165
+ const stage = tap.stage ?? 0;
167
166
  if (from < stage && stage <= to) {
168
167
  tapsInRange.push(tap);
169
168
  }
@@ -580,7 +579,7 @@ class AsyncSeriesBailHook extends Hook {
580
579
  exports.AsyncSeriesBailHook = AsyncSeriesBailHook;
581
580
  class AsyncSeriesWaterfallHook extends Hook {
582
581
  constructor(args, name) {
583
- if (!(args === null || args === void 0 ? void 0 : args.length))
582
+ if (!args?.length)
584
583
  throw new Error("Waterfall hooks must have at least one argument");
585
584
  super(args, name);
586
585
  }
@@ -719,7 +718,7 @@ class HookMap {
719
718
  isUsed() {
720
719
  for (const key of this._map.keys()) {
721
720
  const hook = this.get(key);
722
- if (hook === null || hook === void 0 ? void 0 : hook.isUsed()) {
721
+ if (hook?.isUsed()) {
723
722
  return true;
724
723
  }
725
724
  }
@@ -736,16 +735,14 @@ class QueriedHookMap {
736
735
  this.hookMap = hookMap;
737
736
  }
738
737
  get(key) {
739
- var _a;
740
- return (_a = this.hookMap.get(key)) === null || _a === void 0 ? void 0 : _a.queryStageRange(this.stageRange);
738
+ return this.hookMap.get(key)?.queryStageRange(this.stageRange);
741
739
  }
742
740
  for(key) {
743
741
  return this.hookMap.for(key).queryStageRange(this.stageRange);
744
742
  }
745
743
  isUsed() {
746
- var _a;
747
744
  for (const key in this.hookMap._map.keys()) {
748
- if ((_a = this.get(key)) === null || _a === void 0 ? void 0 : _a.isUsed()) {
745
+ if (this.get(key)?.isUsed()) {
749
746
  return true;
750
747
  }
751
748
  }
@@ -23,9 +23,9 @@ const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)
23
23
  function parsePathQueryFragment(str) {
24
24
  const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
25
25
  return {
26
- path: (match === null || match === void 0 ? void 0 : match[1].replace(/\0(.)/g, "$1")) || "",
27
- query: (match === null || match === void 0 ? void 0 : match[2]) ? match[2].replace(/\0(.)/g, "$1") : "",
28
- fragment: (match === null || match === void 0 ? void 0 : match[3]) || ""
26
+ path: match?.[1].replace(/\0(.)/g, "$1") || "",
27
+ query: match?.[2] ? match[2].replace(/\0(.)/g, "$1") : "",
28
+ fragment: match?.[3] || ""
29
29
  };
30
30
  }
31
31
  exports.parsePathQueryFragment = parsePathQueryFragment;
@@ -480,7 +480,7 @@ async function runLoaders(compiler, rawContext) {
480
480
  loaderContext._compilation = compiler._lastCompilation;
481
481
  loaderContext.getOptions = function () {
482
482
  const loader = getCurrentLoader(loaderContext);
483
- let options = loader === null || loader === void 0 ? void 0 : loader.options;
483
+ let options = loader?.options;
484
484
  if (typeof options === "string") {
485
485
  if (options.startsWith("{") && options.endsWith("}")) {
486
486
  try {
@@ -37,14 +37,13 @@ module.exports = function loadLoader(loader, callback) {
37
37
  if (loader.path.startsWith("builtin:")) {
38
38
  // @ts-expect-error
39
39
  module = async function (content, sourceMap, additionalData) {
40
- var _a;
41
40
  // @ts-expect-error
42
41
  assert(!this.__internal__context.isPitching);
43
42
  // @ts-expect-error
44
43
  const callback = this.async();
45
44
  const { runBuiltinLoader } = require("@rspack/binding");
46
45
  // @ts-expect-error
47
- let options = (_a = this.getOptions()) !== null && _a !== void 0 ? _a : {};
46
+ let options = this.getOptions() ?? {};
48
47
  // This is used an hack to tell `builtin:swc-loader` whether to return AST or source.
49
48
  // @ts-expect-error
50
49
  this.__internal__context.loaderIndexFromJs = this.loaderIndex;
@@ -26,7 +26,6 @@ const cleverMerge_1 = require("./util/cleverMerge");
26
26
  class RspackOptionsApply {
27
27
  constructor() { }
28
28
  process(options, compiler) {
29
- var _a, _b, _c;
30
29
  (0, assert_1.default)(options.output.path, "options.output.path should have value after `applyRspackOptionsDefaults`");
31
30
  compiler.outputPath = options.output.path;
32
31
  compiler.name = options.name;
@@ -167,7 +166,7 @@ class RspackOptionsApply {
167
166
  new builtin_plugin_1.LazyCompilationPlugin(
168
167
  // this is only for test
169
168
  // @ts-expect-error cacheable is hide
170
- (_a = lazyOptions.cacheable) !== null && _a !== void 0 ? _a : true, (_b = lazyOptions.entries) !== null && _b !== void 0 ? _b : true, (_c = lazyOptions.imports) !== null && _c !== void 0 ? _c : true, typeof lazyOptions.test === "function"
169
+ lazyOptions.cacheable ?? true, lazyOptions.entries ?? true, lazyOptions.imports ?? true, typeof lazyOptions.test === "function"
171
170
  ? function (jsModule) {
172
171
  return lazyOptions.test.call(lazyOptions, new Module_1.Module(jsModule));
173
172
  }
@@ -8,7 +8,6 @@ const ShareRuntimePlugin_1 = require("./ShareRuntimePlugin");
8
8
  const utils_1 = require("./utils");
9
9
  class ConsumeSharedPlugin extends base_1.RspackBuiltinPlugin {
10
10
  constructor(options) {
11
- var _a;
12
11
  super();
13
12
  this.name = binding_1.BuiltinPluginName.ConsumeSharedPlugin;
14
13
  this._options = {
@@ -52,7 +51,7 @@ class ConsumeSharedPlugin extends base_1.RspackBuiltinPlugin {
52
51
  singleton: !!item.singleton,
53
52
  eager: !!item.eager
54
53
  })),
55
- enhanced: (_a = options.enhanced) !== null && _a !== void 0 ? _a : false
54
+ enhanced: options.enhanced ?? false
56
55
  };
57
56
  }
58
57
  raw(compiler) {
@@ -7,7 +7,6 @@ const options_1 = require("../container/options");
7
7
  const ShareRuntimePlugin_1 = require("./ShareRuntimePlugin");
8
8
  class ProvideSharedPlugin extends base_1.RspackBuiltinPlugin {
9
9
  constructor(options) {
10
- var _a;
11
10
  super();
12
11
  this.name = binding_1.BuiltinPluginName.ProvideSharedPlugin;
13
12
  this._options = {
@@ -27,7 +26,7 @@ class ProvideSharedPlugin extends base_1.RspackBuiltinPlugin {
27
26
  shareScope: item.shareScope || options.shareScope || "default",
28
27
  eager: !!item.eager
29
28
  })),
30
- enhanced: (_a = options.enhanced) !== null && _a !== void 0 ? _a : false
29
+ enhanced: options.enhanced ?? false
31
30
  };
32
31
  }
33
32
  raw(compiler) {
@@ -7,7 +7,6 @@ const ProvideSharedPlugin_1 = require("./ProvideSharedPlugin");
7
7
  const utils_1 = require("./utils");
8
8
  class SharePlugin {
9
9
  constructor(options) {
10
- var _a;
11
10
  const sharedOptions = (0, options_1.parseOptions)(options.shared, (item, key) => {
12
11
  if (typeof item !== "string")
13
12
  throw new Error("Unexpected array in shared");
@@ -46,7 +45,7 @@ class SharePlugin {
46
45
  this._shareScope = options.shareScope;
47
46
  this._consumes = consumes;
48
47
  this._provides = provides;
49
- this._enhanced = (_a = options.enhanced) !== null && _a !== void 0 ? _a : false;
48
+ this._enhanced = options.enhanced ?? false;
50
49
  }
51
50
  apply(compiler) {
52
51
  new ConsumeSharedPlugin_1.ConsumeSharedPlugin({
@@ -289,7 +289,6 @@ const SORTERS = {
289
289
  const SIMPLE_EXTRACTORS = {
290
290
  compilation: {
291
291
  _: (object, compilation, context, options) => {
292
- var _a;
293
292
  if (!context.makePathsRelative) {
294
293
  context.makePathsRelative = identifier_1.makePathsRelative.bindContextCache(compilation.compiler.context, compilation.compiler.root);
295
294
  }
@@ -370,7 +369,7 @@ const SIMPLE_EXTRACTORS = {
370
369
  const entry = {
371
370
  type: rest.type,
372
371
  trace: rest.trace,
373
- args: (_a = rest.args) !== null && _a !== void 0 ? _a : []
372
+ args: rest.args ?? []
374
373
  };
375
374
  if (value) {
376
375
  value.push(entry);
@@ -166,7 +166,7 @@ const SIMPLE_PRINTERS = {
166
166
  "asset.emitted": (emitted, { green, formatFlag }) => emitted ? green(formatFlag("emitted")) : undefined,
167
167
  "asset.comparedForEmit": (comparedForEmit, { yellow, formatFlag }) => comparedForEmit ? yellow(formatFlag("compared for emit")) : undefined,
168
168
  "asset.cached": (cached, { green, formatFlag }) => cached ? green(formatFlag("cached")) : undefined,
169
- "asset.isOverSizeLimit": (isOverSizeLimit, { yellow, formatFlag }) => isOverSizeLimit ? yellow === null || yellow === void 0 ? void 0 : yellow(formatFlag("big")) : undefined,
169
+ "asset.isOverSizeLimit": (isOverSizeLimit, { yellow, formatFlag }) => isOverSizeLimit ? yellow?.(formatFlag("big")) : undefined,
170
170
  "asset.info.immutable": (immutable, { green, formatFlag }) => immutable ? green(formatFlag("immutable")) : undefined,
171
171
  "asset.info.javascriptModule": (javascriptModule, { formatFlag }) => javascriptModule ? formatFlag("javascript module") : undefined,
172
172
  "asset.info.sourceFilename": (sourceFilename, { formatFlag }) => sourceFilename
@@ -96,13 +96,12 @@ function toJsAssetInfo(info) {
96
96
  }
97
97
  exports.toJsAssetInfo = toJsAssetInfo;
98
98
  const getDeprecationStatus = () => {
99
- var _a;
100
99
  const defaultEnableDeprecatedWarning = true;
101
100
  if (process.env.RSPACK_DEP_WARNINGS === "false" ||
102
101
  process.env.RSPACK_DEP_WARNINGS === "0") {
103
102
  return false;
104
103
  }
105
- return (((_a = process.env.RSPACK_DEP_WARNINGS) !== null && _a !== void 0 ? _a : `${defaultEnableDeprecatedWarning}`) !==
104
+ return ((process.env.RSPACK_DEP_WARNINGS ?? `${defaultEnableDeprecatedWarning}`) !==
106
105
  "false");
107
106
  };
108
107
  const yellow = (content) => `\u001b[1m\u001b[33m${content}\u001b[39m\u001b[22m`;
@@ -29,7 +29,6 @@ class JsSource extends webpack_sources_1.Source {
29
29
  });
30
30
  }
31
31
  static __to_binding(source) {
32
- var _a, _b, _c;
33
32
  const sourceSource = source.source();
34
33
  const isBuffer = Buffer.isBuffer(sourceSource);
35
34
  if (source instanceof webpack_sources_1.RawSource) {
@@ -39,12 +38,13 @@ class JsSource extends webpack_sources_1.Source {
39
38
  isBuffer
40
39
  };
41
40
  }
42
- const buffer = (_b = (_a = source.buffer) === null || _a === void 0 ? void 0 : _a.call(source)) !== null && _b !== void 0 ? _b : (isBuffer
43
- ? sourceSource
44
- : sourceSource instanceof ArrayBuffer
45
- ? arrayBufferToBuffer(sourceSource)
46
- : Buffer.from(sourceSource));
47
- const map = JSON.stringify((_c = source.map) === null || _c === void 0 ? void 0 : _c.call(source, {
41
+ const buffer = source.buffer?.() ??
42
+ (isBuffer
43
+ ? sourceSource
44
+ : sourceSource instanceof ArrayBuffer
45
+ ? arrayBufferToBuffer(sourceSource)
46
+ : Buffer.from(sourceSource));
47
+ const map = JSON.stringify(source.map?.({
48
48
  columns: true
49
49
  }));
50
50
  return {
@@ -3,10 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isValidate = exports.validate = void 0;
4
4
  const zod_validation_error_1 = require("../../compiled/zod-validation-error");
5
5
  function validate(opts, schema) {
6
- var _a;
7
6
  const res = schema.safeParse(opts);
8
7
  if (!res.success) {
9
- const strategy = (_a = process.env.RSPACK_CONFIG_VALIDATE) !== null && _a !== void 0 ? _a : "strict";
8
+ const strategy = process.env.RSPACK_CONFIG_VALIDATE ?? "strict";
10
9
  if (strategy === "loose-silent")
11
10
  return;
12
11
  const issueSeparator = "$issue$";
@@ -35,7 +34,7 @@ function isValidate(opts, schema) {
35
34
  validate(opts, schema);
36
35
  return true;
37
36
  }
38
- catch (_a) {
37
+ catch {
39
38
  return false;
40
39
  }
41
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.7.0-beta.2-canary-89c6913-20240527004336",
3
+ "version": "0.7.0-canary-c216972-20240528031643",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "A Fast Rust-based Web Bundler",
@@ -72,15 +72,15 @@
72
72
  "watchpack": "^2.4.0",
73
73
  "zod": "^3.21.4",
74
74
  "zod-validation-error": "1.3.1",
75
- "@rspack/core": "0.7.0-beta.2-canary-89c6913-20240527004336",
76
- "@rspack/plugin-minify": "^0.7.0-beta.2-canary-89c6913-20240527004336"
75
+ "@rspack/core": "0.7.0-canary-c216972-20240528031643",
76
+ "@rspack/plugin-minify": "^0.7.0-canary-c216972-20240528031643"
77
77
  },
78
78
  "dependencies": {
79
79
  "@module-federation/runtime-tools": "0.1.6",
80
80
  "caniuse-lite": "^1.0.30001616",
81
81
  "tapable": "2.2.1",
82
82
  "webpack-sources": "3.2.3",
83
- "@rspack/binding": "0.7.0-beta.2-canary-89c6913-20240527004336"
83
+ "@rspack/binding": "0.7.0-canary-c216972-20240528031643"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "@swc/helpers": ">=0.5.1"