stackbite 0.5.55 → 0.5.57
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/package.json
CHANGED
|
@@ -8,6 +8,7 @@ const { download } = require('./download');
|
|
|
8
8
|
const { extractArchive } = require('./archive');
|
|
9
9
|
const { cacheDirectory, existingCacheDirectory } = require('./cache');
|
|
10
10
|
const { parseSetup, stageReporter } = require('./setup');
|
|
11
|
+
const timing = require('./startup-timing');
|
|
11
12
|
const packageVersion = require('../../../package.json').version;
|
|
12
13
|
|
|
13
14
|
// Only a glibc Linux host (or an injected runtime report) may select the Linux release.
|
|
@@ -226,10 +227,13 @@ async function main(argv = process.argv.slice(2), options = {}) {
|
|
|
226
227
|
const platform = options.platform || process.platform;
|
|
227
228
|
const environment = options.environment || process.env;
|
|
228
229
|
const spec = releaseSpec(manifest, platform, options.arch || process.arch, options);
|
|
229
|
-
|
|
230
|
+
// Every launch still verifies the full pinned payload; timing only observes it.
|
|
231
|
+
const installed = await timing.phase(environment, 'launcher.ensure', () => ensureBinary(spec, { ...options,
|
|
232
|
+
cache: options.cache || cacheDirectory(environment, platform),
|
|
230
233
|
checkOnly: setup?.checkOnly || false, reportCached: Boolean(setup),
|
|
231
|
-
progress: options.progress || stageReporter(options.stderr || process.stderr) });
|
|
234
|
+
progress: options.progress || stageReporter(options.stderr || process.stderr) }));
|
|
232
235
|
if (setup) return { code: 0, signal: null };
|
|
236
|
+
timing.mark(environment, 'launcher.exec');
|
|
233
237
|
// The bundled runtime owns state discovery and migration for every entrypoint.
|
|
234
238
|
return launchNative(installed.executable, argv, { ...environment,
|
|
235
239
|
STACKBITE_HOME: path.resolve(installed.home) }, options);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// Optional bounded launcher phase timing; the same off-by-default JSONL contract as
|
|
3
|
+
// private_pty/startup_timing.py (docs/startup-timing.md). Only fixed phase names,
|
|
4
|
+
// monotonic offsets from Node process start, wall-clock start and ok/raised are
|
|
5
|
+
// written: never arguments, paths, URLs, errors or credentials. Recording failures
|
|
6
|
+
// are ignored and never change verification, refusal or launch.
|
|
7
|
+
const fs = require('node:fs');
|
|
8
|
+
const path = require('node:path');
|
|
9
|
+
const { performance } = require('node:perf_hooks');
|
|
10
|
+
|
|
11
|
+
const ENVIRONMENT = 'STACKBITE_STARTUP_TIMING_FILE';
|
|
12
|
+
const SCHEMA = 'stackbite-startup-timing-v1';
|
|
13
|
+
const MAX_RECORDS = 128;
|
|
14
|
+
const NAME = /^[a-z][a-z0-9_.-]{0,63}$/;
|
|
15
|
+
let written = 0;
|
|
16
|
+
|
|
17
|
+
function target(environment) {
|
|
18
|
+
const value = environment[ENVIRONMENT];
|
|
19
|
+
return typeof value === 'string' && value && path.isAbsolute(value) ? value : null;
|
|
20
|
+
}
|
|
21
|
+
function record(environment, name, started, outcome, ended = performance.now()) {
|
|
22
|
+
const file = target(environment);
|
|
23
|
+
if (file === null || !NAME.test(name) || written >= MAX_RECORDS) return;
|
|
24
|
+
written++;
|
|
25
|
+
const line = JSON.stringify({ schema: SCHEMA, pid: process.pid, phase: name,
|
|
26
|
+
start_ms: Math.round(started * 1000) / 1000, ms: Math.round((ended - started) * 1000) / 1000,
|
|
27
|
+
wall_ms: Math.round(performance.timeOrigin + started), outcome }) + '\n';
|
|
28
|
+
const { O_WRONLY, O_CREAT, O_APPEND, O_NOFOLLOW = 0 } = fs.constants;
|
|
29
|
+
try {
|
|
30
|
+
const descriptor = fs.openSync(file, O_WRONLY | O_CREAT | O_APPEND | O_NOFOLLOW, 0o600);
|
|
31
|
+
try { fs.writeSync(descriptor, line); } finally { fs.closeSync(descriptor); }
|
|
32
|
+
} catch { /* advisory only */ }
|
|
33
|
+
}
|
|
34
|
+
// Times one awaited step; its result or rejection passes through unchanged.
|
|
35
|
+
async function phase(environment, name, step) {
|
|
36
|
+
const started = performance.now();
|
|
37
|
+
try {
|
|
38
|
+
const result = await step();
|
|
39
|
+
record(environment, name, started, 'ok');
|
|
40
|
+
return result;
|
|
41
|
+
} catch (error) {
|
|
42
|
+
record(environment, name, started, 'raised');
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// A zero-length phase: the moment a step (such as the native exec) begins.
|
|
47
|
+
function mark(environment, name) {
|
|
48
|
+
const now = performance.now();
|
|
49
|
+
record(environment, name, now, 'ok', now);
|
|
50
|
+
}
|
|
51
|
+
function resetForTest() { written = 0; }
|
|
52
|
+
|
|
53
|
+
module.exports = { ENVIRONMENT, SCHEMA, MAX_RECORDS, phase, mark, resetForTest };
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
|
-
"version": "0.5.
|
|
4
|
-
"commit": "
|
|
3
|
+
"version": "0.5.57",
|
|
4
|
+
"commit": "8ae067ad59076354f38c1b3744a0d8ea88122503",
|
|
5
5
|
"repository": "Shinick-Han/stackbite",
|
|
6
6
|
"platforms": {
|
|
7
7
|
"win32-x64": {
|
|
8
|
-
"asset": "stackbite-0.5.
|
|
9
|
-
"url": "https://github.com/Shinick-Han/stackbite/releases/download/v0.5.
|
|
10
|
-
"sha256": "
|
|
11
|
-
"size":
|
|
12
|
-
"root": "stackbite-0.5.
|
|
13
|
-
"manifestSha256": "
|
|
14
|
-
"metadataSha256": "
|
|
8
|
+
"asset": "stackbite-0.5.57-windows-x64-8ae067ad5907.zip",
|
|
9
|
+
"url": "https://github.com/Shinick-Han/stackbite/releases/download/v0.5.57/stackbite-0.5.57-windows-x64-8ae067ad5907.zip",
|
|
10
|
+
"sha256": "67196ede037e83a7d6da7a3f5eeebb5b86917e2383c9c66769335907fa42fccc",
|
|
11
|
+
"size": 88197128,
|
|
12
|
+
"root": "stackbite-0.5.57-windows-x64-8ae067ad5907",
|
|
13
|
+
"manifestSha256": "1f71e45fe7b3fb75f358be619db47a7f6a8b41c962eb7ccb7d7c2da0399f91b8",
|
|
14
|
+
"metadataSha256": "f7e84c68e9bb7c9a8c17955e6d5af0400c0925bcbc75300384df57ef394f7bba"
|
|
15
15
|
},
|
|
16
16
|
"linux-x64": {
|
|
17
|
-
"asset": "stackbite-0.5.
|
|
18
|
-
"url": "https://github.com/Shinick-Han/stackbite/releases/download/v0.5.
|
|
19
|
-
"sha256": "
|
|
20
|
-
"size":
|
|
21
|
-
"root": "stackbite-0.5.
|
|
22
|
-
"manifestSha256": "
|
|
23
|
-
"metadataSha256": "
|
|
17
|
+
"asset": "stackbite-0.5.57-linux-x86_64-8ae067ad5907.tar.gz",
|
|
18
|
+
"url": "https://github.com/Shinick-Han/stackbite/releases/download/v0.5.57/stackbite-0.5.57-linux-x86_64-8ae067ad5907.tar.gz",
|
|
19
|
+
"sha256": "773ae954bb8bfe06f2d650ead890ade60ea72a2d7a68b9724e97ff5ed413d2e8",
|
|
20
|
+
"size": 72285655,
|
|
21
|
+
"root": "stackbite-0.5.57-linux-x86_64-8ae067ad5907",
|
|
22
|
+
"manifestSha256": "e5c1c3d507faaebb12748fea1ff8c1a1e675962c6f501e390d20e6f2ec93b1cb",
|
|
23
|
+
"metadataSha256": "09f17f8eee7f37bf9711441d4e44823ffb3ba591b30f91e1b2b3da879860d8f0"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|