@rspack-canary/browser 1.4.12-canary-becf0a0e-20250808091433 → 1.5.0-canary-0de3ce24-20250810153546

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,12 +1,12 @@
1
1
  import type { IFs, Volume } from "memfs";
2
2
  export declare const fs: IFs;
3
3
  export declare const volume: Volume;
4
- declare const readFileSync: (file: import("memfs/lib/volume").TFileId, options?: import("memfs/lib/node/types/options").IReadFileOptions | string) => import("memfs/lib/encoding").TDataOut, readdirSync: (path: import("memfs/lib/node/types/misc").PathLike, options?: import("memfs/lib/node/types/options").IReaddirOptions | string) => import("memfs/lib/encoding").TDataOut[] | import("memfs/lib/Dirent").Dirent[], lstat: {
5
- (path: import("memfs/lib/node/types/misc").PathLike, callback: import("memfs/lib/volume").TCallback<import("memfs/lib/Stats").Stats>): void;
6
- (path: import("memfs/lib/node/types/misc").PathLike, options: import("memfs/lib/node/types/options").IStatOptions, callback: import("memfs/lib/volume").TCallback<import("memfs/lib/Stats").Stats>): void;
4
+ declare const readFileSync: (file: import("memfs/lib/core").TFileId, options?: import("memfs/lib/node/types/options").IReadFileOptions | string) => import("memfs/lib/encoding").TDataOut, readdirSync: (path: import("memfs/lib/node/types/misc").PathLike, options?: import("memfs/lib/node/types/options").IReaddirOptions | string) => import("memfs/lib/encoding").TDataOut[] | import("memfs/lib/node/Dirent").Dirent[], lstat: {
5
+ (path: import("memfs/lib/node/types/misc").PathLike, callback: import("memfs/lib/node/types/misc").TCallback<import("memfs/lib/node/Stats").Stats>): void;
6
+ (path: import("memfs/lib/node/types/misc").PathLike, options: import("memfs/lib/node/types/options").IStatOptions, callback: import("memfs/lib/node/types/misc").TCallback<import("memfs/lib/node/Stats").Stats>): void;
7
7
  }, existsSync: (path: import("memfs/lib/node/types/misc").PathLike) => boolean, readdir: {
8
- (path: import("memfs/lib/node/types/misc").PathLike, callback: import("memfs/lib/volume").TCallback<import("memfs/lib/encoding").TDataOut[] | import("memfs/lib/Dirent").Dirent[]>): any;
9
- (path: import("memfs/lib/node/types/misc").PathLike, options: import("memfs/lib/node/types/options").IReaddirOptions | string, callback: import("memfs/lib/volume").TCallback<import("memfs/lib/encoding").TDataOut[] | import("memfs/lib/Dirent").Dirent[]>): any;
10
- }, watch: (path: import("memfs/lib/node/types/misc").PathLike, options?: import("memfs/lib/volume").IWatchOptions | string, listener?: (eventType: string, filename: string) => void) => import("memfs/lib/volume").FSWatcher;
8
+ (path: import("memfs/lib/node/types/misc").PathLike, callback: import("memfs/lib/node/types/misc").TCallback<import("memfs/lib/encoding").TDataOut[] | import("memfs/lib/node/Dirent").Dirent[]>): any;
9
+ (path: import("memfs/lib/node/types/misc").PathLike, options: import("memfs/lib/node/types/options").IReaddirOptions | string, callback: import("memfs/lib/node/types/misc").TCallback<import("memfs/lib/encoding").TDataOut[] | import("memfs/lib/node/Dirent").Dirent[]>): any;
10
+ }, watch: (path: import("memfs/lib/node/types/misc").PathLike, options?: import("memfs/lib/node/volume").IWatchOptions | string, listener?: (eventType: string, filename: string) => void) => import("memfs/lib/node/volume").FSWatcher;
11
11
  export default fs;
12
12
  export { readFileSync, readdirSync, lstat, existsSync, readdir, watch };
