@swmansion/argent 0.33.1-next.10 → 0.33.1-next.11
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/dist/tool-server.cjs +366 -85
- package/package.json +1 -2
- package/assets/trace-processor/SHA256SUMS +0 -4
- package/assets/trace-processor/engine.mjs +0 -42423
package/dist/tool-server.cjs
CHANGED
|
@@ -2985,9 +2985,9 @@ function $constructor(name, initializer3, proto, params) {
|
|
|
2985
2985
|
function _(def) {
|
|
2986
2986
|
const inst = params?.Parent ? newError(Definition) : this;
|
|
2987
2987
|
init2(inst, def);
|
|
2988
|
-
const
|
|
2989
|
-
if (
|
|
2990
|
-
for (const fn of
|
|
2988
|
+
const deferred2 = inst._zod.deferred;
|
|
2989
|
+
if (deferred2) {
|
|
2990
|
+
for (const fn of deferred2) {
|
|
2991
2991
|
fn();
|
|
2992
2992
|
}
|
|
2993
2993
|
inst._zod.deferred = void 0;
|
|
@@ -80001,7 +80001,7 @@ var require_buffer_util = __commonJS({
|
|
|
80001
80001
|
"use strict";
|
|
80002
80002
|
var { EMPTY_BUFFER } = require_constants2();
|
|
80003
80003
|
var FastBuffer = Buffer[Symbol.species];
|
|
80004
|
-
function
|
|
80004
|
+
function concat3(list, totalLength) {
|
|
80005
80005
|
if (list.length === 0) return EMPTY_BUFFER;
|
|
80006
80006
|
if (list.length === 1) return list[0];
|
|
80007
80007
|
const target = Buffer.allocUnsafe(totalLength);
|
|
@@ -80047,7 +80047,7 @@ var require_buffer_util = __commonJS({
|
|
|
80047
80047
|
return buf;
|
|
80048
80048
|
}
|
|
80049
80049
|
module2.exports = {
|
|
80050
|
-
concat:
|
|
80050
|
+
concat: concat3,
|
|
80051
80051
|
mask: _mask,
|
|
80052
80052
|
toArrayBuffer,
|
|
80053
80053
|
toBuffer,
|
|
@@ -80716,7 +80716,7 @@ var require_receiver = __commonJS({
|
|
|
80716
80716
|
kStatusCode,
|
|
80717
80717
|
kWebSocket
|
|
80718
80718
|
} = require_constants2();
|
|
80719
|
-
var { concat:
|
|
80719
|
+
var { concat: concat3, toArrayBuffer, unmask } = require_buffer_util();
|
|
80720
80720
|
var { isValidStatusCode, isValidUTF8 } = require_validation();
|
|
80721
80721
|
var FastBuffer = Buffer[Symbol.species];
|
|
80722
80722
|
var GET_INFO = 0;
|
|
@@ -81193,9 +81193,9 @@ var require_receiver = __commonJS({
|
|
|
81193
81193
|
if (this._opcode === 2) {
|
|
81194
81194
|
let data;
|
|
81195
81195
|
if (this._binaryType === "nodebuffer") {
|
|
81196
|
-
data =
|
|
81196
|
+
data = concat3(fragments, messageLength);
|
|
81197
81197
|
} else if (this._binaryType === "arraybuffer") {
|
|
81198
|
-
data = toArrayBuffer(
|
|
81198
|
+
data = toArrayBuffer(concat3(fragments, messageLength));
|
|
81199
81199
|
} else if (this._binaryType === "blob") {
|
|
81200
81200
|
data = new Blob(fragments);
|
|
81201
81201
|
} else {
|
|
@@ -81213,7 +81213,7 @@ var require_receiver = __commonJS({
|
|
|
81213
81213
|
});
|
|
81214
81214
|
}
|
|
81215
81215
|
} else {
|
|
81216
|
-
const buf =
|
|
81216
|
+
const buf = concat3(fragments, messageLength);
|
|
81217
81217
|
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
81218
81218
|
const error63 = this.createError(
|
|
81219
81219
|
Error,
|
|
@@ -129953,6 +129953,321 @@ var import_promises6 = require("node:fs/promises");
|
|
|
129953
129953
|
var path23 = __toESM(require("node:path"));
|
|
129954
129954
|
var import_node_url2 = require("node:url");
|
|
129955
129955
|
var import_node_vm = __toESM(require("node:vm"));
|
|
129956
|
+
|
|
129957
|
+
// ../native-devtools-android/src/trace-processor-rpc.ts
|
|
129958
|
+
var TPM_APPEND_TRACE_DATA = 1;
|
|
129959
|
+
var TPM_FINALIZE_TRACE_DATA = 2;
|
|
129960
|
+
var TPM_QUERY_STREAMING = 3;
|
|
129961
|
+
var CELL_NULL = 1;
|
|
129962
|
+
var CELL_VARINT = 2;
|
|
129963
|
+
var CELL_FLOAT64 = 3;
|
|
129964
|
+
var CELL_STRING = 4;
|
|
129965
|
+
var CELL_BLOB = 5;
|
|
129966
|
+
var WIRE_VARINT2 = 0;
|
|
129967
|
+
var WIRE_I64 = 1;
|
|
129968
|
+
var WIRE_LEN2 = 2;
|
|
129969
|
+
var WIRE_I32 = 5;
|
|
129970
|
+
var MAX_MSG_SIZE = 1024 * 1024 * 1024;
|
|
129971
|
+
var utf8Encoder = new TextEncoder();
|
|
129972
|
+
var cellDecoder = new TextDecoder();
|
|
129973
|
+
var fieldDecoder = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
129974
|
+
function varintBytes(n) {
|
|
129975
|
+
const out = [];
|
|
129976
|
+
while (n >= 128) {
|
|
129977
|
+
out.push(n % 128 | 128);
|
|
129978
|
+
n = Math.floor(n / 128);
|
|
129979
|
+
}
|
|
129980
|
+
out.push(n);
|
|
129981
|
+
return out;
|
|
129982
|
+
}
|
|
129983
|
+
function concat2(parts2) {
|
|
129984
|
+
let len = 0;
|
|
129985
|
+
for (const p of parts2) len += p.length;
|
|
129986
|
+
const out = new Uint8Array(len);
|
|
129987
|
+
let off = 0;
|
|
129988
|
+
for (const p of parts2) {
|
|
129989
|
+
out.set(p, off);
|
|
129990
|
+
off += p.length;
|
|
129991
|
+
}
|
|
129992
|
+
return out;
|
|
129993
|
+
}
|
|
129994
|
+
function lenField(field, payload) {
|
|
129995
|
+
return [varintBytes(field * 8 + WIRE_LEN2), varintBytes(payload.length), payload];
|
|
129996
|
+
}
|
|
129997
|
+
function encodeRpcRequest(seq, method, argsField, args) {
|
|
129998
|
+
const parts2 = [[8], varintBytes(seq), [16], varintBytes(method)];
|
|
129999
|
+
if (argsField !== void 0 && args) parts2.push(...lenField(argsField, args));
|
|
130000
|
+
const rpc = concat2(parts2);
|
|
130001
|
+
return concat2(lenField(1, rpc));
|
|
130002
|
+
}
|
|
130003
|
+
var Reader2 = class {
|
|
130004
|
+
constructor(buf, pos = 0, end = buf.length) {
|
|
130005
|
+
this.buf = buf;
|
|
130006
|
+
this.end = end;
|
|
130007
|
+
this.pos = pos;
|
|
130008
|
+
}
|
|
130009
|
+
buf;
|
|
130010
|
+
end;
|
|
130011
|
+
pos;
|
|
130012
|
+
varint() {
|
|
130013
|
+
let result = 0;
|
|
130014
|
+
let mul = 1;
|
|
130015
|
+
for (; ; ) {
|
|
130016
|
+
if (this.pos >= this.end) throw new Error("Index out of range");
|
|
130017
|
+
const b = this.buf[this.pos++];
|
|
130018
|
+
result += (b & 127) * mul;
|
|
130019
|
+
if (b < 128) return result;
|
|
130020
|
+
mul *= 128;
|
|
130021
|
+
}
|
|
130022
|
+
}
|
|
130023
|
+
/** Signed 64-bit varint as a bigint (two's complement, like proto int64). */
|
|
130024
|
+
int64() {
|
|
130025
|
+
const buf = this.buf;
|
|
130026
|
+
let lo = 0;
|
|
130027
|
+
let hi = 0;
|
|
130028
|
+
for (let i = 0; i < 10; i++) {
|
|
130029
|
+
if (this.pos >= this.end) throw new Error("Index out of range");
|
|
130030
|
+
const b = buf[this.pos++];
|
|
130031
|
+
if (i < 4) lo |= (b & 127) << i * 7;
|
|
130032
|
+
else if (i === 4) {
|
|
130033
|
+
lo |= (b & 127) << 28;
|
|
130034
|
+
hi = (b & 127) >> 4;
|
|
130035
|
+
} else hi |= (b & 127) << (i - 5) * 7 + 3;
|
|
130036
|
+
if (b < 128) {
|
|
130037
|
+
return BigInt.asIntN(64, BigInt(hi >>> 0) << 32n | BigInt(lo >>> 0));
|
|
130038
|
+
}
|
|
130039
|
+
}
|
|
130040
|
+
throw new Error("invalid varint encoding");
|
|
130041
|
+
}
|
|
130042
|
+
bytes() {
|
|
130043
|
+
const len = this.varint();
|
|
130044
|
+
const start2 = this.pos;
|
|
130045
|
+
this.pos += len;
|
|
130046
|
+
if (this.pos > this.end) throw new Error("Index out of range");
|
|
130047
|
+
return this.buf.subarray(start2, this.pos);
|
|
130048
|
+
}
|
|
130049
|
+
skip(wireType) {
|
|
130050
|
+
if (wireType === WIRE_VARINT2) this.varint();
|
|
130051
|
+
else if (wireType === WIRE_I64) this.pos += 8;
|
|
130052
|
+
else if (wireType === WIRE_LEN2) this.bytes();
|
|
130053
|
+
else if (wireType === WIRE_I32) this.pos += 4;
|
|
130054
|
+
else throw new Error(`invalid wire type ${wireType} at offset ${this.pos}`);
|
|
130055
|
+
}
|
|
130056
|
+
};
|
|
130057
|
+
function lenOnly(wireType) {
|
|
130058
|
+
if (wireType !== WIRE_LEN2) throw new Error("Failed assertion");
|
|
130059
|
+
}
|
|
130060
|
+
function decodeBatch(batch, numColumns) {
|
|
130061
|
+
const r = new Reader2(batch);
|
|
130062
|
+
let cellTypes = new Uint8Array(0);
|
|
130063
|
+
let varints = new Reader2(batch, 0, 0);
|
|
130064
|
+
let floats = new Float64Array(0);
|
|
130065
|
+
const blobs = [];
|
|
130066
|
+
let strings = [];
|
|
130067
|
+
let last = false;
|
|
130068
|
+
while (r.pos < r.end) {
|
|
130069
|
+
const tag3 = r.varint();
|
|
130070
|
+
const field = Math.floor(tag3 / 8);
|
|
130071
|
+
const wire = tag3 & 7;
|
|
130072
|
+
if (field >= 1 && field <= 5) lenOnly(wire);
|
|
130073
|
+
if (field === 1) cellTypes = r.bytes();
|
|
130074
|
+
else if (field === 2) {
|
|
130075
|
+
const packed = r.bytes();
|
|
130076
|
+
varints = new Reader2(batch, packed.byteOffset - batch.byteOffset, r.pos);
|
|
130077
|
+
} else if (field === 3) {
|
|
130078
|
+
const packed = r.bytes();
|
|
130079
|
+
if (packed.length % 8 !== 0) throw new Error("Failed assertion");
|
|
130080
|
+
floats = new Float64Array(packed.slice().buffer);
|
|
130081
|
+
} else if (field === 4) blobs.push(r.bytes().slice());
|
|
130082
|
+
else if (field === 5) strings = cellDecoder.decode(r.bytes()).split("\0");
|
|
130083
|
+
else if (field === 6) last = r.varint() !== 0;
|
|
130084
|
+
else r.skip(wire);
|
|
130085
|
+
}
|
|
130086
|
+
const numCells = cellTypes.length;
|
|
130087
|
+
if (numColumns === 0 ? numCells !== 0 : numCells % numColumns !== 0) {
|
|
130088
|
+
throw new Error("Failed assertion");
|
|
130089
|
+
}
|
|
130090
|
+
const rows = [];
|
|
130091
|
+
let f = 0;
|
|
130092
|
+
let s = 0;
|
|
130093
|
+
let b = 0;
|
|
130094
|
+
for (let i = 0; i < numCells; i += numColumns) {
|
|
130095
|
+
const row = new Array(numColumns);
|
|
130096
|
+
for (let c = 0; c < numColumns; c++) {
|
|
130097
|
+
const type = cellTypes[i + c];
|
|
130098
|
+
if (type === CELL_NULL) row[c] = null;
|
|
130099
|
+
else if (type === CELL_VARINT) row[c] = varints.int64();
|
|
130100
|
+
else if (type === CELL_FLOAT64) row[c] = floats[f++];
|
|
130101
|
+
else if (type === CELL_STRING) row[c] = strings[s++];
|
|
130102
|
+
else if (type === CELL_BLOB) row[c] = blobs[b++];
|
|
130103
|
+
else throw new Error(`Invalid cell type ${type}`);
|
|
130104
|
+
}
|
|
130105
|
+
rows.push(row);
|
|
130106
|
+
}
|
|
130107
|
+
return { rows, last };
|
|
130108
|
+
}
|
|
130109
|
+
function deferred() {
|
|
130110
|
+
let resolve19;
|
|
130111
|
+
let reject;
|
|
130112
|
+
const promise2 = new Promise((res, rej) => {
|
|
130113
|
+
resolve19 = res;
|
|
130114
|
+
reject = rej;
|
|
130115
|
+
});
|
|
130116
|
+
return { promise: promise2, resolve: resolve19, reject };
|
|
130117
|
+
}
|
|
130118
|
+
var PendingQuery = class {
|
|
130119
|
+
constructor(done) {
|
|
130120
|
+
this.done = done;
|
|
130121
|
+
}
|
|
130122
|
+
done;
|
|
130123
|
+
result = { columns: [], rows: [] };
|
|
130124
|
+
error;
|
|
130125
|
+
complete = false;
|
|
130126
|
+
/** Appends one proto-encoded QueryResult message. */
|
|
130127
|
+
append(msg) {
|
|
130128
|
+
const r = new Reader2(msg);
|
|
130129
|
+
const { columns } = this.result;
|
|
130130
|
+
const columnsEmptyAtStart = columns.length === 0;
|
|
130131
|
+
const seen = /* @__PURE__ */ new Set();
|
|
130132
|
+
while (r.pos < r.end) {
|
|
130133
|
+
const tag3 = r.varint();
|
|
130134
|
+
const field = Math.floor(tag3 / 8);
|
|
130135
|
+
if (field === 1) {
|
|
130136
|
+
if (!columnsEmptyAtStart) throw new Error("Failed assertion");
|
|
130137
|
+
const orig = fieldDecoder.decode(r.bytes());
|
|
130138
|
+
let name = orig;
|
|
130139
|
+
for (let i = 1; seen.has(name); i++) name = `${orig}_${i}`;
|
|
130140
|
+
seen.add(name);
|
|
130141
|
+
columns.push(name);
|
|
130142
|
+
} else if (field === 2) {
|
|
130143
|
+
const err = fieldDecoder.decode(r.bytes());
|
|
130144
|
+
this.error = err.length ? err : void 0;
|
|
130145
|
+
} else if (field === 3) {
|
|
130146
|
+
const batch = decodeBatch(r.bytes(), columns.length);
|
|
130147
|
+
this.complete = batch.last;
|
|
130148
|
+
for (const row of batch.rows) this.result.rows.push(row);
|
|
130149
|
+
} else r.skip(tag3 & 7);
|
|
130150
|
+
}
|
|
130151
|
+
}
|
|
130152
|
+
};
|
|
130153
|
+
var TraceProcessorRpc = class {
|
|
130154
|
+
txSeqId = 0;
|
|
130155
|
+
rxSeqId = 0;
|
|
130156
|
+
rxBuf = new Uint8Array(0);
|
|
130157
|
+
pendingParses = [];
|
|
130158
|
+
pendingEofs = [];
|
|
130159
|
+
pendingQueries = [];
|
|
130160
|
+
/** Reason of the first fatal failure, if any. */
|
|
130161
|
+
failed;
|
|
130162
|
+
/** Pushes a chunk of trace data. Each call must stay under 64 MiB. */
|
|
130163
|
+
parse(data) {
|
|
130164
|
+
const d = deferred();
|
|
130165
|
+
this.pendingParses.push(d);
|
|
130166
|
+
this.send(TPM_APPEND_TRACE_DATA, 101, data);
|
|
130167
|
+
return d.promise;
|
|
130168
|
+
}
|
|
130169
|
+
/** Signals the end of the trace, after the last parse(). */
|
|
130170
|
+
notifyEof() {
|
|
130171
|
+
const d = deferred();
|
|
130172
|
+
this.pendingEofs.push(d);
|
|
130173
|
+
this.send(TPM_FINALIZE_TRACE_DATA);
|
|
130174
|
+
return d.promise;
|
|
130175
|
+
}
|
|
130176
|
+
/** Runs SQL; resolves once every batch arrived, rejects with the SQL error. */
|
|
130177
|
+
query(sql) {
|
|
130178
|
+
const d = deferred();
|
|
130179
|
+
this.pendingQueries.push(new PendingQuery(d));
|
|
130180
|
+
this.send(TPM_QUERY_STREAMING, 103, concat2(lenField(1, utf8Encoder.encode(sql))));
|
|
130181
|
+
return d.promise;
|
|
130182
|
+
}
|
|
130183
|
+
send(method, argsField, args) {
|
|
130184
|
+
this.rpcSendRequestBytes(encodeRpcRequest(this.txSeqId++, method, argsField, args));
|
|
130185
|
+
}
|
|
130186
|
+
onRpcResponseBytes(data) {
|
|
130187
|
+
const buf = this.rxBuf.length ? concat2([this.rxBuf, data]) : data;
|
|
130188
|
+
let pos = 0;
|
|
130189
|
+
for (; ; ) {
|
|
130190
|
+
const msg = this.nextFrame(buf, pos);
|
|
130191
|
+
if (!msg) break;
|
|
130192
|
+
pos = msg.byteOffset - buf.byteOffset + msg.length;
|
|
130193
|
+
this.onRpcResponseMessage(msg);
|
|
130194
|
+
}
|
|
130195
|
+
this.rxBuf = buf.slice(pos);
|
|
130196
|
+
}
|
|
130197
|
+
// A frame is a TraceProcessorRpcStream.msg field: tag 0x0a, varint size, body.
|
|
130198
|
+
nextFrame(buf, pos) {
|
|
130199
|
+
if (pos >= buf.length) return void 0;
|
|
130200
|
+
const tag3 = buf[pos];
|
|
130201
|
+
if (tag3 >= 128 || (tag3 & 7) !== WIRE_LEN2) {
|
|
130202
|
+
throw new Error(`RPC framing error, unexpected tag ${tag3} @ offset ${pos}`);
|
|
130203
|
+
}
|
|
130204
|
+
const r = new Reader2(buf, pos + 1);
|
|
130205
|
+
let len;
|
|
130206
|
+
try {
|
|
130207
|
+
len = r.varint();
|
|
130208
|
+
} catch {
|
|
130209
|
+
return void 0;
|
|
130210
|
+
}
|
|
130211
|
+
if (len >= MAX_MSG_SIZE) {
|
|
130212
|
+
throw new Error(`RPC framing error, message too large (${len} > ${MAX_MSG_SIZE}`);
|
|
130213
|
+
}
|
|
130214
|
+
if (r.pos + len > buf.length) return void 0;
|
|
130215
|
+
return buf.subarray(r.pos, r.pos + len);
|
|
130216
|
+
}
|
|
130217
|
+
onRpcResponseMessage(msg) {
|
|
130218
|
+
const r = new Reader2(msg);
|
|
130219
|
+
let seq = 0;
|
|
130220
|
+
let fatalError;
|
|
130221
|
+
let response;
|
|
130222
|
+
let args;
|
|
130223
|
+
while (r.pos < r.end) {
|
|
130224
|
+
const tag3 = r.varint();
|
|
130225
|
+
const field = Math.floor(tag3 / 8);
|
|
130226
|
+
if (field === 1) seq = r.varint();
|
|
130227
|
+
else if (field === 5) fatalError = fieldDecoder.decode(r.bytes());
|
|
130228
|
+
else if (field === 3) response = r.varint();
|
|
130229
|
+
else if (field === 201 || field === 203 || field === 212) args = r.bytes();
|
|
130230
|
+
else r.skip(tag3 & 7);
|
|
130231
|
+
}
|
|
130232
|
+
if (fatalError) this.fail(fatalError);
|
|
130233
|
+
if (seq !== this.rxSeqId + 1 && this.rxSeqId !== 0 && seq !== 0) {
|
|
130234
|
+
this.fail(`RPC sequence id mismatch cur=${seq} last=${this.rxSeqId} (ERR:rpc_seq)`);
|
|
130235
|
+
}
|
|
130236
|
+
this.rxSeqId = seq;
|
|
130237
|
+
if (response === TPM_APPEND_TRACE_DATA || response === TPM_FINALIZE_TRACE_DATA) {
|
|
130238
|
+
const errorField = response === TPM_APPEND_TRACE_DATA ? 2 : 1;
|
|
130239
|
+
const queue = response === TPM_APPEND_TRACE_DATA ? this.pendingParses : this.pendingEofs;
|
|
130240
|
+
const pending = queue.shift();
|
|
130241
|
+
if (!pending) throw new Error(`Unexpected response ${response} with no pending request`);
|
|
130242
|
+
let error63 = "";
|
|
130243
|
+
if (args) {
|
|
130244
|
+
const a = new Reader2(args);
|
|
130245
|
+
while (a.pos < a.end) {
|
|
130246
|
+
const tag3 = a.varint();
|
|
130247
|
+
if (Math.floor(tag3 / 8) === errorField) error63 = fieldDecoder.decode(a.bytes());
|
|
130248
|
+
else a.skip(tag3 & 7);
|
|
130249
|
+
}
|
|
130250
|
+
}
|
|
130251
|
+
if (error63.length > 0) pending.reject(new Error(error63));
|
|
130252
|
+
else pending.resolve();
|
|
130253
|
+
} else if (response === TPM_QUERY_STREAMING) {
|
|
130254
|
+
const pending = this.pendingQueries[0];
|
|
130255
|
+
if (!pending) throw new Error("Unexpected query result with no pending query");
|
|
130256
|
+
pending.append(args ?? new Uint8Array(0));
|
|
130257
|
+
if (pending.complete) {
|
|
130258
|
+
this.pendingQueries.shift();
|
|
130259
|
+
if (pending.error === void 0) pending.done.resolve(pending.result);
|
|
130260
|
+
else pending.done.reject(new Error(pending.error));
|
|
130261
|
+
}
|
|
130262
|
+
}
|
|
130263
|
+
}
|
|
130264
|
+
fail(reason2) {
|
|
130265
|
+
this.failed = reason2;
|
|
130266
|
+
throw new Error(reason2);
|
|
130267
|
+
}
|
|
130268
|
+
};
|
|
130269
|
+
|
|
130270
|
+
// ../native-devtools-android/src/wasm-trace-processor.ts
|
|
129956
130271
|
var DEFAULT_INIT_MS = 1500;
|
|
129957
130272
|
var MAX_WARM_ENGINES = 3;
|
|
129958
130273
|
var IDLE_DISPOSE_MS = 5 * 6e4;
|
|
@@ -129968,8 +130283,7 @@ function resolveTraceProcessorAssets() {
|
|
|
129968
130283
|
}
|
|
129969
130284
|
return {
|
|
129970
130285
|
wasmPath: wasmOverride ?? path23.join(dir, "trace_processor.wasm"),
|
|
129971
|
-
gluePath: path23.join(dir, "engine_bundle.node.js")
|
|
129972
|
-
enginePath: path23.join(dir, "engine.mjs")
|
|
130286
|
+
gluePath: path23.join(dir, "engine_bundle.node.js")
|
|
129973
130287
|
};
|
|
129974
130288
|
}
|
|
129975
130289
|
function patchGlueForNode(src) {
|
|
@@ -129992,17 +130306,8 @@ function patchGlueForNode(src) {
|
|
|
129992
130306
|
}
|
|
129993
130307
|
return src;
|
|
129994
130308
|
}
|
|
129995
|
-
var engineModulePromise = null;
|
|
129996
|
-
var wasmEngineClass = null;
|
|
129997
130309
|
var workerScopeReady = false;
|
|
129998
|
-
var decoderWarningSilenced = false;
|
|
129999
130310
|
var createMutex = Promise.resolve();
|
|
130000
|
-
function loadEngineModule(enginePath) {
|
|
130001
|
-
if (!engineModulePromise) {
|
|
130002
|
-
engineModulePromise = import((0, import_node_url2.pathToFileURL)(enginePath).href);
|
|
130003
|
-
}
|
|
130004
|
-
return engineModulePromise;
|
|
130005
|
-
}
|
|
130006
130311
|
function setupWorkerScope(assetsDir) {
|
|
130007
130312
|
if (workerScopeReady) return;
|
|
130008
130313
|
const g = engineGlobals();
|
|
@@ -130026,56 +130331,40 @@ function setupWorkerScope(assetsDir) {
|
|
|
130026
130331
|
}
|
|
130027
130332
|
workerScopeReady = true;
|
|
130028
130333
|
}
|
|
130029
|
-
|
|
130030
|
-
|
|
130031
|
-
|
|
130032
|
-
|
|
130033
|
-
|
|
130034
|
-
|
|
130035
|
-
|
|
130036
|
-
|
|
130037
|
-
|
|
130038
|
-
|
|
130039
|
-
|
|
130040
|
-
|
|
130041
|
-
|
|
130042
|
-
|
|
130043
|
-
|
|
130044
|
-
|
|
130045
|
-
|
|
130046
|
-
|
|
130047
|
-
|
|
130048
|
-
|
|
130049
|
-
|
|
130050
|
-
|
|
130051
|
-
|
|
130052
|
-
});
|
|
130053
|
-
this.fatal.catch(() => {
|
|
130054
|
-
});
|
|
130055
|
-
this.port.onmessage = (m) => {
|
|
130056
|
-
if (!(m.data instanceof Uint8Array)) return;
|
|
130057
|
-
try {
|
|
130058
|
-
this.onRpcResponseBytes(m.data);
|
|
130059
|
-
} catch (err) {
|
|
130060
|
-
const e = err instanceof Error ? err : new Error(String(err));
|
|
130061
|
-
this.rejectFatal(e);
|
|
130062
|
-
this.dispose();
|
|
130063
|
-
}
|
|
130064
|
-
};
|
|
130065
|
-
}
|
|
130066
|
-
rpcSendRequestBytes(data) {
|
|
130067
|
-
this.port.postMessage(data);
|
|
130068
|
-
}
|
|
130069
|
-
dispose() {
|
|
130070
|
-
if (this.disposed) return;
|
|
130071
|
-
this.disposed = true;
|
|
130072
|
-
this.port.onmessage = null;
|
|
130073
|
-
this.port.close();
|
|
130074
|
-
}
|
|
130334
|
+
var WasmEngine = class extends TraceProcessorRpc {
|
|
130335
|
+
port;
|
|
130336
|
+
disposed = false;
|
|
130337
|
+
fatal;
|
|
130338
|
+
rejectFatal;
|
|
130339
|
+
constructor(port) {
|
|
130340
|
+
super();
|
|
130341
|
+
this.port = port;
|
|
130342
|
+
this.fatal = new Promise((_resolve, reject) => {
|
|
130343
|
+
this.rejectFatal = reject;
|
|
130344
|
+
});
|
|
130345
|
+
this.fatal.catch(() => {
|
|
130346
|
+
});
|
|
130347
|
+
this.port.onmessage = (m) => {
|
|
130348
|
+
if (!(m.data instanceof Uint8Array)) return;
|
|
130349
|
+
try {
|
|
130350
|
+
this.onRpcResponseBytes(m.data);
|
|
130351
|
+
} catch (err) {
|
|
130352
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
130353
|
+
this.rejectFatal(e);
|
|
130354
|
+
this.dispose();
|
|
130355
|
+
}
|
|
130356
|
+
};
|
|
130075
130357
|
}
|
|
130076
|
-
|
|
130077
|
-
|
|
130078
|
-
}
|
|
130358
|
+
rpcSendRequestBytes(data) {
|
|
130359
|
+
this.port.postMessage(data);
|
|
130360
|
+
}
|
|
130361
|
+
dispose() {
|
|
130362
|
+
if (this.disposed) return;
|
|
130363
|
+
this.disposed = true;
|
|
130364
|
+
this.port.onmessage = null;
|
|
130365
|
+
this.port.close();
|
|
130366
|
+
}
|
|
130367
|
+
};
|
|
130079
130368
|
async function createEngine() {
|
|
130080
130369
|
const prev = createMutex;
|
|
130081
130370
|
let release2;
|
|
@@ -130083,12 +130372,10 @@ async function createEngine() {
|
|
|
130083
130372
|
await prev.catch(() => {
|
|
130084
130373
|
});
|
|
130085
130374
|
try {
|
|
130086
|
-
const { wasmPath, gluePath
|
|
130375
|
+
const { wasmPath, gluePath } = resolveTraceProcessorAssets();
|
|
130087
130376
|
const dir = path23.dirname(wasmPath);
|
|
130088
130377
|
const initMs = Number(process.env.ARGENT_TRACE_PROCESSOR_INIT_MS) || DEFAULT_INIT_MS;
|
|
130089
|
-
const { EngineBase } = await loadEngineModule(enginePath);
|
|
130090
130378
|
setupWorkerScope(dir);
|
|
130091
|
-
silenceDecoderWarning();
|
|
130092
130379
|
const g = engineGlobals();
|
|
130093
130380
|
g.__TP_WASM_BYTES = new Uint8Array((0, import_node_fs7.readFileSync)(wasmPath));
|
|
130094
130381
|
const src = patchGlueForNode((0, import_node_fs7.readFileSync)(gluePath, "utf8"));
|
|
@@ -130097,7 +130384,6 @@ async function createEngine() {
|
|
|
130097
130384
|
if (!bridge) throw new Error("patched glue did not expose globalThis.__TP_bridge");
|
|
130098
130385
|
const channel = new MessageChannel();
|
|
130099
130386
|
bridge.initialize(channel.port1);
|
|
130100
|
-
const WasmEngine = makeWasmEngineClass(EngineBase);
|
|
130101
130387
|
const engine = new WasmEngine(channel.port2);
|
|
130102
130388
|
await new Promise((r) => setTimeout(r, initMs));
|
|
130103
130389
|
g.__TP_bridge = void 0;
|
|
@@ -130178,27 +130464,22 @@ function readCell(v) {
|
|
|
130178
130464
|
}
|
|
130179
130465
|
return v;
|
|
130180
130466
|
}
|
|
130181
|
-
function decodeRows(
|
|
130182
|
-
|
|
130183
|
-
const rows = [];
|
|
130184
|
-
for (const it = result.iter({}); it.valid(); it.next()) {
|
|
130467
|
+
function decodeRows({ columns, rows }) {
|
|
130468
|
+
return rows.map((cells) => {
|
|
130185
130469
|
const row = {};
|
|
130186
|
-
|
|
130187
|
-
|
|
130188
|
-
}
|
|
130189
|
-
return rows;
|
|
130470
|
+
columns.forEach((c, i) => row[c] = readCell(cells[i]));
|
|
130471
|
+
return row;
|
|
130472
|
+
});
|
|
130190
130473
|
}
|
|
130191
130474
|
async function queryWarm(tracePath, sql) {
|
|
130192
130475
|
const engine = await getWarmEngine(tracePath);
|
|
130193
130476
|
let result;
|
|
130194
130477
|
try {
|
|
130195
130478
|
result = await Promise.race([engine.query(sql), engine.fatal]);
|
|
130196
|
-
} catch (
|
|
130479
|
+
} catch (err) {
|
|
130197
130480
|
await disposeWarmEngine(tracePath);
|
|
130198
|
-
throw
|
|
130481
|
+
throw err;
|
|
130199
130482
|
}
|
|
130200
|
-
const err = result.error();
|
|
130201
|
-
if (err) throw new Error(err);
|
|
130202
130483
|
return decodeRows(result);
|
|
130203
130484
|
}
|
|
130204
130485
|
async function disposeWarmEngine(tracePath) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swmansion/argent",
|
|
3
|
-
"version": "0.33.1-next.
|
|
3
|
+
"version": "0.33.1-next.11",
|
|
4
4
|
"mcpName": "io.github.software-mansion/argent",
|
|
5
5
|
"description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"default": "./dist/client.js"
|
|
16
16
|
},
|
|
17
17
|
"./assets/manifest": "./assets/manifest.json",
|
|
18
|
-
"./assets/trace-processor/engine": "./assets/trace-processor/engine.mjs",
|
|
19
18
|
"./assets/trace-processor/engine_bundle.node": "./assets/trace-processor/engine_bundle.node.js",
|
|
20
19
|
"./bin/argent-simulator-server": "./bin/argent-simulator-server.cjs",
|
|
21
20
|
"./dist/bundled-paths": "./dist/bundled-paths.js",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
c1c25c299b74cc9b9651592c94b669c91916434a2990f214f03c8135c848d3fa trace_processor.wasm
|
|
2
|
-
390f39007f0a617c44d88df051cbec33f52b1cffad145748a51f5b4961a4ffd9 engine_bundle.node.js
|
|
3
|
-
321e956788280009b2f7a89be8f6c8c745107642e3288c71c6c180100ffbaac4 engine.mjs
|
|
4
|
-
73f3b0eee3d8d064888f928c52211f33bdcc9145925a9e1340d07cd78ed62351 LICENSE
|