@sentry/babel-plugin-component-annotate 2.22.7 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/dist/cjs/index.js +7 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +7 -10
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts +1 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -47,6 +47,14 @@ Using pnpm:
|
|
|
47
47
|
pnpm add @sentry/babel-plugin-component-annotate --save-dev
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
## Options
|
|
51
|
+
|
|
52
|
+
### `ignoredComponents`
|
|
53
|
+
|
|
54
|
+
Type: `string[]`
|
|
55
|
+
|
|
56
|
+
A list of strings representing the names of components to ignore. The plugin will not apply `data-sentry` annotations on the DOM element for these components.
|
|
57
|
+
|
|
50
58
|
## Example
|
|
51
59
|
|
|
52
60
|
```js
|
|
@@ -57,7 +65,8 @@ pnpm add @sentry/babel-plugin-component-annotate --save-dev
|
|
|
57
65
|
|
|
58
66
|
plugins: [
|
|
59
67
|
// Put this plugin before any other plugins you have that transform JSX code
|
|
60
|
-
|
|
68
|
+
// The options are set by providing an object as the second element in the array, but not required
|
|
69
|
+
['@sentry/babel-plugin-component-annotate', {ignoredComponents: ['Foo', 'Bar']}]
|
|
61
70
|
],
|
|
62
71
|
}
|
|
63
72
|
```
|
package/dist/cjs/index.js
CHANGED
|
@@ -105,17 +105,17 @@ function componentNameAnnotatePlugin(_ref) {
|
|
|
105
105
|
return {
|
|
106
106
|
visitor: {
|
|
107
107
|
FunctionDeclaration: function FunctionDeclaration(path, state) {
|
|
108
|
-
var _state$opts$
|
|
108
|
+
var _state$opts$ignoredCo;
|
|
109
109
|
if (!path.node.id || !path.node.id.name) {
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
if (isKnownIncompatiblePluginFromState(state)) {
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
functionBodyPushAttributes(state.opts["annotate-fragments"] === true, t, path, path.node.id.name, sourceFileNameFromState(state), attributeNamesFromState(state), (_state$opts$
|
|
115
|
+
functionBodyPushAttributes(state.opts["annotate-fragments"] === true, t, path, path.node.id.name, sourceFileNameFromState(state), attributeNamesFromState(state), (_state$opts$ignoredCo = state.opts.ignoredComponents) !== null && _state$opts$ignoredCo !== void 0 ? _state$opts$ignoredCo : []);
|
|
116
116
|
},
|
|
117
117
|
ArrowFunctionExpression: function ArrowFunctionExpression(path, state) {
|
|
118
|
-
var _state$opts$
|
|
118
|
+
var _state$opts$ignoredCo2;
|
|
119
119
|
// We're expecting a `VariableDeclarator` like `const MyComponent =`
|
|
120
120
|
var parent = path.parent;
|
|
121
121
|
if (!parent || !("id" in parent) || !parent.id || !("name" in parent.id) || !parent.id.name) {
|
|
@@ -124,10 +124,10 @@ function componentNameAnnotatePlugin(_ref) {
|
|
|
124
124
|
if (isKnownIncompatiblePluginFromState(state)) {
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
|
-
functionBodyPushAttributes(state.opts["annotate-fragments"] === true, t, path, parent.id.name, sourceFileNameFromState(state), attributeNamesFromState(state), (_state$opts$
|
|
127
|
+
functionBodyPushAttributes(state.opts["annotate-fragments"] === true, t, path, parent.id.name, sourceFileNameFromState(state), attributeNamesFromState(state), (_state$opts$ignoredCo2 = state.opts.ignoredComponents) !== null && _state$opts$ignoredCo2 !== void 0 ? _state$opts$ignoredCo2 : []);
|
|
128
128
|
},
|
|
129
129
|
ClassDeclaration: function ClassDeclaration(path, state) {
|
|
130
|
-
var _state$opts$
|
|
130
|
+
var _state$opts$ignoredCo3;
|
|
131
131
|
var name = path.get("id");
|
|
132
132
|
var properties = path.get("body").get("body");
|
|
133
133
|
var render = properties.find(function (prop) {
|
|
@@ -138,7 +138,7 @@ function componentNameAnnotatePlugin(_ref) {
|
|
|
138
138
|
if (!render || !render.traverse || isKnownIncompatiblePluginFromState(state)) {
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
|
-
var ignoredComponents = (_state$opts$
|
|
141
|
+
var ignoredComponents = (_state$opts$ignoredCo3 = state.opts.ignoredComponents) !== null && _state$opts$ignoredCo3 !== void 0 ? _state$opts$ignoredCo3 : [];
|
|
142
142
|
render.traverse({
|
|
143
143
|
ReturnStatement: function ReturnStatement(returnStatement) {
|
|
144
144
|
var arg = returnStatement.get("argument");
|
|
@@ -255,7 +255,7 @@ function applyAttributes(t, openingElement, componentName, sourceFileName, attri
|
|
|
255
255
|
if (!openingElement.node.attributes) openingElement.node.attributes = [];
|
|
256
256
|
var elementName = getPathName(t, openingElement);
|
|
257
257
|
var isAnIgnoredComponent = ignoredComponents.some(function (ignoredComponent) {
|
|
258
|
-
return
|
|
258
|
+
return ignoredComponent === componentName || ignoredComponent === elementName;
|
|
259
259
|
});
|
|
260
260
|
|
|
261
261
|
// Add a stable attribute for the element name but only for non-DOM names
|
|
@@ -363,9 +363,6 @@ function isReactFragment(t, openingElement) {
|
|
|
363
363
|
}
|
|
364
364
|
return false;
|
|
365
365
|
}
|
|
366
|
-
function matchesIgnoreRule(rule, name) {
|
|
367
|
-
return rule === "*" || rule === name;
|
|
368
|
-
}
|
|
369
366
|
function hasAttributeWithName(openingElement, name) {
|
|
370
367
|
if (!name) {
|
|
371
368
|
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 ignoreComponents?: IgnoredComponent[];\n}\n\ninterface AnnotationPluginPass extends PluginPass {\n opts: AnnotationOpts;\n}\n\ntype IgnoredComponent = [file: string, component: string, element: string];\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.ignoreComponents ?? []\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.ignoreComponents ?? []\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.ignoreComponents ?? [];\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: IgnoredComponent[]\n) {\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: IgnoredComponent[]\n) {\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: IgnoredComponent[]\n) {\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) =>\n matchesIgnoreRule(ignoredComponent[0], sourceFileName) &&\n matchesIgnoreRule(ignoredComponent[1], componentName) &&\n matchesIgnoreRule(ignoredComponent[2], 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) {\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) {\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 matchesIgnoreRule(rule: string, name: string | undefined | null) {\n return rule === \"*\" || rule === name;\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 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$ignoreCom","node","id","name","isKnownIncompatiblePluginFromState","functionBodyPushAttributes","opts","sourceFileNameFromState","attributeNamesFromState","ignoreComponents","ArrowFunctionExpression","_state$opts$ignoreCom2","parent","ClassDeclaration","_state$opts$ignoreCom3","get","properties","render","find","prop","isClassMethod","isIdentifier","traverse","ignoredComponents","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","matchesIgnoreRule","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","rule","UNKNOWN_ELEMENT_NAME","isJSXIdentifier","isJSXNamespacedName"],"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,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C,KAAA;AAEA,IAAA,OAAO,KAAK,CAAA;AACd,GAAC,CAAC,CAAA;AACJ,CAAA;AAEA,SAASyD,WAAWA,CAAClE,CAAqB,EAAEI,IAAoB,EAAU;AACxE,EAAA,IAAI,CAACA,IAAI,CAACG,IAAI,EAAE,OAAO2F,oBAAoB,CAAA;AAC3C,EAAA,IAAI,EAAE,MAAM,IAAI9F,IAAI,CAACG,IAAI,CAAC,EAAE;AAC1B,IAAA,OAAO2F,oBAAoB,CAAA;AAC7B,GAAA;AAEA,EAAA,IAAMzF,IAAI,GAAGL,IAAI,CAACG,IAAI,CAACE,IAAI,CAAA;AAE3B,EAAA,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;AAC5B,IAAA,OAAOA,IAAI,CAAA;AACb,GAAA;AAEA,EAAA,IAAIT,CAAC,CAAC2B,YAAY,CAAClB,IAAI,CAAC,IAAIT,CAAC,CAACmG,eAAe,CAAC1F,IAAI,CAAC,EAAE;IACnD,OAAOA,IAAI,CAACA,IAAI,CAAA;AAClB,GAAA;AAEA,EAAA,IAAIT,CAAC,CAACoG,mBAAmB,CAAC3F,IAAI,CAAC,EAAE;AAC/B,IAAA,OAAOA,IAAI,CAACA,IAAI,CAACA,IAAI,CAAA;AACvB,GAAA;AAEA,EAAA,OAAOyF,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 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) {\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) {\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) {\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) {\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) {\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 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"],"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,EACN,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,QAAQ,E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AI,CAAC,IAAIT,CAAC,CAACgG,eAAe,CAACvF,IAAI,CAAC,EAAE;IACnD,OAAOA,IAAI,CAACA,IAAI,CAAA;AAClB,GAAA;AAEA,EAAA,IAAIT,CAAC,CAACiG,mBAAmB,CAACxF,IAAI,CAAC,EAAE;AAC/B,IAAA,OAAOA,IAAI,CAACA,IAAI,CAACA,IAAI,CAAA;AACvB,GAAA;AAEA,EAAA,OAAOsF,oBAAoB,CAAA;AAC7B,CAAA;AAEA,IAAMA,oBAAoB,GAAG,SAAS;;;;"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -101,17 +101,17 @@ function componentNameAnnotatePlugin(_ref) {
|
|
|
101
101
|
return {
|
|
102
102
|
visitor: {
|
|
103
103
|
FunctionDeclaration: function FunctionDeclaration(path, state) {
|
|
104
|
-
var _state$opts$
|
|
104
|
+
var _state$opts$ignoredCo;
|
|
105
105
|
if (!path.node.id || !path.node.id.name) {
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
if (isKnownIncompatiblePluginFromState(state)) {
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
functionBodyPushAttributes(state.opts["annotate-fragments"] === true, t, path, path.node.id.name, sourceFileNameFromState(state), attributeNamesFromState(state), (_state$opts$
|
|
111
|
+
functionBodyPushAttributes(state.opts["annotate-fragments"] === true, t, path, path.node.id.name, sourceFileNameFromState(state), attributeNamesFromState(state), (_state$opts$ignoredCo = state.opts.ignoredComponents) !== null && _state$opts$ignoredCo !== void 0 ? _state$opts$ignoredCo : []);
|
|
112
112
|
},
|
|
113
113
|
ArrowFunctionExpression: function ArrowFunctionExpression(path, state) {
|
|
114
|
-
var _state$opts$
|
|
114
|
+
var _state$opts$ignoredCo2;
|
|
115
115
|
// We're expecting a `VariableDeclarator` like `const MyComponent =`
|
|
116
116
|
var parent = path.parent;
|
|
117
117
|
if (!parent || !("id" in parent) || !parent.id || !("name" in parent.id) || !parent.id.name) {
|
|
@@ -120,10 +120,10 @@ function componentNameAnnotatePlugin(_ref) {
|
|
|
120
120
|
if (isKnownIncompatiblePluginFromState(state)) {
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
functionBodyPushAttributes(state.opts["annotate-fragments"] === true, t, path, parent.id.name, sourceFileNameFromState(state), attributeNamesFromState(state), (_state$opts$
|
|
123
|
+
functionBodyPushAttributes(state.opts["annotate-fragments"] === true, t, path, parent.id.name, sourceFileNameFromState(state), attributeNamesFromState(state), (_state$opts$ignoredCo2 = state.opts.ignoredComponents) !== null && _state$opts$ignoredCo2 !== void 0 ? _state$opts$ignoredCo2 : []);
|
|
124
124
|
},
|
|
125
125
|
ClassDeclaration: function ClassDeclaration(path, state) {
|
|
126
|
-
var _state$opts$
|
|
126
|
+
var _state$opts$ignoredCo3;
|
|
127
127
|
var name = path.get("id");
|
|
128
128
|
var properties = path.get("body").get("body");
|
|
129
129
|
var render = properties.find(function (prop) {
|
|
@@ -134,7 +134,7 @@ function componentNameAnnotatePlugin(_ref) {
|
|
|
134
134
|
if (!render || !render.traverse || isKnownIncompatiblePluginFromState(state)) {
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
var ignoredComponents = (_state$opts$
|
|
137
|
+
var ignoredComponents = (_state$opts$ignoredCo3 = state.opts.ignoredComponents) !== null && _state$opts$ignoredCo3 !== void 0 ? _state$opts$ignoredCo3 : [];
|
|
138
138
|
render.traverse({
|
|
139
139
|
ReturnStatement: function ReturnStatement(returnStatement) {
|
|
140
140
|
var arg = returnStatement.get("argument");
|
|
@@ -251,7 +251,7 @@ function applyAttributes(t, openingElement, componentName, sourceFileName, attri
|
|
|
251
251
|
if (!openingElement.node.attributes) openingElement.node.attributes = [];
|
|
252
252
|
var elementName = getPathName(t, openingElement);
|
|
253
253
|
var isAnIgnoredComponent = ignoredComponents.some(function (ignoredComponent) {
|
|
254
|
-
return
|
|
254
|
+
return ignoredComponent === componentName || ignoredComponent === elementName;
|
|
255
255
|
});
|
|
256
256
|
|
|
257
257
|
// Add a stable attribute for the element name but only for non-DOM names
|
|
@@ -359,9 +359,6 @@ function isReactFragment(t, openingElement) {
|
|
|
359
359
|
}
|
|
360
360
|
return false;
|
|
361
361
|
}
|
|
362
|
-
function matchesIgnoreRule(rule, name) {
|
|
363
|
-
return rule === "*" || rule === name;
|
|
364
|
-
}
|
|
365
362
|
function hasAttributeWithName(openingElement, name) {
|
|
366
363
|
if (!name) {
|
|
367
364
|
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 ignoreComponents?: IgnoredComponent[];\n}\n\ninterface AnnotationPluginPass extends PluginPass {\n opts: AnnotationOpts;\n}\n\ntype IgnoredComponent = [file: string, component: string, element: string];\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.ignoreComponents ?? []\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.ignoreComponents ?? []\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.ignoreComponents ?? [];\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: IgnoredComponent[]\n) {\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: IgnoredComponent[]\n) {\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: IgnoredComponent[]\n) {\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) =>\n matchesIgnoreRule(ignoredComponent[0], sourceFileName) &&\n matchesIgnoreRule(ignoredComponent[1], componentName) &&\n matchesIgnoreRule(ignoredComponent[2], 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) {\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) {\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 matchesIgnoreRule(rule: string, name: string | undefined | null) {\n return rule === \"*\" || rule === name;\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 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$ignoreCom","node","id","name","isKnownIncompatiblePluginFromState","functionBodyPushAttributes","opts","sourceFileNameFromState","attributeNamesFromState","ignoreComponents","ArrowFunctionExpression","_state$opts$ignoreCom2","parent","ClassDeclaration","_state$opts$ignoreCom3","get","properties","render","find","prop","isClassMethod","isIdentifier","traverse","ignoredComponents","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","matchesIgnoreRule","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","rule","UNKNOWN_ELEMENT_NAME","isJSXIdentifier","isJSXNamespacedName"],"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,EACN,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,GAAG,EACH,QAAQ,EACR,KAAK,EACL,OAAO,EACP,KAAK,EACL,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,UAAU,EACV,OAAO,EACP,KAAK,EACL,UAAU,EACV,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,O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AC1F,IAAI,CAAC,EAAE;IACnD,OAAOA,IAAI,CAACA,IAAI,CAAA;AAClB,GAAA;AAEA,EAAA,IAAIT,CAAC,CAACoG,mBAAmB,CAAC3F,IAAI,CAAC,EAAE;AAC/B,IAAA,OAAOA,IAAI,CAACA,IAAI,CAACA,IAAI,CAAA;AACvB,GAAA;AAEA,EAAA,OAAOyF,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 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) {\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) {\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) {\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) {\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) {\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 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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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,IAAA,IAAIA,IAAI,CAACkC,IAAI,KAAK,cAAc,EAAE;AAChC,MAAA,OAAOlC,IAAI,CAACE,IAAI,CAACA,IAAI,KAAKA,IAAI,CAAA;AAChC,KAAA;AAEA,IAAA,OAAO,KAAK,CAAA;AACd,GAAC,CAAC,CAAA;AACJ,CAAA;AAEA,SAASwD,WAAWA,CAACjE,CAAqB,EAAEI,IAAoB,EAAU;AACxE,EAAA,IAAI,CAACA,IAAI,CAACG,IAAI,EAAE,OAAOwF,oBAAoB,CAAA;AAC3C,EAAA,IAAI,EAAE,MAAM,IAAI3F,IAAI,CAACG,IAAI,CAAC,EAAE;AAC1B,IAAA,OAAOwF,oBAAoB,CAAA;AAC7B,GAAA;AAEA,EAAA,IAAMtF,IAAI,GAAGL,IAAI,CAACG,IAAI,CAACE,IAAI,CAAA;AAE3B,EAAA,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;AAC5B,IAAA,OAAOA,IAAI,CAAA;AACb,GAAA;AAEA,EAAA,IAAIT,CAAC,CAAC2B,YAAY,CAAClB,IAAI,CAAC,IAAIT,CAAC,CAACgG,eAAe,CAACvF,IAAI,CAAC,EAAE;IACnD,OAAOA,IAAI,CAACA,IAAI,CAAA;AAClB,GAAA;AAEA,EAAA,IAAIT,CAAC,CAACiG,mBAAmB,CAACxF,IAAI,CAAC,EAAE;AAC/B,IAAA,OAAOA,IAAI,CAACA,IAAI,CAACA,IAAI,CAAA;AACvB,GAAA;AAEA,EAAA,OAAOsF,oBAAoB,CAAA;AAC7B,CAAA;AAEA,IAAMA,oBAAoB,GAAG,SAAS;;;;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -35,12 +35,11 @@ import type { PluginObj, PluginPass } from "@babel/core";
|
|
|
35
35
|
interface AnnotationOpts {
|
|
36
36
|
native?: boolean;
|
|
37
37
|
"annotate-fragments"?: boolean;
|
|
38
|
-
|
|
38
|
+
ignoredComponents?: string[];
|
|
39
39
|
}
|
|
40
40
|
interface AnnotationPluginPass extends PluginPass {
|
|
41
41
|
opts: AnnotationOpts;
|
|
42
42
|
}
|
|
43
|
-
type IgnoredComponent = [file: string, component: string, element: string];
|
|
44
43
|
type AnnotationPlugin = PluginObj<AnnotationPluginPass>;
|
|
45
44
|
export default function componentNameAnnotatePlugin({ types: t }: typeof Babel): AnnotationPlugin;
|
|
46
45
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/babel-plugin-component-annotate",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
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": "
|
|
60
|
-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "
|
|
59
|
+
"@sentry-internal/eslint-config": "3.0.0",
|
|
60
|
+
"@sentry-internal/sentry-bundler-plugin-tsconfig": "3.0.0",
|
|
61
61
|
"@swc/core": "^1.2.205",
|
|
62
62
|
"@swc/jest": "^0.2.21",
|
|
63
63
|
"@types/jest": "^28.1.3",
|