@rspack/core 1.2.0-beta.0 → 1.2.0

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 (73) hide show
  1. package/compiled/browserslist/index.js +28 -28
  2. package/compiled/graceful-fs/index.js +18 -18
  3. package/compiled/watchpack/index.js +34 -34
  4. package/compiled/webpack-sources/index.js +76 -76
  5. package/compiled/zod/index.js +30 -30
  6. package/dist/ChunkGraph.d.ts +1 -0
  7. package/dist/ChunkGroup.d.ts +2 -0
  8. package/dist/ResolverFactory.d.ts +1 -1
  9. package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
  10. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
  11. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
  12. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
  13. package/dist/builtin-plugin/BannerPlugin.d.ts +1 -1
  14. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
  15. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
  16. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
  17. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +1 -1
  18. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
  19. package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
  20. package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
  21. package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
  22. package/dist/builtin-plugin/DllEntryPlugin.d.ts +1 -1
  23. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +1 -1
  24. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
  25. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
  26. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
  27. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
  28. package/dist/builtin-plugin/EntryPlugin.d.ts +1 -1
  29. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
  30. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
  31. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
  32. package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
  33. package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +1 -1
  34. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
  35. package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +1 -1
  36. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
  37. package/dist/builtin-plugin/IgnorePlugin.d.ts +1 -1
  38. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
  39. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
  40. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
  41. package/dist/builtin-plugin/LibManifestPlugin.d.ts +1 -1
  42. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +1 -1
  43. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
  44. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
  45. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
  46. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
  47. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
  48. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +1 -1
  49. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
  50. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +1 -1
  51. package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
  52. package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
  53. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
  54. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +1 -1
  55. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
  56. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
  57. package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
  58. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
  59. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
  60. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
  61. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
  62. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
  63. package/dist/builtin-plugin/base.d.ts +1 -1
  64. package/dist/builtin-plugin/lazy-compilation/backend.d.ts +1 -1
  65. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +1 -1
  66. package/dist/config/normalization.d.ts +3 -2
  67. package/dist/config/types.d.ts +32 -52
  68. package/dist/config/zod.d.ts +67 -62
  69. package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
  70. package/dist/exports.d.ts +2 -3
  71. package/dist/index.js +158 -29
  72. package/dist/stats/statsFactoryUtils.d.ts +9 -0
  73. package/package.json +9 -4
