@rspack/binding 1.0.4 → 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 +127 -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 {
@@ -599,6 +635,7 @@ export interface JsLoaderContext {
599
635
  /** Content maybe empty in pitching stage */
600
636
  content: null | Buffer
601
637
  additionalData?: any
638
+ __internal__parseMeta: Record<string, string>
602
639
  sourceMap?: Buffer
603
640
  cacheable: boolean
604
641
  fileDependencies: Array<string>
@@ -689,6 +726,11 @@ export interface JsResourceData {
689
726
  fragment?: string
690
727
  }
691
728
 
729
+ export interface JsRspackDiagnostic {
730
+ severity: JsRspackSeverity
731
+ error: JsRspackError
732
+ }
733
+
692
734
  export interface JsRspackError {
693
735
  name: string
694
736
  message: string
@@ -720,6 +762,15 @@ export interface JsRuntimeModuleArg {
720
762
  chunk: JsChunk
721
763
  }
722
764
 
765
+ export interface JsRuntimeRequirementInTreeArg {
766
+ chunk: JsChunk
767
+ runtimeRequirements: JsRuntimeGlobals
768
+ }
769
+
770
+ export interface JsRuntimeRequirementInTreeResult {
771
+ runtimeRequirements: JsRuntimeGlobals
772
+ }
773
+
723
774
  export interface JsStatsAsset {
724
775
  type: string
725
776
  name: string
@@ -735,11 +786,11 @@ export interface JsStatsAsset {
735
786
  }
736
787
 
737
788
  export interface JsStatsAssetInfo {
738
- minimized: boolean
739
- development: boolean
740
- hotModuleReplacement: boolean
789
+ minimized?: boolean
790
+ development?: boolean
791
+ hotModuleReplacement?: boolean
741
792
  sourceFilename?: string
742
- immutable: boolean
793
+ immutable?: boolean
743
794
  javascriptModule?: boolean
744
795
  chunkhash: Array<string>
745
796
  contenthash: Array<string>
@@ -1125,6 +1176,14 @@ export interface RawContainerReferencePluginOptions {
1125
1176
  enhanced: boolean
1126
1177
  }
1127
1178
 
1179
+ export interface RawContextReplacementPluginOptions {
1180
+ resourceRegExp: RawRegex
1181
+ newContentResource?: string
1182
+ newContentRecursive?: boolean
1183
+ newContentRegExp?: RawRegex
1184
+ newContentCreateContextMap?: Record<string, string>
1185
+ }
1186
+
1128
1187
  export interface RawCopyGlobOptions {
1129
1188
  caseSensitiveMatch?: boolean
1130
1189
  dot?: boolean
@@ -1344,20 +1403,20 @@ export interface RawInfo {
1344
1403
  }
1345
1404
 
1346
1405
  export interface RawJavascriptParserOptions {
1347
- dynamicImportMode: string
1348
- dynamicImportPreload: string
1349
- dynamicImportPrefetch: string
1406
+ dynamicImportMode?: string
1407
+ dynamicImportPreload?: string
1408
+ dynamicImportPrefetch?: string
1350
1409
  dynamicImportFetchPriority?: string
1351
- url: string
1352
- exprContextCritical: boolean
1353
- wrappedContextCritical: boolean
1410
+ url?: string
1411
+ exprContextCritical?: boolean
1412
+ wrappedContextCritical?: boolean
1354
1413
  exportsPresence?: string
1355
1414
  importExportsPresence?: string
1356
1415
  reexportExportsPresence?: string
1357
- strictExportPresence: boolean
1358
- worker: Array<string>
1416
+ strictExportPresence?: boolean
1417
+ worker?: Array<string>
1359
1418
  overrideStrict?: string
1360
- importMeta: boolean
1419
+ importMeta?: boolean
1361
1420
  }
1362
1421
 
1363
1422
  export interface RawLazyCompilationOption {
@@ -1598,11 +1657,12 @@ export interface RawPathData {
1598
1657
  }
1599
1658
 
1600
1659
  export interface RawProgressPluginOptions {
1601
- prefix: string
1602
- profile: boolean
1603
- template: string
1660
+ prefix?: string
1661
+ profile?: boolean
1662
+ template?: string
1604
1663
  tick?: string | Array<string>
1605
- progressChars: string
1664
+ progressChars?: string
1665
+ handler?: (percent: number, msg: string, items: string[]) => void
1606
1666
  }
1607
1667
 
1608
1668
  export interface RawProvideOptions {
@@ -1830,28 +1890,29 @@ export enum RegisterJsTapKind {
1830
1890
  CompilationOptimizeTree = 15,
1831
1891
  CompilationOptimizeChunkModules = 16,
1832
1892
  CompilationAdditionalTreeRuntimeRequirements = 17,
1833
- CompilationRuntimeModule = 18,
1834
- CompilationChunkHash = 19,
1835
- CompilationChunkAsset = 20,
1836
- CompilationProcessAssets = 21,
1837
- CompilationAfterProcessAssets = 22,
1838
- CompilationSeal = 23,
1839
- CompilationAfterSeal = 24,
1840
- NormalModuleFactoryBeforeResolve = 25,
1841
- NormalModuleFactoryFactorize = 26,
1842
- NormalModuleFactoryResolve = 27,
1843
- NormalModuleFactoryAfterResolve = 28,
1844
- NormalModuleFactoryCreateModule = 29,
1845
- NormalModuleFactoryResolveForScheme = 30,
1846
- ContextModuleFactoryBeforeResolve = 31,
1847
- ContextModuleFactoryAfterResolve = 32,
1848
- JavascriptModulesChunkHash = 33,
1849
- HtmlPluginBeforeAssetTagGeneration = 34,
1850
- HtmlPluginAlterAssetTags = 35,
1851
- HtmlPluginAlterAssetTagGroups = 36,
1852
- HtmlPluginAfterTemplateExecution = 37,
1853
- HtmlPluginBeforeEmit = 38,
1854
- 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
1855
1916
  }
1856
1917
 
1857
1918
  export interface RegisterJsTaps {
@@ -1868,6 +1929,7 @@ export interface RegisterJsTaps {
1868
1929
  registerCompilationSucceedModuleTaps: (stages: Array<number>) => Array<{ function: ((arg: JsModule) => void); stage: number; }>
1869
1930
  registerCompilationExecuteModuleTaps: (stages: Array<number>) => Array<{ function: ((arg: JsExecuteModuleArg) => void); stage: number; }>
1870
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; }>
1871
1933
  registerCompilationRuntimeModuleTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRuntimeModuleArg) => JsRuntimeModule | undefined); stage: number; }>
1872
1934
  registerCompilationFinishModulesTaps: (stages: Array<number>) => Array<{ function: ((arg: JsCompilation) => Promise<void>); stage: number; }>
1873
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.4",
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.4",
28
- "@rspack/binding-win32-arm64-msvc": "1.0.4",
29
- "@rspack/binding-linux-arm64-musl": "1.0.4",
30
- "@rspack/binding-linux-arm64-gnu": "1.0.4",
31
- "@rspack/binding-win32-ia32-msvc": "1.0.4",
32
- "@rspack/binding-darwin-x64": "1.0.4",
33
- "@rspack/binding-win32-x64-msvc": "1.0.4",
34
- "@rspack/binding-linux-x64-musl": "1.0.4",
35
- "@rspack/binding-linux-x64-gnu": "1.0.4"
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",