@rspack/binding 2.0.0-canary.20260120 → 2.0.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.
Files changed (3) hide show
  1. package/README.md +4 -0
  2. package/napi-binding.d.ts +231 -84
  3. package/package.json +21 -18
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
@@ -95,6 +95,8 @@ export interface JsSource {
95
95
  source: string | Buffer
96
96
  map?: string
97
97
  }
98
+
99
+ export type CompilerId = void;
98
100
  /* -- banner.d.ts end -- */
99
101
 
100
102
  /* -- napi-rs generated below -- */
@@ -213,6 +215,7 @@ export declare class Dependency {
213
215
  get critical(): boolean
214
216
  set critical(val: boolean)
215
217
  get ids(): Array<string> | undefined
218
+ get loc(): DependencyLocation | null
216
219
  }
217
220
 
218
221
  export declare class Diagnostics {
@@ -334,6 +337,7 @@ export declare class JsCompiler {
334
337
  rebuild(changed_files: string[], removed_files: string[], callback: (err: null | Error) => void): void
335
338
  close(): Promise<void>
336
339
  getVirtualFileStore(): VirtualFileStore | null
340
+ getCompilerId(): ExternalObject<CompilerId>
337
341
  }
338
342
 
339
343
  export declare class JsContextModuleFactoryAfterResolveData {
@@ -361,6 +365,10 @@ export declare class JsContextModuleFactoryBeforeResolveData {
361
365
  set recursive(recursive: boolean)
362
366
  }
363
367
 
368
+ export declare class JsCoordinator {
369
+ constructor(getServerCompilerIdJsFn: () => ExternalObject<CompilerId>)
370
+ }
371
+
364
372
  export declare class JsDependencies {
365
373
  get fileDependencies(): Array<string>
366
374
  get addedFileDependencies(): Array<string>
@@ -522,6 +530,7 @@ export declare enum BuiltinPluginName {
522
530
  DynamicEntryPlugin = 'DynamicEntryPlugin',
523
531
  ExternalsPlugin = 'ExternalsPlugin',
524
532
  NodeTargetPlugin = 'NodeTargetPlugin',
533
+ EsmNodeTargetPlugin = 'EsmNodeTargetPlugin',
525
534
  ElectronTargetPlugin = 'ElectronTargetPlugin',
526
535
  EnableChunkLoadingPlugin = 'EnableChunkLoadingPlugin',
527
536
  EnableLibraryPlugin = 'EnableLibraryPlugin',
@@ -540,10 +549,13 @@ export declare enum BuiltinPluginName {
540
549
  SplitChunksPlugin = 'SplitChunksPlugin',
541
550
  RemoveDuplicateModulesPlugin = 'RemoveDuplicateModulesPlugin',
542
551
  ShareRuntimePlugin = 'ShareRuntimePlugin',
552
+ SharedUsedExportsOptimizerPlugin = 'SharedUsedExportsOptimizerPlugin',
543
553
  ContainerPlugin = 'ContainerPlugin',
544
554
  ContainerReferencePlugin = 'ContainerReferencePlugin',
545
555
  ProvideSharedPlugin = 'ProvideSharedPlugin',
546
556
  ConsumeSharedPlugin = 'ConsumeSharedPlugin',
557
+ CollectSharedEntryPlugin = 'CollectSharedEntryPlugin',
558
+ SharedContainerPlugin = 'SharedContainerPlugin',
547
559
  ModuleFederationRuntimePlugin = 'ModuleFederationRuntimePlugin',
548
560
  ModuleFederationManifestPlugin = 'ModuleFederationManifestPlugin',
549
561
  NamedModuleIdsPlugin = 'NamedModuleIdsPlugin',
@@ -602,7 +614,9 @@ export declare enum BuiltinPluginName {
602
614
  LazyCompilationPlugin = 'LazyCompilationPlugin',
603
615
  ModuleInfoHeaderPlugin = 'ModuleInfoHeaderPlugin',
604
616
  HttpUriPlugin = 'HttpUriPlugin',
605
- CssChunkingPlugin = 'CssChunkingPlugin'
617
+ CssChunkingPlugin = 'CssChunkingPlugin',
618
+ RscServerPlugin = 'RscServerPlugin',
619
+ RscClientPlugin = 'RscClientPlugin'
606
620
  }
607
621
 
608
622
  export declare function cleanupGlobalTrace(): void
@@ -707,6 +721,14 @@ export interface JsBeforeEmitData {
707
721
  uid?: number
708
722
  }
709
723
 
724
+ export interface JsBeforeModuleIdsArg {
725
+ modules: Array<JsModuleForIds>
726
+ }
727
+
728
+ export interface JsBeforeModuleIdsResult {
729
+ assignments: Record<string, string>
730
+ }
731
+
710
732
  export interface JsBuildMeta {
711
733
  strictEsmModule?: boolean
712
734
  hasTopLevelAwait?: boolean
@@ -970,6 +992,10 @@ export interface JsModuleDescriptor {
970
992
  id?: string | number | null
971
993
  }
972
994
 
995
+ export interface JsModuleForIds {
996
+ identifier: string
997
+ }
998
+
973
999
  export interface JsNormalModuleFactoryCreateModuleArgs {
974
1000
  dependencyType: string
975
1001
  rawRequest: string
@@ -1028,6 +1054,16 @@ export interface JsResourceData {
1028
1054
  descriptionFilePath?: string
1029
1055
  }
1030
1056
 
1057
+ export interface JsRscClientPluginOptions {
1058
+ coordinator: JsCoordinator
1059
+ }
1060
+
1061
+ export interface JsRscServerPluginOptions {
1062
+ coordinator: JsCoordinator
1063
+ onServerComponentChanges?: (() => void) | undefined | null
1064
+ onManifest?: ((arg: string) => Promise<undefined>) | undefined | null
1065
+ }
1066
+
1031
1067
  export interface JsRsdoctorAsset {
1032
1068
  ukey: number
1033
1069
  path: string
@@ -1065,6 +1101,30 @@ export interface JsRsdoctorChunkModules {
1065
1101
  modules: Array<number>
1066
1102
  }
1067
1103
 
1104
+ export interface JsRsdoctorConnection {
1105
+ ukey: number
1106
+ dependencyId: string
1107
+ module: number
1108
+ originModule?: number
1109
+ resolvedModule: number
1110
+ dependencyType: string
1111
+ userRequest: string
1112
+ loc?: string
1113
+ active: boolean
1114
+ }
1115
+
1116
+ export interface JsRsdoctorConnectionsOnlyImport {
1117
+ moduleUkey: number
1118
+ modulePath: string
1119
+ connections: Array<JsRsdoctorConnectionsOnlyImportConnection>
1120
+ }
1121
+
1122
+ export interface JsRsdoctorConnectionsOnlyImportConnection {
1123
+ originModule?: number
1124
+ dependencyType: string
1125
+ userRequest: string
1126
+ }
1127
+
1068
1128
  export interface JsRsdoctorDependency {
1069
1129
  ukey: number
1070
1130
  kind: string
@@ -1090,7 +1150,11 @@ export interface JsRsdoctorExportInfo {
1090
1150
  from?: number
1091
1151
  variable?: number
1092
1152
  identifier?: JsRsdoctorStatement
1093
- sideEffects: Array<number>
1153
+ }
1154
+
1155
+ export interface JsRsdoctorJsonModuleSize {
1156
+ identifier: string
1157
+ size: number
1094
1158
  }
1095
1159
 
1096
1160
  export interface JsRsdoctorModule {
@@ -1107,12 +1171,15 @@ export interface JsRsdoctorModule {
1107
1171
  chunks: Array<number>
1108
1172
  issuerPath: Array<number>
1109
1173
  bailoutReason: Array<string>
1174
+ sideEffectsLocations: Array<JsRsdoctorSideEffectLocation>
1175
+ exportsType: string
1110
1176
  }
1111
1177
 
1112
1178
  export interface JsRsdoctorModuleGraph {
1113
1179
  modules: Array<JsRsdoctorModule>
1114
1180
  dependencies: Array<JsRsdoctorDependency>
1115
1181
  chunkModules: Array<JsRsdoctorChunkModules>
1182
+ connectionsOnlyImports: Array<JsRsdoctorConnectionsOnlyImport>
1116
1183
  }
1117
1184
 
1118
1185
  export interface JsRsdoctorModuleGraphModule {
@@ -1141,6 +1208,7 @@ export interface JsRsdoctorModuleOriginalSource {
1141
1208
 
1142
1209
  export interface JsRsdoctorModuleSourcesPatch {
1143
1210
  moduleOriginalSources: Array<JsRsdoctorModuleOriginalSource>
1211
+ jsonModuleSizes: Array<JsRsdoctorJsonModuleSize>
1144
1212
  }
1145
1213
 
1146
1214
  export interface JsRsdoctorSideEffect {
@@ -1155,6 +1223,13 @@ export interface JsRsdoctorSideEffect {
1155
1223
  variable?: number
1156
1224
  }
1157
1225
 
1226
+ export interface JsRsdoctorSideEffectLocation {
1227
+ location: string
1228
+ nodeType: string
1229
+ module: number
1230
+ request: string
1231
+ }
1232
+
1158
1233
  export interface JsRsdoctorSourceMapFeatures {
1159
1234
  cheap?: boolean
1160
1235
  module?: boolean
@@ -1832,6 +1907,8 @@ export interface RawCacheOptionsPersistent {
1832
1907
  version?: string
1833
1908
  snapshot?: RawSnapshotOptions
1834
1909
  storage?: RawStorageOptions
1910
+ portable?: boolean
1911
+ readonly?: boolean
1835
1912
  }
1836
1913
 
1837
1914
  export interface RawCircularDependencyRspackPluginOptions {
@@ -1844,6 +1921,11 @@ export interface RawCircularDependencyRspackPluginOptions {
1844
1921
  onEnd?: () => void
1845
1922
  }
1846
1923
 
1924
+ export interface RawCollectShareEntryPluginOptions {
1925
+ consumes: Array<RawConsumeOptions>
1926
+ filename?: string
1927
+ }
1928
+
1847
1929
  export interface RawCompilerPlatform {
1848
1930
  web?: boolean | null
1849
1931
  browser?: boolean | null
@@ -1858,12 +1940,13 @@ export interface RawConsumeOptions {
1858
1940
  import?: string
1859
1941
  importResolved?: string
1860
1942
  shareKey: string
1861
- shareScope: string
1943
+ shareScope: string | Array<string>
1862
1944
  requiredVersion?: string | false | undefined
1863
1945
  packageName?: string
1864
1946
  strictVersion: boolean
1865
1947
  singleton: boolean
1866
1948
  eager: boolean
1949
+ treeShakingMode?: string
1867
1950
  }
1868
1951
 
1869
1952
  export interface RawConsumeSharedPluginOptions {
@@ -1873,7 +1956,7 @@ export interface RawConsumeSharedPluginOptions {
1873
1956
 
1874
1957
  export interface RawContainerPluginOptions {
1875
1958
  name: string
1876
- shareScope: string
1959
+ shareScope: string | Array<string>
1877
1960
  library: JsLibraryOptions
1878
1961
  runtime?: false | string
1879
1962
  filename?: string
@@ -1884,7 +1967,7 @@ export interface RawContainerPluginOptions {
1884
1967
  export interface RawContainerReferencePluginOptions {
1885
1968
  remoteType: string
1886
1969
  remotes: Array<RawRemoteOptions>
1887
- shareScope?: string
1970
+ shareScope?: string | Array<string>
1888
1971
  enhanced: boolean
1889
1972
  }
1890
1973
 
@@ -2014,6 +2097,7 @@ export interface RawCssAutoGeneratorOptions {
2014
2097
  export interface RawCssAutoParserOptions {
2015
2098
  namedExports?: boolean
2016
2099
  url?: boolean
2100
+ resolveImport?: boolean | ((context: { url: string, media: string | undefined, resourcePath: string, supports: string | undefined, layer: string | undefined }) => boolean)
2017
2101
  }
2018
2102
 
2019
2103
  export interface RawCssChunkingPluginOptions {
@@ -2040,6 +2124,14 @@ export interface RawCssGeneratorOptions {
2040
2124
  esModule?: boolean
2041
2125
  }
2042
2126
 
2127
+ export interface RawCssImportContext {
2128
+ url: string
2129
+ media?: string
2130
+ resourcePath: string
2131
+ supports?: string
2132
+ layer?: string
2133
+ }
2134
+
2043
2135
  export interface RawCssModuleGeneratorOptions {
2044
2136
  exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only"
2045
2137
  exportsOnly?: boolean
@@ -2050,11 +2142,13 @@ export interface RawCssModuleGeneratorOptions {
2050
2142
  export interface RawCssModuleParserOptions {
2051
2143
  namedExports?: boolean
2052
2144
  url?: boolean
2145
+ resolveImport?: boolean | ((context: { url: string, media: string | undefined, resourcePath: string, supports: string | undefined, layer: string | undefined }) => boolean)
2053
2146
  }
2054
2147
 
2055
2148
  export interface RawCssParserOptions {
2056
2149
  namedExports?: boolean
2057
2150
  url?: boolean
2151
+ resolveImport?: boolean | ((context: { url: string, media: string | undefined, resourcePath: string, supports: string | undefined, layer: string | undefined }) => boolean)
2058
2152
  }
2059
2153
 
2060
2154
  export interface RawDllEntryPluginOptions {
@@ -2095,6 +2189,12 @@ export interface RawDynamicEntryPluginOptions {
2095
2189
  entry: () => Promise<RawEntryDynamicResult[]>
2096
2190
  }
2097
2191
 
2192
+ export interface RawEnableLibraryPluginOptions {
2193
+ libraryType: string
2194
+ preserveModules?: string
2195
+ splitChunks?: RawSplitChunksOptions
2196
+ }
2197
+
2098
2198
  export interface RawEntryDynamicResult {
2099
2199
  import: Array<string>
2100
2200
  options: JsEntryOptions
@@ -2121,6 +2221,7 @@ export interface RawEnvironment {
2121
2221
 
2122
2222
  export interface RawEsmLibraryPlugin {
2123
2223
  preserveModules?: string
2224
+ splitChunks?: RawSplitChunksOptions
2124
2225
  }
2125
2226
 
2126
2227
  export interface RawEvalDevToolModulePluginOptions {
@@ -2130,10 +2231,9 @@ export interface RawEvalDevToolModulePluginOptions {
2130
2231
  }
2131
2232
 
2132
2233
  export interface RawExperiments {
2133
- incremental?: false | { [key: string]: boolean }
2134
- useInputFileSystem?: false | Array<RegExp>
2135
- css?: boolean
2136
- deferImport: boolean
2234
+ useInputFileSystem?: false | Array<RegExp>
2235
+ css?: boolean
2236
+ deferImport: boolean
2137
2237
  }
2138
2238
 
2139
2239
  export interface RawExposeOptions {
@@ -2172,6 +2272,7 @@ export interface RawExternalsPresets {
2172
2272
  export interface RawExtractComments {
2173
2273
  banner?: string | boolean
2174
2274
  condition?: string
2275
+ conditionFlags?: string
2175
2276
  }
2176
2277
 
2177
2278
  export interface RawFallbackCacheGroupOptions {
@@ -2260,12 +2361,11 @@ export interface RawIgnorePluginOptions {
2260
2361
 
2261
2362
  export interface RawIncremental {
2262
2363
  silent: boolean
2263
- make: boolean
2264
- inferAsyncModules: boolean
2265
- providedExports: boolean
2266
- dependenciesDiagnostics: boolean
2267
- sideEffects: boolean
2364
+ buildModuleGraph: boolean
2365
+ finishModules: boolean
2366
+ optimizeDependencies: boolean
2268
2367
  buildChunkGraph: boolean
2368
+ optimizeChunkModules: boolean
2269
2369
  moduleIds: boolean
2270
2370
  chunkIds: boolean
2271
2371
  modulesHashes: boolean
@@ -2273,7 +2373,7 @@ export interface RawIncremental {
2273
2373
  modulesRuntimeRequirements: boolean
2274
2374
  chunksRuntimeRequirements: boolean
2275
2375
  chunksHashes: boolean
2276
- chunksRender: boolean
2376
+ chunkAsset: boolean
2277
2377
  emitAssets: boolean
2278
2378
  }
2279
2379
 
@@ -2318,41 +2418,42 @@ export interface RawJavascriptParserOptions {
2318
2418
  exprContextCritical?: boolean
2319
2419
  unknownContextCritical?: boolean
2320
2420
  wrappedContextCritical?: boolean
2421
+ strictThisContextOnImports?: boolean
2321
2422
  wrappedContextRegExp?: RegExp
2322
2423
  exportsPresence?: string
2323
2424
  importExportsPresence?: string
2324
2425
  reexportExportsPresence?: string
2325
- strictExportPresence?: boolean
2326
2426
  worker?: Array<string>
2327
2427
  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
2428
+ importMeta?: string
2429
+ commonjsMagicComments?: boolean
2349
2430
  commonjs?: boolean | { exports?: boolean | 'skipInEsm' }
2431
+ deferImport?: boolean
2432
+ /**
2433
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2434
+ * @experimental
2435
+ */
2436
+ requireAlias?: boolean
2437
+ /**
2438
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2439
+ * @experimental
2440
+ */
2441
+ requireAsExpression?: boolean
2442
+ /**
2443
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2444
+ * @experimental
2445
+ */
2446
+ requireDynamic?: boolean
2447
+ /**
2448
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2449
+ * @experimental
2450
+ */
2451
+ requireResolve?: boolean
2350
2452
  /**
2351
2453
  * This option is experimental in Rspack only and subject to change or be removed anytime.
2352
2454
  * @experimental
2353
2455
  */
2354
2456
  importDynamic?: boolean
2355
- commonjsMagicComments?: boolean
2356
2457
  /**
2357
2458
  * This option is experimental in Rspack only and subject to change or be removed anytime.
2358
2459
  * @experimental
@@ -2363,7 +2464,11 @@ typeReexportsPresence?: string
2363
2464
  * @experimental
2364
2465
  */
2365
2466
  jsx?: boolean
2366
- deferImport?: boolean
2467
+ /**
2468
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2469
+ * @experimental
2470
+ */
2471
+ importMetaResolve?: boolean
2367
2472
  }
2368
2473
 
2369
2474
  export interface RawJsonGeneratorOptions {
@@ -2463,8 +2568,13 @@ export interface RawModuleFederationManifestPluginOptions {
2463
2568
  buildInfo?: RawStatsBuildInfo
2464
2569
  }
2465
2570
 
2571
+ export interface RawModuleFederationRuntimeExperimentsOptions {
2572
+ asyncStartup?: boolean
2573
+ }
2574
+
2466
2575
  export interface RawModuleFederationRuntimePluginOptions {
2467
2576
  entryRuntime?: string | undefined
2577
+ experiments?: RawModuleFederationRuntimeExperimentsOptions
2468
2578
  }
2469
2579
 
2470
2580
  export interface RawModuleFilenameTemplateFnCtx {
@@ -2492,7 +2602,6 @@ export interface RawModuleOptions {
2492
2602
  parser?: Record<string, RawParserOptions>
2493
2603
  generator?: Record<string, RawGeneratorOptions>
2494
2604
  noParse?: string | RegExp | ((request: string) => boolean) | (string | RegExp | ((request: string) => boolean))[]
2495
- unsafeCache?: boolean | RegExp
2496
2605
  }
2497
2606
 
2498
2607
  export interface RawModuleRule {
@@ -2568,7 +2677,6 @@ export interface RawOccurrenceChunkIdsPluginOptions {
2568
2677
  }
2569
2678
 
2570
2679
  export interface RawOptimizationOptions {
2571
- removeAvailableModules: boolean
2572
2680
  sideEffects: boolean | string
2573
2681
  usedExports: boolean | string
2574
2682
  providedExports: boolean
@@ -2580,6 +2688,12 @@ export interface RawOptimizationOptions {
2580
2688
  avoidEntryIife: boolean
2581
2689
  }
2582
2690
 
2691
+ export interface RawOptimizeSharedConfig {
2692
+ shareKey: string
2693
+ treeShaking: boolean
2694
+ usedExports?: Array<string>
2695
+ }
2696
+
2583
2697
  export interface RawOptions {
2584
2698
  name?: string
2585
2699
  mode?: undefined | 'production' | 'development' | 'none'
@@ -2592,11 +2706,12 @@ export interface RawOptions {
2592
2706
  stats: RawStatsOptions
2593
2707
  cache: boolean | { type: "memory" } | ({ type: "persistent" } & RawCacheOptionsPersistent)
2594
2708
  experiments: RawExperiments
2595
- node?: RawNodeOption
2596
- amd?: string
2597
- bail: boolean
2598
- __references: Record<string, any>
2599
- __virtual_files?: Array<JsVirtualFile>
2709
+ incremental?: false | { [key: string]: boolean }
2710
+ node?: RawNodeOption
2711
+ amd?: string
2712
+ bail: boolean
2713
+ __references: Record<string, any>
2714
+ __virtual_files?: Array<JsVirtualFile>
2600
2715
  }
2601
2716
 
2602
2717
  export interface RawOutputOptions {
@@ -2660,24 +2775,32 @@ export interface RawPathData {
2660
2775
  url?: string
2661
2776
  }
2662
2777
 
2778
+ export interface RawProgressPluginHandlerInfo {
2779
+ /** Number of built modules */
2780
+ builtModules: number
2781
+ /** Identifier of the active module (only provided during `build modules` updates) */
2782
+ moduleIdentifier?: string
2783
+ }
2784
+
2663
2785
  export interface RawProgressPluginOptions {
2664
2786
  prefix?: string
2665
2787
  profile?: boolean
2666
2788
  template?: string
2667
2789
  tick?: string | Array<string>
2668
2790
  progressChars?: string
2669
- handler?: (percent: number, msg: string, items: string[]) => void
2791
+ handler?: (percent: number, msg: string, info: RawProgressPluginHandlerInfo) => void
2670
2792
  }
2671
2793
 
2672
2794
  export interface RawProvideOptions {
2673
2795
  key: string
2674
2796
  shareKey: string
2675
- shareScope: string
2797
+ shareScope: string | Array<string>
2676
2798
  version?: string | false | undefined
2677
2799
  eager: boolean
2678
2800
  singleton?: boolean
2679
2801
  requiredVersion?: string | false | undefined
2680
2802
  strictVersion?: boolean
2803
+ treeShakingMode?: string
2681
2804
  }
2682
2805
 
2683
2806
  export interface RawRelated {
@@ -2692,7 +2815,7 @@ export interface RawRemoteAliasTarget {
2692
2815
  export interface RawRemoteOptions {
2693
2816
  key: string
2694
2817
  external: Array<string>
2695
- shareScope: string
2818
+ shareScope: string | Array<string>
2696
2819
  }
2697
2820
 
2698
2821
  export interface RawResolveOptions {
@@ -2770,6 +2893,11 @@ export interface RawRslibPluginOptions {
2770
2893
  * @default `false`
2771
2894
  */
2772
2895
  forceNodeShims?: boolean
2896
+ /**
2897
+ * Externalize Node.js builtin modules with ESM-aware external types
2898
+ * @default `false`
2899
+ */
2900
+ externalEsmNodeBuiltin?: boolean
2773
2901
  }
2774
2902
 
2775
2903
  export interface RawRstestPluginOptions {
@@ -2778,6 +2906,7 @@ export interface RawRstestPluginOptions {
2778
2906
  hoistMockModule: boolean
2779
2907
  manualMockRoot: string
2780
2908
  preserveNewUrl?: Array<string>
2909
+ globals?: boolean
2781
2910
  }
2782
2911
 
2783
2912
  export interface RawRuleSetCondition {
@@ -2811,6 +2940,21 @@ export interface RawRuntimeChunkOptions {
2811
2940
  name: string | ((entrypoint: { name: string }) => string)
2812
2941
  }
2813
2942
 
2943
+ export interface RawSharedContainerPluginOptions {
2944
+ name: string
2945
+ request: string
2946
+ version: string
2947
+ fileName?: string
2948
+ library: JsLibraryOptions
2949
+ }
2950
+
2951
+ export interface RawSharedUsedExportsOptimizerPluginOptions {
2952
+ shared: Array<RawOptimizeSharedConfig>
2953
+ injectTreeShakingUsedExports?: boolean
2954
+ manifestFileName?: string
2955
+ statsFileName?: string
2956
+ }
2957
+
2814
2958
  export interface RawSizeLimitsPluginOptions {
2815
2959
  assetFilter?: (assetFilename: string) => boolean
2816
2960
  hints?: "error" | "warning"
@@ -2854,6 +2998,8 @@ export interface RawSplitChunksOptions {
2854
2998
  export interface RawStatsBuildInfo {
2855
2999
  buildVersion: string
2856
3000
  buildName?: string
3001
+ target?: Array<string>
3002
+ plugins?: Array<string>
2857
3003
  }
2858
3004
 
2859
3005
  export interface RawStatsOptions {
@@ -2914,8 +3060,7 @@ export interface RealDependencyLocation {
2914
3060
  end?: SourcePosition
2915
3061
  }
2916
3062
 
2917
- /**
2918
- * this is a process level tracing, which means it would be shared by all compilers in the same process
3063
+ /** * this is a process level tracing, which means it would be shared by all compilers in the same process
2919
3064
  * only the first call would take effect, the following calls would be ignored
2920
3065
  * Some code is modified based on
2921
3066
  * https://github.com/swc-project/swc/blob/d1d0607158ab40463d1b123fed52cc526eba8385/bindings/binding_core_node/src/util.rs#L29-L58
@@ -2943,39 +3088,40 @@ export declare enum RegisterJsTapKind {
2943
3088
  CompilationAfterOptimizeModules = 14,
2944
3089
  CompilationOptimizeTree = 15,
2945
3090
  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
3091
+ CompilationBeforeModuleIds = 17,
3092
+ CompilationAdditionalTreeRuntimeRequirements = 18,
3093
+ CompilationRuntimeRequirementInTree = 19,
3094
+ CompilationRuntimeModule = 20,
3095
+ CompilationChunkHash = 21,
3096
+ CompilationChunkAsset = 22,
3097
+ CompilationProcessAssets = 23,
3098
+ CompilationAfterProcessAssets = 24,
3099
+ CompilationSeal = 25,
3100
+ CompilationAfterSeal = 26,
3101
+ NormalModuleFactoryBeforeResolve = 27,
3102
+ NormalModuleFactoryFactorize = 28,
3103
+ NormalModuleFactoryResolve = 29,
3104
+ NormalModuleFactoryAfterResolve = 30,
3105
+ NormalModuleFactoryCreateModule = 31,
3106
+ NormalModuleFactoryResolveForScheme = 32,
3107
+ ContextModuleFactoryBeforeResolve = 33,
3108
+ ContextModuleFactoryAfterResolve = 34,
3109
+ JavascriptModulesChunkHash = 35,
3110
+ HtmlPluginBeforeAssetTagGeneration = 36,
3111
+ HtmlPluginAlterAssetTags = 37,
3112
+ HtmlPluginAlterAssetTagGroups = 38,
3113
+ HtmlPluginAfterTemplateExecution = 39,
3114
+ HtmlPluginBeforeEmit = 40,
3115
+ HtmlPluginAfterEmit = 41,
3116
+ RuntimePluginCreateScript = 42,
3117
+ RuntimePluginCreateLink = 43,
3118
+ RuntimePluginLinkPreload = 44,
3119
+ RuntimePluginLinkPrefetch = 45,
3120
+ RsdoctorPluginModuleGraph = 46,
3121
+ RsdoctorPluginChunkGraph = 47,
3122
+ RsdoctorPluginModuleIds = 48,
3123
+ RsdoctorPluginModuleSources = 49,
3124
+ RsdoctorPluginAssets = 50
2979
3125
  }
2980
3126
 
2981
3127
  export interface RegisterJsTaps {
@@ -2999,6 +3145,7 @@ export interface RegisterJsTaps {
2999
3145
  registerCompilationAfterOptimizeModulesTaps: (stages: Array<number>) => Array<{ function: (() => void); stage: number; }>
3000
3146
  registerCompilationOptimizeTreeTaps: (stages: Array<number>) => Array<{ function: (() => Promise<void>); stage: number; }>
3001
3147
  registerCompilationOptimizeChunkModulesTaps: (stages: Array<number>) => Array<{ function: (() => Promise<boolean | undefined>); stage: number; }>
3148
+ registerCompilationBeforeModuleIdsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsBeforeModuleIdsArg) => JsBeforeModuleIdsResult); stage: number; }>
3002
3149
  registerCompilationChunkHashTaps: (stages: Array<number>) => Array<{ function: ((arg: Chunk) => Buffer); stage: number; }>
3003
3150
  registerCompilationChunkAssetTaps: (stages: Array<number>) => Array<{ function: ((arg: JsChunkAssetArgs) => void); stage: number; }>
3004
3151
  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.0",
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.1",
23
+ "@emnapi/runtime": "1.9.1",
24
+ "@napi-rs/cli": "3.6.0",
25
+ "@napi-rs/wasm-runtime": "1.1.2",
26
+ "@types/node": "^20.19.37",
27
+ "emnapi": "1.9.1",
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.0",
58
+ "@rspack/binding-linux-arm64-gnu": "2.0.0-rc.0",
59
+ "@rspack/binding-win32-ia32-msvc": "2.0.0-rc.0",
60
+ "@rspack/binding-linux-arm64-musl": "2.0.0-rc.0",
61
+ "@rspack/binding-win32-arm64-msvc": "2.0.0-rc.0",
62
+ "@rspack/binding-wasm32-wasi": "2.0.0-rc.0",
63
+ "@rspack/binding-win32-x64-msvc": "2.0.0-rc.0",
64
+ "@rspack/binding-darwin-x64": "2.0.0-rc.0",
65
+ "@rspack/binding-linux-x64-gnu": "2.0.0-rc.0",
66
+ "@rspack/binding-linux-x64-musl": "2.0.0-rc.0"
64
67
  },
65
68
  "scripts": {
66
69
  "build:dev": "node scripts/build.js",