@rspack-debug/core 2.0.0-beta.1 → 2.0.0-beta.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.
@@ -0,0 +1,175 @@
1
+ type FixedSizeArray<T extends number, U> = T extends 0 ? undefined[] : ReadonlyArray<U> & {
2
+ 0: U;
3
+ length: T;
4
+ };
5
+ type Measure<T extends number> = T extends 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 ? T : never;
6
+ type Append<T extends any[], U> = {
7
+ 0: [U];
8
+ 1: [T[0], U];
9
+ 2: [T[0], T[1], U];
10
+ 3: [T[0], T[1], T[2], U];
11
+ 4: [T[0], T[1], T[2], T[3], U];
12
+ 5: [T[0], T[1], T[2], T[3], T[4], U];
13
+ 6: [T[0], T[1], T[2], T[3], T[4], T[5], U];
14
+ 7: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], U];
15
+ 8: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], U];
16
+ }[Measure<T['length']>];
17
+ export type AsArray<T> = T extends any[] ? T : [T];
18
+ export type Fn<T, R> = (...args: AsArray<T>) => R;
19
+ export type FnAsync<T, R> = (...args: Append<AsArray<T>, InnerCallback<Error, R>>) => void;
20
+ export type FnPromise<T, R> = (...args: AsArray<T>) => Promise<R>;
21
+ declare class UnsetAdditionalOptions {
22
+ _UnsetAdditionalOptions: true;
23
+ }
24
+ type IfSet<X> = X extends UnsetAdditionalOptions ? {} : X;
25
+ export type Callback<E, T> = (error: E | null, result?: T) => void;
26
+ type InnerCallback<E, T> = (error?: E | null | false, result?: T) => void;
27
+ type FullTap = Tap & {
28
+ type: 'sync' | 'async' | 'promise';
29
+ fn: Function;
30
+ };
31
+ type Tap = TapOptions & {
32
+ name: string;
33
+ };
34
+ type TapOptions = {
35
+ before?: string;
36
+ stage?: number;
37
+ };
38
+ export type Options<AdditionalOptions = UnsetAdditionalOptions> = string | (Tap & IfSet<AdditionalOptions>);
39
+ export interface HookInterceptor<T, R, AdditionalOptions = UnsetAdditionalOptions> {
40
+ name?: string;
41
+ tap?: (tap: FullTap & IfSet<AdditionalOptions>) => void;
42
+ call?: (...args: any[]) => void;
43
+ loop?: (...args: any[]) => void;
44
+ error?: (err: Error) => void;
45
+ result?: (result: R) => void;
46
+ done?: () => void;
47
+ register?: (tap: FullTap & IfSet<AdditionalOptions>) => FullTap & IfSet<AdditionalOptions>;
48
+ }
49
+ type ArgumentNames<T extends any[]> = FixedSizeArray<T['length'], string>;
50
+ type ExtractHookArgs<H> = H extends Hook<infer T, any> ? T : never;
51
+ type ExtractHookReturn<H> = H extends Hook<any, infer R> ? R : never;
52
+ type ExtractHookAdditionalOptions<H> = H extends Hook<any, any, infer A> ? A : never;
53
+ export interface Hook<T = any, R = any, AdditionalOptions = UnsetAdditionalOptions> {
54
+ name?: string;
55
+ tap(opt: Options<AdditionalOptions>, fn: Fn<T, R>): void;
56
+ tapAsync(opt: Options<AdditionalOptions>, fn: FnAsync<T, R>): void;
57
+ tapPromise(opt: Options<AdditionalOptions>, fn: FnPromise<T, R>): void;
58
+ intercept(interceptor: HookInterceptor<T, R, AdditionalOptions>): void;
59
+ isUsed(): boolean;
60
+ withOptions(opt: TapOptions & IfSet<AdditionalOptions>): Hook<T, R, AdditionalOptions>;
61
+ queryStageRange(stageRange: StageRange): QueriedHook<T, R, AdditionalOptions>;
62
+ }
63
+ export declare class HookBase<T, R, AdditionalOptions = UnsetAdditionalOptions> implements Hook<T, R, AdditionalOptions> {
64
+ args: ArgumentNames<AsArray<T>>;
65
+ name?: string;
66
+ taps: (FullTap & IfSet<AdditionalOptions>)[];
67
+ interceptors: HookInterceptor<T, R, AdditionalOptions>[];
68
+ constructor(args?: ArgumentNames<AsArray<T>>, name?: string);
69
+ intercept(interceptor: HookInterceptor<T, R, AdditionalOptions>): void;
70
+ _runRegisterInterceptors(options: FullTap & IfSet<AdditionalOptions>): FullTap & IfSet<AdditionalOptions>;
71
+ _runCallInterceptors(...args: any[]): void;
72
+ _runErrorInterceptors(e: Error): void;
73
+ _runTapInterceptors(tap: FullTap & IfSet<AdditionalOptions>): void;
74
+ _runDoneInterceptors(): void;
75
+ _runResultInterceptors(r: R): void;
76
+ withOptions(options: TapOptions & IfSet<AdditionalOptions>): Hook<T, R, AdditionalOptions>;
77
+ isUsed(): boolean;
78
+ queryStageRange(stageRange: StageRange): QueriedHook<T, R, AdditionalOptions>;
79
+ callAsyncStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, R>>): void;
80
+ callAsync(...args: Append<AsArray<T>, Callback<Error, R>>): void;
81
+ promiseStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: AsArray<T>): Promise<R>;
82
+ promise(...args: AsArray<T>): Promise<R>;
83
+ tap(options: Options<AdditionalOptions>, fn: Fn<T, R>): void;
84
+ tapAsync(options: Options<AdditionalOptions>, fn: FnAsync<T, R>): void;
85
+ tapPromise(options: Options<AdditionalOptions>, fn: FnPromise<T, R>): void;
86
+ _tap(type: 'sync' | 'async' | 'promise', options: Options<AdditionalOptions>, fn: Function): void;
87
+ _insert(item: FullTap & IfSet<AdditionalOptions>): void;
88
+ _prepareArgs(args: AsArray<T>): (T | undefined)[];
89
+ }
90
+ export type StageRange = readonly [number, number];
91
+ export declare const minStage: number;
92
+ export declare const maxStage: number;
93
+ export declare const safeStage: (stage: number) => number;
94
+ export declare class QueriedHook<T, R, AdditionalOptions = UnsetAdditionalOptions> {
95
+ stageRange: StageRange;
96
+ hook: HookBase<T, R, AdditionalOptions>;
97
+ tapsInRange: (FullTap & IfSet<AdditionalOptions>)[];
98
+ constructor(stageRange: StageRange, hook: HookBase<T, R, AdditionalOptions>);
99
+ isUsed(): boolean;
100
+ call(...args: AsArray<T>): R;
101
+ callAsync(...args: Append<AsArray<T>, Callback<Error, R>>): void;
102
+ promise(...args: AsArray<T>): Promise<R>;
103
+ }
104
+ export declare class SyncHook<T, R = void, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, R, AdditionalOptions> {
105
+ callAsyncStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, R>>): void;
106
+ call(...args: AsArray<T>): R;
107
+ callStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: AsArray<T>): R;
108
+ tapAsync(): never;
109
+ tapPromise(): never;
110
+ }
111
+ export declare class SyncBailHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, R, AdditionalOptions> {
112
+ callAsyncStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, R>>): void;
113
+ call(...args: AsArray<T>): R;
114
+ callStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: AsArray<T>): R;
115
+ tapAsync(): never;
116
+ tapPromise(): never;
117
+ }
118
+ export declare class SyncWaterfallHook<T, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, AsArray<T>[0], AdditionalOptions> {
119
+ constructor(args?: ArgumentNames<AsArray<T>>, name?: string);
120
+ callAsyncStageRange(queried: QueriedHook<T, AsArray<T>[0], AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, AsArray<T>[0]>>): void;
121
+ call(...args: AsArray<T>): AsArray<T>[0];
122
+ callStageRange(queried: QueriedHook<T, AsArray<T>[0], AdditionalOptions>, ...args: AsArray<T>): AsArray<T>[0];
123
+ tapAsync(): never;
124
+ tapPromise(): never;
125
+ }
126
+ export declare class AsyncParallelHook<T, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, void, AdditionalOptions> {
127
+ callAsyncStageRange(queried: QueriedHook<T, void, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, void>>): void;
128
+ }
129
+ export declare class AsyncSeriesHook<T, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, void, AdditionalOptions> {
130
+ callAsyncStageRange(queried: QueriedHook<T, void, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, void>>): void;
131
+ }
132
+ export declare class AsyncSeriesBailHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, R, AdditionalOptions> {
133
+ callAsyncStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, R>>): void;
134
+ }
135
+ export declare class AsyncSeriesWaterfallHook<T, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, AsArray<T>[0], AdditionalOptions> {
136
+ constructor(args?: ArgumentNames<AsArray<T>>, name?: string);
137
+ callAsyncStageRange(queried: QueriedHook<T, AsArray<T>[0], AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, AsArray<T>[0]>>): void;
138
+ }
139
+ export type HookMapKey = any;
140
+ export type HookFactory<H> = (key: HookMapKey, hook?: H) => H;
141
+ export interface HookMapInterceptor<H> {
142
+ factory?: HookFactory<H>;
143
+ }
144
+ export declare class HookMap<H extends Hook> {
145
+ _map: Map<HookMapKey, H>;
146
+ _factory: HookFactory<H>;
147
+ name?: string;
148
+ _interceptors: HookMapInterceptor<H>[];
149
+ constructor(factory: HookFactory<H>, name?: string);
150
+ get(key: HookMapKey): H | undefined;
151
+ for(key: HookMapKey): H;
152
+ intercept(interceptor: HookMapInterceptor<H>): void;
153
+ isUsed(): boolean;
154
+ queryStageRange(stageRange: StageRange): QueriedHookMap<H>;
155
+ }
156
+ export declare class QueriedHookMap<H extends Hook> {
157
+ stageRange: StageRange;
158
+ hookMap: HookMap<H>;
159
+ constructor(stageRange: StageRange, hookMap: HookMap<H>);
160
+ get(key: HookMapKey): QueriedHook<any, any, UnsetAdditionalOptions> | undefined;
161
+ for(key: HookMapKey): QueriedHook<any, any, UnsetAdditionalOptions>;
162
+ isUsed(): boolean;
163
+ }
164
+ export declare class MultiHook<H extends Hook> {
165
+ hooks: H[];
166
+ name?: string;
167
+ constructor(hooks: H[], name?: string);
168
+ tap(options: Options<ExtractHookAdditionalOptions<Hook>>, fn: Fn<ExtractHookArgs<Hook>, ExtractHookReturn<Hook>>): void;
169
+ tapAsync(options: Options<ExtractHookAdditionalOptions<Hook>>, fn: FnAsync<ExtractHookArgs<Hook>, ExtractHookReturn<Hook>>): void;
170
+ tapPromise(options: Options<ExtractHookAdditionalOptions<Hook>>, fn: FnPromise<ExtractHookArgs<Hook>, ExtractHookReturn<Hook>>): void;
171
+ isUsed(): boolean;
172
+ intercept(interceptor: HookInterceptor<ExtractHookArgs<Hook>, ExtractHookReturn<Hook>, ExtractHookAdditionalOptions<Hook>>): void;
173
+ withOptions(options: TapOptions & IfSet<ExtractHookAdditionalOptions<Hook>>): MultiHook<Hook<any, any, UnsetAdditionalOptions>>;
174
+ }
175
+ export {};
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022-present Bytedance, Inc. and its affiliates.
4
+
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ {"name":"@rspack/lite-tapable","version":"1.1.0","license":"MIT","types":"./dist/index.d.ts","type":"module"}
@@ -10,7 +10,7 @@
10
10
  import type { AssetInfo, ChunkGroup, Dependency, ExternalObject, JsCompilation } from '@rspack/binding';
