@tracepanel/agent 0.0.0-stage → 0.0.1-alpha.2

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.
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { spawnSync } = require("node:child_process");
5
+ const { binaryPath } = require("../index.js");
6
+
7
+ let binary;
8
+ try {
9
+ binary = binaryPath();
10
+ } catch (error) {
11
+ console.error(error.message);
12
+ process.exit(1);
13
+ }
14
+ const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
15
+ if (result.error) {
16
+ console.error(`tracepanel-agent: ${result.error.message}`);
17
+ process.exit(1);
18
+ }
19
+ if (result.signal) process.kill(process.pid, result.signal);
20
+ process.exit(result.status ?? 1);
package/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /** The path of the tracepanel-agent binary: TRACEPANEL_AGENT_BIN, or the one npm installed for this platform. */
2
+ export function binaryPath(): string;
3
+ /** The name of the platform package npm installs for this machine, such as `@tracepanel/agent-darwin-arm64`. */
4
+ export function platformPackage(): string;
package/index.js ADDED
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ const path = require("node:path");
4
+
5
+ function libc() {
6
+ if (process.platform !== "linux") return "";
7
+ const header = process.report && process.report.getReport().header;
8
+ return header && header.glibcVersionRuntime ? "gnu" : "musl";
9
+ }
10
+
11
+ /** The platform package npm installed for this machine. */
12
+ function platformPackage() {
13
+ const { platform, arch } = process;
14
+ if (platform === "linux" && arch === "arm") return "@tracepanel/agent-linux-arm";
15
+ if (platform === "linux") return `@tracepanel/agent-linux-${arch}-${libc()}`;
16
+ return `@tracepanel/agent-${platform}-${arch}`;
17
+ }
18
+
19
+ /** The path of the tracepanel-agent binary: TRACEPANEL_AGENT_BIN, or the one npm installed. */
20
+ function binaryPath() {
21
+ if (process.env.TRACEPANEL_AGENT_BIN) return process.env.TRACEPANEL_AGENT_BIN;
22
+ const name = `tracepanel-agent${process.platform === "win32" ? ".exe" : ""}`;
23
+ const pkg = platformPackage();
24
+ try {
25
+ return require.resolve(`${pkg}/bin/${name}`);
26
+ } catch {
27
+ throw new Error(
28
+ `tracepanel-agent: ${pkg} is not installed. It may have been left out (npm --omit=optional), or there is ` +
29
+ "no build for this platform: set TRACEPANEL_AGENT_BIN to an agent built for it.",
30
+ );
31
+ }
32
+ }
33
+
34
+ module.exports = { binaryPath, platformPackage };
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
2
  "name": "@tracepanel/agent",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1-alpha.2",
4
+ "description": "The Tracepanel agent: keeps your app's traces and logs, finds N+1 queries and other issues, serves the local console",
5
+ "license": "FSL-1.1-ALv2",
6
+ "homepage": "https://github.com/tracepanel/tracepanel",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/tracepanel/tracepanel.git"
10
+ },
11
+ "main": "index.js",
12
+ "types": "index.d.ts",
13
+ "bin": {
14
+ "tracepanel-agent": "bin/tracepanel-agent.js"
15
+ },
16
+ "files": [
17
+ "index.js",
18
+ "index.d.ts",
19
+ "bin",
20
+ "README.md",
21
+ "LICENSE",
22
+ "NOTICE",
23
+ "THIRD-PARTY-NOTICES"
24
+ ],
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
28
+ "optionalDependencies": {
29
+ "@tracepanel/agent-darwin-arm64": "0.0.1-alpha.2",
30
+ "@tracepanel/agent-darwin-x64": "0.0.1-alpha.2",
31
+ "@tracepanel/agent-linux-arm": "0.0.1-alpha.2",
32
+ "@tracepanel/agent-linux-arm64-gnu": "0.0.1-alpha.2",
33
+ "@tracepanel/agent-linux-arm64-musl": "0.0.1-alpha.2",
34
+ "@tracepanel/agent-linux-ia32-gnu": "0.0.1-alpha.2",
35
+ "@tracepanel/agent-linux-ia32-musl": "0.0.1-alpha.2",
36
+ "@tracepanel/agent-linux-ppc64-gnu": "0.0.1-alpha.2",
37
+ "@tracepanel/agent-linux-riscv64-gnu": "0.0.1-alpha.2",
38
+ "@tracepanel/agent-linux-s390x-gnu": "0.0.1-alpha.2",
39
+ "@tracepanel/agent-linux-x64-gnu": "0.0.1-alpha.2",
40
+ "@tracepanel/agent-linux-x64-musl": "0.0.1-alpha.2",
41
+ "@tracepanel/agent-win32-arm64": "0.0.1-alpha.2",
42
+ "@tracepanel/agent-win32-ia32": "0.0.1-alpha.2",
43
+ "@tracepanel/agent-win32-x64": "0.0.1-alpha.2"
44
+ }
45
+ }