Lines 30-70javascript
30// knows exactly which optionalDependency npm failed to place.
32// NATIVE ENGINE (GJS) — `@gjsify/oxfmt-native`
33// ────────────────────────────────────────────
34// Under GJS the Node launcher path is a dead end: there is no Node host to
35// spawn. For oxfmt the dual-engine pick mirrors `bundler-pick.ts`'s
36// native/npm pattern exactly: `shouldUseNativeOxfmt()` prefers the
37// `@gjsify/oxfmt-native` GI bridge (Vala/Rust prebuild wrapping the full
38// pure-Rust oxfmt CLI — config resolution, ignore handling, file walking,
39// --write/--check/--list-different) when running under GJS and the prebuild
40// is loadable, and falls back to spawning the Node launcher otherwise.
41// `GJSIFY_OXFMT=native|npm` is the explicit override (native throws when the
42// prebuild isn't loadable instead of silently switching engines).
44// oxlint has NO native path yet: its JS-plugin host (the internal
45// `gjsify/register-class-order` rule wired via `.oxlintrc.json` jsPlugins)
46// lives in the Node launcher, so a native oxlint bridge could only run the
47// Rust rule subset. Lint stays Node-spawned until that trade-off is decided
48// (tracked in STATUS.md Open TODOs).
49import { existsSync, readFileSync } from 'node:fs';
50import { join, resolve } from 'node:path';
51import { spawn, spawnSync } from 'node:child_process';
52import { createRequire } from 'node:module';
HighChild Process
Package source references child process execution.
lib/utils/oxc-resolve.jsView on unpkg · L50 53import { pathToFileURL } from 'node:url';
54import { findWorkspaceRoot } from './workspace-root.js';
55import { resolveNpmPackage } from './resolve-npm-package.js';
56import { nodeBinary } from './run-node.js';
57import { isGjs } from '@gjsify/rolldown-plugin-gjsify/runtime';
59 * Map Node.js `process.platform` + `arch` (+ musl on Linux) to the
60 * napi-rs binding-package suffix oxc uses, e.g. `linux-x64-gnu`,
61 * `linux-x64-musl`, `darwin-arm64`, `win32-x64-msvc`.
63 * Mirrors biome-resolve's platform detection (same musl probe), adapted to
64 * oxc's napi-rs target naming (gnu/musl libc suffix on Linux, -msvc on
67function oxcBindingSuffix() {
68 const platform = process.platform;
69 const arch = process.arch;