11
11
  import binding from '@rspack/binding';
12
12
  export type { AssetInfo } from '@rspack/binding';
13
- import * as liteTapable from '@rspack/lite-tapable';
13
+ import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d';
14
14
  import type { Source } from '../compiled/webpack-sources';
15
15
  import type { EntryOptions, EntryPlugin } from './builtin-plugin/index.js';
16
16
  import type { Chunk } from './Chunk.js';
@@ -8,7 +8,7 @@
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
10
  import type binding from '@rspack/binding';
11
- import * as liteTapable from '@rspack/lite-tapable';
11
+ import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d';
12
12
  import type Watchpack from '../compiled/watchpack';
13
13
  import type { Source } from '../compiled/webpack-sources';
14
14
  import type { Chunk } from './Chunk.js';
@@ -1,4 +1,4 @@
1
- import * as liteTapable from '@rspack/lite-tapable';
1
+ import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d';
2
2
  import type { ContextModuleFactoryAfterResolveResult, ContextModuleFactoryBeforeResolveResult } from './Module.js';
3
3
  export declare class ContextModuleFactory {
4
4
  hooks: {
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import * as liteTapable from '@rspack/lite-tapable';
10
+ import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d';
11
11
  import type { CompilationParams, Compiler, CompilerHooks, RspackOptions } from './index.js';
12
12
  import type { WatchOptions } from './config/index.js';
13
13
  import MultiStats from './MultiStats.js';
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type { Callback } from '@rspack/lite-tapable';
10
+ import type { Callback } from '../compiled/@rspack/lite-tapable/dist/index.d';
11
11
  import type { MultiCompiler } from './MultiCompiler.js';
12
12
  import type { Watching } from './Watching.js';
13
13
  declare class MultiWatching {
@@ -1,10 +1,9 @@
1
- import * as liteTapable from '@rspack/lite-tapable';
1
+ import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d';
2
2
  import type { Compilation } from './Compilation.js';
3
3
  import type { LoaderContext } from './config/index.js';
4
4
  import type { Module } from './Module.js';
5
5
  export interface NormalModuleCompilationHooks {
6
6
  loader: liteTapable.SyncHook<[LoaderContext, Module]>;
7
- readResourceForScheme: any;
8
7
  readResource: liteTapable.HookMap<liteTapable.AsyncSeriesBailHook<[LoaderContext], string | Buffer>>;
9
8
  }
10
9
  declare module '@rspack/binding' {
@@ -1,5 +1,5 @@
1
1
  import type binding from '@rspack/binding';
2
- import * as liteTapable from '@rspack/lite-tapable';
2
+ import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.d';
3
3
  import type { ResolveData, ResourceDataWithData } from './Module.js';
4
4
  import type { ResolveOptionsWithDependencyType, ResolverFactory } from './ResolverFactory.js';
5
5
  export type NormalModuleCreateData = binding.JsNormalModuleFactoryCreateModuleArgs & {
@@ -352,5 +352,5 @@ export declare enum RuntimeVariable {
352
352
  }
353
353
  export declare function renderRuntimeVariables(variable: RuntimeVariable, _compilerOptions?: RspackOptionsNormalized): string;
354
354
  export declare function createCompilerRuntimeGlobals(compilerOptions?: RspackOptionsNormalized): Record<keyof typeof RuntimeGlobals, string>;
355
- declare const DefaultRuntimeGlobals: Record<"publicPath" | "chunkName" | "moduleId" | "module" | "require" | "global" | "system" | "exports" | "requireScope" | "thisAsExports" | "returnExportsFromRuntime" | "moduleLoaded" | "entryModuleId" | "moduleCache" | "moduleFactories" | "moduleFactoriesAddOnly" | "ensureChunk" | "ensureChunkHandlers" | "ensureChunkIncludeEntries" | "prefetchChunk" | "prefetchChunkHandlers" | "preloadChunk" | "preloadChunkHandlers" | "definePropertyGetters" | "makeNamespaceObject" | "createFakeNamespaceObject" | "compatGetDefaultExport" | "harmonyModuleDecorator" | "nodeModuleDecorator" | "getFullHash" | "wasmInstances" | "instantiateWasm" | "uncaughtErrorHandler" | "scriptNonce" | "loadScript" | "createScript" | "createScriptUrl" | "getTrustedTypesPolicy" | "hasFetchPriority" | "runtimeId" | "getChunkScriptFilename" | "getChunkCssFilename" | "rspackVersion" | "hasCssModules" | "rspackUniqueId" | "getChunkUpdateScriptFilename" | "getChunkUpdateCssFilename" | "startup" | "startupNoDefault" | "startupOnlyAfter" | "startupOnlyBefore" | "chunkCallback" | "startupEntrypoint" | "startupChunkDependencies" | "onChunksLoaded" | "externalInstallChunk" | "interceptModuleExecution" | "shareScopeMap" | "initializeSharing" | "currentRemoteGetScope" | "getUpdateManifestFilename" | "hmrDownloadManifest" | "hmrDownloadUpdateHandlers" | "hmrModuleData" | "hmrInvalidateModuleHandlers" | "hmrRuntimeStatePrefix" | "amdDefine" | "amdOptions" | "hasOwnProperty" | "systemContext" | "baseURI" | "relativeUrl" | "asyncModule" | "asyncModuleExportSymbol" | "makeDeferredNamespaceObject" | "makeDeferredNamespaceObjectSymbol", string>;
355
+ declare const DefaultRuntimeGlobals: Record<"publicPath" | "chunkName" | "moduleId" | "module" | "exports" | "require" | "global" | "system" | "requireScope" | "thisAsExports" | "returnExportsFromRuntime" | "moduleLoaded" | "entryModuleId" | "moduleCache" | "moduleFactories" | "moduleFactoriesAddOnly" | "ensureChunk" | "ensureChunkHandlers" | "ensureChunkIncludeEntries" | "prefetchChunk" | "prefetchChunkHandlers" | "preloadChunk" | "preloadChunkHandlers" | "definePropertyGetters" | "makeNamespaceObject" | "createFakeNamespaceObject" | "compatGetDefaultExport" | "harmonyModuleDecorator" | "nodeModuleDecorator" | "getFullHash" | "wasmInstances" | "instantiateWasm" | "uncaughtErrorHandler" | "scriptNonce" | "loadScript" | "createScript" | "createScriptUrl" | "getTrustedTypesPolicy" | "hasFetchPriority" | "runtimeId" | "getChunkScriptFilename" | "getChunkCssFilename" | "rspackVersion" | "hasCssModules" | "rspackUniqueId" | "getChunkUpdateScriptFilename" | "getChunkUpdateCssFilename" | "startup" | "startupNoDefault" | "startupOnlyAfter" | "startupOnlyBefore" | "chunkCallback" | "startupEntrypoint" | "startupChunkDependencies" | "onChunksLoaded" | "externalInstallChunk" | "interceptModuleExecution" | "shareScopeMap" | "initializeSharing" | "currentRemoteGetScope" | "getUpdateManifestFilename" | "hmrDownloadManifest" | "hmrDownloadUpdateHandlers" | "hmrModuleData" | "hmrInvalidateModuleHandlers" | "hmrRuntimeStatePrefix" | "amdDefine" | "amdOptions" | "hasOwnProperty" | "systemContext" | "baseURI" | "relativeUrl" | "asyncModule" | "asyncModuleExportSymbol" | "makeDeferredNamespaceObject" | "makeDeferredNamespaceObjectSymbol", string>;
356
356
  export { DefaultRuntimeGlobals as RuntimeGlobals };
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type { Callback } from '@rspack/lite-tapable';
10
+ import type { Callback } from '../compiled/@rspack/lite-tapable/dist/index.d';
11
11
  import type { Compiler } from './index.js';
12
12
  import { Stats } from './index.js';
13
13
  import type { WatchOptions } from './config/index.js';
@@ -1,5 +1,5 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
- import * as liteTapable from '@rspack/lite-tapable';
2
+ import * as liteTapable from '../../compiled/@rspack/lite-tapable/dist/index.d';
3
3
  import type { Chunk } from '../Chunk.js';
4
4
  import { type Compilation } from '../Compilation.js';
5
5
  import type Hash from '../util/hash/index.js';
@@ -1,5 +1,5 @@
1
1
  import { type JsRsdoctorAsset, type JsRsdoctorAssetPatch, type JsRsdoctorChunk, type JsRsdoctorChunkAssets, type JsRsdoctorChunkGraph, type JsRsdoctorChunkModules, type JsRsdoctorDependency, type JsRsdoctorEntrypoint, type JsRsdoctorEntrypointAssets, type JsRsdoctorExportInfo, type JsRsdoctorModule, type JsRsdoctorModuleGraph, type JsRsdoctorModuleGraphModule, type JsRsdoctorModuleIdsPatch, type JsRsdoctorModuleOriginalSource, type JsRsdoctorModuleSourcesPatch, type JsRsdoctorSideEffect, type JsRsdoctorSourcePosition, type JsRsdoctorSourceRange, type JsRsdoctorStatement, type JsRsdoctorVariable } from '@rspack/binding';
2
- import * as liteTapable from '@rspack/lite-tapable';
2
+ import * as liteTapable from '../../compiled/@rspack/lite-tapable/dist/index.d';
3
3
  import { type Compilation } from '../Compilation.js';
4
4
  import type { Compiler } from '../Compiler.js';
5
5
  import type { CreatePartialRegisters } from '../taps/types.js';
@@ -1,5 +1,5 @@
1
1
  import binding from '@rspack/binding';
2
- import * as liteTapable from '@rspack/lite-tapable';
2
+ import * as liteTapable from '../../compiled/@rspack/lite-tapable/dist/index.d';
3
3
  import type { Chunk } from '../Chunk.js';
4
4
  import { type Compilation } from '../Compilation.js';
5
5
  import type { CreatePartialRegisters } from '../taps/types.js';
@@ -1,5 +1,5 @@
1
1
  import type { JsAfterEmitData, JsAfterTemplateExecutionData, JsAlterAssetTagGroupsData, JsAlterAssetTagsData, JsBeforeAssetTagGenerationData, JsBeforeEmitData } from '@rspack/binding';
2
- import * as liteTapable from '@rspack/lite-tapable';
2
+ import * as liteTapable from '../../../compiled/@rspack/lite-tapable/dist/index.d';
3
3
  import { type Compilation } from '../../Compilation.js';
4
4
  import type { HtmlRspackPluginOptions } from './options.js';
5
5
  type ExtraPluginHookData = {
package/dist/index.js CHANGED
@@ -2713,11 +2713,7 @@ function stringifyLoaderObject(o) {
2713
2713
  let unsupported = (name, issue)=>{
2714
2714
  let s = `${name} is not supported by Rspack.`;
2715
2715
  throw issue && (s += ` Refer to issue ${issue} for more information.`), Error(s);
2716
- }, warnedMessages = new Set();
2717
- function deprecate(message) {
2718
- warnedMessages.has(message) || (warnedMessages.add(message), console.warn(`[Rspack Deprecation] ${message}`));
2719
- }
2720
- let WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>'' === relativePath ? './.' : '..' === relativePath ? '../.' : relativePath.startsWith('../') ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
2716
+ }, warnedMessages = new Set(), WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>'' === relativePath ? './.' : '..' === relativePath ? '../.' : relativePath.startsWith('../') ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
2721
2717
  if ('/' === maybeAbsolutePath[0]) {
2722
2718
  if (maybeAbsolutePath.length > 1 && '/' === maybeAbsolutePath[maybeAbsolutePath.length - 1]) return maybeAbsolutePath;
2723
2719
  let querySplitPos = maybeAbsolutePath.indexOf('?'), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
@@ -2906,12 +2902,6 @@ function toFeatures(featureOptions) {
2906
2902
  }
2907
2903
  return feature;
2908
2904
  }
2909
- function resolveCollectTypeScriptInfo(options) {
2910
- return {
2911
- typeExports: options.typeExports,
2912
- exportedEnum: !0 === options.exportedEnum ? 'all' : !1 === options.exportedEnum || void 0 === options.exportedEnum ? 'none' : 'const-only'
2913
- };
2914
- }
2915
2905
  let $assets = Symbol('assets');
2916
2906
  Object.defineProperty(binding_default().KnownBuildInfo.prototype, node_util.inspect.custom, {
2917
2907
  enumerable: !0,
@@ -2995,8 +2985,7 @@ Object.defineProperty(binding_default().NormalModule.prototype, 'identifier', {
2995
2985
  value (filename, source, assetInfo) {
2996
2986
  return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
2997
2987
  }
2998
- });
2999
- Object.defineProperty(binding_default().NormalModule, 'getCompilationHooks', {
2988
+ }), Object.defineProperty(binding_default().NormalModule, 'getCompilationHooks', {
3000
2989
  enumerable: !0,
3001
2990
  configurable: !0,
3002
2991
  value (compilation) {
@@ -3007,40 +2996,6 @@ Object.defineProperty(binding_default().NormalModule, 'getCompilationHooks', {
3007
2996
  'loaderContext',
3008
2997
  'module'
3009
2998
  ]),
3010
- readResourceForScheme: new HookMap((scheme)=>{
3011
- let fakeHook, message, code, hook = hooks.readResource.for(scheme);
3012
- return fakeHook = {
3013
- tap: (options, fn)=>hook.tap(options, (loaderContext)=>fn(loaderContext.resource)),
3014
- tapAsync: (options, fn)=>hook.tapAsync(options, (loaderContext, callback)=>fn(loaderContext.resource, callback)),
3015
- tapPromise: (options, fn)=>hook.tapPromise(options, (loaderContext)=>fn(loaderContext.resource))
3016
- }, Object.freeze(Object.assign(message && code ? ((obj, message, code)=>{
3017
- let newObj = {}, descriptors = Object.getOwnPropertyDescriptors(obj);
3018
- for (let name of Object.keys(descriptors)){
3019
- let descriptor = descriptors[name];
3020
- if ('function' == typeof descriptor.value) Object.defineProperty(newObj, name, {
3021
- ...descriptor,
3022
- value: node_util.deprecate(descriptor.value, message, code)
3023
- });
3024
- else if (descriptor.get || descriptor.set) Object.defineProperty(newObj, name, {
3025
- ...descriptor,
3026
- get: descriptor.get && node_util.deprecate(descriptor.get, message, code),
3027
- set: descriptor.set && node_util.deprecate(descriptor.set, message, code)
3028
- });
3029
- else {
3030
- let value = descriptor.value;
3031
- Object.defineProperty(newObj, name, {
3032
- configurable: descriptor.configurable,
3033
- enumerable: descriptor.enumerable,
3034
- get: node_util.deprecate(()=>value, message, code),
3035
- set: descriptor.writable ? node_util.deprecate((v)=>value = v, message, code) : void 0
3036
- });
3037
- }
3038
- }
3039
- return newObj;
3040
- })(fakeHook, message, code) : fakeHook, {
3041
- _fakeHook: !0
3042
- }));
3043
- }),
3044
2999
  readResource: new HookMap(()=>new AsyncSeriesBailHook([
3045
3000
  'loaderContext'
3046
3001
  ]))
@@ -4115,6 +4070,7 @@ function createRawModuleRuleUses(uses, path, options) {
4115
4070
  if (identifier.startsWith(`${BUILTIN_LOADER_PREFIX}swc-loader`)) return ((o, composeOptions)=>{
4116
4071
  let options = o ?? {};
4117
4072
  if ('object' == typeof options) {
4073
+ var options1;
4118
4074
  if (options.jsc ??= {}, options.jsc.experimental ??= {}, options.jsc.experimental.disableAllLints ??= !0, options.env?.targets === void 0 && options.jsc?.target === void 0) {
4119
4075
  if (composeOptions.compiler.target?.targets) options.env ??= {}, options.env.targets ??= function(targets) {
4120
4076
  let REMAP = {
@@ -4141,9 +4097,12 @@ function createRawModuleRuleUses(uses, path, options) {
4141
4097
  options.jsc.target ??= esVersion >= 2015 ? `es${esVersion}` : 'es5';
4142
4098
  }
4143
4099
  }
4144
- options.collectTypeScriptInfo && (options.collectTypeScriptInfo = resolveCollectTypeScriptInfo(options.collectTypeScriptInfo));
4100
+ options.collectTypeScriptInfo && (options.collectTypeScriptInfo = {
4101
+ typeExports: (options1 = options.collectTypeScriptInfo).typeExports,
4102
+ exportedEnum: !0 === options1.exportedEnum ? 'all' : !1 === options1.exportedEnum || void 0 === options1.exportedEnum ? 'none' : 'const-only'
4103
+ });
4145
4104
  let { rspackExperiments } = options;
4146
- rspackExperiments && ((rspackExperiments.import || rspackExperiments.pluginImport) && (rspackExperiments.import = function(pluginImport) {
4105
+ rspackExperiments && (rspackExperiments.import || rspackExperiments.pluginImport) && (rspackExperiments.import = function(pluginImport) {
4147
4106
  if (pluginImport) return pluginImport.map((config)=>{
4148
4107
  let rawConfig = {
4149
4108
  ...config,
@@ -4161,7 +4120,7 @@ function createRawModuleRuleUses(uses, path, options) {
4161
4120
  styleLibraryDirectory: config.styleLibraryDirectory
4162
4121
  }), rawConfig;
4163
4122
  });
4164
- }(rspackExperiments.import || rspackExperiments.pluginImport)), rspackExperiments.collectTypeScriptInfo && (deprecate('`rspackExperiments.collectTypeScriptInfo` is deprecated and will be removed in Rspack v2.0. Use top-level `collectTypeScriptInfo` instead.'), options.collectTypeScriptInfo || (options.collectTypeScriptInfo = resolveCollectTypeScriptInfo(rspackExperiments.collectTypeScriptInfo)), delete rspackExperiments.collectTypeScriptInfo));
4123
+ }(rspackExperiments.import || rspackExperiments.pluginImport));
4165
4124
  }
4166
4125
  return options;
4167
4126
  })(o, options);
@@ -6825,7 +6784,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6825
6784
  return output.wasmLoading && enabledWasmLoadingTypes.add(output.wasmLoading), output.workerWasmLoading && enabledWasmLoadingTypes.add(output.workerWasmLoading), forEachEntry((desc)=>{
6826
6785
  desc.wasmLoading && enabledWasmLoadingTypes.add(desc.wasmLoading);
6827
6786
  }), Array.from(enabledWasmLoadingTypes);
6828
- }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.0-beta.1"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !output.library));
6787
+ }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.0-beta.2"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !output.library));
6829
6788
  }, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp, outputModule })=>{
6830
6789
  let isUniversal = (key)=>!!(outputModule && targetProperties && null === targetProperties[key]);
6831
6790
  D(externalsPresets, 'web', !buildHttp && targetProperties && (targetProperties.web || isUniversal('node'))), D(externalsPresets, 'node', targetProperties && (targetProperties.node || isUniversal('node'))), D(externalsPresets, 'electron', targetProperties && targetProperties.electron || isUniversal('electron')), D(externalsPresets, 'electronMain', targetProperties && !!targetProperties.electron && (targetProperties.electronMain || isUniversal('electronMain'))), D(externalsPresets, 'electronPreload', targetProperties && !!targetProperties.electron && (targetProperties.electronPreload || isUniversal('electronPreload'))), D(externalsPresets, 'electronRenderer', targetProperties && !!targetProperties.electron && (targetProperties.electronRenderer || isUniversal('electronRenderer'))), D(externalsPresets, 'nwjs', targetProperties && (targetProperties.nwjs || isUniversal('nwjs')));
@@ -8078,7 +8037,7 @@ class MultiStats {
8078
8037
  obj.children = this.stats.map((stat, idx)=>{
8079
8038
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
8080
8039
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
8081
- }), childOptions.version && (obj.rspackVersion = "2.0.0-beta.1", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
8040
+ }), childOptions.version && (obj.rspackVersion = "2.0.0-beta.2", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
8082
8041
  let mapError = (j, obj)=>({
8083
8042
  ...obj,
8084
8043
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -9337,7 +9296,7 @@ let iterateConfig = (config, options, fn)=>{
9337
9296
  object.hash = context.getStatsCompilation(compilation).hash;
9338
9297
  },
9339
9298
  version: (object)=>{
9340
- object.version = "5.75.0", object.rspackVersion = "2.0.0-beta.1";
9299
+ object.version = "5.75.0", object.rspackVersion = "2.0.0-beta.2";
9341
9300
  },
9342
9301
  env: (object, _compilation, _context, { _env })=>{
9343
9302
  object.env = _env;
@@ -10741,8 +10700,9 @@ function rspack_rspack(options, callback) {
10741
10700
  return process.nextTick(()=>callback(err)), null;
10742
10701
  }
10743
10702
  {
10703
+ var message;
10744
10704
  let { compiler, watch } = create();
10745
- return watch && deprecate("A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback."), compiler;
10705
+ return watch && (message = "A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.", warnedMessages.has(message) || (warnedMessages.add(message), console.warn(`[Rspack Deprecation] ${message}`))), compiler;
10746
10706
  }
10747
10707
  }
10748
10708
  class CodeGenerationResult {
@@ -10998,7 +10958,7 @@ class TraceHookPlugin {
10998
10958
  });
10999
10959
  }
11000
10960
  }
11001
- let CORE_VERSION = "2.0.0-beta.1", VFILES_BY_COMPILER = new WeakMap();
10961
+ let CORE_VERSION = "2.0.0-beta.2", VFILES_BY_COMPILER = new WeakMap();
11002
10962
  class VirtualModulesPlugin {
11003
10963
  #staticModules;
11004
10964
  #compiler;
@@ -13282,7 +13242,7 @@ async function transform(source, options) {
13282
13242
  let _options = JSON.stringify(options || {});
13283
13243
  return binding_default().transform(source, _options);
13284
13244
  }
13285
- let exports_rspackVersion = "2.0.0-beta.1", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
13245
+ let exports_rspackVersion = "2.0.0-beta.2", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
13286
13246
  getNormalizedRspackOptions: getNormalizedRspackOptions,
13287
13247
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
13288
13248
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import { AsyncParallelHook, AsyncSeriesBailHook, SyncHook } from '@rspack/lite-tapable';
10
+ import { AsyncParallelHook, AsyncSeriesBailHook, SyncHook } from '../../compiled/@rspack/lite-tapable/dist/index.d';
11
11
  import type { WebpackError } from './WebpackError.js';
12
12
  export interface Etag {
13
13
  toString(): string;
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type { Callback } from '@rspack/lite-tapable';
10
+ import type { Callback } from '../../compiled/@rspack/lite-tapable/dist/index.d';
11
11
  import WebpackError from './WebpackError.js';
12
12
  export declare class HookWebpackError extends WebpackError {
13
13
  hook: string;
package/dist/rspack.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type { Callback } from '@rspack/lite-tapable';
10
+ import type { Callback } from '../compiled/@rspack/lite-tapable/dist/index.d';
11
11
  import { Compiler } from './Compiler.js';
12
12
  import { type RspackOptions } from './config/index.js';
13
13
  import { MultiCompiler, type MultiRspackOptions } from './MultiCompiler.js';
@@ -8,7 +8,7 @@
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
10
  import type { JsStats, JsStatsCompilation, JsStatsError } from '@rspack/binding';
11
- import { HookMap, SyncBailHook, SyncWaterfallHook } from '@rspack/lite-tapable';
11
+ import { HookMap, SyncBailHook, SyncWaterfallHook } from '../../compiled/@rspack/lite-tapable/dist/index.d';
12
12
  import type { Compilation } from '../Compilation.js';
13
13
  import { type GroupConfig } from '../util/smartGrouping.js';
14
14
  export type KnownStatsFactoryContext = {
@@ -1,4 +1,4 @@
1
- import { HookMap, SyncBailHook, SyncWaterfallHook } from '@rspack/lite-tapable';
1
+ import { HookMap, SyncBailHook, SyncWaterfallHook } from '../../compiled/@rspack/lite-tapable/dist/index.d';
2
2
  import type { StatsAsset, StatsChunk, StatsChunkGroup, StatsCompilation, StatsModule, StatsModuleReason } from './statsFactoryUtils.js';
3
3
  type PrintedElement = {
4
4
  element: string;
@@ -1,5 +1,5 @@
1
1
  import type binding from '@rspack/binding';
2
- import type * as liteTapable from '@rspack/lite-tapable';
2
+ import type * as liteTapable from '../../compiled/@rspack/lite-tapable/dist/index.d';
3
3
  import type { Compiler } from '../Compiler.js';
4
4
  type CreateHookMapRegisterTaps = <H extends liteTapable.Hook<any, any, any>>(registerKind: binding.RegisterJsTapKind, getHookMap: () => liteTapable.HookMap<H>, createTap: (queried: liteTapable.QueriedHookMap<H>) => any) => (stages: number[]) => binding.JsTap[];
5
5
  type CreateHookRegisterTaps = <T, R, A>(registerKind: binding.RegisterJsTapKind, getHook: () => liteTapable.Hook<T, R, A>, createTap: (queried: liteTapable.QueriedHook<T, R, A>) => any) => (stages: number[]) => binding.JsTap[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-debug/core",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.0-beta.2",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -39,11 +39,11 @@
39
39
  "devDependencies": {
40
40
  "@ast-grep/napi": "^0.40.5",
41
41
  "@napi-rs/wasm-runtime": "1.0.7",
42
- "@rsbuild/plugin-node-polyfill": "^1.4.3",
42
+ "@rsbuild/plugin-node-polyfill": "^1.4.4",
43
43
  "@rspack/lite-tapable": "1.1.0",
44
- "@rslib/core": "0.19.4",
44
+ "@rslib/core": "0.19.5",
45
45
  "@swc/types": "0.1.25",
46
- "@types/node": "^20.19.31",
46
+ "@types/node": "^20.19.33",
47
47
  "@types/watchpack": "^2.4.5",
48
48
  "browserslist-load-config": "^1.0.1",
49
49
  "browserslist-to-es-version": "^1.4.1",
@@ -58,10 +58,10 @@
58
58
  "webpack-sources": "3.3.3"
59
59
  },
60
60
  "dependencies": {
61
- "@rspack/binding": "npm:@rspack-debug/binding@2.0.0-beta.1"
61
+ "@rspack/binding": "npm:@rspack-debug/binding@2.0.0-beta.2"
62
62
  },
63
63
  "peerDependencies": {
64
- "@module-federation/runtime-tools": "0.24.1",
64
+ "@module-federation/runtime-tools": "^0.24.1 || ^2.0.0",
65
65
  "@swc/helpers": ">=0.5.1"
66
66
  },
67
67
  "peerDependenciesMeta": {