@rspack-debug/browser 2.0.7 → 2.1.0-rc.0

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.
@@ -9,6 +9,7 @@ export default class ModuleGraph {
9
9
  getModule(dependency: Dependency): Module | null;
10
10
  getResolvedModule(dependency: Dependency): Module | null;
11
11
  getUsedExports(module: Module, runtime: string | string[]): string[] | boolean | null;
12
+ getProvidedExports(module: Module): true | string[] | null;
12
13
  getParentModule(dependency: Dependency): Module | null;
13
14
  getIssuer(module: Module): Module | null;
14
15
  getExportsInfo(module: Module): ExportsInfo;
@@ -348,13 +348,14 @@ export declare const isReservedRuntimeGlobal: (r: string, compilerRuntimeGlobals
348
348
  export declare function renderModulePrefix(_compilerOptions: RspackOptionsNormalized): string;
349
349
  export declare enum RuntimeVariable {
350
350
  Require = 0,
351
- Modules = 1,
352
- ModuleCache = 2,
353
- Module = 3,
354
- Exports = 4,
355
- StartupExec = 5
351
+ Context = 1,
352
+ Modules = 2,
353
+ ModuleCache = 3,
354
+ Module = 4,
355
+ Exports = 5,
356
+ StartupExec = 6
356
357
  }
357
- export declare function renderRuntimeVariables(variable: RuntimeVariable, _compilerOptions?: RspackOptionsNormalized): string;
358
+ export declare function renderRuntimeVariables(variable: RuntimeVariable, compilerOptions?: RspackOptionsNormalized): string;
358
359
  export declare function createCompilerRuntimeGlobals(compilerOptions?: RspackOptionsNormalized): Record<keyof typeof RuntimeGlobals, string>;
359
360
  declare const DefaultRuntimeGlobals: Record<"amdDefine" | "amdOptions" | "asyncModule" | "asyncModuleExportSymbol" | "baseURI" | "chunkCallback" | "chunkName" | "compatGetDefaultExport" | "compileWasm" | "createFakeNamespaceObject" | "createScript" | "createScriptUrl" | "currentRemoteGetScope" | "definePropertyGetters" | "ensureChunk" | "ensureChunkHandlers" | "ensureChunkIncludeEntries" | "entryModuleId" | "exports" | "externalInstallChunk" | "getChunkCssFilename" | "getChunkScriptFilename" | "getChunkUpdateCssFilename" | "getChunkUpdateScriptFilename" | "getFullHash" | "getTrustedTypesPolicy" | "getUpdateManifestFilename" | "global" | "harmonyModuleDecorator" | "hasCssModules" | "hasFetchPriority" | "hasOwnProperty" | "hmrDownloadManifest" | "hmrDownloadUpdateHandlers" | "hmrInvalidateModuleHandlers" | "hmrModuleData" | "hmrRuntimeStatePrefix" | "initializeSharing" | "instantiateWasm" | "interceptModuleExecution" | "loadScript" | "makeDeferredNamespaceObject" | "makeDeferredNamespaceObjectSymbol" | "makeNamespaceObject" | "module" | "moduleCache" | "moduleFactories" | "moduleFactoriesAddOnly" | "moduleId" | "moduleLoaded" | "nodeModuleDecorator" | "onChunksLoaded" | "prefetchChunk" | "prefetchChunkHandlers" | "preloadChunk" | "preloadChunkHandlers" | "publicPath" | "relativeUrl" | "require" | "requireScope" | "returnExportsFromRuntime" | "rspackUniqueId" | "rspackVersion" | "runtimeId" | "scriptNonce" | "shareScopeMap" | "startup" | "startupChunkDependencies" | "startupEntrypoint" | "startupNoDefault" | "startupOnlyAfter" | "startupOnlyBefore" | "system" | "systemContext" | "thisAsExports" | "uncaughtErrorHandler" | "wasmInstances", string>;
360
361
  export { DefaultRuntimeGlobals as RuntimeGlobals };
@@ -13,6 +13,7 @@ export type RsdoctorPluginOptions = {
13
13
  module?: boolean;
14
14
  cheap?: boolean;
15
15
  };
16
+ exportUsageGraph?: boolean;
16
17
  };
17
18
  declare const RsdoctorPluginImpl: {
18
19
  new (c?: RsdoctorPluginOptions | undefined): {
@@ -1,7 +1,7 @@
1
1
  import type { AssetInfo, RawModuleRuleUse, RawOptions } from '../binding';
2
2
  import type { Compilation } from '../Compilation';
3
3
  import type { Compiler } from '../Compiler';
4
- import { type LoaderObject } from '../loader-runner';
4
+ import type { LoaderObject } from '../loader-runner';
5
5
  import type { Logger } from '../logging/Logger';
6
6
  import type { Module } from '../Module';
7
7
  import type { ResolveRequest } from '../Resolver';
@@ -1,5 +1,5 @@
1
1
  import type { RspackOptionsNormalized } from './normalization';
2
- export declare const applyRspackOptionsDefaults: (options: RspackOptionsNormalized) => false | {
2
+ export declare const applyRspackOptionsDefaults: (options: RspackOptionsNormalized, compilerIndex?: number) => false | {
3
3
  platform: {
4
4
  web: boolean | null | undefined;
5
5
  browser: boolean | null | undefined;
@@ -10,7 +10,7 @@
10
10
  import type { HttpUriPluginOptions } from '../builtin-plugin';
11
11
  import type { Compilation } from '../Compilation';
12
12
  import type WebpackError from '../lib/WebpackError';
13
- import type { Amd, AssetModuleFilename, Bail, BundlerInfoOptions, ChunkFilename, ChunkLoading, ChunkLoadingGlobal, Clean, Context, CrossOriginLoading, CssChunkFilename, CssFilename, Dependencies, DevServer, DevTool, DevtoolFallbackModuleFilenameTemplate, DevtoolModuleFilenameTemplate, DevtoolNamespace, EnabledLibraryTypes, EnabledWasmLoadingTypes, EntryDescription, Environment, Externals, ExternalsPresets, ExternalsType, Filename, GeneratorOptionsByModuleType, GlobalObject, HashDigest, HashDigestLength, HashFunction, HashSalt, HotUpdateChunkFilename, HotUpdateGlobal, HotUpdateMainFilename, Iife, ImportFunctionName, ImportMetaName, Incremental, InfrastructureLogging, LazyCompilationOptions, LibraryOptions, Loader, Mode, Name, Node, NoParseOption, Optimization, OutputModule, ParserOptionsByModuleType, Path, Performance, Plugins, PublicPath, Resolve, RspackOptions, RuleSetRules, ScriptType, SnapshotOptions, SourceMapFilename, StatsValue, StrictModuleErrorHandling, Target, TrustedTypes, UniqueName, WasmLoading, Watch, WatchOptions, WebassemblyModuleFilename, WorkerPublicPath } from './types';
13
+ import type { Amd, AssetModuleFilename, Bail, BundlerInfoOptions, ChunkFilename, ChunkLoading, ChunkLoadingGlobal, Clean, Context, CrossOriginLoading, CssChunkFilename, CssFilename, Dependencies, DevServer, DevTool, DevtoolFallbackModuleFilenameTemplate, DevtoolModuleFilenameTemplate, DevtoolNamespace, EnabledLibraryTypes, EnabledWasmLoadingTypes, EntryDescription, Environment, Externals, ExternalsPresets, ExternalsType, Filename, GeneratorOptionsByModuleType, GlobalObject, HashDigest, HashDigestLength, HashFunction, HashSalt, HotUpdateChunkFilename, HotUpdateGlobal, HotUpdateMainFilename, Iife, ImportFunctionName, ImportMetaName, Incremental, InfrastructureLogging, LazyCompilationOptions, LibraryOptions, Loader, Mode, Name, Node, NoParseOption, Optimization, OutputModule, ParserOptionsByModuleType, Path, Performance, Plugins, PublicPath, Resolve, RspackOptions, RuleSetRules, ScriptType, SourceMapFilename, StatsValue, StrictModuleErrorHandling, Target, TrustedTypes, UniqueName, WasmLoading, Watch, WatchOptions, WebassemblyModuleFilename, WorkerPublicPath } from './types';
14
14
  export declare const getNormalizedRspackOptions: (config: RspackOptions) => RspackOptionsNormalized;
15
15
  export type EntryDynamicNormalized = () => Promise<EntryStaticNormalized>;
16
16
  export type EntryNormalized = EntryDynamicNormalized | EntryStaticNormalized;
@@ -77,22 +77,25 @@ export interface ModuleOptionsNormalized {
77
77
  generator: GeneratorOptionsByModuleType;
78
78
  noParse?: NoParseOption;
79
79
  }
80
- export type CacheNormalized = boolean | {
80
+ export type CacheNormalized = false | {
81
81
  type: 'memory';
82
82
  } | {
83
83
  type: 'persistent';
84
84
  buildDependencies: string[];
85
- version: string;
85
+ version?: string;
86
86
  snapshot: {
87
- immutablePaths: (string | RegExp)[];
88
- unmanagedPaths: (string | RegExp)[];
89
- managedPaths: (string | RegExp)[];
87
+ immutablePaths?: (string | RegExp)[];
88
+ unmanagedPaths?: (string | RegExp)[];
89
+ managedPaths?: (string | RegExp)[];
90
90
  };
91
91
  storage: {
92
92
  type: 'filesystem';
93
- directory: string;
93
+ directory?: string;
94
+ maxAge?: number;
95
+ maxGenerations?: number;
94
96
  };
95
97
  portable?: boolean;
98
+ readonly?: boolean;
96
99
  };
97
100
  export interface ExperimentsNormalized {
98
101
  asyncWebAssembly?: boolean;
@@ -104,6 +107,7 @@ export interface ExperimentsNormalized {
104
107
  deferImport?: boolean;
105
108
  sourceImport?: boolean;
106
109
  pureFunctions?: boolean;
110
+ runtimeMode?: 'webpack' | 'rspack';
107
111
  }
108
112
  export type IgnoreWarningsNormalized = ((warning: WebpackError, compilation: Compilation) => boolean)[];
109
113
  export type OptimizationRuntimeChunkNormalized = false | {
@@ -129,7 +133,6 @@ export interface RspackOptionsNormalized {
129
133
  devtool?: DevTool;
130
134
  node: Node;
131
135
  loader: Loader;
132
- snapshot: SnapshotOptions;
133
136
  cache?: CacheNormalized;
134
137
  stats: StatsValue;
135
138
  optimization: Optimization;
@@ -39,7 +39,7 @@ export type ChunkLoading = false | ChunkLoadingType;
39
39
  /** Whether to create a load-on-demand asynchronous chunk for entry. */
40
40
  export type AsyncChunks = boolean;
41
41
  /** Option to set the method of loading WebAssembly Modules. */
42
- export type WasmLoadingType = LiteralUnion<'fetch-streaming' | 'fetch' | 'async-node', string>;
42
+ export type WasmLoadingType = 'fetch' | 'async-node' | 'universal';
43
43
  /** Option to set the method of loading WebAssembly Modules. */
44
44
  export type WasmLoading = false | WasmLoadingType;
45
45
  export type ScriptType = false | 'text/javascript' | 'module';
@@ -194,7 +194,7 @@ export type StrictModuleErrorHandling = boolean;
194
194
  /** Indicates what global object will be used to mount the library. */
195
195
  export type GlobalObject = string;
196
196
  /** List of wasm loading types enabled for use by entry points. */
197
- export type EnabledWasmLoadingTypes = string[];
197
+ export type EnabledWasmLoadingTypes = ('...' | WasmLoadingType)[];
198
198
  /** The name of the native import() function. */
199
199
  export type ImportFunctionName = string;
200
200
  /** The name of the native import.meta object. */
@@ -932,6 +932,11 @@ export type JavascriptParserOptions = {
932
932
  * Enable magic comments for CommonJS require() expressions.
933
933
  */
934
934
  commonjsMagicComments?: boolean;
935
+ /**
936
+ * Enable or disable parsing `import { createRequire } from "module"` and evaluating createRequire().
937
+ * @default false
938
+ */
939
+ createRequire?: boolean | string;
935
940
  /** Whether to tolerant exportsPresence for type reexport */
936
941
  typeReexportsPresence?: 'no-tolerant' | 'tolerant' | 'tolerant-no-check';
937
942
  /** Whether to enable JSX parsing */
@@ -1342,7 +1347,6 @@ export type NodeOptions = {
1342
1347
  */
1343
1348
  export type Node = false | NodeOptions;
1344
1349
  export type Loader = Record<string, any>;
1345
- export type SnapshotOptions = {};
1346
1350
  /**
1347
1351
  * Snapshot options for determining which files have been modified.
1348
1352
  */
@@ -1371,9 +1375,22 @@ export type CacheStorageOptions = {
1371
1375
  type: 'filesystem';
1372
1376
  /**
1373
1377
  * Cache directory path.
1374
- * @default 'node_modules/.cache/rspack'
1378
+ * @default 'node_modules/.cache/rspack/<name>-<mode>-<compilerIndex>'
1375
1379
  */
1376
1380
  directory?: string;
1381
+ /**
1382
+ * Maximum age of unused filesystem cache in seconds. Must be an integer
1383
+ * between 1 and 4294967295, or Infinity to disable age-based cleanup.
1384
+ * @default 7 * 24 * 60 * 60
1385
+ */
1386
+ maxAge?: number;
1387
+ /**
1388
+ * Maximum number of filesystem cache generations to retain in the cache
1389
+ * directory. Must be an integer between 1 and 4294967295, or Infinity to
1390
+ * disable generation-based cleanup.
1391
+ * @default 3
1392
+ */
1393
+ maxGenerations?: number;
1377
1394
  };
1378
1395
  /**
1379
1396
  * Persistent cache options.
@@ -2302,6 +2319,12 @@ export type Experiments = {
2302
2319
  * @default false
2303
2320
  */
2304
2321
  pureFunctions?: boolean;
2322
+ /**
2323
+ * Select runtime proxy context behavior. `webpack` keeps the webpack startup hook,
2324
+ * while `rspack` uses `__rspack_context`.
2325
+ * @default "webpack"
2326
+ */
2327
+ runtimeMode?: 'webpack' | 'rspack';
2305
2328
  };
2306
2329
  export type Watch = boolean;
2307
2330
  /** Options for watch mode. */
@@ -2480,10 +2503,6 @@ export type RspackOptions = {
2480
2503
  * Options for the stats output.
2481
2504
  */
2482
2505
  stats?: StatsValue;
2483
- /**
2484
- * Options for snapshotting.
2485
- */
2486
- snapshot?: SnapshotOptions;
2487
2506
  /**
2488
2507
  * Optimization options.
2489
2508
  */