@rspack/binding 1.2.1 → 1.2.3

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.
Files changed (2) hide show
  1. package/binding.d.ts +221 -8
  2. package/package.json +11 -11
package/binding.d.ts CHANGED
@@ -67,6 +67,7 @@ export declare class JsChunk {
67
67
  getAllInitialChunks(): JsChunk[]
68
68
  getAllReferencedChunks(): JsChunk[]
69
69
  groups(): JsChunkGroup[]
70
+ getEntryOptions(): EntryOptionsDTO | undefined
70
71
  }
71
72
 
72
73
  export declare class JsChunkGraph {
@@ -77,6 +78,7 @@ export declare class JsChunkGraph {
77
78
  getChunkModulesIterableBySourceType(chunk: JsChunk, sourceType: string): JsModule[]
78
79
  getModuleChunks(module: JsModule): JsChunk[]
79
80
  getModuleId(jsModule: JsModule): string | null
81
+ getBlockChunkGroup(jsBlock: JsDependenciesBlock): JsChunkGroup | null
80
82
  }
81
83
 
82
84
  export declare class JsChunkGroup {
@@ -84,6 +86,7 @@ export declare class JsChunkGroup {
84
86
  get index(): number | undefined
85
87
  get name(): string | undefined
86
88
  get origins(): Array<JsChunkGroupOrigin>
89
+ get childrenIterable(): JsChunkGroup[]
87
90
  isInitial(): boolean
88
91
  getParents(): JsChunkGroup[]
89
92
  getRuntimeChunk(): JsChunk
@@ -102,18 +105,17 @@ export declare class JsCompilation {
102
105
  getOptimizationBailout(): Array<JsStatsOptimizationBailout>
103
106
  getChunks(): JsChunk[]
104
107
  getNamedChunkKeys(): Array<string>
105
- getNamedChunk(name: string): JsChunk
108
+ getNamedChunk(name: string): JsChunk | null
106
109
  getNamedChunkGroupKeys(): Array<string>
107
110
  getNamedChunkGroup(name: string): JsChunkGroup
108
111
  setAssetSource(name: string, source: JsCompatSource): void
109
112
  deleteAssetSource(name: string): void
110
113
  getAssetFilenames(): Array<string>
111
114
  hasAsset(name: string): boolean
112
- emitAssetFromLoader(filename: string, source: JsCompatSource, assetInfo: JsAssetInfo, module: string): void
113
115
  emitAsset(filename: string, source: JsCompatSource, assetInfo: JsAssetInfo): void
114
116
  deleteAsset(filename: string): void
115
117
  renameAsset(filename: string, newName: string): void
116
- get entrypoints(): Record<string, JsChunkGroup>
118
+ get entrypoints(): JsChunkGroup[]
117
119
  get chunkGroups(): JsChunkGroup[]
118
120
  get hash(): string | null
119
121
  dependencies(): JsDependencies
@@ -197,6 +199,7 @@ export declare class JsDependency {
197
199
  get request(): string | undefined
198
200
  get critical(): boolean
199
201
  set critical(val: boolean)
202
+ get ids(): Array<string> | undefined
200
203
  }
201
204
 
202
205
  export declare class JsEntries {
@@ -225,7 +228,7 @@ export declare class JsModule {
225
228
  get nameForCondition(): string | undefined
226
229
  get request(): string | undefined
227
230
  get userRequest(): string | undefined
228
- set userRequest(val: string)
231
+ set userRequest(val: string | undefined)
229
232
  get rawRequest(): string | undefined
230
233
  get factoryMeta(): JsFactoryMeta | undefined
231
234
  get type(): string
@@ -235,6 +238,10 @@ export declare class JsModule {
235
238
  size(ty?: string | undefined | null): number
236
239
  get modules(): JsModule[] | undefined
237
240
  get useSourceMap(): boolean
241
+ libIdent(options: JsLibIdentOptions): string | null
242
+ get resourceResolveData(): JsResourceData | undefined
243
+ get matchResource(): string | undefined
244
+ emitFile(filename: string, source: JsCompatSource, assetInfo: JsAssetInfo): void
238
245
  }
239
246
 
240
247
  export declare class JsModuleGraph {
@@ -246,11 +253,16 @@ export declare class JsModuleGraph {
246
253
  getConnection(dependency: JsDependency): JsModuleGraphConnection | null
247
254
  getOutgoingConnections(module: JsModule): JsModuleGraphConnection[]
248
255
  getIncomingConnections(module: JsModule): JsModuleGraphConnection[]
256
+ getParentModule(jsDependency: JsDependency): JsModule | null
257
+ getParentBlockIndex(jsDependency: JsDependency): number
258
+ isAsync(module: JsModule): boolean
249
259
  }
250
260
 
251
261
  export declare class JsModuleGraphConnection {
252
262
  get dependency(): JsDependency
253
263
  get module(): JsModule | null
264
+ get resolvedModule(): JsModule | null
265
+ get originModule(): JsModule | null
254
266
  }
255
267
 
256
268
  export declare class JsResolver {
@@ -366,6 +378,7 @@ export declare enum BuiltinPluginName {
366
378
  LightningCssMinimizerRspackPlugin = 'LightningCssMinimizerRspackPlugin',
367
379
  BundlerInfoRspackPlugin = 'BundlerInfoRspackPlugin',
368
380
  CssExtractRspackPlugin = 'CssExtractRspackPlugin',
381
+ RsdoctorPlugin = 'RsdoctorPlugin',
369
382
  JsLoaderRspackPlugin = 'JsLoaderRspackPlugin',
370
383
  LazyCompilationPlugin = 'LazyCompilationPlugin'
371
384
  }
@@ -399,6 +412,7 @@ export interface JsAdditionalTreeRuntimeRequirementsResult {
399
412
 
400
413
  export interface JsAfterEmitData {
401
414
  outputName: string
415
+ compilationId: number
402
416
  }
403
417
 
404
418
  export interface JsAfterResolveData {
@@ -416,6 +430,7 @@ export interface JsAfterTemplateExecutionData {
416
430
  headTags: Array<JsHtmlPluginTag>
417
431
  bodyTags: Array<JsHtmlPluginTag>
418
432
  outputName: string
433
+ compilationId: number
419
434
  }
420
435
 
421
436
  export interface JsAlterAssetTagGroupsData {
@@ -423,12 +438,14 @@ export interface JsAlterAssetTagGroupsData {
423
438
  bodyTags: Array<JsHtmlPluginTag>
424
439
  publicPath: string
425
440
  outputName: string
441
+ compilationId: number
426
442
  }
427
443
 
428
444
  export interface JsAlterAssetTagsData {
429
445
  assetTags: JsHtmlPluginAssetTags
430
446
  outputName: string
431
447
  publicPath: string
448
+ compilationId: number
432
449
  }
433
450
 
434
451
  export interface JsAsset {
@@ -496,11 +513,13 @@ export interface JsBannerContentFnCtx {
496
513
  export interface JsBeforeAssetTagGenerationData {
497
514
  assets: JsHtmlPluginAssets
498
515
  outputName: string
516
+ compilationId: number
499
517
  }
500
518
 
501
519
  export interface JsBeforeEmitData {
502
520
  html: string
503
521
  outputName: string
522
+ compilationId: number
504
523
  }
505
524
 
506
525
  export interface JsBeforeResolveArgs {
@@ -592,6 +611,11 @@ export interface JsCreateData {
592
611
  resource: string
593
612
  }
594
613
 
614
+ export interface JsCreateScriptData {
615
+ code: string
616
+ chunk: JsChunk
617
+ }
618
+
595
619
  export interface JsDefaultObjectRedirectWarnObject {
596
620
  ignore: boolean
597
621
  }
@@ -654,7 +678,6 @@ export interface JsExecuteModuleResult {
654
678
  buildDependencies: Array<string>
655
679
  missingDependencies: Array<string>
656
680
  cacheable: boolean
657
- assets: Array<string>
658
681
  id: number
659
682
  error?: string
660
683
  }
@@ -674,6 +697,8 @@ export interface JsHtmlPluginAssets {
674
697
  js: Array<string>
675
698
  css: Array<string>
676
699
  favicon?: string
700
+ jsIntegrity?: Array<string | undefined | null>
701
+ cssIntegrity?: Array<string | undefined | null>
677
702
  }
678
703
 
679
704
  export interface JsHtmlPluginAssetTags {
@@ -690,6 +715,10 @@ export interface JsHtmlPluginTag {
690
715
  asset?: string
691
716
  }
692
717
 
718
+ export interface JsLibIdentOptions {
719
+ context: string
720
+ }
721
+
693
722
  export interface JsLibraryAuxiliaryComment {
694
723
  root?: string
695
724
  commonjs?: string
@@ -719,6 +748,16 @@ export interface JsLibraryOptions {
719
748
  amdContainer?: string
720
749
  }
721
750
 
751
+ export interface JsLinkPrefetchData {
752
+ code: string
753
+ chunk: JsChunk
754
+ }
755
+
756
+ export interface JsLinkPreloadData {
757
+ code: string
758
+ chunk: JsChunk
759
+ }
760
+
722
761
  export interface JsLoaderContext {
723
762
  resourceData: Readonly<JsResourceData>
724
763
  /** Will be deprecated. Use module.module_identifier instead */
@@ -813,6 +852,157 @@ export interface JsResourceData {
813
852
  fragment?: string
814
853
  }
815
854
 
855
+ export interface JsRsdoctorAsset {
856
+ ukey: number
857
+ path: string
858
+ chunks: Array<number>
859
+ size: number
860
+ }
861
+
862
+ export interface JsRsdoctorAssetPatch {
863
+ assets: Array<JsRsdoctorAsset>
864
+ chunkAssets: Array<JsRsdoctorChunkAssets>
865
+ entrypointAssets: Array<JsRsdoctorEntrypointAssets>
866
+ }
867
+
868
+ export interface JsRsdoctorChunk {
869
+ ukey: number
870
+ name: string
871
+ initial: boolean
872
+ entry: boolean
873
+ dependencies: Array<number>
874
+ imported: Array<number>
875
+ }
876
+
877
+ export interface JsRsdoctorChunkAssets {
878
+ chunk: number
879
+ assets: Array<number>
880
+ }
881
+
882
+ export interface JsRsdoctorChunkGraph {
883
+ chunks: Array<JsRsdoctorChunk>
884
+ entrypoints: Array<JsRsdoctorEntrypoint>
885
+ }
886
+
887
+ export interface JsRsdoctorChunkModules {
888
+ chunk: number
889
+ modules: Array<number>
890
+ }
891
+
892
+ export interface JsRsdoctorDependency {
893
+ ukey: number
894
+ kind: string
895
+ request: string
896
+ module: number
897
+ dependency: number
898
+ }
899
+
900
+ export interface JsRsdoctorEntrypoint {
901
+ ukey: number
902
+ name: string
903
+ chunks: Array<number>
904
+ }
905
+
906
+ export interface JsRsdoctorEntrypointAssets {
907
+ entrypoint: number
908
+ assets: Array<number>
909
+ }
910
+
911
+ export interface JsRsdoctorExportInfo {
912
+ ukey: number
913
+ name: string
914
+ from?: number
915
+ variable?: number
916
+ identifier?: JsRsdoctorStatement
917
+ sideEffects: Array<number>
918
+ }
919
+
920
+ export interface JsRsdoctorModule {
921
+ ukey: number
922
+ identifier: string
923
+ path: string
924
+ isEntry: boolean
925
+ kind: 'normal' | 'concatenated'
926
+ layer?: string
927
+ dependencies: Array<number>
928
+ imported: Array<number>
929
+ modules: Array<number>
930
+ belongModules: Array<number>
931
+ chunks: Array<number>
932
+ }
933
+
934
+ export interface JsRsdoctorModuleGraph {
935
+ modules: Array<JsRsdoctorModule>
936
+ dependencies: Array<JsRsdoctorDependency>
937
+ chunkModules: Array<JsRsdoctorChunkModules>
938
+ }
939
+
940
+ export interface JsRsdoctorModuleGraphModule {
941
+ ukey: number
942
+ module: number
943
+ exports: Array<number>
944
+ sideEffects: Array<number>
945
+ variables: Array<number>
946
+ dynamic: boolean
947
+ }
948
+
949
+ export interface JsRsdoctorModuleId {
950
+ module: number
951
+ renderId: string
952
+ }
953
+
954
+ export interface JsRsdoctorModuleIdsPatch {
955
+ moduleIds: Array<JsRsdoctorModuleId>
956
+ }
957
+
958
+ export interface JsRsdoctorModuleOriginalSource {
959
+ module: number
960
+ source: string
961
+ size: number
962
+ }
963
+
964
+ export interface JsRsdoctorModuleSourcesPatch {
965
+ moduleOriginalSources: Array<JsRsdoctorModuleOriginalSource>
966
+ }
967
+
968
+ export interface JsRsdoctorSideEffect {
969
+ ukey: number
970
+ name: string
971
+ originName?: string
972
+ module: number
973
+ identifier: JsRsdoctorStatement
974
+ isNameSpace: boolean
975
+ fromDependency?: number
976
+ exports: Array<number>
977
+ variable?: number
978
+ }
979
+
980
+ export interface JsRsdoctorSourcePosition {
981
+ line?: number
982
+ column?: number
983
+ index?: number
984
+ }
985
+
986
+ export interface JsRsdoctorSourceRange {
987
+ start: JsRsdoctorSourcePosition
988
+ end?: JsRsdoctorSourcePosition
989
+ }
990
+
991
+ export interface JsRsdoctorStatement {
992
+ module: number
993
+ sourcePosition?: JsRsdoctorSourceRange
994
+ transformedPosition: JsRsdoctorSourceRange
995
+ }
996
+
997
+ export interface JsRsdoctorVariable {
998
+ ukey: number
999
+ name: string
1000
+ module: number
1001
+ usedInfo: string
1002
+ identififer: JsRsdoctorStatement
1003
+ exported?: number
1004
+ }
1005
+
816
1006
  export interface JsRspackDiagnostic {
817
1007
  severity: JsRspackSeverity
818
1008
  error: JsRspackError
@@ -1206,7 +1396,7 @@ export interface RawCacheGroupOptions {
1206
1396
  /** What kind of chunks should be selected. */
1207
1397
  chunks?: RegExp | 'async' | 'initial' | 'all'
1208
1398
  type?: RegExp | string
1209
- layer?: RegExp | string
1399
+ layer?: RegExp | string | ((layer?: string) => boolean)
1210
1400
  automaticNameDelimiter?: string
1211
1401
  minChunks?: number
1212
1402
  minSize?: number | RawSplitChunkSizes
@@ -1353,7 +1543,7 @@ export interface RawDllManifest {
1353
1543
  export interface RawDllManifestContentItem {
1354
1544
  buildMeta?: JsBuildMeta
1355
1545
  exports?: string[] | true
1356
- id?: string
1546
+ id?: number | string
1357
1547
  }
1358
1548
 
1359
1549
  export interface RawDllReferenceAgencyPluginOptions {
@@ -1395,6 +1585,7 @@ export interface RawEnvironment {
1395
1585
  module?: boolean
1396
1586
  optionalChaining?: boolean
1397
1587
  templateLiteral?: boolean
1588
+ dynamicImportInWorker?: boolean
1398
1589
  }
1399
1590
 
1400
1591
  export interface RawEvalDevToolModulePluginOptions {
@@ -1773,6 +1964,7 @@ export interface RawOptimizationOptions {
1773
1964
  usedExports: boolean | string
1774
1965
  providedExports: boolean
1775
1966
  innerGraph: boolean
1967
+ realContentHash: boolean
1776
1968
  mangleExports: boolean | string
1777
1969
  concatenateModules: boolean
1778
1970
  avoidEntryIife: boolean
@@ -1947,6 +2139,11 @@ export interface RawResolveTsconfigOptions {
1947
2139
  references?: Array<string>
1948
2140
  }
1949
2141
 
2142
+ export interface RawRsdoctorPluginOptions {
2143
+ moduleGraphFeatures: boolean | Array<'graph' | 'ids' | 'sources'>
2144
+ chunkGraphFeatures: boolean | Array<'graph' | 'assets'>
2145
+ }
2146
+
1950
2147
  export interface RawRspackFuture {
1951
2148
 
1952
2149
  }
@@ -2117,7 +2314,15 @@ export declare enum RegisterJsTapKind {
2117
2314
  HtmlPluginAlterAssetTagGroups = 37,
2118
2315
  HtmlPluginAfterTemplateExecution = 38,
2119
2316
  HtmlPluginBeforeEmit = 39,
2120
- HtmlPluginAfterEmit = 40
2317
+ HtmlPluginAfterEmit = 40,
2318
+ RuntimePluginCreateScript = 41,
2319
+ RuntimePluginLinkPreload = 42,
2320
+ RuntimePluginLinkPrefetch = 43,
2321
+ RsdoctorPluginModuleGraph = 44,
2322
+ RsdoctorPluginChunkGraph = 45,
2323
+ RsdoctorPluginModuleIds = 46,
2324
+ RsdoctorPluginModuleSources = 47,
2325
+ RsdoctorPluginAssets = 48
2121
2326
  }
2122
2327
 
2123
2328
  export interface RegisterJsTaps {
@@ -2162,6 +2367,14 @@ export interface RegisterJsTaps {
2162
2367
  registerHtmlPluginAfterTemplateExecutionTaps: (stages: Array<number>) => Array<{ function: ((arg: JsAfterTemplateExecutionData) => JsAfterTemplateExecutionData); stage: number; }>
2163
2368
  registerHtmlPluginBeforeEmitTaps: (stages: Array<number>) => Array<{ function: ((arg: JsBeforeEmitData) => JsBeforeEmitData); stage: number; }>
2164
2369
  registerHtmlPluginAfterEmitTaps: (stages: Array<number>) => Array<{ function: ((arg: JsAfterEmitData) => JsAfterEmitData); stage: number; }>
2370
+ registerRuntimePluginCreateScriptTaps: (stages: Array<number>) => Array<{ function: ((arg: JsCreateScriptData) => String); stage: number; }>
2371
+ registerRuntimePluginLinkPreloadTaps: (stages: Array<number>) => Array<{ function: ((arg: JsLinkPreloadData) => String); stage: number; }>
2372
+ registerRuntimePluginLinkPrefetchTaps: (stages: Array<number>) => Array<{ function: ((arg: JsLinkPrefetchData) => String); stage: number; }>
2373
+ registerRsdoctorPluginModuleGraphTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRsdoctorModuleGraph) => Promise<boolean | undefined>); stage: number; }>
2374
+ registerRsdoctorPluginChunkGraphTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRsdoctorChunkGraph) => Promise<boolean | undefined>); stage: number; }>
2375
+ registerRsdoctorPluginModuleIdsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRsdoctorModuleIdsPatch) => Promise<boolean | undefined>); stage: number; }>
2376
+ registerRsdoctorPluginModuleSourcesTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRsdoctorModuleSourcesPatch) => Promise<boolean | undefined>); stage: number; }>
2377
+ registerRsdoctorPluginAssetsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRsdoctorAssetPatch) => Promise<boolean | undefined>); stage: number; }>
2165
2378
  }
2166
2379
 
2167
2380
  export interface ThreadsafeNodeFS {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/binding",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "license": "MIT",
5
5
  "description": "Node binding for rspack",
6
6
  "main": "binding.js",
@@ -18,21 +18,21 @@
18
18
  "repository": "web-infra-dev/rspack",
19
19
  "devDependencies": {
20
20
  "@napi-rs/cli": "3.0.0-alpha.65",
21
- "typescript": "^5.7.2"
21
+ "typescript": "^5.7.3"
22
22
  },
23
23
  "napi": {
24
24
  "binaryName": "rspack"
25
25
  },
26
26
  "optionalDependencies": {
27
- "@rspack/binding-darwin-arm64": "1.2.1",
28
- "@rspack/binding-win32-arm64-msvc": "1.2.1",
29
- "@rspack/binding-linux-arm64-gnu": "1.2.1",
30
- "@rspack/binding-linux-arm64-musl": "1.2.1",
31
- "@rspack/binding-win32-ia32-msvc": "1.2.1",
32
- "@rspack/binding-darwin-x64": "1.2.1",
33
- "@rspack/binding-win32-x64-msvc": "1.2.1",
34
- "@rspack/binding-linux-x64-musl": "1.2.1",
35
- "@rspack/binding-linux-x64-gnu": "1.2.1"
27
+ "@rspack/binding-darwin-arm64": "1.2.3",
28
+ "@rspack/binding-linux-arm64-gnu": "1.2.3",
29
+ "@rspack/binding-win32-arm64-msvc": "1.2.3",
30
+ "@rspack/binding-win32-ia32-msvc": "1.2.3",
31
+ "@rspack/binding-linux-arm64-musl": "1.2.3",
32
+ "@rspack/binding-darwin-x64": "1.2.3",
33
+ "@rspack/binding-win32-x64-msvc": "1.2.3",
34
+ "@rspack/binding-linux-x64-gnu": "1.2.3",
35
+ "@rspack/binding-linux-x64-musl": "1.2.3"
36
36
  },
37
37
  "scripts": {
38
38
  "build:debug": "node scripts/build.js",