@rspack/browser 2.0.8 → 2.1.0-beta.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.
- package/dist/ModuleGraph.d.ts +1 -0
- package/dist/RuntimeGlobals.d.ts +7 -6
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +1 -0
- package/dist/config/adapterRuleUse.d.ts +1 -1
- package/dist/config/defaults.d.ts +1 -1
- package/dist/config/normalization.d.ts +11 -8
- package/dist/config/types.d.ts +24 -6
- package/dist/index.js +2679 -2561
- package/dist/loader-runner/index.d.ts +9 -10
- package/dist/napi-binding.d.ts +8 -0
- package/dist/rspack.d.ts +1 -1
- package/dist/rspack.wasm32-wasi.wasm +0 -0
- package/dist/trace/index.d.ts +1 -0
- package/dist/util/identifier.d.ts +0 -1
- package/dist/wasi-worker-browser.mjs +638 -341
- package/package.json +7 -7
package/dist/ModuleGraph.d.ts
CHANGED
|
@@ -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;
|
package/dist/RuntimeGlobals.d.ts
CHANGED
|
@@ -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
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
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,
|
|
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 };
|
|
@@ -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 {
|
|
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,
|
|
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 =
|
|
80
|
+
export type CacheNormalized = false | {
|
|
81
81
|
type: 'memory';
|
|
82
82
|
} | {
|
|
83
83
|
type: 'persistent';
|
|
84
84
|
buildDependencies: string[];
|
|
85
|
-
version
|
|
85
|
+
version?: string;
|
|
86
86
|
snapshot: {
|
|
87
|
-
immutablePaths
|
|
88
|
-
unmanagedPaths
|
|
89
|
-
managedPaths
|
|
87
|
+
immutablePaths?: (string | RegExp)[];
|
|
88
|
+
unmanagedPaths?: (string | RegExp)[];
|
|
89
|
+
managedPaths?: (string | RegExp)[];
|
|
90
90
|
};
|
|
91
91
|
storage: {
|
|
92
92
|
type: 'filesystem';
|
|
93
|
-
directory
|
|
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;
|
package/dist/config/types.d.ts
CHANGED
|
@@ -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,21 @@ 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 0 and 4294967295.
|
|
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 0 and 4294967295.
|
|
1390
|
+
* @default No generation count limit; maxAge cleanup still applies
|
|
1391
|
+
*/
|
|
1392
|
+
maxGenerations?: number;
|
|
1377
1393
|
};
|
|
1378
1394
|
/**
|
|
1379
1395
|
* Persistent cache options.
|
|
@@ -2302,6 +2318,12 @@ export type Experiments = {
|
|
|
2302
2318
|
* @default false
|
|
2303
2319
|
*/
|
|
2304
2320
|
pureFunctions?: boolean;
|
|
2321
|
+
/**
|
|
2322
|
+
* Select runtime proxy context behavior. `webpack` keeps the webpack startup hook,
|
|
2323
|
+
* while `rspack` uses `__rspack_context`.
|
|
2324
|
+
* @default "webpack"
|
|
2325
|
+
*/
|
|
2326
|
+
runtimeMode?: 'webpack' | 'rspack';
|
|
2305
2327
|
};
|
|
2306
2328
|
export type Watch = boolean;
|
|
2307
2329
|
/** Options for watch mode. */
|
|
@@ -2480,10 +2502,6 @@ export type RspackOptions = {
|
|
|
2480
2502
|
* Options for the stats output.
|
|
2481
2503
|
*/
|
|
2482
2504
|
stats?: StatsValue;
|
|
2483
|
-
/**
|
|
2484
|
-
* Options for snapshotting.
|
|
2485
|
-
*/
|
|
2486
|
-
snapshot?: SnapshotOptions;
|
|
2487
2505
|
/**
|
|
2488
2506
|
* Optimization options.
|
|
2489
2507
|
*/
|