@rspack/core 2.1.0-beta.0 → 2.1.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/compiled/http-proxy-middleware/package.json +1 -1
- package/compiled/watchpack/index.js +474 -235
- package/compiled/watchpack/package.json +1 -1
- package/compiled/watchpack/types/DirectoryWatcher.d.ts +2 -0
- package/compiled/watchpack/types/index.d.ts +121 -113
- package/compiled/watchpack/types/util/globToRegExp.d.ts +2 -0
- package/compiled/watchpack/types/watchpack.d.ts +1 -1
- package/compiled/webpack-sources/index.js +953 -351
- package/compiled/webpack-sources/package.json +1 -1
- package/compiled/webpack-sources/types.d.ts +40 -1
- package/dist/Module.d.ts +0 -1
- package/dist/NativeWatchFileSystem.d.ts +29 -0
- package/dist/RuntimeGlobals.d.ts +0 -1
- package/dist/builtin-loader/swc/types.d.ts +1 -59
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/html-plugin/options.d.ts +1 -1
- package/dist/config/normalization.d.ts +2 -2
- package/dist/config/types.d.ts +15 -14
- package/dist/index.js +116 -67
- package/dist/lib/HookWebpackError.d.ts +0 -1
- package/dist/lib/cache/getLazyHashedEtag.d.ts +1 -1
- package/dist/lib/cache/mergeEtags.d.ts +0 -1
- package/dist/node/NodeWatchFileSystem.d.ts +13 -1
- package/dist/rslib-runtime-worker.js +22 -0
- package/dist/rspack.d.ts +0 -1
- package/dist/sharing/IndependentSharedPlugin.d.ts +0 -1
- package/dist/stats/statsFactoryUtils.d.ts +0 -6
- package/dist/util/comparators.d.ts +1 -1
- package/dist/util/fake.d.ts +0 -3
- package/dist/util/fs.d.ts +9 -8
- package/dist/worker.js +1 -1
- package/package.json +7 -7
- /package/dist/{612.js → rslib-runtime-index.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"webpack-sources","author":"Tobias Koppers @sokra","version":"3.
|
|
1
|
+
{"name":"webpack-sources","author":"Tobias Koppers @sokra","version":"3.5.0","license":"MIT","types":"types.d.ts","type":"commonjs"}
|
|
@@ -96,6 +96,22 @@ declare class CachedSource extends Source {
|
|
|
96
96
|
onName: (nameIndex: number, name: string) => void,
|
|
97
97
|
): GeneratedSourceInfo;
|
|
98
98
|
}
|
|
99
|
+
declare interface ClearCacheOptions {
|
|
100
|
+
/**
|
|
101
|
+
* drop cached source maps (default `true`)
|
|
102
|
+
*/
|
|
103
|
+
maps?: boolean;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* drop cached source/buffer copies (default `true`)
|
|
107
|
+
*/
|
|
108
|
+
source?: boolean;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* drop the parsed object form of cached source maps on `SourceMapSource` instances (default `false` — re-parsing JSON is significantly more expensive than `toString`). Only takes effect when a serialized form (buffer or string) is also retained, so the data remains recoverable.
|
|
112
|
+
*/
|
|
113
|
+
parsedMap?: boolean;
|
|
114
|
+
}
|
|
99
115
|
declare class CompatSource extends Source {
|
|
100
116
|
constructor(sourceLike: SourceLike);
|
|
101
117
|
static from(sourceLike: SourceLike): Source;
|
|
@@ -318,10 +334,24 @@ declare class Source {
|
|
|
318
334
|
constructor();
|
|
319
335
|
source(): SourceValue;
|
|
320
336
|
buffer(): Buffer;
|
|
337
|
+
buffers(): Buffer[];
|
|
321
338
|
size(): number;
|
|
322
339
|
map(options?: MapOptions): null | RawSourceMap;
|
|
323
340
|
sourceAndMap(options?: MapOptions): SourceAndMap;
|
|
324
341
|
updateHash(hash: HashLike): void;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Release cached data held by this source. clearCache is a memory
|
|
345
|
+
* hint: it never affects correctness or output, only how expensive
|
|
346
|
+
* the next read is. Subclasses override; the base is a no-op so
|
|
347
|
+
* every Source supports the call. Composite sources always recurse
|
|
348
|
+
* into wrapped sources. When the same child is reachable via several
|
|
349
|
+
* parents (e.g. modules shared across webpack chunks), pass a shared
|
|
350
|
+
* `visited` WeakSet so each subtree is walked at most once.
|
|
351
|
+
* Not safe to call concurrently with source/map/sourceAndMap/
|
|
352
|
+
* streamChunks/updateHash on the same instance.
|
|
353
|
+
*/
|
|
354
|
+
clearCache(options?: ClearCacheOptions, visited?: WeakSet<Source>): void;
|
|
325
355
|
}
|
|
326
356
|
declare interface SourceAndMap {
|
|
327
357
|
/**
|
|
@@ -345,6 +375,11 @@ declare interface SourceLike {
|
|
|
345
375
|
*/
|
|
346
376
|
buffer?: () => Buffer;
|
|
347
377
|
|
|
378
|
+
/**
|
|
379
|
+
* buffers
|
|
380
|
+
*/
|
|
381
|
+
buffers?: () => Buffer[];
|
|
382
|
+
|
|
348
383
|
/**
|
|
349
384
|
* size
|
|
350
385
|
*/
|
|
@@ -364,6 +399,11 @@ declare interface SourceLike {
|
|
|
364
399
|
* hash updater
|
|
365
400
|
*/
|
|
366
401
|
updateHash?: (hash: HashLike) => void;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* clear cache
|
|
405
|
+
*/
|
|
406
|
+
clearCache?: (options?: ClearCacheOptions, visited?: WeakSet<Source>) => void;
|
|
367
407
|
}
|
|
368
408
|
declare class SourceMapSource extends Source {
|
|
369
409
|
constructor(
|
|
@@ -458,4 +498,3 @@ declare interface StreamChunksOptions {
|
|
|
458
498
|
};
|
|
459
499
|
|
|
460
500
|
|
|
461
|
-
|
package/dist/Module.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import './BuildInfo.js';
|
|
|
5
5
|
export type ResourceDataWithData = ResourceData & {
|
|
6
6
|
data?: Record<string, any>;
|
|
7
7
|
};
|
|
8
|
-
export type CreateData = binding.JsCreateData;
|
|
9
8
|
export type ContextInfo = binding.ContextInfo;
|
|
10
9
|
export type ResolveData = binding.JsResolveData;
|
|
11
10
|
export declare class ContextModuleFactoryBeforeResolveData {
|
|
@@ -1,9 +1,28 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
1
2
|
import binding from '@rspack/binding';
|
|
2
3
|
import type Watchpack from '../compiled/watchpack/index.js';
|
|
3
4
|
import type { FileSystemInfoEntry, InputFileSystem, Watcher, WatchFileSystem } from './util/fs.js';
|
|
5
|
+
/**
|
|
6
|
+
* Minimal watchpack-compatible shim exposed as `NativeWatchFileSystem.watcher`.
|
|
7
|
+
*
|
|
8
|
+
* It proxies the watchpack-private surface that `ts-checker-rspack-plugin` and
|
|
9
|
+
* `fork-ts-checker-webpack-plugin` rely on — `on`/`once` for `change`/`remove`,
|
|
10
|
+
* plus `_onChange`/`_onRemove` to inject events — onto the native watcher, so
|
|
11
|
+
* those plugins keep working under `experiments.nativeWatcher` unmodified.
|
|
12
|
+
*
|
|
13
|
+
* APIs that iterate `fileWatchers`/`directoryWatchers` are intentionally not
|
|
14
|
+
* supported; plugins needing those should use `WatchFileSystem.emit` instead.
|
|
15
|
+
*/
|
|
16
|
+
declare class NativeWatcherShim extends EventEmitter {
|
|
17
|
+
#private;
|
|
18
|
+
constructor(trigger: (kind: 'change' | 'remove', path: string) => void);
|
|
19
|
+
_onChange(item: string, _mtime?: number, file?: string, _type?: string): void;
|
|
20
|
+
_onRemove(item: string, file?: string, _type?: string): void;
|
|
21
|
+
}
|
|
4
22
|
export default class NativeWatchFileSystem implements WatchFileSystem {
|
|
5
23
|
#private;
|
|
6
24
|
constructor(inputFileSystem: InputFileSystem);
|
|
25
|
+
get watcher(): NativeWatcherShim | undefined;
|
|
7
26
|
watch(files: Iterable<string> & {
|
|
8
27
|
added?: Iterable<string>;
|
|
9
28
|
removed?: Iterable<string>;
|
|
@@ -16,8 +35,18 @@ export default class NativeWatchFileSystem implements WatchFileSystem {
|
|
|
16
35
|
}, startTime: number, options: Watchpack.WatchOptions, callback: (error: Error | null, fileTimeInfoEntries: Map<string, FileSystemInfoEntry | 'ignore'>, contextTimeInfoEntries: Map<string, FileSystemInfoEntry | 'ignore'>, changedFiles: Set<string>, removedFiles: Set<string>) => void, callbackUndelayed: (fileName: string, changeTime: number) => void): Watcher;
|
|
17
36
|
getNativeWatcher(options: Watchpack.WatchOptions): binding.NativeWatcher;
|
|
18
37
|
triggerEvent(kind: 'change' | 'remove' | 'create', path: string): void;
|
|
38
|
+
on(event: 'change', listener: (filename: string, mtime: number) => void): this;
|
|
39
|
+
on(event: 'remove', listener: (filename: string) => void): this;
|
|
40
|
+
on(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
|
|
41
|
+
once(event: 'change', listener: (filename: string, mtime: number) => void): this;
|
|
42
|
+
once(event: 'remove', listener: (filename: string) => void): this;
|
|
43
|
+
once(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
|
|
44
|
+
emit(event: 'change', filename: string, mtime: number): boolean;
|
|
45
|
+
emit(event: 'remove', filename: string): boolean;
|
|
46
|
+
emit(event: 'aggregated', changes: Set<string>, removals: Set<string>): boolean;
|
|
19
47
|
formatWatchDependencies(dependencies: Iterable<string> & {
|
|
20
48
|
added?: Iterable<string>;
|
|
21
49
|
removed?: Iterable<string>;
|
|
22
50
|
}): [string[], string[]];
|
|
23
51
|
}
|
|
52
|
+
export {};
|
package/dist/RuntimeGlobals.d.ts
CHANGED
|
@@ -345,7 +345,6 @@ declare enum RuntimeGlobals {
|
|
|
345
345
|
makeDeferredNamespaceObjectSymbol = 76
|
|
346
346
|
}
|
|
347
347
|
export declare const isReservedRuntimeGlobal: (r: string, compilerRuntimeGlobals: Record<string, string>) => boolean;
|
|
348
|
-
export declare function renderModulePrefix(_compilerOptions: RspackOptionsNormalized): string;
|
|
349
348
|
export declare enum RuntimeVariable {
|
|
350
349
|
Require = 0,
|
|
351
350
|
Context = 1,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config, EnvConfig, EsParserConfig, JscConfig, ModuleConfig, ParserConfig,
|
|
1
|
+
import type { Config, EnvConfig, EsParserConfig, JscConfig, ModuleConfig, ParserConfig, TransformConfig, TsParserConfig } from '../../../compiled/@swc/types/index.js';
|
|
2
2
|
import type { CollectTypeScriptInfoOptions } from './collectTypeScriptInfo.js';
|
|
3
3
|
import type { PluginImportOptions } from './pluginImport.js';
|
|
4
4
|
export type SwcLoaderEnvConfig = EnvConfig;
|
|
@@ -57,62 +57,4 @@ export interface ReactServerComponentsOptions {
|
|
|
57
57
|
*/
|
|
58
58
|
disableClientApiChecks?: boolean;
|
|
59
59
|
}
|
|
60
|
-
export interface TerserCompressOptions {
|
|
61
|
-
arguments?: boolean;
|
|
62
|
-
arrows?: boolean;
|
|
63
|
-
booleans?: boolean;
|
|
64
|
-
booleans_as_integers?: boolean;
|
|
65
|
-
collapse_vars?: boolean;
|
|
66
|
-
comparisons?: boolean;
|
|
67
|
-
computed_props?: boolean;
|
|
68
|
-
conditionals?: boolean;
|
|
69
|
-
dead_code?: boolean;
|
|
70
|
-
defaults?: boolean;
|
|
71
|
-
directives?: boolean;
|
|
72
|
-
drop_console?: boolean;
|
|
73
|
-
drop_debugger?: boolean;
|
|
74
|
-
ecma?: TerserEcmaVersion;
|
|
75
|
-
evaluate?: boolean;
|
|
76
|
-
expression?: boolean;
|
|
77
|
-
global_defs?: any;
|
|
78
|
-
hoist_funs?: boolean;
|
|
79
|
-
hoist_props?: boolean;
|
|
80
|
-
hoist_vars?: boolean;
|
|
81
|
-
ie8?: boolean;
|
|
82
|
-
if_return?: boolean;
|
|
83
|
-
inline?: 0 | 1 | 2 | 3;
|
|
84
|
-
join_vars?: boolean;
|
|
85
|
-
keep_classnames?: boolean;
|
|
86
|
-
keep_fargs?: boolean;
|
|
87
|
-
keep_fnames?: boolean;
|
|
88
|
-
keep_infinity?: boolean;
|
|
89
|
-
loops?: boolean;
|
|
90
|
-
negate_iife?: boolean;
|
|
91
|
-
passes?: number;
|
|
92
|
-
properties?: boolean;
|
|
93
|
-
pure_getters?: any;
|
|
94
|
-
pure_funcs?: string[];
|
|
95
|
-
reduce_funcs?: boolean;
|
|
96
|
-
reduce_vars?: boolean;
|
|
97
|
-
sequences?: any;
|
|
98
|
-
side_effects?: boolean;
|
|
99
|
-
switches?: boolean;
|
|
100
|
-
top_retain?: any;
|
|
101
|
-
toplevel?: any;
|
|
102
|
-
typeofs?: boolean;
|
|
103
|
-
unsafe?: boolean;
|
|
104
|
-
unsafe_passes?: boolean;
|
|
105
|
-
unsafe_arrows?: boolean;
|
|
106
|
-
unsafe_comps?: boolean;
|
|
107
|
-
unsafe_function?: boolean;
|
|
108
|
-
unsafe_math?: boolean;
|
|
109
|
-
unsafe_symbols?: boolean;
|
|
110
|
-
unsafe_methods?: boolean;
|
|
111
|
-
unsafe_proto?: boolean;
|
|
112
|
-
unsafe_regexp?: boolean;
|
|
113
|
-
unsafe_undefined?: boolean;
|
|
114
|
-
unused?: boolean;
|
|
115
|
-
const_to_let?: boolean;
|
|
116
|
-
module?: boolean;
|
|
117
|
-
}
|
|
118
60
|
export {};
|
|
@@ -182,7 +182,7 @@ export interface TerserCompressOptions {
|
|
|
182
182
|
unsafe_passes?: boolean;
|
|
183
183
|
unsafe_arrows?: boolean;
|
|
184
184
|
unsafe_comps?: boolean;
|
|
185
|
-
|
|
185
|
+
unsafe_Function?: boolean;
|
|
186
186
|
unsafe_math?: boolean;
|
|
187
187
|
unsafe_symbols?: boolean;
|
|
188
188
|
unsafe_methods?: boolean;
|
|
@@ -40,7 +40,7 @@ export type HtmlRspackPluginOptions = {
|
|
|
40
40
|
* Modern browsers support non-blocking JavaScript loading ([`defer` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#defer)) to improve the page startup performance.
|
|
41
41
|
*
|
|
42
42
|
* Setting this option to `'module'` adds attribute `type="module"` to the `script`. This also implies `defer` attribute on the `script`, since modules are automatically deferred.
|
|
43
|
-
* @default "defer"
|
|
43
|
+
* @default "module" when `output.module` is enabled, otherwise "defer"
|
|
44
44
|
* */
|
|
45
45
|
scriptLoading?: 'blocking' | 'defer' | 'module' | 'systemjs-module';
|
|
46
46
|
/** Allows you to add only some chunks. */
|
|
@@ -83,6 +83,8 @@ export type CacheNormalized = false | {
|
|
|
83
83
|
type: 'persistent';
|
|
84
84
|
buildDependencies: string[];
|
|
85
85
|
version?: string;
|
|
86
|
+
maxAge?: number;
|
|
87
|
+
maxVersions?: number;
|
|
86
88
|
snapshot: {
|
|
87
89
|
immutablePaths?: (string | RegExp)[];
|
|
88
90
|
unmanagedPaths?: (string | RegExp)[];
|
|
@@ -91,8 +93,6 @@ export type CacheNormalized = false | {
|
|
|
91
93
|
storage: {
|
|
92
94
|
type: 'filesystem';
|
|
93
95
|
directory?: string;
|
|
94
|
-
maxAge?: number;
|
|
95
|
-
maxGenerations?: number;
|
|
96
96
|
};
|
|
97
97
|
portable?: boolean;
|
|
98
98
|
readonly?: boolean;
|
package/dist/config/types.d.ts
CHANGED
|
@@ -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 =
|
|
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 =
|
|
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. */
|
|
@@ -1378,18 +1378,6 @@ export type CacheStorageOptions = {
|
|
|
1378
1378
|
* @default 'node_modules/.cache/rspack/<name>-<mode>-<compilerIndex>'
|
|
1379
1379
|
*/
|
|
1380
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;
|
|
1393
1381
|
};
|
|
1394
1382
|
/**
|
|
1395
1383
|
* Persistent cache options.
|
|
@@ -1409,6 +1397,19 @@ export type PersistentCacheOptions = {
|
|
|
1409
1397
|
* @default ""
|
|
1410
1398
|
*/
|
|
1411
1399
|
version?: string;
|
|
1400
|
+
/**
|
|
1401
|
+
* Maximum age of unused filesystem cache in seconds. Must be an integer
|
|
1402
|
+
* between 1 and 4294967295, or Infinity to disable age-based cleanup.
|
|
1403
|
+
* @default 7 * 24 * 60 * 60
|
|
1404
|
+
*/
|
|
1405
|
+
maxAge?: number;
|
|
1406
|
+
/**
|
|
1407
|
+
* Maximum number of filesystem cache versions to retain in the cache
|
|
1408
|
+
* directory. Must be an integer between 1 and 4294967295, or Infinity to
|
|
1409
|
+
* disable version-based cleanup.
|
|
1410
|
+
* @default 3
|
|
1411
|
+
*/
|
|
1412
|
+
maxVersions?: number;
|
|
1412
1413
|
/**
|
|
1413
1414
|
* Snapshot options for determining which files have been modified.
|
|
1414
1415
|
*/
|