@ohos-ports/rspack-binding 2.2.2-beta.0 → 2.2.9-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
@@ -19,3 +19,14 @@ The generation of `rspack.wasi-browser.js` and `rspack.wasi.js` is disabled by d
19
19
  ## License
20
20
 
21
21
  Rspack is [MIT licensed](https://github.com/web-infra-dev/rspack/blob/main/LICENSE).
22
+
23
+ ## OpenHarmony port
24
+
25
+ This is the `@ohos-ports` distribution of `@rspack/binding@2.2.9`.
26
+
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.
package/binding.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * We manually create binding.d.ts and re-export everything of the dts generated by napi to fix the cjs-esm interop
3
3
  */
4
4
 
5
- import * as binding from "./napi-binding";
5
+ import * as binding from "./napi-binding.js";
6
6
 
7
- export * from "./napi-binding"
7
+ export * from "./napi-binding.js"
8
8
  export default binding;
package/binding.js CHANGED
@@ -320,7 +320,7 @@ function requireNative() {
320
320
  } else if (process.platform === 'openharmony') {
321
321
  if (process.arch === 'arm64') {
322
322
  try {
323
- return require('./rspack.openharmony-arm64-ohos.node')
323
+ return require('./rspack.linux-arm64-ohos.node')
324
324
  } catch (e) {
325
325
  loadErrors.push(e)
326
326
  }
@@ -329,6 +329,13 @@ function requireNative() {
329
329
  } catch (e) {
330
330
  loadErrors.push(e)
331
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
+ try {
335
+ return require('@ohos-ports/rspack-binding-openharmony-arm64')
336
+ } catch (e) {
337
+ loadErrors.push(e)
338
+ }
332
339
  } else if (process.arch === 'x64') {
333
340
  try {
334
341
  return require('./rspack.linux-x64-ohos.node')
package/napi-binding.d.ts CHANGED
@@ -191,7 +191,7 @@ export declare class ConcatenatedModule {
191
191
  get rootModule(): Module
192
192
  get modules(): Module[]
193
193
  readableIdentifier(): string
194
- _originalSource(): JsSource | undefined
194
+ _originalSource(): JsSourceWithLazyMap | undefined
195
195
  nameForCondition(): string | undefined
196
196
  get blocks(): AsyncDependenciesBlock[]
197
197
  get dependencies(): Dependency[]
@@ -202,7 +202,7 @@ export declare class ConcatenatedModule {
202
202
 
203
203
  export declare class ContextModule {
204
204
  readableIdentifier(): string
205
- _originalSource(): JsSource | undefined
205
+ _originalSource(): JsSourceWithLazyMap | undefined
206
206
  nameForCondition(): string | undefined
207
207
  get blocks(): AsyncDependenciesBlock[]
208
208
  get dependencies(): Dependency[]
@@ -267,7 +267,7 @@ export type EntryOptionsDTO = EntryOptionsDto
267
267
 
268
268
  export declare class ExternalModule {
269
269
  readableIdentifier(): string
270
- _originalSource(): JsSource | undefined
270
+ _originalSource(): JsSourceWithLazyMap | undefined
271
271
  nameForCondition(): string | undefined
272
272
  get blocks(): AsyncDependenciesBlock[]
273
273
  get dependencies(): Dependency[]
@@ -276,12 +276,33 @@ export declare class ExternalModule {
276
276
  _emitFile(filename: string, source: JsSource, assetInfo?: AssetInfo | undefined | null): void
277
277
  }
278
278
 
279
+ /** Native operations on the owning compiler's current dependency collection. */
280
+ export declare class FileSystemDependencies {
281
+ get added(): Array<string>
282
+ get removed(): Array<string>
283
+ size(): number
284
+ has(value: string): boolean
285
+ clear(): void
286
+ update(added: Array<string>, deleted: Array<string>): void
287
+ values(this: this): ReadonlyArray<string>
288
+ add(value: string): void
289
+ addAll(values: Array<string>): void
290
+ }
291
+
292
+ /** One shared cache, initialized from the first compiler that uses it. */
293
+ export declare class JsCache {
294
+ constructor()
295
+ beginIdle(): void
296
+ endIdle(): void
297
+ shutdown(): Promise<void>
298
+ }
299
+
279
300
  export declare class JsCompilation {
280
301
  updateAsset(filename: string, newSourceOrFunction: JsSource | ((source: JsSource) => JsSource), assetInfoUpdateOrFunction?: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo | undefined)): void
281
302
  getAssets(): Readonly<JsAsset>[]
282
303
  getAsset(name: string): JsAsset | null
283
304
  getAssetSource(name: string): JsSource | null
284
- get modules(): Array<Module>
305
+ get modules(): Modules
285
306
  get builtModules(): Array<Module>
286
307
  getOptimizationBailout(): Array<JsStatsOptimizationBailout>
287
308
  get chunks(): Chunks
@@ -299,7 +320,10 @@ export declare class JsCompilation {
299
320
  get entrypoints(): ChunkGroup[]
300
321
  get chunkGroups(): ChunkGroup[]
301
322
  get hash(): string | null
302
- dependencies(): JsDependencies
323
+ get fileDependencies(): FileSystemDependencies
324
+ get contextDependencies(): FileSystemDependencies
325
+ get missingDependencies(): FileSystemDependencies
326
+ get buildDependencies(): FileSystemDependencies
303
327
  pushDiagnostic(diagnostic: JsRspackDiagnostic): void
304
328
  pushNativeDiagnostic(diagnostic: ExternalObject<'Diagnostic'>): void
305
329
  pushNativeDiagnostics(diagnostics: ExternalObject<'Diagnostic[]'>): void
@@ -334,7 +358,7 @@ export declare class JsCompilation {
334
358
  }
335
359
 
336
360
  export declare class JsCompiler {
337
- constructor(compilerPath: string, options: RawOptions, builtinPlugins: BuiltinPlugin[], registerJsTaps: RegisterJsTaps, outputFilesystem: ThreadsafeNodeFS, intermediateFilesystem: ThreadsafeNodeFS | undefined | null, inputFilesystem: ThreadsafeNodeFS | undefined | null, resolverFactoryReference: JsResolverFactory, unsafeFastDrop: boolean, platform: RawCompilerPlatform, infrastructureLogCallback: (logs: JsLog[]) => void)
361
+ constructor(compilerPath: string, options: RawOptions, builtinPlugins: BuiltinPlugin[], registerJsTaps: RegisterJsTaps, outputFilesystem: ThreadsafeNodeFS, intermediateFilesystem: ThreadsafeNodeFS | undefined | null, inputFilesystem: ThreadsafeNodeFS | undefined | null, resolverFactoryReference: JsResolverFactory, unsafeFastDrop: boolean, platform: RawCompilerPlatform, infrastructureLogCallback: (logs: JsLog[]) => void, cache: JsCache, jsHelpers: JsHelpers)
338
362
  setNonSkippableRegisters(kinds: Array<RegisterJsTapKind>): void
339
363
  /** Build with the given option passed to the constructor */
340
364
  build(callback: (err: null | Error) => void): void
@@ -374,21 +398,6 @@ export declare class JsCoordinator {
374
398
  constructor()
375
399
  }
376
400
 
377
- export declare class JsDependencies {
378
- get fileDependencies(): Array<string>
379
- get addedFileDependencies(): Array<string>
380
- get removedFileDependencies(): Array<string>
381
- get contextDependencies(): Array<string>
382
- get addedContextDependencies(): Array<string>
383
- get removedContextDependencies(): Array<string>
384
- get missingDependencies(): Array<string>
385
- get addedMissingDependencies(): Array<string>
386
- get removedMissingDependencies(): Array<string>
387
- get buildDependencies(): Array<string>
388
- get addedBuildDependencies(): Array<string>
389
- get removedBuildDependencies(): Array<string>
390
- }
391
-
392
401
  export declare class JsEntries {
393
402
  clear(): void
394
403
  get size(): number
@@ -413,18 +422,18 @@ export declare class JsLoaderCache {
413
422
  }
414
423
 
415
424
  export declare class JsModuleGraph {
416
- getModule(dependency: Dependency): Module | null
417
- getResolvedModule(dependency: Dependency): Module | null
425
+ getModule(dependency: Dependency | EntryDependency): Module | null
426
+ getResolvedModule(dependency: Dependency | EntryDependency): Module | null
418
427
  getUsedExports(module: Module, runtime: string | string[]): boolean | Array<string> | null
419
428
  getProvidedExports(module: Module): true | string[] | null
420
429
  getIssuer(module: Module): Module | null
421
430
  getExportsInfo(module: Module): JsExportsInfo
422
- getConnection(dependency: Dependency): ModuleGraphConnection | null
431
+ getConnection(dependency: Dependency | EntryDependency): ModuleGraphConnection | null
423
432
  getOutgoingConnections(module: Module): ModuleGraphConnection[]
424
433
  getOutgoingConnectionsInOrder(module: Module): ModuleGraphConnection[]
425
434
  getIncomingConnections(module: Module): ModuleGraphConnection[]
426
- getParentModule(dependency: Dependency): Module | null
427
- getParentBlockIndex(dependency: Dependency): number
435
+ getParentModule(dependency: Dependency | EntryDependency): Module | null
436
+ getParentBlockIndex(dependency: Dependency | EntryDependency): number
428
437
  isAsync(module: Module): boolean
429
438
  }
430
439
 
@@ -449,7 +458,7 @@ export declare class KnownBuildInfo {
449
458
 
450
459
  export declare class Module {
451
460
  readableIdentifier(): string
452
- _originalSource(): JsSource | undefined
461
+ _originalSource(): JsSourceWithLazyMap | undefined
453
462
  nameForCondition(): string | undefined
454
463
  get blocks(): AsyncDependenciesBlock[]
455
464
  get dependencies(): Dependency[]
@@ -466,6 +475,13 @@ export declare class ModuleGraphConnection {
466
475
  getActiveState(runtime: string | string[] | undefined): ConnectionState
467
476
  }
468
477
 
478
+ /** Read-only operations on a compilation's module collection. */
479
+ export declare class Modules {
480
+ size(): number
481
+ has(value: Module): boolean
482
+ values(): ReadonlyArray<Module>
483
+ }
484
+
469
485
  export declare class NativeWatcher {
470
486
  constructor(options: NativeWatcherOptions)
471
487
  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
@@ -877,13 +893,18 @@ export interface JsExecuteModuleResult {
877
893
  missingDependencies: Array<string>
878
894
  cacheable: boolean
879
895
  id: number
880
- error?: string
896
+ errors: Array<RspackError>
881
897
  }
882
898
 
883
899
  export interface JsFactoryMeta {
884
900
  sideEffectFree?: boolean
885
901
  }
886
902
 
903
+ export interface JsHelpers {
904
+ applyIndexedArrayUpdates: <T>(source: ReadonlyArray<T>, target: T[], commands: Uint32Array) => void
905
+ swapRemoveArrayElements: <T>(array: T[], removedIndices: Uint32Array) => void
906
+ }
907
+
887
908
  export interface JsHtmlPluginAssets {
888
909
  publicPath: string
889
910
  js: Array<string>
@@ -961,6 +982,7 @@ export interface JsLoaderCacheEntry {
961
982
  sourceMap?: Uint8Array
962
983
  addedDependencies: JsLoaderDependencies
963
984
  removedDependencies: JsLoaderDependencies
985
+ parseMeta: Record<string, string>
964
986
  }
965
987
 
966
988
  export interface JsLoaderContext {
@@ -968,7 +990,7 @@ export interface JsLoaderContext {
968
990
  _module: Module
969
991
  hot: Readonly<boolean>
970
992
  /** Content maybe empty in pitching stage */
971
- content: null | Buffer
993
+ content: string | Buffer | null
972
994
  additionalData?: any
973
995
  __internal__parseMeta: Record<string, string>
974
996
  sourceMap?: Buffer
@@ -979,11 +1001,6 @@ export interface JsLoaderContext {
979
1001
  loaderState: Readonly<JsLoaderState>
980
1002
  __internal__error?: RspackError
981
1003
  __internal__loaderCache?: JsLoaderCache | undefined
982
- /**
983
- * UTF-8 hint for `content`
984
- * - Some(true): `content` is a `UTF-8` encoded sequence
985
- */
986
- __internal__utf8Hint?: boolean
987
1004
  }
988
1005
 
989
1006
  export interface JsLoaderDependencies {
@@ -1064,9 +1081,8 @@ export interface JsResolveData {
1064
1081
  request: string
1065
1082
  context: string
1066
1083
  contextInfo: ContextInfo
1067
- fileDependencies: Array<string>
1068
- contextDependencies: Array<string>
1069
- missingDependencies: Array<string>
1084
+ /** The import attributes of the dependency that triggered this resolution, read-only. */
1085
+ attributes?: Record<string, string>
1070
1086
  createData?: JsCreateData
1071
1087
  }
1072
1088
 
@@ -1357,6 +1373,11 @@ export interface JsSourceToJs {
1357
1373
  map?: string
1358
1374
  }
1359
1375
 
1376
+ export interface JsSourceWithLazyMap {
1377
+ source: string | Buffer
1378
+ map?: string | (() => string)
1379
+ }
1380
+
1360
1381
  export interface JsStatsAsset {
1361
1382
  type: string
1362
1383
  name: string
@@ -1816,9 +1837,10 @@ export interface NativeWatcherOptions {
1816
1837
  aggregateTimeout?: number
1817
1838
  /**
1818
1839
  * The ignored paths for the watcher.
1819
- * It can be a single path, an array of paths, or a regular expression.
1840
+ * It can be a single path, an array of paths, a regular expression, or a
1841
+ * predicate returning `true` for entries to ignore.
1820
1842
  */
1821
- ignored?: string | string[] | RegExp
1843
+ ignored?: string | string[] | RegExp | ((entry: string) => boolean)
1822
1844
  }
1823
1845
 
1824
1846
  /**
@@ -1946,14 +1968,13 @@ export interface RawCacheGroupOptions {
1946
1968
 
1947
1969
  export interface RawCacheOptionsMemory {
1948
1970
  maxGenerations?: number
1949
- snapshot?: RawSnapshotOptions
1950
1971
  }
1951
1972
 
1952
1973
  export interface RawCacheOptionsPersistent {
1953
1974
  buildDependencies?: Array<string>
1954
1975
  version?: string
1955
1976
  maxAge: number
1956
- snapshot?: RawSnapshotOptions
1977
+ maxMemoryGenerations?: number
1957
1978
  storage?: RawStorageOptions
1958
1979
  portable?: boolean
1959
1980
  readonly?: boolean
@@ -2380,6 +2401,18 @@ export interface RawFallbackCacheGroupOptions {
2380
2401
  automaticNameDelimiter?: string
2381
2402
  }
2382
2403
 
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
+
2383
2416
  export interface RawFlagAllModulesAsUsedPluginOptions {
2384
2417
  explanation: string
2385
2418
  }
@@ -2453,6 +2486,7 @@ export interface RawHttpUriPluginOptions {
2453
2486
  lockfileLocation?: string
2454
2487
  cacheLocation?: string
2455
2488
  upgrade: boolean
2489
+ frozen: boolean
2456
2490
  httpClient: (url: string, headers: Record<string, string>) => Promise<JsHttpResponseRaw>
2457
2491
  }
2458
2492
 
@@ -2597,7 +2631,7 @@ export interface RawJsonParserOptions {
2597
2631
  }
2598
2632
 
2599
2633
  export interface RawLazyCompilationOption {
2600
- currentActiveModules: ((err: Error | null, ) => Set<string>)
2634
+ takeNewlyActiveModules: ((err: Error | null, ) => Set<string>)
2601
2635
  test?: RawLazyCompilationTest
2602
2636
  entries: boolean
2603
2637
  imports: boolean
@@ -2779,9 +2813,11 @@ export interface RawModuleRuleUse {
2779
2813
 
2780
2814
  export interface RawNewCache {
2781
2815
  codeGeneration: boolean
2816
+ module: boolean
2782
2817
  devtool: boolean
2783
2818
  loader: boolean
2784
2819
  minimize: boolean
2820
+ resolver: boolean
2785
2821
  }
2786
2822
 
2787
2823
  export interface RawNodeOption {
@@ -2831,7 +2867,8 @@ export interface RawOptions {
2831
2867
  module: RawModuleOptions
2832
2868
  optimization: RawOptimizationOptions
2833
2869
  stats: RawStatsOptions
2834
- cache: boolean | { type: "memory", snapshot: RawSnapshotOptions } | ({ type: "persistent" } & RawCacheOptionsPersistent)
2870
+ cache: boolean | { type: "memory" } | ({ type: "persistent" } & RawCacheOptionsPersistent) | ({ type: "filesystem" } & RawFileSystemCacheOptions)
2871
+ snapshot: RawSnapshotOptions
2835
2872
  experiments: RawExperiments
2836
2873
  incremental?: false | { [key: string]: boolean }
2837
2874
  node?: RawNodeOption
@@ -3049,6 +3086,8 @@ export interface RawRstestPluginOptions {
3049
3086
  */
3050
3087
  injectImportMetaRstestOrigin?: boolean
3051
3088
  injectDynamicImportOrigin?: boolean | { functionName?: string }
3089
+ updateImportMockAPI?: boolean
3090
+ updateRequireMockAPI?: boolean
3052
3091
  injectRequireResolveOrigin?: boolean | { functionName?: string }
3053
3092
  }
3054
3093
 
@@ -3113,6 +3152,16 @@ export interface RawSnapshotOptions {
3113
3152
  immutablePaths: Array<string|RegExp>
3114
3153
  unmanagedPaths: Array<string|RegExp>
3115
3154
  managedPaths: Array<string|RegExp>
3155
+ buildDependencies: RawSnapshotStrategyOptions
3156
+ resolveBuildDependencies: RawSnapshotStrategyOptions
3157
+ module: RawSnapshotStrategyOptions
3158
+ contextModule: RawSnapshotStrategyOptions
3159
+ resolve: RawSnapshotStrategyOptions
3160
+ }
3161
+
3162
+ export interface RawSnapshotStrategyOptions {
3163
+ hash: boolean
3164
+ timestamp: boolean
3116
3165
  }
3117
3166
 
3118
3167
  export interface RawSplitChunkSizes {
@@ -3120,6 +3169,7 @@ export interface RawSplitChunkSizes {
3120
3169
  }
3121
3170
 
3122
3171
  export interface RawSplitChunksOptions {
3172
+ dedupDepth?: number
3123
3173
  fallbackCacheGroup?: RawFallbackCacheGroupOptions
3124
3174
  name?: string | false | ((ctx: JsChunkOptionNameCtx) => string | undefined)
3125
3175
  nameBatch?: ((batch: JsChunkOptionNameBatch) => (string | undefined)[])
@@ -3409,6 +3459,7 @@ export interface ThreadsafeNodeFS {
3409
3459
  readFile: (name: string) => Promise<Buffer | string | void>
3410
3460
  stat: (name: string) => Promise<NodeFsStats | void>
3411
3461
  lstat: (name: string) => Promise<NodeFsStats | void>
3462
+ readlink: (name: string) => Promise<string | void>
3412
3463
  realpath: (name: string) => Promise<string | void>
3413
3464
  open: (name: string, flags: string) => Promise<number | void>
3414
3465
  rename: (from: string, to: string) => Promise<void>
package/package.json CHANGED
@@ -1,21 +1,29 @@
1
1
  {
2
2
  "name": "@ohos-ports/rspack-binding",
3
- "version": "2.2.2-beta.0",
3
+ "version": "2.2.9-beta.0",
4
4
  "license": "MIT",
5
- "description": "Node binding for rspack",
5
+ "description": "Node binding loader for rspack (OpenHarmony port: probes @ohos-ports/rspack-binding-openharmony-arm64 on openharmony/arm64)",
6
6
  "main": "binding.js",
7
7
  "types": "binding.d.ts",
8
8
  "files": [
9
9
  "binding.js",
10
10
  "binding.d.ts",
11
11
  "napi-binding.d.ts",
12
- "webcontainer-fallback.cjs",
13
- "rspack.openharmony-arm64-ohos.node"
12
+ "webcontainer-fallback.cjs"
14
13
  ],
14
+ "optionalDependencies": {
15
+ "@ohos-ports/rspack-binding-openharmony-arm64": "2.2.9-beta.0"
16
+ },
15
17
  "homepage": "https://rspack.rs",
16
- "bugs": "https://github.com/web-infra-dev/rspack/issues",
18
+ "bugs": {
19
+ "url": "https://github.com/ohos-ports/ohos-ports/issues"
20
+ },
17
21
  "repository": {
18
22
  "type": "git",
19
- "url": "web-infra-dev/rspack"
23
+ "url": "https://github.com/ohos-ports/ohos-ports.git",
24
+ "directory": "ports/@rspack/binding/2.2.9"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
20
28
  }
21
29
  }
@@ -1,4 +0,0 @@
1
- [diffend] Oversized file quarantined before diffing.
2
- name: package/rspack.openharmony-arm64-ohos.node
3
- size: 44418752 bytes
4
- sha256: cc6b4b91716cfb7e1f4d6567ec026800cc9ba8da51fcca0fe2e935880824e319