@rspack/binding 1.0.0-beta.2 → 1.0.0-beta.4

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 +219 -72
  2. package/package.json +10 -10
package/binding.d.ts CHANGED
@@ -19,12 +19,68 @@ export class ExternalObject<T> {
19
19
  [K: symbol]: T
20
20
  }
21
21
  }
22
+ export class DependenciesBlockDto {
23
+ get dependencies(): Array<DependencyDto>
24
+ get blocks(): Array<DependenciesBlockDto>
25
+ }
26
+ export type DependenciesBlockDTO = DependenciesBlockDto
27
+
28
+ export class DependenciesDto {
29
+ get fileDependencies(): Array<string>
30
+ get addedFileDependencies(): Array<string>
31
+ get removedFileDependencies(): Array<string>
32
+ get contextDependencies(): Array<string>
33
+ get addedContextDependencies(): Array<string>
34
+ get removedContextDependencies(): Array<string>
35
+ get missingDependencies(): Array<string>
36
+ get addedMissingDependencies(): Array<string>
37
+ get removedMissingDependencies(): Array<string>
38
+ get buildDependencies(): Array<string>
39
+ get addedBuildDependencies(): Array<string>
40
+ get removedBuildDependencies(): Array<string>
41
+ }
42
+ export type DependenciesDTO = DependenciesDto
43
+
44
+ export class DependencyDto {
45
+ get type(): string
46
+ get category(): string
47
+ get request(): string | undefined
48
+ }
49
+ export type DependencyDTO = DependencyDto
50
+
51
+ export class EntryDataDto {
52
+ get dependencies(): Array<DependencyDTO>
53
+ get includeDependencies(): Array<DependencyDTO>
54
+ get options(): EntryOptionsDto
55
+ }
56
+ export type EntryDataDTO = EntryDataDto
57
+
58
+ export class EntryOptionsDto {
59
+ get name(): string | undefined
60
+ set name(name: string | undefined)
61
+ get runtime(): false | string | undefined
62
+ set runtime(chunkLoading: boolean | string | undefined)
63
+ get chunkLoading(): string | undefined
64
+ set chunkLoading(chunkLoading: string | undefined)
65
+ get asyncChunks(): boolean | undefined
66
+ set asyncChunks(asyncChunks: boolean | undefined)
67
+ get baseUri(): string | undefined
68
+ set baseUri(baseUri: string | undefined)
69
+ get library(): JsLibraryOptions | undefined
70
+ set library(library: JsLibraryOptions | undefined)
71
+ get dependOn(): Array<string> | undefined
72
+ set dependOn(dependOn: Array<string> | undefined)
73
+ get layer(): string | undefined
74
+ set layer(layer: string | undefined)
75
+ }
76
+ export type EntryOptionsDTO = EntryOptionsDto
77
+
22
78
  export class JsCompilation {
23
79
  updateAsset(filename: string, newSourceOrFunction: JsCompatSource | ((source: JsCompatSource) => JsCompatSource), assetInfoUpdateOrFunction?: JsAssetInfo | ((assetInfo: JsAssetInfo) => JsAssetInfo)): void
24
80
  getAssets(): Readonly<JsAsset>[]
25
81
  getAsset(name: string): JsAsset | null
26
82
  getAssetSource(name: string): JsCompatSource | null
27
- getModules(): Array<JsModule>
83
+ get modules(): Array<ModuleDTO>
28
84
  getOptimizationBailout(): Array<JsStatsOptimizationBailout>
29
85
  getChunks(): Array<JsChunk>
30
86
  getNamedChunkKeys(): Array<string>
@@ -42,10 +98,7 @@ export class JsCompilation {
42
98
  get entrypoints(): Record<string, JsChunkGroup>
43
99
  get chunkGroups(): Array<JsChunkGroup>
44
100
  get hash(): string | null
45
- getFileDependencies(): Array<string>
46
- getContextDependencies(): Array<string>
47
- getMissingDependencies(): Array<string>
48
- getBuildDependencies(): Array<string>
101
+ dependencies(): DependenciesDto
49
102
  pushDiagnostic(diagnostic: JsDiagnostic): void
50
103
  spliceDiagnostic(start: number, end: number, replaceWith: Array<JsDiagnostic>): void
51
104
  pushNativeDiagnostics(diagnostics: ExternalObject<'Diagnostic[]'>): void
@@ -62,6 +115,18 @@ export class JsCompilation {
62
115
  addBuildDependencies(deps: Array<string>): void
63
116
  rebuildModule(moduleIdentifiers: Array<string>, f: (...args: any[]) => any): void
64
117
  importModule(request: string, publicPath: JsFilename | undefined | null, baseUri: string | undefined | null, originalModule: string | undefined | null, originalModuleContext: string | undefined | null, callback: (...args: any[]) => any): void
118
+ get entries(): JsEntries
119
+ }
120
+
121
+ export class JsEntries {
122
+ clear(): void
123
+ get size(): number
124
+ has(key: string): boolean
125
+ set(key: string, value: JsEntryData | EntryDataDto): void
126
+ delete(key: string): boolean
127
+ get(key: string): EntryDataDto | undefined
128
+ keys(): Array<string>
129
+ values(): Array<EntryDataDto>
65
130
  }
66
131
 
67
132
  export class JsResolver {
@@ -81,6 +146,23 @@ export class JsStats {
81
146
  getLogging(acceptedTypes: number): Array<JsStatsLogging>
82
147
  }
83
148
 
149
+ export class ModuleDto {
150
+ get context(): string | undefined
151
+ get originalSource(): JsCompatSource | undefined
152
+ get resource(): string | undefined
153
+ get moduleIdentifier(): string
154
+ get nameForCondition(): string | undefined
155
+ get request(): string | undefined
156
+ get userRequest(): string | undefined
157
+ get rawRequest(): string | undefined
158
+ get factoryMeta(): JsFactoryMeta | undefined
159
+ get type(): string
160
+ get layer(): string | undefined
161
+ get blocks(): Array<DependenciesBlockDto>
162
+ size(ty?: string | undefined | null): number
163
+ }
164
+ export type ModuleDTO = ModuleDto
165
+
84
166
  export class Rspack {
85
167
  constructor(options: RawOptions, builtinPlugins: Array<BuiltinPlugin>, registerJsTaps: RegisterJsTaps, outputFilesystem: ThreadsafeNodeFS, resolverFactoryReference: JsResolverFactory)
86
168
  setNonSkippableRegisters(kinds: Array<RegisterJsTapKind>): void
@@ -264,6 +346,8 @@ export interface JsAssetInfo {
264
346
  * Related: packages/rspack/src/Compilation.ts
265
347
  */
266
348
  extras: Record<string, any>
349
+ /** whether this asset is over the size limit */
350
+ isOverSizeLimit?: boolean
267
351
  }
268
352
 
269
353
  export interface JsAssetInfoRelated {
@@ -281,6 +365,10 @@ export interface JsBuildTimeExecutionOption {
281
365
  baseUri?: string
282
366
  }
283
367
 
368
+ export interface JsCacheGroupTestCtx {
369
+ module: ModuleDTO
370
+ }
371
+
284
372
  export interface JsChunk {
285
373
  __inner_ukey: number
286
374
  __inner_groups: Array<number>
@@ -360,6 +448,31 @@ export interface JsDiagnostic {
360
448
  error: JsRspackError
361
449
  }
362
450
 
451
+ export interface JsEntryData {
452
+ dependencies: Array<DependencyDTO>
453
+ includeDependencies: Array<DependencyDTO>
454
+ options: JsEntryOptions
455
+ }
456
+
457
+ export interface JsEntryOptions {
458
+ name?: string
459
+ runtime?: false | string
460
+ chunkLoading?: string
461
+ asyncChunks?: boolean
462
+ publicPath?: "auto" | JsFilename
463
+ baseUri?: string
464
+ filename?: JsFilename
465
+ library?: JsLibraryOptions
466
+ dependOn?: Array<string>
467
+ layer?: string
468
+ }
469
+
470
+ export interface JsEntryPluginOptions {
471
+ context: string
472
+ entry: string
473
+ options: JsEntryOptions
474
+ }
475
+
363
476
  export interface JsExecuteModuleArg {
364
477
  entry: string
365
478
  runtimeModules: Array<string>
@@ -387,6 +500,35 @@ export interface JsFactoryMeta {
387
500
  sideEffectFree?: boolean
388
501
  }
389
502
 
503
+ export interface JsLibraryAuxiliaryComment {
504
+ root?: string
505
+ commonjs?: string
506
+ commonjs2?: string
507
+ amd?: string
508
+ }
509
+
510
+ export interface JsLibraryCustomUmdObject {
511
+ amd?: string
512
+ commonjs?: string
513
+ root?: Array<string>
514
+ }
515
+
516
+ export interface JsLibraryName {
517
+ type: "string" | "array" | "umdObject"
518
+ stringPayload?: string
519
+ arrayPayload?: Array<string>
520
+ umdObjectPayload?: JsLibraryCustomUmdObject
521
+ }
522
+
523
+ export interface JsLibraryOptions {
524
+ name?: JsLibraryName
525
+ export?: Array<string>
526
+ libraryType: string
527
+ umdNamedDefine?: boolean
528
+ auxiliaryComment?: JsLibraryAuxiliaryComment
529
+ amdContainer?: string
530
+ }
531
+
390
532
  export interface JsLoaderContext {
391
533
  resourceData: Readonly<JsResourceData>
392
534
  /** Will be deprecated. Use module.module_identifier instead */
@@ -542,6 +684,7 @@ export interface JsStatsAssetInfo {
542
684
  contenthash: Array<string>
543
685
  fullhash: Array<string>
544
686
  related: Array<JsStatsAssetInfoRelated>
687
+ isOverSizeLimit?: boolean
545
688
  }
546
689
 
547
690
  export interface JsStatsAssetInfoRelated {
@@ -554,6 +697,11 @@ export interface JsStatsAssetsByChunkName {
554
697
  files: Array<string>
555
698
  }
556
699
 
700
+ export interface JsStatsChildGroupChildAssets {
701
+ preload?: Array<string>
702
+ prefetch?: Array<string>
703
+ }
704
+
557
705
  export interface JsStatsChunk {
558
706
  type: string
559
707
  files: Array<string>
@@ -584,7 +732,9 @@ export interface JsStatsChunkGroup {
584
732
  assetsSize: number
585
733
  auxiliaryAssets?: Array<JsStatsChunkGroupAsset>
586
734
  auxiliaryAssetsSize?: number
735
+ isOverSizeLimit?: boolean
587
736
  children?: JsStatsChunkGroupChildren
737
+ childAssets?: JsStatsChildGroupChildAssets
588
738
  }
589
739
 
590
740
  export interface JsStatsChunkGroupAsset {
@@ -690,6 +840,8 @@ export interface JsStatsModuleProfile {
690
840
 
691
841
  export interface JsStatsModuleReason {
692
842
  moduleDescriptor?: JsModuleDescriptor
843
+ resolvedModuleDescriptor?: JsModuleDescriptor
844
+ moduleChunks?: number
693
845
  type?: string
694
846
  userRequest?: string
695
847
  }
@@ -851,13 +1003,12 @@ export interface RawCacheGroupOptions {
851
1003
  maxSize?: number | RawSplitChunkSizes
852
1004
  maxAsyncSize?: number | RawSplitChunkSizes
853
1005
  maxInitialSize?: number | RawSplitChunkSizes
1006
+ maxAsyncRequests?: number
1007
+ maxInitialRequests?: number
854
1008
  name?: string | false | Function
855
1009
  reuseExistingChunk?: boolean
856
1010
  enforce?: boolean
857
- }
858
-
859
- export interface RawCacheGroupTestCtx {
860
- module: JsModule
1011
+ usedExports?: boolean
861
1012
  }
862
1013
 
863
1014
  export interface RawCacheOptions {
@@ -899,7 +1050,7 @@ export interface RawConsumeSharedPluginOptions {
899
1050
  export interface RawContainerPluginOptions {
900
1051
  name: string
901
1052
  shareScope: string
902
- library: RawLibraryOptions
1053
+ library: JsLibraryOptions
903
1054
  runtime?: false | string
904
1055
  filename?: string
905
1056
  exposes: Array<RawExposeOptions>
@@ -984,6 +1135,10 @@ export interface RawCssParserOptions {
984
1135
  namedExports?: boolean
985
1136
  }
986
1137
 
1138
+ export interface RawDraft {
1139
+ customMedia: boolean
1140
+ }
1141
+
987
1142
  export interface RawDynamicEntryPluginOptions {
988
1143
  context: string
989
1144
  entry: () => Promise<RawEntryDynamicResult[]>
@@ -991,26 +1146,7 @@ export interface RawDynamicEntryPluginOptions {
991
1146
 
992
1147
  export interface RawEntryDynamicResult {
993
1148
  import: Array<string>
994
- options: RawEntryOptions
995
- }
996
-
997
- export interface RawEntryOptions {
998
- name?: string
999
- runtime?: false | string
1000
- chunkLoading?: string
1001
- asyncChunks?: boolean
1002
- publicPath?: "auto" | JsFilename
1003
- baseUri?: string
1004
- filename?: JsFilename
1005
- library?: RawLibraryOptions
1006
- dependOn?: Array<string>
1007
- layer?: string
1008
- }
1009
-
1010
- export interface RawEntryPluginOptions {
1011
- context: string
1012
- entry: string
1013
- options: RawEntryOptions
1149
+ options: JsEntryOptions
1014
1150
  }
1015
1151
 
1016
1152
  export interface RawEnvironment {
@@ -1163,43 +1299,43 @@ export interface RawLazyCompilationOption {
1163
1299
  cacheable: boolean
1164
1300
  }
1165
1301
 
1166
- export interface RawLibraryAuxiliaryComment {
1167
- root?: string
1168
- commonjs?: string
1169
- commonjs2?: string
1170
- amd?: string
1171
- }
1172
-
1173
- export interface RawLibraryCustomUmdObject {
1174
- amd?: string
1175
- commonjs?: string
1176
- root?: Array<string>
1177
- }
1178
-
1179
- export interface RawLibraryName {
1180
- type: "string" | "array" | "umdObject"
1181
- stringPayload?: string
1182
- arrayPayload?: Array<string>
1183
- umdObjectPayload?: RawLibraryCustomUmdObject
1302
+ export interface RawLightningCssBrowsers {
1303
+ android?: number
1304
+ chrome?: number
1305
+ edge?: number
1306
+ firefox?: number
1307
+ ie?: number
1308
+ ios_saf?: number
1309
+ opera?: number
1310
+ safari?: number
1311
+ samsung?: number
1184
1312
  }
1185
1313
 
1186
- export interface RawLibraryOptions {
1187
- name?: RawLibraryName
1188
- export?: Array<string>
1189
- libraryType: string
1190
- umdNamedDefine?: boolean
1191
- auxiliaryComment?: RawLibraryAuxiliaryComment
1192
- amdContainer?: string
1314
+ export interface RawLightningCssMinimizerOptions {
1315
+ errorRecovery: boolean
1316
+ targets?: RawLightningCssBrowsers
1317
+ include?: number
1318
+ exclude?: number
1319
+ draft?: RawDraft
1320
+ nonStandard?: RawNonStandard
1321
+ pseudoClasses?: RawLightningCssPseudoClasses
1322
+ unusedSymbols: Array<string>
1193
1323
  }
1194
1324
 
1195
1325
  export interface RawLightningCssMinimizerRspackPluginOptions {
1196
- errorRecovery: boolean
1197
- unusedSymbols: Array<string>
1198
- removeUnusedLocalIdents: boolean
1199
- browserslist: Array<string>
1200
1326
  test?: string | RegExp | (string | RegExp)[]
1201
1327
  include?: string | RegExp | (string | RegExp)[]
1202
1328
  exclude?: string | RegExp | (string | RegExp)[]
1329
+ removeUnusedLocalIdents: boolean
1330
+ minimizerOptions: RawLightningCssMinimizerOptions
1331
+ }
1332
+
1333
+ export interface RawLightningCssPseudoClasses {
1334
+ hover?: string
1335
+ active?: string
1336
+ focus?: string
1337
+ focusVisible?: string
1338
+ focusWithin?: string
1203
1339
  }
1204
1340
 
1205
1341
  export interface RawLimitChunkCountPluginOptions {
@@ -1297,6 +1433,10 @@ export interface RawNodeOption {
1297
1433
  global: string
1298
1434
  }
1299
1435
 
1436
+ export interface RawNonStandard {
1437
+ deepSelectorCombinator: boolean
1438
+ }
1439
+
1300
1440
  export interface RawOptimizationOptions {
1301
1441
  removeAvailableModules: boolean
1302
1442
  sideEffects: string
@@ -1347,7 +1487,7 @@ export interface RawOutputOptions {
1347
1487
  hotUpdateGlobal: string
1348
1488
  uniqueName: string
1349
1489
  chunkLoadingGlobal: string
1350
- library?: RawLibraryOptions
1490
+ library?: JsLibraryOptions
1351
1491
  strictModuleErrorHandling: boolean
1352
1492
  enabledLibraryTypes?: Array<string>
1353
1493
  globalObject: string
@@ -1549,6 +1689,7 @@ export interface RawSplitChunksOptions {
1549
1689
  cacheGroups?: Array<RawCacheGroupOptions>
1550
1690
  /** What kind of chunks should be selected. */
1551
1691
  chunks?: RegExp | 'async' | 'initial' | 'all' | Function
1692
+ usedExports?: boolean
1552
1693
  automaticNameDelimiter?: string
1553
1694
  maxAsyncRequests?: number
1554
1695
  maxInitialRequests?: number
@@ -1573,15 +1714,19 @@ export interface RawSwcCssMinimizerRspackPluginOptions {
1573
1714
  exclude?: string | RegExp | (string | RegExp)[]
1574
1715
  }
1575
1716
 
1576
- export interface RawSwcJsMinimizerRspackPluginOptions {
1577
- extractComments?: RawExtractComments
1717
+ export interface RawSwcJsMinimizerOptions {
1578
1718
  compress: any
1579
1719
  mangle: any
1580
1720
  format: any
1581
1721
  module?: boolean
1722
+ }
1723
+
1724
+ export interface RawSwcJsMinimizerRspackPluginOptions {
1582
1725
  test?: string | RegExp | (string | RegExp)[]
1583
1726
  include?: string | RegExp | (string | RegExp)[]
1584
1727
  exclude?: string | RegExp | (string | RegExp)[]
1728
+ extractComments?: RawExtractComments
1729
+ minimizerOptions: RawSwcJsMinimizerOptions
1585
1730
  }
1586
1731
 
1587
1732
  export interface RawToOptions {
@@ -1626,16 +1771,17 @@ export enum RegisterJsTapKind {
1626
1771
  CompilationChunkAsset = 20,
1627
1772
  CompilationProcessAssets = 21,
1628
1773
  CompilationAfterProcessAssets = 22,
1629
- CompilationAfterSeal = 23,
1630
- NormalModuleFactoryBeforeResolve = 24,
1631
- NormalModuleFactoryFactorize = 25,
1632
- NormalModuleFactoryResolve = 26,
1633
- NormalModuleFactoryAfterResolve = 27,
1634
- NormalModuleFactoryCreateModule = 28,
1635
- NormalModuleFactoryResolveForScheme = 29,
1636
- ContextModuleFactoryBeforeResolve = 30,
1637
- ContextModuleFactoryAfterResolve = 31,
1638
- JavascriptModulesChunkHash = 32
1774
+ CompilationSeal = 23,
1775
+ CompilationAfterSeal = 24,
1776
+ NormalModuleFactoryBeforeResolve = 25,
1777
+ NormalModuleFactoryFactorize = 26,
1778
+ NormalModuleFactoryResolve = 27,
1779
+ NormalModuleFactoryAfterResolve = 28,
1780
+ NormalModuleFactoryCreateModule = 29,
1781
+ NormalModuleFactoryResolveForScheme = 30,
1782
+ ContextModuleFactoryBeforeResolve = 31,
1783
+ ContextModuleFactoryAfterResolve = 32,
1784
+ JavascriptModulesChunkHash = 33
1639
1785
  }
1640
1786
 
1641
1787
  export interface RegisterJsTaps {
@@ -1662,6 +1808,7 @@ export interface RegisterJsTaps {
1662
1808
  registerCompilationChunkAssetTaps: (stages: Array<number>) => Array<{ function: ((arg: JsChunkAssetArgs) => void); stage: number; }>
1663
1809
  registerCompilationProcessAssetsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsCompilation) => Promise<void>); stage: number; }>
1664
1810
  registerCompilationAfterProcessAssetsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsCompilation) => void); stage: number; }>
1811
+ registerCompilationSealTaps: (stages: Array<number>) => Array<{ function: (() => void); stage: number; }>
1665
1812
  registerCompilationAfterSealTaps: (stages: Array<number>) => Array<{ function: (() => Promise<void>); stage: number; }>
1666
1813
  registerNormalModuleFactoryBeforeResolveTaps: (stages: Array<number>) => Array<{ function: ((arg: JsBeforeResolveArgs) => Promise<[boolean | undefined, JsBeforeResolveArgs]>); stage: number; }>
1667
1814
  registerNormalModuleFactoryFactorizeTaps: (stages: Array<number>) => Array<{ function: ((arg: JsFactorizeArgs) => Promise<JsFactorizeArgs>); stage: number; }>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/binding",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.4",
4
4
  "license": "MIT",
5
5
  "description": "Node binding for rspack",
6
6
  "main": "binding.js",
@@ -24,15 +24,15 @@
24
24
  "binaryName": "rspack"
25
25
  },
26
26
  "optionalDependencies": {
27
- "@rspack/binding-darwin-arm64": "1.0.0-beta.2",
28
- "@rspack/binding-win32-arm64-msvc": "1.0.0-beta.2",
29
- "@rspack/binding-linux-arm64-musl": "1.0.0-beta.2",
30
- "@rspack/binding-linux-arm64-gnu": "1.0.0-beta.2",
31
- "@rspack/binding-win32-x64-msvc": "1.0.0-beta.2",
32
- "@rspack/binding-win32-ia32-msvc": "1.0.0-beta.2",
33
- "@rspack/binding-linux-x64-gnu": "1.0.0-beta.2",
34
- "@rspack/binding-darwin-x64": "1.0.0-beta.2",
35
- "@rspack/binding-linux-x64-musl": "1.0.0-beta.2"
27
+ "@rspack/binding-darwin-arm64": "1.0.0-beta.4",
28
+ "@rspack/binding-win32-arm64-msvc": "1.0.0-beta.4",
29
+ "@rspack/binding-linux-arm64-gnu": "1.0.0-beta.4",
30
+ "@rspack/binding-win32-ia32-msvc": "1.0.0-beta.4",
31
+ "@rspack/binding-darwin-x64": "1.0.0-beta.4",
32
+ "@rspack/binding-linux-arm64-musl": "1.0.0-beta.4",
33
+ "@rspack/binding-win32-x64-msvc": "1.0.0-beta.4",
34
+ "@rspack/binding-linux-x64-gnu": "1.0.0-beta.4",
35
+ "@rspack/binding-linux-x64-musl": "1.0.0-beta.4"
36
36
  },
37
37
  "scripts": {
38
38
  "build:debug": "node scripts/build.js",