@rspack/binding 2.0.0-canary.20260120 → 2.0.0-rc.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 (3) hide show
  1. package/README.md +4 -0
  2. package/napi-binding.d.ts +251 -84
  3. package/package.json +23 -19
package/README.md CHANGED
@@ -12,6 +12,10 @@ Private node binding crate for rspack.
12
12
 
13
13
  See [https://rspack.rs](https://rspack.rs) for details.
14
14
 
15
+ ## Update Wasm binding
16
+
17
+ The generation of `rspack.wasi-browser.js` and `rspack.wasi.js` is disabled by default because `@napi/cli` produces unstable output for these files. To update the Wasm bindings, add `wasm32-wasip1-threads` to the `napi.targets` field in `package.json` before building the project.
18
+
15
19
  ## License
16
20
 
17
21
  Rspack is [MIT licensed](https://github.com/web-infra-dev/rspack/blob/main/LICENSE).
package/napi-binding.d.ts CHANGED
@@ -25,6 +25,10 @@ export const COMMIT_CUSTOM_FIELDS_SYMBOL: unique symbol;
25
25
 
26
26
  export const RUST_ERROR_SYMBOL: unique symbol;
27
27
 
28
+ export const CIRCULAR_CONNECTION_SYMBOL: unique symbol;
29
+ export const TRANSITIVE_ONLY_SYMBOL: unique symbol;
30
+ export type ConnectionState = boolean | typeof CIRCULAR_CONNECTION_SYMBOL | typeof TRANSITIVE_ONLY_SYMBOL;
31
+
28
32
  interface KnownBuildInfo {
29
33
  [BUILD_INFO_ASSETS_SYMBOL]: Assets,
30
34
  [BUILD_INFO_FILE_DEPENDENCIES_SYMBOL]: string[],
@@ -95,6 +99,8 @@ export interface JsSource {
95
99
  source: string | Buffer
96
100
  map?: string
97
101
  }
102
+
103
+ export type CompilerId = void;
98
104
  /* -- banner.d.ts end -- */
99
105
 
100
106
  /* -- napi-rs generated below -- */
@@ -213,6 +219,7 @@ export declare class Dependency {
213
219
  get critical(): boolean
214
220
  set critical(val: boolean)
215
221
  get ids(): Array<string> | undefined
222
+ get loc(): DependencyLocation | null
216
223
  }
217
224
 
218
225
  export declare class Diagnostics {
@@ -334,6 +341,7 @@ export declare class JsCompiler {
334
341
  rebuild(changed_files: string[], removed_files: string[], callback: (err: null | Error) => void): void
335
342
  close(): Promise<void>
336
343
  getVirtualFileStore(): VirtualFileStore | null
344
+ getCompilerId(): ExternalObject<CompilerId>
337
345
  }
338
346
 
339
347
  export declare class JsContextModuleFactoryAfterResolveData {
@@ -361,6 +369,10 @@ export declare class JsContextModuleFactoryBeforeResolveData {
361
369
  set recursive(recursive: boolean)
362
370
  }
363
371
 
372
+ export declare class JsCoordinator {
373
+ constructor(getServerCompilerIdJsFn: () => ExternalObject<CompilerId>)
374
+ }
375
+
364
376
  export declare class JsDependencies {
365
377
  get fileDependencies(): Array<string>
366
378
  get addedFileDependencies(): Array<string>
@@ -444,6 +456,7 @@ export declare class ModuleGraphConnection {
444
456
  get module(): Module | null
445
457
  get resolvedModule(): Module | null
446
458
  get originModule(): Module | null
459
+ getActiveState(runtime: string | string[] | undefined): ConnectionState
447
460
  }
448
461
 
449
462
  export declare class NativeWatcher {
@@ -522,6 +535,7 @@ export declare enum BuiltinPluginName {
522
535
  DynamicEntryPlugin = 'DynamicEntryPlugin',
523
536
  ExternalsPlugin = 'ExternalsPlugin',
524
537
  NodeTargetPlugin = 'NodeTargetPlugin',
538
+ EsmNodeTargetPlugin = 'EsmNodeTargetPlugin',
525
539
  ElectronTargetPlugin = 'ElectronTargetPlugin',
526
540
  EnableChunkLoadingPlugin = 'EnableChunkLoadingPlugin',
527
541
  EnableLibraryPlugin = 'EnableLibraryPlugin',
@@ -540,15 +554,19 @@ export declare enum BuiltinPluginName {
540
554
  SplitChunksPlugin = 'SplitChunksPlugin',
541
555
  RemoveDuplicateModulesPlugin = 'RemoveDuplicateModulesPlugin',
542
556
  ShareRuntimePlugin = 'ShareRuntimePlugin',
557
+ SharedUsedExportsOptimizerPlugin = 'SharedUsedExportsOptimizerPlugin',
543
558
  ContainerPlugin = 'ContainerPlugin',
544
559
  ContainerReferencePlugin = 'ContainerReferencePlugin',
545
560
  ProvideSharedPlugin = 'ProvideSharedPlugin',
546
561
  ConsumeSharedPlugin = 'ConsumeSharedPlugin',
562
+ CollectSharedEntryPlugin = 'CollectSharedEntryPlugin',
563
+ SharedContainerPlugin = 'SharedContainerPlugin',
547
564
  ModuleFederationRuntimePlugin = 'ModuleFederationRuntimePlugin',
548
565
  ModuleFederationManifestPlugin = 'ModuleFederationManifestPlugin',
549
566
  NamedModuleIdsPlugin = 'NamedModuleIdsPlugin',
550
567
  NaturalModuleIdsPlugin = 'NaturalModuleIdsPlugin',
551
568
  DeterministicModuleIdsPlugin = 'DeterministicModuleIdsPlugin',
569
+ HashedModuleIdsPlugin = 'HashedModuleIdsPlugin',
552
570
  NaturalChunkIdsPlugin = 'NaturalChunkIdsPlugin',
553
571
  NamedChunkIdsPlugin = 'NamedChunkIdsPlugin',
554
572
  DeterministicChunkIdsPlugin = 'DeterministicChunkIdsPlugin',
@@ -602,7 +620,9 @@ export declare enum BuiltinPluginName {
602
620
  LazyCompilationPlugin = 'LazyCompilationPlugin',
603
621
  ModuleInfoHeaderPlugin = 'ModuleInfoHeaderPlugin',
604
622
  HttpUriPlugin = 'HttpUriPlugin',
605
- CssChunkingPlugin = 'CssChunkingPlugin'
623
+ CssChunkingPlugin = 'CssChunkingPlugin',
624
+ RscServerPlugin = 'RscServerPlugin',
625
+ RscClientPlugin = 'RscClientPlugin'
606
626
  }
607
627
 
608
628
  export declare function cleanupGlobalTrace(): void
@@ -707,6 +727,14 @@ export interface JsBeforeEmitData {
707
727
  uid?: number
708
728
  }
709
729
 
730
+ export interface JsBeforeModuleIdsArg {
731
+ modules: Array<JsModuleForIds>
732
+ }
733
+
734
+ export interface JsBeforeModuleIdsResult {
735
+ assignments: Record<string, string>
736
+ }
737
+
710
738
  export interface JsBuildMeta {
711
739
  strictEsmModule?: boolean
712
740
  hasTopLevelAwait?: boolean
@@ -970,6 +998,10 @@ export interface JsModuleDescriptor {
970
998
  id?: string | number | null
971
999
  }
972
1000
 
1001
+ export interface JsModuleForIds {
1002
+ identifier: string
1003
+ }
1004
+
973
1005
  export interface JsNormalModuleFactoryCreateModuleArgs {
974
1006
  dependencyType: string
975
1007
  rawRequest: string
@@ -1028,6 +1060,16 @@ export interface JsResourceData {
1028
1060
  descriptionFilePath?: string
1029
1061
  }
1030
1062
 
1063
+ export interface JsRscClientPluginOptions {
1064
+ coordinator: JsCoordinator
1065
+ }
1066
+
1067
+ export interface JsRscServerPluginOptions {
1068
+ coordinator: JsCoordinator
1069
+ onServerComponentChanges?: (() => void) | undefined | null
1070
+ onManifest?: ((arg: string) => Promise<undefined>) | undefined | null
1071
+ }
1072
+
1031
1073
  export interface JsRsdoctorAsset {
1032
1074
  ukey: number
1033
1075
  path: string
@@ -1065,6 +1107,30 @@ export interface JsRsdoctorChunkModules {
1065
1107
  modules: Array<number>
1066
1108
  }
1067
1109
 
1110
+ export interface JsRsdoctorConnection {
1111
+ ukey: number
1112
+ dependencyId: string
1113
+ module: number
1114
+ originModule?: number
1115
+ resolvedModule: number
1116
+ dependencyType: string
1117
+ userRequest: string
1118
+ loc?: string
1119
+ active: boolean
1120
+ }
1121
+
1122
+ export interface JsRsdoctorConnectionsOnlyImport {
1123
+ moduleUkey: number
1124
+ modulePath: string
1125
+ connections: Array<JsRsdoctorConnectionsOnlyImportConnection>
1126
+ }
1127
+
1128
+ export interface JsRsdoctorConnectionsOnlyImportConnection {
1129
+ originModule?: number
1130
+ dependencyType: string
1131
+ userRequest: string
1132
+ }
1133
+
1068
1134
  export interface JsRsdoctorDependency {
1069
1135
  ukey: number
1070
1136
  kind: string
@@ -1090,7 +1156,11 @@ export interface JsRsdoctorExportInfo {
1090
1156
  from?: number
1091
1157
  variable?: number
1092
1158
  identifier?: JsRsdoctorStatement
1093
- sideEffects: Array<number>
1159
+ }
1160
+
1161
+ export interface JsRsdoctorJsonModuleSize {
1162
+ identifier: string
1163
+ size: number
1094
1164
  }
1095
1165
 
1096
1166
  export interface JsRsdoctorModule {
@@ -1107,12 +1177,15 @@ export interface JsRsdoctorModule {
1107
1177
  chunks: Array<number>
1108
1178
  issuerPath: Array<number>
1109
1179
  bailoutReason: Array<string>
1180
+ sideEffectsLocations: Array<JsRsdoctorSideEffectLocation>
1181
+ exportsType: string
1110
1182
  }
1111
1183
 
1112
1184
  export interface JsRsdoctorModuleGraph {
1113
1185
  modules: Array<JsRsdoctorModule>
1114
1186
  dependencies: Array<JsRsdoctorDependency>
1115
1187
  chunkModules: Array<JsRsdoctorChunkModules>
1188
+ connectionsOnlyImports: Array<JsRsdoctorConnectionsOnlyImport>
1116
1189
  }
1117
1190
 
1118
1191
  export interface JsRsdoctorModuleGraphModule {
@@ -1141,6 +1214,7 @@ export interface JsRsdoctorModuleOriginalSource {
1141
1214
 
1142
1215
  export interface JsRsdoctorModuleSourcesPatch {
1143
1216
  moduleOriginalSources: Array<JsRsdoctorModuleOriginalSource>
1217
+ jsonModuleSizes: Array<JsRsdoctorJsonModuleSize>
1144
1218
  }
1145
1219
 
1146
1220
  export interface JsRsdoctorSideEffect {
@@ -1155,6 +1229,13 @@ export interface JsRsdoctorSideEffect {
1155
1229
  variable?: number
1156
1230
  }
1157
1231
 
1232
+ export interface JsRsdoctorSideEffectLocation {
1233
+ location: string
1234
+ nodeType: string
1235
+ module: number
1236
+ request: string
1237
+ }
1238
+
1158
1239
  export interface JsRsdoctorSourceMapFeatures {
1159
1240
  cheap?: boolean
1160
1241
  module?: boolean
@@ -1832,6 +1913,8 @@ export interface RawCacheOptionsPersistent {
1832
1913
  version?: string
1833
1914
  snapshot?: RawSnapshotOptions
1834
1915
  storage?: RawStorageOptions
1916
+ portable?: boolean
1917
+ readonly?: boolean
1835
1918
  }
1836
1919
 
1837
1920
  export interface RawCircularDependencyRspackPluginOptions {
@@ -1844,6 +1927,11 @@ export interface RawCircularDependencyRspackPluginOptions {
1844
1927
  onEnd?: () => void
1845
1928
  }
1846
1929
 
1930
+ export interface RawCollectShareEntryPluginOptions {
1931
+ consumes: Array<RawConsumeOptions>
1932
+ filename?: string
1933
+ }
1934
+
1847
1935
  export interface RawCompilerPlatform {
1848
1936
  web?: boolean | null
1849
1937
  browser?: boolean | null
@@ -1858,12 +1946,13 @@ export interface RawConsumeOptions {
1858
1946
  import?: string
1859
1947
  importResolved?: string
1860
1948
  shareKey: string
1861
- shareScope: string
1949
+ shareScope: string | Array<string>
1862
1950
  requiredVersion?: string | false | undefined
1863
1951
  packageName?: string
1864
1952
  strictVersion: boolean
1865
1953
  singleton: boolean
1866
1954
  eager: boolean
1955
+ treeShakingMode?: string
1867
1956
  }
1868
1957
 
1869
1958
  export interface RawConsumeSharedPluginOptions {
@@ -1873,7 +1962,7 @@ export interface RawConsumeSharedPluginOptions {
1873
1962
 
1874
1963
  export interface RawContainerPluginOptions {
1875
1964
  name: string
1876
- shareScope: string
1965
+ shareScope: string | Array<string>
1877
1966
  library: JsLibraryOptions
1878
1967
  runtime?: false | string
1879
1968
  filename?: string
@@ -1884,7 +1973,7 @@ export interface RawContainerPluginOptions {
1884
1973
  export interface RawContainerReferencePluginOptions {
1885
1974
  remoteType: string
1886
1975
  remotes: Array<RawRemoteOptions>
1887
- shareScope?: string
1976
+ shareScope?: string | Array<string>
1888
1977
  enhanced: boolean
1889
1978
  }
1890
1979
 
@@ -2014,6 +2103,7 @@ export interface RawCssAutoGeneratorOptions {
2014
2103
  export interface RawCssAutoParserOptions {
2015
2104
  namedExports?: boolean
2016
2105
  url?: boolean
2106
+ resolveImport?: boolean | ((context: { url: string, media: string | undefined, resourcePath: string, supports: string | undefined, layer: string | undefined }) => boolean)
2017
2107
  }
2018
2108
 
2019
2109
  export interface RawCssChunkingPluginOptions {
@@ -2040,6 +2130,14 @@ export interface RawCssGeneratorOptions {
2040
2130
  esModule?: boolean
2041
2131
  }
2042
2132
 
2133
+ export interface RawCssImportContext {
2134
+ url: string
2135
+ media?: string
2136
+ resourcePath: string
2137
+ supports?: string
2138
+ layer?: string
2139
+ }
2140
+
2043
2141
  export interface RawCssModuleGeneratorOptions {
2044
2142
  exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only"
2045
2143
  exportsOnly?: boolean
@@ -2050,11 +2148,13 @@ export interface RawCssModuleGeneratorOptions {
2050
2148
  export interface RawCssModuleParserOptions {
2051
2149
  namedExports?: boolean
2052
2150
  url?: boolean
2151
+ resolveImport?: boolean | ((context: { url: string, media: string | undefined, resourcePath: string, supports: string | undefined, layer: string | undefined }) => boolean)
2053
2152
  }
2054
2153
 
2055
2154
  export interface RawCssParserOptions {
2056
2155
  namedExports?: boolean
2057
2156
  url?: boolean
2157
+ resolveImport?: boolean | ((context: { url: string, media: string | undefined, resourcePath: string, supports: string | undefined, layer: string | undefined }) => boolean)
2058
2158
  }
2059
2159
 
2060
2160
  export interface RawDllEntryPluginOptions {
@@ -2095,6 +2195,12 @@ export interface RawDynamicEntryPluginOptions {
2095
2195
  entry: () => Promise<RawEntryDynamicResult[]>
2096
2196
  }
2097
2197
 
2198
+ export interface RawEnableLibraryPluginOptions {
2199
+ libraryType: string
2200
+ preserveModules?: string
2201
+ splitChunks?: RawSplitChunksOptions
2202
+ }
2203
+
2098
2204
  export interface RawEntryDynamicResult {
2099
2205
  import: Array<string>
2100
2206
  options: JsEntryOptions
@@ -2121,6 +2227,7 @@ export interface RawEnvironment {
2121
2227
 
2122
2228
  export interface RawEsmLibraryPlugin {
2123
2229
  preserveModules?: string
2230
+ splitChunks?: RawSplitChunksOptions
2124
2231
  }
2125
2232
 
2126
2233
  export interface RawEvalDevToolModulePluginOptions {
@@ -2130,10 +2237,10 @@ export interface RawEvalDevToolModulePluginOptions {
2130
2237
  }
2131
2238
 
2132
2239
  export interface RawExperiments {
2133
- incremental?: false | { [key: string]: boolean }
2134
- useInputFileSystem?: false | Array<RegExp>
2135
- css?: boolean
2136
- deferImport: boolean
2240
+ useInputFileSystem?: false | Array<RegExp>
2241
+ css?: boolean
2242
+ deferImport: boolean
2243
+ pureFunctions: boolean
2137
2244
  }
2138
2245
 
2139
2246
  export interface RawExposeOptions {
@@ -2172,6 +2279,7 @@ export interface RawExternalsPresets {
2172
2279
  export interface RawExtractComments {
2173
2280
  banner?: string | boolean
2174
2281
  condition?: string
2282
+ conditionFlags?: string
2175
2283
  }
2176
2284
 
2177
2285
  export interface RawFallbackCacheGroupOptions {
@@ -2207,6 +2315,13 @@ export interface RawGeneratorOptions {
2207
2315
  json?: RawJsonGeneratorOptions
2208
2316
  }
2209
2317
 
2318
+ export interface RawHashedModuleIdsPluginOptions {
2319
+ context?: string
2320
+ hashFunction?: string
2321
+ hashDigest?: string
2322
+ hashDigestLength?: number
2323
+ }
2324
+
2210
2325
  export interface RawHtmlRspackPluginBaseOptions {
2211
2326
  href?: string
2212
2327
  target?: "_self" | "_blank" | "_parent" | "_top"
@@ -2260,12 +2375,11 @@ export interface RawIgnorePluginOptions {
2260
2375
 
2261
2376
  export interface RawIncremental {
2262
2377
  silent: boolean
2263
- make: boolean
2264
- inferAsyncModules: boolean
2265
- providedExports: boolean
2266
- dependenciesDiagnostics: boolean
2267
- sideEffects: boolean
2378
+ buildModuleGraph: boolean
2379
+ finishModules: boolean
2380
+ optimizeDependencies: boolean
2268
2381
  buildChunkGraph: boolean
2382
+ optimizeChunkModules: boolean
2269
2383
  moduleIds: boolean
2270
2384
  chunkIds: boolean
2271
2385
  modulesHashes: boolean
@@ -2273,7 +2387,7 @@ export interface RawIncremental {
2273
2387
  modulesRuntimeRequirements: boolean
2274
2388
  chunksRuntimeRequirements: boolean
2275
2389
  chunksHashes: boolean
2276
- chunksRender: boolean
2390
+ chunkAsset: boolean
2277
2391
  emitAssets: boolean
2278
2392
  }
2279
2393
 
@@ -2318,41 +2432,42 @@ export interface RawJavascriptParserOptions {
2318
2432
  exprContextCritical?: boolean
2319
2433
  unknownContextCritical?: boolean
2320
2434
  wrappedContextCritical?: boolean
2435
+ strictThisContextOnImports?: boolean
2321
2436
  wrappedContextRegExp?: RegExp
2322
2437
  exportsPresence?: string
2323
2438
  importExportsPresence?: string
2324
2439
  reexportExportsPresence?: string
2325
- strictExportPresence?: boolean
2326
2440
  worker?: Array<string>
2327
2441
  overrideStrict?: string
2328
- importMeta?: boolean
2329
- /**
2330
- * This option is experimental in Rspack only and subject to change or be removed anytime.
2331
- * @experimental
2332
- */
2333
- requireAlias?: boolean
2334
- /**
2335
- * This option is experimental in Rspack only and subject to change or be removed anytime.
2336
- * @experimental
2337
- */
2338
- requireAsExpression?: boolean
2339
- /**
2340
- * This option is experimental in Rspack only and subject to change or be removed anytime.
2341
- * @experimental
2342
- */
2343
- requireDynamic?: boolean
2344
- /**
2345
- * This option is experimental in Rspack only and subject to change or be removed anytime.
2346
- * @experimental
2347
- */
2348
- requireResolve?: boolean
2442
+ importMeta?: string
2443
+ commonjsMagicComments?: boolean
2349
2444
  commonjs?: boolean | { exports?: boolean | 'skipInEsm' }
2445
+ deferImport?: boolean
2446
+ /**
2447
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2448
+ * @experimental
2449
+ */
2450
+ requireAlias?: boolean
2451
+ /**
2452
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2453
+ * @experimental
2454
+ */
2455
+ requireAsExpression?: boolean
2456
+ /**
2457
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2458
+ * @experimental
2459
+ */
2460
+ requireDynamic?: boolean
2461
+ /**
2462
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2463
+ * @experimental
2464
+ */
2465
+ requireResolve?: boolean
2350
2466
  /**
2351
2467
  * This option is experimental in Rspack only and subject to change or be removed anytime.
2352
2468
  * @experimental
2353
2469
  */
2354
2470
  importDynamic?: boolean
2355
- commonjsMagicComments?: boolean
2356
2471
  /**
2357
2472
  * This option is experimental in Rspack only and subject to change or be removed anytime.
2358
2473
  * @experimental
@@ -2363,7 +2478,17 @@ typeReexportsPresence?: string
2363
2478
  * @experimental
2364
2479
  */
2365
2480
  jsx?: boolean
2366
- deferImport?: boolean
2481
+ /**
2482
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2483
+ * @experimental
2484
+ */
2485
+ importMetaResolve?: boolean
2486
+ /**
2487
+ * Flag top-level exported functions as side-effect-free for pure-function-based tree shaking.
2488
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2489
+ * @experimental
2490
+ */
2491
+ pureFunctions?: Array<string>
2367
2492
  }
2368
2493
 
2369
2494
  export interface RawJsonGeneratorOptions {
@@ -2463,8 +2588,13 @@ export interface RawModuleFederationManifestPluginOptions {
2463
2588
  buildInfo?: RawStatsBuildInfo
2464
2589
  }
2465
2590
 
2591
+ export interface RawModuleFederationRuntimeExperimentsOptions {
2592
+ asyncStartup?: boolean
2593
+ }
2594
+
2466
2595
  export interface RawModuleFederationRuntimePluginOptions {
2467
2596
  entryRuntime?: string | undefined
2597
+ experiments?: RawModuleFederationRuntimeExperimentsOptions
2468
2598
  }
2469
2599
 
2470
2600
  export interface RawModuleFilenameTemplateFnCtx {
@@ -2492,7 +2622,6 @@ export interface RawModuleOptions {
2492
2622
  parser?: Record<string, RawParserOptions>
2493
2623
  generator?: Record<string, RawGeneratorOptions>
2494
2624
  noParse?: string | RegExp | ((request: string) => boolean) | (string | RegExp | ((request: string) => boolean))[]
2495
- unsafeCache?: boolean | RegExp
2496
2625
  }
2497
2626
 
2498
2627
  export interface RawModuleRule {
@@ -2568,7 +2697,6 @@ export interface RawOccurrenceChunkIdsPluginOptions {
2568
2697
  }
2569
2698
 
2570
2699
  export interface RawOptimizationOptions {
2571
- removeAvailableModules: boolean
2572
2700
  sideEffects: boolean | string
2573
2701
  usedExports: boolean | string
2574
2702
  providedExports: boolean
@@ -2580,6 +2708,12 @@ export interface RawOptimizationOptions {
2580
2708
  avoidEntryIife: boolean
2581
2709
  }
2582
2710
 
2711
+ export interface RawOptimizeSharedConfig {
2712
+ shareKey: string
2713
+ treeShaking: boolean
2714
+ usedExports?: Array<string>
2715
+ }
2716
+
2583
2717
  export interface RawOptions {
2584
2718
  name?: string
2585
2719
  mode?: undefined | 'production' | 'development' | 'none'
@@ -2592,11 +2726,12 @@ export interface RawOptions {
2592
2726
  stats: RawStatsOptions
2593
2727
  cache: boolean | { type: "memory" } | ({ type: "persistent" } & RawCacheOptionsPersistent)
2594
2728
  experiments: RawExperiments
2595
- node?: RawNodeOption
2596
- amd?: string
2597
- bail: boolean
2598
- __references: Record<string, any>
2599
- __virtual_files?: Array<JsVirtualFile>
2729
+ incremental?: false | { [key: string]: boolean }
2730
+ node?: RawNodeOption
2731
+ amd?: string
2732
+ bail: boolean
2733
+ __references: Record<string, any>
2734
+ __virtual_files?: Array<JsVirtualFile>
2600
2735
  }
2601
2736
 
2602
2737
  export interface RawOutputOptions {
@@ -2660,24 +2795,32 @@ export interface RawPathData {
2660
2795
  url?: string
2661
2796
  }
2662
2797
 
2798
+ export interface RawProgressPluginHandlerInfo {
2799
+ /** Number of built modules */
2800
+ builtModules: number
2801
+ /** Identifier of the active module (only provided during `build modules` updates) */
2802
+ moduleIdentifier?: string
2803
+ }
2804
+
2663
2805
  export interface RawProgressPluginOptions {
2664
2806
  prefix?: string
2665
2807
  profile?: boolean
2666
2808
  template?: string
2667
2809
  tick?: string | Array<string>
2668
2810
  progressChars?: string
2669
- handler?: (percent: number, msg: string, items: string[]) => void
2811
+ handler?: (percent: number, msg: string, info: RawProgressPluginHandlerInfo) => void
2670
2812
  }
2671
2813
 
2672
2814
  export interface RawProvideOptions {
2673
2815
  key: string
2674
2816
  shareKey: string
2675
- shareScope: string
2817
+ shareScope: string | Array<string>
2676
2818
  version?: string | false | undefined
2677
2819
  eager: boolean
2678
2820
  singleton?: boolean
2679
2821
  requiredVersion?: string | false | undefined
2680
2822
  strictVersion?: boolean
2823
+ treeShakingMode?: string
2681
2824
  }
2682
2825
 
2683
2826
  export interface RawRelated {
@@ -2692,7 +2835,7 @@ export interface RawRemoteAliasTarget {
2692
2835
  export interface RawRemoteOptions {
2693
2836
  key: string
2694
2837
  external: Array<string>
2695
- shareScope: string
2838
+ shareScope: string | Array<string>
2696
2839
  }
2697
2840
 
2698
2841
  export interface RawResolveOptions {
@@ -2770,6 +2913,11 @@ export interface RawRslibPluginOptions {
2770
2913
  * @default `false`
2771
2914
  */
2772
2915
  forceNodeShims?: boolean
2916
+ /**
2917
+ * Auto downgrade module external type to node-commonjs for CJS require of node builtins
2918
+ * @default `false`
2919
+ */
2920
+ autoCjsNodeBuiltin?: boolean
2773
2921
  }
2774
2922
 
2775
2923
  export interface RawRstestPluginOptions {
@@ -2778,6 +2926,7 @@ export interface RawRstestPluginOptions {
2778
2926
  hoistMockModule: boolean
2779
2927
  manualMockRoot: string
2780
2928
  preserveNewUrl?: Array<string>
2929
+ globals?: boolean
2781
2930
  }
2782
2931
 
2783
2932
  export interface RawRuleSetCondition {
@@ -2811,6 +2960,21 @@ export interface RawRuntimeChunkOptions {
2811
2960
  name: string | ((entrypoint: { name: string }) => string)
2812
2961
  }
2813
2962
 
2963
+ export interface RawSharedContainerPluginOptions {
2964
+ name: string
2965
+ request: string
2966
+ version: string
2967
+ fileName?: string
2968
+ library: JsLibraryOptions
2969
+ }
2970
+
2971
+ export interface RawSharedUsedExportsOptimizerPluginOptions {
2972
+ shared: Array<RawOptimizeSharedConfig>
2973
+ injectTreeShakingUsedExports?: boolean
2974
+ manifestFileName?: string
2975
+ statsFileName?: string
2976
+ }
2977
+
2814
2978
  export interface RawSizeLimitsPluginOptions {
2815
2979
  assetFilter?: (assetFilename: string) => boolean
2816
2980
  hints?: "error" | "warning"
@@ -2854,6 +3018,8 @@ export interface RawSplitChunksOptions {
2854
3018
  export interface RawStatsBuildInfo {
2855
3019
  buildVersion: string
2856
3020
  buildName?: string
3021
+ target?: Array<string>
3022
+ plugins?: Array<string>
2857
3023
  }
2858
3024
 
2859
3025
  export interface RawStatsOptions {
@@ -2914,8 +3080,7 @@ export interface RealDependencyLocation {
2914
3080
  end?: SourcePosition
2915
3081
  }
2916
3082
 
2917
- /**
2918
- * this is a process level tracing, which means it would be shared by all compilers in the same process
3083
+ /** * this is a process level tracing, which means it would be shared by all compilers in the same process
2919
3084
  * only the first call would take effect, the following calls would be ignored
2920
3085
  * Some code is modified based on
2921
3086
  * https://github.com/swc-project/swc/blob/d1d0607158ab40463d1b123fed52cc526eba8385/bindings/binding_core_node/src/util.rs#L29-L58
@@ -2943,39 +3108,40 @@ export declare enum RegisterJsTapKind {
2943
3108
  CompilationAfterOptimizeModules = 14,
2944
3109
  CompilationOptimizeTree = 15,
2945
3110
  CompilationOptimizeChunkModules = 16,
2946
- CompilationAdditionalTreeRuntimeRequirements = 17,
2947
- CompilationRuntimeRequirementInTree = 18,
2948
- CompilationRuntimeModule = 19,
2949
- CompilationChunkHash = 20,
2950
- CompilationChunkAsset = 21,
2951
- CompilationProcessAssets = 22,
2952
- CompilationAfterProcessAssets = 23,
2953
- CompilationSeal = 24,
2954
- CompilationAfterSeal = 25,
2955
- NormalModuleFactoryBeforeResolve = 26,
2956
- NormalModuleFactoryFactorize = 27,
2957
- NormalModuleFactoryResolve = 28,
2958
- NormalModuleFactoryAfterResolve = 29,
2959
- NormalModuleFactoryCreateModule = 30,
2960
- NormalModuleFactoryResolveForScheme = 31,
2961
- ContextModuleFactoryBeforeResolve = 32,
2962
- ContextModuleFactoryAfterResolve = 33,
2963
- JavascriptModulesChunkHash = 34,
2964
- HtmlPluginBeforeAssetTagGeneration = 35,
2965
- HtmlPluginAlterAssetTags = 36,
2966
- HtmlPluginAlterAssetTagGroups = 37,
2967
- HtmlPluginAfterTemplateExecution = 38,
2968
- HtmlPluginBeforeEmit = 39,
2969
- HtmlPluginAfterEmit = 40,
2970
- RuntimePluginCreateScript = 41,
2971
- RuntimePluginCreateLink = 42,
2972
- RuntimePluginLinkPreload = 43,
2973
- RuntimePluginLinkPrefetch = 44,
2974
- RsdoctorPluginModuleGraph = 45,
2975
- RsdoctorPluginChunkGraph = 46,
2976
- RsdoctorPluginModuleIds = 47,
2977
- RsdoctorPluginModuleSources = 48,
2978
- RsdoctorPluginAssets = 49
3111
+ CompilationBeforeModuleIds = 17,
3112
+ CompilationAdditionalTreeRuntimeRequirements = 18,
3113
+ CompilationRuntimeRequirementInTree = 19,
3114
+ CompilationRuntimeModule = 20,
3115
+ CompilationChunkHash = 21,
3116
+ CompilationChunkAsset = 22,
3117
+ CompilationProcessAssets = 23,
3118
+ CompilationAfterProcessAssets = 24,
3119
+ CompilationSeal = 25,
3120
+ CompilationAfterSeal = 26,
3121
+ NormalModuleFactoryBeforeResolve = 27,
3122
+ NormalModuleFactoryFactorize = 28,
3123
+ NormalModuleFactoryResolve = 29,
3124
+ NormalModuleFactoryAfterResolve = 30,
3125
+ NormalModuleFactoryCreateModule = 31,
3126
+ NormalModuleFactoryResolveForScheme = 32,
3127
+ ContextModuleFactoryBeforeResolve = 33,
3128
+ ContextModuleFactoryAfterResolve = 34,
3129
+ JavascriptModulesChunkHash = 35,
3130
+ HtmlPluginBeforeAssetTagGeneration = 36,
3131
+ HtmlPluginAlterAssetTags = 37,
3132
+ HtmlPluginAlterAssetTagGroups = 38,
3133
+ HtmlPluginAfterTemplateExecution = 39,
3134
+ HtmlPluginBeforeEmit = 40,
3135
+ HtmlPluginAfterEmit = 41,
3136
+ RuntimePluginCreateScript = 42,
3137
+ RuntimePluginCreateLink = 43,
3138
+ RuntimePluginLinkPreload = 44,
3139
+ RuntimePluginLinkPrefetch = 45,
3140
+ RsdoctorPluginModuleGraph = 46,
3141
+ RsdoctorPluginChunkGraph = 47,
3142
+ RsdoctorPluginModuleIds = 48,
3143
+ RsdoctorPluginModuleSources = 49,
3144
+ RsdoctorPluginAssets = 50
2979
3145
  }
2980
3146
 
2981
3147
  export interface RegisterJsTaps {
@@ -2999,6 +3165,7 @@ export interface RegisterJsTaps {
2999
3165
  registerCompilationAfterOptimizeModulesTaps: (stages: Array<number>) => Array<{ function: (() => void); stage: number; }>
3000
3166
  registerCompilationOptimizeTreeTaps: (stages: Array<number>) => Array<{ function: (() => Promise<void>); stage: number; }>
3001
3167
  registerCompilationOptimizeChunkModulesTaps: (stages: Array<number>) => Array<{ function: (() => Promise<boolean | undefined>); stage: number; }>
3168
+ registerCompilationBeforeModuleIdsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsBeforeModuleIdsArg) => JsBeforeModuleIdsResult); stage: number; }>
3002
3169
  registerCompilationChunkHashTaps: (stages: Array<number>) => Array<{ function: ((arg: Chunk) => Buffer); stage: number; }>
3003
3170
  registerCompilationChunkAssetTaps: (stages: Array<number>) => Array<{ function: ((arg: JsChunkAssetArgs) => void); stage: number; }>
3004
3171
  registerCompilationProcessAssetsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsCompilation) => Promise<void>); stage: number; }>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/binding",
3
- "version": "2.0.0-canary.20260120",
3
+ "version": "2.0.0-rc.1",
4
4
  "license": "MIT",
5
5
  "description": "Node binding for rspack",
6
6
  "main": "binding.js",
@@ -19,10 +19,13 @@
19
19
  "bugs": "https://github.com/web-infra-dev/rspack/issues",
20
20
  "repository": "web-infra-dev/rspack",
21
21
  "devDependencies": {
22
- "@napi-rs/cli": "3.0.4",
23
- "@napi-rs/wasm-runtime": "1.0.7",
24
- "emnapi": "^1.8.1",
25
- "typescript": "^5.9.3"
22
+ "@emnapi/core": "1.9.2",
23
+ "@emnapi/runtime": "1.9.2",
24
+ "@napi-rs/cli": "3.6.0",
25
+ "@napi-rs/wasm-runtime": "1.1.2",
26
+ "@types/node": "^20.19.39",
27
+ "emnapi": "1.9.2",
28
+ "typescript": "^6.0.2"
26
29
  },
27
30
  "napi": {
28
31
  "binaryName": "rspack",
@@ -38,29 +41,29 @@
38
41
  "aarch64-unknown-linux-gnu",
39
42
  "aarch64-apple-darwin",
40
43
  "aarch64-unknown-linux-musl",
41
- "aarch64-pc-windows-msvc",
42
- "wasm32-wasip1-threads"
44
+ "aarch64-pc-windows-msvc"
43
45
  ],
44
46
  "wasm": {
45
47
  "initialMemory": 16384,
46
48
  "browser": {
47
49
  "fs": true,
48
50
  "asyncInit": true,
49
- "buffer": true
51
+ "buffer": true,
52
+ "errorEvent": true
50
53
  }
51
54
  }
52
55
  },
53
56
  "optionalDependencies": {
54
- "@rspack/binding-darwin-arm64": "2.0.0-canary.20260120",
55
- "@rspack/binding-win32-arm64-msvc": "2.0.0-canary.20260120",
56
- "@rspack/binding-linux-arm64-gnu": "2.0.0-canary.20260120",
57
- "@rspack/binding-linux-arm64-musl": "2.0.0-canary.20260120",
58
- "@rspack/binding-win32-ia32-msvc": "2.0.0-canary.20260120",
59
- "@rspack/binding-wasm32-wasi": "2.0.0-canary.20260120",
60
- "@rspack/binding-win32-x64-msvc": "2.0.0-canary.20260120",
61
- "@rspack/binding-darwin-x64": "2.0.0-canary.20260120",
62
- "@rspack/binding-linux-x64-gnu": "2.0.0-canary.20260120",
63
- "@rspack/binding-linux-x64-musl": "2.0.0-canary.20260120"
57
+ "@rspack/binding-darwin-arm64": "2.0.0-rc.1",
58
+ "@rspack/binding-linux-arm64-gnu": "2.0.0-rc.1",
59
+ "@rspack/binding-win32-arm64-msvc": "2.0.0-rc.1",
60
+ "@rspack/binding-linux-arm64-musl": "2.0.0-rc.1",
61
+ "@rspack/binding-win32-ia32-msvc": "2.0.0-rc.1",
62
+ "@rspack/binding-wasm32-wasi": "2.0.0-rc.1",
63
+ "@rspack/binding-win32-x64-msvc": "2.0.0-rc.1",
64
+ "@rspack/binding-darwin-x64": "2.0.0-rc.1",
65
+ "@rspack/binding-linux-x64-musl": "2.0.0-rc.1",
66
+ "@rspack/binding-linux-x64-gnu": "2.0.0-rc.1"
64
67
  },
65
68
  "scripts": {
66
69
  "build:dev": "node scripts/build.js",
@@ -73,6 +76,7 @@
73
76
  "build:dev:browser": "DISABLE_PLUGIN=1 RUST_TARGET=wasm32-wasip1-threads RSPACK_TARGET_BROWSER=1 node scripts/build.js",
74
77
  "build:release:browser": "DISABLE_PLUGIN=1 RUST_TARGET=wasm32-wasip1-threads RSPACK_TARGET_BROWSER=1 node scripts/build.js --profile release-wasi",
75
78
  "move-binding": "node scripts/move-binding",
76
- "test": "tsc -p tsconfig.type-test.json"
79
+ "test": "tsc -p tsconfig.type-test.json",
80
+ "wasm-add-external-debug": "node scripts/add-external-debug-info.js rspack.wasm32-wasi.wasm rspack.wasm32-wasi.debug.wasm"
77
81
  }
78
82
  }