@dynatrace/react-native-plugin 2.321.1 β†’ 2.321.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace/react-native-plugin",
3
- "version": "2.321.1",
3
+ "version": "2.321.2",
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",
@@ -46,7 +46,7 @@
46
46
  "author": "Dynatrace",
47
47
  "license": "SEE LICENSE IN LICENSE.md",
48
48
  "dependencies": {
49
- "@babel/runtime": "^7.28.3",
49
+ "@babel/runtime": "^7.28.4",
50
50
  "jscodeshift": "^17.3.0",
51
51
  "plist": "^3.1.0",
52
52
  "proxy-polyfill": "^0.3.2",
@@ -78,7 +78,7 @@
78
78
  "@testing-library/react-native": "^13.2.0",
79
79
  "@types/jest": "^30.0.0",
80
80
  "@types/jscodeshift": "^17.3.0",
81
- "@types/node": "^18.19.71",
81
+ "@types/node": "^18.19.123",
82
82
  "@types/plist": "^3.0.5",
83
83
  "@types/react": "^19.1.8",
84
84
  "@types/semver": "^7.7.0",
@@ -16,6 +16,7 @@ const diff_1 = require("diff");
16
16
  const Logger_1 = require("../Logger");
17
17
  const InstrumentUtil_1 = require("../util/InstrumentUtil");
18
18
  const FileOperationHelper_1 = require("../../scripts/FileOperationHelper");
19
+ const ReactOptions_1 = require("../util/ReactOptions");
19
20
  class LineOffsetAnalyzer {
20
21
  constructor(options) {
21
22
  this.rootDir = (0, path_1.resolve)(options.projectRoot);
@@ -32,26 +33,26 @@ class LineOffsetAnalyzer {
32
33
  try {
33
34
  const buildExists = yield FileOperationHelper_1.default.checkIfFileExists(this.instrumentedDir);
34
35
  if (!buildExists) {
35
- yield this.log(`❌ Build directory not found at: ${this.instrumentedDir}`);
36
- yield this.log('πŸ› οΈ Please run the instrumentation step first!');
37
- console.error('🚫 Build directory missing. Make and instrument the project first.');
36
+ yield this.log(`❌ Build directory not found at: ${this.instrumentedDir}`, true);
37
+ yield this.log('πŸ› οΈ Please run the instrumentation step first!', true);
38
+ console.error('🚫 Build directory missing. Make and instrument the project first.', true);
38
39
  process.exit(1);
39
40
  }
40
41
  yield fs.writeFile(this.logFile, '');
41
42
  const instrumentedFiles = (yield FileOperationHelper_1.default.getAllFiles(this.log, this.instrumentedDir))
42
43
  .filter((filePath) => filePath.endsWith(InstrumentUtil_1.INSTRUMENTED_FILE_EXTENSION));
43
44
  const mappings = {};
44
- yield this.log(`πŸ” Found ${instrumentedFiles.length} instrumented files`);
45
+ yield this.log(`πŸ” Found ${instrumentedFiles.length} instrumented files`, true);
45
46
  for (const instrRelPath of instrumentedFiles) {
46
47
  const baseRelPath = instrRelPath.slice(0, -InstrumentUtil_1.INSTRUMENTED_FILE_EXTENSION.length);
47
48
  const origPath = (0, path_1.join)(this.rootDir, baseRelPath);
48
49
  const instrPath = (0, path_1.join)(this.instrumentedDir, instrRelPath);
49
50
  const origExists = yield FileOperationHelper_1.default.checkIfFileExists(origPath);
50
51
  if (!origExists) {
51
- yield this.log(`⚠️ Original file not found for: ${baseRelPath}`);
52
+ yield this.log(`⚠️ Original file not found for: ${baseRelPath}`, true);
52
53
  continue;
53
54
  }
54
- yield this.log(`πŸ“„ Comparing: ${baseRelPath}`);
55
+ yield this.log(`πŸ“„ Comparing: ${baseRelPath}`, true);
55
56
  const [originalContent, instrumentedContent] = yield Promise.all([
56
57
  FileOperationHelper_1.default.readTextFromFile(origPath),
57
58
  FileOperationHelper_1.default.readTextFromFile(instrPath),
@@ -59,10 +60,10 @@ class LineOffsetAnalyzer {
59
60
  const offsets = this.computeLineOffsets(originalContent, instrumentedContent);
60
61
  if (offsets.length > 0) {
61
62
  mappings[baseRelPath] = offsets;
62
- yield this.log(`βœ… Offsets found for ${baseRelPath}: ${offsets.length} entries`);
63
+ yield this.log(`βœ… Offsets found for ${baseRelPath}: ${offsets.length} entries`, true);
63
64
  }
64
65
  else {
65
- yield this.log(`ℹ️ No offsets needed for ${baseRelPath}`);
66
+ yield this.log(`ℹ️ No offsets needed for ${baseRelPath}`, true);
66
67
  }
67
68
  }
68
69
  const finalOutput = {
@@ -74,7 +75,7 @@ class LineOffsetAnalyzer {
74
75
  },
75
76
  };
76
77
  yield fs.writeFile(this.outputFile, JSON.stringify(finalOutput, null, 2));
77
- yield this.log(`βœ… Line offsets written to ${this.outputFile}`);
78
+ yield this.log(`βœ… Line offsets written to ${this.outputFile}`, true);
78
79
  if (this.isProd) {
79
80
  yield this.log('πŸ”§ Patching source map with all offset data...');
80
81
  const loadedMap = yield this.loadSourceMap();
@@ -117,22 +118,24 @@ class LineOffsetAnalyzer {
117
118
  foundAny = true;
118
119
  const content = yield fs.readFile(mapPath, 'utf-8');
119
120
  const parsed = JSON.parse(content);
120
- yield this.log(`πŸ—ΊοΈ Found and parsed source map at: ${mapPath}`);
121
+ yield this.log(`πŸ—ΊοΈ Found and parsed source map at: ${mapPath}`, true);
121
122
  return { map: parsed, path: mapPath };
122
123
  }
123
124
  catch (err) {
124
- yield this.log(`⚠️ Failed to load or parse source map at ${mapPath}: ${err.message}`);
125
+ yield this.log(`⚠️ Failed to load or parse source map at ${mapPath}: ${err.message}`, true);
125
126
  }
126
127
  }
127
128
  if (!foundAny) {
128
- yield this.log('❌ No valid source map found in any of the expected locations.');
129
+ yield this.log('❌ No valid source map found in any of the expected locations.', true);
129
130
  }
130
131
  return null;
131
132
  });
132
133
  }
133
- log(msg) {
134
+ log(msg, logOnScreen = false) {
134
135
  return __awaiter(this, void 0, void 0, function* () {
135
- Logger_1.default.logMessageSync(msg, Logger_1.default.INFO);
136
+ if (ReactOptions_1.reactOptions && ReactOptions_1.reactOptions.react.debug && logOnScreen) {
137
+ Logger_1.default.logMessageSync(msg, Logger_1.default.INFO);
138
+ }
136
139
  yield fs.appendFile(this.logFile, msg + '\n');
137
140
  });
138
141
  }
@@ -143,7 +146,7 @@ class LineOffsetAnalyzer {
143
146
  let offset = 0;
144
147
  let lastRecordedOffset = null;
145
148
  const offsets = [];
146
- this.log('πŸ” Diff result:');
149
+ this.log('πŸ” Diff result:', true);
147
150
  for (const part of diffs) {
148
151
  const lines = part.value.split('\n').slice(0, -1);
149
152
  if (part.added) {
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reactOptions = void 0;
4
+ const nodePath = require("path");
5
+ const PathsConstants_1 = require("../../scripts/PathsConstants");
6
+ const CustomArgumentUtil_1 = require("../util/CustomArgumentUtil");
7
+ const config = require("../../scripts/Config");
8
+ const customArguments = (0, CustomArgumentUtil_1.readCustomArguments)();
9
+ let reactOptions;
10
+ exports.reactOptions = reactOptions;
11
+ try {
12
+ if (customArguments.isCustomConfigurationPathSet()) {
13
+ exports.reactOptions = reactOptions = config.readConfig(nodePath.join(PathsConstants_1.default.getApplicationPath(), customArguments.getCustomConfigurationPath()));
14
+ }
15
+ else {
16
+ exports.reactOptions = reactOptions = config.readConfig(nodePath.join(PathsConstants_1.default.getConfigFilePath()));
17
+ }
18
+ }
19
+ catch (_a) {
20
+ exports.reactOptions = reactOptions = undefined;
21
+ }