@rspack/binding 1.0.5 → 1.0.6

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 +126 -65
  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
@@ -1345,20 +1403,20 @@ export interface RawInfo {
1345
1403
  }
1346
1404
 
1347
1405
  export interface RawJavascriptParserOptions {
1348
- dynamicImportMode: string
1349
- dynamicImportPreload: string
1350
- dynamicImportPrefetch: string
1406
+ dynamicImportMode?: string
1407
+ dynamicImportPreload?: string
1408
+ dynamicImportPrefetch?: string
1351
1409
  dynamicImportFetchPriority?: string
1352
- url: string
1353
- exprContextCritical: boolean
1354
- wrappedContextCritical: boolean
1410
+ url?: string
1411
+ exprContextCritical?: boolean
1412
+ wrappedContextCritical?: boolean
1355
1413
  exportsPresence?: string
1356
1414
  importExportsPresence?: string
1357
1415
  reexportExportsPresence?: string
1358
- strictExportPresence: boolean
1359
- worker: Array<string>
1416
+ strictExportPresence?: boolean
1417
+ worker?: Array<string>
1360
1418
  overrideStrict?: string
1361
- importMeta: boolean
1419
+ importMeta?: boolean
1362
1420
  }
1363
1421
 
1364
1422
  export interface RawLazyCompilationOption {
@@ -1599,11 +1657,12 @@ export interface RawPathData {
1599
1657
  }
1600
1658
 
1601
1659
  export interface RawProgressPluginOptions {
1602
- prefix: string
1603
- profile: boolean
1604
- template: string
1660
+ prefix?: string
1661
+ profile?: boolean
1662
+ template?: string
1605
1663
  tick?: string | Array<string>
1606
- progressChars: string
1664
+ progressChars?: string
1665
+ handler?: (percent: number, msg: string, items: string[]) => void
1607
1666
  }
1608
1667
 
1609
1668
  export interface RawProvideOptions {
@@ -1831,28 +1890,29 @@ export enum RegisterJsTapKind {
1831
1890
  CompilationOptimizeTree = 15,
1832
1891
  CompilationOptimizeChunkModules = 16,
1833
1892
  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
1893
+ CompilationRuntimeRequirementInTree = 18,
1894
+ CompilationRuntimeModule = 19,
1895
+ CompilationChunkHash = 20,
1896
+ CompilationChunkAsset = 21,
1897
+ CompilationProcessAssets = 22,
1898
+ CompilationAfterProcessAssets = 23,
1899
+ CompilationSeal = 24,
1900
+ CompilationAfterSeal = 25,
1901
+ NormalModuleFactoryBeforeResolve = 26,
1902
+ NormalModuleFactoryFactorize = 27,
1903
+ NormalModuleFactoryResolve = 28,
1904
+ NormalModuleFactoryAfterResolve = 29,
1905
+ NormalModuleFactoryCreateModule = 30,
1906
+ NormalModuleFactoryResolveForScheme = 31,
1907
+ ContextModuleFactoryBeforeResolve = 32,
1908
+ ContextModuleFactoryAfterResolve = 33,
1909
+ JavascriptModulesChunkHash = 34,
1910
+ HtmlPluginBeforeAssetTagGeneration = 35,
1911
+ HtmlPluginAlterAssetTags = 36,
1912
+ HtmlPluginAlterAssetTagGroups = 37,
1913
+ HtmlPluginAfterTemplateExecution = 38,
1914
+ HtmlPluginBeforeEmit = 39,
1915
+ HtmlPluginAfterEmit = 40
1856
1916
  }
1857
1917
 
1858
1918
  export interface RegisterJsTaps {
@@ -1869,6 +1929,7 @@ export interface RegisterJsTaps {
1869
1929
  registerCompilationSucceedModuleTaps: (stages: Array<number>) => Array<{ function: ((arg: JsModule) => void); stage: number; }>
1870
1930
  registerCompilationExecuteModuleTaps: (stages: Array<number>) => Array<{ function: ((arg: JsExecuteModuleArg) => void); stage: number; }>
1871
1931
  registerCompilationAdditionalTreeRuntimeRequirements: (stages: Array<number>) => Array<{ function: ((arg: JsAdditionalTreeRuntimeRequirementsArg) => JsAdditionalTreeRuntimeRequirementsResult | undefined); stage: number; }>
1932
+ registerCompilationRuntimeRequirementInTree: (stages: Array<number>) => Array<{ function: ((arg: JsRuntimeRequirementInTreeArg) => JsRuntimeRequirementInTreeResult | undefined); stage: number; }>
1872
1933
  registerCompilationRuntimeModuleTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRuntimeModuleArg) => JsRuntimeModule | undefined); stage: number; }>
1873
1934
  registerCompilationFinishModulesTaps: (stages: Array<number>) => Array<{ function: ((arg: JsCompilation) => Promise<void>); stage: number; }>
1874
1935
  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.6",
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.6",
28
+ "@rspack/binding-win32-arm64-msvc": "1.0.6",
29
+ "@rspack/binding-win32-ia32-msvc": "1.0.6",
30
+ "@rspack/binding-linux-arm64-musl": "1.0.6",
31
+ "@rspack/binding-darwin-x64": "1.0.6",
32
+ "@rspack/binding-linux-x64-musl": "1.0.6",
33
+ "@rspack/binding-linux-x64-gnu": "1.0.6",
34
+ "@rspack/binding-win32-x64-msvc": "1.0.6",
35
+ "@rspack/binding-linux-arm64-gnu": "1.0.6"
36
36
  },
37
37
  "scripts": {
38
38
  "build:debug": "node scripts/build.js",