@rolldown/binding-wasm32-wasi 1.2.8 → 1.2.10

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.
@@ -4,6 +4,10 @@ type VoidNullable<T = void> = T | null | undefined | void
4
4
  export type BindingStringOrRegex = string | RegExp
5
5
  export type BindingResult<T> = { errors: BindingError[], isBindingErrors: boolean } | T
6
6
 
7
+
8
+ /** The WASI flavor this loader instantiates. */
9
+ export declare const __napiBindingTarget: 'wasm32-wasi'
10
+
7
11
  export interface CodegenOptions {
8
12
  /**
9
13
  * Remove whitespace.
@@ -11,6 +15,24 @@ export interface CodegenOptions {
11
15
  * @default true
12
16
  */
13
17
  removeWhitespace?: boolean
18
+ /**
19
+ * Escape non-ASCII characters in string literals, untagged template literals, regular
20
+ * expression literals and identifier names.
21
+ *
22
+ * Uses `\uXXXX` for characters up to U+FFFF and `\u{...}` for higher code points.
23
+ * Regular expressions use escaped UTF-16 surrogate pairs for higher code points instead;
24
+ * escaping changes the observable `RegExp.prototype.source` value.
25
+ *
26
+ * Code point escapes (`\u{...}`) require ES2015 or later; this option does not provide
27
+ * ES5-compatible output.
28
+ *
29
+ * Non-ASCII characters are left unescaped in tagged template quasis (whose raw text is
30
+ * observable), JSX names and text, JSX attribute strings, hashbangs and preserved comments.
31
+ * JavaScript expressions inside tagged templates and JSX are escaped normally.
32
+ *
33
+ * @default false
34
+ */
35
+ asciiOnly?: boolean
14
36
  /**
15
37
  * How to handle legal comments (comments containing `@license`, `@preserve`, or starting with `//!`/`/*!`).
16
38
  *
@@ -22,7 +44,7 @@ export interface CodegenOptions {
22
44
  *
23
45
  * @default "none" (when minifying)
24
46
  */
25
- legalComments?: 'none' | 'inline' | 'eof' | 'external' | { linked: string }
47
+ legalComments?: 'none' | 'inline' | 'eof' | 'external' | { linked: string }
26
48
  }
27
49
 
