@bitfab/sdk 0.65.3 → 0.65.5

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.
Files changed (170) hide show
  1. package/dist/autoTrace-CZu0BXhG.js +270 -0
  2. package/dist/autoTrace-CZu0BXhG.js.map +1 -0
  3. package/dist/autoTrace-KM9pYqk9.cjs +395 -0
  4. package/dist/autoTrace-KM9pYqk9.cjs.map +1 -0
  5. package/dist/autoTrace.cjs +15 -353
  6. package/dist/autoTrace.d.cts +44 -44
  7. package/dist/autoTrace.d.ts +44 -44
  8. package/dist/autoTrace.js +1 -28
  9. package/dist/babelPlugin-C70OxrqA.js +209 -0
  10. package/dist/babelPlugin-C70OxrqA.js.map +1 -0
  11. package/dist/babelPlugin-Nta4-VcL.cjs +232 -0
  12. package/dist/babelPlugin-Nta4-VcL.cjs.map +1 -0
  13. package/dist/http-CG1Irqxx.js +2154 -0
  14. package/dist/http-CG1Irqxx.js.map +1 -0
  15. package/dist/index-BFkAwvuc.d.cts +4410 -0
  16. package/dist/index-BFkAwvuc.d.ts +4410 -0
  17. package/dist/index.cjs +48 -12501
  18. package/dist/index.d.cts +2 -4426
  19. package/dist/index.d.ts +2 -4426
  20. package/dist/index.js +3 -96
  21. package/dist/loaderRuntime-0huddOOP.d.ts +12 -0
  22. package/dist/loaderRuntime-CslfDFO7.d.cts +12 -0
  23. package/dist/node.cjs +56 -12517
  24. package/dist/node.cjs.map +1 -1
  25. package/dist/node.d.cts +2 -1
  26. package/dist/node.d.ts +2 -1
  27. package/dist/node.js +10 -105
  28. package/dist/node.js.map +1 -1
  29. package/dist/registryCommand-Di8x0YoJ.js +1111 -0
  30. package/dist/registryCommand-Di8x0YoJ.js.map +1 -0
  31. package/dist/replayCli.js +49 -87
  32. package/dist/replayCli.js.map +1 -1
  33. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  34. package/dist/seedCli.js +10 -24
  35. package/dist/seedCli.js.map +1 -1
  36. package/dist/src-BRKm0P_S.cjs +8434 -0
  37. package/dist/src-BRKm0P_S.cjs.map +1 -0
  38. package/dist/src-CfFkki5l.js +6011 -0
  39. package/dist/src-CfFkki5l.js.map +1 -0
  40. package/dist/transform/babel.cjs +5 -422
  41. package/dist/transform/babel.d.cts +16 -16
  42. package/dist/transform/babel.d.ts +16 -16
  43. package/dist/transform/babel.js +1 -7
  44. package/dist/transform/bun.cjs +9 -478
  45. package/dist/transform/bun.cjs.map +1 -1
  46. package/dist/transform/bun.d.cts +5 -7
  47. package/dist/transform/bun.d.ts +5 -7
  48. package/dist/transform/bun.js +6 -11
  49. package/dist/transform/bun.js.map +1 -1
  50. package/dist/transform/esbuild.cjs +9 -478
  51. package/dist/transform/esbuild.cjs.map +1 -1
  52. package/dist/transform/esbuild.d.cts +5 -7
  53. package/dist/transform/esbuild.d.ts +5 -7
  54. package/dist/transform/esbuild.js +6 -11
  55. package/dist/transform/esbuild.js.map +1 -1
  56. package/dist/transform/loaderRuntime.cjs +85 -532
  57. package/dist/transform/loaderRuntime.cjs.map +1 -1
  58. package/dist/transform/loaderRuntime.d.cts +2 -12
  59. package/dist/transform/loaderRuntime.d.ts +2 -12
  60. package/dist/transform/loaderRuntime.js +56 -98
  61. package/dist/transform/loaderRuntime.js.map +1 -1
  62. package/dist/transform/nest.cjs +12 -481
  63. package/dist/transform/nest.cjs.map +1 -1
  64. package/dist/transform/nest.d.cts +8 -9
  65. package/dist/transform/nest.d.ts +8 -9
  66. package/dist/transform/nest.js +9 -14
  67. package/dist/transform/nest.js.map +1 -1
  68. package/dist/transform/next.cjs +56 -528
  69. package/dist/transform/next.cjs.map +1 -1
  70. package/dist/transform/next.d.cts +25 -25
  71. package/dist/transform/next.d.ts +24 -24
  72. package/dist/transform/next.js +52 -60
  73. package/dist/transform/next.js.map +1 -1
  74. package/dist/transform/nodeLoader.js +260 -506
  75. package/dist/transform/nodeLoader.js.map +1 -1
  76. package/dist/transform/register.js +4 -1
  77. package/dist/transform/register.js.map +1 -1
  78. package/dist/transform/rolldown.cjs +9 -478
  79. package/dist/transform/rolldown.cjs.map +1 -1
  80. package/dist/transform/rolldown.d.cts +5 -7
  81. package/dist/transform/rolldown.d.ts +5 -7
  82. package/dist/transform/rolldown.js +6 -11
  83. package/dist/transform/rolldown.js.map +1 -1
  84. package/dist/transform/rollup.cjs +9 -478
  85. package/dist/transform/rollup.cjs.map +1 -1
  86. package/dist/transform/rollup.d.cts +5 -7
  87. package/dist/transform/rollup.d.ts +5 -7
  88. package/dist/transform/rollup.js +6 -11
  89. package/dist/transform/rollup.js.map +1 -1
  90. package/dist/transform/rsbuild.cjs +9 -478
  91. package/dist/transform/rsbuild.cjs.map +1 -1
  92. package/dist/transform/rsbuild.d.cts +5 -7
  93. package/dist/transform/rsbuild.d.ts +5 -7
  94. package/dist/transform/rsbuild.js +6 -11
  95. package/dist/transform/rsbuild.js.map +1 -1
  96. package/dist/transform/rspack.cjs +9 -478
  97. package/dist/transform/rspack.cjs.map +1 -1
  98. package/dist/transform/rspack.d.cts +5 -7
  99. package/dist/transform/rspack.d.ts +5 -7
  100. package/dist/transform/rspack.js +6 -11
  101. package/dist/transform/rspack.js.map +1 -1
  102. package/dist/transform/swc.cjs +18 -486
  103. package/dist/transform/swc.cjs.map +1 -1
  104. package/dist/transform/swc.d.cts +15 -14
  105. package/dist/transform/swc.d.ts +15 -14
  106. package/dist/transform/swc.js +14 -32
  107. package/dist/transform/swc.js.map +1 -1
  108. package/dist/transform/unplugin.cjs +20 -476
  109. package/dist/transform/unplugin.cjs.map +1 -1
  110. package/dist/transform/unplugin.d.cts +4 -6
  111. package/dist/transform/unplugin.d.ts +4 -6
  112. package/dist/transform/unplugin.js +19 -8
  113. package/dist/transform/unplugin.js.map +1 -1
  114. package/dist/transform/vite.cjs +9 -478
  115. package/dist/transform/vite.cjs.map +1 -1
  116. package/dist/transform/vite.d.cts +5 -7
  117. package/dist/transform/vite.d.ts +5 -7
  118. package/dist/transform/vite.js +6 -11
  119. package/dist/transform/vite.js.map +1 -1
  120. package/dist/transform/webpack.cjs +9 -478
  121. package/dist/transform/webpack.cjs.map +1 -1
  122. package/dist/transform/webpack.d.cts +5 -7
  123. package/dist/transform/webpack.d.ts +5 -7
  124. package/dist/transform/webpack.js +6 -11
  125. package/dist/transform/webpack.js.map +1 -1
  126. package/dist/transform-BcyUocwm.js +36 -0
  127. package/dist/transform-BcyUocwm.js.map +1 -0
  128. package/dist/transform-BjxHGGKc.cjs +47 -0
  129. package/dist/transform-BjxHGGKc.cjs.map +1 -0
  130. package/dist/transformOptions-BsjCELkh.d.cts +11 -0
  131. package/dist/transformOptions-BsjCELkh.d.ts +11 -0
  132. package/package.json +5 -5
  133. package/dist/autoTrace.cjs.map +0 -1
  134. package/dist/autoTrace.js.map +0 -1
  135. package/dist/chunk-BRMGNMDO.js +0 -1176
  136. package/dist/chunk-BRMGNMDO.js.map +0 -1
  137. package/dist/chunk-CLP2L5PU.js +0 -2547
  138. package/dist/chunk-CLP2L5PU.js.map +0 -1
  139. package/dist/chunk-HLH7TN2A.js +0 -2060
  140. package/dist/chunk-HLH7TN2A.js.map +0 -1
  141. package/dist/chunk-LCV2JYXL.js +0 -2979
  142. package/dist/chunk-LCV2JYXL.js.map +0 -1
  143. package/dist/chunk-MT36GJMW.js +0 -106
  144. package/dist/chunk-MT36GJMW.js.map +0 -1
  145. package/dist/chunk-NRE5CJPR.js +0 -6874
  146. package/dist/chunk-NRE5CJPR.js.map +0 -1
  147. package/dist/chunk-PTCLRG4E.js +0 -28
  148. package/dist/chunk-PTCLRG4E.js.map +0 -1
  149. package/dist/chunk-QRNHRY7F.js +0 -270
  150. package/dist/chunk-QRNHRY7F.js.map +0 -1
  151. package/dist/chunk-YVJAOGHE.js +0 -45
  152. package/dist/chunk-YVJAOGHE.js.map +0 -1
  153. package/dist/chunk-Z26K57WZ.js +0 -1912
  154. package/dist/chunk-Z26K57WZ.js.map +0 -1
  155. package/dist/chunk-ZG6SHKEF.js +0 -404
  156. package/dist/chunk-ZG6SHKEF.js.map +0 -1
  157. package/dist/http-VN52X47M.js +0 -24
  158. package/dist/http-VN52X47M.js.map +0 -1
  159. package/dist/http-WP4YPPKC.js +0 -23
  160. package/dist/http-WP4YPPKC.js.map +0 -1
  161. package/dist/index.cjs.map +0 -1
  162. package/dist/index.js.map +0 -1
  163. package/dist/replay-463SEV53.js +0 -28
  164. package/dist/replay-463SEV53.js.map +0 -1
  165. package/dist/replay-OT4A4HVF.js +0 -29
  166. package/dist/replay-OT4A4HVF.js.map +0 -1
  167. package/dist/transform/babel.cjs.map +0 -1
  168. package/dist/transform/babel.js.map +0 -1
  169. package/dist/transformOptions-Df2_Chtc.d.cts +0 -10
  170. package/dist/transformOptions-Df2_Chtc.d.ts +0 -10
