@sentry/babel-plugin-component-annotate 2.13.0 → 2.14.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 +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +2 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ Or alternatively, configure the plugin by directly importing it:
|
|
|
69
69
|
```js
|
|
70
70
|
// babel.config.js
|
|
71
71
|
|
|
72
|
-
import
|
|
72
|
+
import componentNameAnnotatePlugin from '@sentry/babel-plugin-component-annotate';
|
|
73
73
|
|
|
74
74
|
{
|
|
75
75
|
// ... other config above ...
|
package/dist/cjs/index.js
CHANGED
|
@@ -99,6 +99,7 @@ var webSourceFileName = "data-sentry-source-file";
|
|
|
99
99
|
var nativeComponentName = "dataSentryComponent";
|
|
100
100
|
var nativeElementName = "dataSentryElement";
|
|
101
101
|
var nativeSourceFileName = "dataSentrySourceFile";
|
|
102
|
+
// We must export the plugin as default, otherwise the Babel loader will not be able to resolve it when configured using its string identifier
|
|
102
103
|
function componentNameAnnotatePlugin(_ref) {
|
|
103
104
|
var t = _ref.types;
|
|
104
105
|
return {
|
|
@@ -382,5 +383,5 @@ function getPathName(t, path) {
|
|
|
382
383
|
}
|
|
383
384
|
var UNKNOWN_ELEMENT_NAME = "unknown";
|
|
384
385
|
|
|
385
|
-
exports
|
|
386
|
+
exports["default"] = componentNameAnnotatePlugin;
|
|
386
387
|
//# sourceMappingURL=index.js.map
|
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\nexport 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 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 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\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","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,QA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/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 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 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\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","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,IAA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AACA,IAAI,CAAA;AACvB,GAAA;AAEA,EAAA,OAAOsF,oBAAoB,CAAA;AAC7B,CAAA;AAEA,IAAMA,oBAAoB,GAAG,SAAS;;;;"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -95,6 +95,7 @@ var webSourceFileName = "data-sentry-source-file";
|
|
|
95
95
|
var nativeComponentName = "dataSentryComponent";
|
|
96
96
|
var nativeElementName = "dataSentryElement";
|
|
97
97
|
var nativeSourceFileName = "dataSentrySourceFile";
|
|
98
|
+
// We must export the plugin as default, otherwise the Babel loader will not be able to resolve it when configured using its string identifier
|
|
98
99
|
function componentNameAnnotatePlugin(_ref) {
|
|
99
100
|
var t = _ref.types;
|
|
100
101
|
return {
|
|
@@ -378,5 +379,5 @@ function getPathName(t, path) {
|
|
|
378
379
|
}
|
|
379
380
|
var UNKNOWN_ELEMENT_NAME = "unknown";
|
|
380
381
|
|
|
381
|
-
export { componentNameAnnotatePlugin };
|
|
382
|
+
export { componentNameAnnotatePlugin as default };
|
|
382
383
|
//# sourceMappingURL=index.mjs.map
|
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\nexport 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 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 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\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","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,OAAO,EACP,KAAK,EACL,UAAU,EACV,GAAG,EACH,IA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AAA;AACJ,CAAA;AAEA,SAASsD,WAAWA,CAAC/D,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 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 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 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\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","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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AI,CAACmC,IAAI,KAAK,cAAc,EAAE;AAChC,MAAA,OAAOnC,IAAI,CAACE,IAAI,CAACA,IAAI,KAAKA,IAAI,CAAA;AAChC,KAAA;AAEA,IAAA,OAAO,KAAK,CAAA;AACd,GAAC,CAAC,CAAA;AACJ,CAAA;AAEA,SAASsD,WAAWA,CAAC/D,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
|
@@ -42,5 +42,5 @@ interface AnnotationPluginPass extends PluginPass {
|
|
|
42
42
|
}
|
|
43
43
|
type IgnoredComponent = [file: string, component: string, element: string];
|
|
44
44
|
type AnnotationPlugin = PluginObj<AnnotationPluginPass>;
|
|
45
|
-
export
|
|
45
|
+
export default function componentNameAnnotatePlugin({ types: t }: typeof Babel): AnnotationPlugin;
|
|
46
46
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/babel-plugin-component-annotate",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.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": "2.
|
|
60
|
-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "2.
|
|
59
|
+
"@sentry-internal/eslint-config": "2.14.0",
|
|
60
|
+
"@sentry-internal/sentry-bundler-plugin-tsconfig": "2.14.0",
|
|
61
61
|
"@swc/core": "^1.2.205",
|
|
62
62
|
"@swc/jest": "^0.2.21",
|
|
63
63
|
"@types/jest": "^28.1.3",
|