@rspack-debug/browser 2.0.0-rc.0 → 2.0.0-rc.2

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,5 +1,6 @@
1
- import type { Dependency, JsModuleGraph, ModuleGraphConnection } from './binding';
1
+ import type { Dependency, JsModuleGraph } from './binding';
2
2
  import { ExportsInfo } from './ExportsInfo';
3
+ import type { ModuleGraphConnection } from './ModuleGraphConnection';
3
4
  import type { Module } from './Module';
4
5
  export default class ModuleGraph {
5
6
  #private;
@@ -0,0 +1,10 @@
1
+ import binding, { ModuleGraphConnection as BindingModuleGraphConnection } from './binding';
2
+ type ModuleGraphConnectionConstructor = typeof BindingModuleGraphConnection & {
3
+ readonly TRANSITIVE_ONLY: typeof binding.TRANSITIVE_ONLY_SYMBOL;
4
+ readonly CIRCULAR_CONNECTION: typeof binding.CIRCULAR_CONNECTION_SYMBOL;
5
+ };
6
+ export interface ModuleGraphConnection extends BindingModuleGraphConnection {
7
+ }
8
+ export declare const ModuleGraphConnection: ModuleGraphConnectionConstructor;
9
+ export type ConnectionState = boolean | typeof ModuleGraphConnection.TRANSITIVE_ONLY | typeof ModuleGraphConnection.CIRCULAR_CONNECTION;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ import { type RawHashedModuleIdsPluginOptions } from '../binding';
2
+ export declare const HashedModuleIdsPlugin: {
3
+ new (options?: RawHashedModuleIdsPluginOptions | undefined): {
4
+ name: string;
5
+ _args: [options?: RawHashedModuleIdsPluginOptions | undefined];
6
+ affectedHooks: keyof import("..").CompilerHooks | undefined;
7
+ raw(compiler: import("..").Compiler): import("../binding").BuiltinPlugin;
8
+ apply(compiler: import("..").Compiler): void;
9
+ };
10
+ };
@@ -1,9 +1,9 @@
1
- export declare const SideEffectsFlagPlugin: {
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
- };
1
+ import { type BuiltinPlugin, BuiltinPluginName } from '../binding';
2
+ import { RspackBuiltinPlugin } from './base';
3
+ export declare class SideEffectsFlagPlugin extends RspackBuiltinPlugin {
4
+ private analyzeSideEffectsFree;
5
+ name: BuiltinPluginName;
6
+ affectedHooks: "compilation";
7
+ constructor(analyzeSideEffectsFree?: boolean);
8
+ raw(): BuiltinPlugin;
9
+ }
@@ -36,6 +36,7 @@ export * from './FetchCompileAsyncWasmPlugin';
36
36
  export * from './FileUriPlugin';
37
37
  export * from './FlagDependencyExportsPlugin';
38
38
  export * from './FlagDependencyUsagePlugin';
39
+ export * from './HashedModuleIdsPlugin';
39
40
  export * from './HotModuleReplacementPlugin';
40
41
  export * from './HttpExternalsRspackPlugin';
41
42
  export * from './HttpUriPlugin';
@@ -186,7 +186,7 @@ export interface LoaderContext<OptionsType = {}> {
186
186
  */
187
187
  request: string;
188
188
  /**
189
- * An array of all the loaders. It is writeable in the pitch phase.
189
+ * An array of all the loaders. It is writable in the pitch phase.
190
190
  * loaders = [{request: string, path: string, query: string, module: function}]
191
191
  *
192
192
  * In the example:
@@ -102,6 +102,7 @@ export interface ExperimentsNormalized {
102
102
  useInputFileSystem?: false | RegExp[];
103
103
  nativeWatcher?: boolean;
104
104
  deferImport?: boolean;
105
+ pureFunctions?: boolean;
105
106
  }
106
107
  export type IgnoreWarningsNormalized = ((warning: WebpackError, compilation: Compilation) => boolean)[];
107
108
  export type OptimizationRuntimeChunkNormalized = false | {
@@ -137,7 +138,7 @@ export interface RspackOptionsNormalized {
137
138
  incremental?: false | Incremental;
138
139
  watch?: Watch;
139
140
  watchOptions: WatchOptions;
140
- devServer?: DevServer;
141
+ devServer?: false | DevServer;
141
142
  ignoreWarnings?: IgnoreWarningsNormalized;
142
143
  performance?: Performance;
143
144
  amd?: Amd;
@@ -631,8 +631,30 @@ export type RuleSetLoaderWithOptions = {
631
631
  };
632
632
  export type RuleSetUseItem = RuleSetLoader | RuleSetLoaderWithOptions;
633
633
  export type RuleSetUse = RuleSetUseItem | RuleSetUseItem[] | ((data: RawFuncUseCtx) => RuleSetUseItem[]);
634
+ export type RuleSetRuleUseAndLoader = {
635
+ /** A loader name */
636
+ loader: RuleSetLoader;
637
+ /** A loader options */
638
+ options?: RuleSetLoaderOptions;
639
+ /** An array to pass the Loader package name and its options. */
640
+ use?: never;
641
+ } | {
642
+ /** A loader name */
643
+ loader?: never;
644
+ /** A loader options */
645
+ options?: never;
646
+ /** An array to pass the Loader package name and its options. */
647
+ use: RuleSetUse;
648
+ } | {
649
+ /** A loader name */
650
+ loader?: never;
651
+ /** A loader options */
652
+ options?: never;
653
+ /** An array to pass the Loader package name and its options. */
654
+ use?: never;
655
+ };
634
656
  /** Rule defines the conditions for matching a module and the behavior of handling those modules. */
635
- export type RuleSetRule = {
657
+ export type RuleSetRule = RuleSetRuleUseAndLoader & {
636
658
  /** Matches all modules that match this resource, and will match against Resource. */
637
659
  test?: RuleSetCondition;
638
660
  /** Excludes all modules that match this condition and will match against the absolute path of the resource */
@@ -663,12 +685,6 @@ export type RuleSetRule = {
663
685
  type?: string;
664
686
  /** Used to mark the layer of the matching module. */
665
687
  layer?: string;
666
- /** A loader name */
667
- loader?: RuleSetLoader;
668
- /** A loader options */
669
- options?: RuleSetLoaderOptions;
670
- /** An array to pass the Loader package name and its options. */
671
- use?: RuleSetUse;
672
688
  /**
673
689
  * Parser options for the specific modules that matched by the rule conditions
674
690
  * It will override the parser options in module.parser.
@@ -807,7 +823,6 @@ export type JavascriptParserOptions = {
807
823
  dynamicImportFetchPriority?: 'low' | 'high' | 'auto';
808
824
  /**
809
825
  * Enable or disable evaluating import.meta. Set to 'preserve-unknown' to preserve unknown properties for runtime evaluation.
810
- * @default 'preserve-unknown'
811
826
  */
812
827
  importMeta?: boolean | 'preserve-unknown';
813
828
  /**
@@ -898,6 +913,11 @@ export type JavascriptParserOptions = {
898
913
  * @default false
899
914
  */
900
915
  importMetaResolve?: boolean;
916
+ /**
917
+ * Flag top-level exported functions as side-effect-free for pure-function-based tree shaking.
918
+ * @experimental
919
+ */
920
+ pureFunctions?: string[];
901
921
  };
902
922
  export type JsonParserOptions = {
903
923
  /**
@@ -1354,6 +1374,8 @@ export type MemoryCacheOptions = {
1354
1374
  */
1355
1375
  export type CacheOptions = boolean | MemoryCacheOptions | PersistentCacheOptions;
1356
1376
  export type StatsPresets = 'normal' | 'none' | 'verbose' | 'errors-only' | 'errors-warnings' | 'minimal' | 'detailed' | 'summary';
1377
+ type AssetFilterItemTypes = RegExp | string | ((name: string, asset: any) => boolean);
1378
+ type AssetFilterTypes = boolean | AssetFilterItemTypes | AssetFilterItemTypes[];
1357
1379
  type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
1358
1380
  type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
1359
1381
  export type StatsColorOptions = {
@@ -1638,7 +1660,7 @@ export type StatsOptions = {
1638
1660
  * Exclude the matching assets information.
1639
1661
  * @default false
1640
1662
  */
1641
- excludeAssets?: ModuleFilterTypes;
1663
+ excludeAssets?: AssetFilterTypes;
1642
1664
  /**
1643
1665
  * Specifies the sorting order for modules.
1644
1666
  * @default 'id'
@@ -1818,6 +1840,13 @@ type SharedOptimizationSplitChunksCacheGroup = {
1818
1840
  */
1819
1841
  minSize?: OptimizationSplitChunksSizes;
1820
1842
  minSizeReduction?: OptimizationSplitChunksSizes;
1843
+ /**
1844
+ * Size threshold at which splitting is enforced and other restrictions
1845
+ * (minRemainingSize, maxAsyncRequests, maxInitialRequests) are ignored.
1846
+ * The value is `50000` in production mode.
1847
+ * The value is `30000` in others mode.
1848
+ */
1849
+ enforceSizeThreshold?: OptimizationSplitChunksSizes;
1821
1850
  /** Maximum size, in bytes, for a chunk to be generated. */
1822
1851
  maxSize?: OptimizationSplitChunksSizes;
1823
1852
  /** Maximum size, in bytes, for a async chunk to be generated. */
@@ -1900,8 +1929,10 @@ export type OptimizationSplitChunksOptions = {
1900
1929
  export type Optimization = {
1901
1930
  /**
1902
1931
  * Which algorithm to use when choosing module ids.
1932
+ * Setting to `false` disables the built-in algorithm, allowing a custom plugin
1933
+ * (e.g. HashedModuleIdsPlugin) to provide module ids instead.
1903
1934
  */
1904
- moduleIds?: 'named' | 'natural' | 'deterministic';
1935
+ moduleIds?: false | 'named' | 'natural' | 'deterministic' | 'hashed';
1905
1936
  /**
1906
1937
  * Which algorithm to use when choosing chunk ids.
1907
1938
  */
@@ -2199,6 +2230,11 @@ export type Experiments = {
2199
2230
  * @default false
2200
2231
  */
2201
2232
  deferImport?: boolean;
2233
+ /**
2234
+ * Enable pure-function-based side-effects analysis.
2235
+ * @default false
2236
+ */
2237
+ pureFunctions?: boolean;
2202
2238
  };
2203
2239
  export type Watch = boolean;
2204
2240
  /** Options for watch mode. */
@@ -2400,7 +2436,7 @@ export type RspackOptions = {
2400
2436
  /**
2401
2437
  * Configuration for the development server.
2402
2438
  */
2403
- devServer?: DevServer;
2439
+ devServer?: false | DevServer;
2404
2440
  /**
2405
2441
  * Options for module configuration.
2406
2442
  */
package/dist/exports.d.ts CHANGED
@@ -16,6 +16,7 @@ export { ExternalModule } from './ExternalModule';
16
16
  export type { ResolveData, ResourceDataWithData } from './Module';
17
17
  export { Module } from './Module';
18
18
  export type { default as ModuleGraph } from './ModuleGraph';
19
+ export { ModuleGraphConnection, type ConnectionState, } from './ModuleGraphConnection';
19
20
  export { MultiStats } from './MultiStats';
20
21
  export { NormalModule } from './NormalModule';
21
22
  export type { NormalModuleFactory } from './NormalModuleFactory';
@@ -76,6 +77,11 @@ interface Electron {
76
77
  ElectronTargetPlugin: typeof ElectronTargetPlugin;
77
78
  }
78
79
  export declare const electron: Electron;
80
+ import { HashedModuleIdsPlugin } from './builtin-plugin';
81
+ interface Ids {
82
+ HashedModuleIdsPlugin: typeof HashedModuleIdsPlugin;
83
+ }
84
+ export declare const ids: Ids;
79
85
  import { EnableLibraryPlugin } from './builtin-plugin';
80
86
  interface Library {
81
87
  EnableLibraryPlugin: typeof EnableLibraryPlugin;