@rspack/core 0.7.5-canary-08f2925-20240618102814 → 0.7.5-canary-87a73c3a-20240620004559
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 +19 -14
- package/dist/Chunk.js +22 -17
- package/dist/ChunkGraph.d.ts +1 -1
- package/dist/ChunkGraph.js +5 -5
- package/dist/ChunkGroup.d.ts +17 -7
- package/dist/ChunkGroup.js +12 -2
- package/dist/Compilation.d.ts +9 -15
- package/dist/Compilation.js +8 -16
- package/dist/Compiler.js +18 -2
- package/dist/Entrypoint.d.ts +1 -1
- package/dist/Entrypoint.js +2 -2
- package/dist/Module.d.ts +5 -5
- package/dist/NormalModule.d.ts +0 -1
- package/dist/NormalModule.js +0 -7
- package/dist/NormalModuleFactory.js +0 -22
- package/dist/Stats.d.ts +2 -2
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +15 -9
- package/dist/builtin-plugin/JavascriptModulesPlugin.js +50 -1
- package/dist/exports.d.ts +2 -1
- package/dist/exports.js +4 -1
- package/dist/util/memoize.js +5 -1
- package/package.json +4 -4
package/dist/Chunk.d.ts
CHANGED
|
@@ -3,19 +3,19 @@ import { Compilation } from ".";
|
|
|
3
3
|
import { ChunkGroup } from "./ChunkGroup";
|
|
4
4
|
export declare class Chunk {
|
|
5
5
|
#private;
|
|
6
|
-
name?: string
|
|
7
|
-
id?: string
|
|
8
|
-
ids:
|
|
9
|
-
idNameHints:
|
|
10
|
-
filenameTemplate?: string
|
|
11
|
-
cssFilenameTemplate?: string
|
|
12
|
-
files:
|
|
13
|
-
runtime:
|
|
14
|
-
hash?: string
|
|
15
|
-
contentHash: Record<string, string
|
|
16
|
-
renderedHash?: string
|
|
17
|
-
|
|
18
|
-
auxiliaryFiles:
|
|
6
|
+
name?: Readonly<string>;
|
|
7
|
+
id?: Readonly<string>;
|
|
8
|
+
ids: ReadonlyArray<string>;
|
|
9
|
+
idNameHints: ReadonlyArray<string>;
|
|
10
|
+
filenameTemplate?: Readonly<string>;
|
|
11
|
+
cssFilenameTemplate?: Readonly<string>;
|
|
12
|
+
files: ReadonlySet<string>;
|
|
13
|
+
runtime: ReadonlySet<string>;
|
|
14
|
+
hash?: Readonly<string>;
|
|
15
|
+
contentHash: Readonly<Record<string, string>>;
|
|
16
|
+
renderedHash?: Readonly<string>;
|
|
17
|
+
chunkReason: ReadonlyArray<string>;
|
|
18
|
+
auxiliaryFiles: ReadonlySet<string>;
|
|
19
19
|
static __from_binding(chunk: JsChunk, compilation: Compilation): Chunk;
|
|
20
20
|
static __from_binding(chunk: JsChunk, compilation: JsCompilation): Chunk;
|
|
21
21
|
constructor(chunk: JsChunk, compilation: JsCompilation);
|
|
@@ -26,5 +26,10 @@ export declare class Chunk {
|
|
|
26
26
|
getAllAsyncChunks(): Iterable<Chunk>;
|
|
27
27
|
getAllInitialChunks(): Iterable<Chunk>;
|
|
28
28
|
getAllReferencedChunks(): Iterable<Chunk>;
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
31
|
+
*
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
__internal__innerUkey(): number;
|
|
30
35
|
}
|
package/dist/Chunk.js
CHANGED
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
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");
|
|
11
11
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
12
|
};
|
|
13
|
-
var _Chunk_inner,
|
|
13
|
+
var _Chunk_inner, _Chunk_innerCompilation;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.Chunk = void 0;
|
|
16
16
|
const binding_1 = require("@rspack/binding");
|
|
@@ -26,52 +26,57 @@ class Chunk {
|
|
|
26
26
|
}
|
|
27
27
|
constructor(chunk, compilation) {
|
|
28
28
|
_Chunk_inner.set(this, void 0);
|
|
29
|
-
|
|
29
|
+
_Chunk_innerCompilation.set(this, void 0);
|
|
30
30
|
__classPrivateFieldSet(this, _Chunk_inner, chunk, "f");
|
|
31
|
-
__classPrivateFieldSet(this,
|
|
31
|
+
__classPrivateFieldSet(this, _Chunk_innerCompilation, compilation, "f");
|
|
32
32
|
this.name = chunk.name;
|
|
33
33
|
this.id = chunk.id;
|
|
34
34
|
this.ids = chunk.ids;
|
|
35
35
|
this.idNameHints = chunk.idNameHints;
|
|
36
36
|
this.filenameTemplate = chunk.filenameTemplate;
|
|
37
37
|
this.cssFilenameTemplate = chunk.cssFilenameTemplate;
|
|
38
|
-
this.files = chunk.files;
|
|
39
|
-
this.runtime = chunk.runtime;
|
|
38
|
+
this.files = new Set(chunk.files);
|
|
39
|
+
this.runtime = new Set(chunk.runtime);
|
|
40
40
|
this.hash = chunk.hash;
|
|
41
41
|
this.contentHash = chunk.contentHash;
|
|
42
42
|
this.renderedHash = chunk.renderedHash;
|
|
43
|
-
this.
|
|
44
|
-
this.auxiliaryFiles = chunk.auxiliaryFiles;
|
|
43
|
+
this.chunkReason = chunk.chunkReason;
|
|
44
|
+
this.auxiliaryFiles = new Set(chunk.auxiliaryFiles);
|
|
45
45
|
}
|
|
46
46
|
isOnlyInitial() {
|
|
47
|
-
return (0, binding_1.__chunk_inner_is_only_initial)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this,
|
|
47
|
+
return (0, binding_1.__chunk_inner_is_only_initial)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"));
|
|
48
48
|
}
|
|
49
49
|
canBeInitial() {
|
|
50
|
-
return (0, binding_1.__chunk_inner_can_be_initial)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this,
|
|
50
|
+
return (0, binding_1.__chunk_inner_can_be_initial)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"));
|
|
51
51
|
}
|
|
52
52
|
hasRuntime() {
|
|
53
|
-
return (0, binding_1.__chunk_inner_has_runtime)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this,
|
|
53
|
+
return (0, binding_1.__chunk_inner_has_runtime)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"));
|
|
54
54
|
}
|
|
55
55
|
get groupsIterable() {
|
|
56
56
|
const chunk_groups = __classPrivateFieldGet(this, _Chunk_inner, "f").__inner_groups.map(ukey => {
|
|
57
|
-
const cg = (0, binding_1.__chunk_group_inner_get_chunk_group)(ukey, __classPrivateFieldGet(this,
|
|
58
|
-
return ChunkGroup_1.ChunkGroup.__from_binding(cg, __classPrivateFieldGet(this,
|
|
57
|
+
const cg = (0, binding_1.__chunk_group_inner_get_chunk_group)(ukey, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"));
|
|
58
|
+
return ChunkGroup_1.ChunkGroup.__from_binding(cg, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"));
|
|
59
59
|
});
|
|
60
60
|
chunk_groups.sort(comparators_1.compareChunkGroupsByIndex);
|
|
61
61
|
return new Set(chunk_groups);
|
|
62
62
|
}
|
|
63
63
|
getAllAsyncChunks() {
|
|
64
|
-
return new Set((0, binding_1.__chunk_inner_get_all_async_chunks)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this,
|
|
64
|
+
return new Set((0, binding_1.__chunk_inner_get_all_async_chunks)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f")).map(c => Chunk.__from_binding(c, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"))));
|
|
65
65
|
}
|
|
66
66
|
getAllInitialChunks() {
|
|
67
|
-
return new Set((0, binding_1.__chunk_inner_get_all_initial_chunks)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this,
|
|
67
|
+
return new Set((0, binding_1.__chunk_inner_get_all_initial_chunks)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f")).map(c => Chunk.__from_binding(c, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"))));
|
|
68
68
|
}
|
|
69
69
|
getAllReferencedChunks() {
|
|
70
|
-
return new Set((0, binding_1.__chunk_inner_get_all_referenced_chunks)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this,
|
|
70
|
+
return new Set((0, binding_1.__chunk_inner_get_all_referenced_chunks)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f")).map(c => Chunk.__from_binding(c, __classPrivateFieldGet(this, _Chunk_innerCompilation, "f"))));
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
74
|
+
*
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
__internal__innerUkey() {
|
|
73
78
|
return __classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey;
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
81
|
exports.Chunk = Chunk;
|
|
77
|
-
_Chunk_inner = new WeakMap(),
|
|
82
|
+
_Chunk_inner = new WeakMap(), _Chunk_innerCompilation = new WeakMap();
|
package/dist/ChunkGraph.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Module } from "./Module";
|
|
|
4
4
|
export declare class ChunkGraph {
|
|
5
5
|
private compilation;
|
|
6
6
|
constructor(compilation: Compilation);
|
|
7
|
-
getChunkModules(chunk: Chunk): Module[]
|
|
7
|
+
getChunkModules(chunk: Chunk): Readonly<Module[]>;
|
|
8
8
|
getChunkModulesIterable(chunk: Chunk): Iterable<Module>;
|
|
9
9
|
getChunkEntryModulesIterable(chunk: Chunk): Iterable<Module>;
|
|
10
10
|
getChunkEntryDependentChunksIterable(chunk: Chunk): Iterable<Chunk>;
|
package/dist/ChunkGraph.js
CHANGED
|
@@ -9,19 +9,19 @@ class ChunkGraph {
|
|
|
9
9
|
this.compilation = compilation;
|
|
10
10
|
}
|
|
11
11
|
getChunkModules(chunk) {
|
|
12
|
-
return (0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.
|
|
12
|
+
return (0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.__internal__innerUkey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation));
|
|
13
13
|
}
|
|
14
14
|
getChunkModulesIterable(chunk) {
|
|
15
|
-
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.
|
|
15
|
+
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.__internal__innerUkey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
|
|
16
16
|
}
|
|
17
17
|
getChunkEntryModulesIterable(chunk) {
|
|
18
|
-
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_entry_modules)(chunk.
|
|
18
|
+
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_entry_modules)(chunk.__internal__innerUkey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
|
|
19
19
|
}
|
|
20
20
|
getChunkEntryDependentChunksIterable(chunk) {
|
|
21
|
-
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_entry_dependent_chunks_iterable)(chunk.
|
|
21
|
+
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_entry_dependent_chunks_iterable)(chunk.__internal__innerUkey(), this.compilation.__internal_getInner()).map(c => Chunk_1.Chunk.__from_binding(c, this.compilation.__internal_getInner())));
|
|
22
22
|
}
|
|
23
23
|
getChunkModulesIterableBySourceType(chunk, sourceType) {
|
|
24
|
-
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules_iterable_by_source_type)(chunk.
|
|
24
|
+
return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules_iterable_by_source_type)(chunk.__internal__innerUkey(), sourceType, this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
exports.ChunkGraph = ChunkGraph;
|
package/dist/ChunkGroup.d.ts
CHANGED
|
@@ -4,11 +4,21 @@ export declare class ChunkGroup {
|
|
|
4
4
|
#private;
|
|
5
5
|
static __from_binding(chunk: JsChunkGroup, compilation: JsCompilation): ChunkGroup;
|
|
6
6
|
protected constructor(inner: JsChunkGroup, compilation: JsCompilation);
|
|
7
|
-
getFiles(): string
|
|
8
|
-
getParents(): ChunkGroup
|
|
9
|
-
get chunks(): Chunk
|
|
10
|
-
get index(): number | undefined
|
|
11
|
-
get name(): string | undefined
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
getFiles(): ReadonlyArray<string>;
|
|
8
|
+
getParents(): ReadonlyArray<ChunkGroup>;
|
|
9
|
+
get chunks(): ReadonlyArray<Chunk>;
|
|
10
|
+
get index(): Readonly<number | undefined>;
|
|
11
|
+
get name(): Readonly<string | undefined>;
|
|
12
|
+
/**
|
|
13
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
__internal__innerUkey(): number;
|
|
18
|
+
/**
|
|
19
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
__internal__innerCompilation(): JsCompilation;
|
|
14
24
|
}
|
package/dist/ChunkGroup.js
CHANGED
|
@@ -49,10 +49,20 @@ class ChunkGroup {
|
|
|
49
49
|
get name() {
|
|
50
50
|
return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").name;
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
54
|
+
*
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
__internal__innerUkey() {
|
|
53
58
|
return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").__inner_ukey;
|
|
54
59
|
}
|
|
55
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
__internal__innerCompilation() {
|
|
56
66
|
return __classPrivateFieldGet(this, _ChunkGroup_innerCompilation, "f");
|
|
57
67
|
}
|
|
58
68
|
}
|
package/dist/Compilation.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
/**
|
|
3
2
|
* The following code is modified based on
|
|
4
3
|
* https://github.com/webpack/webpack/blob/4b4ca3bb53f36a5b8fc6bc1bd976ed7af161bd80/lib/Compilation.js
|
|
@@ -26,7 +25,7 @@ import { Logger } from "./logging/Logger";
|
|
|
26
25
|
import { StatsFactory } from "./stats/StatsFactory";
|
|
27
26
|
import { StatsPrinter } from "./stats/StatsPrinter";
|
|
28
27
|
import { type AssetInfo } from "./util/AssetInfo";
|
|
29
|
-
import
|
|
28
|
+
import Hash = require("./util/hash");
|
|
30
29
|
export { type AssetInfo } from "./util/AssetInfo";
|
|
31
30
|
export type Assets = Record<string, Source>;
|
|
32
31
|
export interface Asset {
|
|
@@ -102,7 +101,7 @@ export type CreateStatsOptionsContext = KnownCreateStatsOptionsContext & Record<
|
|
|
102
101
|
export type NormalizedStatsOptions = KnownNormalizedStatsOptions & Omit<StatsOptions, keyof KnownNormalizedStatsOptions> & Record<string, any>;
|
|
103
102
|
export declare class Compilation {
|
|
104
103
|
#private;
|
|
105
|
-
hooks: {
|
|
104
|
+
hooks: Readonly<{
|
|
106
105
|
processAssets: liteTapable.AsyncSeriesHook<Assets>;
|
|
107
106
|
afterProcessAssets: liteTapable.SyncHook<Assets>;
|
|
108
107
|
childCompiler: tapable.SyncHook<[Compiler, string, number]>;
|
|
@@ -119,6 +118,7 @@ export declare class Compilation {
|
|
|
119
118
|
Iterable<Module>
|
|
120
119
|
], void>;
|
|
121
120
|
finishModules: liteTapable.AsyncSeriesHook<[Iterable<Module>], void>;
|
|
121
|
+
chunkHash: liteTapable.SyncHook<[Chunk, Hash], void>;
|
|
122
122
|
chunkAsset: liteTapable.SyncHook<[Chunk, string], void>;
|
|
123
123
|
processWarnings: tapable.SyncWaterfallHook<[Error[]]>;
|
|
124
124
|
succeedModule: liteTapable.SyncHook<[Module], void>;
|
|
@@ -141,7 +141,7 @@ export declare class Compilation {
|
|
|
141
141
|
], void>;
|
|
142
142
|
runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk], void>;
|
|
143
143
|
afterSeal: liteTapable.AsyncSeriesHook<[], void>;
|
|
144
|
-
}
|
|
144
|
+
}>;
|
|
145
145
|
name?: string;
|
|
146
146
|
startTime?: number;
|
|
147
147
|
endTime?: number;
|
|
@@ -158,13 +158,8 @@ export declare class Compilation {
|
|
|
158
158
|
createSnapshot(): null;
|
|
159
159
|
};
|
|
160
160
|
constructor(compiler: Compiler, inner: JsCompilation);
|
|
161
|
-
get
|
|
162
|
-
|
|
163
|
-
readResourceForScheme: any;
|
|
164
|
-
readResource: tapable.HookMap<tapable.AsyncSeriesBailHook<[import("./config").LoaderContext<{}>], string | Buffer, tapable.UnsetAdditionalOptions>>;
|
|
165
|
-
};
|
|
166
|
-
get hash(): string | null;
|
|
167
|
-
get fullHash(): string | null;
|
|
161
|
+
get hash(): Readonly<string | null>;
|
|
162
|
+
get fullHash(): Readonly<string | null>;
|
|
168
163
|
/**
|
|
169
164
|
* Get a map of all assets.
|
|
170
165
|
*/
|
|
@@ -173,14 +168,14 @@ export declare class Compilation {
|
|
|
173
168
|
* Get a map of all entrypoints.
|
|
174
169
|
*/
|
|
175
170
|
get entrypoints(): ReadonlyMap<string, Entrypoint>;
|
|
176
|
-
get modules(): Module
|
|
177
|
-
get chunks(): Chunk
|
|
171
|
+
get modules(): ReadonlySet<Module>;
|
|
172
|
+
get chunks(): ReadonlySet<Chunk>;
|
|
178
173
|
/**
|
|
179
174
|
* Get the named chunks.
|
|
180
175
|
*
|
|
181
176
|
* Note: This is a proxy for webpack internal API, only method `get` is supported now.
|
|
182
177
|
*/
|
|
183
|
-
get namedChunks():
|
|
178
|
+
get namedChunks(): ReadonlyMap<string, Readonly<Chunk>>;
|
|
184
179
|
/**
|
|
185
180
|
* Note: This is not a webpack public API, maybe removed in future.
|
|
186
181
|
*
|
|
@@ -260,7 +255,6 @@ export declare class Compilation {
|
|
|
260
255
|
};
|
|
261
256
|
getStats(): Stats;
|
|
262
257
|
createChildCompiler(name: string, outputOptions: OutputNormalized, plugins: RspackPluginInstance[]): Compiler;
|
|
263
|
-
_rebuildModuleCaller: MergeCaller<[string, (err: Error, m: Module) => void]>;
|
|
264
258
|
rebuildModule(m: Module, f: (err: Error, m: Module) => void): void;
|
|
265
259
|
/**
|
|
266
260
|
* Get the `Source` of a given asset filename.
|
package/dist/Compilation.js
CHANGED
|
@@ -36,7 +36,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
36
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
|
-
var _Compilation_instances, _Compilation_inner, _Compilation_cachedAssets, _Compilation_customModules, _Compilation_createCachedAssets;
|
|
39
|
+
var _Compilation_instances, _Compilation_inner, _Compilation_cachedAssets, _Compilation_customModules, _Compilation_createCachedAssets, _Compilation_rebuildModuleCaller;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.Compilation = void 0;
|
|
42
42
|
const tapable = __importStar(require("tapable"));
|
|
@@ -46,7 +46,6 @@ const ChunkGraph_1 = require("./ChunkGraph");
|
|
|
46
46
|
const Entrypoint_1 = require("./Entrypoint");
|
|
47
47
|
const ErrorHelpers_1 = __importDefault(require("./ErrorHelpers"));
|
|
48
48
|
const Module_1 = require("./Module");
|
|
49
|
-
const NormalModule_1 = require("./NormalModule");
|
|
50
49
|
const Stats_1 = require("./Stats");
|
|
51
50
|
const Logger_1 = require("./logging/Logger");
|
|
52
51
|
const StatsFactory_1 = require("./stats/StatsFactory");
|
|
@@ -77,7 +76,7 @@ class Compilation {
|
|
|
77
76
|
this.contextDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getContextDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addContextDependencies(d));
|
|
78
77
|
this.missingDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getMissingDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addMissingDependencies(d));
|
|
79
78
|
this.buildDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getBuildDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addBuildDependencies(d));
|
|
80
|
-
this
|
|
79
|
+
_Compilation_rebuildModuleCaller.set(this, (function (compilation) {
|
|
81
80
|
return new MergeCaller_1.default((args) => {
|
|
82
81
|
__classPrivateFieldGet(compilation, _Compilation_inner, "f").rebuildModule(args.map(item => item[0]), function (err, modules) {
|
|
83
82
|
for (const [id, callback] of args) {
|
|
@@ -91,7 +90,7 @@ class Compilation {
|
|
|
91
90
|
}
|
|
92
91
|
});
|
|
93
92
|
}, 10);
|
|
94
|
-
})(this);
|
|
93
|
+
})(this));
|
|
95
94
|
__classPrivateFieldSet(this, _Compilation_inner, inner, "f");
|
|
96
95
|
__classPrivateFieldSet(this, _Compilation_cachedAssets, __classPrivateFieldGet(this, _Compilation_instances, "m", _Compilation_createCachedAssets).call(this), "f");
|
|
97
96
|
__classPrivateFieldSet(this, _Compilation_customModules, {}, "f");
|
|
@@ -145,6 +144,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
145
144
|
"modules"
|
|
146
145
|
]),
|
|
147
146
|
finishModules: new liteTapable.AsyncSeriesHook(["modules"]),
|
|
147
|
+
chunkHash: new liteTapable.SyncHook(["chunk", "hash"]),
|
|
148
148
|
chunkAsset: new liteTapable.SyncHook(["chunk", "filename"]),
|
|
149
149
|
processWarnings: new tapable.SyncWaterfallHook(["warnings"]),
|
|
150
150
|
succeedModule: new liteTapable.SyncHook(["module"]),
|
|
@@ -172,9 +172,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
172
172
|
this.children = [];
|
|
173
173
|
this.chunkGraph = new ChunkGraph_1.ChunkGraph(this);
|
|
174
174
|
}
|
|
175
|
-
get currentNormalModuleHooks() {
|
|
176
|
-
return NormalModule_1.NormalModule.getCompilationHooks(this);
|
|
177
|
-
}
|
|
178
175
|
get hash() {
|
|
179
176
|
return __classPrivateFieldGet(this, _Compilation_inner, "f").hash;
|
|
180
177
|
}
|
|
@@ -197,15 +194,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
197
194
|
]));
|
|
198
195
|
}
|
|
199
196
|
get modules() {
|
|
200
|
-
return (0, memoize_1.memoizeValue)(() =>
|
|
201
|
-
return this.__internal__getModules().map(item => Module_1.Module.__from_binding(item, this));
|
|
202
|
-
});
|
|
197
|
+
return (0, memoize_1.memoizeValue)(() => new Set(this.__internal__getModules().map(item => Module_1.Module.__from_binding(item, this))));
|
|
203
198
|
}
|
|
204
|
-
// FIXME: Webpack returns a `Set`
|
|
205
199
|
get chunks() {
|
|
206
|
-
return (0, memoize_1.memoizeValue)(() =>
|
|
207
|
-
return this.__internal__getChunks();
|
|
208
|
-
});
|
|
200
|
+
return (0, memoize_1.memoizeValue)(() => new Set(this.__internal__getChunks()));
|
|
209
201
|
}
|
|
210
202
|
/**
|
|
211
203
|
* Get the named chunks.
|
|
@@ -619,7 +611,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
619
611
|
return this.compiler.createChildCompiler(this, name, idx, outputOptions, plugins);
|
|
620
612
|
}
|
|
621
613
|
rebuildModule(m, f) {
|
|
622
|
-
this.
|
|
614
|
+
__classPrivateFieldGet(this, _Compilation_rebuildModuleCaller, "f").push([m.identifier(), f]);
|
|
623
615
|
}
|
|
624
616
|
/**
|
|
625
617
|
* Get the `Source` of a given asset filename.
|
|
@@ -704,7 +696,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
704
696
|
seal() { }
|
|
705
697
|
unseal() { }
|
|
706
698
|
}
|
|
707
|
-
_Compilation_inner = new WeakMap(), _Compilation_cachedAssets = new WeakMap(), _Compilation_customModules = new WeakMap(), _Compilation_instances = new WeakSet(), _Compilation_createCachedAssets = function _Compilation_createCachedAssets() {
|
|
699
|
+
_Compilation_inner = new WeakMap(), _Compilation_cachedAssets = new WeakMap(), _Compilation_customModules = new WeakMap(), _Compilation_rebuildModuleCaller = new WeakMap(), _Compilation_instances = new WeakSet(), _Compilation_createCachedAssets = function _Compilation_createCachedAssets() {
|
|
708
700
|
return new Proxy({}, {
|
|
709
701
|
get: (_, property) => {
|
|
710
702
|
if (typeof property === "string") {
|
package/dist/Compiler.js
CHANGED
|
@@ -77,6 +77,7 @@ const Logger_1 = require("./logging/Logger");
|
|
|
77
77
|
const util_1 = require("./util");
|
|
78
78
|
const assertNotNil_1 = require("./util/assertNotNil");
|
|
79
79
|
const bindingVersionCheck_1 = require("./util/bindingVersionCheck");
|
|
80
|
+
const createHash_1 = require("./util/createHash");
|
|
80
81
|
const identifier_1 = require("./util/identifier");
|
|
81
82
|
class Compiler {
|
|
82
83
|
constructor(context, options) {
|
|
@@ -651,10 +652,18 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
|
|
|
651
652
|
__classPrivateFieldGet(this, _Compiler_moduleExecutionResultsMap, "f").set(id, executeResult);
|
|
652
653
|
}),
|
|
653
654
|
registerCompilationFinishModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationFinishModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.finishModules, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f").modules)),
|
|
654
|
-
registerCompilationOptimizeModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationOptimizeModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.optimizeModules, queried => () => queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f").modules)),
|
|
655
|
-
registerCompilationAfterOptimizeModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterOptimizeModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.afterOptimizeModules, queried => () =>
|
|
655
|
+
registerCompilationOptimizeModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationOptimizeModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.optimizeModules, queried => () => queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f").modules.values())),
|
|
656
|
+
registerCompilationAfterOptimizeModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterOptimizeModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.afterOptimizeModules, queried => () => {
|
|
657
|
+
queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f").modules.values());
|
|
658
|
+
}),
|
|
656
659
|
registerCompilationOptimizeTreeTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationOptimizeTree, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.optimizeTree, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f").chunks, __classPrivateFieldGet(this, _Compiler_compilation, "f").modules)),
|
|
657
660
|
registerCompilationOptimizeChunkModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationOptimizeChunkModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.optimizeChunkModules, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f").chunks, __classPrivateFieldGet(this, _Compiler_compilation, "f").modules)),
|
|
661
|
+
registerCompilationChunkHashTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationChunkHash, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.chunkHash, queried => (chunk) => {
|
|
662
|
+
const hash = (0, createHash_1.createHash)(this.options.output.hashFunction);
|
|
663
|
+
queried.call(Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")), hash);
|
|
664
|
+
const digestResult = hash.digest(this.options.output.hashDigest);
|
|
665
|
+
return Buffer.from(digestResult);
|
|
666
|
+
}),
|
|
658
667
|
registerCompilationChunkAssetTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationChunkAsset, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.chunkAsset, queried => ({ chunk, filename }) => queried.call(Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")), filename)),
|
|
659
668
|
registerCompilationProcessAssetsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationProcessAssets, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.processAssets, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f").assets)),
|
|
660
669
|
registerCompilationAfterProcessAssetsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterProcessAssets, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.afterProcessAssets, queried => () => queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f").assets)),
|
|
@@ -728,6 +737,13 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
|
|
|
728
737
|
})
|
|
729
738
|
: false;
|
|
730
739
|
return result;
|
|
740
|
+
}),
|
|
741
|
+
registerJavascriptModulesChunkHashTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.JavascriptModulesChunkHash, () => builtin_plugin_1.JavascriptModulesPlugin.getCompilationHooks(__classPrivateFieldGet(this, _Compiler_compilation, "f"))
|
|
742
|
+
.chunkHash, queried => (chunk) => {
|
|
743
|
+
const hash = (0, createHash_1.createHash)(this.options.output.hashFunction);
|
|
744
|
+
queried.call(Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")), hash);
|
|
745
|
+
const digestResult = hash.digest(this.options.output.hashDigest);
|
|
746
|
+
return Buffer.from(digestResult);
|
|
731
747
|
})
|
|
732
748
|
}, "f");
|
|
733
749
|
__classPrivateFieldSet(this, _Compiler_instance, new instanceBinding.Rspack(rawOptions, __classPrivateFieldGet(this, _Compiler_builtinPlugins, "f"), __classPrivateFieldGet(this, _Compiler_registers, "f"), FileSystem_1.ThreadsafeWritableNodeFS.__to_binding(this.outputFileSystem)), "f");
|
package/dist/Entrypoint.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ import { ChunkGroup } from "./ChunkGroup";
|
|
|
4
4
|
export declare class Entrypoint extends ChunkGroup {
|
|
5
5
|
static __from_binding(chunk: JsChunkGroup, compilation: JsCompilation): Entrypoint;
|
|
6
6
|
protected constructor(inner: JsChunkGroup, compilation: JsCompilation);
|
|
7
|
-
getRuntimeChunk(): Chunk | null
|
|
7
|
+
getRuntimeChunk(): Readonly<Chunk | null>;
|
|
8
8
|
}
|
package/dist/Entrypoint.js
CHANGED
|
@@ -12,9 +12,9 @@ class Entrypoint extends ChunkGroup_1.ChunkGroup {
|
|
|
12
12
|
super(inner, compilation);
|
|
13
13
|
}
|
|
14
14
|
getRuntimeChunk() {
|
|
15
|
-
const c = (0, binding_1.__entrypoint_inner_get_runtime_chunk)(this.
|
|
15
|
+
const c = (0, binding_1.__entrypoint_inner_get_runtime_chunk)(this.__internal__innerUkey(), this.__internal__innerCompilation());
|
|
16
16
|
if (c)
|
|
17
|
-
return Chunk_1.Chunk.__from_binding(c, this.
|
|
17
|
+
return Chunk_1.Chunk.__from_binding(c, this.__internal__innerCompilation());
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
20
|
}
|
package/dist/Module.d.ts
CHANGED
|
@@ -32,11 +32,11 @@ export type ContextModuleFactoryAfterResolveResult = false | {
|
|
|
32
32
|
};
|
|
33
33
|
export declare class Module {
|
|
34
34
|
#private;
|
|
35
|
-
context?: string
|
|
36
|
-
resource?: string
|
|
37
|
-
request?: string
|
|
38
|
-
userRequest?: string
|
|
39
|
-
rawRequest?: string
|
|
35
|
+
context?: Readonly<string>;
|
|
36
|
+
resource?: Readonly<string>;
|
|
37
|
+
request?: Readonly<string>;
|
|
38
|
+
userRequest?: Readonly<string>;
|
|
39
|
+
rawRequest?: Readonly<string>;
|
|
40
40
|
/**
|
|
41
41
|
* Records the dynamically added fields for Module on the JavaScript side.
|
|
42
42
|
* These fields are generally used within a plugin, so they do not need to be passed back to the Rust side.
|
package/dist/NormalModule.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { AsyncSeriesBailHook, HookMap, SyncHook } from "tapable";
|
|
|
3
3
|
import { Compilation } from "./Compilation";
|
|
4
4
|
import { LoaderContext } from "./config";
|
|
5
5
|
export declare class NormalModule {
|
|
6
|
-
constructor();
|
|
7
6
|
static getCompilationHooks(compilation: Compilation): {
|
|
8
7
|
loader: SyncHook<[LoaderContext<{}>], void, import("tapable").UnsetAdditionalOptions>;
|
|
9
8
|
readResourceForScheme: any;
|
package/dist/NormalModule.js
CHANGED
|
@@ -46,10 +46,7 @@ const deprecateAllProperties = (obj, message, code) => {
|
|
|
46
46
|
}
|
|
47
47
|
return newObj;
|
|
48
48
|
};
|
|
49
|
-
// Actually it is just a NormalModule proxy, used for hooks api alignment
|
|
50
|
-
// Maybe we can 1:1 align to webpack NormalModule once we found a better way to reduce communicate overhead between rust and js
|
|
51
49
|
class NormalModule {
|
|
52
|
-
constructor() { }
|
|
53
50
|
static getCompilationHooks(compilation) {
|
|
54
51
|
if (!(compilation instanceof Compilation_1.Compilation)) {
|
|
55
52
|
throw new TypeError("The 'compilation' argument must be an instance of Compilation");
|
|
@@ -58,9 +55,6 @@ class NormalModule {
|
|
|
58
55
|
if (hooks === undefined) {
|
|
59
56
|
hooks = {
|
|
60
57
|
loader: new tapable_1.SyncHook(["loaderContext"]),
|
|
61
|
-
// beforeLoaders: new SyncHook(["loaders", "module", "loaderContext"]),
|
|
62
|
-
// beforeParse: new SyncHook(["module"]),
|
|
63
|
-
// beforeSnapshot: new SyncHook(["module"]),
|
|
64
58
|
// TODO webpack 6 deprecate
|
|
65
59
|
readResourceForScheme: new tapable_1.HookMap(scheme => {
|
|
66
60
|
const hook = hooks.readResource.for(scheme);
|
|
@@ -71,7 +65,6 @@ class NormalModule {
|
|
|
71
65
|
});
|
|
72
66
|
}),
|
|
73
67
|
readResource: new tapable_1.HookMap(() => new tapable_1.AsyncSeriesBailHook(["loaderContext"]))
|
|
74
|
-
// needBuild: new AsyncSeriesBailHook(["module", "context"])
|
|
75
68
|
};
|
|
76
69
|
compilationHooksMap.set(compilation, hooks);
|
|
77
70
|
}
|
|
@@ -28,35 +28,13 @@ const liteTapable = __importStar(require("./lite-tapable"));
|
|
|
28
28
|
class NormalModuleFactory {
|
|
29
29
|
constructor() {
|
|
30
30
|
this.hooks = {
|
|
31
|
-
// /** @type {AsyncSeriesBailHook<[ResolveData], Module | false | void>} */
|
|
32
|
-
// resolve: new AsyncSeriesBailHook(["resolveData"]),
|
|
33
|
-
// /** @type {HookMap<AsyncSeriesBailHook<[ResourceDataWithData, ResolveData], true | void>>} */
|
|
34
31
|
resolveForScheme: new liteTapable.HookMap(() => new liteTapable.AsyncSeriesBailHook(["resourceData"])),
|
|
35
|
-
// /** @type {HookMap<AsyncSeriesBailHook<[ResourceDataWithData, ResolveData], true | void>>} */
|
|
36
|
-
// resolveInScheme: new HookMap(
|
|
37
|
-
// () => new AsyncSeriesBailHook(["resourceData", "resolveData"])
|
|
38
|
-
// ),
|
|
39
|
-
// /** @type {AsyncSeriesBailHook<[ResolveData], Module>} */
|
|
40
|
-
// factorize: new AsyncSeriesBailHook(["resolveData"]),
|
|
41
|
-
// /** @type {AsyncSeriesBailHook<[ResolveData], false | void>} */
|
|
42
32
|
beforeResolve: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
|
|
43
|
-
// /** @type {AsyncSeriesBailHook<[ResolveData], false | void>} */
|
|
44
33
|
afterResolve: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
|
|
45
|
-
// /** @type {AsyncSeriesBailHook<[ResolveData["createData"], ResolveData], Module | void>} */
|
|
46
34
|
createModule: new liteTapable.AsyncSeriesBailHook([
|
|
47
35
|
"createData",
|
|
48
36
|
"resolveData"
|
|
49
37
|
])
|
|
50
|
-
// /** @type {SyncWaterfallHook<[Module, ResolveData["createData"], ResolveData], Module>} */
|
|
51
|
-
// module: new SyncWaterfallHook(["module", "createData", "resolveData"]),
|
|
52
|
-
// createParser: new HookMap(() => new SyncBailHook(["parserOptions"])),
|
|
53
|
-
// parser: new HookMap(() => new SyncHook(["parser", "parserOptions"])),
|
|
54
|
-
// createGenerator: new HookMap(
|
|
55
|
-
// () => new SyncBailHook(["generatorOptions"])
|
|
56
|
-
// ),
|
|
57
|
-
// generator: new HookMap(
|
|
58
|
-
// () => new SyncHook(["generator", "generatorOptions"])
|
|
59
|
-
// )
|
|
60
38
|
};
|
|
61
39
|
}
|
|
62
40
|
}
|
package/dist/Stats.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Compilation } from "
|
|
1
|
+
import { Compilation } from "./Compilation";
|
|
2
2
|
import { StatsOptions, StatsValue } from "./config";
|
|
3
3
|
import type { StatsCompilation } from "./stats/statsFactoryUtils";
|
|
4
4
|
export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule, StatsWarnings } from "./stats/statsFactoryUtils";
|
|
@@ -6,7 +6,7 @@ export declare class Stats {
|
|
|
6
6
|
#private;
|
|
7
7
|
compilation: Compilation;
|
|
8
8
|
constructor(compilation: Compilation);
|
|
9
|
-
get hash(): string | null
|
|
9
|
+
get hash(): Readonly<string | null>;
|
|
10
10
|
hasErrors(): boolean;
|
|
11
11
|
hasWarnings(): boolean;
|
|
12
12
|
toJson(opts?: StatsValue, forToString?: boolean): StatsCompilation;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
1
|
+
import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import { Compilation } from "../Compilation";
|
|
3
|
+
import * as liteTapable from "../lite-tapable";
|
|
4
|
+
import { RspackBuiltinPlugin } from "./base";
|
|
5
|
+
import Hash = require("../util/hash");
|
|
6
|
+
import { Chunk } from "../Chunk";
|
|
7
|
+
export type CompilationHooks = {
|
|
8
|
+
chunkHash: liteTapable.SyncHook<[Chunk, Hash]>;
|
|
10
9
|
};
|
|
10
|
+
export declare class JavascriptModulesPlugin extends RspackBuiltinPlugin {
|
|
11
|
+
name: BuiltinPluginName;
|
|
12
|
+
affectedHooks: "compilation";
|
|
13
|
+
constructor();
|
|
14
|
+
raw(): BuiltinPlugin;
|
|
15
|
+
static getCompilationHooks(compilation: Compilation): CompilationHooks;
|
|
16
|
+
}
|
|
@@ -1,6 +1,55 @@
|
|
|
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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.JavascriptModulesPlugin = void 0;
|
|
4
27
|
const binding_1 = require("@rspack/binding");
|
|
28
|
+
const Compilation_1 = require("../Compilation");
|
|
29
|
+
const liteTapable = __importStar(require("../lite-tapable"));
|
|
5
30
|
const base_1 = require("./base");
|
|
6
|
-
|
|
31
|
+
const compilationHooksMap = new WeakMap();
|
|
32
|
+
class JavascriptModulesPlugin extends base_1.RspackBuiltinPlugin {
|
|
33
|
+
constructor() {
|
|
34
|
+
super();
|
|
35
|
+
this.name = binding_1.BuiltinPluginName.JavascriptModulesPlugin;
|
|
36
|
+
this.affectedHooks = "compilation";
|
|
37
|
+
}
|
|
38
|
+
raw() {
|
|
39
|
+
return (0, base_1.createBuiltinPlugin)(this.name, undefined);
|
|
40
|
+
}
|
|
41
|
+
static getCompilationHooks(compilation) {
|
|
42
|
+
if (!(compilation instanceof Compilation_1.Compilation)) {
|
|
43
|
+
throw new TypeError("The 'compilation' argument must be an instance of Compilation");
|
|
44
|
+
}
|
|
45
|
+
let hooks = compilationHooksMap.get(compilation);
|
|
46
|
+
if (hooks === undefined) {
|
|
47
|
+
hooks = {
|
|
48
|
+
chunkHash: new liteTapable.SyncHook(["chunk", "hash"])
|
|
49
|
+
};
|
|
50
|
+
compilationHooksMap.set(compilation, hooks);
|
|
51
|
+
}
|
|
52
|
+
return hooks;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.JavascriptModulesPlugin = JavascriptModulesPlugin;
|
package/dist/exports.d.ts
CHANGED
|
@@ -87,9 +87,10 @@ interface Wasm {
|
|
|
87
87
|
EnableWasmLoadingPlugin: typeof EnableWasmLoadingPlugin;
|
|
88
88
|
}
|
|
89
89
|
export declare const wasm: Wasm;
|
|
90
|
-
import { EnableChunkLoadingPlugin } from "./builtin-plugin";
|
|
90
|
+
import { EnableChunkLoadingPlugin, JavascriptModulesPlugin } from "./builtin-plugin";
|
|
91
91
|
interface JavaScript {
|
|
92
92
|
EnableChunkLoadingPlugin: typeof EnableChunkLoadingPlugin;
|
|
93
|
+
JavascriptModulesPlugin: typeof JavascriptModulesPlugin;
|
|
93
94
|
}
|
|
94
95
|
export declare const javascript: JavaScript;
|
|
95
96
|
import { WebWorkerTemplatePlugin } from "./builtin-plugin";
|
package/dist/exports.js
CHANGED
|
@@ -117,7 +117,10 @@ exports.library = { EnableLibraryPlugin: builtin_plugin_13.EnableLibraryPlugin }
|
|
|
117
117
|
const builtin_plugin_14 = require("./builtin-plugin");
|
|
118
118
|
exports.wasm = { EnableWasmLoadingPlugin: builtin_plugin_14.EnableWasmLoadingPlugin };
|
|
119
119
|
const builtin_plugin_15 = require("./builtin-plugin");
|
|
120
|
-
exports.javascript = {
|
|
120
|
+
exports.javascript = {
|
|
121
|
+
EnableChunkLoadingPlugin: builtin_plugin_15.EnableChunkLoadingPlugin,
|
|
122
|
+
JavascriptModulesPlugin: builtin_plugin_15.JavascriptModulesPlugin
|
|
123
|
+
};
|
|
121
124
|
const builtin_plugin_16 = require("./builtin-plugin");
|
|
122
125
|
exports.webworker = { WebWorkerTemplatePlugin: builtin_plugin_16.WebWorkerTemplatePlugin };
|
|
123
126
|
const builtin_plugin_17 = require("./builtin-plugin");
|
package/dist/util/memoize.js
CHANGED
|
@@ -37,7 +37,11 @@ function memoizeValue(fn) {
|
|
|
37
37
|
const getValue = (0, exports.memoize)(fn);
|
|
38
38
|
return new Proxy({}, {
|
|
39
39
|
get(_, property) {
|
|
40
|
-
|
|
40
|
+
let res = getValue()[property];
|
|
41
|
+
if (typeof res === "function") {
|
|
42
|
+
res = res.bind(getValue());
|
|
43
|
+
}
|
|
44
|
+
return res;
|
|
41
45
|
},
|
|
42
46
|
set(_, property, newValue) {
|
|
43
47
|
getValue()[property] = newValue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "0.7.5-canary-
|
|
3
|
+
"version": "0.7.5-canary-87a73c3a-20240620004559",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
|
@@ -74,15 +74,15 @@
|
|
|
74
74
|
"watchpack": "^2.4.0",
|
|
75
75
|
"zod": "^3.21.4",
|
|
76
76
|
"zod-validation-error": "1.3.1",
|
|
77
|
-
"@rspack/
|
|
78
|
-
"@rspack/
|
|
77
|
+
"@rspack/plugin-minify": "^0.7.5-canary-87a73c3a-20240620004559",
|
|
78
|
+
"@rspack/core": "0.7.5-canary-87a73c3a-20240620004559"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@module-federation/runtime-tools": "0.1.6",
|
|
82
82
|
"caniuse-lite": "^1.0.30001616",
|
|
83
83
|
"tapable": "2.2.1",
|
|
84
84
|
"webpack-sources": "3.2.3",
|
|
85
|
-
"@rspack/binding": "0.7.5-canary-
|
|
85
|
+
"@rspack/binding": "0.7.5-canary-87a73c3a-20240620004559"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"@swc/helpers": ">=0.5.1"
|