@apilift/cli 1.7.0 → 1.7.2-dev.1793350775.9e4732871b0c2f7fcd0e7ef763da291488572b43
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.
|
@@ -19883,7 +19883,7 @@ child.stdout.on('data',chunk=>{
|
|
|
19883
19883
|
while((end=text.indexOf('\\n'))>=0){
|
|
19884
19884
|
const [id,stamp]=text.slice(0,end).trim().split('|').map(Number);text=text.slice(end+1);
|
|
19885
19885
|
if(id!==Atomics.load(state,1)||Atomics.load(state,0)!==1)continue;
|
|
19886
|
-
value[0]=Number.isFinite(stamp)?stamp:0;Atomics.store(state,0,2);Atomics.notify(state,0);
|
|
19886
|
+
value[0]=Number.isFinite(stamp)?stamp:0;Atomics.store(state,2,id);Atomics.store(state,0,2);Atomics.notify(state,0);
|
|
19887
19887
|
}
|
|
19888
19888
|
if(text.length>1024){child.kill();fail();}
|
|
19889
19889
|
});
|
|
@@ -19893,7 +19893,7 @@ parentPort.on('message',({id,pid})=>{try{child.stdin.write(id+'|'+pid+'\\n');}ca
|
|
|
19893
19893
|
var worker;
|
|
19894
19894
|
var memory;
|
|
19895
19895
|
var sequence = 0;
|
|
19896
|
-
function windowsProcessStart(pid) {
|
|
19896
|
+
function windowsProcessStart(pid, isAlive) {
|
|
19897
19897
|
if (!worker) {
|
|
19898
19898
|
memory = new SharedArrayBuffer(24);
|
|
19899
19899
|
worker = new Worker(workerSource, { eval: true, workerData: { memory, script } });
|
|
@@ -19902,16 +19902,22 @@ function windowsProcessStart(pid) {
|
|
|
19902
19902
|
worker.unref();
|
|
19903
19903
|
}
|
|
19904
19904
|
const state = new Int32Array(memory, 0, 4), value = new Float64Array(memory, 16, 1);
|
|
19905
|
-
const
|
|
19906
|
-
|
|
19907
|
-
|
|
19908
|
-
|
|
19909
|
-
|
|
19910
|
-
|
|
19911
|
-
|
|
19912
|
-
|
|
19913
|
-
worker
|
|
19914
|
-
|
|
19905
|
+
const deadline = performance.now() + 8e3;
|
|
19906
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
19907
|
+
if (!isAlive()) return null;
|
|
19908
|
+
const remaining = deadline - performance.now();
|
|
19909
|
+
if (remaining <= 0) break;
|
|
19910
|
+
const id2 = ++sequence;
|
|
19911
|
+
Atomics.store(state, 1, id2);
|
|
19912
|
+
Atomics.store(state, 0, 1);
|
|
19913
|
+
worker.postMessage({ id: id2, pid });
|
|
19914
|
+
const result = Atomics.wait(state, 0, 1, Math.min(4e3, remaining));
|
|
19915
|
+
const status = Atomics.load(state, 0);
|
|
19916
|
+
if (status === 2) return Atomics.load(state, 2) === id2 && Number.isFinite(value[0]) && value[0] > 0 && isAlive() ? value[0] : null;
|
|
19917
|
+
if (result !== "timed-out" || status !== 1) break;
|
|
19918
|
+
}
|
|
19919
|
+
void worker.terminate();
|
|
19920
|
+
worker = void 0;
|
|
19915
19921
|
return null;
|
|
19916
19922
|
}
|
|
19917
19923
|
|
|
@@ -19984,7 +19990,7 @@ function inspectOwner(pid, expectedStartedAt, probe) {
|
|
|
19984
19990
|
}
|
|
19985
19991
|
}
|
|
19986
19992
|
if (windows && !probe.inspect) {
|
|
19987
|
-
const observed = windowsProcessStart(pid);
|
|
19993
|
+
const observed = windowsProcessStart(pid, () => alive(pid));
|
|
19988
19994
|
return observed !== null && Math.abs(observed - expectedStartedAt) <= 5e3;
|
|
19989
19995
|
}
|
|
19990
19996
|
for (let attempt = 0; attempt < (windows ? 2 : 1); attempt++) {
|
|
@@ -20555,13 +20561,14 @@ async function startCaptureServer(options) {
|
|
|
20555
20561
|
if (closed) return;
|
|
20556
20562
|
closed = true;
|
|
20557
20563
|
clearInterval(timer);
|
|
20558
|
-
|
|
20559
|
-
store.close();
|
|
20564
|
+
const drained = new Promise((resolve2) => server.close(() => resolve2()));
|
|
20560
20565
|
try {
|
|
20561
20566
|
const current = JSON.parse(await readFile(receiptPath, "utf8"));
|
|
20562
20567
|
if (current.token === token) await rm(receiptPath);
|
|
20563
20568
|
} catch {
|
|
20564
20569
|
}
|
|
20570
|
+
await drained;
|
|
20571
|
+
store.close();
|
|
20565
20572
|
}
|
|
20566
20573
|
return { receipt, store, close };
|
|
20567
20574
|
}
|
|
@@ -28187,6 +28187,7 @@ var init_analysis = __esm({
|
|
|
28187
28187
|
"use strict";
|
|
28188
28188
|
import__2 = __toESM(require__(), 1);
|
|
28189
28189
|
init_json();
|
|
28190
|
+
init_rules();
|
|
28190
28191
|
init_metadata();
|
|
28191
28192
|
ajv2 = new import__2.default({ strict: false, validateFormats: false });
|
|
28192
28193
|
}
|
|
@@ -31902,6 +31902,8 @@ var NativeHost = class {
|
|
|
31902
31902
|
try {
|
|
31903
31903
|
client2 = await this.capture();
|
|
31904
31904
|
scopes = await client2.scopes();
|
|
31905
|
+
if (this.stopped) return;
|
|
31906
|
+
if (!client2.legacyBridge) await client2.bridgeReady?.(this.options.version, this.extensionCapabilities);
|
|
31905
31907
|
} catch (error62) {
|
|
31906
31908
|
if (this.options.captureClient || !captureServerIdle(this.options.root)) throw error62;
|
|
31907
31909
|
void this.client?.then((client3) => client3.close()).catch(() => {
|
|
@@ -31914,7 +31916,6 @@ var NativeHost = class {
|
|
|
31914
31916
|
void this.heartbeatRecordingSessions(scopes.scopes).catch(() => {
|
|
31915
31917
|
});
|
|
31916
31918
|
if (client2) {
|
|
31917
|
-
if (!client2.legacyBridge) await client2.bridgeReady?.(this.options.version, this.extensionCapabilities);
|
|
31918
31919
|
this.analytics.recovered();
|
|
31919
31920
|
if (!this.reportedReady) {
|
|
31920
31921
|
this.reportedReady = true;
|
package/dist/apilift.js
CHANGED
|
@@ -46,7 +46,7 @@ var init_receipts = __esm({
|
|
|
46
46
|
|
|
47
47
|
// src/capture-server/windows-owner.ts
|
|
48
48
|
import { Worker } from "node:worker_threads";
|
|
49
|
-
function windowsProcessStart(pid) {
|
|
49
|
+
function windowsProcessStart(pid, isAlive) {
|
|
50
50
|
if (!worker) {
|
|
51
51
|
memory = new SharedArrayBuffer(24);
|
|
52
52
|
worker = new Worker(workerSource, { eval: true, workerData: { memory, script } });
|
|
@@ -55,16 +55,22 @@ function windowsProcessStart(pid) {
|
|
|
55
55
|
worker.unref();
|
|
56
56
|
}
|
|
57
57
|
const state = new Int32Array(memory, 0, 4), value = new Float64Array(memory, 16, 1);
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
worker
|
|
67
|
-
|
|
58
|
+
const deadline = performance.now() + 8e3;
|
|
59
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
60
|
+
if (!isAlive()) return null;
|
|
61
|
+
const remaining = deadline - performance.now();
|
|
62
|
+
if (remaining <= 0) break;
|
|
63
|
+
const id2 = ++sequence;
|
|
64
|
+
Atomics.store(state, 1, id2);
|
|
65
|
+
Atomics.store(state, 0, 1);
|
|
66
|
+
worker.postMessage({ id: id2, pid });
|
|
67
|
+
const result3 = Atomics.wait(state, 0, 1, Math.min(4e3, remaining));
|
|
68
|
+
const status = Atomics.load(state, 0);
|
|
69
|
+
if (status === 2) return Atomics.load(state, 2) === id2 && Number.isFinite(value[0]) && value[0] > 0 && isAlive() ? value[0] : null;
|
|
70
|
+
if (result3 !== "timed-out" || status !== 1) break;
|
|
71
|
+
}
|
|
72
|
+
void worker.terminate();
|
|
73
|
+
worker = void 0;
|
|
68
74
|
return null;
|
|
69
75
|
}
|
|
70
76
|
var script, workerSource, worker, memory, sequence;
|
|
@@ -86,7 +92,7 @@ child.stdout.on('data',chunk=>{
|
|
|
86
92
|
while((end=text.indexOf('\\n'))>=0){
|
|
87
93
|
const [id,stamp]=text.slice(0,end).trim().split('|').map(Number);text=text.slice(end+1);
|
|
88
94
|
if(id!==Atomics.load(state,1)||Atomics.load(state,0)!==1)continue;
|
|
89
|
-
value[0]=Number.isFinite(stamp)?stamp:0;Atomics.store(state,0,2);Atomics.notify(state,0);
|
|
95
|
+
value[0]=Number.isFinite(stamp)?stamp:0;Atomics.store(state,2,id);Atomics.store(state,0,2);Atomics.notify(state,0);
|
|
90
96
|
}
|
|
91
97
|
if(text.length>1024){child.kill();fail();}
|
|
92
98
|
});
|
|
@@ -20702,7 +20708,7 @@ function inspectOwner(pid, expectedStartedAt, probe) {
|
|
|
20702
20708
|
}
|
|
20703
20709
|
}
|
|
20704
20710
|
if (windows && !probe.inspect) {
|
|
20705
|
-
const observed = windowsProcessStart(pid);
|
|
20711
|
+
const observed = windowsProcessStart(pid, () => alive(pid));
|
|
20706
20712
|
return observed !== null && Math.abs(observed - expectedStartedAt) <= 5e3;
|
|
20707
20713
|
}
|
|
20708
20714
|
for (let attempt = 0; attempt < (windows ? 2 : 1); attempt++) {
|
|
@@ -28725,6 +28731,7 @@ var init_analysis = __esm({
|
|
|
28725
28731
|
"use strict";
|
|
28726
28732
|
import__2 = __toESM(require__(), 1);
|
|
28727
28733
|
init_json();
|
|
28734
|
+
init_rules();
|
|
28728
28735
|
init_metadata();
|
|
28729
28736
|
ajv2 = new import__2.default({ strict: false, validateFormats: false });
|
|
28730
28737
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apilift/cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2-dev.1793350775.9e4732871b0c2f7fcd0e7ef763da291488572b43",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=24.16.0 <27"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "9e4732871b0c2f7fcd0e7ef763da291488572b43",
|
|
41
41
|
"repository": {
|
|
42
42
|
"type": "git",
|
|
43
43
|
"url": "git+https://github.com/egor-sergeev/apilift.git",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"build": "node scripts/build.mjs",
|
|
48
48
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
49
49
|
"test": "vitest run --project component",
|
|
50
|
-
"test:platform": "vitest run --project component src/process src/capture-server/store.test.ts src/capture-server/performance.test.ts src/capture-server/server.test.ts src/capture-server/lifetime.test.ts src/native-host/registration.test.ts src/discovery/lock.test.ts src/discovery/drafts.test.ts src/plugin.test.ts src/update.test.ts src/setup-check.test.ts src/windows-installation.test.ts src/native-host/framing.test.ts src/native-host/idle-scopes.test.ts src/usage/measurement.test.ts src/usage/transcript.test.ts src/usage/ownership.test.ts",
|
|
50
|
+
"test:platform": "vitest run --project component --maxWorkers=1 --testTimeout=15000 src/process src/capture-server/store.test.ts src/capture-server/windows-owner.test.ts src/capture-server/performance.test.ts src/capture-server/server.test.ts src/capture-server/lifetime.test.ts src/native-host/registration.test.ts src/discovery/lock.test.ts src/discovery/drafts.test.ts src/plugin.test.ts src/update.test.ts src/setup-check.test.ts src/windows-installation.test.ts src/native-host/framing.test.ts src/native-host/idle-scopes.test.ts src/usage/measurement.test.ts src/usage/transcript.test.ts src/usage/ownership.test.ts",
|
|
51
51
|
"test:database": "vitest run --project database"
|
|
52
52
|
}
|
|
53
53
|
}
|