@rspack-canary/browser 1.6.0-canary-beafb11e-20251019174144 → 1.6.0-canary-e3199f44-20251020173943

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.
@@ -107,6 +107,14 @@ declare class Compiler {
107
107
  cache: Cache;
108
108
  compilerPath: string;
109
109
  options: RspackOptionsNormalized;
110
+ /**
111
+ * Whether to skip dropping Rust compiler instance to improve performance.
112
+ * This is an internal option api and could be removed or changed at any time.
113
+ * @internal
114
+ * true: Skip dropping Rust compiler instance.
115
+ * false: Drop Rust compiler instance when Compiler is garbage collected.
116
+ */
117
+ unsafeFastDrop: boolean;
110
118
  /**
111
119
  * Note: This is not a webpack public API, maybe removed in future.
112
120
  * @internal
@@ -41,6 +41,7 @@ export declare class MultiCompiler {
41
41
  running: boolean;
42
42
  watching?: MultiWatching;
43
43
  constructor(compilers: Compiler[] | Record<string, Compiler>, options?: MultiCompilerOptions);
44
+ set unsafeFastDrop(value: boolean);
44
45
  get options(): import(".").RspackOptionsNormalized[] & MultiCompilerOptions;
45
46
  get outputPath(): string;
46
47
  get inputFileSystem(): InputFileSystem;
@@ -321,5 +321,8 @@ export declare const RuntimeGlobals: {
321
321
  * ) =\> void
322
322
  */
323
323
  readonly asyncModule: "__webpack_require__.a";
324
+ readonly asyncModuleExportSymbol: "__webpack_require__.aE";
325
+ readonly makeDeferredNamespaceObject: "__webpack_require__.z";
326
+ readonly makeDeferredNamespaceObjectSymbol: "__webpack_require__.zS";
324
327
  };
325
328
  export declare const isReservedRuntimeGlobal: (r: string) => boolean;
@@ -76,6 +76,7 @@ export interface ModuleOptionsNormalized {
76
76
  parser: ParserOptionsByModuleType;
77
77
  generator: GeneratorOptionsByModuleType;
78
78
  noParse?: NoParseOption;
79
+ unsafeCache?: boolean | RegExp;
79
80
  }
