@rspack-debug/binding 1.3.14 → 1.4.0

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.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <picture>
2
- <img alt="Rspack Banner" src="https://assets.rspack.rs/rspack/rspack-banner.png">
2
+ <img alt="Rspack Banner" src="https://assets.rspack.dev/rspack/rspack-banner.png">
3
3
  </picture>
4
4
 
5
5
  # @rspack/binding
package/binding.d.ts CHANGED
@@ -14,6 +14,24 @@ export const MODULE_IDENTIFIER_SYMBOL: unique symbol;
14
14
 
15
15
  export const COMPILATION_HOOKS_MAP_SYMBOL: unique symbol;
16
16
 
17
+ export const BUILD_INFO_ASSETS_SYMBOL: unique symbol;
18
+ export const BUILD_INFO_FILE_DEPENDENCIES_SYMBOL: unique symbol;
19
+ export const BUILD_INFO_CONTEXT_DEPENDENCIES_SYMBOL: unique symbol;
20
+ export const BUILD_INFO_MISSING_DEPENDENCIES_SYMBOL: unique symbol;
21
+ export const BUILD_INFO_BUILD_DEPENDENCIES_SYMBOL: unique symbol;
22
+ export const COMMIT_CUSTOM_FIELDS_SYMBOL: unique symbol;
23
+
24
+ interface KnownBuildInfo {
25
+ [BUILD_INFO_ASSETS_SYMBOL]: Assets,
26
+ [BUILD_INFO_FILE_DEPENDENCIES_SYMBOL]: string[],
27
+ [BUILD_INFO_CONTEXT_DEPENDENCIES_SYMBOL]: string[],
28
+ [BUILD_INFO_MISSING_DEPENDENCIES_SYMBOL]: string[],
29
+ [BUILD_INFO_BUILD_DEPENDENCIES_SYMBOL]: string[],
30
+ [COMMIT_CUSTOM_FIELDS_SYMBOL](): void;
31
+ }
32
+
33
+ export type BuildInfo = KnownBuildInfo & Record<string, any>;
34
+
17
35
  export interface Module {
18
36
  [MODULE_IDENTIFIER_SYMBOL]: string;
19
37
  readonly type: string;
@@ -23,9 +41,8 @@ export interface Module {
23
41
  set factoryMeta(factoryMeta: JsFactoryMeta);
24
42
  get useSourceMap(): boolean;
25
43
  get useSimpleSourceMap(): boolean;
26
- get _readableIdentifier(): string;
27
- buildInfo: KnownBuildInfo & Record<string, any>;
28
- buildMeta: KnownBuildInfo & Record<string, any>;
44
+ buildInfo: BuildInfo;
45
+ buildMeta: Record<string, any>;
29
46
  }
30
47
 
31
48
  interface NormalModuleConstructor {
@@ -55,6 +72,8 @@ export interface ContextModule extends Module {
55
72
  export interface ExternalModule extends Module {
56
73
  readonly userRequest: string;
57
74
  }
75
+
76
+ export type DependencyLocation = SyntheticDependencyLocation | RealDependencyLocation;
58
77
  /* -- banner.d.ts end -- */
59
78
 
60
79
  /* -- napi-rs generated below -- */
@@ -91,6 +110,7 @@ export declare class CodeGenerationResults {
91
110
  export declare class ConcatenatedModule {
92
111
  get rootModule(): Module
93
112
  get modules(): Module[]
113
+ readableIdentifier(): string
94
114
  _originalSource(): JsCompatSource | undefined
95
115
  nameForCondition(): string | undefined
96
116
  get blocks(): AsyncDependenciesBlock[]
@@ -101,6 +121,7 @@ export declare class ConcatenatedModule {
101
121
  }
102
122
 
103
123
  export declare class ContextModule {
124
+ readableIdentifier(): string
104
125
  _originalSource(): JsCompatSource | undefined
105
126
  nameForCondition(): string | undefined
106
127
  get blocks(): AsyncDependenciesBlock[]
@@ -163,6 +184,7 @@ export declare class EntryOptionsDto {
163
184
  export type EntryOptionsDTO = EntryOptionsDto
164
185
 
165
186
  export declare class ExternalModule {
187
+ readableIdentifier(): string
166
188
  _originalSource(): JsCompatSource | undefined
167
189
  nameForCondition(): string | undefined
168
190
  get blocks(): AsyncDependenciesBlock[]
@@ -281,7 +303,7 @@ export declare class JsCompilation {
281
303
  }
282
304
 
283
305
  export declare class JsCompiler {
284
- constructor(compilerPath: string, options: RawOptions, builtinPlugins: Array<BuiltinPlugin>, registerJsTaps: RegisterJsTaps, outputFilesystem: ThreadsafeNodeFS, intermediateFilesystem: ThreadsafeNodeFS | undefined | null, resolverFactoryReference: JsResolverFactory)
306
+ constructor(compilerPath: string, options: RawOptions, builtinPlugins: Array<BuiltinPlugin>, registerJsTaps: RegisterJsTaps, outputFilesystem: ThreadsafeNodeFS, intermediateFilesystem: ThreadsafeNodeFS | undefined | null, inputFilesystem: ThreadsafeNodeFS | undefined | null, resolverFactoryReference: JsResolverFactory)
285
307
  setNonSkippableRegisters(kinds: Array<RegisterJsTapKind>): void
286
308
  /** Build with the given option passed to the constructor */
287
309
  build(callback: (err: null | Error) => void): void
@@ -380,14 +402,11 @@ export declare class JsStats {
380
402
  }
381
403
 
382
404
  export declare class KnownBuildInfo {
383
- get _assets(): Assets
384
- get _fileDependencies(): Array<string>
385
- get _contextDependencies(): Array<string>
386
- get _missingDependencies(): Array<string>
387
- get _buildDependencies(): Array<string>
405
+
388
406
  }
389
407
 
390
408
  export declare class Module {
409
+ readableIdentifier(): string
391
410
  _originalSource(): JsCompatSource | undefined
392
411
  nameForCondition(): string | undefined
393
412
  get blocks(): AsyncDependenciesBlock[]
@@ -504,6 +523,7 @@ export declare enum BuiltinPluginName {
504
523
  SubresourceIntegrityPlugin = 'SubresourceIntegrityPlugin',
505
524
  RsdoctorPlugin = 'RsdoctorPlugin',
506
525
  RstestPlugin = 'RstestPlugin',
526
+ RslibPlugin = 'RslibPlugin',
507
527
  CircularDependencyRspackPlugin = 'CircularDependencyRspackPlugin',
508
528
  JsLoaderRspackPlugin = 'JsLoaderRspackPlugin',
509
529
  LazyCompilationPlugin = 'LazyCompilationPlugin',
@@ -521,6 +541,8 @@ export interface ContextInfo {
521
541
 
522
542
  export interface CssChunkingPluginOptions {
523
543
  strict?: boolean
544
+ minSize?: number
545
+ maxSize?: number
524
546
  exclude?: RegExp
525
547
  }
526
548
 
@@ -660,7 +682,7 @@ export interface JsChunkAssetArgs {
660
682
  export interface JsChunkGroupOrigin {
661
683
  module?: Module | undefined
662
684
  request?: string
663
- loc?: string | JsRealDependencyLocation
685
+ loc?: string | RealDependencyLocation
664
686
  }
665
687
 
666
688
  export interface JsChunkOptionNameCtx {
@@ -940,11 +962,6 @@ export interface JsPathDataChunkLike {
940
962
  id?: string
941
963
  }
942
964
 
943
- export interface JsRealDependencyLocation {
944
- start: JsSourcePosition
945
- end?: JsSourcePosition
946
- }
947
-
948
965
  export interface JsResolveArgs {
949
966
  request: string
950
967
  context: string
@@ -1048,6 +1065,7 @@ export interface JsRsdoctorModule {
1048
1065
  belongModules: Array<number>
1049
1066
  chunks: Array<number>
1050
1067
  issuerPath: Array<number>
1068
+ bailoutReason: Array<string>
1051
1069
  }
1052
1070
 
1053
1071
  export interface JsRsdoctorModuleGraph {
@@ -1131,7 +1149,7 @@ export interface JsRspackError {
1131
1149
  name: string
1132
1150
  message: string
1133
1151
  moduleIdentifier?: string
1134
- loc?: string
1152
+ loc?: DependencyLocation
1135
1153
  file?: string
1136
1154
  stack?: string
1137
1155
  hideStack?: boolean
@@ -1168,11 +1186,6 @@ export interface JsRuntimeRequirementInTreeResult {
1168
1186
  allRuntimeRequirements: JsRuntimeGlobals
1169
1187
  }
1170
1188
 
1171
- export interface JsSourcePosition {
1172
- line: number
1173
- column: number
1174
- }
1175
-
1176
1189
  export interface JsStatsAsset {
1177
1190
  type: string
1178
1191
  name: string
@@ -1472,6 +1485,8 @@ export declare function loadBrowserslist(input: string | undefined | null, conte
1472
1485
 
1473
1486
  export declare function minify(source: string, options: string): Promise<TransformOutput>
1474
1487
 
1488
+ export declare function minifySync(source: string, options: string): TransformOutput
1489
+
1475
1490
  export interface NodeFsStats {
1476
1491
  isFile: boolean
1477
1492
  isDirectory: boolean
@@ -1875,6 +1890,8 @@ incremental?: false | { [key: string]: boolean }
1875
1890
  parallelCodeSplitting: boolean
1876
1891
  rspackFuture?: RawRspackFuture
1877
1892
  cache: boolean | { type: "persistent" } & RawExperimentCacheOptionsPersistent | { type: "memory" }
1893
+ useInputFileSystem?: false | Array<RegExp>
1894
+ inlineConst: boolean
1878
1895
  }
1879
1896
 
1880
1897
  export interface RawExperimentSnapshotOptions {
@@ -2084,6 +2101,16 @@ export interface RawJavascriptParserOptions {
2084
2101
  * @experimental
2085
2102
  */
2086
2103
  importDynamic?: boolean
2104
+ /**
2105
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2106
+ * @experimental
2107
+ */
2108
+ inlineConst?: boolean
2109
+ /**
2110
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2111
+ * @experimental
2112
+ */
2113
+ typeReexportsPresence?: string
2087
2114
  }
2088
2115
 
2089
2116
  export interface RawJsonGeneratorOptions {
@@ -2441,12 +2468,19 @@ export interface RawRsdoctorPluginOptions {
2441
2468
  chunkGraphFeatures: boolean | Array<'graph' | 'assets'>
2442
2469
  }
2443
2470
 
2471
+ export interface RawRslibPluginOptions {
2472
+ interceptApiPlugin: boolean
2473
+ }
2474
+
2444
2475
  export interface RawRspackFuture {
2445
2476
 
2446
2477
  }
2447
2478
 
2448
2479
  export interface RawRstestPluginOptions {
2449
2480
  injectModulePathName: boolean
2481
+ importMetaPathName: boolean
2482
+ hoistMockModule: boolean
2483
+ manualMockRoot: string
2450
2484
  }
2451
2485
 
2452
2486
  export interface RawRuleSetCondition {
@@ -2550,11 +2584,27 @@ export interface RawToOptions {
2550
2584
  absoluteFilename?: string
2551
2585
  }
2552
2586
 
2587
+ export interface RawTraceEvent {
2588
+ name: string
2589
+ trackName?: string
2590
+ processName?: string
2591
+ args?: Record<string, string>
2592
+ uuid: number
2593
+ ts: bigint
2594
+ ph: string
2595
+ categories?: Array<string>
2596
+ }
2597
+
2553
2598
  export interface RawTrustedTypes {
2554
2599
  policyName?: string
2555
2600
  onPolicyCreationFailure?: string
2556
2601
  }
2557
2602
 
2603
+ export interface RealDependencyLocation {
2604
+ start: SourcePosition
2605
+ end?: SourcePosition
2606
+ }
2607
+
2558
2608
  /**
2559
2609
  * Some code is modified based on
2560
2610
  * https://github.com/swc-project/swc/blob/d1d0607158ab40463d1b123fed52cc526eba8385/bindings/binding_core_node/src/util.rs#L29-L58
@@ -2562,7 +2612,7 @@ export interface RawTrustedTypes {
2562
2612
  * Author Donny/강동윤
2563
2613
  * Copyright (c)
2564
2614
  */
2565
- export declare function registerGlobalTrace(filter: string, layer: "chrome" | "logger" , output: string): void
2615
+ export declare function registerGlobalTrace(filter: string, layer: "logger" | "perfetto" , output: string): void
2566
2616
 
2567
2617
  export declare enum RegisterJsTapKind {
2568
2618
  CompilerThisCompilation = 0,
@@ -2668,14 +2718,6 @@ export interface RegisterJsTaps {
2668
2718
  registerRsdoctorPluginAssetsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRsdoctorAssetPatch) => Promise<boolean | undefined>); stage: number; }>
2669
2719
  }
2670
2720
 
2671
- /**
2672
- * Shutdown the tokio runtime manually.
2673
- *
2674
- * This is required for the wasm target with `tokio_unstable` cfg.
2675
- * In the wasm runtime, the `park` threads will hang there until the tokio::Runtime is shutdown.
2676
- */
2677
- export declare function shutdownAsyncRuntime(): void
2678
-
2679
2721
  export interface SourceMapDevToolPluginOptions {
2680
2722
  append?: (false | null) | string | Function
2681
2723
  columns?: boolean
@@ -2694,13 +2736,16 @@ export interface SourceMapDevToolPluginOptions {
2694
2736
  debugIds?: boolean
2695
2737
  }
2696
2738
 
2697
- /**
2698
- * Start the async runtime manually.
2699
- *
2700
- * This is required when the async runtime is shutdown manually.
2701
- * Usually it's used in test.
2702
- */
2703
- export declare function startAsyncRuntime(): void
2739
+ export interface SourcePosition {
2740
+ line: number
2741
+ column?: number
2742
+ }
2743
+
2744
+ export declare function syncTraceEvent(events: Array<RawTraceEvent>): void
2745
+
2746
+ export interface SyntheticDependencyLocation {
2747
+ name: string
2748
+ }
2704
2749
 
2705
2750
  export interface ThreadsafeNodeFS {
2706
2751
  writeFile: (name: string, content: Buffer) => Promise<void>
@@ -2712,6 +2757,7 @@ export interface ThreadsafeNodeFS {
2712
2757
  readFile: (name: string) => Promise<Buffer | string | void>
2713
2758
  stat: (name: string) => Promise<NodeFsStats | void>
2714
2759
  lstat: (name: string) => Promise<NodeFsStats | void>
2760
+ realpath: (name: string) => Promise<string | void>
2715
2761
  open: (name: string, flags: string) => Promise<number | void>
2716
2762
  rename: (from: string, to: string) => Promise<void>
2717
2763
  close: (fd: number) => Promise<void>
@@ -2729,3 +2775,5 @@ export interface TransformOutput {
2729
2775
  map?: string
2730
2776
  diagnostics: Array<string>
2731
2777
  }
2778
+
2779
+ export declare function transformSync(source: string, options: string): TransformOutput
package/binding.js CHANGED
@@ -1,4 +1,4 @@
1
- const { existsSync, readFileSync } = require('fs')
1
+ const { existsSync } = require('fs')
2
2
  const { join } = require('path')
3
3
 
4
4
  const { platform, arch } = process
@@ -8,18 +8,8 @@ let localFileExisted = false
8
8
  let loadError = null
9
9
 
10
10
  function isMusl() {
11
- // For Node 10
12
- if (!process.report || typeof process.report.getReport !== 'function') {
13
- try {
14
- const lddPath = require('child_process').execSync('which ldd').toString().trim();
15
- return readFileSync(lddPath, 'utf8').includes('musl')
16
- } catch (e) {
17
- return true
18
- }
19
- } else {
20
- const { glibcVersionRuntime } = process.report.getReport().header
21
- return !glibcVersionRuntime
22
- }
11
+ const { glibcVersionRuntime } = process.report.getReport().header
12
+ return !glibcVersionRuntime
23
13
  }
24
14
 
25
15
  switch (platform) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-debug/binding",
3
- "version": "1.3.14",
3
+ "version": "1.4.0",
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.84",
21
- "@napi-rs/wasm-runtime": "^0.2.10",
20
+ "@napi-rs/cli": "3.0.0-alpha.88",
21
+ "@napi-rs/wasm-runtime": "^0.2.11",
22
22
  "emnapi": "^1.4.3",
23
23
  "typescript": "^5.8.3",
24
24
  "@emnapi/core": "^1.4.3"
@@ -47,15 +47,15 @@
47
47
  }
48
48
  },
49
49
  "optionalDependencies": {
50
- "@rspack/binding-win32-arm64-msvc": "npm:@rspack-debug/binding-win32-arm64-msvc@1.3.14",
51
- "@rspack/binding-linux-arm64-musl": "npm:@rspack-debug/binding-linux-arm64-musl@1.3.14",
52
- "@rspack/binding-darwin-arm64": "npm:@rspack-debug/binding-darwin-arm64@1.3.14",
53
- "@rspack/binding-linux-arm64-gnu": "npm:@rspack-debug/binding-linux-arm64-gnu@1.3.14",
54
- "@rspack/binding-win32-ia32-msvc": "npm:@rspack-debug/binding-win32-ia32-msvc@1.3.14",
55
- "@rspack/binding-win32-x64-msvc": "npm:@rspack-debug/binding-win32-x64-msvc@1.3.14",
56
- "@rspack/binding-darwin-x64": "npm:@rspack-debug/binding-darwin-x64@1.3.14",
57
- "@rspack/binding-linux-x64-musl": "npm:@rspack-debug/binding-linux-x64-musl@1.3.14",
58
- "@rspack/binding-linux-x64-gnu": "npm:@rspack-debug/binding-linux-x64-gnu@1.3.14"
50
+ "@rspack/binding-win32-arm64-msvc": "npm:@rspack-debug/binding-win32-arm64-msvc@1.4.0",
51
+ "@rspack/binding-linux-arm64-gnu": "npm:@rspack-debug/binding-linux-arm64-gnu@1.4.0",
52
+ "@rspack/binding-darwin-arm64": "npm:@rspack-debug/binding-darwin-arm64@1.4.0",
53
+ "@rspack/binding-linux-arm64-musl": "npm:@rspack-debug/binding-linux-arm64-musl@1.4.0",
54
+ "@rspack/binding-win32-ia32-msvc": "npm:@rspack-debug/binding-win32-ia32-msvc@1.4.0",
55
+ "@rspack/binding-darwin-x64": "npm:@rspack-debug/binding-darwin-x64@1.4.0",
56
+ "@rspack/binding-win32-x64-msvc": "npm:@rspack-debug/binding-win32-x64-msvc@1.4.0",
57
+ "@rspack/binding-linux-x64-musl": "npm:@rspack-debug/binding-linux-x64-musl@1.4.0",
58
+ "@rspack/binding-linux-x64-gnu": "npm:@rspack-debug/binding-linux-x64-gnu@1.4.0"
59
59
  },
60
60
  "scripts": {
61
61
  "build:dev": "node scripts/build.js",