@rspack/core 1.0.0-alpha.3 → 1.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/compiled/browserslist/index.js +17 -17
  2. package/compiled/enhanced-resolve/index.js +107 -107
  3. package/compiled/graceful-fs/index.js +8 -8
  4. package/compiled/json-parse-even-better-errors/index.js +2 -2
  5. package/compiled/neo-async/index.js +2 -2
  6. package/compiled/watchpack/index.js +15 -15
  7. package/compiled/webpack-sources/index.js +76 -76
  8. package/compiled/zod/index.js +30 -30
  9. package/compiled/zod-validation-error/index.js +6 -6
  10. package/dist/Compilation.js +2 -3
  11. package/dist/ErrorHelpers.d.ts +16 -7
  12. package/dist/ErrorHelpers.js +34 -33
  13. package/dist/ExecuteModulePlugin.js +1 -1
  14. package/dist/FileSystem.js +6 -6
  15. package/dist/Module.d.ts +1 -2
  16. package/dist/Module.js +2 -6
  17. package/dist/MultiCompiler.js +1 -1
  18. package/dist/NormalModule.js +6 -6
  19. package/dist/ResolverFactory.d.ts +5 -1
  20. package/dist/ResolverFactory.js +7 -1
  21. package/dist/RuntimeGlobals.js +3 -3
  22. package/dist/Stats.js +4 -4
  23. package/dist/Template.js +2 -2
  24. package/dist/Watching.js +2 -2
  25. package/dist/builtin-plugin/DefinePlugin.js +2 -2
  26. package/dist/builtin-plugin/EntryPlugin.js +1 -1
  27. package/dist/builtin-plugin/SplitChunksPlugin.js +2 -2
  28. package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +10 -2
  29. package/dist/builtin-plugin/SwcCssMinimizerPlugin.js +7 -1
  30. package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +2 -2
  31. package/dist/builtin-plugin/WorkerPlugin.js +5 -1
  32. package/dist/builtin-plugin/base.js +1 -1
  33. package/dist/builtin-plugin/css-extract/loader.js +5 -5
  34. package/dist/builtin-plugin/css-extract/utils.js +3 -3
  35. package/dist/builtin-plugin/lazy-compilation/backend.d.ts +3 -3
  36. package/dist/builtin-plugin/lazy-compilation/backend.js +1 -1
  37. package/dist/config/adapter.d.ts +1 -1
  38. package/dist/config/adapter.js +27 -16
  39. package/dist/config/adapterRuleUse.js +1 -1
  40. package/dist/config/browserslistTargetHandler.js +2 -2
  41. package/dist/config/defaults.js +11 -10
  42. package/dist/config/zod.d.ts +119 -12
  43. package/dist/config/zod.js +43 -40
  44. package/dist/container/ModuleFederationPlugin.js +2 -2
  45. package/dist/lib/EntryOptionPlugin.js +2 -2
  46. package/dist/lib/WebpackError.js +1 -1
  47. package/dist/loader-runner/index.js +22 -22
  48. package/dist/loader-runner/loadLoader.js +1 -1
  49. package/dist/logging/runtime.js +1 -1
  50. package/dist/node/NodeWatchFileSystem.js +5 -5
  51. package/dist/node/nodeConsole.js +1 -1
  52. package/dist/rspack.js +6 -6
  53. package/dist/rspackOptionsApply.js +3 -3
  54. package/dist/sharing/ConsumeSharedPlugin.js +1 -1
  55. package/dist/stats/DefaultStatsFactoryPlugin.js +285 -50
  56. package/dist/stats/DefaultStatsPresetPlugin.js +17 -17
  57. package/dist/stats/DefaultStatsPrinterPlugin.js +2 -2
  58. package/dist/stats/statsFactoryUtils.d.ts +24 -10
  59. package/dist/util/bindingVersionCheck.js +6 -6
  60. package/dist/util/createHash.js +2 -2
  61. package/dist/util/fs.js +11 -11
  62. package/dist/util/identifier.d.ts +65 -62
  63. package/dist/util/identifier.js +30 -55
  64. package/package.json +6 -3
