@rasputin-ai/node 0.16.0 → 1.0.0
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/auto-instrumentation/instrumentation-manifest-registry.d.ts.map +1 -1
- package/dist/auto-instrumentation/schedule-instrumentation-manifest-upload.d.ts.map +1 -1
- package/dist/create-rasputin-runtime.d.ts +72 -0
- package/dist/create-rasputin-runtime.d.ts.map +1 -0
- package/dist/execution-metrics/encode-execution-metrics-upload.d.ts.map +1 -1
- package/dist/execution-metrics/execution-metrics-collector.d.ts +3 -3
- package/dist/execution-metrics/execution-metrics-collector.d.ts.map +1 -1
- package/dist/execution-recorder/adaptive-recording-options.d.ts +3 -0
- package/dist/execution-recorder/adaptive-recording-options.d.ts.map +1 -1
- package/dist/execution-recorder/bind-adaptive-recorder.d.ts.map +1 -1
- package/dist/execution-recorder/execution-journal.d.ts +16 -1
- package/dist/execution-recorder/execution-journal.d.ts.map +1 -1
- package/dist/execution-recorder/execution-recorder-types.d.ts +18 -13
- package/dist/execution-recorder/execution-recorder-types.d.ts.map +1 -1
- package/dist/execution-recorder/execution-recorder.d.ts.map +1 -1
- package/dist/execution-recorder/execution-recording-sync.d.ts +0 -1
- package/dist/execution-recorder/execution-recording-sync.d.ts.map +1 -1
- package/dist/execution-recorder/runtime-state-size-budget.d.ts +3 -3
- package/dist/execution-recorder/runtime-state-size-budget.d.ts.map +1 -1
- package/dist/function-metrics/create-metrics-only-runtime.d.ts.map +1 -1
- package/dist/function-metrics/function-metrics-collector.d.ts.map +1 -1
- package/dist/index.js +878 -412
- package/dist/instrument/build.js +211 -355
- package/dist/instrument/bun.js +135 -246
- package/dist/instrument/node.js +135 -246
- package/dist/internal.d.ts +2 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +983 -341
- package/dist/rasputin-init.d.ts +7 -60
- package/dist/rasputin-init.d.ts.map +1 -1
- package/dist/sdk-meta.d.ts +1 -1
- package/dist/sdk-meta.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/instrument/node.js
CHANGED
|
@@ -28,7 +28,8 @@ var registerFunctionMetricDeclarations = (declarations) => {
|
|
|
28
28
|
import { resolve } from "node:path";
|
|
29
29
|
import {
|
|
30
30
|
INSTRUMENTATION_MANIFEST_SCHEMA_VERSION,
|
|
31
|
-
sourceLocatorFromFile as sourceLocatorFromFile2
|
|
31
|
+
sourceLocatorFromFile as sourceLocatorFromFile2,
|
|
32
|
+
sourceLocatorKey
|
|
32
33
|
} from "@rasputin-ai/core";
|
|
33
34
|
|
|
34
35
|
// ../recorder/src/encoded-function-plan.ts
|
|
@@ -68,7 +69,7 @@ var encodeFunctionPlan = (source) => {
|
|
|
68
69
|
var AUTOMATIC_RUNTIME_SYMBOL = "rasputin.execution.runtime.v3";
|
|
69
70
|
|
|
70
71
|
// src/auto-instrumentation/instrumentation-manifest-registry.ts
|
|
71
|
-
var INSTRUMENTATION_MANIFEST_SYMBOL = "rasputin.instrumentation.manifest.
|
|
72
|
+
var INSTRUMENTATION_MANIFEST_SYMBOL = "rasputin.instrumentation.manifest.v4";
|
|
72
73
|
var registrySymbol = Symbol.for(INSTRUMENTATION_MANIFEST_SYMBOL);
|
|
73
74
|
var getRegistry2 = () => {
|
|
74
75
|
const existing = Reflect.get(globalThis, registrySymbol);
|
|
@@ -208,9 +209,6 @@ import { homedir } from "node:os";
|
|
|
208
209
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
209
210
|
import { sourceLocatorFromFile as sourceLocatorFromFile4 } from "@rasputin-ai/core";
|
|
210
211
|
|
|
211
|
-
// ../instrumentation/src/classify-function.ts
|
|
212
|
-
import ts3 from "typescript";
|
|
213
|
-
|
|
214
212
|
// ../instrumentation/src/collect-instrumentation-delta.ts
|
|
215
213
|
import ts from "typescript";
|
|
216
214
|
var paramBindingFromName = (name, sourceFile) => {
|
|
@@ -279,91 +277,6 @@ var mappedLocation = (sourceFile, position, absolutePath, mapLocation) => {
|
|
|
279
277
|
};
|
|
280
278
|
return mapLocation ? mapLocation(raw) : raw;
|
|
281
279
|
};
|
|
282
|
-
var unwrapExpression = (expression) => {
|
|
283
|
-
let current = expression;
|
|
284
|
-
while (ts.isParenthesizedExpression(current) || ts.isNonNullExpression(current)) {
|
|
285
|
-
current = current.expression;
|
|
286
|
-
}
|
|
287
|
-
if (ts.isAwaitExpression(current)) return unwrapExpression(current.expression);
|
|
288
|
-
return current;
|
|
289
|
-
};
|
|
290
|
-
var calleeFromExpression = (expression, sourceFile) => {
|
|
291
|
-
const current = unwrapExpression(expression);
|
|
292
|
-
if (ts.isIdentifier(current)) {
|
|
293
|
-
return { calleeName: current.text, calleeText: current.text };
|
|
294
|
-
}
|
|
295
|
-
if (ts.isPropertyAccessExpression(current) && ts.isIdentifier(current.name)) {
|
|
296
|
-
return {
|
|
297
|
-
calleeName: current.name.text,
|
|
298
|
-
calleeText: current.getText(sourceFile).replace(/\s+/g, "")
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
return null;
|
|
302
|
-
};
|
|
303
|
-
var resultBindingForCall = (call) => {
|
|
304
|
-
let node = call.parent;
|
|
305
|
-
if (ts.isAwaitExpression(node)) node = node.parent;
|
|
306
|
-
if (!ts.isVariableDeclaration(node)) return null;
|
|
307
|
-
if (!ts.isIdentifier(node.name)) return null;
|
|
308
|
-
const initializer = node.initializer;
|
|
309
|
-
if (!initializer) return null;
|
|
310
|
-
const inner = unwrapExpression(initializer);
|
|
311
|
-
if (inner !== call) return null;
|
|
312
|
-
return node.name.text;
|
|
313
|
-
};
|
|
314
|
-
var argIdentifiersForCall = (call) => {
|
|
315
|
-
const identifiers = [];
|
|
316
|
-
call.arguments?.forEach((argument, index) => {
|
|
317
|
-
if (ts.isIdentifier(argument)) {
|
|
318
|
-
identifiers.push({ index, kind: "identifier", name: argument.text });
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
if (!ts.isObjectLiteralExpression(argument)) return;
|
|
322
|
-
const properties = [];
|
|
323
|
-
for (const property of argument.properties) {
|
|
324
|
-
if (ts.isShorthandPropertyAssignment(property)) {
|
|
325
|
-
properties.push({ key: property.name.text, name: property.name.text });
|
|
326
|
-
continue;
|
|
327
|
-
}
|
|
328
|
-
if (ts.isPropertyAssignment(property) && ts.isIdentifier(property.name) && ts.isIdentifier(property.initializer)) {
|
|
329
|
-
properties.push({ key: property.name.text, name: property.initializer.text });
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
if (properties.length > 0) {
|
|
333
|
-
identifiers.push({ index, kind: "object", properties });
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
return identifiers;
|
|
337
|
-
};
|
|
338
|
-
var collectCallSite = (call, caller, context) => {
|
|
339
|
-
const callee = calleeFromExpression(call.expression, context.sourceFile);
|
|
340
|
-
if (!callee) return null;
|
|
341
|
-
const start = mappedLocation(
|
|
342
|
-
context.sourceFile,
|
|
343
|
-
call.getStart(context.sourceFile),
|
|
344
|
-
context.absolutePath,
|
|
345
|
-
context.mapLocation
|
|
346
|
-
);
|
|
347
|
-
const end = mappedLocation(
|
|
348
|
-
context.sourceFile,
|
|
349
|
-
call.end,
|
|
350
|
-
context.absolutePath,
|
|
351
|
-
context.mapLocation
|
|
352
|
-
);
|
|
353
|
-
if (!start || !end) return null;
|
|
354
|
-
return {
|
|
355
|
-
callerFunctionId: caller.functionId,
|
|
356
|
-
calleeName: callee.calleeName,
|
|
357
|
-
calleeText: callee.calleeText,
|
|
358
|
-
filePath: start.filePath,
|
|
359
|
-
line: start.line,
|
|
360
|
-
column: start.column,
|
|
361
|
-
endLine: end.line,
|
|
362
|
-
endColumn: end.column,
|
|
363
|
-
resultBinding: resultBindingForCall(call),
|
|
364
|
-
argIdentifiers: argIdentifiersForCall(call)
|
|
365
|
-
};
|
|
366
|
-
};
|
|
367
280
|
var collectParamDestructure = (declaration, caller, context) => {
|
|
368
281
|
if (!declaration.initializer || !ts.isIdentifier(declaration.initializer)) return null;
|
|
369
282
|
if (!ts.isObjectBindingPattern(declaration.name) && !ts.isArrayBindingPattern(declaration.name)) {
|
|
@@ -388,9 +301,6 @@ var collectParamDestructure = (declaration, caller, context) => {
|
|
|
388
301
|
};
|
|
389
302
|
};
|
|
390
303
|
|
|
391
|
-
// ../instrumentation/src/parse-source.ts
|
|
392
|
-
import ts2 from "typescript";
|
|
393
|
-
|
|
394
304
|
// ../instrumentation/src/edits.ts
|
|
395
305
|
var isIdentContinue = (code) => code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || code === 36 || code === 95;
|
|
396
306
|
var isIdentStart = (code) => code >= 65 && code <= 90 || code >= 97 && code <= 122 || code === 36 || code === 95;
|
|
@@ -813,9 +723,43 @@ var attachInlineSourceMap = (original, generated, filePath, edits, basenameOf) =
|
|
|
813
723
|
` : `${withoutUpstream}${comment}`;
|
|
814
724
|
};
|
|
815
725
|
|
|
816
|
-
// ../instrumentation/src/
|
|
817
|
-
import
|
|
818
|
-
|
|
726
|
+
// ../instrumentation/src/parameter-initializer-may-run-code.ts
|
|
727
|
+
import ts2 from "typescript";
|
|
728
|
+
var unwrap = (expression) => {
|
|
729
|
+
let current = expression;
|
|
730
|
+
while (ts2.isParenthesizedExpression(current) || ts2.isNonNullExpression(current)) {
|
|
731
|
+
current = current.expression;
|
|
732
|
+
}
|
|
733
|
+
return current;
|
|
734
|
+
};
|
|
735
|
+
var isSafeLiteralInitializer = (expression) => {
|
|
736
|
+
const current = unwrap(expression);
|
|
737
|
+
if (ts2.isNumericLiteral(current) || ts2.isStringLiteral(current) || ts2.isNoSubstitutionTemplateLiteral(current) || ts2.isBigIntLiteral(current)) {
|
|
738
|
+
return true;
|
|
739
|
+
}
|
|
740
|
+
if (current.kind === ts2.SyntaxKind.TrueKeyword || current.kind === ts2.SyntaxKind.FalseKeyword || current.kind === ts2.SyntaxKind.NullKeyword) {
|
|
741
|
+
return true;
|
|
742
|
+
}
|
|
743
|
+
if (ts2.isIdentifier(current) && current.text === "undefined") return true;
|
|
744
|
+
if (ts2.isPrefixUnaryExpression(current) && (current.operator === ts2.SyntaxKind.PlusToken || current.operator === ts2.SyntaxKind.MinusToken)) {
|
|
745
|
+
return ts2.isNumericLiteral(unwrap(current.operand));
|
|
746
|
+
}
|
|
747
|
+
return false;
|
|
748
|
+
};
|
|
749
|
+
var functionHasPreBodyParameterEvaluation = (node) => {
|
|
750
|
+
for (const parameter of node.parameters) {
|
|
751
|
+
if (ts2.isIdentifier(parameter.name) && parameter.name.text === "this") continue;
|
|
752
|
+
if (!parameter.initializer) continue;
|
|
753
|
+
if (!isSafeLiteralInitializer(parameter.initializer)) return true;
|
|
754
|
+
}
|
|
755
|
+
return false;
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
// ../instrumentation/src/parse-source.ts
|
|
759
|
+
import ts3 from "typescript";
|
|
760
|
+
|
|
761
|
+
// ../instrumentation/src/source-map-location.ts
|
|
762
|
+
import { originalPositionFor as originalPositionFor3, TraceMap as TraceMap4 } from "@jridgewell/trace-mapping";
|
|
819
763
|
|
|
820
764
|
// ../instrumentation/src/suspension-whitelist.ts
|
|
821
765
|
import ts4 from "typescript";
|
|
@@ -946,7 +890,7 @@ var decideAsyncInstrumentation = (node, sourceFile) => {
|
|
|
946
890
|
|
|
947
891
|
// ../instrumentation/src/transform-source.ts
|
|
948
892
|
import { basename, resolve as resolve4 } from "node:path";
|
|
949
|
-
import
|
|
893
|
+
import ts8 from "typescript";
|
|
950
894
|
|
|
951
895
|
// ../instrumentation/src/function-metric-declarations.ts
|
|
952
896
|
import {
|
|
@@ -1200,57 +1144,25 @@ var collectFunctionMetricDeclarations = (input) => {
|
|
|
1200
1144
|
return declarations;
|
|
1201
1145
|
};
|
|
1202
1146
|
|
|
1203
|
-
// ../instrumentation/src/parameter-initializer-may-run-code.ts
|
|
1204
|
-
import ts6 from "typescript";
|
|
1205
|
-
var unwrap = (expression) => {
|
|
1206
|
-
let current = expression;
|
|
1207
|
-
while (ts6.isParenthesizedExpression(current) || ts6.isNonNullExpression(current)) {
|
|
1208
|
-
current = current.expression;
|
|
1209
|
-
}
|
|
1210
|
-
return current;
|
|
1211
|
-
};
|
|
1212
|
-
var isSafeLiteralInitializer = (expression) => {
|
|
1213
|
-
const current = unwrap(expression);
|
|
1214
|
-
if (ts6.isNumericLiteral(current) || ts6.isStringLiteral(current) || ts6.isNoSubstitutionTemplateLiteral(current) || ts6.isBigIntLiteral(current)) {
|
|
1215
|
-
return true;
|
|
1216
|
-
}
|
|
1217
|
-
if (current.kind === ts6.SyntaxKind.TrueKeyword || current.kind === ts6.SyntaxKind.FalseKeyword || current.kind === ts6.SyntaxKind.NullKeyword) {
|
|
1218
|
-
return true;
|
|
1219
|
-
}
|
|
1220
|
-
if (ts6.isIdentifier(current) && current.text === "undefined") return true;
|
|
1221
|
-
if (ts6.isPrefixUnaryExpression(current) && (current.operator === ts6.SyntaxKind.PlusToken || current.operator === ts6.SyntaxKind.MinusToken)) {
|
|
1222
|
-
return ts6.isNumericLiteral(unwrap(current.operand));
|
|
1223
|
-
}
|
|
1224
|
-
return false;
|
|
1225
|
-
};
|
|
1226
|
-
var functionHasPreBodyParameterEvaluation = (node) => {
|
|
1227
|
-
for (const parameter of node.parameters) {
|
|
1228
|
-
if (ts6.isIdentifier(parameter.name) && parameter.name.text === "this") continue;
|
|
1229
|
-
if (!parameter.initializer) continue;
|
|
1230
|
-
if (!isSafeLiteralInitializer(parameter.initializer)) return true;
|
|
1231
|
-
}
|
|
1232
|
-
return false;
|
|
1233
|
-
};
|
|
1234
|
-
|
|
1235
1147
|
// ../instrumentation/src/verify-instrumentation-isomorphism.ts
|
|
1236
|
-
import
|
|
1148
|
+
import ts6 from "typescript";
|
|
1237
1149
|
var RASPUTIN_IDENT = /^__rasputin/;
|
|
1238
1150
|
var scriptKindFor = (filePath) => {
|
|
1239
|
-
if (/\.tsx$/i.test(filePath)) return
|
|
1240
|
-
if (/\.jsx$/i.test(filePath)) return
|
|
1241
|
-
if (/\.[cm]?ts$/i.test(filePath)) return
|
|
1242
|
-
return
|
|
1151
|
+
if (/\.tsx$/i.test(filePath)) return ts6.ScriptKind.TSX;
|
|
1152
|
+
if (/\.jsx$/i.test(filePath)) return ts6.ScriptKind.JSX;
|
|
1153
|
+
if (/\.[cm]?ts$/i.test(filePath)) return ts6.ScriptKind.TS;
|
|
1154
|
+
return ts6.ScriptKind.JS;
|
|
1243
1155
|
};
|
|
1244
|
-
var parse = (filePath, source) =>
|
|
1156
|
+
var parse = (filePath, source) => ts6.createSourceFile(filePath, source, ts6.ScriptTarget.Latest, true, scriptKindFor(filePath));
|
|
1245
1157
|
var isRasputinName = (name) => RASPUTIN_IDENT.test(name);
|
|
1246
1158
|
var identText = (node) => {
|
|
1247
|
-
if (
|
|
1248
|
-
if (
|
|
1159
|
+
if (ts6.isIdentifier(node)) return node.text;
|
|
1160
|
+
if (ts6.isPrivateIdentifier(node)) return node.text;
|
|
1249
1161
|
return void 0;
|
|
1250
1162
|
};
|
|
1251
1163
|
var calleeName = (expression) => {
|
|
1252
|
-
if (
|
|
1253
|
-
if (
|
|
1164
|
+
if (ts6.isIdentifier(expression)) return expression.text;
|
|
1165
|
+
if (ts6.isPropertyAccessExpression(expression)) {
|
|
1254
1166
|
const object = identText(expression.expression);
|
|
1255
1167
|
const property = identText(expression.name);
|
|
1256
1168
|
if (object && isRasputinName(object) && property) return `${object}.${property}`;
|
|
@@ -1258,7 +1170,7 @@ var calleeName = (expression) => {
|
|
|
1258
1170
|
return void 0;
|
|
1259
1171
|
};
|
|
1260
1172
|
var isRasputinCall = (node, methods) => {
|
|
1261
|
-
if (!
|
|
1173
|
+
if (!ts6.isCallExpression(node)) return false;
|
|
1262
1174
|
const name = calleeName(node.expression);
|
|
1263
1175
|
if (!name) return false;
|
|
1264
1176
|
if (isRasputinName(name)) return !methods || methods.has(name.split(".")[1] ?? "");
|
|
@@ -1268,20 +1180,20 @@ var unwrapCall = (node) => {
|
|
|
1268
1180
|
let current = node;
|
|
1269
1181
|
while (isRasputinCall(current) && current.arguments.length === 1 && current.arguments[0]) {
|
|
1270
1182
|
current = current.arguments[0];
|
|
1271
|
-
if (
|
|
1183
|
+
if (ts6.isParenthesizedExpression(current)) current = current.expression;
|
|
1272
1184
|
}
|
|
1273
|
-
if (
|
|
1185
|
+
if (ts6.isParenthesizedExpression(current)) return current.expression;
|
|
1274
1186
|
return current;
|
|
1275
1187
|
};
|
|
1276
1188
|
var isRasputinStatement = (node) => {
|
|
1277
|
-
if (
|
|
1278
|
-
if (
|
|
1189
|
+
if (ts6.isEmptyStatement(node)) return true;
|
|
1190
|
+
if (ts6.isVariableStatement(node)) {
|
|
1279
1191
|
return node.declarationList.declarations.every((declaration) => {
|
|
1280
1192
|
const name = identText(declaration.name);
|
|
1281
1193
|
return Boolean(name && isRasputinName(name));
|
|
1282
1194
|
});
|
|
1283
1195
|
}
|
|
1284
|
-
if (
|
|
1196
|
+
if (ts6.isExpressionStatement(node)) {
|
|
1285
1197
|
if (!isRasputinCall(node.expression)) return false;
|
|
1286
1198
|
const unwrapped = unwrapCall(node.expression);
|
|
1287
1199
|
return unwrapped === node.expression;
|
|
@@ -1295,7 +1207,7 @@ var isRasputinTryWrapper = (node) => {
|
|
|
1295
1207
|
(statement) => !isRasputinStatement(statement)
|
|
1296
1208
|
);
|
|
1297
1209
|
const leftover = catchCalls[0];
|
|
1298
|
-
const leftoverThrow = catchCalls.length === 1 && leftover !== void 0 &&
|
|
1210
|
+
const leftoverThrow = catchCalls.length === 1 && leftover !== void 0 && ts6.isThrowStatement(leftover) && ts6.isIdentifier(leftover.expression) && isRasputinName(leftover.expression.text);
|
|
1299
1211
|
if (!leftoverThrow && catchCalls.length > 0) return false;
|
|
1300
1212
|
return node.finallyBlock.statements.every((statement) => isRasputinStatement(statement));
|
|
1301
1213
|
};
|
|
@@ -1303,7 +1215,7 @@ var flattenStatements = (statements) => {
|
|
|
1303
1215
|
const flattened = [];
|
|
1304
1216
|
for (const statement of statements) {
|
|
1305
1217
|
if (isRasputinStatement(statement)) continue;
|
|
1306
|
-
if (
|
|
1218
|
+
if (ts6.isTryStatement(statement) && isRasputinTryWrapper(statement)) {
|
|
1307
1219
|
flattened.push(...flattenStatements(statement.tryBlock.statements));
|
|
1308
1220
|
continue;
|
|
1309
1221
|
}
|
|
@@ -1312,38 +1224,38 @@ var flattenStatements = (statements) => {
|
|
|
1312
1224
|
return flattened;
|
|
1313
1225
|
};
|
|
1314
1226
|
var extra = (node) => {
|
|
1315
|
-
if (
|
|
1227
|
+
if (ts6.isIdentifier(node) || ts6.isPrivateIdentifier(node)) {
|
|
1316
1228
|
return isRasputinName(node.text) ? "" : node.text;
|
|
1317
1229
|
}
|
|
1318
|
-
if (
|
|
1230
|
+
if (ts6.isStringLiteral(node) || ts6.isNumericLiteral(node) || ts6.isNoSubstitutionTemplateLiteral(node)) {
|
|
1319
1231
|
return node.text;
|
|
1320
1232
|
}
|
|
1321
|
-
if (
|
|
1233
|
+
if (ts6.isToken(node) && !ts6.isIdentifier(node)) return ts6.SyntaxKind[node.kind] ?? "";
|
|
1322
1234
|
return "";
|
|
1323
1235
|
};
|
|
1324
1236
|
var signatureOf = (node) => {
|
|
1325
1237
|
const unwrapped = unwrapCall(node);
|
|
1326
1238
|
if (unwrapped !== node) return signatureOf(unwrapped);
|
|
1327
|
-
if (
|
|
1328
|
-
if (
|
|
1239
|
+
if (ts6.isEmptyStatement(unwrapped) || isRasputinStatement(unwrapped)) return "";
|
|
1240
|
+
if (ts6.isTryStatement(unwrapped) && isRasputinTryWrapper(unwrapped)) {
|
|
1329
1241
|
return flattenStatements(unwrapped.tryBlock.statements).map(signatureOf).filter(Boolean).join("");
|
|
1330
1242
|
}
|
|
1331
|
-
if (
|
|
1243
|
+
if (ts6.isBlock(unwrapped)) {
|
|
1332
1244
|
const statements = flattenStatements(unwrapped.statements);
|
|
1333
1245
|
return `Block[${statements.map(signatureOf).filter(Boolean).join(",")}]`;
|
|
1334
1246
|
}
|
|
1335
|
-
if (
|
|
1247
|
+
if (ts6.isCatchClause(unwrapped)) {
|
|
1336
1248
|
const statements = flattenStatements(unwrapped.block.statements);
|
|
1337
1249
|
const variable = unwrapped.variableDeclaration ? signatureOf(unwrapped.variableDeclaration) : "";
|
|
1338
1250
|
return `Catch${variable}[${statements.map(signatureOf).filter(Boolean).join(",")}]`;
|
|
1339
1251
|
}
|
|
1340
|
-
if (
|
|
1252
|
+
if (ts6.isArrowFunction(unwrapped) && ts6.isBlock(unwrapped.body)) {
|
|
1341
1253
|
const statements = flattenStatements(unwrapped.body.statements);
|
|
1342
1254
|
const only = statements[0];
|
|
1343
|
-
if (statements.length === 1 && only &&
|
|
1255
|
+
if (statements.length === 1 && only && ts6.isReturnStatement(only) && only.expression) {
|
|
1344
1256
|
const expression = only.expression;
|
|
1345
1257
|
const parts2 = [];
|
|
1346
|
-
|
|
1258
|
+
ts6.forEachChild(unwrapped, (child) => {
|
|
1347
1259
|
if (child === unwrapped.body) {
|
|
1348
1260
|
const part2 = signatureOf(expression);
|
|
1349
1261
|
if (part2) parts2.push(part2);
|
|
@@ -1356,11 +1268,11 @@ var signatureOf = (node) => {
|
|
|
1356
1268
|
}
|
|
1357
1269
|
}
|
|
1358
1270
|
const parts = [];
|
|
1359
|
-
|
|
1271
|
+
ts6.forEachChild(unwrapped, (child) => {
|
|
1360
1272
|
const part = signatureOf(child);
|
|
1361
1273
|
if (part) parts.push(part);
|
|
1362
1274
|
});
|
|
1363
|
-
const kind =
|
|
1275
|
+
const kind = ts6.SyntaxKind[unwrapped.kind] ?? "Node";
|
|
1364
1276
|
const label = extra(unwrapped);
|
|
1365
1277
|
return `${kind}${label}[${parts.join(",")}]`;
|
|
1366
1278
|
};
|
|
@@ -1369,14 +1281,14 @@ var instrumentationTreesAreIsomorphic = (filePath, original, transformed) => {
|
|
|
1369
1281
|
};
|
|
1370
1282
|
|
|
1371
1283
|
// ../instrumentation/src/verify-transformed-source.ts
|
|
1372
|
-
import
|
|
1373
|
-
var transpileForVerification = (filePath, code) =>
|
|
1284
|
+
import ts7 from "typescript";
|
|
1285
|
+
var transpileForVerification = (filePath, code) => ts7.transpileModule(code, {
|
|
1374
1286
|
compilerOptions: {
|
|
1375
1287
|
// ES2020 downlevel keeps native @decorators out of `new Function`.
|
|
1376
|
-
target:
|
|
1377
|
-
module:
|
|
1288
|
+
target: ts7.ScriptTarget.ES2020,
|
|
1289
|
+
module: ts7.ModuleKind.ESNext,
|
|
1378
1290
|
allowJs: true,
|
|
1379
|
-
jsx:
|
|
1291
|
+
jsx: ts7.JsxEmit.React,
|
|
1380
1292
|
experimentalDecorators: true
|
|
1381
1293
|
},
|
|
1382
1294
|
reportDiagnostics: true,
|
|
@@ -1384,7 +1296,7 @@ var transpileForVerification = (filePath, code) => ts8.transpileModule(code, {
|
|
|
1384
1296
|
});
|
|
1385
1297
|
var hasScanOrParseError = (diagnostics) => Boolean(
|
|
1386
1298
|
diagnostics?.some(
|
|
1387
|
-
(diagnostic) => diagnostic.category ===
|
|
1299
|
+
(diagnostic) => diagnostic.category === ts7.DiagnosticCategory.Error && diagnostic.code < 2e3
|
|
1388
1300
|
)
|
|
1389
1301
|
);
|
|
1390
1302
|
var scriptBodyForEngine = (emitted) => (
|
|
@@ -1393,39 +1305,39 @@ var scriptBodyForEngine = (emitted) => (
|
|
|
1393
1305
|
);
|
|
1394
1306
|
var looksTyped = (filePath) => /\.[cm]?tsx?$/i.test(filePath);
|
|
1395
1307
|
var scriptKindFor2 = (filePath) => {
|
|
1396
|
-
if (/\.tsx$/i.test(filePath)) return
|
|
1397
|
-
if (/\.jsx$/i.test(filePath)) return
|
|
1398
|
-
if (/\.[cm]?ts$/i.test(filePath)) return
|
|
1399
|
-
return
|
|
1308
|
+
if (/\.tsx$/i.test(filePath)) return ts7.ScriptKind.TSX;
|
|
1309
|
+
if (/\.jsx$/i.test(filePath)) return ts7.ScriptKind.JSX;
|
|
1310
|
+
if (/\.[cm]?ts$/i.test(filePath)) return ts7.ScriptKind.TS;
|
|
1311
|
+
return ts7.ScriptKind.JS;
|
|
1400
1312
|
};
|
|
1401
|
-
var isIterationStatement = (node) =>
|
|
1313
|
+
var isIterationStatement = (node) => ts7.isForStatement(node) || ts7.isForOfStatement(node) || ts7.isForInStatement(node) || ts7.isWhileStatement(node) || ts7.isDoStatement(node);
|
|
1402
1314
|
var unwrapLabeled = (node) => {
|
|
1403
1315
|
let current = node;
|
|
1404
|
-
while (
|
|
1316
|
+
while (ts7.isLabeledStatement(current)) current = current.statement;
|
|
1405
1317
|
return current;
|
|
1406
1318
|
};
|
|
1407
1319
|
var hasInvalidLabelJump = (sourceFile) => {
|
|
1408
1320
|
const visit = (node, labels) => {
|
|
1409
|
-
if (
|
|
1321
|
+
if (ts7.isFunctionLike(node)) {
|
|
1410
1322
|
let nestedInvalid = false;
|
|
1411
|
-
|
|
1323
|
+
ts7.forEachChild(node, (child) => {
|
|
1412
1324
|
if (visit(child, /* @__PURE__ */ new Map())) nestedInvalid = true;
|
|
1413
1325
|
});
|
|
1414
1326
|
return nestedInvalid;
|
|
1415
1327
|
}
|
|
1416
|
-
if (
|
|
1328
|
+
if (ts7.isLabeledStatement(node)) {
|
|
1417
1329
|
const next = new Map(labels);
|
|
1418
1330
|
next.set(node.label.text, isIterationStatement(unwrapLabeled(node.statement)));
|
|
1419
1331
|
return visit(node.statement, next);
|
|
1420
1332
|
}
|
|
1421
|
-
if (
|
|
1333
|
+
if (ts7.isContinueStatement(node) && node.label) {
|
|
1422
1334
|
if (labels.get(node.label.text) !== true) return true;
|
|
1423
1335
|
}
|
|
1424
|
-
if (
|
|
1336
|
+
if (ts7.isBreakStatement(node) && node.label && !labels.has(node.label.text)) {
|
|
1425
1337
|
return true;
|
|
1426
1338
|
}
|
|
1427
1339
|
let invalid = false;
|
|
1428
|
-
|
|
1340
|
+
ts7.forEachChild(node, (child) => {
|
|
1429
1341
|
if (visit(child, labels)) invalid = true;
|
|
1430
1342
|
});
|
|
1431
1343
|
return invalid;
|
|
@@ -1468,10 +1380,10 @@ var UNTERMINATED_BARE_LEAVE = /\breturn\s+__rasputin\w*\.leave\(\)(?!\s*;|\()/;
|
|
|
1468
1380
|
var transformedSourceIsInvalid = (filePath, code) => {
|
|
1469
1381
|
if (GLUED_INSTRUMENTATION.test(code)) return true;
|
|
1470
1382
|
if (UNTERMINATED_BARE_LEAVE.test(code)) return true;
|
|
1471
|
-
const sourceFile =
|
|
1383
|
+
const sourceFile = ts7.createSourceFile(
|
|
1472
1384
|
filePath,
|
|
1473
1385
|
code,
|
|
1474
|
-
|
|
1386
|
+
ts7.ScriptTarget.Latest,
|
|
1475
1387
|
true,
|
|
1476
1388
|
scriptKindFor2(filePath)
|
|
1477
1389
|
);
|
|
@@ -1492,25 +1404,25 @@ var alreadyInstrumentedResult = (source) => ({
|
|
|
1492
1404
|
delta: { functions: [], callSites: [], destructures: [], alreadyInstrumented: true }
|
|
1493
1405
|
});
|
|
1494
1406
|
var scriptKindFor3 = (filePath) => {
|
|
1495
|
-
if (/\.tsx$/i.test(filePath)) return
|
|
1496
|
-
if (/\.jsx$/i.test(filePath)) return
|
|
1497
|
-
if (/\.[cm]?ts$/i.test(filePath)) return
|
|
1498
|
-
return
|
|
1407
|
+
if (/\.tsx$/i.test(filePath)) return ts8.ScriptKind.TSX;
|
|
1408
|
+
if (/\.jsx$/i.test(filePath)) return ts8.ScriptKind.JSX;
|
|
1409
|
+
if (/\.[cm]?ts$/i.test(filePath)) return ts8.ScriptKind.TS;
|
|
1410
|
+
return ts8.ScriptKind.JS;
|
|
1499
1411
|
};
|
|
1500
1412
|
var functionName = (node, sourceFile) => {
|
|
1501
|
-
if (
|
|
1413
|
+
if (ts8.isConstructorDeclaration(node)) return "constructor";
|
|
1502
1414
|
if (node.name) return node.name.getText(sourceFile).replace(/^['"]|['"]$/g, "");
|
|
1503
1415
|
const parent = node.parent;
|
|
1504
|
-
if (
|
|
1505
|
-
if (
|
|
1506
|
-
if (
|
|
1416
|
+
if (ts8.isVariableDeclaration(parent) && ts8.isIdentifier(parent.name)) return parent.name.text;
|
|
1417
|
+
if (ts8.isPropertyAssignment(parent)) return parent.name.getText(sourceFile);
|
|
1418
|
+
if (ts8.isPropertyDeclaration(parent) && parent.name) return parent.name.getText(sourceFile);
|
|
1507
1419
|
const location = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));
|
|
1508
1420
|
return `anonymous@${location.line + 1}:${location.character + 1}`;
|
|
1509
1421
|
};
|
|
1510
1422
|
var functionLocationPosition = (node, sourceFile) => {
|
|
1511
1423
|
if (node.name) return node.name.getStart(sourceFile);
|
|
1512
1424
|
const parent = node.parent;
|
|
1513
|
-
if ((
|
|
1425
|
+
if ((ts8.isVariableDeclaration(parent) || ts8.isPropertyAssignment(parent)) && parent.name) {
|
|
1514
1426
|
return parent.name.getStart(sourceFile);
|
|
1515
1427
|
}
|
|
1516
1428
|
return node.getStart(sourceFile);
|
|
@@ -1523,12 +1435,12 @@ var functionBodyPrologueEnd = (body, sourceFile) => {
|
|
|
1523
1435
|
}
|
|
1524
1436
|
return end;
|
|
1525
1437
|
};
|
|
1526
|
-
var isStaticPropertyName = (name) =>
|
|
1438
|
+
var isStaticPropertyName = (name) => ts8.isIdentifier(name) || ts8.isStringLiteral(name) || ts8.isNoSubstitutionTemplateLiteral(name) || ts8.isNumericLiteral(name);
|
|
1527
1439
|
var canReconstructBinding = (name) => {
|
|
1528
|
-
if (
|
|
1529
|
-
if (
|
|
1440
|
+
if (ts8.isIdentifier(name)) return true;
|
|
1441
|
+
if (ts8.isArrayBindingPattern(name)) {
|
|
1530
1442
|
return name.elements.every(
|
|
1531
|
-
(element) =>
|
|
1443
|
+
(element) => ts8.isOmittedExpression(element) || canReconstructBinding(element.name)
|
|
1532
1444
|
);
|
|
1533
1445
|
}
|
|
1534
1446
|
return name.elements.every((element) => {
|
|
@@ -1537,10 +1449,10 @@ var canReconstructBinding = (name) => {
|
|
|
1537
1449
|
});
|
|
1538
1450
|
};
|
|
1539
1451
|
var bindingValue = (name, sourceFile) => {
|
|
1540
|
-
if (
|
|
1541
|
-
if (
|
|
1452
|
+
if (ts8.isIdentifier(name)) return name.text;
|
|
1453
|
+
if (ts8.isArrayBindingPattern(name)) {
|
|
1542
1454
|
const values = name.elements.map((element) => {
|
|
1543
|
-
if (
|
|
1455
|
+
if (ts8.isOmittedExpression(element)) return "";
|
|
1544
1456
|
const value = bindingValue(element.name, sourceFile);
|
|
1545
1457
|
return element.dotDotDotToken ? `...${value}` : value;
|
|
1546
1458
|
});
|
|
@@ -1550,7 +1462,7 @@ var bindingValue = (name, sourceFile) => {
|
|
|
1550
1462
|
const value = bindingValue(element.name, sourceFile);
|
|
1551
1463
|
if (element.dotDotDotToken) return `...${value}`;
|
|
1552
1464
|
if (!element.propertyName) return value;
|
|
1553
|
-
const key =
|
|
1465
|
+
const key = ts8.isIdentifier(element.propertyName) ? element.propertyName.text : element.propertyName.getText(sourceFile);
|
|
1554
1466
|
return `${key}:${value}`;
|
|
1555
1467
|
});
|
|
1556
1468
|
return `{${properties.join(",")}}`;
|
|
@@ -1558,7 +1470,7 @@ var bindingValue = (name, sourceFile) => {
|
|
|
1558
1470
|
var arrowArgsCapture = (node) => {
|
|
1559
1471
|
const sourceFile = node.getSourceFile();
|
|
1560
1472
|
const params = node.parameters.filter(
|
|
1561
|
-
(parameter) => !(
|
|
1473
|
+
(parameter) => !(ts8.isIdentifier(parameter.name) && parameter.name.text === "this")
|
|
1562
1474
|
);
|
|
1563
1475
|
if (!params.every((parameter) => canReconstructBinding(parameter.name))) {
|
|
1564
1476
|
return {
|
|
@@ -1573,13 +1485,13 @@ var arrowArgsCapture = (node) => {
|
|
|
1573
1485
|
return { args: `[${values.join(",")}]`, omitValues: false };
|
|
1574
1486
|
};
|
|
1575
1487
|
var isSupportedFunction = (node) => {
|
|
1576
|
-
if (!
|
|
1488
|
+
if (!ts8.isFunctionDeclaration(node) && !ts8.isFunctionExpression(node) && !ts8.isArrowFunction(node) && !ts8.isMethodDeclaration(node) && !ts8.isGetAccessorDeclaration(node) && !ts8.isSetAccessorDeclaration(node)) {
|
|
1577
1489
|
return false;
|
|
1578
1490
|
}
|
|
1579
1491
|
if (!node.body || "asteriskToken" in node && node.asteriskToken) return false;
|
|
1580
1492
|
return true;
|
|
1581
1493
|
};
|
|
1582
|
-
var isDirectivePrologue = (statement) =>
|
|
1494
|
+
var isDirectivePrologue = (statement) => ts8.isExpressionStatement(statement) && ts8.isStringLiteral(statement.expression);
|
|
1583
1495
|
var insertPositionAfterPrologue = (source, sourceFile) => {
|
|
1584
1496
|
const shebangEnd = source.startsWith("#!") ? source.indexOf("\n") + 1 : 0;
|
|
1585
1497
|
let end = shebangEnd;
|
|
@@ -1630,7 +1542,7 @@ var insertAfterSuperOrPrologue = (body, sourceFile) => {
|
|
|
1630
1542
|
const end = functionBodyPrologueEnd(body, sourceFile);
|
|
1631
1543
|
for (const statement of body.statements) {
|
|
1632
1544
|
if (isDirectivePrologue(statement)) continue;
|
|
1633
|
-
if (
|
|
1545
|
+
if (ts8.isExpressionStatement(statement) && ts8.isCallExpression(statement.expression) && statement.expression.expression.kind === ts8.SyntaxKind.SuperKeyword) {
|
|
1634
1546
|
return statement.end;
|
|
1635
1547
|
}
|
|
1636
1548
|
break;
|
|
@@ -1641,15 +1553,15 @@ var failEpilogue = (handleName, errorName, args, restoreOnCatch) => `}catch(${er
|
|
|
1641
1553
|
var walkOwnBody = (node, visitNode) => {
|
|
1642
1554
|
if (!node.body) return;
|
|
1643
1555
|
const visit = (candidate) => {
|
|
1644
|
-
if (candidate !== node &&
|
|
1556
|
+
if (candidate !== node && ts8.isFunctionLike(candidate)) return;
|
|
1645
1557
|
visitNode(candidate);
|
|
1646
|
-
|
|
1558
|
+
ts8.forEachChild(candidate, visit);
|
|
1647
1559
|
};
|
|
1648
1560
|
visit(node.body);
|
|
1649
1561
|
};
|
|
1650
1562
|
var collectAwaitWraps = (node, sourceFile, handleName, edits, depth) => {
|
|
1651
1563
|
walkOwnBody(node, (candidate) => {
|
|
1652
|
-
if (!
|
|
1564
|
+
if (!ts8.isAwaitExpression(candidate)) return;
|
|
1653
1565
|
wrap(
|
|
1654
1566
|
edits,
|
|
1655
1567
|
candidate.expression.getStart(sourceFile),
|
|
@@ -1670,7 +1582,7 @@ var collectAwaitWraps = (node, sourceFile, handleName, edits, depth) => {
|
|
|
1670
1582
|
};
|
|
1671
1583
|
var collectCatchFinallyResumes = (node, sourceFile, handleName, edits, depth) => {
|
|
1672
1584
|
walkOwnBody(node, (candidate) => {
|
|
1673
|
-
if (!
|
|
1585
|
+
if (!ts8.isTryStatement(candidate)) return;
|
|
1674
1586
|
const blocks = [candidate.catchClause?.block, candidate.finallyBlock];
|
|
1675
1587
|
for (const block of blocks) {
|
|
1676
1588
|
if (!block) continue;
|
|
@@ -1686,10 +1598,10 @@ var collectCatchFinallyResumes = (node, sourceFile, handleName, edits, depth) =>
|
|
|
1686
1598
|
});
|
|
1687
1599
|
};
|
|
1688
1600
|
var collectReturnWraps = (node, sourceFile, handleName, edits, depth) => {
|
|
1689
|
-
if (!node.body || !
|
|
1601
|
+
if (!node.body || !ts8.isBlock(node.body)) return;
|
|
1690
1602
|
const visit = (candidate, at) => {
|
|
1691
|
-
if (candidate !== node &&
|
|
1692
|
-
if (
|
|
1603
|
+
if (candidate !== node && ts8.isFunctionLike(candidate)) return;
|
|
1604
|
+
if (ts8.isReturnStatement(candidate) && candidate.expression) {
|
|
1693
1605
|
const expression = candidate.expression;
|
|
1694
1606
|
wrap(
|
|
1695
1607
|
edits,
|
|
@@ -1701,17 +1613,17 @@ var collectReturnWraps = (node, sourceFile, handleName, edits, depth) => {
|
|
|
1701
1613
|
);
|
|
1702
1614
|
return;
|
|
1703
1615
|
}
|
|
1704
|
-
|
|
1616
|
+
ts8.forEachChild(candidate, (child) => visit(child, at + 1));
|
|
1705
1617
|
};
|
|
1706
1618
|
visit(node.body, depth + 1);
|
|
1707
1619
|
};
|
|
1708
1620
|
var transformSource = (source, options) => {
|
|
1709
1621
|
if (source.includes("@rasputin-ignore-file")) return void 0;
|
|
1710
1622
|
if (sourceIsRasputinInstrumented(source)) return alreadyInstrumentedResult(source);
|
|
1711
|
-
const sourceFile =
|
|
1623
|
+
const sourceFile = ts8.createSourceFile(
|
|
1712
1624
|
options.filePath,
|
|
1713
1625
|
source,
|
|
1714
|
-
|
|
1626
|
+
ts8.ScriptTarget.Latest,
|
|
1715
1627
|
true,
|
|
1716
1628
|
scriptKindFor3(options.filePath)
|
|
1717
1629
|
);
|
|
@@ -1775,7 +1687,7 @@ var transformSource = (source, options) => {
|
|
|
1775
1687
|
collected.asyncFunction = true;
|
|
1776
1688
|
skipFunction(node, collected, "unsupported_async_generator");
|
|
1777
1689
|
}
|
|
1778
|
-
|
|
1690
|
+
ts8.forEachChild(node, (child) => visit(child, caller, depth + 1));
|
|
1779
1691
|
return;
|
|
1780
1692
|
}
|
|
1781
1693
|
if (isSyncGeneratorLike(node) && node.body) {
|
|
@@ -1787,10 +1699,10 @@ var transformSource = (source, options) => {
|
|
|
1787
1699
|
);
|
|
1788
1700
|
if (collected)
|
|
1789
1701
|
skipFunction(node, collected, "unsupported_sync_generator");
|
|
1790
|
-
|
|
1702
|
+
ts8.forEachChild(node, (child) => visit(child, caller, depth + 1));
|
|
1791
1703
|
return;
|
|
1792
1704
|
}
|
|
1793
|
-
if (
|
|
1705
|
+
if (ts8.isConstructorDeclaration(node) && node.body) {
|
|
1794
1706
|
const collected = collectWrappedFunction(
|
|
1795
1707
|
node,
|
|
1796
1708
|
sourceFile,
|
|
@@ -1799,13 +1711,13 @@ var transformSource = (source, options) => {
|
|
|
1799
1711
|
);
|
|
1800
1712
|
if (collected)
|
|
1801
1713
|
skipFunction(node, collected, "unsupported_constructor");
|
|
1802
|
-
|
|
1714
|
+
ts8.forEachChild(node, (child) => visit(child, caller, depth + 1));
|
|
1803
1715
|
return;
|
|
1804
1716
|
}
|
|
1805
1717
|
if (isSupportedFunction(node)) {
|
|
1806
1718
|
const collected = collectWrappedFunction(node, sourceFile, absolutePath, options.mapLocation);
|
|
1807
1719
|
if (!collected) {
|
|
1808
|
-
|
|
1720
|
+
ts8.forEachChild(node, (child) => visit(child, caller, depth + 1));
|
|
1809
1721
|
return;
|
|
1810
1722
|
}
|
|
1811
1723
|
if (options.decideFunction?.({
|
|
@@ -1814,7 +1726,7 @@ var transformSource = (source, options) => {
|
|
|
1814
1726
|
filePath: options.filePath,
|
|
1815
1727
|
name: collected.name
|
|
1816
1728
|
}) === "skip") {
|
|
1817
|
-
|
|
1729
|
+
ts8.forEachChild(node, (child) => visit(child, caller, depth + 1));
|
|
1818
1730
|
return;
|
|
1819
1731
|
}
|
|
1820
1732
|
const asyncFunction = isAsyncFunctionLike(node);
|
|
@@ -1822,7 +1734,7 @@ var transformSource = (source, options) => {
|
|
|
1822
1734
|
const decision = asyncFunction ? decideAsyncInstrumentation(node, sourceFile) : { action: "inline" };
|
|
1823
1735
|
if (decision.action === "skip") {
|
|
1824
1736
|
skipFunction(node, collected, decision.reason);
|
|
1825
|
-
|
|
1737
|
+
ts8.forEachChild(node, (child) => visit(child, caller, depth + 1));
|
|
1826
1738
|
return;
|
|
1827
1739
|
}
|
|
1828
1740
|
if (functionHasPreBodyParameterEvaluation(node)) {
|
|
@@ -1836,29 +1748,25 @@ var transformSource = (source, options) => {
|
|
|
1836
1748
|
});
|
|
1837
1749
|
delta.functions.push(collected);
|
|
1838
1750
|
rememberIdentity(node, collected);
|
|
1839
|
-
|
|
1751
|
+
ts8.forEachChild(node, (child) => visit(child, collected, depth + 1));
|
|
1840
1752
|
return;
|
|
1841
1753
|
}
|
|
1842
|
-
if (caller &&
|
|
1843
|
-
const site = collectCallSite(node, caller, collectContext);
|
|
1844
|
-
if (site) delta.callSites.push(site);
|
|
1845
|
-
}
|
|
1846
|
-
if (caller && ts9.isVariableDeclaration(node)) {
|
|
1754
|
+
if (caller && ts8.isVariableDeclaration(node)) {
|
|
1847
1755
|
const destructure = collectParamDestructure(node, caller, collectContext);
|
|
1848
1756
|
if (destructure) delta.destructures.push(destructure);
|
|
1849
1757
|
}
|
|
1850
|
-
|
|
1758
|
+
ts8.forEachChild(node, (child) => visit(child, caller, depth + 1));
|
|
1851
1759
|
};
|
|
1852
1760
|
visit(sourceFile, void 0, 0);
|
|
1853
1761
|
if (pending.length === 0) {
|
|
1854
1762
|
return delta.functions.length > 0 ? withDeclarations({ code: source, delta }) : void 0;
|
|
1855
1763
|
}
|
|
1856
1764
|
for (const [planIndex, entry] of pending.entries()) {
|
|
1857
|
-
const captured =
|
|
1765
|
+
const captured = ts8.isArrowFunction(entry.node) ? arrowArgsCapture(entry.node) : { args: "arguments", omitValues: false };
|
|
1858
1766
|
const omitArg = captured.omitValues ? ",true" : "";
|
|
1859
1767
|
const enterCall = `${runName}.enter(${planIndex},${captured.args}${omitArg})`;
|
|
1860
1768
|
const epilogue = failEpilogue(handleName, errorName, captured.args, entry.suspendResume);
|
|
1861
|
-
if (
|
|
1769
|
+
if (ts8.isBlock(entry.node.body)) {
|
|
1862
1770
|
const prologueAt = insertAfterSuperOrPrologue(entry.node.body, sourceFile);
|
|
1863
1771
|
const closeAt = entry.node.body.end - 1;
|
|
1864
1772
|
wrap(
|
|
@@ -1947,27 +1855,8 @@ var transformSource = (source, options) => {
|
|
|
1947
1855
|
});
|
|
1948
1856
|
};
|
|
1949
1857
|
|
|
1950
|
-
// ../instrumentation/src/json-producer-sites.ts
|
|
1951
|
-
import ts11 from "typescript";
|
|
1952
|
-
|
|
1953
|
-
// ../instrumentation/src/literal-sites.ts
|
|
1954
|
-
import ts12 from "typescript";
|
|
1955
|
-
|
|
1956
|
-
// ../instrumentation/src/observe-sites.ts
|
|
1957
|
-
import { propertyNameIsSensitive as propertyNameIsSensitive2 } from "@rasputin-ai/core";
|
|
1958
|
-
import ts13 from "typescript";
|
|
1959
|
-
|
|
1960
|
-
// ../instrumentation/src/verify-browser-source.ts
|
|
1961
|
-
import ts14 from "typescript";
|
|
1962
|
-
|
|
1963
|
-
// ../instrumentation/src/provenance-function-edits.ts
|
|
1964
|
-
import ts15 from "typescript";
|
|
1965
|
-
|
|
1966
|
-
// ../instrumentation/src/source-map-location.ts
|
|
1967
|
-
import { originalPositionFor as originalPositionFor3, TraceMap as TraceMap4 } from "@jridgewell/trace-mapping";
|
|
1968
|
-
|
|
1969
1858
|
// src/sdk-meta.ts
|
|
1970
|
-
var SDK_VERSION = "0.
|
|
1859
|
+
var SDK_VERSION = "1.0.0";
|
|
1971
1860
|
|
|
1972
1861
|
// src/auto-instrumentation/transform-disk-cache.ts
|
|
1973
1862
|
var projectCacheDir = () => {
|