Conversation
README: header now mentions four WASM runtime plugins; new rows in the packages table for ns-wasm-core and ns-wasm-kit-runtime; WebAssembly plugins section covers all three runtimes; new Linting section (Kotlin: Detekt + Ktlint, Swift: SwiftLint + Periphery); per-package docs updated. AGENTS: ns-wasm-core added as shared foundation package; ns-wasm-kit-runtime added as WasmKit Swift interpreter plugin; "Both plugins" references updated to "the WASM runtime plugins"; per-package guidance table includes the two new packages.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe change adds Endive, Chicory, and WasmEdge NativeScript WASM runtime packages. It updates shared WASM infrastructure, existing runtime contracts, tests, CI workflows, project references, package documentation, unsupported-platform guidance, and Nx lint and format tooling. ChangesWASM runtime expansion
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant TestApp
participant RuntimeWrapper
participant NativeAdapter
participant NativeRuntime
TestApp->>RuntimeWrapper: Run shared fixture checks
RuntimeWrapper->>NativeAdapter: Load module and invoke function
NativeAdapter->>NativeRuntime: Convert values and call native API
NativeRuntime-->>NativeAdapter: Return module, memory, and function results
NativeAdapter-->>RuntimeWrapper: Return normalized WASM values
RuntimeWrapper-->>TestApp: Report fixture results
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
New NativeScript plugin wrapping the Endive WebAssembly interpreter (https://github.com/bytecodealliance/endive). Endive runs on the JVM, so Android gets the real adapter and iOS throws a clear unsupported error. - src/lib/endive.ts — EndiveRuntime/Module/Function extending the shared base classes from ns-wasm-core, EndiveError alias, engine types - src/lib/endive-android.ts — Android platform adapter (Kotlin/JNI native classes — org.nativescript.endive.*, same wire protocol as wasm3/wamr) - src/lib/endive-ios.ts — iOS throws "Endive is Java-based, not supported" - src/lib/endive.spec.ts — vitest spec with Android-native fakes - src/lib/native-api.d.ts — Kotlin native class declarations Wired into the test app: fixture-module.spec.ts and the demo page main-view-model now runs Endive alongside wasm3, WAMR and WasmKit.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@AGENTS.md`:
- Around line 42-43: Update the architecture documentation near the WASM runtime
plugin description to scope the Rust cargo workspace, UniFFI Kotlin/Swift
bindings, and mirror-image native architecture exclusively to ns-wasm3 and
ns-wamr. Keep the shared wire protocol, TypeScript adapter, and TypeScript API
described as common components, and exclude ns-wasm-kit-runtime from the
Rust/UniFFI architecture because it is Swift-native and iOS-only.
In `@README.md`:
- Around line 4-11: Update the README overview to say “three WASM runtime
plugins” and revise the referenced “Both plugins” wording to “The WASM runtime
plugins,” ensuring the plugin count and scope accurately cover wasm3, WAMR, and
WasmKit without including ns-wry.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
wasm-test-ios and wasm-test-android now build ns-wasm-core, ns-wasm-kit-runtime, and ns-endive alongside the existing plugins (the test app imports from all of them, so their dist/ must exist before pnpm install). The changes filter (wasm3/wamr/app) also reacts to changes in the new shared/core packages so CI runs when the foundation changes. Note: the test app has new file: dependencies (ns-wasm-kit-runtime, ns-endive) — its pnpm-lock.yaml must be updated (run pnpm install in apps/ns-wasm-test) before the frozen-lockfile checks will pass.
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/ns-wasm-test/app/main-view-model.ts`:
- Line 63: Update the section setup around runWasm3, runWamr, runWasmKit, and
runEndive to execute Endive only on Android or mark it skipped on iOS,
preventing the expected unsupported error from becoming a failure. Also revise
the success message in the surrounding run flow to describe all four runtime
sections rather than “both runtimes.”
In `@apps/ns-wasm-test/app/tests/endive/fixture-module.spec.ts`:
- Around line 69-72: Update the shared fixture test around runFixtureChecks to
pass the HostCall[] log initialized by beforeEach as its second argument, and
remove the module as any cast so the call uses the structural WasmModuleLike
type. Keep the existing report summarization and failed-count assertion
unchanged.
In `@packages/ns-endive/src/lib/endive-android.ts`:
- Around line 130-142: Update getGlobal() to normalize module reads through
normalizeAndroidValue(), and modify normalizeAndroidValue() so java.lang.Long
values return String(value.toString()) before numeric unboxing, preserving i64
precision. Update setGlobal() to pass values through toJavaWireValue() so
numeric values cross the Android bridge as boxed Double values.
- Around line 64-67: Update toJavaWireValue and the EndiveFunction.call argument
path to construct a Java ArrayList, add each converted argument, and pass that
list to NSCEndiveFunction.call; use java.lang.Double.valueOf() for numeric
values. Preserve i64 globals as decimal strings and avoid Number(v) before
shared-layer bigint conversion so values above Number.MAX_SAFE_INTEGER remain
exact.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 93761c8f-3940-4d36-ae53-19d6f9ea4b22
📒 Files selected for processing (15)
apps/ns-wasm-test/app/main-view-model.tsapps/ns-wasm-test/app/tests/endive/fixture-module.spec.tsapps/ns-wasm-test/package.jsonpackages/ns-endive/package.jsonpackages/ns-endive/src/index.tspackages/ns-endive/src/lib/endive-android.tspackages/ns-endive/src/lib/endive-ios.tspackages/ns-endive/src/lib/endive.spec.tspackages/ns-endive/src/lib/endive.tspackages/ns-endive/src/lib/native-api.d.tspackages/ns-endive/src/lib/wire.tspackages/ns-endive/tsconfig.jsonpackages/ns-endive/tsconfig.lib.jsonpackages/ns-endive/tsconfig.spec.jsonpackages/ns-endive/vitest.config.mts
Clarify that the Rust cargo workspace, UniFFI Kotlin/Swift bindings, and mirror-image native architecture apply exclusively to ns-wasm3 and ns-wamr. ns-wasm-kit-runtime (Swift-native WasmKit) and ns-endive (Java-native Endive) share the TypeScript API, wire protocol, and ns-wasm-core foundation but use their own per-engine native layers.
The overview counted ns-wry as a fourth WASM runtime, but it is a general-purpose NativeScript scaffold (not a WebAssembly engine). Separate it into its own paragraph. Also fix the "Both plugins" lingering reference → "The WASM runtime plugins".
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Line 462: Regenerate apps/ns-wasm-test/pnpm-lock.yaml from the current
manifest so its importer includes `@cross-code/ns-wasm-kit-runtime` and
`@cross-code/ns-endive`, allowing frozen installs to succeed. Keep ns-wasm-core
out of the dependency update because it is only a build target, not an app
dependency.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: ffbbaf02-e36c-40d7-bfba-094c2ea619c0
📒 Files selected for processing (1)
.github/workflows/ci.yml
Endive throws "not supported" on iOS (it is Java-native). Gate the runEndive() section behind globalThis.isAndroid so the expected unsupported error does not become a demo failure on iOS. Success message updated from "both runtimes" to "all runtimes" since the demo now covers wasm3, WAMR, WasmKit and (on Android) Endive.
runFixtureChecks expects (module, log) with a WasmModuleLike structural type — EndiveModule satisfies it without a cast. The log array is already initialized by beforeEach().
…obal - toJavaWireValue: use java.lang.Double.valueOf() (static factory) instead of new Double() — the NS Android bridge boxes primitives as Float, silently truncating f64 - AndroidFunction.call: build a java.util.ArrayList and add each converted argument, then pass the ArrayList to NSCEndiveFunction.call (the previous code looped a JS array through javaArrayToJs, which expects a Java list) - getGlobal: return the raw native value instead of Number(v). i64 globals cross as decimal strings; Number() before the shared-layer BigInt conversion would silently truncate values above Number.MAX_SAFE_INTEGER
…ire in setGlobal - normalizeAndroidValue: check for java.lang.Long via instanceof before numeric unboxing — i64 globals cross the Android bridge as Long and must be stringified (String(value.toString())) so values above Number.MAX_SAFE_INTEGER stay exact. Fall back with instanceof java.lang.Number + doubleValue() instead of duck-typing. - getGlobal: normalize through normalizeAndroidValue() - setGlobal: pass values through toJavaWireValue() so numeric values cross as boxed Double objects (the NS Android bridge boxes primitives as Float)
WasmKit is Swift-native (iOS only) and Endive is Java-native (Android only). Both were previously included unconditionally — WasmKit threw on Android, Endive on iOS. Now each only runs on its native platform. wasm3 and WAMR run on both.
New NativeScript plugin wrapping the WasmEdge WebAssembly runtime (https://github.com/WasmEdge/WasmEdge). WasmEdge runs on both iOS and Android. - src/lib/wasmedge.ts — WasmEdgeRuntime/Module/Function extending the shared base classes, WasmEdgeError alias, engine types - src/lib/wasmedge-ios.ts — iOS adapter (NSCWasmEdge ObjC classes) - src/lib/wasmedge-android.ts — Android adapter (org.nativescript.wasmedge.*, with java.lang.Long → String for i64, Double.valueOf() for f64) - src/lib/wasmedge.spec.ts — vitest spec with iOS-native fakes - src/lib/native-api.d.ts — native class declarations Wired into the test app: fixture-module.spec.ts and the demo page.
New NativeScript plugin wrapping the Chicory WebAssembly interpreter (https://github.com/dylibso/chicory). Chicory is pure Java, so it is Android-only — the iOS adapter throws a clear unsupported error. - src/lib/chicory.ts — ChicoryRuntime/Module/Function, engine types - src/lib/chicory-android.ts — Android adapter (org.nativescript.chicory.*, java.lang.Long → String for i64, Double.valueOf() for f64) - src/lib/chicory-ios.ts — iOS stub ("pure-Java, not supported") - src/lib/chicory.spec.ts — vitest spec with Android-native fakes - src/lib/native-api.d.ts — native class declarations Wired into the test app demo (Android-only, alongside Endive).
pnpm-lock.yaml and test app lockfile updated for new workspace deps. tsconfig.lib.json exclude lists aligned across all packages. Spec files updated with consistent patterns.
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/ns-wasm-chicory/vitest.config.mts (1)
3-3: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winReplace each remaining
root: __dirnamein the ESM Vitest configurations.
.mtsfiles do not define__dirname; evaluatingrootthrows before Vitest starts. Update these files to derive the directory fromimport.meta.urlor useimport.meta.dirname:
packages/ns-endive/vitest.config.mtspackages/ns-wamr/vitest.config.mtspackages/ns-wasm-chicory/vitest.config.mtspackages/ns-wasm-core/vitest.config.mtspackages/ns-wasm-edge/vitest.config.mtspackages/ns-wasm-kit-runtime/vitest.config.mtspackages/ns-wasm3/vitest.config.mtspackages/ns-wry/vitest.config.mtspackages/nx-buck2/vitest.config.mtspackages/nx-ns-app/vitest.config.mts🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ns-wasm-chicory/vitest.config.mts` at line 3, Replace each remaining root: __dirname usage in the Vitest configurations, including packages/ns-wasm-chicory/vitest.config.mts:3-3 and packages/ns-wasm-edge/vitest.config.mts:3-3, plus the listed configurations in packages/ns-endive, packages/ns-wamr, packages/ns-wasm-core, packages/ns-wasm-kit-runtime, packages/ns-wasm3, packages/ns-wry, packages/nx-buck2, and packages/nx-ns-app. Derive the root directory from import.meta.url or use import.meta.dirname so the ESM configurations initialize successfully.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ns-wasm-chicory/src/lib/chicory-android.ts`:
- Line 56: Update memorySize() in
packages/ns-wasm-chicory/src/lib/chicory-android.ts:56-56 and
packages/ns-wasm-edge/src/lib/wasmedge-android.ts:85-85 to catch errors from
this.runtime.memorySize() and rethrow them through rethrow(error, 'memorySize');
retain Number() for the numeric return value.
In `@packages/ns-wasm-chicory/src/lib/chicory.ts`:
- Line 31: Update WasmRuntime.loadModule in runtime.ts so both string-source and
file-backed branches construct the module, call module.linkImports(imports), and
only then return it; add a regression test covering file-backed loading with
imports, while preserving the existing ChicoryRuntime.loadModule delegation.
In `@packages/ns-wasm-edge/src/lib/wasmedge-ios.ts`:
- Line 86: Update writeMemory to convert the Uint8Array bytes argument into
NSData using NSData.dataWithBytesLength(bytes, bytes.length) before passing it
to runtime.writeMemoryAtOffsetDataError, while preserving the existing
withErrorRef handling.
In `@packages/ns-wasm-edge/src/lib/wasmedge.spec.ts`:
- Around line 20-27: Add Android adapter coverage alongside the existing
“WasmEdgeRuntime (iOS fake)” suite by installing an Android runtime fake and
testing module loading, function lookup/calls, memory reads/writes, and
missing-native error behavior through WasmEdgeRuntime. Preserve the existing iOS
tests, then run the configured V8 coverage and Nx targets plus the test
application on both iOS and Android.
In `@packages/ns-wasm-edge/src/lib/wasmedge.ts`:
- Line 37: Update WasmRuntime.loadModule so imports are linked for both string
and non-string sources after the module is loaded, or add equivalent linking in
WasmEdgeRuntime.loadModule when source is a string; ensure file-based modules
with required host imports invoke module.linkImports(imports) before returning.
In `@packages/ns-wry/AGENTS.md`:
- Around line 58-59: The Android limitation wording is inaccurate across the
package documentation. In packages/ns-wry/AGENTS.md lines 58-59, replace
“Android support has not been scaffolded yet” with wording that Android
integration is incomplete and not packaged while retaining the unavailable
Android build and host-test target limitation. In packages/ns-wry/README.md
lines 32-33 and 44, replace “NativeScript integration placeholder” and related
wording with the same precise description; no other documentation changes are
needed.
---
Outside diff comments:
In `@packages/ns-wasm-chicory/vitest.config.mts`:
- Line 3: Replace each remaining root: __dirname usage in the Vitest
configurations, including packages/ns-wasm-chicory/vitest.config.mts:3-3 and
packages/ns-wasm-edge/vitest.config.mts:3-3, plus the listed configurations in
packages/ns-endive, packages/ns-wamr, packages/ns-wasm-core,
packages/ns-wasm-kit-runtime, packages/ns-wasm3, packages/ns-wry,
packages/nx-buck2, and packages/nx-ns-app. Derive the root directory from
import.meta.url or use import.meta.dirname so the ESM configurations initialize
successfully.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 70fc47d1-552d-4b51-a8b4-9aeab2bbee21
⛔ Files ignored due to path filters (2)
apps/ns-wasm-test/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (53)
AGENTS.mdREADME.mdapps/ns-wasm-test/app/main-view-model.tsapps/ns-wasm-test/app/tests/chicory/fixture-module.spec.tsapps/ns-wasm-test/app/tests/endive/fixture-module.spec.tsapps/ns-wasm-test/app/tests/wamr/fixture-module.spec.tsapps/ns-wasm-test/app/tests/wasm3/fixture-module.spec.tsapps/ns-wasm-test/app/tests/wasmedge/fixture-module.spec.tsapps/ns-wasm-test/app/tests/wasmkit/fixture-module.spec.tsapps/ns-wasm-test/package.jsonapps/ns-wasm-test/pnpm-workspace.yamlapps/ns-wasm-test/tsconfig.jsonpackages/ns-endive/src/lib/endive-android.tspackages/ns-endive/src/lib/endive.spec.tspackages/ns-endive/tsconfig.lib.jsonpackages/ns-wamr/src/lib/wamr.spec.tspackages/ns-wamr/tsconfig.lib.jsonpackages/ns-wasm-chicory/package.jsonpackages/ns-wasm-chicory/src/index.tspackages/ns-wasm-chicory/src/lib/chicory-android.tspackages/ns-wasm-chicory/src/lib/chicory-ios.tspackages/ns-wasm-chicory/src/lib/chicory.spec.tspackages/ns-wasm-chicory/src/lib/chicory.tspackages/ns-wasm-chicory/src/lib/native-api.d.tspackages/ns-wasm-chicory/src/lib/wire.tspackages/ns-wasm-chicory/tsconfig.jsonpackages/ns-wasm-chicory/tsconfig.lib.jsonpackages/ns-wasm-chicory/tsconfig.spec.jsonpackages/ns-wasm-chicory/vitest.config.mtspackages/ns-wasm-core/src/lib/runtime.tspackages/ns-wasm-core/src/lib/wire.tspackages/ns-wasm-edge/package.jsonpackages/ns-wasm-edge/src/index.tspackages/ns-wasm-edge/src/lib/native-api.d.tspackages/ns-wasm-edge/src/lib/wasmedge-android.tspackages/ns-wasm-edge/src/lib/wasmedge-ios.tspackages/ns-wasm-edge/src/lib/wasmedge.spec.tspackages/ns-wasm-edge/src/lib/wasmedge.tspackages/ns-wasm-edge/src/lib/wire.tspackages/ns-wasm-edge/tsconfig.jsonpackages/ns-wasm-edge/tsconfig.lib.jsonpackages/ns-wasm-edge/tsconfig.spec.jsonpackages/ns-wasm-edge/vitest.config.mtspackages/ns-wasm-kit-runtime/src/lib/wasmkit-ios.tspackages/ns-wasm-kit-runtime/src/lib/wasmkit.spec.tspackages/ns-wasm-kit-runtime/tsconfig.lib.jsonpackages/ns-wasm3/src/lib/wasm3.spec.tspackages/ns-wasm3/tsconfig.lib.jsonpackages/ns-wry/AGENTS.mdpackages/ns-wry/README.mdpackages/ns-wry/package.jsonpnpm-workspace.yamltsconfig.json
💤 Files with no reviewable changes (1)
- packages/ns-wry/package.json
🚧 Files skipped from review as they are similar to previous changes (6)
- apps/ns-wasm-test/package.json
- apps/ns-wasm-test/app/tests/endive/fixture-module.spec.ts
- AGENTS.md
- packages/ns-endive/src/lib/endive.spec.ts
- README.md
- packages/ns-endive/src/lib/endive-android.ts
| loadModuleFromBytes(bytes: Uint8Array): NativeModuleAdapter { try { return new AndroidModule(this.runtime.loadModuleFromBytes(toJavaBytes(bytes))); } catch (e) { rethrow(e, 'loadModule'); throw null as never; } } | ||
| loadModuleFromFile(path: string): NativeModuleAdapter { try { return new AndroidModule(this.runtime.loadModuleFromFile(path)); } catch (e) { rethrow(e, 'loadModule'); throw null as never; } } | ||
| findFunction(name: string): NativeFunctionAdapter { try { return new AndroidFunction(this.runtime.findFunction(name)); } catch (e) { rethrow(e, 'findFunction'); throw null as never; } } | ||
| memorySize(): number { return Number(this.runtime.memorySize()); } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- chicory adapter ---'
cat -n packages/ns-wasm-chicory/src/lib/chicory-android.ts | sed -n '1,110p'
printf '%s\n' '--- edge adapter ---'
cat -n packages/ns-wasm-edge/src/lib/wasmedge-android.ts | sed -n '1,135p'
printf '%s\n' '--- helper definitions and uses ---'
rg -n -C 3 'normalizeAndroidValue|rethrow|memorySize\(' \
packages/ns-wasm-chicory packages/ns-wasm-edge \
-g '*.ts' -g '*.tsx' -g '*.mts'
printf '%s\n' '--- Vitest configs ---'
cat -n packages/ns-wasm-chicory/vitest.config.mts
cat -n packages/ns-wasm-edge/vitest.config.mtsRepository: listepo/cross-code
Length of output: 34787
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- native runtime declarations and implementations ---'
rg -n -C 4 'memorySize|NSCChicoryRuntime|NSCWasmEdgeRuntime' \
-g '*.kt' -g '*.java' -g '*.d.ts' -g '*.ts' -g '*.tsx' .
printf '%s\n' '--- Android adapter tests and runtime construction ---'
rg -n -C 5 'AndroidRuntime|memorySize\(\)|wasmedge-android|chicory-android' \
packages apps -g '*.spec.ts' -g '*.test.ts' -g '*.ts' -g '*.tsx' 2>/dev/null || true
printf '%s\n' '--- package scripts and workspace metadata ---'
rg -n -C 3 '"test"|vitest|ns-wasm-chicory|ns-wasm-edge' \
package.json nx.json project.json packages/ns-wasm-chicory packages/ns-wasm-edge \
-g 'package.json' -g 'project.json' -g 'nx.json' -g '*.json' -g '*.mts' 2>/dev/null || trueRepository: listepo/cross-code
Length of output: 50375
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- candidate native platform files ---'
find packages -type f \( -iname '*chicory*' -o -iname '*wasmedge*' \) \
\( -iname '*.kt' -o -iname '*.java' -o -iname '*.swift' -o -iname '*.mm' -o -iname '*.h' \) \
-print
printf '%s\n' '--- exact Android memorySize declarations ---'
rg -n -C 6 'fun memorySize|memorySize\(\)' packages \
-g '*.kt' -g '*.java' -g '*.swift' -g '*.mm' -g '*.h' \
| rg -n -C 4 'chicory|wasmedge|memorySize|NSCChicory|NSCWasmEdge' \
| head -200
printf '%s\n' '--- Android adapter-specific tests ---'
find packages/ns-wasm-chicory packages/ns-wasm-edge -type f \
\( -iname '*.spec.ts' -o -iname '*.test.ts' \) -printRepository: listepo/cross-code
Length of output: 15934
🌐 Web query:
NativeScript Android Java interop Java primitive return values java.lang.Number proxy doubleValue toString
💡 Result:
In NativeScript, the Android runtime handles the interop between Java primitive types and JavaScript by providing implicit marshalling [1][2]. When a Java method returns a primitive or a wrapper object (such as java.lang.Double, java.lang.Integer, etc.), NativeScript automatically converts these into JavaScript numbers [1][3][4]. Key aspects of this interop include: 1. Numeric Conversion: Java primitive types (e.g., int, double, float, short, byte) and their corresponding java.lang wrapper classes are projected as JavaScript Numbers [1][3][4]. 2. Proxy Access: When you interact with a Java object instance in NativeScript, you are working with a proxy object [5]. When you call methods on these objects—such as doubleValue on a java.lang.Double instance—the resulting Java primitive value is automatically converted to a JavaScript Number [1][6]. 3. toString behavior: When a Java object (including numeric wrappers) is involved in an operation that triggers its toString method, NativeScript leverages the standard Java toString implementation [7]. For numeric wrapper classes like java.lang.Double, calling toString returns the string representation of the value [7]. 4. Special Cases (Long): Java long types (and java.lang.Long) are handled differently if the value exceeds the safe integer limit for JavaScript (2^53 - 1). In such cases, NativeScript projects them as a special proxy object that provides a toString method returning the string representation of the long value, while its valueOf method returns NaN [6][8]. In summary, NativeScript abstracts the difference between Java primitives and JavaScript's unified Number type, ensuring that method calls returning numeric data types seamlessly provide usable JavaScript numbers in your application code [1][2].
Citations:
- 1: https://docs.nativescript.org/guide/android-marshalling
- 2: https://old.docs.nativescript.org/core-concepts/android-runtime/marshalling/overview
- 3: https://old.docs.nativescript.org/core-concepts/android-runtime/marshalling/java-to-js.html
- 4: https://old.docs.nativescript.org/core-concepts/android-runtime/marshalling/java-to-js
- 5: https://old.docs.nativescript.org/core-concepts/android-runtime/metadata/accessing-packages
- 6: https://beta.docs.nativescript.org/guide/android-marshalling
- 7: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Double.html
- 8: https://nativescript-docs-beta.pages.dev/guide/android-marshalling
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- package file inventory ---'
find packages/ns-wasm-chicory packages/ns-wasm-edge -maxdepth 5 -type f -print | sort
printf '%s\n' '--- all Android adapter memorySize implementations ---'
rg -n -C 3 'memorySize\(\): number' packages -g '*-android.ts'
printf '%s\n' '--- error-contract patterns around runtime access ---'
rg -n -C 3 'runtime\.[A-Za-z0-9_]+\(' \
packages/ns-wasm-chicory/src/lib/chicory-android.ts \
packages/ns-wasm-edge/src/lib/wasmedge-android.tsRepository: listepo/cross-code
Length of output: 10196
🌐 Web query:
site:github.com/listepo/cross-code NSCChicoryRuntime memorySize NSCWasmEdgeRuntime
💡 Result:
I couldn’t find an indexed result for that exact query in listepo/cross-code. GitHub’s code search may require authentication for repository contents. The closest result confirms WasmEdge is a WebAssembly runtime, but not the requested symbols. (github.com)
Citations:
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- repository metadata for submodules and ignored native sources ---'
git submodule status 2>/dev/null || true
git ls-files | rg '(^|/)(platforms|android|native|chicory|wasmedge)' | head -250
printf '%s\n' '--- adapter error classes and native-call tests ---'
rg -n -C 4 'class (ChicoryError|WasmEdgeError)|toThrow|NSCChicoryException|NSCWasmEdgeException' \
packages/ns-wasm-chicory packages/ns-wasm-edge -g '*.ts' -g '*.tsx'Repository: listepo/cross-code
Length of output: 29701
Translate native errors in memorySize().
If this.runtime.memorySize() throws, both adapters expose the raw native error. Wrap each call with rethrow(error, 'memorySize'). Number() is sufficient for the declared numeric return.
📍 Affects 2 files
packages/ns-wasm-chicory/src/lib/chicory-android.ts#L56-L56(this comment)packages/ns-wasm-edge/src/lib/wasmedge-android.ts#L85-L85
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/ns-wasm-chicory/src/lib/chicory-android.ts` at line 56, Update
memorySize() in packages/ns-wasm-chicory/src/lib/chicory-android.ts:56-56 and
packages/ns-wasm-edge/src/lib/wasmedge-android.ts:85-85 to catch errors from
this.runtime.memorySize() and rethrow them through rethrow(error, 'memorySize');
retain Number() for the numeric return value.
Source: Coding guidelines
| export class ChicoryRuntime extends WasmRuntime { | ||
| constructor(options?: ChicoryRuntimeOptions) { super(createAdapter(options?.stackSizeInBytes ?? 64 * 1024), { moduleCtor: ChicoryModule, functionCtor: ChicoryFunction }); } | ||
| static version(): string { return chicoryVersionNative(); } | ||
| override loadModule(source: ChicoryModuleSource, imports?: ChicoryImports): ChicoryModule { return super.loadModule(source, imports) as unknown as ChicoryModule; } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Link imports for file-backed modules.
ChicoryRuntime.loadModule(path, imports) delegates to WasmRuntime.loadModule. The shared string-source branch returns before it calls module.linkImports(imports). A module loaded from a file therefore does not receive its declared host imports.
Fix packages/ns-wasm-core/src/lib/runtime.ts so both source branches construct the module and link imports before returning. Add a regression test that loads a file-backed module with imports.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/ns-wasm-chicory/src/lib/chicory.ts` at line 31, Update
WasmRuntime.loadModule in runtime.ts so both string-source and file-backed
branches construct the module, call module.linkImports(imports), and only then
return it; add a regression test covering file-backed loading with imports,
while preserving the existing ChicoryRuntime.loadModule delegation.
| if (!data) throw new WasmEdgeError('readMemory: returned null'); | ||
| return new Uint8Array(iosInterop()?.bufferFromData(data)); | ||
| } | ||
| writeMemory(offset: number, bytes: Uint8Array): void { withErrorRef('writeMemory', (err) => this.runtime.writeMemoryAtOffsetDataError(offset, bytes, ...err)); } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- candidate files ---'
git ls-files | rg '(^|/)(wasmedge-ios\.ts|.*wasmedge.*|.*WasmEdge.*|.*ios.*\.(ts|d\.ts|m|h))$' | head -200
printf '%s\n' '--- relevant symbols and calls ---'
rg -n -C 6 \
'writeMemoryAtOffsetDataError|writeMemory\(|dataWithBytesLength|NSCWasmEdgeRuntime|class .*WasmEdge|WasmEdgeRuntime' \
packages apps 2>/dev/null | head -400
printf '%s\n' '--- target file ---'
target='packages/ns-wasm-edge/src/lib/wasmedge-ios.ts'
if [ -f "$target" ]; then
cat -n "$target" | sed -n '1,150p'
else
printf 'missing: %s\n' "$target"
fi
printf '%s\n' '--- package tests/config ---'
rg -n -C 5 'writeMemory|writeMemoryAtOffset|NSData|d\.buffer|wasmedge-ios' \
packages/ns-wasm-edge 2>/dev/null | head -400Repository: listepo/cross-code
Length of output: 50374
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- WasmEdge iOS adapter ---'
cat -n packages/ns-wasm-edge/src/lib/wasmedge-ios.ts | sed -n '1,130p'
printf '%s\n' '--- WasmEdge native declaration ---'
cat -n packages/ns-wasm-edge/src/lib/native-api.d.ts | sed -n '1,35p'
printf '%s\n' '--- WasmEdge unit test ---'
cat -n packages/ns-wasm-edge/src/lib/wasmedge.spec.ts | sed -n '1,240p'
printf '%s\n' '--- exact NSData conversion patterns ---'
rg -n -C 4 'NSData\.dataWithBytesLength|writeMemoryAtOffsetDataError' \
packages/ns-wasm-edge/src/lib packages/ns-wasm-kit-runtime/src/lib \
-g '*.ts' -g '*.d.ts'
printf '%s\n' '--- repository change summary ---'
git diff --stat -- packages/ns-wasm-edgeRepository: listepo/cross-code
Length of output: 19059
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
import re
adapter = Path("packages/ns-wasm-edge/src/lib/wasmedge-ios.ts").read_text()
decl = Path("packages/ns-wasm-edge/src/lib/native-api.d.ts").read_text()
test = Path("packages/ns-wasm-edge/src/lib/wasmedge.spec.ts").read_text()
checks = {
"native write parameter is NSData": bool(re.search(
r"writeMemoryAtOffsetDataError\s*\([^)]*\bdata:\s*NSData\b", decl
)),
"adapter passes bytes directly": bool(re.search(
r"writeMemoryAtOffsetDataError\(offset,\s*bytes,", adapter
)),
"adapter already converts module bytes": bool(re.search(
r"NSData\.dataWithBytesLength\(bytes,\s*bytes\.length\)", adapter
)),
"fake accepts NSData bytes or raw buffer": bool(re.search(
r"new Uint8Array\(d\.bytes\s*\?\?\s*d\.buffer\)", test
)),
}
for label, result in checks.items():
print(f"{label}: {result}")
if not all(checks.values()):
raise SystemExit("expected source evidence was not found")
PYRepository: listepo/cross-code
Length of output: 321
Convert bytes to NSData before writing memory.
writeMemoryAtOffsetDataError requires NSData, but this call passes Uint8Array. Use NSData.dataWithBytesLength(bytes, bytes.length) before the native call. The test fake accepts d.buffer, so it does not detect this bridge mismatch.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/ns-wasm-edge/src/lib/wasmedge-ios.ts` at line 86, Update writeMemory
to convert the Uint8Array bytes argument into NSData using
NSData.dataWithBytesLength(bytes, bytes.length) before passing it to
runtime.writeMemoryAtOffsetDataError, while preserving the existing withErrorRef
handling.
| describe('WasmEdgeRuntime (iOS fake)', () => { | ||
| beforeEach(() => { installIosFake(); }); | ||
| it('reports version', () => { const r = new WasmEdgeRuntime(); expect(WasmEdgeRuntime.version()).toBe('0.1.0'); r.dispose(); }); | ||
| it('loads module from bytes', () => { const r = new WasmEdgeRuntime(); const m = r.loadModule(new Uint8Array([0, 0x61, 0x73, 0x6d, 1, 0, 0, 0])); expect(m).toBeDefined(); r.dispose(); }); | ||
| it('finds function', () => { const r = new WasmEdgeRuntime(); expect(r.findFunction('t').name).toBe('t'); r.dispose(); }); | ||
| it('reads/writes memory', () => { const r = new WasmEdgeRuntime(); r.writeMemory(0, new Uint8Array([1, 2, 3])); expect(r.readMemory(0, 3)).toEqual(new Uint8Array([1, 2, 3])); expect(r.memorySize).toBe(64 * 1024); r.dispose(); }); | ||
| it('throws when native missing', () => { delete g.NSCWasmEdgeRuntime; expect(() => new WasmEdgeRuntime()).toThrow(WasmEdgeError); }); | ||
| }); |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Add Android adapter coverage.
This suite installs only iOS bridge globals. WasmEdgeRuntime also constructs AndroidRuntime, so Android module loading, function calls, memory operations, and native errors have no package-level coverage.
Add an Android native-runtime fake suite. Run the configured V8 coverage and Nx targets. Run the test application on iOS and Android after this adapter change.
As per coding guidelines, “Maintain Vitest unit coverage for TypeScript adapters” and “When changing wire.ts or an adapter, run the test app suite on both iOS and Android.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/ns-wasm-edge/src/lib/wasmedge.spec.ts` around lines 20 - 27, Add
Android adapter coverage alongside the existing “WasmEdgeRuntime (iOS fake)”
suite by installing an Android runtime fake and testing module loading, function
lookup/calls, memory reads/writes, and missing-native error behavior through
WasmEdgeRuntime. Preserve the existing iOS tests, then run the configured V8
coverage and Nx targets plus the test application on both iOS and Android.
Source: Coding guidelines
| super(createAdapter(options?.stackSizeInBytes ?? 64 * 1024), { moduleCtor: WasmEdgeModule, functionCtor: WasmEdgeFunction }); | ||
| } | ||
| static version(): string { return wasmEdgeVersionNative(); } | ||
| override loadModule(source: WasmEdgeModuleSource, imports?: WasmEdgeImports): WasmEdgeModule { return super.loadModule(source, imports) as unknown as WasmEdgeModule; } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Link imports for file-based modules.
WasmEdgeRuntime.loadModule(path, imports) delegates to WasmRuntime.loadModule. The shared implementation returns immediately for string sources before it calls module.linkImports(imports). A file-based module with required host imports therefore loads without those imports.
Update WasmRuntime.loadModule to link imports after either loading path. Alternatively, link imports in this override when source is a string.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/ns-wasm-edge/src/lib/wasmedge.ts` at line 37, Update
WasmRuntime.loadModule so imports are linked for both string and non-string
sources after the module is loaded, or add equivalent linking in
WasmEdgeRuntime.loadModule when source is a string; ensure file-based modules
with required host imports invoke module.linkImports(imports) before returning.
| # Android support has not been scaffolded yet, so this package has no Android | ||
| # build or host-test target. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- candidate files ---'
git ls-files packages/ns-wry/AGENTS.md packages/ns-wry/README.md packages/ns-wry | sed -n '1,120p'
printf '%s\n' '--- documented sections ---'
sed -n '45,70p' packages/ns-wry/AGENTS.md
sed -n '20,55p' packages/ns-wry/README.md
printf '%s\n' '--- Android-related package files and references ---'
git ls-files packages/ns-wry | rg -i 'android|platform|native|wry|gradle|podspec|package'
rg -n -i --glob '!node_modules' --glob '!dist' --glob '!build' 'ns-wry|wry|android|host-test|platforms/android' packages/ns-wry | sed -n '1,240p'Repository: listepo/cross-code
Length of output: 43398
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- package metadata and NativeScript configuration ---'
cat -n packages/ns-wry/package.json
cat -n packages/ns-wry/nativescript.config.ts
cat -n packages/ns-wry/platforms/android/include.gradle
printf '%s\n' '--- Android adapter and native declarations ---'
cat -n packages/ns-wry/src/lib/wry.ts
cat -n packages/ns-wry/src/lib/native-api.d.ts
printf '%s\n' '--- Android app and workspace references ---'
git ls-files apps | rg -i 'ns-wry|android|gradle|host|test' | sed -n '1,160p'
rg -n -i --glob '!node_modules' --glob '!dist' --glob '!build' 'run\.android|nsc-wry\.aar|includeGradle|NativeWry|NSCWryRuntime' apps packages | sed -n '1,240p'
printf '%s\n' '--- tracked Android artifacts ---'
git ls-files packages/ns-wry | rg 'platforms/android|wry-kotlin|wry-jni' | while read -r f; do
printf '%s\n' "$f"
doneRepository: listepo/cross-code
Length of output: 16218
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- ns-wry app configuration ---'
cat -n apps/ns-wry-app/package.json
cat -n apps/ns-wry-app/project.json
cat -n apps/ns-wry-app/nativescript.config.ts
printf '%s\n' '--- ns-wry app usage and README ---'
cat -n apps/ns-wry-app/app/app.ts
cat -n apps/ns-wry-app/app/main-page.ts
cat -n apps/ns-wry-app/README.md
printf '%s\n' '--- Android artifact existence and contents ---'
python3 - <<'PY'
from pathlib import Path
root = Path("packages/ns-wry")
for rel in [
"platforms/android/include.gradle",
"platforms/android/nsc-wry.aar",
"src/vendors/wry-kotlin",
"src/vendors/wry-rust/wry-jni/src/lib.rs",
]:
p = root / rel
print(f"{rel}: exists={p.exists()} type={'dir' if p.is_dir() else 'file' if p.is_file() else 'missing'}")
if p.is_file():
print(f" size={p.stat().st_size}")
PY
printf '%s\n' '--- Android target definitions for ns-wry ---'
rg -n -i --glob '!node_modules' --glob '!dist' --glob '!build' 'ns-wry|run\.android|build\.android|test\.android|host-test|android' apps/ns-wry-app/project.json apps/ns-wry-app/package.json apps/ns-wry-app/README.md packages/ns-wry/package.jsonRepository: listepo/cross-code
Length of output: 11474
Use precise Android support terminology across both documents.
Android integration is partially scaffolded, but the package is not yet usable on Android. JNI/Kotlin sources exist, while platforms/android/nsc-wry.aar is absent and include.gradle is empty. Keep the limitation focused on unavailable package Android build and host-test targets. Replace “Android support has not been scaffolded yet” and “NativeScript integration placeholder” with wording that states Android integration is incomplete and not packaged.
📍 Affects 2 files
packages/ns-wry/AGENTS.md#L58-L59(this comment)packages/ns-wry/README.md#L32-L33packages/ns-wry/README.md#L44-L44
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/ns-wry/AGENTS.md` around lines 58 - 59, The Android limitation
wording is inaccurate across the package documentation. In
packages/ns-wry/AGENTS.md lines 58-59, replace “Android support has not been
scaffolded yet” with wording that Android integration is incomplete and not
packaged while retaining the unavailable Android build and host-test target
limitation. In packages/ns-wry/README.md lines 32-33 and 44, replace
“NativeScript integration placeholder” and related wording with the same precise
description; no other documentation changes are needed.
- .oxlintrc.json — shared oxlint config (typescript, import, unicorn
plugins; ignores generated/build/vendor dirs)
- .oxfmtrc.json — shared oxfmt config
- tools/nx-oxlint.js — Nx inference plugin that auto-adds a "lint"
target to every TypeScript project (npx oxlint --deny-warnings)
- tools/nx-oxfmt.js — Nx inference plugin that auto-adds a "format"
target to every TypeScript project (npx oxfmt)
- nx.json — registered both plugins; lint/format cache enabled
- package.json — oxlint ^0.15.0 and oxfmt ^0.15.0 as devDeps
Run: pnpm exec nx run-many -t lint (lint all TS projects)
pnpm exec nx run-many -t format (format all TS projects)
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.oxlintrc.json:
- Line 2: Update the $schema value in .oxlintrc.json to reference the local
./node_modules/oxlint/configuration_schema.json file shipped with oxlint,
replacing the invalid remote URL.
In `@tools/nx-oxfmt.js`:
- Around line 25-37: Disable caching for the source-writing format target in
tools/nx-oxfmt.js at lines 25-37 by changing its explicit cache setting to
false. Also remove the global format.cache default or set it to false in nx.json
at lines 108-112 so other source-writing format targets do not inherit unsafe
caching; no other changes are required at the sibling site.
- Around line 6-19: Update tools/nx-oxfmt.js at lines 6-19 and
tools/nx-oxlint.js at lines 6-22 to use the Nx 23 batch createNodes contract via
createNodesFromFiles. In both callbacks, treat the matching-files argument as an
array, derive each project root with dirname, and skip the workspace
package.json; remove opts?.targets checks because opts contains plugin options
rather than project configuration.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: cdda87ee-99c9-4abe-ab39-4a627b1b35e4
📒 Files selected for processing (6)
.oxfmtrc.json.oxlintrc.jsonnx.jsonpackage.jsontools/nx-oxfmt.jstools/nx-oxlint.js
| @@ -0,0 +1,31 @@ | |||
| { | |||
| "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/crates/oxc_linter/src/schema.json", | |||
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
test -f node_modules/oxlint/configuration_schema.jsonRepository: listepo/cross-code
Length of output: 156
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- tracked configuration and manifests ---'
git ls-files | rg '(^|/)(\.oxlintrc\.json|package\.json|pnpm-lock\.yaml|yarn\.lock|package-lock\.json|bun\.lockb?|oxlint)' || true
printf '%s\n' '--- .oxlintrc.json ---'
cat -n .oxlintrc.json
printf '%s\n' '--- dependency declarations ---'
for f in package.json pnpm-lock.yaml yarn.lock package-lock.json bun.lock bun.lockb; do
if test -f "$f"; then
printf '\n--- %s ---\n' "$f"
rg -n -C 3 'oxlint|configuration_schema|oxc-project/oxc' "$f" || true
fi
done
printf '%s\n' '--- configured URL headers ---'
curl -L -sS -o /tmp/oxlint-schema.json -w 'HTTP %{http_code}\n' \
'https://raw.githubusercontent.com/oxc-project/oxc/main/crates/oxc_linter/src/schema.json'
if test -s /tmp/oxlint-schema.json; then
head -c 300 /tmp/oxlint-schema.json
printf '\n'
fiRepository: listepo/cross-code
Length of output: 2156
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- locked oxlint entries ---'
rg -n -i -C 5 'oxlint|configuration_schema|oxc_linter' pnpm-lock.yaml package.json
printf '%s\n' '--- npm package metadata ---'
curl -sS -L 'https://registry.npmjs.org/oxlint' |
node -e '
let data = "";
process.stdin.on("data", c => data += c);
process.stdin.on("end", () => {
const p = JSON.parse(data);
for (const version of ["0.15.0", p["dist-tags"]?.latest]) {
if (p.versions?.[version]) {
console.log(JSON.stringify({
version,
dist: p.versions[version].dist,
files: p.versions[version].files
}, null, 2));
}
}
});
'
printf '%s\n' '--- package tarball file list ---'
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
curl -sS -L 'https://registry.npmjs.org/oxlint/-/oxlint-0.15.0.tgz' -o "$tmpdir/oxlint.tgz"
tar -tzf "$tmpdir/oxlint.tgz" | rg -i 'schema|config|package.json'Repository: listepo/cross-code
Length of output: 2486
Use the schema shipped with oxlint.
The current URL returns HTTP 404. oxlint@0.15.0 includes configuration_schema.json; set $schema to ./node_modules/oxlint/configuration_schema.json.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.oxlintrc.json at line 2, Update the $schema value in .oxlintrc.json to
reference the local ./node_modules/oxlint/configuration_schema.json file shipped
with oxlint, replacing the invalid remote URL.
| format: { | ||
| executor: 'nx:run-commands', | ||
| options: { | ||
| command: `npx oxfmt`, | ||
| cwd: root, | ||
| }, | ||
| cache: true, | ||
| inputs: [ | ||
| '{projectRoot}/**/*.ts', | ||
| '{projectRoot}/**/*.tsx', | ||
| '{projectRoot}/**/*.js', | ||
| '{projectRoot}/**/*.mjs', | ||
| ], |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
# Inspect the changed configuration and repository metadata without executing repository code.
printf '%s\n' '--- tools/nx-oxfmt.js ---'
nl -ba tools/nx-oxfmt.js | sed -n '1,90p'
printf '%s\n' '--- nx.json ---'
nl -ba nx.json | sed -n '90,125p'
printf '%s\n' '--- formatter references ---'
rg -n --glob '!node_modules' --glob '!dist' --glob '!build' 'oxfmt|format' package.json nx.json tools .github 2>/dev/null | head -200
printf '%s\n' '--- package metadata ---'
rg -n --glob 'package.json' '"(oxfmt|nx|packageManager)"' . | head -100Repository: listepo/cross-code
Length of output: 7364
🏁 Script executed:
printf '%s\n' '--- tools/nx-oxfmt.js ---'
sed -n '1,90p' tools/nx-oxfmt.js
printf '%s\n' '--- nx.json ---'
sed -n '90,125p' nx.json
printf '%s\n' '--- root package.json ---'
sed -n '1,70p' package.json
printf '%s\n' '--- Oxfmt configuration files ---'
find . -maxdepth 3 -type f \( -name '.oxfmtrc*' -o -name 'oxfmt.config.*' \) -print
printf '%s\n' '--- format target declarations ---'
rg -n --glob '!node_modules' --glob '!dist' --glob '!build' '"format"\s*:|format:' --glob 'project.json' --glob 'package.json' --glob 'nx.json' --glob '*.js' --glob '*.mjs' --glob '*.ts' .Repository: listepo/cross-code
Length of output: 3212
🌐 Web query:
Oxfmt CLI 0.15 default writes files supported extensions .oxfmtrc.json
💡 Result:
Yes, the Oxfmt CLI supports.oxfmtrc.json as a configuration file [1][2]. It is one of the standard configuration files automatically discovered by the tool [1][2]. When you run the Oxfmt CLI, it automatically searches for the nearest configuration file by looking in the directory of the file being formatted and walking up the directory tree [1][2]. Supported configuration files include: -.oxfmtrc.json [1][2] -.oxfmtrc.jsonc [1][2] - oxfmt.config.ts [1][2] - oxfmt.config.mts [1][2] You can initialize a default.oxfmtrc.json file in your project by running the following command [3]: oxfmt --init [4][3] Additionally, you can use the --config (or -c) flag to explicitly specify a configuration file path, which also supports.json,.jsonc,.ts,.mts,.cts,.js,.mjs, and.cjs formats [1][4].
Citations:
- 1: https://oxc.rs/docs/guide/usage/formatter/config.html
- 2: https://www.oxcjs.com/guide/usage/formatter/config.html
- 3: https://www.oxcjs.com/guide/usage/formatter/quickstart.html
- 4: https://oxc.rs/docs/guide/usage/formatter/cli.html
🌐 Web query:
Nx cached run-commands target outputs no outputs cache behavior source-writing command inputs
💡 Result:
In Nx, the run-commands executor follows the standard Nx task caching model, where caching is opt-in and relies on hashing inputs to determine if a task result can be reused [1][2]. Caching Mechanism and Inputs Nx calculates a unique hash for a task based on its defined inputs [1][2]. If the calculated hash matches a previous run, Nx skips execution and replays the cached terminal output and restores the specified output files [1][3]. If no inputs are explicitly defined, Nx defaults to including all files within the project root [1][4]. Important Considerations for Run-Commands 1. Self-Referential Inputs: A common pitfall occurs when a command generates an output file (e.g., hello.txt) within the project directory without excluding it from inputs [5]. If the output file is part of the project files, it is included in the hash calculation [5]. On the first run, the file does not exist (Hash A); on the second run, the file exists, changing the input hash (Hash B); only on the third run, when the content of the generated file matches the previous run's output, does the hash stabilize (Hash B), resulting in a cache hit [5]. To avoid this, explicitly define inputs to exclude generated output files [5]. 2. Defining Inputs: You can manage cache behavior by defining inputs in your project.json or nx.json [4][2]. Inputs can include file sets, environment variables, and runtime commands [6]. Excluding unnecessary files or adding specific dependencies ensures cache stability [4][6]. 3. Outputs Configuration: Use the outputs array to specify the files or directories Nx should cache [3]. If not configured, Nx may attempt to fall back to an executor's outputPath if applicable, but explicit configuration is recommended for reliability [1][3]. 4. Non-Cacheable Commands: If a command should never be cached (e.g., a command that always changes), set "cache": false in the target configuration [2][7]. Note that the Nx daemon may cache the results of runtime inputs locally, which can affect expected behavior in some environments [7]. To ensure consistent caching, always explicitly define both inputs (to capture dependencies and exclude outputs) and outputs (to capture the task's results) [1][4][3].
Citations:
- 1: https://nx.dev/docs/concepts/how-caching-works
- 2: https://nx.dev/docs/getting-started/tutorials/caching
- 3: https://nx.dev/docs/guides/tasks--caching/configure-outputs
- 4: https://nx.dev/docs/guides/tasks--caching/configure-inputs
- 5: run-commands workspace task caching does not function correctly. nrwl/nx#26749
- 6: https://nx.dev/docs/reference/inputs
- 7: nx:run-commands runtime input is broken nrwl/nx#18432
🏁 Script executed:
printf '%s\n' '--- .oxfmtrc.json ---'
cat .oxfmtrc.json
printf '%s\n' '--- package and workspace configuration files ---'
find . -maxdepth 3 -type f \( -name 'package.json' -o -name 'project.json' -o -name '.oxfmtrc*' -o -name 'oxfmt.config.*' \) -print | sort
printf '%s\n' '--- tracked source/config extensions ---'
git ls-files | awk '
/\// { n=$0; sub(/^.*\//,"",n) }
/\.[^.\/]+$/ {
ext=$0; sub(/^.*\./,"",ext);
count[ext]++
}
END { for (e in count) print e, count[e] }
' | sortRepository: listepo/cross-code
Length of output: 1626
🌐 Web query:
Oxfmt 0.15 CLI supported file extensions default format JSON JSONC CSS HTML Vue Markdown
💡 Result:
As of version 0.15, the Oxfmt CLI supports a wide range of file types, including the formats requested: JSON, JSONC, CSS, HTML, Vue, and Markdown [1][2]. Oxfmt's formatting strategy for these files is split into two categories: 1. Native Formats: These are formatted directly by Oxfmt's Rust engine, providing maximum performance [1]. - JSON/JSONC: Supported natively [1]. - CSS: Supported natively [1]. 2. Prettier-backed Formats: For languages not yet reimplemented natively, Oxfmt delegates formatting to a bundled version of Prettier that is included within the oxfmt npm package [1]. - HTML: Delegated to the bundled Prettier [1]. - Vue: Delegated to the bundled Prettier [1]. - Markdown: Delegated to the bundled Prettier [1]. Please note that for delegated formats, the functionality is available when using the oxfmt npm package (which includes the Prettier dependency), but it is not available in the standalone binary distributed via GitHub Releases [1]. Formatting for all these types works out-of-the-box without requiring separate configuration, although custom settings can be managed via configuration files such as.oxfmtrc.json or oxfmt.config.ts [3][4].
Citations:
- 1: https://oxc.rs/docs/guide/usage/formatter/language-support.html
- 2: https://push.chocolatey.org/packages/oxfmt/0.15.0
- 3: https://oxc.rs/docs/guide/usage/formatter/config.html
- 4: https://www.npmjs.com/package/oxfmt
🌐 Web query:
Nx task caching no outputs source files run-commands cache hit restores outputs
💡 Result:
In Nx, task caching is a deterministic mechanism based on the computation hash of a task's inputs [1]. When a task is marked as cacheable, Nx calculates this hash by looking at all configured task inputs (such as source files and command-line arguments) [1][2]. Regarding the behavior of cache hits and output restoration: 1. How Cache Hits Work: When a task is run, Nx compares the current task's hash against previous executions [1][2]. If the hash matches an existing cache entry, Nx identifies a cache hit [1]. On a hit, Nx skips the actual execution of the command [2], prints the cached terminal output, and restores the files specified in the task's outputs configuration [1][3]. 2. The Importance of outputs: Nx only restores files that are explicitly defined in the outputs array (or inferred by an Nx plugin) [4][1][3]. If a task writes files to locations outside of these defined outputs, those files will not be captured in the cache and will not be restored during a cache hit [5]. This can lead to missing files or broken builds if subsequent tasks rely on those un-captured outputs [5]. 3. Common Pitfalls with run-commands: - Undefined Outputs: If outputs are not configured for a custom command, Nx may not know which files to restore [1][3]. While Nx has some backward-compatible fallbacks for common build directories (like dist), it is best practice to define them explicitly [1][3]. - Self-Referential Inputs: A common issue occurs when a command modifies a file that is also included in the project's default inputs [6]. If the command writes to a file in the project root, and that file is part of the inputs, the hash will change on every run, preventing a cache hit until the state stabilizes [6]. - Sandboxing: Enabling Nx sandboxing helps detect these issues by verifying that a task only reads from declared inputs and writes to declared outputs [5]. If a task writes to an undeclared location, it is a sandbox violation [5]. 4. Troubleshooting Restoration: If you experience a cache hit (terminal output is replayed) but the files are not restored, ensure the path is correctly defined in the outputs array [3][5]. Note that there have been reported edge cases, such as interactions with the Nx Daemon, where files might not be copied correctly despite a reported cache hit [7]; disabling the daemon can sometimes help verify if the issue is environmental [7]. In summary, Nx does not automatically "know" which files a command produces [4][3]. You must ensure that the outputs configuration accurately reflects all files generated by the command to guarantee they are correctly captured and restored upon a cache hit [4][5].
Citations:
- 1: https://nx.dev/docs/concepts/how-caching-works
- 2: https://nx.dev/docs/getting-started/tutorials/caching
- 3: https://nx.dev/docs/features/cache-task-results
- 4: https://nx.dev/docs/guides/tasks--caching/configure-outputs
- 5: https://nx.dev/docs/features/ci-features/sandboxing
- 6: run-commands workspace task caching does not function correctly. nrwl/nx#26749
- 7: Cache outputs are not restored on local cache hit nrwl/nx#32620
🏁 Script executed:
python3 - <<'PY'
import json
import subprocess
from pathlib import Path
tracked = subprocess.check_output(["git", "ls-files"], text=True).splitlines()
roots = sorted({
str(Path(p).parent)
for p in tracked
if p.endswith("/package.json") and str(Path(p).parent) != "."
})
hashed = {".ts", ".tsx", ".js", ".mjs"}
supported = {".ts", ".tsx", ".js", ".mjs", ".json", ".jsonc", ".css", ".html", ".vue", ".md", ".markdown"}
print("project roots:")
for root in roots:
print(root)
print("\ntracked files under project roots with supported extensions omitted by inputs:")
for name in tracked:
path = Path(name)
if any(str(path).startswith(root + "/") for root in roots):
ext = path.suffix.lower()
if ext in supported and ext not in hashed:
print(name)
print("\nroot formatter configuration:")
config = Path(".oxfmtrc.json")
print(f"{config}: exists={config.exists()}")
if config.exists():
json.loads(config.read_text())
print("valid JSON")
PYRepository: listepo/cross-code
Length of output: 7129
Do not cache the source-writing format target.
npx oxfmt writes files in place. On a cache hit, Nx skips the command and restores no outputs because this target declares none. Set this target to cache: false. If the target must be cached, use oxfmt --check and include every formatted file type plus .oxfmtrc.json in inputs; the current patterns omit tracked JSON, CSS, Markdown, and configuration files.
Remove the global format.cache default or set it to false so other source-writing format targets do not inherit unsafe caching. This does not replace disabling the explicit cache: true above.
📍 Affects 2 files
tools/nx-oxfmt.js#L25-L37(this comment)nx.json#L108-L112
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tools/nx-oxfmt.js` around lines 25 - 37, Disable caching for the
source-writing format target in tools/nx-oxfmt.js at lines 25-37 by changing its
explicit cache setting to false. Also remove the global format.cache default or
set it to false in nx.json at lines 108-112 so other source-writing format
targets do not inherit unsafe caching; no other changes are required at the
sibling site.
build-xcframework.sh: - lipo the arm64 + x86_64 simulator builds into ONE universal slice (ios-arm64_x86_64-simulator) — Xcode rejects two separate simulator libraries as "equivalent library definitions" - dSYMs generated per-slice from the unstripped binaries; relocated yml binary-path strings are cosmetic (UUIDs verified to match) - rebuild all three xcframeworks (wasm3, wamr, wry) with the new layout Test app: - new tests/runtime-support.ts — per-engine platform matrix (WasmKit iOS-only; Endive/Chicory Android-only; WasmEdge both) + describeRuntime() gate that skips wrong-platform suites and not-yet-native engines, while wasm3/WAMR still fail loudly - wasmkit/endive/chicory/wasmedge fixture specs route through describeRuntime(); AGENTS.md documents the pattern Other: - nx-oxlint.js / nx-oxfmt.js refactored to createNodesForFile helper - ns-wasm-core package.json publishes dist/ (CI builds before install)
README: header now mentions four WASM runtime plugins; new rows in the packages table for ns-wasm-core and ns-wasm-kit-runtime; WebAssembly plugins section covers all three runtimes; new Linting section (Kotlin: Detekt + Ktlint, Swift: SwiftLint + Periphery); per-package docs updated.
AGENTS: ns-wasm-core added as shared foundation package; ns-wasm-kit-runtime added as WasmKit Swift interpreter plugin; "Both plugins" references updated to "the WASM runtime plugins"; per-package guidance table includes the two new packages.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation