@rspack-canary/browser 1.7.0-canary-be5d0ef3-20251222175046 → 1.7.0-canary-dcc2f8c9-20251223064055

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.
@@ -2103,6 +2103,7 @@ export type Experiments = {
2103
2103
  outputModule?: boolean;
2104
2104
  /**
2105
2105
  * Enable top-level await.
2106
+ * @deprecated This option is deprecated, top-level await is enabled by default.
2106
2107
  * @default true
2107
2108
  */
2108
2109
  topLevelAwait?: boolean;
@@ -1,11 +1,13 @@
1
1
  import type { Compiler } from "../Compiler";
2
2
  import { type ModuleFederationManifestPluginOptions } from "./ModuleFederationManifestPlugin";
3
3
  import type { ModuleFederationPluginV1Options } from "./ModuleFederationPluginV1";
4
+ import { type ModuleFederationRuntimeExperimentsOptions } from "./ModuleFederationRuntimePlugin";
4
5
  export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPluginV1Options, "enhanced"> {
5
6
  runtimePlugins?: RuntimePlugins;
6
7
  implementation?: string;
7
8
  shareStrategy?: "version-first" | "loaded-first";
8
9
  manifest?: boolean | Omit<ModuleFederationManifestPluginOptions, "remoteAliasMap" | "globalName" | "name" | "exposes" | "shared">;
10
+ experiments?: ModuleFederationRuntimeExperimentsOptions;
9
11
  }
10
12
  export type RuntimePlugins = string[] | [string, Record<string, unknown>][];
11
13
  export declare class ModuleFederationPlugin {
@@ -1,5 +1,9 @@
1
+ export interface ModuleFederationRuntimeExperimentsOptions {
2
+ asyncStartup?: boolean;
3
+ }
1
4
  export interface ModuleFederationRuntimeOptions {
2
5
  entryRuntime?: string;
6
+ experiments?: ModuleFederationRuntimeExperimentsOptions;
3
7
  }
4
8
  export declare const ModuleFederationRuntimePlugin: {
5
9
  new (options?: ModuleFederationRuntimeOptions | undefined): {
package/dist/index.mjs CHANGED
@@ -53498,10 +53498,16 @@ function stringifyLoaderObject(o) {
53498
53498
  return o.path + o.query + o.fragment;
53499
53499
  }
53500
53500
  const unsupported = (name, issue)=>{
53501
- let s = `${name} is not supported by rspack.`;
53502
- if (issue) s += ` Please refer to issue ${issue} for more information.`;
53501
+ let s = `${name} is not supported by Rspack.`;
53502
+ if (issue) s += ` Refer to issue ${issue} for more information.`;
53503
53503
  throw new Error(s);
53504
53504
  };
53505
+ const warnedMessages = new Set();
53506
+ function deprecate(message) {
53507
+ if (warnedMessages.has(message)) return;
53508
+ warnedMessages.add(message);
53509
+ console.warn(`[Rspack Deprecation] ${message}`);
53510
+ }
53505
53511
  const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/;
53506
53512
  const SEGMENTS_SPLIT_REGEXP = /([|!])/;
53507
53513
  const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g;
@@ -56355,23 +56361,9 @@ const lazyCompilationMiddleware = (compiler)=>{
56355
56361
  if (compiler instanceof MultiCompiler) {
56356
56362
  const middlewareByCompiler = new Map();
56357
56363
  let i = 0;
56358
- let isReportDeprecatedWarned = false;
56359
- let isReportRepeatWarned = false;
56360
56364
  for (const c of compiler.compilers){
56361
- if (c.options.experiments.lazyCompilation) {
56362
- if (c.name) console.warn(`The 'experiments.lazyCompilation' option in compiler named '${c.name}' is deprecated, please use the Configuration top level 'lazyCompilation' instead.`);
56363
- else if (!isReportDeprecatedWarned) {
56364
- console.warn(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN);
56365
- isReportDeprecatedWarned = true;
56366
- }
56367
- }
56368
- if (c.options.lazyCompilation && c.options.experiments.lazyCompilation) {
56369
- if (c.name) console.warn(`The top-level 'lazyCompilation' option in compiler named '${c.name}' will override the 'experiments.lazyCompilation' option.`);
56370
- else if (!isReportRepeatWarned) {
56371
- console.warn(REPEAT_LAZY_COMPILATION_OPTIONS_WARN);
56372
- isReportRepeatWarned = true;
56373
- }
56374
- }
56365
+ if (c.options.experiments.lazyCompilation) c.name ? deprecate(`The 'experiments.lazyCompilation' option in compiler named '${c.name}' is deprecated, please use the Configuration top level 'lazyCompilation' instead.`) : deprecate(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN);
56366
+ if (c.options.lazyCompilation && c.options.experiments.lazyCompilation) c.name ? deprecate(`The top-level 'lazyCompilation' option in compiler named '${c.name}' will override the 'experiments.lazyCompilation' option.`) : deprecate(REPEAT_LAZY_COMPILATION_OPTIONS_WARN);
56375
56367
  if (!c.options.lazyCompilation && !c.options.experiments.lazyCompilation) continue;
56376
56368
  const options = {
56377
56369
  ...c.options.experiments.lazyCompilation,
@@ -56394,8 +56386,8 @@ const lazyCompilationMiddleware = (compiler)=>{
56394
56386
  };
56395
56387
  }
56396
56388
  if (compiler.options.experiments.lazyCompilation) {
56397
- console.warn(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN);
56398
- if (compiler.options.lazyCompilation) console.warn(REPEAT_LAZY_COMPILATION_OPTIONS_WARN);
56389
+ deprecate(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN);
56390
+ if (compiler.options.lazyCompilation) deprecate(REPEAT_LAZY_COMPILATION_OPTIONS_WARN);
56399
56391
  }
56400
56392
  if (!compiler.options.lazyCompilation && !compiler.options.experiments.lazyCompilation) return noop;
56401
56393
  const activeModules = new Set();
@@ -58221,7 +58213,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58221
58213
  if ("object" == typeof rspackFuture) {
58222
58214
  D(rspackFuture, "bundlerInfo", {});
58223
58215
  if ("object" == typeof rspackFuture.bundlerInfo) {
58224
- D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-be5d0ef3-20251222175046");
58216
+ D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-dcc2f8c9-20251223064055");
58225
58217
  D(rspackFuture.bundlerInfo, "bundler", "rspack");
58226
58218
  D(rspackFuture.bundlerInfo, "force", !library);
58227
58219
  }
@@ -58939,7 +58931,7 @@ const getNormalizedRspackOptions = (config)=>({
58939
58931
  main: {}
58940
58932
  } : "function" == typeof config.entry ? ((fn)=>()=>Promise.resolve().then(fn).then(getNormalizedEntryStatic))(config.entry) : getNormalizedEntryStatic(config.entry),
58941
58933
  output: nestedConfig(config.output, (output)=>{
58942
- if ("cssHeadDataCompression" in output) util_default().deprecate(()=>{}, "cssHeadDataCompression is not used now, see https://github.com/web-infra-dev/rspack/pull/8534, this option could be removed in the future")();
58934
+ if ("cssHeadDataCompression" in output) deprecate("cssHeadDataCompression is not used now, see https://github.com/web-infra-dev/rspack/pull/8534, this option could be removed in the future");
58943
58935
  const { library } = output;
58944
58936
  const libraryAsName = library;
58945
58937
  const libraryBase = "object" == typeof library && library && !Array.isArray(library) && "type" in library ? library : libraryAsName || output.libraryTarget ? {
@@ -59090,12 +59082,12 @@ const getNormalizedRspackOptions = (config)=>({
59090
59082
  ...p
59091
59083
  ]),
59092
59084
  experiments: nestedConfig(config.experiments, (experiments)=>{
59093
- if (experiments.layers) util_default().deprecate(()=>{}, "`experiments.layers` config has been deprecated and will be removed in Rspack v2.0. Feature layers will be always enabled. Please remove this option from your Rspack configuration.")();
59094
- if (false === experiments.topLevelAwait) util_default().deprecate(()=>{}, "`experiments.topLevelAwait` config has been deprecated and will be removed in Rspack v2.0. Top-level await will be always enabled. Please remove this option from your Rspack configuration.")();
59095
- if (experiments.lazyBarrel) util_default().deprecate(()=>{}, "`experiments.lazyBarrel` config has been deprecated and will be removed in Rspack v2.0. Lazy barrel is already stable and enabled by default. Please remove this option from your Rspack configuration.")();
59096
- if (experiments.inlineConst) util_default().deprecate(()=>{}, "`experiments.inlineConst` config has been deprecated and will be removed in Rspack v2.0. Inline Const is already stable and enabled by default. Please remove this option from your Rspack configuration.")();
59097
- if (experiments.inlineEnum) util_default().deprecate(()=>{}, "`experiments.inlineEnum` config has been deprecated and will be removed in Rspack v2.0. Inline Enum is already stable. Please remove this option from your Rspack configuration.")();
59098
- if (experiments.typeReexportsPresence) util_default().deprecate(()=>{}, "`experiments.typeReexportsPresence` config has been deprecated and will be removed in Rspack v2.0. typeReexportsPresence is already stable. Please remove this option from your Rspack configuration.")();
59085
+ if (experiments.layers) deprecate("`experiments.layers` config is deprecated and will be removed in Rspack v2.0. Feature layers will always be enabled. Remove this option from your Rspack configuration.");
59086
+ if (false === experiments.topLevelAwait) deprecate("`experiments.topLevelAwait` config is deprecated and will be removed in Rspack v2.0. Top-level await will always be enabled. Remove this option from your Rspack configuration.");
59087
+ if (experiments.lazyBarrel) deprecate("`experiments.lazyBarrel` config is deprecated and will be removed in Rspack v2.0. Lazy barrel is already stable and enabled by default. Remove this option from your Rspack configuration.");
59088
+ if (experiments.inlineConst) deprecate("`experiments.inlineConst` config is deprecated and will be removed in Rspack v2.0. Inline Const is already stable and enabled by default. Remove this option from your Rspack configuration.");
59089
+ if (experiments.inlineEnum) deprecate("`experiments.inlineEnum` config is deprecated and will be removed in Rspack v2.0. Inline Enum is already stable. Remove this option from your Rspack configuration.");
59090
+ if (experiments.typeReexportsPresence) deprecate("`experiments.typeReexportsPresence` config is deprecated and will be removed in Rspack v2.0. typeReexportsPresence is already stable. Remove this option from your Rspack configuration.");
59099
59091
  return {
59100
59092
  ...experiments,
59101
59093
  cache: optionalNestedConfig(experiments.cache, (cache)=>{
@@ -62379,7 +62371,7 @@ class MultiStats {
62379
62371
  return obj;
62380
62372
  });
62381
62373
  if (childOptions.version) {
62382
- obj.rspackVersion = "1.7.0-canary-be5d0ef3-20251222175046";
62374
+ obj.rspackVersion = "1.7.0-canary-dcc2f8c9-20251223064055";
62383
62375
  obj.version = "5.75.0";
62384
62376
  }
62385
62377
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
@@ -63695,7 +63687,7 @@ const SIMPLE_EXTRACTORS = {
63695
63687
  },
63696
63688
  version: (object)=>{
63697
63689
  object.version = "5.75.0";
63698
- object.rspackVersion = "1.7.0-canary-be5d0ef3-20251222175046";
63690
+ object.rspackVersion = "1.7.0-canary-dcc2f8c9-20251223064055";
63699
63691
  },
63700
63692
  env: (object, _compilation, _context, { _env })=>{
63701
63693
  object.env = _env;
@@ -66263,13 +66255,26 @@ class ModuleFederationPlugin {
66263
66255
  ...compiler.options.resolve.alias
66264
66256
  };
66265
66257
  const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
66258
+ const runtimeExperiments = {
66259
+ asyncStartup: this._options.experiments?.asyncStartup ?? false
66260
+ };
66266
66261
  new ModuleFederationRuntimePlugin({
66267
- entryRuntime
66262
+ entryRuntime,
66263
+ experiments: runtimeExperiments
66268
66264
  }).apply(compiler);
66269
- new webpack.container.ModuleFederationPluginV1({
66270
- ...this._options,
66265
+ const v1Options = {
66266
+ name: this._options.name,
66267
+ exposes: this._options.exposes,
66268
+ filename: this._options.filename,
66269
+ library: this._options.library,
66270
+ remoteType: this._options.remoteType,
66271
+ remotes: this._options.remotes,
66272
+ runtime: this._options.runtime,
66273
+ shareScope: this._options.shareScope,
66274
+ shared: this._options.shared,
66271
66275
  enhanced: true
66272
- }).apply(compiler);
66276
+ };
66277
+ new webpack.container.ModuleFederationPluginV1(v1Options).apply(compiler);
66273
66278
  if (this._options.manifest) {
66274
66279
  const manifestOptions = true === this._options.manifest ? {} : {
66275
66280
  ...this._options.manifest
@@ -66729,14 +66734,19 @@ class ContainerReferencePlugin extends RspackBuiltinPlugin {
66729
66734
  raw(compiler) {
66730
66735
  const { remoteType, remotes } = this._options;
66731
66736
  const remoteExternals = {};
66737
+ const importExternals = {};
66732
66738
  for (const [key, config] of remotes){
66733
66739
  let i = 0;
66734
- for (const external of config.external)if (!external.startsWith("internal ")) {
66735
- remoteExternals[`webpack/container/reference/${key}${i ? `/fallback-${i}` : ""}`] = external;
66740
+ for (const external of config.external){
66741
+ if (external.startsWith("internal ")) continue;
66742
+ const request = `webpack/container/reference/${key}${i ? `/fallback-${i}` : ""}`;
66743
+ if (("module" === remoteType || "module-import" === remoteType) && external.startsWith(".")) importExternals[request] = external;
66744
+ else remoteExternals[request] = external;
66736
66745
  i++;
66737
66746
  }
66738
66747
  }
66739
66748
  new ExternalsPlugin(remoteType, remoteExternals, true).apply(compiler);
66749
+ if (Object.keys(importExternals).length > 0) new ExternalsPlugin("import", importExternals, true).apply(compiler);
66740
66750
  new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
66741
66751
  const rawOptions = {
66742
66752
  remoteType: this._options.remoteType,
@@ -66832,7 +66842,7 @@ function transformSync(source, options) {
66832
66842
  const _options = JSON.stringify(options || {});
66833
66843
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
66834
66844
  }
66835
- const exports_rspackVersion = "1.7.0-canary-be5d0ef3-20251222175046";
66845
+ const exports_rspackVersion = "1.7.0-canary-dcc2f8c9-20251223064055";
66836
66846
  const exports_version = "5.75.0";
66837
66847
  const exports_WebpackError = Error;
66838
66848
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -67037,7 +67047,7 @@ function rspack(options, callback) {
67037
67047
  }
67038
67048
  {
67039
67049
  const { compiler, watch } = create();
67040
- if (watch) util_default().deprecate(()=>{}, "A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.")();
67050
+ if (watch) deprecate("A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.");
67041
67051
  return compiler;
67042
67052
  }
67043
67053
  }
@@ -2462,8 +2462,13 @@ export interface RawModuleFederationManifestPluginOptions {
2462
2462
  buildInfo?: RawStatsBuildInfo
2463
2463
  }
2464
2464
 
2465
+ export interface RawModuleFederationRuntimeExperimentsOptions {
2466
+ asyncStartup?: boolean
2467
+ }
2468
+
2465
2469
  export interface RawModuleFederationRuntimePluginOptions {
2466
2470
  entryRuntime?: string | undefined
2471
+ experiments?: RawModuleFederationRuntimeExperimentsOptions
2467
2472
  }
2468
2473
 
2469
2474
  export interface RawModuleFilenameTemplateFnCtx {
package/dist/rspack.d.ts CHANGED
@@ -1,3 +1,12 @@
1
+ /**
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack/blob/4b4ca3b/lib
4
+ *
5
+ * MIT Licensed
6
+ * Author Tobias Koppers @sokra
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/webpack/blob/main/LICENSE
9
+ */
1
10
  import type { Callback } from "@rspack/lite-tapable";
2
11
  import { Compiler } from "./Compiler";
3
12
  import { type RspackOptions } from "./config";
Binary file
@@ -6,3 +6,4 @@ export declare function serializeObject(map: string | object | undefined | null)
6
6
  export declare function indent(str: string, prefix: string): string;
7
7
  export declare function stringifyLoaderObject(o: LoaderObject): string;
8
8
  export declare const unsupported: (name: string, issue?: string) => never;
9
+ export declare function deprecate(message: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-canary/browser",
3
- "version": "1.7.0-canary-be5d0ef3-20251222175046",
3
+ "version": "1.7.0-canary-dcc2f8c9-20251223064055",
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.",