@rspack/binding 1.3.10 → 1.3.12

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 +142 -31
  2. package/package.json +13 -14
package/binding.d.ts CHANGED
@@ -65,11 +65,19 @@ export declare class ExternalObject<T> {
65
65
  [K: symbol]: T
66
66
  }
67
67
  }
68
+ export declare class Assets {
69
+ keys(): Array<string>
70
+ }
71
+
68
72
  export declare class AsyncDependenciesBlock {
69
73
  get dependencies(): Dependency[]
70
74
  get blocks(): AsyncDependenciesBlock[]
71
75
  }
72
76
 
77
+ export declare class BuildInfo {
78
+ get _assets(): Assets
79
+ }
80
+
73
81
  export declare class Chunks {
74
82
  get size(): number
75
83
  _values(): JsChunk[]
@@ -116,6 +124,14 @@ export declare class Dependency {
116
124
  get ids(): Array<string> | undefined
117
125
  }
118
126
 
127
+ export declare class Diagnostics {
128
+ get length(): number
129
+ values(): Array<JsRspackError>
130
+ get(index: number): JsRspackError | undefined
131
+ set(index: number, error: JsRspackError): void
132
+ spliceWithArray(index: number, deleteCount?: number | undefined | null, newItems?: Array<JsRspackError> | undefined | null): Array<JsRspackError>
133
+ }
134
+
119
135
  export declare class EntryDataDto {
120
136
  get dependencies(): Dependency[]
121
137
  get includeDependencies(): Dependency[]
@@ -237,16 +253,17 @@ export declare class JsCompilation {
237
253
  get hash(): string | null
238
254
  dependencies(): JsDependencies
239
255
  pushDiagnostic(diagnostic: JsRspackDiagnostic): void
240
- spliceDiagnostic(start: number, end: number, replaceWith: Array<JsRspackDiagnostic>): void
241
256
  pushNativeDiagnostic(diagnostic: ExternalObject<'Diagnostic'>): void
242
257
  pushNativeDiagnostics(diagnostics: ExternalObject<'Diagnostic[]'>): void
258
+ get errors(): Diagnostics
259
+ get warnings(): Diagnostics
243
260
  getErrors(): Array<JsRspackError>
244
261
  getWarnings(): Array<JsRspackError>
245
262
  getStats(): JsStats
246
- getAssetPath(filename: JsFilename, data: JsPathData): string
247
- getAssetPathWithInfo(filename: JsFilename, data: JsPathData): PathWithInfo
248
- getPath(filename: JsFilename, data: JsPathData): string
249
- getPathWithInfo(filename: JsFilename, data: JsPathData): PathWithInfo
263
+ getAssetPath(filename: string, data: JsPathData): string
264
+ getAssetPathWithInfo(filename: string, data: JsPathData): PathWithInfo
265
+ getPath(filename: string, data: JsPathData): string
266
+ getPathWithInfo(filename: string, data: JsPathData): PathWithInfo
250
267
  addFileDependencies(deps: Array<string>): void
251
268
  addContextDependencies(deps: Array<string>): void
252
269
  addMissingDependencies(deps: Array<string>): void
@@ -257,7 +274,7 @@ export declare class JsCompilation {
257
274
  * Using async and mutable reference to `Compilation` at the same time would likely to cause data races.
258
275
  */
259
276
  rebuildModule(moduleIdentifiers: Array<string>, f: any): void
260
- importModule(request: string, layer: string | undefined | null, publicPath: JsFilename | undefined | null, baseUri: string | undefined | null, originalModule: string | undefined | null, originalModuleContext: string | undefined | null, callback: any): void
277
+ importModule(request: string, layer: string | undefined | null, publicPath: JsFilename | undefined | null, baseUri: string | undefined | null, originalModule: string, originalModuleContext: string | undefined | null, callback: any): void
261
278
  get entries(): JsEntries
262
279
  addRuntimeModule(chunk: JsChunk, runtimeModule: JsAddingRuntimeModule): void
263
280
  get moduleGraph(): JsModuleGraph
@@ -476,11 +493,13 @@ export declare enum BuiltinPluginName {
476
493
  CssExtractRspackPlugin = 'CssExtractRspackPlugin',
477
494
  SubresourceIntegrityPlugin = 'SubresourceIntegrityPlugin',
478
495
  RsdoctorPlugin = 'RsdoctorPlugin',
496
+ RstestPlugin = 'RstestPlugin',
479
497
  CircularDependencyRspackPlugin = 'CircularDependencyRspackPlugin',
480
498
  JsLoaderRspackPlugin = 'JsLoaderRspackPlugin',
481
499
  LazyCompilationPlugin = 'LazyCompilationPlugin',
482
500
  ModuleInfoHeaderPlugin = 'ModuleInfoHeaderPlugin',
483
- HttpUriPlugin = 'HttpUriPlugin'
501
+ HttpUriPlugin = 'HttpUriPlugin',
502
+ CssChunkingPlugin = 'CssChunkingPlugin'
484
503
  }
485
504
 
486
505
  export declare function cleanupGlobalTrace(): void
@@ -490,6 +509,11 @@ export interface ContextInfo {
490
509
  issuerLayer?: string
491
510
  }
492
511
 
512
+ export interface CssChunkingPluginOptions {
513
+ strict?: boolean
514
+ exclude?: RegExp
515
+ }
516
+
493
517
  export declare function formatDiagnostic(diagnostic: JsDiagnostic): ExternalObject<'Diagnostic'>
494
518
 
495
519
  export interface JsAddingRuntimeModule {
@@ -851,7 +875,11 @@ export interface JsLoaderContext {
851
875
  loaderIndex: number
852
876
  loaderState: Readonly<JsLoaderState>
853
877
  __internal__error?: JsRspackError
854
- __internal__tracingCarrier?: Record<string, string>
878
+ /**
879
+ * UTF-8 hint for `content`
880
+ * - Some(true): `content` is a `UTF-8` encoded sequence
881
+ */
882
+ __internal__utf8Hint?: boolean
855
883
  }
856
884
 
857
885
  export interface JsLoaderItem {
@@ -1601,20 +1629,93 @@ export interface RawContextReplacementPluginOptions {
1601
1629
  }
1602
1630
 
1603
1631
  export interface RawCopyGlobOptions {
1632
+ /**
1633
+ * Whether the match is case sensitive
1634
+ * @default true
1635
+ */
1604
1636
  caseSensitiveMatch?: boolean
1637
+ /**
1638
+ * Whether to match files starting with `.`
1639
+ * @default true
1640
+ */
1605
1641
  dot?: boolean
1642
+ /**
1643
+ * An array of strings in glob format, which can be used to ignore specific paths
1644
+ * @default undefined
1645
+ */
1606
1646
  ignore?: Array<string>
1607
1647
  }
1608
1648
 
1609
1649
  export interface RawCopyPattern {
1650
+ /**
1651
+ * The source path of the copy operation, which can be an absolute path, a relative
1652
+ * path, or a glob pattern. It can refer to a file or a directory. If a relative path
1653
+ * is passed, it is relative to the `context` option.
1654
+ * @default undefined
1655
+ */
1610
1656
  from: string
1657
+ /**
1658
+ * The destination path of the copy operation, which can be an absolute path, a
1659
+ * relative path, or a template string. If not specified, it is equal to Rspack's
1660
+ * `output.path`.
1661
+ * @default Rspack's `output.path`
1662
+ */
1611
1663
  to?: string | ((pathData: { context: string; absoluteFilename?: string }) => string | Promise<string>)
1664
+ /**
1665
+ * `context` is a path to be prepended to `from` and removed from the start of the
1666
+ * result paths. `context` can be an absolute path or a relative path. If it is a
1667
+ * relative path, then it will be converted to an absolute path based on Rspack's
1668
+ * `context`.
1669
+ * `context` should be explicitly set only when `from` contains a glob. Otherwise,
1670
+ * `context` is automatically set based on whether `from` is a file or a directory:
1671
+ * - If `from` is a file, then `context` is its directory. The result path will be
1672
+ * the filename alone.
1673
+ * - If `from` is a directory, then `context` equals `from`. The result paths will
1674
+ * be the paths of the directory's contents (including nested contents), relative
1675
+ * to the directory.
1676
+ * @default Rspack's `context`
1677
+ */
1612
1678
  context?: string
1679
+ /**
1680
+ * Specify the type of [to](#to), which can be a directory, a file, or a template
1681
+ * name in Rspack. If not specified, it will be automatically inferred.
1682
+ * The automatic inference rules are as follows:
1683
+ * - `dir`: If `to` has no extension, or ends on `/`.
1684
+ * - `file`: If `to` is not a directory and is not a template.
1685
+ * - `template`: If `to` contains a template pattern.
1686
+ * @default undefined
1687
+ */
1613
1688
  toType?: string
1689
+ /**
1690
+ * Whether to ignore the error if there are missing files or directories.
1691
+ * @default false
1692
+ */
1614
1693
  noErrorOnMissing: boolean
1694
+ /**
1695
+ * Whether to force the copy operation to overwrite the destination file if it
1696
+ * already exists.
1697
+ * @default false
1698
+ */
1615
1699
  force: boolean
1700
+ /**
1701
+ * The priority of the copy operation. The higher the priority, the earlier the copy
1702
+ * operation will be executed. When `force` is set to `true`, if a matching file is
1703
+ * found, the one with higher priority will overwrite the one with lower priority.
1704
+ * @default 0
1705
+ */
1616
1706
  priority: number
1707
+ /**
1708
+ * Set the glob options for the copy operation.
1709
+ * @default undefined
1710
+ */
1617
1711
  globOptions: RawCopyGlobOptions
1712
+ /**
1713
+ * Allows to add some assets info to the copied files, which may affect some behaviors
1714
+ * in the build process. For example, by default, the copied JS and CSS files will be
1715
+ * minified by Rspack's minimizer, if you want to skip minification for copied files,
1716
+ * you can set `info.minimized` to `true`.
1717
+ * @default undefined
1718
+ */
1618
1719
  info?: RawInfo
1619
1720
  /**
1620
1721
  * Determines whether to copy file permissions from the source to the destination.
@@ -1623,10 +1724,15 @@ export interface RawCopyPattern {
1623
1724
  * @default false
1624
1725
  */
1625
1726
  copyPermissions?: boolean
1626
- transform?: { transformer: (input: string, absoluteFilename: string) => string | Buffer | Promise<string> | Promise<Buffer> } | ((input: Buffer, absoluteFilename: string) => string | Buffer | Promise<string> | Promise<Buffer>)
1727
+ /**
1728
+ * Allows to modify the file contents.
1729
+ * @default undefined
1730
+ */
1731
+ transform?: { transformer: (input: Buffer, absoluteFilename: string) => string | Buffer | Promise<string> | Promise<Buffer> } | ((input: Buffer, absoluteFilename: string) => string | Buffer | Promise<string> | Promise<Buffer>)
1627
1732
  }
1628
1733
 
1629
1734
  export interface RawCopyRspackPluginOptions {
1735
+ /** An array of objects that describe the copy operations to be performed. */
1630
1736
  patterns: Array<RawCopyPattern>
1631
1737
  }
1632
1738
 
@@ -1907,6 +2013,10 @@ export interface RawIncremental {
1907
2013
 
1908
2014
  export interface RawInfo {
1909
2015
  immutable?: boolean
2016
+ /**
2017
+ * Whether to skip minification for the copied files.
2018
+ * @default false
2019
+ */
1910
2020
  minimized?: boolean
1911
2021
  chunkHash?: Array<string>
1912
2022
  contentHash?: Array<string>
@@ -2322,6 +2432,10 @@ export interface RawRspackFuture {
2322
2432
 
2323
2433
  }
2324
2434
 
2435
+ export interface RawRstestPluginOptions {
2436
+ injectModulePathName: boolean
2437
+ }
2438
+
2325
2439
  export interface RawRuleSetCondition {
2326
2440
  type: RawRuleSetConditionType
2327
2441
  string?: string
@@ -2360,24 +2474,6 @@ export interface RawSizeLimitsPluginOptions {
2360
2474
  maxEntrypointSize?: number
2361
2475
  }
2362
2476
 
2363
- export interface RawSourceMapDevToolPluginOptions {
2364
- append?: (false | null) | string | Function
2365
- columns?: boolean
2366
- fallbackModuleFilenameTemplate?: string | ((info: RawModuleFilenameTemplateFnCtx) => string)
2367
- fileContext?: string
2368
- filename?: (false | null) | string
2369
- module?: boolean
2370
- moduleFilenameTemplate?: string | ((info: RawModuleFilenameTemplateFnCtx) => string)
2371
- namespace?: string
2372
- noSources?: boolean
2373
- publicPath?: string
2374
- sourceRoot?: string
2375
- test?: string | RegExp | (string | RegExp)[]
2376
- include?: string | RegExp | (string | RegExp)[]
2377
- exclude?: string | RegExp | (string | RegExp)[]
2378
- debugIds?: boolean
2379
- }
2380
-
2381
2477
  export interface RawSplitChunkSizes {
2382
2478
  sizes: Record<string, number>
2383
2479
  }
@@ -2441,10 +2537,6 @@ export interface RawToOptions {
2441
2537
  absoluteFilename?: string
2442
2538
  }
2443
2539
 
2444
- export interface RawTransformOptions {
2445
- transformer: { transformer: (input: string, absoluteFilename: string) => string | Buffer | Promise<string> | Promise<Buffer> }
2446
- }
2447
-
2448
2540
  export interface RawTrustedTypes {
2449
2541
  policyName?: string
2450
2542
  onPolicyCreationFailure?: string
@@ -2571,6 +2663,24 @@ export interface RegisterJsTaps {
2571
2663
  */
2572
2664
  export declare function shutdownAsyncRuntime(): void
2573
2665
 
2666
+ export interface SourceMapDevToolPluginOptions {
2667
+ append?: (false | null) | string | Function
2668
+ columns?: boolean
2669
+ fallbackModuleFilenameTemplate?: string | ((info: RawModuleFilenameTemplateFnCtx) => string)
2670
+ fileContext?: string
2671
+ filename?: (false | null) | string
2672
+ module?: boolean
2673
+ moduleFilenameTemplate?: string | ((info: RawModuleFilenameTemplateFnCtx) => string)
2674
+ namespace?: string
2675
+ noSources?: boolean
2676
+ publicPath?: string
2677
+ sourceRoot?: string
2678
+ test?: string | RegExp | (string | RegExp)[]
2679
+ include?: string | RegExp | (string | RegExp)[]
2680
+ exclude?: string | RegExp | (string | RegExp)[]
2681
+ debugIds?: boolean
2682
+ }
2683
+
2574
2684
  /**
2575
2685
  * Start the async runtime manually.
2576
2686
  *
@@ -2604,4 +2714,5 @@ export declare function transform(source: string, options: string): Promise<Tran
2604
2714
  export interface TransformOutput {
2605
2715
  code: string
2606
2716
  map?: string
2717
+ diagnostics: Array<string>
2607
2718
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/binding",
3
- "version": "1.3.10",
3
+ "version": "1.3.12",
4
4
  "license": "MIT",
5
5
  "description": "Node binding for rspack",
6
6
  "main": "binding.js",
@@ -17,8 +17,8 @@
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.78",
21
- "@napi-rs/wasm-runtime": "^0.2.9",
20
+ "@napi-rs/cli": "3.0.0-alpha.80",
21
+ "@napi-rs/wasm-runtime": "^0.2.10",
22
22
  "emnapi": "^1.4.3",
23
23
  "typescript": "^5.8.3",
24
24
  "@emnapi/core": "^1.4.3"
@@ -37,8 +37,7 @@
37
37
  "aarch64-unknown-linux-gnu",
38
38
  "aarch64-apple-darwin",
39
39
  "aarch64-unknown-linux-musl",
40
- "aarch64-pc-windows-msvc",
41
- "wasm32-wasip1-threads"
40
+ "aarch64-pc-windows-msvc"
42
41
  ],
43
42
  "wasm": {
44
43
  "initialMemory": 16384,
@@ -48,15 +47,15 @@
48
47
  }
49
48
  },
50
49
  "optionalDependencies": {
51
- "@rspack/binding-darwin-arm64": "1.3.10",
52
- "@rspack/binding-win32-arm64-msvc": "1.3.10",
53
- "@rspack/binding-linux-arm64-gnu": "1.3.10",
54
- "@rspack/binding-win32-ia32-msvc": "1.3.10",
55
- "@rspack/binding-darwin-x64": "1.3.10",
56
- "@rspack/binding-win32-x64-msvc": "1.3.10",
57
- "@rspack/binding-linux-arm64-musl": "1.3.10",
58
- "@rspack/binding-linux-x64-gnu": "1.3.10",
59
- "@rspack/binding-linux-x64-musl": "1.3.10"
50
+ "@rspack/binding-darwin-arm64": "1.3.12",
51
+ "@rspack/binding-win32-arm64-msvc": "1.3.12",
52
+ "@rspack/binding-linux-arm64-gnu": "1.3.12",
53
+ "@rspack/binding-linux-arm64-musl": "1.3.12",
54
+ "@rspack/binding-darwin-x64": "1.3.12",
55
+ "@rspack/binding-win32-ia32-msvc": "1.3.12",
56
+ "@rspack/binding-win32-x64-msvc": "1.3.12",
57
+ "@rspack/binding-linux-x64-gnu": "1.3.12",
58
+ "@rspack/binding-linux-x64-musl": "1.3.12"
60
59
  },
61
60
  "scripts": {
62
61
  "build:dev": "node scripts/build.js",