From 46eb6b337fb33235cc7876099b75a9aa4914ab87 Mon Sep 17 00:00:00 2001 From: Erwann Mest Date: Tue, 24 Nov 2026 00:11:27 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20chore(deps):=20upgrade?= =?UTF-8?q?=20to=20ink=208?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 227 ++++++++++++++++++---------------------------- package.json | 6 +- 2 files changed, 89 insertions(+), 144 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7b3b927..7b454a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,9 +12,9 @@ "chalk": "5.6.2", "citty": "0.2.2", "execa": "9.6.1", - "ink": "7.1.0", + "ink": "8.0.0", "ink-spinner": "5.0.0", - "react": "19.2.7" + "react": "19.3.1" }, "bin": { "bt-switch": "dist/index.js" @@ -22,7 +22,7 @@ "devDependencies": { "@eslint/js": "10.0.1", "@types/node": "26.0.1", - "@types/react": "19.2.17", + "@types/react": "19.3.0", "eslint": "10.6.0", "eslint-config-prettier": "10.1.8", "prettier": "3.9.4", @@ -37,9 +37,9 @@ } }, "node_modules/@alcalzone/ansi-tokenize": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@alcalzone/ansi-tokenize/-/ansi-tokenize-0.3.0.tgz", - "integrity": "sha512-p+CMKJ93HFmLkjXKlXiVGlMQEuRb6H0MokBSwUsX+S6BRX8eV5naFZpQJFfJHjRZY0Hmnqy1/r6UWl3x+19zYA==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@alcalzone/ansi-tokenize/-/ansi-tokenize-0.3.2.tgz", + "integrity": "sha512-GZdcaU9RV2Gn9SAg1hcsSoQ4nIWZfutPqIvxayUYsOzfBPJioJ+aQIXnMJiGDz+35Gg2pskkPxioYnSblPELEw==", "license": "MIT", "dependencies": { "ansi-styles": "^6.2.1", @@ -880,9 +880,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -900,9 +897,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -920,9 +914,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -940,9 +931,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -960,9 +948,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -980,9 +965,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1161,9 +1143,6 @@ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1178,9 +1157,6 @@ "arm" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1195,9 +1171,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1212,9 +1185,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1229,9 +1199,6 @@ "loong64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1246,9 +1213,6 @@ "loong64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1263,9 +1227,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1280,9 +1241,6 @@ "ppc64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1297,9 +1255,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1314,9 +1269,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1331,9 +1283,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1348,9 +1297,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1365,9 +1311,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1544,9 +1487,9 @@ } }, "node_modules/@types/react": { - "version": "19.2.17", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.17.tgz", - "integrity": "sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw==", + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz", + "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==", "devOptional": true, "license": "MIT", "dependencies": { @@ -2283,13 +2226,15 @@ "license": "MIT" }, "node_modules/es-toolkit": { - "version": "1.49.0", - "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.49.0.tgz", - "integrity": "sha512-G5iZ6Pc/FNRY/soKZHC+TxGDD83rHUDXxzaWhGCX44vAv/tMs56WMusnm/KMNK+luUPsgA9U28cGr4RDlSzL2g==", + "version": "1.53.2", + "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.53.2.tgz", + "integrity": "sha512-iUqZ+NlwH4jUgRmXZUxFBsV/9762TQEa1O4IXLFBmDEjVHScBytKuseX23I0+v9ShZ5MYxEx6WKNzm6IPnex8g==", "license": "MIT", "workspaces": [ "docs", - "benchmarks" + "benchmarks", + "tests/types", + "tests/browser-compat" ] }, "node_modules/esbuild": { @@ -2788,43 +2733,41 @@ } }, "node_modules/ink": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/ink/-/ink-7.1.0.tgz", - "integrity": "sha512-VWE6/yeLtFCJBNLflyI2OSylyXK1Rc24LuXup8Qt+icwkmmycFNdbn8IkSp6Frc0h1iA0NOvvi1ajW44U/w3Qg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/ink/-/ink-8.0.0.tgz", + "integrity": "sha512-M2aFwZOqmkFxCwedy6xrP4E+DGoK57iahAFnfTqNyOyJ54O7DZzu027z/NI8EGy44Sw9O9BcbTF4QEUS2GHAtg==", "license": "MIT", "dependencies": { - "@alcalzone/ansi-tokenize": "^0.3.0", + "@alcalzone/ansi-tokenize": "^0.3.1", "ansi-escapes": "^7.3.0", - "ansi-styles": "^6.2.3", + "ansi-styles": "^7.0.0", "auto-bind": "^5.0.1", - "chalk": "^5.6.2", + "chalk": "^6.0.1", "cli-boxes": "^4.0.1", "cli-cursor": "^4.0.0", "cli-truncate": "^6.0.0", "code-excerpt": "^4.0.0", - "es-toolkit": "^1.45.1", + "es-toolkit": "^1.52.0", "indent-string": "^5.0.0", "is-in-ci": "^2.0.0", "patch-console": "^2.0.0", - "react-reconciler": "^0.33.0", - "scheduler": "^0.27.0", + "quick-lru": "^7.3.0", + "react-reconciler": "^0.34.0", "signal-exit": "^3.0.7", - "slice-ansi": "^9.0.0", "stack-utils": "^2.0.6", - "string-width": "^8.2.0", + "string-width": "^8.3.0", "terminal-size": "^4.0.1", - "type-fest": "^5.5.0", + "type-fest": "^5.10.0", "widest-line": "^6.0.0", - "wrap-ansi": "^10.0.0", - "ws": "^8.20.0", + "wrap-ansi": "^10.0.2", "yoga-layout": "~3.2.1" }, "engines": { "node": ">=22" }, "peerDependencies": { - "@types/react": ">=19.2.0", - "react": ">=19.2.0", + "@types/react": ">=19.3.0", + "react": ">=19.3.0", "react-devtools-core": ">=6.1.2" }, "peerDependenciesMeta": { @@ -2852,6 +2795,30 @@ "react": ">=18.0.0" } }, + "node_modules/ink/node_modules/ansi-styles": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-7.0.0.tgz", + "integrity": "sha512-kKvt3m4uwzqL0wlkPd09CmljPJGOZZ4D0fP65sqFSvPkMRKhNi+74MgIJ5QxE6SxqB4t4KyUFGg8+n5zjo6hew==", + "license": "MIT", + "engines": { + "node": ">=22" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/ink/node_modules/chalk": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-6.0.1.tgz", + "integrity": "sha512-/Ce6KNm3vIbWdMlNna6RVIZ/ICQxnJxCicet5LBKK9ZffBkqzDw0xh9EiKSljdRtiIQ1S1z4YgcscUUGzNCWrA==", + "license": "MIT", + "engines": { + "node": ">=22" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/ink/node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -3151,9 +3118,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -3175,9 +3139,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -3199,9 +3160,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -3223,9 +3181,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -3749,28 +3704,40 @@ "node": ">=6" } }, + "node_modules/quick-lru": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-7.3.0.tgz", + "integrity": "sha512-k9lSsjl36EJdK7I06v7APZCbyGT2vMTsYSRX1Q2nbYmnkBqgUhRkAuzH08Ciotteu/PLJmIF2+tti7o3C/ts2g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/react": { - "version": "19.2.7", - "resolved": "https://registry.npmjs.org/react/-/react-19.2.7.tgz", - "integrity": "sha512-HNe9WslTbXmFK8o8cmwgAeJFSBvt1bPdHCVKtaaV+WlAN36mpT4hcRpwbf3fY56ar2oIXzsBpOAiIRHAdY0OlQ==", + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz", + "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==", "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/react-reconciler": { - "version": "0.33.0", - "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.33.0.tgz", - "integrity": "sha512-KetWRytFv1epdpJc3J4G75I4WrplZE5jOL7Yq0p34+OVOKF4Se7WrdIdVC45XsSSmUTlht2FM/fM1FZb1mfQeA==", + "version": "0.34.0", + "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.34.0.tgz", + "integrity": "sha512-eVibvB1fc9j5Qf1KRkiM3GzRPBdjg2P6G6QV2f3P6Eb3OGMxRBhdg2rrUwjbV5JrQaJj8nOa8uajmmJA5tJWjQ==", "license": "MIT", "dependencies": { - "scheduler": "^0.27.0" + "scheduler": "^0.28.0" }, "engines": { "node": ">=0.10.0" }, "peerDependencies": { - "react": "^19.2.0" + "react": "^19.3.0" } }, "node_modules/readdirp": { @@ -3899,9 +3866,9 @@ } }, "node_modules/scheduler": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", - "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz", + "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==", "license": "MIT" }, "node_modules/semver": { @@ -4020,9 +3987,9 @@ "license": "MIT" }, "node_modules/string-width": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.2.1.tgz", - "integrity": "sha512-IIaP0g3iy9Cyy18w3M9YcaDudujEAVHKt3a3QJg1+sr/oX96TbaGUubG0hJyCjCBThFH+tFpcIyoUHUn1ogaLA==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.3.0.tgz", + "integrity": "sha512-ZbmZM0JCihQN91dWnxoipT2KOEyHqEyfRXUyjuRhW8b/xnqPDoq4gWEVApTVa9db2wN8mmoikgFBbjh71+cGeQ==", "license": "MIT", "dependencies": { "get-east-asian-width": "^1.5.0", @@ -4297,9 +4264,9 @@ } }, "node_modules/type-fest": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-5.7.0.tgz", - "integrity": "sha512-1URUxUqfHFM1c+zfSPsa3gnkO7Aq21qyH75SIduNYz4SzY964rn1X2vCMQaHSHhktiw+0kPa2iyb6PUpXqB6Vg==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-5.10.0.tgz", + "integrity": "sha512-NoSdpq/WEiAg5sjmBkmV/hfxv6HJH4NqPNrqjtSO5CwRmpsDfaf4begxW34KdJykH/l1yHtwBWQkCRdoXO8mPA==", "license": "(MIT OR CC0-1.0)", "dependencies": { "tagged-tag": "^1.0.0" @@ -4621,14 +4588,13 @@ } }, "node_modules/wrap-ansi": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-10.0.0.tgz", - "integrity": "sha512-SGcvg80f0wUy2/fXES19feHMz8E0JoXv2uNgHOu4Dgi2OrCy1lqwFYEJz1BLbDI0exjPMe/ZdzZ/YpGECBG/aQ==", + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-10.0.2.tgz", + "integrity": "sha512-6OLRNZqRntVGBm26ghZ5eZhCuWWyOkRCSn8XsOIuq5stpCE/tjLbdozd93naILZig0lmD8ANfRwnhn0DLeXGlg==", "license": "MIT", "dependencies": { "ansi-styles": "^6.2.3", - "string-width": "^8.2.0", - "strip-ansi": "^7.1.2" + "string-width": "^8.2.0" }, "engines": { "node": ">=20" @@ -4637,27 +4603,6 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/ws": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz", - "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==", - "license": "MIT", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 6733e81..755df65 100644 --- a/package.json +++ b/package.json @@ -40,14 +40,14 @@ "chalk": "5.6.2", "citty": "0.2.2", "execa": "9.6.1", - "ink": "7.1.0", + "ink": "8.0.0", "ink-spinner": "5.0.0", - "react": "19.2.7" + "react": "19.3.1" }, "devDependencies": { "@eslint/js": "10.0.1", "@types/node": "26.0.1", - "@types/react": "19.2.17", + "@types/react": "19.3.0", "eslint": "10.6.0", "eslint-config-prettier": "10.1.8", "prettier": "3.9.4", From 5740e5f4796568f84fd4f4af6ab33e91cf6c041e Mon Sep 17 00:00:00 2001 From: Erwann Mest Date: Tue, 24 Nov 2026 00:12:02 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20perf(build):=20run=20r?= =?UTF-8?q?eact=20in=20production=20mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/cli.tsx | 34 ++++++++++++++++++++++++++++++++++ src/index.tsx | 37 +++++-------------------------------- 3 files changed, 40 insertions(+), 33 deletions(-) create mode 100644 src/cli.tsx diff --git a/package.json b/package.json index 755df65..35e0ac0 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "dist" ], "scripts": { - "dev": "tsx src/index.tsx", + "dev": "tsx src/cli.tsx", "build": "tsup src/index.tsx --format esm --dts", "build:watch": "tsup src/index.tsx --format esm --dts --watch", "clean": "rm -rf dist", diff --git a/src/cli.tsx b/src/cli.tsx new file mode 100644 index 0000000..0aa276f --- /dev/null +++ b/src/cli.tsx @@ -0,0 +1,34 @@ +import { defineCommand, runMain } from "citty" +import { add } from "./commands/add.js" +import { connect } from "./commands/connect.js" +import { switchCmd } from "./commands/switch.js" +import { forget } from "./commands/forget.js" +import { list } from "./commands/list.js" + +const NAME = "bt-switch" + +const subCommands = { + add, + connect, + switch: switchCmd, + forget, + list, + ls: list, +} + +runMain( + defineCommand({ + meta: { + name: NAME, + description: + "Bluetooth device handoff CLI — switch Magic peripherals between Macs by name", + }, + subCommands, + run: ({ rawArgs }) => { + if (rawArgs.some((arg) => arg in subCommands)) return + process.stdout.write( + `Usage: ${NAME} \nRun \`${NAME} --help\` to list commands.\n`, + ) + }, + }), +) diff --git a/src/index.tsx b/src/index.tsx index 9d85cfa..dc186ef 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,35 +1,8 @@ #!/usr/bin/env node -import { defineCommand, runMain } from "citty" -import { add } from "./commands/add.js" -import { connect } from "./commands/connect.js" -import { switchCmd } from "./commands/switch.js" -import { forget } from "./commands/forget.js" -import { list } from "./commands/list.js" +// React reads NODE_ENV when first loaded, so set it before importing the app. +// An explicit NODE_ENV (e.g. development) is honoured. +process.env.NODE_ENV ??= "production" -const NAME = "bt-switch" +await import("./cli.js") -const subCommands = { - add, - connect, - switch: switchCmd, - forget, - list, - ls: list, -} - -runMain( - defineCommand({ - meta: { - name: NAME, - description: - "Bluetooth device handoff CLI — switch Magic peripherals between Macs by name", - }, - subCommands, - run: ({ rawArgs }) => { - if (rawArgs.some((arg) => arg in subCommands)) return - process.stdout.write( - `Usage: ${NAME} \nRun \`${NAME} --help\` to list commands.\n`, - ) - }, - }), -) +export {}