@rspack/core 1.3.6 → 1.3.7

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.
@@ -1,7 +1,8 @@
1
1
  import type * as binding from "@rspack/binding";
2
2
  export type RspackError = binding.JsRspackError;
3
+ export type RspackSeverity = binding.JsRspackSeverity;
3
4
  export declare class JsRspackDiagnostic {
4
- static __to_binding(error: Error | RspackError, severity: binding.JsRspackSeverity): binding.JsRspackDiagnostic;
5
+ static __to_binding(error: Error | RspackError, severity: RspackSeverity): binding.JsRspackDiagnostic;
5
6
  }
6
7
  export declare class NonErrorEmittedError extends Error {
7
8
  constructor(error: Error);
@@ -1,5 +1,8 @@
1
- import { BuiltinPluginName, type JsCompilation } from "@rspack/binding";
1
+ import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
2
+ import type { Compilation } from "../Compilation";
3
+ import type { Compiler } from "../Compiler";
2
4
  import type { Module } from "../Module";
5
+ import { RspackBuiltinPlugin } from "./base";
3
6
  export type CircularDependencyRspackPluginOptions = {
4
7
  /**
5
8
  * When `true`, the plugin will emit `ERROR` diagnostics rather than the
@@ -33,27 +36,24 @@ export type CircularDependencyRspackPluginOptions = {
33
36
  * Called once for every detected cycle. Providing this handler overrides the
34
37
  * default behavior of adding diagnostics to the compilation.
35
38
  */
36
- onDetected?(entrypoint: Module, modules: string[], compilation: JsCompilation): void;
39
+ onDetected?(entrypoint: Module, modules: string[], compilation: Compilation): void;
37
40
  /**
38
41
  * Called once for every detected cycle that was ignored because of a rule,
39
42
  * either from `exclude` or `ignoredConnections`.
40
43
  */
41
- onIgnored?(entrypoint: Module, modules: string[], compilation: JsCompilation): void;
44
+ onIgnored?(entrypoint: Module, modules: string[], compilation: Compilation): void;
42
45
  /**
43
46
  * Called before cycle detection begins.
44
47
  */
45
- onStart?(compilation: JsCompilation): void;
48
+ onStart?(compilation: Compilation): void;
46
49
  /**
47
50
  * Called after cycle detection finishes.
48
51
  */
49
- onEnd?(compilation: JsCompilation): void;
50
- };
51
- export declare const CircularDependencyRspackPlugin: {
52
- new (options: CircularDependencyRspackPluginOptions): {
53
- name: BuiltinPluginName;
54
- _args: [options: CircularDependencyRspackPluginOptions];
55
- affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
56
- raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
57
- apply(compiler: import("..").Compiler): void;
58
- };
52
+ onEnd?(compilation: Compilation): void;
59
53
  };
54
+ export declare class CircularDependencyRspackPlugin extends RspackBuiltinPlugin {
55
+ name: BuiltinPluginName;
56
+ _options: CircularDependencyRspackPluginOptions;
57
+ constructor(options: CircularDependencyRspackPluginOptions);
58
+ raw(compiler: Compiler): BuiltinPlugin;
59
+ }
@@ -1838,6 +1838,11 @@ export type LazyCompilationOptions = {
1838
1838
  * environment you need to explicitly specify a specific path.
1839
1839
  */
1840
1840
  serverUrl?: string;
1841
+ /**
1842
+ * Customize the prefix used for lazy compilation endpoint.
1843
+ * @default "/lazy-compilation-using-"
1844
+ */
1845
+ prefix?: string;
1841
1846
  };
1842
1847
  /**
1843
1848
  * Options for incremental builds.
@@ -890,15 +890,18 @@ export declare const rspackOptions: z.ZodObject<{
890
890
  test: z.ZodOptional<z.ZodUnion<[z.Schema<RegExp, z.ZodTypeDef, RegExp>, z.ZodFunction<z.ZodTuple<[z.Schema<Module, z.ZodTypeDef, Module>], z.ZodUnknown>, z.ZodBoolean>]>>;
891
891
  client: z.ZodOptional<z.ZodString>;
892
892
  serverUrl: z.ZodOptional<z.ZodString>;
893
+ prefix: z.ZodOptional<z.ZodString>;
893
894
  }, "strip", z.ZodTypeAny, {
894
895
  entries?: boolean | undefined;
895
896
  test?: RegExp | ((args_0: Module, ...args: unknown[]) => boolean) | undefined;
897
+ prefix?: string | undefined;
896
898
  serverUrl?: string | undefined;
897
899
  imports?: boolean | undefined;
898
900
  client?: string | undefined;
899
901
  }, {
900
902
  entries?: boolean | undefined;
901
903
  test?: RegExp | ((args_0: Module, ...args: unknown[]) => boolean) | undefined;
904
+ prefix?: string | undefined;
902
905
  serverUrl?: string | undefined;
903
906
  imports?: boolean | undefined;
904
907
  client?: string | undefined;
@@ -1048,6 +1051,7 @@ export declare const rspackOptions: z.ZodObject<{
1048
1051
  lazyCompilation?: boolean | {
1049
1052
  entries?: boolean | undefined;
1050
1053
  test?: RegExp | ((args_0: Module, ...args: unknown[]) => boolean) | undefined;
1054
+ prefix?: string | undefined;
1051
1055
  serverUrl?: string | undefined;
1052
1056
  imports?: boolean | undefined;
1053
1057
  client?: string | undefined;
@@ -1115,6 +1119,7 @@ export declare const rspackOptions: z.ZodObject<{
1115
1119
  lazyCompilation?: boolean | {
1116
1120
  entries?: boolean | undefined;
1117
1121
  test?: RegExp | ((args_0: Module, ...args: unknown[]) => boolean) | undefined;
1122
+ prefix?: string | undefined;
1118
1123
  serverUrl?: string | undefined;
1119
1124
  imports?: boolean | undefined;
1120
1125
  client?: string | undefined;
@@ -3401,6 +3406,7 @@ export declare const rspackOptions: z.ZodObject<{
3401
3406
  lazyCompilation?: boolean | {
3402
3407
  entries?: boolean | undefined;
3403
3408
  test?: RegExp | ((args_0: Module, ...args: unknown[]) => boolean) | undefined;
3409
+ prefix?: string | undefined;
3404
3410
  serverUrl?: string | undefined;
3405
3411
  imports?: boolean | undefined;
3406
3412
  client?: string | undefined;
@@ -4017,6 +4023,7 @@ export declare const rspackOptions: z.ZodObject<{
4017
4023
  lazyCompilation?: boolean | {
4018
4024
  entries?: boolean | undefined;
4019
4025
  test?: RegExp | ((args_0: Module, ...args: unknown[]) => boolean) | undefined;
4026
+ prefix?: string | undefined;
4020
4027
  serverUrl?: string | undefined;
4021
4028
  imports?: boolean | undefined;
4022
4029
  client?: string | undefined;
package/dist/exports.d.ts CHANGED
@@ -23,6 +23,7 @@ export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule
23
23
  export { Stats } from "./Stats";
24
24
  export { RuntimeModule } from "./RuntimeModule";
25
25
  export { EntryDependency, Dependency, AsyncDependenciesBlock } from "@rspack/binding";
26
+ export type { RspackError, RspackSeverity } from "./RspackError";
26
27
  import * as ModuleFilenameHelpers from "./lib/ModuleFilenameHelpers";
27
28
  export { ModuleFilenameHelpers };
28
29
  export { Template } from "./Template";
package/dist/index.js CHANGED
@@ -3071,17 +3071,20 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3071
3071
  static initJavaScriptTrace(layer, output) {
3072
3072
  this.session = new (external_node_inspector_default()).Session(), this.layer = layer, this.output = output, this.events = [];
3073
3073
  let hrtime = process.hrtime();
3074
- "chrome" === this.layer && (this.session.connect(), this.session.post("Profiler.enable"), this.session.post("Profiler.start")), this.startTime = 1000000 * hrtime[0] + Math.round(hrtime[1] / 1000);
3074
+ this.startTime = 1000000 * hrtime[0] + Math.round(hrtime[1] / 1000);
3075
+ }
3076
+ static initCpuProfiler() {
3077
+ "chrome" === this.layer && (this.session.connect(), this.session.post("Profiler.enable"), this.session.post("Profiler.start"));
3075
3078
  }
3076
3079
  static async cleanupJavaScriptTrace() {
3077
3080
  this.layer.includes("chrome") && this.session.post("Profiler.stop", (err, param)=>{
3078
3081
  let cpu_profile;
3079
3082
  err ? console.error("Error stopping profiler:", err) : cpu_profile = param.profile, cpu_profile && (this.pushEvent({
3080
3083
  name: "Profile",
3081
- cat: "disabled-by-default-v8.cpu_profiler",
3082
3084
  ph: "P",
3083
3085
  id: 1,
3084
3086
  ...this.getCommonEv(),
3087
+ cat: "disabled-by-default-v8.cpu_profiler",
3085
3088
  pid: 3,
3086
3089
  args: {
3087
3090
  data: {
@@ -3092,8 +3095,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3092
3095
  name: "ProfileChunk",
3093
3096
  ph: "P",
3094
3097
  id: 1,
3095
- cat: "disabled-by-default-v8.cpu_profiler",
3096
3098
  ...this.getCommonEv(),
3099
+ cat: "disabled-by-default-v8.cpu_profiler",
3097
3100
  pid: 3,
3098
3101
  args: {
3099
3102
  data: {
@@ -3116,11 +3119,14 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3116
3119
  return {
3117
3120
  tid: 1,
3118
3121
  pid: 2,
3119
- ts: this.getTs()
3122
+ ts: this.getTs(),
3123
+ cat: "rspack"
3120
3124
  };
3121
3125
  }
3122
3126
  static pushEvent(event) {
3123
- this.events.push(event);
3127
+ !event.id2 && event.args?.id2 && (event.id2 = {
3128
+ local: event.args.id2
3129
+ }), this.events.push(event);
3124
3130
  }
3125
3131
  static startAsync(events) {
3126
3132
  "chrome" === this.layer && this.pushEvent({
@@ -3369,7 +3375,14 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3369
3375
  return loaderContext.loaders?.length && index < loaderContext.loaders.length && index >= 0 && loaderContext.loaders[index] ? loaderContext.loaders[index] : null;
3370
3376
  }
3371
3377
  async function runLoaders(compiler, context) {
3372
- let loaderState = context.loaderState, { resource } = context.resourceData, splittedResource = resource && parsePathQueryFragment(resource), resourcePath = splittedResource ? splittedResource.path : void 0, resourceQuery = splittedResource ? splittedResource.query : void 0, resourceFragment = splittedResource ? splittedResource.fragment : void 0, contextDirectory = resourcePath ? function(path) {
3378
+ let loaderState = context.loaderState, pitch = loaderState === binding_.JsLoaderState.Pitching, { resource } = context.resourceData;
3379
+ JavaScriptTracer.startAsync({
3380
+ name: `run_js_loaders${pitch ? ":pitch" : ":normal"}`,
3381
+ args: {
3382
+ id2: resource
3383
+ }
3384
+ });
3385
+ let splittedResource = resource && parsePathQueryFragment(resource), resourcePath = splittedResource ? splittedResource.path : void 0, resourceQuery = splittedResource ? splittedResource.query : void 0, resourceFragment = splittedResource ? splittedResource.fragment : void 0, contextDirectory = resourcePath ? function(path) {
3373
3386
  if ("/" === path) return "/";
3374
3387
  let i = path.lastIndexOf("/"), j = path.lastIndexOf("\\"), i2 = path.indexOf("/"), j2 = path.indexOf("\\"), idx = i > j ? i : j, idx2 = i > j ? i2 : j2;
3375
3388
  return idx < 0 ? path : idx === idx2 ? path.slice(0, idx + 1) : path.slice(0, idx);
@@ -3391,16 +3404,32 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3391
3404
  }, loaderContext.clearDependencies = function() {
3392
3405
  fileDependencies.length = 0, contextDependencies.length = 0, missingDependencies.length = 0, context.cacheable = !0;
3393
3406
  }, loaderContext.importModule = function(request, userOptions, callback) {
3407
+ JavaScriptTracer.startAsync({
3408
+ name: "importModule",
3409
+ args: {
3410
+ id2: resource
3411
+ }
3412
+ });
3394
3413
  let options = userOptions || {};
3395
3414
  function finalCallback(onError, onDone) {
3396
3415
  return function(err, res) {
3397
- if (err) onError(err);
3416
+ if (err) JavaScriptTracer.endAsync({
3417
+ name: "importModule",
3418
+ args: {
3419
+ id2: resource
3420
+ }
3421
+ }), onError(err);
3398
3422
  else {
3399
3423
  for (let dep of res.buildDependencies)loaderContext.addBuildDependency(dep);
3400
3424
  for (let dep of res.contextDependencies)loaderContext.addContextDependency(dep);
3401
3425
  for (let dep of res.missingDependencies)loaderContext.addMissingDependency(dep);
3402
3426
  for (let dep of res.fileDependencies)loaderContext.addDependency(dep);
3403
- !1 === res.cacheable && loaderContext.cacheable(!1), res.error ? onError(compiler.__internal__getModuleExecutionResult(res.id) ?? Error(err)) : onDone(compiler.__internal__getModuleExecutionResult(res.id));
3427
+ !1 === res.cacheable && loaderContext.cacheable(!1), JavaScriptTracer.endAsync({
3428
+ name: "importModule",
3429
+ args: {
3430
+ id2: resource
3431
+ }
3432
+ }), res.error ? onError(compiler.__internal__getModuleExecutionResult(res.id) ?? Error(err)) : onDone(compiler.__internal__getModuleExecutionResult(res.id));
3404
3433
  }
3405
3434
  };
3406
3435
  }
@@ -3537,13 +3566,17 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3537
3566
  sourceMap: loaderContext.sourceMap,
3538
3567
  rootContext: loaderContext.context,
3539
3568
  loaderIndex: loaderContext.loaderIndex,
3540
- loaders: loaderContext.loaders.map((item)=>({
3569
+ loaders: loaderContext.loaders.map((item)=>{
3570
+ let options = item.options;
3571
+ return (!item.parallel || item.request.startsWith(BUILTIN_LOADER_PREFIX)) && (options = void 0), {
3541
3572
  ...item,
3573
+ options,
3542
3574
  pitch: void 0,
3543
3575
  normal: void 0,
3544
3576
  normalExecuted: item.normalExecuted,
3545
3577
  pitchExecuted: item.pitchExecuted
3546
- })),
3578
+ };
3579
+ }),
3547
3580
  __internal__workerInfo: {
3548
3581
  hashFunction: compiler._lastCompilation.outputOptions.hashFunction
3549
3582
  },
@@ -3590,13 +3623,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3590
3623
  return res;
3591
3624
  }(currentLoaderObject.request);
3592
3625
  if (JavaScriptTracer.startAsync({
3593
- name: `loader:${pitch ? "pitch:" : ""}${loaderName}`,
3594
- id2: {
3595
- local: resource
3596
- },
3626
+ name: `js_loader:${pitch ? "pitch:" : ""}${loaderName}`,
3597
3627
  cat: "rspack",
3598
3628
  args: {
3599
- resource: resource,
3629
+ id2: resource,
3600
3630
  "loader.request": currentLoaderObject?.request
3601
3631
  }
3602
3632
  }), parallelism) result = await service_run({
@@ -3718,14 +3748,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3718
3748
  }(args1[0]) : raw && "string" == typeof args1[0] && (args1[0] = Buffer.from(args1[0], "utf-8")), raw && args1[0] instanceof Uint8Array && !Buffer.isBuffer(args1[0]) && (args1[0] = Buffer.from(args1[0].buffer))), result = await utils_runSyncOrAsync(fn, loaderContext, args) || [];
3719
3749
  }
3720
3750
  return JavaScriptTracer.endAsync({
3721
- name: `loader:${pitch ? "pitch:" : ""}${loaderName}`,
3751
+ name: `js_loader:${pitch ? "pitch:" : ""}${loaderName}`,
3722
3752
  args: {
3723
- resource: resource,
3753
+ id2: resource,
3724
3754
  "loader.request": currentLoaderObject?.request
3725
- },
3726
- cat: "rspack",
3727
- id2: {
3728
- local: resource
3729
3755
  }
3730
3756
  }), result;
3731
3757
  };
@@ -3772,7 +3798,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3772
3798
  additionalData
3773
3799
  ], context.resourceData));
3774
3800
  }
3775
- context.content = isNil(content) ? null : toBuffer(content), context.sourceMap = JsSourceMap.__to_binding(sourceMap), context.additionalData = additionalData;
3801
+ context.content = isNil(content) ? null : toBuffer(content), context.sourceMap = JsSourceMap.__to_binding(sourceMap), context.additionalData = additionalData || void 0;
3776
3802
  break;
3777
3803
  }
3778
3804
  default:
@@ -3790,7 +3816,12 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3790
3816
  hideStack: "hideStack" in e ? !0 === e.hideStack || "true" === e.hideStack : void 0
3791
3817
  };
3792
3818
  }
3793
- return context;
3819
+ return JavaScriptTracer.endAsync({
3820
+ name: `run_js_loaders${pitch ? ":pitch" : ":normal"}`,
3821
+ args: {
3822
+ id2: resource
3823
+ }
3824
+ }), context;
3794
3825
  }
3795
3826
  let loader_runner_PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
3796
3827
  function parsePathQueryFragment(str) {
@@ -4354,16 +4385,40 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
4354
4385
  version: options.version || "unknown",
4355
4386
  bundler: options.bundler || "rspack",
4356
4387
  force: options.force ?? !0
4357
- })), CircularDependencyRspackPlugin = base_create(binding_.BuiltinPluginName.CircularDependencyRspackPlugin, (options)=>({
4358
- allowAsyncCycles: options.allowAsyncCycles,
4359
- failOnError: options.failOnError,
4360
- exclude: options.exclude,
4361
- ignoredConnections: options.ignoredConnections,
4362
- onDetected: options.onDetected,
4363
- onIgnored: options.onIgnored,
4364
- onStart: options.onStart,
4365
- onEnd: options.onEnd
4366
- }), "compilation"), ChunkPrefetchPreloadPlugin = base_create(binding_.BuiltinPluginName.ChunkPrefetchPreloadPlugin, ()=>{}), CommonJsChunkFormatPlugin = base_create(binding_.BuiltinPluginName.CommonJsChunkFormatPlugin, ()=>{}), CopyRspackPlugin = base_create(binding_.BuiltinPluginName.CopyRspackPlugin, (copy)=>{
4388
+ }));
4389
+ class CircularDependencyRspackPlugin extends RspackBuiltinPlugin {
4390
+ name = binding_.BuiltinPluginName.CircularDependencyRspackPlugin;
4391
+ _options;
4392
+ constructor(options){
4393
+ super(), this._options = options;
4394
+ }
4395
+ raw(compiler) {
4396
+ let { failOnError, allowAsyncCycles, exclude, ignoredConnections } = this._options, rawOptions = {
4397
+ failOnError,
4398
+ allowAsyncCycles,
4399
+ exclude,
4400
+ ignoredConnections,
4401
+ onDetected: this._options.onDetected ? (entripoint, modules)=>{
4402
+ let compilation = compiler.__internal__get_compilation();
4403
+ this._options.onDetected(entripoint, modules, compilation);
4404
+ } : void 0,
4405
+ onIgnored: this._options.onIgnored ? (entripoint, modules)=>{
4406
+ let compilation = compiler.__internal__get_compilation();
4407
+ this._options.onIgnored(entripoint, modules, compilation);
4408
+ } : void 0,
4409
+ onStart: this._options.onStart ? ()=>{
4410
+ let compilation = compiler.__internal__get_compilation();
4411
+ this._options.onStart(compilation);
4412
+ } : void 0,
4413
+ onEnd: this._options.onEnd ? ()=>{
4414
+ let compilation = compiler.__internal__get_compilation();
4415
+ this._options.onEnd(compilation);
4416
+ } : void 0
4417
+ };
4418
+ return createBuiltinPlugin(this.name, rawOptions);
4419
+ }
4420
+ }
4421
+ let ChunkPrefetchPreloadPlugin = base_create(binding_.BuiltinPluginName.ChunkPrefetchPreloadPlugin, ()=>{}), CommonJsChunkFormatPlugin = base_create(binding_.BuiltinPluginName.CommonJsChunkFormatPlugin, ()=>{}), CopyRspackPlugin = base_create(binding_.BuiltinPluginName.CopyRspackPlugin, (copy)=>{
4367
4422
  let ret = {
4368
4423
  patterns: []
4369
4424
  };
@@ -4423,16 +4478,14 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
4423
4478
  name = binding_.BuiltinPluginName.DeterministicChunkIdsPlugin;
4424
4479
  affectedHooks = "compilation";
4425
4480
  raw(compiler) {
4426
- let incremental = compiler.options.experiments.incremental, logger = compiler.getInfrastructureLogger("rspack.DeterministicChunkIdsPlugin");
4427
- return incremental.chunkIds && (incremental.chunkIds = !1, logger.warn("`optimization.chunkIds = 'deterministic'` can't be used with `incremental.chunkIds` as deterministic chunk ids is a global effect. `incremental.chunkIds` has been overridden to false. We recommend enabling incremental only in the development mode.")), createBuiltinPlugin(this.name, void 0);
4481
+ return createBuiltinPlugin(this.name, void 0);
4428
4482
  }
4429
4483
  }
4430
4484
  class DeterministicModuleIdsPlugin extends RspackBuiltinPlugin {
4431
4485
  name = binding_.BuiltinPluginName.DeterministicModuleIdsPlugin;
4432
4486
  affectedHooks = "compilation";
4433
4487
  raw(compiler) {
4434
- let incremental = compiler.options.experiments.incremental, logger = compiler.getInfrastructureLogger("rspack.DeterministicModuleIdsPlugin");
4435
- return incremental.moduleIds && (incremental.moduleIds = !1, logger.warn("`optimization.moduleIds = 'deterministic'` can't be used with `incremental.moduleIds` as deterministic module ids is a global effect. `incremental.moduleIds` has been overridden to false. We recommend enabling incremental only in the development mode.")), createBuiltinPlugin(this.name, void 0);
4488
+ return createBuiltinPlugin(this.name, void 0);
4436
4489
  }
4437
4490
  }
4438
4491
  class EntryOptionPlugin {
@@ -4644,8 +4697,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4644
4697
  super(), this.global = global, this.name = binding_.BuiltinPluginName.FlagDependencyUsagePlugin, this.affectedHooks = "compilation";
4645
4698
  }
4646
4699
  raw(compiler) {
4647
- let incremental = compiler.options.experiments.incremental, logger = compiler.getInfrastructureLogger("rspack.FlagDependencyUsagePlugin");
4648
- return incremental.modulesHashes && (incremental.modulesHashes = !1, logger.warn("`optimization.usedExports` can't be used with `incremental.modulesHashes` as export usage is a global effect. `incremental.modulesHashes` has been overridden to false. We recommend enabling incremental only in the development mode.")), incremental.modulesCodegen && (incremental.modulesCodegen = !1, logger.warn("`optimization.usedExports` can't be used with `incremental.modulesCodegen` as export usage is a global effect. `incremental.modulesCodegen` has been overridden to false. We recommend enabling incremental only in the development mode.")), incremental.modulesRuntimeRequirements && (incremental.modulesRuntimeRequirements = !1, logger.warn("`optimization.usedExports` can't be used with `incremental.modulesRuntimeRequirements` as export usage is a global effect. `incremental.modulesRuntimeRequirements` has been overridden to false. We recommend enabling incremental only in the development mode.")), createBuiltinPlugin(this.name, this.global);
4700
+ return createBuiltinPlugin(this.name, this.global);
4649
4701
  }
4650
4702
  }
4651
4703
  class HotModuleReplacementPlugin extends RspackBuiltinPlugin {
@@ -5058,11 +5110,14 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5058
5110
  test
5059
5111
  }), "thisCompilation"), LAZY_COMPILATION_PREFIX = "/lazy-compilation-using-", getDefaultClient = (compiler)=>require.resolve(`../hot/lazy-compilation-${compiler.options.externalsPresets.node ? "node" : "web"}.js`), noop = (_req, _res, next)=>{
5060
5112
  "function" == typeof next && next();
5061
- }, getFullServerUrl = ({ serverUrl })=>serverUrl ? serverUrl + (serverUrl.endsWith("/") ? LAZY_COMPILATION_PREFIX.slice(1) : LAZY_COMPILATION_PREFIX) : LAZY_COMPILATION_PREFIX, lazyCompilationMiddlewareInternal = (compiler, activeModules, filesByKey)=>{
5113
+ }, getFullServerUrl = ({ serverUrl, prefix })=>{
5114
+ let lazyCompilationPrefix = prefix || LAZY_COMPILATION_PREFIX;
5115
+ return serverUrl ? serverUrl + (serverUrl.endsWith("/") ? lazyCompilationPrefix.slice(1) : lazyCompilationPrefix) : lazyCompilationPrefix;
5116
+ }, lazyCompilationMiddlewareInternal = (compiler, activeModules, filesByKey, lazyCompilationPrefix)=>{
5062
5117
  let logger = compiler.getInfrastructureLogger("LazyCompilation");
5063
5118
  return (req, res, next)=>{
5064
- if (!req.url?.startsWith(LAZY_COMPILATION_PREFIX)) return next?.();
5065
- let keys = req.url.slice(LAZY_COMPILATION_PREFIX.length).split("@");
5119
+ if (!req.url?.startsWith(lazyCompilationPrefix)) return next?.();
5120
+ let keys = req.url.slice(lazyCompilationPrefix.length).split("@");
5066
5121
  req.socket.setNoDelay(!0), res.setHeader("content-type", "text/event-stream"), res.writeHead(200), res.write("\n");
5067
5122
  let moduleActivated = [];
5068
5123
  for (let key of keys){
@@ -5086,8 +5141,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5086
5141
  super(), this.deterministic = deterministic, this.name = binding_.BuiltinPluginName.MangleExportsPlugin, this.affectedHooks = "compilation";
5087
5142
  }
5088
5143
  raw(compiler) {
5089
- let incremental = compiler.options.experiments.incremental, logger = compiler.getInfrastructureLogger("rspack.MangleExportsPlugin");
5090
- return incremental.modulesHashes && (incremental.modulesHashes = !1, logger.warn("`optimization.mangleExports` can't be used with `incremental.modulesHashes` as export mangling is a global effect. `incremental.modulesHashes` has been overridden to false. We recommend enabling incremental only in the development mode.")), incremental.modulesCodegen && (incremental.modulesCodegen = !1, logger.warn("`optimization.mangleExports` can't be used with `incremental.modulesCodegen` as export mangling is a global effect. `incremental.modulesCodegen` has been overridden to false. We recommend enabling incremental only in the development mode.")), incremental.modulesRuntimeRequirements && (incremental.modulesRuntimeRequirements = !1, logger.warn("`optimization.mangleExports` can't be used with `incremental.modulesRuntimeRequirements` as export mangling is a global effect. `incremental.modulesRuntimeRequirements` has been overridden to false. We recommend enabling incremental only in the development mode.")), createBuiltinPlugin(this.name, this.deterministic);
5144
+ return createBuiltinPlugin(this.name, this.deterministic);
5091
5145
  }
5092
5146
  }
5093
5147
  let MergeDuplicateChunksPlugin = base_create(binding_.BuiltinPluginName.MergeDuplicateChunksPlugin, ()=>{}), ModuleChunkFormatPlugin = base_create(binding_.BuiltinPluginName.ModuleChunkFormatPlugin, ()=>{});
@@ -5095,8 +5149,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5095
5149
  name = binding_.BuiltinPluginName.ModuleConcatenationPlugin;
5096
5150
  affectedHooks = "compilation";
5097
5151
  raw(compiler) {
5098
- let incremental = compiler.options.experiments.incremental, logger = compiler.getInfrastructureLogger("rspack.ModuleConcatenationPlugin");
5099
- return incremental.moduleIds && (incremental.moduleIds = !1, logger.warn("`optimization.concatenateModules` can't be used with `incremental.moduleIds` as module concatenation is a global effect. `incremental.moduleIds` has been overridden to false. We recommend enabling incremental only in the development mode.")), incremental.modulesHashes && (incremental.modulesHashes = !1, logger.warn("`optimization.concatenateModules` can't be used with `incremental.modulesHashes` as module concatenation is a global effect. `incremental.modulesHashes` has been overridden to false. We recommend enabling incremental only in the development mode.")), incremental.modulesCodegen && (incremental.modulesCodegen = !1, logger.warn("`optimization.concatenateModules` can't be used with `incremental.modulesCodegen` as module concatenation is a global effect. `incremental.modulesCodegen` has been overridden to false. We recommend enabling incremental only in the development mode.")), incremental.modulesRuntimeRequirements && (incremental.modulesRuntimeRequirements = !1, logger.warn("`optimization.concatenateModules` can't be used with `incremental.modulesRuntimeRequirements` as module concatenation is a global effect. `incremental.modulesRuntimeRequirements` has been overridden to false. We recommend enabling incremental only in the development mode.")), incremental.chunksRuntimeRequirements && (incremental.chunksRuntimeRequirements = !1, logger.warn("`optimization.concatenateModules` can't be used with `incremental.chunksRuntimeRequirements` as module concatenation is a global effect. `incremental.chunksRuntimeRequirements` has been overridden to false. We recommend enabling incremental only in the development mode.")), incremental.chunksHashes && (incremental.chunksHashes = !1, logger.warn("`optimization.concatenateModules` can't be used with `incremental.chunksHashes` as module concatenation is a global effect. `incremental.chunksHashes` has been overridden to false. We recommend enabling incremental only in the development mode.")), incremental.chunksRender && (incremental.chunksRender = !1, logger.warn("`optimization.concatenateModules` can't be used with `incremental.chunksRender` as module concatenation is a global effect. `incremental.chunksRender` has been overridden to false. We recommend enabling incremental only in the development mode.")), createBuiltinPlugin(this.name, void 0);
5152
+ return createBuiltinPlugin(this.name, void 0);
5100
5153
  }
5101
5154
  }
5102
5155
  let NamedChunkIdsPlugin = base_create(binding_.BuiltinPluginName.NamedChunkIdsPlugin, ()=>{}, "compilation"), NamedModuleIdsPlugin = base_create(binding_.BuiltinPluginName.NamedModuleIdsPlugin, ()=>{}, "compilation");
@@ -5104,16 +5157,14 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5104
5157
  name = binding_.BuiltinPluginName.NaturalChunkIdsPlugin;
5105
5158
  affectedHooks = "compilation";
5106
5159
  raw(compiler) {
5107
- let incremental = compiler.options.experiments.incremental, logger = compiler.getInfrastructureLogger("rspack.NaturalChunkIdsPlugin");
5108
- return incremental.moduleIds && (incremental.moduleIds = !1, logger.warn("`optimization.chunkIds = 'natural'` can't be used with `incremental.chunkIds` as natural chunk ids is a global effect. `incremental.chunkIds` has been overridden to false. We recommend enabling incremental only in the development mode.")), createBuiltinPlugin(this.name, void 0);
5160
+ return createBuiltinPlugin(this.name, void 0);
5109
5161
  }
5110
5162
  }
5111
5163
  class NaturalModuleIdsPlugin extends RspackBuiltinPlugin {
5112
5164
  name = binding_.BuiltinPluginName.NaturalModuleIdsPlugin;
5113
5165
  affectedHooks = "compilation";
5114
5166
  raw(compiler) {
5115
- let incremental = compiler.options.experiments.incremental, logger = compiler.getInfrastructureLogger("rspack.NaturalModuleIdsPlugin");
5116
- return incremental.moduleIds && (incremental.moduleIds = !1, logger.warn("`optimization.moduleIds = 'natural'` can't be used with `incremental.moduleIds` as natural module ids is a global effect. `incremental.moduleIds` has been overridden to false. We recommend enabling incremental only in the development mode.")), createBuiltinPlugin(this.name, void 0);
5167
+ return createBuiltinPlugin(this.name, void 0);
5117
5168
  }
5118
5169
  }
5119
5170
  let NodeTargetPlugin = base_create(binding_.BuiltinPluginName.NodeTargetPlugin, ()=>void 0), OccurrenceChunkIdsPlugin = base_create(binding_.BuiltinPluginName.OccurrenceChunkIdsPlugin, (options)=>({
@@ -6443,9 +6494,9 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6443
6494
  let tty = infrastructureLogging.stream.isTTY && "dumb" !== process.env.TERM;
6444
6495
  D(infrastructureLogging, "level", "info"), D(infrastructureLogging, "debug", !1), D(infrastructureLogging, "colors", tty), D(infrastructureLogging, "appendOnly", !tty);
6445
6496
  }, applyExperimentsDefaults = (experiments, { production, development })=>{
6446
- F(experiments, "cache", ()=>development), D(experiments, "futureDefaults", !1), D(experiments, "lazyCompilation", !1), D(experiments, "asyncWebAssembly", experiments.futureDefaults), D(experiments, "css", !!experiments.futureDefaults || void 0), D(experiments, "layers", !1), D(experiments, "topLevelAwait", !0), D(experiments, "buildHttp", void 0), experiments.buildHttp && "object" == typeof experiments.buildHttp && D(experiments.buildHttp, "upgrade", !1), D(experiments, "incremental", !production && {}), "object" == typeof experiments.incremental && (D(experiments.incremental, "make", !0), D(experiments.incremental, "inferAsyncModules", !1), D(experiments.incremental, "providedExports", !1), D(experiments.incremental, "dependenciesDiagnostics", !1), D(experiments.incremental, "sideEffects", !1), D(experiments.incremental, "buildChunkGraph", !1), D(experiments.incremental, "moduleIds", !1), D(experiments.incremental, "chunkIds", !1), D(experiments.incremental, "modulesHashes", !1), D(experiments.incremental, "modulesCodegen", !1), D(experiments.incremental, "modulesRuntimeRequirements", !1), D(experiments.incremental, "chunksRuntimeRequirements", !1), D(experiments.incremental, "chunksHashes", !1), D(experiments.incremental, "chunksRender", !1), D(experiments.incremental, "emitAssets", !0)), D(experiments, "rspackFuture", {}), D(experiments, "parallelCodeSplitting", !0), D(experiments, "parallelLoader", !1);
6497
+ F(experiments, "cache", ()=>development), D(experiments, "futureDefaults", !1), D(experiments, "lazyCompilation", !1), D(experiments, "asyncWebAssembly", experiments.futureDefaults), D(experiments, "css", !!experiments.futureDefaults || void 0), D(experiments, "layers", !1), D(experiments, "topLevelAwait", !0), D(experiments, "buildHttp", void 0), experiments.buildHttp && "object" == typeof experiments.buildHttp && D(experiments.buildHttp, "upgrade", !1), D(experiments, "incremental", !!development && {}), "object" == typeof experiments.incremental && (D(experiments.incremental, "make", !0), D(experiments.incremental, "inferAsyncModules", !1), D(experiments.incremental, "providedExports", !1), D(experiments.incremental, "dependenciesDiagnostics", !1), D(experiments.incremental, "sideEffects", !1), D(experiments.incremental, "buildChunkGraph", !1), D(experiments.incremental, "moduleIds", !1), D(experiments.incremental, "chunkIds", !1), D(experiments.incremental, "modulesHashes", !1), D(experiments.incremental, "modulesCodegen", !1), D(experiments.incremental, "modulesRuntimeRequirements", !1), D(experiments.incremental, "chunksRuntimeRequirements", !1), D(experiments.incremental, "chunksHashes", !1), D(experiments.incremental, "chunksRender", !1), D(experiments.incremental, "emitAssets", !0)), D(experiments, "rspackFuture", {}), D(experiments, "parallelCodeSplitting", !0), D(experiments, "parallelLoader", !1);
6447
6498
  }, applybundlerInfoDefaults = (rspackFuture, library)=>{
6448
- "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.3.6"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
6499
+ "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.3.7"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
6449
6500
  }, applySnapshotDefaults = (_snapshot, _env)=>{}, applyJavascriptParserOptionsDefaults = (parserOptions)=>{
6450
6501
  D(parserOptions, "dynamicImportMode", "lazy"), D(parserOptions, "dynamicImportPrefetch", !1), D(parserOptions, "dynamicImportPreload", !1), D(parserOptions, "url", !0), D(parserOptions, "exprContextCritical", !0), D(parserOptions, "wrappedContextCritical", !1), D(parserOptions, "wrappedContextRegExp", /.*/), D(parserOptions, "strictExportPresence", !1), D(parserOptions, "requireAsExpression", !0), D(parserOptions, "requireDynamic", !0), D(parserOptions, "requireResolve", !0), D(parserOptions, "importDynamic", !0), D(parserOptions, "worker", [
6451
6502
  "..."
@@ -7339,7 +7390,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7339
7390
  },
7340
7391
  arm: "gnueabihf"
7341
7392
  }
