@rspack/binding 1.3.11 → 1.3.13

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 (3) hide show
  1. package/README.md +2 -2
  2. package/binding.d.ts +103 -7
  3. package/package.json +14 -15
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <picture>
2
- <img alt="Rspack Banner" src="https://assets.rspack.dev/rspack/rspack-banner.png">
2
+ <img alt="Rspack Banner" src="https://assets.rspack.rs/rspack/rspack-banner.png">
3
3
  </picture>
4
4
 
5
5
  # @rspack/binding
@@ -9,7 +9,7 @@ Private node binding crate for rspack.
9
9
 
10
10
  ## Documentation
11
11
 
12
- See [https://rspack.dev](https://rspack.dev) for details.
12
+ See [https://rspack.rs](https://rspack.rs) for details.
13
13
 
14
14
  ## License
15
15
 
package/binding.d.ts CHANGED
@@ -40,8 +40,8 @@ export interface NormalModule extends Module {
40
40
  readonly request: string;
41
41
  readonly userRequest: string;
42
42
  readonly rawRequest: string;
43
- readonly resourceResolveData: JsResourceData | undefined;
44
- readonly loaders: ReadonlyArray<JsLoaderItem>;
43
+ readonly resourceResolveData: Readonly<JsResourceData> | undefined;
44
+ readonly loaders: JsLoaderItem[];
45
45
  get matchResource(): string | undefined;
46
46
  set matchResource(val: string | undefined);
47
47
  }
@@ -253,10 +253,10 @@ export declare class JsCompilation {
253
253
  get hash(): string | null
254
254
  dependencies(): JsDependencies
255
255
  pushDiagnostic(diagnostic: JsRspackDiagnostic): void
256
- spliceDiagnostic(start: number, end: number, replaceWith: Array<JsRspackDiagnostic>): void
257
256
  pushNativeDiagnostic(diagnostic: ExternalObject<'Diagnostic'>): void
258
257
  pushNativeDiagnostics(diagnostics: ExternalObject<'Diagnostic[]'>): void
259
258
  get errors(): Diagnostics
259
+ get warnings(): Diagnostics
260
260
  getErrors(): Array<JsRspackError>
261
261
  getWarnings(): Array<JsRspackError>
262
262
  getStats(): JsStats
@@ -274,7 +274,7 @@ export declare class JsCompilation {
274
274
  * Using async and mutable reference to `Compilation` at the same time would likely to cause data races.
275
275
  */
276
276
  rebuildModule(moduleIdentifiers: Array<string>, f: any): void
277
- 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
278
278
  get entries(): JsEntries
279
279
  addRuntimeModule(chunk: JsChunk, runtimeModule: JsAddingRuntimeModule): void
280
280
  get moduleGraph(): JsModuleGraph
@@ -369,6 +369,7 @@ export declare class JsModuleGraph {
369
369
 
370
370
  export declare class JsResolver {
371
371
  resolveSync(path: string, request: string): JsResourceData | false
372
+ resolve(path: string, request: string, callback: (err: null | Error, req?: JsResourceData) => void): void
372
373
  withOptions(raw?: RawResolveOptionsWithDependencyType | undefined | null): JsResolver
373
374
  }
374
375
 
@@ -405,6 +406,11 @@ export declare class RawExternalItemFnCtx {
405
406
  getResolver(): JsResolver
406
407
  }
407
408
 
409
+ export declare class ReadonlyResourceData {
410
+ get descriptionFileData(): any
411
+ get descriptionFilePath(): string
412
+ }
413
+
408
414
  export declare class Sources {
409
415
  _get(sourceType: string): JsCompatSourceOwned | null
410
416
  }
@@ -493,6 +499,7 @@ export declare enum BuiltinPluginName {
493
499
  CssExtractRspackPlugin = 'CssExtractRspackPlugin',
494
500
  SubresourceIntegrityPlugin = 'SubresourceIntegrityPlugin',
495
501
  RsdoctorPlugin = 'RsdoctorPlugin',
502
+ RstestPlugin = 'RstestPlugin',
496
503
  CircularDependencyRspackPlugin = 'CircularDependencyRspackPlugin',
497
504
  JsLoaderRspackPlugin = 'JsLoaderRspackPlugin',
498
505
  LazyCompilationPlugin = 'LazyCompilationPlugin',
@@ -855,9 +862,7 @@ export interface JsLinkPreloadData {
855
862
  }
856
863
 
857
864
  export interface JsLoaderContext {
858
- resourceData: Readonly<JsResourceData>
859
- /** Will be deprecated. Use module.module_identifier instead */
860
- _moduleIdentifier: Readonly<string>
865
+ resource: string
861
866
  _module: Module
862
867
  hot: Readonly<boolean>
863
868
  /** Content maybe empty in pitching stage */
@@ -1268,6 +1273,7 @@ export interface JsStatsError {
1268
1273
  moduleDescriptor?: JsModuleDescriptor
1269
1274
  message: string
1270
1275
  chunkName?: string
1276
+ code?: string
1271
1277
  chunkEntry?: boolean
1272
1278
  chunkInitial?: boolean
1273
1279
  loc?: string
@@ -1407,6 +1413,7 @@ export interface JsStatsWarning {
1407
1413
  name?: string
1408
1414
  message: string
1409
1415
  chunkName?: string
1416
+ code?: string
1410
1417
  chunkEntry?: boolean
1411
1418
  chunkInitial?: boolean
1412
1419
  file?: string
@@ -1456,6 +1463,8 @@ export interface KnownAssetInfo {
1456
1463
  isOverSizeLimit?: boolean
1457
1464
  }
1458
1465
 
1466
+ export declare function loadBrowserslist(input: string | undefined | null, context: string): Array<string> | null
1467
+
1459
1468
  export declare function minify(source: string, options: string): Promise<TransformOutput>
1460
1469
 
1461
1470
  export interface NodeFsStats {
@@ -1628,20 +1637,93 @@ export interface RawContextReplacementPluginOptions {
1628
1637
  }
1629
1638
 
1630
1639
  export interface RawCopyGlobOptions {
1640
+ /**
1641
+ * Whether the match is case sensitive
1642
+ * @default true
1643
+ */
1631
1644
  caseSensitiveMatch?: boolean
1645
+ /**
1646
+ * Whether to match files starting with `.`
1647
+ * @default true
1648
+ */
1632
1649
  dot?: boolean
1650
+ /**
1651
+ * An array of strings in glob format, which can be used to ignore specific paths
1652
+ * @default undefined
1653
+ */
1633
1654
  ignore?: Array<string>
1634
1655
  }
1635
1656
 
1636
1657
  export interface RawCopyPattern {
1658
+ /**
1659
+ * The source path of the copy operation, which can be an absolute path, a relative
1660
+ * path, or a glob pattern. It can refer to a file or a directory. If a relative path
1661
+ * is passed, it is relative to the `context` option.
1662
+ * @default undefined
1663
+ */
1637
1664
  from: string
1665
+ /**
1666
+ * The destination path of the copy operation, which can be an absolute path, a
1667
+ * relative path, or a template string. If not specified, it is equal to Rspack's
1668
+ * `output.path`.
1669
+ * @default Rspack's `output.path`
1670
+ */
1638
1671
  to?: string | ((pathData: { context: string; absoluteFilename?: string }) => string | Promise<string>)
1672
+ /**
1673
+ * `context` is a path to be prepended to `from` and removed from the start of the
1674
+ * result paths. `context` can be an absolute path or a relative path. If it is a
1675
+ * relative path, then it will be converted to an absolute path based on Rspack's
1676
+ * `context`.
1677
+ * `context` should be explicitly set only when `from` contains a glob. Otherwise,
1678
+ * `context` is automatically set based on whether `from` is a file or a directory:
1679
+ * - If `from` is a file, then `context` is its directory. The result path will be
1680
+ * the filename alone.
1681
+ * - If `from` is a directory, then `context` equals `from`. The result paths will
1682
+ * be the paths of the directory's contents (including nested contents), relative
1683
+ * to the directory.
1684
+ * @default Rspack's `context`
1685
+ */
1639
1686
  context?: string
1687
+ /**
1688
+ * Specify the type of [to](#to), which can be a directory, a file, or a template
1689
+ * name in Rspack. If not specified, it will be automatically inferred.
1690
+ * The automatic inference rules are as follows:
1691
+ * - `dir`: If `to` has no extension, or ends on `/`.
1692
+ * - `file`: If `to` is not a directory and is not a template.
1693
+ * - `template`: If `to` contains a template pattern.
1694
+ * @default undefined
1695
+ */
1640
1696
  toType?: string
1697
+ /**
1698
+ * Whether to ignore the error if there are missing files or directories.
1699
+ * @default false
1700
+ */
1641
1701
  noErrorOnMissing: boolean
1702
+ /**
1703
+ * Whether to force the copy operation to overwrite the destination file if it
1704
+ * already exists.
1705
+ * @default false
1706
+ */
1642
1707
  force: boolean
1708
+ /**
1709
+ * The priority of the copy operation. The higher the priority, the earlier the copy
1710
+ * operation will be executed. When `force` is set to `true`, if a matching file is
1711
+ * found, the one with higher priority will overwrite the one with lower priority.
1712
+ * @default 0
1713
+ */
1643
1714
  priority: number
1715
+ /**
1716
+ * Set the glob options for the copy operation.
1717
+ * @default undefined
1718
+ */
1644
1719
  globOptions: RawCopyGlobOptions
1720
+ /**
1721
+ * Allows to add some assets info to the copied files, which may affect some behaviors
1722
+ * in the build process. For example, by default, the copied JS and CSS files will be
1723
+ * minified by Rspack's minimizer, if you want to skip minification for copied files,
1724
+ * you can set `info.minimized` to `true`.
1725
+ * @default undefined
1726
+ */
1645
1727
  info?: RawInfo
1646
1728
  /**
1647
1729
  * Determines whether to copy file permissions from the source to the destination.
@@ -1650,10 +1732,15 @@ export interface RawCopyPattern {
1650
1732
  * @default false
1651
1733
  */
1652
1734
  copyPermissions?: boolean
1735
+ /**
1736
+ * Allows to modify the file contents.
1737
+ * @default undefined
1738
+ */
1653
1739
  transform?: { transformer: (input: Buffer, absoluteFilename: string) => string | Buffer | Promise<string> | Promise<Buffer> } | ((input: Buffer, absoluteFilename: string) => string | Buffer | Promise<string> | Promise<Buffer>)
1654
1740
  }
1655
1741
 
1656
1742
  export interface RawCopyRspackPluginOptions {
1743
+ /** An array of objects that describe the copy operations to be performed. */
1657
1744
  patterns: Array<RawCopyPattern>
1658
1745
  }
1659
1746
 
@@ -1934,6 +2021,10 @@ export interface RawIncremental {
1934
2021
 
1935
2022
  export interface RawInfo {
1936
2023
  immutable?: boolean
2024
+ /**
2025
+ * Whether to skip minification for the copied files.
2026
+ * @default false
2027
+ */
1937
2028
  minimized?: boolean
1938
2029
  chunkHash?: Array<string>
1939
2030
  contentHash?: Array<string>
@@ -2349,6 +2440,10 @@ export interface RawRspackFuture {
2349
2440
 
2350
2441
  }
2351
2442
 
2443
+ export interface RawRstestPluginOptions {
2444
+ injectModulePathName: boolean
2445
+ }
2446
+
2352
2447
  export interface RawRuleSetCondition {
2353
2448
  type: RawRuleSetConditionType
2354
2449
  string?: string
@@ -2627,4 +2722,5 @@ export declare function transform(source: string, options: string): Promise<Tran
2627
2722
  export interface TransformOutput {
2628
2723
  code: string
2629
2724
  map?: string
2725
+ diagnostics: Array<string>
2630
2726
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/binding",
3
- "version": "1.3.11",
3
+ "version": "1.3.13",
4
4
  "license": "MIT",
5
5
  "description": "Node binding for rspack",
6
6
  "main": "binding.js",
@@ -13,12 +13,12 @@
13
13
  "binding.js",
14
14
  "binding.d.ts"
15
15
  ],
16
- "homepage": "https://rspack.dev",
16
+ "homepage": "https://rspack.rs",
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.11",
52
- "@rspack/binding-linux-arm64-gnu": "1.3.11",
53
- "@rspack/binding-win32-arm64-msvc": "1.3.11",
54
- "@rspack/binding-darwin-x64": "1.3.11",
55
- "@rspack/binding-linux-arm64-musl": "1.3.11",
56
- "@rspack/binding-win32-ia32-msvc": "1.3.11",
57
- "@rspack/binding-win32-x64-msvc": "1.3.11",
58
- "@rspack/binding-linux-x64-gnu": "1.3.11",
59
- "@rspack/binding-linux-x64-musl": "1.3.11"
50
+ "@rspack/binding-darwin-arm64": "1.3.13",
51
+ "@rspack/binding-win32-arm64-msvc": "1.3.13",
52
+ "@rspack/binding-linux-arm64-gnu": "1.3.13",
53
+ "@rspack/binding-win32-ia32-msvc": "1.3.13",
54
+ "@rspack/binding-linux-arm64-musl": "1.3.13",
55
+ "@rspack/binding-darwin-x64": "1.3.13",
56
+ "@rspack/binding-win32-x64-msvc": "1.3.13",
57
+ "@rspack/binding-linux-x64-gnu": "1.3.13",
58
+ "@rspack/binding-linux-x64-musl": "1.3.13"
60
59
  },
61
60
  "scripts": {
62
61
  "build:dev": "node scripts/build.js",