@rspack/core 0.7.5-canary-1ab2ea8-20240624100353 → 0.7.5
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 +14 -19
- package/dist/Chunk.js +17 -22
- package/dist/ChunkGraph.d.ts +1 -1
- package/dist/ChunkGraph.js +5 -5
- package/dist/ChunkGroup.d.ts +7 -17
- package/dist/ChunkGroup.js +2 -12
- package/dist/Compilation.d.ts +15 -9
- package/dist/Compilation.js +16 -8
- package/dist/Compiler.js +2 -18
- 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 +1 -0
- package/dist/NormalModule.js +7 -0
- package/dist/NormalModuleFactory.js +22 -0
- package/dist/Stats.d.ts +2 -2
- package/dist/builtin-loader/swc/emotion.d.ts +17 -0
- package/dist/builtin-loader/swc/emotion.js +22 -0
- package/dist/builtin-loader/swc/index.d.ts +4 -0
- package/dist/builtin-loader/swc/index.js +5 -1
- package/dist/builtin-loader/swc/preact.d.ts +4 -3
- package/dist/builtin-loader/swc/relay.d.ts +5 -0
- package/dist/builtin-loader/swc/relay.js +48 -0
- package/dist/builtin-loader/swc/types.d.ts +17 -2
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +9 -15
- package/dist/builtin-plugin/JavascriptModulesPlugin.js +1 -50
- package/dist/config/adapter.js +9 -12
- package/dist/config/adapterRuleUse.js +11 -0
- package/dist/config/normalization.js +2 -12
- package/dist/config/zod.d.ts +10 -7
- package/dist/config/zod.js +5 -5
- package/dist/exports.d.ts +1 -2
- package/dist/exports.js +1 -4
- package/dist/stats/DefaultStatsFactoryPlugin.js +2 -19
- package/dist/stats/statsFactoryUtils.d.ts +2 -4
- package/dist/util/memoize.js +1 -5
- package/package.json +4 -8
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?:
|
|
7
|
-
id?:
|
|
8
|
-
ids:
|
|
9
|
-
idNameHints:
|
|
10
|
-
filenameTemplate?:
|
|
11
|
-
cssFilenameTemplate?:
|
|
12
|
-
files:
|
|
13
|
-
runtime:
|
|
14
|
-
hash?:
|
|
15
|
-
contentHash:
|
|
16
|
-
renderedHash?:
|
|
17
|
-
|
|
18
|
-
auxiliaryFiles:
|
|
6
|
+
name?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
ids: Array<string>;
|
|
9
|
+
idNameHints: Array<string>;
|
|
10
|
+
filenameTemplate?: string;
|
|
11
|
+
cssFilenameTemplate?: string;
|
|
12
|
+
files: Array<string>;
|
|
13
|
+
runtime: Array<string>;
|
|
14
|
+
hash?: string;
|
|
15
|
+
contentHash: Record<string, string>;
|
|
16
|
+
renderedHash?: string;
|
|
17
|
+
chunkReasons: Array<string>;
|
|
18
|
+
auxiliaryFiles: Array<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,10 +26,5 @@ export declare class Chunk {
|
|
|
26
26
|
getAllAsyncChunks(): Iterable<Chunk>;
|
|
27
27
|
getAllInitialChunks(): Iterable<Chunk>;
|
|
28
28
|
getAllReferencedChunks(): Iterable<Chunk>;
|
|
29
|
-
|
|
30
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
31
|
-
*
|
|
32
|
-
* @internal
|
|
33
|
-
*/
|
|
34
|
-
__internal__innerUkey(): number;
|
|
29
|
+
__internal_innerUkey(): number;
|
|
35
30
|
}
|
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_inner_compilation;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.Chunk = void 0;
|
|
16
16
|
const binding_1 = require("@rspack/binding");
|
|
@@ -26,57 +26,52 @@ class Chunk {
|
|
|
26
26
|
}
|
|
27
27
|
constructor(chunk, compilation) {
|
|
28
28
|
_Chunk_inner.set(this, void 0);
|
|
29
|
-
|
|
29
|
+
_Chunk_inner_compilation.set(this, void 0);
|
|
30
30
|
__classPrivateFieldSet(this, _Chunk_inner, chunk, "f");
|
|
31
|
-
__classPrivateFieldSet(this,
|
|
31
|
+
__classPrivateFieldSet(this, _Chunk_inner_compilation, 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 =
|
|
39
|
-
this.runtime =
|
|
38
|
+
this.files = chunk.files;
|
|
39
|
+
this.runtime = 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 =
|
|
43
|
+
this.chunkReasons = chunk.chunkReasons;
|
|
44
|
+
this.auxiliaryFiles = 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_inner_compilation, "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_inner_compilation, "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_inner_compilation, "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_inner_compilation, "f"));
|
|
58
|
+
return ChunkGroup_1.ChunkGroup.__from_binding(cg, __classPrivateFieldGet(this, _Chunk_inner_compilation, "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_inner_compilation, "f")).map(c => Chunk.__from_binding(c, __classPrivateFieldGet(this, _Chunk_inner_compilation, "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_inner_compilation, "f")).map(c => Chunk.__from_binding(c, __classPrivateFieldGet(this, _Chunk_inner_compilation, "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_inner_compilation, "f")).map(c => Chunk.__from_binding(c, __classPrivateFieldGet(this, _Chunk_inner_compilation, "f"))));
|
|
71
71
|
}
|
|
72
|
-
|
|
73
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
74
|
-
*
|
|
75
|
-
* @internal
|
|
76
|
-
*/
|
|
77
|
-
__internal__innerUkey() {
|
|
72
|
+
__internal_innerUkey() {
|
|
78
73
|
return __classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey;
|
|
79
74
|
}
|
|
80
75
|
}
|
|
81
76
|
exports.Chunk = Chunk;
|
|
82
|
-
_Chunk_inner = new WeakMap(),
|
|
77
|
+
_Chunk_inner = new WeakMap(), _Chunk_inner_compilation = 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):
|
|
7
|
+
getChunkModules(chunk: Chunk): 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,21 +4,11 @@ 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():
|
|
8
|
-
getParents():
|
|
9
|
-
get chunks():
|
|
10
|
-
get index():
|
|
11
|
-
get name():
|
|
12
|
-
|
|
13
|
-
|
|
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;
|
|
7
|
+
getFiles(): string[];
|
|
8
|
+
getParents(): ChunkGroup[];
|
|
9
|
+
get chunks(): Chunk[];
|
|
10
|
+
get index(): number | undefined;
|
|
11
|
+
get name(): string | undefined;
|
|
12
|
+
__internal_innerUkey(): number;
|
|
13
|
+
__internal_innerCompilation(): JsCompilation;
|
|
24
14
|
}
|
package/dist/ChunkGroup.js
CHANGED
|
@@ -49,20 +49,10 @@ class ChunkGroup {
|
|
|
49
49
|
get name() {
|
|
50
50
|
return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").name;
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
54
|
-
*
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
57
|
-
__internal__innerUkey() {
|
|
52
|
+
__internal_innerUkey() {
|
|
58
53
|
return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").__inner_ukey;
|
|
59
54
|
}
|
|
60
|
-
|
|
61
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
62
|
-
*
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
|
-
__internal__innerCompilation() {
|
|
55
|
+
__internal_innerCompilation() {
|
|
66
56
|
return __classPrivateFieldGet(this, _ChunkGroup_innerCompilation, "f");
|
|
67
57
|
}
|
|
68
58
|
}
|
package/dist/Compilation.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
/**
|
|
2
3
|
* The following code is modified based on
|
|
3
4
|
* https://github.com/webpack/webpack/blob/4b4ca3bb53f36a5b8fc6bc1bd976ed7af161bd80/lib/Compilation.js
|
|
@@ -25,7 +26,7 @@ import { Logger } from "./logging/Logger";
|
|
|
25
26
|
import { StatsFactory } from "./stats/StatsFactory";
|
|
26
27
|
import { StatsPrinter } from "./stats/StatsPrinter";
|
|
27
28
|
import { type AssetInfo } from "./util/AssetInfo";
|
|
28
|
-
import
|
|
29
|
+
import MergeCaller from "./util/MergeCaller";
|
|
29
30
|
export { type AssetInfo } from "./util/AssetInfo";
|
|
30
31
|
export type Assets = Record<string, Source>;
|
|
31
32
|
export interface Asset {
|
|
@@ -101,7 +102,7 @@ export type CreateStatsOptionsContext = KnownCreateStatsOptionsContext & Record<
|
|
|
101
102
|
export type NormalizedStatsOptions = KnownNormalizedStatsOptions & Omit<StatsOptions, keyof KnownNormalizedStatsOptions> & Record<string, any>;
|
|
102
103
|
export declare class Compilation {
|
|
103
104
|
#private;
|
|
104
|
-
hooks:
|
|
105
|
+
hooks: {
|
|
105
106
|
processAssets: liteTapable.AsyncSeriesHook<Assets>;
|
|
106
107
|
afterProcessAssets: liteTapable.SyncHook<Assets>;
|
|
107
108
|
childCompiler: tapable.SyncHook<[Compiler, string, number]>;
|
|
@@ -118,7 +119,6 @@ export declare class Compilation {
|
|
|
118
119
|
Iterable<Module>
|
|
119
120
|
], void>;
|
|
120
121
|
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,8 +158,13 @@ export declare class Compilation {
|
|
|
158
158
|
createSnapshot(): null;
|
|
159
159
|
};
|
|
160
160
|
constructor(compiler: Compiler, inner: JsCompilation);
|
|
161
|
-
get
|
|
162
|
-
|
|
161
|
+
get currentNormalModuleHooks(): {
|
|
162
|
+
loader: tapable.SyncHook<[import("./config").LoaderContext<{}>], void, tapable.UnsetAdditionalOptions>;
|
|
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
168
|
/**
|
|
164
169
|
* Get a map of all assets.
|
|
165
170
|
*/
|
|
@@ -168,14 +173,14 @@ export declare class Compilation {
|
|
|
168
173
|
* Get a map of all entrypoints.
|
|
169
174
|
*/
|
|
170
175
|
get entrypoints(): ReadonlyMap<string, Entrypoint>;
|
|
171
|
-
get modules():
|
|
172
|
-
get chunks():
|
|
176
|
+
get modules(): Module[];
|
|
177
|
+
get chunks(): Chunk[];
|
|
173
178
|
/**
|
|
174
179
|
* Get the named chunks.
|
|
175
180
|
*
|
|
176
181
|
* Note: This is a proxy for webpack internal API, only method `get` is supported now.
|
|
177
182
|
*/
|
|
178
|
-
get namedChunks():
|
|
183
|
+
get namedChunks(): Map<string, Readonly<Chunk>>;
|
|
179
184
|
/**
|
|
180
185
|
* Note: This is not a webpack public API, maybe removed in future.
|
|
181
186
|
*
|
|
@@ -255,6 +260,7 @@ export declare class Compilation {
|
|
|
255
260
|
};
|
|
256
261
|
getStats(): Stats;
|
|
257
262
|
createChildCompiler(name: string, outputOptions: OutputNormalized, plugins: RspackPluginInstance[]): Compiler;
|
|
263
|
+
_rebuildModuleCaller: MergeCaller<[string, (err: Error, m: Module) => void]>;
|
|
258
264
|
rebuildModule(m: Module, f: (err: Error, m: Module) => void): void;
|
|
259
265
|
/**
|
|
260
266
|
* 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;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.Compilation = void 0;
|
|
42
42
|
const tapable = __importStar(require("tapable"));
|
|
@@ -46,6 +46,7 @@ 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");
|
|
49
50
|
const Stats_1 = require("./Stats");
|
|
50
51
|
const Logger_1 = require("./logging/Logger");
|
|
51
52
|
const StatsFactory_1 = require("./stats/StatsFactory");
|
|
@@ -76,7 +77,7 @@ class Compilation {
|
|
|
76
77
|
this.contextDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getContextDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addContextDependencies(d));
|
|
77
78
|
this.missingDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getMissingDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addMissingDependencies(d));
|
|
78
79
|
this.buildDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getBuildDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addBuildDependencies(d));
|
|
79
|
-
|
|
80
|
+
this._rebuildModuleCaller = (function (compilation) {
|
|
80
81
|
return new MergeCaller_1.default((args) => {
|
|
81
82
|
__classPrivateFieldGet(compilation, _Compilation_inner, "f").rebuildModule(args.map(item => item[0]), function (err, modules) {
|
|
82
83
|
for (const [id, callback] of args) {
|
|
@@ -90,7 +91,7 @@ class Compilation {
|
|
|
90
91
|
}
|
|
91
92
|
});
|
|
92
93
|
}, 10);
|
|
93
|
-
})(this)
|
|
94
|
+
})(this);
|
|
94
95
|
__classPrivateFieldSet(this, _Compilation_inner, inner, "f");
|
|
95
96
|
__classPrivateFieldSet(this, _Compilation_cachedAssets, __classPrivateFieldGet(this, _Compilation_instances, "m", _Compilation_createCachedAssets).call(this), "f");
|
|
96
97
|
__classPrivateFieldSet(this, _Compilation_customModules, {}, "f");
|
|
@@ -144,7 +145,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
144
145
|
"modules"
|
|
145
146
|
]),
|
|
146
147
|
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,6 +172,9 @@ 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
|
+
}
|
|
175
178
|
get hash() {
|
|
176
179
|
return __classPrivateFieldGet(this, _Compilation_inner, "f").hash;
|
|
177
180
|
}
|
|
@@ -194,10 +197,15 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
194
197
|
]));
|
|
195
198
|
}
|
|
196
199
|
get modules() {
|
|
197
|
-
return (0, memoize_1.memoizeValue)(() =>
|
|
200
|
+
return (0, memoize_1.memoizeValue)(() => {
|
|
201
|
+
return this.__internal__getModules().map(item => Module_1.Module.__from_binding(item, this));
|
|
202
|
+
});
|
|
198
203
|
}
|
|
204
|
+
// FIXME: Webpack returns a `Set`
|
|
199
205
|
get chunks() {
|
|
200
|
-
return (0, memoize_1.memoizeValue)(() =>
|
|
206
|
+
return (0, memoize_1.memoizeValue)(() => {
|
|
207
|
+
return this.__internal__getChunks();
|
|
208
|
+
});
|
|
201
209
|
}
|
|
202
210
|
/**
|
|
203
211
|
* Get the named chunks.
|
|
@@ -611,7 +619,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
611
619
|
return this.compiler.createChildCompiler(this, name, idx, outputOptions, plugins);
|
|
612
620
|
}
|
|
613
621
|
rebuildModule(m, f) {
|
|
614
|
-
|
|
622
|
+
this._rebuildModuleCaller.push([m.identifier(), f]);
|
|
615
623
|
}
|
|
616
624
|
/**
|
|
617
625
|
* Get the `Source` of a given asset filename.
|
|
@@ -696,7 +704,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
696
704
|
seal() { }
|
|
697
705
|
unseal() { }
|
|
698
706
|
}
|
|
699
|
-
_Compilation_inner = new WeakMap(), _Compilation_cachedAssets = new WeakMap(), _Compilation_customModules = new WeakMap(),
|
|
707
|
+
_Compilation_inner = new WeakMap(), _Compilation_cachedAssets = new WeakMap(), _Compilation_customModules = new WeakMap(), _Compilation_instances = new WeakSet(), _Compilation_createCachedAssets = function _Compilation_createCachedAssets() {
|
|
700
708
|
return new Proxy({}, {
|
|
701
709
|
get: (_, property) => {
|
|
702
710
|
if (typeof property === "string") {
|
package/dist/Compiler.js
CHANGED
|
@@ -77,7 +77,6 @@ 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");
|
|
81
80
|
const identifier_1 = require("./util/identifier");
|
|
82
81
|
class Compiler {
|
|
83
82
|
constructor(context, options) {
|
|
@@ -652,18 +651,10 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
|
|
|
652
651
|
__classPrivateFieldGet(this, _Compiler_moduleExecutionResultsMap, "f").set(id, executeResult);
|
|
653
652
|
}),
|
|
654
653
|
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)),
|
|
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
|
|
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
|
-
}),
|
|
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 => () => queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f").modules)),
|
|
659
656
|
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)),
|
|
660
657
|
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
|
-
}),
|
|
667
658
|
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)),
|
|
668
659
|
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)),
|
|
669
660
|
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)),
|
|
@@ -737,13 +728,6 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
|
|
|
737
728
|
})
|
|
738
729
|
: false;
|
|
739
730
|
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);
|
|
747
731
|
})
|
|
748
732
|
}, "f");
|
|
749
733
|
__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():
|
|
7
|
+
getRuntimeChunk(): 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?:
|
|
36
|
-
resource?:
|
|
37
|
-
request?:
|
|
38
|
-
userRequest?:
|
|
39
|
-
rawRequest?:
|
|
35
|
+
context?: string;
|
|
36
|
+
resource?: string;
|
|
37
|
+
request?: string;
|
|
38
|
+
userRequest?: string;
|
|
39
|
+
rawRequest?: 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,6 +3,7 @@ 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();
|
|
6
7
|
static getCompilationHooks(compilation: Compilation): {
|
|
7
8
|
loader: SyncHook<[LoaderContext<{}>], void, import("tapable").UnsetAdditionalOptions>;
|
|
8
9
|
readResourceForScheme: any;
|
package/dist/NormalModule.js
CHANGED
|
@@ -46,7 +46,10 @@ 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
|
|
49
51
|
class NormalModule {
|
|
52
|
+
constructor() { }
|
|
50
53
|
static getCompilationHooks(compilation) {
|
|
51
54
|
if (!(compilation instanceof Compilation_1.Compilation)) {
|
|
52
55
|
throw new TypeError("The 'compilation' argument must be an instance of Compilation");
|
|
@@ -55,6 +58,9 @@ class NormalModule {
|
|
|
55
58
|
if (hooks === undefined) {
|
|
56
59
|
hooks = {
|
|
57
60
|
loader: new tapable_1.SyncHook(["loaderContext"]),
|
|
61
|
+
// beforeLoaders: new SyncHook(["loaders", "module", "loaderContext"]),
|
|
62
|
+
// beforeParse: new SyncHook(["module"]),
|
|
63
|
+
// beforeSnapshot: new SyncHook(["module"]),
|
|
58
64
|
// TODO webpack 6 deprecate
|
|
59
65
|
readResourceForScheme: new tapable_1.HookMap(scheme => {
|
|
60
66
|
const hook = hooks.readResource.for(scheme);
|
|
@@ -65,6 +71,7 @@ class NormalModule {
|
|
|
65
71
|
});
|
|
66
72
|
}),
|
|
67
73
|
readResource: new tapable_1.HookMap(() => new tapable_1.AsyncSeriesBailHook(["loaderContext"]))
|
|
74
|
+
// needBuild: new AsyncSeriesBailHook(["module", "context"])
|
|
68
75
|
};
|
|
69
76
|
compilationHooksMap.set(compilation, hooks);
|
|
70
77
|
}
|
|
@@ -28,13 +28,35 @@ 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>>} */
|
|
31
34
|
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>} */
|
|
32
42
|
beforeResolve: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
|
|
43
|
+
// /** @type {AsyncSeriesBailHook<[ResolveData], false | void>} */
|
|
33
44
|
afterResolve: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
|
|
45
|
+
// /** @type {AsyncSeriesBailHook<[ResolveData["createData"], ResolveData], Module | void>} */
|
|
34
46
|
createModule: new liteTapable.AsyncSeriesBailHook([
|
|
35
47
|
"createData",
|
|
36
48
|
"resolveData"
|
|
37
49
|
])
|
|
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
|
+
// )
|
|
38
60
|
};
|
|
39
61
|
}
|
|
40
62
|
}
|
package/dist/Stats.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Compilation } from "
|
|
1
|
+
import { Compilation } from ".";
|
|
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():
|
|
9
|
+
get hash(): string | null;
|
|
10
10
|
hasErrors(): boolean;
|
|
11
11
|
hasWarnings(): boolean;
|
|
12
12
|
toJson(opts?: StatsValue, forToString?: boolean): StatsCompilation;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type EmotionConfigImportMap = {
|
|
2
|
+
[packageName: string]: {
|
|
3
|
+
[exportName: string]: {
|
|
4
|
+
canonicalImport?: [string, string];
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
type EmotionConfig = {
|
|
9
|
+
sourceMap?: boolean;
|
|
10
|
+
autoLabel?: "never" | "dev-only" | "always";
|
|
11
|
+
labelFormat?: string;
|
|
12
|
+
importMap?: EmotionConfigImportMap;
|
|
13
|
+
};
|
|
14
|
+
type EmotionOptions = boolean | EmotionConfig | undefined;
|
|
15
|
+
declare function resolveEmotion(emotion: EmotionOptions, isProduction: boolean): EmotionConfig | undefined;
|
|
16
|
+
export { resolveEmotion };
|
|
17
|
+
export type { EmotionOptions };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveEmotion = void 0;
|
|
4
|
+
function resolveEmotion(emotion, isProduction) {
|
|
5
|
+
if (!emotion) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
if (emotion === true) {
|
|
9
|
+
emotion = {};
|
|
10
|
+
}
|
|
11
|
+
const autoLabel = emotion?.autoLabel ?? "dev-only";
|
|
12
|
+
const emotionConfig = {
|
|
13
|
+
enabled: true,
|
|
14
|
+
// @ts-expect-error autoLabel is string for JavaScript interface, however is boolean for Rust interface
|
|
15
|
+
autoLabel: autoLabel === "dev-only" ? !isProduction : autoLabel === "always",
|
|
16
|
+
importMap: emotion?.importMap,
|
|
17
|
+
labelFormat: emotion?.labelFormat ?? "[local]",
|
|
18
|
+
sourcemap: isProduction ? false : emotion?.sourceMap ?? true
|
|
19
|
+
};
|
|
20
|
+
return emotionConfig;
|
|
21
|
+
}
|
|
22
|
+
exports.resolveEmotion = resolveEmotion;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
export type { EmotionOptions } from "./emotion";
|
|
2
|
+
export { resolveEmotion } from "./emotion";
|
|
1
3
|
export { resolvePluginImport } from "./pluginImport";
|
|
2
4
|
export type { PluginImportOptions } from "./pluginImport";
|
|
3
5
|
export type { ReactOptions } from "./react";
|
|
4
6
|
export { resolveReact } from "./react";
|
|
5
7
|
export { resolvePreact } from "./preact";
|
|
6
8
|
export type { PreactOptions } from "./preact";
|
|
9
|
+
export type { RelayOptions } from "./relay";
|
|
10
|
+
export { resolveRelay } from "./relay";
|
|
7
11
|
export type { SwcLoaderEnvConfig, SwcLoaderEsParserConfig, SwcLoaderJscConfig, SwcLoaderModuleConfig, SwcLoaderOptions, SwcLoaderParserConfig, SwcLoaderTransformConfig, SwcLoaderTsParserConfig } from "./types";
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolvePreact = exports.resolveReact = exports.resolvePluginImport = void 0;
|
|
3
|
+
exports.resolveRelay = exports.resolvePreact = exports.resolveReact = exports.resolvePluginImport = exports.resolveEmotion = void 0;
|
|
4
|
+
var emotion_1 = require("./emotion");
|
|
5
|
+
Object.defineProperty(exports, "resolveEmotion", { enumerable: true, get: function () { return emotion_1.resolveEmotion; } });
|
|
4
6
|
var pluginImport_1 = require("./pluginImport");
|
|
5
7
|
Object.defineProperty(exports, "resolvePluginImport", { enumerable: true, get: function () { return pluginImport_1.resolvePluginImport; } });
|
|
6
8
|
var react_1 = require("./react");
|
|
7
9
|
Object.defineProperty(exports, "resolveReact", { enumerable: true, get: function () { return react_1.resolveReact; } });
|
|
8
10
|
var preact_1 = require("./preact");
|
|
9
11
|
Object.defineProperty(exports, "resolvePreact", { enumerable: true, get: function () { return preact_1.resolvePreact; } });
|
|
12
|
+
var relay_1 = require("./relay");
|
|
13
|
+
Object.defineProperty(exports, "resolveRelay", { enumerable: true, get: function () { return relay_1.resolveRelay; } });
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type RawPreactOptions = {
|
|
2
2
|
library?: string;
|
|
3
3
|
};
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export {};
|
|
4
|
+
type PreactOptions = RawPreactOptions | boolean | undefined;
|
|
5
|
+
declare function resolvePreact(preact: PreactOptions): RawPreactOptions | undefined;
|
|
6
|
+
export { resolvePreact };
|
|
7
|
+
export type { PreactOptions };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RawRelayConfig } from "@rspack/binding";
|
|
2
|
+
type RelayOptions = boolean | RawRelayConfig | undefined;
|
|
3
|
+
declare function resolveRelay(relay: RelayOptions, rootDir: string): RawRelayConfig | undefined;
|
|
4
|
+
export { resolveRelay };
|
|
5
|
+
export type { RelayOptions };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.resolveRelay = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
function getRelayConfigFromProject(rootDir) {
|
|
9
|
+
for (const configName of [
|
|
10
|
+
"relay.config.json",
|
|
11
|
+
"relay.config.js",
|
|
12
|
+
"package.json"
|
|
13
|
+
]) {
|
|
14
|
+
const configPath = path_1.default.join(rootDir, configName);
|
|
15
|
+
try {
|
|
16
|
+
let config = require(configPath);
|
|
17
|
+
let finalConfig;
|
|
18
|
+
if (configName === "package.json") {
|
|
19
|
+
finalConfig = config?.relay;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
finalConfig = config;
|
|
23
|
+
}
|
|
24
|
+
if (finalConfig) {
|
|
25
|
+
return {
|
|
26
|
+
language: finalConfig.language,
|
|
27
|
+
artifactDirectory: finalConfig.artifactDirectory
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch (_) { }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function resolveRelay(relay, rootDir) {
|
|
35
|
+
if (!relay) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
// Search relay config based on
|
|
39
|
+
if (relay === true) {
|
|
40
|
+
return (getRelayConfigFromProject(rootDir) || {
|
|
41
|
+
language: "javascript"
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return relay;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.resolveRelay = resolveRelay;
|
|
@@ -2,9 +2,22 @@
|
|
|
2
2
|
* Some types are modified from https://github.com/swc-project/swc/blob/16a38851/packages/types/index.ts#L647
|
|
3
3
|
* license at https://github.com/swc-project/swc/blob/main/LICENSE
|
|
4
4
|
*/
|
|
5
|
+
import type { EmotionOptions } from "./emotion";
|
|
5
6
|
import type { PluginImportOptions } from "./pluginImport";
|
|
6
|
-
import type { PreactOptions } from "./preact";
|
|
7
7
|
import type { ReactOptions } from "./react";
|
|
8
|
+
import type { RelayOptions } from "./relay";
|
|
9
|
+
export type StyledComponentsOptions = {
|
|
10
|
+
displayName?: boolean;
|
|
11
|
+
ssr?: boolean;
|
|
12
|
+
fileName?: boolean;
|
|
13
|
+
meaninglessFileNames?: string[];
|
|
14
|
+
namespace?: string;
|
|
15
|
+
topLevelImportPaths?: string[];
|
|
16
|
+
transpileTemplateLiterals?: boolean;
|
|
17
|
+
minify?: boolean;
|
|
18
|
+
pure?: boolean;
|
|
19
|
+
cssProps?: boolean;
|
|
20
|
+
};
|
|
8
21
|
export type JscTarget = "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "esnext";
|
|
9
22
|
export type SwcLoaderParserConfig = SwcLoaderTsParserConfig | SwcLoaderEsParserConfig;
|
|
10
23
|
export interface SwcLoaderTsParserConfig {
|
|
@@ -441,7 +454,9 @@ export type SwcLoaderOptions = {
|
|
|
441
454
|
* @experimental
|
|
442
455
|
*/
|
|
443
456
|
rspackExperiments?: {
|
|
457
|
+
relay?: RelayOptions;
|
|
458
|
+
emotion?: EmotionOptions;
|
|
444
459
|
import?: PluginImportOptions;
|
|
445
|
-
|
|
460
|
+
styledComponents?: StyledComponentsOptions;
|
|
446
461
|
};
|
|
447
462
|
};
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
export declare const JavascriptModulesPlugin: {
|
|
3
|
+
new (): {
|
|
4
|
+
name: BuiltinPluginName;
|
|
5
|
+
_options: void;
|
|
6
|
+
affectedHooks: "make" | "compile" | "emit" | "afterEmit" | "invalid" | "done" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
7
|
+
raw(): import("@rspack/binding").BuiltinPlugin;
|
|
8
|
+
apply(compiler: import("../Compiler").Compiler): void;
|
|
9
|
+
};
|
|
9
10
|
};
|
|
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,55 +1,6 @@
|
|
|
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
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.JavascriptModulesPlugin = void 0;
|
|
27
4
|
const binding_1 = require("@rspack/binding");
|
|
28
|
-
const Compilation_1 = require("../Compilation");
|
|
29
|
-
const liteTapable = __importStar(require("../lite-tapable"));
|
|
30
5
|
const base_1 = require("./base");
|
|
31
|
-
|
|
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;
|
|
6
|
+
exports.JavascriptModulesPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.JavascriptModulesPlugin, () => { }, "compilation");
|
package/dist/config/adapter.js
CHANGED
|
@@ -85,24 +85,21 @@ function getRawResolveByDependency(byDependency) {
|
|
|
85
85
|
return byDependency;
|
|
86
86
|
return Object.fromEntries(Object.entries(byDependency).map(([k, v]) => [k, getRawResolve(v)]));
|
|
87
87
|
}
|
|
88
|
-
function getRawTsConfig(tsConfig) {
|
|
89
|
-
(0, assert_1.default)(typeof tsConfig !== "string", "should resolve string tsConfig in normalization");
|
|
90
|
-
if (tsConfig === undefined)
|
|
91
|
-
return tsConfig;
|
|
92
|
-
const { configFile, references } = tsConfig;
|
|
93
|
-
return {
|
|
94
|
-
configFile,
|
|
95
|
-
referencesType: references == "auto" ? "auto" : references ? "manual" : "disabled",
|
|
96
|
-
references: references == "auto" ? undefined : references
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
88
|
function getRawResolve(resolve) {
|
|
89
|
+
let references = resolve.tsConfig?.references;
|
|
90
|
+
let tsconfigConfigFile = resolve.tsConfigPath ?? resolve.tsConfig?.configFile;
|
|
100
91
|
return {
|
|
101
92
|
...resolve,
|
|
102
93
|
alias: getRawAlias(resolve.alias),
|
|
103
94
|
fallback: getRawAlias(resolve.fallback),
|
|
104
95
|
extensionAlias: getRawExtensionAlias(resolve.extensionAlias),
|
|
105
|
-
tsconfig:
|
|
96
|
+
tsconfig: tsconfigConfigFile
|
|
97
|
+
? {
|
|
98
|
+
configFile: tsconfigConfigFile,
|
|
99
|
+
referencesType: references == "auto" ? "auto" : references ? "manual" : "disabled",
|
|
100
|
+
references: references == "auto" ? undefined : references
|
|
101
|
+
}
|
|
102
|
+
: undefined,
|
|
106
103
|
byDependency: getRawResolveByDependency(resolve.byDependency)
|
|
107
104
|
};
|
|
108
105
|
}
|
|
@@ -16,9 +16,20 @@ exports.createRawModuleRuleUses = createRawModuleRuleUses;
|
|
|
16
16
|
const getSwcLoaderOptions = (o, options) => {
|
|
17
17
|
if (o && typeof o === "object" && o.rspackExperiments) {
|
|
18
18
|
let expr = o.rspackExperiments;
|
|
19
|
+
const contextPath = options.context;
|
|
20
|
+
const production = options.mode === "production" || !options.mode;
|
|
21
|
+
if (expr.emotion) {
|
|
22
|
+
expr.emotion = (0, builtin_loader_1.resolveEmotion)(expr.emotion, production);
|
|
23
|
+
}
|
|
24
|
+
if (expr.relay) {
|
|
25
|
+
expr.relay = (0, builtin_loader_1.resolveRelay)(expr.relay, contextPath);
|
|
26
|
+
}
|
|
19
27
|
if (expr.import || expr.pluginImport) {
|
|
20
28
|
expr.import = (0, builtin_loader_1.resolvePluginImport)(expr.import || expr.pluginImport);
|
|
21
29
|
}
|
|
30
|
+
if (expr.react) {
|
|
31
|
+
expr.react = (0, builtin_loader_1.resolveReact)(expr.react);
|
|
32
|
+
}
|
|
22
33
|
if (expr.preact) {
|
|
23
34
|
expr.preact = (0, builtin_loader_1.resolvePreact)(expr.preact);
|
|
24
35
|
}
|
|
@@ -123,20 +123,10 @@ const getNormalizedRspackOptions = (config) => {
|
|
|
123
123
|
};
|
|
124
124
|
}),
|
|
125
125
|
resolve: nestedConfig(config.resolve, resolve => ({
|
|
126
|
-
...resolve
|
|
127
|
-
tsConfig: optionalNestedConfig(resolve.tsConfig, tsConfig => {
|
|
128
|
-
return typeof tsConfig === "string"
|
|
129
|
-
? { configFile: tsConfig }
|
|
130
|
-
: tsConfig;
|
|
131
|
-
})
|
|
126
|
+
...resolve
|
|
132
127
|
})),
|
|
133
128
|
resolveLoader: nestedConfig(config.resolveLoader, resolve => ({
|
|
134
|
-
...resolve
|
|
135
|
-
tsConfig: optionalNestedConfig(resolve.tsConfig, tsConfig => {
|
|
136
|
-
return typeof tsConfig === "string"
|
|
137
|
-
? { configFile: tsConfig }
|
|
138
|
-
: tsConfig;
|
|
139
|
-
})
|
|
129
|
+
...resolve
|
|
140
130
|
})),
|
|
141
131
|
module: nestedConfig(config.module, module => ({
|
|
142
132
|
noParse: module.noParse,
|
package/dist/config/zod.d.ts
CHANGED
|
@@ -1431,7 +1431,7 @@ declare const output: z.ZodObject<{
|
|
|
1431
1431
|
export type Output = z.infer<typeof output>;
|
|
1432
1432
|
declare const resolveAlias: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<false>, z.ZodString]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodLiteral<false>]>, "many">]>>;
|
|
1433
1433
|
export type ResolveAlias = z.infer<typeof resolveAlias>;
|
|
1434
|
-
declare const
|
|
1434
|
+
declare const resolveTsconfig: z.ZodObject<{
|
|
1435
1435
|
configFile: z.ZodString;
|
|
1436
1436
|
references: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodLiteral<"auto">]>>;
|
|
1437
1437
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -1440,8 +1440,8 @@ declare const resolveTsConfig: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
|
1440
1440
|
}, {
|
|
1441
1441
|
configFile: string;
|
|
1442
1442
|
references?: string[] | "auto" | undefined;
|
|
1443
|
-
}
|
|
1444
|
-
export type
|
|
1443
|
+
}>;
|
|
1444
|
+
export type ResolveTsconfig = z.infer<typeof resolveTsconfig>;
|
|
1445
1445
|
declare const baseResolveOptions: z.ZodObject<{
|
|
1446
1446
|
alias: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<false>, z.ZodString]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodLiteral<false>]>, "many">]>>>;
|
|
1447
1447
|
conditionNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -1456,7 +1456,8 @@ declare const baseResolveOptions: z.ZodObject<{
|
|
|
1456
1456
|
enforceExtension: z.ZodOptional<z.ZodBoolean>;
|
|
1457
1457
|
importsFields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1458
1458
|
descriptionFiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1459
|
-
|
|
1459
|
+
tsConfigPath: z.ZodOptional<z.ZodString>;
|
|
1460
|
+
tsConfig: z.ZodOptional<z.ZodObject<{
|
|
1460
1461
|
configFile: z.ZodString;
|
|
1461
1462
|
references: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodLiteral<"auto">]>>;
|
|
1462
1463
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -1465,7 +1466,7 @@ declare const baseResolveOptions: z.ZodObject<{
|
|
|
1465
1466
|
}, {
|
|
1466
1467
|
configFile: string;
|
|
1467
1468
|
references?: string[] | "auto" | undefined;
|
|
1468
|
-
}
|
|
1469
|
+
}>>;
|
|
1469
1470
|
fullySpecified: z.ZodOptional<z.ZodBoolean>;
|
|
1470
1471
|
exportsFields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1471
1472
|
extensionAlias: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>>;
|
|
@@ -1486,7 +1487,8 @@ declare const baseResolveOptions: z.ZodObject<{
|
|
|
1486
1487
|
enforceExtension?: boolean | undefined;
|
|
1487
1488
|
importsFields?: string[] | undefined;
|
|
1488
1489
|
descriptionFiles?: string[] | undefined;
|
|
1489
|
-
|
|
1490
|
+
tsConfigPath?: string | undefined;
|
|
1491
|
+
tsConfig?: {
|
|
1490
1492
|
configFile: string;
|
|
1491
1493
|
references?: string[] | "auto" | undefined;
|
|
1492
1494
|
} | undefined;
|
|
@@ -1510,7 +1512,8 @@ declare const baseResolveOptions: z.ZodObject<{
|
|
|
1510
1512
|
enforceExtension?: boolean | undefined;
|
|
1511
1513
|
importsFields?: string[] | undefined;
|
|
1512
1514
|
descriptionFiles?: string[] | undefined;
|
|
1513
|
-
|
|
1515
|
+
tsConfigPath?: string | undefined;
|
|
1516
|
+
tsConfig?: {
|
|
1514
1517
|
configFile: string;
|
|
1515
1518
|
references?: string[] | "auto" | undefined;
|
|
1516
1519
|
} | undefined;
|
package/dist/config/zod.js
CHANGED
|
@@ -230,11 +230,10 @@ const resolveAlias = zod_1.z.record(zod_1.z
|
|
|
230
230
|
.literal(false)
|
|
231
231
|
.or(zod_1.z.string())
|
|
232
232
|
.or(zod_1.z.array(zod_1.z.string().or(zod_1.z.literal(false)))));
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
configFile: resolveTsConfigFile,
|
|
233
|
+
const resolveTsconfig = zod_1.z.strictObject({
|
|
234
|
+
configFile: zod_1.z.string(),
|
|
236
235
|
references: zod_1.z.array(zod_1.z.string()).or(zod_1.z.literal("auto")).optional()
|
|
237
|
-
})
|
|
236
|
+
});
|
|
238
237
|
const baseResolveOptions = zod_1.z.strictObject({
|
|
239
238
|
alias: resolveAlias.optional(),
|
|
240
239
|
conditionNames: zod_1.z.array(zod_1.z.string()).optional(),
|
|
@@ -249,7 +248,8 @@ const baseResolveOptions = zod_1.z.strictObject({
|
|
|
249
248
|
enforceExtension: zod_1.z.boolean().optional(),
|
|
250
249
|
importsFields: zod_1.z.array(zod_1.z.string()).optional(),
|
|
251
250
|
descriptionFiles: zod_1.z.array(zod_1.z.string()).optional(),
|
|
252
|
-
|
|
251
|
+
tsConfigPath: zod_1.z.string().optional(),
|
|
252
|
+
tsConfig: resolveTsconfig.optional(),
|
|
253
253
|
fullySpecified: zod_1.z.boolean().optional(),
|
|
254
254
|
exportsFields: zod_1.z.array(zod_1.z.string()).optional(),
|
|
255
255
|
extensionAlias: zod_1.z.record(zod_1.z.string().or(zod_1.z.array(zod_1.z.string()))).optional(),
|
package/dist/exports.d.ts
CHANGED
|
@@ -87,10 +87,9 @@ interface Wasm {
|
|
|
87
87
|
EnableWasmLoadingPlugin: typeof EnableWasmLoadingPlugin;
|
|
88
88
|
}
|
|
89
89
|
export declare const wasm: Wasm;
|
|
90
|
-
import { EnableChunkLoadingPlugin
|
|
90
|
+
import { EnableChunkLoadingPlugin } from "./builtin-plugin";
|
|
91
91
|
interface JavaScript {
|
|
92
92
|
EnableChunkLoadingPlugin: typeof EnableChunkLoadingPlugin;
|
|
93
|
-
JavascriptModulesPlugin: typeof JavascriptModulesPlugin;
|
|
94
93
|
}
|
|
95
94
|
export declare const javascript: JavaScript;
|
|
96
95
|
import { WebWorkerTemplatePlugin } from "./builtin-plugin";
|
package/dist/exports.js
CHANGED
|
@@ -117,10 +117,7 @@ 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 = {
|
|
121
|
-
EnableChunkLoadingPlugin: builtin_plugin_15.EnableChunkLoadingPlugin,
|
|
122
|
-
JavascriptModulesPlugin: builtin_plugin_15.JavascriptModulesPlugin
|
|
123
|
-
};
|
|
120
|
+
exports.javascript = { EnableChunkLoadingPlugin: builtin_plugin_15.EnableChunkLoadingPlugin };
|
|
124
121
|
const builtin_plugin_16 = require("./builtin-plugin");
|
|
125
122
|
exports.webworker = { WebWorkerTemplatePlugin: builtin_plugin_16.WebWorkerTemplatePlugin };
|
|
126
123
|
const builtin_plugin_17 = require("./builtin-plugin");
|
|
@@ -277,23 +277,13 @@ const SORTERS = {
|
|
|
277
277
|
_: comparators => {
|
|
278
278
|
comparators.push((0, comparators_1.compareSelect)((c) => c.id, compareIds));
|
|
279
279
|
}
|
|
280
|
-
}
|
|
280
|
+
}
|
|
281
281
|
// "compilation.modules": MODULES_SORTER,
|
|
282
282
|
// "chunk.rootModules": MODULES_SORTER,
|
|
283
283
|
// "chunk.modules": MODULES_SORTER,
|
|
284
284
|
// "module.modules": MODULES_SORTER,
|
|
285
285
|
// not support module.reasons (missing Module.identifier())
|
|
286
|
-
|
|
287
|
-
_: comparators => {
|
|
288
|
-
comparators.push(
|
|
289
|
-
// compareSelect(
|
|
290
|
-
// origin =>
|
|
291
|
-
// origin.module ? chunkGraph.getModuleId(origin.module) : undefined,
|
|
292
|
-
// compareIds
|
|
293
|
-
// ),
|
|
294
|
-
(0, comparators_1.compareSelect)((origin) => origin.loc, compareIds), (0, comparators_1.compareSelect)((origin) => origin.request, compareIds));
|
|
295
|
-
}
|
|
296
|
-
}
|
|
286
|
+
// not support chunk.origins (missing compilation.chunkGraph)
|
|
297
287
|
};
|
|
298
288
|
const SIMPLE_EXTRACTORS = {
|
|
299
289
|
compilation: {
|
|
@@ -718,10 +708,6 @@ const SIMPLE_EXTRACTORS = {
|
|
|
718
708
|
object.files = chunk.files;
|
|
719
709
|
object.auxiliaryFiles = chunk.auxiliaryFiles;
|
|
720
710
|
object.childrenByOrder = chunk.childrenByOrder;
|
|
721
|
-
object.runtime = chunk.runtime;
|
|
722
|
-
object.sizes = Object.fromEntries(chunk.sizes.map(({ sourceType, size }) => [sourceType, size]));
|
|
723
|
-
object.reason = chunk.reason;
|
|
724
|
-
object.rendered = chunk.rendered;
|
|
725
711
|
},
|
|
726
712
|
ids: (object, chunk) => {
|
|
727
713
|
object.id = chunk.id;
|
|
@@ -734,9 +720,6 @@ const SIMPLE_EXTRACTORS = {
|
|
|
734
720
|
chunkModules: (object, chunk, context, options, factory) => {
|
|
735
721
|
const { type } = context;
|
|
736
722
|
object.modules = factory.create(`${type}.modules`, chunk.modules, context);
|
|
737
|
-
},
|
|
738
|
-
chunkOrigins: (object, chunk, context, options, factory) => {
|
|
739
|
-
object.origins = chunk.origins;
|
|
740
723
|
}
|
|
741
724
|
}
|
|
742
725
|
};
|
|
@@ -3,9 +3,7 @@ import type { Compilation, NormalizedStatsOptions } from "../Compilation";
|
|
|
3
3
|
import { type Comparator } from "../util/comparators";
|
|
4
4
|
import type { StatsFactory, StatsFactoryContext } from "./StatsFactory";
|
|
5
5
|
export type KnownStatsChunkGroup = binding.JsStatsChunkGroup;
|
|
6
|
-
export type KnownStatsChunk =
|
|
7
|
-
sizes: Record<string, number>;
|
|
8
|
-
};
|
|
6
|
+
export type KnownStatsChunk = binding.JsStatsChunk;
|
|
9
7
|
export type StatsChunkGroup = binding.JsStatsChunkGroup & Record<string, any>;
|
|
10
8
|
export type KnownStatsAsset = binding.JsStatsAsset;
|
|
11
9
|
export type StatsAsset = KnownStatsAsset & Record<string, any>;
|
|
@@ -97,7 +95,7 @@ export type SimpleExtractors = {
|
|
|
97
95
|
moduleIssuer: ExtractorsByOption<binding.JsStatsModuleIssuer, StatsModuleIssuer>;
|
|
98
96
|
profile: ExtractorsByOption<binding.JsStatsModuleProfile, StatsProfile>;
|
|
99
97
|
moduleReason: ExtractorsByOption<binding.JsStatsModuleReason, StatsModuleReason>;
|
|
100
|
-
chunk: ExtractorsByOption<
|
|
98
|
+
chunk: ExtractorsByOption<StatsChunk, KnownStatsChunk>;
|
|
101
99
|
};
|
|
102
100
|
export declare const uniqueArray: <T, I>(items: Iterable<T>, selector: (arg: T) => Iterable<I>) => I[];
|
|
103
101
|
export declare const uniqueOrderedArray: <T, I>(items: Iterable<T>, selector: (arg: T) => Iterable<I>, comparator: Comparator) => I[];
|
package/dist/util/memoize.js
CHANGED
|
@@ -37,11 +37,7 @@ function memoizeValue(fn) {
|
|
|
37
37
|
const getValue = (0, exports.memoize)(fn);
|
|
38
38
|
return new Proxy({}, {
|
|
39
39
|
get(_, property) {
|
|
40
|
-
|
|
41
|
-
if (typeof res === "function") {
|
|
42
|
-
res = res.bind(getValue());
|
|
43
|
-
}
|
|
44
|
-
return res;
|
|
40
|
+
return getValue()[property];
|
|
45
41
|
},
|
|
46
42
|
set(_, property, newValue) {
|
|
47
43
|
getValue()[property] = newValue;
|
package/package.json
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "0.7.5
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"publishConfig": {
|
|
10
|
-
"access": "public",
|
|
11
|
-
"provenance": true
|
|
12
|
-
},
|
|
13
9
|
"exports": {
|
|
14
10
|
".": {
|
|
15
11
|
"default": "./dist/index.js"
|
|
@@ -78,15 +74,15 @@
|
|
|
78
74
|
"watchpack": "^2.4.0",
|
|
79
75
|
"zod": "^3.21.4",
|
|
80
76
|
"zod-validation-error": "1.3.1",
|
|
81
|
-
"@rspack/
|
|
82
|
-
"@rspack/
|
|
77
|
+
"@rspack/core": "0.7.5",
|
|
78
|
+
"@rspack/plugin-minify": "^0.7.5"
|
|
83
79
|
},
|
|
84
80
|
"dependencies": {
|
|
85
81
|
"@module-federation/runtime-tools": "0.1.6",
|
|
86
82
|
"caniuse-lite": "^1.0.30001616",
|
|
87
83
|
"tapable": "2.2.1",
|
|
88
84
|
"webpack-sources": "3.2.3",
|
|
89
|
-
"@rspack/binding": "0.7.5
|
|
85
|
+
"@rspack/binding": "0.7.5"
|
|
90
86
|
},
|
|
91
87
|
"peerDependencies": {
|
|
92
88
|
"@swc/helpers": ">=0.5.1"
|