80
81
  export type ExperimentCacheNormalized = boolean | {
81
82
  type: "memory";
@@ -121,6 +122,7 @@ export interface ExperimentsNormalized {
121
122
  typeReexportsPresence?: boolean;
122
123
  lazyBarrel?: boolean;
123
124
  nativeWatcher?: boolean;
125
+ deferImport?: boolean;
124
126
  }
125
127
  export type IgnoreWarningsNormalized = ((warning: WebpackError, compilation: Compilation) => boolean)[];
126
128
  export type OptimizationRuntimeChunkNormalized = false | {
@@ -818,6 +818,8 @@ export type JavascriptParserOptions = {
818
818
  typeReexportsPresence?: "no-tolerant" | "tolerant" | "tolerant-no-check";
819
819
  /** Whether to enable JSX parsing */
820
820
  jsx?: boolean;
821
+ /** Whether to enable defer import */
822
+ deferImport?: boolean;
821
823
  };
822
824
  export type JsonParserOptions = {
823
825
  /**
@@ -990,6 +992,10 @@ export type ModuleOptions = {
990
992
  generator?: GeneratorOptionsByModuleType;
991
993
  /** Keep module mechanism of the matched modules as-is, such as module.exports, require, import. */
992
994
  noParse?: NoParseOption;
995
+ /**
996
+ * Cache the resolving of module requests.
997
+ */
998
+ unsafeCache?: boolean | RegExp;
993
999
  };
994
1000
  type AllowTarget = "web" | "webworker" | "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "es2023" | "es2024" | "es2025" | "node" | "async-node" | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | "electron-main" | `electron${number}-main` | `electron${number}.${number}-main` | "electron-renderer" | `electron${number}-renderer` | `electron${number}.${number}-renderer` | "electron-preload" | `electron${number}-preload` | `electron${number}.${number}-preload` | "nwjs" | `nwjs${number}` | `nwjs${number}.${number}` | "node-webkit" | `node-webkit${number}` | `node-webkit${number}.${number}` | "browserslist" | `browserslist:${string}`;
995
1001
  /** Used to configure the target environment of Rspack output and the ECMAScript version of Rspack runtime code. */
@@ -2116,6 +2122,11 @@ export type Experiments = {
2116
2122
  * @default false
2117
2123
  */
2118
2124
  lazyBarrel?: boolean;
2125
+ /**
2126
+ * Enable defer import feature
2127
+ * @default false
2128
+ */
2129
+ deferImport?: boolean;
2119
2130
  };
2120
2131
  export type Watch = boolean;
2121
2132
  /** Options for watch mode. */
@@ -2148,8 +2159,7 @@ export type WatchOptions = {
2148
2159
  /**
2149
2160
  * Options for devServer, it based on `webpack-dev-server@5`
2150
2161
  * */
2151
- export interface DevServer extends DevServerOptions {
2152
- }
2162
+ export type DevServer = DevServerOptions;
2153
2163
  export type { Middleware as DevServerMiddleware } from "./devServer";
2154
2164
  /**
2155
2165
  * Ignore specific warnings.
package/dist/index.mjs CHANGED
@@ -39766,7 +39766,8 @@ function getRawModule(module1, options) {
39766
39766
  rules,
39767
39767
  parser: getRawParserOptionsMap(module1.parser),
39768
39768
  generator: getRawGeneratorOptionsMap(module1.generator),
39769
- noParse: module1.noParse
39769
+ noParse: module1.noParse,
39770
+ unsafeCache: module1.unsafeCache
39770
39771
  };
39771
39772
  }
39772
39773
  function tryMatch(payload, condition) {
@@ -39960,7 +39961,8 @@ function getRawJavascriptParserOptions(parser) {
39960
39961
  commonjsMagicComments: parser.commonjsMagicComments,
39961
39962
  inlineConst: parser.inlineConst,
39962
39963
  typeReexportsPresence: parser.typeReexportsPresence,
39963
- jsx: parser.jsx
39964
+ jsx: parser.jsx,
39965
+ deferImport: parser.deferImport
39964
39966
  };
39965
39967
  }
39966
39968
  function getRawAssetParserOptions(parser) {
@@ -42362,13 +42364,15 @@ const applyRspackOptionsDefaults = (options)=>{
42362
42364
  production
42363
42365
  });
42364
42366
  applyModuleDefaults(options.module, {
42367
+ cache: !!options.cache,
42365
42368
  asyncWebAssembly: options.experiments.asyncWebAssembly,
42366
42369
  css: options.experiments.css,
42367
42370
  targetProperties,
42368
42371
  mode: options.mode,
42369
42372
  uniqueName: options.output.uniqueName,
42370
42373
  usedExports: !!options.optimization.usedExports,
42371
- inlineConst: options.experiments.inlineConst
42374
+ inlineConst: options.experiments.inlineConst,
42375
+ deferImport: options.experiments.deferImport
42372
42376
  });
42373
42377
  applyOutputDefaults(options.output, {
42374
42378
  context: options.context,
@@ -42425,6 +42429,7 @@ const applyExperimentsDefaults = (experiments, { development })=>{
42425
42429
  D(experiments, "asyncWebAssembly", experiments.futureDefaults);
42426
42430
  D(experiments, "css", experiments.futureDefaults ? true : void 0);
42427
42431
  D(experiments, "topLevelAwait", true);
42432
+ D(experiments, "deferImport", false);
42428
42433
  D(experiments, "buildHttp", void 0);
42429
42434
  if (experiments.buildHttp && "object" == typeof experiments.buildHttp) D(experiments.buildHttp, "upgrade", false);
42430
42435
  D(experiments, "incremental", {});
@@ -42459,14 +42464,14 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
42459
42464
  if ("object" == typeof rspackFuture) {
42460
42465
  D(rspackFuture, "bundlerInfo", {});
42461
42466
  if ("object" == typeof rspackFuture.bundlerInfo) {
42462
- D(rspackFuture.bundlerInfo, "version", "1.6.0-canary-beafb11e-20251019174144");
42467
+ D(rspackFuture.bundlerInfo, "version", "1.6.0-canary-e3199f44-20251020173943");
42463
42468
  D(rspackFuture.bundlerInfo, "bundler", "rspack");
42464
42469
  D(rspackFuture.bundlerInfo, "force", !library);
42465
42470
  }
42466
42471
  }
42467
42472
  };
42468
42473
  const applySnapshotDefaults = (_snapshot, _env)=>{};
42469
- const applyJavascriptParserOptionsDefaults = (parserOptions, { usedExports, inlineConst })=>{
42474
+ const applyJavascriptParserOptionsDefaults = (parserOptions, { usedExports, inlineConst, deferImport })=>{
42470
42475
  D(parserOptions, "dynamicImportMode", "lazy");
42471
42476
  D(parserOptions, "dynamicImportPrefetch", false);
42472
42477
  D(parserOptions, "dynamicImportPreload", false);
@@ -42488,13 +42493,15 @@ const applyJavascriptParserOptionsDefaults = (parserOptions, { usedExports, inli
42488
42493
  D(parserOptions, "inlineConst", usedExports && inlineConst);
42489
42494
  D(parserOptions, "typeReexportsPresence", "no-tolerant");
42490
42495
  D(parserOptions, "jsx", false);
42496
+ D(parserOptions, "deferImport", deferImport);
42491
42497
  };
42492
42498
  const applyJsonGeneratorOptionsDefaults = (generatorOptions)=>{
42493
42499
  D(generatorOptions, "JSONParse", true);
42494
42500
  };
42495
- const applyModuleDefaults = (module1, { asyncWebAssembly, css, targetProperties, mode, uniqueName, usedExports, inlineConst })=>{
42501
+ const applyModuleDefaults = (module1, { cache, asyncWebAssembly, css, targetProperties, mode, uniqueName, usedExports, inlineConst, deferImport })=>{
42496
42502
  assertNotNill(module1.parser);
42497
42503
  assertNotNill(module1.generator);
42504
+ cache ? D(module1, "unsafeCache", /[\\/]node_modules[\\/]/) : D(module1, "unsafeCache", false);
42498
42505
  F(module1.parser, "asset", ()=>({}));
42499
42506
  assertNotNill(module1.parser.asset);
42500
42507
  F(module1.parser.asset, "dataUrlCondition", ()=>({}));
@@ -42503,7 +42510,8 @@ const applyModuleDefaults = (module1, { asyncWebAssembly, css, targetProperties,
42503
42510
  assertNotNill(module1.parser.javascript);
42504
42511
  applyJavascriptParserOptionsDefaults(module1.parser.javascript, {
42505
42512
  usedExports,
42506
- inlineConst
42513
+ inlineConst,
42514
+ deferImport
42507
42515
  });
42508
42516
  F(module1.parser, "json", ()=>({}));
42509
42517
  assertNotNill(module1.parser["json"]);
@@ -43267,7 +43275,8 @@ const getNormalizedRspackOptions = (config)=>({
43267
43275
  ]),
43268
43276
  rules: nestedArray(module1.rules, (r)=>[
43269
43277
  ...r
43270
- ])
43278
+ ]),
43279
+ unsafeCache: module1.unsafeCache
43271
43280
  })),
43272
43281
  target: config.target,
43273
43282
  externals: config.externals,
@@ -44553,7 +44562,10 @@ const RuntimeGlobals = {
44553
44562
  systemContext: "__webpack_require__.y",
44554
44563
  baseURI: "__webpack_require__.b",
44555
44564
  relativeUrl: "__webpack_require__.U",
44556
- asyncModule: "__webpack_require__.a"
44565
+ asyncModule: "__webpack_require__.a",
44566
+ asyncModuleExportSymbol: "__webpack_require__.aE",
44567
+ makeDeferredNamespaceObject: "__webpack_require__.z",
44568
+ makeDeferredNamespaceObjectSymbol: "__webpack_require__.zS"
44557
44569
  };
44558
44570
  for (const entry of Object.entries(RuntimeGlobals))RESERVED_RUNTIME_GLOBALS.set(entry[1], entry[0]);
44559
44571
  const isReservedRuntimeGlobal = (r)=>RESERVED_RUNTIME_GLOBALS.has(r);
@@ -45972,11 +45984,9 @@ class Compiler {
45972
45984
  this.hooks.shutdown.callAsync((err)=>{
45973
45985
  if (err) return callback(err);
45974
45986
  this.cache.shutdown(()=>{
45975
- Compiler_class_private_method_get(this, _getInstance, getInstance).call(this, (error, instance)=>{
45976
- if (error) return callback(error);
45977
- instance.close();
45978
- callback();
45979
- });
45987
+ var _class_private_field_get1;
45988
+ null == (_class_private_field_get1 = Compiler_class_private_field_get(this, _instance)) || _class_private_field_get1.close();
45989
+ callback();
45980
45990
  });
45981
45991
  });
45982
45992
  }
@@ -46093,6 +46103,7 @@ class Compiler {
46093
46103
  Compiler_define_property(this, "cache", void 0);
46094
46104
  Compiler_define_property(this, "compilerPath", void 0);
46095
46105
  Compiler_define_property(this, "options", void 0);
46106
+ Compiler_define_property(this, "unsafeFastDrop", false);
46096
46107
  Compiler_define_property(this, "__internal_browser_require", void 0);
46097
46108
  Compiler_class_private_field_set(this, Compiler_initial, true);
46098
46109
  Compiler_class_private_field_set(this, _builtinPlugins, []);
@@ -46248,7 +46259,7 @@ function getInstance(callback) {
46248
46259
  Compiler_class_private_field_set(this, _registers, Compiler_class_private_method_get(this, _createHooksRegisters, createHooksRegisters).call(this));
46249
46260
  const inputFileSystem = this.inputFileSystem && ThreadsafeInputNodeFS.needsBinding(options.experiments.useInputFileSystem) ? ThreadsafeInputNodeFS.__to_binding(this.inputFileSystem) : void 0;
46250
46261
  try {
46251
- Compiler_class_private_field_set(this, _instance, new instanceBinding.JsCompiler(this.compilerPath, rawOptions, Compiler_class_private_field_get(this, _builtinPlugins), Compiler_class_private_field_get(this, _registers), ThreadsafeOutputNodeFS.__to_binding(this.outputFileSystem), this.intermediateFileSystem ? ThreadsafeIntermediateNodeFS.__to_binding(this.intermediateFileSystem) : void 0, inputFileSystem, ResolverFactory.__to_binding(this.resolverFactory)));
46262
+ Compiler_class_private_field_set(this, _instance, new instanceBinding.JsCompiler(this.compilerPath, rawOptions, Compiler_class_private_field_get(this, _builtinPlugins), Compiler_class_private_field_get(this, _registers), ThreadsafeOutputNodeFS.__to_binding(this.outputFileSystem), this.intermediateFileSystem ? ThreadsafeIntermediateNodeFS.__to_binding(this.intermediateFileSystem) : void 0, inputFileSystem, ResolverFactory.__to_binding(this.resolverFactory), this.unsafeFastDrop));
46252
46263
  callback(null, Compiler_class_private_field_get(this, _instance));
46253
46264
  } catch (err) {
46254
46265
  if (err instanceof Error) delete err.stack;
@@ -46409,7 +46420,7 @@ class MultiStats {
46409
46420
  return obj;
46410
46421
  });
46411
46422
  if (childOptions.version) {
46412
- obj.rspackVersion = "1.6.0-canary-beafb11e-20251019174144";
46423
+ obj.rspackVersion = "1.6.0-canary-e3199f44-20251020173943";
46413
46424
  obj.version = "5.75.0";
46414
46425
  }
46415
46426
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
@@ -46643,6 +46654,9 @@ function MultiCompiler_define_property(obj, key, value) {
46643
46654
  }
46644
46655
  var _runGraph = /*#__PURE__*/ new WeakSet();
46645
46656
  class MultiCompiler {
46657
+ set unsafeFastDrop(value) {
46658
+ for (const compiler of this.compilers)compiler.unsafeFastDrop = value;
46659
+ }
46646
46660
  get options() {
46647
46661
  return Object.assign(this.compilers.map((c)=>c.options), this._options);
46648
46662
  }
@@ -47717,7 +47731,7 @@ const SIMPLE_EXTRACTORS = {
47717
47731
  },
47718
47732
  version: (object)=>{
47719
47733
  object.version = "5.75.0";
47720
- object.rspackVersion = "1.6.0-canary-beafb11e-20251019174144";
47734
+ object.rspackVersion = "1.6.0-canary-e3199f44-20251020173943";
47721
47735
  },
47722
47736
  env: (object, _compilation, _context, { _env })=>{
47723
47737
  object.env = _env;
@@ -50739,7 +50753,7 @@ function transformSync(source, options) {
50739
50753
  const _options = JSON.stringify(options || {});
50740
50754
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
50741
50755
  }
50742
- const exports_rspackVersion = "1.6.0-canary-beafb11e-20251019174144";
50756
+ const exports_rspackVersion = "1.6.0-canary-e3199f44-20251020173943";
50743
50757
  const exports_version = "5.75.0";
50744
50758
  const exports_WebpackError = Error;
50745
50759
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -321,7 +321,7 @@ export declare class JsCompilation {
321
321
  }
322
322
 
323
323
  export declare class JsCompiler {
324
- constructor(compilerPath: string, options: RawOptions, builtinPlugins: Array<BuiltinPlugin>, registerJsTaps: RegisterJsTaps, outputFilesystem: ThreadsafeNodeFS, intermediateFilesystem: ThreadsafeNodeFS | undefined | null, inputFilesystem: ThreadsafeNodeFS | undefined | null, resolverFactoryReference: JsResolverFactory)
324
+ constructor(compilerPath: string, options: RawOptions, builtinPlugins: Array<BuiltinPlugin>, registerJsTaps: RegisterJsTaps, outputFilesystem: ThreadsafeNodeFS, intermediateFilesystem: ThreadsafeNodeFS | undefined | null, inputFilesystem: ThreadsafeNodeFS | undefined | null, resolverFactoryReference: JsResolverFactory, unsafeFastDrop: boolean)
325
325
  setNonSkippableRegisters(kinds: Array<RegisterJsTapKind>): void
326
326
  /** Build with the given option passed to the constructor */
327
327
  build(callback: (err: null | Error) => void): void
@@ -2112,6 +2112,7 @@ inlineConst: boolean
2112
2112
  inlineEnum: boolean
2113
2113
  typeReexportsPresence: boolean
2114
2114
  lazyBarrel: boolean
2115
+ deferImport: boolean
2115
2116
  }
2116
2117
 
2117
2118
  export interface RawExperimentSnapshotOptions {
@@ -2348,6 +2349,7 @@ typeReexportsPresence?: string
2348
2349
  * @experimental
2349
2350
  */
2350
2351
  jsx?: boolean
2352
+ deferImport?: boolean
2351
2353
  }
2352
2354
 
2353
2355
  export interface RawJsonGeneratorOptions {
@@ -2451,6 +2453,7 @@ export interface RawModuleOptions {
2451
2453
  parser?: Record<string, RawParserOptions>
2452
2454
  generator?: Record<string, RawGeneratorOptions>
2453
2455
  noParse?: string | RegExp | ((request: string) => boolean) | (string | RegExp | ((request: string) => boolean))[]
2456
+ unsafeCache?: boolean | RegExp
2454
2457
  }
2455
2458
 
2456
2459
  export interface RawModuleRule {
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-canary/browser",
3
- "version": "1.6.0-canary-beafb11e-20251019174144",
3
+ "version": "1.6.0-canary-e3199f44-20251020173943",
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.",