diff --git a/package-lock.json b/package-lock.json index 346c245..b903cba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dvalincode", - "version": "0.14.1", + "version": "0.15.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dvalincode", - "version": "0.14.1", + "version": "0.15.0", "license": "MIT", "dependencies": { "chalk": "^6.0.0", @@ -23,6 +23,7 @@ "dvalincode": "dist/index.js" }, "devDependencies": { + "@types/bun": "^1.3.14", "@types/cors": "^2.8.17", "@types/express": "^5.0.3", "@types/node": "^26.1.0", @@ -1691,6 +1692,16 @@ "@types/node": "*" } }, + "node_modules/@types/bun": { + "version": "1.3.14", + "resolved": "https://registry.npmjs.org/@types/bun/-/bun-1.3.14.tgz", + "integrity": "sha512-h1hFqFVcvAvD9j9K7ZW7vd82aSA+rTdznZa+5bwvCwqSB1jmmfLcbIWhOLx1/+boy/xmjgCs/OMUL8hRJSmnPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "bun-types": "1.3.14" + } + }, "node_modules/@types/chai": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", @@ -2741,6 +2752,16 @@ "node": ">=8" } }, + "node_modules/bun-types": { + "version": "1.3.14", + "resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.3.14.tgz", + "integrity": "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", diff --git a/package.json b/package.json index e93001c..e0bcfc4 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "test": "vitest run", "test:e2e": "playwright test", "typecheck": "tsc -p tsconfig.json --noEmit", - "check": "npm run typecheck && npm test", + "check": "npm run typecheck && npm run typecheck:gui && npm test", "prepublishOnly": "npm run build && npm run check", "build:release": "bash scripts/build-release.sh", "build:release:darwin": "bash scripts/build-release.sh darwin", @@ -41,7 +41,8 @@ "gui:dev": "bun src/gui/index.ts", "build:gui": "bash scripts/build-gui.sh", "build:gui:darwin": "bash scripts/build-gui.sh darwin", - "notices:update": "node scripts/generate-third-party-notices.mjs" + "notices:update": "node scripts/generate-third-party-notices.mjs", + "typecheck:gui": "tsc -p tsconfig.gui.json" }, "keywords": [ "cli", @@ -65,6 +66,7 @@ "zod": "^4.1.13" }, "devDependencies": { + "@types/bun": "^1.3.14", "@types/cors": "^2.8.17", "@types/express": "^5.0.3", "@types/node": "^26.1.0", diff --git a/src/gui/index.ts b/src/gui/index.ts index dcf9a8f..e9fdfc3 100644 --- a/src/gui/index.ts +++ b/src/gui/index.ts @@ -39,7 +39,9 @@ if (process.env.DVALINCODE_GUI_ROLE === 'server') { // The server prints "…http://localhost:" once it's listening. Keep // draining stdout afterwards so the child never blocks on a full pipe. - let resolveUrl: (url: string) => void; + // Definite assignment: a Promise executor runs synchronously, so this is set + // before the reader below can reach it — TypeScript cannot see that. + let resolveUrl!: (url: string) => void; const urlPromise = new Promise((resolve) => (resolveUrl = resolve)); (async () => { const decoder = new TextDecoder(); diff --git a/tsconfig.gui.json b/tsconfig.gui.json new file mode 100644 index 0000000..06cb12b --- /dev/null +++ b/tsconfig.gui.json @@ -0,0 +1,21 @@ +{ + // src/gui runs under Bun, not Node, so it cannot join the main tsconfig: it + // uses `Bun`, `import.meta.path`, and webview-bun's FFI types. It was simply + // excluded, which left it unchecked while it imports from src/core — a + // signature change there would only surface during a GUI release. + // + // `exclude` must be restated. It is inherited from the base config, and an + // inherited exclude wins over the include below, which silently turns this + // whole check into a no-op. + "extends": "./tsconfig.json", + "compilerOptions": { + // Bun resolves like a bundler, not like Node. nodenext makes TypeScript + // reject webview-bun's own extensionless relative imports. + "module": "esnext", + "moduleResolution": "bundler", + "types": ["bun"], + "noEmit": true + }, + "include": ["src/gui/**/*.ts", "src/core/**/*.ts", "src/version.ts"], + "exclude": ["dist", "node_modules"] +}