7342
- }, BINDING_VERSION = __webpack_require__("@rspack/binding/package.json").version, CORE_VERSION = "1.3.6", getAddonPlatformArchAbi = ()=>{
7393
+ }, BINDING_VERSION = __webpack_require__("@rspack/binding/package.json").version, CORE_VERSION = "1.3.7", getAddonPlatformArchAbi = ()=>{
7343
7394
  let { platform, arch } = process, binding = "";
7344
7395
  binding += platform;
7345
7396
  let abi = NodePlatformArchToAbi[platform][arch];
@@ -8509,7 +8560,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
8509
8560
  obj.children = this.stats.map((stat, idx)=>{
8510
8561
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
8511
8562
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
8512
- }), childOptions.version && (obj.rspackVersion = "1.3.6", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
8563
+ }), childOptions.version && (obj.rspackVersion = "1.3.7", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
8513
8564
  let mapError = (j, obj)=>({
8514
8565
  ...obj,
8515
8566
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -9385,7 +9436,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
9385
9436
  object.hash = context.getStatsCompilation(compilation).hash;
9386
9437
  },
9387
9438
  version: (object)=>{
9388
- object.version = "1.3.6", object.rspackVersion = "5.75.0";
9439
+ object.version = "1.3.7", object.rspackVersion = "5.75.0";
9389
9440
  },
9390
9441
  env: (object, _compilation, _context, { _env })=>{
9391
9442
  object.env = _env;
@@ -12576,8 +12627,9 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
12576
12627
  entries: zod_index_js_default().boolean().optional(),
12577
12628
  test: zod_index_js_default().instanceof(RegExp).or(zod_index_js_default().function().args(zod_index_js_default().custom()).returns(zod_index_js_default().boolean())).optional(),
12578
12629
  client: zod_index_js_default().string().optional(),
12579
- serverUrl: zod_index_js_default().string().optional()
12580
- }), zod_incremental = zod_index_js_default().strictObject({
12630
+ serverUrl: zod_index_js_default().string().optional(),
12631
+ prefix: zod_index_js_default().string().optional()
12632
+ }), incremental = zod_index_js_default().strictObject({
12581
12633
  make: zod_index_js_default().boolean().optional(),
12582
12634
  inferAsyncModules: zod_index_js_default().boolean().optional(),
12583
12635
  providedExports: zod_index_js_default().boolean().optional(),
@@ -12617,7 +12669,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
12617
12669
  topLevelAwait: zod_index_js_default().boolean().optional(),
12618
12670
  css: zod_index_js_default().boolean().optional(),
12619
12671
  layers: zod_index_js_default().boolean().optional(),
12620
- incremental: zod_index_js_default().boolean().or(zod_incremental).optional(),
12672
+ incremental: zod_index_js_default().boolean().or(incremental).optional(),
12621
12673
  parallelCodeSplitting: zod_index_js_default().boolean().optional(),
12622
12674
  futureDefaults: zod_index_js_default().boolean().optional(),
12623
12675
  rspackFuture: rspackFutureOptions.optional(),
@@ -13035,7 +13087,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
13035
13087
  return createBuiltinPlugin(this.name, rawOptions);
13036
13088
  }
13037
13089
  }
13038
- let exports_rspackVersion = "1.3.6", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
13090
+ let exports_rspackVersion = "1.3.7", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
13039
13091
  getNormalizedRspackOptions: getNormalizedRspackOptions,
13040
13092
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
13041
13093
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -13116,7 +13168,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
13116
13168
  }, exports_experiments = {
13117
13169
  globalTrace: {
13118
13170
  async register (filter, layer, output) {
13119
- (0, binding_.registerGlobalTrace)(filter, layer, output), JavaScriptTracer.initJavaScriptTrace(layer, output);
13171
+ JavaScriptTracer.initJavaScriptTrace(layer, output), (0, binding_.registerGlobalTrace)(filter, layer, output), JavaScriptTracer.initCpuProfiler();
13120
13172
  },
13121
13173
  async cleanup () {
13122
13174
  (0, binding_.cleanupGlobalTrace)(), JavaScriptTracer.cleanupJavaScriptTrace();
@@ -13127,7 +13179,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
13127
13179
  SubresourceIntegrityPlugin: SubresourceIntegrityPlugin,
13128
13180
  lazyCompilationMiddleware: (compiler, userOptions = {})=>{
13129
13181
  if (!1 === userOptions) return noop;
13130
- let options = !0 === userOptions ? {} : userOptions, activeModules = new Map(), filesByKey = new Map();
13182
+ let options = !0 === userOptions ? {} : userOptions, activeModules = new Map(), filesByKey = new Map(), lazyCompilationPrefix = options.prefix || LAZY_COMPILATION_PREFIX;
13131
13183
  return new BuiltinLazyCompilationPlugin(({ module, path })=>{
13132
13184
  let key = encodeURIComponent(module.replace(/\\/g, "/").replace(/@/g, "_")).replace(/%(2F|3A|24|26|2B|2C|3B|3D)/g, decodeURIComponent);
13133
13185
  filesByKey.set(key, path);
@@ -13137,7 +13189,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
13137
13189
  data: key,
13138
13190
  active
13139
13191
  };
13140
- }, options.cacheable ?? !0, options.entries ?? !0, options.imports ?? !0, "function" == typeof options.test ? (module)=>(0, options.test)(module) : options.test).apply(compiler), lazyCompilationMiddlewareInternal(compiler, activeModules, filesByKey);
13192
+ }, options.cacheable ?? !0, options.entries ?? !0, options.imports ?? !0, "function" == typeof options.test ? (module)=>(0, options.test)(module) : options.test).apply(compiler), lazyCompilationMiddlewareInternal(compiler, activeModules, filesByKey, lazyCompilationPrefix);
13141
13193
  }
13142
13194
  };
13143
13195
  function createCompiler(userOptions) {
@@ -22,12 +22,14 @@ export declare class JavaScriptTracer {
22
22
  static output: string;
23
23
  static session: inspector.Session;
24
24
  static initJavaScriptTrace(layer: string, output: string): void;
25
+ static initCpuProfiler(): void;
25
26
  static cleanupJavaScriptTrace(): Promise<void>;
26
27
  static getTs(): number;
27
28
  static getCommonEv(): {
28
29
  tid: number;
29
30
  pid: number;
30
31
  ts: number;
32
+ cat: string;
31
33
  };
32
34
  static pushEvent(event: ChromeEvent): void;
33
35
  static startAsync(events: ChromeEvent): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -59,7 +59,7 @@
59
59
  "@module-federation/runtime-tools": "0.13.0",
60
60
  "@rspack/lite-tapable": "1.0.1",
61
61
  "caniuse-lite": "^1.0.30001715",
62
- "@rspack/binding": "1.3.6"
62
+ "@rspack/binding": "1.3.7"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "@swc/helpers": ">=0.5.1"