From cbc38887a1246e913246e7cf85436f21a3cba1ab Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:40:08 +0000 Subject: [PATCH 1/4] fix(@angular/build): enable oxc WASI fallback in WebContainer environments In WebContainer environments (such as StackBlitz and angular.dev playground), native Node.js addons cannot run, requiring oxc-parser to fall back to WebAssembly (WASI). However, @oxc-parser/binding-wasm32-wasi@0.156.0 specifies @emnapi/core@2.0.0-alpha.6 while depending on @napi-rs/wasm-runtime@~1.2.6 (which was updated for @emnapi/core@>=2.0.0-beta.2). In wasm-runtime 1.2.6, initWorker is assigned to emnapi_shared.addonModule, which is undefined in alpha.6 (where it was named napiModule), throwing TypeError: Cannot set properties of undefined (setting 'initWorker'). Introducing oxc-wasi-shim aliases addonModule to napiModule on Object.prototype when in WebContainer or when NAPI_RS_FORCE_WASI is enabled, allowing the WASI runtime to initialize successfully. Additionally, remove @oxc-parser/binding-wasm32-wasi from optionalDependencies as oxc-parser's built-in WebContainer fallback downloads and loads it on demand. Fixes #34524 --- packages/angular/build/package.json | 1 - .../src/tools/i18n/i18n-inliner-worker.ts | 1 + .../build/src/tools/oxc/oxc-transform.ts | 1 + .../build/src/tools/oxc/oxc-wasi-shim.ts | 36 +++++++++++ .../angular/build/src/tools/oxc/traversal.ts | 1 + pnpm-lock.yaml | 61 ------------------- tests/e2e/tests/vite/wasi.ts | 27 ++++++++ 7 files changed, 66 insertions(+), 62 deletions(-) create mode 100644 packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts create mode 100644 tests/e2e/tests/vite/wasi.ts diff --git a/packages/angular/build/package.json b/packages/angular/build/package.json index dfe7c94e14a5..51b46c5e9a78 100644 --- a/packages/angular/build/package.json +++ b/packages/angular/build/package.json @@ -48,7 +48,6 @@ "xxhash-wasm": "1.1.0" }, "optionalDependencies": { - "@oxc-parser/binding-wasm32-wasi": "0.156.0", "lmdb": "3.5.9" }, "devDependencies": { diff --git a/packages/angular/build/src/tools/i18n/i18n-inliner-worker.ts b/packages/angular/build/src/tools/i18n/i18n-inliner-worker.ts index 778ca55bb814..a84d54eb713b 100644 --- a/packages/angular/build/src/tools/i18n/i18n-inliner-worker.ts +++ b/packages/angular/build/src/tools/i18n/i18n-inliner-worker.ts @@ -6,6 +6,7 @@ * found in the LICENSE file at https://angular.dev/license */ +import '../oxc/oxc-wasi-shim'; import { type DecodedSourceMap, type SourceMapInput } from '@ampproject/remapping'; import { type ɵParsedTranslation, diff --git a/packages/angular/build/src/tools/oxc/oxc-transform.ts b/packages/angular/build/src/tools/oxc/oxc-transform.ts index e0d6ba26a252..89594d9462ef 100644 --- a/packages/angular/build/src/tools/oxc/oxc-transform.ts +++ b/packages/angular/build/src/tools/oxc/oxc-transform.ts @@ -6,6 +6,7 @@ * found in the LICENSE file at https://angular.dev/license */ +import './oxc-wasi-shim'; import type { DecodedSourceMap } from '@ampproject/remapping'; import { needsLinking } from '@angular/compiler-cli/linker'; import type { BindingIdentifier, Class, Node } from '@oxc-project/types'; diff --git a/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts b/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts new file mode 100644 index 000000000000..2c187eeb59cb --- /dev/null +++ b/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts @@ -0,0 +1,36 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.dev/license + */ + +// Workaround for an upstream incompatibility in `@oxc-parser/binding-wasm32-wasi` when +// falling back to WebAssembly (e.g., inside WebContainers or StackBlitz). +// +// `@oxc-parser/binding-wasm32-wasi` declares a dependency on `@emnapi/core@2.0.0-alpha.6`, +// but depends on `@napi-rs/wasm-runtime@~1.2.6` which expects `@emnapi/core@>=2.0.0-beta.2`. +// In `@napi-rs/wasm-runtime@1.2.6`, the runtime attempts to assign `initWorker` to +// `emnapi_shared.addonModule`, which is undefined in `alpha.6` where the property was named +// `napiModule`. This results in `TypeError: Cannot set properties of undefined (setting 'initWorker')`, +// causing WASI binding initialization to fail and surface as a misleading "WASI binding not found" error +// or an `ERR_REQUIRE_CYCLE_MODULE` failure. +// +// Aliasing `addonModule` to `this.napiModule` on `Object.prototype` allows the WASI runtime to +// initialize successfully. +// +// See: https://github.com/oxc-project/oxc/issues/28717 and https://github.com/napi-rs/napi-rs/issues/3674 +if ( + (globalThis.process?.versions?.['webcontainer'] || + globalThis.process?.env?.['NAPI_RS_FORCE_WASI'] === 'true') && + !('addonModule' in Object.prototype) +) { + Object.defineProperty(Object.prototype, 'addonModule', { + get() { + return (this as { napiModule?: unknown }).napiModule; + }, + configurable: true, + enumerable: false, + }); +} diff --git a/packages/angular/build/src/tools/oxc/traversal.ts b/packages/angular/build/src/tools/oxc/traversal.ts index f25f4bc78664..7d85e312522a 100644 --- a/packages/angular/build/src/tools/oxc/traversal.ts +++ b/packages/angular/build/src/tools/oxc/traversal.ts @@ -6,6 +6,7 @@ * found in the LICENSE file at https://angular.dev/license */ +import './oxc-wasi-shim'; import type { Node } from '@oxc-project/types'; import { visitorKeys } from 'oxc-parser'; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2febf803fd89..f700c279418f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -596,9 +596,6 @@ importers: specifier: 5.0.5 version: 5.0.5(@opentelemetry/api@1.10.0)(@types/node@22.20.5)(@vitest/coverage-v8@5.0.5)(jsdom@30.1.3(@noble/hashes@1.8.0))(vite@8.3.5(@types/node@22.20.5)(esbuild@0.28.2)(jiti@2.7.0)(less@4.9.1(supports-color@11.0.0))(sass-embedded@1.106.1)(sass@1.106.1)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) optionalDependencies: - '@oxc-parser/binding-wasm32-wasi': - specifier: 0.156.0 - version: 0.156.0 lmdb: specifier: 3.5.9 version: 3.5.9 @@ -1805,15 +1802,6 @@ packages: resolution: {integrity: sha512-Xc3VhU02wqZ1HvHRJUwL09HkZSTvidqY5Ya0NXBSYOxAp+Ln9dcJr9fySI+CkONzP3PekQo9WdzCv0PGER/mOA==} engines: {node: '>=14.17.0'} - '@emnapi/core@2.0.0-alpha.6': - resolution: {integrity: sha512-MNVvMV7WtEJMgqaWJMvCyupK7Oi8sZctUIgPRZTsiS3cVvefk8DXPflOU3MSBddtj/rrYHygpYgpHDgwXnI3+w==} - - '@emnapi/runtime@2.0.0-alpha.6': - resolution: {integrity: sha512-5ZR49ZsZ3cLvu5lkrVj6CMpHRgZjYz7XSlqK23GYYpyEqp749RVuIH0bEUKaGNghMh2pXRhIC3cnVrH28Y1j1Q==} - - '@emnapi/wasi-threads@2.2.0': - resolution: {integrity: sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==} - '@esbuild/aix-ppc64@0.28.2': resolution: {integrity: sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==} engines: {node: '>=18'} @@ -2855,13 +2843,6 @@ packages: resolution: {integrity: sha512-xJIPs+bYuc9ASBl+cvGsKbGrJmS6fAKaSZCnT0lhahT5rhA2VVy9/EcIgd2JhtEuFOJNx7UHNn/qiTPTY4nrQw==} engines: {node: '>= 10'} - '@napi-rs/wasm-runtime@1.2.6': - resolution: {integrity: sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==} - engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0} - peerDependencies: - '@emnapi/core': ^1.7.1 || 2.0.0-beta.2 - '@emnapi/runtime': ^1.7.1 || 2.0.0-beta.2 - '@noble/hashes@1.8.0': resolution: {integrity: sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==} engines: {node: ^14.21.3 || >=16} @@ -3102,10 +3083,6 @@ packages: cpu: [arm64] os: [openharmony] - '@oxc-parser/binding-wasm32-wasi@0.156.0': - resolution: {integrity: sha512-FWs20Zd4XCqpVwiTgKhyXWplIliulfwJMCI+POY2z1YF9IFr91qDLa7Jfqu0f1i95GFOy0GUGx8s6C4EtfFM3g==} - engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0} - '@oxc-parser/binding-win32-arm64-msvc@0.156.0': resolution: {integrity: sha512-l21Tz6tjraGBC3JefVeJZ9pojD0fCiB62PydAv+i9nrqJX7z/pDmyDNYLamDr/PRcQ4UQbFwkSnz7NKBB9UMLw==} engines: {node: ^20.19.0 || >=22.12.0} @@ -3628,9 +3605,6 @@ packages: peerDependencies: eslint: '>=7.7.0' - '@tybys/wasm-util@0.10.4': - resolution: {integrity: sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==} - '@types/babel__core@7.20.5': resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} @@ -9536,22 +9510,6 @@ snapshots: '@discoveryjs/json-ext@1.1.0': {} - '@emnapi/core@2.0.0-alpha.6': - dependencies: - '@emnapi/wasi-threads': 2.2.0 - tslib: 2.8.1 - optional: true - - '@emnapi/runtime@2.0.0-alpha.6': - dependencies: - tslib: 2.8.1 - optional: true - - '@emnapi/wasi-threads@2.2.0': - dependencies: - tslib: 2.8.1 - optional: true - '@esbuild/aix-ppc64@0.28.2': optional: true @@ -10683,13 +10641,6 @@ snapshots: '@napi-rs/nice-win32-x64-msvc': 1.1.1 optional: true - '@napi-rs/wasm-runtime@1.2.6(@emnapi/core@2.0.0-alpha.6)(@emnapi/runtime@2.0.0-alpha.6)': - dependencies: - '@emnapi/core': 2.0.0-alpha.6 - '@emnapi/runtime': 2.0.0-alpha.6 - '@tybys/wasm-util': 0.10.4 - optional: true - '@noble/hashes@1.8.0': {} '@nodelib/fs.scandir@2.1.5': @@ -10895,13 +10846,6 @@ snapshots: '@oxc-parser/binding-openharmony-arm64@0.156.0': optional: true - '@oxc-parser/binding-wasm32-wasi@0.156.0': - dependencies: - '@emnapi/core': 2.0.0-alpha.6 - '@emnapi/runtime': 2.0.0-alpha.6 - '@napi-rs/wasm-runtime': 1.2.6(@emnapi/core@2.0.0-alpha.6)(@emnapi/runtime@2.0.0-alpha.6) - optional: true - '@oxc-parser/binding-win32-arm64-msvc@0.156.0': optional: true @@ -11298,11 +11242,6 @@ snapshots: dependencies: eslint: 10.13.0(jiti@2.7.0)(supports-color@11.0.0) - '@tybys/wasm-util@0.10.4': - dependencies: - tslib: 2.8.1 - optional: true - '@types/babel__core@7.20.5': dependencies: '@babel/parser': 7.29.11 diff --git a/tests/e2e/tests/vite/wasi.ts b/tests/e2e/tests/vite/wasi.ts new file mode 100644 index 000000000000..7d9f31c03bb4 --- /dev/null +++ b/tests/e2e/tests/vite/wasi.ts @@ -0,0 +1,27 @@ +import assert from 'node:assert'; +import { getGlobalVariable } from '../../utils/env'; +import { ngServe } from '../../utils/project'; + +export default async function () { + assert( + getGlobalVariable('argv')['esbuild'], + 'This test should not be called in the Webpack suite.', + ); + + const originalForceWasi = process.env['NAPI_RS_FORCE_WASI']; + process.env['NAPI_RS_FORCE_WASI'] = 'true'; + + try { + const port = await ngServe(); + const response = await fetch(`http://localhost:${port}/`); + assert(response.ok, 'Expected response to be ok'); + const text = await response.text(); + assert.match(text, / Date: Mon, 2 Nov 2026 09:45:54 +0000 Subject: [PATCH 2/4] fixup! fix(@angular/build): enable oxc WASI fallback in WebContainer environments --- packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts b/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts index 2c187eeb59cb..b61d419ffb58 100644 --- a/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts +++ b/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts @@ -30,6 +30,14 @@ if ( get() { return (this as { napiModule?: unknown }).napiModule; }, + set(value) { + Object.defineProperty(this, 'addonModule', { + value, + writable: true, + configurable: true, + enumerable: true, + }); + }, configurable: true, enumerable: false, }); From 4d2137ecf101ca97026875d6f437d799c7ef33df Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:53:26 +0000 Subject: [PATCH 3/4] fixup! fix(@angular/build): enable oxc WASI fallback in WebContainer environments --- .../angular/build/src/tools/oxc/oxc-wasi-shim.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts b/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts index b61d419ffb58..0706551f239c 100644 --- a/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts +++ b/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts @@ -31,12 +31,14 @@ if ( return (this as { napiModule?: unknown }).napiModule; }, set(value) { - Object.defineProperty(this, 'addonModule', { - value, - writable: true, - configurable: true, - enumerable: true, - }); + if (this && (typeof this === 'object' || typeof this === 'function')) { + Object.defineProperty(this, 'addonModule', { + value, + writable: true, + configurable: true, + enumerable: true, + }); + } }, configurable: true, enumerable: false, From 9be932c80f72d041ad71a5f3d28b42a311e982e1 Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:46:49 +0000 Subject: [PATCH 4/4] fixup! fix(@angular/build): enable oxc WASI fallback in WebContainer environments --- packages/angular/build/package.json | 1 + .../build/src/tools/oxc/oxc-wasi-shim.ts | 55 ++++++++++++++--- pnpm-lock.yaml | 61 +++++++++++++++++++ tests/e2e/tests/vite/wasi.ts | 10 +-- 4 files changed, 110 insertions(+), 17 deletions(-) diff --git a/packages/angular/build/package.json b/packages/angular/build/package.json index 51b46c5e9a78..dfe7c94e14a5 100644 --- a/packages/angular/build/package.json +++ b/packages/angular/build/package.json @@ -48,6 +48,7 @@ "xxhash-wasm": "1.1.0" }, "optionalDependencies": { + "@oxc-parser/binding-wasm32-wasi": "0.156.0", "lmdb": "3.5.9" }, "devDependencies": { diff --git a/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts b/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts index 0706551f239c..3285052be059 100644 --- a/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts +++ b/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts @@ -6,24 +6,30 @@ * found in the LICENSE file at https://angular.dev/license */ +import { Module, createRequire } from 'node:module'; + // Workaround for an upstream incompatibility in `@oxc-parser/binding-wasm32-wasi` when // falling back to WebAssembly (e.g., inside WebContainers or StackBlitz). // // `@oxc-parser/binding-wasm32-wasi` declares a dependency on `@emnapi/core@2.0.0-alpha.6`, -// but depends on `@napi-rs/wasm-runtime@~1.2.6` which expects `@emnapi/core@>=2.0.0-beta.2`. -// In `@napi-rs/wasm-runtime@1.2.6`, the runtime attempts to assign `initWorker` to -// `emnapi_shared.addonModule`, which is undefined in `alpha.6` where the property was named -// `napiModule`. This results in `TypeError: Cannot set properties of undefined (setting 'initWorker')`, -// causing WASI binding initialization to fail and surface as a misleading "WASI binding not found" error -// or an `ERR_REQUIRE_CYCLE_MODULE` failure. -// -// Aliasing `addonModule` to `this.napiModule` on `Object.prototype` allows the WASI runtime to -// initialize successfully. +// but depends on `@napi-rs/wasm-runtime@~1.2.6` which expects `@emnapi/core@^1.7.1 || 2.0.0-beta.2`. +// 1. In `@napi-rs/wasm-runtime@1.2.6`, the runtime attempts to assign `initWorker` to +// `emnapi_shared.addonModule`, which is undefined in `alpha.6` where the property was named +// `napiModule`. Aliasing `addonModule` to `this.napiModule` on `Object.prototype` allows the +// WASI runtime to initialize successfully. +// 2. Under npm, `@napi-rs/wasm-runtime@1.2.6`'s peerDependencies cause npm to hoist `@emnapi/core@1.x` +// to top-level `node_modules` while nesting `2.0.0-alpha.6` under `@oxc-parser/binding-wasm32-wasi`, +// causing an ABI mismatch (`this.bridge.setLastError is not a function`). Under pnpm, `oxc-parser` +// does not declare `@oxc-parser/binding-wasm32-wasi` in its own dependencies. Resolving these +// packages relative to `@angular/build` and `@oxc-parser/binding-wasm32-wasi` ensures consistent +// module resolution across package managers. // // See: https://github.com/oxc-project/oxc/issues/28717 and https://github.com/napi-rs/napi-rs/issues/3674 +const forceWasi = globalThis.process?.env?.['NAPI_RS_FORCE_WASI']; if ( (globalThis.process?.versions?.['webcontainer'] || - globalThis.process?.env?.['NAPI_RS_FORCE_WASI'] === 'true') && + forceWasi === 'true' || + forceWasi === 'error') && !('addonModule' in Object.prototype) ) { Object.defineProperty(Object.prototype, 'addonModule', { @@ -43,4 +49,33 @@ if ( configurable: true, enumerable: false, }); + + const resolvedModules = new Map(); + try { + const wasiBindingPath = require.resolve('@oxc-parser/binding-wasm32-wasi'); + resolvedModules.set('@oxc-parser/binding-wasm32-wasi', wasiBindingPath); + const wasiRequire = createRequire(wasiBindingPath); + resolvedModules.set('@emnapi/core', wasiRequire.resolve('@emnapi/core')); + resolvedModules.set('@emnapi/runtime', wasiRequire.resolve('@emnapi/runtime')); + } catch {} + + if (resolvedModules.size > 0) { + const moduleWithResolve = Module as typeof Module & { + _resolveFilename: ( + request: string, + parent: unknown, + isMain: boolean, + options: unknown, + ) => string; + }; + const origResolveFilename = moduleWithResolve._resolveFilename; + moduleWithResolve._resolveFilename = function (request, parent, isMain, options) { + const resolved = resolvedModules.get(request); + if (resolved !== undefined) { + return resolved; + } + + return origResolveFilename.call(this, request, parent, isMain, options); + }; + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f700c279418f..2febf803fd89 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -596,6 +596,9 @@ importers: specifier: 5.0.5 version: 5.0.5(@opentelemetry/api@1.10.0)(@types/node@22.20.5)(@vitest/coverage-v8@5.0.5)(jsdom@30.1.3(@noble/hashes@1.8.0))(vite@8.3.5(@types/node@22.20.5)(esbuild@0.28.2)(jiti@2.7.0)(less@4.9.1(supports-color@11.0.0))(sass-embedded@1.106.1)(sass@1.106.1)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) optionalDependencies: + '@oxc-parser/binding-wasm32-wasi': + specifier: 0.156.0 + version: 0.156.0 lmdb: specifier: 3.5.9 version: 3.5.9 @@ -1802,6 +1805,15 @@ packages: resolution: {integrity: sha512-Xc3VhU02wqZ1HvHRJUwL09HkZSTvidqY5Ya0NXBSYOxAp+Ln9dcJr9fySI+CkONzP3PekQo9WdzCv0PGER/mOA==} engines: {node: '>=14.17.0'} + '@emnapi/core@2.0.0-alpha.6': + resolution: {integrity: sha512-MNVvMV7WtEJMgqaWJMvCyupK7Oi8sZctUIgPRZTsiS3cVvefk8DXPflOU3MSBddtj/rrYHygpYgpHDgwXnI3+w==} + + '@emnapi/runtime@2.0.0-alpha.6': + resolution: {integrity: sha512-5ZR49ZsZ3cLvu5lkrVj6CMpHRgZjYz7XSlqK23GYYpyEqp749RVuIH0bEUKaGNghMh2pXRhIC3cnVrH28Y1j1Q==} + + '@emnapi/wasi-threads@2.2.0': + resolution: {integrity: sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==} + '@esbuild/aix-ppc64@0.28.2': resolution: {integrity: sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==} engines: {node: '>=18'} @@ -2843,6 +2855,13 @@ packages: resolution: {integrity: sha512-xJIPs+bYuc9ASBl+cvGsKbGrJmS6fAKaSZCnT0lhahT5rhA2VVy9/EcIgd2JhtEuFOJNx7UHNn/qiTPTY4nrQw==} engines: {node: '>= 10'} + '@napi-rs/wasm-runtime@1.2.6': + resolution: {integrity: sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==} + engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0} + peerDependencies: + '@emnapi/core': ^1.7.1 || 2.0.0-beta.2 + '@emnapi/runtime': ^1.7.1 || 2.0.0-beta.2 + '@noble/hashes@1.8.0': resolution: {integrity: sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==} engines: {node: ^14.21.3 || >=16} @@ -3083,6 +3102,10 @@ packages: cpu: [arm64] os: [openharmony] + '@oxc-parser/binding-wasm32-wasi@0.156.0': + resolution: {integrity: sha512-FWs20Zd4XCqpVwiTgKhyXWplIliulfwJMCI+POY2z1YF9IFr91qDLa7Jfqu0f1i95GFOy0GUGx8s6C4EtfFM3g==} + engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0} + '@oxc-parser/binding-win32-arm64-msvc@0.156.0': resolution: {integrity: sha512-l21Tz6tjraGBC3JefVeJZ9pojD0fCiB62PydAv+i9nrqJX7z/pDmyDNYLamDr/PRcQ4UQbFwkSnz7NKBB9UMLw==} engines: {node: ^20.19.0 || >=22.12.0} @@ -3605,6 +3628,9 @@ packages: peerDependencies: eslint: '>=7.7.0' + '@tybys/wasm-util@0.10.4': + resolution: {integrity: sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==} + '@types/babel__core@7.20.5': resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} @@ -9510,6 +9536,22 @@ snapshots: '@discoveryjs/json-ext@1.1.0': {} + '@emnapi/core@2.0.0-alpha.6': + dependencies: + '@emnapi/wasi-threads': 2.2.0 + tslib: 2.8.1 + optional: true + + '@emnapi/runtime@2.0.0-alpha.6': + dependencies: + tslib: 2.8.1 + optional: true + + '@emnapi/wasi-threads@2.2.0': + dependencies: + tslib: 2.8.1 + optional: true + '@esbuild/aix-ppc64@0.28.2': optional: true @@ -10641,6 +10683,13 @@ snapshots: '@napi-rs/nice-win32-x64-msvc': 1.1.1 optional: true + '@napi-rs/wasm-runtime@1.2.6(@emnapi/core@2.0.0-alpha.6)(@emnapi/runtime@2.0.0-alpha.6)': + dependencies: + '@emnapi/core': 2.0.0-alpha.6 + '@emnapi/runtime': 2.0.0-alpha.6 + '@tybys/wasm-util': 0.10.4 + optional: true + '@noble/hashes@1.8.0': {} '@nodelib/fs.scandir@2.1.5': @@ -10846,6 +10895,13 @@ snapshots: '@oxc-parser/binding-openharmony-arm64@0.156.0': optional: true + '@oxc-parser/binding-wasm32-wasi@0.156.0': + dependencies: + '@emnapi/core': 2.0.0-alpha.6 + '@emnapi/runtime': 2.0.0-alpha.6 + '@napi-rs/wasm-runtime': 1.2.6(@emnapi/core@2.0.0-alpha.6)(@emnapi/runtime@2.0.0-alpha.6) + optional: true + '@oxc-parser/binding-win32-arm64-msvc@0.156.0': optional: true @@ -11242,6 +11298,11 @@ snapshots: dependencies: eslint: 10.13.0(jiti@2.7.0)(supports-color@11.0.0) + '@tybys/wasm-util@0.10.4': + dependencies: + tslib: 2.8.1 + optional: true + '@types/babel__core@7.20.5': dependencies: '@babel/parser': 7.29.11 diff --git a/tests/e2e/tests/vite/wasi.ts b/tests/e2e/tests/vite/wasi.ts index 7d9f31c03bb4..b7ddafb4e82c 100644 --- a/tests/e2e/tests/vite/wasi.ts +++ b/tests/e2e/tests/vite/wasi.ts @@ -1,6 +1,6 @@ import assert from 'node:assert'; import { getGlobalVariable } from '../../utils/env'; -import { ngServe } from '../../utils/project'; +import { ng } from '../../utils/process'; export default async function () { assert( @@ -9,14 +9,10 @@ export default async function () { ); const originalForceWasi = process.env['NAPI_RS_FORCE_WASI']; - process.env['NAPI_RS_FORCE_WASI'] = 'true'; + process.env['NAPI_RS_FORCE_WASI'] = 'error'; try { - const port = await ngServe(); - const response = await fetch(`http://localhost:${port}/`); - assert(response.ok, 'Expected response to be ok'); - const text = await response.text(); - assert.match(text, /