@rspack-canary/browser 1.7.2-canary-f4c77913-20260107173928 → 1.7.2-canary-6ee0d4b1-20260109174315

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.
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type { AssetInfo, ChunkGroup, Dependency, ExternalObject, JsCompilation, JsRuntimeModule } from '@rspack/binding';
10
+ import type { AssetInfo, ChunkGroup, Dependency, ExternalObject, JsCompilation } from '@rspack/binding';
11
11
  import binding from '@rspack/binding';
12
12
  export type { AssetInfo } from '@rspack/binding';
13
13
  import * as liteTapable from '@rspack/lite-tapable';
@@ -185,7 +185,7 @@ export declare class Compilation {
185
185
  Set<string>
186
186
  ]>;
187
187
  runtimeRequirementInTree: liteTapable.HookMap<liteTapable.SyncBailHook<[Chunk, Set<string>], void>>;
188
- runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk]>;
188
+ runtimeModule: liteTapable.SyncHook<[RuntimeModule, Chunk]>;
189
189
  seal: liteTapable.SyncHook<[]>;
190
190
  afterSeal: liteTapable.AsyncSeriesHook<[], void>;
191
191
  needAdditionalPass: liteTapable.SyncBailHook<[], boolean>;
@@ -1,4 +1,4 @@
1
- import type { JsAddingRuntimeModule } from '@rspack/binding';
1
+ import type { JsAddingRuntimeModule, JsRuntimeModule } from '@rspack/binding';
2
2
  import type { Chunk } from './Chunk';
3
3
  import type { ChunkGraph } from './ChunkGraph';
4
4
  import type { Compilation } from './Compilation';
@@ -30,3 +30,4 @@ export declare class RuntimeModule {
30
30
  shouldIsolate(): boolean;
31
31
  generate(): string;
32
32
  }
