@rspack/binding 1.3.15 → 1.4.0-beta.1

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 +66 -36
  2. package/package.json +14 -12
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;
@@ -24,8 +42,8 @@ export interface Module {
24
42
  get useSourceMap(): boolean;
25
43
  get useSimpleSourceMap(): boolean;
26
44
  get _readableIdentifier(): string;
27
- buildInfo: KnownBuildInfo & Record<string, any>;
28
- buildMeta: KnownBuildInfo & Record<string, any>;
45
+ buildInfo: BuildInfo;
46
+ buildMeta: Record<string, any>;
29
47
  }
30
48
 
31
49
  interface NormalModuleConstructor {
@@ -55,6 +73,8 @@ export interface ContextModule extends Module {
55
73
  export interface ExternalModule extends Module {
56
74
  readonly userRequest: string;
57
75
  }
76
+
77
+ export type DependencyLocation = SyntheticDependencyLocation | RealDependencyLocation;
58
78
  /* -- banner.d.ts end -- */
59
79
 
60
80
  /* -- napi-rs generated below -- */
@@ -281,7 +301,7 @@ export declare class JsCompilation {
281
301
  }
282
302
 
283
303
  export declare class JsCompiler {
284
- constructor(compilerPath: string, options: RawOptions, builtinPlugins: Array<BuiltinPlugin>, registerJsTaps: RegisterJsTaps, outputFilesystem: ThreadsafeNodeFS, intermediateFilesystem: ThreadsafeNodeFS | undefined | null, resolverFactoryReference: JsResolverFactory)
304
+ constructor(compilerPath: string, options: RawOptions, builtinPlugins: Array<BuiltinPlugin>, registerJsTaps: RegisterJsTaps, outputFilesystem: ThreadsafeNodeFS, intermediateFilesystem: ThreadsafeNodeFS | undefined | null, inputFilesystem: ThreadsafeNodeFS | undefined | null, resolverFactoryReference: JsResolverFactory)
285
305
  setNonSkippableRegisters(kinds: Array<RegisterJsTapKind>): void
286
306
  /** Build with the given option passed to the constructor */
287
307
  build(callback: (err: null | Error) => void): void
@@ -380,11 +400,7 @@ export declare class JsStats {
380
400
  }
381
401
 
382
402
  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>
403
+
388
404
  }
389
405
 
390
406
  export declare class Module {
@@ -660,7 +676,7 @@ export interface JsChunkAssetArgs {
660
676
  export interface JsChunkGroupOrigin {
661
677
  module?: Module | undefined
662
678
  request?: string
663
- loc?: string | JsRealDependencyLocation
679
+ loc?: string | RealDependencyLocation
664
680
  }
665
681
 
666
682
  export interface JsChunkOptionNameCtx {
@@ -940,11 +956,6 @@ export interface JsPathDataChunkLike {
940
956
  id?: string
941
957
  }
942
958
 
943
- export interface JsRealDependencyLocation {
944
- start: JsSourcePosition
945
- end?: JsSourcePosition
946
- }
947
-
948
959
  export interface JsResolveArgs {
949
960
  request: string
950
961
  context: string
@@ -1048,6 +1059,7 @@ export interface JsRsdoctorModule {
1048
1059
  belongModules: Array<number>
1049
1060
  chunks: Array<number>
1050
1061
  issuerPath: Array<number>
1062
+ bailoutReason: Array<string>
1051
1063
  }
1052
1064
 
1053
1065
  export interface JsRsdoctorModuleGraph {
@@ -1131,7 +1143,7 @@ export interface JsRspackError {
1131
1143
  name: string
1132
1144
  message: string
1133
1145
  moduleIdentifier?: string
1134
- loc?: string
1146
+ loc?: DependencyLocation
1135
1147
  file?: string
1136
1148
  stack?: string
1137
1149
  hideStack?: boolean
@@ -1168,11 +1180,6 @@ export interface JsRuntimeRequirementInTreeResult {
1168
1180
  allRuntimeRequirements: JsRuntimeGlobals
1169
1181
  }
1170
1182
 
1171
- export interface JsSourcePosition {
1172
- line: number
1173
- column: number
1174
- }
1175
-
1176
1183
  export interface JsStatsAsset {
1177
1184
  type: string
1178
1185
  name: string
@@ -1472,6 +1479,8 @@ export declare function loadBrowserslist(input: string | undefined | null, conte
1472
1479
 
1473
1480
  export declare function minify(source: string, options: string): Promise<TransformOutput>
1474
1481
 
1482
+ export declare function minifySync(source: string, options: string): TransformOutput
1483
+
1475
1484
  export interface NodeFsStats {
1476
1485
  isFile: boolean
1477
1486
  isDirectory: boolean
@@ -1875,6 +1884,8 @@ incremental?: false | { [key: string]: boolean }
1875
1884
  parallelCodeSplitting: boolean
1876
1885
  rspackFuture?: RawRspackFuture
1877
1886
  cache: boolean | { type: "persistent" } & RawExperimentCacheOptionsPersistent | { type: "memory" }
1887
+ useInputFileSystem?: false | Array<RegExp>
1888
+ inlineConst: boolean
1878
1889
  }
1879
1890
 
1880
1891
  export interface RawExperimentSnapshotOptions {
@@ -2084,6 +2095,11 @@ export interface RawJavascriptParserOptions {
2084
2095
  * @experimental
2085
2096
  */
2086
2097
  importDynamic?: boolean
2098
+ /**
2099
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2100
+ * @experimental
2101
+ */
2102
+ inlineConst?: boolean
2087
2103
  }
2088
2104
 
2089
2105
  export interface RawJsonGeneratorOptions {
@@ -2550,11 +2566,27 @@ export interface RawToOptions {
2550
2566
  absoluteFilename?: string
2551
2567
  }
2552
2568
 
2569
+ export interface RawTraceEvent {
2570
+ name: string
2571
+ trackName?: string
2572
+ processName?: string
2573
+ args?: Record<string, string>
2574
+ uuid: number
2575
+ ts: bigint
2576
+ ph: string
2577
+ categories?: Array<string>
2578
+ }
2579
+
2553
2580
  export interface RawTrustedTypes {
2554
2581
  policyName?: string
2555
2582
  onPolicyCreationFailure?: string
2556
2583
  }
2557
2584
 
2585
+ export interface RealDependencyLocation {
2586
+ start: SourcePosition
2587
+ end?: SourcePosition
2588
+ }
2589
+
2558
2590
  /**
2559
2591
  * Some code is modified based on
2560
2592
  * https://github.com/swc-project/swc/blob/d1d0607158ab40463d1b123fed52cc526eba8385/bindings/binding_core_node/src/util.rs#L29-L58
@@ -2562,7 +2594,7 @@ export interface RawTrustedTypes {
2562
2594
  * Author Donny/강동윤
2563
2595
  * Copyright (c)
2564
2596
  */
2565
- export declare function registerGlobalTrace(filter: string, layer: "chrome" | "logger" , output: string): void
2597
+ export declare function registerGlobalTrace(filter: string, layer: "logger" | "perfetto" , output: string): void
2566
2598
 
2567
2599
  export declare enum RegisterJsTapKind {
2568
2600
  CompilerThisCompilation = 0,
@@ -2668,14 +2700,6 @@ export interface RegisterJsTaps {
2668
2700
  registerRsdoctorPluginAssetsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsRsdoctorAssetPatch) => Promise<boolean | undefined>); stage: number; }>
2669
2701
  }
2670
2702
 
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
2703
  export interface SourceMapDevToolPluginOptions {
2680
2704
  append?: (false | null) | string | Function
2681
2705
  columns?: boolean
@@ -2694,13 +2718,16 @@ export interface SourceMapDevToolPluginOptions {
2694
2718
  debugIds?: boolean
2695
2719
  }
2696
2720
 
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
2721
+ export interface SourcePosition {
2722
+ line: number
2723
+ column?: number
2724
+ }
2725
+
2726
+ export declare function syncTraceEvent(events: Array<RawTraceEvent>): void
2727
+
2728
+ export interface SyntheticDependencyLocation {
2729
+ name: string
2730
+ }
2704
2731
 
2705
2732
  export interface ThreadsafeNodeFS {
2706
2733
  writeFile: (name: string, content: Buffer) => Promise<void>
@@ -2712,6 +2739,7 @@ export interface ThreadsafeNodeFS {
2712
2739
  readFile: (name: string) => Promise<Buffer | string | void>
2713
2740
  stat: (name: string) => Promise<NodeFsStats | void>
2714
2741
  lstat: (name: string) => Promise<NodeFsStats | void>
2742
+ realpath: (name: string) => Promise<string | void>
2715
2743
  open: (name: string, flags: string) => Promise<number | void>
2716
2744
  rename: (from: string, to: string) => Promise<void>
2717
2745
  close: (fd: number) => Promise<void>
@@ -2729,3 +2757,5 @@ export interface TransformOutput {
2729
2757
  map?: string
2730
2758
  diagnostics: Array<string>
2731
2759
  }
2760
+
2761
+ export declare function transformSync(source: string, options: string): TransformOutput
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/binding",
3
- "version": "1.3.15",
3
+ "version": "1.4.0-beta.1",
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,18 +47,20 @@
47
47
  }
48
48
  },
49
49
  "optionalDependencies": {
50
- "@rspack/binding-darwin-arm64": "1.3.15",
51
- "@rspack/binding-win32-arm64-msvc": "1.3.15",
52
- "@rspack/binding-linux-arm64-musl": "1.3.15",
53
- "@rspack/binding-linux-arm64-gnu": "1.3.15",
54
- "@rspack/binding-win32-ia32-msvc": "1.3.15",
55
- "@rspack/binding-darwin-x64": "1.3.15",
56
- "@rspack/binding-win32-x64-msvc": "1.3.15",
57
- "@rspack/binding-linux-x64-musl": "1.3.15",
58
- "@rspack/binding-linux-x64-gnu": "1.3.15"
50
+ "@rspack/binding-darwin-arm64": "1.4.0-beta.1",
51
+ "@rspack/binding-win32-arm64-msvc": "1.4.0-beta.1",
52
+ "@rspack/binding-linux-arm64-musl": "1.4.0-beta.1",
53
+ "@rspack/binding-linux-arm64-gnu": "1.4.0-beta.1",
54
+ "@rspack/binding-win32-ia32-msvc": "1.4.0-beta.1",
55
+ "@rspack/binding-win32-x64-msvc": "1.4.0-beta.1",
56
+ "@rspack/binding-linux-x64-gnu": "1.4.0-beta.1",
57
+ "@rspack/binding-wasm32-wasi": "1.4.0-beta.1",
58
+ "@rspack/binding-darwin-x64": "1.4.0-beta.1",
59
+ "@rspack/binding-linux-x64-musl": "1.4.0-beta.1"
59
60
  },
60
61
  "scripts": {
61
62
  "build:dev": "node scripts/build.js",
63
+ "build:debug": "node scripts/build.js --profile release-debug",
62
64
  "build:ci": "node scripts/build.js --profile ci",
63
65
  "build:profiling": "node scripts/build.js --profile profiling",
64
66
  "build:release": "node scripts/build.js --profile release",