@clayroach/effect-unplugin 4.0.0-effect4-transformer.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/dist/rollup.js ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Rollup plugin for Effect source location tracing.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * // rollup.config.js
7
+ * import effectSourceTrace from "@effect/unplugin/rollup"
8
+ *
9
+ * export default {
10
+ * plugins: [effectSourceTrace()]
11
+ * }
12
+ * ```
13
+ *
14
+ * @since 0.0.1
15
+ */
16
+ import unplugin from "./index.js";
17
+ export default unplugin.rollup;
18
+ //# sourceMappingURL=rollup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup.js","names":["unplugin","rollup"],"sources":["../src/rollup.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;AAeA,OAAOA,QAAQ,MAAM,YAAY;AAEjC,eAAeA,QAAQ,CAACC,MAAM","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import type { SourceTraceOptions } from "./types.ts";
2
+ /**
3
+ * @since 0.0.1
4
+ * @category models
5
+ */
6
+ export interface TransformResult {
7
+ readonly code: string;
8
+ readonly map?: unknown;
9
+ readonly transformed: boolean;
10
+ }
11
+ /**
12
+ * Transforms source code to inject source location tracing and span instrumentation.
13
+ *
14
+ * @since 0.0.1
15
+ * @category transform
16
+ */
17
+ export declare function transform(code: string, id: string, options?: SourceTraceOptions): TransformResult;
18
+ //# sourceMappingURL=sourceTrace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceTrace.d.ts","sourceRoot":"","sources":["../src/sourceTrace.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAEV,kBAAkB,EAGnB,MAAM,YAAY,CAAA;AAwJnB;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAA;CAC9B;AA4QD;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,kBAAuB,GAC/B,eAAe,CAsNjB"}
@@ -0,0 +1,451 @@
1
+ /**
2
+ * Core source trace transformer for Effect.gen yield* expressions.
3
+ *
4
+ * @since 0.0.1
5
+ */
6
+ import { parse } from "@babel/parser";
7
+ import * as _traverse from "@babel/traverse";
8
+ import * as _generate from "@babel/generator";
9
+ import * as t from "@babel/types";
10
+ function extractBabelExport(module) {
11
+ // Check if module is directly the export (ESM)
12
+ if (typeof module === "function") {
13
+ return module;
14
+ }
15
+ // Check for CJS default export
16
+ const moduleAsRecord = module;
17
+ if (moduleAsRecord.default !== undefined) {
18
+ if (typeof moduleAsRecord.default === "function") {
19
+ return moduleAsRecord.default;
20
+ }
21
+ // Check for double-wrapped default (CJS -> ESM -> CJS)
22
+ const defaultAsRecord = moduleAsRecord.default;
23
+ if (defaultAsRecord?.default !== undefined) {
24
+ return defaultAsRecord.default;
25
+ }
26
+ }
27
+ return module;
28
+ }
29
+ const traverse = /*#__PURE__*/extractBabelExport(_traverse);
30
+ const generate = /*#__PURE__*/extractBabelExport(_generate);
31
+ const ALL_INSTRUMENTABLE = ["gen", "fork", "forkDaemon", "forkScoped", "all", "forEach", "filter", "reduce", "iterate", "loop"];
32
+ /**
33
+ * Resolves which Effect combinators should be instrumented with spans.
34
+ */
35
+ function resolveInstrumentable(options) {
36
+ const include = options.include ?? ALL_INSTRUMENTABLE;
37
+ const exclude = new Set(options.exclude ?? []);
38
+ return new Set(include.filter(name => !exclude.has(name)));
39
+ }
40
+ /**
41
+ * Simple glob matcher for common patterns.
42
+ * Supports: *, **, path/to/file
43
+ * Normalizes paths by removing leading slashes for matching.
44
+ */
45
+ function matchesGlob(filepath, pattern) {
46
+ const normalizedPath = filepath.replace(/^\/+/, "");
47
+ const regexPattern = pattern.replace(/\./g, "\\.").replace(/\*\*/g, ".*").replace(/\*/g, "[^/]*");
48
+ const regex = new RegExp(`^${regexPattern}$`);
49
+ return regex.test(normalizedPath);
50
+ }
51
+ /**
52
+ * Checks if a file matches any of the given patterns.
53
+ */
54
+ function matchesAnyPattern(filepath, patterns) {
55
+ const patternArray = Array.isArray(patterns) ? patterns : [patterns];
56
+ return patternArray.some(pattern => matchesGlob(filepath, pattern));
57
+ }
58
+ /**
59
+ * Checks if a function name matches any regex pattern.
60
+ */
61
+ function matchesAnyRegex(functionName, patterns) {
62
+ const patternArray = Array.isArray(patterns) ? patterns : [patterns];
63
+ return patternArray.some(pattern => new RegExp(pattern).test(functionName));
64
+ }
65
+ /**
66
+ * Checks if instrumentation should be applied based on strategy.
67
+ */
68
+ function shouldInstrument(combinator, filepath, functionName, depth, options) {
69
+ const strategy = options.strategy;
70
+ if (!strategy) {
71
+ return true; // No strategy = instrument everything
72
+ }
73
+ if (strategy.type === "depth") {
74
+ const globalMax = strategy.maxDepth ?? Infinity;
75
+ const combinatorMax = strategy.perCombinator?.[combinator];
76
+ const effectiveMax = combinatorMax !== undefined ? combinatorMax : globalMax;
77
+ return depth <= effectiveMax;
78
+ }
79
+ if (strategy.type === "overrides") {
80
+ const filter = strategy.rules[combinator];
81
+ if (!filter) {
82
+ return true; // No override for this combinator = allow
83
+ }
84
+ // Check file filters
85
+ if (filter.files && !matchesAnyPattern(filepath, filter.files)) {
86
+ return false;
87
+ }
88
+ if (filter.excludeFiles && matchesAnyPattern(filepath, filter.excludeFiles)) {
89
+ return false;
90
+ }
91
+ // Check function filters
92
+ if (functionName) {
93
+ if (filter.functions && !matchesAnyRegex(functionName, filter.functions)) {
94
+ return false;
95
+ }
96
+ if (filter.excludeFunctions && matchesAnyRegex(functionName, filter.excludeFunctions)) {
97
+ return false;
98
+ }
99
+ }
100
+ return true;
101
+ }
102
+ return true;
103
+ }
104
+ /**
105
+ * Determines if a call expression is Effect.gen() or a named import gen().
106
+ */
107
+ function isEffectGenCall(node, effectImportName, genImportName) {
108
+ const callee = node.callee;
109
+ // Effect.gen(...)
110
+ if (t.isMemberExpression(callee) && t.isIdentifier(callee.object) && callee.object.name === effectImportName && t.isIdentifier(callee.property) && callee.property.name === "gen") {
111
+ return true;
112
+ }
113
+ // gen(...) from named import
114
+ if (t.isIdentifier(callee) && callee.name === genImportName) {
115
+ return true;
116
+ }
117
+ return false;
118
+ }
119
+ /**
120
+ * Extracts function name from a yield* argument expression.
121
+ */
122
+ function extractFunctionName(node) {
123
+ // foo()
124
+ if (t.isCallExpression(node) && t.isIdentifier(node.callee)) {
125
+ return node.callee.name;
126
+ }
127
+ // obj.method()
128
+ if (t.isCallExpression(node) && t.isMemberExpression(node.callee) && t.isIdentifier(node.callee.property)) {
129
+ return node.callee.property.name;
130
+ }
131
+ // Effect.succeed(...)
132
+ if (t.isCallExpression(node) && t.isMemberExpression(node.callee) && t.isIdentifier(node.callee.object) && t.isIdentifier(node.callee.property)) {
133
+ return `${node.callee.object.name}.${node.callee.property.name}`;
134
+ }
135
+ return "unknown";
136
+ }
137
+ /**
138
+ * Creates a hoisted StackFrame variable declaration.
139
+ */
140
+ function createStackFrameDeclaration(info) {
141
+ return t.variableDeclaration("const", [t.variableDeclarator(t.identifier(info.varName), t.objectExpression([t.objectProperty(t.identifier("name"), t.stringLiteral(info.name)), t.objectProperty(t.identifier("stack"), t.arrowFunctionExpression([], t.stringLiteral(info.location))), t.objectProperty(t.identifier("parent"), t.identifier("undefined"))]))]);
142
+ }
143
+ /**
144
+ * Wraps a yield* argument with Effect.updateService.
145
+ */
146
+ function wrapWithUpdateService(argument, frameVarName, effectImportName, referencesImportName) {
147
+ return t.callExpression(t.memberExpression(t.identifier(effectImportName), t.identifier("updateService")), [argument, t.memberExpression(t.identifier(referencesImportName), t.identifier("CurrentStackFrame")), t.arrowFunctionExpression([t.identifier("parent")], t.objectExpression([t.spreadElement(t.identifier(frameVarName)), t.objectProperty(t.identifier("parent"), t.identifier("parent"))]))]);
148
+ }
149
+ /**
150
+ * Gets the variable/function name from the AST context.
151
+ * Handles multiple patterns: direct assignment, arrow functions, object properties, function declarations.
152
+ */
153
+ function getAssignedVariableName(path) {
154
+ const parent = path.parent;
155
+ // Case 1: const program = Effect.gen(...)
156
+ if (t.isVariableDeclarator(parent) && t.isIdentifier(parent.id)) {
157
+ return parent.id.name;
158
+ }
159
+ // Case 2: const fetchUser = (id) => Effect.gen(...)
160
+ if (t.isArrowFunctionExpression(parent)) {
161
+ const grandparent = path.parentPath?.parent;
162
+ if (t.isVariableDeclarator(grandparent) && t.isIdentifier(grandparent.id)) {
163
+ return grandparent.id.name;
164
+ }
165
+ }
166
+ // Case 3: { fetchUser: Effect.gen(...) }
167
+ if (t.isObjectProperty(parent) && t.isIdentifier(parent.key)) {
168
+ return parent.key.name;
169
+ }
170
+ // Case 4: function fetchUser() { return Effect.gen(...) }
171
+ if (t.isReturnStatement(parent)) {
172
+ const funcParent = path.parentPath?.parentPath?.parent;
173
+ if (t.isFunctionDeclaration(funcParent) && funcParent.id) {
174
+ return funcParent.id.name;
175
+ }
176
+ }
177
+ return null;
178
+ }
179
+ /**
180
+ * Formats span name based on the nameFormat option.
181
+ */
182
+ function formatSpanName(combinator, functionName, filename, line, format) {
183
+ switch (format) {
184
+ case "function":
185
+ return functionName ? `${combinator} (${functionName})` : combinator;
186
+ case "location":
187
+ return `${combinator} (${filename}:${line})`;
188
+ case "full":
189
+ return functionName ? `${combinator} (${functionName} @ ${filename}:${line})` : `${combinator} (${filename}:${line})`;
190
+ }
191
+ }
192
+ /**
193
+ * Wraps an expression with Effect.withSpan() and attributes.
194
+ */
195
+ function wrapWithSpan(expr, spanName, effectImportName, attrs) {
196
+ const attributesObject = t.objectExpression([t.objectProperty(t.stringLiteral("code.filepath"), t.stringLiteral(attrs.filepath)), t.objectProperty(t.stringLiteral("code.lineno"), t.numericLiteral(attrs.line)), t.objectProperty(t.stringLiteral("code.column"), t.numericLiteral(attrs.column)), t.objectProperty(t.stringLiteral("code.function"), t.stringLiteral(attrs.functionName))]);
197
+ const optionsObject = t.objectExpression([t.objectProperty(t.identifier("attributes"), attributesObject)]);
198
+ return t.callExpression(t.memberExpression(t.identifier(effectImportName), t.identifier("withSpan")), [expr, t.stringLiteral(spanName), optionsObject]);
199
+ }
200
+ /**
201
+ * Finds or creates the Effect namespace import name.
202
+ */
203
+ function findOrGetEffectImport(ast) {
204
+ let effectName = null;
205
+ let genName = null;
206
+ for (const node of ast.program.body) {
207
+ if (!t.isImportDeclaration(node)) continue;
208
+ if (node.source.value !== "effect") continue;
209
+ for (const specifier of node.specifiers) {
210
+ // import * as Effect from "effect" or import { Effect } from "effect"
211
+ if (t.isImportNamespaceSpecifier(specifier)) {
212
+ effectName = specifier.local.name;
213
+ } else if (t.isImportSpecifier(specifier)) {
214
+ const imported = t.isIdentifier(specifier.imported) ? specifier.imported.name : specifier.imported.value;
215
+ if (imported === "Effect") {
216
+ effectName = specifier.local.name;
217
+ } else if (imported === "gen") {
218
+ genName = specifier.local.name;
219
+ }
220
+ }
221
+ }
222
+ }
223
+ return {
224
+ effectName: effectName ?? "Effect",
225
+ genName
226
+ };
227
+ }
228
+ /**
229
+ * Ensures References is imported from effect.
230
+ */
231
+ function ensureReferencesImport(ast) {
232
+ for (const node of ast.program.body) {
233
+ if (!t.isImportDeclaration(node)) continue;
234
+ if (node.source.value !== "effect") continue;
235
+ for (const specifier of node.specifiers) {
236
+ if (t.isImportSpecifier(specifier)) {
237
+ const imported = t.isIdentifier(specifier.imported) ? specifier.imported.name : specifier.imported.value;
238
+ if (imported === "References") {
239
+ return specifier.local.name;
240
+ }
241
+ }
242
+ }
243
+ // Add References to existing effect import
244
+ node.specifiers.push(t.importSpecifier(t.identifier("References"), t.identifier("References")));
245
+ return "References";
246
+ }
247
+ // No effect import found - add one (unlikely scenario)
248
+ const importDecl = t.importDeclaration([t.importSpecifier(t.identifier("References"), t.identifier("References"))], t.stringLiteral("effect"));
249
+ ast.program.body.unshift(importDecl);
250
+ return "References";
251
+ }
252
+ /**
253
+ * Extracts the filename from a full path.
254
+ */
255
+ function getFileName(filePath) {
256
+ const parts = filePath.split("/");
257
+ return parts[parts.length - 1] ?? filePath;
258
+ }
259
+ /**
260
+ * Transforms source code to inject source location tracing and span instrumentation.
261
+ *
262
+ * @since 0.0.1
263
+ * @category transform
264
+ */
265
+ export function transform(code, id, options = {}) {
266
+ const enableSourceTrace = options.sourceTrace !== false;
267
+ const extractFnName = options.extractFunctionName !== false;
268
+ const spanOptions = options.spans;
269
+ const enableSpans = spanOptions?.enabled === true;
270
+ let ast;
271
+ try {
272
+ ast = parse(code, {
273
+ sourceType: "module",
274
+ plugins: ["typescript", "jsx"],
275
+ sourceFilename: id
276
+ });
277
+ } catch {
278
+ return {
279
+ code,
280
+ transformed: false
281
+ };
282
+ }
283
+ const {
284
+ effectName,
285
+ genName
286
+ } = findOrGetEffectImport(ast);
287
+ // No Effect import found
288
+ if (!effectName && !genName) {
289
+ return {
290
+ code,
291
+ transformed: false
292
+ };
293
+ }
294
+ let hasTransformed = false;
295
+ const fileName = getFileName(id);
296
+ // Span instrumentation pass
297
+ if (enableSpans && effectName) {
298
+ const instrumentable = resolveInstrumentable(spanOptions);
299
+ const nameFormat = spanOptions.nameFormat ?? "function";
300
+ const wrappedNodes = new WeakSet();
301
+ const depthMap = new WeakMap();
302
+ // Calculate depth for each node
303
+ traverse(ast, {
304
+ CallExpression(path) {
305
+ const callee = path.node.callee;
306
+ if (t.isMemberExpression(callee) && t.isIdentifier(callee.object) && callee.object.name === effectName && t.isIdentifier(callee.property) && instrumentable.has(callee.property.name)) {
307
+ // Find parent Effect call depth
308
+ let depth = 0;
309
+ let currentPath = path.parentPath;
310
+ while (currentPath) {
311
+ const node = currentPath.node;
312
+ if (t.isCallExpression(node) && depthMap.has(node)) {
313
+ depth = (depthMap.get(node) ?? 0) + 1;
314
+ break;
315
+ }
316
+ currentPath = currentPath.parentPath;
317
+ }
318
+ depthMap.set(path.node, depth);
319
+ }
320
+ }
321
+ });
322
+ // Instrument nodes that pass filters
323
+ traverse(ast, {
324
+ CallExpression(path) {
325
+ if (wrappedNodes.has(path.node)) return;
326
+ const callee = path.node.callee;
327
+ if (!t.isMemberExpression(callee)) return;
328
+ if (!t.isIdentifier(callee.object) || callee.object.name !== effectName) return;
329
+ if (!t.isIdentifier(callee.property)) return;
330
+ const methodName = callee.property.name;
331
+ if (!instrumentable.has(methodName)) return;
332
+ const loc = path.node.loc;
333
+ if (!loc) return;
334
+ const variableName = getAssignedVariableName(path);
335
+ const depth = depthMap.get(path.node) ?? 0;
336
+ // Check if instrumentation should be applied
337
+ if (!shouldInstrument(methodName, id, variableName, depth, spanOptions)) {
338
+ return;
339
+ }
340
+ const combinator = `effect.${methodName}`;
341
+ const functionName = variableName ?? combinator;
342
+ const spanName = formatSpanName(combinator, variableName, fileName, loc.start.line, nameFormat);
343
+ const attrs = {
344
+ filepath: id,
345
+ line: loc.start.line,
346
+ column: loc.start.column,
347
+ functionName
348
+ };
349
+ const wrapped = wrapWithSpan(path.node, spanName, effectName, attrs);
350
+ wrappedNodes.add(path.node);
351
+ path.replaceWith(wrapped);
352
+ hasTransformed = true;
353
+ }
354
+ });
355
+ }
356
+ // Source trace pass
357
+ if (enableSourceTrace) {
358
+ const framesByLocation = new Map();
359
+ let frameCounter = 0;
360
+ // First pass: collect all yield* locations and create frame info
361
+ traverse(ast, {
362
+ CallExpression(path) {
363
+ if (!isEffectGenCall(path.node, effectName, genName)) return;
364
+ const generatorArg = path.node.arguments[0];
365
+ if (!t.isFunctionExpression(generatorArg) || !generatorArg.generator) return;
366
+ path.traverse({
367
+ // Skip nested Effect.gen calls to avoid processing their yield* twice
368
+ CallExpression(nestedPath) {
369
+ if (isEffectGenCall(nestedPath.node, effectName, genName)) {
370
+ nestedPath.skip();
371
+ }
372
+ },
373
+ YieldExpression(yieldPath) {
374
+ // Only process yield* (delegate)
375
+ if (!yieldPath.node.delegate || !yieldPath.node.argument) return;
376
+ const loc = yieldPath.node.loc;
377
+ if (!loc) return;
378
+ const location = `${id}:${loc.start.line}:${loc.start.column}`;
379
+ if (!framesByLocation.has(location)) {
380
+ const name = extractFnName ? extractFunctionName(yieldPath.node.argument) : "effect";
381
+ const varName = `_sf${frameCounter++}`;
382
+ const info = {
383
+ name,
384
+ location,
385
+ varName
386
+ };
387
+ framesByLocation.set(location, info);
388
+ }
389
+ }
390
+ });
391
+ }
392
+ });
393
+ if (framesByLocation.size > 0) {
394
+ const referencesName = ensureReferencesImport(ast);
395
+ // Second pass: wrap yield* expressions
396
+ traverse(ast, {
397
+ CallExpression(path) {
398
+ if (!isEffectGenCall(path.node, effectName, genName)) return;
399
+ const generatorArg = path.node.arguments[0];
400
+ if (!t.isFunctionExpression(generatorArg) || !generatorArg.generator) return;
401
+ path.traverse({
402
+ // Skip nested Effect.gen calls to avoid processing their yield* twice
403
+ CallExpression(nestedPath) {
404
+ if (isEffectGenCall(nestedPath.node, effectName, genName)) {
405
+ nestedPath.skip();
406
+ }
407
+ },
408
+ YieldExpression(yieldPath) {
409
+ if (!yieldPath.node.delegate || !yieldPath.node.argument) return;
410
+ const loc = yieldPath.node.loc;
411
+ if (!loc) return;
412
+ const location = `${id}:${loc.start.line}:${loc.start.column}`;
413
+ const frame = framesByLocation.get(location);
414
+ if (!frame) return;
415
+ const wrapped = wrapWithUpdateService(yieldPath.node.argument, frame.varName, effectName, referencesName);
416
+ yieldPath.node.argument = wrapped;
417
+ hasTransformed = true;
418
+ }
419
+ });
420
+ }
421
+ });
422
+ // Insert hoisted frame declarations after imports
423
+ const frameDeclarations = Array.from(framesByLocation.values()).map(createStackFrameDeclaration);
424
+ let insertIndex = 0;
425
+ for (let i = 0; i < ast.program.body.length; i++) {
426
+ if (!t.isImportDeclaration(ast.program.body[i])) {
427
+ insertIndex = i;
428
+ break;
429
+ }
430
+ insertIndex = i + 1;
431
+ }
432
+ ast.program.body.splice(insertIndex, 0, ...frameDeclarations);
433
+ }
434
+ }
435
+ if (!hasTransformed) {
436
+ return {
437
+ code,
438
+ transformed: false
439
+ };
440
+ }
441
+ const result = generate(ast, {
442
+ sourceMaps: true,
443
+ sourceFileName: id
444
+ }, code);
445
+ return {
446
+ code: result.code,
447
+ map: result.map,
448
+ transformed: true
449
+ };
450
+ }
451
+ //# sourceMappingURL=sourceTrace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceTrace.js","names":["parse","_traverse","_generate","t","extractBabelExport","module","moduleAsRecord","default","undefined","defaultAsRecord","traverse","generate","ALL_INSTRUMENTABLE","resolveInstrumentable","options","include","exclude","Set","filter","name","has","matchesGlob","filepath","pattern","normalizedPath","replace","regexPattern","regex","RegExp","test","matchesAnyPattern","patterns","patternArray","Array","isArray","some","matchesAnyRegex","functionName","shouldInstrument","combinator","depth","strategy","type","globalMax","maxDepth","Infinity","combinatorMax","perCombinator","effectiveMax","rules","files","excludeFiles","functions","excludeFunctions","isEffectGenCall","node","effectImportName","genImportName","callee","isMemberExpression","isIdentifier","object","property","extractFunctionName","isCallExpression","createStackFrameDeclaration","info","variableDeclaration","variableDeclarator","identifier","varName","objectExpression","objectProperty","stringLiteral","arrowFunctionExpression","location","wrapWithUpdateService","argument","frameVarName","referencesImportName","callExpression","memberExpression","spreadElement","getAssignedVariableName","path","parent","isVariableDeclarator","id","isArrowFunctionExpression","grandparent","parentPath","isObjectProperty","key","isReturnStatement","funcParent","isFunctionDeclaration","formatSpanName","filename","line","format","wrapWithSpan","expr","spanName","attrs","attributesObject","numericLiteral","column","optionsObject","findOrGetEffectImport","ast","effectName","genName","program","body","isImportDeclaration","source","value","specifier","specifiers","isImportNamespaceSpecifier","local","isImportSpecifier","imported","ensureReferencesImport","push","importSpecifier","importDecl","importDeclaration","unshift","getFileName","filePath","parts","split","length","transform","code","enableSourceTrace","sourceTrace","extractFnName","spanOptions","spans","enableSpans","enabled","sourceType","plugins","sourceFilename","transformed","hasTransformed","fileName","instrumentable","nameFormat","wrappedNodes","WeakSet","depthMap","WeakMap","CallExpression","currentPath","get","set","methodName","loc","variableName","start","wrapped","add","replaceWith","framesByLocation","Map","frameCounter","generatorArg","arguments","isFunctionExpression","generator","nestedPath","skip","YieldExpression","yieldPath","delegate","size","referencesName","frame","frameDeclarations","from","values","map","insertIndex","i","splice","result","sourceMaps","sourceFileName"],"sources":["../src/sourceTrace.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA,SAASA,KAAK,QAAQ,eAAe;AACrC,OAAO,KAAKC,SAAS,MAAM,iBAAiB;AAC5C,OAAO,KAAKC,SAAS,MAAM,kBAAkB;AAC7C,OAAO,KAAKC,CAAC,MAAM,cAAc;AAyBjC,SAASC,kBAAkBA,CAAIC,MAAsB;EACnD;EACA,IAAI,OAAOA,MAAM,KAAK,UAAU,EAAE;IAChC,OAAOA,MAAM;EACf;EACA;EACA,MAAMC,cAAc,GAAGD,MAAiC;EACxD,IAAIC,cAAc,CAACC,OAAO,KAAKC,SAAS,EAAE;IACxC,IAAI,OAAOF,cAAc,CAACC,OAAO,KAAK,UAAU,EAAE;MAChD,OAAOD,cAAc,CAACC,OAAY;IACpC;IACA;IACA,MAAME,eAAe,GAAGH,cAAc,CAACC,OAAkC;IACzE,IAAIE,eAAe,EAAEF,OAAO,KAAKC,SAAS,EAAE;MAC1C,OAAOC,eAAe,CAACF,OAAY;IACrC;EACF;EACA,OAAOF,MAAW;AACpB;AAEA,MAAMK,QAAQ,gBAAeN,kBAAkB,CAAaH,SAAoC,CAAC;AACjG,MAAMU,QAAQ,gBAAeP,kBAAkB,CAAaF,SAAoC,CAAC;AAejG,MAAMU,kBAAkB,GAAwC,CAC9D,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CACnG;AAED;;;AAGA,SAASC,qBAAqBA,CAACC,OAAmC;EAChE,MAAMC,OAAO,GAAGD,OAAO,CAACC,OAAO,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,EAAEA,CAAC,GAAG7E,GAAG,CAACG,OAAO,CAACC,IAAI,CAACoB,MAAM,EAAEqD,CAAC,EAAE,EAAE;QAChD,IAAI,CAACvL,CAAC,CAAC+G,mBAAmB,CAACL,GAAG,CAACG,OAAO,CAACC,IAAI,CAACyE,CAAC,CAAC,CAAC,EAAE;UAC/CD,WAAW,GAAGC,CAAC;UACf;QACF;QACAD,WAAW,GAAGC,CAAC,GAAG,CAAC;MACrB;MACA7E,GAAG,CAACG,OAAO,CAACC,IAAI,CAAC0E,MAAM,CAACF,WAAW,EAAE,CAAC,EAAE,GAAGJ,iBAAiB,CAAC;IAC/D;EACF;EAEA,IAAI,CAAClC,cAAc,EAAE;IACnB,OAAO;MAAEZ,IAAI;MAAEW,WAAW,EAAE;IAAK,CAAE;EACrC;EAEA,MAAM0C,MAAM,GAAGjL,QAAQ,CAACkG,GAAG,EAAE;IAC3BgF,UAAU,EAAE,IAAI;IAChBC,cAAc,EAAEvG;GACjB,EAAEgD,IAAI,CAAC;EAER,OAAO;IACLA,IAAI,EAAEqD,MAAM,CAACrD,IAAI;IACjBiD,GAAG,EAAEI,MAAM,CAACJ,GAAG;IACftC,WAAW,EAAE;GACd;AACH","ignoreList":[]}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * @since 0.0.1
3
+ */
4
+ /**
5
+ * Filter pattern for file matching.
6
+ *
7
+ * @since 0.0.1
8
+ * @category models
9
+ */
10
+ export type FilterPattern = string | RegExp | ReadonlyArray<string | RegExp>;
11
+ /**
12
+ * Effect combinators that can be auto-instrumented with spans.
13
+ *
14
+ * @since 0.0.1
15
+ * @category models
16
+ */
17
+ export type InstrumentableEffect = "gen" | "fork" | "forkDaemon" | "forkScoped" | "all" | "forEach" | "filter" | "reduce" | "iterate" | "loop";
18
+ /**
19
+ * Span name format options.
20
+ *
21
+ * @since 0.0.1
22
+ * @category models
23
+ */
24
+ export type SpanNameFormat = "function" | "location" | "full";
25
+ /**
26
+ * File/function filtering for a specific combinator.
27
+ *
28
+ * @since 0.0.1
29
+ * @category models
30
+ */
31
+ export interface CombinatorFilter {
32
+ /**
33
+ * File glob patterns to include (single or array)
34
+ */
35
+ readonly files?: string | ReadonlyArray<string> | undefined;
36
+ /**
37
+ * File glob patterns to exclude (single or array)
38
+ */
39
+ readonly excludeFiles?: string | ReadonlyArray<string> | undefined;
40
+ /**
41
+ * Function name regex patterns to include (single or array)
42
+ */
43
+ readonly functions?: string | ReadonlyArray<string> | undefined;
44
+ /**
45
+ * Function name regex patterns to exclude (single or array)
46
+ */
47
+ readonly excludeFunctions?: string | ReadonlyArray<string> | undefined;
48
+ }
49
+ /**
50
+ * Depth-based instrumentation strategy.
51
+ *
52
+ * @since 0.0.1
53
+ * @category models
54
+ */
55
+ export interface DepthInstrumentationStrategy {
56
+ readonly type: "depth";
57
+ /**
58
+ * Global max nesting depth for all combinators (default: Infinity)
59
+ * 0 = top-level only, 1 = one level deep, etc.
60
+ */
61
+ readonly maxDepth?: number | undefined;
62
+ /**
63
+ * Per-combinator depth limits (overrides maxDepth)
64
+ */
65
+ readonly perCombinator?: Partial<Record<InstrumentableEffect, number>> | undefined;
66
+ }
67
+ /**
68
+ * Override-based instrumentation strategy with file/function filtering.
69
+ *
70
+ * @since 0.0.1
71
+ * @category models
72
+ */
73
+ export interface OverrideInstrumentationStrategy {
74
+ readonly type: "overrides";
75
+ /**
76
+ * Per-combinator filter rules
77
+ */
78
+ readonly rules: Partial<Record<InstrumentableEffect, CombinatorFilter>>;
79
+ }
80
+ /**
81
+ * Options for auto-instrumentation with withSpan.
82
+ *
83
+ * @since 0.0.1
84
+ * @category models
85
+ */
86
+ export interface SpanInstrumentationOptions {
87
+ /**
88
+ * Enable auto-instrumentation with withSpan.
89
+ * @default false
90
+ */
91
+ readonly enabled?: boolean | undefined;
92
+ /**
93
+ * Effect combinators to instrument. Defaults to all supported combinators.
94
+ */
95
+ readonly include?: ReadonlyArray<InstrumentableEffect> | undefined;
96
+ /**
97
+ * Effect combinators to exclude from instrumentation.
98
+ */
99
+ readonly exclude?: ReadonlyArray<InstrumentableEffect> | undefined;
100
+ /**
101
+ * Span name format.
102
+ * - "function": `effect.gen (fetchUser)` - combinator + function name (DEFAULT)
103
+ * - "location": `effect.gen (index.ts:23)` - combinator + file:line
104
+ * - "full": `effect.gen (fetchUser @ index.ts:23)` - all info
105
+ * @default "function"
106
+ */
107
+ readonly nameFormat?: SpanNameFormat | undefined;
108
+ /**
109
+ * Instrumentation strategy for fine-grained control.
110
+ * - depth: Limit by nesting depth
111
+ * - overrides: File/function filtering per combinator
112
+ */
113
+ readonly strategy?: DepthInstrumentationStrategy | OverrideInstrumentationStrategy | undefined;
114
+ }
115
+ /**
116
+ * Options for the source trace transformer plugin.
117
+ *
118
+ * @since 0.0.1
119
+ * @category models
120
+ */
121
+ export interface SourceTraceOptions {
122
+ /**
123
+ * Files to include in transformation. Defaults to TypeScript/JavaScript files.
124
+ */
125
+ readonly include?: FilterPattern | undefined;
126
+ /**
127
+ * Files to exclude from transformation. Defaults to node_modules.
128
+ */
129
+ readonly exclude?: FilterPattern | undefined;
130
+ /**
131
+ * Extract function name from yield* expression for the stack frame.
132
+ * @default true
133
+ */
134
+ readonly extractFunctionName?: boolean | undefined;
135
+ /**
136
+ * Enable yield* source tracing with CurrentStackFrame.
137
+ * @default true
138
+ */
139
+ readonly sourceTrace?: boolean | undefined;
140
+ /**
141
+ * Auto-instrumentation options for wrapping Effect combinators with withSpan.
142
+ */
143
+ readonly spans?: SpanInstrumentationOptions | undefined;
144
+ }
145
+ //# sourceMappingURL=types.d.ts.map