33
+ export declare function createRenderedRuntimeModule(module: JsRuntimeModule): RuntimeModule;
@@ -851,6 +851,11 @@ export type JavascriptParserOptions = {
851
851
  worker?: string[] | boolean;
852
852
  /** Override the module to strict or non-strict. */
853
853
  overrideStrict?: 'strict' | 'non-strict';
854
+ /**
855
+ * Control whether renaming of the CommonJS `require` function will be parsed and transformed.
856
+ * @default true
857
+ */
858
+ requireAlias?: boolean;
854
859
  requireAsExpression?: boolean;
855
860
  requireDynamic?: boolean;
856
861
  requireResolve?: boolean;
package/dist/index.mjs CHANGED
@@ -50957,6 +50957,38 @@ RuntimeModule_define_property(RuntimeModule, "STAGE_NORMAL", 0);
50957
50957
  RuntimeModule_define_property(RuntimeModule, "STAGE_BASIC", 5);
50958
50958
  RuntimeModule_define_property(RuntimeModule, "STAGE_ATTACH", 10);
50959
50959
  RuntimeModule_define_property(RuntimeModule, "STAGE_TRIGGER", 20);
50960
+ function createRenderedRuntimeModule(module1) {
50961
+ const RuntimeModuleClass = {
50962
+ [module1.constructorName]: class extends RuntimeModule {
50963
+ get constructorName() {
50964
+ return module1.constructorName;
50965
+ }
50966
+ get moduleIdentifier() {
50967
+ return module1.moduleIdentifier;
50968
+ }
50969
+ get source() {
50970
+ return this._source;
50971
+ }
50972
+ identifier() {
50973
+ return module1.moduleIdentifier;
50974
+ }
50975
+ readableIdentifier() {
50976
+ return module1.moduleIdentifier;
50977
+ }
50978
+ shouldIsolate() {
50979
+ return module1.isolate;
50980
+ }
50981
+ generate() {
50982
+ return this._source?.source.toString('utf-8') || '';
50983
+ }
50984
+ constructor(){
50985
+ super(module1.name, module1.stage), RuntimeModule_define_property(this, "_source", void 0);
50986
+ this._source = module1.source;
50987
+ }
50988
+ }
50989
+ }[module1.constructorName];
50990
+ return new RuntimeModuleClass();
50991
+ }
50960
50992
  function Stats_check_private_redeclaration(obj, privateCollection) {
50961
50993
  if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
50962
50994
  }
@@ -55616,6 +55648,7 @@ function getRawJavascriptParserOptions(parser) {
55616
55648
  ] : [] : parser.worker,
55617
55649
  overrideStrict: parser.overrideStrict,
55618
55650
  requireAsExpression: parser.requireAsExpression,
55651
+ requireAlias: parser.requireAlias,
55619
55652
  requireDynamic: parser.requireDynamic,
55620
55653
  requireResolve: parser.requireResolve,
55621
55654
  commonjs: parser.commonjs,
@@ -55843,7 +55876,7 @@ class ExternalsPlugin extends RspackBuiltinPlugin {
55843
55876
  if ('string' == typeof item || item instanceof RegExp) return item;
55844
55877
  if ('function' == typeof item) {
55845
55878
  const processResolveResult = ExternalsPlugin_class_private_field_get(this, _processResolveResult);
55846
- return async (ctx)=>await new Promise((resolve, reject)=>{
55879
+ return async (ctx)=>new Promise((resolve, reject)=>{
55847
55880
  const data = ctx.data();
55848
55881
  const promise = item({
55849
55882
  request: data.request,
@@ -56537,35 +56570,35 @@ const createRsdoctorPluginHooksRegisters = (getCompiler, createTap)=>({
56537
56570
  return RsdoctorPlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).moduleGraph;
56538
56571
  }, function(queried) {
56539
56572
  return async function(data) {
56540
- return await queried.promise(data);
56573
+ return queried.promise(data);
56541
56574
  };
56542
56575
  }),
56543
56576
  registerRsdoctorPluginChunkGraphTaps: createTap(external_rspack_wasi_browser_js_.RegisterJsTapKind.RsdoctorPluginChunkGraph, function() {
56544
56577
  return RsdoctorPlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).chunkGraph;
56545
56578
  }, function(queried) {
56546
56579
  return async function(data) {
56547
- return await queried.promise(data);
56580
+ return queried.promise(data);
56548
56581
  };
56549
56582
  }),
56550
56583
  registerRsdoctorPluginModuleIdsTaps: createTap(external_rspack_wasi_browser_js_.RegisterJsTapKind.RsdoctorPluginModuleIds, function() {
56551
56584
  return RsdoctorPlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).moduleIds;
56552
56585
  }, function(queried) {
56553
56586
  return async function(data) {
56554
- return await queried.promise(data);
56587
+ return queried.promise(data);
56555
56588
  };
56556
56589
  }),
56557
56590
  registerRsdoctorPluginModuleSourcesTaps: createTap(external_rspack_wasi_browser_js_.RegisterJsTapKind.RsdoctorPluginModuleSources, function() {
56558
56591
  return RsdoctorPlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).moduleSources;
56559
56592
  }, function(queried) {
56560
56593
  return async function(data) {
56561
- return await queried.promise(data);
56594
+ return queried.promise(data);
56562
56595
  };
56563
56596
  }),
56564
56597
  registerRsdoctorPluginAssetsTaps: createTap(external_rspack_wasi_browser_js_.RegisterJsTapKind.RsdoctorPluginAssets, function() {
56565
56598
  return RsdoctorPlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).assets;
56566
56599
  }, function(queried) {
56567
56600
  return async function(data) {
56568
- return await queried.promise(data);
56601
+ return queried.promise(data);
56569
56602
  };
56570
56603
  })
56571
56604
  });
@@ -58172,7 +58205,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58172
58205
  if ('object' == typeof rspackFuture) {
58173
58206
  D(rspackFuture, 'bundlerInfo', {});
58174
58207
  if ('object' == typeof rspackFuture.bundlerInfo) {
58175
- D(rspackFuture.bundlerInfo, 'version', "1.7.2-canary-f4c77913-20260107173928");
58208
+ D(rspackFuture.bundlerInfo, 'version', "1.7.2-canary-6ee0d4b1-20260109174315");
58176
58209
  D(rspackFuture.bundlerInfo, 'bundler', 'rspack');
58177
58210
  D(rspackFuture.bundlerInfo, 'force', !library);
58178
58211
  }
@@ -58190,6 +58223,7 @@ const applyJavascriptParserOptionsDefaults = (parserOptions, { deferImport })=>{
58190
58223
  D(parserOptions, 'wrappedContextRegExp', /.*/);
58191
58224
  D(parserOptions, 'strictExportPresence', false);
58192
58225
  D(parserOptions, 'requireAsExpression', true);
58226
+ D(parserOptions, 'requireAlias', true);
58193
58227
  D(parserOptions, 'requireDynamic', true);
58194
58228
  D(parserOptions, 'requireResolve', true);
58195
58229
  D(parserOptions, 'commonjs', true);
@@ -59776,13 +59810,13 @@ class ThreadsafeIntermediateNodeFS extends ThreadsafeOutputNodeFS {
59776
59810
  this.close = memoizeFn(()=>util_0_default().promisify(fs.close.bind(fs)));
59777
59811
  this.write = memoizeFn(()=>{
59778
59812
  const writeFn = util_0_default().promisify(fs.write.bind(fs));
59779
- return async (fd, content, position)=>await writeFn(fd, content, {
59813
+ return async (fd, content, position)=>writeFn(fd, content, {
59780
59814
  position
59781
59815
  });
59782
59816
  });
59783
59817
  this.writeAll = memoizeFn(()=>{
59784
59818
  const writeFn = util_0_default().promisify(fs.writeFile.bind(fs));
59785
- return async (fd, content)=>await writeFn(fd, content);
59819
+ return async (fd, content)=>writeFn(fd, content);
59786
59820
  });
59787
59821
  this.read = memoizeFn(()=>{
59788
59822
  const readFn = fs.read.bind(fs);
@@ -60440,7 +60474,7 @@ class MultiStats {
60440
60474
  return obj;
60441
60475
  });
60442
60476
  if (childOptions.version) {
60443
- obj.rspackVersion = "1.7.2-canary-f4c77913-20260107173928";
60477
+ obj.rspackVersion = "1.7.2-canary-6ee0d4b1-20260109174315";
60444
60478
  obj.version = "5.75.0";
60445
60479
  }
60446
60480
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
@@ -62272,7 +62306,7 @@ const SIMPLE_EXTRACTORS = {
62272
62306
  },
62273
62307
  version: (object)=>{
62274
62308
  object.version = "5.75.0";
62275
- object.rspackVersion = "1.7.2-canary-f4c77913-20260107173928";
62309
+ object.rspackVersion = "1.7.2-canary-6ee0d4b1-20260109174315";
62276
62310
  },
62277
62311
  env: (object, _compilation, _context, { _env })=>{
62278
62312
  object.env = _env;
@@ -64300,8 +64334,11 @@ const createCompilationHooksRegisters = (getCompiler, createTap, createMapTap)=>
64300
64334
  return getCompiler().__internal__get_compilation().hooks.runtimeModule;
64301
64335
  }, function(queried) {
64302
64336
  return function({ module: module1, chunk }) {
64337
+ const runtimeModule = createRenderedRuntimeModule(module1);
64338
+ const compilation = getCompiler().__internal__get_compilation();
64339
+ runtimeModule.attach(compilation, chunk, compilation.chunkGraph);
64303
64340
  const originSource = module1.source?.source;
64304
- queried.call(module1, chunk);
64341
+ queried.call(runtimeModule, chunk);
64305
64342
  const newSource = module1.source?.source;
64306
64343
  if (newSource && newSource !== originSource) return module1;
64307
64344
  };
@@ -64377,7 +64414,7 @@ const createCompilationHooksRegisters = (getCompiler, createTap, createMapTap)=>
64377
64414
  return getCompiler().__internal__get_compilation().hooks.finishModules;
64378
64415
  }, function(queried) {
64379
64416
  return async function() {
64380
- return await queried.promise(getCompiler().__internal__get_compilation().modules);
64417
+ return queried.promise(getCompiler().__internal__get_compilation().modules);
64381
64418
  };
64382
64419
  }),
64383
64420
  registerCompilationOptimizeModulesTaps: createTap(external_rspack_wasi_browser_js_["default"].RegisterJsTapKind.CompilationOptimizeModules, function() {
@@ -64398,14 +64435,14 @@ const createCompilationHooksRegisters = (getCompiler, createTap, createMapTap)=>
64398
64435
  return getCompiler().__internal__get_compilation().hooks.optimizeTree;
64399
64436
  }, function(queried) {
64400
64437
  return async function() {
64401
- return await queried.promise(getCompiler().__internal__get_compilation().chunks, getCompiler().__internal__get_compilation().modules);
64438
+ return queried.promise(getCompiler().__internal__get_compilation().chunks, getCompiler().__internal__get_compilation().modules);
64402
64439
  };
64403
64440
  }),
64404
64441
  registerCompilationOptimizeChunkModulesTaps: createTap(external_rspack_wasi_browser_js_["default"].RegisterJsTapKind.CompilationOptimizeChunkModules, function() {
64405
64442
  return getCompiler().__internal__get_compilation().hooks.optimizeChunkModules;
64406
64443
  }, function(queried) {
64407
64444
  return async function() {
64408
- return await queried.promise(getCompiler().__internal__get_compilation().chunks, getCompiler().__internal__get_compilation().modules);
64445
+ return queried.promise(getCompiler().__internal__get_compilation().chunks, getCompiler().__internal__get_compilation().modules);
64409
64446
  };
64410
64447
  }),
64411
64448
  registerCompilationChunkHashTaps: createTap(external_rspack_wasi_browser_js_["default"].RegisterJsTapKind.CompilationChunkHash, function() {
@@ -64431,7 +64468,7 @@ const createCompilationHooksRegisters = (getCompiler, createTap, createMapTap)=>
64431
64468
  return getCompiler().__internal__get_compilation().hooks.processAssets;
64432
64469
  }, function(queried) {
64433
64470
  return async function() {
64434
- return await queried.promise(getCompiler().__internal__get_compilation().assets);
64471
+ return queried.promise(getCompiler().__internal__get_compilation().assets);
64435
64472
  };
64436
64473
  }),
64437
64474
  registerCompilationAfterProcessAssetsTaps: createTap(external_rspack_wasi_browser_js_["default"].RegisterJsTapKind.CompilationAfterProcessAssets, function() {
@@ -64452,7 +64489,7 @@ const createCompilationHooksRegisters = (getCompiler, createTap, createMapTap)=>
64452
64489
  return getCompiler().__internal__get_compilation().hooks.afterSeal;
64453
64490
  }, function(queried) {
64454
64491
  return async function() {
64455
- return await queried.promise();
64492
+ return queried.promise();
64456
64493
  };
64457
64494
  })
64458
64495
  });
@@ -64476,14 +64513,14 @@ const createCompilerHooksRegisters = (getCompiler, createTap)=>({
64476
64513
  return getCompiler().hooks.make;
64477
64514
  }, function(queried) {
64478
64515
  return async function() {
64479
- return await queried.promise(getCompiler().__internal__get_compilation());
64516
+ return queried.promise(getCompiler().__internal__get_compilation());
64480
64517
  };
64481
64518
  }),
64482
64519
  registerCompilerFinishMakeTaps: createTap(external_rspack_wasi_browser_js_["default"].RegisterJsTapKind.CompilerFinishMake, function() {
64483
64520
  return getCompiler().hooks.finishMake;
64484
64521
  }, function(queried) {
64485
64522
  return async function() {
64486
- return await queried.promise(getCompiler().__internal__get_compilation());
64523
+ return queried.promise(getCompiler().__internal__get_compilation());
64487
64524
  };
64488
64525
  }),
64489
64526
  registerCompilerShouldEmitTaps: createTap(external_rspack_wasi_browser_js_["default"].RegisterJsTapKind.CompilerShouldEmit, function() {
@@ -64497,14 +64534,14 @@ const createCompilerHooksRegisters = (getCompiler, createTap)=>({
64497
64534
  return getCompiler().hooks.emit;
64498
64535
  }, function(queried) {
64499
64536
  return async function() {
64500
- return await queried.promise(getCompiler().__internal__get_compilation());
64537
+ return queried.promise(getCompiler().__internal__get_compilation());
64501
64538
  };
64502
64539
  }),
64503
64540
  registerCompilerAfterEmitTaps: createTap(external_rspack_wasi_browser_js_["default"].RegisterJsTapKind.CompilerAfterEmit, function() {
64504
64541
  return getCompiler().hooks.afterEmit;
64505
64542
  }, function(queried) {
64506
64543
  return async function() {
64507
- return await queried.promise(getCompiler().__internal__get_compilation());
64544
+ return queried.promise(getCompiler().__internal__get_compilation());
64508
64545
  };
64509
64546
  }),
64510
64547
  registerCompilerAssetEmittedTaps: createTap(external_rspack_wasi_browser_js_["default"].RegisterJsTapKind.CompilerAssetEmitted, function() {
@@ -66939,7 +66976,7 @@ function transformSync(source, options) {
66939
66976
  const _options = JSON.stringify(options || {});
66940
66977
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
66941
66978
  }
66942
- const exports_rspackVersion = "1.7.2-canary-f4c77913-20260107173928";
66979
+ const exports_rspackVersion = "1.7.2-canary-6ee0d4b1-20260109174315";
66943
66980
  const exports_version = "5.75.0";
66944
66981
  const exports_WebpackError = Error;
66945
66982
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -1205,6 +1205,8 @@ export interface JsRuntimeModule {
1205
1205
  moduleIdentifier: string
1206
1206
  constructorName: string
1207
1207
  name: string
1208
+ stage: number
1209
+ isolate: boolean
1208
1210
  }
1209
1211
 
1210
1212
  export interface JsRuntimeModuleArg {
@@ -2337,6 +2339,11 @@ export interface RawJavascriptParserOptions {
2337
2339
  worker?: Array<string>
2338
2340
  overrideStrict?: string
2339
2341
  importMeta?: boolean
2342
+ /**
2343
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2344
+ * @experimental
2345
+ */
2346
+ requireAlias?: boolean
2340
2347
  /**
2341
2348
  * This option is experimental in Rspack only and subject to change or be removed anytime.
2342
2349
  * @experimental
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-canary/browser",
3
- "version": "1.7.2-canary-f4c77913-20260107173928",
3
+ "version": "1.7.2-canary-6ee0d4b1-20260109174315",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "Rspack for running in the browser. This is still in early stage and may not follow the semver.",