@@ -95,6 +95,11 @@ export type ExperimentCacheNormalized = boolean | {
95
95
  };
96
96
  export interface ExperimentsNormalized {
97
97
  cache?: ExperimentCacheNormalized;
98
+ /**
99
+ * @deprecated This option is deprecated and will be removed in future versions.
100
+ *
101
+ * Please use the Configuration top-level `lazyCompilation` option instead.
102
+ */
98
103
  lazyCompilation?: false | LazyCompilationOptions;
99
104
  asyncWebAssembly?: boolean;
100
105
  outputModule?: boolean;
@@ -144,6 +149,7 @@ export interface RspackOptionsNormalized {
144
149
  optimization: Optimization;
145
150
  plugins: Plugins;
146
151
  experiments: ExperimentsNormalized;
152
+ lazyCompilation?: false | LazyCompilationOptions;
147
153
  watch?: Watch;
148
154
  watchOptions: WatchOptions;
149
155
  devServer?: DevServer;
@@ -1971,6 +1971,7 @@ export type Experiments = {
1971
1971
  cache?: ExperimentCacheOptions;
1972
1972
  /**
1973
1973
  * Enable lazy compilation.
1974
+ * @deprecated Please use the configuration top-level `lazyCompilation` option instead.
1974
1975
  * @default false
1975
1976
  */
1976
1977
  lazyCompilation?: boolean | LazyCompilationOptions;
@@ -2282,6 +2283,11 @@ export type RspackOptions = {
2282
2283
  * Performance optimization options.
2283
2284
  */
2284
2285
  performance?: Performance;
2286
+ /**
2287
+ * Enable lazy compilation.
2288
+ * @default false
2289
+ */
2290
+ lazyCompilation?: boolean | LazyCompilationOptions;
2285
2291
  };
2286
2292
  /** Configuration for Rspack */
2287
2293
  export type Configuration = RspackOptions;
package/dist/index.mjs CHANGED
@@ -45264,14 +45264,33 @@ const getFullServerUrl = ({ serverUrl, prefix })=>{
45264
45264
  if (!serverUrl) return lazyCompilationPrefix;
45265
45265
  return serverUrl + (serverUrl.endsWith("/") ? lazyCompilationPrefix.slice(1) : lazyCompilationPrefix);
45266
45266
  };
45267
+ const DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN = "The `experiments.lazyCompilation` option is deprecated, please use the configuration top level `lazyCompilation` instead.";
45268
+ const REPEAT_LAZY_COMPILATION_OPTIONS_WARN = "Both top-level `lazyCompilation` and `experiments.lazyCompilation` options are set. The top-level `lazyCompilation` configuration will take precedence.";
45267
45269
  const lazyCompilationMiddleware = (compiler)=>{
45268
45270
  if (compiler instanceof MultiCompiler) {
45269
45271
  const middlewareByCompiler = new Map();
45270
45272
  let i = 0;
45273
+ let isReportDeprecatedWarned = false;
45274
+ let isReportRepeatWarned = false;
45271
45275
  for (const c of compiler.compilers){
45272
- if (!c.options.experiments.lazyCompilation) continue;
45276
+ if (c.options.experiments.lazyCompilation) {
45277
+ if (c.name) console.warn(`The 'experiments.lazyCompilation' option in compiler named '${c.name}' is deprecated, please use the Configuration top level 'lazyCompilation' instead.`);
45278
+ else if (!isReportDeprecatedWarned) {
45279
+ console.warn(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN);
45280
+ isReportDeprecatedWarned = true;
45281
+ }
45282
+ }
45283
+ if (c.options.lazyCompilation && c.options.experiments.lazyCompilation) {
45284
+ if (c.name) console.warn(`The top-level 'lazyCompilation' option in compiler named '${c.name}' will override the 'experiments.lazyCompilation' option.`);
45285
+ else if (!isReportRepeatWarned) {
45286
+ console.warn(REPEAT_LAZY_COMPILATION_OPTIONS_WARN);
45287
+ isReportRepeatWarned = true;
45288
+ }
45289
+ }
45290
+ if (!c.options.lazyCompilation && !c.options.experiments.lazyCompilation) continue;
45273
45291
  const options = {
45274
- ...c.options.experiments.lazyCompilation
45292
+ ...c.options.experiments.lazyCompilation,
45293
+ ...c.options.lazyCompilation
45275
45294
  };
45276
45295
  const prefix = options.prefix || LAZY_COMPILATION_PREFIX;
45277
45296
  options.prefix = `${prefix}__${i++}`;
@@ -45295,13 +45314,18 @@ const lazyCompilationMiddleware = (compiler)=>{
45295
45314
  return null == middleware ? void 0 : middleware(req, res, next);
45296
45315
  };
45297
45316
  }
45298
- if (!compiler.options.experiments.lazyCompilation) return noop;
45317
+ if (compiler.options.experiments.lazyCompilation) {
45318
+ console.warn(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN);
45319
+ if (compiler.options.lazyCompilation) console.warn(REPEAT_LAZY_COMPILATION_OPTIONS_WARN);
45320
+ }
45321
+ if (!compiler.options.lazyCompilation && !compiler.options.experiments.lazyCompilation) return noop;
45299
45322
  const activeModules = new Map();
45300
45323
  const filesByKey = new Map();
45301
45324
  const indexToMap = new Map();
45302
45325
  const moduleToIndex = new Map();
45303
45326
  const options = {
45304
- ...compiler.options.experiments.lazyCompilation
45327
+ ...compiler.options.experiments.lazyCompilation,
45328
+ ...compiler.options.lazyCompilation
45305
45329
  };
45306
45330
  applyPlugin(compiler, moduleToIndex, indexToMap, options, activeModules, filesByKey);
45307
45331
  const lazyCompilationPrefix = options.prefix || LAZY_COMPILATION_PREFIX;
@@ -45762,29 +45786,33 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
45762
45786
  });
45763
45787
  });
45764
45788
  });
