@ohos-ports/rspack-binding 2.2.9-beta.0 → 2.3.4-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.4`.
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
+ taken from the official upstream `@rspack/binding-linux-arm64-musl@2.3.4`
32
+ prebuilt (exact version match) and signed with `binary-sign-tool -selfSign 1`.
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
 
@@ -818,6 +760,7 @@ export interface JsCodegenerationResults {
818
760
  }
819
761
 
820
762
  export interface JsCreateData {
763
+ context?: string
821
764
  request: string
822
765
  userRequest: string
823
766
  resource: string
@@ -901,6 +844,7 @@ export interface JsFactoryMeta {
901
844
  }
902
845
 
903
846
  export interface JsHelpers {
847
+ createModule: (kind: ModuleKind) => Module
904
848
  applyIndexedArrayUpdates: <T>(source: ReadonlyArray<T>, target: T[], commands: Uint32Array) => void
905
849
  swapRemoveArrayElements: <T>(array: T[], removedIndices: Uint32Array) => void
906
850
  }
@@ -977,14 +921,6 @@ export interface JsLinkPreloadData {
977
921
  chunk: Chunk
978
922
  }
979
923
 
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
924
  export interface JsLoaderContext {
989
925
  resource: string
990
926
  _module: Module
@@ -996,11 +932,15 @@ export interface JsLoaderContext {
996
932
  sourceMap?: Buffer
997
933
  cacheable: boolean
998
934
  dependencies: JsLoaderDependencies
935
+ addedDependencies: JsLoaderDependencies
936
+ removedDependencies: JsLoaderDependencies
999
937
  loaderItems: Array<JsLoaderItem>
1000
938
  loaderIndex: number
1001
939
  loaderState: Readonly<JsLoaderState>
940
+ loaderChainStart: number
941
+ loaderChainEnd: number
1002
942
  __internal__error?: RspackError
1003
- __internal__loaderCache?: JsLoaderCache | undefined
943
+ __internal__diagnostics?: Array<JsRspackDiagnostic>
1004
944
  }
1005
945
 
1006
946
  export interface JsLoaderDependencies {
@@ -1017,12 +957,14 @@ export interface JsLoaderItem {
1017
957
  data: any
1018
958
  normalExecuted: boolean
1019
959
  pitchExecuted: boolean
960
+ codeFilter?: string | RegExp
961
+ filterMatched: boolean
1020
962
  noPitch: boolean
1021
963
  }
1022
964
 
1023
965
  export declare enum JsLoaderState {
1024
966
  Pitching = 'Pitching',
1025
- Normal = 'Normal'
967
+ Normal = 'Normal',
1026
968
  }
1027
969
 
1028
970
  export interface JsLog {
@@ -1077,6 +1019,13 @@ export interface JsRealContentHashPluginUpdateHashData {
1077
1019
  oldHash: string
1078
1020
  }
1079
1021
 
1022
+ export interface JsReplaceSourceEdit {
1023
+ start: number
1024
+ end: number
1025
+ content: string
1026
+ name?: string
1027
+ }
1028
+
1080
1029
  export interface JsResolveData {
1081
1030
  request: string
1082
1031
  context: string
@@ -1325,7 +1274,7 @@ export interface JsRspackDiagnostic {
1325
1274
 
1326
1275
  export declare enum JsRspackSeverity {
1327
1276
  Error = 'Error',
1328
- Warn = 'Warn'
1277
+ Warn = 'Warn',
1329
1278
  }
1330
1279
 
1331
1280
  export interface JsRuntimeGlobals {
@@ -1356,18 +1305,6 @@ export interface JsRuntimeRequirementInTreeResult {
1356
1305
  allRuntimeRequirements: JsRuntimeGlobals
1357
1306
  }
1358
1307
 
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
1308
  export interface JsSourceToJs {
1372
1309
  source: string | Buffer
1373
1310
  map?: string
@@ -1417,6 +1354,13 @@ export interface JsStatsAssetsByChunkName {
1417
1354
  files: Array<string>
1418
1355
  }
1419
1356
 
1357
+ export interface JsStatsCacheInfo {
1358
+ hits: number
1359
+ misses: number
1360
+ reused: number
1361
+ stores: number
1362
+ }
1363
+
1420
1364
  export interface JsStatsChildGroupChildAssets {
1421
1365
  preload?: Array<string>
1422
1366
  prefetch?: Array<string>
@@ -1470,6 +1414,7 @@ export interface JsStatsChunkGroupChildren {
1470
1414
  export interface JsStatsCompilation {
1471
1415
  assets?: Array<JsStatsAsset>
1472
1416
  assetsByChunkName?: Array<JsStatsAssetsByChunkName>
1417
+ cacheInfo?: Record<string, JsStatsCacheInfo>
1473
1418
  chunks?: Array<JsStatsChunk>
1474
1419
  entrypoints?: Array<JsStatsChunkGroup>
1475
1420
  errors: Array<JsStatsError>
@@ -1578,6 +1523,7 @@ export interface JsStatsOptimizationBailout {
1578
1523
 
1579
1524
  export interface JsStatsOptions {
1580
1525
  assets: boolean
1526
+ cacheInfo: boolean
1581
1527
  cachedModules: boolean
1582
1528
  chunks: boolean
1583
1529
  chunkGroupAuxiliary: boolean
@@ -1659,6 +1605,51 @@ export declare function minify(source: string, options: string): Promise<Transfo
1659
1605
 
1660
1606
  export declare function minifySync(source: string, options: string): TransformOutput
1661
1607
 
1608
+ export declare function moduleEmitFile(module: Module, filename: string, source: JsSourceFromJs, assetInfo?: AssetInfo | null): void
1609
+
1610
+ export declare function moduleGetBlocks(module: Module): AsyncDependenciesBlock[]
1611
+
1612
+ export declare function moduleGetBuildInfo(module: Module): BuildInfo
1613
+
1614
+ export declare function moduleGetContext(module: Module): string | undefined
1615
+
1616
+ export declare function moduleGetDependencies(module: Module): Dependency[]
1617
+
1618
+ export declare function moduleGetFactoryMeta(module: Module): JsFactoryMeta
1619
+
1620
+ export declare function moduleGetIdentifier(module: Module): string
1621
+
1622
+ export declare function moduleGetLayer(module: Module): string | undefined
1623
+
1624
+ export declare function moduleGetNameForCondition(module: Module): string | undefined
1625
+
1626
+ export declare function moduleGetOriginalSource(module: Module): JsSourceWithLazyMap | undefined
1627
+
1628
+ export declare function moduleGetReadableIdentifier(module: Module): string
1629
+
1630
+ export declare function moduleGetType(module: Module): string
1631
+
1632
+ export declare function moduleGetUseSimpleSourceMap(module: Module): boolean
1633
+
1634
+ export declare function moduleGetUseSourceMap(module: Module): boolean
1635
+
1636
+ /** JavaScript class selected when wrapping a native module. */
1637
+ export declare enum ModuleKind {
1638
+ Module = 0,
1639
+ Normal = 1,
1640
+ Concatenated = 2,
1641
+ Context = 3,
1642
+ External = 4,
1643
+ }
1644
+
1645
+ export declare function moduleLibIdent(module: Module, options: JsLibIdentOptions): string | null
1646
+
1647
+ export declare function moduleSetBuildInfo(module: Module, value: BuildInfo): void
1648
+
1649
+ export declare function moduleSetFactoryMeta(module: Module, factoryMeta: JsFactoryMeta): void
1650
+
1651
+ export declare function moduleSize(module: Module, ty?: string | null): number
1652
+
1662
1653
  /**
1663
1654
  * Module Resolution Options
1664
1655
  *
@@ -1831,16 +1822,34 @@ export interface NapiResolveOptions {
1831
1822
  enablePnp?: boolean
1832
1823
  }
1833
1824
 
1825
+ /**
1826
+ * One row of watchpack's `TimeInfoEntries`, flattened for napi: a file's
1827
+ * `Entry` carries all three times, a directory's `OnlySafeTimeEntry` only
1828
+ * `safe_time`, and an `ExistenceOnlyTimeEntry` sets `existence_only`.
1829
+ */
1830
+ export interface NativeTimeInfoEntry {
1831
+ path: string
1832
+ existenceOnly: boolean
1833
+ safeTime?: number
1834
+ timestamp?: number
1835
+ accuracy?: number
1836
+ }
1837
+
1838
+ export interface NativeTimeInfoTable {
1839
+ entries: Array<NativeTimeInfoEntry>
1840
+ missing: Array<string>
1841
+ }
1842
+
1834
1843
  export interface NativeWatcherOptions {
1835
1844
  followSymlinks?: boolean
1836
1845
  pollInterval?: number
1837
1846
  aggregateTimeout?: number
1838
1847
  /**
1839
1848
  * 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.
1849
+ * It can be a single path, a regular expression, an array mixing paths and
1850
+ * regular expressions, or a predicate returning `true` for entries to ignore.
1842
1851
  */
1843
- ignored?: string | string[] | RegExp | ((entry: string) => boolean)
1852
+ ignored?: string | RegExp | (string | RegExp)[] | ((entry: string) => boolean)
1844
1853
  }
1845
1854
 
1846
1855
  /**
@@ -1851,6 +1860,7 @@ export interface NativeWatcherOptions {
1851
1860
  export interface NativeWatchUndelayedEvent {
1852
1861
  kind: string
1853
1862
  path: string
1863
+ mtime?: null
1854
1864
  }
1855
1865
 
1856
1866
  export interface NodeFsStats {
@@ -1865,6 +1875,24 @@ export interface NodeFsStats {
1865
1875
  mode: number
1866
1876
  }
1867
1877
 
1878
+ export declare function normalModuleGetError(module: Module): RspackError | undefined
1879
+
1880
+ export declare function normalModuleGetLoaders(module: Module): Array<JsLoaderItem>
1881
+
1882
+ export declare function normalModuleGetMatchResource(module: Module): string | undefined
1883
+
1884
+ export declare function normalModuleGetRawRequest(module: Module): string
1885
+
1886
+ export declare function normalModuleGetRequest(module: Module): string
1887
+
1888
+ export declare function normalModuleGetResource(module: Module): string
1889
+
1890
+ export declare function normalModuleGetResourceResolveData(module: Module): Readonly<JsResourceData>
1891
+
1892
+ export declare function normalModuleGetUserRequest(module: Module): string
1893
+
1894
+ export declare function normalModuleSetMatchResource(module: Module, value: string | undefined): void
1895
+
1868
1896
  export interface PathWithInfo {
1869
1897
  path: string
1870
1898
  info: AssetInfo
@@ -1954,6 +1982,7 @@ export interface RawCacheGroupOptions {
1954
1982
  minSize?: number | RawSplitChunkSizes
1955
1983
  minSizeReduction?: number | RawSplitChunkSizes
1956
1984
  enforceSizeThreshold?: number | RawSplitChunkSizes
1985
+ minRemainingSize?: number | RawSplitChunkSizes
1957
1986
  maxSize?: number | RawSplitChunkSizes
1958
1987
  maxAsyncSize?: number | RawSplitChunkSizes
1959
1988
  maxInitialSize?: number | RawSplitChunkSizes
@@ -2005,10 +2034,12 @@ export interface RawCollectShareEntryPluginOptions {
2005
2034
 
2006
2035
  export interface RawCompactHashedChunkIdsPluginOptions {
2007
2036
  minLength?: number
2037
+ salt?: number
2008
2038
  }
2009
2039
 
2010
2040
  export interface RawCompactHashedModuleIdsPluginOptions {
2011
2041
  minLength?: number
2042
+ salt?: number
2012
2043
  }
2013
2044
 
2014
2045
  export interface RawCompilerPlatform {
@@ -2208,6 +2239,7 @@ export interface RawCssExtractPluginOption {
2208
2239
 
2209
2240
  export interface RawCssGeneratorOptions {
2210
2241
  exportsOnly?: boolean
2242
+ runtimePublicPath?: boolean
2211
2243
  esModule?: boolean
2212
2244
  }
2213
2245
 
@@ -2222,6 +2254,7 @@ export interface RawCssImportContext {
2222
2254
  export interface RawCssModuleGeneratorOptions {
2223
2255
  exportsConvention?: "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only"
2224
2256
  exportsOnly?: boolean
2257
+ runtimePublicPath?: boolean
2225
2258
  localIdentHashDigest?: string
2226
2259
  localIdentHashDigestLength?: number
2227
2260
  localIdentHashFunction?: string
@@ -2252,6 +2285,10 @@ export interface RawCssParserOptions {
2252
2285
  resolveImport?: boolean | ((context: { url: string, media: string | undefined, resourcePath: string, supports: string | undefined, layer: string | undefined }) => boolean)
2253
2286
  }
2254
2287
 
2288
+ export interface RawDeterministicChunkIdsPluginOptions {
2289
+ salt?: number
2290
+ }
2291
+
2255
2292
  export interface RawDeterministicModuleIdsPluginOptions {
2256
2293
  context?: string
2257
2294
  test?: (module: Module) => boolean
@@ -2292,6 +2329,7 @@ export interface RawDllReferenceAgencyPluginOptions {
2292
2329
 
2293
2330
  export interface RawDraft {
2294
2331
  customMedia: boolean
2332
+ scrollNavigationControls: boolean
2295
2333
  }
2296
2334
 
2297
2335
  export interface RawDynamicEntryPluginOptions {
@@ -2326,9 +2364,12 @@ export interface RawEnvironment {
2326
2364
  module: boolean
2327
2365
  optionalChaining: boolean
2328
2366
  logicalAssignment: boolean
2367
+ spread: boolean
2368
+ symbol: boolean
2329
2369
  templateLiteral: boolean
2330
2370
  dynamicImportInWorker: boolean
2331
2371
  importMetaDirnameAndFilename: boolean
2372
+ topLevelAwait: boolean
2332
2373
  }
2333
2374
 
2334
2375
  export interface RawEsmLibraryPlugin {
@@ -2370,10 +2411,15 @@ export interface RawExternalItemFnResult {
2370
2411
  result?: string | boolean | string[] | Record<string, string[]>
2371
2412
  }
2372
2413
 
2414
+ export interface RawExternalItemObject {
2415
+ values: Record<string, string | boolean | string[] | Record<string, string[]>>
2416
+ byLayer?: Record<string, Record<string, string | boolean | string[] | Record<string, string[]>>>
2417
+ }
2418
+
2373
2419
  export interface RawExternalsPluginOptions {
2374
2420
  type: string
2375
2421
  fallbackType?: string
2376
- externals: (string | RegExp | Record<string, string | boolean | string[] | Record<string, string[]>> | ((...args: any[]) => any))[]
2422
+ externals: (string | RegExp | RawExternalItemObject | ((...args: any[]) => any))[]
2377
2423
  placeInInitial: boolean
2378
2424
  }
2379
2425
 
@@ -2401,18 +2447,6 @@ export interface RawFallbackCacheGroupOptions {
2401
2447
  automaticNameDelimiter?: string
2402
2448
  }
2403
2449
 
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
2450
  export interface RawFlagAllModulesAsUsedPluginOptions {
2417
2451
  explanation: string
2418
2452
  }
@@ -2539,7 +2573,7 @@ export interface RawIntegrityItem {
2539
2573
  }
2540
2574
 
2541
2575
  export declare enum RawJavascriptParserCommonjsExports {
2542
- SkipInEsm = 'skipInEsm'
2576
+ SkipInEsm = 'skipInEsm',
2543
2577
  }
2544
2578
 
2545
2579
  export interface RawJavascriptParserCommonjsOptions {
@@ -2548,6 +2582,7 @@ export interface RawJavascriptParserCommonjsOptions {
2548
2582
 
2549
2583
  export interface RawJavascriptParserOptions {
2550
2584
  dynamicImportMode?: string
2585
+ dynamicUrl?: boolean
2551
2586
  dynamicImportPreload?: string
2552
2587
  dynamicImportPrefetch?: string
2553
2588
  dynamicImportFetchPriority?: string
@@ -2565,55 +2600,55 @@ export interface RawJavascriptParserOptions {
2565
2600
  importMeta?: string | Record<string, boolean>
2566
2601
  commonjsMagicComments?: boolean
2567
2602
  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>
2603
+ commonjs?: boolean | { exports?: boolean | 'skipInEsm' }
2604
+ deferImport?: boolean
2605
+ sourceImport?: boolean
2606
+ /**
2607
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2608
+ * @experimental
2609
+ */
2610
+ requireAlias?: boolean
2611
+ /**
2612
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2613
+ * @experimental
2614
+ */
2615
+ requireAsExpression?: boolean
2616
+ /**
2617
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2618
+ * @experimental
2619
+ */
2620
+ requireDynamic?: boolean
2621
+ /**
2622
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2623
+ * @experimental
2624
+ */
2625
+ requireResolve?: boolean
2626
+ /**
2627
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2628
+ * @experimental
2629
+ */
2630
+ importDynamic?: boolean
2631
+ /**
2632
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2633
+ * @experimental
2634
+ */
2635
+ typeReexportsPresence?: string
2636
+ /**
2637
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2638
+ * @experimental
2639
+ */
2640
+ jsx?: boolean
2641
+ /**
2642
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2643
+ * @experimental
2644
+ */
2645
+ importMetaResolve?: boolean
2646
+ /**
2647
+ * Flag top-level exported functions as side-effect-free for pure-function-based tree shaking.
2648
+ * This option is experimental in Rspack only and subject to change or be removed anytime.
2649
+ * @experimental
2650
+ */
2651
+ pureFunctions?: Array<string>
2617
2652
  }
2618
2653
 
2619
2654
  export interface RawJavascriptParserWorkerOptions {
@@ -2631,12 +2666,12 @@ export interface RawJsonParserOptions {
2631
2666
  }
2632
2667
 
2633
2668
  export interface RawLazyCompilationOption {
2634
- takeNewlyActiveModules: ((err: Error | null, ) => Set<string>)
2669
+ takeNewlyActiveModules: ((err: Error | null) => Set<string>)
2635
2670
  test?: RawLazyCompilationTest
2636
2671
  entries: boolean
2637
2672
  imports: boolean
2638
2673
  client: string
2639
- reservedExternals: Array<string>
2674
+ collectReservedExternals: (layer?: string | null) => string[]
2640
2675
  }
2641
2676
 
2642
2677
  export interface RawLibManifestPluginOptions {
@@ -2756,6 +2791,7 @@ export interface RawModuleOptions {
2756
2791
  }
2757
2792
 
2758
2793
  export interface RawModuleRule {
2794
+ as?: string
2759
2795
  /**
2760
2796
  * A conditional match matching an absolute path + query + fragment.
2761
2797
  * Note:
@@ -2809,6 +2845,7 @@ export interface RawModuleRuleUse {
2809
2845
  options?: string
2810
2846
  cache: boolean
2811
2847
  optionsCacheKey: string
2848
+ codeFilter?: string | RegExp
2812
2849
  }
2813
2850
 
2814
2851
  export interface RawNewCache {
@@ -2867,15 +2904,15 @@ export interface RawOptions {
2867
2904
  module: RawModuleOptions
2868
2905
  optimization: RawOptimizationOptions
2869
2906
  stats: RawStatsOptions
2870
- cache: boolean | { type: "memory" } | ({ type: "persistent" } & RawCacheOptionsPersistent) | ({ type: "filesystem" } & RawFileSystemCacheOptions)
2907
+ cache: boolean | { type: "memory" } | ({ type: "persistent" } & RawCacheOptionsPersistent)
2871
2908
  snapshot: RawSnapshotOptions
2872
2909
  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>
2910
+ incremental?: false | { [key: string]: boolean }
2911
+ node?: RawNodeOption
2912
+ amd?: string
2913
+ bail: boolean
2914
+ __references: Record<string, any>
2915
+ __virtual_files?: Array<JsVirtualFile>
2879
2916
  }
2880
2917
 
2881
2918
  export interface RawOutputOptions {
@@ -2906,6 +2943,7 @@ export interface RawOutputOptions {
2906
2943
  importMetaName: string
2907
2944
  iife: boolean
2908
2945
  module: boolean
2946
+ chunkFormat: string | false
2909
2947
  chunkLoading: string | false
2910
2948
  chunkLoadTimeout: number
2911
2949
  enabledChunkLoadingTypes?: Array<string>
@@ -3073,6 +3111,10 @@ export interface RawRstestDynamicImportOriginOptions {
3073
3111
  functionName?: string
3074
3112
  }
3075
3113
 
3114
+ export interface RawRstestImportMetaResolveOriginOptions {
3115
+ functionName?: string
3116
+ }
3117
+
3076
3118
  export interface RawRstestPluginOptions {
3077
3119
  injectModulePathName: boolean
3078
3120
  importMetaPathName: boolean
@@ -3085,10 +3127,18 @@ export interface RawRstestPluginOptions {
3085
3127
  * `globalThis['@rstest/core/import-meta']?.(<absolute source path>)`.
3086
3128
  */
3087
3129
  injectImportMetaRstestOrigin?: boolean
3088
- injectDynamicImportOrigin?: boolean | { functionName?: string }
3089
- updateImportMockAPI?: boolean
3090
- updateRequireMockAPI?: boolean
3091
- injectRequireResolveOrigin?: boolean | { functionName?: string }
3130
+ injectDynamicImportOrigin?: boolean | { functionName?: string }
3131
+ updateImportMockAPI?: boolean
3132
+ updateRequireMockAPI?: boolean
3133
+ injectRequireResolveOrigin?: boolean | { functionName?: string }
3134
+ /**
3135
+ * Replace `import.meta.resolve` with a call to a runtime factory receiving
3136
+ * the absolute source path. The factory must return a stable resolver for
3137
+ * that source module. Defaults to `__rstest_import_meta_resolve__`.
3138
+ * Modules with `parser.importMetaResolve: true` use Rspack's built-in
3139
+ * resolution instead.
3140
+ */
3141
+ injectImportMetaResolveOrigin?: boolean | { functionName?: string }
3092
3142
  }
3093
3143
 
3094
3144
  export interface RawRstestRequireResolveOriginOptions {
@@ -3109,7 +3159,7 @@ export declare enum RawRuleSetConditionType {
3109
3159
  regexp = 'regexp',
3110
3160
  logical = 'logical',
3111
3161
  array = 'array',
3112
- func = 'func'
3162
+ func = 'func',
3113
3163
  }
3114
3164
 
3115
3165
  export interface RawRuleSetLogicalConditions {
@@ -3207,12 +3257,14 @@ export interface RawStatsOptions {
3207
3257
  export interface RawStorageOptions {
3208
3258
  type: "filesystem"
3209
3259
  directory: string
3260
+ location: string
3210
3261
  }
3211
3262
 
3212
3263
  export interface RawSubresourceIntegrityPluginOptions {
3213
3264
  integrityCallback?: (data: RawIntegrityData) => void
3214
3265
  hashFuncNames: Array<string>
3215
3266
  htmlPlugin: "JavaScript" | "Native" | "Disabled"
3267
+ hashLoading: "eager" | "lazy"
3216
3268
  }
3217
3269
 
3218
3270
  export interface RawSwcEmitDtsOptions {
@@ -3241,7 +3293,7 @@ export declare enum RawSyncModuleIdsPluginMode {
3241
3293
  Read = 'read',
3242
3294
  Create = 'create',
3243
3295
  Merge = 'merge',
3244
- Update = 'update'
3296
+ Update = 'update',
3245
3297
  }
3246
3298
 
3247
3299
  export interface RawSyncModuleIdsPluginOptions {
@@ -3341,7 +3393,7 @@ export declare enum RegisterJsTapKind {
3341
3393
  RsdoctorPluginChunkGraph = 50,
3342
3394
  RsdoctorPluginModuleIds = 51,
3343
3395
  RsdoctorPluginModuleSources = 52,
3344
- RsdoctorPluginAssets = 53
3396
+ RsdoctorPluginAssets = 53,
3345
3397
  }
3346
3398
 
3347
3399
  export interface RegisterJsTaps {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@ohos-ports/rspack-binding",
3
- "version": "2.2.9-beta.0",
3
+ "version": "2.3.4-beta.0",
4
4
  "license": "MIT",
5
- "description": "Node binding loader for rspack (OpenHarmony port: probes @ohos-ports/rspack-binding-openharmony-arm64 on openharmony/arm64)",
5
+ "description": "Node binding loader for rspack (OpenHarmony port: probes @ohos-ports/rspack-binding-openharmony-arm64 on openharmony/arm64; binary from upstream @rspack/binding-linux-arm64-musl@2.3.4 prebuilt, signed)",
6
6
  "main": "binding.js",
7
7
  "types": "binding.d.ts",
8
8
  "files": [
@@ -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.4-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.4"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"