@dynatrace/react-native-plugin 2.343.1 → 2.345.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 +638 -660
- package/android/build.gradle +6 -2
- package/files/plugin-runtime.gradle +17 -33
- package/files/plugin.gradle +1 -1
- package/instrumentation/BabelPluginDynatrace.js +1 -1
- package/instrumentation/libs/UserInteraction.js +20 -6
- package/instrumentation/libs/react-navigation/ReactNavigation.js +14 -58
- package/instrumentation/libs/withOnPressMonitoring.js +3 -54
- package/internal.d.ts +1 -0
- package/internal.js +3 -1
- package/ios/DynatraceRNBridge.mm +9 -0
- package/lib/core/configuration/ConfigurationHandler.js +0 -21
- package/lib/dynatrace-reporter.js +1 -30
- package/lib/dynatrace-transformer.js +6 -34
- package/lib/next/configuration/INativeRuntimeConfiguration.js +0 -1
- package/lib/next/configuration/RuntimeConfigurationObserver.js +1 -6
- package/lib/next/navigation/NavigationTracker.js +93 -0
- package/lib/next/navigation/useNavigationTracking.js +54 -0
- package/package.json +9 -21
- package/public.js +3 -1
- package/react-native-dynatrace.podspec +1 -1
- package/scripts/Android.js +1 -20
- package/scripts/Config.js +0 -4
- package/scripts/Deprecations.js +18 -0
- package/scripts/Install.js +13 -0
- package/scripts/PathsConstants.js +0 -4
- package/scripts/Uninstall.js +0 -15
- package/scripts/core/InstrumentCall.js +2 -3
- package/scripts/util/DeprecationReport.js +24 -0
- package/types.d.ts +212 -10
- package/instrumentation/DynatraceInstrumentation.js +0 -1
- package/instrumentation/libs/community/Picker.InstrInfo.js +0 -20
- package/instrumentation/libs/community/gesture-handler/Touchables.InstrInfo.js +0 -25
- package/instrumentation/libs/react-native/RefreshControl.InstrInfo.js +0 -12
- package/instrumentation/libs/react-native/Switch.InstrInfo.js +0 -12
- package/instrumentation/libs/react-native/Touchables.InstrInfo.js +0 -25
- package/instrumentation/model/Reference.js +0 -2
- package/instrumentation/parser/Babel.js +0 -60
- package/instrumentation/parser/ParserUtil.js +0 -11
- package/lib/features/ui-interaction/Config.js +0 -42
- package/lib/features/ui-interaction/IUserInteractionEvent.js +0 -16
- package/lib/features/ui-interaction/Plugin.Fragment.Test.js +0 -170
- package/lib/features/ui-interaction/Plugin.js +0 -289
- package/lib/features/ui-interaction/RootDetection.js +0 -51
- package/lib/features/ui-interaction/RootWrapper.js +0 -236
- package/lib/features/ui-interaction/Run.js +0 -38
- package/lib/features/ui-interaction/Runtime.js +0 -843
- package/lib/features/ui-interaction/TouchMetaResolver.js +0 -493
- package/lib/features/ui-interaction/Types.js +0 -14
- package/lib/metro/getSourceMapInfo.js +0 -26
- package/scripts/LineOffsetAnalyze.js +0 -25
- package/scripts/core/LineOffsetAnalyzeCall.js +0 -165
- package/scripts/util/SourceMapUtil.js +0 -68
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._resetForTest = exports.getActivePath = exports.reportScreenResume = exports.reportScreenBackground = exports.reportScreenChange = exports.buildPathFromState = exports.registerEventTrigger = void 0;
|
|
4
|
+
const ConsoleLogger_1 = require("../../core/logging/ConsoleLogger");
|
|
5
|
+
const LogMessages_1 = require("../../core/logging/LogMessages");
|
|
6
|
+
const ConfigurationHandler_1 = require("../../core/configuration/ConfigurationHandler");
|
|
7
|
+
const DynatraceBridge_1 = require("../../core/DynatraceBridge");
|
|
8
|
+
const BaseDataEventModifier_1 = require("../events/modifier/BaseDataEventModifier");
|
|
9
|
+
const logger = new ConsoleLogger_1.ConsoleLogger('NavigationTracker');
|
|
10
|
+
let eventTrigger = null;
|
|
11
|
+
const registerEventTrigger = (fn) => {
|
|
12
|
+
eventTrigger = fn;
|
|
13
|
+
};
|
|
14
|
+
exports.registerEventTrigger = registerEventTrigger;
|
|
15
|
+
let activePath = '';
|
|
16
|
+
let isBackgrounded = false;
|
|
17
|
+
const buildPathFromState = (state) => {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
let currentState = state;
|
|
20
|
+
const parts = [];
|
|
21
|
+
while (currentState === null || currentState === void 0 ? void 0 : currentState.routes[(_a = currentState.index) !== null && _a !== void 0 ? _a : 0]) {
|
|
22
|
+
const currentRoute = currentState.routes[(_b = currentState.index) !== null && _b !== void 0 ? _b : 0];
|
|
23
|
+
parts.push(currentRoute.name);
|
|
24
|
+
currentState = currentRoute.state;
|
|
25
|
+
}
|
|
26
|
+
return parts.join('/');
|
|
27
|
+
};
|
|
28
|
+
exports.buildPathFromState = buildPathFromState;
|
|
29
|
+
const startView = (newPath) => {
|
|
30
|
+
if (!ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
31
|
+
logger.info(LogMessages_1.LogMessage.NAVIGATION_NOT_STARTED);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const startViewInternalEvent = new BaseDataEventModifier_1.BaseDataEventModifier().modifyEvent(Object.assign({ 'view.detected_name': newPath }, (activePath && {
|
|
35
|
+
'view.source.detected_name': activePath,
|
|
36
|
+
})));
|
|
37
|
+
const fn = DynatraceBridge_1.DynatraceNative === null || DynatraceBridge_1.DynatraceNative === void 0 ? void 0 : DynatraceBridge_1.DynatraceNative.startViewInternal;
|
|
38
|
+
if (typeof fn === 'function') {
|
|
39
|
+
fn(startViewInternalEvent);
|
|
40
|
+
}
|
|
41
|
+
logger.debug(LogMessages_1.LogMessage.START_VIEW_INTERNAL, {
|
|
42
|
+
event: JSON.stringify(startViewInternalEvent),
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const stopView = () => {
|
|
46
|
+
if (!ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
47
|
+
logger.info(LogMessages_1.LogMessage.NAVIGATION_NOT_STARTED);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const fn = DynatraceBridge_1.DynatraceNative === null || DynatraceBridge_1.DynatraceNative === void 0 ? void 0 : DynatraceBridge_1.DynatraceNative.stopViewInternal;
|
|
51
|
+
if (typeof fn === 'function') {
|
|
52
|
+
fn();
|
|
53
|
+
}
|
|
54
|
+
logger.debug(LogMessages_1.LogMessage.STOP_VIEW_INTERNAL);
|
|
55
|
+
};
|
|
56
|
+
const reportScreenChange = (newPath) => {
|
|
57
|
+
if (newPath === activePath) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (activePath !== '') {
|
|
61
|
+
stopView();
|
|
62
|
+
}
|
|
63
|
+
startView(newPath);
|
|
64
|
+
activePath = newPath;
|
|
65
|
+
if (newPath) {
|
|
66
|
+
eventTrigger === null || eventTrigger === void 0 ? void 0 : eventTrigger(newPath, Date.now());
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.reportScreenChange = reportScreenChange;
|
|
70
|
+
const reportScreenBackground = () => {
|
|
71
|
+
isBackgrounded = true;
|
|
72
|
+
stopView();
|
|
73
|
+
};
|
|
74
|
+
exports.reportScreenBackground = reportScreenBackground;
|
|
75
|
+
const reportScreenResume = () => {
|
|
76
|
+
if (!isBackgrounded) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
isBackgrounded = false;
|
|
80
|
+
startView(activePath);
|
|
81
|
+
if (activePath) {
|
|
82
|
+
eventTrigger === null || eventTrigger === void 0 ? void 0 : eventTrigger(activePath, Date.now());
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
exports.reportScreenResume = reportScreenResume;
|
|
86
|
+
const getActivePath = () => activePath;
|
|
87
|
+
exports.getActivePath = getActivePath;
|
|
88
|
+
const _resetForTest = () => {
|
|
89
|
+
activePath = '';
|
|
90
|
+
isBackgrounded = false;
|
|
91
|
+
eventTrigger = null;
|
|
92
|
+
};
|
|
93
|
+
exports._resetForTest = _resetForTest;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useNavigationTracking = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const NavigationTracker_1 = require("./NavigationTracker");
|
|
7
|
+
const rootStateOf = (container) => container.getRootState();
|
|
8
|
+
const useNavigationTracking = (navigationRef) => {
|
|
9
|
+
const appStateRef = (0, react_1.useRef)(react_native_1.AppState.currentState);
|
|
10
|
+
const unsubscribeRef = (0, react_1.useRef)(null);
|
|
11
|
+
const containerRef = (0, react_1.useRef)(null);
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
var _a;
|
|
14
|
+
const container = navigationRef.current;
|
|
15
|
+
if (container === containerRef.current) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
(_a = unsubscribeRef.current) === null || _a === void 0 ? void 0 : _a.call(unsubscribeRef);
|
|
19
|
+
unsubscribeRef.current = null;
|
|
20
|
+
containerRef.current = container;
|
|
21
|
+
if (!container) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
unsubscribeRef.current = container.addListener('state', () => {
|
|
25
|
+
(0, NavigationTracker_1.reportScreenChange)((0, NavigationTracker_1.buildPathFromState)(rootStateOf(container)));
|
|
26
|
+
});
|
|
27
|
+
(0, NavigationTracker_1.reportScreenChange)((0, NavigationTracker_1.buildPathFromState)(rootStateOf(container)));
|
|
28
|
+
});
|
|
29
|
+
(0, react_1.useEffect)(() => {
|
|
30
|
+
return () => {
|
|
31
|
+
var _a;
|
|
32
|
+
(_a = unsubscribeRef.current) === null || _a === void 0 ? void 0 : _a.call(unsubscribeRef);
|
|
33
|
+
unsubscribeRef.current = null;
|
|
34
|
+
containerRef.current = null;
|
|
35
|
+
};
|
|
36
|
+
}, []);
|
|
37
|
+
(0, react_1.useEffect)(() => {
|
|
38
|
+
const subscription = react_native_1.AppState.addEventListener('change', (nextAppState) => {
|
|
39
|
+
const prevAppState = appStateRef.current;
|
|
40
|
+
appStateRef.current = nextAppState;
|
|
41
|
+
if (nextAppState !== 'active' && prevAppState === 'active') {
|
|
42
|
+
(0, NavigationTracker_1.reportScreenBackground)();
|
|
43
|
+
}
|
|
44
|
+
else if (nextAppState === 'active' &&
|
|
45
|
+
prevAppState !== 'active') {
|
|
46
|
+
(0, NavigationTracker_1.reportScreenResume)();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return () => {
|
|
50
|
+
subscription.remove();
|
|
51
|
+
};
|
|
52
|
+
}, []);
|
|
53
|
+
};
|
|
54
|
+
exports.useNavigationTracking = useNavigationTracking;
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace/react-native-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.345.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": "types.d.ts",
|
|
7
7
|
"bin": {
|
|
8
8
|
"instrumentDynatrace": "scripts/Instrument.js",
|
|
9
|
-
"configDynatrace": "scripts/CheckConfig.js"
|
|
10
|
-
"lineOffsetDynatrace": "scripts/LineOffsetAnalyze.js"
|
|
9
|
+
"configDynatrace": "scripts/CheckConfig.js"
|
|
11
10
|
},
|
|
12
11
|
"keywords": [
|
|
13
12
|
"react-native",
|
|
@@ -22,6 +21,7 @@
|
|
|
22
21
|
"plugin": "./command/command.js"
|
|
23
22
|
},
|
|
24
23
|
"scripts": {
|
|
24
|
+
"postinstall": "node ./scripts/Install.js",
|
|
25
25
|
"uninstall": "node ./scripts/Uninstall.js",
|
|
26
26
|
"test": "jest --runInBand",
|
|
27
27
|
"test:coverage": "jest --runInBand --coverage",
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@babel/runtime": "^8.0.0",
|
|
53
|
-
"jscodeshift": "^17.4.0",
|
|
54
53
|
"plist": "^3.1.0",
|
|
55
54
|
"proxy-polyfill": "^0.3.2",
|
|
56
55
|
"semver": "^7.8.5"
|
|
@@ -58,21 +57,13 @@
|
|
|
58
57
|
"homepage": "https://www.dynatrace.com/",
|
|
59
58
|
"peerDependencies": {
|
|
60
59
|
"@babel/core": ">=7.4.4",
|
|
61
|
-
"diff": "^8.0.2",
|
|
62
60
|
"react": ">=16.11.0",
|
|
63
61
|
"react-native": ">=0.62.0"
|
|
64
62
|
},
|
|
65
63
|
"overrides": {
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"ast-types": "npm:ast-types-x",
|
|
70
|
-
"flow-parser": "0.160",
|
|
71
|
-
"tmp": ">=0.2.6",
|
|
72
|
-
"ws": "^7.5.11",
|
|
73
|
-
"@istanbuljs/load-nyc-config": {
|
|
74
|
-
"js-yaml": "^3.15.0"
|
|
75
|
-
}
|
|
64
|
+
"ws": "^8.21.1",
|
|
65
|
+
"js-yaml": "^5.2.2",
|
|
66
|
+
"brace-expansion": "5.0.9"
|
|
76
67
|
},
|
|
77
68
|
"devDependencies": {
|
|
78
69
|
"@babel/plugin-transform-class-properties": "^7.27.1",
|
|
@@ -80,6 +71,7 @@
|
|
|
80
71
|
"@babel/plugin-transform-nullish-coalescing-operator": "^7.27.1",
|
|
81
72
|
"@babel/plugin-transform-optional-chaining": "^7.27.1",
|
|
82
73
|
"@babel/preset-env": "^7.27.2",
|
|
74
|
+
"@babel/preset-flow": "^7.27.1",
|
|
83
75
|
"@babel/preset-react": "^7.27.1",
|
|
84
76
|
"@react-native-picker/picker": "^2.11.4",
|
|
85
77
|
"@react-native/babel-preset": "^0.80.1",
|
|
@@ -87,7 +79,6 @@
|
|
|
87
79
|
"@react-navigation/drawer": "^7.7.2",
|
|
88
80
|
"@testing-library/react-native": "^13.3.3",
|
|
89
81
|
"@types/jest": "^30.0.0",
|
|
90
|
-
"@types/jscodeshift": "^17.3.0",
|
|
91
82
|
"@types/micromatch": "^4.0.10",
|
|
92
83
|
"@types/node": "^18.19.123",
|
|
93
84
|
"@types/plist": "^3.0.5",
|
|
@@ -98,7 +89,6 @@
|
|
|
98
89
|
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
99
90
|
"@typescript-eslint/parser": "^8.56.0",
|
|
100
91
|
"compressing": "^1.10.3",
|
|
101
|
-
"diff": "^8.0.2",
|
|
102
92
|
"eslint": "^9.29.0",
|
|
103
93
|
"eslint-config-prettier": "^8.5.0",
|
|
104
94
|
"eslint-plugin-import": "^2.32.0",
|
|
@@ -132,6 +122,7 @@
|
|
|
132
122
|
"index.js",
|
|
133
123
|
"public.js",
|
|
134
124
|
"internal.js",
|
|
125
|
+
"internal.d.ts",
|
|
135
126
|
"react-augmentation.js",
|
|
136
127
|
"README.md",
|
|
137
128
|
"LICENSE.md",
|
|
@@ -157,8 +148,6 @@
|
|
|
157
148
|
"instrumentation/libs/react-native/*.js",
|
|
158
149
|
"instrumentation/libs/react-native/Touchables.jsx",
|
|
159
150
|
"instrumentation/model/*.js",
|
|
160
|
-
"instrumentation/parser/*.js",
|
|
161
|
-
"instrumentation/DynatraceInstrumentation.js",
|
|
162
151
|
"instrumentation/BabelPluginDynatrace.js",
|
|
163
152
|
"lib/*.js",
|
|
164
153
|
"lib/core/*.js",
|
|
@@ -168,7 +157,6 @@
|
|
|
168
157
|
"lib/core/model/*.js",
|
|
169
158
|
"lib/core/util/*.js",
|
|
170
159
|
"lib/core/*.js",
|
|
171
|
-
"lib/metro/*.js",
|
|
172
160
|
"lib/next/*.js",
|
|
173
161
|
"lib/next/appstart/*.js",
|
|
174
162
|
"lib/next/configuration/*.js",
|
|
@@ -179,7 +167,7 @@
|
|
|
179
167
|
"lib/next/util/*.js",
|
|
180
168
|
"lib/next/provider/*.js",
|
|
181
169
|
"lib/next/userAction/*.js",
|
|
182
|
-
"lib/
|
|
170
|
+
"lib/next/navigation/*.js",
|
|
183
171
|
"src/lib/core/interface/NativeDynatraceBridge.ts",
|
|
184
172
|
"types.d.ts"
|
|
185
173
|
],
|
package/public.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserActionConfiguration = exports.ExceptionEventData = exports.SessionPropertyEventData = exports.EventData = exports.HttpRequestEventData = exports.DynatraceWebRequestTiming = exports.UserPrivacyOptions = exports.LogLevel = exports.Platform = exports.ConfigurationBuilder = exports.ManualStartupConfiguration = exports.DataCollectionLevel = exports.Dynatrace = void 0;
|
|
3
|
+
exports.useNavigationTracking = exports.UserActionConfiguration = exports.ExceptionEventData = exports.SessionPropertyEventData = exports.EventData = exports.HttpRequestEventData = exports.DynatraceWebRequestTiming = exports.UserPrivacyOptions = exports.LogLevel = exports.Platform = exports.ConfigurationBuilder = exports.ManualStartupConfiguration = exports.DataCollectionLevel = exports.Dynatrace = void 0;
|
|
4
4
|
var Dynatrace_1 = require("./lib/core/Dynatrace");
|
|
5
5
|
Object.defineProperty(exports, "Dynatrace", { enumerable: true, get: function () { return Dynatrace_1.Dynatrace; } });
|
|
6
6
|
var DataCollectionLevel_1 = require("./lib/core/model/DataCollectionLevel");
|
|
@@ -27,4 +27,6 @@ var ExceptionEventData_1 = require("./lib/next/events/ExceptionEventData");
|
|
|
27
27
|
Object.defineProperty(exports, "ExceptionEventData", { enumerable: true, get: function () { return ExceptionEventData_1.default; } });
|
|
28
28
|
var UserActionConfiguration_1 = require("./lib/next/userAction/UserActionConfiguration");
|
|
29
29
|
Object.defineProperty(exports, "UserActionConfiguration", { enumerable: true, get: function () { return UserActionConfiguration_1.UserActionConfiguration; } });
|
|
30
|
+
var useNavigationTracking_1 = require("./lib/next/navigation/useNavigationTracking");
|
|
31
|
+
Object.defineProperty(exports, "useNavigationTracking", { enumerable: true, get: function () { return useNavigationTracking_1.useNavigationTracking; } });
|
|
30
32
|
require("./react-augmentation");
|
|
@@ -118,7 +118,7 @@ Pod::Spec.new do |s|
|
|
|
118
118
|
#
|
|
119
119
|
|
|
120
120
|
s.dependency "React"
|
|
121
|
-
s.dependency 'Dynatrace', '~> 8.
|
|
121
|
+
s.dependency 'Dynatrace', '~> 8.345.1.1003'
|
|
122
122
|
|
|
123
123
|
# Allows for better compatibility for older and newer versions
|
|
124
124
|
if defined?(install_modules_dependencies)
|
package/scripts/Android.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.writeGradleConfig = exports.instrumentAndroidPlatform = exports.GRADLE_APPLY_BUILDSCRIPT_KTS = exports.GRADLE_APPLY_BUILDSCRIPT = exports.GRADLE_DYNATRACE_FILE_KTS = exports.GRADLE_DYNATRACE_FILE = void 0;
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const Logger_1 = require("./Logger");
|
|
7
7
|
const FileOperationHelper_1 = require("./FileOperationHelper");
|
|
@@ -14,19 +14,15 @@ const GRADLE_BUILDSCRIPT_IDENTIFIER = 'buildscript';
|
|
|
14
14
|
exports.GRADLE_APPLY_BUILDSCRIPT = 'apply from: "../node_modules/@dynatrace/react-native-plugin/files/plugin.gradle", to: buildscript';
|
|
15
15
|
exports.GRADLE_APPLY_BUILDSCRIPT_KTS = 'apply(from = "../node_modules/@dynatrace/react-native-plugin/files/plugin.gradle", to = buildscript)';
|
|
16
16
|
const GRADLE_REACT_NATIVE_PLUGIN = 'apply plugin: "com.facebook.react.rootproject"';
|
|
17
|
-
exports.GRADLE_APPLY_RUNTIME_SCRIPT = 'apply from: "../../node_modules/@dynatrace/react-native-plugin/files/plugin-runtime.gradle"';
|
|
18
|
-
exports.GRADLE_APPLY_RUNTIME_SCRIPT_KTS = 'apply(from = "../../node_modules/@dynatrace/react-native-plugin/files/plugin-runtime.gradle")';
|
|
19
17
|
const isKotlinDslGradleFile = (pathToGradle) => pathToGradle.endsWith('.gradle.kts');
|
|
20
18
|
const getGradleStatements = (pathToGradle) => isKotlinDslGradleFile(pathToGradle)
|
|
21
19
|
? {
|
|
22
20
|
applyBuildscript: exports.GRADLE_APPLY_BUILDSCRIPT_KTS,
|
|
23
21
|
dynatraceFile: exports.GRADLE_DYNATRACE_FILE_KTS,
|
|
24
|
-
runtimeScript: exports.GRADLE_APPLY_RUNTIME_SCRIPT_KTS,
|
|
25
22
|
}
|
|
26
23
|
: {
|
|
27
24
|
applyBuildscript: exports.GRADLE_APPLY_BUILDSCRIPT,
|
|
28
25
|
dynatraceFile: exports.GRADLE_DYNATRACE_FILE,
|
|
29
|
-
runtimeScript: exports.GRADLE_APPLY_RUNTIME_SCRIPT,
|
|
30
26
|
};
|
|
31
27
|
const instrumentAndroidPlatform = (pathToGradle, remove) => {
|
|
32
28
|
const path = FileOperationHelper_1.default.checkIfFileExistsSync(pathToGradle);
|
|
@@ -165,18 +161,3 @@ const removeOldGradleConfig = (gradleFileContent) => {
|
|
|
165
161
|
gradleFileContentLines.splice(gradleConfigIndex[0] + 1, gradleConfigIndex[1] - (gradleConfigIndex[0] + 1));
|
|
166
162
|
return gradleFileContentLines;
|
|
167
163
|
};
|
|
168
|
-
const ensureRuntimeScriptApplied = (pathToGradle) => {
|
|
169
|
-
const gradleContent = FileOperationHelper_1.default.readTextFromFileSync(pathToGradle);
|
|
170
|
-
const gradleLines = gradleContent.split('\n');
|
|
171
|
-
const { runtimeScript } = getGradleStatements(pathToGradle);
|
|
172
|
-
const alreadyApplied = gradleLines.some((line) => line.includes('plugin-runtime.gradle'));
|
|
173
|
-
if (!alreadyApplied) {
|
|
174
|
-
gradleLines.push(runtimeScript);
|
|
175
|
-
FileOperationHelper_1.default.writeTextToFileSync(pathToGradle, gradleLines.join('\n'));
|
|
176
|
-
Logger_1.default.logMessageSync(`Added runtime script to ${pathToGradle}`, Logger_1.default.INFO);
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
Logger_1.default.logMessageSync(`Runtime script already present in ${pathToGradle}`, Logger_1.default.INFO);
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
exports.ensureRuntimeScriptApplied = ensureRuntimeScriptApplied;
|
package/scripts/Config.js
CHANGED
|
@@ -38,10 +38,6 @@ exports.defaultConfig = {
|
|
|
38
38
|
enabled: true,
|
|
39
39
|
},
|
|
40
40
|
userInteraction: true,
|
|
41
|
-
sourcemap: {
|
|
42
|
-
enabled: true,
|
|
43
|
-
androidSourcemapLocation: 'app/build/generated/sourcemaps/react/release/index.android.bundle.map',
|
|
44
|
-
},
|
|
45
41
|
},
|
|
46
42
|
};
|
|
47
43
|
const readConfigDefault = () => {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEPRECATIONS = exports.readInstalledPackageVersion = void 0;
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
const FileOperationHelper_1 = require("./FileOperationHelper");
|
|
6
|
+
const PathsConstants_1 = require("./PathsConstants");
|
|
7
|
+
const readInstalledPackageVersion = (packageName) => {
|
|
8
|
+
var _a;
|
|
9
|
+
try {
|
|
10
|
+
const raw = FileOperationHelper_1.default.readTextFromFileSync((0, node_path_1.join)(PathsConstants_1.default.getApplicationPath(), 'node_modules', packageName, 'package.json'));
|
|
11
|
+
return (_a = JSON.parse(raw).version) !== null && _a !== void 0 ? _a : null;
|
|
12
|
+
}
|
|
13
|
+
catch (_b) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.readInstalledPackageVersion = readInstalledPackageVersion;
|
|
18
|
+
exports.DEPRECATIONS = [];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const DeprecationReport_1 = require("./util/DeprecationReport");
|
|
5
|
+
const Logger_1 = require("./Logger");
|
|
6
|
+
module.exports = (() => {
|
|
7
|
+
try {
|
|
8
|
+
(0, DeprecationReport_1.showDeprecationWarnings)();
|
|
9
|
+
Logger_1.default.closeLogFile();
|
|
10
|
+
}
|
|
11
|
+
catch (_a) {
|
|
12
|
+
}
|
|
13
|
+
})();
|
|
@@ -30,10 +30,6 @@ exports.default = {
|
|
|
30
30
|
getPackageJsonFile() {
|
|
31
31
|
return (0, node_path_1.join)(this.getApplicationPath(), 'package.json');
|
|
32
32
|
},
|
|
33
|
-
getMetroSouceMapPath() {
|
|
34
|
-
return (0, node_path_1.join)(this.getApplicationPath(), 'node_modules', 'metro', 'src', 'DeltaBundler', 'Serializers', 'helpers');
|
|
35
|
-
},
|
|
36
|
-
getOurSourceMapFile: () => (0, node_path_1.join)(getPluginPath(), 'lib', 'metro', 'getSourceMapInfo.js'),
|
|
37
33
|
getInternalPackageJsonFile: () => (0, node_path_1.join)(getPluginPath(), 'package.json'),
|
|
38
34
|
getDefaultConfig: () => (0, node_path_1.join)(getPluginPath(), PATH_FILES, 'default.config.js'),
|
|
39
35
|
getBuildPath: () => (0, node_path_1.join)(getPluginPath(), 'build'),
|
package/scripts/Uninstall.js
CHANGED
|
@@ -16,20 +16,6 @@ const FileOperationHelper_1 = require("./FileOperationHelper");
|
|
|
16
16
|
const PathsConstants_1 = require("./PathsConstants");
|
|
17
17
|
const android = require("./Android");
|
|
18
18
|
const Ios_1 = require("./Ios");
|
|
19
|
-
const removePatchMetroSourceMap = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
Logger_1.default.logMessageSync('Undo Patching SourceMap generation of Metro .. ', Logger_1.default.INFO);
|
|
21
|
-
try {
|
|
22
|
-
const currentSourceMapPath = nodePath.join(PathsConstants_1.default.getMetroSouceMapPath(), 'getSourceMapInfo.js');
|
|
23
|
-
const origSourceMapPath = nodePath.join(PathsConstants_1.default.getMetroSouceMapPath(), 'getSourceMapInfoOrig.js');
|
|
24
|
-
yield FileOperationHelper_1.default.checkIfFileExists(origSourceMapPath);
|
|
25
|
-
yield FileOperationHelper_1.default.deleteFile(currentSourceMapPath);
|
|
26
|
-
yield FileOperationHelper_1.default.renameFile(origSourceMapPath, currentSourceMapPath);
|
|
27
|
-
Logger_1.default.logMessageSync('Removed patch for SourceMap generation of Metro!', Logger_1.default.INFO);
|
|
28
|
-
}
|
|
29
|
-
catch (e) {
|
|
30
|
-
Logger_1.default.logMessageSync('Removing of patch for SourceMap generation failed!', Logger_1.default.ERROR);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
19
|
const removeGradleModification = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
20
|
try {
|
|
35
21
|
const path = yield FileOperationHelper_1.default.checkIfFileExists(nodePath.join(PathsConstants_1.default.getAndroidFolder(), 'build.gradle'));
|
|
@@ -48,7 +34,6 @@ const removePListModification = () => __awaiter(void 0, void 0, void 0, function
|
|
|
48
34
|
}
|
|
49
35
|
});
|
|
50
36
|
module.exports = (() => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
-
yield removePatchMetroSourceMap();
|
|
52
37
|
yield removeGradleModification();
|
|
53
38
|
yield removePListModification();
|
|
54
39
|
}))();
|
|
@@ -8,9 +8,9 @@ const android = require("../Android");
|
|
|
8
8
|
const PathsConstants_1 = require("../PathsConstants");
|
|
9
9
|
const Ios_1 = require("../Ios");
|
|
10
10
|
const InstrumentUtil_1 = require("../util/InstrumentUtil");
|
|
11
|
+
const DeprecationReport_1 = require("../util/DeprecationReport");
|
|
11
12
|
const CustomArgumentUtil_1 = require("../util/CustomArgumentUtil");
|
|
12
13
|
const Platform_1 = require("../api/model/Platform");
|
|
13
|
-
const SourceMapUtil_1 = require("../util/SourceMapUtil");
|
|
14
14
|
const platformLogPrefix = { info: ' ℹ️ ', warning: ' ⚠️ ', error: ' ❌ ' };
|
|
15
15
|
const logHelpMessage = () => {
|
|
16
16
|
const iOSDefaultPath = (0, node_path_1.join)(PathsConstants_1.default.getIOSFolder(), '<appName>', 'Info.plist');
|
|
@@ -93,7 +93,6 @@ const instrumentAndroidIfAvailable = (androidAvailable, pathToGradle, pathToAppG
|
|
|
93
93
|
Logger_1.default.withPrefix(platformLogPrefix, () => {
|
|
94
94
|
android.instrumentAndroidPlatform(pathToGradle, false);
|
|
95
95
|
android.writeGradleConfig(androidConfig, pathToGradle);
|
|
96
|
-
android.ensureRuntimeScriptApplied(pathToAppGradle);
|
|
97
96
|
});
|
|
98
97
|
Logger_1.default.logMessageSync(' ✅ Finished Android Instrumentation with Dynatrace!', Logger_1.default.INFO);
|
|
99
98
|
}
|
|
@@ -128,7 +127,6 @@ const runPlatformInstrumentation = (paths, availability) => {
|
|
|
128
127
|
const configAgent = (0, Config_1.readConfig)(paths.pathToConfig);
|
|
129
128
|
instrumentAndroidIfAvailable(availability.androidAvailable, paths.pathToGradle, paths.pathToAppGradle, configAgent.android);
|
|
130
129
|
instrumentIosIfAvailable(availability.iosAvailable, paths.pathToPList, configAgent.ios);
|
|
131
|
-
(0, SourceMapUtil_1.patchMetroSourceMap)();
|
|
132
130
|
Logger_1.default.logMessageSync('🎉 Finished instrumentation of React Native application ..', Logger_1.default.INFO);
|
|
133
131
|
}
|
|
134
132
|
catch (e) {
|
|
@@ -150,6 +148,7 @@ const instrumentCommand = () => {
|
|
|
150
148
|
}
|
|
151
149
|
Logger_1.default.logMessageSync('⏳ Starting instrumentation of React Native application ..', Logger_1.default.INFO);
|
|
152
150
|
Logger_1.default.withPrefix({ info: ' ℹ️ ', warning: ' ⚠️ ' }, () => (0, InstrumentUtil_1.showVersionOfPlugin)());
|
|
151
|
+
(0, DeprecationReport_1.showDeprecationWarnings)();
|
|
153
152
|
const argv = (0, CustomArgumentUtil_1.parseCommandLine)(commandArgs.slice(2));
|
|
154
153
|
persistCustomArguments(argv);
|
|
155
154
|
const instrumentationPaths = resolveInstrumentationPaths(argv);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.showDeprecationWarnings = void 0;
|
|
4
|
+
const Logger_1 = require("../Logger");
|
|
5
|
+
const Deprecations_1 = require("../Deprecations");
|
|
6
|
+
const formatEntry = (entry) => `⚠️ Deprecation [${entry.id}]: ${entry.description}\n` +
|
|
7
|
+
` Deprecated since: plugin v${entry.deprecatedSince}\n` +
|
|
8
|
+
` Removal planned: plugin v${entry.removalVersion}\n` +
|
|
9
|
+
` Migration: ${entry.migration}`;
|
|
10
|
+
const showDeprecationWarnings = () => {
|
|
11
|
+
for (const entry of Deprecations_1.DEPRECATIONS) {
|
|
12
|
+
let applicable;
|
|
13
|
+
try {
|
|
14
|
+
applicable = entry.isApplicable();
|
|
15
|
+
}
|
|
16
|
+
catch (_a) {
|
|
17
|
+
applicable = false;
|
|
18
|
+
}
|
|
19
|
+
if (applicable) {
|
|
20
|
+
Logger_1.default.logMessageSync(formatEntry(entry), Logger_1.default.WARNING);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.showDeprecationWarnings = showDeprecationWarnings;
|