@rspack/core 0.5.7 → 0.5.8-canary-2e1be96-20240321104547
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Chunk.d.ts +2 -0
- package/dist/Chunk.js +4 -0
- package/dist/Compilation.d.ts +17 -19
- package/dist/Compilation.js +10 -10
- package/dist/Compiler.d.ts +7 -6
- package/dist/Compiler.js +156 -240
- package/dist/Module.d.ts +3 -0
- package/dist/Module.js +12 -0
- package/dist/NormalModuleFactory.d.ts +2 -1
- package/dist/NormalModuleFactory.js +25 -1
- package/dist/Watching.js +2 -2
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BannerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +11 -0
- package/dist/builtin-plugin/JsLoaderRspackPlugin.js +7 -0
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +1 -1
- package/dist/builtin-plugin/base.d.ts +1 -1
- package/dist/builtin-plugin/index.d.ts +1 -0
- package/dist/builtin-plugin/index.js +1 -0
- package/dist/config/adapter.js +9 -8
- package/dist/config/zod.d.ts +332 -78
- package/dist/config/zod.js +8 -1
- package/dist/exports.d.ts +27 -15
- package/dist/lite-tapable/index.d.ts +14 -1
- package/dist/lite-tapable/index.js +168 -1
- package/dist/loader-runner/index.d.ts +2 -2
- package/dist/loader-runner/index.js +4 -4
- package/dist/rspackOptionsApply.js +1 -0
- package/package.json +5 -5
- package/dist/util/normalization.d.ts +0 -5
- package/dist/util/normalization.js +0 -9
package/dist/Chunk.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type JsChunk, type JsCompilation } from "@rspack/binding";
|
|
2
2
|
import { ChunkGroup } from "./ChunkGroup";
|
|
3
|
+
import { Compilation } from ".";
|
|
3
4
|
export declare class Chunk {
|
|
4
5
|
#private;
|
|
5
6
|
name?: string;
|
|
@@ -15,6 +16,7 @@ export declare class Chunk {
|
|
|
15
16
|
renderedHash?: string;
|
|
16
17
|
chunkReasons: Array<string>;
|
|
17
18
|
auxiliaryFiles: Array<string>;
|
|
19
|
+
static __from_binding(chunk: JsChunk, compilation: Compilation): Chunk;
|
|
18
20
|
static __from_binding(chunk: JsChunk, compilation: JsCompilation): Chunk;
|
|
19
21
|
constructor(chunk: JsChunk, compilation: JsCompilation);
|
|
20
22
|
isOnlyInitial(): boolean;
|
package/dist/Chunk.js
CHANGED
|
@@ -16,8 +16,12 @@ exports.Chunk = void 0;
|
|
|
16
16
|
const binding_1 = require("@rspack/binding");
|
|
17
17
|
const ChunkGroup_1 = require("./ChunkGroup");
|
|
18
18
|
const comparators_1 = require("./util/comparators");
|
|
19
|
+
const _1 = require(".");
|
|
19
20
|
class Chunk {
|
|
20
21
|
static __from_binding(chunk, compilation) {
|
|
22
|
+
if (compilation instanceof _1.Compilation) {
|
|
23
|
+
return new Chunk(chunk, compilation.__internal_getInner());
|
|
24
|
+
}
|
|
21
25
|
return new Chunk(chunk, compilation);
|
|
22
26
|
}
|
|
23
27
|
constructor(chunk, compilation) {
|
package/dist/Compilation.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import * as tapable from "tapable";
|
|
12
12
|
import { Source } from "webpack-sources";
|
|
13
|
-
import type { ExternalObject, JsAssetInfo,
|
|
13
|
+
import type { ExternalObject, JsAssetInfo, JsCompatSource, JsCompilation, JsModule, JsRuntimeModule, JsStatsChunk, JsStatsError, PathData } from "@rspack/binding";
|
|
14
14
|
import { RspackOptionsNormalized, StatsOptions, OutputNormalized, StatsValue, RspackPluginInstance } from "./config";
|
|
15
15
|
import * as liteTapable from "./lite-tapable";
|
|
16
16
|
import { ContextModuleFactory } from "./ContextModuleFactory";
|
|
@@ -21,10 +21,9 @@ import { NormalModuleFactory } from "./NormalModuleFactory";
|
|
|
21
21
|
import { Stats } from "./Stats";
|
|
22
22
|
import { StatsFactory } from "./stats/StatsFactory";
|
|
23
23
|
import { StatsPrinter } from "./stats/StatsPrinter";
|
|
24
|
-
import { NormalizedJsModule } from "./util/normalization";
|
|
25
24
|
import MergeCaller from "./util/MergeCaller";
|
|
26
25
|
import { Chunk } from "./Chunk";
|
|
27
|
-
import { CodeGenerationResult } from "./Module";
|
|
26
|
+
import { CodeGenerationResult, Module } from "./Module";
|
|
28
27
|
import { ChunkGraph } from "./ChunkGraph";
|
|
29
28
|
import { Entrypoint } from "./Entrypoint";
|
|
30
29
|
export type AssetInfo = Partial<JsAssetInfo> & Record<string, any>;
|
|
@@ -42,6 +41,7 @@ export interface LogEntry {
|
|
|
42
41
|
}
|
|
43
42
|
export interface CompilationParams {
|
|
44
43
|
normalModuleFactory: NormalModuleFactory;
|
|
44
|
+
contextModuleFactory: ContextModuleFactory;
|
|
45
45
|
}
|
|
46
46
|
export interface KnownCreateStatsOptionsContext {
|
|
47
47
|
forToString?: boolean;
|
|
@@ -67,29 +67,29 @@ export declare class Compilation {
|
|
|
67
67
|
childCompiler: tapable.SyncHook<[Compiler, string, number]>;
|
|
68
68
|
log: tapable.SyncBailHook<[string, LogEntry], true>;
|
|
69
69
|
additionalAssets: any;
|
|
70
|
-
optimizeModules: tapable.SyncBailHook<Iterable<
|
|
71
|
-
afterOptimizeModules: tapable.SyncHook<Iterable<
|
|
70
|
+
optimizeModules: tapable.SyncBailHook<Iterable<Module>, void>;
|
|
71
|
+
afterOptimizeModules: tapable.SyncHook<Iterable<Module>, void>;
|
|
72
72
|
optimizeTree: tapable.AsyncSeriesBailHook<[
|
|
73
73
|
Iterable<Chunk>,
|
|
74
|
-
Iterable<
|
|
74
|
+
Iterable<Module>
|
|
75
75
|
], void>;
|
|
76
76
|
optimizeChunkModules: tapable.AsyncSeriesBailHook<[
|
|
77
77
|
Iterable<Chunk>,
|
|
78
|
-
Iterable<
|
|
78
|
+
Iterable<Module>
|
|
79
79
|
], void>;
|
|
80
|
-
finishModules: tapable.AsyncSeriesHook<[Iterable<
|
|
81
|
-
chunkAsset:
|
|
80
|
+
finishModules: tapable.AsyncSeriesHook<[Iterable<Module>], void>;
|
|
81
|
+
chunkAsset: liteTapable.SyncHook<[Chunk, string], void>;
|
|
82
82
|
processWarnings: tapable.SyncWaterfallHook<[Error[]]>;
|
|
83
|
-
succeedModule:
|
|
84
|
-
stillValidModule:
|
|
83
|
+
succeedModule: liteTapable.SyncHook<[Module], void>;
|
|
84
|
+
stillValidModule: liteTapable.SyncHook<[Module], void>;
|
|
85
85
|
statsFactory: tapable.SyncHook<[StatsFactory, StatsOptions], void>;
|
|
86
86
|
statsPrinter: tapable.SyncHook<[StatsPrinter, StatsOptions], void>;
|
|
87
|
-
buildModule:
|
|
88
|
-
executeModule:
|
|
87
|
+
buildModule: liteTapable.SyncHook<[Module]>;
|
|
88
|
+
executeModule: liteTapable.SyncHook<[
|
|
89
89
|
ExecuteModuleArgument,
|
|
90
90
|
ExecuteModuleContext
|
|
91
91
|
]>;
|
|
92
|
-
runtimeModule:
|
|
92
|
+
runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk], void>;
|
|
93
93
|
};
|
|
94
94
|
options: RspackOptionsNormalized;
|
|
95
95
|
outputOptions: OutputNormalized;
|
|
@@ -101,9 +101,7 @@ export declare class Compilation {
|
|
|
101
101
|
childrenCounters: Record<string, number>;
|
|
102
102
|
startTime?: number;
|
|
103
103
|
endTime?: number;
|
|
104
|
-
normalModuleFactory?: NormalModuleFactory;
|
|
105
104
|
children: Compilation[];
|
|
106
|
-
contextModuleFactory?: ContextModuleFactory;
|
|
107
105
|
chunkGraph: ChunkGraph;
|
|
108
106
|
fileSystemInfo: {
|
|
109
107
|
createSnapshot(): null;
|
|
@@ -227,7 +225,7 @@ export declare class Compilation {
|
|
|
227
225
|
add: (dep: string) => void;
|
|
228
226
|
addAll: (deps: Iterable<string>) => void;
|
|
229
227
|
};
|
|
230
|
-
get modules():
|
|
228
|
+
get modules(): Module[];
|
|
231
229
|
get chunks(): Chunk[];
|
|
232
230
|
/**
|
|
233
231
|
* Get the named chunks.
|
|
@@ -267,8 +265,8 @@ export declare class Compilation {
|
|
|
267
265
|
__internal__getChunks(): Chunk[];
|
|
268
266
|
getStats(): Stats;
|
|
269
267
|
createChildCompiler(name: string, outputOptions: OutputNormalized, plugins: RspackPluginInstance[]): Compiler;
|
|
270
|
-
_rebuildModuleCaller: MergeCaller<[string, (err:
|
|
271
|
-
rebuildModule(m:
|
|
268
|
+
_rebuildModuleCaller: MergeCaller<[string, (err: Error, m: Module) => void]>;
|
|
269
|
+
rebuildModule(m: Module, f: (err: Error, m: Module) => void): void;
|
|
272
270
|
/**
|
|
273
271
|
* Get the `Source` of a given asset filename.
|
|
274
272
|
*
|
package/dist/Compilation.js
CHANGED
|
@@ -59,10 +59,10 @@ const StatsPrinter_1 = require("./stats/StatsPrinter");
|
|
|
59
59
|
const util_1 = require("./util");
|
|
60
60
|
const createSource_1 = require("./util/createSource");
|
|
61
61
|
const fake_1 = require("./util/fake");
|
|
62
|
-
const normalization_1 = require("./util/normalization");
|
|
63
62
|
const MergeCaller_1 = __importDefault(require("./util/MergeCaller"));
|
|
64
63
|
const memoize_1 = require("./util/memoize");
|
|
65
64
|
const Chunk_1 = require("./Chunk");
|
|
65
|
+
const Module_1 = require("./Module");
|
|
66
66
|
const ChunkGraph_1 = require("./ChunkGraph");
|
|
67
67
|
const Entrypoint_1 = require("./Entrypoint");
|
|
68
68
|
class Compilation {
|
|
@@ -85,7 +85,7 @@ class Compilation {
|
|
|
85
85
|
for (const [id, callback] of args) {
|
|
86
86
|
const m = modules.find(item => item.moduleIdentifier === id);
|
|
87
87
|
if (m) {
|
|
88
|
-
callback(err, m);
|
|
88
|
+
callback(err, Module_1.Module.__from_binding(m));
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
91
91
|
callback(err || new Error("module no found"), null);
|
|
@@ -146,15 +146,15 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
146
146
|
"modules"
|
|
147
147
|
]),
|
|
148
148
|
finishModules: new tapable.AsyncSeriesHook(["modules"]),
|
|
149
|
-
chunkAsset: new
|
|
149
|
+
chunkAsset: new liteTapable.SyncHook(["chunk", "filename"]),
|
|
150
150
|
processWarnings: new tapable.SyncWaterfallHook(["warnings"]),
|
|
151
|
-
succeedModule: new
|
|
152
|
-
stillValidModule: new
|
|
151
|
+
succeedModule: new liteTapable.SyncHook(["module"]),
|
|
152
|
+
stillValidModule: new liteTapable.SyncHook(["module"]),
|
|
153
153
|
statsFactory: new tapable.SyncHook(["statsFactory", "options"]),
|
|
154
154
|
statsPrinter: new tapable.SyncHook(["statsPrinter", "options"]),
|
|
155
|
-
buildModule: new
|
|
156
|
-
executeModule: new
|
|
157
|
-
runtimeModule: new
|
|
155
|
+
buildModule: new liteTapable.SyncHook(["module"]),
|
|
156
|
+
executeModule: new liteTapable.SyncHook(["options", "context"]),
|
|
157
|
+
runtimeModule: new liteTapable.SyncHook(["module", "chunk"])
|
|
158
158
|
};
|
|
159
159
|
this.compiler = compiler;
|
|
160
160
|
this.resolverFactory = compiler.resolverFactory;
|
|
@@ -549,7 +549,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
549
549
|
}
|
|
550
550
|
get modules() {
|
|
551
551
|
return (0, memoize_1.memoizeValue)(() => {
|
|
552
|
-
return this.__internal__getModules().map(item =>
|
|
552
|
+
return this.__internal__getModules().map(item => Module_1.Module.__from_binding(item));
|
|
553
553
|
});
|
|
554
554
|
}
|
|
555
555
|
// FIXME: This is not aligned with Webpack.
|
|
@@ -644,7 +644,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
644
644
|
return this.compiler.createChildCompiler(this, name, idx, outputOptions, plugins);
|
|
645
645
|
}
|
|
646
646
|
rebuildModule(m, f) {
|
|
647
|
-
this._rebuildModuleCaller.push([m.
|
|
647
|
+
this._rebuildModuleCaller.push([m.identifier(), f]);
|
|
648
648
|
}
|
|
649
649
|
/**
|
|
650
650
|
* Get the `Source` of a given asset filename.
|
package/dist/Compiler.d.ts
CHANGED
|
@@ -32,7 +32,8 @@ declare class Compiler {
|
|
|
32
32
|
rspack: typeof import("./rspack").rspack & typeof import("./exports") & any;
|
|
33
33
|
webpack: typeof import("./rspack").rspack & typeof import("./exports") & any;
|
|
34
34
|
};
|
|
35
|
-
compilation
|
|
35
|
+
compilation?: Compilation;
|
|
36
|
+
compilationParams?: CompilationParams;
|
|
36
37
|
first: boolean;
|
|
37
38
|
builtinPlugins: binding.BuiltinPlugin[];
|
|
38
39
|
root: Compiler;
|
|
@@ -50,23 +51,23 @@ declare class Compiler {
|
|
|
50
51
|
intermediateFileSystem: any;
|
|
51
52
|
watchMode: boolean;
|
|
52
53
|
context: string;
|
|
53
|
-
modifiedFiles?: ReadonlySet<string>;
|
|
54
54
|
cache: Cache;
|
|
55
55
|
compilerPath: string;
|
|
56
|
+
modifiedFiles?: ReadonlySet<string>;
|
|
56
57
|
removedFiles?: ReadonlySet<string>;
|
|
57
58
|
fileTimestamps?: ReadonlyMap<string, FileSystemInfoEntry | "ignore" | null>;
|
|
58
59
|
contextTimestamps?: ReadonlyMap<string, FileSystemInfoEntry | "ignore" | null>;
|
|
59
60
|
hooks: {
|
|
60
61
|
done: tapable.AsyncSeriesHook<Stats>;
|
|
61
62
|
afterDone: tapable.SyncHook<Stats>;
|
|
63
|
+
thisCompilation: liteTapable.SyncHook<[Compilation, CompilationParams]>;
|
|
62
64
|
compilation: liteTapable.SyncHook<[Compilation, CompilationParams]>;
|
|
63
|
-
thisCompilation: tapable.SyncHook<[Compilation, CompilationParams]>;
|
|
64
65
|
invalid: tapable.SyncHook<[string | null, number]>;
|
|
65
|
-
compile: tapable.SyncHook<[
|
|
66
|
+
compile: tapable.SyncHook<[CompilationParams]>;
|
|
66
67
|
normalModuleFactory: tapable.SyncHook<NormalModuleFactory>;
|
|
67
68
|
contextModuleFactory: tapable.SyncHook<ContextModuleFactory>;
|
|
68
69
|
initialize: tapable.SyncHook<[]>;
|
|
69
|
-
shouldEmit:
|
|
70
|
+
shouldEmit: liteTapable.SyncBailHook<[Compilation], boolean>;
|
|
70
71
|
infrastructureLog: tapable.SyncBailHook<[string, string, any[]], true>;
|
|
71
72
|
beforeRun: tapable.AsyncSeriesHook<[Compiler]>;
|
|
72
73
|
run: tapable.AsyncSeriesHook<[Compiler]>;
|
|
@@ -82,7 +83,7 @@ declare class Compiler {
|
|
|
82
83
|
afterPlugins: tapable.SyncHook<[Compiler]>;
|
|
83
84
|
afterResolvers: tapable.SyncHook<[Compiler]>;
|
|
84
85
|
make: liteTapable.AsyncParallelHook<[Compilation]>;
|
|
85
|
-
beforeCompile: tapable.AsyncSeriesHook<
|
|
86
|
+
beforeCompile: tapable.AsyncSeriesHook<[CompilationParams]>;
|
|
86
87
|
afterCompile: tapable.AsyncSeriesHook<[Compilation]>;
|
|
87
88
|
finishModules: tapable.AsyncSeriesHook<[any]>;
|
|
88
89
|
finishMake: tapable.AsyncSeriesHook<[Compilation]>;
|