@rspack/browser 1.5.7 → 1.5.8

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.
@@ -13,7 +13,7 @@ export declare class RuntimeModule {
13
13
  static STAGE_BASIC: RuntimeModuleStage;
14
14
  static STAGE_ATTACH: RuntimeModuleStage;
15
15
  static STAGE_TRIGGER: RuntimeModuleStage;
16
- static __to_binding(compilation: Compilation, module: RuntimeModule): JsAddingRuntimeModule;
16
+ static __to_binding(module: RuntimeModule): JsAddingRuntimeModule;
17
17
  private _name;
18
18
  private _stage;
19
19
  fullHash: boolean;
@@ -1,8 +1,7 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from "../binding";
2
- import type { Compiler } from "../Compiler";
3
2
  import { RspackBuiltinPlugin } from "./base";
4
3
  export declare class DeterministicChunkIdsPlugin extends RspackBuiltinPlugin {
5
4
  name: BuiltinPluginName;
6
5
  affectedHooks: "compilation";
7
- raw(compiler: Compiler): BuiltinPlugin;
6
+ raw(): BuiltinPlugin;
8
7
  }
@@ -1,8 +1,7 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from "../binding";
2
- import type { Compiler } from "../Compiler";
3
2
  import { RspackBuiltinPlugin } from "./base";
4
3
  export declare class DeterministicModuleIdsPlugin extends RspackBuiltinPlugin {
5
4
  name: BuiltinPluginName;
6
5
  affectedHooks: "compilation";
7
- raw(compiler: Compiler): BuiltinPlugin;
6
+ raw(): BuiltinPlugin;
8
7
  }
@@ -0,0 +1,5 @@
1
+ import type { Compiler } from "../Compiler";
2
+ export declare class EsmLibraryPlugin {
3
+ static PLUGIN_NAME: string;
4
+ apply(compiler: Compiler): void;
5
+ }
@@ -1,10 +1,9 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from "../binding";
2
- import type { Compiler } from "../Compiler";
3
2
  import { RspackBuiltinPlugin } from "./base";
4
3
  export declare class FlagDependencyUsagePlugin extends RspackBuiltinPlugin {
5
4
  private global;
6
5
  name: BuiltinPluginName;
7
6
  affectedHooks: "compilation";
8
7
  constructor(global: boolean);
9
- raw(compiler: Compiler): BuiltinPlugin;
8
+ raw(): BuiltinPlugin;
10
9
  }
@@ -1,10 +1,9 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from "../binding";
2
- import type { Compiler } from "../Compiler";
3
2
  import { RspackBuiltinPlugin } from "./base";
4
3
  export declare class MangleExportsPlugin extends RspackBuiltinPlugin {
5
4
  private deterministic;
6
5
  name: BuiltinPluginName;
7
6
  affectedHooks: "compilation";
8
7
  constructor(deterministic: boolean);
9
- raw(compiler: Compiler): BuiltinPlugin;
8
+ raw(): BuiltinPlugin;
10
9
  }
@@ -1,8 +1,7 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from "../binding";
2
- import type { Compiler } from "../Compiler";
3
2
  import { RspackBuiltinPlugin } from "./base";
4
3
  export declare class ModuleConcatenationPlugin extends RspackBuiltinPlugin {
5
4
  name: BuiltinPluginName;
6
5
  affectedHooks: "compilation";
7
- raw(compiler: Compiler): BuiltinPlugin;
6
+ raw(): BuiltinPlugin;
8
7
  }
@@ -1,8 +1,7 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from "../binding";
2
- import type { Compiler } from "../Compiler";
3
2
  import { RspackBuiltinPlugin } from "./base";
4
3
  export declare class NaturalChunkIdsPlugin extends RspackBuiltinPlugin {
5
4
  name: BuiltinPluginName;
6
5
  affectedHooks: "compilation";
7
- raw(compiler: Compiler): BuiltinPlugin;
6
+ raw(): BuiltinPlugin;
8
7
  }
@@ -1,8 +1,7 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from "../binding";
2
- import type { Compiler } from "../Compiler";
3
2
  import { RspackBuiltinPlugin } from "./base";
4
3
  export declare class NaturalModuleIdsPlugin extends RspackBuiltinPlugin {
5
4
  name: BuiltinPluginName;
6
5
  affectedHooks: "compilation";
7
- raw(compiler: Compiler): BuiltinPlugin;
6
+ raw(): BuiltinPlugin;
8
7
  }
@@ -0,0 +1,9 @@
1
+ export declare const URLPlugin: {
2
+ new (): {
3
+ name: string;
4
+ _args: [];
5
+ affectedHooks: keyof import("..").CompilerHooks | undefined;
6
+ raw(compiler: import("..").Compiler): import("../binding").BuiltinPlugin;
7
+ apply(compiler: import("..").Compiler): void;
8
+ };
9
+ };
@@ -26,6 +26,7 @@ export * from "./EnableLibraryPlugin";
26
26
  export * from "./EnableWasmLoadingPlugin";
27
27
  export * from "./EnsureChunkConditionsPlugin";
28
28
  export * from "./EntryPlugin";
29
+ export * from "./EsmLibraryPlugin";
29
30
  export * from "./EvalDevToolModulePlugin";
30
31
  export * from "./EvalSourceMapDevToolPlugin";
31
32
  export * from "./ExternalsPlugin";
@@ -76,6 +77,7 @@ export * from "./SourceMapDevToolPlugin";
76
77
  export * from "./SplitChunksPlugin";
77
78
  export * from "./SubresourceIntegrityPlugin";
78
79
  export * from "./SwcJsMinimizerPlugin";
80
+ export * from "./URLPlugin";
79
81
  export * from "./WarnCaseSensitiveModulesPlugin";
80
82
  export * from "./WebWorkerTemplatePlugin";
81
83
  export * from "./WorkerPlugin";
@@ -727,6 +727,11 @@ export type CssModuleParserOptions = {
727
727
  url?: CssParserUrl;
728
728
  };
729
729
  type ExportsPresence = "error" | "warn" | "auto" | false;
730
+ export type JavascriptParserCommonjsExports = boolean | "skipInEsm";
731
+ export type JavascriptParserCommonjsOption = boolean | {
732
+ /** Controls how CommonJS export mutations are handled. */
733
+ exports?: JavascriptParserCommonjsExports;
734
+ };
730
735
  export type JavascriptParserOptions = {
731
736
  /**
732
737
  * Specifies global mode for dynamic import.
@@ -757,7 +762,7 @@ export type JavascriptParserOptions = {
757
762
  * Enable parsing of new URL() syntax.
758
763
  * @default true
759
764
  * */
760
- url?: "relative" | boolean;
765
+ url?: "relative" | "new-url-relative" | boolean;
761
766
  /**
762
767
  * Enable warnings for full dynamic dependencies
763
768
  * @default true
@@ -795,6 +800,11 @@ export type JavascriptParserOptions = {
795
800
  requireAsExpression?: boolean;
796
801
  requireDynamic?: boolean;
797
802
  requireResolve?: boolean;
803
+ /**
804
+ * CommonJS-specific parser options. `true` enables the default behaviour, `{ exports: 'skipInEsm' }` preserves CommonJS export mutations when executed inside ESM.
805
+ * @default true
806
+ */
807
+ commonjs?: JavascriptParserCommonjsOption;
798
808
  importDynamic?: boolean;
799
809
  /**
800
810
  * Enable magic comments for CommonJS require() expressions.
package/dist/exports.d.ts CHANGED
@@ -57,7 +57,7 @@ export { EnvironmentPlugin } from "./lib/EnvironmentPlugin";
57
57
  export { LoaderOptionsPlugin } from "./lib/LoaderOptionsPlugin";
58
58
  export { LoaderTargetPlugin } from "./lib/LoaderTargetPlugin";
59
59
  export type { OutputFileSystem } from "./util/fs";
60
- import { FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, SubresourceIntegrityPlugin } from "./builtin-plugin";
60
+ import { EsmLibraryPlugin, FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, SubresourceIntegrityPlugin } from "./builtin-plugin";
61
61
  interface Web {
62
62
  FetchCompileAsyncWasmPlugin: typeof FetchCompileAsyncWasmPlugin;
63
63
  }
@@ -143,6 +143,7 @@ interface Experiments {
143
143
  cleanup: () => Promise<void>;
144
144
  };
145
145
  RemoveDuplicateModulesPlugin: typeof RemoveDuplicateModulesPlugin;
146
+ EsmLibraryPlugin: typeof EsmLibraryPlugin;
146
147
  RsdoctorPlugin: typeof RsdoctorPlugin;
147
148
  RstestPlugin: typeof RstestPlugin;
148
149
  RslibPlugin: typeof RslibPlugin;