@@ -3,7 +3,7 @@ export declare const ModuleFederationRuntimePlugin: {
3
3
  new (): {
4
4
  name: BuiltinPluginName;
5
5
  _args: [];
6
- affectedHooks: "done" | "make" | "environment" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
6
+ affectedHooks: "done" | "environment" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
7
7
  raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
8
8
  apply(compiler: import("..").Compiler): void;
9
9
  };
package/dist/exports.d.ts CHANGED
@@ -157,11 +157,10 @@ export { CssExtractRspackPlugin } from "./builtin-plugin";
157
157
  export { ContextReplacementPlugin } from "./builtin-plugin";
158
158
  export type { SwcLoaderEnvConfig, SwcLoaderEsParserConfig, SwcLoaderJscConfig, SwcLoaderModuleConfig, SwcLoaderOptions, SwcLoaderParserConfig, SwcLoaderTransformConfig, SwcLoaderTsParserConfig } from "./builtin-loader/swc/index";
159
159
  export type { LoaderOptions as LightningcssLoaderOptions, FeatureOptions as LightningcssFeatureOptions } from "./builtin-loader/lightningcss/index";
160
- import { cleanupGlobalTrace, registerGlobalTrace } from "@rspack/binding";
161
160
  interface Experiments {
162
161
  globalTrace: {
163
- register: typeof registerGlobalTrace;
164
- cleanup: typeof cleanupGlobalTrace;
162
+ register: (filter: string, layer: "chrome" | "logger" | "otel", output: string) => Promise<void>;
163
+ cleanup: () => Promise<void>;
165
164
  };
166
165
  RemoveDuplicateModulesPlugin: typeof RemoveDuplicateModulesPlugin;
167
166
  }
package/dist/index.js CHANGED
@@ -1235,6 +1235,12 @@ var ChunkGroup = class _ChunkGroup {
1235
1235
  isInitial() {
1236
1236
  return this.#inner.isInitial();
1237
1237
  }
1238
+ getModulePreOrderIndex(module2) {
1239
+ return this.#inner.getModulePreOrderIndex(Module.__to_binding(module2));
1240
+ }
1241
+ getModulePostOrderIndex(module2) {
1242
+ return this.#inner.getModulePostOrderIndex(Module.__to_binding(module2));
1243
+ }
1238
1244
  };
1239
1245
 
1240
1246
  // src/Chunk.ts
@@ -1412,6 +1418,9 @@ var ChunkGraph = class _ChunkGraph {
1412
1418
  getChunkEntryModulesIterable(chunk) {
1413
1419
  return this.#inner.getChunkEntryModules(Chunk.__to_binding(chunk)).map((binding3) => Module.__from_binding(binding3));
1414
1420
  }
1421
+ getNumberOfEntryModules(chunk) {
1422
+ return this.#inner.getNumberOfEntryModules(Chunk.__to_binding(chunk));
1423
+ }
1415
1424
  getChunkEntryDependentChunksIterable(chunk) {
1416
1425
  return this.#inner.getChunkEntryDependentChunksIterable(Chunk.__to_binding(chunk)).map((binding3) => Chunk.__from_binding(binding3));
1417
1426
  }
@@ -6454,7 +6463,32 @@ function getCurrentLoader(loaderContext, index = loaderContext.loaderIndex) {
6454
6463
  }
6455
6464
  return null;
6456
6465
  }
6466
+ var tracingCache;
6467
+ async function tryTrace(context2) {
6468
+ if (!process.env.RSPACK_PROFILE) {
6469
+ return {};
6470
+ }
6471
+ try {
6472
+ const {
6473
+ trace,
6474
+ propagation,
6475
+ context: tracingContext
6476
+ } = await import("@rspack/tracing");
6477
+ const tracer = trace.getTracer("rspack-loader-runner");
6478
+ const activeContext = propagation.extract(
6479
+ tracingContext.active(),
6480
+ context2.__internal__tracingCarrier
6481
+ );
6482
+ tracingCache = { tracer, activeContext };
6483
+ return tracingCache;
6484
+ } catch (error) {
6485
+ tracingCache = {};
6486
+ return tracingCache;
6487
+ }
6488
+ }
6457
6489
  async function runLoaders(compiler, context2) {
6490
+ var _a, _b;
6491
+ const { tracer, activeContext } = await tryTrace(context2);
6458
6492
  const loaderState = context2.loaderState;
6459
6493
  const { resource } = context2.resourceData;
6460
6494
  const splittedResource = resource && parsePathQueryFragment(resource);
@@ -6827,11 +6861,21 @@ async function runLoaders(compiler, context2) {
6827
6861
  const fn2 = currentLoaderObject.pitch;
6828
6862
  currentLoaderObject.pitchExecuted = true;
6829
6863
  if (!fn2) continue;
6864
+ const span = tracer == null ? void 0 : tracer.startSpan(
6865
+ "LoaderRunner:pitch",
6866
+ {
6867
+ attributes: {
6868
+ "loader.identifier": (_a = getCurrentLoader(loaderContext)) == null ? void 0 : _a.request
6869
+ }
6870
+ },
6871
+ activeContext
6872
+ );
6830
6873
  const args = await runSyncOrAsync(fn2, loaderContext, [
6831
6874
  loaderContext.remainingRequest,
6832
6875
  loaderContext.previousRequest,
6833
6876
  currentLoaderObject.data
6834
6877
  ]) || [];
6878
+ span == null ? void 0 : span.end();
6835
6879
  const hasArg = args.some((value) => value !== void 0);
6836
6880
  if (hasArg) {
6837
6881
  const [content, sourceMap, additionalData] = args;
@@ -6860,7 +6904,17 @@ async function runLoaders(compiler, context2) {
6860
6904
  if (!fn2) continue;
6861
6905
  const args = [content, sourceMap, additionalData];
6862
6906
  convertArgs(args, !!currentLoaderObject.raw);
6907
+ const span = tracer == null ? void 0 : tracer.startSpan(
6908
+ "LoaderRunner:normal",
6909
+ {
6910
+ attributes: {
6911
+ "loader.identifier": (_b = getCurrentLoader(loaderContext)) == null ? void 0 : _b.request
6912
+ }
6913
+ },
6914
+ activeContext
6915
+ );
6863
6916
  [content, sourceMap, additionalData] = await runSyncOrAsync(fn2, loaderContext, args) || [];
6917
+ span == null ? void 0 : span.end();
6864
6918
  }
6865
6919
  context2.content = isNil(content) ? null : toBuffer(content);
6866
6920
  context2.sourceMap = JsSourceMap.__to_binding(sourceMap);
@@ -7019,7 +7073,7 @@ var getRawOptions = (options, compiler) => {
7019
7073
  name: options.name,
7020
7074
  mode: mode2,
7021
7075
  context: options.context,
7022
- output: options.output,
7076
+ output: getRawOutput(options.output),
7023
7077
  resolve: getRawResolve(options.resolve),
7024
7078
  resolveLoader: getRawResolve(options.resolveLoader),
7025
7079
  module: getRawModule(options.module, {
@@ -7036,11 +7090,34 @@ var getRawOptions = (options, compiler) => {
7036
7090
  experiments: experiments3,
7037
7091
  node: getRawNode(options.node),
7038
7092
  profile: options.profile,
7039
- amd: options.amd,
7093
+ amd: options.amd !== false ? JSON.stringify(options.amd || {}) : void 0,
7040
7094
  bail: options.bail,
7041
7095
  __references: {}
7042
7096
  };
7043
7097
  };
7098
+ function getRawOutput(output2) {
7099
+ return {
7100
+ ...output2,
7101
+ environment: getRawOutputEnvironment(output2.environment)
7102
+ };
7103
+ }
7104
+ function getRawOutputEnvironment(environment2 = {}) {
7105
+ return {
7106
+ const: Boolean(environment2.const),
7107
+ arrowFunction: Boolean(environment2.arrowFunction),
7108
+ nodePrefixForCoreModules: Boolean(environment2.nodePrefixForCoreModules),
7109
+ asyncFunction: Boolean(environment2.asyncFunction),
7110
+ bigIntLiteral: Boolean(environment2.bigIntLiteral),
7111
+ destructuring: Boolean(environment2.destructuring),
7112
+ document: Boolean(environment2.document),
7113
+ dynamicImport: Boolean(environment2.dynamicImport),
7114
+ forOf: Boolean(environment2.forOf),
7115
+ globalThis: Boolean(environment2.globalThis),
7116
+ module: Boolean(environment2.module),
7117
+ optionalChaining: Boolean(environment2.optionalChaining),
7118
+ templateLiteral: Boolean(environment2.templateLiteral)
7119
+ };
7120
+ }
7044
7121
  function getRawExtensionAlias(alias = {}) {
7045
7122
  const entries = Object.entries(alias).map(([key, value]) => {
7046
7123
  if (Array.isArray(value)) {
@@ -7384,7 +7461,8 @@ function getRawCssParserOptions(parser) {
7384
7461
  }
7385
7462
  function getRawJsonParserOptions(parser) {
7386
7463
  return {
7387
- exportsDepth: parser.exportsDepth
7464
+ exportsDepth: parser.exportsDepth,
7465
+ parse: typeof parser.parse === "function" ? (str) => JSON.stringify(parser.parse(str)) : void 0
7388
7466
  };
7389
7467
  }
7390
7468
  function getRawGeneratorOptions(generator, type) {
@@ -7450,7 +7528,8 @@ function getRawAssetResourceGeneratorOptions(options) {
7450
7528
  emit: options.emit,
7451
7529
  filename: options.filename,
7452
7530
  outputPath: options.outputPath,
7453
- publicPath: options.publicPath
7531
+ publicPath: options.publicPath,
7532
+ importMode: options.importMode
7454
7533
  };
7455
7534
  }
7456
7535
  function getRawAssetGeneratorDataUrl(dataUrl) {
@@ -8707,6 +8786,7 @@ var applyExperimentsDefaults = (experiments3, { production, development }) => {
8707
8786
  D(experiments3.incremental, "emitAssets", true);
8708
8787
  }
8709
8788
  D(experiments3, "rspackFuture", {});
8789
+ D(experiments3, "parallelCodeSplitting", false);
8710
8790
  };
8711
8791
  var applybundlerInfoDefaults = (rspackFuture, library3) => {
8712
8792
  if (typeof rspackFuture === "object") {
@@ -9407,6 +9487,9 @@ var getResolveDefaults = ({
9407
9487
  extensions: [...jsExtensions]
9408
9488
  });
9409
9489
  const resolveOptions2 = {
9490
+ // enable pnp only in pnp environment, see https://yarnpkg.com/advanced/pnpapi#processversionspnp
9491
+ // IGNORE(resolve.pnp): Rspack use `resolve.enable` to enable yarn pnp feature
9492
+ pnp: !!process.versions.pnp,
9410
9493
  modules: ["node_modules"],
9411
9494
  conditionNames: conditions,
9412
9495
  mainFiles: ["index"],
@@ -9427,7 +9510,7 @@ var getResolveDefaults = ({
9427
9510
  preferRelative: true
9428
9511
  },
9429
9512
  commonjs: cjsDeps(),
9430
- // amd: cjsDeps(),
9513
+ amd: cjsDeps(),
9431
9514
  // for backward-compat: loadModule
9432
9515
  // loader: cjsDeps(),
9433
9516
  // for backward-compat: Custom Dependency and getResolve without dependencyType
@@ -9721,13 +9804,14 @@ var getNormalizedRspackOptions = (config2) => {
9721
9804
  chunksRender: true,
9722
9805
  emitAssets: true
9723
9806
  } : options
9724
- )
9807
+ ),
9808
+ parallelCodeSplitting: experiments3.parallelCodeSplitting
9725
9809
  })),
9726
9810
  watch: config2.watch,
9727
9811
  watchOptions: cloneObject(config2.watchOptions),
9728
9812
  devServer: config2.devServer,
9729
9813
  profile: config2.profile,
9730
- amd: config2.amd ? JSON.stringify(config2.amd) : void 0,
9814
+ amd: config2.amd,
9731
9815
  bail: config2.bail
9732
9816
  };
9733
9817
  };
@@ -10235,7 +10319,8 @@ var baseResolveOptions = import_zod2.z.strictObject({
10235
10319
  extensionAlias: import_zod2.z.record(import_zod2.z.string().or(import_zod2.z.array(import_zod2.z.string()))).optional(),
10236
10320
  aliasFields: import_zod2.z.array(import_zod2.z.string()).optional(),
10237
10321
  restrictions: import_zod2.z.array(import_zod2.z.string()).optional(),
10238
- roots: import_zod2.z.array(import_zod2.z.string()).optional()
10322
+ roots: import_zod2.z.array(import_zod2.z.string()).optional(),
10323
+ pnp: import_zod2.z.boolean().optional()
10239
10324
  });
10240
10325
  var resolveOptions = baseResolveOptions.extend({
10241
10326
  byDependency: import_zod2.z.lazy(() => import_zod2.z.record(resolveOptions)).optional()
@@ -10787,10 +10872,8 @@ var optimizationRuntimeChunk = import_zod2.z.enum(["single", "multiple"]).or(imp
10787
10872
  ).optional()
10788
10873
  })
10789
10874
  );
10790
- var optimizationSplitChunksNameFunction = import_zod2.z.function().args(
10791
- import_zod2.z.instanceof(Module).optional()
10792
- // FIXME: z.array(z.instanceof(Chunk)).optional(), z.string()
10793
- // FIXME: Chunk[], cacheChunkKey
10875
+ var optimizationSplitChunksNameFunction = import_zod2.z.function().args(import_zod2.z.instanceof(Module), import_zod2.z.array(import_zod2.z.instanceof(Chunk)), import_zod2.z.string()).returns(
10876
+ import_zod2.z.string().optional()
10794
10877
  );
10795
10878
  var optimizationSplitChunksName = import_zod2.z.string().or(import_zod2.z.literal(false)).or(optimizationSplitChunksNameFunction);
10796
10879
  var optimizationSplitChunksChunks = import_zod2.z.enum(["initial", "async", "all"]).or(import_zod2.z.instanceof(RegExp)).or(
@@ -10932,6 +11015,7 @@ var experiments = import_zod2.z.strictObject({
10932
11015
  css: import_zod2.z.boolean().optional(),
10933
11016
  layers: import_zod2.z.boolean().optional(),
10934
11017
  incremental: import_zod2.z.boolean().or(incremental).optional(),
11018
+ parallelCodeSplitting: import_zod2.z.boolean().optional(),
10935
11019
  futureDefaults: import_zod2.z.boolean().optional(),
10936
11020
  rspackFuture: rspackFutureOptions.optional()
10937
11021
  });
@@ -12983,8 +13067,8 @@ var ResolverFactory = class {
12983
13067
  static __to_binding(resolver_factory) {
12984
13068
  return resolver_factory.#binding;
12985
13069
  }
12986
- constructor() {
12987
- this.#binding = new binding.JsResolverFactory();
13070
+ constructor(pnp) {
13071
+ this.#binding = new binding.JsResolverFactory(pnp);
12988
13072
  }
12989
13073
  get(type, resolveOptions2) {
12990
13074
  const { dependencyCategory, resolveToContext, ...resolve2 } = resolveOptions2 || {};
@@ -13221,26 +13305,33 @@ var Watching = class {
13221
13305
  cb(err);
13222
13306
  }
13223
13307
  };
13224
- const cbs = this.callbacks;
13225
- this.callbacks = [];
13226
- const startTime = this.startTime;
13227
- this.startTime = void 0;
13228
13308
  if (error) {
13229
13309
  return handleError(error);
13230
13310
  }
13231
13311
  (0, import_node_assert7.default)(compilation);
13312
+ stats = new Stats(compilation);
13313
+ if (this.invalid && !this.suspended && !this.blocked && !(this.isBlocked() && (this.blocked = true))) {
13314
+ this.#go();
13315
+ return;
13316
+ }
13317
+ const startTime = this.startTime;
13318
+ this.startTime = void 0;
13232
13319
  compilation.startTime = startTime;
13233
13320
  compilation.endTime = Date.now();
13234
- stats = new Stats(compilation);
13321
+ const cbs = this.callbacks;
13322
+ this.callbacks = [];
13323
+ const fileDependencies = /* @__PURE__ */ new Set([...compilation.fileDependencies]);
13324
+ const contextDependencies = /* @__PURE__ */ new Set([...compilation.contextDependencies]);
13325
+ const missingDependencies = /* @__PURE__ */ new Set([...compilation.missingDependencies]);
13235
13326
  this.compiler.hooks.done.callAsync(stats, (err) => {
13236
13327
  if (err) return handleError(err, cbs);
13237
13328
  this.handler(null, stats);
13238
13329
  process.nextTick(() => {
13239
13330
  if (!this.#closed) {
13240
13331
  this.watch(
13241
- compilation.fileDependencies,
13242
- compilation.contextDependencies,
13243
- compilation.missingDependencies
13332
+ fileDependencies,
13333
+ contextDependencies,
13334
+ missingDependencies
13244
13335
  );
13245
13336
  }
13246
13337
  });
@@ -13454,7 +13545,6 @@ var Compiler = class _Compiler {
13454
13545
  this.watchFileSystem = null;
13455
13546
  this.records = {};
13456
13547
  this.options = options;
13457
- this.resolverFactory = new ResolverFactory();
13458
13548
  this.context = context2;
13459
13549
  this.cache = new Cache_default();
13460
13550
  this.compilerPath = "";
@@ -14615,7 +14705,11 @@ var Compiler = class _Compiler {
14615
14705
  this.#registers,
14616
14706
  ThreadsafeOutputNodeFS.__to_binding(this.outputFileSystem),
14617
14707
  this.intermediateFileSystem ? ThreadsafeIntermediateNodeFS.__to_binding(this.intermediateFileSystem) : void 0,
14618
- ResolverFactory.__to_binding(this.resolverFactory)
14708
+ ResolverFactory.__to_binding(
14709
+ this.resolverFactory = new ResolverFactory(
14710
+ rawOptions.resolve.pnp ?? false
14711
+ )
14712
+ )
14619
14713
  );
14620
14714
  callback(null, this.#instance);
14621
14715
  }
@@ -16760,6 +16854,9 @@ var SIMPLE_EXTRACTORS = {
16760
16854
  object.resolvedModuleIdentifier = reason.resolvedModuleDescriptor.identifier;
16761
16855
  object.resolvedModule = reason.resolvedModuleDescriptor.name;
16762
16856
  }
16857
+ object.explanation = reason.explanation;
16858
+ object.active = reason.active;
16859
+ object.loc = reason.loc;
16763
16860
  },
16764
16861
  ids: (object, reason) => {
16765
16862
  object.moduleId = reason.moduleDescriptor ? reason.moduleDescriptor.id : null;
@@ -16833,7 +16930,8 @@ var SIMPLE_EXTRACTORS = {
16833
16930
  error: EXTRACT_ERROR,
16834
16931
  warning: EXTRACT_ERROR,
16835
16932
  moduleTraceItem: {
16836
- _: (object, { origin, module: module2 }, _context, { requestShortener }, _factory) => {
16933
+ _: (object, { origin, module: module2, dependencies: dependencies2 }, context2, { requestShortener }, factory) => {
16934
+ const { type } = context2;
16837
16935
  if (origin.moduleDescriptor) {
16838
16936
  object.originIdentifier = origin.moduleDescriptor.identifier;
16839
16937
  object.originName = origin.moduleDescriptor.name;
@@ -16842,13 +16940,22 @@ var SIMPLE_EXTRACTORS = {
16842
16940
  object.moduleIdentifier = module2.moduleDescriptor.identifier;
16843
16941
  object.moduleName = module2.moduleDescriptor.name;
16844
16942
  }
16943
+ object.dependencies = factory.create(
16944
+ `${type}.dependencies`,
16945
+ dependencies2,
16946
+ context2
16947
+ );
16845
16948
  },
16846
16949
  ids: (object, { origin, module: module2 }) => {
16847
16950
  object.originId = origin.moduleDescriptor.id;
16848
16951
  object.moduleId = module2.moduleDescriptor.id;
16849
16952
  }
16953
+ },
16954
+ moduleTraceDependency: {
16955
+ _: (object, dependency) => {
16956
+ object.loc = dependency.loc;
16957
+ }
16850
16958
  }
16851
- // - moduleTraceDependency
16852
16959
  };
16853
16960
  var FILTER = {
16854
16961
  "module.reasons": {
@@ -18361,6 +18468,7 @@ var RspackOptionsApply = class {
18361
18468
  const cheap = options.devtool.includes("cheap");
18362
18469
  const moduleMaps = options.devtool.includes("module");
18363
18470
  const noSources = options.devtool.includes("nosources");
18471
+ const debugIds = options.devtool.includes("debugids");
18364
18472
  const Plugin = evalWrapped ? EvalSourceMapDevToolPlugin : SourceMapDevToolPlugin;
18365
18473
  new Plugin({
18366
18474
  filename: inline ? null : options.output.sourceMapFilename,
@@ -18370,7 +18478,8 @@ var RspackOptionsApply = class {
18370
18478
  module: moduleMaps ? true : !cheap,
18371
18479
  columns: !cheap,
18372
18480
  noSources,
18373
- namespace: options.output.devtoolNamespace
18481
+ namespace: options.output.devtoolNamespace,
18482
+ debugIds
18374
18483
  }).apply(compiler);
18375
18484
  } else if (options.devtool.includes("eval")) {
18376
18485
  new EvalDevToolModulePlugin({
@@ -20069,8 +20178,28 @@ var sharing = {
20069
20178
  };
20070
20179
  var experiments2 = {
20071
20180
  globalTrace: {
20072
- register: import_binding81.registerGlobalTrace,
20073
- cleanup: import_binding81.cleanupGlobalTrace
20181
+ async register(filter, layer2, output2) {
20182
+ (0, import_binding81.registerGlobalTrace)(filter, layer2, output2);
20183
+ if (layer2 === "otel") {
20184
+ try {
20185
+ const { initOpenTelemetry } = await import("@rspack/tracing");
20186
+ await initOpenTelemetry();
20187
+ } catch (error) {
20188
+ console.error(
20189
+ "Failed to import `@rspack/tracing` package. Please install `@rspack/tracing` to enable OpenTelemetry tracing.",
20190
+ error
20191
+ );
20192
+ }
20193
+ }
20194
+ },
20195
+ async cleanup() {
20196
+ (0, import_binding81.cleanupGlobalTrace)();
20197
+ try {
20198
+ const { shutdownOpenTelemetry } = await import("@rspack/tracing");
20199
+ await shutdownOpenTelemetry();
20200
+ } catch (error) {
20201
+ }
20202
+ }
20074
20203
  },
20075
20204
  RemoveDuplicateModulesPlugin
20076
20205
  };
@@ -164,6 +164,11 @@ export type StatsModuleTraceItem = {
164
164
  moduleName?: string;
165
165
  originId?: string;
166
166
  moduleId?: string;
167
+ dependencies?: StatsModuleTraceDependency[];
168
+ };
169
+ export type StatsModuleTraceDependency = KnownStatsModuleTraceDependency & Record<string, any>;
170
+ export type KnownStatsModuleTraceDependency = {
171
+ loc: string;
167
172
  };
168
173
  export type KnownStatsModuleReason = {
169
174
  moduleIdentifier?: string;
@@ -172,7 +177,10 @@ export type KnownStatsModuleReason = {
172
177
  resolvedModuleIdentifier?: string;
173
178
  resolvedModule?: string;
174
179
  type?: string;
180
+ active: boolean;
181
+ explanation?: string;
175
182
  userRequest?: string;
183
+ loc?: string;
176
184
  moduleId?: string | null;
177
185
  resolvedModuleId?: string | number | null;
178
186
  };
@@ -256,6 +264,7 @@ export type SimpleExtractors = {
256
264
  error: ExtractorsByOption<binding.JsStatsError, StatsError>;
257
265
  warning: ExtractorsByOption<binding.JsStatsWarning, StatsError>;
258
266
  moduleTraceItem: ExtractorsByOption<binding.JsStatsModuleTrace, StatsModuleTraceItem>;
267
+ moduleTraceDependency: ExtractorsByOption<binding.JsStatsModuleTraceDependency, StatsModuleTraceDependency>;
259
268
  };
260
269
  export declare const uniqueArray: <T, I>(items: Iterable<T>, selector: (arg: T) => Iterable<I>) => I[];
261
270
  export declare const uniqueOrderedArray: <T, I>(items: Iterable<T>, selector: (arg: T) => Iterable<I>, comparator: Comparator) => I[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "1.2.0-beta.0",
3
+ "version": "1.2.0",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -47,7 +47,7 @@
47
47
  "enhanced-resolve": "5.17.1",
48
48
  "graceful-fs": "4.2.11",
49
49
  "json-parse-even-better-errors": "^3.0.0",
50
- "prebundle": "^1.1.0",
50
+ "prebundle": "^1.2.7",
51
51
  "tsc-alias": "^1.8.8",
52
52
  "tsup": "^8.3.0",
53
53
  "tsx": "^4.19.2",
@@ -56,20 +56,25 @@
56
56
  "webpack-dev-server": "5.0.4",
57
57
  "webpack-sources": "3.2.3",
58
58
  "zod": "^3.23.8",
59
- "zod-validation-error": "3.4.0"
59
+ "zod-validation-error": "3.4.0",
60
+ "@rspack/tracing": "1.2.0"
60
61
  },
61
62
  "dependencies": {
62
63
  "@module-federation/runtime-tools": "0.8.4",
63
64
  "@rspack/lite-tapable": "1.0.1",
64
65
  "caniuse-lite": "^1.0.30001616",
65
- "@rspack/binding": "1.2.0-beta.0"
66
+ "@rspack/binding": "1.2.0"
66
67
  },
67
68
  "peerDependencies": {
69
+ "@rspack/tracing": "^1.x",
68
70
  "@swc/helpers": ">=0.5.1"
69
71
  },
70
72
  "peerDependenciesMeta": {
71
73
  "@swc/helpers": {
72
74
  "optional": true
75
+ },
76
+ "@rspack/tracing": {
77
+ "optional": true
73
78
  }
74
79
  },
75
80
  "scripts": {