@rspack/binding 1.2.6 → 1.2.7

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 +79 -74
  2. package/package.json +11 -11
package/binding.d.ts CHANGED
@@ -4,11 +4,13 @@
4
4
  /* -- banner.d.ts -- */
5
5
  export type JsFilename =
6
6
  | string
7
- | ((pathData: JsPathData, assetInfo?: JsAssetInfo) => string);
7
+ | ((pathData: JsPathData, assetInfo?: AssetInfo) => string);
8
8
 
9
9
  export type LocalJsFilename = JsFilename;
10
10
 
11
11
  export type RawLazyCompilationTest = RegExp | ((m: JsModule) => boolean);
12
+
13
+ export type AssetInfo = KnownAssetInfo & Record<string, any>;
12
14
  /* -- banner.d.ts end -- */
13
15
 
14
16
  /* -- napi-rs generated below -- */
@@ -19,13 +21,29 @@ export declare class ExternalObject<T> {
19
21
  [K: symbol]: T
20
22
  }
21
23
  }
24
+ export declare class Dependency {
25
+ get type(): string
26
+ get category(): string
27
+ get request(): string | undefined
28
+ get critical(): boolean
29
+ set critical(val: boolean)
30
+ get ids(): Array<string> | undefined
31
+ }
32
+
22
33
  export declare class EntryDataDto {
23
- get dependencies(): JsDependency[]
24
- get includeDependencies(): JsDependency[]
34
+ get dependencies(): Dependency[]
35
+ get includeDependencies(): Dependency[]
25
36
  get options(): EntryOptionsDto
26
37
  }
27
38
  export type EntryDataDTO = EntryDataDto
28
39
 
