@rspack/core 0.7.6-canary-1a0d77d-20240627143904 → 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/compiled/webpack-sources/index.d.ts +130 -0
- package/compiled/webpack-sources/index.js +3520 -0
- package/compiled/webpack-sources/license +21 -0
- package/compiled/webpack-sources/package.json +1 -0
- 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 +19 -23
- package/dist/Compilation.js +20 -43
- package/dist/Compiler.d.ts +1 -1
- package/dist/Compiler.js +32 -2
- package/dist/Entrypoint.d.ts +1 -1
- package/dist/Entrypoint.js +2 -2
- package/dist/Module.d.ts +12 -7
- package/dist/Module.js +1 -0
- package/dist/NormalModule.d.ts +0 -1
- package/dist/NormalModule.js +0 -7
- package/dist/NormalModuleFactory.d.ts +1 -0
- package/dist/NormalModuleFactory.js +1 -22
- package/dist/RspackError.d.ts +8 -0
- package/dist/RspackError.js +21 -0
- package/dist/Stats.d.ts +2 -2
- package/dist/Template.d.ts +1 -1
- package/dist/Template.js +2 -2
- package/dist/builtin-loader/swc/index.d.ts +0 -4
- package/dist/builtin-loader/swc/index.js +1 -5
- package/dist/builtin-loader/swc/preact.d.ts +3 -4
- package/dist/builtin-loader/swc/types.d.ts +2 -17
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -0
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.js +1 -0
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +0 -28
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +20 -69
- package/dist/builtin-plugin/css-extract/index.d.ts +2 -2
- package/dist/config/adapter.js +23 -10
- package/dist/config/adapterRuleUse.js +0 -11
- package/dist/config/defaults.js +22 -30
- package/dist/config/normalization.js +13 -5
- package/dist/config/zod.d.ts +168 -43
- package/dist/config/zod.js +23 -11
- package/dist/container/ModuleFederationPlugin.js +1 -1
- package/dist/container/default.runtime.js +1 -170
- package/dist/exports.d.ts +1 -1
- package/dist/exports.js +1 -1
- package/dist/lite-tapable/index.js +2 -2
- package/dist/loader-runner/index.js +28 -7
- package/dist/rspackOptionsApply.js +3 -0
- package/dist/stats/DefaultStatsFactoryPlugin.js +35 -11
- package/dist/stats/DefaultStatsPrinterPlugin.js +2 -2
- package/dist/stats/statsFactoryUtils.d.ts +13 -4
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.js +4 -3
- package/dist/util/memoize.js +5 -1
- package/dist/util/source.d.ts +1 -1
- package/dist/util/source.js +1 -1
- package/package.json +12 -7
- package/dist/builtin-loader/swc/emotion.d.ts +0 -17
- package/dist/builtin-loader/swc/emotion.js +0 -22
- package/dist/builtin-loader/swc/relay.d.ts +0 -5
- package/dist/builtin-loader/swc/relay.js +0 -48
- package/dist/container/default.runtime.d.ts +0 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 JS Foundation and other contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"webpack-sources","author":"Tobias Koppers @sokra","version":"3.2.3","license":"MIT","types":"index.d.ts","type":"commonjs"}
|
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?: Readonly<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
|
|
@@ -8,9 +7,10 @@
|
|
|
8
7
|
* Copyright (c) JS Foundation and other contributors
|
|
9
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
10
9
|
*/
|
|
11
|
-
import type
|
|
10
|
+
import type * as binding from "@rspack/binding";
|
|
11
|
+
import { type ExternalObject, type JsCompilation, type JsModule, type JsPathData, type JsRuntimeModule } from "@rspack/binding";
|
|
12
12
|
import * as tapable from "tapable";
|
|
13
|
-
import { Source } from "webpack-sources";
|
|
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
16
|
import * as liteTapable from "./lite-tapable";
|
|
@@ -26,7 +26,8 @@ import { Logger } from "./logging/Logger";
|
|
|
26
26
|
import { StatsFactory } from "./stats/StatsFactory";
|
|
27
27
|
import { StatsPrinter } from "./stats/StatsPrinter";
|
|
28
28
|
import { type AssetInfo } from "./util/AssetInfo";
|
|
29
|
-
import
|
|
29
|
+
import Hash = require("./util/hash");
|
|
30
|
+
import { RspackError } from "./RspackError";
|
|
30
31
|
export { type AssetInfo } from "./util/AssetInfo";
|
|
31
32
|
export type Assets = Record<string, Source>;
|
|
32
33
|
export interface Asset {
|
|
@@ -102,7 +103,7 @@ export type CreateStatsOptionsContext = KnownCreateStatsOptionsContext & Record<
|
|
|
102
103
|
export type NormalizedStatsOptions = KnownNormalizedStatsOptions & Omit<StatsOptions, keyof KnownNormalizedStatsOptions> & Record<string, any>;
|
|
103
104
|
export declare class Compilation {
|
|
104
105
|
#private;
|
|
105
|
-
hooks: {
|
|
106
|
+
hooks: Readonly<{
|
|
106
107
|
processAssets: liteTapable.AsyncSeriesHook<Assets>;
|
|
107
108
|
afterProcessAssets: liteTapable.SyncHook<Assets>;
|
|
108
109
|
childCompiler: tapable.SyncHook<[Compiler, string, number]>;
|
|
@@ -119,6 +120,7 @@ export declare class Compilation {
|
|
|
119
120
|
Iterable<Module>
|
|
120
121
|
], void>;
|
|
121
122
|
finishModules: liteTapable.AsyncSeriesHook<[Iterable<Module>], void>;
|
|
123
|
+
chunkHash: liteTapable.SyncHook<[Chunk, Hash], void>;
|
|
122
124
|
chunkAsset: liteTapable.SyncHook<[Chunk, string], void>;
|
|
123
125
|
processWarnings: tapable.SyncWaterfallHook<[Error[]]>;
|
|
124
126
|
succeedModule: liteTapable.SyncHook<[Module], void>;
|
|
@@ -141,7 +143,7 @@ export declare class Compilation {
|
|
|
141
143
|
], void>;
|
|
142
144
|
runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk], void>;
|
|
143
145
|
afterSeal: liteTapable.AsyncSeriesHook<[], void>;
|
|
144
|
-
}
|
|
146
|
+
}>;
|
|
145
147
|
name?: string;
|
|
146
148
|
startTime?: number;
|
|
147
149
|
endTime?: number;
|
|
@@ -158,13 +160,8 @@ export declare class Compilation {
|
|
|
158
160
|
createSnapshot(): null;
|
|
159
161
|
};
|
|
160
162
|
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;
|
|
163
|
+
get hash(): Readonly<string | null>;
|
|
164
|
+
get fullHash(): Readonly<string | null>;
|
|
168
165
|
/**
|
|
169
166
|
* Get a map of all assets.
|
|
170
167
|
*/
|
|
@@ -173,14 +170,14 @@ export declare class Compilation {
|
|
|
173
170
|
* Get a map of all entrypoints.
|
|
174
171
|
*/
|
|
175
172
|
get entrypoints(): ReadonlyMap<string, Entrypoint>;
|
|
176
|
-
get modules(): Module
|
|
177
|
-
get chunks(): Chunk
|
|
173
|
+
get modules(): ReadonlySet<Module>;
|
|
174
|
+
get chunks(): ReadonlySet<Chunk>;
|
|
178
175
|
/**
|
|
179
176
|
* Get the named chunks.
|
|
180
177
|
*
|
|
181
178
|
* Note: This is a proxy for webpack internal API, only method `get` is supported now.
|
|
182
179
|
*/
|
|
183
|
-
get namedChunks():
|
|
180
|
+
get namedChunks(): ReadonlyMap<string, Readonly<Chunk>>;
|
|
184
181
|
/**
|
|
185
182
|
* Note: This is not a webpack public API, maybe removed in future.
|
|
186
183
|
*
|
|
@@ -220,19 +217,19 @@ export declare class Compilation {
|
|
|
220
217
|
*
|
|
221
218
|
* @internal
|
|
222
219
|
*/
|
|
223
|
-
__internal__pushDiagnostic(
|
|
220
|
+
__internal__pushDiagnostic(diagnostic: binding.JsDiagnostic): void;
|
|
224
221
|
/**
|
|
225
222
|
* Note: This is not a webpack public API, maybe removed in future.
|
|
226
223
|
*
|
|
227
224
|
* @internal
|
|
228
225
|
*/
|
|
229
226
|
__internal__pushNativeDiagnostics(diagnostics: ExternalObject<"Diagnostic[]">): void;
|
|
230
|
-
get errors():
|
|
231
|
-
get warnings():
|
|
227
|
+
get errors(): RspackError[];
|
|
228
|
+
get warnings(): RspackError[];
|
|
232
229
|
getPath(filename: Filename, data?: PathData): string;
|
|
233
|
-
getPathWithInfo(filename: Filename, data?: PathData):
|
|
230
|
+
getPathWithInfo(filename: Filename, data?: PathData): binding.PathWithInfo;
|
|
234
231
|
getAssetPath(filename: Filename, data?: PathData): string;
|
|
235
|
-
getAssetPathWithInfo(filename: Filename, data?: PathData):
|
|
232
|
+
getAssetPathWithInfo(filename: Filename, data?: PathData): binding.PathWithInfo;
|
|
236
233
|
getLogger(name: string | (() => string)): Logger;
|
|
237
234
|
fileDependencies: {
|
|
238
235
|
[Symbol.iterator](): Generator<string, void, unknown>;
|
|
@@ -260,7 +257,6 @@ export declare class Compilation {
|
|
|
260
257
|
};
|
|
261
258
|
getStats(): Stats;
|
|
262
259
|
createChildCompiler(name: string, outputOptions: OutputNormalized, plugins: RspackPluginInstance[]): Compiler;
|
|
263
|
-
_rebuildModuleCaller: MergeCaller<[string, (err: Error, m: Module) => void]>;
|
|
264
260
|
rebuildModule(m: Module, f: (err: Error, m: Module) => void): void;
|
|
265
261
|
/**
|
|
266
262
|
* Get the `Source` of a given asset filename.
|
|
@@ -319,7 +315,7 @@ export declare class Compilation {
|
|
|
319
315
|
*
|
|
320
316
|
* @internal
|
|
321
317
|
*/
|
|
322
|
-
__internal_getInner(): JsCompilation;
|
|
318
|
+
__internal_getInner(): binding.JsCompilation;
|
|
323
319
|
seal(): void;
|
|
324
320
|
unseal(): void;
|
|
325
321
|
static PROCESS_ASSETS_STAGE_ADDITIONAL: number;
|
package/dist/Compilation.js
CHANGED
|
@@ -36,9 +36,10 @@ 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
|
+
const binding_1 = require("@rspack/binding");
|
|
42
43
|
const tapable = __importStar(require("tapable"));
|
|
43
44
|
const liteTapable = __importStar(require("./lite-tapable"));
|
|
44
45
|
const Chunk_1 = require("./Chunk");
|
|
@@ -46,17 +47,16 @@ const ChunkGraph_1 = require("./ChunkGraph");
|
|
|
46
47
|
const Entrypoint_1 = require("./Entrypoint");
|
|
47
48
|
const ErrorHelpers_1 = __importDefault(require("./ErrorHelpers"));
|
|
48
49
|
const Module_1 = require("./Module");
|
|
49
|
-
const NormalModule_1 = require("./NormalModule");
|
|
50
50
|
const Stats_1 = require("./Stats");
|
|
51
51
|
const Logger_1 = require("./logging/Logger");
|
|
52
52
|
const StatsFactory_1 = require("./stats/StatsFactory");
|
|
53
53
|
const StatsPrinter_1 = require("./stats/StatsPrinter");
|
|
54
|
-
const util_1 = require("./util");
|
|
55
54
|
const AssetInfo_1 = require("./util/AssetInfo");
|
|
56
55
|
const MergeCaller_1 = __importDefault(require("./util/MergeCaller"));
|
|
57
56
|
const fake_1 = require("./util/fake");
|
|
58
57
|
const memoize_1 = require("./util/memoize");
|
|
59
58
|
const source_1 = require("./util/source");
|
|
59
|
+
const RspackError_1 = require("./RspackError");
|
|
60
60
|
class Compilation {
|
|
61
61
|
constructor(compiler, inner) {
|
|
62
62
|
_Compilation_instances.add(this);
|
|
@@ -77,7 +77,7 @@ class Compilation {
|
|
|
77
77
|
this.contextDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getContextDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addContextDependencies(d));
|
|
78
78
|
this.missingDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getMissingDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addMissingDependencies(d));
|
|
79
79
|
this.buildDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getBuildDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addBuildDependencies(d));
|
|
80
|
-
this
|
|
80
|
+
_Compilation_rebuildModuleCaller.set(this, (function (compilation) {
|
|
81
81
|
return new MergeCaller_1.default((args) => {
|
|
82
82
|
__classPrivateFieldGet(compilation, _Compilation_inner, "f").rebuildModule(args.map(item => item[0]), function (err, modules) {
|
|
83
83
|
for (const [id, callback] of args) {
|
|
@@ -91,7 +91,7 @@ class Compilation {
|
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
}, 10);
|
|
94
|
-
})(this);
|
|
94
|
+
})(this));
|
|
95
95
|
__classPrivateFieldSet(this, _Compilation_inner, inner, "f");
|
|
96
96
|
__classPrivateFieldSet(this, _Compilation_cachedAssets, __classPrivateFieldGet(this, _Compilation_instances, "m", _Compilation_createCachedAssets).call(this), "f");
|
|
97
97
|
__classPrivateFieldSet(this, _Compilation_customModules, {}, "f");
|
|
@@ -145,6 +145,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
145
145
|
"modules"
|
|
146
146
|
]),
|
|
147
147
|
finishModules: new liteTapable.AsyncSeriesHook(["modules"]),
|
|
148
|
+
chunkHash: new liteTapable.SyncHook(["chunk", "hash"]),
|
|
148
149
|
chunkAsset: new liteTapable.SyncHook(["chunk", "filename"]),
|
|
149
150
|
processWarnings: new tapable.SyncWaterfallHook(["warnings"]),
|
|
150
151
|
succeedModule: new liteTapable.SyncHook(["module"]),
|
|
@@ -172,9 +173,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
172
173
|
this.children = [];
|
|
173
174
|
this.chunkGraph = new ChunkGraph_1.ChunkGraph(this);
|
|
174
175
|
}
|
|
175
|
-
get currentNormalModuleHooks() {
|
|
176
|
-
return NormalModule_1.NormalModule.getCompilationHooks(this);
|
|
177
|
-
}
|
|
178
176
|
get hash() {
|
|
179
177
|
return __classPrivateFieldGet(this, _Compilation_inner, "f").hash;
|
|
180
178
|
}
|
|
@@ -197,15 +195,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
197
195
|
]));
|
|
198
196
|
}
|
|
199
197
|
get modules() {
|
|
200
|
-
return (0, memoize_1.memoizeValue)(() =>
|
|
201
|
-
return this.__internal__getModules().map(item => Module_1.Module.__from_binding(item, this));
|
|
202
|
-
});
|
|
198
|
+
return (0, memoize_1.memoizeValue)(() => new Set(this.__internal__getModules().map(item => Module_1.Module.__from_binding(item, this))));
|
|
203
199
|
}
|
|
204
|
-
// FIXME: Webpack returns a `Set`
|
|
205
200
|
get chunks() {
|
|
206
|
-
return (0, memoize_1.memoizeValue)(() =>
|
|
207
|
-
return this.__internal__getChunks();
|
|
208
|
-
});
|
|
201
|
+
return (0, memoize_1.memoizeValue)(() => new Set(this.__internal__getChunks()));
|
|
209
202
|
}
|
|
210
203
|
/**
|
|
211
204
|
* Get the named chunks.
|
|
@@ -347,8 +340,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
347
340
|
*
|
|
348
341
|
* @internal
|
|
349
342
|
*/
|
|
350
|
-
__internal__pushDiagnostic(
|
|
351
|
-
__classPrivateFieldGet(this, _Compilation_inner, "f").pushDiagnostic(
|
|
343
|
+
__internal__pushDiagnostic(diagnostic) {
|
|
344
|
+
__classPrivateFieldGet(this, _Compilation_inner, "f").pushDiagnostic(diagnostic);
|
|
352
345
|
}
|
|
353
346
|
/**
|
|
354
347
|
* Note: This is not a webpack public API, maybe removed in future.
|
|
@@ -360,14 +353,14 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
360
353
|
}
|
|
361
354
|
get errors() {
|
|
362
355
|
const inner = __classPrivateFieldGet(this, _Compilation_inner, "f");
|
|
363
|
-
const errors = inner.
|
|
356
|
+
const errors = inner.getErrors();
|
|
364
357
|
const proxyMethod = [
|
|
365
358
|
{
|
|
366
359
|
method: "push",
|
|
367
360
|
handler(target, thisArg, errs) {
|
|
368
361
|
for (let i = 0; i < errs.length; i++) {
|
|
369
362
|
const error = errs[i];
|
|
370
|
-
inner.pushDiagnostic(
|
|
363
|
+
inner.pushDiagnostic(RspackError_1.JsDiagnostic.__to_binding(error, binding_1.JsRspackSeverity.Error));
|
|
371
364
|
}
|
|
372
365
|
return Reflect.apply(target, thisArg, errs);
|
|
373
366
|
}
|
|
@@ -390,11 +383,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
390
383
|
method: "unshift",
|
|
391
384
|
handler(target, thisArg, errs) {
|
|
392
385
|
const errList = errs.map(error => {
|
|
393
|
-
return
|
|
394
|
-
severity: "error",
|
|
395
|
-
title: error instanceof Error ? error.name : "Error",
|
|
396
|
-
message: (0, util_1.concatErrorMsgAndStack)(error)
|
|
397
|
-
};
|
|
386
|
+
return RspackError_1.JsDiagnostic.__to_binding(error, binding_1.JsRspackSeverity.Error);
|
|
398
387
|
});
|
|
399
388
|
inner.spliceDiagnostic(0, 0, errList);
|
|
400
389
|
return Reflect.apply(target, thisArg, errs);
|
|
@@ -404,11 +393,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
404
393
|
method: "splice",
|
|
405
394
|
handler(target, thisArg, [startIdx, delCount, ...errors]) {
|
|
406
395
|
const errList = errors.map(error => {
|
|
407
|
-
return
|
|
408
|
-
severity: "error",
|
|
409
|
-
title: error instanceof Error ? error.name : "Error",
|
|
410
|
-
message: (0, util_1.concatErrorMsgAndStack)(error)
|
|
411
|
-
};
|
|
396
|
+
return RspackError_1.JsDiagnostic.__to_binding(error, binding_1.JsRspackSeverity.Error);
|
|
412
397
|
});
|
|
413
398
|
inner.spliceDiagnostic(startIdx, startIdx + delCount, errList);
|
|
414
399
|
return Reflect.apply(target, thisArg, [
|
|
@@ -430,7 +415,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
430
415
|
get warnings() {
|
|
431
416
|
const inner = __classPrivateFieldGet(this, _Compilation_inner, "f");
|
|
432
417
|
const processWarningsHook = this.hooks.processWarnings;
|
|
433
|
-
const warnings = inner.
|
|
418
|
+
const warnings = inner.getWarnings();
|
|
434
419
|
const proxyMethod = [
|
|
435
420
|
{
|
|
436
421
|
method: "push",
|
|
@@ -438,7 +423,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
438
423
|
warns = processWarningsHook.call(warns);
|
|
439
424
|
for (let i = 0; i < warns.length; i++) {
|
|
440
425
|
const warn = warns[i];
|
|
441
|
-
inner.pushDiagnostic(
|
|
426
|
+
inner.pushDiagnostic(RspackError_1.JsDiagnostic.__to_binding(warn, binding_1.JsRspackSeverity.Warn));
|
|
442
427
|
}
|
|
443
428
|
return Reflect.apply(target, thisArg, warns);
|
|
444
429
|
}
|
|
@@ -462,11 +447,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
462
447
|
handler(target, thisArg, warns) {
|
|
463
448
|
warns = processWarningsHook.call(warns);
|
|
464
449
|
const warnList = warns.map(warn => {
|
|
465
|
-
return
|
|
466
|
-
severity: "warning",
|
|
467
|
-
title: warn instanceof Error ? warn.name : "Warning",
|
|
468
|
-
message: (0, util_1.concatErrorMsgAndStack)(warn)
|
|
469
|
-
};
|
|
450
|
+
return RspackError_1.JsDiagnostic.__to_binding(warn, binding_1.JsRspackSeverity.Warn);
|
|
470
451
|
});
|
|
471
452
|
inner.spliceDiagnostic(0, 0, warnList);
|
|
472
453
|
return Reflect.apply(target, thisArg, warns);
|
|
@@ -477,11 +458,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
477
458
|
handler(target, thisArg, [startIdx, delCount, ...warns]) {
|
|
478
459
|
warns = processWarningsHook.call(warns);
|
|
479
460
|
const warnList = warns.map(warn => {
|
|
480
|
-
return
|
|
481
|
-
severity: "warning",
|
|
482
|
-
title: warn instanceof Error ? warn.name : "Warning",
|
|
483
|
-
message: (0, util_1.concatErrorMsgAndStack)(warn)
|
|
484
|
-
};
|
|
461
|
+
return RspackError_1.JsDiagnostic.__to_binding(warn, binding_1.JsRspackSeverity.Warn);
|
|
485
462
|
});
|
|
486
463
|
inner.spliceDiagnostic(startIdx, startIdx + delCount, warnList);
|
|
487
464
|
return Reflect.apply(target, thisArg, [
|
|
@@ -619,7 +596,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
619
596
|
return this.compiler.createChildCompiler(this, name, idx, outputOptions, plugins);
|
|
620
597
|
}
|
|
621
598
|
rebuildModule(m, f) {
|
|
622
|
-
this.
|
|
599
|
+
__classPrivateFieldGet(this, _Compilation_rebuildModuleCaller, "f").push([m.identifier(), f]);
|
|
623
600
|
}
|
|
624
601
|
/**
|
|
625
602
|
* Get the `Source` of a given asset filename.
|
|
@@ -704,7 +681,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
704
681
|
seal() { }
|
|
705
682
|
unseal() { }
|
|
706
683
|
}
|
|
707
|
-
_Compilation_inner = new WeakMap(), _Compilation_cachedAssets = new WeakMap(), _Compilation_customModules = new WeakMap(), _Compilation_instances = new WeakSet(), _Compilation_createCachedAssets = function _Compilation_createCachedAssets() {
|
|
684
|
+
_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
685
|
return new Proxy({}, {
|
|
709
686
|
get: (_, property) => {
|
|
710
687
|
if (typeof property === "string") {
|
package/dist/Compiler.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ import * as liteTapable from "./lite-tapable";
|
|
|
22
22
|
import ResolverFactory = require("./ResolverFactory");
|
|
23
23
|
import Cache = require("./lib/Cache");
|
|
24
24
|
import CacheFacade = require("./lib/CacheFacade");
|
|
25
|
-
import { Source } from "webpack-sources";
|
|
25
|
+
import { Source } from "../compiled/webpack-sources";
|
|
26
26
|
import { Chunk } from "./Chunk";
|
|
27
27
|
import { FileSystemInfoEntry } from "./FileSystemInfo";
|
|
28
28
|
import { NormalModuleFactory } from "./NormalModuleFactory";
|