@@ -118,7 +118,7 @@ const entry = entryStatic.or(zod_1.z.function().returns(entryStatic.or(zod_1.z.p
118
118
  //#region Output
119
119
  const path = zod_1.z.string();
120
120
  const pathinfo = zod_1.z.boolean().or(zod_1.z.literal("verbose"));
121
- const assetModuleFilename = zod_1.z.string();
121
+ const assetModuleFilename = filename;
122
122
  const webassemblyModuleFilename = zod_1.z.string();
123
123
  const chunkFilename = filename;
124
124
  const crossOriginLoading = zod_1.z
@@ -345,6 +345,7 @@ const reexportExportsPresence = zod_1.z
345
345
  .or(zod_1.z.literal(false));
346
346
  const strictExportPresence = zod_1.z.boolean();
347
347
  const worker = zod_1.z.array(zod_1.z.string()).or(zod_1.z.boolean());
348
+ const overrideStrict = zod_1.z.enum(["strict", "non-strict"]);
348
349
  const javascriptParserOptions = zod_1.z.strictObject({
349
350
  dynamicImportMode: dynamicImportMode.optional(),
350
351
  dynamicImportPreload: dynamicImportPreload.optional(),
@@ -357,7 +358,8 @@ const javascriptParserOptions = zod_1.z.strictObject({
357
358
  importExportsPresence: importExportsPresence.optional(),
358
359
  reexportExportsPresence: reexportExportsPresence.optional(),
359
360
  strictExportPresence: strictExportPresence.optional(),
360
- worker: worker.optional()
361
+ worker: worker.optional(),
362
+ overrideStrict: overrideStrict.optional()
361
363
  });
362
364
  const parserOptionsByModuleTypeKnown = zod_1.z.strictObject({
363
365
  asset: assetParserOptions.optional(),
@@ -442,44 +444,45 @@ const moduleOptions = zod_1.z.strictObject({
442
444
  });
443
445
  //#endregion
444
446
  //#region Target
445
- const allowTarget = zod_1.z
446
- .enum([
447
- "web",
448
- "webworker",
449
- "es3",
450
- "es5",
451
- "es2015",
452
- "es2016",
453
- "es2017",
454
- "es2018",
455
- "es2019",
456
- "es2020",
457
- "es2021",
458
- "es2022",
459
- "browserslist"
460
- ])
461
- .or(zod_1.z.literal("node"))
462
- .or(zod_1.z.literal("async-node"))
463
- .or(zod_1.z.custom(value => typeof value === "string" && /^node\d+$/.test(value)))
464
- .or(zod_1.z.custom(value => typeof value === "string" && /^async-node\d+$/.test(value)))
465
- .or(zod_1.z.custom(value => typeof value === "string" && /^node\d+\.\d+$/.test(value)))
466
- .or(zod_1.z.custom(value => typeof value === "string" && /^async-node\d+\.\d+$/.test(value)))
467
- .or(zod_1.z.literal("electron-main"))
468
- .or(zod_1.z.custom(value => typeof value === "string" && /^electron\d+-main$/.test(value)))
469
- .or(zod_1.z.custom(value => typeof value === "string" && /^electron\d+\.\d+-main$/.test(value)))
470
- .or(zod_1.z.literal("electron-renderer"))
471
- .or(zod_1.z.custom(value => typeof value === "string" && /^electron\d+-renderer$/.test(value)))
472
- .or(zod_1.z.custom(value => typeof value === "string" && /^electron\d+\.\d+-renderer$/.test(value)))
473
- .or(zod_1.z.literal("electron-preload"))
474
- .or(zod_1.z.custom(value => typeof value === "string" && /^electron\d+-preload$/.test(value)))
475
- .or(zod_1.z.custom(value => typeof value === "string" && /^electron\d+\.\d+-preload$/.test(value)))
476
- .or(zod_1.z.literal("nwjs"))
477
- .or(zod_1.z.custom(value => typeof value === "string" && /^nwjs\d+$/.test(value)))
478
- .or(zod_1.z.custom(value => typeof value === "string" && /^nwjs\d+\.\d+$/.test(value)))
479
- .or(zod_1.z.literal("node-webkit"))
480
- .or(zod_1.z.custom(value => typeof value === "string" && /^node-webkit\d+$/.test(value)))
481
- .or(zod_1.z.custom(value => typeof value === "string" && /^node-webkit\d+\.\d+$/.test(value)));
482
- const target = zod_1.z.literal(false).or(allowTarget).or(allowTarget.array());
447
+ const allowTarget = zod_1.z.union([
448
+ zod_1.z.enum([
449
+ "web",
450
+ "webworker",
451
+ "es3",
452
+ "es5",
453
+ "es2015",
454
+ "es2016",
455
+ "es2017",
456
+ "es2018",
457
+ "es2019",
458
+ "es2020",
459
+ "es2021",
460
+ "es2022",
461
+ "browserslist"
462
+ ]),
463
+ zod_1.z.literal("node"),
464
+ zod_1.z.literal("async-node"),
465
+ zod_1.z.custom(value => typeof value === "string" && /^node\d+$/.test(value)),
466
+ zod_1.z.custom(value => typeof value === "string" && /^async-node\d+$/.test(value)),
467
+ zod_1.z.custom(value => typeof value === "string" && /^node\d+\.\d+$/.test(value)),
468
+ zod_1.z.custom(value => typeof value === "string" && /^async-node\d+\.\d+$/.test(value)),
469
+ zod_1.z.literal("electron-main"),
470
+ zod_1.z.custom(value => typeof value === "string" && /^electron\d+-main$/.test(value)),
471
+ zod_1.z.custom(value => typeof value === "string" && /^electron\d+\.\d+-main$/.test(value)),
472
+ zod_1.z.literal("electron-renderer"),
473
+ zod_1.z.custom(value => typeof value === "string" && /^electron\d+-renderer$/.test(value)),
474
+ zod_1.z.custom(value => typeof value === "string" && /^electron\d+\.\d+-renderer$/.test(value)),
475
+ zod_1.z.literal("electron-preload"),
476
+ zod_1.z.custom(value => typeof value === "string" && /^electron\d+-preload$/.test(value)),
477
+ zod_1.z.custom(value => typeof value === "string" && /^electron\d+\.\d+-preload$/.test(value)),
478
+ zod_1.z.literal("nwjs"),
479
+ zod_1.z.custom(value => typeof value === "string" && /^nwjs\d+$/.test(value)),
480
+ zod_1.z.custom(value => typeof value === "string" && /^nwjs\d+\.\d+$/.test(value)),
481
+ zod_1.z.literal("node-webkit"),
482
+ zod_1.z.custom(value => typeof value === "string" && /^node-webkit\d+$/.test(value)),
483
+ zod_1.z.custom(value => typeof value === "string" && /^node-webkit\d+\.\d+$/.test(value))
484
+ ]);
485
+ const target = zod_1.z.union([zod_1.z.literal(false), allowTarget, allowTarget.array()]);
483
486
  //#endregion
484
487
  //#region ExternalsType
485
488
  exports.externalsType = zod_1.z.enum([
@@ -71,8 +71,8 @@ function getRemoteInfos(options) {
71
71
  shareScope: item.shareScope || options.shareScope || "default"
72
72
  }));
73
73
  const remoteInfos = {};
74
- for (let [key, config] of remotes) {
75
- for (let external of config.external) {
74
+ for (const [key, config] of remotes) {
75
+ for (const external of config.external) {
76
76
  const [externalType, externalRequest] = getExternal(external);
77
77
  remoteInfos[key] ??= [];
78
78
  if (externalType === "script") {
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const assert_1 = __importDefault(require("assert"));
15
+ const node_assert_1 = __importDefault(require("node:assert"));
16
16
  const builtin_plugin_1 = require("../builtin-plugin");
17
17
  class EntryOptionPlugin {
18
18
  apply(compiler) {
@@ -29,7 +29,7 @@ class EntryOptionPlugin {
29
29
  for (const name of Object.keys(entry)) {
30
30
  const desc = entry[name];
31
31
  const options = EntryOptionPlugin.entryDescriptionToOptions(compiler, name, desc);
32
- (0, assert_1.default)(desc.import !== undefined, "desc.import should not be `undefined` once `EntryOptionPlugin.applyEntryOption` is called");
32
+ (0, node_assert_1.default)(desc.import !== undefined, "desc.import should not be `undefined` once `EntryOptionPlugin.applyEntryOption` is called");
33
33
  for (const entry of desc.import) {
34
34
  new builtin_plugin_1.EntryPlugin(context, entry, options).apply(compiler);
35
35
  }
@@ -3,7 +3,7 @@
3
3
  Author Jarid Margolin @jaridmargolin
4
4
  */
5
5
  "use strict";
6
- const inspect = require("util").inspect.custom;
6
+ const inspect = require("node:util").inspect.custom;
7
7
  // /** @typedef {import("./Chunk")} Chunk */
8
8
  // /** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
9
9
  // /** @typedef {import("./Module")} Module */
@@ -26,15 +26,15 @@ var _LoaderObject_loaderItem;
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.parsePathQueryFragment = exports.runLoaders = exports.LoaderObject = void 0;
28
28
  const node_querystring_1 = __importDefault(require("node:querystring"));
29
- const assert_1 = __importDefault(require("assert"));
30
- const util_1 = require("util");
29
+ const node_assert_1 = __importDefault(require("node:assert"));
30
+ const node_util_1 = require("node:util");
31
31
  const binding_1 = require("@rspack/binding");
32
32
  const webpack_sources_1 = require("../../compiled/webpack-sources");
33
33
  const Module_1 = require("../Module");
34
34
  const NormalModule_1 = require("../NormalModule");
35
35
  const RspackError_1 = require("../RspackError");
36
36
  const adapterRuleUse_1 = require("../config/adapterRuleUse");
37
- const util_2 = require("../util");
37
+ const util_1 = require("../util");
38
38
  const createHash_1 = require("../util/createHash");
39
39
  const identifier_1 = require("../util/identifier");
40
40
  const memoize_1 = require("../util/memoize");
@@ -59,10 +59,10 @@ function createLoaderObject(loader, compiler) {
59
59
  obj.query.replace(/#/g, "\u200b#") +
60
60
  obj.fragment,
61
61
  set: value => {
62
- var splittedRequest = (0, identifier_1.parseResourceWithoutFragment)(value.request);
62
+ const splittedRequest = (0, identifier_1.parseResourceWithoutFragment)(value.request);
63
63
  obj.path = splittedRequest.path;
64
64
  obj.query = splittedRequest.query;
65
- obj.fragment = splittedRequest.fragment || "";
65
+ obj.fragment = "";
66
66
  obj.options =
67
67
  obj.options === null
68
68
  ? splittedRequest.query
@@ -123,14 +123,14 @@ class LoaderObject {
123
123
  return __classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").pitchExecuted;
124
124
  }
125
125
  set pitchExecuted(value) {
126
- (0, assert_1.default)(value);
126
+ (0, node_assert_1.default)(value);
127
127
  __classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").pitchExecuted = true;
128
128
  }
129
129
  get normalExecuted() {
130
130
  return __classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").normalExecuted;
131
131
  }
132
132
  set normalExecuted(value) {
133
- (0, assert_1.default)(value);
133
+ (0, node_assert_1.default)(value);
134
134
  __classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").normalExecuted = true;
135
135
  }
136
136
  // A data object shared between the pitch and the normal phase
@@ -167,14 +167,14 @@ exports.LoaderObject = LoaderObject;
167
167
  _LoaderObject_loaderItem = new WeakMap();
168
168
  class JsSourceMap {
169
169
  static __from_binding(map) {
170
- return (0, util_2.isNil)(map) ? undefined : (0, util_2.toObject)(map);
170
+ return (0, util_1.isNil)(map) ? undefined : (0, util_1.toObject)(map);
171
171
  }
172
172
  static __to_binding(map) {
173
- return (0, util_2.serializeObject)(map);
173
+ return (0, util_1.serializeObject)(map);
174
174
  }
175
175
  }
176
- const loadLoaderAsync = (0, util_1.promisify)(loadLoader_1.default);
177
- const runSyncOrAsync = (0, util_1.promisify)(function runSyncOrAsync(fn, context, args, callback) {
176
+ const loadLoaderAsync = (0, node_util_1.promisify)(loadLoader_1.default);
177
+ const runSyncOrAsync = (0, node_util_1.promisify)(function runSyncOrAsync(fn, context, args, callback) {
178
178
  let isSync = true;
179
179
  let isDone = false;
180
180
  let isError = false; // internal error
@@ -231,7 +231,7 @@ const runSyncOrAsync = (0, util_1.promisify)(function runSyncOrAsync(fn, context
231
231
  }
232
232
  catch (e) {
233
233
  // use string for napi getter
234
- let err = e;
234
+ const err = e;
235
235
  if ("hideStack" in err && err.hideStack) {
236
236
  err.hideStack = "true";
237
237
  }
@@ -514,11 +514,11 @@ async function runLoaders(compiler, context) {
514
514
  if (!(error instanceof Error)) {
515
515
  error = new RspackError_1.NonErrorEmittedError(error);
516
516
  }
517
- let hasStack = !!error.stack;
517
+ const hasStack = !!error.stack;
518
518
  error.name = "ModuleError";
519
- error.message = `${error.message} (from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`;
519
+ error.message = `${error.message} (from: ${(0, util_1.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`;
520
520
  !hasStack && Error.captureStackTrace(error);
521
- error = (0, util_2.concatErrorMsgAndStack)(error);
521
+ error = (0, util_1.concatErrorMsgAndStack)(error);
522
522
  error.moduleIdentifier = this._module.identifier();
523
523
  compiler._lastCompilation.__internal__pushDiagnostic({
524
524
  error,
@@ -529,11 +529,11 @@ async function runLoaders(compiler, context) {
529
529
  if (!(warning instanceof Error)) {
530
530
  warning = new RspackError_1.NonErrorEmittedError(warning);
531
531
  }
532
- let hasStack = !!warning.stack;
532
+ const hasStack = !!warning.stack;
533
533
  warning.name = "ModuleWarning";
534
- warning.message = `${warning.message} (from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`;
534
+ warning.message = `${warning.message} (from: ${(0, util_1.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`;
535
535
  hasStack && Error.captureStackTrace(warning);
536
- warning = (0, util_2.concatErrorMsgAndStack)(warning);
536
+ warning = (0, util_1.concatErrorMsgAndStack)(warning);
537
537
  warning.moduleIdentifier = this._module.identifier();
538
538
  compiler._lastCompilation.__internal__pushDiagnostic({
539
539
  error: warning,
@@ -661,8 +661,8 @@ async function runLoaders(compiler, context) {
661
661
  const hasArg = args.some(value => value !== undefined);
662
662
  if (hasArg) {
663
663
  const [content, sourceMap, additionalData] = args;
664
- context.content = (0, util_2.isNil)(content) ? null : (0, util_2.toBuffer)(content);
665
- context.sourceMap = (0, util_2.serializeObject)(sourceMap);
664
+ context.content = (0, util_1.isNil)(content) ? null : (0, util_1.toBuffer)(content);
665
+ context.sourceMap = (0, util_1.serializeObject)(sourceMap);
666
666
  context.additionalData = additionalData;
667
667
  break;
668
668
  }
@@ -686,12 +686,12 @@ async function runLoaders(compiler, context) {
686
686
  currentLoaderObject.normalExecuted = true;
687
687
  if (!fn)
688
688
  continue;
689
- let args = [content, sourceMap, additionalData];
689
+ const args = [content, sourceMap, additionalData];
690
690
  convertArgs(args, !!currentLoaderObject.raw);
691
691
  [content, sourceMap, additionalData] =
692
692
  (await runSyncOrAsync(fn, loaderContext, args)) || [];
693
693
  }
694
- context.content = (0, util_2.isNil)(content) ? null : (0, util_2.toBuffer)(content);
694
+ context.content = (0, util_1.isNil)(content) ? null : (0, util_1.toBuffer)(content);
695
695
  context.sourceMap = JsSourceMap.__to_binding(sourceMap);
696
696
  context.additionalData = additionalData;
697
697
  break;
@@ -16,7 +16,7 @@ module.exports = function loadLoader(loader, callback) {
16
16
  if (loader.type === "module") {
17
17
  try {
18
18
  if (url === undefined)
19
- url = require("url");
19
+ url = require("node:url");
20
20
  var loaderUrl = url.pathToFileURL(loader.path);
21
21
  /** @type {Promise<any>} */
22
22
  var modulePromise = eval("import(" + JSON.stringify(loaderUrl.toString()) + ")");
@@ -14,7 +14,7 @@ const SyncBailHook = require("tapable/lib/SyncBailHook");
14
14
  const { Logger } = require("./Logger");
15
15
  const createConsoleLogger = require("./createConsoleLogger");
16
16
  /** @type {createConsoleLogger.LoggerOptions} */
17
- let currentDefaultLoggerOptions = {
17
+ const currentDefaultLoggerOptions = {
18
18
  level: "info",
19
19
  debug: false,
20
20
  console
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const util_1 = __importDefault(require("util"));
15
+ const node_util_1 = __importDefault(require("node:util"));
16
16
  const watchpack_1 = __importDefault(require("../../compiled/watchpack"));
17
17
  class NodeWatchFileSystem {
18
18
  constructor(inputFileSystem) {
@@ -91,7 +91,7 @@ class NodeWatchFileSystem {
91
91
  this.watcher.pause();
92
92
  }
93
93
  },
94
- getAggregatedRemovals: util_1.default.deprecate(() => {
94
+ getAggregatedRemovals: node_util_1.default.deprecate(() => {
95
95
  const items = this.watcher && this.watcher.aggregatedRemovals;
96
96
  if (items && this.inputFileSystem && this.inputFileSystem.purge) {
97
97
  const fs = this.inputFileSystem;
@@ -101,7 +101,7 @@ class NodeWatchFileSystem {
101
101
  }
102
102
  return items;
103
103
  }, "Watcher.getAggregatedRemovals is deprecated in favor of Watcher.getInfo since that's more performant.", "DEP_WEBPACK_WATCHER_GET_AGGREGATED_REMOVALS"),
104
- getAggregatedChanges: util_1.default.deprecate(() => {
104
+ getAggregatedChanges: node_util_1.default.deprecate(() => {
105
105
  const items = this.watcher && this.watcher.aggregatedChanges;
106
106
  if (items && this.inputFileSystem && this.inputFileSystem.purge) {
107
107
  const fs = this.inputFileSystem;
@@ -111,10 +111,10 @@ class NodeWatchFileSystem {
111
111
  }
112
112
  return items;
113
113
  }, "Watcher.getAggregatedChanges is deprecated in favor of Watcher.getInfo since that's more performant.", "DEP_WEBPACK_WATCHER_GET_AGGREGATED_CHANGES"),
114
- getFileTimeInfoEntries: util_1.default.deprecate(() => {
114
+ getFileTimeInfoEntries: node_util_1.default.deprecate(() => {
115
115
  return fetchTimeInfo().fileTimeInfoEntries;
116
116
  }, "Watcher.getFileTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", "DEP_WEBPACK_WATCHER_FILE_TIME_INFO_ENTRIES"),
117
- getContextTimeInfoEntries: util_1.default.deprecate(() => {
117
+ getContextTimeInfoEntries: node_util_1.default.deprecate(() => {
118
118
  return fetchTimeInfo().contextTimeInfoEntries;
119
119
  }, "Watcher.getContextTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", "DEP_WEBPACK_WATCHER_CONTEXT_TIME_INFO_ENTRIES"),
120
120
  getInfo: () => {
@@ -31,7 +31,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
31
31
  __setModuleDefault(result, mod);
32
32
  return result;
33
33
  };
34
- const util = __importStar(require("util"));
34
+ const util = __importStar(require("node:util"));
35
35
  const truncateArgs_1 = require("../logging/truncateArgs");
36
36
  module.exports = ({ colors, appendOnly, stream }) => {
37
37
  // @ts-expect-error
package/dist/rspack.js CHANGED
@@ -13,8 +13,8 @@ exports.Stats = exports.rspack = exports.MultiStats = exports.createMultiCompile
13
13
  * Copyright (c) JS Foundation and other contributors
14
14
  * https://github.com/webpack/webpack/blob/main/LICENSE
15
15
  */
16
- const assert_1 = __importDefault(require("assert"));
17
- const util_1 = __importDefault(require("util"));
16
+ const node_assert_1 = __importDefault(require("node:assert"));
17
+ const node_util_1 = __importDefault(require("node:util"));
18
18
  const Compiler_1 = require("./Compiler");
19
19
  const MultiCompiler_1 = require("./MultiCompiler");
20
20
  const MultiStats_1 = __importDefault(require("./MultiStats"));
@@ -24,7 +24,7 @@ Object.defineProperty(exports, "Stats", { enumerable: true, get: function () { r
24
24
  const config_1 = require("./config");
25
25
  const NodeEnvironmentPlugin_1 = __importDefault(require("./node/NodeEnvironmentPlugin"));
26
26
  const rspackOptionsApply_1 = require("./rspackOptionsApply");
27
- const util_2 = require("./util");
27
+ const util_1 = require("./util");
28
28
  const validate_1 = require("./util/validate");
29
29
  function createMultiCompiler(options) {
30
30
  const compilers = options.map(createCompiler);
@@ -40,7 +40,7 @@ exports.createMultiCompiler = createMultiCompiler;
40
40
  function createCompiler(userOptions) {
41
41
  const options = (0, config_1.getNormalizedRspackOptions)(userOptions);
42
42
  (0, config_1.applyRspackOptionsBaseDefaults)(options);
43
- (0, assert_1.default)(!(0, util_2.isNil)(options.context));
43
+ (0, node_assert_1.default)(!(0, util_1.isNil)(options.context));
44
44
  const compiler = new Compiler_1.Compiler(options.context, options);
45
45
  new NodeEnvironmentPlugin_1.default({
46
46
  infrastructureLogging: options.infrastructureLogging
@@ -68,7 +68,7 @@ function isMultiRspackOptions(o) {
68
68
  }
69
69
  function rspack(options, callback) {
70
70
  try {
71
- for (let o of (0, util_2.asArray)(options)) {
71
+ for (const o of (0, util_1.asArray)(options)) {
72
72
  (0, validate_1.validate)(o, config_1.rspackOptions);
73
73
  }
74
74
  }
@@ -114,7 +114,7 @@ function rspack(options, callback) {
114
114
  else {
115
115
  const { compiler, watch } = create();
116
116
  if (watch) {
117
- util_1.default.deprecate(() => { }, "A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.")();
117
+ node_util_1.default.deprecate(() => { }, "A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.")();
118
118
  }
119
119
  return compiler;
120
120
  }
@@ -13,7 +13,7 @@ exports.RspackOptionsApply = void 0;
13
13
  * Copyright (c) JS Foundation and other contributors
14
14
  * https://github.com/webpack/webpack/blob/main/LICENSE
15
15
  */
16
- const assert_1 = __importDefault(require("assert"));
16
+ const node_assert_1 = __importDefault(require("node:assert"));
17
17
  const graceful_fs_1 = __importDefault(require("../compiled/graceful-fs"));
18
18
  const Module_1 = require("./Module");
19
19
  const builtin_plugin_1 = require("./builtin-plugin");
@@ -26,12 +26,12 @@ const assertNotNil_1 = require("./util/assertNotNil");
26
26
  class RspackOptionsApply {
27
27
  constructor() { }
28
28
  process(options, compiler) {
29
- (0, assert_1.default)(options.output.path, "options.output.path should have value after `applyRspackOptionsDefaults`");
29
+ (0, node_assert_1.default)(options.output.path, "options.output.path should have value after `applyRspackOptionsDefaults`");
30
30
  compiler.outputPath = options.output.path;
31
31
  compiler.name = options.name;
32
32
  compiler.outputFileSystem = graceful_fs_1.default;
33
33
  if (options.externals) {
34
- (0, assert_1.default)(options.externalsType, "options.externalsType should have value after `applyRspackOptionsDefaults`");
34
+ (0, node_assert_1.default)(options.externalsType, "options.externalsType should have value after `applyRspackOptionsDefaults`");
35
35
  new builtin_plugin_1.ExternalsPlugin(options.externalsType, options.externals).apply(compiler);
36
36
  }
37
37
  if (options.externalsPresets.node) {
@@ -14,7 +14,7 @@ class ConsumeSharedPlugin extends base_1.RspackBuiltinPlugin {
14
14
  consumes: (0, options_1.parseOptions)(options.consumes, (item, key) => {
15
15
  if (Array.isArray(item))
16
16
  throw new Error("Unexpected array in options");
17
- let result = item === key || !(0, utils_1.isRequiredVersion)(item)
17
+ const result = item === key || !(0, utils_1.isRequiredVersion)(item)
18
18
  ? // item is a request/key
19
19
  {
20
20
  import: key,