28
50
  export interface CompressOptions {
@@ -117,14 +139,7 @@ export interface LegalCommentsLinked {
117
139
  linked: string
118
140
  }
119
141
 
120
- export type LegalCommentsMode = /** Do not preserve any legal comments. */
121
- 'none'|
122
- /** Preserve all legal comments inline. */
123
- 'inline'|
124
- /** Move all legal comments to the end of the file. */
125
- 'eof'|
126
- /** Extract legal comments without linking. */
127
- 'external';
142
+ export type LegalCommentsMode = 'none' | 'inline' | 'eof' | 'external'
128
143
 
129
144
  export interface MangleOptions {
130
145
  /**
@@ -293,6 +308,7 @@ export interface TreeShakeOptions {
293
308
  */
294
309
  invalidImportSideEffects?: boolean
295
310
  }
311
+
296
312
  export interface Comment {
297
313
  type: 'Line' | 'Block'
298
314
  value: string
@@ -314,9 +330,8 @@ export interface OxcError {
314
330
  codeframe: string | null
315
331
  }
316
332
 
317
- export type Severity = 'Error'|
318
- 'Warning'|
319
- 'Advice';
333
+ export type Severity = 'Error' | 'Warning' | 'Advice'
334
+
320
335
  export declare class ParseResult {
321
336
  get program(): import("@oxc-project/types").Program
322
337
  get module(): EcmaScriptModule
@@ -356,12 +371,7 @@ export interface ExportExportName {
356
371
  end: number | null
357
372
  }
358
373
 
359
- export type ExportExportNameKind = /** `export { name } */
360
- 'Name'|
361
- /** `export default expression` */
362
- 'Default'|
363
- /** `export * from "mod" */
364
- 'None';
374
+ export type ExportExportNameKind = 'Name' | 'Default' | 'None'
365
375
 
366
376
  export interface ExportImportName {
367
377
  kind: ExportImportNameKind
@@ -370,14 +380,7 @@ export interface ExportImportName {
370
380
  end: number | null
371
381
  }
372
382
 
373
- export type ExportImportNameKind = /** `export { name } */
374
- 'Name'|
375
- /** `export * as ns from "mod"` */
376
- 'All'|
377
- /** `export * from "mod"` */
378
- 'AllButDefault'|
379
- /** Does not have a specifier. */
380
- 'None';
383
+ export type ExportImportNameKind = 'Name' | 'All' | 'AllButDefault' | 'None'
381
384
 
382
385
  export interface ExportLocalName {
383
386
  kind: ExportLocalNameKind
@@ -386,15 +389,7 @@ export interface ExportLocalName {
386
389
  end: number | null
387
390
  }
388
391
 
389
- export type ExportLocalNameKind = /** `export { name } */
390
- 'Name'|
391
- /** `export default expression` */
392
- 'Default'|
393
- /**
394
- * If the exported value is not locally accessible from within the module.
395
- * `export default function () {}`
396
- */
397
- 'None';
392
+ export type ExportLocalNameKind = 'Name' | 'Default' | 'None'
398
393
 
399
394
  export interface ImportName {
400
395
  kind: ImportNameKind
@@ -403,12 +398,7 @@ export interface ImportName {
403
398
  end: number | null
404
399
  }
405
400
 
406
- export type ImportNameKind = /** `import { x } from "mod"` */
407
- 'Name'|
408
- /** `import * as ns from "mod"` */
409
- 'NamespaceObject'|
410
- /** `import defaultExport from "mod"` */
411
- 'Default';
401
+ export type ImportNameKind = 'Name' | 'NamespaceObject' | 'Default'
412
402
 
413
403
  /**
414
404
  * Parse JS/TS source asynchronously on a separate thread.
@@ -579,6 +569,7 @@ export interface ValueSpan {
579
569
  start: number
580
570
  end: number
581
571
  }
572
+
582
573
  export declare class ResolverFactory {
583
574
  constructor(options?: NapiResolveOptions | undefined | null)
584
575
  static default(): ResolverFactory
@@ -641,14 +632,10 @@ export interface Builtin {
641
632
  export declare enum EnforceExtension {
642
633
  Auto = 0,
643
634
  Enabled = 1,
644
- Disabled = 2
635
+ Disabled = 2,
645
636
  }
646
637
 
647
- export type ModuleType = 'module'|
648
- 'commonjs'|
649
- 'json'|
650
- 'wasm'|
651
- 'addon';
638
+ export type ModuleType = 'module' | 'commonjs' | 'json' | 'wasm' | 'addon'
652
639
 
653
640
  /**
654
641
  * Module Resolution Options
@@ -886,6 +873,7 @@ export interface TsconfigOptions {
886
873
  */
887
874
  references?: 'auto'
888
875
  }
876
+
889
877
  export interface SourceMap {
890
878
  file?: string
891
879
  mappings: string
@@ -896,6 +884,7 @@ export interface SourceMap {
896
884
  version: number
897
885
  x_google_ignoreList?: Array<number>
898
886
  }
887
+
899
888
  export interface ArrowFunctionsOptions {
900
889
  /**
901
890
  * This option enables the following:
@@ -997,27 +986,7 @@ export interface Es2015Options {
997
986
  arrowFunction?: ArrowFunctionsOptions
998
987
  }
999
988
 
1000
- export type HelperMode = /**
1001
- * Runtime mode (default): Helper functions are imported from a runtime package.
1002
- *
1003
- * Example:
1004
- *
1005
- * ```js
1006
- * import helperName from "@oxc-project/runtime/helpers/helperName";
1007
- * helperName(...arguments);
1008
- * ```
1009
- */
1010
- 'Runtime'|
1011
- /**
1012
- * External mode: Helper functions are accessed from a global `babelHelpers` object.
1013
- *
1014
- * Example:
1015
- *
1016
- * ```js
1017
- * babelHelpers.helperName(...arguments);
1018
- * ```
1019
- */
1020
- 'External';
989
+ export type HelperMode = 'Runtime' | 'External'
1021
990
 
1022
991
  export interface Helpers {
1023
992
  mode?: HelperMode
@@ -1545,6 +1514,7 @@ export interface TypeScriptOptions {
1545
1514
  */
1546
1515
  rewriteImportExtensions?: 'rewrite' | 'remove' | boolean
1547
1516
  }
1517
+
1548
1518
  export declare class BindingBundleEndEventData {
1549
1519
  output: string
1550
1520
  duration: number
@@ -1613,8 +1583,9 @@ export declare class BindingDevEngine {
1613
1583
  */
1614
1584
  registerClient(clientId: string): Promise<void>
1615
1585
  /**
1616
- * Delivery notification from the serving middleware: the response for
1617
- * `filename` completed, so record its modules as shipped to that client.
1586
+ * Delivery notification for the payload `filename`: the client reported that it
1587
+ * ran the payload, so record its modules as shipped to that client. See
1588
+ * `DevEngine::notify_payload_delivered`.
1618
1589
  */
1619
1590
  notifyPayloadDelivered(filename: string): Promise<void>
1620
1591
  removeClient(clientId: string): Promise<void>
@@ -1928,6 +1899,13 @@ export declare class TsconfigCache {
1928
1899
  size(): number
1929
1900
  }
1930
1901
 
1902
+ /**
1903
+ * Panics on purpose. CI calls this to check that a published binding can produce a
1904
+ * symbolicated backtrace from its separately published debug info.
1905
+ * See `scripts/misc/verify-debuginfo.mjs` and internal-docs/panic-symbolication/implementation.md
1906
+ */
1907
+ export declare function __internalForcePanic(): void
1908
+
1931
1909
  export interface AliasItem {
1932
1910
  find: string
1933
1911
  replacements: Array<string | undefined | null>
@@ -1940,7 +1918,7 @@ export interface BindingAssetSource {
1940
1918
  export declare enum BindingAttachDebugInfo {
1941
1919
  None = 0,
1942
1920
  Simple = 1,
1943
- Full = 2
1921
+ Full = 2,
1944
1922
  }
1945
1923
 
1946
1924
  export interface BindingBuiltinPlugin {
@@ -1948,24 +1926,7 @@ export interface BindingBuiltinPlugin {
1948
1926
  options?: unknown
1949
1927
  }
1950
1928
 
1951
- export type BindingBuiltinPluginName = 'builtin:bundle-analyzer'|
1952
- 'builtin:esm-external-require'|
1953
- 'builtin:isolated-declaration'|
1954
- 'builtin:replace'|
1955
- 'builtin:vite-alias'|
1956
- 'builtin:vite-build-import-analysis'|
1957
- 'builtin:vite-dynamic-import-vars'|
1958
- 'builtin:vite-import-glob'|
1959
- 'builtin:vite-json'|
1960
- 'builtin:vite-load-fallback'|
1961
- 'builtin:vite-manifest'|
1962
- 'builtin:vite-module-preload-polyfill'|
1963
- 'builtin:vite-react-refresh-wrapper'|
1964
- 'builtin:vite-reporter'|
1965
- 'builtin:vite-resolve'|
1966
- 'builtin:vite-transform'|
1967
- 'builtin:vite-web-worker-post'|
1968
- 'builtin:oxc-runtime';
1929
+ export type BindingBuiltinPluginName = 'builtin:bundle-analyzer' | 'builtin:esm-external-require' | 'builtin:isolated-declaration' | 'builtin:replace' | 'builtin:vite-alias' | 'builtin:vite-build-import-analysis' | 'builtin:vite-dynamic-import-vars' | 'builtin:vite-import-glob' | 'builtin:vite-json' | 'builtin:vite-load-fallback' | 'builtin:vite-manifest' | 'builtin:vite-module-preload-polyfill' | 'builtin:vite-react-refresh-wrapper' | 'builtin:vite-reporter' | 'builtin:vite-resolve' | 'builtin:vite-transform' | 'builtin:vite-web-worker-post' | 'builtin:oxc-runtime'
1969
1930
 
1970
1931
  export interface BindingBundleAnalyzerPluginConfig {
1971
1932
  /** Output filename for the bundle analysis data (default: "analyze-data.json") */
@@ -2004,6 +1965,7 @@ export interface BindingChecksOptions {
2004
1965
  unresolvedEntry?: boolean
2005
1966
  unresolvedImport?: boolean
2006
1967
  filenameConflict?: boolean
1968
+ moduleLevelDirective?: boolean
2007
1969
  commonJsVariableInEsm?: boolean
2008
1970
  importIsUndefined?: boolean
2009
1971
  emptyImportMeta?: boolean
@@ -2012,6 +1974,8 @@ export interface BindingChecksOptions {
2012
1974
  configurationFieldConflict?: boolean
2013
1975
  preferBuiltinFeature?: boolean
2014
1976
  couldNotCleanDirectory?: boolean
1977
+ bundlerTimings?: boolean
1978
+ /** Deprecated alias for `bundlerTimings`. Rolldown uses `bundlerTimings` if both options have values. */
2015
1979
  pluginTimings?: boolean
2016
1980
  duplicateShebang?: boolean
2017
1981
  unsupportedTsconfigOption?: boolean
@@ -2028,7 +1992,7 @@ export interface BindingChunkImportMap {
2028
1992
 
2029
1993
  export declare enum BindingChunkModuleOrderBy {
2030
1994
  ModuleId = 0,
2031
- ExecOrder = 1
1995
+ ExecOrder = 1,
2032
1996
  }
2033
1997
 
2034
1998
  export interface BindingChunkOptimizationOptions {
@@ -2259,8 +2223,8 @@ export interface BindingEnhancedTransformResult {
2259
2223
  }
2260
2224
 
2261
2225
  export type BindingError =
2262
- | { type: 'JsError', field0: Error }
2263
- | { type: 'NativeError', field0: NativeError }
2226
+ | { type: 'JsError'; field0: Error }
2227
+ | { type: 'NativeError'; field0: NativeError }
2264
2228
 
2265
2229
  export interface BindingErrors {
2266
2230
  errors: Array<BindingError>
@@ -2276,8 +2240,7 @@ export interface BindingErrors {
2276
2240
  * on the next page load (HMR generation may itself be buggy). See
2277
2241
  * `internal-docs/dev-engine/implementation.md` §12.
2278
2242
  */
2279
- export type BindingErrorStage = 'Hmr'|
2280
- 'Rebuild';
2243
+ export type BindingErrorStage = 'Hmr' | 'Rebuild'
2281
2244
 
2282
2245
  export interface BindingEsmExternalRequirePluginConfig {
2283
2246
  external: Array<BindingStringOrRegex>
@@ -2318,14 +2281,14 @@ export interface BindingGeneratedCodeOptions {
2318
2281
  }
2319
2282
 
2320
2283
  export type BindingHmrUpdate =
2321
- | { type: 'Patch', code: string, filename: string, sourcemap?: string, sourcemapFilename?: string, /**
2322
- * Stable ids of the changed modules — the `changedIds` of the push envelope.
2323
- * The client walks from these on its own graph.
2324
- */
2325
- changedIds: Array<string>, /** Per-client envelope sequence number. */
2326
- seq: number }
2327
- | { type: 'FullReload', reason?: string }
2328
- | { type: 'Noop' }
2284
+ | { type: 'Patch'; code: string; filename: string; sourcemap?: string; sourcemapFilename?: string; /**
2285
+ * Stable ids of the changed modules — the `changedIds` of the push envelope.
2286
+ * The client walks from these on its own graph.
2287
+ */
2288
+ changedIds: Array<string>; /** Per-client envelope sequence number. */
2289
+ seq: number }
2290
+ | { type: 'FullReload'; reason?: string }
2291
+ | { type: 'Noop' }
2329
2292
 
2330
2293
  export interface BindingHookFilter {
2331
2294
  value?: Array<Array<BindingFilterToken>>
@@ -2420,8 +2383,7 @@ export interface BindingHookResolveIdOutput {
2420
2383
  packageJsonPath?: string | null
2421
2384
  }
2422
2385
 
2423
- export type BindingHookSideEffects =
2424
- boolean | string
2386
+ export type BindingHookSideEffects = boolean | string
2425
2387
 
2426
2388
  export interface BindingHookTransformOutput {
2427
2389
  code?: string
@@ -2446,8 +2408,7 @@ export interface BindingIndentOptions {
2446
2408
  exclude?: Array<Array<number>> | Array<number>
2447
2409
  }
2448
2410
 
2449
- export type BindingInjectImport =
2450
- BindingInjectImportNamed | BindingInjectImportNamespace
2411
+ export type BindingInjectImport = BindingInjectImportNamed | BindingInjectImportNamespace
2451
2412
 
2452
2413
  export interface BindingInjectImportNamed {
2453
2414
  tagNamed: true
@@ -2558,7 +2519,7 @@ export declare enum BindingLogLevel {
2558
2519
  Silent = 0,
2559
2520
  Warn = 1,
2560
2521
  Info = 2,
2561
- Debug = 3
2522
+ Debug = 3,
2562
2523
  }
2563
2524
 
2564
2525
  export interface BindingLogLocation {
@@ -2577,7 +2538,7 @@ export interface BindingMagicStringOptions {
2577
2538
  }
2578
2539
 
2579
2540
  export type BindingMakeAbsoluteExternalsRelative =
2580
- | { type: 'Bool', field0: boolean }
2541
+ | { type: 'Bool'; field0: boolean }
2581
2542
  | { type: 'IfRelativeSource' }
2582
2543
 
2583
2544
  export interface BindingManualCodeSplittingOptions {
@@ -2667,9 +2628,13 @@ export interface BindingOutputOptions {
2667
2628
  sourcemap?: 'file' | 'inline' | 'hidden'
2668
2629
  sourcemapFileNames?: string | ((chunk: PreRenderedChunk) => string)
2669
2630
  sourcemapBaseUrl?: string
2670
- sourcemapIgnoreList?: boolean | string | RegExp | ((source: string, sourcemapPath: string) => boolean)
2631
+ sourcemapIgnoreList?: boolean | string | RegExp | ((sources: Array<string>, sourcemapPath: string) => Uint8Array)
2671
2632
  sourcemapDebugIds?: boolean
2672
- sourcemapPathTransform?: (source: string, sourcemapPath: string) => string
2633
+ /**
2634
+ * Batched like `sourcemapIgnoreList` above. One call rewrites every source of a sourcemap,
2635
+ * and the returned array matches the source array by index.
2636
+ */
2637
+ sourcemapPathTransform?: (sources: Array<string>, sourcemapPath: string) => Array<string>
2673
2638
  sourcemapExcludeSources?: boolean
2674
2639
  strict?: boolean | 'auto'
2675
2640
  minify?: boolean | 'dce-only' | MinifyOptions
@@ -2781,7 +2746,7 @@ export interface BindingPluginOptions {
2781
2746
 
2782
2747
  export declare enum BindingPluginOrder {
2783
2748
  Pre = 0,
2784
- Post = 1
2749
+ Post = 1,
2785
2750
  }
2786
2751
 
2787
2752
  /**
@@ -2825,22 +2790,22 @@ export interface BindingPreRenderedAsset {
2825
2790
  }
2826
2791
 
2827
2792
  export type BindingPreserveEntrySignatures =
2828
- | { type: 'Bool', field0: boolean }
2829
- | { type: 'String', field0: string }
2793
+ | { type: 'Bool'; field0: boolean }
2794
+ | { type: 'String'; field0: string }
2830
2795
 
2831
2796
  export declare enum BindingPropertyReadSideEffects {
2832
2797
  Always = 0,
2833
- False = 1
2798
+ False = 1,
2834
2799
  }
2835
2800
 
2836
2801
  export declare enum BindingPropertyWriteSideEffects {
2837
2802
  Always = 0,
2838
- False = 1
2803
+ False = 1,
2839
2804
  }
2840
2805
 
2841
2806
  export declare enum BindingRebuildStrategy {
2842
2807
  Always = 0,
2843
- Never = 1
2808
+ Never = 1,
2844
2809
  }
2845
2810
 
2846
2811
  export interface BindingReplacePluginConfig {
@@ -2851,8 +2816,7 @@ export interface BindingReplacePluginConfig {
2851
2816
  sourcemap?: boolean
2852
2817
  }
2853
2818
 
2854
- export type BindingResolvedExternal =
2855
- boolean | string
2819
+ export type BindingResolvedExternal = boolean | string
2856
2820
 
2857
2821
  export interface BindingResolveOptions {
2858
2822
  alias?: Array<AliasItem>
@@ -3003,8 +2967,7 @@ export interface BindingViteJsonPluginConfig {
3003
2967
  stringify?: BindingViteJsonPluginStringify
3004
2968
  }
3005
2969
 
3006
- export type BindingViteJsonPluginStringify =
3007
- boolean | string
2970
+ export type BindingViteJsonPluginStringify = boolean | string
3008
2971
 
3009
2972
  export interface BindingViteManifestPluginConfig {
3010
2973
  root: string
@@ -3120,18 +3083,7 @@ export interface ExternalMemoryStatus {
3120
3083
  reason?: string
3121
3084
  }
3122
3085
 
3123
- export type FilterTokenKind = 'Id'|
3124
- 'ImporterId'|
3125
- 'Code'|
3126
- 'ModuleType'|
3127
- 'And'|
3128
- 'Or'|
3129
- 'Not'|
3130
- 'Include'|
3131
- 'Exclude'|
3132
- 'CleanUrl'|
3133
- 'QueryKey'|
3134
- 'QueryValue';
3086
+ export type FilterTokenKind = 'Id' | 'ImporterId' | 'Code' | 'ModuleType' | 'And' | 'Or' | 'Not' | 'Include' | 'Exclude' | 'CleanUrl' | 'QueryKey' | 'QueryValue'
3135
3087
 
3136
3088
  /**
3137
3089
  * Returns the Rust-side allocator counters, or `None` when this binding was
Binary file
@@ -23,10 +23,9 @@ const handler = new MessageHandler({
23
23
  // eslint-disable-next-line no-console
24
24
  console.log.apply(console, arguments)
25
25
  },
26
- printErr: function() {
26
+ printErr: function () {
27
27
  // eslint-disable-next-line no-console
28
28
  console.error.apply(console, arguments)
29
-
30
29
  errorOutputs.push([...arguments])
31
30
  },
32
31
  })
package/wasi-worker.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import fs from "node:fs";
2
- import { createRequire } from "node:module";
3
- import { parse } from "node:path";
4
- import { WASI } from "node:wasi";
5
- import { parentPort, Worker } from "node:worker_threads";
1
+ import fs from 'node:fs'
2
+ import { createRequire } from 'node:module'
3
+ import { parse } from 'node:path'
4
+ import { WASI } from 'node:wasi'
5
+ import { parentPort, Worker, workerData } from 'node:worker_threads'
6
6
 
7
- const require = createRequire(import.meta.url);
7
+ const require = createRequire(import.meta.url)
8
8
 
9
9
  const {
10
10
  instantiateNapiModuleSync,
@@ -12,12 +12,12 @@ const {
12
12
  getDefaultContext,
13
13
  emnapiAsyncWorkPlugin,
14
14
  emnapiTSFNPlugin,
15
- } = require("@napi-rs/wasm-runtime");
15
+ } = require('@napi-rs/wasm-runtime')
16
16
 
17
17
  if (parentPort) {
18
- parentPort.on("message", (data) => {
19
- globalThis.onmessage({ data });
20
- });
18
+ parentPort.on('message', (data) => {
19
+ globalThis.onmessage({ data })
20
+ })
21
21
  }
22
22
 
23
23
  Object.assign(globalThis, {
@@ -25,18 +25,25 @@ Object.assign(globalThis, {
25
25
  require,
26
26
  Worker,
27
27
  importScripts: function (f) {
28
- ;(0, eval)(fs.readFileSync(f, "utf8") + "//# sourceURL=" + f);
28
+ // oxlint-disable-next-line no-eval -- WASI importScripts polyfill
29
+ ;(0, eval)(fs.readFileSync(f, 'utf8') + '//# sourceURL=' + f)
29
30
  },
30
31
  postMessage: function (msg) {
31
32
  if (parentPort) {
32
- parentPort.postMessage(msg);
33
+ parentPort.postMessage(msg)
33
34
  }
34
35
  },
35
- });
36
+ })
36
37
 
37
- const emnapiContext = getDefaultContext();
38
+ const emnapiContext = getDefaultContext()
38
39
 
39
- const __rootDir = parse(process.cwd()).root;
40
+ const __cwd = process.cwd()
41
+ const __rootDir =
42
+ (workerData && typeof workerData.rootDir === 'string' && workerData.rootDir) ||
43
+ parse(__cwd).root
44
+ const __hostRoot =
45
+ (workerData && typeof workerData.hostRoot === 'string' && workerData.hostRoot) ||
46
+ (process.platform === 'android' ? __cwd : __rootDir)
40
47
 
41
48
  const handler = new MessageHandler({
42
49
  onLoad({ wasmModule, wasmMemory }) {
@@ -44,9 +51,10 @@ const handler = new MessageHandler({
44
51
  version: 'preview1',
45
52
  env: process.env,
46
53
  preopens: {
47
- [__rootDir]: __rootDir,
54
+ [__rootDir]: __hostRoot,
55
+ [__hostRoot]: __hostRoot,
48
56
  },
49
- });
57
+ })
50
58
 
51
59
  return instantiateNapiModuleSync(wasmModule, {
52
60
  childThread: true,
@@ -62,13 +70,13 @@ const handler = new MessageHandler({
62
70
  ...importObject.env,
63
71
  ...importObject.napi,
64
72
  ...importObject.emnapi,
65
- memory: wasmMemory
66
- };
73
+ memory: wasmMemory,
74
+ }
67
75
  },
68
- });
76
+ })
69
77
  },
70
- });
78
+ })
71
79
 
72
80
  globalThis.onmessage = function (e) {
73
- handler.handle(e);
74
- };
81
+ handler.handle(e)
82
+ }