@rspack-debug/binding 1.3.14 → 1.4.0-rc.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[]
@@ -660,7 +679,7 @@ export interface JsChunkAssetArgs {
660
679
  export interface JsChunkGroupOrigin {
661
680
  module?: Module | undefined
662
681
  request?: string
663
- loc?: string | JsRealDependencyLocation
682
+ loc?: string | RealDependencyLocation
664
683
  }
665
684
 
666
685
  export interface JsChunkOptionNameCtx {
@@ -940,11 +959,6 @@ export interface JsPathDataChunkLike {
940
959
  id?: string
941
960
  }
942
961
 
943
- export interface JsRealDependencyLocation {
944
- start: JsSourcePosition
945
- end?: JsSourcePosition
946
- }
947
-
948
962
  export interface JsResolveArgs {
949
963
  request: string
950
964
  context: string
@@ -1048,6 +1062,7 @@ export interface JsRsdoctorModule {
1048
1062
  belongModules: Array<number>
1049
1063
  chunks: Array<number>
1050
1064
  issuerPath: Array<number>
1065
+ bailoutReason: Array<string>
1051
1066
  }
1052
1067
 
1053
1068
  export interface JsRsdoctorModuleGraph {
@@ -1131,7 +1146,7 @@ export interface JsRspackError {
1131
1146
  name: string
1132
1147
  message: string
1133
1148
  moduleIdentifier?: string
1134
- loc?: string
1149
+ loc?: DependencyLocation
1135
1150
  file?: string
1136
1151
  stack?: string
1137
1152
  hideStack?: boolean
@@ -1168,11 +1183,6 @@ export interface JsRuntimeRequirementInTreeResult {
1168
1183
  allRuntimeRequirements: JsRuntimeGlobals
1169
1184
  }
1170
1185
 
1171
- export interface JsSourcePosition {
1172
- line: number
1173
- column: number
1174
- }
1175
-
1176
1186
  export interface JsStatsAsset {
1177
1187
  type: string
1178
1188
  name: string
@@ -1472,6 +1482,8 @@ export declare function loadBrowserslist(input: string | undefined | null, conte
1472
1482
 
1473
1483
  export declare function minify(source: string, options: string): Promise<TransformOutput>
1474
1484
 
1485
+ export declare function minifySync(source: string, options: string): TransformOutput
1486
+
1475
1487
  export interface NodeFsStats {
1476
1488
  isFile: boolean
1477
1489
  isDirectory: boolean
@@ -1875,6 +1887,8 @@ incremental?: false | { [key: string]: boolean }
1875
1887
  parallelCodeSplitting: boolean
1876
1888
  rspackFuture?: RawRspackFuture
1877
1889
  cache: boolean | { type: "persistent" } & RawExperimentCacheOptionsPersistent | { type: "memory" }
1890
+ useInputFileSystem?: false | Array<RegExp>
1891
+ inlineConst: boolean
1878
1892
  }
1879
1893
 
1880
1894
  export interface RawExperimentSnapshotOptions {
@@ -2084,6 +2098,16 @@ export interface RawJavascriptParserOptions {
2084
2098
  * @experimental
2085
2099
  */
2086
2100
  importDynamic?: boolean
2101
+ /**
2102
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2103
+ * @experimental
2104
+ */
2105
+ inlineConst?: boolean
2106
+ /**
2107
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2108
+ * @experimental
2109
+ */
2110
+ typeReexportsPresence?: string
2087
2111
  }
2088
2112
 
2089
2113
  export interface RawJsonGeneratorOptions {
@@ -2447,6 +2471,9 @@ export interface RawRspackFuture {
2447
2471
 
2448
2472
  export interface RawRstestPluginOptions {
2449
2473
  injectModulePathName: boolean
2474
+ importMetaPathName: boolean
2475
+ hoistMockModule: boolean
2476
+ manualMockRoot: string
2450
2477
  }
2451
2478
 
2452
2479
  export interface RawRuleSetCondition {
@@ -2550,11 +2577,27 @@ export interface RawToOptions {
2550
2577
  absoluteFilename?: string
2551
2578
  }
2552
2579
 
2580
+ export interface RawTraceEvent {
2581
+ name: string
2582
+ trackName?: string
2583
+ processName?: string
2584
+ args?: Record<string, string>
2585
+ uuid: number
2586
+ ts: bigint
2587
+ ph: string
2588
+ categories?: Array<string>
2589
+ }
2590
+
2553
2591
  export interface RawTrustedTypes {
2554
2592
  policyName?: string
2555
2593
  onPolicyCreationFailure?: string
2556
2594
  }
2557
2595
 
2596
+ export interface RealDependencyLocation {
2597
+ start: SourcePosition
2598
+ end?: SourcePosition
2599
+ }
2600
+
2558
2601
  /**
2559
2602
  * Some code is modified based on
2560
2603
  * https://github.com/swc-project/swc/blob/d1d0607158ab40463d1b123fed52cc526eba8385/bindings/binding_core_node/src/util.rs#L29-L58
@@ -2562,7 +2605,7 @@ export interface RawTrustedTypes {
2562
2605
  * Author Donny/강동윤
2563
2606
  * Copyright (c)
2564
2607
  */
2565
- export declare function registerGlobalTrace(filter: string, layer: "chrome" | "logger" , output: string): void
2608
+ export declare function registerGlobalTrace(filter: string, layer: "logger" | "perfetto" , output: string): void
2566
2609
 
2567
2610
  export declare enum RegisterJsTapKind {
2568
2611
  CompilerThisCompilation = 0,
@@ -2668,14 +2711,6 @@ export interface RegisterJsTaps {
2668
2711
  registerRsdoctorPluginAssetsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRsdoctorAssetPatch) => Promise<boolean | undefined>); stage: number; }>
2669
2712
  }
2670
2713
 
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
2714
  export interface SourceMapDevToolPluginOptions {
2680
2715
  append?: (false | null) | string | Function
2681
2716
  columns?: boolean
@@ -2694,13 +2729,16 @@ export interface SourceMapDevToolPluginOptions {
2694
2729
  debugIds?: boolean
2695
2730
  }
2696
2731
 
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
2732
+ export interface SourcePosition {
2733
+ line: number
2734
+ column?: number
2735
+ }
2736
+
2737
+ export declare function syncTraceEvent(events: Array<RawTraceEvent>): void
2738
+
2739
+ export interface SyntheticDependencyLocation {
2740
+ name: string
2741
+ }
2704
2742
 
2705
2743
  export interface ThreadsafeNodeFS {
2706
2744
  writeFile: (name: string, content: Buffer) => Promise<void>
@@ -2712,6 +2750,7 @@ export interface ThreadsafeNodeFS {
2712
2750
  readFile: (name: string) => Promise<Buffer | string | void>
2713
2751
  stat: (name: string) => Promise<NodeFsStats | void>
2714
2752
  lstat: (name: string) => Promise<NodeFsStats | void>
2753
+ realpath: (name: string) => Promise<string | void>
2715
2754
  open: (name: string, flags: string) => Promise<number | void>
2716
2755
  rename: (from: string, to: string) => Promise<void>
2717
2756
  close: (fd: number) => Promise<void>
@@ -2729,3 +2768,5 @@ export interface TransformOutput {
2729
2768
  map?: string
2730
2769
  diagnostics: Array<string>
2731
2770
  }
2771
+
2772
+ 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-rc.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-darwin-arm64": "npm:@rspack-debug/binding-darwin-arm64@1.4.0-rc.0",
51
+ "@rspack/binding-win32-arm64-msvc": "npm:@rspack-debug/binding-win32-arm64-msvc@1.4.0-rc.0",
52
+ "@rspack/binding-linux-arm64-gnu": "npm:@rspack-debug/binding-linux-arm64-gnu@1.4.0-rc.0",
53
+ "@rspack/binding-win32-x64-msvc": "npm:@rspack-debug/binding-win32-x64-msvc@1.4.0-rc.0",
54
+ "@rspack/binding-linux-x64-gnu": "npm:@rspack-debug/binding-linux-x64-gnu@1.4.0-rc.0",
55
+ "@rspack/binding-win32-ia32-msvc": "npm:@rspack-debug/binding-win32-ia32-msvc@1.4.0-rc.0",
56
+ "@rspack/binding-darwin-x64": "npm:@rspack-debug/binding-darwin-x64@1.4.0-rc.0",
57
+ "@rspack/binding-linux-arm64-musl": "npm:@rspack-debug/binding-linux-arm64-musl@1.4.0-rc.0",
58
+ "@rspack/binding-linux-x64-musl": "npm:@rspack-debug/binding-linux-x64-musl@1.4.0-rc.0"
59
59
  },
60
60
  "scripts": {
61
61
  "build:dev": "node scripts/build.js",