@rspack/binding 1.0.5 → 1.0.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 +138 -66
  2. package/package.json +10 -10
package/binding.d.ts CHANGED
@@ -99,8 +99,9 @@ export class JsCompilation {
99
99
  get chunkGroups(): Array<JsChunkGroup>
100
100
  get hash(): string | null
101
101
  dependencies(): DependenciesDto
102
- pushDiagnostic(diagnostic: JsDiagnostic): void
103
- spliceDiagnostic(start: number, end: number, replaceWith: Array<JsDiagnostic>): void
102
+ pushDiagnostic(diagnostic: JsRspackDiagnostic): void
103
+ spliceDiagnostic(start: number, end: number, replaceWith: Array<JsRspackDiagnostic>): void
104
+ pushNativeDiagnostic(diagnostic: ExternalObject<'Diagnostic'>): void
104
105
  pushNativeDiagnostics(diagnostics: ExternalObject<'Diagnostic[]'>): void
105
106
  getErrors(): Array<JsRspackError>
106
107
  getWarnings(): Array<JsRspackError>
@@ -116,6 +117,31 @@ export class JsCompilation {
116
117
  rebuildModule(moduleIdentifiers: Array<string>, f: (...args: any[]) => any): void
117
118
  importModule(request: string, layer: string | undefined | null, publicPath: JsFilename | undefined | null, baseUri: string | undefined | null, originalModule: string | undefined | null, originalModuleContext: string | undefined | null, callback: (...args: any[]) => any): void
118
119
  get entries(): JsEntries
120
+ addRuntimeModule(chunkUkey: number, runtimeModule: JsAddingRuntimeModule): void
121
+ }
122
+
123
+ export class JsContextModuleFactoryAfterResolveData {
124
+ get resource(): string
125
+ set resource(resource: string)
126
+ get context(): string
127
+ set context(context: string)
128
+ get request(): string
129
+ set request(request: string)
130
+ get regExp(): RawRegex | undefined
131
+ set regExp(rawRegExp: RawRegex | undefined)
132
+ get recursive(): boolean
133
+ set recursive(recursive: boolean)
134
+ }
135
+
136
+ export class JsContextModuleFactoryBeforeResolveData {
137
+ get context(): string
138
+ set context(context: string)
139
+ get request(): string
140
+ set request(request: string)
141
+ get regExp(): RawRegex | undefined
142
+ set regExp(rawRegExp: RawRegex | undefined)
143
+ get recursive(): boolean
144
+ set recursive(recursive: boolean)
119
145
  }
120
146
 
121
147
  export class JsEntries {
@@ -264,6 +290,7 @@ export enum BuiltinPluginName {
264
290
  RuntimeChunkPlugin = 'RuntimeChunkPlugin',
265
291
  SizeLimitsPlugin = 'SizeLimitsPlugin',
266
292
  NoEmitOnErrorsPlugin = 'NoEmitOnErrorsPlugin',
293
+ ContextReplacementPlugin = 'ContextReplacementPlugin',
267
294
  HttpExternalsRspackPlugin = 'HttpExternalsRspackPlugin',
268
295
  CopyRspackPlugin = 'CopyRspackPlugin',
269
296
  HtmlRspackPlugin = 'HtmlRspackPlugin',
@@ -281,6 +308,16 @@ export interface ContextInfo {
281
308
  issuer: string
282
309
  }
283
310
 
311
+ export function formatDiagnostic(diagnostic: JsDiagnostic): ExternalObject<'Diagnostic'>
312
+
313
+ export interface JsAddingRuntimeModule {
314
+ name: string
315
+ generator: () => String
316
+ cacheable: boolean
317
+ isolate: boolean
318
+ stage: number
319
+ }
320
+
284
321
  export interface JsAdditionalTreeRuntimeRequirementsArg {
285
322
  chunk: JsChunk
286
323
  runtimeRequirements: JsRuntimeGlobals
@@ -337,9 +374,9 @@ export interface JsAssetEmittedArgs {
337
374
 
338
375
  export interface JsAssetInfo {
339
376
  /** if the asset can be long term cached forever (contains a hash) */
340
- immutable: boolean
377
+ immutable?: boolean
341
378
  /** whether the asset is minimized */
342
- minimized: boolean
379
+ minimized?: boolean
343
380
  /** the value(s) of the full hash used for this asset */
344
381
  fullhash: Array<string>
345
382
  /** the value(s) of the chunk hash used for this asset */
@@ -354,9 +391,9 @@ export interface JsAssetInfo {
354
391
  * size in bytes, only set after asset has been emitted
355
392
  * when asset is only used for development and doesn't count towards user-facing assets
356
393
  */
357
- development: boolean
394
+ development?: boolean
358
395
  /** when asset ships data for updating an existing application (HMR) */
359
- hotModuleReplacement: boolean
396
+ hotModuleReplacement?: boolean
360
397
  /** when asset is javascript and an ESM */
361
398
  javascriptModule?: boolean
362
399
  /** related object to other assets, keyed by type of relation (only points from parent to child) */
@@ -457,24 +494,8 @@ export interface JsCodegenerationResults {
457
494
  }
458
495
 
459
496
  export interface JsCompatSource {
460
- /** Whether the underlying data structure is a `RawSource` */
461
- isRaw: boolean
462
- /** Whether the underlying value is a buffer or string */
463
- isBuffer: boolean
464
- source: Buffer
465
- map?: Buffer
466
- }
467
-
468
- export interface JsContextModuleFactoryAfterResolveData {
469
- resource: string
470
- context: string
471
- request: string
472
- regExp?: RawRegex
473
- }
474
-
475
- export interface JsContextModuleFactoryBeforeResolveData {
476
- context: string
477
- request?: string
497
+ source: string | Buffer
498
+ map?: string
478
499
  }
479
500
 
480
501
  export interface JsCreateData {
@@ -484,8 +505,23 @@ export interface JsCreateData {
484
505
  }
485
506
 
486
507
  export interface JsDiagnostic {
487
- severity: JsRspackSeverity
488
- error: JsRspackError
508
+ message: string
509
+ help?: string
510
+ sourceCode?: string
511
+ location?: JsDiagnosticLocation
512
+ file?: string
513
+ severity: "error" | "warning"
514
+ moduleIdentifier?: string
515
+ }
516
+
517
+ export interface JsDiagnosticLocation {
518
+ text?: string
519
+ /** 1-based */
520
+ line: number
521
+ /** 0-based in bytes */
522
+ column: number
523
+ /** Length in bytes */
524
+ length: number
489
525
  }
490
526
 
491
527
  export interface JsEntryData {
@@ -690,6 +726,11 @@ export interface JsResourceData {
690
726
  fragment?: string
691
727
  }
692
728
 
729
+ export interface JsRspackDiagnostic {
730
+ severity: JsRspackSeverity
731
+ error: JsRspackError
732
+ }
733
+
693
734
  export interface JsRspackError {
694
735
  name: string
695
736
  message: string
@@ -721,6 +762,15 @@ export interface JsRuntimeModuleArg {
721
762
  chunk: JsChunk
722
763
  }
723
764
 
765
+ export interface JsRuntimeRequirementInTreeArg {
766
+ chunk: JsChunk
767
+ runtimeRequirements: JsRuntimeGlobals
768
+ }
769
+
770
+ export interface JsRuntimeRequirementInTreeResult {
771
+ runtimeRequirements: JsRuntimeGlobals
772
+ }
773
+
724
774
  export interface JsStatsAsset {
725
775
  type: string
726
776
  name: string
@@ -736,11 +786,11 @@ export interface JsStatsAsset {
736
786
  }
737
787
 
738
788
  export interface JsStatsAssetInfo {
739
- minimized: boolean
740
- development: boolean
741
- hotModuleReplacement: boolean
789
+ minimized?: boolean
790
+ development?: boolean
791
+ hotModuleReplacement?: boolean
742
792
  sourceFilename?: string
743
- immutable: boolean
793
+ immutable?: boolean
744
794
  javascriptModule?: boolean
745
795
  chunkhash: Array<string>
746
796
  contenthash: Array<string>
@@ -1126,6 +1176,14 @@ export interface RawContainerReferencePluginOptions {
1126
1176
  enhanced: boolean
1127
1177
  }
1128
1178
 
1179
+ export interface RawContextReplacementPluginOptions {
1180
+ resourceRegExp: RawRegex
1181
+ newContentResource?: string
1182
+ newContentRecursive?: boolean
1183
+ newContentRegExp?: RawRegex
1184
+ newContentCreateContextMap?: Record<string, string>
1185
+ }
1186
+
1129
1187
  export interface RawCopyGlobOptions {
1130
1188
  caseSensitiveMatch?: boolean
1131
1189
  dot?: boolean
@@ -1225,6 +1283,7 @@ export interface RawEvalDevToolModulePluginOptions {
1225
1283
  export interface RawExperiments {
1226
1284
  layers: boolean
1227
1285
  topLevelAwait: boolean
1286
+ incremental?: RawIncremental
1228
1287
  rspackFuture: RawRspackFuture
1229
1288
  }
1230
1289
 
@@ -1333,6 +1392,16 @@ export interface RawIgnorePluginOptions {
1333
1392
  checkResource?: (resource: string, context: string) => boolean
1334
1393
  }
1335
1394
 
1395
+ export interface RawIncremental {
1396
+ make: boolean
1397
+ emitAssets: boolean
1398
+ inferAsyncModules: boolean
1399
+ providedExports: boolean
1400
+ moduleHashes: boolean
1401
+ moduleCodegen: boolean
1402
+ moduleRuntimeRequirements: boolean
1403
+ }
1404
+
1336
1405
  export interface RawInfo {
1337
1406
  immutable?: boolean
1338
1407
  minimized?: boolean
@@ -1345,20 +1414,20 @@ export interface RawInfo {
1345
1414
  }
1346
1415
 
1347
1416
  export interface RawJavascriptParserOptions {
1348
- dynamicImportMode: string
1349
- dynamicImportPreload: string
1350
- dynamicImportPrefetch: string
1417
+ dynamicImportMode?: string
1418
+ dynamicImportPreload?: string
1419
+ dynamicImportPrefetch?: string
1351
1420
  dynamicImportFetchPriority?: string
1352
- url: string
1353
- exprContextCritical: boolean
1354
- wrappedContextCritical: boolean
1421
+ url?: string
1422
+ exprContextCritical?: boolean
1423
+ wrappedContextCritical?: boolean
1355
1424
  exportsPresence?: string
1356
1425
  importExportsPresence?: string
1357
1426
  reexportExportsPresence?: string
1358
- strictExportPresence: boolean
1359
- worker: Array<string>
1427
+ strictExportPresence?: boolean
1428
+ worker?: Array<string>
1360
1429
  overrideStrict?: string
1361
- importMeta: boolean
1430
+ importMeta?: boolean
1362
1431
  }
1363
1432
 
1364
1433
  export interface RawLazyCompilationOption {
@@ -1599,11 +1668,12 @@ export interface RawPathData {
1599
1668
  }
1600
1669
 
1601
1670
  export interface RawProgressPluginOptions {
1602
- prefix: string
1603
- profile: boolean
1604
- template: string
1671
+ prefix?: string
1672
+ profile?: boolean
1673
+ template?: string
1605
1674
  tick?: string | Array<string>
1606
- progressChars: string
1675
+ progressChars?: string
1676
+ handler?: (percent: number, msg: string, items: string[]) => void
1607
1677
  }
1608
1678
 
1609
1679
  export interface RawProvideOptions {
@@ -1689,7 +1759,7 @@ export interface RawResolveTsconfigOptions {
1689
1759
  }
1690
1760
 
1691
1761
  export interface RawRspackFuture {
1692
- newIncremental: boolean
1762
+
1693
1763
  }
1694
1764
 
1695
1765
  export interface RawRuleSetCondition {
@@ -1831,28 +1901,29 @@ export enum RegisterJsTapKind {
1831
1901
  CompilationOptimizeTree = 15,
1832
1902
  CompilationOptimizeChunkModules = 16,
1833
1903
  CompilationAdditionalTreeRuntimeRequirements = 17,
1834
- CompilationRuntimeModule = 18,
1835
- CompilationChunkHash = 19,
1836
- CompilationChunkAsset = 20,
1837
- CompilationProcessAssets = 21,
1838
- CompilationAfterProcessAssets = 22,
1839
- CompilationSeal = 23,
1840
- CompilationAfterSeal = 24,
1841
- NormalModuleFactoryBeforeResolve = 25,
1842
- NormalModuleFactoryFactorize = 26,
1843
- NormalModuleFactoryResolve = 27,
1844
- NormalModuleFactoryAfterResolve = 28,
1845
- NormalModuleFactoryCreateModule = 29,
1846
- NormalModuleFactoryResolveForScheme = 30,
1847
- ContextModuleFactoryBeforeResolve = 31,
1848
- ContextModuleFactoryAfterResolve = 32,
1849
- JavascriptModulesChunkHash = 33,
1850
- HtmlPluginBeforeAssetTagGeneration = 34,
1851
- HtmlPluginAlterAssetTags = 35,
1852
- HtmlPluginAlterAssetTagGroups = 36,
1853
- HtmlPluginAfterTemplateExecution = 37,
1854
- HtmlPluginBeforeEmit = 38,
1855
- HtmlPluginAfterEmit = 39
1904
+ CompilationRuntimeRequirementInTree = 18,
1905
+ CompilationRuntimeModule = 19,
1906
+ CompilationChunkHash = 20,
1907
+ CompilationChunkAsset = 21,
1908
+ CompilationProcessAssets = 22,
1909
+ CompilationAfterProcessAssets = 23,
1910
+ CompilationSeal = 24,
1911
+ CompilationAfterSeal = 25,
1912
+ NormalModuleFactoryBeforeResolve = 26,
1913
+ NormalModuleFactoryFactorize = 27,
1914
+ NormalModuleFactoryResolve = 28,
1915
+ NormalModuleFactoryAfterResolve = 29,
1916
+ NormalModuleFactoryCreateModule = 30,
1917
+ NormalModuleFactoryResolveForScheme = 31,
1918
+ ContextModuleFactoryBeforeResolve = 32,
1919
+ ContextModuleFactoryAfterResolve = 33,
1920
+ JavascriptModulesChunkHash = 34,
1921
+ HtmlPluginBeforeAssetTagGeneration = 35,
1922
+ HtmlPluginAlterAssetTags = 36,
1923
+ HtmlPluginAlterAssetTagGroups = 37,
1924
+ HtmlPluginAfterTemplateExecution = 38,
1925
+ HtmlPluginBeforeEmit = 39,
1926
+ HtmlPluginAfterEmit = 40
1856
1927
  }
1857
1928
 
1858
1929
  export interface RegisterJsTaps {
@@ -1869,6 +1940,7 @@ export interface RegisterJsTaps {
1869
1940
  registerCompilationSucceedModuleTaps: (stages: Array<number>) => Array<{ function: ((arg: JsModule) => void); stage: number; }>
1870
1941
  registerCompilationExecuteModuleTaps: (stages: Array<number>) => Array<{ function: ((arg: JsExecuteModuleArg) => void); stage: number; }>
1871
1942
  registerCompilationAdditionalTreeRuntimeRequirements: (stages: Array<number>) => Array<{ function: ((arg: JsAdditionalTreeRuntimeRequirementsArg) => JsAdditionalTreeRuntimeRequirementsResult | undefined); stage: number; }>
1943
+ registerCompilationRuntimeRequirementInTree: (stages: Array<number>) => Array<{ function: ((arg: JsRuntimeRequirementInTreeArg) => JsRuntimeRequirementInTreeResult | undefined); stage: number; }>
1872
1944
  registerCompilationRuntimeModuleTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRuntimeModuleArg) => JsRuntimeModule | undefined); stage: number; }>
1873
1945
  registerCompilationFinishModulesTaps: (stages: Array<number>) => Array<{ function: ((arg: JsCompilation) => Promise<void>); stage: number; }>
1874
1946
  registerCompilationOptimizeModulesTaps: (stages: Array<number>) => Array<{ function: (() => boolean | undefined); stage: number; }>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/binding",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
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.5",
28
- "@rspack/binding-linux-arm64-musl": "1.0.5",
29
- "@rspack/binding-linux-arm64-gnu": "1.0.5",
30
- "@rspack/binding-win32-ia32-msvc": "1.0.5",
31
- "@rspack/binding-darwin-x64": "1.0.5",
32
- "@rspack/binding-win32-arm64-msvc": "1.0.5",
33
- "@rspack/binding-win32-x64-msvc": "1.0.5",
34
- "@rspack/binding-linux-x64-musl": "1.0.5",
35
- "@rspack/binding-linux-x64-gnu": "1.0.5"
27
+ "@rspack/binding-darwin-arm64": "1.0.7",
28
+ "@rspack/binding-win32-arm64-msvc": "1.0.7",
29
+ "@rspack/binding-linux-arm64-musl": "1.0.7",
30
+ "@rspack/binding-win32-ia32-msvc": "1.0.7",
31
+ "@rspack/binding-linux-arm64-gnu": "1.0.7",
32
+ "@rspack/binding-darwin-x64": "1.0.7",
33
+ "@rspack/binding-win32-x64-msvc": "1.0.7",
34
+ "@rspack/binding-linux-x64-musl": "1.0.7",
35
+ "@rspack/binding-linux-x64-gnu": "1.0.7"
36
36
  },
37
37
  "scripts": {
38
38
  "build:debug": "node scripts/build.js",