fix(voice): replace __dirname with import.meta.dirname for ESM compat

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson 2026-03-15 19:35:07 -06:00
parent 15462a7da7
commit 40dd80a41e
2 changed files with 4 additions and 6 deletions

View file

@ -7,9 +7,10 @@ import * as fs from "node:fs";
import * as path from "node:path";
import * as readline from "node:readline";
const SWIFT_SRC = path.join(__dirname, "speech-recognizer.swift");
const RECOGNIZER_BIN = path.join(__dirname, "speech-recognizer");
const PYTHON_SCRIPT = path.join(__dirname, "speech-recognizer.py");
const __extensionDir = import.meta.dirname!;
const SWIFT_SRC = path.join(__extensionDir, "speech-recognizer.swift");
const RECOGNIZER_BIN = path.join(__extensionDir, "speech-recognizer");
const PYTHON_SCRIPT = path.join(__extensionDir, "speech-recognizer.py");
const IS_DARWIN = process.platform === "darwin";
const IS_LINUX = process.platform === "linux";

View file

@ -26,9 +26,6 @@ const SKIP_EXTENSIONS = new Set([
// rewrites .js→.ts imports and fails because core.ts doesn't exist.
// Works fine at runtime via jiti which loads core.js directly.
"browser-tools",
// Uses __dirname at module scope — valid in CJS/jiti but crashes in ESM test runner.
// TODO: fix voice/index.ts to use import.meta.dirname or fileURLToPath(import.meta.url)
"voice",
]);
test("all bundled extensions can be imported without throwing", async () => {