@sentry/babel-plugin-component-annotate 4.0.2 → 4.1.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/cjs/index.js +231 -30
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +231 -30
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -60,6 +60,57 @@ function _arrayLikeToArray(arr, len) {
|
|
|
60
60
|
function _nonIterableRest() {
|
|
61
61
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
62
62
|
}
|
|
63
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
64
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
65
|
+
if (!it) {
|
|
66
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
67
|
+
if (it) o = it;
|
|
68
|
+
var i = 0;
|
|
69
|
+
var F = function () {};
|
|
70
|
+
return {
|
|
71
|
+
s: F,
|
|
72
|
+
n: function () {
|
|
73
|
+
if (i >= o.length) return {
|
|
74
|
+
done: true
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
done: false,
|
|
78
|
+
value: o[i++]
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
e: function (e) {
|
|
82
|
+
throw e;
|
|
83
|
+
},
|
|
84
|
+
f: F
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
88
|
+
}
|
|
89
|
+
var normalCompletion = true,
|
|
90
|
+
didErr = false,
|
|
91
|
+
err;
|
|
92
|
+
return {
|
|
93
|
+
s: function () {
|
|
94
|
+
it = it.call(o);
|
|
95
|
+
},
|
|
96
|
+
n: function () {
|
|
97
|
+
var step = it.next();
|
|
98
|
+
normalCompletion = step.done;
|
|
99
|
+
return step;
|
|
100
|
+
},
|
|
101
|
+
e: function (e) {
|
|
102
|
+
didErr = true;
|
|
103
|
+
err = e;
|
|
104
|
+
},
|
|
105
|
+
f: function () {
|
|
106
|
+
try {
|
|
107
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
108
|
+
} finally {
|
|
109
|
+
if (didErr) throw err;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
63
114
|
|
|
64
115
|
/**
|
|
65
116
|
* MIT License
|
|
@@ -99,23 +150,31 @@ var webSourceFileName = "data-sentry-source-file";
|
|
|
99
150
|
var nativeComponentName = "dataSentryComponent";
|
|
100
151
|
var nativeElementName = "dataSentryElement";
|
|
101
152
|
var nativeSourceFileName = "dataSentrySourceFile";
|
|
153
|
+
|
|
154
|
+
// Shared context object for all JSX processing functions
|
|
155
|
+
|
|
102
156
|
// We must export the plugin as default, otherwise the Babel loader will not be able to resolve it when configured using its string identifier
|
|
103
157
|
function componentNameAnnotatePlugin(_ref) {
|
|
104
158
|
var t = _ref.types;
|
|
105
159
|
return {
|
|
106
160
|
visitor: {
|
|
161
|
+
Program: {
|
|
162
|
+
enter: function enter(path, state) {
|
|
163
|
+
var fragmentContext = collectFragmentContext(path);
|
|
164
|
+
state.sentryFragmentContext = fragmentContext;
|
|
165
|
+
}
|
|
166
|
+
},
|
|
107
167
|
FunctionDeclaration: function FunctionDeclaration(path, state) {
|
|
108
|
-
var _state$opts$ignoredCo;
|
|
109
168
|
if (!path.node.id || !path.node.id.name) {
|
|
110
169
|
return;
|
|
111
170
|
}
|
|
112
171
|
if (isKnownIncompatiblePluginFromState(state)) {
|
|
113
172
|
return;
|
|
114
173
|
}
|
|
115
|
-
|
|
174
|
+
var context = createJSXProcessingContext(state, t, path.node.id.name);
|
|
175
|
+
functionBodyPushAttributes(context, path);
|
|
116
176
|
},
|
|
117
177
|
ArrowFunctionExpression: function ArrowFunctionExpression(path, state) {
|
|
118
|
-
var _state$opts$ignoredCo2;
|
|
119
178
|
// We're expecting a `VariableDeclarator` like `const MyComponent =`
|
|
120
179
|
var parent = path.parent;
|
|
121
180
|
if (!parent || !("id" in parent) || !parent.id || !("name" in parent.id) || !parent.id.name) {
|
|
@@ -124,10 +183,11 @@ function componentNameAnnotatePlugin(_ref) {
|
|
|
124
183
|
if (isKnownIncompatiblePluginFromState(state)) {
|
|
125
184
|
return;
|
|
126
185
|
}
|
|
127
|
-
|
|
186
|
+
var context = createJSXProcessingContext(state, t, parent.id.name);
|
|
187
|
+
functionBodyPushAttributes(context, path);
|
|
128
188
|
},
|
|
129
189
|
ClassDeclaration: function ClassDeclaration(path, state) {
|
|
130
|
-
var
|
|
190
|
+
var _name$node;
|
|
131
191
|
var name = path.get("id");
|
|
132
192
|
var properties = path.get("body").get("body");
|
|
133
193
|
var render = properties.find(function (prop) {
|
|
@@ -138,21 +198,43 @@ function componentNameAnnotatePlugin(_ref) {
|
|
|
138
198
|
if (!render || !render.traverse || isKnownIncompatiblePluginFromState(state)) {
|
|
139
199
|
return;
|
|
140
200
|
}
|
|
141
|
-
var
|
|
201
|
+
var context = createJSXProcessingContext(state, t, ((_name$node = name.node) === null || _name$node === void 0 ? void 0 : _name$node.name) || "");
|
|
142
202
|
render.traverse({
|
|
143
203
|
ReturnStatement: function ReturnStatement(returnStatement) {
|
|
144
204
|
var arg = returnStatement.get("argument");
|
|
145
205
|
if (!arg.isJSXElement() && !arg.isJSXFragment()) {
|
|
146
206
|
return;
|
|
147
207
|
}
|
|
148
|
-
processJSX(
|
|
208
|
+
processJSX(context, arg);
|
|
149
209
|
}
|
|
150
210
|
});
|
|
151
211
|
}
|
|
152
212
|
}
|
|
153
213
|
};
|
|
154
214
|
}
|
|
155
|
-
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Creates a JSX processing context from the plugin state
|
|
218
|
+
*/
|
|
219
|
+
function createJSXProcessingContext(state, t, componentName) {
|
|
220
|
+
var _state$opts$ignoredCo;
|
|
221
|
+
return {
|
|
222
|
+
annotateFragments: state.opts["annotate-fragments"] === true,
|
|
223
|
+
t: t,
|
|
224
|
+
componentName: componentName,
|
|
225
|
+
sourceFileName: sourceFileNameFromState(state),
|
|
226
|
+
attributeNames: attributeNamesFromState(state),
|
|
227
|
+
ignoredComponents: (_state$opts$ignoredCo = state.opts.ignoredComponents) !== null && _state$opts$ignoredCo !== void 0 ? _state$opts$ignoredCo : [],
|
|
228
|
+
fragmentContext: state.sentryFragmentContext
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Processes the body of a function to add Sentry tracking attributes to JSX elements.
|
|
234
|
+
* Handles various function body structures including direct JSX returns, conditional expressions,
|
|
235
|
+
* and nested JSX elements.
|
|
236
|
+
*/
|
|
237
|
+
function functionBodyPushAttributes(context, path) {
|
|
156
238
|
var jsxNode;
|
|
157
239
|
var functionBody = path.get("body").get("body");
|
|
158
240
|
if (!("length" in functionBody) && functionBody.parent && (functionBody.parent.type === "JSXElement" || functionBody.parent.type === "JSXFragment")) {
|
|
@@ -183,11 +265,11 @@ function functionBodyPushAttributes(annotateFragments, t, path, componentName, s
|
|
|
183
265
|
if (arg.isConditionalExpression()) {
|
|
184
266
|
var consequent = arg.get("consequent");
|
|
185
267
|
if (consequent.isJSXFragment() || consequent.isJSXElement()) {
|
|
186
|
-
processJSX(
|
|
268
|
+
processJSX(context, consequent);
|
|
187
269
|
}
|
|
188
270
|
var alternate = arg.get("alternate");
|
|
189
271
|
if (alternate.isJSXFragment() || alternate.isJSXElement()) {
|
|
190
|
-
processJSX(
|
|
272
|
+
processJSX(context, alternate);
|
|
191
273
|
}
|
|
192
274
|
return;
|
|
193
275
|
}
|
|
@@ -199,18 +281,28 @@ function functionBodyPushAttributes(annotateFragments, t, path, componentName, s
|
|
|
199
281
|
if (!jsxNode) {
|
|
200
282
|
return;
|
|
201
283
|
}
|
|
202
|
-
processJSX(
|
|
284
|
+
processJSX(context, jsxNode);
|
|
203
285
|
}
|
|
204
|
-
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Recursively processes JSX elements to add Sentry tracking attributes.
|
|
289
|
+
* Handles both JSX elements and fragments, applying appropriate attributes
|
|
290
|
+
* based on configuration and component context.
|
|
291
|
+
*/
|
|
292
|
+
function processJSX(context, jsxNode, componentName) {
|
|
205
293
|
if (!jsxNode) {
|
|
206
294
|
return;
|
|
207
295
|
}
|
|
296
|
+
|
|
297
|
+
// Use provided componentName or fall back to context componentName
|
|
298
|
+
var currentComponentName = componentName !== null && componentName !== void 0 ? componentName : context.componentName;
|
|
299
|
+
|
|
208
300
|
// NOTE: I don't know of a case where `openingElement` would have more than one item,
|
|
209
301
|
// but it's safer to always iterate
|
|
210
302
|
var paths = jsxNode.get("openingElement");
|
|
211
303
|
var openingElements = Array.isArray(paths) ? paths : [paths];
|
|
212
304
|
openingElements.forEach(function (openingElement) {
|
|
213
|
-
applyAttributes(
|
|
305
|
+
applyAttributes(context, openingElement, currentComponentName);
|
|
214
306
|
});
|
|
215
307
|
var children = jsxNode.get("children");
|
|
216
308
|
// TODO: See why `Array.isArray` doesn't have correct behaviour here
|
|
@@ -218,7 +310,7 @@ function processJSX(annotateFragments, t, jsxNode, componentName, sourceFileName
|
|
|
218
310
|
// A single child was found, maybe a bit of static text
|
|
219
311
|
children = [children];
|
|
220
312
|
}
|
|
221
|
-
var shouldSetComponentName = annotateFragments;
|
|
313
|
+
var shouldSetComponentName = context.annotateFragments;
|
|
222
314
|
children.forEach(function (child) {
|
|
223
315
|
// Happens for some node types like plain text
|
|
224
316
|
if (!child.node) {
|
|
@@ -234,24 +326,39 @@ function processJSX(annotateFragments, t, jsxNode, componentName, sourceFileName
|
|
|
234
326
|
}
|
|
235
327
|
if (shouldSetComponentName && openingElement && openingElement.node) {
|
|
236
328
|
shouldSetComponentName = false;
|
|
237
|
-
processJSX(
|
|
329
|
+
processJSX(context, child, currentComponentName);
|
|
238
330
|
} else {
|
|
239
|
-
processJSX(
|
|
331
|
+
processJSX(context, child, "");
|
|
240
332
|
}
|
|
241
333
|
});
|
|
242
334
|
}
|
|
243
|
-
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Applies Sentry tracking attributes to a JSX opening element.
|
|
338
|
+
* Adds component name, element name, and source file attributes while
|
|
339
|
+
* respecting ignore lists and fragment detection.
|
|
340
|
+
*/
|
|
341
|
+
function applyAttributes(context, openingElement, componentName) {
|
|
342
|
+
var t = context.t,
|
|
343
|
+
attributeNames = context.attributeNames,
|
|
344
|
+
ignoredComponents = context.ignoredComponents,
|
|
345
|
+
fragmentContext = context.fragmentContext,
|
|
346
|
+
sourceFileName = context.sourceFileName;
|
|
244
347
|
var _attributeNames = _slicedToArray(attributeNames, 3),
|
|
245
348
|
componentAttributeName = _attributeNames[0],
|
|
246
349
|
elementAttributeName = _attributeNames[1],
|
|
247
350
|
sourceFileAttributeName = _attributeNames[2];
|
|
248
|
-
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
351
|
+
|
|
251
352
|
// e.g., Raw JSX text like the `A` in `<h1>a</h1>`
|
|
252
353
|
if (!openingElement.node) {
|
|
253
354
|
return;
|
|
254
355
|
}
|
|
356
|
+
|
|
357
|
+
// Check if this is a React fragment - if so, skip attribute addition entirely
|
|
358
|
+
var isFragment = isReactFragment(t, openingElement, fragmentContext);
|
|
359
|
+
if (isFragment) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
255
362
|
if (!openingElement.node.attributes) openingElement.node.attributes = [];
|
|
256
363
|
var elementName = getPathName(t, openingElement);
|
|
257
364
|
var isAnIgnoredComponent = ignoredComponents.some(function (ignoredComponent) {
|
|
@@ -260,11 +367,11 @@ function applyAttributes(t, openingElement, componentName, sourceFileName, attri
|
|
|
260
367
|
|
|
261
368
|
// Add a stable attribute for the element name but only for non-DOM names
|
|
262
369
|
var isAnIgnoredElement = false;
|
|
263
|
-
if (!isAnIgnoredComponent && !hasAttributeWithName(openingElement,
|
|
370
|
+
if (!isAnIgnoredComponent && !hasAttributeWithName(openingElement, elementAttributeName)) {
|
|
264
371
|
if (DEFAULT_IGNORED_ELEMENTS.includes(elementName)) {
|
|
265
372
|
isAnIgnoredElement = true;
|
|
266
373
|
} else {
|
|
267
|
-
//
|
|
374
|
+
// Always add element attribute for non-ignored elements
|
|
268
375
|
if (elementAttributeName) {
|
|
269
376
|
openingElement.node.attributes.push(t.jSXAttribute(t.jSXIdentifier(elementAttributeName), t.stringLiteral(elementName)));
|
|
270
377
|
}
|
|
@@ -273,15 +380,16 @@ function applyAttributes(t, openingElement, componentName, sourceFileName, attri
|
|
|
273
380
|
|
|
274
381
|
// Add a stable attribute for the component name (absent for non-root elements)
|
|
275
382
|
if (componentName && !isAnIgnoredComponent && !hasAttributeWithName(openingElement, componentAttributeName)) {
|
|
276
|
-
// TODO: Is it possible to avoid this null check?
|
|
277
383
|
if (componentAttributeName) {
|
|
278
384
|
openingElement.node.attributes.push(t.jSXAttribute(t.jSXIdentifier(componentAttributeName), t.stringLiteral(componentName)));
|
|
279
385
|
}
|
|
280
386
|
}
|
|
281
387
|
|
|
282
|
-
// Add a stable attribute for the source file name
|
|
283
|
-
|
|
284
|
-
|
|
388
|
+
// Add a stable attribute for the source file name
|
|
389
|
+
// Updated condition: add source file for elements that have either:
|
|
390
|
+
// 1. A component name (root elements), OR
|
|
391
|
+
// 2. An element name that's not ignored (child elements)
|
|
392
|
+
if (sourceFileName && !isAnIgnoredComponent && (componentName || !isAnIgnoredElement) && !hasAttributeWithName(openingElement, sourceFileAttributeName)) {
|
|
285
393
|
if (sourceFileAttributeName) {
|
|
286
394
|
openingElement.node.attributes.push(t.jSXAttribute(t.jSXIdentifier(sourceFileAttributeName), t.stringLiteral(sourceFileName)));
|
|
287
395
|
}
|
|
@@ -327,20 +435,98 @@ function attributeNamesFromState(state) {
|
|
|
327
435
|
}
|
|
328
436
|
return [webComponentName, webElementName, webSourceFileName];
|
|
329
437
|
}
|
|
330
|
-
function
|
|
438
|
+
function collectFragmentContext(programPath) {
|
|
439
|
+
var fragmentAliases = new Set();
|
|
440
|
+
var reactNamespaceAliases = new Set(["React"]); // Default React namespace
|
|
441
|
+
|
|
442
|
+
programPath.traverse({
|
|
443
|
+
ImportDeclaration: function ImportDeclaration(importPath) {
|
|
444
|
+
var source = importPath.node.source.value;
|
|
445
|
+
|
|
446
|
+
// Handle React imports
|
|
447
|
+
if (source === "react" || source === "React") {
|
|
448
|
+
importPath.node.specifiers.forEach(function (spec) {
|
|
449
|
+
if (spec.type === "ImportSpecifier" && spec.imported.type === "Identifier") {
|
|
450
|
+
// Detect aliased React.Fragment imports (e.g., `Fragment as F`)
|
|
451
|
+
// so we can later identify <F> as a fragment in JSX.
|
|
452
|
+
if (spec.imported.name === "Fragment") {
|
|
453
|
+
fragmentAliases.add(spec.local.name);
|
|
454
|
+
}
|
|
455
|
+
} else if (spec.type === "ImportDefaultSpecifier" || spec.type === "ImportNamespaceSpecifier") {
|
|
456
|
+
// import React from 'react' -> React OR
|
|
457
|
+
// import * as React from 'react' -> React
|
|
458
|
+
reactNamespaceAliases.add(spec.local.name);
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
// Handle simple variable assignments only (avoid complex cases)
|
|
464
|
+
VariableDeclarator: function VariableDeclarator(varPath) {
|
|
465
|
+
if (varPath.node.init) {
|
|
466
|
+
var init = varPath.node.init;
|
|
467
|
+
|
|
468
|
+
// Handle identifier assignments: const MyFragment = Fragment
|
|
469
|
+
if (varPath.node.id.type === "Identifier") {
|
|
470
|
+
// Handle: const MyFragment = Fragment (only if Fragment is a known alias)
|
|
471
|
+
if (init.type === "Identifier" && fragmentAliases.has(init.name)) {
|
|
472
|
+
fragmentAliases.add(varPath.node.id.name);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// Handle: const MyFragment = React.Fragment (only for known React namespaces)
|
|
476
|
+
if (init.type === "MemberExpression" && init.object.type === "Identifier" && init.property.type === "Identifier" && init.property.name === "Fragment" && reactNamespaceAliases.has(init.object.name)) {
|
|
477
|
+
fragmentAliases.add(varPath.node.id.name);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// Handle destructuring assignments: const { Fragment } = React
|
|
482
|
+
if (varPath.node.id.type === "ObjectPattern") {
|
|
483
|
+
if (init.type === "Identifier" && reactNamespaceAliases.has(init.name)) {
|
|
484
|
+
var properties = varPath.node.id.properties;
|
|
485
|
+
var _iterator = _createForOfIteratorHelper(properties),
|
|
486
|
+
_step;
|
|
487
|
+
try {
|
|
488
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
489
|
+
var prop = _step.value;
|
|
490
|
+
if (prop.type === "ObjectProperty" && prop.key && prop.key.type === "Identifier" && prop.value && prop.value.type === "Identifier" && prop.key.name === "Fragment") {
|
|
491
|
+
fragmentAliases.add(prop.value.name);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
} catch (err) {
|
|
495
|
+
_iterator.e(err);
|
|
496
|
+
} finally {
|
|
497
|
+
_iterator.f();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
return {
|
|
505
|
+
fragmentAliases: fragmentAliases,
|
|
506
|
+
reactNamespaceAliases: reactNamespaceAliases
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
function isReactFragment(t, openingElement, context) {
|
|
510
|
+
// Handle JSX fragments (<>)
|
|
331
511
|
if (openingElement.isJSXFragment()) {
|
|
332
512
|
return true;
|
|
333
513
|
}
|
|
334
514
|
var elementName = getPathName(t, openingElement);
|
|
515
|
+
|
|
516
|
+
// Direct fragment references
|
|
335
517
|
if (elementName === "Fragment" || elementName === "React.Fragment") {
|
|
336
518
|
return true;
|
|
337
519
|
}
|
|
338
520
|
|
|
339
521
|
// TODO: All these objects are typed as unknown, maybe an oversight in Babel types?
|
|
522
|
+
|
|
523
|
+
// Check if the element name is a known fragment alias
|
|
524
|
+
if (context && elementName && context.fragmentAliases.has(elementName)) {
|
|
525
|
+
return true;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// Handle JSXMemberExpression
|
|
340
529
|
if (openingElement.node && "name" in openingElement.node && openingElement.node.name && _typeof(openingElement.node.name) === "object" && "type" in openingElement.node.name && openingElement.node.name.type === "JSXMemberExpression") {
|
|
341
|
-
if (!("name" in openingElement.node)) {
|
|
342
|
-
return false;
|
|
343
|
-
}
|
|
344
530
|
var nodeName = openingElement.node.name;
|
|
345
531
|
if (_typeof(nodeName) !== "object" || !nodeName) {
|
|
346
532
|
return false;
|
|
@@ -356,9 +542,24 @@ function isReactFragment(t, openingElement) {
|
|
|
356
542
|
}
|
|
357
543
|
var objectName = "name" in nodeNameObject && nodeNameObject.name;
|
|
358
544
|
var propertyName = "name" in nodeNameProperty && nodeNameProperty.name;
|
|
545
|
+
|
|
546
|
+
// React.Fragment check
|
|
359
547
|
if (objectName === "React" && propertyName === "Fragment") {
|
|
360
548
|
return true;
|
|
361
549
|
}
|
|
550
|
+
|
|
551
|
+
// Enhanced checks using context
|
|
552
|
+
if (context) {
|
|
553
|
+
// Check React.Fragment pattern with known React namespaces
|
|
554
|
+
if (context.reactNamespaceAliases.has(objectName) && propertyName === "Fragment") {
|
|
555
|
+
return true;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// Check MyFragment.Fragment pattern
|
|
559
|
+
if (context.fragmentAliases.has(objectName) && propertyName === "Fragment") {
|
|
560
|
+
return true;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
362
563
|
}
|
|
363
564
|
}
|
|
364
565
|
return false;
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/constants.ts","../../src/index.ts"],"sourcesContent":["/**\n * MIT License\n *\n * Copyright (c) 2020 Engineering at FullStory\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n */\n\nexport const KNOWN_INCOMPATIBLE_PLUGINS = [\n // This module might be causing an issue preventing clicks. For safety, we won't run on this module.\n \"react-native-testfairy\",\n // This module checks for unexpected property keys and throws an exception.\n \"@react-navigation\",\n];\n\nexport const DEFAULT_IGNORED_ELEMENTS = [\n \"a\",\n \"abbr\",\n \"address\",\n \"area\",\n \"article\",\n \"aside\",\n \"audio\",\n \"b\",\n \"base\",\n \"bdi\",\n \"bdo\",\n \"blockquote\",\n \"body\",\n \"br\",\n \"button\",\n \"canvas\",\n \"caption\",\n \"cite\",\n \"code\",\n \"col\",\n \"colgroup\",\n \"data\",\n \"datalist\",\n \"dd\",\n \"del\",\n \"details\",\n \"dfn\",\n \"dialog\",\n \"div\",\n \"dl\",\n \"dt\",\n \"em\",\n \"embed\",\n \"fieldset\",\n \"figure\",\n \"footer\",\n \"form\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"head\",\n \"header\",\n \"hgroup\",\n \"hr\",\n \"html\",\n \"i\",\n \"iframe\",\n \"img\",\n \"input\",\n \"ins\",\n \"kbd\",\n \"keygen\",\n \"label\",\n \"legend\",\n \"li\",\n \"link\",\n \"main\",\n \"map\",\n \"mark\",\n \"menu\",\n \"menuitem\",\n \"meter\",\n \"nav\",\n \"noscript\",\n \"object\",\n \"ol\",\n \"optgroup\",\n \"option\",\n \"output\",\n \"p\",\n \"param\",\n \"pre\",\n \"progress\",\n \"q\",\n \"rb\",\n \"rp\",\n \"rt\",\n \"rtc\",\n \"ruby\",\n \"s\",\n \"samp\",\n \"script\",\n \"section\",\n \"select\",\n \"small\",\n \"source\",\n \"span\",\n \"strong\",\n \"style\",\n \"sub\",\n \"summary\",\n \"sup\",\n \"table\",\n \"tbody\",\n \"td\",\n \"template\",\n \"textarea\",\n \"tfoot\",\n \"th\",\n \"thead\",\n \"time\",\n \"title\",\n \"tr\",\n \"track\",\n \"u\",\n \"ul\",\n \"var\",\n \"video\",\n \"wbr\",\n];\n","/**\n * MIT License\n *\n * Copyright (c) 2020 Engineering at FullStory\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n */\n\n/**\n * The following code is based on the FullStory Babel plugin, but has been modified to work\n * with Sentry products:\n *\n * - Added `sentry` to data properties, i.e `data-sentry-component`\n * - Converted to TypeScript\n * - Code cleanups\n */\n\nimport type * as Babel from \"@babel/core\";\nimport type { PluginObj, PluginPass } from \"@babel/core\";\n\nimport { DEFAULT_IGNORED_ELEMENTS, KNOWN_INCOMPATIBLE_PLUGINS } from \"./constants\";\n\nconst webComponentName = \"data-sentry-component\";\nconst webElementName = \"data-sentry-element\";\nconst webSourceFileName = \"data-sentry-source-file\";\n\nconst nativeComponentName = \"dataSentryComponent\";\nconst nativeElementName = \"dataSentryElement\";\nconst nativeSourceFileName = \"dataSentrySourceFile\";\n\ninterface AnnotationOpts {\n native?: boolean;\n \"annotate-fragments\"?: boolean;\n ignoredComponents?: string[];\n}\n\ninterface AnnotationPluginPass extends PluginPass {\n opts: AnnotationOpts;\n}\n\ntype AnnotationPlugin = PluginObj<AnnotationPluginPass>;\n\n// We must export the plugin as default, otherwise the Babel loader will not be able to resolve it when configured using its string identifier\nexport default function componentNameAnnotatePlugin({ types: t }: typeof Babel): AnnotationPlugin {\n return {\n visitor: {\n FunctionDeclaration(path, state) {\n if (!path.node.id || !path.node.id.name) {\n return;\n }\n if (isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n functionBodyPushAttributes(\n state.opts[\"annotate-fragments\"] === true,\n t,\n path,\n path.node.id.name,\n sourceFileNameFromState(state),\n attributeNamesFromState(state),\n state.opts.ignoredComponents ?? []\n );\n },\n ArrowFunctionExpression(path, state) {\n // We're expecting a `VariableDeclarator` like `const MyComponent =`\n const parent = path.parent;\n\n if (\n !parent ||\n !(\"id\" in parent) ||\n !parent.id ||\n !(\"name\" in parent.id) ||\n !parent.id.name\n ) {\n return;\n }\n\n if (isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n functionBodyPushAttributes(\n state.opts[\"annotate-fragments\"] === true,\n t,\n path,\n parent.id.name,\n sourceFileNameFromState(state),\n attributeNamesFromState(state),\n state.opts.ignoredComponents ?? []\n );\n },\n ClassDeclaration(path, state) {\n const name = path.get(\"id\");\n const properties = path.get(\"body\").get(\"body\");\n const render = properties.find((prop) => {\n return prop.isClassMethod() && prop.get(\"key\").isIdentifier({ name: \"render\" });\n });\n\n if (!render || !render.traverse || isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n const ignoredComponents = state.opts.ignoredComponents ?? [];\n\n render.traverse({\n ReturnStatement(returnStatement) {\n const arg = returnStatement.get(\"argument\");\n\n if (!arg.isJSXElement() && !arg.isJSXFragment()) {\n return;\n }\n\n processJSX(\n state.opts[\"annotate-fragments\"] === true,\n t,\n arg,\n name.node && name.node.name,\n sourceFileNameFromState(state),\n attributeNamesFromState(state),\n ignoredComponents\n );\n },\n });\n },\n },\n };\n}\n\nfunction functionBodyPushAttributes(\n annotateFragments: boolean,\n t: typeof Babel.types,\n path: Babel.NodePath<Babel.types.Function>,\n componentName: string,\n sourceFileName: string | undefined,\n attributeNames: string[],\n ignoredComponents: string[]\n): void {\n let jsxNode: Babel.NodePath;\n\n const functionBody = path.get(\"body\").get(\"body\");\n\n if (\n !(\"length\" in functionBody) &&\n functionBody.parent &&\n (functionBody.parent.type === \"JSXElement\" || functionBody.parent.type === \"JSXFragment\")\n ) {\n const maybeJsxNode = functionBody.find((c) => {\n return c.type === \"JSXElement\" || c.type === \"JSXFragment\";\n });\n\n if (!maybeJsxNode) {\n return;\n }\n\n jsxNode = maybeJsxNode;\n } else {\n const returnStatement = functionBody.find((c) => {\n return c.type === \"ReturnStatement\";\n });\n if (!returnStatement) {\n return;\n }\n\n const arg = returnStatement.get(\"argument\");\n if (!arg) {\n return;\n }\n\n if (Array.isArray(arg)) {\n return;\n }\n\n // Handle the case of a function body returning a ternary operation.\n // `return (maybeTrue ? '' : (<SubComponent />))`\n if (arg.isConditionalExpression()) {\n const consequent = arg.get(\"consequent\");\n if (consequent.isJSXFragment() || consequent.isJSXElement()) {\n processJSX(\n annotateFragments,\n t,\n consequent,\n componentName,\n sourceFileName,\n attributeNames,\n ignoredComponents\n );\n }\n const alternate = arg.get(\"alternate\");\n if (alternate.isJSXFragment() || alternate.isJSXElement()) {\n processJSX(\n annotateFragments,\n t,\n alternate,\n componentName,\n sourceFileName,\n attributeNames,\n ignoredComponents\n );\n }\n return;\n }\n\n if (!arg.isJSXFragment() && !arg.isJSXElement()) {\n return;\n }\n\n jsxNode = arg;\n }\n\n if (!jsxNode) {\n return;\n }\n\n processJSX(\n annotateFragments,\n t,\n jsxNode,\n componentName,\n sourceFileName,\n attributeNames,\n ignoredComponents\n );\n}\n\nfunction processJSX(\n annotateFragments: boolean,\n t: typeof Babel.types,\n jsxNode: Babel.NodePath,\n componentName: string | null,\n sourceFileName: string | undefined,\n attributeNames: string[],\n ignoredComponents: string[]\n): void {\n if (!jsxNode) {\n return;\n }\n // NOTE: I don't know of a case where `openingElement` would have more than one item,\n // but it's safer to always iterate\n const paths = jsxNode.get(\"openingElement\");\n const openingElements = Array.isArray(paths) ? paths : [paths];\n\n openingElements.forEach((openingElement) => {\n applyAttributes(\n t,\n openingElement as Babel.NodePath<Babel.types.JSXOpeningElement>,\n componentName,\n sourceFileName,\n attributeNames,\n ignoredComponents\n );\n });\n\n let children = jsxNode.get(\"children\");\n // TODO: See why `Array.isArray` doesn't have correct behaviour here\n if (children && !(\"length\" in children)) {\n // A single child was found, maybe a bit of static text\n children = [children];\n }\n\n let shouldSetComponentName = annotateFragments;\n\n children.forEach((child) => {\n // Happens for some node types like plain text\n if (!child.node) {\n return;\n }\n\n // Children don't receive the data-component attribute so we pass null for componentName unless it's the first child of a Fragment with a node and `annotateFragments` is true\n const openingElement = child.get(\"openingElement\");\n // TODO: Improve this. We never expect to have multiple opening elements\n // but if it's possible, this should work\n if (Array.isArray(openingElement)) {\n return;\n }\n\n if (shouldSetComponentName && openingElement && openingElement.node) {\n shouldSetComponentName = false;\n processJSX(\n annotateFragments,\n t,\n child,\n componentName,\n sourceFileName,\n attributeNames,\n ignoredComponents\n );\n } else {\n processJSX(\n annotateFragments,\n t,\n child,\n null,\n sourceFileName,\n attributeNames,\n ignoredComponents\n );\n }\n });\n}\n\nfunction applyAttributes(\n t: typeof Babel.types,\n openingElement: Babel.NodePath<Babel.types.JSXOpeningElement>,\n componentName: string | null,\n sourceFileName: string | undefined,\n attributeNames: string[],\n ignoredComponents: string[]\n): void {\n const [componentAttributeName, elementAttributeName, sourceFileAttributeName] = attributeNames;\n\n if (isReactFragment(t, openingElement)) {\n return;\n }\n // e.g., Raw JSX text like the `A` in `<h1>a</h1>`\n if (!openingElement.node) {\n return;\n }\n\n if (!openingElement.node.attributes) openingElement.node.attributes = [];\n const elementName = getPathName(t, openingElement);\n\n const isAnIgnoredComponent = ignoredComponents.some(\n (ignoredComponent) => ignoredComponent === componentName || ignoredComponent === elementName\n );\n\n // Add a stable attribute for the element name but only for non-DOM names\n let isAnIgnoredElement = false;\n if (\n !isAnIgnoredComponent &&\n !hasAttributeWithName(openingElement, componentAttributeName) &&\n (componentAttributeName !== elementAttributeName || !componentName)\n ) {\n if (DEFAULT_IGNORED_ELEMENTS.includes(elementName)) {\n isAnIgnoredElement = true;\n } else {\n // TODO: Is it possible to avoid this null check?\n if (elementAttributeName) {\n openingElement.node.attributes.push(\n t.jSXAttribute(t.jSXIdentifier(elementAttributeName), t.stringLiteral(elementName))\n );\n }\n }\n }\n\n // Add a stable attribute for the component name (absent for non-root elements)\n if (\n componentName &&\n !isAnIgnoredComponent &&\n !hasAttributeWithName(openingElement, componentAttributeName)\n ) {\n // TODO: Is it possible to avoid this null check?\n if (componentAttributeName) {\n openingElement.node.attributes.push(\n t.jSXAttribute(t.jSXIdentifier(componentAttributeName), t.stringLiteral(componentName))\n );\n }\n }\n\n // Add a stable attribute for the source file name (absent for non-root elements)\n if (\n sourceFileName &&\n !isAnIgnoredComponent &&\n (componentName || isAnIgnoredElement === false) &&\n !hasAttributeWithName(openingElement, sourceFileAttributeName)\n ) {\n // TODO: Is it possible to avoid this null check?\n if (sourceFileAttributeName) {\n openingElement.node.attributes.push(\n t.jSXAttribute(t.jSXIdentifier(sourceFileAttributeName), t.stringLiteral(sourceFileName))\n );\n }\n }\n}\n\nfunction sourceFileNameFromState(state: AnnotationPluginPass): string | undefined {\n const name = fullSourceFileNameFromState(state);\n if (!name) {\n return undefined;\n }\n\n if (name.indexOf(\"/\") !== -1) {\n return name.split(\"/\").pop();\n } else if (name.indexOf(\"\\\\\") !== -1) {\n return name.split(\"\\\\\").pop();\n } else {\n return name;\n }\n}\n\nfunction fullSourceFileNameFromState(state: AnnotationPluginPass): string | null {\n // @ts-expect-error This type is incorrect in Babel, `sourceFileName` is the correct type\n const name = state.file.opts.parserOpts?.sourceFileName as unknown;\n\n if (typeof name === \"string\") {\n return name;\n }\n\n return null;\n}\n\nfunction isKnownIncompatiblePluginFromState(state: AnnotationPluginPass): boolean {\n const fullSourceFileName = fullSourceFileNameFromState(state);\n\n if (!fullSourceFileName) {\n return false;\n }\n\n return KNOWN_INCOMPATIBLE_PLUGINS.some((pluginName) => {\n if (\n fullSourceFileName.includes(`/node_modules/${pluginName}/`) ||\n fullSourceFileName.includes(`\\\\node_modules\\\\${pluginName}\\\\`)\n ) {\n return true;\n }\n\n return false;\n });\n}\n\nfunction attributeNamesFromState(state: AnnotationPluginPass): [string, string, string] {\n if (state.opts.native) {\n return [nativeComponentName, nativeElementName, nativeSourceFileName];\n }\n\n return [webComponentName, webElementName, webSourceFileName];\n}\n\nfunction isReactFragment(t: typeof Babel.types, openingElement: Babel.NodePath): boolean {\n if (openingElement.isJSXFragment()) {\n return true;\n }\n\n const elementName = getPathName(t, openingElement);\n\n if (elementName === \"Fragment\" || elementName === \"React.Fragment\") {\n return true;\n }\n\n // TODO: All these objects are typed as unknown, maybe an oversight in Babel types?\n if (\n openingElement.node &&\n \"name\" in openingElement.node &&\n openingElement.node.name &&\n typeof openingElement.node.name === \"object\" &&\n \"type\" in openingElement.node.name &&\n openingElement.node.name.type === \"JSXMemberExpression\"\n ) {\n if (!(\"name\" in openingElement.node)) {\n return false;\n }\n\n const nodeName = openingElement.node.name;\n if (typeof nodeName !== \"object\" || !nodeName) {\n return false;\n }\n\n if (\"object\" in nodeName && \"property\" in nodeName) {\n const nodeNameObject = nodeName.object;\n const nodeNameProperty = nodeName.property;\n\n if (typeof nodeNameObject !== \"object\" || typeof nodeNameProperty !== \"object\") {\n return false;\n }\n\n if (!nodeNameObject || !nodeNameProperty) {\n return false;\n }\n\n const objectName = \"name\" in nodeNameObject && nodeNameObject.name;\n const propertyName = \"name\" in nodeNameProperty && nodeNameProperty.name;\n\n if (objectName === \"React\" && propertyName === \"Fragment\") {\n return true;\n }\n }\n }\n\n return false;\n}\n\nfunction hasAttributeWithName(\n openingElement: Babel.NodePath<Babel.types.JSXOpeningElement>,\n name: string | undefined | null\n): boolean {\n if (!name) {\n return false;\n }\n\n return openingElement.node.attributes.some((node) => {\n if (node.type === \"JSXAttribute\") {\n return node.name.name === name;\n }\n\n return false;\n });\n}\n\nfunction getPathName(t: typeof Babel.types, path: Babel.NodePath): string {\n if (!path.node) return UNKNOWN_ELEMENT_NAME;\n if (!(\"name\" in path.node)) {\n return UNKNOWN_ELEMENT_NAME;\n }\n\n const name = path.node.name;\n\n if (typeof name === \"string\") {\n return name;\n }\n\n if (t.isIdentifier(name) || t.isJSXIdentifier(name)) {\n return name.name;\n }\n\n if (t.isJSXNamespacedName(name)) {\n return name.name.name;\n }\n\n // Handle JSX member expressions like Tab.Group\n if (t.isJSXMemberExpression(name)) {\n const objectName = getJSXMemberExpressionObjectName(t, name.object);\n const propertyName = name.property.name;\n return `${objectName}.${propertyName}`;\n }\n\n return UNKNOWN_ELEMENT_NAME;\n}\n\n// Recursively handle nested member expressions (e.g. Components.UI.Header)\nfunction getJSXMemberExpressionObjectName(\n t: typeof Babel.types,\n object: Babel.types.JSXMemberExpression | Babel.types.JSXIdentifier\n): string {\n if (t.isJSXIdentifier(object)) {\n return object.name;\n }\n if (t.isJSXMemberExpression(object)) {\n const objectName = getJSXMemberExpressionObjectName(t, object.object);\n return `${objectName}.${object.property.name}`;\n }\n\n return UNKNOWN_ELEMENT_NAME;\n}\n\nconst UNKNOWN_ELEMENT_NAME = \"unknown\";\n"],"names":["KNOWN_INCOMPATIBLE_PLUGINS","DEFAULT_IGNORED_ELEMENTS","webComponentName","webElementName","webSourceFileName","nativeComponentName","nativeElementName","nativeSourceFileName","componentNameAnnotatePlugin","_ref","t","types","visitor","FunctionDeclaration","path","state","_state$opts$ignoredCo","node","id","name","isKnownIncompatiblePluginFromState","functionBodyPushAttributes","opts","sourceFileNameFromState","attributeNamesFromState","ignoredComponents","ArrowFunctionExpression","_state$opts$ignoredCo2","parent","ClassDeclaration","_state$opts$ignoredCo3","get","properties","render","find","prop","isClassMethod","isIdentifier","traverse","ReturnStatement","returnStatement","arg","isJSXElement","isJSXFragment","processJSX","annotateFragments","componentName","sourceFileName","attributeNames","jsxNode","functionBody","type","maybeJsxNode","c","Array","isArray","isConditionalExpression","consequent","alternate","paths","openingElements","forEach","openingElement","applyAttributes","children","shouldSetComponentName","child","_attributeNames","_slicedToArray","componentAttributeName","elementAttributeName","sourceFileAttributeName","isReactFragment","attributes","elementName","getPathName","isAnIgnoredComponent","some","ignoredComponent","isAnIgnoredElement","hasAttributeWithName","includes","push","jSXAttribute","jSXIdentifier","stringLiteral","fullSourceFileNameFromState","undefined","indexOf","split","pop","_state$file$opts$pars","file","parserOpts","fullSourceFileName","pluginName","concat","_typeof","nodeName","nodeNameObject","object","nodeNameProperty","property","objectName","propertyName","UNKNOWN_ELEMENT_NAME","isJSXIdentifier","isJSXNamespacedName","isJSXMemberExpression","getJSXMemberExpressionObjectName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA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AAA6E,MAAA,CAAUO,UAAU,EAAAP,GAAAA,CAAAA,CAAAA,MAAA,CAAIQ,YAAY,CAAA,CAAA;AACtC,GAAA;AAEA,EAAA,OAAOC,oBAAoB,CAAA;AAC7B,CAAA;;AAEA;AACA,SAASI,gCAAgCA,CACvCnG,CAAqB,EACrB0F,MAAmE,EAC3D;AACR,EAAA,IAAI1F,CAAC,CAACgG,eAAe,CAACN,MAAM,CAAC,EAAE;IAC7B,OAAOA,MAAM,CAACjF,IAAI,CAAA;AACpB,GAAA;AACA,EAAA,IAAIT,CAAC,CAACkG,qBAAqB,CAACR,MAAM,CAAC,EAAE;IACnC,IAAMG,UAAU,GAAGM,gCAAgC,CAACnG,CAAC,EAAE0F,MAAM,CAACA,MAAM,CAAC,CAAA;IACrE,OAAAJ,EAAAA,CAAAA,MAAA,CAAUO,UAAU,EAAAP,GAAAA,CAAAA,CAAAA,MAAA,CAAII,MAAM,CAACE,QAAQ,CAACnF,IAAI,CAAA,CAAA;AAC9C,GAAA;AAEA,EAAA,OAAOsF,oBAAoB,CAAA;AAC7B,CAAA;AAEA,IAAMA,oBAAoB,GAAG,SAAS;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/constants.ts","../../src/index.ts"],"sourcesContent":["/**\n * MIT License\n *\n * Copyright (c) 2020 Engineering at FullStory\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n */\n\nexport const KNOWN_INCOMPATIBLE_PLUGINS = [\n // This module might be causing an issue preventing clicks. For safety, we won't run on this module.\n \"react-native-testfairy\",\n // This module checks for unexpected property keys and throws an exception.\n \"@react-navigation\",\n];\n\nexport const DEFAULT_IGNORED_ELEMENTS = [\n \"a\",\n \"abbr\",\n \"address\",\n \"area\",\n \"article\",\n \"aside\",\n \"audio\",\n \"b\",\n \"base\",\n \"bdi\",\n \"bdo\",\n \"blockquote\",\n \"body\",\n \"br\",\n \"button\",\n \"canvas\",\n \"caption\",\n \"cite\",\n \"code\",\n \"col\",\n \"colgroup\",\n \"data\",\n \"datalist\",\n \"dd\",\n \"del\",\n \"details\",\n \"dfn\",\n \"dialog\",\n \"div\",\n \"dl\",\n \"dt\",\n \"em\",\n \"embed\",\n \"fieldset\",\n \"figure\",\n \"footer\",\n \"form\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"head\",\n \"header\",\n \"hgroup\",\n \"hr\",\n \"html\",\n \"i\",\n \"iframe\",\n \"img\",\n \"input\",\n \"ins\",\n \"kbd\",\n \"keygen\",\n \"label\",\n \"legend\",\n \"li\",\n \"link\",\n \"main\",\n \"map\",\n \"mark\",\n \"menu\",\n \"menuitem\",\n \"meter\",\n \"nav\",\n \"noscript\",\n \"object\",\n \"ol\",\n \"optgroup\",\n \"option\",\n \"output\",\n \"p\",\n \"param\",\n \"pre\",\n \"progress\",\n \"q\",\n \"rb\",\n \"rp\",\n \"rt\",\n \"rtc\",\n \"ruby\",\n \"s\",\n \"samp\",\n \"script\",\n \"section\",\n \"select\",\n \"small\",\n \"source\",\n \"span\",\n \"strong\",\n \"style\",\n \"sub\",\n \"summary\",\n \"sup\",\n \"table\",\n \"tbody\",\n \"td\",\n \"template\",\n \"textarea\",\n \"tfoot\",\n \"th\",\n \"thead\",\n \"time\",\n \"title\",\n \"tr\",\n \"track\",\n \"u\",\n \"ul\",\n \"var\",\n \"video\",\n \"wbr\",\n];\n","/**\n * MIT License\n *\n * Copyright (c) 2020 Engineering at FullStory\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n */\n\n/**\n * The following code is based on the FullStory Babel plugin, but has been modified to work\n * with Sentry products:\n *\n * - Added `sentry` to data properties, i.e `data-sentry-component`\n * - Converted to TypeScript\n * - Code cleanups\n */\n\nimport type * as Babel from \"@babel/core\";\nimport type { PluginObj, PluginPass } from \"@babel/core\";\n\nimport { DEFAULT_IGNORED_ELEMENTS, KNOWN_INCOMPATIBLE_PLUGINS } from \"./constants\";\n\nconst webComponentName = \"data-sentry-component\";\nconst webElementName = \"data-sentry-element\";\nconst webSourceFileName = \"data-sentry-source-file\";\n\nconst nativeComponentName = \"dataSentryComponent\";\nconst nativeElementName = \"dataSentryElement\";\nconst nativeSourceFileName = \"dataSentrySourceFile\";\n\ninterface AnnotationOpts {\n native?: boolean;\n \"annotate-fragments\"?: boolean;\n ignoredComponents?: string[];\n}\n\ninterface FragmentContext {\n fragmentAliases: Set<string>;\n reactNamespaceAliases: Set<string>;\n}\n\ninterface AnnotationPluginPass extends PluginPass {\n opts: AnnotationOpts;\n sentryFragmentContext?: FragmentContext;\n}\n\ntype AnnotationPlugin = PluginObj<AnnotationPluginPass>;\n\n// Shared context object for all JSX processing functions\ninterface JSXProcessingContext {\n /** Whether to annotate React fragments */\n annotateFragments: boolean;\n /** Babel types object */\n t: typeof Babel.types;\n /** Name of the React component */\n componentName: string;\n /** Source file name (optional) */\n sourceFileName?: string;\n /** Array of attribute names [component, element, sourceFile] */\n attributeNames: string[];\n /** Array of component names to ignore */\n ignoredComponents: string[];\n /** Fragment context for identifying React fragments */\n fragmentContext?: FragmentContext;\n}\n\n// We must export the plugin as default, otherwise the Babel loader will not be able to resolve it when configured using its string identifier\nexport default function componentNameAnnotatePlugin({ types: t }: typeof Babel): AnnotationPlugin {\n return {\n visitor: {\n Program: {\n enter(path, state) {\n const fragmentContext = collectFragmentContext(path);\n state.sentryFragmentContext = fragmentContext;\n },\n },\n FunctionDeclaration(path, state) {\n if (!path.node.id || !path.node.id.name) {\n return;\n }\n if (isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n const context = createJSXProcessingContext(state, t, path.node.id.name);\n functionBodyPushAttributes(context, path);\n },\n ArrowFunctionExpression(path, state) {\n // We're expecting a `VariableDeclarator` like `const MyComponent =`\n const parent = path.parent;\n\n if (\n !parent ||\n !(\"id\" in parent) ||\n !parent.id ||\n !(\"name\" in parent.id) ||\n !parent.id.name\n ) {\n return;\n }\n\n if (isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n const context = createJSXProcessingContext(state, t, parent.id.name);\n functionBodyPushAttributes(context, path);\n },\n ClassDeclaration(path, state) {\n const name = path.get(\"id\");\n const properties = path.get(\"body\").get(\"body\");\n const render = properties.find((prop) => {\n return prop.isClassMethod() && prop.get(\"key\").isIdentifier({ name: \"render\" });\n });\n\n if (!render || !render.traverse || isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n const context = createJSXProcessingContext(state, t, name.node?.name || \"\");\n\n render.traverse({\n ReturnStatement(returnStatement) {\n const arg = returnStatement.get(\"argument\");\n\n if (!arg.isJSXElement() && !arg.isJSXFragment()) {\n return;\n }\n\n processJSX(context, arg);\n },\n });\n },\n },\n };\n}\n\n/**\n * Creates a JSX processing context from the plugin state\n */\nfunction createJSXProcessingContext(\n state: AnnotationPluginPass,\n t: typeof Babel.types,\n componentName: string\n): JSXProcessingContext {\n return {\n annotateFragments: state.opts[\"annotate-fragments\"] === true,\n t,\n componentName,\n sourceFileName: sourceFileNameFromState(state),\n attributeNames: attributeNamesFromState(state),\n ignoredComponents: state.opts.ignoredComponents ?? [],\n fragmentContext: state.sentryFragmentContext,\n };\n}\n\n/**\n * Processes the body of a function to add Sentry tracking attributes to JSX elements.\n * Handles various function body structures including direct JSX returns, conditional expressions,\n * and nested JSX elements.\n */\nfunction functionBodyPushAttributes(\n context: JSXProcessingContext,\n path: Babel.NodePath<Babel.types.Function>\n): void {\n let jsxNode: Babel.NodePath;\n\n const functionBody = path.get(\"body\").get(\"body\");\n\n if (\n !(\"length\" in functionBody) &&\n functionBody.parent &&\n (functionBody.parent.type === \"JSXElement\" || functionBody.parent.type === \"JSXFragment\")\n ) {\n const maybeJsxNode = functionBody.find((c) => {\n return c.type === \"JSXElement\" || c.type === \"JSXFragment\";\n });\n\n if (!maybeJsxNode) {\n return;\n }\n\n jsxNode = maybeJsxNode;\n } else {\n const returnStatement = functionBody.find((c) => {\n return c.type === \"ReturnStatement\";\n });\n if (!returnStatement) {\n return;\n }\n\n const arg = returnStatement.get(\"argument\");\n if (!arg) {\n return;\n }\n\n if (Array.isArray(arg)) {\n return;\n }\n\n // Handle the case of a function body returning a ternary operation.\n // `return (maybeTrue ? '' : (<SubComponent />))`\n if (arg.isConditionalExpression()) {\n const consequent = arg.get(\"consequent\");\n if (consequent.isJSXFragment() || consequent.isJSXElement()) {\n processJSX(context, consequent);\n }\n const alternate = arg.get(\"alternate\");\n if (alternate.isJSXFragment() || alternate.isJSXElement()) {\n processJSX(context, alternate);\n }\n return;\n }\n\n if (!arg.isJSXFragment() && !arg.isJSXElement()) {\n return;\n }\n\n jsxNode = arg;\n }\n\n if (!jsxNode) {\n return;\n }\n\n processJSX(context, jsxNode);\n}\n\n/**\n * Recursively processes JSX elements to add Sentry tracking attributes.\n * Handles both JSX elements and fragments, applying appropriate attributes\n * based on configuration and component context.\n */\nfunction processJSX(\n context: JSXProcessingContext,\n jsxNode: Babel.NodePath,\n componentName?: string\n): void {\n if (!jsxNode) {\n return;\n }\n\n // Use provided componentName or fall back to context componentName\n const currentComponentName = componentName ?? context.componentName;\n\n // NOTE: I don't know of a case where `openingElement` would have more than one item,\n // but it's safer to always iterate\n const paths = jsxNode.get(\"openingElement\");\n const openingElements = Array.isArray(paths) ? paths : [paths];\n\n openingElements.forEach((openingElement) => {\n applyAttributes(\n context,\n openingElement as Babel.NodePath<Babel.types.JSXOpeningElement>,\n currentComponentName\n );\n });\n\n let children = jsxNode.get(\"children\");\n // TODO: See why `Array.isArray` doesn't have correct behaviour here\n if (children && !(\"length\" in children)) {\n // A single child was found, maybe a bit of static text\n children = [children];\n }\n\n let shouldSetComponentName = context.annotateFragments;\n\n children.forEach((child) => {\n // Happens for some node types like plain text\n if (!child.node) {\n return;\n }\n\n // Children don't receive the data-component attribute so we pass null for componentName unless it's the first child of a Fragment with a node and `annotateFragments` is true\n const openingElement = child.get(\"openingElement\");\n // TODO: Improve this. We never expect to have multiple opening elements\n // but if it's possible, this should work\n if (Array.isArray(openingElement)) {\n return;\n }\n\n if (shouldSetComponentName && openingElement && openingElement.node) {\n shouldSetComponentName = false;\n processJSX(context, child, currentComponentName);\n } else {\n processJSX(context, child, \"\");\n }\n });\n}\n\n/**\n * Applies Sentry tracking attributes to a JSX opening element.\n * Adds component name, element name, and source file attributes while\n * respecting ignore lists and fragment detection.\n */\nfunction applyAttributes(\n context: JSXProcessingContext,\n openingElement: Babel.NodePath<Babel.types.JSXOpeningElement>,\n componentName: string\n): void {\n const { t, attributeNames, ignoredComponents, fragmentContext, sourceFileName } = context;\n const [componentAttributeName, elementAttributeName, sourceFileAttributeName] = attributeNames;\n\n // e.g., Raw JSX text like the `A` in `<h1>a</h1>`\n if (!openingElement.node) {\n return;\n }\n\n // Check if this is a React fragment - if so, skip attribute addition entirely\n const isFragment = isReactFragment(t, openingElement, fragmentContext);\n if (isFragment) {\n return;\n }\n\n if (!openingElement.node.attributes) openingElement.node.attributes = [];\n const elementName = getPathName(t, openingElement);\n\n const isAnIgnoredComponent = ignoredComponents.some(\n (ignoredComponent) => ignoredComponent === componentName || ignoredComponent === elementName\n );\n\n // Add a stable attribute for the element name but only for non-DOM names\n let isAnIgnoredElement = false;\n if (!isAnIgnoredComponent && !hasAttributeWithName(openingElement, elementAttributeName)) {\n if (DEFAULT_IGNORED_ELEMENTS.includes(elementName)) {\n isAnIgnoredElement = true;\n } else {\n // Always add element attribute for non-ignored elements\n if (elementAttributeName) {\n openingElement.node.attributes.push(\n t.jSXAttribute(t.jSXIdentifier(elementAttributeName), t.stringLiteral(elementName))\n );\n }\n }\n }\n\n // Add a stable attribute for the component name (absent for non-root elements)\n if (\n componentName &&\n !isAnIgnoredComponent &&\n !hasAttributeWithName(openingElement, componentAttributeName)\n ) {\n if (componentAttributeName) {\n openingElement.node.attributes.push(\n t.jSXAttribute(t.jSXIdentifier(componentAttributeName), t.stringLiteral(componentName))\n );\n }\n }\n\n // Add a stable attribute for the source file name\n // Updated condition: add source file for elements that have either:\n // 1. A component name (root elements), OR\n // 2. An element name that's not ignored (child elements)\n if (\n sourceFileName &&\n !isAnIgnoredComponent &&\n (componentName || !isAnIgnoredElement) &&\n !hasAttributeWithName(openingElement, sourceFileAttributeName)\n ) {\n if (sourceFileAttributeName) {\n openingElement.node.attributes.push(\n t.jSXAttribute(t.jSXIdentifier(sourceFileAttributeName), t.stringLiteral(sourceFileName))\n );\n }\n }\n}\n\nfunction sourceFileNameFromState(state: AnnotationPluginPass): string | undefined {\n const name = fullSourceFileNameFromState(state);\n if (!name) {\n return undefined;\n }\n\n if (name.indexOf(\"/\") !== -1) {\n return name.split(\"/\").pop();\n } else if (name.indexOf(\"\\\\\") !== -1) {\n return name.split(\"\\\\\").pop();\n } else {\n return name;\n }\n}\n\nfunction fullSourceFileNameFromState(state: AnnotationPluginPass): string | null {\n // @ts-expect-error This type is incorrect in Babel, `sourceFileName` is the correct type\n const name = state.file.opts.parserOpts?.sourceFileName as unknown;\n\n if (typeof name === \"string\") {\n return name;\n }\n\n return null;\n}\n\nfunction isKnownIncompatiblePluginFromState(state: AnnotationPluginPass): boolean {\n const fullSourceFileName = fullSourceFileNameFromState(state);\n\n if (!fullSourceFileName) {\n return false;\n }\n\n return KNOWN_INCOMPATIBLE_PLUGINS.some((pluginName) => {\n if (\n fullSourceFileName.includes(`/node_modules/${pluginName}/`) ||\n fullSourceFileName.includes(`\\\\node_modules\\\\${pluginName}\\\\`)\n ) {\n return true;\n }\n\n return false;\n });\n}\n\nfunction attributeNamesFromState(state: AnnotationPluginPass): [string, string, string] {\n if (state.opts.native) {\n return [nativeComponentName, nativeElementName, nativeSourceFileName];\n }\n\n return [webComponentName, webElementName, webSourceFileName];\n}\n\nfunction collectFragmentContext(programPath: Babel.NodePath): FragmentContext {\n const fragmentAliases = new Set<string>();\n const reactNamespaceAliases = new Set<string>([\"React\"]); // Default React namespace\n\n programPath.traverse({\n ImportDeclaration(importPath) {\n const source = importPath.node.source.value;\n\n // Handle React imports\n if (source === \"react\" || source === \"React\") {\n importPath.node.specifiers.forEach((spec) => {\n if (spec.type === \"ImportSpecifier\" && spec.imported.type === \"Identifier\") {\n // Detect aliased React.Fragment imports (e.g., `Fragment as F`)\n // so we can later identify <F> as a fragment in JSX.\n if (spec.imported.name === \"Fragment\") {\n fragmentAliases.add(spec.local.name);\n }\n } else if (\n spec.type === \"ImportDefaultSpecifier\" ||\n spec.type === \"ImportNamespaceSpecifier\"\n ) {\n // import React from 'react' -> React OR\n // import * as React from 'react' -> React\n reactNamespaceAliases.add(spec.local.name);\n }\n });\n }\n },\n\n // Handle simple variable assignments only (avoid complex cases)\n VariableDeclarator(varPath) {\n if (varPath.node.init) {\n const init = varPath.node.init;\n\n // Handle identifier assignments: const MyFragment = Fragment\n if (varPath.node.id.type === \"Identifier\") {\n // Handle: const MyFragment = Fragment (only if Fragment is a known alias)\n if (init.type === \"Identifier\" && fragmentAliases.has(init.name)) {\n fragmentAliases.add(varPath.node.id.name);\n }\n\n // Handle: const MyFragment = React.Fragment (only for known React namespaces)\n if (\n init.type === \"MemberExpression\" &&\n init.object.type === \"Identifier\" &&\n init.property.type === \"Identifier\" &&\n init.property.name === \"Fragment\" &&\n reactNamespaceAliases.has(init.object.name)\n ) {\n fragmentAliases.add(varPath.node.id.name);\n }\n }\n\n // Handle destructuring assignments: const { Fragment } = React\n if (varPath.node.id.type === \"ObjectPattern\") {\n if (init.type === \"Identifier\" && reactNamespaceAliases.has(init.name)) {\n const properties = varPath.node.id.properties;\n\n for (const prop of properties) {\n if (\n prop.type === \"ObjectProperty\" &&\n prop.key &&\n prop.key.type === \"Identifier\" &&\n prop.value &&\n prop.value.type === \"Identifier\" &&\n prop.key.name === \"Fragment\"\n ) {\n fragmentAliases.add(prop.value.name);\n }\n }\n }\n }\n }\n },\n });\n\n return { fragmentAliases, reactNamespaceAliases };\n}\n\nfunction isReactFragment(\n t: typeof Babel.types,\n openingElement: Babel.NodePath,\n context?: FragmentContext // Add this optional parameter\n): boolean {\n // Handle JSX fragments (<>)\n if (openingElement.isJSXFragment()) {\n return true;\n }\n\n const elementName = getPathName(t, openingElement);\n\n // Direct fragment references\n if (elementName === \"Fragment\" || elementName === \"React.Fragment\") {\n return true;\n }\n\n // TODO: All these objects are typed as unknown, maybe an oversight in Babel types?\n\n // Check if the element name is a known fragment alias\n if (context && elementName && context.fragmentAliases.has(elementName)) {\n return true;\n }\n\n // Handle JSXMemberExpression\n if (\n openingElement.node &&\n \"name\" in openingElement.node &&\n openingElement.node.name &&\n typeof openingElement.node.name === \"object\" &&\n \"type\" in openingElement.node.name &&\n openingElement.node.name.type === \"JSXMemberExpression\"\n ) {\n const nodeName = openingElement.node.name;\n if (typeof nodeName !== \"object\" || !nodeName) {\n return false;\n }\n\n if (\"object\" in nodeName && \"property\" in nodeName) {\n const nodeNameObject = nodeName.object;\n const nodeNameProperty = nodeName.property;\n\n if (typeof nodeNameObject !== \"object\" || typeof nodeNameProperty !== \"object\") {\n return false;\n }\n\n if (!nodeNameObject || !nodeNameProperty) {\n return false;\n }\n\n const objectName = \"name\" in nodeNameObject && nodeNameObject.name;\n const propertyName = \"name\" in nodeNameProperty && nodeNameProperty.name;\n\n // React.Fragment check\n if (objectName === \"React\" && propertyName === \"Fragment\") {\n return true;\n }\n\n // Enhanced checks using context\n if (context) {\n // Check React.Fragment pattern with known React namespaces\n if (\n context.reactNamespaceAliases.has(objectName as string) &&\n propertyName === \"Fragment\"\n ) {\n return true;\n }\n\n // Check MyFragment.Fragment pattern\n if (context.fragmentAliases.has(objectName as string) && propertyName === \"Fragment\") {\n return true;\n }\n }\n }\n }\n\n return false;\n}\n\nfunction hasAttributeWithName(\n openingElement: Babel.NodePath<Babel.types.JSXOpeningElement>,\n name: string | undefined | null\n): boolean {\n if (!name) {\n return false;\n }\n\n return openingElement.node.attributes.some((node) => {\n if (node.type === \"JSXAttribute\") {\n return node.name.name === name;\n }\n\n return false;\n });\n}\n\nfunction getPathName(t: typeof Babel.types, path: Babel.NodePath): string {\n if (!path.node) return UNKNOWN_ELEMENT_NAME;\n if (!(\"name\" in path.node)) {\n return UNKNOWN_ELEMENT_NAME;\n }\n\n const name = path.node.name;\n\n if (typeof name === \"string\") {\n return name;\n }\n\n if (t.isIdentifier(name) || t.isJSXIdentifier(name)) {\n return name.name;\n }\n\n if (t.isJSXNamespacedName(name)) {\n return name.name.name;\n }\n\n // Handle JSX member expressions like Tab.Group\n if (t.isJSXMemberExpression(name)) {\n const objectName = getJSXMemberExpressionObjectName(t, name.object);\n const propertyName = name.property.name;\n return `${objectName}.${propertyName}`;\n }\n\n return UNKNOWN_ELEMENT_NAME;\n}\n\n// Recursively handle nested member expressions (e.g. Components.UI.Header)\nfunction getJSXMemberExpressionObjectName(\n t: typeof Babel.types,\n object: Babel.types.JSXMemberExpression | Babel.types.JSXIdentifier\n): string {\n if (t.isJSXIdentifier(object)) {\n return object.name;\n }\n if (t.isJSXMemberExpression(object)) {\n const objectName = getJSXMemberExpressionObjectName(t, object.object);\n return `${objectName}.${object.property.name}`;\n }\n\n return UNKNOWN_ELEMENT_NAME;\n}\n\nconst UNKNOWN_ELEMENT_NAME = \"unknown\";\n"],"names":["KNOWN_INCOMPATIBLE_PLUGINS","DEFAULT_IGNORED_ELEMENTS","webComponentName","webElementName","webSourceFileName","nativeComponentName","nativeElementName","nativeSourceFileName","componentNameAnnotatePlugin","_ref","t","types","visitor","Program","enter","path","state","fragmentContext","collectFragmentContext","sentryFragmentContext","FunctionDeclaration","node","id","name","isKnownIncompatiblePluginFromState","context","createJSXProcessingContext","functionBodyPushAttributes","ArrowFunctionExpression","parent","ClassDeclaration","_name$node","get","properties","render","find","prop","isClassMethod","isIdentifier","traverse","ReturnStatement","returnStatement","arg","isJSXElement","isJSXFragment","processJSX","componentName","_state$opts$ignoredCo","annotateFragments","opts","sourceFileName","sourceFileNameFromState","attributeNames","attributeNamesFromState","ignoredComponents","jsxNode","functionBody","type","maybeJsxNode","c","Array","isArray","isConditionalExpression","consequent","alternate","currentComponentName","paths","openingElements","forEach","openingElement","applyAttributes","children","shouldSetComponentName","child","_attributeNames","_slicedToArray","componentAttributeName","elementAttributeName","sourceFileAttributeName","isFragment","isReactFragment","attributes","elementName","getPathName","isAnIgnoredComponent","some","ignoredComponent","isAnIgnoredElement","hasAttributeWithName","includes","push","jSXAttribute","jSXIdentifier","stringLiteral","fullSourceFileNameFromState","undefined","indexOf","split","pop","_state$file$opts$pars","file","parserOpts","fullSourceFileName","pluginName","concat","programPath","fragmentAliases","Set","reactNamespaceAliases","ImportDeclaration","importPath","source","value","specifiers","spec","imported","add","local","VariableDeclarator","varPath","init","has","object","property","_iterator","_createForOfIteratorHelper","_step","s","n","done","key","err","e","f","_typeof","nodeName","nodeNameObject","nodeNameProperty","objectName","propertyName","UNKNOWN_ELEMENT_NAME","isJSXIdentifier","isJSXNamespacedName","isJSXMemberExpression","getJSXMemberExpressionObjectName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,IAAMA,0BAA0B,GAAG;AACxC;AACA,wBAAwB;AACxB;AACA,mBAAmB,CACpB,CAAA;AAEM,IAAMC,wBAAwB,GAAG,CACtC,GAAG,EACH,MAAM,EACN,SAAS,EACT,MAAM,EACN,SAAS,EACT,OAAO,EACP,OAAO,EACP,GAAG,EACH,MAAM,EACN,KAAK,EACL,KAAK,EACL,YAAY,EACZ,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,MAAM,EACN,MAAM,EACN,KAAK,EACL,UAAU,EACV,MAAM,EACN,UAAU,EACV,IAAI,EACJ,KAAK,EACL,SAAS,EACT,KAAK,EACL,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EAC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CAACtI,CAAC,EAAEgH,MAAM,CAACA,MAAM,CAAC,CAAA;IACrE,OAAAlB,EAAAA,CAAAA,MAAA,CAAUkC,UAAU,EAAAlC,GAAAA,CAAAA,CAAAA,MAAA,CAAIkB,MAAM,CAACC,QAAQ,CAACpG,IAAI,CAAA,CAAA;AAC9C,GAAA;AAEA,EAAA,OAAOqH,oBAAoB,CAAA;AAC7B,CAAA;AAEA,IAAMA,oBAAoB,GAAG,SAAS;;;;"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -56,6 +56,57 @@ function _arrayLikeToArray(arr, len) {
|
|
|
56
56
|
function _nonIterableRest() {
|
|
57
57
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
58
58
|
}
|
|
59
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
60
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
61
|
+
if (!it) {
|
|
62
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
63
|
+
if (it) o = it;
|
|
64
|
+
var i = 0;
|
|
65
|
+
var F = function () {};
|
|
66
|
+
return {
|
|
67
|
+
s: F,
|
|
68
|
+
n: function () {
|
|
69
|
+
if (i >= o.length) return {
|
|
70
|
+
done: true
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
done: false,
|
|
74
|
+
value: o[i++]
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
e: function (e) {
|
|
78
|
+
throw e;
|
|
79
|
+
},
|
|
80
|
+
f: F
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
84
|
+
}
|
|
85
|
+
var normalCompletion = true,
|
|
86
|
+
didErr = false,
|
|
87
|
+
err;
|
|
88
|
+
return {
|
|
89
|
+
s: function () {
|
|
90
|
+
it = it.call(o);
|
|
91
|
+
},
|
|
92
|
+
n: function () {
|
|
93
|
+
var step = it.next();
|
|
94
|
+
normalCompletion = step.done;
|
|
95
|
+
return step;
|
|
96
|
+
},
|
|
97
|
+
e: function (e) {
|
|
98
|
+
didErr = true;
|
|
99
|
+
err = e;
|
|
100
|
+
},
|
|
101
|
+
f: function () {
|
|
102
|
+
try {
|
|
103
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
104
|
+
} finally {
|
|
105
|
+
if (didErr) throw err;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
59
110
|
|
|
60
111
|
/**
|
|
61
112
|
* MIT License
|
|
@@ -95,23 +146,31 @@ var webSourceFileName = "data-sentry-source-file";
|
|
|
95
146
|
var nativeComponentName = "dataSentryComponent";
|
|
96
147
|
var nativeElementName = "dataSentryElement";
|
|
97
148
|
var nativeSourceFileName = "dataSentrySourceFile";
|
|
149
|
+
|
|
150
|
+
// Shared context object for all JSX processing functions
|
|
151
|
+
|
|
98
152
|
// We must export the plugin as default, otherwise the Babel loader will not be able to resolve it when configured using its string identifier
|
|
99
153
|
function componentNameAnnotatePlugin(_ref) {
|
|
100
154
|
var t = _ref.types;
|
|
101
155
|
return {
|
|
102
156
|
visitor: {
|
|
157
|
+
Program: {
|
|
158
|
+
enter: function enter(path, state) {
|
|
159
|
+
var fragmentContext = collectFragmentContext(path);
|
|
160
|
+
state.sentryFragmentContext = fragmentContext;
|
|
161
|
+
}
|
|
162
|
+
},
|
|
103
163
|
FunctionDeclaration: function FunctionDeclaration(path, state) {
|
|
104
|
-
var _state$opts$ignoredCo;
|
|
105
164
|
if (!path.node.id || !path.node.id.name) {
|
|
106
165
|
return;
|
|
107
166
|
}
|
|
108
167
|
if (isKnownIncompatiblePluginFromState(state)) {
|
|
109
168
|
return;
|
|
110
169
|
}
|
|
111
|
-
|
|
170
|
+
var context = createJSXProcessingContext(state, t, path.node.id.name);
|
|
171
|
+
functionBodyPushAttributes(context, path);
|
|
112
172
|
},
|
|
113
173
|
ArrowFunctionExpression: function ArrowFunctionExpression(path, state) {
|
|
114
|
-
var _state$opts$ignoredCo2;
|
|
115
174
|
// We're expecting a `VariableDeclarator` like `const MyComponent =`
|
|
116
175
|
var parent = path.parent;
|
|
117
176
|
if (!parent || !("id" in parent) || !parent.id || !("name" in parent.id) || !parent.id.name) {
|
|
@@ -120,10 +179,11 @@ function componentNameAnnotatePlugin(_ref) {
|
|
|
120
179
|
if (isKnownIncompatiblePluginFromState(state)) {
|
|
121
180
|
return;
|
|
122
181
|
}
|
|
123
|
-
|
|
182
|
+
var context = createJSXProcessingContext(state, t, parent.id.name);
|
|
183
|
+
functionBodyPushAttributes(context, path);
|
|
124
184
|
},
|
|
125
185
|
ClassDeclaration: function ClassDeclaration(path, state) {
|
|
126
|
-
var
|
|
186
|
+
var _name$node;
|
|
127
187
|
var name = path.get("id");
|
|
128
188
|
var properties = path.get("body").get("body");
|
|
129
189
|
var render = properties.find(function (prop) {
|
|
@@ -134,21 +194,43 @@ function componentNameAnnotatePlugin(_ref) {
|
|
|
134
194
|
if (!render || !render.traverse || isKnownIncompatiblePluginFromState(state)) {
|
|
135
195
|
return;
|
|
136
196
|
}
|
|
137
|
-
var
|
|
197
|
+
var context = createJSXProcessingContext(state, t, ((_name$node = name.node) === null || _name$node === void 0 ? void 0 : _name$node.name) || "");
|
|
138
198
|
render.traverse({
|
|
139
199
|
ReturnStatement: function ReturnStatement(returnStatement) {
|
|
140
200
|
var arg = returnStatement.get("argument");
|
|
141
201
|
if (!arg.isJSXElement() && !arg.isJSXFragment()) {
|
|
142
202
|
return;
|
|
143
203
|
}
|
|
144
|
-
processJSX(
|
|
204
|
+
processJSX(context, arg);
|
|
145
205
|
}
|
|
146
206
|
});
|
|
147
207
|
}
|
|
148
208
|
}
|
|
149
209
|
};
|
|
150
210
|
}
|
|
151
|
-
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Creates a JSX processing context from the plugin state
|
|
214
|
+
*/
|
|
215
|
+
function createJSXProcessingContext(state, t, componentName) {
|
|
216
|
+
var _state$opts$ignoredCo;
|
|
217
|
+
return {
|
|
218
|
+
annotateFragments: state.opts["annotate-fragments"] === true,
|
|
219
|
+
t: t,
|
|
220
|
+
componentName: componentName,
|
|
221
|
+
sourceFileName: sourceFileNameFromState(state),
|
|
222
|
+
attributeNames: attributeNamesFromState(state),
|
|
223
|
+
ignoredComponents: (_state$opts$ignoredCo = state.opts.ignoredComponents) !== null && _state$opts$ignoredCo !== void 0 ? _state$opts$ignoredCo : [],
|
|
224
|
+
fragmentContext: state.sentryFragmentContext
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Processes the body of a function to add Sentry tracking attributes to JSX elements.
|
|
230
|
+
* Handles various function body structures including direct JSX returns, conditional expressions,
|
|
231
|
+
* and nested JSX elements.
|
|
232
|
+
*/
|
|
233
|
+
function functionBodyPushAttributes(context, path) {
|
|
152
234
|
var jsxNode;
|
|
153
235
|
var functionBody = path.get("body").get("body");
|
|
154
236
|
if (!("length" in functionBody) && functionBody.parent && (functionBody.parent.type === "JSXElement" || functionBody.parent.type === "JSXFragment")) {
|
|
@@ -179,11 +261,11 @@ function functionBodyPushAttributes(annotateFragments, t, path, componentName, s
|
|
|
179
261
|
if (arg.isConditionalExpression()) {
|
|
180
262
|
var consequent = arg.get("consequent");
|
|
181
263
|
if (consequent.isJSXFragment() || consequent.isJSXElement()) {
|
|
182
|
-
processJSX(
|
|
264
|
+
processJSX(context, consequent);
|
|
183
265
|
}
|
|
184
266
|
var alternate = arg.get("alternate");
|
|
185
267
|
if (alternate.isJSXFragment() || alternate.isJSXElement()) {
|
|
186
|
-
processJSX(
|
|
268
|
+
processJSX(context, alternate);
|
|
187
269
|
}
|
|
188
270
|
return;
|
|
189
271
|
}
|
|
@@ -195,18 +277,28 @@ function functionBodyPushAttributes(annotateFragments, t, path, componentName, s
|
|
|
195
277
|
if (!jsxNode) {
|
|
196
278
|
return;
|
|
197
279
|
}
|
|
198
|
-
processJSX(
|
|
280
|
+
processJSX(context, jsxNode);
|
|
199
281
|
}
|
|
200
|
-
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Recursively processes JSX elements to add Sentry tracking attributes.
|
|
285
|
+
* Handles both JSX elements and fragments, applying appropriate attributes
|
|
286
|
+
* based on configuration and component context.
|
|
287
|
+
*/
|
|
288
|
+
function processJSX(context, jsxNode, componentName) {
|
|
201
289
|
if (!jsxNode) {
|
|
202
290
|
return;
|
|
203
291
|
}
|
|
292
|
+
|
|
293
|
+
// Use provided componentName or fall back to context componentName
|
|
294
|
+
var currentComponentName = componentName !== null && componentName !== void 0 ? componentName : context.componentName;
|
|
295
|
+
|
|
204
296
|
// NOTE: I don't know of a case where `openingElement` would have more than one item,
|
|
205
297
|
// but it's safer to always iterate
|
|
206
298
|
var paths = jsxNode.get("openingElement");
|
|
207
299
|
var openingElements = Array.isArray(paths) ? paths : [paths];
|
|
208
300
|
openingElements.forEach(function (openingElement) {
|
|
209
|
-
applyAttributes(
|
|
301
|
+
applyAttributes(context, openingElement, currentComponentName);
|
|
210
302
|
});
|
|
211
303
|
var children = jsxNode.get("children");
|
|
212
304
|
// TODO: See why `Array.isArray` doesn't have correct behaviour here
|
|
@@ -214,7 +306,7 @@ function processJSX(annotateFragments, t, jsxNode, componentName, sourceFileName
|
|
|
214
306
|
// A single child was found, maybe a bit of static text
|
|
215
307
|
children = [children];
|
|
216
308
|
}
|
|
217
|
-
var shouldSetComponentName = annotateFragments;
|
|
309
|
+
var shouldSetComponentName = context.annotateFragments;
|
|
218
310
|
children.forEach(function (child) {
|
|
219
311
|
// Happens for some node types like plain text
|
|
220
312
|
if (!child.node) {
|
|
@@ -230,24 +322,39 @@ function processJSX(annotateFragments, t, jsxNode, componentName, sourceFileName
|
|
|
230
322
|
}
|
|
231
323
|
if (shouldSetComponentName && openingElement && openingElement.node) {
|
|
232
324
|
shouldSetComponentName = false;
|
|
233
|
-
processJSX(
|
|
325
|
+
processJSX(context, child, currentComponentName);
|
|
234
326
|
} else {
|
|
235
|
-
processJSX(
|
|
327
|
+
processJSX(context, child, "");
|
|
236
328
|
}
|
|
237
329
|
});
|
|
238
330
|
}
|
|
239
|
-
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Applies Sentry tracking attributes to a JSX opening element.
|
|
334
|
+
* Adds component name, element name, and source file attributes while
|
|
335
|
+
* respecting ignore lists and fragment detection.
|
|
336
|
+
*/
|
|
337
|
+
function applyAttributes(context, openingElement, componentName) {
|
|
338
|
+
var t = context.t,
|
|
339
|
+
attributeNames = context.attributeNames,
|
|
340
|
+
ignoredComponents = context.ignoredComponents,
|
|
341
|
+
fragmentContext = context.fragmentContext,
|
|
342
|
+
sourceFileName = context.sourceFileName;
|
|
240
343
|
var _attributeNames = _slicedToArray(attributeNames, 3),
|
|
241
344
|
componentAttributeName = _attributeNames[0],
|
|
242
345
|
elementAttributeName = _attributeNames[1],
|
|
243
346
|
sourceFileAttributeName = _attributeNames[2];
|
|
244
|
-
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
347
|
+
|
|
247
348
|
// e.g., Raw JSX text like the `A` in `<h1>a</h1>`
|
|
248
349
|
if (!openingElement.node) {
|
|
249
350
|
return;
|
|
250
351
|
}
|
|
352
|
+
|
|
353
|
+
// Check if this is a React fragment - if so, skip attribute addition entirely
|
|
354
|
+
var isFragment = isReactFragment(t, openingElement, fragmentContext);
|
|
355
|
+
if (isFragment) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
251
358
|
if (!openingElement.node.attributes) openingElement.node.attributes = [];
|
|
252
359
|
var elementName = getPathName(t, openingElement);
|
|
253
360
|
var isAnIgnoredComponent = ignoredComponents.some(function (ignoredComponent) {
|
|
@@ -256,11 +363,11 @@ function applyAttributes(t, openingElement, componentName, sourceFileName, attri
|
|
|
256
363
|
|
|
257
364
|
// Add a stable attribute for the element name but only for non-DOM names
|
|
258
365
|
var isAnIgnoredElement = false;
|
|
259
|
-
if (!isAnIgnoredComponent && !hasAttributeWithName(openingElement,
|
|
366
|
+
if (!isAnIgnoredComponent && !hasAttributeWithName(openingElement, elementAttributeName)) {
|
|
260
367
|
if (DEFAULT_IGNORED_ELEMENTS.includes(elementName)) {
|
|
261
368
|
isAnIgnoredElement = true;
|
|
262
369
|
} else {
|
|
263
|
-
//
|
|
370
|
+
// Always add element attribute for non-ignored elements
|
|
264
371
|
if (elementAttributeName) {
|
|
265
372
|
openingElement.node.attributes.push(t.jSXAttribute(t.jSXIdentifier(elementAttributeName), t.stringLiteral(elementName)));
|
|
266
373
|
}
|
|
@@ -269,15 +376,16 @@ function applyAttributes(t, openingElement, componentName, sourceFileName, attri
|
|
|
269
376
|
|
|
270
377
|
// Add a stable attribute for the component name (absent for non-root elements)
|
|
271
378
|
if (componentName && !isAnIgnoredComponent && !hasAttributeWithName(openingElement, componentAttributeName)) {
|
|
272
|
-
// TODO: Is it possible to avoid this null check?
|
|
273
379
|
if (componentAttributeName) {
|
|
274
380
|
openingElement.node.attributes.push(t.jSXAttribute(t.jSXIdentifier(componentAttributeName), t.stringLiteral(componentName)));
|
|
275
381
|
}
|
|
276
382
|
}
|
|
277
383
|
|
|
278
|
-
// Add a stable attribute for the source file name
|
|
279
|
-
|
|
280
|
-
|
|
384
|
+
// Add a stable attribute for the source file name
|
|
385
|
+
// Updated condition: add source file for elements that have either:
|
|
386
|
+
// 1. A component name (root elements), OR
|
|
387
|
+
// 2. An element name that's not ignored (child elements)
|
|
388
|
+
if (sourceFileName && !isAnIgnoredComponent && (componentName || !isAnIgnoredElement) && !hasAttributeWithName(openingElement, sourceFileAttributeName)) {
|
|
281
389
|
if (sourceFileAttributeName) {
|
|
282
390
|
openingElement.node.attributes.push(t.jSXAttribute(t.jSXIdentifier(sourceFileAttributeName), t.stringLiteral(sourceFileName)));
|
|
283
391
|
}
|
|
@@ -323,20 +431,98 @@ function attributeNamesFromState(state) {
|
|
|
323
431
|
}
|
|
324
432
|
return [webComponentName, webElementName, webSourceFileName];
|
|
325
433
|
}
|
|
326
|
-
function
|
|
434
|
+
function collectFragmentContext(programPath) {
|
|
435
|
+
var fragmentAliases = new Set();
|
|
436
|
+
var reactNamespaceAliases = new Set(["React"]); // Default React namespace
|
|
437
|
+
|
|
438
|
+
programPath.traverse({
|
|
439
|
+
ImportDeclaration: function ImportDeclaration(importPath) {
|
|
440
|
+
var source = importPath.node.source.value;
|
|
441
|
+
|
|
442
|
+
// Handle React imports
|
|
443
|
+
if (source === "react" || source === "React") {
|
|
444
|
+
importPath.node.specifiers.forEach(function (spec) {
|
|
445
|
+
if (spec.type === "ImportSpecifier" && spec.imported.type === "Identifier") {
|
|
446
|
+
// Detect aliased React.Fragment imports (e.g., `Fragment as F`)
|
|
447
|
+
// so we can later identify <F> as a fragment in JSX.
|
|
448
|
+
if (spec.imported.name === "Fragment") {
|
|
449
|
+
fragmentAliases.add(spec.local.name);
|
|
450
|
+
}
|
|
451
|
+
} else if (spec.type === "ImportDefaultSpecifier" || spec.type === "ImportNamespaceSpecifier") {
|
|
452
|
+
// import React from 'react' -> React OR
|
|
453
|
+
// import * as React from 'react' -> React
|
|
454
|
+
reactNamespaceAliases.add(spec.local.name);
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
// Handle simple variable assignments only (avoid complex cases)
|
|
460
|
+
VariableDeclarator: function VariableDeclarator(varPath) {
|
|
461
|
+
if (varPath.node.init) {
|
|
462
|
+
var init = varPath.node.init;
|
|
463
|
+
|
|
464
|
+
// Handle identifier assignments: const MyFragment = Fragment
|
|
465
|
+
if (varPath.node.id.type === "Identifier") {
|
|
466
|
+
// Handle: const MyFragment = Fragment (only if Fragment is a known alias)
|
|
467
|
+
if (init.type === "Identifier" && fragmentAliases.has(init.name)) {
|
|
468
|
+
fragmentAliases.add(varPath.node.id.name);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// Handle: const MyFragment = React.Fragment (only for known React namespaces)
|
|
472
|
+
if (init.type === "MemberExpression" && init.object.type === "Identifier" && init.property.type === "Identifier" && init.property.name === "Fragment" && reactNamespaceAliases.has(init.object.name)) {
|
|
473
|
+
fragmentAliases.add(varPath.node.id.name);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// Handle destructuring assignments: const { Fragment } = React
|
|
478
|
+
if (varPath.node.id.type === "ObjectPattern") {
|
|
479
|
+
if (init.type === "Identifier" && reactNamespaceAliases.has(init.name)) {
|
|
480
|
+
var properties = varPath.node.id.properties;
|
|
481
|
+
var _iterator = _createForOfIteratorHelper(properties),
|
|
482
|
+
_step;
|
|
483
|
+
try {
|
|
484
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
485
|
+
var prop = _step.value;
|
|
486
|
+
if (prop.type === "ObjectProperty" && prop.key && prop.key.type === "Identifier" && prop.value && prop.value.type === "Identifier" && prop.key.name === "Fragment") {
|
|
487
|
+
fragmentAliases.add(prop.value.name);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
} catch (err) {
|
|
491
|
+
_iterator.e(err);
|
|
492
|
+
} finally {
|
|
493
|
+
_iterator.f();
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
return {
|
|
501
|
+
fragmentAliases: fragmentAliases,
|
|
502
|
+
reactNamespaceAliases: reactNamespaceAliases
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
function isReactFragment(t, openingElement, context) {
|
|
506
|
+
// Handle JSX fragments (<>)
|
|
327
507
|
if (openingElement.isJSXFragment()) {
|
|
328
508
|
return true;
|
|
329
509
|
}
|
|
330
510
|
var elementName = getPathName(t, openingElement);
|
|
511
|
+
|
|
512
|
+
// Direct fragment references
|
|
331
513
|
if (elementName === "Fragment" || elementName === "React.Fragment") {
|
|
332
514
|
return true;
|
|
333
515
|
}
|
|
334
516
|
|
|
335
517
|
// TODO: All these objects are typed as unknown, maybe an oversight in Babel types?
|
|
518
|
+
|
|
519
|
+
// Check if the element name is a known fragment alias
|
|
520
|
+
if (context && elementName && context.fragmentAliases.has(elementName)) {
|
|
521
|
+
return true;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// Handle JSXMemberExpression
|
|
336
525
|
if (openingElement.node && "name" in openingElement.node && openingElement.node.name && _typeof(openingElement.node.name) === "object" && "type" in openingElement.node.name && openingElement.node.name.type === "JSXMemberExpression") {
|
|
337
|
-
if (!("name" in openingElement.node)) {
|
|
338
|
-
return false;
|
|
339
|
-
}
|
|
340
526
|
var nodeName = openingElement.node.name;
|
|
341
527
|
if (_typeof(nodeName) !== "object" || !nodeName) {
|
|
342
528
|
return false;
|
|
@@ -352,9 +538,24 @@ function isReactFragment(t, openingElement) {
|
|
|
352
538
|
}
|
|
353
539
|
var objectName = "name" in nodeNameObject && nodeNameObject.name;
|
|
354
540
|
var propertyName = "name" in nodeNameProperty && nodeNameProperty.name;
|
|
541
|
+
|
|
542
|
+
// React.Fragment check
|
|
355
543
|
if (objectName === "React" && propertyName === "Fragment") {
|
|
356
544
|
return true;
|
|
357
545
|
}
|
|
546
|
+
|
|
547
|
+
// Enhanced checks using context
|
|
548
|
+
if (context) {
|
|
549
|
+
// Check React.Fragment pattern with known React namespaces
|
|
550
|
+
if (context.reactNamespaceAliases.has(objectName) && propertyName === "Fragment") {
|
|
551
|
+
return true;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// Check MyFragment.Fragment pattern
|
|
555
|
+
if (context.fragmentAliases.has(objectName) && propertyName === "Fragment") {
|
|
556
|
+
return true;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
358
559
|
}
|
|
359
560
|
}
|
|
360
561
|
return false;
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/constants.ts","../../src/index.ts"],"sourcesContent":["/**\n * MIT License\n *\n * Copyright (c) 2020 Engineering at FullStory\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n */\n\nexport const KNOWN_INCOMPATIBLE_PLUGINS = [\n // This module might be causing an issue preventing clicks. For safety, we won't run on this module.\n \"react-native-testfairy\",\n // This module checks for unexpected property keys and throws an exception.\n \"@react-navigation\",\n];\n\nexport const DEFAULT_IGNORED_ELEMENTS = [\n \"a\",\n \"abbr\",\n \"address\",\n \"area\",\n \"article\",\n \"aside\",\n \"audio\",\n \"b\",\n \"base\",\n \"bdi\",\n \"bdo\",\n \"blockquote\",\n \"body\",\n \"br\",\n \"button\",\n \"canvas\",\n \"caption\",\n \"cite\",\n \"code\",\n \"col\",\n \"colgroup\",\n \"data\",\n \"datalist\",\n \"dd\",\n \"del\",\n \"details\",\n \"dfn\",\n \"dialog\",\n \"div\",\n \"dl\",\n \"dt\",\n \"em\",\n \"embed\",\n \"fieldset\",\n \"figure\",\n \"footer\",\n \"form\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"head\",\n \"header\",\n \"hgroup\",\n \"hr\",\n \"html\",\n \"i\",\n \"iframe\",\n \"img\",\n \"input\",\n \"ins\",\n \"kbd\",\n \"keygen\",\n \"label\",\n \"legend\",\n \"li\",\n \"link\",\n \"main\",\n \"map\",\n \"mark\",\n \"menu\",\n \"menuitem\",\n \"meter\",\n \"nav\",\n \"noscript\",\n \"object\",\n \"ol\",\n \"optgroup\",\n \"option\",\n \"output\",\n \"p\",\n \"param\",\n \"pre\",\n \"progress\",\n \"q\",\n \"rb\",\n \"rp\",\n \"rt\",\n \"rtc\",\n \"ruby\",\n \"s\",\n \"samp\",\n \"script\",\n \"section\",\n \"select\",\n \"small\",\n \"source\",\n \"span\",\n \"strong\",\n \"style\",\n \"sub\",\n \"summary\",\n \"sup\",\n \"table\",\n \"tbody\",\n \"td\",\n \"template\",\n \"textarea\",\n \"tfoot\",\n \"th\",\n \"thead\",\n \"time\",\n \"title\",\n \"tr\",\n \"track\",\n \"u\",\n \"ul\",\n \"var\",\n \"video\",\n \"wbr\",\n];\n","/**\n * MIT License\n *\n * Copyright (c) 2020 Engineering at FullStory\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n */\n\n/**\n * The following code is based on the FullStory Babel plugin, but has been modified to work\n * with Sentry products:\n *\n * - Added `sentry` to data properties, i.e `data-sentry-component`\n * - Converted to TypeScript\n * - Code cleanups\n */\n\nimport type * as Babel from \"@babel/core\";\nimport type { PluginObj, PluginPass } from \"@babel/core\";\n\nimport { DEFAULT_IGNORED_ELEMENTS, KNOWN_INCOMPATIBLE_PLUGINS } from \"./constants\";\n\nconst webComponentName = \"data-sentry-component\";\nconst webElementName = \"data-sentry-element\";\nconst webSourceFileName = \"data-sentry-source-file\";\n\nconst nativeComponentName = \"dataSentryComponent\";\nconst nativeElementName = \"dataSentryElement\";\nconst nativeSourceFileName = \"dataSentrySourceFile\";\n\ninterface AnnotationOpts {\n native?: boolean;\n \"annotate-fragments\"?: boolean;\n ignoredComponents?: string[];\n}\n\ninterface AnnotationPluginPass extends PluginPass {\n opts: AnnotationOpts;\n}\n\ntype AnnotationPlugin = PluginObj<AnnotationPluginPass>;\n\n// We must export the plugin as default, otherwise the Babel loader will not be able to resolve it when configured using its string identifier\nexport default function componentNameAnnotatePlugin({ types: t }: typeof Babel): AnnotationPlugin {\n return {\n visitor: {\n FunctionDeclaration(path, state) {\n if (!path.node.id || !path.node.id.name) {\n return;\n }\n if (isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n functionBodyPushAttributes(\n state.opts[\"annotate-fragments\"] === true,\n t,\n path,\n path.node.id.name,\n sourceFileNameFromState(state),\n attributeNamesFromState(state),\n state.opts.ignoredComponents ?? []\n );\n },\n ArrowFunctionExpression(path, state) {\n // We're expecting a `VariableDeclarator` like `const MyComponent =`\n const parent = path.parent;\n\n if (\n !parent ||\n !(\"id\" in parent) ||\n !parent.id ||\n !(\"name\" in parent.id) ||\n !parent.id.name\n ) {\n return;\n }\n\n if (isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n functionBodyPushAttributes(\n state.opts[\"annotate-fragments\"] === true,\n t,\n path,\n parent.id.name,\n sourceFileNameFromState(state),\n attributeNamesFromState(state),\n state.opts.ignoredComponents ?? []\n );\n },\n ClassDeclaration(path, state) {\n const name = path.get(\"id\");\n const properties = path.get(\"body\").get(\"body\");\n const render = properties.find((prop) => {\n return prop.isClassMethod() && prop.get(\"key\").isIdentifier({ name: \"render\" });\n });\n\n if (!render || !render.traverse || isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n const ignoredComponents = state.opts.ignoredComponents ?? [];\n\n render.traverse({\n ReturnStatement(returnStatement) {\n const arg = returnStatement.get(\"argument\");\n\n if (!arg.isJSXElement() && !arg.isJSXFragment()) {\n return;\n }\n\n processJSX(\n state.opts[\"annotate-fragments\"] === true,\n t,\n arg,\n name.node && name.node.name,\n sourceFileNameFromState(state),\n attributeNamesFromState(state),\n ignoredComponents\n );\n },\n });\n },\n },\n };\n}\n\nfunction functionBodyPushAttributes(\n annotateFragments: boolean,\n t: typeof Babel.types,\n path: Babel.NodePath<Babel.types.Function>,\n componentName: string,\n sourceFileName: string | undefined,\n attributeNames: string[],\n ignoredComponents: string[]\n): void {\n let jsxNode: Babel.NodePath;\n\n const functionBody = path.get(\"body\").get(\"body\");\n\n if (\n !(\"length\" in functionBody) &&\n functionBody.parent &&\n (functionBody.parent.type === \"JSXElement\" || functionBody.parent.type === \"JSXFragment\")\n ) {\n const maybeJsxNode = functionBody.find((c) => {\n return c.type === \"JSXElement\" || c.type === \"JSXFragment\";\n });\n\n if (!maybeJsxNode) {\n return;\n }\n\n jsxNode = maybeJsxNode;\n } else {\n const returnStatement = functionBody.find((c) => {\n return c.type === \"ReturnStatement\";\n });\n if (!returnStatement) {\n return;\n }\n\n const arg = returnStatement.get(\"argument\");\n if (!arg) {\n return;\n }\n\n if (Array.isArray(arg)) {\n return;\n }\n\n // Handle the case of a function body returning a ternary operation.\n // `return (maybeTrue ? '' : (<SubComponent />))`\n if (arg.isConditionalExpression()) {\n const consequent = arg.get(\"consequent\");\n if (consequent.isJSXFragment() || consequent.isJSXElement()) {\n processJSX(\n annotateFragments,\n t,\n consequent,\n componentName,\n sourceFileName,\n attributeNames,\n ignoredComponents\n );\n }\n const alternate = arg.get(\"alternate\");\n if (alternate.isJSXFragment() || alternate.isJSXElement()) {\n processJSX(\n annotateFragments,\n t,\n alternate,\n componentName,\n sourceFileName,\n attributeNames,\n ignoredComponents\n );\n }\n return;\n }\n\n if (!arg.isJSXFragment() && !arg.isJSXElement()) {\n return;\n }\n\n jsxNode = arg;\n }\n\n if (!jsxNode) {\n return;\n }\n\n processJSX(\n annotateFragments,\n t,\n jsxNode,\n componentName,\n sourceFileName,\n attributeNames,\n ignoredComponents\n );\n}\n\nfunction processJSX(\n annotateFragments: boolean,\n t: typeof Babel.types,\n jsxNode: Babel.NodePath,\n componentName: string | null,\n sourceFileName: string | undefined,\n attributeNames: string[],\n ignoredComponents: string[]\n): void {\n if (!jsxNode) {\n return;\n }\n // NOTE: I don't know of a case where `openingElement` would have more than one item,\n // but it's safer to always iterate\n const paths = jsxNode.get(\"openingElement\");\n const openingElements = Array.isArray(paths) ? paths : [paths];\n\n openingElements.forEach((openingElement) => {\n applyAttributes(\n t,\n openingElement as Babel.NodePath<Babel.types.JSXOpeningElement>,\n componentName,\n sourceFileName,\n attributeNames,\n ignoredComponents\n );\n });\n\n let children = jsxNode.get(\"children\");\n // TODO: See why `Array.isArray` doesn't have correct behaviour here\n if (children && !(\"length\" in children)) {\n // A single child was found, maybe a bit of static text\n children = [children];\n }\n\n let shouldSetComponentName = annotateFragments;\n\n children.forEach((child) => {\n // Happens for some node types like plain text\n if (!child.node) {\n return;\n }\n\n // Children don't receive the data-component attribute so we pass null for componentName unless it's the first child of a Fragment with a node and `annotateFragments` is true\n const openingElement = child.get(\"openingElement\");\n // TODO: Improve this. We never expect to have multiple opening elements\n // but if it's possible, this should work\n if (Array.isArray(openingElement)) {\n return;\n }\n\n if (shouldSetComponentName && openingElement && openingElement.node) {\n shouldSetComponentName = false;\n processJSX(\n annotateFragments,\n t,\n child,\n componentName,\n sourceFileName,\n attributeNames,\n ignoredComponents\n );\n } else {\n processJSX(\n annotateFragments,\n t,\n child,\n null,\n sourceFileName,\n attributeNames,\n ignoredComponents\n );\n }\n });\n}\n\nfunction applyAttributes(\n t: typeof Babel.types,\n openingElement: Babel.NodePath<Babel.types.JSXOpeningElement>,\n componentName: string | null,\n sourceFileName: string | undefined,\n attributeNames: string[],\n ignoredComponents: string[]\n): void {\n const [componentAttributeName, elementAttributeName, sourceFileAttributeName] = attributeNames;\n\n if (isReactFragment(t, openingElement)) {\n return;\n }\n // e.g., Raw JSX text like the `A` in `<h1>a</h1>`\n if (!openingElement.node) {\n return;\n }\n\n if (!openingElement.node.attributes) openingElement.node.attributes = [];\n const elementName = getPathName(t, openingElement);\n\n const isAnIgnoredComponent = ignoredComponents.some(\n (ignoredComponent) => ignoredComponent === componentName || ignoredComponent === elementName\n );\n\n // Add a stable attribute for the element name but only for non-DOM names\n let isAnIgnoredElement = false;\n if (\n !isAnIgnoredComponent &&\n !hasAttributeWithName(openingElement, componentAttributeName) &&\n (componentAttributeName !== elementAttributeName || !componentName)\n ) {\n if (DEFAULT_IGNORED_ELEMENTS.includes(elementName)) {\n isAnIgnoredElement = true;\n } else {\n // TODO: Is it possible to avoid this null check?\n if (elementAttributeName) {\n openingElement.node.attributes.push(\n t.jSXAttribute(t.jSXIdentifier(elementAttributeName), t.stringLiteral(elementName))\n );\n }\n }\n }\n\n // Add a stable attribute for the component name (absent for non-root elements)\n if (\n componentName &&\n !isAnIgnoredComponent &&\n !hasAttributeWithName(openingElement, componentAttributeName)\n ) {\n // TODO: Is it possible to avoid this null check?\n if (componentAttributeName) {\n openingElement.node.attributes.push(\n t.jSXAttribute(t.jSXIdentifier(componentAttributeName), t.stringLiteral(componentName))\n );\n }\n }\n\n // Add a stable attribute for the source file name (absent for non-root elements)\n if (\n sourceFileName &&\n !isAnIgnoredComponent &&\n (componentName || isAnIgnoredElement === false) &&\n !hasAttributeWithName(openingElement, sourceFileAttributeName)\n ) {\n // TODO: Is it possible to avoid this null check?\n if (sourceFileAttributeName) {\n openingElement.node.attributes.push(\n t.jSXAttribute(t.jSXIdentifier(sourceFileAttributeName), t.stringLiteral(sourceFileName))\n );\n }\n }\n}\n\nfunction sourceFileNameFromState(state: AnnotationPluginPass): string | undefined {\n const name = fullSourceFileNameFromState(state);\n if (!name) {\n return undefined;\n }\n\n if (name.indexOf(\"/\") !== -1) {\n return name.split(\"/\").pop();\n } else if (name.indexOf(\"\\\\\") !== -1) {\n return name.split(\"\\\\\").pop();\n } else {\n return name;\n }\n}\n\nfunction fullSourceFileNameFromState(state: AnnotationPluginPass): string | null {\n // @ts-expect-error This type is incorrect in Babel, `sourceFileName` is the correct type\n const name = state.file.opts.parserOpts?.sourceFileName as unknown;\n\n if (typeof name === \"string\") {\n return name;\n }\n\n return null;\n}\n\nfunction isKnownIncompatiblePluginFromState(state: AnnotationPluginPass): boolean {\n const fullSourceFileName = fullSourceFileNameFromState(state);\n\n if (!fullSourceFileName) {\n return false;\n }\n\n return KNOWN_INCOMPATIBLE_PLUGINS.some((pluginName) => {\n if (\n fullSourceFileName.includes(`/node_modules/${pluginName}/`) ||\n fullSourceFileName.includes(`\\\\node_modules\\\\${pluginName}\\\\`)\n ) {\n return true;\n }\n\n return false;\n });\n}\n\nfunction attributeNamesFromState(state: AnnotationPluginPass): [string, string, string] {\n if (state.opts.native) {\n return [nativeComponentName, nativeElementName, nativeSourceFileName];\n }\n\n return [webComponentName, webElementName, webSourceFileName];\n}\n\nfunction isReactFragment(t: typeof Babel.types, openingElement: Babel.NodePath): boolean {\n if (openingElement.isJSXFragment()) {\n return true;\n }\n\n const elementName = getPathName(t, openingElement);\n\n if (elementName === \"Fragment\" || elementName === \"React.Fragment\") {\n return true;\n }\n\n // TODO: All these objects are typed as unknown, maybe an oversight in Babel types?\n if (\n openingElement.node &&\n \"name\" in openingElement.node &&\n openingElement.node.name &&\n typeof openingElement.node.name === \"object\" &&\n \"type\" in openingElement.node.name &&\n openingElement.node.name.type === \"JSXMemberExpression\"\n ) {\n if (!(\"name\" in openingElement.node)) {\n return false;\n }\n\n const nodeName = openingElement.node.name;\n if (typeof nodeName !== \"object\" || !nodeName) {\n return false;\n }\n\n if (\"object\" in nodeName && \"property\" in nodeName) {\n const nodeNameObject = nodeName.object;\n const nodeNameProperty = nodeName.property;\n\n if (typeof nodeNameObject !== \"object\" || typeof nodeNameProperty !== \"object\") {\n return false;\n }\n\n if (!nodeNameObject || !nodeNameProperty) {\n return false;\n }\n\n const objectName = \"name\" in nodeNameObject && nodeNameObject.name;\n const propertyName = \"name\" in nodeNameProperty && nodeNameProperty.name;\n\n if (objectName === \"React\" && propertyName === \"Fragment\") {\n return true;\n }\n }\n }\n\n return false;\n}\n\nfunction hasAttributeWithName(\n openingElement: Babel.NodePath<Babel.types.JSXOpeningElement>,\n name: string | undefined | null\n): boolean {\n if (!name) {\n return false;\n }\n\n return openingElement.node.attributes.some((node) => {\n if (node.type === \"JSXAttribute\") {\n return node.name.name === name;\n }\n\n return false;\n });\n}\n\nfunction getPathName(t: typeof Babel.types, path: Babel.NodePath): string {\n if (!path.node) return UNKNOWN_ELEMENT_NAME;\n if (!(\"name\" in path.node)) {\n return UNKNOWN_ELEMENT_NAME;\n }\n\n const name = path.node.name;\n\n if (typeof name === \"string\") {\n return name;\n }\n\n if (t.isIdentifier(name) || t.isJSXIdentifier(name)) {\n return name.name;\n }\n\n if (t.isJSXNamespacedName(name)) {\n return name.name.name;\n }\n\n // Handle JSX member expressions like Tab.Group\n if (t.isJSXMemberExpression(name)) {\n const objectName = getJSXMemberExpressionObjectName(t, name.object);\n const propertyName = name.property.name;\n return `${objectName}.${propertyName}`;\n }\n\n return UNKNOWN_ELEMENT_NAME;\n}\n\n// Recursively handle nested member expressions (e.g. Components.UI.Header)\nfunction getJSXMemberExpressionObjectName(\n t: typeof Babel.types,\n object: Babel.types.JSXMemberExpression | Babel.types.JSXIdentifier\n): string {\n if (t.isJSXIdentifier(object)) {\n return object.name;\n }\n if (t.isJSXMemberExpression(object)) {\n const objectName = getJSXMemberExpressionObjectName(t, object.object);\n return `${objectName}.${object.property.name}`;\n }\n\n return UNKNOWN_ELEMENT_NAME;\n}\n\nconst UNKNOWN_ELEMENT_NAME = \"unknown\";\n"],"names":["KNOWN_INCOMPATIBLE_PLUGINS","DEFAULT_IGNORED_ELEMENTS","webComponentName","webElementName","webSourceFileName","nativeComponentName","nativeElementName","nativeSourceFileName","componentNameAnnotatePlugin","_ref","t","types","visitor","FunctionDeclaration","path","state","_state$opts$ignoredCo","node","id","name","isKnownIncompatiblePluginFromState","functionBodyPushAttributes","opts","sourceFileNameFromState","attributeNamesFromState","ignoredComponents","ArrowFunctionExpression","_state$opts$ignoredCo2","parent","ClassDeclaration","_state$opts$ignoredCo3","get","properties","render","find","prop","isClassMethod","isIdentifier","traverse","ReturnStatement","returnStatement","arg","isJSXElement","isJSXFragment","processJSX","annotateFragments","componentName","sourceFileName","attributeNames","jsxNode","functionBody","type","maybeJsxNode","c","Array","isArray","isConditionalExpression","consequent","alternate","paths","openingElements","forEach","openingElement","applyAttributes","children","shouldSetComponentName","child","_attributeNames","_slicedToArray","componentAttributeName","elementAttributeName","sourceFileAttributeName","isReactFragment","attributes","elementName","getPathName","isAnIgnoredComponent","some","ignoredComponent","isAnIgnoredElement","hasAttributeWithName","includes","push","jSXAttribute","jSXIdentifier","stringLiteral","fullSourceFileNameFromState","undefined","indexOf","split","pop","_state$file$opts$pars","file","parserOpts","fullSourceFileName","pluginName","concat","_typeof","nodeName","nodeNameObject","object","nodeNameProperty","property","objectName","propertyName","UNKNOWN_ELEMENT_NAME","isJSXIdentifier","isJSXNamespacedName","isJSXMemberExpression","getJSXMemberExpressionObjectName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAI,CAAA;AACvC,IAAA,OAAA,EAAA,CAAA6E,MAAA,CAAUO,UAAU,EAAAP,GAAAA,CAAAA,CAAAA,MAAA,CAAIQ,YAAY,CAAA,CAAA;AACtC,GAAA;AAEA,EAAA,OAAOC,oBAAoB,CAAA;AAC7B,CAAA;;AAEA;AACA,SAASI,gCAAgCA,CACvCnG,CAAqB,EACrB0F,MAAmE,EAC3D;AACR,EAAA,IAAI1F,CAAC,CAACgG,eAAe,CAACN,MAAM,CAAC,EAAE;IAC7B,OAAOA,MAAM,CAACjF,IAAI,CAAA;AACpB,GAAA;AACA,EAAA,IAAIT,CAAC,CAACkG,qBAAqB,CAACR,MAAM,CAAC,EAAE;IACnC,IAAMG,UAAU,GAAGM,gCAAgC,CAACnG,CAAC,EAAE0F,MAAM,CAACA,MAAM,CAAC,CAAA;IACrE,OAAAJ,EAAAA,CAAAA,MAAA,CAAUO,UAAU,EAAAP,GAAAA,CAAAA,CAAAA,MAAA,CAAII,MAAM,CAACE,QAAQ,CAACnF,IAAI,CAAA,CAAA;AAC9C,GAAA;AAEA,EAAA,OAAOsF,oBAAoB,CAAA;AAC7B,CAAA;AAEA,IAAMA,oBAAoB,GAAG,SAAS;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/constants.ts","../../src/index.ts"],"sourcesContent":["/**\n * MIT License\n *\n * Copyright (c) 2020 Engineering at FullStory\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n */\n\nexport const KNOWN_INCOMPATIBLE_PLUGINS = [\n // This module might be causing an issue preventing clicks. For safety, we won't run on this module.\n \"react-native-testfairy\",\n // This module checks for unexpected property keys and throws an exception.\n \"@react-navigation\",\n];\n\nexport const DEFAULT_IGNORED_ELEMENTS = [\n \"a\",\n \"abbr\",\n \"address\",\n \"area\",\n \"article\",\n \"aside\",\n \"audio\",\n \"b\",\n \"base\",\n \"bdi\",\n \"bdo\",\n \"blockquote\",\n \"body\",\n \"br\",\n \"button\",\n \"canvas\",\n \"caption\",\n \"cite\",\n \"code\",\n \"col\",\n \"colgroup\",\n \"data\",\n \"datalist\",\n \"dd\",\n \"del\",\n \"details\",\n \"dfn\",\n \"dialog\",\n \"div\",\n \"dl\",\n \"dt\",\n \"em\",\n \"embed\",\n \"fieldset\",\n \"figure\",\n \"footer\",\n \"form\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"head\",\n \"header\",\n \"hgroup\",\n \"hr\",\n \"html\",\n \"i\",\n \"iframe\",\n \"img\",\n \"input\",\n \"ins\",\n \"kbd\",\n \"keygen\",\n \"label\",\n \"legend\",\n \"li\",\n \"link\",\n \"main\",\n \"map\",\n \"mark\",\n \"menu\",\n \"menuitem\",\n \"meter\",\n \"nav\",\n \"noscript\",\n \"object\",\n \"ol\",\n \"optgroup\",\n \"option\",\n \"output\",\n \"p\",\n \"param\",\n \"pre\",\n \"progress\",\n \"q\",\n \"rb\",\n \"rp\",\n \"rt\",\n \"rtc\",\n \"ruby\",\n \"s\",\n \"samp\",\n \"script\",\n \"section\",\n \"select\",\n \"small\",\n \"source\",\n \"span\",\n \"strong\",\n \"style\",\n \"sub\",\n \"summary\",\n \"sup\",\n \"table\",\n \"tbody\",\n \"td\",\n \"template\",\n \"textarea\",\n \"tfoot\",\n \"th\",\n \"thead\",\n \"time\",\n \"title\",\n \"tr\",\n \"track\",\n \"u\",\n \"ul\",\n \"var\",\n \"video\",\n \"wbr\",\n];\n","/**\n * MIT License\n *\n * Copyright (c) 2020 Engineering at FullStory\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n */\n\n/**\n * The following code is based on the FullStory Babel plugin, but has been modified to work\n * with Sentry products:\n *\n * - Added `sentry` to data properties, i.e `data-sentry-component`\n * - Converted to TypeScript\n * - Code cleanups\n */\n\nimport type * as Babel from \"@babel/core\";\nimport type { PluginObj, PluginPass } from \"@babel/core\";\n\nimport { DEFAULT_IGNORED_ELEMENTS, KNOWN_INCOMPATIBLE_PLUGINS } from \"./constants\";\n\nconst webComponentName = \"data-sentry-component\";\nconst webElementName = \"data-sentry-element\";\nconst webSourceFileName = \"data-sentry-source-file\";\n\nconst nativeComponentName = \"dataSentryComponent\";\nconst nativeElementName = \"dataSentryElement\";\nconst nativeSourceFileName = \"dataSentrySourceFile\";\n\ninterface AnnotationOpts {\n native?: boolean;\n \"annotate-fragments\"?: boolean;\n ignoredComponents?: string[];\n}\n\ninterface FragmentContext {\n fragmentAliases: Set<string>;\n reactNamespaceAliases: Set<string>;\n}\n\ninterface AnnotationPluginPass extends PluginPass {\n opts: AnnotationOpts;\n sentryFragmentContext?: FragmentContext;\n}\n\ntype AnnotationPlugin = PluginObj<AnnotationPluginPass>;\n\n// Shared context object for all JSX processing functions\ninterface JSXProcessingContext {\n /** Whether to annotate React fragments */\n annotateFragments: boolean;\n /** Babel types object */\n t: typeof Babel.types;\n /** Name of the React component */\n componentName: string;\n /** Source file name (optional) */\n sourceFileName?: string;\n /** Array of attribute names [component, element, sourceFile] */\n attributeNames: string[];\n /** Array of component names to ignore */\n ignoredComponents: string[];\n /** Fragment context for identifying React fragments */\n fragmentContext?: FragmentContext;\n}\n\n// We must export the plugin as default, otherwise the Babel loader will not be able to resolve it when configured using its string identifier\nexport default function componentNameAnnotatePlugin({ types: t }: typeof Babel): AnnotationPlugin {\n return {\n visitor: {\n Program: {\n enter(path, state) {\n const fragmentContext = collectFragmentContext(path);\n state.sentryFragmentContext = fragmentContext;\n },\n },\n FunctionDeclaration(path, state) {\n if (!path.node.id || !path.node.id.name) {\n return;\n }\n if (isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n const context = createJSXProcessingContext(state, t, path.node.id.name);\n functionBodyPushAttributes(context, path);\n },\n ArrowFunctionExpression(path, state) {\n // We're expecting a `VariableDeclarator` like `const MyComponent =`\n const parent = path.parent;\n\n if (\n !parent ||\n !(\"id\" in parent) ||\n !parent.id ||\n !(\"name\" in parent.id) ||\n !parent.id.name\n ) {\n return;\n }\n\n if (isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n const context = createJSXProcessingContext(state, t, parent.id.name);\n functionBodyPushAttributes(context, path);\n },\n ClassDeclaration(path, state) {\n const name = path.get(\"id\");\n const properties = path.get(\"body\").get(\"body\");\n const render = properties.find((prop) => {\n return prop.isClassMethod() && prop.get(\"key\").isIdentifier({ name: \"render\" });\n });\n\n if (!render || !render.traverse || isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n const context = createJSXProcessingContext(state, t, name.node?.name || \"\");\n\n render.traverse({\n ReturnStatement(returnStatement) {\n const arg = returnStatement.get(\"argument\");\n\n if (!arg.isJSXElement() && !arg.isJSXFragment()) {\n return;\n }\n\n processJSX(context, arg);\n },\n });\n },\n },\n };\n}\n\n/**\n * Creates a JSX processing context from the plugin state\n */\nfunction createJSXProcessingContext(\n state: AnnotationPluginPass,\n t: typeof Babel.types,\n componentName: string\n): JSXProcessingContext {\n return {\n annotateFragments: state.opts[\"annotate-fragments\"] === true,\n t,\n componentName,\n sourceFileName: sourceFileNameFromState(state),\n attributeNames: attributeNamesFromState(state),\n ignoredComponents: state.opts.ignoredComponents ?? [],\n fragmentContext: state.sentryFragmentContext,\n };\n}\n\n/**\n * Processes the body of a function to add Sentry tracking attributes to JSX elements.\n * Handles various function body structures including direct JSX returns, conditional expressions,\n * and nested JSX elements.\n */\nfunction functionBodyPushAttributes(\n context: JSXProcessingContext,\n path: Babel.NodePath<Babel.types.Function>\n): void {\n let jsxNode: Babel.NodePath;\n\n const functionBody = path.get(\"body\").get(\"body\");\n\n if (\n !(\"length\" in functionBody) &&\n functionBody.parent &&\n (functionBody.parent.type === \"JSXElement\" || functionBody.parent.type === \"JSXFragment\")\n ) {\n const maybeJsxNode = functionBody.find((c) => {\n return c.type === \"JSXElement\" || c.type === \"JSXFragment\";\n });\n\n if (!maybeJsxNode) {\n return;\n }\n\n jsxNode = maybeJsxNode;\n } else {\n const returnStatement = functionBody.find((c) => {\n return c.type === \"ReturnStatement\";\n });\n if (!returnStatement) {\n return;\n }\n\n const arg = returnStatement.get(\"argument\");\n if (!arg) {\n return;\n }\n\n if (Array.isArray(arg)) {\n return;\n }\n\n // Handle the case of a function body returning a ternary operation.\n // `return (maybeTrue ? '' : (<SubComponent />))`\n if (arg.isConditionalExpression()) {\n const consequent = arg.get(\"consequent\");\n if (consequent.isJSXFragment() || consequent.isJSXElement()) {\n processJSX(context, consequent);\n }\n const alternate = arg.get(\"alternate\");\n if (alternate.isJSXFragment() || alternate.isJSXElement()) {\n processJSX(context, alternate);\n }\n return;\n }\n\n if (!arg.isJSXFragment() && !arg.isJSXElement()) {\n return;\n }\n\n jsxNode = arg;\n }\n\n if (!jsxNode) {\n return;\n }\n\n processJSX(context, jsxNode);\n}\n\n/**\n * Recursively processes JSX elements to add Sentry tracking attributes.\n * Handles both JSX elements and fragments, applying appropriate attributes\n * based on configuration and component context.\n */\nfunction processJSX(\n context: JSXProcessingContext,\n jsxNode: Babel.NodePath,\n componentName?: string\n): void {\n if (!jsxNode) {\n return;\n }\n\n // Use provided componentName or fall back to context componentName\n const currentComponentName = componentName ?? context.componentName;\n\n // NOTE: I don't know of a case where `openingElement` would have more than one item,\n // but it's safer to always iterate\n const paths = jsxNode.get(\"openingElement\");\n const openingElements = Array.isArray(paths) ? paths : [paths];\n\n openingElements.forEach((openingElement) => {\n applyAttributes(\n context,\n openingElement as Babel.NodePath<Babel.types.JSXOpeningElement>,\n currentComponentName\n );\n });\n\n let children = jsxNode.get(\"children\");\n // TODO: See why `Array.isArray` doesn't have correct behaviour here\n if (children && !(\"length\" in children)) {\n // A single child was found, maybe a bit of static text\n children = [children];\n }\n\n let shouldSetComponentName = context.annotateFragments;\n\n children.forEach((child) => {\n // Happens for some node types like plain text\n if (!child.node) {\n return;\n }\n\n // Children don't receive the data-component attribute so we pass null for componentName unless it's the first child of a Fragment with a node and `annotateFragments` is true\n const openingElement = child.get(\"openingElement\");\n // TODO: Improve this. We never expect to have multiple opening elements\n // but if it's possible, this should work\n if (Array.isArray(openingElement)) {\n return;\n }\n\n if (shouldSetComponentName && openingElement && openingElement.node) {\n shouldSetComponentName = false;\n processJSX(context, child, currentComponentName);\n } else {\n processJSX(context, child, \"\");\n }\n });\n}\n\n/**\n * Applies Sentry tracking attributes to a JSX opening element.\n * Adds component name, element name, and source file attributes while\n * respecting ignore lists and fragment detection.\n */\nfunction applyAttributes(\n context: JSXProcessingContext,\n openingElement: Babel.NodePath<Babel.types.JSXOpeningElement>,\n componentName: string\n): void {\n const { t, attributeNames, ignoredComponents, fragmentContext, sourceFileName } = context;\n const [componentAttributeName, elementAttributeName, sourceFileAttributeName] = attributeNames;\n\n // e.g., Raw JSX text like the `A` in `<h1>a</h1>`\n if (!openingElement.node) {\n return;\n }\n\n // Check if this is a React fragment - if so, skip attribute addition entirely\n const isFragment = isReactFragment(t, openingElement, fragmentContext);\n if (isFragment) {\n return;\n }\n\n if (!openingElement.node.attributes) openingElement.node.attributes = [];\n const elementName = getPathName(t, openingElement);\n\n const isAnIgnoredComponent = ignoredComponents.some(\n (ignoredComponent) => ignoredComponent === componentName || ignoredComponent === elementName\n );\n\n // Add a stable attribute for the element name but only for non-DOM names\n let isAnIgnoredElement = false;\n if (!isAnIgnoredComponent && !hasAttributeWithName(openingElement, elementAttributeName)) {\n if (DEFAULT_IGNORED_ELEMENTS.includes(elementName)) {\n isAnIgnoredElement = true;\n } else {\n // Always add element attribute for non-ignored elements\n if (elementAttributeName) {\n openingElement.node.attributes.push(\n t.jSXAttribute(t.jSXIdentifier(elementAttributeName), t.stringLiteral(elementName))\n );\n }\n }\n }\n\n // Add a stable attribute for the component name (absent for non-root elements)\n if (\n componentName &&\n !isAnIgnoredComponent &&\n !hasAttributeWithName(openingElement, componentAttributeName)\n ) {\n if (componentAttributeName) {\n openingElement.node.attributes.push(\n t.jSXAttribute(t.jSXIdentifier(componentAttributeName), t.stringLiteral(componentName))\n );\n }\n }\n\n // Add a stable attribute for the source file name\n // Updated condition: add source file for elements that have either:\n // 1. A component name (root elements), OR\n // 2. An element name that's not ignored (child elements)\n if (\n sourceFileName &&\n !isAnIgnoredComponent &&\n (componentName || !isAnIgnoredElement) &&\n !hasAttributeWithName(openingElement, sourceFileAttributeName)\n ) {\n if (sourceFileAttributeName) {\n openingElement.node.attributes.push(\n t.jSXAttribute(t.jSXIdentifier(sourceFileAttributeName), t.stringLiteral(sourceFileName))\n );\n }\n }\n}\n\nfunction sourceFileNameFromState(state: AnnotationPluginPass): string | undefined {\n const name = fullSourceFileNameFromState(state);\n if (!name) {\n return undefined;\n }\n\n if (name.indexOf(\"/\") !== -1) {\n return name.split(\"/\").pop();\n } else if (name.indexOf(\"\\\\\") !== -1) {\n return name.split(\"\\\\\").pop();\n } else {\n return name;\n }\n}\n\nfunction fullSourceFileNameFromState(state: AnnotationPluginPass): string | null {\n // @ts-expect-error This type is incorrect in Babel, `sourceFileName` is the correct type\n const name = state.file.opts.parserOpts?.sourceFileName as unknown;\n\n if (typeof name === \"string\") {\n return name;\n }\n\n return null;\n}\n\nfunction isKnownIncompatiblePluginFromState(state: AnnotationPluginPass): boolean {\n const fullSourceFileName = fullSourceFileNameFromState(state);\n\n if (!fullSourceFileName) {\n return false;\n }\n\n return KNOWN_INCOMPATIBLE_PLUGINS.some((pluginName) => {\n if (\n fullSourceFileName.includes(`/node_modules/${pluginName}/`) ||\n fullSourceFileName.includes(`\\\\node_modules\\\\${pluginName}\\\\`)\n ) {\n return true;\n }\n\n return false;\n });\n}\n\nfunction attributeNamesFromState(state: AnnotationPluginPass): [string, string, string] {\n if (state.opts.native) {\n return [nativeComponentName, nativeElementName, nativeSourceFileName];\n }\n\n return [webComponentName, webElementName, webSourceFileName];\n}\n\nfunction collectFragmentContext(programPath: Babel.NodePath): FragmentContext {\n const fragmentAliases = new Set<string>();\n const reactNamespaceAliases = new Set<string>([\"React\"]); // Default React namespace\n\n programPath.traverse({\n ImportDeclaration(importPath) {\n const source = importPath.node.source.value;\n\n // Handle React imports\n if (source === \"react\" || source === \"React\") {\n importPath.node.specifiers.forEach((spec) => {\n if (spec.type === \"ImportSpecifier\" && spec.imported.type === \"Identifier\") {\n // Detect aliased React.Fragment imports (e.g., `Fragment as F`)\n // so we can later identify <F> as a fragment in JSX.\n if (spec.imported.name === \"Fragment\") {\n fragmentAliases.add(spec.local.name);\n }\n } else if (\n spec.type === \"ImportDefaultSpecifier\" ||\n spec.type === \"ImportNamespaceSpecifier\"\n ) {\n // import React from 'react' -> React OR\n // import * as React from 'react' -> React\n reactNamespaceAliases.add(spec.local.name);\n }\n });\n }\n },\n\n // Handle simple variable assignments only (avoid complex cases)\n VariableDeclarator(varPath) {\n if (varPath.node.init) {\n const init = varPath.node.init;\n\n // Handle identifier assignments: const MyFragment = Fragment\n if (varPath.node.id.type === \"Identifier\") {\n // Handle: const MyFragment = Fragment (only if Fragment is a known alias)\n if (init.type === \"Identifier\" && fragmentAliases.has(init.name)) {\n fragmentAliases.add(varPath.node.id.name);\n }\n\n // Handle: const MyFragment = React.Fragment (only for known React namespaces)\n if (\n init.type === \"MemberExpression\" &&\n init.object.type === \"Identifier\" &&\n init.property.type === \"Identifier\" &&\n init.property.name === \"Fragment\" &&\n reactNamespaceAliases.has(init.object.name)\n ) {\n fragmentAliases.add(varPath.node.id.name);\n }\n }\n\n // Handle destructuring assignments: const { Fragment } = React\n if (varPath.node.id.type === \"ObjectPattern\") {\n if (init.type === \"Identifier\" && reactNamespaceAliases.has(init.name)) {\n const properties = varPath.node.id.properties;\n\n for (const prop of properties) {\n if (\n prop.type === \"ObjectProperty\" &&\n prop.key &&\n prop.key.type === \"Identifier\" &&\n prop.value &&\n prop.value.type === \"Identifier\" &&\n prop.key.name === \"Fragment\"\n ) {\n fragmentAliases.add(prop.value.name);\n }\n }\n }\n }\n }\n },\n });\n\n return { fragmentAliases, reactNamespaceAliases };\n}\n\nfunction isReactFragment(\n t: typeof Babel.types,\n openingElement: Babel.NodePath,\n context?: FragmentContext // Add this optional parameter\n): boolean {\n // Handle JSX fragments (<>)\n if (openingElement.isJSXFragment()) {\n return true;\n }\n\n const elementName = getPathName(t, openingElement);\n\n // Direct fragment references\n if (elementName === \"Fragment\" || elementName === \"React.Fragment\") {\n return true;\n }\n\n // TODO: All these objects are typed as unknown, maybe an oversight in Babel types?\n\n // Check if the element name is a known fragment alias\n if (context && elementName && context.fragmentAliases.has(elementName)) {\n return true;\n }\n\n // Handle JSXMemberExpression\n if (\n openingElement.node &&\n \"name\" in openingElement.node &&\n openingElement.node.name &&\n typeof openingElement.node.name === \"object\" &&\n \"type\" in openingElement.node.name &&\n openingElement.node.name.type === \"JSXMemberExpression\"\n ) {\n const nodeName = openingElement.node.name;\n if (typeof nodeName !== \"object\" || !nodeName) {\n return false;\n }\n\n if (\"object\" in nodeName && \"property\" in nodeName) {\n const nodeNameObject = nodeName.object;\n const nodeNameProperty = nodeName.property;\n\n if (typeof nodeNameObject !== \"object\" || typeof nodeNameProperty !== \"object\") {\n return false;\n }\n\n if (!nodeNameObject || !nodeNameProperty) {\n return false;\n }\n\n const objectName = \"name\" in nodeNameObject && nodeNameObject.name;\n const propertyName = \"name\" in nodeNameProperty && nodeNameProperty.name;\n\n // React.Fragment check\n if (objectName === \"React\" && propertyName === \"Fragment\") {\n return true;\n }\n\n // Enhanced checks using context\n if (context) {\n // Check React.Fragment pattern with known React namespaces\n if (\n context.reactNamespaceAliases.has(objectName as string) &&\n propertyName === \"Fragment\"\n ) {\n return true;\n }\n\n // Check MyFragment.Fragment pattern\n if (context.fragmentAliases.has(objectName as string) && propertyName === \"Fragment\") {\n return true;\n }\n }\n }\n }\n\n return false;\n}\n\nfunction hasAttributeWithName(\n openingElement: Babel.NodePath<Babel.types.JSXOpeningElement>,\n name: string | undefined | null\n): boolean {\n if (!name) {\n return false;\n }\n\n return openingElement.node.attributes.some((node) => {\n if (node.type === \"JSXAttribute\") {\n return node.name.name === name;\n }\n\n return false;\n });\n}\n\nfunction getPathName(t: typeof Babel.types, path: Babel.NodePath): string {\n if (!path.node) return UNKNOWN_ELEMENT_NAME;\n if (!(\"name\" in path.node)) {\n return UNKNOWN_ELEMENT_NAME;\n }\n\n const name = path.node.name;\n\n if (typeof name === \"string\") {\n return name;\n }\n\n if (t.isIdentifier(name) || t.isJSXIdentifier(name)) {\n return name.name;\n }\n\n if (t.isJSXNamespacedName(name)) {\n return name.name.name;\n }\n\n // Handle JSX member expressions like Tab.Group\n if (t.isJSXMemberExpression(name)) {\n const objectName = getJSXMemberExpressionObjectName(t, name.object);\n const propertyName = name.property.name;\n return `${objectName}.${propertyName}`;\n }\n\n return UNKNOWN_ELEMENT_NAME;\n}\n\n// Recursively handle nested member expressions (e.g. Components.UI.Header)\nfunction getJSXMemberExpressionObjectName(\n t: typeof Babel.types,\n object: Babel.types.JSXMemberExpression | Babel.types.JSXIdentifier\n): string {\n if (t.isJSXIdentifier(object)) {\n return object.name;\n }\n if (t.isJSXMemberExpression(object)) {\n const objectName = getJSXMemberExpressionObjectName(t, object.object);\n return `${objectName}.${object.property.name}`;\n }\n\n return UNKNOWN_ELEMENT_NAME;\n}\n\nconst UNKNOWN_ELEMENT_NAME = \"unknown\";\n"],"names":["KNOWN_INCOMPATIBLE_PLUGINS","DEFAULT_IGNORED_ELEMENTS","webComponentName","webElementName","webSourceFileName","nativeComponentName","nativeElementName","nativeSourceFileName","componentNameAnnotatePlugin","_ref","t","types","visitor","Program","enter","path","state","fragmentContext","collectFragmentContext","sentryFragmentContext","FunctionDeclaration","node","id","name","isKnownIncompatiblePluginFromState","context","createJSXProcessingContext","functionBodyPushAttributes","ArrowFunctionExpression","parent","ClassDeclaration","_name$node","get","properties","render","find","prop","isClassMethod","isIdentifier","traverse","ReturnStatement","returnStatement","arg","isJSXElement","isJSXFragment","processJSX","componentName","_state$opts$ignoredCo","annotateFragments","opts","sourceFileName","sourceFileNameFromState","attributeNames","attributeNamesFromState","ignoredComponents","jsxNode","functionBody","type","maybeJsxNode","c","Array","isArray","isConditionalExpression","consequent","alternate","currentComponentName","paths","openingElements","forEach","openingElement","applyAttributes","children","shouldSetComponentName","child","_attributeNames","_slicedToArray","componentAttributeName","elementAttributeName","sourceFileAttributeName","isFragment","isReactFragment","attributes","elementName","getPathName","isAnIgnoredComponent","some","ignoredComponent","isAnIgnoredElement","hasAttributeWithName","includes","push","jSXAttribute","jSXIdentifier","stringLiteral","fullSourceFileNameFromState","undefined","indexOf","split","pop","_state$file$opts$pars","file","parserOpts","fullSourceFileName","pluginName","concat","programPath","fragmentAliases","Set","reactNamespaceAliases","ImportDeclaration","importPath","source","value","specifiers","spec","imported","add","local","VariableDeclarator","varPath","init","has","object","property","_iterator","_createForOfIteratorHelper","_step","s","n","done","key","err","e","f","_typeof","nodeName","nodeNameObject","nodeNameProperty","objectName","propertyName","UNKNOWN_ELEMENT_NAME","isJSXIdentifier","isJSXNamespacedName","isJSXMemberExpression","getJSXMemberExpressionObjectName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,IAAMA,0BAA0B,GAAG;AACxC;AACA,wBAAwB;AACxB;AACA,mBAAmB,CACpB,CAAA;AAEM,IAAMC,wBAAwB,GAAG,CACtC,GAAG,EACH,MAAM,EACN,SAAS,EACT,MAAM,EACN,SAAS,EACT,OAAO,EACP,OAAO,EACP,GAAG,EACH,MAAM,EACN,KAAK,EACL,KAAK,EACL,YAAY,EACZ,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,MAAM,EACN,MAAM,EACN,KAAK,EACL,UAAU,EACV,MAAM,EACN,UAAU,EACV,IAAI,EACJ,KAAK,EACL,SAAS,EACT,KAAK,EACL,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,UAAU,EACV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nC,IAAMgB,UAAU,GAAGM,gCAAgC,CAACtI,CAAC,EAAEgH,MAAM,CAACA,MAAM,CAAC,CAAA;IACrE,OAAAlB,EAAAA,CAAAA,MAAA,CAAUkC,UAAU,EAAAlC,GAAAA,CAAAA,CAAAA,MAAA,CAAIkB,MAAM,CAACC,QAAQ,CAACpG,IAAI,CAAA,CAAA;AAC9C,GAAA;AAEA,EAAA,OAAOqH,oBAAoB,CAAA;AAC7B,CAAA;AAEA,IAAMA,oBAAoB,GAAG,SAAS;;;;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -37,8 +37,13 @@ interface AnnotationOpts {
|
|
|
37
37
|
"annotate-fragments"?: boolean;
|
|
38
38
|
ignoredComponents?: string[];
|
|
39
39
|
}
|
|
40
|
+
interface FragmentContext {
|
|
41
|
+
fragmentAliases: Set<string>;
|
|
42
|
+
reactNamespaceAliases: Set<string>;
|
|
43
|
+
}
|
|
40
44
|
interface AnnotationPluginPass extends PluginPass {
|
|
41
45
|
opts: AnnotationOpts;
|
|
46
|
+
sentryFragmentContext?: FragmentContext;
|
|
42
47
|
}
|
|
43
48
|
type AnnotationPlugin = PluginObj<AnnotationPluginPass>;
|
|
44
49
|
export default function componentNameAnnotatePlugin({ types: t }: typeof Babel): AnnotationPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/babel-plugin-component-annotate",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "A Babel plugin that annotates frontend components with additional data to enrich the experience in Sentry",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript-bundler-plugins.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript-bundler-plugins/tree/main/packages/babel-plugin-component-annotate",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"@babel/preset-typescript": "7.17.12",
|
|
57
57
|
"@rollup/plugin-babel": "5.3.1",
|
|
58
58
|
"@rollup/plugin-node-resolve": "13.3.0",
|
|
59
|
-
"@sentry-internal/eslint-config": "4.
|
|
60
|
-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "4.
|
|
59
|
+
"@sentry-internal/eslint-config": "4.1.1",
|
|
60
|
+
"@sentry-internal/sentry-bundler-plugin-tsconfig": "4.1.1",
|
|
61
61
|
"@swc/core": "^1.2.205",
|
|
62
62
|
"@swc/jest": "^0.2.21",
|
|
63
63
|
"@types/jest": "^28.1.3",
|