@ohos-ports/rspack-binding 2.2.9-beta.0 → 2.3.2-beta.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
@@ -22,11 +22,12 @@ Rspack is [MIT licensed](https://github.com/web-infra-dev/rspack/blob/main/LICEN
22
22
 
23
23
  ## OpenHarmony port
24
24
 
25
- This is the `@ohos-ports` distribution of `@rspack/binding@2.2.9`.
25
+ This is the `@ohos-ports` distribution of `@rspack/binding@2.3.2`.
26
26
 
27
27
  - On `process.platform === 'openharmony'` and `process.arch === 'arm64'`,
28
- the loader additionally probes `@ohos-ports/rspack-binding-openharmony-arm64`
29
- (installed automatically via `optionalDependencies`), which ships the
30
- native binary compiled from rspack v2.2.9 source for
31
- `aarch64-unknown-linux-ohos` and signed with `binary-sign-tool`.
32
- - All upstream probe paths are preserved.
28
+ the loader probes the local `rspack.linux-arm64-ohos.node` slot first and
29
+ then `@ohos-ports/rspack-binding-openharmony-arm64` (installed
30
+ automatically via `optionalDependencies`), which ships the native binary
31
+ compiled from rspack v2.3.2 source for `aarch64-unknown-linux-ohos` and
32
+ signed with `binary-sign-tool`.
33
+ - Upstream probe behavior on all other platforms is unchanged.
package/binding.js CHANGED
@@ -324,13 +324,6 @@ function requireNative() {
324
324
  } catch (e) {
325
325
  loadErrors.push(e)
326
326
  }
327
- try {
328
- return require('@rspack/binding-linux-arm64-ohos')
329
- } catch (e) {
330
- loadErrors.push(e)
331
- }
332
- // OpenHarmony port: probe the @ohos-ports platform binary slot
333
- // (compiled from rspack v2.2.9 source for aarch64-unknown-linux-ohos)
334
327
  try {
335
328
  return require('@ohos-ports/rspack-binding-openharmony-arm64')
336
329
  } catch (e) {
package/napi-binding.d.ts CHANGED
@@ -12,73 +12,26 @@ export type AssetInfo = KnownAssetInfo & Record<string, any>;
12
12
 
13
13
  export type CustomPluginName = string;
14
14
 
15
- export const MODULE_IDENTIFIER_SYMBOL: unique symbol;
16
-
17
- export const COMPILATION_HOOKS_MAP_SYMBOL: unique symbol;
18
-
19
- export const BUILD_INFO_ASSETS_SYMBOL: unique symbol;
20
- export const BUILD_INFO_FILE_DEPENDENCIES_SYMBOL: unique symbol;
21
- export const BUILD_INFO_CONTEXT_DEPENDENCIES_SYMBOL: unique symbol;
22
- export const BUILD_INFO_MISSING_DEPENDENCIES_SYMBOL: unique symbol;
23
- export const BUILD_INFO_BUILD_DEPENDENCIES_SYMBOL: unique symbol;
24
- export const COMMIT_CUSTOM_FIELDS_SYMBOL: unique symbol;
25
-
26
- export const RUST_ERROR_SYMBOL: unique symbol;
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
-
32
- interface KnownBuildInfo {
33
- [BUILD_INFO_ASSETS_SYMBOL]: Assets,
34
- [BUILD_INFO_FILE_DEPENDENCIES_SYMBOL]: string[],
35
- [BUILD_INFO_CONTEXT_DEPENDENCIES_SYMBOL]: string[],
36
- [BUILD_INFO_MISSING_DEPENDENCIES_SYMBOL]: string[],
37
- [BUILD_INFO_BUILD_DEPENDENCIES_SYMBOL]: string[],
38
- [COMMIT_CUSTOM_FIELDS_SYMBOL](): void;
39
- }
15
+ export type ConnectionState = boolean | symbol;
40
16
 
41
17
  export type BuildInfo = KnownBuildInfo & Record<string, any>;
42
18
 
43
19
  export interface Module {
44
20
  readonly type: string;
45
- get context(): string | undefined;
46
- get layer(): string | undefined;
47
- get factoryMeta(): JsFactoryMeta
48
- set factoryMeta(factoryMeta: JsFactoryMeta);
49
- get useSourceMap(): boolean;
50
- get useSimpleSourceMap(): boolean;
21
+ readonly context: string | undefined;
22
+ readonly layer: string | undefined;
23
+ readonly useSourceMap: boolean;
24
+ readonly useSimpleSourceMap: boolean;
25
+ factoryMeta: JsFactoryMeta;
51
26
  buildInfo: BuildInfo;
52
27
  buildMeta: Record<string, any>;
53
- }
54
-
55
- interface NormalModuleConstructor {
56
- new(): NormalModule;
57
- readonly prototype: NormalModule;
58
- }
59
-
60
- export var NormalModule: NormalModuleConstructor;
61
-
62
- export interface NormalModule extends Module {
63
- readonly resource: string;
64
- readonly request: string;
65
- readonly userRequest: string;
66
- readonly rawRequest: string;
67
- readonly resourceResolveData: Readonly<JsResourceData> | undefined;
68
- readonly loaders: JsLoaderItem[];
69
- get matchResource(): string | undefined;
70
- set matchResource(val: string | undefined);
71
- get error(): RspackError | undefined;
72
- }
73
-
74
- export interface ConcatenatedModule extends Module {
75
- }
76
-
77
- export interface ContextModule extends Module {
78
- }
79
-
80
- export interface ExternalModule extends Module {
81
- readonly userRequest: string;
28
+ readonly blocks: AsyncDependenciesBlock[];
29
+ readonly dependencies: Dependency[];
30
+ identifier(): string;
31
+ readableIdentifier(): string;
32
+ nameForCondition(): string | undefined;
33
+ size(type?: string | null): number;
34
+ libIdent(options: JsLibIdentOptions): string | null;
82
35
  }
83
36
 
84
37
  export interface RspackError extends Error {
@@ -100,6 +53,12 @@ export interface JsSource {
100
53
  map?: string
101
54
  }
102
55
 
56
+ export type JsSourceFromJs =
57
+ | { kind: "raw"; content: string | Buffer; map?: string }
58
+ | { kind: "native"; handle: JsNativeSource }
59
+ | { kind: "concat"; children: JsSourceFromJs[] }
60
+ | { kind: "replace"; original: JsSourceFromJs; replacements: JsReplaceSourceEdit[]; fallback: () => JsSourceFromJs }
61
+
103
62
  export type CompilerId = void;
104
63
  /* -- banner.d.ts end -- */
105
64
 
@@ -111,6 +70,7 @@ export declare class ExternalObject<T> {
111
70
  [K: symbol]: T
112
71
  }
113
72
  }
73
+
114
74
  export declare class Assets {
115
75
  keys(): Array<string>
116
76
  }
@@ -187,30 +147,6 @@ export declare class CodeGenerationResults {
187
147
  get(module: Module, runtime: string | string[] | undefined): CodeGenerationResult
188
148
  }
189
149
 
190
- export declare class ConcatenatedModule {
191
- get rootModule(): Module
192
- get modules(): Module[]
193
- readableIdentifier(): string
194
- _originalSource(): JsSourceWithLazyMap | undefined
195
- nameForCondition(): string | undefined
196
- get blocks(): AsyncDependenciesBlock[]
197
- get dependencies(): Dependency[]
198
- size(ty?: string | undefined | null): number
199
- libIdent(options: JsLibIdentOptions): string | null
200
- _emitFile(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
201
- }
202
-
203
- export declare class ContextModule {
204
- readableIdentifier(): string
205
- _originalSource(): JsSourceWithLazyMap | undefined
206
- nameForCondition(): string | undefined
207
- get blocks(): AsyncDependenciesBlock[]
208
- get dependencies(): Dependency[]
209
- size(ty?: string | undefined | null): number
210
- libIdent(options: JsLibIdentOptions): string | null
211
- _emitFile(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
212
- }
213
-
214
150
  export declare class Dependency {
215
151
  get _parentModule(): Module | undefined
216
152
  get type(): string
@@ -265,17 +201,6 @@ export declare class EntryOptionsDto {
265
201
  }
266
202
  export type EntryOptionsDTO = EntryOptionsDto
267
203
 
268
- export declare class ExternalModule {
269
- readableIdentifier(): string
270
- _originalSource(): JsSourceWithLazyMap | undefined
271
- nameForCondition(): string | undefined
272
- get blocks(): AsyncDependenciesBlock[]
273
- get dependencies(): Dependency[]
274
- size(ty?: string | undefined | null): number
275
- libIdent(options: JsLibIdentOptions): string | null
276
- _emitFile(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
277
- }
278
-
279
204
  /** Native operations on the owning compiler's current dependency collection. */
280
205
  export declare class FileSystemDependencies {
281
206
  get added(): Array<string>
@@ -298,10 +223,11 @@ export declare class JsCache {
298
223
  }
299
224
 
300
225
  export declare class JsCompilation {
301
- updateAsset(filename: string, newSourceOrFunction: JsSource | ((source: JsSource) => JsSource), assetInfoUpdateOrFunction?: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo | undefined)): void
226
+ updateAsset(filename: string, newSourceOrFunction: JsSourceFromJs | ((source: JsSource) => JsSourceFromJs), assetInfoUpdateOrFunction?: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo | undefined)): void
302
227
  getAssets(): Readonly<JsAsset>[]
303
228
  getAsset(name: string): JsAsset | null
304
229
  getAssetSource(name: string): JsSource | null
230
+ getAssetNativeSource(name: string): JsNativeSource | null
305
231
  get modules(): Modules
306
232
  get builtModules(): Array<Module>
307
233
  getOptimizationBailout(): Array<JsStatsOptimizationBailout>
@@ -310,11 +236,11 @@ export declare class JsCompilation {
310
236
  getNamedChunk(name: string): Chunk
311
237
  getNamedChunkGroupKeys(): Array<string>
312
238
  getNamedChunkGroup(name: string): ChunkGroup
313
- setAssetSource(name: string, source: JsSource): void
239
+ setAssetSource(name: string, source: JsSourceFromJs): void
314
240
  deleteAssetSource(name: string): void
315
241
  getAssetFilenames(): Array<string>
316
242
  hasAsset(name: string): boolean
317
- emitAsset(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
243
+ emitAsset(filename: string, source: JsSourceFromJs, assetInfo?: AssetInfo | undefined | null): void
318
244
  deleteAsset(filename: string): void
319
245
  renameAsset(filename: string, newName: string): void
320
246
  get entrypoints(): ChunkGroup[]
@@ -416,11 +342,6 @@ export declare class JsExportsInfo {
416
342
  getUsed(name: string | string[], runtime: string | string[] | undefined): 0 | 1 | 2 | 3 | 4
417
343
  }
418
344
 
419
- export declare class JsLoaderCache {
420
- get(loaderIndex: number, content: string | Uint8Array, existing: JsLoaderDependencies): Promise<JsLoaderCacheEntry | null>
421
- store(loaderIndex: number, output: JsLoaderCacheEntry): Promise<void>
422
- }
423
-
424
345
  export declare class JsModuleGraph {
425
346
  getModule(dependency: Dependency | EntryDependency): Module | null
426
347
  getResolvedModule(dependency: Dependency | EntryDependency): Module | null
@@ -437,6 +358,15 @@ export declare class JsModuleGraph {
437
358
  isAsync(module: Module): boolean
438
359
  }
439
360
 
361
+ /**
362
+ * An owned source reference transferred from the compiler to JavaScript.
363
+ *
364
+ * JavaScript uses this as an opaque handle when updating an existing asset.
365
+ */
366
+ export declare class JsNativeSource {
367
+ static fromSource(source: JsSourceFromJs): JsNativeSource
368
+ }
369
+
440
370
  export declare class JsResolver {
441
371
  resolveSync(path: string, request: string): string | undefined
442
372
  resolve(path: string, request: string, callback: (err: null | Error, req?: string) => void): void
@@ -452,20 +382,7 @@ export declare class JsStats {
452
382
  getLogging(acceptedTypes: number): Array<JsLog>
453
383
  }
454
384
 
455
- export declare class KnownBuildInfo {
456
-
457
- }
458
-
459
- export declare class Module {
460
- readableIdentifier(): string
461
- _originalSource(): JsSourceWithLazyMap | undefined
462
- nameForCondition(): string | undefined
463
- get blocks(): AsyncDependenciesBlock[]
464
- get dependencies(): Dependency[]
465
- size(ty?: string | undefined | null): number
466
- libIdent(options: JsLibIdentOptions): string | null
467
- _emitFile(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
468
- }
385
+ export declare class KnownBuildInfo {}
469
386
 
470
387
  export declare class ModuleGraphConnection {
471
388
  get dependency(): Dependency
@@ -482,11 +399,30 @@ export declare class Modules {
482
399
  values(): ReadonlyArray<Module>
483
400
  }
484
401
 
402
+ /** Owns the timestamp snapshot so either table can be converted after the watcher closes. */
403
+ export declare class NativeTimeInfoEntries {
404
+ get fileTimestamps(): NativeTimeInfoTable
405
+ get directoryTimestamps(): NativeTimeInfoTable
406
+ }
407
+
485
408
  export declare class NativeWatcher {
486
409
  constructor(options: NativeWatcherOptions)
487
410
  watch(files: [Array<string>, Array<string>], directories: [Array<string>, Array<string>], missing: [Array<string>, Array<string>], startTime: bigint, callback: (err: Error | null, result: NativeWatchResult) => void, callbackUndelayed: (event: NativeWatchUndelayedEvent) => void): void
488
411
  triggerEvent(kind: 'change' | 'remove' | 'create', path: string): void
489
412
  close(): Promise<void>
413
+ /**
414
+ * watchpack's `aggregatedChanges` / `aggregatedRemovals`: the events that
415
+ * arrived since the last aggregated batch (while paused), read without
416
+ * draining them.
417
+ */
418
+ peekAggregated(): NativeWatchResult
419
+ /**
420
+ * watchpack's `getAggregated`: the same events, drained, for the build
421
+ * that folds them in.
422
+ */
423
+ getAggregated(): NativeWatchResult
424
+ /** watchpack's `collectTimeInfoEntries`, over every registered path. */
425
+ collectTimeInfoEntries(): NativeTimeInfoEntries
490
426
  pause(): void
491
427
  }
492
428
 
@@ -495,7 +431,6 @@ export declare class NativeWatchResult {
495
431
  removedFiles: Array<string>
496
432
  }
497
433
 
498
-
499
434
  export declare class RawExternalItemFnCtx {
500
435
  data(): RawExternalItemFnCtxData
501
436
  getResolve(options?: RawResolveOptionsWithDependencyType | undefined | null): (context: string, path: string, callback: (error?: Error, text?: string) => void) => void
@@ -598,6 +533,7 @@ export declare enum BuiltinPluginName {
598
533
  RuntimePlugin = 'RuntimePlugin',
599
534
  JsonModulesPlugin = 'JsonModulesPlugin',
600
535
  InferAsyncModulesPlugin = 'InferAsyncModulesPlugin',
536
+ ImportedByDeferModulesPlugin = 'ImportedByDeferModulesPlugin',
601
537
  JavascriptModulesPlugin = 'JavascriptModulesPlugin',
602
538
  AsyncWebAssemblyModulesPlugin = 'AsyncWebAssemblyModulesPlugin',
603
539
  AssetModulesPlugin = 'AssetModulesPlugin',
@@ -643,11 +579,15 @@ export declare enum BuiltinPluginName {
643
579
  HttpUriPlugin = 'HttpUriPlugin',
644
580
  CssChunkingPlugin = 'CssChunkingPlugin',
645
581
  RscServerPlugin = 'RscServerPlugin',
646
- RscClientPlugin = 'RscClientPlugin'
582
+ RscClientPlugin = 'RscClientPlugin',
647
583
  }
648
584
 
649
585
  export declare function cleanupGlobalTrace(): void
650
586
 
587
+ export declare function concatenatedModuleGetModules(module: Module): Module[]
588
+
589
+ export declare function concatenatedModuleGetRootModule(module: Module): Module
590
+
651
591
  export interface ContextInfo {
652
592
  issuer: string
653
593
  issuerLayer?: string
@@ -656,14 +596,16 @@ export interface ContextInfo {
656
596
  export declare enum EnforceExtension {
657
597
  Auto = 0,
658
598
  Enabled = 1,
659
- Disabled = 2
599
+ Disabled = 2,
660
600
  }
661
601
 
662
602
  /**
663
603
  * Expected version of @rspack/core to the current binding version
664
604
  * @internal
665
605
  */
666
- export const EXPECTED_RSPACK_CORE_VERSION: string
606
+ export declare const EXPECTED_RSPACK_CORE_VERSION: string
607
+
608
+ export declare function externalModuleGetUserRequest(module: Module): string
667
609
 
668
610
  export declare function formatDiagnostic(diagnostic: JsDiagnostic): ExternalObject<'Diagnostic'>
669
611
 
@@ -901,6 +843,7 @@ export interface JsFactoryMeta {
901
843
  }
902
844
 
903
845
  export interface JsHelpers {
846
+ createModule: (kind: ModuleKind) => Module
904
847
  applyIndexedArrayUpdates: <T>(source: ReadonlyArray<T>, target: T[], commands: Uint32Array) => void
905
848
  swapRemoveArrayElements: <T>(array: T[], removedIndices: Uint32Array) => void
906
849
  }
@@ -977,14 +920,6 @@ export interface JsLinkPreloadData {
977
920
  chunk: Chunk
978
921
  }
979
922
 
980
- export interface JsLoaderCacheEntry {
981
- content: null | string | Uint8Array
982
- sourceMap?: Uint8Array
983
- addedDependencies: JsLoaderDependencies
984
- removedDependencies: JsLoaderDependencies
985
- parseMeta: Record<string, string>
986
- }
987
-
988
923
  export interface JsLoaderContext {
989
924
  resource: string
990
925
  _module: Module
@@ -996,11 +931,15 @@ export interface JsLoaderContext {
996
931
  sourceMap?: Buffer
997
932
  cacheable: boolean
998
933
  dependencies: JsLoaderDependencies
934
+ addedDependencies: JsLoaderDependencies
935
+ removedDependencies: JsLoaderDependencies
999
936
  loaderItems: Array<JsLoaderItem>
1000
937
  loaderIndex: number
1001
938
  loaderState: Readonly<JsLoaderState>
939
+ loaderChainStart: number
940
+ loaderChainEnd: number
1002
941
  __internal__error?: RspackError
1003
- __internal__loaderCache?: JsLoaderCache | undefined
942
+ __internal__diagnostics?: Array<JsRspackDiagnostic>
1004
943
  }
1005
944
 
1006
945
  export interface JsLoaderDependencies {
@@ -1017,12 +956,14 @@ export interface JsLoaderItem {
1017
956
  data: any
1018
957
  normalExecuted: boolean
1019
958
  pitchExecuted: boolean
959
+ codeFilter?: string | RegExp
960
+ filterMatched: boolean
1020
961
  noPitch: boolean
1021
962
  }
1022
963
 
1023
964
  export declare enum JsLoaderState {
1024
965
  Pitching = 'Pitching',
1025
- Normal = 'Normal'
966
+ Normal = 'Normal',
1026
967
  }
1027
968
 
1028
969
  export interface JsLog {
@@ -1077,6 +1018,13 @@ export interface JsRealContentHashPluginUpdateHashData {
1077
1018
  oldHash: string
1078
1019
  }
1079
1020
 
1021
+ export interface JsReplaceSourceEdit {
1022
+ start: number
1023
+ end: number
1024
+ content: string
1025
+ name?: string
1026
+ }
1027
+
1080
1028
  export interface JsResolveData {
1081
1029
  request: string
1082
1030
  context: string
@@ -1325,7 +1273,7 @@ export interface JsRspackDiagnostic {
1325
1273
 
1326
1274
  export declare enum JsRspackSeverity {
1327
1275
  Error = 'Error',
1328
- Warn = 'Warn'
1276
+ Warn = 'Warn',
1329
1277
  }
1330
1278
 
1331
1279
  export interface JsRuntimeGlobals {
@@ -1356,18 +1304,6 @@ export interface JsRuntimeRequirementInTreeResult {
1356
1304
  allRuntimeRequirements: JsRuntimeGlobals
1357
1305
  }
1358
1306
 
1359
- /**
1360
- * Zero copy `JsSourceFromJs` slice shared between Rust and Node.js if buffer is used.
1361
- *
1362
- * It can only be used in non-async context and the lifetime is bound to the fn closure.
1363
- *
1364
- * If you want to use Node.js Buffer in async context or want to extend the lifetime, use `JsSourceToJs` instead.
1365
- */
1366
- export interface JsSourceFromJs {
1367
- source: string | Buffer
1368
- map?: string
1369
- }
1370
-
1371
1307
  export interface JsSourceToJs {
1372
1308
  source: string | Buffer
1373
1309
  map?: string
@@ -1417,6 +1353,13 @@ export interface JsStatsAssetsByChunkName {
1417
1353
  files: Array<string>
1418
1354
  }
1419
1355
 
1356
+ export interface JsStatsCacheInfo {
1357
+ hits: number
1358
+ misses: number
1359
+ reused: number
1360
+ stores: number
1361
+ }
1362
+
1420
1363
  export interface JsStatsChildGroupChildAssets {
1421
1364
  preload?: Array<string>
1422
1365
  prefetch?: Array<string>
@@ -1470,6 +1413,7 @@ export interface JsStatsChunkGroupChildren {
1470
1413
  export interface JsStatsCompilation {
1471
1414
  assets?: Array<JsStatsAsset>
1472
1415
  assetsByChunkName?: Array<JsStatsAssetsByChunkName>
1416
+ cacheInfo?: Record<string, JsStatsCacheInfo>
1473
1417
  chunks?: Array<JsStatsChunk>
1474
1418
  entrypoints?: Array<JsStatsChunkGroup>
1475
1419
  errors: Array<JsStatsError>
@@ -1578,6 +1522,7 @@ export interface JsStatsOptimizationBailout {
1578
1522
 
1579
1523
  export interface JsStatsOptions {
1580
1524
  assets: boolean
1525
+ cacheInfo: boolean
1581
1526
  cachedModules: boolean
1582
1527
  chunks: boolean
1583
1528
  chunkGroupAuxiliary: boolean
@@ -1659,6 +1604,51 @@ export declare function minify(source: string, options: string): Promise<Transfo
1659
1604
 
1660
1605
  export declare function minifySync(source: string, options: string): TransformOutput
1661
1606
 
1607
+ export declare function moduleEmitFile(module: Module, filename: string, source: JsSourceFromJs, assetInfo?: AssetInfo | null): void
1608
+
1609
+ export declare function moduleGetBlocks(module: Module): AsyncDependenciesBlock[]
1610
+
1611
+ export declare function moduleGetBuildInfo(module: Module): BuildInfo
1612
+
1613
+ export declare function moduleGetContext(module: Module): string | undefined
1614
+
1615
+ export declare function moduleGetDependencies(module: Module): Dependency[]
1616
+
1617
+ export declare function moduleGetFactoryMeta(module: Module): JsFactoryMeta
1618
+
1619
+ export declare function moduleGetIdentifier(module: Module): string
1620
+
1621
+ export declare function moduleGetLayer(module: Module): string | undefined
1622
+
1623
+ export declare function moduleGetNameForCondition(module: Module): string | undefined
1624
+
1625
+ export declare function moduleGetOriginalSource(module: Module): JsSourceWithLazyMap | undefined
1626
+
1627
+ export declare function moduleGetReadableIdentifier(module: Module): string
1628
+
1629
+ export declare function moduleGetType(module: Module): string
1630
+
1631
+ export declare function moduleGetUseSimpleSourceMap(module: Module): boolean
1632
+
1633
+ export declare function moduleGetUseSourceMap(module: Module): boolean
1634
+
1635
+ /** JavaScript class selected when wrapping a native module. */
1636
+ export declare enum ModuleKind {
1637
+ Module = 0,
1638
+ Normal = 1,
1639
+ Concatenated = 2,
1640
+ Context = 3,
1641
+ External = 4,
1642
+ }
1643
+
1644
+ export declare function moduleLibIdent(module: Module, options: JsLibIdentOptions): string | null
1645
+
1646
+ export declare function moduleSetBuildInfo(module: Module, value: BuildInfo): void
1647
+
1648
+ export declare function moduleSetFactoryMeta(module: Module, factoryMeta: JsFactoryMeta): void
1649
+
1650
+ export declare function moduleSize(module: Module, ty?: string | null): number
1651
+
1662
1652
  /**
1663
1653
  * Module Resolution Options
1664
1654
  *
@@ -1831,16 +1821,34 @@ export interface NapiResolveOptions {
1831
1821
  enablePnp?: boolean
1832
1822
  }
1833
1823
 
1824
+ /**
1825
+ * One row of watchpack's `TimeInfoEntries`, flattened for napi: a file's
1826
+ * `Entry` carries all three times, a directory's `OnlySafeTimeEntry` only
1827
+ * `safe_time`, and an `ExistenceOnlyTimeEntry` sets `existence_only`.
1828
+ */
1829
+ export interface NativeTimeInfoEntry {
1830
+ path: string
1831
+ existenceOnly: boolean
1832
+ safeTime?: number
1833
+ timestamp?: number
1834
+ accuracy?: number
1835
+ }
1836
+
1837
+ export interface NativeTimeInfoTable {
1838
+ entries: Array<NativeTimeInfoEntry>
1839
+ missing: Array<string>
1840
+ }
1841
+
1834
1842
  export interface NativeWatcherOptions {
1835
1843
  followSymlinks?: boolean
1836
1844
  pollInterval?: number
1837
1845
  aggregateTimeout?: number
1838
1846
  /**
1839
1847
  * The ignored paths for the watcher.
1840
- * It can be a single path, an array of paths, a regular expression, or a
1841
- * predicate returning `true` for entries to ignore.
1848
+ * It can be a single path, a regular expression, an array mixing paths and
1849
+ * regular expressions, or a predicate returning `true` for entries to ignore.
1842
1850
  */
1843
- ignored?: string | string[] | RegExp | ((entry: string) => boolean)
1851
+ ignored?: string | RegExp | (string | RegExp)[] | ((entry: string) => boolean)
1844
1852
  }
1845
1853
 
1846
1854
  /**
@@ -1851,6 +1859,7 @@ export interface NativeWatcherOptions {
1851
1859
  export interface NativeWatchUndelayedEvent {
1852
1860
  kind: string
1853
1861
  path: string
1862
+ mtime?: null
1854
1863
  }
1855
1864
 
1856
1865
  export interface NodeFsStats {
@@ -1865,6 +1874,24 @@ export interface NodeFsStats {
1865
1874
  mode: number
1866
1875
  }
1867
1876
 
1877
+ export declare function normalModuleGetError(module: Module): RspackError | undefined
1878
+
1879
+ export declare function normalModuleGetLoaders(module: Module): Array<JsLoaderItem>
1880
+
1881
+ export declare function normalModuleGetMatchResource(module: Module): string | undefined
1882
+
1883
+ export declare function normalModuleGetRawRequest(module: Module): string
1884
+
1885
+ export declare function normalModuleGetRequest(module: Module): string
1886
+
1887
+ export declare function normalModuleGetResource(module: Module): string
1888
+
1889
+ export declare function normalModuleGetResourceResolveData(module: Module): Readonly<JsResourceData>
1890
+
1891
+ export declare function normalModuleGetUserRequest(module: Module): string
1892
+
1893
+ export declare function normalModuleSetMatchResource(module: Module, value: string | undefined): void
1894
+
1868
1895
  export interface PathWithInfo {
1869
1896
  path: string
1870
1897
  info: AssetInfo
@@ -1954,6 +1981,7 @@ export interface RawCacheGroupOptions {
1954
1981
  minSize?: number | RawSplitChunkSizes
1955
1982
  minSizeReduction?: number | RawSplitChunkSizes
1956
1983
  enforceSizeThreshold?: number | RawSplitChunkSizes
1984
+ minRemainingSize?: number | RawSplitChunkSizes
1957
1985
  maxSize?: number | RawSplitChunkSizes
1958
1986
  maxAsyncSize?: number | RawSplitChunkSizes
1959
1987
  maxInitialSize?: number | RawSplitChunkSizes
@@ -2208,6 +2236,7 @@ export interface RawCssExtractPluginOption {
2208
2236
 
2209
2237
  export interface RawCssGeneratorOptions {
2210
2238
  exportsOnly?: boolean
2239
+ runtimePublicPath?: boolean
2211
2240
  esModule?: boolean
2212
2241
  }
2213
2242
 
@@ -2222,6 +2251,7 @@ export interface RawCssImportContext {
2222
2251
  export interface RawCssModuleGeneratorOptions {
2223
2252
  exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only"
2224
2253
  exportsOnly?: boolean
2254
+ runtimePublicPath?: boolean
2225
2255
  localIdentHashDigest?: string
2226
2256
  localIdentHashDigestLength?: number
2227
2257
  localIdentHashFunction?: string
@@ -2329,6 +2359,7 @@ export interface RawEnvironment {
2329
2359
  templateLiteral: boolean
2330
2360
  dynamicImportInWorker: boolean
2331
2361
  importMetaDirnameAndFilename: boolean
2362
+ topLevelAwait: boolean
2332
2363
  }
2333
2364
 
2334
2365
  export interface RawEsmLibraryPlugin {
@@ -2370,10 +2401,15 @@ export interface RawExternalItemFnResult {
2370
2401
  result?: string | boolean | string[] | Record<string, string[]>
2371
2402
  }
2372
2403
 
2404
+ export interface RawExternalItemObject {
2405
+ values: Record<string, string | boolean | string[] | Record<string, string[]>>
2406
+ byLayer?: Record<string, Record<string, string | boolean | string[] | Record<string, string[]>>>
2407
+ }
2408
+
2373
2409
  export interface RawExternalsPluginOptions {
2374
2410
  type: string
2375
2411
  fallbackType?: string
2376
- externals: (string | RegExp | Record<string, string | boolean | string[] | Record<string, string[]>> | ((...args: any[]) => any))[]
2412
+ externals: (string | RegExp | RawExternalItemObject | ((...args: any[]) => any))[]
2377
2413
  placeInInitial: boolean
2378
2414
  }
2379
2415
 
@@ -2401,18 +2437,6 @@ export interface RawFallbackCacheGroupOptions {
2401
2437
  automaticNameDelimiter?: string
2402
2438
  }
2403
2439
 
2404
- export interface RawFileSystemCacheOptions {
2405
- buildDependencies: Array<string>
2406
- cacheDirectory: string
2407
- cacheLocation: string
2408
- version: string
2409
- readonly: boolean
2410
- maxMemoryGenerations?: number
2411
- idleTimeout: number
2412
- idleTimeoutForInitialStore: number
2413
- idleTimeoutAfterLargeChanges: number
2414
- }
2415
-
2416
2440
  export interface RawFlagAllModulesAsUsedPluginOptions {
2417
2441
  explanation: string
2418
2442
  }
@@ -2539,7 +2563,7 @@ export interface RawIntegrityItem {
2539
2563
  }
2540
2564
 
2541
2565
  export declare enum RawJavascriptParserCommonjsExports {
2542
- SkipInEsm = 'skipInEsm'
2566
+ SkipInEsm = 'skipInEsm',
2543
2567
  }
2544
2568
 
2545
2569
  export interface RawJavascriptParserCommonjsOptions {
@@ -2548,6 +2572,7 @@ export interface RawJavascriptParserCommonjsOptions {
2548
2572
 
2549
2573
  export interface RawJavascriptParserOptions {
2550
2574
  dynamicImportMode?: string
2575
+ dynamicUrl?: boolean
2551
2576
  dynamicImportPreload?: string
2552
2577
  dynamicImportPrefetch?: string
2553
2578
  dynamicImportFetchPriority?: string
@@ -2565,55 +2590,55 @@ export interface RawJavascriptParserOptions {
2565
2590
  importMeta?: string | Record<string, boolean>
2566
2591
  commonjsMagicComments?: boolean
2567
2592
  createRequire?: boolean | string
2568
- commonjs?: boolean | { exports?: boolean | 'skipInEsm' }
2569
- deferImport?: boolean
2570
- sourceImport?: boolean
2571
- /**
2572
- * This option is experimental in Rspack only and subject to change or be removed anytime.
2573
- * @experimental
2574
- */
2575
- requireAlias?: boolean
2576
- /**
2577
- * This option is experimental in Rspack only and subject to change or be removed anytime.
2578
- * @experimental
2579
- */
2580
- requireAsExpression?: boolean
2581
- /**
2582
- * This option is experimental in Rspack only and subject to change or be removed anytime.
2583
- * @experimental
2584
- */
2585
- requireDynamic?: boolean
2586
- /**
2587
- * This option is experimental in Rspack only and subject to change or be removed anytime.
2588
- * @experimental
2589
- */
2590
- requireResolve?: boolean
2591
- /**
2592
- * This option is experimental in Rspack only and subject to change or be removed anytime.
2593
- * @experimental
2594
- */
2595
- importDynamic?: boolean
2596
- /**
2597
- * This option is experimental in Rspack only and subject to change or be removed anytime.
2598
- * @experimental
2599
- */
2600
- typeReexportsPresence?: string
2601
- /**
2602
- * This option is experimental in Rspack only and subject to change or be removed anytime.
2603
- * @experimental
2604
- */
2605
- jsx?: boolean
2606
- /**
2607
- * This option is experimental in Rspack only and subject to change or be removed anytime.
2608
- * @experimental
2609
- */
2610
- importMetaResolve?: boolean
2611
- /**
2612
- * Flag top-level exported functions as side-effect-free for pure-function-based tree shaking.
2613
- * This option is experimental in Rspack only and subject to change or be removed anytime.
2614
- * @experimental
2615
- */
2616
- pureFunctions?: Array<string>
2593
+ commonjs?: boolean | { exports?: boolean | 'skipInEsm' }
2594
+ deferImport?: boolean
2595
+ sourceImport?: boolean
2596
+ /**
2597
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2598
+ * @experimental
2599
+ */
2600
+ requireAlias?: boolean
2601
+ /**
2602
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2603
+ * @experimental
2604
+ */
2605
+ requireAsExpression?: boolean
2606
+ /**
2607
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2608
+ * @experimental
2609
+ */
2610
+ requireDynamic?: boolean
2611
+ /**
2612
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2613
+ * @experimental
2614
+ */
2615
+ requireResolve?: boolean
2616
+ /**
2617
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2618
+ * @experimental
2619
+ */
2620
+ importDynamic?: boolean
2621
+ /**
2622
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2623
+ * @experimental
2624
+ */
2625
+ typeReexportsPresence?: string
2626
+ /**
2627
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2628
+ * @experimental
2629
+ */
2630
+ jsx?: boolean
2631
+ /**
2632
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2633
+ * @experimental
2634
+ */
2635
+ importMetaResolve?: boolean
2636
+ /**
2637
+ * Flag top-level exported functions as side-effect-free for pure-function-based tree shaking.
2638
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2639
+ * @experimental
2640
+ */
2641
+ pureFunctions?: Array<string>
2617
2642
  }
2618
2643
 
2619
2644
  export interface RawJavascriptParserWorkerOptions {
@@ -2631,12 +2656,12 @@ export interface RawJsonParserOptions {
2631
2656
  }
2632
2657
 
2633
2658
  export interface RawLazyCompilationOption {
2634
- takeNewlyActiveModules: ((err: Error | null, ) => Set<string>)
2659
+ takeNewlyActiveModules: ((err: Error | null) => Set<string>)
2635
2660
  test?: RawLazyCompilationTest
2636
2661
  entries: boolean
2637
2662
  imports: boolean
2638
2663
  client: string
2639
- reservedExternals: Array<string>
2664
+ collectReservedExternals: (layer?: string | null) => string[]
2640
2665
  }
2641
2666
 
2642
2667
  export interface RawLibManifestPluginOptions {
@@ -2756,6 +2781,7 @@ export interface RawModuleOptions {
2756
2781
  }
2757
2782
 
2758
2783
  export interface RawModuleRule {
2784
+ as?: string
2759
2785
  /**
2760
2786
  * A conditional match matching an absolute path + query + fragment.
2761
2787
  * Note:
@@ -2809,6 +2835,7 @@ export interface RawModuleRuleUse {
2809
2835
  options?: string
2810
2836
  cache: boolean
2811
2837
  optionsCacheKey: string
2838
+ codeFilter?: string | RegExp
2812
2839
  }
2813
2840
 
2814
2841
  export interface RawNewCache {
@@ -2867,15 +2894,15 @@ export interface RawOptions {
2867
2894
  module: RawModuleOptions
2868
2895
  optimization: RawOptimizationOptions
2869
2896
  stats: RawStatsOptions
2870
- cache: boolean | { type: "memory" } | ({ type: "persistent" } & RawCacheOptionsPersistent) | ({ type: "filesystem" } & RawFileSystemCacheOptions)
2897
+ cache: boolean | { type: "memory" } | ({ type: "persistent" } & RawCacheOptionsPersistent)
2871
2898
  snapshot: RawSnapshotOptions
2872
2899
  experiments: RawExperiments
2873
- incremental?: false | { [key: string]: boolean }
2874
- node?: RawNodeOption
2875
- amd?: string
2876
- bail: boolean
2877
- __references: Record<string, any>
2878
- __virtual_files?: Array<JsVirtualFile>
2900
+ incremental?: false | { [key: string]: boolean }
2901
+ node?: RawNodeOption
2902
+ amd?: string
2903
+ bail: boolean
2904
+ __references: Record<string, any>
2905
+ __virtual_files?: Array<JsVirtualFile>
2879
2906
  }
2880
2907
 
2881
2908
  export interface RawOutputOptions {
@@ -2906,6 +2933,7 @@ export interface RawOutputOptions {
2906
2933
  importMetaName: string
2907
2934
  iife: boolean
2908
2935
  module: boolean
2936
+ chunkFormat: string | false
2909
2937
  chunkLoading: string | false
2910
2938
  chunkLoadTimeout: number
2911
2939
  enabledChunkLoadingTypes?: Array<string>
@@ -3073,6 +3101,10 @@ export interface RawRstestDynamicImportOriginOptions {
3073
3101
  functionName?: string
3074
3102
  }
3075
3103
 
3104
+ export interface RawRstestImportMetaResolveOriginOptions {
3105
+ functionName?: string
3106
+ }
3107
+
3076
3108
  export interface RawRstestPluginOptions {
3077
3109
  injectModulePathName: boolean
3078
3110
  importMetaPathName: boolean
@@ -3085,10 +3117,18 @@ export interface RawRstestPluginOptions {
3085
3117
  * `globalThis['@rstest/core/import-meta']?.(<absolute source path>)`.
3086
3118
  */
3087
3119
  injectImportMetaRstestOrigin?: boolean
3088
- injectDynamicImportOrigin?: boolean | { functionName?: string }
3089
- updateImportMockAPI?: boolean
3090
- updateRequireMockAPI?: boolean
3091
- injectRequireResolveOrigin?: boolean | { functionName?: string }
3120
+ injectDynamicImportOrigin?: boolean | { functionName?: string }
3121
+ updateImportMockAPI?: boolean
3122
+ updateRequireMockAPI?: boolean
3123
+ injectRequireResolveOrigin?: boolean | { functionName?: string }
3124
+ /**
3125
+ * Replace `import.meta.resolve` with a call to a runtime factory receiving
3126
+ * the absolute source path. The factory must return a stable resolver for
3127
+ * that source module. Defaults to `__rstest_import_meta_resolve__`.
3128
+ * Modules with `parser.importMetaResolve: true` use Rspack's built-in
3129
+ * resolution instead.
3130
+ */
3131
+ injectImportMetaResolveOrigin?: boolean | { functionName?: string }
3092
3132
  }
3093
3133
 
3094
3134
  export interface RawRstestRequireResolveOriginOptions {
@@ -3109,7 +3149,7 @@ export declare enum RawRuleSetConditionType {
3109
3149
  regexp = 'regexp',
3110
3150
  logical = 'logical',
3111
3151
  array = 'array',
3112
- func = 'func'
3152
+ func = 'func',
3113
3153
  }
3114
3154
 
3115
3155
  export interface RawRuleSetLogicalConditions {
@@ -3207,12 +3247,14 @@ export interface RawStatsOptions {
3207
3247
  export interface RawStorageOptions {
3208
3248
  type: "filesystem"
3209
3249
  directory: string
3250
+ location: string
3210
3251
  }
3211
3252
 
3212
3253
  export interface RawSubresourceIntegrityPluginOptions {
3213
3254
  integrityCallback?: (data: RawIntegrityData) => void
3214
3255
  hashFuncNames: Array<string>
3215
3256
  htmlPlugin: "JavaScript" | "Native" | "Disabled"
3257
+ hashLoading: "eager" | "lazy"
3216
3258
  }
3217
3259
 
3218
3260
  export interface RawSwcEmitDtsOptions {
@@ -3241,7 +3283,7 @@ export declare enum RawSyncModuleIdsPluginMode {
3241
3283
  Read = 'read',
3242
3284
  Create = 'create',
3243
3285
  Merge = 'merge',
3244
- Update = 'update'
3286
+ Update = 'update',
3245
3287
  }
3246
3288
 
3247
3289
  export interface RawSyncModuleIdsPluginOptions {
@@ -3341,7 +3383,7 @@ export declare enum RegisterJsTapKind {
3341
3383
  RsdoctorPluginChunkGraph = 50,
3342
3384
  RsdoctorPluginModuleIds = 51,
3343
3385
  RsdoctorPluginModuleSources = 52,
3344
- RsdoctorPluginAssets = 53
3386
+ RsdoctorPluginAssets = 53,
3345
3387
  }
3346
3388
 
3347
3389
  export interface RegisterJsTaps {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohos-ports/rspack-binding",
3
- "version": "2.2.9-beta.0",
3
+ "version": "2.3.2-beta.0",
4
4
  "license": "MIT",
5
5
  "description": "Node binding loader for rspack (OpenHarmony port: probes @ohos-ports/rspack-binding-openharmony-arm64 on openharmony/arm64)",
6
6
  "main": "binding.js",
@@ -12,7 +12,7 @@
12
12
  "webcontainer-fallback.cjs"
13
13
  ],
14
14
  "optionalDependencies": {
15
- "@ohos-ports/rspack-binding-openharmony-arm64": "2.2.9-beta.0"
15
+ "@ohos-ports/rspack-binding-openharmony-arm64": "2.3.2-beta.0"
16
16
  },
17
17
  "homepage": "https://rspack.rs",
18
18
  "bugs": {
@@ -21,7 +21,7 @@
21
21
  "repository": {
22
22
  "type": "git",
23
23
  "url": "https://github.com/ohos-ports/ohos-ports.git",
24
- "directory": "ports/@rspack/binding/2.2.9"
24
+ "directory": "ports/@rspack/binding/2.3.2"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"