From c30194ba0d2926ef905872316865b5f436e1e0ab 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/3] 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 (cherry picked from commit cbc38887a1246e913246e7cf85436f21a3cba1ab) --- 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 | 44 +++++++++++++ .../angular/build/src/tools/oxc/traversal.ts | 1 + pnpm-lock.yaml | 66 ------------------- tests/e2e/tests/vite/wasi.ts | 27 ++++++++ 7 files changed, 74 insertions(+), 67 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 6ca438be18ed..c047389a0fab 100644 --- a/packages/angular/build/package.json +++ b/packages/angular/build/package.json @@ -47,7 +47,6 @@ "xxhash-wasm": "1.1.0" }, "optionalDependencies": { - "@oxc-parser/binding-wasm32-wasi": "0.150.0", "lmdb": "3.5.6" }, "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..b61d419ffb58 --- /dev/null +++ b/packages/angular/build/src/tools/oxc/oxc-wasi-shim.ts @@ -0,0 +1,44 @@ +/** + * @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; + }, + set(value) { + Object.defineProperty(this, 'addonModule', { + value, + writable: true, + configurable: true, + enumerable: true, + }); + }, + 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 1149ea59e045..b70bdde77ea2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -593,9 +593,6 @@ importers: specifier: 5.0.1 version: 5.0.1(@opentelemetry/api@1.10.0)(@types/node@22.20.5)(@vitest/coverage-v8@5.0.1)(jsdom@30.0.1(@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.104.1)(sass@1.104.1)(terser@5.51.2)(tsx@4.23.15)(yaml@2.9.1)) optionalDependencies: - '@oxc-parser/binding-wasm32-wasi': - specifier: 0.150.0 - version: 0.150.0 lmdb: specifier: 3.5.6 version: 3.5.6 @@ -1811,15 +1808,6 @@ packages: resolution: {integrity: sha512-Xc3VhU02wqZ1HvHRJUwL09HkZSTvidqY5Ya0NXBSYOxAp+Ln9dcJr9fySI+CkONzP3PekQo9WdzCv0PGER/mOA==} engines: {node: '>=14.17.0'} - '@emnapi/core@2.0.0-alpha.3': - resolution: {integrity: sha512-AZypUeJ/yByuxyS7BlSNRDOMLMlROYtjYdIAuBmJssVz1UJDSeYxLrdizhXCFYhedC5bqd/ASy8EuNXbVVXp9g==} - - '@emnapi/runtime@2.0.0-alpha.3': - resolution: {integrity: sha512-hFPAhMUjJD9BSyCANEISPOogeXC9Zo9ZQl7L6vKnaVsMkCtzznaW/naYypeyl0Gv5rYfWYsZbpixTMpjDJzQeA==} - - '@emnapi/wasi-threads@2.0.1': - resolution: {integrity: sha512-9DsSk+o5NBX0CCJT8s0EROGSGxjR/tKu6aBTaVyq+SjAEQH4XcdcRxPBRzsBLizTTJ49MJjF+jgu3qnO9GLQcQ==} - '@esbuild/aix-ppc64@0.28.2': resolution: {integrity: sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==} engines: {node: '>=18'} @@ -2995,13 +2983,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} @@ -3242,10 +3223,6 @@ packages: cpu: [arm64] os: [openharmony] - '@oxc-parser/binding-wasm32-wasi@0.150.0': - resolution: {integrity: sha512-bTxhIS4YI/Qr6dt5UACoOUNBeGTMr7tjLTjZzmD93OwMg9Qq5Y4RTmfEWUf4h0DM/Ury+3yVdPAoMEqAE+zFnA==} - 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} @@ -3270,9 +3247,6 @@ packages: '@oxc-project/types@0.156.0': resolution: {integrity: sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==} - '@oxc-project/types@0.156.0': - resolution: {integrity: sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==} - '@parcel/watcher-android-arm64@2.6.0': resolution: {integrity: sha512-trgpLSCKRC/huFjXX/Smh+0sWe4+YtKfktIToiMl59ghz7z+qkH6kMvNnUbLyRs9N11t8l4svSCs1+5B3rOAhA==} engines: {node: '>= 10.0.0'} @@ -3771,9 +3745,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==} @@ -9755,22 +9726,6 @@ snapshots: '@discoveryjs/json-ext@1.1.0': {} - '@emnapi/core@2.0.0-alpha.3': - dependencies: - '@emnapi/wasi-threads': 2.0.1 - tslib: 2.8.1 - optional: true - - '@emnapi/runtime@2.0.0-alpha.3': - dependencies: - tslib: 2.8.1 - optional: true - - '@emnapi/wasi-threads@2.0.1': - dependencies: - tslib: 2.8.1 - optional: true - '@esbuild/aix-ppc64@0.28.2': optional: true @@ -10906,13 +10861,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.3)(@emnapi/runtime@2.0.0-alpha.3)': - dependencies: - '@emnapi/core': 2.0.0-alpha.3 - '@emnapi/runtime': 2.0.0-alpha.3 - '@tybys/wasm-util': 0.10.4 - optional: true - '@noble/hashes@1.8.0': {} '@nodelib/fs.scandir@2.1.5': @@ -11118,13 +11066,6 @@ snapshots: '@oxc-parser/binding-openharmony-arm64@0.156.0': optional: true - '@oxc-parser/binding-wasm32-wasi@0.150.0': - dependencies: - '@emnapi/core': 2.0.0-alpha.3 - '@emnapi/runtime': 2.0.0-alpha.3 - '@napi-rs/wasm-runtime': 1.2.6(@emnapi/core@2.0.0-alpha.3)(@emnapi/runtime@2.0.0-alpha.3) - optional: true - '@oxc-parser/binding-win32-arm64-msvc@0.156.0': optional: true @@ -11138,8 +11079,6 @@ snapshots: '@oxc-project/types@0.156.0': {} - '@oxc-project/types@0.156.0': {} - '@parcel/watcher-android-arm64@2.6.0': optional: true @@ -11523,11 +11462,6 @@ snapshots: dependencies: eslint: 10.10.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:56:27 +0000 Subject: [PATCH 2/3] 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 d0e9af2dabd8c43bafde934e58064666bd4d0733 Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Mon, 2 Nov 2026 17:38:56 +0000 Subject: [PATCH 3/3] 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 c047389a0fab..9088949b38ad 100644 --- a/packages/angular/build/package.json +++ b/packages/angular/build/package.json @@ -47,6 +47,7 @@ "xxhash-wasm": "1.1.0" }, "optionalDependencies": { + "@oxc-parser/binding-wasm32-wasi": "0.156.0", "lmdb": "3.5.6" }, "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 b70bdde77ea2..af5fb6b024d8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -593,6 +593,9 @@ importers: specifier: 5.0.1 version: 5.0.1(@opentelemetry/api@1.10.0)(@types/node@22.20.5)(@vitest/coverage-v8@5.0.1)(jsdom@30.0.1(@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.104.1)(sass@1.104.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.6 version: 3.5.6 @@ -1808,6 +1811,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'} @@ -2983,6 +2995,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} @@ -3223,6 +3242,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} @@ -3745,6 +3768,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==} @@ -9726,6 +9752,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 @@ -10861,6 +10903,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': @@ -11066,6 +11115,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 @@ -11462,6 +11518,11 @@ snapshots: dependencies: eslint: 10.10.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, /