@ohos-ports/rspack-core 2.2.9-beta.0 → 2.3.4-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/README.md +7 -7
- package/compiled/http-proxy-middleware/index.d.ts +12 -10
- package/compiled/http-proxy-middleware/package.json +1 -1
- package/compiled/tinypool/dist/index.js +5 -3
- package/compiled/watchpack/index.js +459 -60
- package/compiled/watchpack/package.json +1 -1
- package/compiled/watchpack/types/DirectoryWatcher.d.ts +24 -0
- package/compiled/watchpack/types/index.d.ts +1 -1
- package/compiled/watchpack/types/watchEventSource.d.ts +9 -0
- package/compiled/webpack-sources/index.d.ts +2 -0
- package/compiled/webpack-sources/index.js +207 -94
- package/compiled/webpack-sources/package.json +1 -1
- package/compiled/webpack-sources/types/RawSource.d.ts +0 -10
- package/compiled/webpack-sources/types/helpers/sourceMap.d.ts +47 -0
- package/compiled/webpack-sources/types/index.d.ts +1 -0
- package/dist/BuildInfo.d.ts +7 -0
- package/dist/Compilation.d.ts +3 -1
- package/dist/Compiler.d.ts +5 -6
- package/dist/ConcatenatedModule.d.ts +5 -1
- package/dist/ContextModule.d.ts +3 -1
- package/dist/ExternalModule.d.ts +7 -6
- package/dist/FileSystemInfo.d.ts +1 -0
- package/dist/Module.d.ts +12 -8
- package/dist/ModuleGraphConnection.d.ts +9 -3
- package/dist/NativeWatchFileSystem.d.ts +19 -7
- package/dist/NormalModule.d.ts +14 -6
- package/dist/RuntimeGlobals.d.ts +2 -1
- package/dist/RuntimeTemplate.d.ts +2 -0
- package/dist/Stats.d.ts +1 -1
- package/dist/builtin-loader/lightningcss/index.d.ts +5 -1
- package/dist/builtin-plugin/CompactHashedChunkIdsPlugin.d.ts +1 -0
- package/dist/builtin-plugin/CompactHashedModuleIdsPlugin.d.ts +1 -0
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +5 -0
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +3 -2
- package/dist/builtin-plugin/ImportedByDeferModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +1 -0
- package/dist/builtin-plugin/index.d.ts +1 -0
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +2 -2
- package/dist/config/adapterRuleUse.d.ts +1 -0
- package/dist/config/normalization.d.ts +2 -2
- package/dist/config/target.d.ts +6 -0
- package/dist/config/types.d.ts +69 -36
- package/dist/cssExtractHmr.js +1 -1
- package/dist/cssExtractLoader.js +1 -1
- package/dist/exports.d.ts +5 -4
- package/dist/index.js +1577 -1151
- package/dist/loader-runner/codeFilter.d.ts +9 -0
- package/dist/loader-runner/dependencies.d.ts +1 -1
- package/dist/loader-runner/index.d.ts +2 -1
- package/dist/loader-runner/service.d.ts +0 -4
- package/dist/loader-runner/worker.d.ts +4 -1
- package/dist/node/NodeWatchFileSystem.d.ts +7 -4
- package/dist/sharing/IndependentSharedPlugin.d.ts +1 -2
- package/dist/sharing/utils.d.ts +1 -1
- package/dist/sources.d.ts +3 -0
- package/dist/stats/statsFactoryUtils.d.ts +7 -0
- package/dist/util/bindingHelpers.d.ts +2 -0
- package/dist/util/createModule.d.ts +3 -0
- package/dist/util/fs.d.ts +13 -7
- package/dist/util/resolveLayerExternals.d.ts +1 -0
- package/dist/util/source.d.ts +12 -3
- package/dist/util/symbols.d.ts +10 -0
- package/dist/util/watchTimeInfo.d.ts +5 -1
- package/dist/worker.js +327 -326
- package/hot/lazy-compilation-node.js +1 -1
- package/hot/lazy-compilation-web.js +1 -1
- package/package.json +4 -4
- package/dist/loader-runner/cache.d.ts +0 -27
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type LoaderCodeFilter = string | RegExp;
|
|
2
|
+
export interface CodeFilterTextCache {
|
|
3
|
+
initialized: boolean;
|
|
4
|
+
content?: unknown;
|
|
5
|
+
text?: string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function createCodeFilterTextCache(): CodeFilterTextCache;
|
|
8
|
+
export declare function invalidateCodeFilterTextCache(cache: CodeFilterTextCache): void;
|
|
9
|
+
export declare function matchesCodeFilter(filter: LoaderCodeFilter, content: unknown, cache: CodeFilterTextCache): boolean | undefined;
|
|
@@ -3,7 +3,7 @@ export type LoaderDependencies = JsLoaderContext['dependencies'];
|
|
|
3
3
|
export declare class LoaderDependenciesState {
|
|
4
4
|
#private;
|
|
5
5
|
readonly existing: LoaderDependencies;
|
|
6
|
-
constructor(existing: LoaderDependencies);
|
|
6
|
+
constructor(existing: LoaderDependencies, added?: LoaderDependencies, removed?: LoaderDependencies);
|
|
7
7
|
get added(): LoaderDependencies;
|
|
8
8
|
get removed(): LoaderDependencies;
|
|
9
9
|
resetChanges(): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type JsLoaderContext, type JsLoaderItem } from '@rspack/binding';
|
|
2
2
|
import type { Compiler } from '../Compiler.js';
|
|
3
|
+
import { createCodeFilterTextCache } from './codeFilter.js';
|
|
3
4
|
type LoaderObjectOptions = string | (object & {
|
|
4
5
|
ident?: unknown;
|
|
5
6
|
}) | null;
|
|
@@ -27,7 +28,7 @@ export declare class LoaderObject {
|
|
|
27
28
|
get normalExecuted(): boolean;
|
|
28
29
|
set normalExecuted(value: boolean);
|
|
29
30
|
set noPitch(value: boolean);
|
|
30
|
-
|
|
31
|
+
shouldSkipNormal(content: unknown, cache: ReturnType<typeof createCodeFilterTextCache>): boolean;
|
|
31
32
|
static __from_binding(loaderItem: JsLoaderItem, compiler: Compiler): LoaderObject;
|
|
32
33
|
static __to_binding(loader: LoaderObject): JsLoaderItem;
|
|
33
34
|
}
|
|
@@ -43,8 +43,6 @@ export declare enum RequestType {
|
|
|
43
43
|
GetContextDependencies = "GetContextDependencies",
|
|
44
44
|
GetMissingDependencies = "GetMissingDependencies",
|
|
45
45
|
ClearDependencies = "ClearDependencies",
|
|
46
|
-
BeginDependencyChanges = "BeginDependencyChanges",
|
|
47
|
-
MergeDependencyChanges = "MergeDependencyChanges",
|
|
48
46
|
Resolve = "Resolve",
|
|
49
47
|
GetResolve = "GetResolve",
|
|
50
48
|
GetLogger = "GetLogger",
|
|
@@ -56,8 +54,6 @@ export declare enum RequestType {
|
|
|
56
54
|
ImportModule = "ImportModule",
|
|
57
55
|
UpdateLoaderObjects = "UpdateLoaderObjects",
|
|
58
56
|
UpdateBuildInfo = "UpdateBuildInfo",
|
|
59
|
-
LoaderCacheGet = "LoaderCacheGet",
|
|
60
|
-
LoaderCacheStore = "LoaderCacheStore",
|
|
61
57
|
CompilationGetPath = "CompilationGetPath",
|
|
62
58
|
CompilationGetPathWithInfo = "CompilationGetPathWithInfo",
|
|
63
59
|
CompilationGetAssetPath = "CompilationGetAssetPath",
|
|
@@ -2,7 +2,10 @@ import { type MessagePort } from 'node:worker_threads';
|
|
|
2
2
|
import { JsLoaderState } from '@rspack/binding';
|
|
3
3
|
import type { LoaderContext } from '../config/index.js';
|
|
4
4
|
interface WorkerOptions {
|
|
5
|
-
loaderContext: LoaderContext
|
|
5
|
+
loaderContext: LoaderContext & {
|
|
6
|
+
loaderChainStart: number;
|
|
7
|
+
loaderChainEnd: number;
|
|
8
|
+
};
|
|
6
9
|
loaderState: JsLoaderState;
|
|
7
10
|
args: any[];
|
|
8
11
|
workerData?: {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
10
|
import type Watchpack from '../../compiled/watchpack/index.js';
|
|
11
|
-
import type {
|
|
11
|
+
import type { InputFileSystem, TimeInfoEntries, Watcher, WatchFileSystem } from '../util/fs.js';
|
|
12
12
|
type WatchpackInstance = InstanceType<typeof Watchpack>;
|
|
13
13
|
export default class NodeWatchFileSystem implements WatchFileSystem {
|
|
14
14
|
#private;
|
|
@@ -16,11 +16,14 @@ export default class NodeWatchFileSystem implements WatchFileSystem {
|
|
|
16
16
|
watcherOptions: Watchpack.WatchOptions;
|
|
17
17
|
watcher?: WatchpackInstance;
|
|
18
18
|
constructor(inputFileSystem: InputFileSystem);
|
|
19
|
-
watch(files: Iterable<string>, directories: Iterable<string>, missing: Iterable<string>, startTime: number, options: Watchpack.WatchOptions, callback: (error: Error | null, fileTimeInfoEntries:
|
|
20
|
-
|
|
19
|
+
watch(files: Iterable<string>, directories: Iterable<string>, missing: Iterable<string>, startTime: number, options: Watchpack.WatchOptions, callback: (error: Error | null, fileTimeInfoEntries: TimeInfoEntries, contextTimeInfoEntries: TimeInfoEntries, changedFiles: Set<string>, removedFiles: Set<string>) => void, callbackUndelayed: (fileName: string, changeTime: number) => void): Watcher;
|
|
20
|
+
getTimes(): Record<string, number | null>;
|
|
21
|
+
getTimeInfoEntries(): TimeInfoEntries;
|
|
22
|
+
collectTimeInfoEntries(fileTimestamps: TimeInfoEntries, directoryTimestamps: TimeInfoEntries): void;
|
|
23
|
+
on(event: 'change', listener: (filename: string, mtime: number | null) => void): this;
|
|
21
24
|
on(event: 'remove', listener: (filename: string) => void): this;
|
|
22
25
|
on(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
|
|
23
|
-
once(event: 'change', listener: (filename: string, mtime: number) => void): this;
|
|
26
|
+
once(event: 'change', listener: (filename: string, mtime: number | null) => void): this;
|
|
24
27
|
once(event: 'remove', listener: (filename: string) => void): this;
|
|
25
28
|
once(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
|
|
26
29
|
emit(event: 'change', filename: string, mtime: number): boolean;
|
|
@@ -31,7 +31,6 @@ export declare class IndependentSharedPlugin {
|
|
|
31
31
|
name: string;
|
|
32
32
|
constructor(options: IndependentSharePluginOptions);
|
|
33
33
|
apply(compiler: Compiler): void;
|
|
34
|
-
private
|
|
35
|
-
private createIndependentCompilers;
|
|
34
|
+
private prepareFallbackBuilds;
|
|
36
35
|
private createIndependentCompiler;
|
|
37
36
|
}
|
package/dist/sharing/utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function isRequiredVersion(str: string): boolean;
|
|
2
|
-
export declare
|
|
2
|
+
export declare function encodeName(...parts: string[]): string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { CachedSource, CompatSource, OriginalSource, PrefixSource, RawSource, SizeOnlySource, Source, SourceMapSource, util, } from '../compiled/webpack-sources/index.js';
|
|
2
|
+
export type * from '../compiled/webpack-sources/index.js';
|
|
3
|
+
export { RspackConcatSource as ConcatSource, RspackReplaceSource as ReplaceSource, } from './util/source.js';
|
|
@@ -229,6 +229,12 @@ export type KnownStatsChunkOrigin = {
|
|
|
229
229
|
moduleId?: string | number | null;
|
|
230
230
|
};
|
|
231
231
|
export type StatsChunkOrigin = KnownStatsChunkOrigin & Record<string, any>;
|
|
232
|
+
export type StatsCacheInfo = {
|
|
233
|
+
hits: number;
|
|
234
|
+
misses: number;
|
|
235
|
+
reused: number;
|
|
236
|
+
stores: number;
|
|
237
|
+
};
|
|
232
238
|
export type KnownStatsCompilation = {
|
|
233
239
|
/**
|
|
234
240
|
* webpack version.
|
|
@@ -239,6 +245,7 @@ export type KnownStatsCompilation = {
|
|
|
239
245
|
rspackVersion?: string;
|
|
240
246
|
name?: string;
|
|
241
247
|
hash?: string;
|
|
248
|
+
cacheInfo?: Record<string, StatsCacheInfo>;
|
|
242
249
|
env?: any;
|
|
243
250
|
time?: number;
|
|
244
251
|
builtAt?: number;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { createModule } from './createModule.js';
|
|
1
2
|
declare function applyIndexedArrayUpdates<T>(source: readonly T[], target: T[], commands: Uint32Array): void;
|
|
2
3
|
declare function swapRemoveArrayElements<T>(array: T[], removedIndices: Uint32Array): void;
|
|
3
4
|
export declare const bindingHelpers: {
|
|
5
|
+
createModule: typeof createModule;
|
|
4
6
|
applyIndexedArrayUpdates: typeof applyIndexedArrayUpdates;
|
|
5
7
|
swapRemoveArrayElements: typeof swapRemoveArrayElements;
|
|
6
8
|
};
|
package/dist/util/fs.d.ts
CHANGED
|
@@ -9,20 +9,22 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Abortable } from 'node:events';
|
|
11
11
|
import type { WatchOptions } from '../config/index.js';
|
|
12
|
+
export type ExistenceOnlyTimeEntry = Record<string, never>;
|
|
13
|
+
export type TimeInfoEntries = Map<string, FileSystemInfoEntry | ExistenceOnlyTimeEntry | 'ignore' | null>;
|
|
12
14
|
export interface Watcher {
|
|
13
15
|
close(): void;
|
|
14
16
|
pause(): void;
|
|
15
17
|
getAggregatedChanges?(): Set<string>;
|
|
16
18
|
getAggregatedRemovals?(): Set<string>;
|
|
17
|
-
getFileTimeInfoEntries?():
|
|
18
|
-
getContextTimeInfoEntries?():
|
|
19
|
+
getFileTimeInfoEntries?(): TimeInfoEntries;
|
|
20
|
+
getContextTimeInfoEntries?(): TimeInfoEntries;
|
|
19
21
|
getInfo(): WatcherInfo;
|
|
20
22
|
}
|
|
21
23
|
export interface WatcherInfo {
|
|
22
24
|
changes: Set<string>;
|
|
23
25
|
removals: Set<string>;
|
|
24
|
-
fileTimeInfoEntries:
|
|
25
|
-
contextTimeInfoEntries:
|
|
26
|
+
fileTimeInfoEntries: TimeInfoEntries;
|
|
27
|
+
contextTimeInfoEntries: TimeInfoEntries;
|
|
26
28
|
}
|
|
27
29
|
export type IStatsBase<T> = {
|
|
28
30
|
isFile: () => boolean;
|
|
@@ -351,6 +353,7 @@ export declare const mkdirp: (fs: OutputFileSystem, p: string, callback: (error?
|
|
|
351
353
|
export interface FileSystemInfoEntry {
|
|
352
354
|
safeTime: number;
|
|
353
355
|
timestamp?: number;
|
|
356
|
+
accuracy?: number;
|
|
354
357
|
}
|
|
355
358
|
export interface WatchFileSystem {
|
|
356
359
|
watch(files: Iterable<string> & {
|
|
@@ -362,11 +365,14 @@ export interface WatchFileSystem {
|
|
|
362
365
|
}, missing: Iterable<string> & {
|
|
363
366
|
added?: Iterable<String>;
|
|
364
367
|
removed?: Iterable<String>;
|
|
365
|
-
}, startTime: number, options: WatchOptions, callback: (error: Error | null, fileTimeInfoEntries:
|
|
366
|
-
|
|
368
|
+
}, startTime: number, options: WatchOptions, callback: (error: Error | null, fileTimeInfoEntries: TimeInfoEntries, contextTimeInfoEntries: TimeInfoEntries, changedFiles: Set<string>, removedFiles: Set<string>) => void, callbackUndelayed: (fileName: string, changeTime: number) => void): Watcher;
|
|
369
|
+
getTimes?(): Record<string, number | null>;
|
|
370
|
+
getTimeInfoEntries?(): TimeInfoEntries;
|
|
371
|
+
collectTimeInfoEntries?(fileTimestamps: TimeInfoEntries, directoryTimestamps: TimeInfoEntries): void;
|
|
372
|
+
on?(event: 'change', listener: (filename: string, mtime: number | null) => void): this;
|
|
367
373
|
on?(event: 'remove', listener: (filename: string) => void): this;
|
|
368
374
|
on?(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
|
|
369
|
-
once?(event: 'change', listener: (filename: string, mtime: number) => void): this;
|
|
375
|
+
once?(event: 'change', listener: (filename: string, mtime: number | null) => void): this;
|
|
370
376
|
once?(event: 'remove', listener: (filename: string) => void): this;
|
|
371
377
|
once?(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
|
|
372
378
|
emit?(event: 'change', filename: string, mtime: number): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const resolveLayerExternals: <T>(item: T, layer: string | null) => T;
|
package/dist/util/source.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import type { JsSource, JsSourceWithLazyMap } from '@rspack/binding';
|
|
1
|
+
import type { JsNativeSource, JsSource, JsSourceFromJs, JsSourceWithLazyMap } from '@rspack/binding';
|
|
2
|
+
import * as webpackSources from '../../compiled/webpack-sources/index.js';
|
|
2
3
|
import { type Source } from '../../compiled/webpack-sources/index.js';
|
|
4
|
+
declare const toBindingSource: unique symbol;
|
|
5
|
+
export declare class RspackConcatSource extends webpackSources.ConcatSource {
|
|
6
|
+
[toBindingSource](): JsSourceFromJs | null;
|
|
7
|
+
}
|
|
8
|
+
export declare class RspackReplaceSource extends webpackSources.ReplaceSource {
|
|
9
|
+
[toBindingSource](): JsSourceFromJs | null;
|
|
10
|
+
}
|
|
3
11
|
export declare class SourceAdapter {
|
|
4
|
-
static fromBinding(cache: JsSource | JsSourceWithLazyMap): Source;
|
|
5
|
-
static toBinding(source: Source):
|
|
12
|
+
static fromBinding(cache: JsSource | JsSourceWithLazyMap, nativeSource?: JsNativeSource | null): Source;
|
|
13
|
+
static toBinding(source: Source): JsSourceFromJs;
|
|
6
14
|
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const MODULE_BUILD_INFO_SYMBOL: unique symbol;
|
|
2
|
+
export declare const COMPILATION_HOOKS_MAP_SYMBOL: unique symbol;
|
|
3
|
+
export declare const BUILD_INFO_ASSETS_SYMBOL: unique symbol;
|
|
4
|
+
export declare const BUILD_INFO_FILE_DEPENDENCIES_SYMBOL: unique symbol;
|
|
5
|
+
export declare const BUILD_INFO_CONTEXT_DEPENDENCIES_SYMBOL: unique symbol;
|
|
6
|
+
export declare const BUILD_INFO_MISSING_DEPENDENCIES_SYMBOL: unique symbol;
|
|
7
|
+
export declare const BUILD_INFO_BUILD_DEPENDENCIES_SYMBOL: unique symbol;
|
|
8
|
+
export declare const COMMIT_CUSTOM_FIELDS_SYMBOL: unique symbol;
|
|
9
|
+
export declare const CIRCULAR_CONNECTION_SYMBOL: unique symbol;
|
|
10
|
+
export declare const TRANSITIVE_ONLY_SYMBOL: unique symbol;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import type { WatchFileSystem } from './fs.js';
|
|
1
|
+
import type { Watcher, WatchFileSystem, WatcherInfo } from './fs.js';
|
|
2
2
|
type WatchCallback = Parameters<WatchFileSystem['watch']>[5];
|
|
3
3
|
type WatchCallbackArgs = Parameters<WatchCallback>;
|
|
4
4
|
type OptionalTimeInfoWatchCallback = (error: WatchCallbackArgs[0], fileTimeInfoEntries: WatchCallbackArgs[1] | undefined, contextTimeInfoEntries: WatchCallbackArgs[2] | undefined, changedFiles: WatchCallbackArgs[3], removedFiles: WatchCallbackArgs[4]) => void;
|
|
5
5
|
export declare function markInternalCallback(callback: OptionalTimeInfoWatchCallback): OptionalTimeInfoWatchCallback;
|
|
6
|
+
export declare const consumeWatcherInfo: unique symbol;
|
|
7
|
+
export type ConsumableWatcher = Watcher & {
|
|
8
|
+
[consumeWatcherInfo]?: () => WatcherInfo;
|
|
9
|
+
};
|
|
6
10
|
export declare function isInternalCallback(callback: WatchCallback): callback is OptionalTimeInfoWatchCallback;
|
|
7
11
|
export {};
|