flashtrace 0.12.1 → 0.13.1

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 CHANGED
@@ -63,10 +63,10 @@
63
63
  README is viewed on.
64
64
  -->
65
65
  <a href="https://github.com/flashtrace/flashtrace/actions/workflows/ci.yml">
66
- <img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fflashtrace%2Fflashtrace%2Fbadges%2Fcoverage.json" alt="Line coverage of src/, measured by node --test." />
66
+ <img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fflashtrace%2Fflashtrace%2Fbadges%2Fcoverage.json" alt="Line coverage of src/." />
67
67
  </a>
68
68
  <a href="https://github.com/flashtrace/flashtrace/actions/workflows/ci.yml">
69
- <img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fflashtrace%2Fflashtrace%2Fbadges%2Ftests.json" alt="Number of tests run by node --test." />
69
+ <img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fflashtrace%2Fflashtrace%2Fbadges%2Ftests.json" alt="Number of tests." />
70
70
  </a>
71
71
  </p>
72
72
 
@@ -74,15 +74,14 @@
74
74
 
75
75
  To use flashtrace in your project,
76
76
 
77
- - either download `dist/flashtrace.mjs` into your own repository and run `node flashtrace.mjs`
78
- - or run `npm install flashtrace -D` to add it as a proper dev dependency to your project.
77
+ - run `npm install flashtrace -D` to add it as a dev dependency (a prebuilt native binary; `npx flashtrace` runs the tracing),
78
+ - or `cargo install flashtrace` to build it from the published crate,
79
+ - or download the binary for your platform from the [releases](https://github.com/flashtrace/flashtrace/releases).
79
80
 
80
- You can then execute `npx flashtrace` to run the tracing.
81
81
  Read our [Usage Guide](docs/USAGE.md) for more details.
82
- Node >= 18 is required for flashtrace to work.
83
82
 
84
83
  Looking for a working setup to start from? The [examples/](examples/) folder
85
- holds four self-contained example projects, from a minimal clean trace to a
84
+ holds seven self-contained example projects, from a minimal clean trace to a
86
85
  deliberately broken one showing every defect flashtrace reports. Each has a
87
86
  README, and the end-to-end tests verify their exact report output on every run.
88
87
 
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ /*
5
+ * npm launcher for the flashtrace native binary: resolves the platform
6
+ * package matching this machine (installed through optionalDependencies) and
7
+ * hands the process over to it. No downloads, no install scripts - if the
8
+ * binary is not here, the fix is a reinstall, and this launcher only says so.
9
+ */
10
+
11
+ const { spawnSync } = require('node:child_process');
12
+ const { constants } = require('node:os');
13
+
14
+ const platformPackage = `@flashtrace/${process.platform}-${process.arch}`;
15
+ const binaryName = process.platform === 'win32' ? 'flashtrace.exe' : 'flashtrace';
16
+
17
+ let binary;
18
+ try {
19
+ binary = require.resolve(`${platformPackage}/bin/${binaryName}`);
20
+ } catch {
21
+ console.error(
22
+ [
23
+ `flashtrace: no prebuilt binary for ${process.platform}-${process.arch}.`,
24
+ '',
25
+ `The package ${platformPackage} should have been installed as an`,
26
+ 'optional dependency of flashtrace. If your install ran with',
27
+ '--omit=optional (or --no-optional), reinstall without it. If no such',
28
+ 'package exists, this platform has no prebuilt binary; the supported',
29
+ 'targets are listed at https://github.com/flashtrace/flashtrace/releases',
30
+ ].join('\n'),
31
+ );
32
+ process.exit(2);
33
+ }
34
+
35
+ const result = spawnSync(binary, process.argv.slice(2), { stdio: 'inherit' });
36
+ if (result.error) {
37
+ console.error(`flashtrace: failed to run ${binary}: ${result.error.message}`);
38
+ process.exit(2);
39
+ }
40
+ if (result.signal) {
41
+ // the binary died on a signal: die on the same one, so the caller sees it
42
+ process.kill(process.pid, result.signal);
43
+ // still alive when Node ignores that signal (SIGPIPE): the shell's 128 + n
44
+ process.exit(128 + constants.signals[result.signal]);
45
+ }
46
+ process.exit(result.status);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flashtrace",
3
- "version": "0.12.1",
3
+ "version": "0.13.1",
4
4
  "description": "Lightning-fast, reference-based requirement tracing that works anywhere.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -17,26 +17,24 @@
17
17
  "markdown",
18
18
  "cli"
19
19
  ],
20
- "type": "module",
21
- "packageManager": "pnpm@11.10.0",
22
20
  "bin": {
23
- "flashtrace": "./dist/flashtrace.mjs"
21
+ "flashtrace": "bin/flashtrace.js"
24
22
  },
25
23
  "files": [
26
- "dist/"
24
+ "bin/"
27
25
  ],
26
+ "scripts": {
27
+ "prepack": "node -e \"for (const file of ['README.md', 'LICENSE']) require('node:fs').copyFileSync('../../' + file, file)\""
28
+ },
28
29
  "engines": {
29
30
  "node": ">=18"
30
31
  },
31
- "scripts": {
32
- "build": "esbuild src/main.mjs --bundle --format=esm --platform=node --outfile=dist/flashtrace.mjs",
33
- "prepack": "pnpm run build",
34
- "pretest": "pnpm run build",
35
- "test": "node --test",
36
- "pretest:coverage": "pnpm run build && node .github/scripts/prepare-coverage.mjs",
37
- "test:coverage": "node --test --experimental-test-coverage --test-coverage-include=src/** --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test-reporter=junit --test-reporter-destination=coverage/junit.xml"
38
- },
39
- "devDependencies": {
40
- "esbuild": "^0.28.1"
32
+ "optionalDependencies": {
33
+ "@flashtrace/darwin-arm64": "0.13.1",
34
+ "@flashtrace/darwin-x64": "0.13.1",
35
+ "@flashtrace/linux-arm64": "0.13.1",
36
+ "@flashtrace/linux-x64": "0.13.1",
37
+ "@flashtrace/win32-arm64": "0.13.1",
38
+ "@flashtrace/win32-x64": "0.13.1"
41
39
  }
42
40
  }