terminfo.dev 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/terminfo.mjs +26 -2
  2. package/package.json +1 -1
package/bin/terminfo.mjs CHANGED
@@ -1,3 +1,27 @@
1
1
  #!/usr/bin/env node
2
- // Thin wrapper — delegates to the TypeScript source via --import with type stripping
3
- import("../src/index.ts")
2
+
3
+ // Bootstrap: spawn bun if available, fall back to node with type stripping
4
+ import { execFileSync, spawnSync } from "node:child_process"
5
+ import { fileURLToPath } from "node:url"
6
+ import { dirname, join } from "node:path"
7
+
8
+ const __dirname = dirname(fileURLToPath(import.meta.url))
9
+ const entry = join(__dirname, "..", "src", "index.ts")
10
+
11
+ // Try bun first (handles .ts natively)
12
+ const bun = spawnSync("bun", [entry, ...process.argv.slice(2)], {
13
+ stdio: "inherit",
14
+ env: process.env,
15
+ })
16
+
17
+ if (bun.error?.code === "ENOENT") {
18
+ // No bun — try node with experimental flags
19
+ const node = spawnSync(
20
+ process.execPath,
21
+ ["--experimental-strip-types", "--disable-warning=ExperimentalWarning", entry, ...process.argv.slice(2)],
22
+ { stdio: "inherit", env: process.env },
23
+ )
24
+ process.exit(node.status ?? 1)
25
+ } else {
26
+ process.exit(bun.status ?? 1)
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terminfo.dev",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Test your terminal's feature support and contribute to terminfo.dev",
5
5
  "keywords": [
6
6
  "ansi",