@sentry/babel-plugin-component-annotate 3.2.1 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -389,6 +389,25 @@ function getPathName(t, path) {
389
389
  if (t.isJSXNamespacedName(name)) {
390
390
  return name.name.name;
391
391
  }
392
+
393
+ // Handle JSX member expressions like Tab.Group
394
+ if (t.isJSXMemberExpression(name)) {
395
+ var objectName = getJSXMemberExpressionObjectName(t, name.object);
396
+ var propertyName = name.property.name;
397
+ return "".concat(objectName, ".").concat(propertyName);
398
+ }
399
+ return UNKNOWN_ELEMENT_NAME;
400
+ }
401
+
402
+ // Recursively handle nested member expressions (e.g. Components.UI.Header)
403
+ function getJSXMemberExpressionObjectName(t, object) {
404
+ if (t.isJSXIdentifier(object)) {
405
+ return object.name;
406
+ }
407
+ if (t.isJSXMemberExpression(object)) {
408
+ var objectName = getJSXMemberExpressionObjectName(t, object.object);
409
+ return "".concat(objectName, ".").concat(object.property.name);
410
+ }
392
411
  return UNKNOWN_ELEMENT_NAME;
393
412
  }
394
413
  var UNKNOWN_ELEMENT_NAME = "unknown";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/constants.ts","../../src/index.ts"],"sourcesContent":["/**\n * MIT License\n *\n * Copyright (c) 2020 Engineering at FullStory\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n */\n\nexport const KNOWN_INCOMPATIBLE_PLUGINS = [\n // This module might be causing an issue preventing clicks. For safety, we won't run on this module.\n \"react-native-testfairy\",\n // This module checks for unexpected property keys and throws an exception.\n \"@react-navigation\",\n];\n\nexport const DEFAULT_IGNORED_ELEMENTS = [\n \"a\",\n \"abbr\",\n \"address\",\n \"area\",\n \"article\",\n \"aside\",\n \"audio\",\n \"b\",\n \"base\",\n \"bdi\",\n \"bdo\",\n \"blockquote\",\n \"body\",\n \"br\",\n \"button\",\n \"canvas\",\n \"caption\",\n \"cite\",\n \"code\",\n \"col\",\n \"colgroup\",\n \"data\",\n \"datalist\",\n \"dd\",\n \"del\",\n \"details\",\n \"dfn\",\n \"dialog\",\n \"div\",\n \"dl\",\n \"dt\",\n \"em\",\n \"embed\",\n \"fieldset\",\n \"figure\",\n \"footer\",\n \"form\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"head\",\n \"header\",\n \"hgroup\",\n \"hr\",\n \"html\",\n \"i\",\n \"iframe\",\n \"img\",\n \"input\",\n \"ins\",\n \"kbd\",\n \"keygen\",\n \"label\",\n \"legend\",\n \"li\",\n \"link\",\n \"main\",\n \"map\",\n \"mark\",\n \"menu\",\n \"menuitem\",\n \"meter\",\n \"nav\",\n \"noscript\",\n \"object\",\n \"ol\",\n \"optgroup\",\n \"option\",\n \"output\",\n \"p\",\n \"param\",\n \"pre\",\n \"progress\",\n \"q\",\n \"rb\",\n \"rp\",\n \"rt\",\n \"rtc\",\n \"ruby\",\n \"s\",\n \"samp\",\n \"script\",\n \"section\",\n \"select\",\n \"small\",\n \"source\",\n \"span\",\n \"strong\",\n \"style\",\n \"sub\",\n \"summary\",\n \"sup\",\n \"table\",\n \"tbody\",\n \"td\",\n \"template\",\n \"textarea\",\n \"tfoot\",\n \"th\",\n \"thead\",\n \"time\",\n \"title\",\n \"tr\",\n \"track\",\n \"u\",\n \"ul\",\n \"var\",\n \"video\",\n \"wbr\",\n];\n","/**\n * MIT License\n *\n * Copyright (c) 2020 Engineering at FullStory\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n */\n\n/**\n * The following code is based on the FullStory Babel plugin, but has been modified to work\n * with Sentry products:\n *\n * - Added `sentry` to data properties, i.e `data-sentry-component`\n * - Converted to TypeScript\n * - Code cleanups\n */\n\nimport type * as Babel from \"@babel/core\";\nimport type { PluginObj, PluginPass } from \"@babel/core\";\n\nimport { DEFAULT_IGNORED_ELEMENTS, KNOWN_INCOMPATIBLE_PLUGINS } from \"./constants\";\n\nconst webComponentName = \"data-sentry-component\";\nconst webElementName = \"data-sentry-element\";\nconst webSourceFileName = \"data-sentry-source-file\";\n\nconst nativeComponentName = \"dataSentryComponent\";\nconst nativeElementName = \"dataSentryElement\";\nconst nativeSourceFileName = \"dataSentrySourceFile\";\n\ninterface AnnotationOpts {\n native?: boolean;\n \"annotate-fragments\"?: boolean;\n ignoredComponents?: string[];\n}\n\ninterface AnnotationPluginPass extends PluginPass {\n opts: AnnotationOpts;\n}\n\ntype AnnotationPlugin = PluginObj<AnnotationPluginPass>;\n\n// We must export the plugin as default, otherwise the Babel loader will not be able to resolve it when configured using its string identifier\nexport default function componentNameAnnotatePlugin({ types: t }: typeof Babel): AnnotationPlugin {\n return {\n visitor: {\n FunctionDeclaration(path, state) {\n if (!path.node.id || !path.node.id.name) {\n return;\n }\n if (isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n functionBodyPushAttributes(\n state.opts[\"annotate-fragments\"] === true,\n t,\n path,\n path.node.id.name,\n sourceFileNameFromState(state),\n attributeNamesFromState(state),\n state.opts.ignoredComponents ?? []\n );\n },\n ArrowFunctionExpression(path, state) {\n // We're expecting a `VariableDeclarator` like `const MyComponent =`\n const parent = path.parent;\n\n if (\n !parent ||\n !(\"id\" in parent) ||\n !parent.id ||\n !(\"name\" in parent.id) ||\n !parent.id.name\n ) {\n return;\n }\n\n if (isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n functionBodyPushAttributes(\n state.opts[\"annotate-fragments\"] === true,\n t,\n path,\n parent.id.name,\n sourceFileNameFromState(state),\n attributeNamesFromState(state),\n state.opts.ignoredComponents ?? []\n );\n },\n ClassDeclaration(path, state) {\n const name = path.get(\"id\");\n const properties = path.get(\"body\").get(\"body\");\n const render = properties.find((prop) => {\n return prop.isClassMethod() && prop.get(\"key\").isIdentifier({ name: \"render\" });\n });\n\n if (!render || !render.traverse || isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n const ignoredComponents = state.opts.ignoredComponents ?? [];\n\n render.traverse({\n ReturnStatement(returnStatement) {\n const arg = returnStatement.get(\"argument\");\n\n if (!arg.isJSXElement() && !arg.isJSXFragment()) {\n return;\n }\n\n processJSX(\n state.opts[\"annotate-fragments\"] === true,\n t,\n arg,\n name.node && name.node.name,\n sourceFileNameFromState(state),\n attributeNamesFromState(state),\n ignoredComponents\n );\n },\n });\n },\n },\n };\n}\n\nfunction functionBodyPushAttributes(\n annotateFragments: boolean,\n t: typeof Babel.types,\n path: Babel.NodePath<Babel.types.Function>,\n componentName: string,\n sourceFileName: string | undefined,\n attributeNames: string[],\n ignoredComponents: string[]\n) {\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,EACR,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,GAAG,EACH,QAAQ,EACR,KAAK,EACL,OAAO,EACP,KAAK,EACL,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QA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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;;;;"}
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 // Handle JSX member expressions like Tab.Group\n if (t.isJSXMemberExpression(name)) {\n const objectName = getJSXMemberExpressionObjectName(t, name.object);\n const propertyName = name.property.name;\n return `${objectName}.${propertyName}`;\n }\n\n return UNKNOWN_ELEMENT_NAME;\n}\n\n// Recursively handle nested member expressions (e.g. Components.UI.Header)\nfunction getJSXMemberExpressionObjectName(\n t: typeof Babel.types,\n object: Babel.types.JSXMemberExpression | Babel.types.JSXIdentifier\n): string {\n if (t.isJSXIdentifier(object)) {\n return object.name;\n }\n if (t.isJSXMemberExpression(object)) {\n const objectName = getJSXMemberExpressionObjectName(t, object.object);\n return `${objectName}.${object.property.name}`;\n }\n\n return UNKNOWN_ELEMENT_NAME;\n}\n\nconst UNKNOWN_ELEMENT_NAME = \"unknown\";\n"],"names":["KNOWN_INCOMPATIBLE_PLUGINS","DEFAULT_IGNORED_ELEMENTS","webComponentName","webElementName","webSourceFileName","nativeComponentName","nativeElementName","nativeSourceFileName","componentNameAnnotatePlugin","_ref","t","types","visitor","FunctionDeclaration","path","state","_state$opts$ignoredCo","node","id","name","isKnownIncompatiblePluginFromState","functionBodyPushAttributes","opts","sourceFileNameFromState","attributeNamesFromState","ignoredComponents","ArrowFunctionExpression","_state$opts$ignoredCo2","parent","ClassDeclaration","_state$opts$ignoredCo3","get","properties","render","find","prop","isClassMethod","isIdentifier","traverse","ReturnStatement","returnStatement","arg","isJSXElement","isJSXFragment","processJSX","annotateFragments","componentName","sourceFileName","attributeNames","jsxNode","functionBody","type","maybeJsxNode","c","Array","isArray","isConditionalExpression","consequent","alternate","paths","openingElements","forEach","openingElement","applyAttributes","children","shouldSetComponentName","child","_attributeNames","_slicedToArray","componentAttributeName","elementAttributeName","sourceFileAttributeName","isReactFragment","attributes","elementName","getPathName","isAnIgnoredComponent","some","ignoredComponent","isAnIgnoredElement","hasAttributeWithName","includes","push","jSXAttribute","jSXIdentifier","stringLiteral","fullSourceFileNameFromState","undefined","indexOf","split","pop","_state$file$opts$pars","file","parserOpts","fullSourceFileName","pluginName","concat","_typeof","nodeName","nodeNameObject","object","nodeNameProperty","property","objectName","propertyName","UNKNOWN_ELEMENT_NAME","isJSXIdentifier","isJSXNamespacedName","isJSXMemberExpression","getJSXMemberExpressionObjectName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,KAA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A;AACvB,GAAA;;AAEA;AACA,EAAA,IAAIT,CAAC,CAACkG,qBAAqB,CAACzF,IAAI,CAAC,EAAE;IACjC,IAAMoF,UAAU,GAAGM,gCAAgC,CAACnG,CAAC,EAAES,IAAI,CAACiF,MAAM,CAAC,CAAA;AACnE,IAAA,IAAMI,YAAY,GAAGrF,IAAI,CAACmF,QAAQ,CAACnF,IAAI,CAAA;AACvC,IAAA,OAAA,EAAA,CAAA6E,MAAA,CAAUO,UAAU,EAAAP,GAAAA,CAAAA,CAAAA,MAAA,CAAIQ,YAAY,CAAA,CAAA;AACtC,GAAA;AAEA,EAAA,OAAOC,oBAAoB,CAAA;AAC7B,CAAA;;AAEA;AACA,SAASI,gCAAgCA,CACvCnG,CAAqB,EACrB0F,MAAmE,EAC3D;AACR,EAAA,IAAI1F,CAAC,CAACgG,eAAe,CAACN,MAAM,CAAC,EAAE;IAC7B,OAAOA,MAAM,CAACjF,IAAI,CAAA;AACpB,GAAA;AACA,EAAA,IAAIT,CAAC,CAACkG,qBAAqB,CAACR,MAAM,CAAC,EAAE;IACnC,IAAMG,UAAU,GAAGM,gCAAgC,CAACnG,CAAC,EAAE0F,MAAM,CAACA,MAAM,CAAC,CAAA;IACrE,OAAAJ,EAAAA,CAAAA,MAAA,CAAUO,UAAU,EAAAP,GAAAA,CAAAA,CAAAA,MAAA,CAAII,MAAM,CAACE,QAAQ,CAACnF,IAAI,CAAA,CAAA;AAC9C,GAAA;AAEA,EAAA,OAAOsF,oBAAoB,CAAA;AAC7B,CAAA;AAEA,IAAMA,oBAAoB,GAAG,SAAS;;;;"}
@@ -385,6 +385,25 @@ function getPathName(t, path) {
385
385
  if (t.isJSXNamespacedName(name)) {
386
386
  return name.name.name;
387
387
  }
388
+
389
+ // Handle JSX member expressions like Tab.Group
390
+ if (t.isJSXMemberExpression(name)) {
391
+ var objectName = getJSXMemberExpressionObjectName(t, name.object);
392
+ var propertyName = name.property.name;
393
+ return "".concat(objectName, ".").concat(propertyName);
394
+ }
395
+ return UNKNOWN_ELEMENT_NAME;
396
+ }
397
+
398
+ // Recursively handle nested member expressions (e.g. Components.UI.Header)
399
+ function getJSXMemberExpressionObjectName(t, object) {
400
+ if (t.isJSXIdentifier(object)) {
401
+ return object.name;
402
+ }
403
+ if (t.isJSXMemberExpression(object)) {
404
+ var objectName = getJSXMemberExpressionObjectName(t, object.object);
405
+ return "".concat(objectName, ".").concat(object.property.name);
406
+ }
388
407
  return UNKNOWN_ELEMENT_NAME;
389
408
  }
390
409
  var UNKNOWN_ELEMENT_NAME = "unknown";
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/constants.ts","../../src/index.ts"],"sourcesContent":["/**\n * MIT License\n *\n * Copyright (c) 2020 Engineering at FullStory\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n */\n\nexport const KNOWN_INCOMPATIBLE_PLUGINS = [\n // This module might be causing an issue preventing clicks. For safety, we won't run on this module.\n \"react-native-testfairy\",\n // This module checks for unexpected property keys and throws an exception.\n \"@react-navigation\",\n];\n\nexport const DEFAULT_IGNORED_ELEMENTS = [\n \"a\",\n \"abbr\",\n \"address\",\n \"area\",\n \"article\",\n \"aside\",\n \"audio\",\n \"b\",\n \"base\",\n \"bdi\",\n \"bdo\",\n \"blockquote\",\n \"body\",\n \"br\",\n \"button\",\n \"canvas\",\n \"caption\",\n \"cite\",\n \"code\",\n \"col\",\n \"colgroup\",\n \"data\",\n \"datalist\",\n \"dd\",\n \"del\",\n \"details\",\n \"dfn\",\n \"dialog\",\n \"div\",\n \"dl\",\n \"dt\",\n \"em\",\n \"embed\",\n \"fieldset\",\n \"figure\",\n \"footer\",\n \"form\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"head\",\n \"header\",\n \"hgroup\",\n \"hr\",\n \"html\",\n \"i\",\n \"iframe\",\n \"img\",\n \"input\",\n \"ins\",\n \"kbd\",\n \"keygen\",\n \"label\",\n \"legend\",\n \"li\",\n \"link\",\n \"main\",\n \"map\",\n \"mark\",\n \"menu\",\n \"menuitem\",\n \"meter\",\n \"nav\",\n \"noscript\",\n \"object\",\n \"ol\",\n \"optgroup\",\n \"option\",\n \"output\",\n \"p\",\n \"param\",\n \"pre\",\n \"progress\",\n \"q\",\n \"rb\",\n \"rp\",\n \"rt\",\n \"rtc\",\n \"ruby\",\n \"s\",\n \"samp\",\n \"script\",\n \"section\",\n \"select\",\n \"small\",\n \"source\",\n \"span\",\n \"strong\",\n \"style\",\n \"sub\",\n \"summary\",\n \"sup\",\n \"table\",\n \"tbody\",\n \"td\",\n \"template\",\n \"textarea\",\n \"tfoot\",\n \"th\",\n \"thead\",\n \"time\",\n \"title\",\n \"tr\",\n \"track\",\n \"u\",\n \"ul\",\n \"var\",\n \"video\",\n \"wbr\",\n];\n","/**\n * MIT License\n *\n * Copyright (c) 2020 Engineering at FullStory\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n */\n\n/**\n * The following code is based on the FullStory Babel plugin, but has been modified to work\n * with Sentry products:\n *\n * - Added `sentry` to data properties, i.e `data-sentry-component`\n * - Converted to TypeScript\n * - Code cleanups\n */\n\nimport type * as Babel from \"@babel/core\";\nimport type { PluginObj, PluginPass } from \"@babel/core\";\n\nimport { DEFAULT_IGNORED_ELEMENTS, KNOWN_INCOMPATIBLE_PLUGINS } from \"./constants\";\n\nconst webComponentName = \"data-sentry-component\";\nconst webElementName = \"data-sentry-element\";\nconst webSourceFileName = \"data-sentry-source-file\";\n\nconst nativeComponentName = \"dataSentryComponent\";\nconst nativeElementName = \"dataSentryElement\";\nconst nativeSourceFileName = \"dataSentrySourceFile\";\n\ninterface AnnotationOpts {\n native?: boolean;\n \"annotate-fragments\"?: boolean;\n ignoredComponents?: string[];\n}\n\ninterface AnnotationPluginPass extends PluginPass {\n opts: AnnotationOpts;\n}\n\ntype AnnotationPlugin = PluginObj<AnnotationPluginPass>;\n\n// We must export the plugin as default, otherwise the Babel loader will not be able to resolve it when configured using its string identifier\nexport default function componentNameAnnotatePlugin({ types: t }: typeof Babel): AnnotationPlugin {\n return {\n visitor: {\n FunctionDeclaration(path, state) {\n if (!path.node.id || !path.node.id.name) {\n return;\n }\n if (isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n functionBodyPushAttributes(\n state.opts[\"annotate-fragments\"] === true,\n t,\n path,\n path.node.id.name,\n sourceFileNameFromState(state),\n attributeNamesFromState(state),\n state.opts.ignoredComponents ?? []\n );\n },\n ArrowFunctionExpression(path, state) {\n // We're expecting a `VariableDeclarator` like `const MyComponent =`\n const parent = path.parent;\n\n if (\n !parent ||\n !(\"id\" in parent) ||\n !parent.id ||\n !(\"name\" in parent.id) ||\n !parent.id.name\n ) {\n return;\n }\n\n if (isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n functionBodyPushAttributes(\n state.opts[\"annotate-fragments\"] === true,\n t,\n path,\n parent.id.name,\n sourceFileNameFromState(state),\n attributeNamesFromState(state),\n state.opts.ignoredComponents ?? []\n );\n },\n ClassDeclaration(path, state) {\n const name = path.get(\"id\");\n const properties = path.get(\"body\").get(\"body\");\n const render = properties.find((prop) => {\n return prop.isClassMethod() && prop.get(\"key\").isIdentifier({ name: \"render\" });\n });\n\n if (!render || !render.traverse || isKnownIncompatiblePluginFromState(state)) {\n return;\n }\n\n const ignoredComponents = state.opts.ignoredComponents ?? [];\n\n render.traverse({\n ReturnStatement(returnStatement) {\n const arg = returnStatement.get(\"argument\");\n\n if (!arg.isJSXElement() && !arg.isJSXFragment()) {\n return;\n }\n\n processJSX(\n state.opts[\"annotate-fragments\"] === true,\n t,\n arg,\n name.node && name.node.name,\n sourceFileNameFromState(state),\n attributeNamesFromState(state),\n ignoredComponents\n );\n },\n });\n },\n },\n };\n}\n\nfunction functionBodyPushAttributes(\n annotateFragments: boolean,\n t: typeof Babel.types,\n path: Babel.NodePath<Babel.types.Function>,\n componentName: string,\n sourceFileName: string | undefined,\n attributeNames: string[],\n ignoredComponents: string[]\n) {\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;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D,UAAU,CAACI,IAAI,CAAC,UAAC5D,IAAI,EAAK;AACnD,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;;;;"}
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 // Handle JSX member expressions like Tab.Group\n if (t.isJSXMemberExpression(name)) {\n const objectName = getJSXMemberExpressionObjectName(t, name.object);\n const propertyName = name.property.name;\n return `${objectName}.${propertyName}`;\n }\n\n return UNKNOWN_ELEMENT_NAME;\n}\n\n// Recursively handle nested member expressions (e.g. Components.UI.Header)\nfunction getJSXMemberExpressionObjectName(\n t: typeof Babel.types,\n object: Babel.types.JSXMemberExpression | Babel.types.JSXIdentifier\n): string {\n if (t.isJSXIdentifier(object)) {\n return object.name;\n }\n if (t.isJSXMemberExpression(object)) {\n const objectName = getJSXMemberExpressionObjectName(t, object.object);\n return `${objectName}.${object.property.name}`;\n }\n\n return UNKNOWN_ELEMENT_NAME;\n}\n\nconst UNKNOWN_ELEMENT_NAME = \"unknown\";\n"],"names":["KNOWN_INCOMPATIBLE_PLUGINS","DEFAULT_IGNORED_ELEMENTS","webComponentName","webElementName","webSourceFileName","nativeComponentName","nativeElementName","nativeSourceFileName","componentNameAnnotatePlugin","_ref","t","types","visitor","FunctionDeclaration","path","state","_state$opts$ignoredCo","node","id","name","isKnownIncompatiblePluginFromState","functionBodyPushAttributes","opts","sourceFileNameFromState","attributeNamesFromState","ignoredComponents","ArrowFunctionExpression","_state$opts$ignoredCo2","parent","ClassDeclaration","_state$opts$ignoredCo3","get","properties","render","find","prop","isClassMethod","isIdentifier","traverse","ReturnStatement","returnStatement","arg","isJSXElement","isJSXFragment","processJSX","annotateFragments","componentName","sourceFileName","attributeNames","jsxNode","functionBody","type","maybeJsxNode","c","Array","isArray","isConditionalExpression","consequent","alternate","paths","openingElements","forEach","openingElement","applyAttributes","children","shouldSetComponentName","child","_attributeNames","_slicedToArray","componentAttributeName","elementAttributeName","sourceFileAttributeName","isReactFragment","attributes","elementName","getPathName","isAnIgnoredComponent","some","ignoredComponent","isAnIgnoredElement","hasAttributeWithName","includes","push","jSXAttribute","jSXIdentifier","stringLiteral","fullSourceFileNameFromState","undefined","indexOf","split","pop","_state$file$opts$pars","file","parserOpts","fullSourceFileName","pluginName","concat","_typeof","nodeName","nodeNameObject","object","nodeNameProperty","property","objectName","propertyName","UNKNOWN_ELEMENT_NAME","isJSXIdentifier","isJSXNamespacedName","isJSXMemberExpression","getJSXMemberExpressionObjectName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,IAAM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AoB,CAAA;AAC7B,CAAA;;AAEA;AACA,SAASI,gCAAgCA,CACvCnG,CAAqB,EACrB0F,MAAmE,EAC3D;AACR,EAAA,IAAI1F,CAAC,CAACgG,eAAe,CAACN,MAAM,CAAC,EAAE;IAC7B,OAAOA,MAAM,CAACjF,IAAI,CAAA;AACpB,GAAA;AACA,EAAA,IAAIT,CAAC,CAACkG,qBAAqB,CAACR,MAAM,CAAC,EAAE;IACnC,IAAMG,UAAU,GAAGM,gCAAgC,CAACnG,CAAC,EAAE0F,MAAM,CAACA,MAAM,CAAC,CAAA;IACrE,OAAAJ,EAAAA,CAAAA,MAAA,CAAUO,UAAU,EAAAP,GAAAA,CAAAA,CAAAA,MAAA,CAAII,MAAM,CAACE,QAAQ,CAACnF,IAAI,CAAA,CAAA;AAC9C,GAAA;AAEA,EAAA,OAAOsF,oBAAoB,CAAA;AAC7B,CAAA;AAEA,IAAMA,oBAAoB,GAAG,SAAS;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/babel-plugin-component-annotate",
3
- "version": "3.2.1",
3
+ "version": "3.2.2",
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": "3.2.1",
60
- "@sentry-internal/sentry-bundler-plugin-tsconfig": "3.2.1",
59
+ "@sentry-internal/eslint-config": "3.2.2",
60
+ "@sentry-internal/sentry-bundler-plugin-tsconfig": "3.2.2",
61
61
  "@swc/core": "^1.2.205",
62
62
  "@swc/jest": "^0.2.21",
63
63
  "@types/jest": "^28.1.3",