@@ -1,423 +1,6 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // ../bitfab-typescript-transform/src/babelPlugin.ts
21
- var babelPlugin_exports = {};
22
- __export(babelPlugin_exports, {
23
- default: () => bitfabBabelPlugin
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
24
4
  });
25
- module.exports = __toCommonJS(babelPlugin_exports);
26
-
27
- // ../bitfab-typescript-transform/src/transformOptions.ts
28
- var AUTO_TRACE_FUNCTION_ID_VERSION = "ts-auto-v1";
29
- var AUTO_TRACE_TRANSFORM_MARKER = "__bitfab_auto_trace_transformed_v1__";
30
- function autoTraceFunctionId(file, name) {
31
- return `${AUTO_TRACE_FUNCTION_ID_VERSION}:${file}#${name}`;
32
- }
33
- function sourceFilename(filename) {
34
- return filename.replace(/\\/g, "/").split(/[?#]/, 1)[0] ?? "";
35
- }
36
- function autoTraceFilename(filename, cwd) {
37
- const normalized = sourceFilename(filename);
38
- const normalizedCwd = cwd.replace(/\\/g, "/").replace(/\/$/, "");
39
- return normalized.startsWith(`${normalizedCwd}/`) ? normalized.slice(normalizedCwd.length + 1) : normalized;
40
- }
41
- function shouldTransformBitfabFile(filename, options) {
42
- if (!filename) {
43
- return false;
44
- }
45
- if (options.include && !options.include(filename)) {
46
- return false;
47
- }
48
- const normalized = sourceFilename(filename);
49
- const normalizedCwd = options.cwd?.replace(/\\/g, "/").replace(/\/$/, "");
50
- const isAbsolute = normalized.startsWith("/") || /^[A-Za-z]:\//.test(normalized);
51
- if (normalizedCwd && isAbsolute && normalized !== normalizedCwd && !normalized.startsWith(`${normalizedCwd}/`)) {
52
- return false;
53
- }
54
- return !normalized.includes("/node_modules/") && !normalized.endsWith(".d.ts") && /\.[cm]?[jt]sx?$/.test(normalized);
55
- }
56
-
57
- // ../bitfab-typescript-transform/src/babelPlugin.ts
58
- function propertyName(node, types) {
59
- if (types.isIdentifier(node)) {
60
- return node.name;
61
- }
62
- if (types.isStringLiteral(node)) {
63
- return node.value;
64
- }
65
- return null;
66
- }
67
- function functionName(path, types) {
68
- const node = path.node;
69
- if (types.isFunctionDeclaration(node) || types.isFunctionExpression(node)) {
70
- if (node.id) {
71
- return node.id.name;
72
- }
73
- }
74
- if ((types.isClassMethod(node) || types.isObjectMethod(node)) && !node.computed && types.isIdentifier(node.key)) {
75
- return node.key.name;
76
- }
77
- const parent = path.parentPath?.node;
78
- if (types.isVariableDeclarator(parent)) {
79
- return propertyName(parent.id, types) ?? "anonymous";
80
- }
81
- if (types.isObjectProperty(parent) && !parent.computed) {
82
- return propertyName(parent.key, types) ?? "anonymous";
83
- }
84
- if (types.isClassProperty(parent) && !parent.computed) {
85
- const name = propertyName(parent.key, types);
86
- if (name) {
87
- return name;
88
- }
89
- }
90
- const { line, column } = sourcePosition(path);
91
- return `anonymous-${line}-${column}`;
92
- }
93
- function isInstrumentableFunction(node, types) {
94
- if (node.generator || types.isClassPrivateMethod(node)) {
95
- return false;
96
- }
97
- return !(types.isClassMethod(node) || types.isObjectMethod(node)) || node.kind === "method";
98
- }
99
- function sourcePosition(path) {
100
- const exportDeclaration = path.parentPath?.isExportDeclaration() ? path.parentPath.node : void 0;
101
- const start = (exportDeclaration ?? path.node).loc?.start;
102
- return { line: start?.line ?? 0, column: start?.column ?? 0 };
103
- }
104
- function qualifiedFunctionName(path, types) {
105
- const ownName = functionName(path, types);
106
- if (ownName.startsWith("anonymous-")) {
107
- return ownName;
108
- }
109
- const scopes = [];
110
- let ancestor = path.parentPath;
111
- while (ancestor) {
112
- if (ancestor.isFunction()) {
113
- if (!isInstrumentableFunction(ancestor.node, types)) {
114
- ancestor = ancestor.parentPath;
115
- continue;
116
- }
117
- const name = functionName(
118
- ancestor,
119
- types
120
- );
121
- if (!name.startsWith("anonymous-")) {
122
- scopes.unshift(name);
123
- }
124
- } else if ((ancestor.isClassDeclaration() || ancestor.isClassExpression()) && ancestor.node.id) {
125
- scopes.unshift(ancestor.node.id.name);
126
- } else if (ancestor.isObjectExpression()) {
127
- const parent = ancestor.parentPath?.node;
128
- if (types.isVariableDeclarator(parent)) {
129
- const name = propertyName(parent.id, types);
130
- if (name) {
131
- scopes.unshift(name);
132
- }
133
- } else if (types.isObjectProperty(parent) && !parent.computed) {
134
- const name = propertyName(parent.key, types);
135
- if (name) {
136
- scopes.unshift(name);
137
- }
138
- }
139
- }
140
- ancestor = ancestor.parentPath;
141
- }
142
- return [...scopes, ownName].join(".");
143
- }
144
- function isTraceDecoratorRoot(path, types) {
145
- const node = path.node;
146
- const parent = path.parentPath?.node;
147
- const decorated = types.isClassMethod(node) || types.isClassPrivateMethod(node) ? node : types.isClassProperty(parent) && parent.value === node ? parent : null;
148
- if (!decorated) {
149
- return false;
150
- }
151
- return decorated.decorators?.some((decorator) => {
152
- const expression = decorator.expression;
153
- if (!types.isCallExpression(expression)) {
154
- return false;
155
- }
156
- const callee = expression.callee;
157
- return types.isMemberExpression(callee) && !callee.computed && types.isIdentifier(callee.property, { name: "trace" });
158
- }) ?? false;
159
- }
160
- function withNodeFunctionName(path, types) {
161
- if (path.node.arguments.length > 2) {
162
- return null;
163
- }
164
- const callee = path.node.callee;
165
- if (!types.isMemberExpression(callee) || callee.computed || !types.isIdentifier(callee.property, { name: "withNode" })) {
166
- return null;
167
- }
168
- const fn = path.node.arguments[path.node.arguments.length - 1];
169
- if (types.isIdentifier(fn)) {
170
- return fn.name;
171
- }
172
- if (types.isMemberExpression(fn) && !fn.computed) {
173
- return propertyName(fn.property, types);
174
- }
175
- if (types.isFunctionExpression(fn) && fn.id) {
176
- return fn.id.name;
177
- }
178
- return null;
179
- }
180
- function runtimeParameters(node, types) {
181
- return node.params.filter(
182
- (parameter) => !types.isIdentifier(parameter, { name: "this" })
183
- );
184
- }
185
- function parameterInputs(path, types) {
186
- const elements = [];
187
- for (const [index, parameter] of runtimeParameters(
188
- path.node,
189
- types
190
- ).entries()) {
191
- if (!types.isArrowFunctionExpression(path.node)) {
192
- if (types.isRestElement(parameter)) {
193
- elements.push(
194
- types.spreadElement(
195
- types.callExpression(
196
- types.memberExpression(
197
- types.arrayExpression([
198
- types.spreadElement(types.identifier("arguments"))
199
- ]),
200
- types.identifier("slice")
201
- ),
202
- [types.numericLiteral(index)]
203
- )
204
- )
205
- );
206
- } else {
207
- elements.push(
208
- types.memberExpression(
209
- types.identifier("arguments"),
210
- types.numericLiteral(index),
211
- true
212
- )
213
- );
214
- }
215
- continue;
216
- }
217
- if (types.isIdentifier(parameter)) {
218
- elements.push(types.identifier(parameter.name));
219
- } else if (types.isRestElement(parameter) && types.isIdentifier(parameter.argument)) {
220
- elements.push(
221
- types.spreadElement(types.identifier(parameter.argument.name))
222
- );
223
- }
224
- }
225
- return types.arrayExpression(elements);
226
- }
227
- function needsArgumentWrapper(path, types) {
228
- return types.isArrowFunctionExpression(path.node) && path.node.params.some(
229
- (parameter) => !types.isIdentifier(parameter) && !(types.isRestElement(parameter) && types.isIdentifier(parameter.argument))
230
- );
231
- }
232
- function isRestWrapper(path, types) {
233
- const parameters = runtimeParameters(path.node, types);
234
- return parameters.length === 1 && types.isRestElement(parameters[0]);
235
- }
236
- function bitfabBabelPlugin(api) {
237
- const { types } = api;
238
- return {
239
- name: "bitfab-auto-trace",
240
- visitor: {
241
- Program: {
242
- enter(path, state) {
243
- const filename = state.file.opts.filename ?? "unknown";
244
- state.skipFile = !shouldTransformBitfabFile(filename, state.opts) || path.scope.hasBinding(AUTO_TRACE_TRANSFORM_MARKER) || path.node.directives.some(
245
- (directive) => directive.value.value === "use client"
246
- );
247
- state.runtimeIdentifier = path.scope.generateUidIdentifier("bitfabAutoSpan");
248
- state.activeIdentifier = path.scope.generateUidIdentifier(
249
- "bitfabAutoTraceActive"
250
- );
251
- state.wrapperIdentifier = path.scope.generateUidIdentifier("bitfabAutoWrap");
252
- state.definitions = [];
253
- state.usedRuntime = false;
254
- state.usedWrapper = false;
255
- },
256
- exit(path, state) {
257
- if (state.skipFile || !state.usedRuntime || !state.runtimeIdentifier || !state.activeIdentifier || !state.wrapperIdentifier) {
258
- return;
259
- }
260
- state.file.metadata[AUTO_TRACE_TRANSFORM_MARKER] = true;
261
- path.unshiftContainer("body", [
262
- types.importDeclaration(
263
- [
264
- types.importSpecifier(
265
- state.runtimeIdentifier,
266
- types.identifier("__bitfabAutoSpan")
267
- ),
268
- types.importSpecifier(
269
- state.activeIdentifier,
270
- types.identifier("__bitfabAutoTraceActive")
271
- ),
272
- ...state.usedWrapper ? [
273
- types.importSpecifier(
274
- state.wrapperIdentifier,
275
- types.identifier("__bitfabAutoWrap")
276
- )
277
- ] : []
278
- ],
279
- types.stringLiteral(
280
- state.opts.runtimeModule ?? "@bitfab/sdk/auto"
281
- )
282
- ),
283
- types.variableDeclaration("const", [
284
- types.variableDeclarator(
285
- types.identifier(AUTO_TRACE_TRANSFORM_MARKER),
286
- types.assignmentExpression(
287
- "=",
288
- types.memberExpression(
289
- types.identifier("globalThis"),
290
- types.identifier(AUTO_TRACE_TRANSFORM_MARKER)
291
- ),
292
- types.booleanLiteral(true)
293
- )
294
- )
295
- ]),
296
- ...state.definitions ?? []
297
- ]);
298
- }
299
- },
300
- CallExpression: {
301
- exit(path, state) {
302
- if (state.skipFile) {
303
- return;
304
- }
305
- const configuredName = withNodeFunctionName(path, types);
306
- if (configuredName === null) {
307
- return;
308
- }
309
- if (path.node.arguments.length === 1) {
310
- path.node.arguments.push(types.identifier("undefined"));
311
- }
312
- path.node.arguments.push(types.stringLiteral(configuredName));
313
- }
314
- },
315
- Function: {
316
- exit(path, state) {
317
- const node = path.node;
318
- if (state.skipFile || node._bitfabInstrumented || !isInstrumentableFunction(node, types) || isTraceDecoratorRoot(path, types) || !state.runtimeIdentifier || !state.activeIdentifier || !state.wrapperIdentifier) {
319
- return;
320
- }
321
- const name = qualifiedFunctionName(path, types);
322
- if (name.startsWith("anonymous-")) {
323
- return;
324
- }
325
- const normalizedFilename = autoTraceFilename(
326
- state.file.opts.filename ?? "unknown",
327
- state.opts.cwd ?? state.file.opts.cwd ?? process.cwd()
328
- );
329
- const { line, column } = sourcePosition(path);
330
- const definition = types.objectExpression([
331
- types.objectProperty(
332
- types.identifier("id"),
333
- types.stringLiteral(
334
- autoTraceFunctionId(normalizedFilename, name)
335
- )
336
- ),
337
- types.objectProperty(
338
- types.identifier("name"),
339
- types.stringLiteral(name)
340
- ),
341
- types.objectProperty(
342
- types.identifier("file"),
343
- types.stringLiteral(normalizedFilename)
344
- ),
345
- types.objectProperty(
346
- types.identifier("line"),
347
- types.numericLiteral(line)
348
- ),
349
- types.objectProperty(
350
- types.identifier("column"),
351
- types.numericLiteral(column)
352
- ),
353
- ...node.async ? [
354
- types.objectProperty(
355
- types.identifier("async"),
356
- types.booleanLiteral(true)
357
- )
358
- ] : [],
359
- ...isRestWrapper(path, types) ? [
360
- types.objectProperty(
361
- types.identifier("wrapper"),
362
- types.booleanLiteral(true)
363
- )
364
- ] : []
365
- ]);
366
- const definitionIdentifier = path.scope.getProgramParent().generateUidIdentifier("bitfabAutoDefinition");
367
- state.definitions?.push(
368
- types.variableDeclaration("const", [
369
- types.variableDeclarator(definitionIdentifier, definition)
370
- ])
371
- );
372
- if (needsArgumentWrapper(path, types)) {
373
- node._bitfabInstrumented = true;
374
- path.replaceWith(
375
- types.callExpression(types.cloneNode(state.wrapperIdentifier), [
376
- types.cloneNode(definitionIdentifier),
377
- node
378
- ])
379
- );
380
- state.usedRuntime = true;
381
- state.usedWrapper = true;
382
- return;
383
- }
384
- const originalBody = types.isBlockStatement(node.body) ? node.body : types.blockStatement([types.returnStatement(node.body)]);
385
- const directives = originalBody.directives;
386
- originalBody.directives = [];
387
- const body = types.blockStatement(
388
- [
389
- types.ifStatement(
390
- types.callExpression(
391
- types.cloneNode(state.activeIdentifier),
392
- []
393
- ),
394
- types.blockStatement([
395
- types.returnStatement(
396
- types.callExpression(
397
- types.cloneNode(state.runtimeIdentifier),
398
- [
399
- types.cloneNode(definitionIdentifier),
400
- parameterInputs(path, types),
401
- types.arrowFunctionExpression(
402
- [],
403
- types.cloneNode(originalBody, true),
404
- node.async ?? false
405
- )
406
- ]
407
- )
408
- )
409
- ])
410
- ),
411
- ...originalBody.body
412
- ],
413
- directives
414
- );
415
- node.body = body;
416
- node._bitfabInstrumented = true;
417
- state.usedRuntime = true;
418
- }
419
- }
420
- }
421
- };
422
- }
423
- //# sourceMappingURL=babel.cjs.map
5
+ const require_babelPlugin = require("../babelPlugin-Nta4-VcL.cjs");
6
+ exports.default = require_babelPlugin.bitfabBabelPlugin;
@@ -1,18 +1,18 @@
1
- import { PluginObject, PluginPass } from '@babel/core';
2
- import * as BabelTypes from '@babel/types';
3
- import { B as BitfabTransformOptions } from '../transformOptions-Df2_Chtc.cjs';
4
-
1
+ import { t as BitfabTransformOptions } from "../transformOptions-BsjCELkh.cjs";
2
+ import { PluginObject, PluginPass } from "@babel/core";
3
+ import * as BabelTypes from "@babel/types";
4
+ //#region ../bitfab-typescript-transform/src/babelPlugin.d.ts
5
5
  type BabelTypesApi = typeof BabelTypes;
6
6
  type BitfabPluginOptions = BitfabTransformOptions;
7
7
  interface BitfabPluginState extends PluginPass {
8
- opts: BitfabPluginOptions;
9
- runtimeIdentifier?: ReturnType<BabelTypesApi["identifier"]>;
10
- activeIdentifier?: ReturnType<BabelTypesApi["identifier"]>;
11
- wrapperIdentifier?: ReturnType<BabelTypesApi["identifier"]>;
12
- definitions?: Array<ReturnType<BabelTypesApi["variableDeclaration"]>>;
13
- skipFile?: boolean;
14
- usedRuntime?: boolean;
15
- usedWrapper?: boolean;
8
+ opts: BitfabPluginOptions;
9
+ runtimeIdentifier?: ReturnType<BabelTypesApi["identifier"]>;
10
+ activeIdentifier?: ReturnType<BabelTypesApi["identifier"]>;
11
+ wrapperIdentifier?: ReturnType<BabelTypesApi["identifier"]>;
12
+ definitions?: Array<ReturnType<BabelTypesApi["variableDeclaration"]>>;
13
+ skipFile?: boolean;
14
+ usedRuntime?: boolean;
15
+ usedWrapper?: boolean;
16
16
  }
17
17
  /**
18
18
  * Babel adapter for Bitfab's experimental automatic call-span runtime.
@@ -20,8 +20,8 @@ interface BitfabPluginState extends PluginPass {
20
20
  * @experimental The transform protocol and generated function identities may
21
21
  * change before the feature is stable.
22
22
  */
23
- declare function bitfabBabelPlugin(api: {
24
- types: BabelTypesApi;
23
+ export default function bitfabBabelPlugin(api: {
24
+ types: BabelTypesApi;
25
25
  }): PluginObject<BitfabPluginState>;
26
-
27
- export { bitfabBabelPlugin as default };
26
+ //#endregion
27
+ export {};
@@ -1,18 +1,18 @@
1
- import { PluginObject, PluginPass } from '@babel/core';
2
- import * as BabelTypes from '@babel/types';
3
- import { B as BitfabTransformOptions } from '../transformOptions-Df2_Chtc.js';
4
-
1
+ import { t as BitfabTransformOptions } from "../transformOptions-BsjCELkh.js";
2
+ import { PluginObject, PluginPass } from "@babel/core";
3
+ import * as BabelTypes from "@babel/types";
4
+ //#region ../bitfab-typescript-transform/src/babelPlugin.d.ts
5
5
  type BabelTypesApi = typeof BabelTypes;
6
6
  type BitfabPluginOptions = BitfabTransformOptions;
7
7
  interface BitfabPluginState extends PluginPass {
8
- opts: BitfabPluginOptions;
9
- runtimeIdentifier?: ReturnType<BabelTypesApi["identifier"]>;
10
- activeIdentifier?: ReturnType<BabelTypesApi["identifier"]>;
11
- wrapperIdentifier?: ReturnType<BabelTypesApi["identifier"]>;
12
- definitions?: Array<ReturnType<BabelTypesApi["variableDeclaration"]>>;
13
- skipFile?: boolean;
14
- usedRuntime?: boolean;
15
- usedWrapper?: boolean;
8
+ opts: BitfabPluginOptions;
9
+ runtimeIdentifier?: ReturnType<BabelTypesApi["identifier"]>;
10
+ activeIdentifier?: ReturnType<BabelTypesApi["identifier"]>;
11
+ wrapperIdentifier?: ReturnType<BabelTypesApi["identifier"]>;
12
+ definitions?: Array<ReturnType<BabelTypesApi["variableDeclaration"]>>;
13
+ skipFile?: boolean;
14
+ usedRuntime?: boolean;
15
+ usedWrapper?: boolean;
16
16
  }
17
17
  /**
18
18
  * Babel adapter for Bitfab's experimental automatic call-span runtime.
@@ -20,8 +20,8 @@ interface BitfabPluginState extends PluginPass {
20
20
  * @experimental The transform protocol and generated function identities may
21
21
  * change before the feature is stable.
22
22
  */
23
- declare function bitfabBabelPlugin(api: {
24
- types: BabelTypesApi;
23
+ export default function bitfabBabelPlugin(api: {
24
+ types: BabelTypesApi;
25
25
  }): PluginObject<BitfabPluginState>;
26
-
27
- export { bitfabBabelPlugin as default };
26
+ //#endregion
27
+ export {};
@@ -1,7 +1 @@
1
- import {
2
- bitfabBabelPlugin
3
- } from "../chunk-ZG6SHKEF.js";
4
- export {
5
- bitfabBabelPlugin as default
6
- };
7
- //# sourceMappingURL=babel.js.map
1
+ export { t as default } from "../babelPlugin-C70OxrqA.js";