@rspack/core 1.0.0-alpha.0 → 1.0.0-alpha.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.
- package/compiled/enhanced-resolve/index.js +11 -11
- package/compiled/zod-validation-error/index.d.ts +4 -170
- package/compiled/zod-validation-error/index.js +4 -4154
- package/dist/Compilation.d.ts +12 -10
- package/dist/Compilation.js +13 -10
- package/dist/Compiler.d.ts +25 -27
- package/dist/Compiler.js +42 -24
- package/dist/ContextModuleFactory.d.ts +1 -1
- package/dist/ContextModuleFactory.js +1 -1
- package/dist/MultiCompiler.d.ts +11 -11
- package/dist/MultiCompiler.js +30 -13
- package/dist/NormalModule.d.ts +7 -3
- package/dist/NormalModule.js +27 -4
- package/dist/NormalModuleFactory.d.ts +2 -1
- package/dist/NormalModuleFactory.js +2 -1
- package/dist/ResolverFactory.d.ts +3 -3
- package/dist/ResolverFactory.js +1 -1
- package/dist/Stats.d.ts +2 -0
- package/dist/Stats.js +6 -0
- package/dist/Watching.d.ts +1 -1
- package/dist/builtin-loader/swc/index.d.ts +0 -2
- package/dist/builtin-loader/swc/index.js +1 -3
- package/dist/builtin-loader/swc/types.d.ts +0 -2
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.js +1 -1
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +1 -1
- package/dist/builtin-plugin/SplitChunksPlugin.js +11 -2
- package/dist/config/adapter.js +7 -6
- package/dist/config/adapterRuleUse.js +0 -3
- package/dist/config/zod.d.ts +585 -162
- package/dist/config/zod.js +4 -2
- package/dist/exports.d.ts +8 -1
- package/dist/exports.js +10 -5
- package/dist/lib/Cache.d.ts +3 -3
- package/dist/lib/Cache.js +1 -1
- package/dist/loader-runner/index.js +9 -5
- package/dist/node/nodeConsole.js +26 -3
- package/dist/rspack.d.ts +1 -1
- package/dist/stats/StatsFactory.d.ts +2 -2
- package/dist/stats/StatsFactory.js +12 -12
- package/dist/stats/StatsPrinter.d.ts +1 -1
- package/dist/stats/StatsPrinter.js +8 -8
- package/dist/util/SplitChunkSize.d.ts +5 -0
- package/dist/util/SplitChunkSize.js +18 -0
- package/package.json +6 -6
- package/dist/builtin-loader/swc/preact.d.ts +0 -6
- package/dist/builtin-loader/swc/preact.js +0 -15
- package/dist/lite-tapable/index.d.ts +0 -146
- package/dist/lite-tapable/index.js +0 -752
package/dist/Compilation.d.ts
CHANGED
|
@@ -9,11 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type * as binding from "@rspack/binding";
|
|
11
11
|
import { type ExternalObject, type JsCompilation, type JsModule, type JsPathData, type JsRuntimeModule } from "@rspack/binding";
|
|
12
|
-
import * as
|
|
12
|
+
import * as liteTapable from "@rspack/lite-tapable";
|
|
13
13
|
import { Source } from "../compiled/webpack-sources";
|
|
14
14
|
import { ContextModuleFactory } from "./ContextModuleFactory";
|
|
15
15
|
import { Filename, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance, StatsOptions, StatsValue } from "./config";
|
|
16
|
-
import * as liteTapable from "./lite-tapable";
|
|
17
16
|
import ResolverFactory = require("./ResolverFactory");
|
|
18
17
|
import { Chunk } from "./Chunk";
|
|
19
18
|
import { ChunkGraph } from "./ChunkGraph";
|
|
@@ -106,8 +105,8 @@ export declare class Compilation {
|
|
|
106
105
|
hooks: Readonly<{
|
|
107
106
|
processAssets: liteTapable.AsyncSeriesHook<Assets>;
|
|
108
107
|
afterProcessAssets: liteTapable.SyncHook<Assets>;
|
|
109
|
-
childCompiler:
|
|
110
|
-
log:
|
|
108
|
+
childCompiler: liteTapable.SyncHook<[Compiler, string, number]>;
|
|
109
|
+
log: liteTapable.SyncBailHook<[string, LogEntry], true>;
|
|
111
110
|
additionalAssets: any;
|
|
112
111
|
optimizeModules: liteTapable.SyncBailHook<Iterable<Module>, void>;
|
|
113
112
|
afterOptimizeModules: liteTapable.SyncHook<Iterable<Module>, void>;
|
|
@@ -122,16 +121,19 @@ export declare class Compilation {
|
|
|
122
121
|
finishModules: liteTapable.AsyncSeriesHook<[Iterable<Module>], void>;
|
|
123
122
|
chunkHash: liteTapable.SyncHook<[Chunk, Hash], void>;
|
|
124
123
|
chunkAsset: liteTapable.SyncHook<[Chunk, string], void>;
|
|
125
|
-
processWarnings:
|
|
124
|
+
processWarnings: liteTapable.SyncWaterfallHook<[Error[]]>;
|
|
126
125
|
succeedModule: liteTapable.SyncHook<[Module], void>;
|
|
127
126
|
stillValidModule: liteTapable.SyncHook<[Module], void>;
|
|
128
|
-
statsPreset:
|
|
129
|
-
|
|
127
|
+
statsPreset: liteTapable.HookMap<liteTapable.SyncHook<[
|
|
128
|
+
Partial<StatsOptions>,
|
|
129
|
+
CreateStatsOptionsContext
|
|
130
|
+
], void>>;
|
|
131
|
+
statsNormalize: liteTapable.SyncHook<[
|
|
130
132
|
Partial<StatsOptions>,
|
|
131
133
|
CreateStatsOptionsContext
|
|
132
134
|
], void>;
|
|
133
|
-
statsFactory:
|
|
134
|
-
statsPrinter:
|
|
135
|
+
statsFactory: liteTapable.SyncHook<[StatsFactory, StatsOptions], void>;
|
|
136
|
+
statsPrinter: liteTapable.SyncHook<[StatsPrinter, StatsOptions], void>;
|
|
135
137
|
buildModule: liteTapable.SyncHook<[Module]>;
|
|
136
138
|
executeModule: liteTapable.SyncHook<[
|
|
137
139
|
ExecuteModuleArgument,
|
|
@@ -175,7 +177,7 @@ export declare class Compilation {
|
|
|
175
177
|
/**
|
|
176
178
|
* Get the named chunks.
|
|
177
179
|
*
|
|
178
|
-
* Note: This is a proxy for webpack internal API, only method `get` is supported now.
|
|
180
|
+
* Note: This is a proxy for webpack internal API, only method `get` and `keys` is supported now.
|
|
179
181
|
*/
|
|
180
182
|
get namedChunks(): ReadonlyMap<string, Readonly<Chunk>>;
|
|
181
183
|
/**
|
package/dist/Compilation.js
CHANGED
|
@@ -40,8 +40,7 @@ var _Compilation_instances, _Compilation_inner, _Compilation_cachedAssets, _Comp
|
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.Compilation = void 0;
|
|
42
42
|
const binding_1 = require("@rspack/binding");
|
|
43
|
-
const
|
|
44
|
-
const liteTapable = __importStar(require("./lite-tapable"));
|
|
43
|
+
const liteTapable = __importStar(require("@rspack/lite-tapable"));
|
|
45
44
|
const Chunk_1 = require("./Chunk");
|
|
46
45
|
const ChunkGraph_1 = require("./ChunkGraph");
|
|
47
46
|
const Entrypoint_1 = require("./Entrypoint");
|
|
@@ -131,12 +130,12 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
131
130
|
afterProcessAssets: new liteTapable.SyncHook(["assets"]),
|
|
132
131
|
/** @deprecated */
|
|
133
132
|
additionalAssets: createProcessAssetsHook("additionalAssets", Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, () => []),
|
|
134
|
-
childCompiler: new
|
|
133
|
+
childCompiler: new liteTapable.SyncHook([
|
|
135
134
|
"childCompiler",
|
|
136
135
|
"compilerName",
|
|
137
136
|
"compilerIndex"
|
|
138
137
|
]),
|
|
139
|
-
log: new
|
|
138
|
+
log: new liteTapable.SyncBailHook(["origin", "logEntry"]),
|
|
140
139
|
optimizeModules: new liteTapable.SyncBailHook(["modules"]),
|
|
141
140
|
afterOptimizeModules: new liteTapable.SyncBailHook(["modules"]),
|
|
142
141
|
optimizeTree: new liteTapable.AsyncSeriesHook(["chunks", "modules"]),
|
|
@@ -147,13 +146,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
147
146
|
finishModules: new liteTapable.AsyncSeriesHook(["modules"]),
|
|
148
147
|
chunkHash: new liteTapable.SyncHook(["chunk", "hash"]),
|
|
149
148
|
chunkAsset: new liteTapable.SyncHook(["chunk", "filename"]),
|
|
150
|
-
processWarnings: new
|
|
149
|
+
processWarnings: new liteTapable.SyncWaterfallHook(["warnings"]),
|
|
151
150
|
succeedModule: new liteTapable.SyncHook(["module"]),
|
|
152
151
|
stillValidModule: new liteTapable.SyncHook(["module"]),
|
|
153
|
-
statsPreset: new
|
|
154
|
-
statsNormalize: new
|
|
155
|
-
statsFactory: new
|
|
156
|
-
statsPrinter: new
|
|
152
|
+
statsPreset: new liteTapable.HookMap(() => new liteTapable.SyncHook(["options", "context"])),
|
|
153
|
+
statsNormalize: new liteTapable.SyncHook(["options", "context"]),
|
|
154
|
+
statsFactory: new liteTapable.SyncHook(["statsFactory", "options"]),
|
|
155
|
+
statsPrinter: new liteTapable.SyncHook(["statsPrinter", "options"]),
|
|
157
156
|
buildModule: new liteTapable.SyncHook(["module"]),
|
|
158
157
|
executeModule: new liteTapable.SyncHook(["options", "context"]),
|
|
159
158
|
additionalTreeRuntimeRequirements: new liteTapable.SyncHook([
|
|
@@ -203,10 +202,14 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
203
202
|
/**
|
|
204
203
|
* Get the named chunks.
|
|
205
204
|
*
|
|
206
|
-
* Note: This is a proxy for webpack internal API, only method `get` is supported now.
|
|
205
|
+
* Note: This is a proxy for webpack internal API, only method `get` and `keys` is supported now.
|
|
207
206
|
*/
|
|
208
207
|
get namedChunks() {
|
|
209
208
|
return {
|
|
209
|
+
keys: () => {
|
|
210
|
+
const names = __classPrivateFieldGet(this, _Compilation_inner, "f").getNamedChunkKeys();
|
|
211
|
+
return names[Symbol.iterator]();
|
|
212
|
+
},
|
|
210
213
|
get: (property) => {
|
|
211
214
|
if (typeof property === "string") {
|
|
212
215
|
const chunk = __classPrivateFieldGet(this, _Compilation_inner, "f").getNamedChunk(property) || undefined;
|
package/dist/Compiler.d.ts
CHANGED
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
10
10
|
*/
|
|
11
11
|
import * as binding from "@rspack/binding";
|
|
12
|
-
import * as
|
|
13
|
-
import { Callback } from "tapable";
|
|
12
|
+
import * as liteTapable from "@rspack/lite-tapable";
|
|
14
13
|
import type Watchpack from "../compiled/watchpack";
|
|
15
14
|
import { Compilation, CompilationParams } from "./Compilation";
|
|
16
15
|
import { ContextModuleFactory } from "./ContextModuleFactory";
|
|
@@ -18,7 +17,6 @@ import { RuleSetCompiler } from "./RuleSetCompiler";
|
|
|
18
17
|
import { Stats } from "./Stats";
|
|
19
18
|
import { EntryNormalized, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance } from "./config";
|
|
20
19
|
import { rspack } from "./index";
|
|
21
|
-
import * as liteTapable from "./lite-tapable";
|
|
22
20
|
import ResolverFactory = require("./ResolverFactory");
|
|
23
21
|
import Cache = require("./lib/Cache");
|
|
24
22
|
import CacheFacade = require("./lib/CacheFacade");
|
|
@@ -39,35 +37,35 @@ export interface AssetEmittedInfo {
|
|
|
39
37
|
declare class Compiler {
|
|
40
38
|
#private;
|
|
41
39
|
hooks: {
|
|
42
|
-
done:
|
|
43
|
-
afterDone:
|
|
40
|
+
done: liteTapable.AsyncSeriesHook<Stats>;
|
|
41
|
+
afterDone: liteTapable.SyncHook<Stats>;
|
|
44
42
|
thisCompilation: liteTapable.SyncHook<[Compilation, CompilationParams]>;
|
|
45
43
|
compilation: liteTapable.SyncHook<[Compilation, CompilationParams]>;
|
|
46
|
-
invalid:
|
|
47
|
-
compile:
|
|
48
|
-
normalModuleFactory:
|
|
49
|
-
contextModuleFactory:
|
|
50
|
-
initialize:
|
|
44
|
+
invalid: liteTapable.SyncHook<[string | null, number]>;
|
|
45
|
+
compile: liteTapable.SyncHook<[CompilationParams]>;
|
|
46
|
+
normalModuleFactory: liteTapable.SyncHook<NormalModuleFactory>;
|
|
47
|
+
contextModuleFactory: liteTapable.SyncHook<ContextModuleFactory>;
|
|
48
|
+
initialize: liteTapable.SyncHook<[]>;
|
|
51
49
|
shouldEmit: liteTapable.SyncBailHook<[Compilation], boolean>;
|
|
52
|
-
infrastructureLog:
|
|
53
|
-
beforeRun:
|
|
54
|
-
run:
|
|
50
|
+
infrastructureLog: liteTapable.SyncBailHook<[string, string, any[]], true>;
|
|
51
|
+
beforeRun: liteTapable.AsyncSeriesHook<[Compiler]>;
|
|
52
|
+
run: liteTapable.AsyncSeriesHook<[Compiler]>;
|
|
55
53
|
emit: liteTapable.AsyncSeriesHook<[Compilation]>;
|
|
56
54
|
assetEmitted: liteTapable.AsyncSeriesHook<[string, AssetEmittedInfo]>;
|
|
57
55
|
afterEmit: liteTapable.AsyncSeriesHook<[Compilation]>;
|
|
58
|
-
failed:
|
|
59
|
-
shutdown:
|
|
60
|
-
watchRun:
|
|
61
|
-
watchClose:
|
|
62
|
-
environment:
|
|
63
|
-
afterEnvironment:
|
|
64
|
-
afterPlugins:
|
|
65
|
-
afterResolvers:
|
|
56
|
+
failed: liteTapable.SyncHook<[Error]>;
|
|
57
|
+
shutdown: liteTapable.AsyncSeriesHook<[]>;
|
|
58
|
+
watchRun: liteTapable.AsyncSeriesHook<[Compiler]>;
|
|
59
|
+
watchClose: liteTapable.SyncHook<[]>;
|
|
60
|
+
environment: liteTapable.SyncHook<[]>;
|
|
61
|
+
afterEnvironment: liteTapable.SyncHook<[]>;
|
|
62
|
+
afterPlugins: liteTapable.SyncHook<[Compiler]>;
|
|
63
|
+
afterResolvers: liteTapable.SyncHook<[Compiler]>;
|
|
66
64
|
make: liteTapable.AsyncParallelHook<[Compilation]>;
|
|
67
|
-
beforeCompile:
|
|
68
|
-
afterCompile:
|
|
65
|
+
beforeCompile: liteTapable.AsyncSeriesHook<[CompilationParams]>;
|
|
66
|
+
afterCompile: liteTapable.AsyncSeriesHook<[Compilation]>;
|
|
69
67
|
finishMake: liteTapable.AsyncSeriesHook<[Compilation]>;
|
|
70
|
-
entryOption:
|
|
68
|
+
entryOption: liteTapable.SyncBailHook<[string, EntryNormalized], any>;
|
|
71
69
|
};
|
|
72
70
|
webpack: typeof rspack;
|
|
73
71
|
name?: string;
|
|
@@ -125,11 +123,11 @@ declare class Compiler {
|
|
|
125
123
|
* @param handler - signals when the call finishes
|
|
126
124
|
* @returns a compiler watcher
|
|
127
125
|
*/
|
|
128
|
-
watch(watchOptions: Watchpack.WatchOptions, handler: Callback<Error, Stats>): Watching;
|
|
126
|
+
watch(watchOptions: Watchpack.WatchOptions, handler: liteTapable.Callback<Error, Stats>): Watching;
|
|
129
127
|
/**
|
|
130
128
|
* @param callback - signals when the call finishes
|
|
131
129
|
*/
|
|
132
|
-
run(callback: Callback<Error, Stats>): void;
|
|
130
|
+
run(callback: liteTapable.Callback<Error, Stats>): void;
|
|
133
131
|
runAsChild(callback: (err?: null | Error, entries?: Chunk[], compilation?: Compilation) => any): void;
|
|
134
132
|
purgeInputFileSystem(): void;
|
|
135
133
|
/**
|
|
@@ -142,7 +140,7 @@ declare class Compiler {
|
|
|
142
140
|
*/
|
|
143
141
|
createChildCompiler(compilation: Compilation, compilerName: string, compilerIndex: number, outputOptions: OutputNormalized, plugins: RspackPluginInstance[]): Compiler;
|
|
144
142
|
isChild(): boolean;
|
|
145
|
-
compile(callback: Callback<Error, Compilation>): void;
|
|
143
|
+
compile(callback: liteTapable.Callback<Error, Compilation>): void;
|
|
146
144
|
close(callback: (error?: Error | null) => void): void;
|
|
147
145
|
/**
|
|
148
146
|
* Note: This is not a webpack public API, maybe removed in future.
|
package/dist/Compiler.js
CHANGED
|
@@ -49,15 +49,13 @@ exports.Compiler = void 0;
|
|
|
49
49
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
50
50
|
*/
|
|
51
51
|
const binding = __importStar(require("@rspack/binding"));
|
|
52
|
-
const
|
|
53
|
-
const tapable_1 = require("tapable");
|
|
52
|
+
const liteTapable = __importStar(require("@rspack/lite-tapable"));
|
|
54
53
|
const Compilation_1 = require("./Compilation");
|
|
55
54
|
const ContextModuleFactory_1 = require("./ContextModuleFactory");
|
|
56
55
|
const RuleSetCompiler_1 = require("./RuleSetCompiler");
|
|
57
56
|
const Stats_1 = require("./Stats");
|
|
58
57
|
const config_1 = require("./config");
|
|
59
58
|
const index_1 = require("./index");
|
|
60
|
-
const liteTapable = __importStar(require("./lite-tapable"));
|
|
61
59
|
const ResolverFactory = require("./ResolverFactory");
|
|
62
60
|
const FileSystem_1 = require("./FileSystem");
|
|
63
61
|
const ConcurrentCompilationError_1 = __importDefault(require("./error/ConcurrentCompilationError"));
|
|
@@ -97,12 +95,12 @@ class Compiler {
|
|
|
97
95
|
__classPrivateFieldSet(this, _Compiler_moduleExecutionResultsMap, new Map(), "f");
|
|
98
96
|
__classPrivateFieldSet(this, _Compiler_ruleSet, new RuleSetCompiler_1.RuleSetCompiler(), "f");
|
|
99
97
|
this.hooks = {
|
|
100
|
-
initialize: new
|
|
98
|
+
initialize: new liteTapable.SyncHook([]),
|
|
101
99
|
shouldEmit: new liteTapable.SyncBailHook(["compilation"]),
|
|
102
|
-
done: new
|
|
103
|
-
afterDone: new
|
|
104
|
-
beforeRun: new
|
|
105
|
-
run: new
|
|
100
|
+
done: new liteTapable.AsyncSeriesHook(["stats"]),
|
|
101
|
+
afterDone: new liteTapable.SyncHook(["stats"]),
|
|
102
|
+
beforeRun: new liteTapable.AsyncSeriesHook(["compiler"]),
|
|
103
|
+
run: new liteTapable.AsyncSeriesHook(["compiler"]),
|
|
106
104
|
emit: new liteTapable.AsyncSeriesHook(["compilation"]),
|
|
107
105
|
assetEmitted: new liteTapable.AsyncSeriesHook(["file", "info"]),
|
|
108
106
|
afterEmit: new liteTapable.AsyncSeriesHook(["compilation"]),
|
|
@@ -111,28 +109,32 @@ class Compiler {
|
|
|
111
109
|
"compilation",
|
|
112
110
|
"params"
|
|
113
111
|
]),
|
|
114
|
-
invalid: new
|
|
115
|
-
compile: new
|
|
116
|
-
infrastructureLog: new
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
112
|
+
invalid: new liteTapable.SyncHook(["filename", "changeTime"]),
|
|
113
|
+
compile: new liteTapable.SyncHook(["params"]),
|
|
114
|
+
infrastructureLog: new liteTapable.SyncBailHook([
|
|
115
|
+
"origin",
|
|
116
|
+
"type",
|
|
117
|
+
"args"
|
|
118
|
+
]),
|
|
119
|
+
failed: new liteTapable.SyncHook(["error"]),
|
|
120
|
+
shutdown: new liteTapable.AsyncSeriesHook([]),
|
|
121
|
+
normalModuleFactory: new liteTapable.SyncHook([
|
|
120
122
|
"normalModuleFactory"
|
|
121
123
|
]),
|
|
122
|
-
contextModuleFactory: new
|
|
124
|
+
contextModuleFactory: new liteTapable.SyncHook([
|
|
123
125
|
"contextModuleFactory"
|
|
124
126
|
]),
|
|
125
|
-
watchRun: new
|
|
126
|
-
watchClose: new
|
|
127
|
-
environment: new
|
|
128
|
-
afterEnvironment: new
|
|
129
|
-
afterPlugins: new
|
|
130
|
-
afterResolvers: new
|
|
127
|
+
watchRun: new liteTapable.AsyncSeriesHook(["compiler"]),
|
|
128
|
+
watchClose: new liteTapable.SyncHook([]),
|
|
129
|
+
environment: new liteTapable.SyncHook([]),
|
|
130
|
+
afterEnvironment: new liteTapable.SyncHook([]),
|
|
131
|
+
afterPlugins: new liteTapable.SyncHook(["compiler"]),
|
|
132
|
+
afterResolvers: new liteTapable.SyncHook(["compiler"]),
|
|
131
133
|
make: new liteTapable.AsyncParallelHook(["compilation"]),
|
|
132
|
-
beforeCompile: new
|
|
133
|
-
afterCompile: new
|
|
134
|
+
beforeCompile: new liteTapable.AsyncSeriesHook(["params"]),
|
|
135
|
+
afterCompile: new liteTapable.AsyncSeriesHook(["compilation"]),
|
|
134
136
|
finishMake: new liteTapable.AsyncSeriesHook(["compilation"]),
|
|
135
|
-
entryOption: new
|
|
137
|
+
entryOption: new liteTapable.SyncBailHook(["context", "entry"])
|
|
136
138
|
};
|
|
137
139
|
this.webpack = index_1.rspack;
|
|
138
140
|
this.root = this;
|
|
@@ -700,6 +702,22 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
|
|
|
700
702
|
resolveData.context = normalizedResolveData.context;
|
|
701
703
|
return resolveData;
|
|
702
704
|
}),
|
|
705
|
+
registerNormalModuleFactoryResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.NormalModuleFactoryResolve, () => __classPrivateFieldGet(this, _Compiler_compilationParams, "f").normalModuleFactory.hooks.resolve, queried => async (resolveData) => {
|
|
706
|
+
const normalizedResolveData = {
|
|
707
|
+
contextInfo: {
|
|
708
|
+
issuer: resolveData.issuer
|
|
709
|
+
},
|
|
710
|
+
request: resolveData.request,
|
|
711
|
+
context: resolveData.context,
|
|
712
|
+
fileDependencies: [],
|
|
713
|
+
missingDependencies: [],
|
|
714
|
+
contextDependencies: []
|
|
715
|
+
};
|
|
716
|
+
await queried.promise(normalizedResolveData);
|
|
717
|
+
resolveData.request = normalizedResolveData.request;
|
|
718
|
+
resolveData.context = normalizedResolveData.context;
|
|
719
|
+
return resolveData;
|
|
720
|
+
}),
|
|
703
721
|
registerNormalModuleFactoryResolveForSchemeTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookMapRegisterTaps).call(this, binding.RegisterJsTapKind.NormalModuleFactoryResolveForScheme, () => __classPrivateFieldGet(this, _Compiler_compilationParams, "f").normalModuleFactory.hooks.resolveForScheme, queried => async (args) => {
|
|
704
722
|
const ret = await queried
|
|
705
723
|
.for(args.scheme)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import * as liteTapable from "@rspack/lite-tapable";
|
|
1
2
|
import { ContextModuleFactoryAfterResolveResult, ContextModuleFactoryBeforeResolveResult } from "./Module";
|
|
2
|
-
import * as liteTapable from "./lite-tapable";
|
|
3
3
|
export declare class ContextModuleFactory {
|
|
4
4
|
hooks: {
|
|
5
5
|
beforeResolve: liteTapable.AsyncSeriesWaterfallHook<[
|
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.ContextModuleFactory = void 0;
|
|
27
|
-
const liteTapable = __importStar(require("
|
|
27
|
+
const liteTapable = __importStar(require("@rspack/lite-tapable"));
|
|
28
28
|
class ContextModuleFactory {
|
|
29
29
|
constructor() {
|
|
30
30
|
this.hooks = {
|
package/dist/MultiCompiler.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
|
|
10
|
+
import * as liteTapable from "@rspack/lite-tapable";
|
|
11
11
|
import { Compiler, RspackOptions } from ".";
|
|
12
12
|
import MultiStats from "./MultiStats";
|
|
13
13
|
import MultiWatching from "./MultiWatching";
|
|
@@ -25,12 +25,12 @@ export declare class MultiCompiler {
|
|
|
25
25
|
compilers: Compiler[];
|
|
26
26
|
dependencies: WeakMap<Compiler, string[]>;
|
|
27
27
|
hooks: {
|
|
28
|
-
done: SyncHook<MultiStats>;
|
|
29
|
-
invalid: MultiHook<SyncHook<[string | null, number]>>;
|
|
30
|
-
run: MultiHook<AsyncSeriesHook<[Compiler]>>;
|
|
31
|
-
watchClose: SyncHook<[]>;
|
|
32
|
-
watchRun: MultiHook<AsyncSeriesHook<[Compiler]>>;
|
|
33
|
-
infrastructureLog: MultiHook<SyncBailHook<[string, string, any[]], true>>;
|
|
28
|
+
done: liteTapable.SyncHook<MultiStats>;
|
|
29
|
+
invalid: liteTapable.MultiHook<liteTapable.SyncHook<[string | null, number]>>;
|
|
30
|
+
run: liteTapable.MultiHook<liteTapable.AsyncSeriesHook<[Compiler]>>;
|
|
31
|
+
watchClose: liteTapable.SyncHook<[]>;
|
|
32
|
+
watchRun: liteTapable.MultiHook<liteTapable.AsyncSeriesHook<[Compiler]>>;
|
|
33
|
+
infrastructureLog: liteTapable.MultiHook<liteTapable.SyncBailHook<[string, string, any[]], true>>;
|
|
34
34
|
};
|
|
35
35
|
_options: MultiCompilerOptions;
|
|
36
36
|
running: boolean;
|
|
@@ -55,14 +55,14 @@ export declare class MultiCompiler {
|
|
|
55
55
|
* @param callback - signals when the validation is complete
|
|
56
56
|
* @returns true if the dependencies are valid
|
|
57
57
|
*/
|
|
58
|
-
validateDependencies(callback: Callback<Error, MultiStats>): boolean;
|
|
58
|
+
validateDependencies(callback: liteTapable.Callback<Error, MultiStats>): boolean;
|
|
59
59
|
/**
|
|
60
60
|
* @param watchOptions - the watcher's options
|
|
61
61
|
* @param handler - signals when the call finishes
|
|
62
62
|
* @returns a compiler watcher
|
|
63
63
|
*/
|
|
64
|
-
watch(watchOptions: WatchOptions, handler: Callback<Error, MultiStats>): MultiWatching;
|
|
65
|
-
run(callback: Callback<Error, MultiStats>): void;
|
|
64
|
+
watch(watchOptions: WatchOptions, handler: liteTapable.Callback<Error, MultiStats>): MultiWatching;
|
|
65
|
+
run(callback: liteTapable.Callback<Error, MultiStats>): void;
|
|
66
66
|
purgeInputFileSystem(): void;
|
|
67
|
-
close(callback: Callback<Error, void>): void;
|
|
67
|
+
close(callback: liteTapable.Callback<Error, void>): void;
|
|
68
68
|
}
|
package/dist/MultiCompiler.js
CHANGED
|
@@ -8,6 +8,29 @@
|
|
|
8
8
|
* Copyright (c) JS Foundation and other contributors
|
|
9
9
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
10
10
|
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
11
34
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
35
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
36
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
@@ -19,8 +42,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
42
|
var _MultiCompiler_instances, _MultiCompiler_runGraph;
|
|
20
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
44
|
exports.MultiCompiler = void 0;
|
|
45
|
+
const liteTapable = __importStar(require("@rspack/lite-tapable"));
|
|
22
46
|
const neo_async_1 = __importDefault(require("../compiled/neo-async"));
|
|
23
|
-
const tapable_1 = require("tapable");
|
|
24
47
|
const MultiStats_1 = __importDefault(require("./MultiStats"));
|
|
25
48
|
const MultiWatching_1 = __importDefault(require("./MultiWatching"));
|
|
26
49
|
const ConcurrentCompilationError_1 = __importDefault(require("./error/ConcurrentCompilationError"));
|
|
@@ -35,18 +58,12 @@ class MultiCompiler {
|
|
|
35
58
|
});
|
|
36
59
|
}
|
|
37
60
|
this.hooks = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/** @type {SyncHook<[]>} */
|
|
45
|
-
watchClose: new tapable_1.SyncHook([]),
|
|
46
|
-
/** @type {MultiHook<AsyncSeriesHook<[Compiler]>>} */
|
|
47
|
-
watchRun: new tapable_1.MultiHook(compilers.map(c => c.hooks.watchRun)),
|
|
48
|
-
/** @type {MultiHook<SyncBailHook<[string, string, any[]], true>>} */
|
|
49
|
-
infrastructureLog: new tapable_1.MultiHook(compilers.map(c => c.hooks.infrastructureLog))
|
|
61
|
+
done: new liteTapable.SyncHook(["stats"]),
|
|
62
|
+
invalid: new liteTapable.MultiHook(compilers.map(c => c.hooks.invalid)),
|
|
63
|
+
run: new liteTapable.MultiHook(compilers.map(c => c.hooks.run)),
|
|
64
|
+
watchClose: new liteTapable.SyncHook([]),
|
|
65
|
+
watchRun: new liteTapable.MultiHook(compilers.map(c => c.hooks.watchRun)),
|
|
66
|
+
infrastructureLog: new liteTapable.MultiHook(compilers.map(c => c.hooks.infrastructureLog))
|
|
50
67
|
};
|
|
51
68
|
this.compilers = compilers;
|
|
52
69
|
this._options = {
|
package/dist/NormalModule.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import
|
|
2
|
+
import * as liteTapable from "@rspack/lite-tapable";
|
|
3
3
|
import { Compilation } from "./Compilation";
|
|
4
4
|
import { LoaderContext } from "./config";
|
|
5
5
|
export declare class NormalModule {
|
|
6
6
|
static getCompilationHooks(compilation: Compilation): {
|
|
7
|
-
loader: SyncHook<[LoaderContext<{}>], void,
|
|
7
|
+
loader: liteTapable.SyncHook<[LoaderContext<{}>], void, {
|
|
8
|
+
_UnsetAdditionalOptions: true;
|
|
9
|
+
}>;
|
|
8
10
|
readResourceForScheme: any;
|
|
9
|
-
readResource: HookMap<AsyncSeriesBailHook<[LoaderContext<{}>], string | Buffer,
|
|
11
|
+
readResource: liteTapable.HookMap<liteTapable.AsyncSeriesBailHook<[LoaderContext<{}>], string | Buffer, {
|
|
12
|
+
_UnsetAdditionalOptions: true;
|
|
13
|
+
}>>;
|
|
10
14
|
};
|
|
11
15
|
}
|
package/dist/NormalModule.js
CHANGED
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.NormalModule = void 0;
|
|
7
30
|
const util_1 = __importDefault(require("util"));
|
|
8
|
-
const
|
|
31
|
+
const liteTapable = __importStar(require("@rspack/lite-tapable"));
|
|
9
32
|
const Compilation_1 = require("./Compilation");
|
|
10
33
|
const compilationHooksMap = new WeakMap();
|
|
11
34
|
const createFakeHook = (fakeHook, message, code) => {
|
|
@@ -54,9 +77,9 @@ class NormalModule {
|
|
|
54
77
|
let hooks = compilationHooksMap.get(compilation);
|
|
55
78
|
if (hooks === undefined) {
|
|
56
79
|
hooks = {
|
|
57
|
-
loader: new
|
|
80
|
+
loader: new liteTapable.SyncHook(["loaderContext"]),
|
|
58
81
|
// TODO webpack 6 deprecate
|
|
59
|
-
readResourceForScheme: new
|
|
82
|
+
readResourceForScheme: new liteTapable.HookMap(scheme => {
|
|
60
83
|
const hook = hooks.readResource.for(scheme);
|
|
61
84
|
return createFakeHook({
|
|
62
85
|
tap: (options, fn) => hook.tap(options, (loaderContext) => fn(loaderContext.resource)),
|
|
@@ -64,7 +87,7 @@ class NormalModule {
|
|
|
64
87
|
tapPromise: (options, fn) => hook.tapPromise(options, (loaderContext) => fn(loaderContext.resource))
|
|
65
88
|
});
|
|
66
89
|
}),
|
|
67
|
-
readResource: new
|
|
90
|
+
readResource: new liteTapable.HookMap(() => new liteTapable.AsyncSeriesBailHook(["loaderContext"]))
|
|
68
91
|
};
|
|
69
92
|
compilationHooksMap.set(compilation, hooks);
|
|
70
93
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as binding from "@rspack/binding";
|
|
2
|
+
import * as liteTapable from "@rspack/lite-tapable";
|
|
2
3
|
import { ResolveData, ResourceDataWithData } from "./Module";
|
|
3
|
-
import * as liteTapable from "./lite-tapable";
|
|
4
4
|
export type NormalModuleCreateData = binding.JsNormalModuleFactoryCreateModuleArgs & {
|
|
5
5
|
settings: {};
|
|
6
6
|
};
|
|
@@ -9,6 +9,7 @@ export declare class NormalModuleFactory {
|
|
|
9
9
|
resolveForScheme: liteTapable.HookMap<liteTapable.AsyncSeriesBailHook<[ResourceDataWithData], true | void>>;
|
|
10
10
|
beforeResolve: liteTapable.AsyncSeriesBailHook<[ResolveData], false | void>;
|
|
11
11
|
factorize: liteTapable.AsyncSeriesBailHook<[ResolveData], void>;
|
|
12
|
+
resolve: liteTapable.AsyncSeriesBailHook<[ResolveData], void>;
|
|
12
13
|
afterResolve: liteTapable.AsyncSeriesBailHook<[ResolveData], false | void>;
|
|
13
14
|
createModule: liteTapable.AsyncSeriesBailHook<[
|
|
14
15
|
NormalModuleCreateData,
|
|
@@ -24,13 +24,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.NormalModuleFactory = void 0;
|
|
27
|
-
const liteTapable = __importStar(require("
|
|
27
|
+
const liteTapable = __importStar(require("@rspack/lite-tapable"));
|
|
28
28
|
class NormalModuleFactory {
|
|
29
29
|
constructor() {
|
|
30
30
|
this.hooks = {
|
|
31
31
|
resolveForScheme: new liteTapable.HookMap(() => new liteTapable.AsyncSeriesBailHook(["resourceData"])),
|
|
32
32
|
beforeResolve: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
|
|
33
33
|
factorize: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
|
|
34
|
+
resolve: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
|
|
34
35
|
afterResolve: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
|
|
35
36
|
createModule: new liteTapable.AsyncSeriesBailHook([
|
|
36
37
|
"createData",
|
|
@@ -24,13 +24,13 @@ declare class ResolverFactory {
|
|
|
24
24
|
declare namespace ResolverFactory {
|
|
25
25
|
export { ResolveOptions, Resolver, WebpackResolveOptions, ResolvePluginInstance, ResolveOptionsWithDependencyType, WithOptions, ResolverWithOptions, ResolverCache };
|
|
26
26
|
}
|
|
27
|
-
import { HookMap } from "tapable";
|
|
28
|
-
import { SyncWaterfallHook } from "tapable";
|
|
27
|
+
import { HookMap } from "@rspack/lite-tapable";
|
|
28
|
+
import { SyncWaterfallHook } from "@rspack/lite-tapable";
|
|
29
29
|
type ResolveOptionsWithDependencyType = WebpackResolveOptions & {
|
|
30
30
|
dependencyType?: string;
|
|
31
31
|
resolveToContext?: boolean;
|
|
32
32
|
};
|
|
33
|
-
import { SyncHook } from "tapable";
|
|
33
|
+
import { SyncHook } from "@rspack/lite-tapable";
|
|
34
34
|
type Resolver = import("../compiled/enhanced-resolve").Resolver;
|
|
35
35
|
type ResolveOptions = import("../compiled/enhanced-resolve").ResolveOptions;
|
|
36
36
|
type ResolverCache = {
|
package/dist/ResolverFactory.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
const Factory = require("../compiled/enhanced-resolve").ResolverFactory;
|
|
12
|
-
const { HookMap, SyncHook, SyncWaterfallHook } = require("tapable");
|
|
12
|
+
const { HookMap, SyncHook, SyncWaterfallHook } = require("@rspack/lite-tapable");
|
|
13
13
|
const { cachedCleverMerge, removeOperations, resolveByProperty } = require("./util/cleverMerge");
|
|
14
14
|
/** @typedef {import("../compiled/enhanced-resolve").ResolveOptions} ResolveOptions */
|
|
15
15
|
/** @typedef {import("../compiled/enhanced-resolve").Resolver} Resolver */
|
package/dist/Stats.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export declare class Stats {
|
|
|
7
7
|
compilation: Compilation;
|
|
8
8
|
constructor(compilation: Compilation);
|
|
9
9
|
get hash(): Readonly<string | null>;
|
|
10
|
+
get startTime(): number | undefined;
|
|
11
|
+
get endTime(): number | undefined;
|
|
10
12
|
hasErrors(): boolean;
|
|
11
13
|
hasWarnings(): boolean;
|
|
12
14
|
toJson(opts?: StatsValue, forToString?: boolean): StatsCompilation;
|
package/dist/Stats.js
CHANGED
|
@@ -25,6 +25,12 @@ class Stats {
|
|
|
25
25
|
get hash() {
|
|
26
26
|
return this.compilation.hash;
|
|
27
27
|
}
|
|
28
|
+
get startTime() {
|
|
29
|
+
return this.compilation.startTime;
|
|
30
|
+
}
|
|
31
|
+
get endTime() {
|
|
32
|
+
return this.compilation.endTime;
|
|
33
|
+
}
|
|
28
34
|
hasErrors() {
|
|
29
35
|
return __classPrivateFieldGet(this, _Stats_inner, "f").getErrors().length > 0;
|
|
30
36
|
}
|
package/dist/Watching.d.ts
CHANGED
|
@@ -2,6 +2,4 @@ export { resolvePluginImport } from "./pluginImport";
|
|
|
2
2
|
export type { PluginImportOptions } from "./pluginImport";
|
|
3
3
|
export type { ReactOptions } from "./react";
|
|
4
4
|
export { resolveReact } from "./react";
|
|
5
|
-
export { resolvePreact } from "./preact";
|
|
6
|
-
export type { PreactOptions } from "./preact";
|
|
7
5
|
export type { SwcLoaderEnvConfig, SwcLoaderEsParserConfig, SwcLoaderJscConfig, SwcLoaderModuleConfig, SwcLoaderOptions, SwcLoaderParserConfig, SwcLoaderTransformConfig, SwcLoaderTsParserConfig } from "./types";
|