-
-
Notifications
You must be signed in to change notification settings - Fork 770
Expand file tree
/
Copy pathnapi-binding.d.ts
More file actions
3140 lines (2811 loc) · 93 KB
/
napi-binding.d.ts
File metadata and controls
3140 lines (2811 loc) · 93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* auto-generated by NAPI-RS */
/* eslint-disable */
/* -- banner.d.ts -- */
export type JsFilename =
| string
| ((pathData: JsPathData, assetInfo?: AssetInfo) => string);
export type RawLazyCompilationTest = RegExp | ((module: Module) => boolean);
export type AssetInfo = KnownAssetInfo & Record<string, any>;
export type CustomPluginName = string;
export const MODULE_IDENTIFIER_SYMBOL: unique symbol;
export const COMPILATION_HOOKS_MAP_SYMBOL: unique symbol;
export const BUILD_INFO_ASSETS_SYMBOL: unique symbol;
export const BUILD_INFO_FILE_DEPENDENCIES_SYMBOL: unique symbol;
export const BUILD_INFO_CONTEXT_DEPENDENCIES_SYMBOL: unique symbol;
export const BUILD_INFO_MISSING_DEPENDENCIES_SYMBOL: unique symbol;
export const BUILD_INFO_BUILD_DEPENDENCIES_SYMBOL: unique symbol;
export const COMMIT_CUSTOM_FIELDS_SYMBOL: unique symbol;
export const RUST_ERROR_SYMBOL: unique symbol;
interface KnownBuildInfo {
[BUILD_INFO_ASSETS_SYMBOL]: Assets,
[BUILD_INFO_FILE_DEPENDENCIES_SYMBOL]: string[],
[BUILD_INFO_CONTEXT_DEPENDENCIES_SYMBOL]: string[],
[BUILD_INFO_MISSING_DEPENDENCIES_SYMBOL]: string[],
[BUILD_INFO_BUILD_DEPENDENCIES_SYMBOL]: string[],
[COMMIT_CUSTOM_FIELDS_SYMBOL](): void;
}
export type BuildInfo = KnownBuildInfo & Record<string, any>;
export interface Module {
[MODULE_IDENTIFIER_SYMBOL]: string;
readonly type: string;
get context(): string | undefined;
get layer(): string | undefined;
get factoryMeta(): JsFactoryMeta
set factoryMeta(factoryMeta: JsFactoryMeta);
get useSourceMap(): boolean;
get useSimpleSourceMap(): boolean;
buildInfo: BuildInfo;
buildMeta: Record<string, any>;
}
interface NormalModuleConstructor {
new(): NormalModule;
readonly prototype: NormalModule;
}
export var NormalModule: NormalModuleConstructor;
export interface NormalModule extends Module {
readonly resource: string;
readonly request: string;
readonly userRequest: string;
readonly rawRequest: string;
readonly resourceResolveData: Readonly<JsResourceData> | undefined;
readonly loaders: JsLoaderItem[];
get matchResource(): string | undefined;
set matchResource(val: string | undefined);
}
export interface ConcatenatedModule extends Module {
}
export interface ContextModule extends Module {
}
export interface ExternalModule extends Module {
readonly userRequest: string;
}
export interface RspackError extends Error {
name: string;
message: string;
details?: string;
module?: null | Module;
loc?: DependencyLocation;
file?: string;
stack?: string;
hideStack?: boolean;
error?: Error;
}
export type DependencyLocation = SyntheticDependencyLocation | RealDependencyLocation;
export interface JsSource {
source: string | Buffer
map?: string
}
/* -- banner.d.ts end -- */
/* -- napi-rs generated below -- */
export declare class ExternalObject<T> {
readonly '': {
readonly '': unique symbol
[K: symbol]: T
}
}
export declare class Assets {
keys(): Array<string>
}
export declare class AsyncDependenciesBlock {
get dependencies(): Dependency[]
get blocks(): AsyncDependenciesBlock[]
}
export declare class Chunk {
get name(): string | undefined
get id(): string | undefined
get ids(): Array<string>
get idNameHints(): Array<string>
get filenameTemplate(): string | undefined
get cssFilenameTemplate(): string | undefined
get _files(): Array<string>
get _runtime(): Array<string>
get hash(): string | undefined
get contentHash(): Record<string, string>
get renderedHash(): string | undefined
get chunkReason(): string | undefined
get _auxiliaryFiles(): Array<string>
isOnlyInitial(): boolean
canBeInitial(): boolean
hasRuntime(): boolean
getAllAsyncChunks(): Chunk[]
getAllInitialChunks(): Chunk[]
getAllReferencedChunks(): Chunk[]
get _groupsIterable(): ChunkGroup[]
getEntryOptions(): EntryOptionsDTO | undefined
}
export declare class ChunkGraph {
hasChunkEntryDependentChunks(chunk: Chunk): boolean
getChunkModules(chunk: Chunk): Module[]
getChunkModulesIterable(chunk: Chunk): Iterable<Module>
getChunkEntryModulesIterable(chunk: Chunk): Iterable<Module>
getNumberOfEntryModules(chunk: Chunk): number
getChunkEntryDependentChunksIterable(chunk: Chunk): Chunk[]
getChunkModulesIterableBySourceType(chunk: Chunk, sourceType: string): Module[]
getModuleChunks(module: Module): Chunk[]
getModuleId(module: Module): string | number | null
_getModuleHash(module: Module, runtime: string | string[] | undefined): string | null
getBlockChunkGroup(jsBlock: AsyncDependenciesBlock): ChunkGroup | null
getChunkGroupBlocks(chunkGroup: ChunkGroup): AsyncDependenciesBlock[]
}
export declare class ChunkGroup {
get chunks(): Chunk[]
get index(): number | undefined
get name(): string | undefined
get origins(): Array<JsChunkGroupOrigin>
get childrenIterable(): ChunkGroup[]
isInitial(): boolean
getParents(): ChunkGroup[]
getRuntimeChunk(): Chunk
getEntrypointChunk(): Chunk
getFiles(): Array<string>
getModulePreOrderIndex(module: Module): number | null
getModulePostOrderIndex(module: Module): number | null
}
export declare class Chunks {
get size(): number
_values(): Chunk[]
_has(chunk: Chunk): boolean
}
export declare class CodeGenerationResult {
get sources(): Sources
}
export declare class CodeGenerationResults {
get(module: Module, runtime: string | string[] | undefined): CodeGenerationResult
}
export declare class ConcatenatedModule {
get rootModule(): Module
get modules(): Module[]
readableIdentifier(): string
_originalSource(): JsSource
nameForCondition(): string | undefined
get blocks(): AsyncDependenciesBlock[]
get dependencies(): Dependency[]
size(ty?: string | undefined | null): number
libIdent(options: JsLibIdentOptions): string | null
_emitFile(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
}
export declare class ContextModule {
readableIdentifier(): string
_originalSource(): JsSource
nameForCondition(): string | undefined
get blocks(): AsyncDependenciesBlock[]
get dependencies(): Dependency[]
size(ty?: string | undefined | null): number
libIdent(options: JsLibIdentOptions): string | null
_emitFile(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
}
export declare class Dependency {
get _parentModule(): Module | undefined
get type(): string
get category(): string
get request(): string | undefined
get critical(): boolean
set critical(val: boolean)
get ids(): Array<string> | undefined
}
export declare class Diagnostics {
get length(): number
values(): Array<RspackError>
get(index: number): RspackError | undefined
set(index: number, error: RspackError): void
spliceWithArray(index: number, deleteCount?: number | undefined | null, newItems?: Array<RspackError> | undefined | null): Array<RspackError>
}
export declare class EntryDataDto {
get dependencies(): Dependency[]
get includeDependencies(): Dependency[]
get options(): EntryOptionsDto
}
export type EntryDataDTO = EntryDataDto
export declare class EntryDependency {
constructor(request: string)
get type(): string
get category(): string
get request(): string | undefined
}
export declare class EntryOptionsDto {
get name(): string | undefined
set name(name: string | undefined)
get runtime(): false | string | undefined
set runtime(chunkLoading: boolean | string | undefined)
get chunkLoading(): string | undefined
set chunkLoading(chunkLoading: string | false | undefined)
get asyncChunks(): boolean | undefined
set asyncChunks(asyncChunks: boolean | undefined)
get baseUri(): string | undefined
set baseUri(baseUri: string | undefined)
get library(): JsLibraryOptions | undefined
set library(library: JsLibraryOptions | undefined)
get dependOn(): Array<string> | undefined
set dependOn(dependOn: Array<string> | undefined)
get layer(): string | undefined
set layer(layer: string | undefined)
}
export type EntryOptionsDTO = EntryOptionsDto
export declare class ExternalModule {
readableIdentifier(): string
_originalSource(): JsSource
nameForCondition(): string | undefined
get blocks(): AsyncDependenciesBlock[]
get dependencies(): Dependency[]
size(ty?: string | undefined | null): number
libIdent(options: JsLibIdentOptions): string | null
_emitFile(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
}
export declare class JsCompilation {
updateAsset(filename: string, newSourceOrFunction: JsSource | ((source: JsSource) => JsSource), assetInfoUpdateOrFunction?: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo | undefined)): void
getAssets(): Readonly<JsAsset>[]
getAsset(name: string): JsAsset | null
getAssetSource(name: string): JsSource | null
get modules(): Array<Module>
get builtModules(): Array<Module>
getOptimizationBailout(): Array<JsStatsOptimizationBailout>
get chunks(): Chunks
getNamedChunkKeys(): Array<string>
getNamedChunk(name: string): Chunk
getNamedChunkGroupKeys(): Array<string>
getNamedChunkGroup(name: string): ChunkGroup
setAssetSource(name: string, source: JsSource): void
deleteAssetSource(name: string): void
getAssetFilenames(): Array<string>
hasAsset(name: string): boolean
emitAsset(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
deleteAsset(filename: string): void
renameAsset(filename: string, newName: string): void
get entrypoints(): ChunkGroup[]
get chunkGroups(): ChunkGroup[]
get hash(): string | null
dependencies(): JsDependencies
pushDiagnostic(diagnostic: JsRspackDiagnostic): void
pushNativeDiagnostic(diagnostic: ExternalObject<'Diagnostic'>): void
pushNativeDiagnostics(diagnostics: ExternalObject<'Diagnostic[]'>): void
get errors(): Diagnostics
get warnings(): Diagnostics
getErrors(): Array<RspackError>
getWarnings(): Array<RspackError>
getStats(): JsStats
getAssetPath(filename: string, data: JsPathData): string
getAssetPathWithInfo(filename: string, data: JsPathData): PathWithInfo
getPath(filename: string, data: JsPathData): string
getPathWithInfo(filename: string, data: JsPathData): PathWithInfo
addFileDependencies(deps: Array<string>): void
addContextDependencies(deps: Array<string>): void
addMissingDependencies(deps: Array<string>): void
addBuildDependencies(deps: Array<string>): void
/**
* This is a very unsafe function.
* Please don't use this at the moment.
* Using async and mutable reference to `Compilation` at the same time would likely to cause data races.
*/
rebuildModule(module_identifiers: string[], callback: (...args: any[]) => any): void
importModule(request: string, layer: string | undefined, public_path: JsFilename | undefined, base_uri: string | undefined, original_module: string, original_module_context: string | undefined | null, callback: (...args: any[]) => any): void
get entries(): JsEntries
addRuntimeModule(chunk: Chunk, runtimeModule: JsAddingRuntimeModule): void
get moduleGraph(): JsModuleGraph
get chunkGraph(): ChunkGraph
addEntry(args: [string, EntryDependency, JsEntryOptions | undefined][], callback: (errMsg: Error | null, results: [string | null, Module][]) => void): void
addInclude(args: [string, EntryDependency, JsEntryOptions | undefined][], callback: (errMsg: Error | null, results: [string | null, Module][]) => void): void
get codeGenerationResults(): CodeGenerationResults
createStatsWarnings(warnings: Array<RspackError>, colored?: boolean | undefined | null): JsStatsError[]
}
export declare class JsCompiler {
constructor(compilerPath: string, options: RawOptions, builtinPlugins: Array<BuiltinPlugin>, registerJsTaps: RegisterJsTaps, outputFilesystem: ThreadsafeNodeFS, intermediateFilesystem: ThreadsafeNodeFS | undefined | null, inputFilesystem: ThreadsafeNodeFS | undefined | null, resolverFactoryReference: JsResolverFactory, unsafeFastDrop: boolean)
setNonSkippableRegisters(kinds: Array<RegisterJsTapKind>): void
/** Build with the given option passed to the constructor */
build(callback: (err: null | Error) => void): void
/** Rebuild with the given option passed to the constructor */
rebuild(changed_files: string[], removed_files: string[], callback: (err: null | Error) => void): void
close(): Promise<void>
getVirtualFileStore(): VirtualFileStore | null
}
export declare class JsContextModuleFactoryAfterResolveData {
get resource(): string
set resource(resource: string)
get context(): string
set context(context: string)
get request(): string
set request(request: string)
get regExp(): RegExp | undefined
set regExp(rawRegExp: RegExp | undefined)
get recursive(): boolean
set recursive(recursive: boolean)
get dependencies(): Dependency[]
}
export declare class JsContextModuleFactoryBeforeResolveData {
get context(): string
set context(context: string)
get request(): string
set request(request: string)
get regExp(): RegExp | undefined
set regExp(rawRegExp: RegExp | undefined)
get recursive(): boolean
set recursive(recursive: boolean)
}
export declare class JsDependencies {
get fileDependencies(): Array<string>
get addedFileDependencies(): Array<string>
get removedFileDependencies(): Array<string>
get contextDependencies(): Array<string>
get addedContextDependencies(): Array<string>
get removedContextDependencies(): Array<string>
get missingDependencies(): Array<string>
get addedMissingDependencies(): Array<string>
get removedMissingDependencies(): Array<string>
get buildDependencies(): Array<string>
get addedBuildDependencies(): Array<string>
get removedBuildDependencies(): Array<string>
}
export declare class JsEntries {
clear(): void
get size(): number
has(key: string): boolean
set(key: string, value: JsEntryData | EntryDataDto): void
delete(key: string): boolean
get(key: string): EntryDataDto | undefined
keys(): Array<string>
values(): Array<EntryDataDto>
}
export declare class JsExportsInfo {
isUsed(runtime: string | string[] | undefined): boolean
isModuleUsed(runtime: string | string[] | undefined): boolean
setUsedInUnknownWay(runtime: string | string[] | undefined): boolean
getUsed(name: string | string[], runtime: string | string[] | undefined): 0 | 1 | 2 | 3 | 4
}
export declare class JsModuleGraph {
getModule(dependency: Dependency): Module | null
getResolvedModule(dependency: Dependency): Module | null
getUsedExports(module: Module, runtime: string | string[]): boolean | Array<string> | null
getIssuer(module: Module): Module | null
getExportsInfo(module: Module): JsExportsInfo
getConnection(dependency: Dependency): ModuleGraphConnection | null
getOutgoingConnections(module: Module): ModuleGraphConnection[]
getOutgoingConnectionsInOrder(module: Module): ModuleGraphConnection[]
getIncomingConnections(module: Module): ModuleGraphConnection[]
getParentModule(dependency: Dependency): Module | null
getParentBlockIndex(dependency: Dependency): number
isAsync(module: Module): boolean
}
export declare class JsResolver {
resolveSync(path: string, request: string): string | undefined
resolve(path: string, request: string, callback: (err: null | Error, req?: string) => void): void
}
export declare class JsResolverFactory {
constructor(pnp: boolean, jsResolveOptions: RawResolveOptions, jsLoaderResolveOptions: RawResolveOptions)
get(type: string, options?: RawResolveOptionsWithDependencyType): JsResolver
}
export declare class JsStats {
toJson(jsOptions: JsStatsOptions): JsStatsCompilation
getLogging(acceptedTypes: number): Array<JsStatsLogging>
}
export declare class KnownBuildInfo {
}
export declare class Module {
readableIdentifier(): string
_originalSource(): JsSource
nameForCondition(): string | undefined
get blocks(): AsyncDependenciesBlock[]
get dependencies(): Dependency[]
size(ty?: string | undefined | null): number
libIdent(options: JsLibIdentOptions): string | null
_emitFile(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
}
export declare class ModuleGraphConnection {
get dependency(): Dependency
get module(): Module | null
get resolvedModule(): Module | null
get originModule(): Module | null
}
export declare class NativeWatcher {
constructor(options: NativeWatcherOptions)
watch(files: [Array<string>, Array<string>], directories: [Array<string>, Array<string>], missing: [Array<string>, Array<string>], startTime: bigint, callback: (err: Error | null, result: NativeWatchResult) => void, callbackUndelayed: (path: string) => void): void
triggerEvent(kind: 'change' | 'remove' | 'create', path: string): void
/**
* # Safety
*
* This function is unsafe because it uses `&mut self` to call the watcher asynchronously.
* It's important to ensure that the watcher is not used in any other places before this function is finished.
* You must ensure that the watcher not call watch, close or pause in the same time, otherwise it may lead to undefined behavior.
*/
close(): Promise<void>
pause(): void
}
export declare class NativeWatchResult {
changedFiles: Array<string>
removedFiles: Array<string>
}
export declare class RawExternalItemFnCtx {
data(): RawExternalItemFnCtxData
getResolve(options?: RawResolveOptionsWithDependencyType | undefined | null): (context: string, path: string, callback: (error?: Error, text?: string) => void) => void
}
export declare class ReadonlyResourceData {
get descriptionFileData(): any
get descriptionFilePath(): string
}
export declare class ResolverFactory {
constructor(options?: NapiResolveOptions | undefined | null)
static default(): ResolverFactory
/** Clone the resolver using the same underlying cache. */
cloneWithOptions(options: NapiResolveOptions): ResolverFactory
/** Clear the underlying cache. */
clearCache(): void
/** Synchronously resolve `specifier` at an absolute path to a `directory`. */
sync(directory: string, request: string): ResolveResult
/** Asynchronously resolve `specifier` at an absolute path to a `directory`. */
async(directory: string, request: string): Promise<ResolveResult>
}
export declare class Sources {
_get(sourceType: string): JsSource | null
}
export declare class VirtualFileStore {
writeVirtualFileSync(path: string, content: string): void
batchWriteVirtualFilesSync(files: Array<JsVirtualFile>): void
}
export type JsVirtualFileStore = VirtualFileStore
export interface AssetInfoRelated {
sourceMap?: string | null
}
export declare function async(path: string, request: string): Promise<ResolveResult>
export interface BuiltinPlugin {
name: BuiltinPluginName | CustomPluginName
options: unknown
canInherentFromParent?: boolean
}
export declare enum BuiltinPluginName {
DefinePlugin = 'DefinePlugin',
ProvidePlugin = 'ProvidePlugin',
BannerPlugin = 'BannerPlugin',
IgnorePlugin = 'IgnorePlugin',
ProgressPlugin = 'ProgressPlugin',
EntryPlugin = 'EntryPlugin',
DynamicEntryPlugin = 'DynamicEntryPlugin',
ExternalsPlugin = 'ExternalsPlugin',
NodeTargetPlugin = 'NodeTargetPlugin',
ElectronTargetPlugin = 'ElectronTargetPlugin',
EnableChunkLoadingPlugin = 'EnableChunkLoadingPlugin',
EnableLibraryPlugin = 'EnableLibraryPlugin',
EnableWasmLoadingPlugin = 'EnableWasmLoadingPlugin',
FetchCompileAsyncWasmPlugin = 'FetchCompileAsyncWasmPlugin',
ChunkPrefetchPreloadPlugin = 'ChunkPrefetchPreloadPlugin',
CommonJsChunkFormatPlugin = 'CommonJsChunkFormatPlugin',
ArrayPushCallbackChunkFormatPlugin = 'ArrayPushCallbackChunkFormatPlugin',
ModuleChunkFormatPlugin = 'ModuleChunkFormatPlugin',
EsmLibraryPlugin = 'EsmLibraryPlugin',
HotModuleReplacementPlugin = 'HotModuleReplacementPlugin',
LimitChunkCountPlugin = 'LimitChunkCountPlugin',
WorkerPlugin = 'WorkerPlugin',
WebWorkerTemplatePlugin = 'WebWorkerTemplatePlugin',
MergeDuplicateChunksPlugin = 'MergeDuplicateChunksPlugin',
SplitChunksPlugin = 'SplitChunksPlugin',
RemoveDuplicateModulesPlugin = 'RemoveDuplicateModulesPlugin',
ShareRuntimePlugin = 'ShareRuntimePlugin',
ContainerPlugin = 'ContainerPlugin',
ContainerReferencePlugin = 'ContainerReferencePlugin',
ProvideSharedPlugin = 'ProvideSharedPlugin',
ConsumeSharedPlugin = 'ConsumeSharedPlugin',
ModuleFederationRuntimePlugin = 'ModuleFederationRuntimePlugin',
ModuleFederationManifestPlugin = 'ModuleFederationManifestPlugin',
NamedModuleIdsPlugin = 'NamedModuleIdsPlugin',
NaturalModuleIdsPlugin = 'NaturalModuleIdsPlugin',
DeterministicModuleIdsPlugin = 'DeterministicModuleIdsPlugin',
NaturalChunkIdsPlugin = 'NaturalChunkIdsPlugin',
NamedChunkIdsPlugin = 'NamedChunkIdsPlugin',
DeterministicChunkIdsPlugin = 'DeterministicChunkIdsPlugin',
OccurrenceChunkIdsPlugin = 'OccurrenceChunkIdsPlugin',
RealContentHashPlugin = 'RealContentHashPlugin',
RemoveEmptyChunksPlugin = 'RemoveEmptyChunksPlugin',
EnsureChunkConditionsPlugin = 'EnsureChunkConditionsPlugin',
WarnCaseSensitiveModulesPlugin = 'WarnCaseSensitiveModulesPlugin',
DataUriPlugin = 'DataUriPlugin',
FileUriPlugin = 'FileUriPlugin',
RuntimePlugin = 'RuntimePlugin',
JsonModulesPlugin = 'JsonModulesPlugin',
InferAsyncModulesPlugin = 'InferAsyncModulesPlugin',
JavascriptModulesPlugin = 'JavascriptModulesPlugin',
AsyncWebAssemblyModulesPlugin = 'AsyncWebAssemblyModulesPlugin',
AssetModulesPlugin = 'AssetModulesPlugin',
SourceMapDevToolPlugin = 'SourceMapDevToolPlugin',
EvalSourceMapDevToolPlugin = 'EvalSourceMapDevToolPlugin',
EvalDevToolModulePlugin = 'EvalDevToolModulePlugin',
SideEffectsFlagPlugin = 'SideEffectsFlagPlugin',
FlagDependencyExportsPlugin = 'FlagDependencyExportsPlugin',
FlagDependencyUsagePlugin = 'FlagDependencyUsagePlugin',
InlineExportsPlugin = 'InlineExportsPlugin',
MangleExportsPlugin = 'MangleExportsPlugin',
ModuleConcatenationPlugin = 'ModuleConcatenationPlugin',
CssModulesPlugin = 'CssModulesPlugin',
APIPlugin = 'APIPlugin',
RuntimeChunkPlugin = 'RuntimeChunkPlugin',
SizeLimitsPlugin = 'SizeLimitsPlugin',
NoEmitOnErrorsPlugin = 'NoEmitOnErrorsPlugin',
NormalModuleReplacementPlugin = 'NormalModuleReplacementPlugin',
ContextReplacementPlugin = 'ContextReplacementPlugin',
DllEntryPlugin = 'DllEntryPlugin',
DllReferenceAgencyPlugin = 'DllReferenceAgencyPlugin',
LibManifestPlugin = 'LibManifestPlugin',
FlagAllModulesAsUsedPlugin = 'FlagAllModulesAsUsedPlugin',
HttpExternalsRspackPlugin = 'HttpExternalsRspackPlugin',
CopyRspackPlugin = 'CopyRspackPlugin',
HtmlRspackPlugin = 'HtmlRspackPlugin',
SwcJsMinimizerRspackPlugin = 'SwcJsMinimizerRspackPlugin',
LightningCssMinimizerRspackPlugin = 'LightningCssMinimizerRspackPlugin',
BundlerInfoRspackPlugin = 'BundlerInfoRspackPlugin',
CssExtractRspackPlugin = 'CssExtractRspackPlugin',
SubresourceIntegrityPlugin = 'SubresourceIntegrityPlugin',
RsdoctorPlugin = 'RsdoctorPlugin',
RstestPlugin = 'RstestPlugin',
RslibPlugin = 'RslibPlugin',
CircularDependencyRspackPlugin = 'CircularDependencyRspackPlugin',
URLPlugin = 'URLPlugin',
JsLoaderRspackPlugin = 'JsLoaderRspackPlugin',
LazyCompilationPlugin = 'LazyCompilationPlugin',
ModuleInfoHeaderPlugin = 'ModuleInfoHeaderPlugin',
HttpUriPlugin = 'HttpUriPlugin',
CssChunkingPlugin = 'CssChunkingPlugin'
}
export declare function cleanupGlobalTrace(): void
export interface ContextInfo {
issuer: string
issuerLayer?: string
}
export declare enum EnforceExtension {
Auto = 0,
Enabled = 1,
Disabled = 2
}
/**
* Expected version of @rspack/core to the current binding version
* @internal
*/
export const EXPECTED_RSPACK_CORE_VERSION: string
export declare function formatDiagnostic(diagnostic: JsDiagnostic): ExternalObject<'Diagnostic'>
export interface JsAddingRuntimeModule {
name: string
generator: () => String
dependentHash: boolean
fullHash: boolean
isolate: boolean
stage: number
}
export interface JsAdditionalTreeRuntimeRequirementsArg {
chunk: Chunk
runtimeRequirements: JsRuntimeGlobals
}
export interface JsAdditionalTreeRuntimeRequirementsResult {
runtimeRequirements: JsRuntimeGlobals
}
export interface JsAfterEmitData {
outputName: string
compilationId: number
uid?: number
}
export interface JsAfterTemplateExecutionData {
html: string
headTags: Array<JsHtmlPluginTag>
bodyTags: Array<JsHtmlPluginTag>
outputName: string
compilationId: number
uid?: number
}
export interface JsAlterAssetTagGroupsData {
headTags: Array<JsHtmlPluginTag>
bodyTags: Array<JsHtmlPluginTag>
publicPath: string
outputName: string
compilationId: number
uid?: number
}
export interface JsAlterAssetTagsData {
assetTags: JsHtmlPluginAssetTags
outputName: string
publicPath: string
compilationId: number
uid?: number
}
export interface JsAsset {
name: string
info: AssetInfo
}
export interface JsAssetEmittedArgs {
filename: string
outputPath: string
targetPath: string
}
export interface JsBannerContentFnCtx {
hash: string
chunk: Chunk
filename: string
}
export interface JsBeforeAssetTagGenerationData {
assets: JsHtmlPluginAssets
outputName: string
compilationId: number
uid?: number
}
export interface JsBeforeEmitData {
html: string
outputName: string
compilationId: number
uid?: number
}
export interface JsBuildMeta {
strictEsmModule?: boolean
hasTopLevelAwait?: boolean
esm?: boolean
exportsType?: undefined | 'unset' | 'default' | 'namespace' | 'flagged' | 'dynamic'
defaultObject?: undefined | 'false' | 'redirect' | JsBuildMetaDefaultObjectRedirectWarn
sideEffectFree?: boolean
exportsFinalName?: Array<[string, string]> | undefined
}
export interface JsBuildMetaDefaultObjectRedirectWarn {
redirectWarn: JsDefaultObjectRedirectWarnObject
}
export interface JsBuildTimeExecutionOption {
publicPath?: string
baseUri?: string
}
export interface JsCacheGroupTestCtx {
module: Module
}
export interface JsChunkAssetArgs {
chunk: Chunk
filename: string
}
export interface JsChunkGroupOrigin {
module?: Module | undefined
request?: string
loc?: string | RealDependencyLocation
}
export interface JsChunkOptionNameCtx {
module: Module
chunks: Chunk[]
cacheGroupKey: string
}
/**
* File clean options
*
* This matches with:
* - keep:
* - If a string, keep the files under this path
*/
export interface JsCleanOptions {
keep?: string | RegExp | ((path: string) => boolean)
}
export interface JsCodegenerationResult {
sources: Record<string, string>
}
export interface JsCodegenerationResults {
map: Record<string, Record<string, JsCodegenerationResult>>
}
export interface JsCreateData {
request: string
userRequest: string
resource: string
}
export interface JsCreateLinkData {
code: string
chunk: Chunk
}
export interface JsCreateScriptData {
code: string
chunk: Chunk
}
export interface JsDefaultObjectRedirectWarnObject {
ignore: boolean
}
export interface JsDiagnostic {
message: string
help?: string
sourceCode?: string
location?: JsDiagnosticLocation
file?: string
severity: "error" | "warning"
moduleIdentifier?: string
}
export interface JsDiagnosticLocation {
text?: string
/** 1-based */
line: number
/** 0-based in bytes */
column: number
/** Length in bytes */
length: number
}
export interface JsEntryData {
dependencies: Array<Dependency>
includeDependencies: Array<Dependency>
options: JsEntryOptions
}
export interface JsEntryOptions {
name?: string
runtime?: false | string
chunkLoading?: false | string
asyncChunks?: boolean
publicPath?: "auto" | JsFilename
baseUri?: string
filename?: JsFilename
library?: JsLibraryOptions
dependOn?: Array<string>
layer?: string
}
export interface JsEntryPluginOptions {
context: string
entry: string
options: JsEntryOptions
}
export interface JsExecuteModuleArg {
entry: string
runtimeModules: Array<string>
codegenResults: JsCodegenerationResults
id: number
}
export interface JsExecuteModuleResult {
fileDependencies: Array<string>
contextDependencies: Array<string>
buildDependencies: Array<string>
missingDependencies: Array<string>
cacheable: boolean
id: number
error?: string
}
export interface JsFactoryMeta {
sideEffectFree?: boolean
}
export interface JsHtmlPluginAssets {
publicPath: string
js: Array<string>
css: Array<string>
favicon?: string
jsIntegrity?: Array<string | undefined | null>
cssIntegrity?: Array<string | undefined | null>
}
export interface JsHtmlPluginAssetTags {
scripts: Array<JsHtmlPluginTag>
styles: Array<JsHtmlPluginTag>
meta: Array<JsHtmlPluginTag>
}
export interface JsHtmlPluginTag {
tagName: string
attributes: Record<string, string | boolean | undefined | null>
voidTag: boolean
innerHTML?: string
asset?: string
}
export interface JsHttpResponseRaw {
status: number
headers: Record<string, string>
body: Buffer
}
export interface JsLibIdentOptions {
context: string
}
export interface JsLibraryAuxiliaryComment {
root?: string
commonjs?: string
commonjs2?: string
amd?: string
}
export interface JsLibraryCustomUmdObject {
amd?: string
commonjs?: string
root?: Array<string> | string
}
export interface JsLibraryName {
type: "string" | "array" | "umdObject"
stringPayload?: string
arrayPayload?: Array<string>
umdObjectPayload?: JsLibraryCustomUmdObject
}
export interface JsLibraryOptions {
name?: string | Array<string> | JsLibraryCustomUmdObject
export?: Array<string> | string
type: string
umdNamedDefine?: boolean
auxiliaryComment?: string | JsLibraryAuxiliaryComment
amdContainer?: string
}
export interface JsLinkPrefetchData {
code: string
chunk: Chunk
}
export interface JsLinkPreloadData {
code: string
chunk: Chunk
}
export interface JsLoaderContext {
resource: string
_module: Module
hot: Readonly<boolean>
/** Content maybe empty in pitching stage */
content: null | Buffer
additionalData?: any
__internal__parseMeta: Record<string, string>
sourceMap?: Buffer
cacheable: boolean
fileDependencies: Array<string>
contextDependencies: Array<string>
missingDependencies: Array<string>
buildDependencies: Array<string>
loaderItems: Array<JsLoaderItem>
loaderIndex: number
loaderState: Readonly<JsLoaderState>
__internal__error?: RspackError
/**
* UTF-8 hint for `content`
* - Some(true): `content` is a `UTF-8` encoded sequence
*/
__internal__utf8Hint?: boolean
}
export interface JsLoaderItem {
loader: string
type: string
data: any
normalExecuted: boolean
pitchExecuted: boolean
noPitch: boolean
}
export declare enum JsLoaderState {
Pitching = 'Pitching',
Normal = 'Normal'
}
export interface JsModuleDescriptor {
identifier: string
name: string
id?: string | number | null
}
export interface JsNormalModuleFactoryCreateModuleArgs {
dependencyType: string
rawRequest: string
resourceResolveData: JsResourceData
context: string
matchResource?: string
}
export interface JsOriginRecord {
moduleDescriptor?: JsModuleDescriptor
loc: string
request: string
}
export interface JsPathData {
filename?: string
hash?: string
contentHash?: string
runtime?: string
url?: string
id?: string
chunk?: JsPathDataChunkLike
}
export interface JsPathDataChunkLike {
name?: string
hash?: string
id?: string