@hediet/dbgjs 0.1.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.
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # dbgjs
2
+
3
+ Native JavaScript debugger CLI and TUI, distributed through npm. Requires Node.js
4
+ 22 or newer. No Rust compiler or install-time build is needed.
5
+
6
+ Previously named `@hediet/jsdbg`. Commands now use `dbgjs`, environment variables
7
+ use `DBGJS_*`, and the daemon uses a fresh `dbgjs` state location. Existing
8
+ prototype state is left untouched. On Windows the new endpoint is
9
+ `%LOCALAPPDATA%\hediet\dbgjs\service.json`; `DBGJS_SERVICE_STATE` overrides it.
10
+
11
+ ## Install a CI build
12
+
13
+ Download and extract the `npm-<platform>` artifact from the CI run. It contains
14
+ two tarballs: the entry package and its matching native package. Install both
15
+ in the same command, for example on Windows x64:
16
+
17
+ ```sh
18
+ npm install -g ./hediet-dbgjs-win32-x64-0.1.0.tgz ./hediet-dbgjs-0.1.0.tgz
19
+ dbgjs --help
20
+ ```
21
+
22
+ For a project-local installation omit `-g` and use `npx --no-install dbgjs`.
23
+ These packages are not yet published to an npm registry; installing only the
24
+ entry tarball will not supply an unpublished native dependency.
25
+
26
+ Supported platforms: Windows x64, macOS x64/ARM64, Linux GNU x64/ARM64.
27
+ Linux requires glibc 2.35 or newer and OpenSSL 3. Musl/Alpine and Windows ARM64
28
+ are not supported. Platform dependencies must not be omitted.
29
+
30
+ The package supplies Playwright's JavaScript library, but does not install a
31
+ browser. Browser debugging requires a separately installed browser. `DBGJS_NODE`
32
+ and `DBGJS_PLAYWRIGHT_PACKAGE` can override the runtime and Playwright module.
33
+
34
+ Each native package keeps `dbgjs`, `dbgjs-service`, and `dbgjs-tui` together.
35
+ Use `dbgjs service stop` for the appropriate service instance before replacing
36
+ an installed package on Windows; running executables cannot be overwritten.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { launch } from "../lib/launch.mjs";
3
+ launch("dbgjs-tui");
package/bin/dbgjs.mjs ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { launch } from "../lib/launch.mjs";
3
+ launch("dbgjs");
package/lib/launch.mjs ADDED
@@ -0,0 +1,43 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { createRequire } from "node:module";
3
+ import { dirname, join } from "node:path";
4
+ import { platformKey } from "./platform.mjs";
5
+
6
+ const require = createRequire(import.meta.url);
7
+
8
+ export function launch(binary) {
9
+ try {
10
+ const key = platformKey(
11
+ process.platform,
12
+ process.arch,
13
+ process.platform === "linux" ? process.report.getReport().header.glibcVersionRuntime : undefined,
14
+ );
15
+ const packageName = `@hediet/dbgjs-${key}`;
16
+ let manifest;
17
+ try {
18
+ manifest = require.resolve(`${packageName}/package.json`);
19
+ } catch (error) {
20
+ if (error.code !== "MODULE_NOT_FOUND") throw error;
21
+ throw new Error(`Missing ${packageName}. Reinstall @hediet/dbgjs with optional dependencies enabled. For unpublished builds, install the matching platform .tgz alongside the entry-package .tgz.`, { cause: error });
22
+ }
23
+ const entryVersion = require("../package.json").version;
24
+ if (require(manifest).version !== entryVersion) {
25
+ throw new Error(`${packageName} must match @hediet/dbgjs version ${entryVersion}. Reinstall both packages together.`);
26
+ }
27
+ const executable = join(dirname(manifest), "bin", `${binary}${process.platform === "win32" ? ".exe" : ""}`);
28
+ const result = spawnSync(executable, process.argv.slice(2), {
29
+ stdio: "inherit",
30
+ env: {
31
+ ...process.env,
32
+ DBGJS_NODE: process.env.DBGJS_NODE ?? process.execPath,
33
+ DBGJS_PLAYWRIGHT_PACKAGE: process.env.DBGJS_PLAYWRIGHT_PACKAGE ?? join(dirname(require.resolve("playwright/package.json")), "index.mjs"),
34
+ },
35
+ });
36
+ if (result.error) throw result.error;
37
+ if (result.signal) process.kill(process.pid, result.signal);
38
+ process.exit(result.status ?? 1);
39
+ } catch (error) {
40
+ console.error(`dbgjs: ${error.message}`);
41
+ process.exitCode = 1;
42
+ }
43
+ }
@@ -0,0 +1,15 @@
1
+ export const platforms = {
2
+ "win32-x64": { os: "win32", cpu: "x64" },
3
+ "darwin-x64": { os: "darwin", cpu: "x64" },
4
+ "darwin-arm64": { os: "darwin", cpu: "arm64" },
5
+ "linux-x64-gnu": { os: "linux", cpu: "x64", libc: "glibc" },
6
+ "linux-arm64-gnu": { os: "linux", cpu: "arm64", libc: "glibc" },
7
+ };
8
+
9
+ export function platformKey(os, arch, glibc) {
10
+ const key = `${os}-${arch}${os === "linux" ? "-gnu" : ""}`;
11
+ if (!platforms[key] || (os === "linux" && !glibc)) {
12
+ throw new Error(`Unsupported dbgjs platform: ${os}/${arch}${os === "linux" && !glibc ? " (musl)" : ""}. Supported: ${Object.keys(platforms).join(", ")}.`);
13
+ }
14
+ return key;
15
+ }
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@hediet/dbgjs",
3
+ "version": "0.1.0",
4
+ "description": "Native JavaScript debugger CLI",
5
+ "type": "module",
6
+ "license": "UNLICENSED",
7
+ "engines": { "node": ">=22" },
8
+ "bin": {
9
+ "dbgjs": "bin/dbgjs.mjs",
10
+ "dbgjs-tui": "bin/dbgjs-tui.mjs"
11
+ },
12
+ "files": ["bin", "lib", "README.md"],
13
+ "dependencies": { "playwright": "1.62.1" },
14
+ "optionalDependencies": {
15
+ "@hediet/dbgjs-win32-x64": "0.1.0",
16
+ "@hediet/dbgjs-darwin-x64": "0.1.0",
17
+ "@hediet/dbgjs-darwin-arm64": "0.1.0",
18
+ "@hediet/dbgjs-linux-x64-gnu": "0.1.0",
19
+ "@hediet/dbgjs-linux-arm64-gnu": "0.1.0"
20
+ }
21
+ }