@dynatrace/react-native-plugin 2.293.2 → 2.297.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -2
- package/android/build.gradle +1 -1
- package/files/plugin.gradle +1 -1
- package/jsx-dev-runtime.js +4 -0
- package/lib/instrumentor/DynatraceInstrumentation.js +1 -1
- package/lib/instrumentor/base/configuration/Configuration.js +7 -2
- package/lib/instrumentor/base/configuration/ConfigurationBuilder.js +6 -1
- package/lib/instrumentor/base/configuration/ConfigurationHandler.js +1 -0
- package/lib/instrumentor/base/configuration/ConfigurationPreset.js +3 -0
- package/lib/jsx-dev-runtime.js +52 -0
- package/package.json +4 -3
- package/react-native-dynatrace.podspec +1 -1
package/README.md
CHANGED
|
@@ -31,8 +31,8 @@ If you want to start using this plugin and are not a Dynatrace customer yet, hea
|
|
|
31
31
|
## Agent Versions
|
|
32
32
|
This agent versions are configured in this plugin:
|
|
33
33
|
|
|
34
|
-
* Android Agent: 8.
|
|
35
|
-
* iOS Agent: 8.
|
|
34
|
+
* Android Agent: 8.297.1.1003
|
|
35
|
+
* iOS Agent: 8.297.1.1004
|
|
36
36
|
|
|
37
37
|
## Quick Setup
|
|
38
38
|
|
|
@@ -81,10 +81,12 @@ This agent versions are configured in this plugin:
|
|
|
81
81
|
* [Upgrading project to Gradle 6](#updating-to-gradle-6)
|
|
82
82
|
* [Maven Central in top-level gradle file](#maven-central-in-top-level-gradle-file)
|
|
83
83
|
* [Configuration of standalone React Native project](#configuration-of-standalone-react-native-project)
|
|
84
|
+
* [Instrumentation Overhead](#instrumentation-overhead)
|
|
84
85
|
|
|
85
86
|
## Troubleshooting
|
|
86
87
|
* [Documentation](#dynatrace-documentation)
|
|
87
88
|
* [Known issues](#troubleshooting-and-applicable-restrictions)
|
|
89
|
+
* [Supported and Unsupported libraries](#supported-and-unsupported-libraries)
|
|
88
90
|
* [Report bug / Get support](#report-a-bug-or-open-a-support-case)
|
|
89
91
|
* [Changelog](#changelog)
|
|
90
92
|
<br/><br/>
|
|
@@ -1388,6 +1390,15 @@ The OneAgent for Android and iOS documentation is available at the following loc
|
|
|
1388
1390
|
**Note:**
|
|
1389
1391
|
The Dynatrace Android Gradle plugin is hosted on [Maven Central](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.dynatrace.tools.android%22%20AND%20a%3A%22gradle-plugin%22). JCenter has noted it's [sunset](https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/) on May 1st so Maven Central is the primary source of the Dynatrace Android Gradle plugin.
|
|
1390
1392
|
|
|
1393
|
+
## Instrumentation Overhead
|
|
1394
|
+
|
|
1395
|
+
When using auto-instrumenation through our plugin, here are some examples of the size differences before and after instrumentation for release builds:
|
|
1396
|
+
|
|
1397
|
+
| Operating System | App template | Version | Size Before | Size After | Difference |
|
|
1398
|
+
|----------------------|-------------------------|----------------|-----------------|----------------|----------------|
|
|
1399
|
+
| Android | Default new app | 0.74.3 | 50.7 MB | 50.9 MB | 0.2 MB |
|
|
1400
|
+
| iOS | Default new app | 0.74.3 | 28.1 MB | 36.5 MB | 8.4 MB |
|
|
1401
|
+
|
|
1391
1402
|
## Troubleshooting and applicable restrictions
|
|
1392
1403
|
|
|
1393
1404
|
>**Attention:** If you think something is not working the way it should, ALWAYS try to reset the cache of metro first before starting a support case. You can do this via the CLI *react-native start --reset-cache*. If it still does not work feel free to open a support case.
|
|
@@ -1403,6 +1414,19 @@ To resolve problems with the plugin, first look at creating logs and identify wh
|
|
|
1403
1414
|
* When using NodeJS version `15+` and version `2.231.1` of our plugin you could encounter the following error: `npm ERR! Could not resolve dependency: npm ERR! peer react@"^16.0" from @react-native-community/picker@1.8.1`. Using the old deprecrated [Picker dependency](https://www.npmjs.com/package/@react-native-community/picker) was causing peer dependency issues so we updated the auto-instrumentation to use the [new Picker dependency.](https://www.npmjs.com/package/@react-native-picker/picker) If you are still using this `@react-native-community/picker`, you can manually instrument the picker without issue ([create custom actions](#create-custom-actions)).
|
|
1404
1415
|
* To disable the error handler when using manual startup, you will need to use/migrate to the `ConfigurationBuilder` instead of the deprecated `ManualStartupConfiguration`. There is no option to disable the crash handler using `ManualStartupConfiguration`.
|
|
1405
1416
|
|
|
1417
|
+
## Supported and Unsupported libraries
|
|
1418
|
+
>**Important note:** If the library you are using is not on either the support or unsupported list, that does not mean that this plugin is not compatible with the library.
|
|
1419
|
+
|
|
1420
|
+
**Supported:**
|
|
1421
|
+
* @react-native-picker/picker
|
|
1422
|
+
* axios
|
|
1423
|
+
* react-native-gesture-handler
|
|
1424
|
+
* react-native-webview
|
|
1425
|
+
* Custom libraries that directly use the default React Native components (i.e. Button)
|
|
1426
|
+
|
|
1427
|
+
**Unsupported:**
|
|
1428
|
+
* NativeWind
|
|
1429
|
+
|
|
1406
1430
|
## Report a bug or open a support case
|
|
1407
1431
|
|
|
1408
1432
|
>**Attention:** If you think something is not working the way it should, ALWAYS try to reset the cache of metro first before starting a support case. You can do this via the CLI *react-native start --reset-cache*. If it still does not work feel free to open a support case.
|
|
@@ -1414,6 +1438,14 @@ If you are struggling with a problem, submit a support ticket to Dynatrace (supp
|
|
|
1414
1438
|
<br/><br/>
|
|
1415
1439
|
## Changelog
|
|
1416
1440
|
|
|
1441
|
+
2.297.1
|
|
1442
|
+
* Update Android (8.297.1.1004) & iOS Agent (8.297.1.1003)
|
|
1443
|
+
* Added information about [Instrumentation Overhead](#instrumentation-overhead) to README
|
|
1444
|
+
|
|
1445
|
+
2.295.1
|
|
1446
|
+
* Update Android (8.295.1.1006) & iOS Agent (8.295.1.1020)
|
|
1447
|
+
* Add list of supported/unsupported libraries to README
|
|
1448
|
+
|
|
1417
1449
|
2.293.2
|
|
1418
1450
|
* Update Android (8.293.1.1003) & iOS Agent (8.293.1.1003)
|
|
1419
1451
|
* Preventing double instrumentation of touchables
|
package/android/build.gradle
CHANGED
|
@@ -70,7 +70,7 @@ repositories {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
dependencies {
|
|
73
|
-
implementation 'com.dynatrace.agent:agent-android:8.
|
|
73
|
+
implementation 'com.dynatrace.agent:agent-android:8.297.1.1003'
|
|
74
74
|
implementation "com.facebook.react:react-native:${safeExtGet('reactNative', '+')}"
|
|
75
75
|
}
|
|
76
76
|
|
package/files/plugin.gradle
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var o,n=require("@babel/runtime/helpers/interopRequireDefault"),r=n(require("@babel/runtime/helpers/toConsumableArray")),a=(Object.defineProperty(exports,"t",{value:!0}),exports.instrument=void 0,require("path")),c=require("jscodeshift"),i=require("jscodeshift/src/Collection"),e=require("../../scripts/FileOperationHelper"),t=require("../../scripts/PathsConstants"),u=require("../react-native/Touchables.InstrInfo"),l=require("../react-native/RefreshControl.InstrInfo"),f=require("../react-native/Switch.InstrInfo"),s=require("../community/gesture-handler/Touchables.InstrInfo"),v=require("../community/Picker.InstrInfo"),d=require("./parser/Babel"),p=require("./model/Types"),m=(!function(n){n[n.i=-1]="Filtered",n[n.u=0]="Normal",n[n.o=1]="ReactNative",n[n.l=2]="React"}(o=o||{}),[]),y=(m.push.apply(m,(0,r.default)(u.instrumentationInfo)),m.push.apply(m,(0,r.default)(l.instrumentationInfo)),m.push.apply(m,(0,r.default)(f.instrumentationInfo)),m.push.apply(m,(0,r.default)(s.instrumentationInfo)),m.push.apply(m,(0,r.default)(v.instrumentationInfo)),["AppRegistry","renderApplication","setUpErrorHandling"]),instrument=function(n,r,e){r=P(r);var t=M(r);if(t!==o.i){var i=!1,u=N(r,n);if(t===o.l)T(u),i=!0;else if(t===o.o)r.endsWith("AppRegistry.js")?void 0!==e&&e.autoStart&&(U(u),i=!0):r.endsWith("renderApplication.js")?(q(u),i=!0):r.endsWith("setUpErrorHandling.js")&&void 0!==e&&e.autoStart&&e.errorHandler.enabled&&(B(u,e.autoStart,e.errorHandler.reportFatalErrorAsCrash),i=!0);else{var t=w(r,e);if(e.custom.reactnavigation&&g(r,u))i=!0;else{if(!t.input&&!t.lifecycle)return null!=e&&e.debug&&console.log("Dynatrace - Filtered All: ".concat(r)),E(r),n;t.lifecycle&&q(u)&&(i=!0),t.input&&m.forEach(function(n){n=G(u,n);u=n.root,i=i||n.v})}}i?(n=u.toSource({quote:"single"}),H(n,r)):E(r),null!=e&&e.debug&&i&&console.log("Dynatrace - Modified Filename: "+r)}else r.includes(a.join("@dynatrace","react-native-plugin"))&&r.endsWith(a.join("lib","instrumentor","base","configuration","ConfigurationPreset.js"))&&void 0!==e&&(t=N(r,n),void 0!==e.lifecycle&&h(t,"getLifecycleUpdate",e.lifecycle.includeUpdate),void 0!==e.debug&&h(t,"getLogLevel",e.debug?0:1),void 0!==e.bundleName&&h(t,"getBundleName",e.bundleName),void 0!==e.input&&void 0!==e.input.actionNamePrivacy&&h(t,"getActionNamePrivacy",e.input.actionNamePrivacy),void 0!==e.errorHandler&&(h(t,"isErrorHandlerEnabled",e.errorHandler.enabled),h(t,"isReportFatalErrorAsCrash",e.errorHandler.reportFatalErrorAsCrash)),e.autoStart&&h(t,"isAutoStartupEnabled",e.autoStart),n=t.toSource({quote:"single"}),H(n,r));return n},g=(exports.instrument=instrument,function(n,r){return!!b(n,r)&&(r.find(c.ImportDeclaration).at(0).insertBefore("import { registerListener } from '@dynatrace/react-native-plugin/lib/react-navigation/ReactNavigation';"),!0)}),b=function(n,r){var e=!1;return n.includes("react-navigation")&&n.includes("NavigationContainer.tsx")&&r.find(c.VariableDeclarator).forEach(function(n){e||null==n.value||null==n.value.id||"refContainer"!==n.value.id.name||null!=n.parent&&null!=n.parent.value&&null!=n.parent.value.type&&"VariableDeclaration"===n.parent.value.type&&(n.parent.insertAfter("registerListener(refContainer);"),e=!0)}),e},q=function(n){var r=n.findJSXElements(),t=!1;return 0<r.length&&(n.find(c.FunctionDeclaration).forEach(function(n){var r,e=(0,i.fromPaths)([n]);0<e.findJSXElements().length&&null!=n&&null!=n.value&&null!=n.value.id&&n.value.id.name&&(r=e.find(c.ClassDeclaration),e=e.find(c.ClassExpression),0===r.length)&&0===e.length&&(A(n,p.Types.FunctionalComponent,n.value.id.name),t=!0)}),n.find(c.ClassDeclaration).forEach(function(n){0<(0,i.fromPaths)([n]).findJSXElements().length&&null!=n&&null!=n.value&&n.value.id&&n.value.id.name&&(A(n,p.Types.ClassComponent,n.value.id.name),t=!0)}),n.find(c.ArrowFunctionExpression).forEach(function(n){0<(0,i.fromPaths)([n]).findJSXElements().length&&null!=n.parent&&null!=n.parent.value&&null!=n.parent.value.id&&null!=n.parent.value.id.name&&(A(n,p.Types.FunctionalComponent,n.parent.value.id.name),t=!0)})),t},A=function(n,r,e){for(r=c.expressionStatement(c.assignmentExpression("=",c.memberExpression(c.identifier(e),c.identifier("_dtInfo")),O(r,e)));void 0!==n.parentPath&&"body"!==n.parentPath.name;)n=n.parentPath;void 0!==n.parentPath&&n.insertAfter(r)},O=function(n,r){return c.objectExpression([c.objectProperty(c.identifier("type"),c.numericLiteral(n)),c.objectProperty(c.identifier("name"),c.stringLiteral(r))])},h=function(n,r,e){var n=n.find(c.Identifier).filter(function(n){return n.node.name===r});1===n.length&&"ReturnStatement"===(n=n.paths()[0].parent.value.body.body[0]).type&&("boolean"==typeof e&&(n.argument=c.booleanLiteral(e)),"string"==typeof e&&(n.argument=c.stringLiteral(e)),"number"==typeof e)&&(n.argument=c.numericLiteral(e))},N=function(n,r){return c.withParser((0,d.babelParser)(a.extname(n)))(r)},P=function(n){return a.isAbsolute(n)?n.replace(t.default.getApplicationPath()+a.sep,""):n},E=function(n){try{var r=a.join(t.default.getBuildPath(),n+".dtx");e.default.checkIfFileExistsSync(r),e.default.deleteFileSync(r)}catch(n){}},H=function(n,r){r=a.join(t.default.getBuildPath(),r);try{e.default.checkIfFileExistsSync(a.dirname(r))}catch(n){e.default.createDirectorySync(a.dirname(r))}e.default.writeTextToFileSync(r+".dtx",n)},w=function(n,r){var e={input:!1,lifecycle:!1};return void 0!==r&&(void 0!==r.lifecycle&&void 0!==r.lifecycle.instrument&&r.lifecycle.instrument(n)&&(e.lifecycle=!0),void 0!==r.input)&&void 0!==r.input.instrument&&r.input.instrument(n)&&(e.input=!0),e},T=function(n){var r,n=n.find(c.Program);1===n.length&&(r=c.expressionStatement(c.callExpression(c.memberExpression(c.callExpression(c.identifier("require"),[c.stringLiteral("@dynatrace/react-native-plugin/lib/instrumentor/base/ElementHelper")]),c.identifier("instrumentCreateElement")),[c.memberExpression(c.identifier("module"),c.identifier("exports"))])),n.paths()[0].node.body.push(r))},U=function(n){var r=J(n,"runApplication",!0);1===r.length&&(rn(n,{p:"_DynatraceApplicationHandler",module:"@dynatrace/react-native-plugin",reference:"ApplicationHandler"}),I(r.paths()[0].parent.value.body.body,0,D("_DynatraceApplicationHandler","startup",[])))},B=function(n,r,e){n=n.paths()[0].value.program.body;null!=n&&(I(n,n.length,_({p:"_DynatraceErrorHandler",module:"@dynatrace/react-native-plugin/lib/instrumentor/base/ErrorHandler",reference:""})),I(n,n.length,D("_DynatraceErrorHandler","registerErrorHandler",[c.literal(e)])))},I=function(n,r){for(var e=arguments.length,t=new Array(2<e?e-2:0),i=2;i<e;i++)t[i-2]=arguments[i];return n.splice.apply(n,[r,0].concat(t))},J=function(n,r,t){for(var e=arguments.length,i=new Array(3<e?e-3:0),u=3;u<e;u++)i[u-3]=arguments[u];return n.find(c.Identifier).filter(function(n){return n.node.name===r}).filter(function(n){return void 0!==n.parent&&void 0!==n.parent.value&&void 0!==n.parent.value.params}).filter(function(n){var r=void 0!==n.parent&&void 0!==n.parent.value;t||(r=r&&n.parent.value.params.length===i.length);for(var e=0;e<0;e++)r=r&&n.parent.value.params[e].name===i[e];return r})},M=function(n){if(n.includes("@dynatrace"))return o.i;var r=a.extname(n);if(".js"!==r&&".ts"!==r&&".tsx"!==r&&".jsx"!==r)return o.i;for(var e=a.parse(n),t=e.dir.split(a.sep),i=0;i<t.length;i++)if("node_modules"===t[i]){if("react-native"===t[i+1]||"create-react-class"===t[i+1]||"react-clone-referenced-element"===t[i+1])return y.includes(e.name)?o.o:o.i;if("react"===t[i+1]&&"index"===e.name)return o.l}return o.u},k=function(n,r,e){var t=V(n,r,e);return z(n,r,e)||t},V=function(n,r,e){var t=K(n,r);return 0<t.length&&(void 0!==(t=j(t,r.reference,!1))&&(e.p=t.localName),$(n,e),!0)},z=function(n,r,e){var t=C(n,r.module);if(1===t.length){t=j(t,r.reference,!0);if(void 0!==t)return nn(n,e.defaultImport,t.localName,"ImportNamespaceSpecifier"===t.type),!0}return!1},G=function(n,r){var e=JSON.parse(JSON.stringify(r.new));return{root:n,v:k(n,r.old,e)||Q(n,r.old,r.new.defaultImport)}},K=function(n,r){return n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r.module&&null!=n.node.specifiers&&n.node.specifiers.some(function(n){return x(n)&&n.imported.name===r.reference||n.local&&n.local.name===r.reference})})},x=function(n){return void 0!==n.imported},Q=function(n,r,e){var t=!1;return n.find(c.CallExpression).filter(function(n){return W(n.node.callee)&&X(n.node.arguments[0])&&n.node.arguments[0].value===r.module&&void 0!==n.parent}).forEach(function(n){(void 0===n.parent.value.property||void 0!==n.parent.value.property&&void 0!==n.parent.value.property.name&&n.parent.value.property.name===r.reference)&&(n.node.arguments[0].value=e,t=t||!0)}),t},W=function(n){return"require"===n.name},X=function(n){return"StringLiteral"===n.type||"Literal"===n.type},C=function(n,r){return n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r})},j=function(n,e,t){var i;return n.forEach(function(n){void 0!==n.node.specifiers&&(n.node.specifiers=n.node.specifiers.filter(function(n){var r;return x(n)&&!t?((r=n.imported.name!==e)||null==n.local||n.imported.name===n.local.name||(i={localName:n.local.name,type:n.type}),r):!(!x(n)&&t&&(null!=n.local&&(i={localName:n.local.name,type:n.type}),1))}),0===n.node.specifiers.length)&&n.prune()}),i},Y=function(n,r){n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r.module}).forEach(function(n){null!=n.node.specifiers&&n.node.specifiers.push(F(r))})},Z=function(n,r,e){n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r}).forEach(function(n){null!=n.node.specifiers&&n.node.specifiers.push(e)})},R=function(n,r,e){var t=n.find(c.ImportDeclaration);0<t.length?c(t.paths()[0]).insertAfter(S(r,e)):1===(t=n.find(c.Program)).length&&t.paths()[0].node.body.unshift(S(r,e))},$=function(n,r){0<C(n,r.module).length?Y(n,r):R(n,r.module,[F(r)])},nn=function(n,r,e,t){var i=C(n,r),t=(t?cn:an)(e);0<i.length?Z(n,r,t):R(n,r,[t])},rn=function(n,r){n=n.find(c.VariableDeclaration);0<n.length&&c(n.paths()[0]).insertAfter(_(r))},D=function(n,r,e){return c.expressionStatement(en(n,r,e))},en=function(n,r,e){return c.callExpression(on(n,r),e)},_=function(n){return c.variableDeclaration("var",[tn(n)])},tn=function(n){return c.variableDeclarator(void 0!==n.p?c.identifier(n.p):c.identifier(n.reference),(0<n.reference.length?un:L)(n))},un=function(n){return c.memberExpression(L(n),c.identifier(n.reference))},on=function(n,r){return c.memberExpression(c.identifier(n),c.identifier(r))},L=function(n){return c.callExpression(c.identifier("require"),[c.literal(n.module)])},S=function(n,r){return c.importDeclaration(r,c.literal(n))},F=function(n){return void 0!==n.p?c.importSpecifier(c.identifier(n.reference),c.identifier(n.p)):c.importSpecifier(c.identifier(n.reference))},an=function(n){return c.importDefaultSpecifier(c.identifier(n))},cn=function(n){return c.importNamespaceSpecifier(c.identifier(n))};
|
|
1
|
+
"use strict";var o,n=require("@babel/runtime/helpers/interopRequireDefault"),r=n(require("@babel/runtime/helpers/toConsumableArray")),a=(Object.defineProperty(exports,"t",{value:!0}),exports.instrument=void 0,require("path")),c=require("jscodeshift"),i=require("jscodeshift/src/Collection"),e=require("../../scripts/FileOperationHelper"),t=require("../../scripts/PathsConstants"),u=require("../react-native/Touchables.InstrInfo"),l=require("../react-native/RefreshControl.InstrInfo"),f=require("../react-native/Switch.InstrInfo"),s=require("../community/gesture-handler/Touchables.InstrInfo"),d=require("../community/Picker.InstrInfo"),v=require("./parser/Babel"),p=require("./model/Types"),m=(!function(n){n[n.i=-1]="Filtered",n[n.u=0]="Normal",n[n.o=1]="ReactNative",n[n.l=2]="React"}(o=o||{}),[]),y=(m.push.apply(m,(0,r.default)(u.instrumentationInfo)),m.push.apply(m,(0,r.default)(l.instrumentationInfo)),m.push.apply(m,(0,r.default)(f.instrumentationInfo)),m.push.apply(m,(0,r.default)(s.instrumentationInfo)),m.push.apply(m,(0,r.default)(d.instrumentationInfo)),["AppRegistry","renderApplication","setUpErrorHandling"]),instrument=function(n,r,e){r=P(r);var t=M(r);if(t!==o.i){var i=!1,u=N(r,n);if(t===o.l)B(u),i=!0;else if(t===o.o)r.endsWith("AppRegistry.js")?void 0!==e&&e.autoStart&&(T(u),i=!0):r.endsWith("renderApplication.js")?(q(u),i=!0):r.endsWith("setUpErrorHandling.js")&&void 0!==e&&e.autoStart&&e.errorHandler.enabled&&(U(u,e.autoStart,e.errorHandler.reportFatalErrorAsCrash),i=!0);else{var t=w(r,e);if(e.custom.reactnavigation&&g(r,u))i=!0;else{if(!t.input&&!t.lifecycle)return null!=e&&e.debug&&console.log("Dynatrace - Filtered All: ".concat(r)),E(r),n;t.lifecycle&&q(u)&&(i=!0),t.input&&m.forEach(function(n){n=G(u,n);u=n.root,i=i||n.v})}}i?(n=u.toSource({quote:"single"}),H(n,r)):E(r),null!=e&&e.debug&&i&&console.log("Dynatrace - Modified Filename: "+r)}else r.includes(a.join("@dynatrace","react-native-plugin"))&&r.endsWith(a.join("lib","instrumentor","base","configuration","ConfigurationPreset.js"))&&void 0!==e&&(t=N(r,n),void 0!==e.lifecycle&&h(t,"getLifecycleUpdate",e.lifecycle.includeUpdate),void 0!==e.debug&&h(t,"getLogLevel",e.debug?0:1),void 0!==e.bundleName&&h(t,"getBundleName",e.bundleName),void 0!==e.bundleVersion&&h(t,"getBundleVersion",e.bundleVersion),void 0!==e.input&&void 0!==e.input.actionNamePrivacy&&h(t,"getActionNamePrivacy",e.input.actionNamePrivacy),void 0!==e.errorHandler&&(h(t,"isErrorHandlerEnabled",e.errorHandler.enabled),h(t,"isReportFatalErrorAsCrash",e.errorHandler.reportFatalErrorAsCrash)),e.autoStart&&h(t,"isAutoStartupEnabled",e.autoStart),n=t.toSource({quote:"single"}),H(n,r));return n},g=(exports.instrument=instrument,function(n,r){return!!b(n,r)&&(r.find(c.ImportDeclaration).at(0).insertBefore("import { registerListener } from '@dynatrace/react-native-plugin/lib/react-navigation/ReactNavigation';"),!0)}),b=function(n,r){var e=!1;return n.includes("react-navigation")&&n.includes("NavigationContainer.tsx")&&r.find(c.VariableDeclarator).forEach(function(n){e||null==n.value||null==n.value.id||"refContainer"!==n.value.id.name||null!=n.parent&&null!=n.parent.value&&null!=n.parent.value.type&&"VariableDeclaration"===n.parent.value.type&&(n.parent.insertAfter("registerListener(refContainer);"),e=!0)}),e},q=function(n){var r=n.findJSXElements(),t=!1;return 0<r.length&&(n.find(c.FunctionDeclaration).forEach(function(n){var r,e=(0,i.fromPaths)([n]);0<e.findJSXElements().length&&null!=n&&null!=n.value&&null!=n.value.id&&n.value.id.name&&(r=e.find(c.ClassDeclaration),e=e.find(c.ClassExpression),0===r.length)&&0===e.length&&(A(n,p.Types.FunctionalComponent,n.value.id.name),t=!0)}),n.find(c.ClassDeclaration).forEach(function(n){0<(0,i.fromPaths)([n]).findJSXElements().length&&null!=n&&null!=n.value&&n.value.id&&n.value.id.name&&(A(n,p.Types.ClassComponent,n.value.id.name),t=!0)}),n.find(c.ArrowFunctionExpression).forEach(function(n){0<(0,i.fromPaths)([n]).findJSXElements().length&&null!=n.parent&&null!=n.parent.value&&null!=n.parent.value.id&&null!=n.parent.value.id.name&&(A(n,p.Types.FunctionalComponent,n.parent.value.id.name),t=!0)})),t},A=function(n,r,e){for(r=c.expressionStatement(c.assignmentExpression("=",c.memberExpression(c.identifier(e),c.identifier("_dtInfo")),O(r,e)));void 0!==n.parentPath&&"body"!==n.parentPath.name;)n=n.parentPath;void 0!==n.parentPath&&n.insertAfter(r)},O=function(n,r){return c.objectExpression([c.objectProperty(c.identifier("type"),c.numericLiteral(n)),c.objectProperty(c.identifier("name"),c.stringLiteral(r))])},h=function(n,r,e){var n=n.find(c.Identifier).filter(function(n){return n.node.name===r});1===n.length&&"ReturnStatement"===(n=n.paths()[0].parent.value.body.body[0]).type&&("boolean"==typeof e&&(n.argument=c.booleanLiteral(e)),"string"==typeof e&&(n.argument=c.stringLiteral(e)),"number"==typeof e)&&(n.argument=c.numericLiteral(e))},N=function(n,r){return c.withParser((0,v.babelParser)(a.extname(n)))(r)},P=function(n){return a.isAbsolute(n)?n.replace(t.default.getApplicationPath()+a.sep,""):n},E=function(n){try{var r=a.join(t.default.getBuildPath(),n+".dtx");e.default.checkIfFileExistsSync(r),e.default.deleteFileSync(r)}catch(n){}},H=function(n,r){r=a.join(t.default.getBuildPath(),r);try{e.default.checkIfFileExistsSync(a.dirname(r))}catch(n){e.default.createDirectorySync(a.dirname(r))}e.default.writeTextToFileSync(r+".dtx",n)},w=function(n,r){var e={input:!1,lifecycle:!1};return void 0!==r&&(void 0!==r.lifecycle&&void 0!==r.lifecycle.instrument&&r.lifecycle.instrument(n)&&(e.lifecycle=!0),void 0!==r.input)&&void 0!==r.input.instrument&&r.input.instrument(n)&&(e.input=!0),e},B=function(n){var r,n=n.find(c.Program);1===n.length&&(r=c.expressionStatement(c.callExpression(c.memberExpression(c.callExpression(c.identifier("require"),[c.stringLiteral("@dynatrace/react-native-plugin/lib/instrumentor/base/ElementHelper")]),c.identifier("instrumentCreateElement")),[c.memberExpression(c.identifier("module"),c.identifier("exports"))])),n.paths()[0].node.body.push(r))},T=function(n){var r=J(n,"runApplication",!0);1===r.length&&(rn(n,{p:"_DynatraceApplicationHandler",module:"@dynatrace/react-native-plugin",reference:"ApplicationHandler"}),I(r.paths()[0].parent.value.body.body,0,D("_DynatraceApplicationHandler","startup",[])))},U=function(n,r,e){n=n.paths()[0].value.program.body;null!=n&&(I(n,n.length,_({p:"_DynatraceErrorHandler",module:"@dynatrace/react-native-plugin/lib/instrumentor/base/ErrorHandler",reference:""})),I(n,n.length,D("_DynatraceErrorHandler","registerErrorHandler",[c.literal(e)])))},I=function(n,r){for(var e=arguments.length,t=new Array(2<e?e-2:0),i=2;i<e;i++)t[i-2]=arguments[i];return n.splice.apply(n,[r,0].concat(t))},J=function(n,r,t){for(var e=arguments.length,i=new Array(3<e?e-3:0),u=3;u<e;u++)i[u-3]=arguments[u];return n.find(c.Identifier).filter(function(n){return n.node.name===r}).filter(function(n){return void 0!==n.parent&&void 0!==n.parent.value&&void 0!==n.parent.value.params}).filter(function(n){var r=void 0!==n.parent&&void 0!==n.parent.value;t||(r=r&&n.parent.value.params.length===i.length);for(var e=0;e<0;e++)r=r&&n.parent.value.params[e].name===i[e];return r})},M=function(n){if(n.includes("@dynatrace"))return o.i;var r=a.extname(n);if(".js"!==r&&".ts"!==r&&".tsx"!==r&&".jsx"!==r)return o.i;for(var e=a.parse(n),t=e.dir.split(a.sep),i=0;i<t.length;i++)if("node_modules"===t[i]){if("react-native"===t[i+1]||"create-react-class"===t[i+1]||"react-clone-referenced-element"===t[i+1])return y.includes(e.name)?o.o:o.i;if("react"===t[i+1]&&"index"===e.name)return o.l}return o.u},V=function(n,r,e){var t=k(n,r,e);return z(n,r,e)||t},k=function(n,r,e){var t=K(n,r);return 0<t.length&&(void 0!==(t=j(t,r.reference,!1))&&(e.p=t.localName),$(n,e),!0)},z=function(n,r,e){var t=C(n,r.module);if(1===t.length){t=j(t,r.reference,!0);if(void 0!==t)return nn(n,e.defaultImport,t.localName,"ImportNamespaceSpecifier"===t.type),!0}return!1},G=function(n,r){var e=JSON.parse(JSON.stringify(r.new));return{root:n,v:V(n,r.old,e)||Q(n,r.old,r.new.defaultImport)}},K=function(n,r){return n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r.module&&null!=n.node.specifiers&&n.node.specifiers.some(function(n){return x(n)&&n.imported.name===r.reference||n.local&&n.local.name===r.reference})})},x=function(n){return void 0!==n.imported},Q=function(n,r,e){var t=!1;return n.find(c.CallExpression).filter(function(n){return W(n.node.callee)&&X(n.node.arguments[0])&&n.node.arguments[0].value===r.module&&void 0!==n.parent}).forEach(function(n){(void 0===n.parent.value.property||void 0!==n.parent.value.property&&void 0!==n.parent.value.property.name&&n.parent.value.property.name===r.reference)&&(n.node.arguments[0].value=e,t=t||!0)}),t},W=function(n){return"require"===n.name},X=function(n){return"StringLiteral"===n.type||"Literal"===n.type},C=function(n,r){return n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r})},j=function(n,e,t){var i;return n.forEach(function(n){void 0!==n.node.specifiers&&(n.node.specifiers=n.node.specifiers.filter(function(n){var r;return x(n)&&!t?((r=n.imported.name!==e)||null==n.local||n.imported.name===n.local.name||(i={localName:n.local.name,type:n.type}),r):!(!x(n)&&t&&(null!=n.local&&(i={localName:n.local.name,type:n.type}),1))}),0===n.node.specifiers.length)&&n.prune()}),i},Y=function(n,r){n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r.module}).forEach(function(n){null!=n.node.specifiers&&n.node.specifiers.push(F(r))})},Z=function(n,r,e){n.find(c.ImportDeclaration).filter(function(n){return n.node.source.value===r}).forEach(function(n){null!=n.node.specifiers&&n.node.specifiers.push(e)})},R=function(n,r,e){var t=n.find(c.ImportDeclaration);0<t.length?c(t.paths()[0]).insertAfter(S(r,e)):1===(t=n.find(c.Program)).length&&t.paths()[0].node.body.unshift(S(r,e))},$=function(n,r){0<C(n,r.module).length?Y(n,r):R(n,r.module,[F(r)])},nn=function(n,r,e,t){var i=C(n,r),t=(t?cn:an)(e);0<i.length?Z(n,r,t):R(n,r,[t])},rn=function(n,r){n=n.find(c.VariableDeclaration);0<n.length&&c(n.paths()[0]).insertAfter(_(r))},D=function(n,r,e){return c.expressionStatement(en(n,r,e))},en=function(n,r,e){return c.callExpression(on(n,r),e)},_=function(n){return c.variableDeclaration("var",[tn(n)])},tn=function(n){return c.variableDeclarator(void 0!==n.p?c.identifier(n.p):c.identifier(n.reference),(0<n.reference.length?un:L)(n))},un=function(n){return c.memberExpression(L(n),c.identifier(n.reference))},on=function(n,r){return c.memberExpression(c.identifier(n),c.identifier(r))},L=function(n){return c.callExpression(c.identifier("require"),[c.literal(n.module)])},S=function(n,r){return c.importDeclaration(r,c.literal(n))},F=function(n){return void 0!==n.p?c.importSpecifier(c.identifier(n.reference),c.identifier(n.p)):c.importSpecifier(c.identifier(n.reference))},an=function(n){return c.importDefaultSpecifier(c.identifier(n))},cn=function(n){return c.importNamespaceSpecifier(c.identifier(n))};
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Configuration = void 0;
|
|
4
4
|
const LogLevel_1 = require("../model/LogLevel");
|
|
5
5
|
class Configuration {
|
|
6
|
-
constructor(beaconUrl, applicationId, reportCrash, errorHandler, reportFatalErrorAsCrash, logLevel, lifecycleUpdate, userOptIn, actionNamePrivacy, bundleName) {
|
|
6
|
+
constructor(beaconUrl, applicationId, reportCrash, errorHandler, reportFatalErrorAsCrash, logLevel, lifecycleUpdate, userOptIn, actionNamePrivacy, bundleName, bundleVersion) {
|
|
7
7
|
this.beaconUrl = beaconUrl;
|
|
8
8
|
this.applicationId = applicationId;
|
|
9
9
|
this.reportCrash = reportCrash;
|
|
@@ -14,6 +14,7 @@ class Configuration {
|
|
|
14
14
|
this.userOptIn = userOptIn;
|
|
15
15
|
this.actionNamePrivacy = actionNamePrivacy;
|
|
16
16
|
this.bundleName = bundleName;
|
|
17
|
+
this.bundleVersion = bundleVersion;
|
|
17
18
|
}
|
|
18
19
|
toString() {
|
|
19
20
|
let configurationString;
|
|
@@ -23,12 +24,16 @@ class Configuration {
|
|
|
23
24
|
else {
|
|
24
25
|
configurationString = `{Startup: Manual Start, applicationId: ${this.applicationId}, beaconUrl: ${this.beaconUrl},`;
|
|
25
26
|
}
|
|
26
|
-
configurationString += ` reportCrash: ${this.reportCrash}, errorHandler: ${this.errorHandler}
|
|
27
|
+
configurationString += ` reportCrash: ${this.reportCrash}, errorHandler: ${this.errorHandler},`
|
|
28
|
+
+ ` reportFatalErrorAsCrash: ${this.reportFatalErrorAsCrash},`
|
|
27
29
|
+ ` lifecycleUpdate: ${this.lifecycleUpdate}, userOptIn: ${this.userOptIn},`
|
|
28
30
|
+ ` actionNamePrivacy: ${this.actionNamePrivacy}, logLevel: ${(0, LogLevel_1.LogLevelToString)(this.logLevel)}`;
|
|
29
31
|
if (this.bundleName !== undefined) {
|
|
30
32
|
configurationString += `, bundleName: ${this.bundleName}`;
|
|
31
33
|
}
|
|
34
|
+
if (this.bundleVersion !== undefined) {
|
|
35
|
+
configurationString += `, bundleVersion: ${this.bundleVersion}`;
|
|
36
|
+
}
|
|
32
37
|
configurationString += '}';
|
|
33
38
|
return configurationString;
|
|
34
39
|
}
|
|
@@ -19,6 +19,7 @@ class ConfigurationBuilder {
|
|
|
19
19
|
this.userOptIn = ConfigurationDefaults_1.DEFAULT_USER_OPT_IN;
|
|
20
20
|
this.actionNamePrivacy = preset.getActionNamePrivacy();
|
|
21
21
|
this.bundleName = preset.getBundleName();
|
|
22
|
+
this.bundleVersion = preset.getBundleVersion();
|
|
22
23
|
this.autoStartup = preset.isAutoStartupEnabled();
|
|
23
24
|
}
|
|
24
25
|
withCrashReporting(reportCrash) {
|
|
@@ -53,6 +54,10 @@ class ConfigurationBuilder {
|
|
|
53
54
|
this.bundleName = bundleName;
|
|
54
55
|
return this;
|
|
55
56
|
}
|
|
57
|
+
withBundleVersion(bundleVersion) {
|
|
58
|
+
this.bundleVersion = bundleVersion;
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
56
61
|
buildConfiguration() {
|
|
57
62
|
if (!this.autoStartup && this.beaconUrl.length === 0) {
|
|
58
63
|
throw new Error('beaconUrl configuration property is empty. This configuration is not possible! Please use a proper beacon url.');
|
|
@@ -60,7 +65,7 @@ class ConfigurationBuilder {
|
|
|
60
65
|
if (!this.autoStartup && this.applicationId.length === 0) {
|
|
61
66
|
throw new Error('applicationId configuration property is empty. This configuration is not possible! Please use a proper application id.');
|
|
62
67
|
}
|
|
63
|
-
return new Configuration_1.Configuration(this.beaconUrl, this.applicationId, this.reportCrash, this.errorHandler, this.reportFatalErrorAsCrash, this.logLevel, this.lifecycleUpdate, this.userOptIn, this.actionNamePrivacy, this.bundleName);
|
|
68
|
+
return new Configuration_1.Configuration(this.beaconUrl, this.applicationId, this.reportCrash, this.errorHandler, this.reportFatalErrorAsCrash, this.logLevel, this.lifecycleUpdate, this.userOptIn, this.actionNamePrivacy, this.bundleName, this.bundleVersion);
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
71
|
exports.ConfigurationBuilder = ConfigurationBuilder;
|
|
@@ -14,4 +14,5 @@ exports.ConfigurationHandler = {
|
|
|
14
14
|
isLifecycleUpdateEnabled: () => _configuration.lifecycleUpdate,
|
|
15
15
|
isActionNamePrivacyEnabled: () => _configuration.actionNamePrivacy,
|
|
16
16
|
getBundleName: () => _configuration.bundleName,
|
|
17
|
+
getBundleVersion: () => _configuration.bundleVersion,
|
|
17
18
|
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ElementHelper_1 = require("./instrumentor/base/ElementHelper");
|
|
4
|
+
const Types_1 = require("./instrumentor/model/Types");
|
|
5
|
+
const Component_1 = require("./react/Component");
|
|
6
|
+
try {
|
|
7
|
+
let _jsxDevRuntime;
|
|
8
|
+
try {
|
|
9
|
+
_jsxDevRuntime = require('react/jsx-dev-runtime.js');
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
try {
|
|
13
|
+
_jsxDevRuntime = require('../../../react/jsx-dev-runtime');
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
_jsxDevRuntime = null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (_jsxDevRuntime != null) {
|
|
20
|
+
const jsxDEV = (...args) => {
|
|
21
|
+
if (args[0] !== undefined && args[0]._dtInfo !== undefined && !(0, ElementHelper_1.isDtActionIgnore)(args[1])) {
|
|
22
|
+
if (args[0]._dtInfo.type === Types_1.Types.FunctionalComponent) {
|
|
23
|
+
const wrapperProps = { children: [] };
|
|
24
|
+
wrapperProps.dtActionName = (args[1] !== undefined &&
|
|
25
|
+
args[1].dtActionName !== undefined) ? args[1].dtActionName : args[0]._dtInfo.name;
|
|
26
|
+
wrapperProps.children.push(_jsxDevRuntime.jsxDEV(args[0], args[1], ...args));
|
|
27
|
+
return _jsxDevRuntime.jsxDEV(Component_1.DynatraceFnWrapper, wrapperProps);
|
|
28
|
+
}
|
|
29
|
+
else if (args[0]._dtInfo.type === Types_1.Types.ClassComponent &&
|
|
30
|
+
args[0].prototype !== undefined && args[0].prototype.isReactComponent !== undefined) {
|
|
31
|
+
const wrapperProps = { children: [] };
|
|
32
|
+
wrapperProps.children.push(_jsxDevRuntime.jsxDEV(args[0], args[1], ...args));
|
|
33
|
+
return _jsxDevRuntime.jsxDEV(Component_1.DynatraceClassWrapper, wrapperProps);
|
|
34
|
+
}
|
|
35
|
+
if (Array.isArray(args[1].children)) {
|
|
36
|
+
(0, ElementHelper_1.modifyElement)(args[0], args[1], ...args[1].children);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
(0, ElementHelper_1.modifyElement)(args[0], args[1], args[1].children);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return _jsxDevRuntime.jsxDEV(...args);
|
|
43
|
+
};
|
|
44
|
+
module.exports = Object.assign(Object.assign({}, _jsxDevRuntime), { jsxDEV });
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
module.exports = {};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
module.exports = {};
|
|
52
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace/react-native-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.297.1",
|
|
4
4
|
"description": "This plugin gives you the ability to use the Dynatrace Mobile agent in your react native application.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "typings/react-native-dynatrace.d.ts",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
"author": "Dynatrace",
|
|
72
72
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@babel/runtime": "^7.
|
|
74
|
+
"@babel/runtime": "^7.25.0",
|
|
75
75
|
"jscodeshift": "^0.16.1",
|
|
76
76
|
"plist": "^3.1.0",
|
|
77
77
|
"proxy-polyfill": "^0.3.2",
|
|
78
|
-
"semver": "^7.6.
|
|
78
|
+
"semver": "^7.6.3"
|
|
79
79
|
},
|
|
80
80
|
"homepage": "https://www.dynatrace.com/",
|
|
81
81
|
"peerDependencies": {
|
|
@@ -163,6 +163,7 @@
|
|
|
163
163
|
"typings/*",
|
|
164
164
|
"package.json",
|
|
165
165
|
"jsx-runtime.js",
|
|
166
|
+
"jsx-dev-runtime.js",
|
|
166
167
|
"src/lib/instrumentor/base/interface/NativeDynatraceBridge.ts"
|
|
167
168
|
],
|
|
168
169
|
"codegenConfig": {
|
|
@@ -111,7 +111,7 @@ Pod::Spec.new do |s|
|
|
|
111
111
|
#
|
|
112
112
|
|
|
113
113
|
s.dependency "React"
|
|
114
|
-
s.dependency 'Dynatrace', '~> 8.
|
|
114
|
+
s.dependency 'Dynatrace', '~> 8.297.1.1004'
|
|
115
115
|
|
|
116
116
|
# Allows for better compatibility for older and newer versions
|
|
117
117
|
if defined?(install_modules_dependencies)
|