45765
- if ("string" == typeof this.options.htmlPlugin && this.options.htmlPlugin !== NATIVE_HTML_PLUGIN) (0, util_require._)()(this.options.htmlPlugin).then((htmlPlugin)=>{
45766
- const getHooks = htmlPlugin.getCompilationHooks || htmlPlugin.getHooks;
45767
- if ("function" == typeof getHooks) compiler.hooks.thisCompilation.tap(SubresourceIntegrityPlugin_PLUGIN_NAME, (compilation)=>{
45768
- if ("string" == typeof compiler.options.output.chunkLoading && [
45769
- "require",
45770
- "async-node"
45771
- ].includes(compiler.options.output.chunkLoading)) return;
45772
- const hwpHooks = getHooks(compilation);
45773
- hwpHooks.beforeAssetTagGeneration.tapPromise(SubresourceIntegrityPlugin_PLUGIN_NAME, async (data)=>{
45774
- this.handleHwpPluginArgs(data);
45775
- return data;
45776
- });
45777
- hwpHooks.alterAssetTagGroups.tapPromise({
45778
- name: SubresourceIntegrityPlugin_PLUGIN_NAME,
45779
- stage: 10000
45780
- }, async (data)=>{
45781
- this.handleHwpBodyTags(data, compiler.outputPath, compiler.options.output.crossOriginLoading);
45782
- return data;
45789
+ if ("string" == typeof this.options.htmlPlugin && this.options.htmlPlugin !== NATIVE_HTML_PLUGIN) {
45790
+ const self1 = this;
45791
+ function bindingHtmlHooks(htmlPlugin) {
45792
+ const getHooks = htmlPlugin.getCompilationHooks || htmlPlugin.getHooks;
45793
+ if ("function" == typeof getHooks) compiler.hooks.thisCompilation.tap(SubresourceIntegrityPlugin_PLUGIN_NAME, (compilation)=>{
45794
+ if ("string" == typeof compiler.options.output.chunkLoading && [
45795
+ "require",
45796
+ "async-node"
45797
+ ].includes(compiler.options.output.chunkLoading)) return;
45798
+ const hwpHooks = getHooks(compilation);
45799
+ hwpHooks.beforeAssetTagGeneration.tapPromise(SubresourceIntegrityPlugin_PLUGIN_NAME, async (data)=>{
45800
+ self1.handleHwpPluginArgs(data);
45801
+ return data;
45802
+ });
45803
+ hwpHooks.alterAssetTagGroups.tapPromise({
45804
+ name: SubresourceIntegrityPlugin_PLUGIN_NAME,
45805
+ stage: 10000
45806
+ }, async (data)=>{
45807
+ self1.handleHwpBodyTags(data, compiler.outputPath, compiler.options.output.crossOriginLoading);
45808
+ return data;
45809
+ });
45783
45810
  });
45811
+ }
45812
+ (0, util_require._)()(this.options.htmlPlugin).then(bindingHtmlHooks).catch((e)=>{
45813
+ if (!isErrorWithCode(e) || "MODULE_NOT_FOUND" !== e.code) throw e;
45784
45814
  });
45785
- }).catch((e)=>{
45786
- if (!isErrorWithCode(e) || "MODULE_NOT_FOUND" !== e.code) throw e;
45787
- });
45815
+ }
45788
45816
  }
45789
45817
  constructor(options = {}){
45790
45818
  let validateError = null;
@@ -46970,6 +46998,7 @@ const applyRspackOptionsDefaults = (options)=>{
46970
46998
  defaults_F(options, "devtool", ()=>development ? "eval" : false);
46971
46999
  D(options, "watch", false);
46972
47000
  D(options, "profile", false);
47001
+ D(options, "lazyCompilation", false);
46973
47002
  D(options, "bail", false);
46974
47003
  defaults_F(options, "cache", ()=>development);
46975
47004
  applyExperimentsDefaults(options.experiments, {
@@ -47084,7 +47113,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
47084
47113
  if ("object" == typeof rspackFuture) {
47085
47114
  D(rspackFuture, "bundlerInfo", {});
47086
47115
  if ("object" == typeof rspackFuture.bundlerInfo) {
47087
- D(rspackFuture.bundlerInfo, "version", "1.4.12-canary-becf0a0e-20250808091433");
47116
+ D(rspackFuture.bundlerInfo, "version", "1.5.0-canary-0de3ce24-20250810153546");
47088
47117
  D(rspackFuture.bundlerInfo, "bundler", "rspack");
47089
47118
  D(rspackFuture.bundlerInfo, "force", !library);
47090
47119
  }
@@ -47357,7 +47386,7 @@ const applyOutputDefaults = (output, { context, outputModule, targetProperties:
47357
47386
  return "[id].css";
47358
47387
  });
47359
47388
  D(output, "hotUpdateChunkFilename", `[id].[fullhash].hot-update.${output.module ? "mjs" : "js"}`);
47360
- D(output, "hotUpdateMainFilename", "[runtime].[fullhash].hot-update.json");
47389
+ defaults_F(output, "hotUpdateMainFilename", ()=>`[runtime].[fullhash].hot-update.${output.module ? "json.mjs" : "json"}`);
47361
47390
  const uniqueNameId = Template.toIdentifier(output.uniqueName);
47362
47391
  defaults_F(output, "hotUpdateGlobal", ()=>`webpackHotUpdate${uniqueNameId}`);
47363
47392
  defaults_F(output, "chunkLoadingGlobal", ()=>`webpackChunk${uniqueNameId}`);
@@ -47975,7 +48004,8 @@ const getNormalizedRspackOptions = (config)=>({
47975
48004
  devServer: config.devServer,
47976
48005
  profile: config.profile,
47977
48006
  amd: config.amd,
47978
- bail: config.bail
48007
+ bail: config.bail,
48008
+ lazyCompilation: optionalNestedConfig(config.lazyCompilation, (options)=>true === options ? {} : options)
47979
48009
  });
47980
48010
  const getNormalizedEntryStatic = (entry)=>{
47981
48011
  if ("string" == typeof entry) return {
@@ -50977,7 +51007,7 @@ class MultiStats {
50977
51007
  return obj;
50978
51008
  });
50979
51009
  if (childOptions.version) {
50980
- obj.rspackVersion = "1.4.12-canary-becf0a0e-20250808091433";
51010
+ obj.rspackVersion = "1.5.0-canary-0de3ce24-20250810153546";
50981
51011
  obj.version = "5.75.0";
50982
51012
  }
50983
51013
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
@@ -52287,7 +52317,7 @@ const SIMPLE_EXTRACTORS = {
52287
52317
  },
52288
52318
  version: (object)=>{
52289
52319
  object.version = "5.75.0";
52290
- object.rspackVersion = "1.4.12-canary-becf0a0e-20250808091433";
52320
+ object.rspackVersion = "1.5.0-canary-0de3ce24-20250810153546";
52291
52321
  },
52292
52322
  env: (object, _compilation, _context, { _env })=>{
52293
52323
  object.env = _env;
@@ -56346,7 +56376,8 @@ const getRspackOptionsSchema = memoize(()=>{
56346
56376
  profile: profile,
56347
56377
  amd: amd,
56348
56378
  bail: bail,
56349
- performance: performance
56379
+ performance: performance,
56380
+ lazyCompilation: schemas_boolean().or(lazyCompilationOptions).optional()
56350
56381
  }).partial().check(externalUmdChecker);
56351
56382
  return rspackOptions;
56352
56383
  });
@@ -56898,7 +56929,7 @@ function transformSync(source, options) {
56898
56929
  const _options = JSON.stringify(options || {});
56899
56930
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
56900
56931
  }
56901
- const exports_rspackVersion = "1.4.12-canary-becf0a0e-20250808091433";
56932
+ const exports_rspackVersion = "1.5.0-canary-0de3ce24-20250810153546";
56902
56933
  const exports_version = "5.75.0";
56903
56934
  const exports_WebpackError = Error;
56904
56935
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
Binary file
@@ -993,4 +993,12 @@ export declare const getRspackOptionsSchema: () => z.ZodObject<{
993
993
  maxAssetSize: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<number>]>>;
994
994
  maxEntrypointSize: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<number>]>>;
995
995
  }, z.core.$strict>, z.ZodLiteral<false>]>>;
996
+ lazyCompilation: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
997
+ imports: z.ZodOptional<z.ZodBoolean>;
998
+ entries: z.ZodOptional<z.ZodBoolean>;
999
+ test: z.ZodOptional<z.ZodUnion<[z.ZodCustom<RegExp, RegExp>, z.ZodCustom<(...args: unknown[]) => any, (...args: unknown[]) => any>]>>;
1000
+ client: z.ZodOptional<z.ZodString>;
1001
+ serverUrl: z.ZodOptional<z.ZodString>;
1002
+ prefix: z.ZodOptional<z.ZodString>;
1003
+ }, z.core.$strip>]>>>;
996
1004
  }, z.core.$strict>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-canary/browser",
3
- "version": "1.4.12-canary-becf0a0e-20250808091433",
3
+ "version": "1.5.0-canary-0de3ce24-20250810153546",
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.",
@@ -32,10 +32,10 @@
32
32
  "@napi-rs/wasm-runtime": "^1.0.1",
33
33
  "@rspack/lite-tapable": "1.0.1",
34
34
  "buffer": "^6.0.3",
35
- "memfs": "4.20.0"
35
+ "memfs": "4.36.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@rspack/binding": "npm:@rspack-canary/binding@1.4.12-canary-becf0a0e-20250808091433"
38
+ "@rspack/binding": "npm:@rspack-canary/binding@1.5.0-canary-0de3ce24-20250810153546"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@swc/helpers": ">=0.5.1"