@rspack/core 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Chunk.d.ts +2 -1
- package/dist/Chunk.js +8 -0
- package/dist/Compilation.d.ts +22 -9
- package/dist/Compilation.js +32 -12
- package/dist/Compiler.js +5 -2
- package/dist/RuntimeModule.d.ts +1 -1
- package/dist/RuntimeModule.js +2 -2
- package/dist/builtin-plugin/BannerPlugin.d.ts +29 -177
- package/dist/builtin-plugin/BannerPlugin.js +0 -23
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +3 -58
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +64 -110
- package/dist/builtin-plugin/IgnorePlugin.d.ts +3 -0
- package/dist/config/adapter.js +5 -1
- package/dist/config/defaults.js +4 -0
- package/dist/config/types.d.ts +293 -0
- package/dist/config/types.js +3 -0
- package/dist/config/zod.d.ts +879 -2074
- package/dist/config/zod.js +49 -13
- package/dist/container/ContainerPlugin.d.ts +2 -18
- package/dist/container/ContainerReferencePlugin.d.ts +1 -1
- package/dist/loader-runner/index.js +2 -1
- package/dist/util/hash/md4.d.ts +1 -19
- package/dist/util/hash/md4.js +12 -6
- package/dist/util/hash/wasm-hash.d.ts +1 -1
- package/dist/util/hash/wasm-hash.js +2 -1
- package/dist/util/hash/xxhash64.d.ts +1 -19
- package/dist/util/hash/xxhash64.js +12 -6
- package/package.json +3 -3
package/dist/Chunk.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type JsChunk, type JsCompilation } from "@rspack/binding";
|
|
1
|
+
import { type JsChunk, type JsChunkPathData, type JsCompilation } from "@rspack/binding";
|
|
2
2
|
import { Compilation } from ".";
|
|
3
3
|
import { ChunkGroup } from "./ChunkGroup";
|
|
4
4
|
export declare class Chunk {
|
|
@@ -37,4 +37,5 @@ export declare class Chunk {
|
|
|
37
37
|
* @internal
|
|
38
38
|
*/
|
|
39
39
|
__internal__innerUkey(): number;
|
|
40
|
+
__internal_to_path_data_chunk(): JsChunkPathData;
|
|
40
41
|
}
|
package/dist/Chunk.js
CHANGED
|
@@ -105,6 +105,14 @@ class Chunk {
|
|
|
105
105
|
__internal__innerUkey() {
|
|
106
106
|
return __classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey;
|
|
107
107
|
}
|
|
108
|
+
__internal_to_path_data_chunk() {
|
|
109
|
+
return {
|
|
110
|
+
id: this.id,
|
|
111
|
+
name: this.name,
|
|
112
|
+
hash: this.hash,
|
|
113
|
+
contentHash: this.contentHash
|
|
114
|
+
};
|
|
115
|
+
}
|
|
108
116
|
}
|
|
109
117
|
exports.Chunk = Chunk;
|
|
110
118
|
_Chunk_inner = new WeakMap(), _Chunk_innerCompilation = new WeakMap();
|
package/dist/Compilation.d.ts
CHANGED
|
@@ -37,7 +37,9 @@ export interface Asset {
|
|
|
37
37
|
source: Source;
|
|
38
38
|
info: AssetInfo;
|
|
39
39
|
}
|
|
40
|
-
export type PathData = JsPathData
|
|
40
|
+
export type PathData = Omit<JsPathData, "chunk"> & {
|
|
41
|
+
chunk?: Chunk | binding.JsChunkPathData;
|
|
42
|
+
};
|
|
41
43
|
export interface LogEntry {
|
|
42
44
|
type: string;
|
|
43
45
|
args: any[];
|
|
@@ -164,10 +166,7 @@ export declare class Compilation {
|
|
|
164
166
|
Chunk,
|
|
165
167
|
Set<string>
|
|
166
168
|
], void>;
|
|
167
|
-
runtimeRequirementInTree: liteTapable.SyncBailHook<[
|
|
168
|
-
Chunk,
|
|
169
|
-
Set<string>
|
|
170
|
-
], void>;
|
|
169
|
+
runtimeRequirementInTree: liteTapable.HookMap<liteTapable.SyncBailHook<[Chunk, Set<string>], void>>;
|
|
171
170
|
runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk], void>;
|
|
172
171
|
seal: liteTapable.SyncHook<[], void>;
|
|
173
172
|
afterSeal: liteTapable.AsyncSeriesHook<[], void>;
|
|
@@ -206,6 +205,7 @@ export declare class Compilation {
|
|
|
206
205
|
*/
|
|
207
206
|
get namedChunkGroups(): ReadonlyMap<string, Readonly<ChunkGroup>>;
|
|
208
207
|
get modules(): ReadonlySet<Module>;
|
|
208
|
+
get builtModules(): ReadonlySet<Module>;
|
|
209
209
|
get chunks(): ReadonlySet<Chunk>;
|
|
210
210
|
/**
|
|
211
211
|
* Get the named chunks.
|
|
@@ -377,19 +377,32 @@ export declare class Compilation {
|
|
|
377
377
|
static PROCESS_ASSETS_STAGE_REPORT: number;
|
|
378
378
|
}
|
|
379
379
|
export type EntryData = binding.JsEntryData;
|
|
380
|
+
/**
|
|
381
|
+
* Copied from `lib.es2015.iterable.d.ts` in TS 5.6 for compatibility
|
|
382
|
+
* 1. In 5.6 and after, `IterableIterator` cannot be assigned to 'MapIterator'
|
|
383
|
+
* 2. Before 5.6, Cannot find name 'MapIterator'
|
|
384
|
+
* @see https://devblogs.microsoft.com/typescript/announcing-typescript-5-6/#iterator-helper-methods
|
|
385
|
+
*/
|
|
386
|
+
interface IteratorObject<T, TReturn = unknown, TNext = unknown> extends Iterator<T, TReturn, TNext> {
|
|
387
|
+
[Symbol.iterator](): IteratorObject<T, TReturn, TNext>;
|
|
388
|
+
}
|
|
389
|
+
type BuiltinIteratorReturn = any;
|
|
390
|
+
interface MapIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
|
|
391
|
+
[Symbol.iterator](): MapIterator<T>;
|
|
392
|
+
}
|
|
380
393
|
export declare class Entries implements Map<string, EntryData> {
|
|
381
394
|
#private;
|
|
382
395
|
constructor(data: binding.JsEntries);
|
|
383
396
|
clear(): void;
|
|
384
397
|
forEach(callback: (value: binding.JsEntryData, key: string, map: Map<string, binding.JsEntryData>) => void, thisArg?: any): void;
|
|
385
398
|
get size(): number;
|
|
386
|
-
entries():
|
|
387
|
-
values():
|
|
388
|
-
[Symbol.iterator]():
|
|
399
|
+
entries(): MapIterator<[string, binding.JsEntryData]>;
|
|
400
|
+
values(): MapIterator<binding.JsEntryData>;
|
|
401
|
+
[Symbol.iterator](): MapIterator<[string, binding.JsEntryData]>;
|
|
389
402
|
get [Symbol.toStringTag](): string;
|
|
390
403
|
has(key: string): boolean;
|
|
391
404
|
set(key: string, value: EntryData): this;
|
|
392
405
|
delete(key: string): boolean;
|
|
393
406
|
get(key: string): EntryData | undefined;
|
|
394
|
-
keys():
|
|
407
|
+
keys(): MapIterator<string>;
|
|
395
408
|
}
|
package/dist/Compilation.js
CHANGED
|
@@ -160,10 +160,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
160
160
|
"chunk",
|
|
161
161
|
"runtimeRequirements"
|
|
162
162
|
]),
|
|
163
|
-
runtimeRequirementInTree: new liteTapable.SyncBailHook([
|
|
164
|
-
"chunk",
|
|
165
|
-
"runtimeRequirements"
|
|
166
|
-
]),
|
|
163
|
+
runtimeRequirementInTree: new liteTapable.HookMap(() => new liteTapable.SyncBailHook(["chunk", "runtimeRequirements"])),
|
|
167
164
|
runtimeModule: new liteTapable.SyncHook(["module", "chunk"]),
|
|
168
165
|
seal: new liteTapable.SyncHook([]),
|
|
169
166
|
afterSeal: new liteTapable.AsyncSeriesHook([])
|
|
@@ -224,6 +221,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
224
221
|
get modules() {
|
|
225
222
|
return new Set(__classPrivateFieldGet(this, _Compilation_inner, "f").modules.map(module => Module_1.Module.__from_binding(module, this)));
|
|
226
223
|
}
|
|
224
|
+
get builtModules() {
|
|
225
|
+
return new Set(__classPrivateFieldGet(this, _Compilation_inner, "f").builtModules.map(module => Module_1.Module.__from_binding(module, this)));
|
|
226
|
+
}
|
|
227
227
|
get chunks() {
|
|
228
228
|
return (0, memoize_1.memoizeValue)(() => new Set(this.__internal__getChunks()));
|
|
229
229
|
}
|
|
@@ -452,10 +452,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
452
452
|
}
|
|
453
453
|
];
|
|
454
454
|
for (const item of proxyMethod) {
|
|
455
|
-
const
|
|
455
|
+
const proxiedMethod = new Proxy(errors[item.method], {
|
|
456
456
|
apply: item.handler
|
|
457
457
|
});
|
|
458
|
-
errors[item.method] =
|
|
458
|
+
errors[item.method] = proxiedMethod;
|
|
459
459
|
}
|
|
460
460
|
return errors;
|
|
461
461
|
}
|
|
@@ -514,24 +514,44 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
514
514
|
}
|
|
515
515
|
];
|
|
516
516
|
for (const item of proxyMethod) {
|
|
517
|
-
const
|
|
517
|
+
const proxiedMethod = new Proxy(warnings[item.method], {
|
|
518
518
|
apply: item.handler
|
|
519
519
|
});
|
|
520
|
-
warnings[item.method] =
|
|
520
|
+
warnings[item.method] = proxiedMethod;
|
|
521
521
|
}
|
|
522
522
|
return warnings;
|
|
523
523
|
}
|
|
524
524
|
getPath(filename, data = {}) {
|
|
525
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").getPath(filename,
|
|
525
|
+
return __classPrivateFieldGet(this, _Compilation_inner, "f").getPath(filename, {
|
|
526
|
+
...data,
|
|
527
|
+
chunk: data.chunk instanceof Chunk_1.Chunk
|
|
528
|
+
? data.chunk.__internal_to_path_data_chunk()
|
|
529
|
+
: data.chunk
|
|
530
|
+
});
|
|
526
531
|
}
|
|
527
532
|
getPathWithInfo(filename, data = {}) {
|
|
528
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").getPathWithInfo(filename,
|
|
533
|
+
return __classPrivateFieldGet(this, _Compilation_inner, "f").getPathWithInfo(filename, {
|
|
534
|
+
...data,
|
|
535
|
+
chunk: data.chunk instanceof Chunk_1.Chunk
|
|
536
|
+
? data.chunk.__internal_to_path_data_chunk()
|
|
537
|
+
: data.chunk
|
|
538
|
+
});
|
|
529
539
|
}
|
|
530
540
|
getAssetPath(filename, data = {}) {
|
|
531
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").getAssetPath(filename,
|
|
541
|
+
return __classPrivateFieldGet(this, _Compilation_inner, "f").getAssetPath(filename, {
|
|
542
|
+
...data,
|
|
543
|
+
chunk: data.chunk instanceof Chunk_1.Chunk
|
|
544
|
+
? data.chunk.__internal_to_path_data_chunk()
|
|
545
|
+
: data.chunk
|
|
546
|
+
});
|
|
532
547
|
}
|
|
533
548
|
getAssetPathWithInfo(filename, data = {}) {
|
|
534
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").getAssetPathWithInfo(filename,
|
|
549
|
+
return __classPrivateFieldGet(this, _Compilation_inner, "f").getAssetPathWithInfo(filename, {
|
|
550
|
+
...data,
|
|
551
|
+
chunk: data.chunk instanceof Chunk_1.Chunk
|
|
552
|
+
? data.chunk.__internal_to_path_data_chunk()
|
|
553
|
+
: data.chunk
|
|
554
|
+
});
|
|
535
555
|
}
|
|
536
556
|
getLogger(name) {
|
|
537
557
|
if (!name) {
|
package/dist/Compiler.js
CHANGED
|
@@ -594,9 +594,12 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
|
|
|
594
594
|
runtimeRequirements: (0, RuntimeGlobals_1.__to_binding_runtime_globals)(set)
|
|
595
595
|
};
|
|
596
596
|
}),
|
|
597
|
-
registerCompilationRuntimeRequirementInTree: __classPrivateFieldGet(this, _Compiler_instances, "m",
|
|
597
|
+
registerCompilationRuntimeRequirementInTree: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookMapRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationRuntimeRequirementInTree, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.runtimeRequirementInTree, queried => ({ chunk: rawChunk, runtimeRequirements }) => {
|
|
598
598
|
const set = (0, RuntimeGlobals_1.__from_binding_runtime_globals)(runtimeRequirements);
|
|
599
|
-
|
|
599
|
+
const chunk = Chunk_1.Chunk.__from_binding(rawChunk, __classPrivateFieldGet(this, _Compiler_compilation, "f"));
|
|
600
|
+
for (const r of set) {
|
|
601
|
+
queried.for(r).call(chunk, set);
|
|
602
|
+
}
|
|
600
603
|
return {
|
|
601
604
|
runtimeRequirements: (0, RuntimeGlobals_1.__to_binding_runtime_globals)(set)
|
|
602
605
|
};
|
package/dist/RuntimeModule.d.ts
CHANGED
package/dist/RuntimeModule.js
CHANGED
|
@@ -13,7 +13,7 @@ class RuntimeModule {
|
|
|
13
13
|
return {
|
|
14
14
|
name: module.name,
|
|
15
15
|
stage: module.stage,
|
|
16
|
-
generator:
|
|
16
|
+
generator: module.generate.bind(module),
|
|
17
17
|
cacheable: !(module.fullHash || module.dependentHash),
|
|
18
18
|
isolate: module.shouldIsolate()
|
|
19
19
|
};
|
|
@@ -47,7 +47,7 @@ class RuntimeModule {
|
|
|
47
47
|
shouldIsolate() {
|
|
48
48
|
return true;
|
|
49
49
|
}
|
|
50
|
-
generate(
|
|
50
|
+
generate() {
|
|
51
51
|
throw new Error(`Should implement "generate" method of runtime module "${this.name}"`);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -1,188 +1,40 @@
|
|
|
1
1
|
import { BuiltinPluginName, type JsChunk } from "@rspack/binding";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
declare const rules: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">]>;
|
|
6
|
-
export type Rules = z.infer<typeof rules>;
|
|
7
|
-
declare const bannerFunction: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
8
|
-
hash: z.ZodString;
|
|
9
|
-
chunk: z.ZodType<JsChunk, z.ZodTypeDef, JsChunk>;
|
|
10
|
-
filename: z.ZodString;
|
|
11
|
-
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
filename: string;
|
|
13
|
-
hash: string;
|
|
14
|
-
chunk: JsChunk;
|
|
15
|
-
}, {
|
|
16
|
-
filename: string;
|
|
17
|
-
hash: string;
|
|
18
|
-
chunk: JsChunk;
|
|
19
|
-
}>], z.ZodUnknown>, z.ZodString>;
|
|
20
|
-
export type BannerFunction = z.infer<typeof bannerFunction>;
|
|
21
|
-
declare const bannerContent: z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
22
|
-
hash: z.ZodString;
|
|
23
|
-
chunk: z.ZodType<JsChunk, z.ZodTypeDef, JsChunk>;
|
|
24
|
-
filename: z.ZodString;
|
|
25
|
-
}, "strip", z.ZodTypeAny, {
|
|
26
|
-
filename: string;
|
|
27
|
-
hash: string;
|
|
28
|
-
chunk: JsChunk;
|
|
29
|
-
}, {
|
|
30
|
-
filename: string;
|
|
31
|
-
hash: string;
|
|
32
|
-
chunk: JsChunk;
|
|
33
|
-
}>], z.ZodUnknown>, z.ZodString>]>;
|
|
34
|
-
export type BannerContent = z.infer<typeof bannerContent>;
|
|
35
|
-
declare const bannerPluginOptions: z.ZodObject<{
|
|
36
|
-
banner: z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
37
|
-
hash: z.ZodString;
|
|
38
|
-
chunk: z.ZodType<JsChunk, z.ZodTypeDef, JsChunk>;
|
|
39
|
-
filename: z.ZodString;
|
|
40
|
-
}, "strip", z.ZodTypeAny, {
|
|
41
|
-
filename: string;
|
|
42
|
-
hash: string;
|
|
43
|
-
chunk: JsChunk;
|
|
44
|
-
}, {
|
|
45
|
-
filename: string;
|
|
46
|
-
hash: string;
|
|
47
|
-
chunk: JsChunk;
|
|
48
|
-
}>], z.ZodUnknown>, z.ZodString>]>;
|
|
49
|
-
entryOnly: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
-
exclude: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">]>>;
|
|
51
|
-
include: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">]>>;
|
|
52
|
-
raw: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
-
footer: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
-
stage: z.ZodOptional<z.ZodNumber>;
|
|
55
|
-
test: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">]>>;
|
|
56
|
-
}, "strict", z.ZodTypeAny, {
|
|
57
|
-
banner: string | ((args_0: {
|
|
58
|
-
filename: string;
|
|
59
|
-
hash: string;
|
|
60
|
-
chunk: JsChunk;
|
|
61
|
-
}, ...args_1: unknown[]) => string);
|
|
62
|
-
entryOnly?: boolean | undefined;
|
|
63
|
-
exclude?: string | RegExp | (string | RegExp)[] | undefined;
|
|
64
|
-
include?: string | RegExp | (string | RegExp)[] | undefined;
|
|
65
|
-
raw?: boolean | undefined;
|
|
66
|
-
footer?: boolean | undefined;
|
|
67
|
-
stage?: number | undefined;
|
|
68
|
-
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
69
|
-
}, {
|
|
70
|
-
banner: string | ((args_0: {
|
|
71
|
-
filename: string;
|
|
72
|
-
hash: string;
|
|
73
|
-
chunk: JsChunk;
|
|
74
|
-
}, ...args_1: unknown[]) => string);
|
|
75
|
-
entryOnly?: boolean | undefined;
|
|
76
|
-
exclude?: string | RegExp | (string | RegExp)[] | undefined;
|
|
77
|
-
include?: string | RegExp | (string | RegExp)[] | undefined;
|
|
78
|
-
raw?: boolean | undefined;
|
|
79
|
-
footer?: boolean | undefined;
|
|
80
|
-
stage?: number | undefined;
|
|
81
|
-
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
82
|
-
}>;
|
|
83
|
-
export type BannerPluginOptions = z.infer<typeof bannerPluginOptions>;
|
|
84
|
-
declare const bannerPluginArgument: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
85
|
-
hash: z.ZodString;
|
|
86
|
-
chunk: z.ZodType<JsChunk, z.ZodTypeDef, JsChunk>;
|
|
87
|
-
filename: z.ZodString;
|
|
88
|
-
}, "strip", z.ZodTypeAny, {
|
|
89
|
-
filename: string;
|
|
2
|
+
export type Rule = string | RegExp;
|
|
3
|
+
export type Rules = Rule[] | Rule;
|
|
4
|
+
export type BannerFunction = (args: {
|
|
90
5
|
hash: string;
|
|
91
6
|
chunk: JsChunk;
|
|
92
|
-
}, {
|
|
93
7
|
filename: string;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
banner
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
banner: string | ((args_0: {
|
|
119
|
-
filename: string;
|
|
120
|
-
hash: string;
|
|
121
|
-
chunk: JsChunk;
|
|
122
|
-
}, ...args_1: unknown[]) => string);
|
|
123
|
-
entryOnly?: boolean | undefined;
|
|
124
|
-
exclude?: string | RegExp | (string | RegExp)[] | undefined;
|
|
125
|
-
include?: string | RegExp | (string | RegExp)[] | undefined;
|
|
126
|
-
raw?: boolean | undefined;
|
|
127
|
-
footer?: boolean | undefined;
|
|
128
|
-
stage?: number | undefined;
|
|
129
|
-
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
130
|
-
}, {
|
|
131
|
-
banner: string | ((args_0: {
|
|
132
|
-
filename: string;
|
|
133
|
-
hash: string;
|
|
134
|
-
chunk: JsChunk;
|
|
135
|
-
}, ...args_1: unknown[]) => string);
|
|
136
|
-
entryOnly?: boolean | undefined;
|
|
137
|
-
exclude?: string | RegExp | (string | RegExp)[] | undefined;
|
|
138
|
-
include?: string | RegExp | (string | RegExp)[] | undefined;
|
|
139
|
-
raw?: boolean | undefined;
|
|
140
|
-
footer?: boolean | undefined;
|
|
141
|
-
stage?: number | undefined;
|
|
142
|
-
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
143
|
-
}>]>;
|
|
144
|
-
export type BannerPluginArgument = z.infer<typeof bannerPluginArgument>;
|
|
8
|
+
}) => string;
|
|
9
|
+
export type BannerContent = string | BannerFunction;
|
|
10
|
+
export type BannerPluginOptions = {
|
|
11
|
+
/** Specifies the banner, it will be wrapped in a comment. */
|
|
12
|
+
banner: BannerContent;
|
|
13
|
+
/** If true, the banner will only be added to the entry chunks. */
|
|
14
|
+
entryOnly?: boolean;
|
|
15
|
+
/** Exclude all modules matching any of these conditions. */
|
|
16
|
+
exclude?: Rules;
|
|
17
|
+
/** Include all modules matching any of these conditions. */
|
|
18
|
+
include?: Rules;
|
|
19
|
+
/** If true, banner will not be wrapped in a comment. */
|
|
20
|
+
raw?: boolean;
|
|
21
|
+
/** If true, banner will be placed at the end of the output. */
|
|
22
|
+
footer?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The stage of the compilation in which the banner should be injected.
|
|
25
|
+
* @default PROCESS_ASSETS_STAGE_ADDITIONS (-100)
|
|
26
|
+
*/
|
|
27
|
+
stage?: number;
|
|
28
|
+
/** Include all modules that pass test assertion. */
|
|
29
|
+
test?: Rules;
|
|
30
|
+
};
|
|
31
|
+
export type BannerPluginArgument = BannerContent | BannerPluginOptions;
|
|
145
32
|
export declare const BannerPlugin: {
|
|
146
|
-
new (args:
|
|
147
|
-
filename: string;
|
|
148
|
-
hash: string;
|
|
149
|
-
chunk: JsChunk;
|
|
150
|
-
}, ...args_1: unknown[]) => string) | {
|
|
151
|
-
banner: string | ((args_0: {
|
|
152
|
-
filename: string;
|
|
153
|
-
hash: string;
|
|
154
|
-
chunk: JsChunk;
|
|
155
|
-
}, ...args_1: unknown[]) => string);
|
|
156
|
-
entryOnly?: boolean | undefined;
|
|
157
|
-
exclude?: string | RegExp | (string | RegExp)[] | undefined;
|
|
158
|
-
include?: string | RegExp | (string | RegExp)[] | undefined;
|
|
159
|
-
raw?: boolean | undefined;
|
|
160
|
-
footer?: boolean | undefined;
|
|
161
|
-
stage?: number | undefined;
|
|
162
|
-
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
163
|
-
}): {
|
|
33
|
+
new (args: BannerPluginArgument): {
|
|
164
34
|
name: BuiltinPluginName;
|
|
165
|
-
_args: [args:
|
|
166
|
-
filename: string;
|
|
167
|
-
hash: string;
|
|
168
|
-
chunk: JsChunk;
|
|
169
|
-
}, ...args_1: unknown[]) => string) | {
|
|
170
|
-
banner: string | ((args_0: {
|
|
171
|
-
filename: string;
|
|
172
|
-
hash: string;
|
|
173
|
-
chunk: JsChunk;
|
|
174
|
-
}, ...args_1: unknown[]) => string);
|
|
175
|
-
entryOnly?: boolean | undefined;
|
|
176
|
-
exclude?: string | RegExp | (string | RegExp)[] | undefined;
|
|
177
|
-
include?: string | RegExp | (string | RegExp)[] | undefined;
|
|
178
|
-
raw?: boolean | undefined;
|
|
179
|
-
footer?: boolean | undefined;
|
|
180
|
-
stage?: number | undefined;
|
|
181
|
-
test?: string | RegExp | (string | RegExp)[] | undefined;
|
|
182
|
-
}];
|
|
35
|
+
_args: [args: BannerPluginArgument];
|
|
183
36
|
affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
184
37
|
raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
185
38
|
apply(compiler: import("../Compiler").Compiler): void;
|
|
186
39
|
};
|
|
187
40
|
};
|
|
188
|
-
export {};
|
|
@@ -2,30 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BannerPlugin = void 0;
|
|
4
4
|
const binding_1 = require("@rspack/binding");
|
|
5
|
-
const zod_1 = require("../../compiled/zod");
|
|
6
5
|
const base_1 = require("./base");
|
|
7
|
-
const rule = zod_1.z.string().or(zod_1.z.instanceof(RegExp));
|
|
8
|
-
const rules = rule.or(rule.array());
|
|
9
|
-
const bannerFunction = zod_1.z
|
|
10
|
-
.function()
|
|
11
|
-
.args(zod_1.z.object({
|
|
12
|
-
hash: zod_1.z.string(),
|
|
13
|
-
chunk: zod_1.z.custom(),
|
|
14
|
-
filename: zod_1.z.string()
|
|
15
|
-
}))
|
|
16
|
-
.returns(zod_1.z.string());
|
|
17
|
-
const bannerContent = zod_1.z.string().or(bannerFunction);
|
|
18
|
-
const bannerPluginOptions = zod_1.z.strictObject({
|
|
19
|
-
banner: bannerContent,
|
|
20
|
-
entryOnly: zod_1.z.boolean().optional(),
|
|
21
|
-
exclude: rules.optional(),
|
|
22
|
-
include: rules.optional(),
|
|
23
|
-
raw: zod_1.z.boolean().optional(),
|
|
24
|
-
footer: zod_1.z.boolean().optional(),
|
|
25
|
-
stage: zod_1.z.number().optional(),
|
|
26
|
-
test: rules.optional()
|
|
27
|
-
});
|
|
28
|
-
const bannerPluginArgument = bannerContent.or(bannerPluginOptions);
|
|
29
6
|
exports.BannerPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.BannerPlugin, (args) => {
|
|
30
7
|
if (typeof args === "string" || typeof args === "function") {
|
|
31
8
|
return {
|
|
@@ -1,64 +1,9 @@
|
|
|
1
1
|
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Externals } from "..";
|
|
2
3
|
export declare const ExternalsPlugin: {
|
|
3
|
-
new (type: string, externals:
|
|
4
|
-
context?: string | undefined;
|
|
5
|
-
dependencyType?: string | undefined;
|
|
6
|
-
request?: string | undefined;
|
|
7
|
-
contextInfo?: {
|
|
8
|
-
issuer: string;
|
|
9
|
-
} | undefined;
|
|
10
|
-
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "module" | "global" | "system" | "promise" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "module-import" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
|
|
11
|
-
context?: string | undefined;
|
|
12
|
-
dependencyType?: string | undefined;
|
|
13
|
-
request?: string | undefined;
|
|
14
|
-
contextInfo?: {
|
|
15
|
-
issuer: string;
|
|
16
|
-
} | undefined;
|
|
17
|
-
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>) | (string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
|
|
18
|
-
context?: string | undefined;
|
|
19
|
-
dependencyType?: string | undefined;
|
|
20
|
-
request?: string | undefined;
|
|
21
|
-
contextInfo?: {
|
|
22
|
-
issuer: string;
|
|
23
|
-
} | undefined;
|
|
24
|
-
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "module" | "global" | "system" | "promise" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "module-import" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
|
|
25
|
-
context?: string | undefined;
|
|
26
|
-
dependencyType?: string | undefined;
|
|
27
|
-
request?: string | undefined;
|
|
28
|
-
contextInfo?: {
|
|
29
|
-
issuer: string;
|
|
30
|
-
} | undefined;
|
|
31
|
-
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>))[]): {
|
|
4
|
+
new (type: string, externals: Externals): {
|
|
32
5
|
name: BuiltinPluginName;
|
|
33
|
-
_args: [type: string, externals:
|
|
34
|
-
context?: string | undefined;
|
|
35
|
-
dependencyType?: string | undefined;
|
|
36
|
-
request?: string | undefined;
|
|
37
|
-
contextInfo?: {
|
|
38
|
-
issuer: string;
|
|
39
|
-
} | undefined;
|
|
40
|
-
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "module" | "global" | "system" | "promise" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "module-import" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
|
|
41
|
-
context?: string | undefined;
|
|
42
|
-
dependencyType?: string | undefined;
|
|
43
|
-
request?: string | undefined;
|
|
44
|
-
contextInfo?: {
|
|
45
|
-
issuer: string;
|
|
46
|
-
} | undefined;
|
|
47
|
-
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>) | (string | RegExp | Record<string, string | boolean | string[] | Record<string, string | string[]>> | ((args_0: {
|
|
48
|
-
context?: string | undefined;
|
|
49
|
-
dependencyType?: string | undefined;
|
|
50
|
-
request?: string | undefined;
|
|
51
|
-
contextInfo?: {
|
|
52
|
-
issuer: string;
|
|
53
|
-
} | undefined;
|
|
54
|
-
}, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "module" | "global" | "system" | "promise" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "module-import" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
|
|
55
|
-
context?: string | undefined;
|
|
56
|
-
dependencyType?: string | undefined;
|
|
57
|
-
request?: string | undefined;
|
|
58
|
-
contextInfo?: {
|
|
59
|
-
issuer: string;
|
|
60
|
-
} | undefined;
|
|
61
|
-
}, ...args_1: unknown[]) => Promise<string | boolean | string[] | Record<string, string | string[]>>))[]];
|
|
6
|
+
_args: [type: string, externals: Externals];
|
|
62
7
|
affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
63
8
|
raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
64
9
|
apply(compiler: import("../Compiler").Compiler): void;
|