40
+ export declare class EntryDependency {
41
+ constructor(request: string)
42
+ get type(): string
43
+ get category(): string
44
+ get request(): string | undefined
45
+ }
46
+
29
47
  export declare class EntryOptionsDto {
30
48
  get name(): string | undefined
31
49
  set name(name: string | undefined)
@@ -97,7 +115,7 @@ export declare class JsChunkGroup {
97
115
  }
98
116
 
99
117
  export declare class JsCompilation {
100
- updateAsset(filename: string, newSourceOrFunction: JsCompatSource | ((source: JsCompatSourceOwned) => JsCompatSourceOwned), assetInfoUpdateOrFunction?: JsAssetInfo | ((assetInfo: JsAssetInfo) => JsAssetInfo)): void
118
+ updateAsset(filename: string, newSourceOrFunction: JsCompatSource | ((source: JsCompatSourceOwned) => JsCompatSourceOwned), assetInfoUpdateOrFunction?: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo | undefined)): void
101
119
  getAssets(): Readonly<JsAsset>[]
102
120
  getAsset(name: string): JsAsset | null
103
121
  getAssetSource(name: string): JsCompatSource | null
@@ -113,7 +131,7 @@ export declare class JsCompilation {
113
131
  deleteAssetSource(name: string): void
114
132
  getAssetFilenames(): Array<string>
115
133
  hasAsset(name: string): boolean
116
- emitAsset(filename: string, source: JsCompatSource, assetInfo: JsAssetInfo): void
134
+ emitAsset(filename: string, source: JsCompatSource, jsAssetInfo?: AssetInfo | undefined | null): void
117
135
  deleteAsset(filename: string): void
118
136
  renameAsset(filename: string, newName: string): void
119
137
  get entrypoints(): JsChunkGroup[]
@@ -146,7 +164,7 @@ export declare class JsCompilation {
146
164
  addRuntimeModule(chunk: JsChunk, runtimeModule: JsAddingRuntimeModule): void
147
165
  get moduleGraph(): JsModuleGraph
148
166
  get chunkGraph(): JsChunkGraph
149
- addInclude(args: [string, RawDependency, JsEntryOptions | undefined][], callback: (errMsg: Error | null, results: [string | null, JsModule][]) => void): void
167
+ addInclude(args: [string, EntryDependency, JsEntryOptions | undefined][], callback: (errMsg: Error | null, results: [string | null, JsModule][]) => void): void
150
168
  }
151
169
 
152
170
  export declare class JsCompiler {
@@ -169,7 +187,7 @@ export declare class JsContextModuleFactoryAfterResolveData {
169
187
  set regExp(rawRegExp: RegExp | undefined)
170
188
  get recursive(): boolean
171
189
  set recursive(recursive: boolean)
172
- get dependencies(): JsDependency[]
190
+ get dependencies(): Dependency[]
173
191
  }
174
192
 
175
193
  export declare class JsContextModuleFactoryBeforeResolveData {
@@ -199,19 +217,10 @@ export declare class JsDependencies {
199
217
  }
200
218
 
201
219
  export declare class JsDependenciesBlock {
202
- get dependencies(): JsDependency[]
220
+ get dependencies(): Dependency[]
203
221
  get blocks(): JsDependenciesBlock[]
204
222
  }
205
223
 
206
- export declare class JsDependency {
207
- get type(): string
208
- get category(): string
209
- get request(): string | undefined
210
- get critical(): boolean
211
- set critical(val: boolean)
212
- get ids(): Array<string> | undefined
213
- }
214
-
215
224
  export declare class JsEntries {
216
225
  clear(): void
217
226
  get size(): number
@@ -244,32 +253,33 @@ export declare class JsModule {
244
253
  get type(): string
245
254
  get layer(): string | undefined
246
255
  get blocks(): JsDependenciesBlock[]
247
- get dependencies(): JsDependency[]
256
+ get dependencies(): Dependency[]
248
257
  size(ty?: string | undefined | null): number
249
258
  get modules(): JsModule[] | undefined
250
259
  get useSourceMap(): boolean
251
260
  libIdent(options: JsLibIdentOptions): string | null
252
261
  get resourceResolveData(): JsResourceData | undefined
253
262
  get matchResource(): string | undefined
254
- emitFile(filename: string, source: JsCompatSource, assetInfo: JsAssetInfo): void
263
+ emitFile(filename: string, source: JsCompatSource, jsAssetInfo?: AssetInfo | undefined | null): void
255
264
  }
256
265
 
257
266
  export declare class JsModuleGraph {
258
- getModule(jsDependency: JsDependency): JsModule | null
259
- getResolvedModule(jsDependency: JsDependency): JsModule | null
267
+ getModule(dependency: Dependency): JsModule | null
268
+ getResolvedModule(dependency: Dependency): JsModule | null
260
269
  getUsedExports(jsModule: JsModule, jsRuntime: string | Array<string>): boolean | Array<string> | null
261
270
  getIssuer(module: JsModule): JsModule | null
262
271
  getExportsInfo(module: JsModule): JsExportsInfo
263
- getConnection(dependency: JsDependency): JsModuleGraphConnection | null
272
+ getConnection(dependency: Dependency): JsModuleGraphConnection | null
264
273
  getOutgoingConnections(module: JsModule): JsModuleGraphConnection[]
274
+ getOutgoingConnectionsInOrder(module: JsModule): JsModuleGraphConnection[]
265
275
  getIncomingConnections(module: JsModule): JsModuleGraphConnection[]
266
- getParentModule(jsDependency: JsDependency): JsModule | null
267
- getParentBlockIndex(jsDependency: JsDependency): number
276
+ getParentModule(dependency: Dependency): JsModule | null
277
+ getParentBlockIndex(dependency: Dependency): number
268
278
  isAsync(module: JsModule): boolean
269
279
  }
270
280
 
271
281
  export declare class JsModuleGraphConnection {
272
- get dependency(): JsDependency
282
+ get dependency(): Dependency
273
283
  get module(): JsModule | null
274
284
  get resolvedModule(): JsModule | null
275
285
  get originModule(): JsModule | null
@@ -421,6 +431,7 @@ export interface JsAfterResolveData {
421
431
  request: string
422
432
  context: string
423
433
  issuer: string
434
+ issuerLayer?: string
424
435
  fileDependencies: Array<string>
425
436
  contextDependencies: Array<string>
426
437
  missingDependencies: Array<string>
@@ -452,7 +463,7 @@ export interface JsAlterAssetTagsData {
452
463
 
453
464
  export interface JsAsset {
454
465
  name: string
455
- info: JsAssetInfo
466
+ info: AssetInfo
456
467
  }
457
468
 
458
469
  export interface JsAssetEmittedArgs {
@@ -461,47 +472,6 @@ export interface JsAssetEmittedArgs {
461
472
  targetPath: string
462
473
  }
463
474
 
464
- export interface JsAssetInfo {
465
- /** if the asset can be long term cached forever (contains a hash) */
466
- immutable?: boolean
467
- /** whether the asset is minimized */
468
- minimized?: boolean
469
- /** the value(s) of the full hash used for this asset */
470
- fullhash: Array<string>
471
- /** the value(s) of the chunk hash used for this asset */
472
- chunkhash: Array<string>
473
- /**
474
- * the value(s) of the module hash used for this asset
475
- * the value(s) of the content hash used for this asset
476
- */
477
- contenthash: Array<string>
478
- sourceFilename?: string
479
- /** when asset was created from a source file (potentially transformed), it should be flagged as copied */
480
- copied?: boolean
481
- /**
482
- * size in bytes, only set after asset has been emitted
483
- * when asset is only used for development and doesn't count towards user-facing assets
484
- */
485
- development?: boolean
486
- /** when asset ships data for updating an existing application (HMR) */
487
- hotModuleReplacement?: boolean
488
- /** when asset is javascript and an ESM */
489
- javascriptModule?: boolean
490
- /** related object to other assets, keyed by type of relation (only points from parent to child) */
491
- related: JsAssetInfoRelated
492
- /** unused css local ident for the css chunk */
493
- cssUnusedIdents?: Array<string>
494
- /**
495
- * Webpack: AssetInfo = KnownAssetInfo & Record<string, any>
496
- * But Napi.rs does not support Intersectiont types. This is a hack to store the additional fields
497
- * in the rust struct and have the Js side to reshape and align with webpack
498
- * Related: packages/rspack/src/Compilation.ts
499
- */
500
- extras: Record<string, any>
501
- /** whether this asset is over the size limit */
502
- isOverSizeLimit?: boolean
503
- }
504
-
505
475
  export interface JsAssetInfoRelated {
506
476
  sourceMap?: string
507
477
  }
@@ -528,6 +498,7 @@ export interface JsBeforeResolveArgs {
528
498
  request: string
529
499
  context: string
530
500
  issuer: string
501
+ issuerLayer?: string
531
502
  }
532
503
 
533
504
  export interface JsBuildMeta {
@@ -641,8 +612,8 @@ export interface JsDiagnosticLocation {
641
612
  }
642
613
 
643
614
  export interface JsEntryData {
644
- dependencies: Array<JsDependency>
645
- includeDependencies: Array<JsDependency>
615
+ dependencies: Array<Dependency>
616
+ includeDependencies: Array<Dependency>
646
617
  options: JsEntryOptions
647
618
  }
648
619
 
@@ -686,6 +657,7 @@ export interface JsFactorizeArgs {
686
657
  request: string
687
658
  context: string
688
659
  issuer: string
660
+ issuerLayer?: string
689
661
  }
690
662
 
691
663
  export interface JsFactoryMeta {
@@ -834,6 +806,7 @@ export interface JsResolveArgs {
834
806
  request: string
835
807
  context: string
836
808
  issuer: string
809
+ issuerLayer?: string
837
810
  }
838
811
 
839
812
  export interface JsResolveForSchemeArgs {
@@ -1305,6 +1278,41 @@ export interface JsTap {
1305
1278
  stage: number
1306
1279
  }
1307
1280
 
1281
+ export interface KnownAssetInfo {
1282
+ /** if the asset can be long term cached forever (contains a hash) */
1283
+ immutable?: boolean
1284
+ /** whether the asset is minimized */
1285
+ minimized?: boolean
1286
+ /** the value(s) of the full hash used for this asset */
1287
+ fullhash?: string | Array<string>
1288
+ /** the value(s) of the chunk hash used for this asset */
1289
+ chunkhash?: string | Array<string>
1290
+ /**
1291
+ * the value(s) of the module hash used for this asset
1292
+ * the value(s) of the content hash used for this asset
1293
+ */
1294
+ contenthash?: string | Array<string>
1295
+ /** when asset was created from a source file (potentially transformed), the original filename relative to compilation context */
1296
+ sourceFilename?: string
1297
+ /** when asset was created from a source file (potentially transformed), it should be flagged as copied */
1298
+ copied?: boolean
1299
+ /**
1300
+ * size in bytes, only set after asset has been emitted
1301
+ * when asset is only used for development and doesn't count towards user-facing assets
1302
+ */
1303
+ development?: boolean
1304
+ /** when asset ships data for updating an existing application (HMR) */
1305
+ hotModuleReplacement?: boolean
1306
+ /** when asset is javascript and an ESM */
1307
+ javascriptModule?: boolean
1308
+ /** related object to other assets, keyed by type of relation (only points from parent to child) */
1309
+ related?: JsAssetInfoRelated
1310
+ /** unused css local ident for the css chunk */
1311
+ cssUnusedIdents?: Array<string>
1312
+ /** whether this asset is over the size limit */
1313
+ isOverSizeLimit?: boolean
1314
+ }
1315
+
1308
1316
  export interface NodeFsStats {
1309
1317
  isFile: boolean
1310
1318
  isDirectory: boolean
@@ -1318,7 +1326,7 @@ export interface NodeFsStats {
1318
1326
 
1319
1327
  export interface PathWithInfo {
1320
1328
  path: string
1321
- info: JsAssetInfo
1329
+ info: AssetInfo
1322
1330
  }
1323
1331
 
1324
1332
  export interface RawAliasOptionItem {
@@ -1414,6 +1422,7 @@ export interface RawCacheGroupOptions {
1414
1422
 
1415
1423
  export interface RawCacheOptions {
1416
1424
  type: string
1425
+ maxGenerations?: number
1417
1426
  }
1418
1427
 
1419
1428
  export interface RawConsumeOptions {
@@ -1525,10 +1534,6 @@ export interface RawCssParserOptions {
1525
1534
  namedExports?: boolean
1526
1535
  }
1527
1536
 
1528
- export interface RawDependency {
1529
- request: string
1530
- }
1531
-
1532
1537
  export interface RawDllEntryPluginOptions {
1533
1538
  context: string
1534
1539
  entries: Array<string>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/binding",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "license": "MIT",
5
5
  "description": "Node binding for rspack",
6
6
  "main": "binding.js",
@@ -17,22 +17,22 @@
17
17
  "bugs": "https://github.com/web-infra-dev/rspack/issues",
18
18
  "repository": "web-infra-dev/rspack",
19
19
  "devDependencies": {
20
- "@napi-rs/cli": "3.0.0-alpha.71",
20
+ "@napi-rs/cli": "3.0.0-alpha.72",
21
21
  "typescript": "^5.7.3"
22
22
  },
23
23
  "napi": {
24
24
  "binaryName": "rspack"
25
25
  },
26
26
  "optionalDependencies": {
27
- "@rspack/binding-linux-arm64-gnu": "1.2.6",
28
- "@rspack/binding-win32-arm64-msvc": "1.2.6",
29
- "@rspack/binding-linux-arm64-musl": "1.2.6",
30
- "@rspack/binding-darwin-arm64": "1.2.6",
31
- "@rspack/binding-win32-ia32-msvc": "1.2.6",
32
- "@rspack/binding-win32-x64-msvc": "1.2.6",
33
- "@rspack/binding-darwin-x64": "1.2.6",
34
- "@rspack/binding-linux-x64-gnu": "1.2.6",
35
- "@rspack/binding-linux-x64-musl": "1.2.6"
27
+ "@rspack/binding-darwin-arm64": "1.2.7",
28
+ "@rspack/binding-win32-arm64-msvc": "1.2.7",
29
+ "@rspack/binding-linux-arm64-gnu": "1.2.7",
30
+ "@rspack/binding-linux-arm64-musl": "1.2.7",
31
+ "@rspack/binding-darwin-x64": "1.2.7",
32
+ "@rspack/binding-win32-ia32-msvc": "1.2.7",
33
+ "@rspack/binding-win32-x64-msvc": "1.2.7",
34
+ "@rspack/binding-linux-x64-musl": "1.2.7",
35
+ "@rspack/binding-linux-x64-gnu": "1.2.7"
36
36
  },
37
37
  "scripts": {
38
38
  "build:dev": "node scripts/build.js",