@datadog/mobile-react-native 3.5.1 → 3.5.3
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 +2 -2
- package/android/src/main/kotlin/com/datadog/reactnative/DdFlagsImplementation.kt +4 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdRumImplementation.kt +1 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +0 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +10 -3
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkReactNativePackage.kt +0 -1
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/test/kotlin/com/datadog/reactnative/DdFlagsImplementationTest.kt +77 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +30 -0
- package/ios/Sources/DdLogsImplementation.swift +2 -2
- package/ios/Sources/DdSdkConfiguration.swift +0 -1
- package/ios/Sources/SdkVersion.swift +1 -1
- package/lib/commonjs/metro/plugin/metroSerializer.js +2 -2
- package/lib/commonjs/metro/plugin/metroSerializer.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/metro/plugin/metroSerializer.js +2 -2
- package/lib/module/metro/plugin/metroSerializer.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/metro/plugin/metroSerializer.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/metro/__tests__/metro.test.ts +19 -0
- package/src/metro/plugin/metroSerializer.ts +3 -2
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -51,12 +51,12 @@ const datadogConfiguration = new DatadogProviderConfiguration(
|
|
|
51
51
|
trackErrors: true, // track errors
|
|
52
52
|
nativeCrashReportEnabled: true, // Optional: enable or disable native crash reports
|
|
53
53
|
sessionSampleRate: 80, // Optional: sample RUM sessions (here, 80% of session will be sent to Datadog. Default = 100%)
|
|
54
|
-
|
|
54
|
+
resourceTraceSampleRate: 80, // Optional: sample tracing integrations for network calls between your app and your backend (here, 80% of calls to your instrumented backend will be linked from the RUM view to the APM view. Default = 20%)
|
|
55
55
|
// You need to specify the hosts of your backends to enable tracing with these backends
|
|
56
56
|
firstPartyHosts: ['example.com'], // matches 'example.com' and subdomains like 'api.example.com'
|
|
57
57
|
},
|
|
58
58
|
logsConfiguration: {
|
|
59
|
-
logEventMapper:
|
|
59
|
+
logEventMapper: logEvent => {
|
|
60
60
|
logEvent.message = `[CUSTOM] ${logEvent.message}`;
|
|
61
61
|
return logEvent;
|
|
62
62
|
}
|
|
@@ -26,10 +26,13 @@ import java.util.Locale
|
|
|
26
26
|
* The entry point to use Datadog's Flags feature.
|
|
27
27
|
*/
|
|
28
28
|
class DdFlagsImplementation(
|
|
29
|
-
private val
|
|
29
|
+
private val sdkCoreOverride: SdkCore? = null,
|
|
30
30
|
) {
|
|
31
31
|
private val clients: MutableMap<String, FlagsClient> = mutableMapOf()
|
|
32
32
|
|
|
33
|
+
private val sdkCore: SdkCore
|
|
34
|
+
get() = sdkCoreOverride ?: Datadog.getInstance()
|
|
35
|
+
|
|
33
36
|
/**
|
|
34
37
|
* Enable the Flags feature with the provided configuration.
|
|
35
38
|
* @param configuration The configuration for Flags.
|
|
@@ -218,6 +218,7 @@ class DdRumImplementation(private val datadog: DatadogWrapper = DatadogSDKWrappe
|
|
|
218
218
|
* @param stacktrace The error stacktrace.
|
|
219
219
|
* @param context The additional context to send.
|
|
220
220
|
* @param timestampMs The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.
|
|
221
|
+
* @param fingerprint A custom fingerprint to group this error with similar ones.
|
|
221
222
|
*/
|
|
222
223
|
@Suppress("LongParameterList")
|
|
223
224
|
fun addError(
|
|
@@ -37,6 +37,9 @@ class DdSdkImplementation(
|
|
|
37
37
|
internal val initialized = AtomicBoolean(false)
|
|
38
38
|
private var frameRateProvider: FrameRateProvider? = null
|
|
39
39
|
|
|
40
|
+
@Volatile
|
|
41
|
+
private var maxDisplayRefreshRate: Double? = null
|
|
42
|
+
|
|
40
43
|
// region DdSdk
|
|
41
44
|
|
|
42
45
|
/**
|
|
@@ -383,7 +386,7 @@ class DdSdkImplementation(
|
|
|
383
386
|
val frameTimeMs = frameTimeSeconds * 1000.0
|
|
384
387
|
val frameBudgetHz = fpsBudget ?: DEFAULT_REFRESH_HZ
|
|
385
388
|
val maxDeviceDisplayHz = deviceDisplayFps ?: getMaxDisplayRefreshRate(context)
|
|
386
|
-
?:
|
|
389
|
+
?: DEFAULT_REFRESH_HZ
|
|
387
390
|
|
|
388
391
|
val maxDeviceFrameTimeMs = 1000.0 / maxDeviceDisplayHz
|
|
389
392
|
val budgetFrameTimeMs = 1000.0 / frameBudgetHz
|
|
@@ -402,10 +405,14 @@ class DdSdkImplementation(
|
|
|
402
405
|
|
|
403
406
|
@Suppress("CyclomaticComplexMethod")
|
|
404
407
|
private fun getMaxDisplayRefreshRate(context: Context?): Double {
|
|
405
|
-
|
|
408
|
+
maxDisplayRefreshRate?.let { return it }
|
|
409
|
+
|
|
410
|
+
val dm = context?.getSystemService(Context.DISPLAY_SERVICE) as? DisplayManager ?: return DEFAULT_REFRESH_HZ
|
|
406
411
|
val display: Display = dm.getDisplay(Display.DEFAULT_DISPLAY) ?: return DEFAULT_REFRESH_HZ
|
|
412
|
+
val hz = display.supportedModes.maxOfOrNull { it.refreshRate.toDouble() } ?: DEFAULT_REFRESH_HZ
|
|
413
|
+
maxDisplayRefreshRate = hz
|
|
407
414
|
|
|
408
|
-
return
|
|
415
|
+
return hz
|
|
409
416
|
}
|
|
410
417
|
|
|
411
418
|
// endregion
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
package com.datadog.reactnative
|
|
8
8
|
|
|
9
9
|
import com.facebook.react.TurboReactPackage
|
|
10
|
-
import com.facebook.react.bridge.LifecycleEventListener
|
|
11
10
|
import com.facebook.react.bridge.NativeModule
|
|
12
11
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
13
12
|
import com.facebook.react.module.model.ReactModuleInfo
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
package com.datadog.reactnative
|
|
8
|
+
|
|
9
|
+
import com.datadog.android.Datadog
|
|
10
|
+
import com.datadog.android.api.SdkCore
|
|
11
|
+
import com.datadog.android.flags.Flags
|
|
12
|
+
import com.datadog.android.flags.FlagsConfiguration
|
|
13
|
+
import com.datadog.tools.unit.toReadableMap
|
|
14
|
+
import com.facebook.react.bridge.Promise
|
|
15
|
+
import org.junit.jupiter.api.Test
|
|
16
|
+
import org.junit.jupiter.api.extension.ExtendWith
|
|
17
|
+
import org.junit.jupiter.api.extension.Extensions
|
|
18
|
+
import org.mockito.Mock
|
|
19
|
+
import org.mockito.Mockito
|
|
20
|
+
import org.mockito.junit.jupiter.MockitoExtension
|
|
21
|
+
import org.mockito.kotlin.any
|
|
22
|
+
import org.mockito.kotlin.mock
|
|
23
|
+
import org.mockito.kotlin.same
|
|
24
|
+
import org.mockito.kotlin.verify
|
|
25
|
+
|
|
26
|
+
@Extensions(
|
|
27
|
+
ExtendWith(MockitoExtension::class)
|
|
28
|
+
)
|
|
29
|
+
internal class DdFlagsImplementationTest {
|
|
30
|
+
|
|
31
|
+
@Mock
|
|
32
|
+
lateinit var mockPromise: Promise
|
|
33
|
+
|
|
34
|
+
@Test
|
|
35
|
+
fun `M not resolve SDK core W constructed`() {
|
|
36
|
+
// Given
|
|
37
|
+
val datadogMock = Mockito.mockStatic(Datadog::class.java)
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
// When
|
|
41
|
+
DdFlagsImplementation()
|
|
42
|
+
|
|
43
|
+
// Then
|
|
44
|
+
datadogMock.verifyNoInteractions()
|
|
45
|
+
} finally {
|
|
46
|
+
datadogMock.close()
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@Test
|
|
51
|
+
fun `M resolve current SDK core W enable() called after construction`() {
|
|
52
|
+
// Given
|
|
53
|
+
val staleCore = mock<SdkCore>()
|
|
54
|
+
val initializedCore = mock<SdkCore>()
|
|
55
|
+
var currentCore = staleCore
|
|
56
|
+
val configuration = mapOf("enabled" to true).toReadableMap()
|
|
57
|
+
val datadogMock = Mockito.mockStatic(Datadog::class.java)
|
|
58
|
+
val flagsMock = Mockito.mockStatic(Flags::class.java)
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
datadogMock.`when`<SdkCore> { Datadog.getInstance() }.thenAnswer { currentCore }
|
|
62
|
+
flagsMock.`when`<Unit> { Flags.enable(any<FlagsConfiguration>(), any()) }.then { }
|
|
63
|
+
val testedImplementation = DdFlagsImplementation()
|
|
64
|
+
currentCore = initializedCore
|
|
65
|
+
|
|
66
|
+
// When
|
|
67
|
+
testedImplementation.enable(configuration, mockPromise)
|
|
68
|
+
|
|
69
|
+
// Then
|
|
70
|
+
flagsMock.verify { Flags.enable(any<FlagsConfiguration>(), same(initializedCore)) }
|
|
71
|
+
verify(mockPromise).resolve(null)
|
|
72
|
+
} finally {
|
|
73
|
+
flagsMock.close()
|
|
74
|
+
datadogMock.close()
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -76,6 +76,7 @@ import org.junit.jupiter.params.provider.MethodSource
|
|
|
76
76
|
import org.mockito.Answers
|
|
77
77
|
import org.mockito.Mock
|
|
78
78
|
import org.mockito.Mockito.mock
|
|
79
|
+
import org.mockito.Mockito.times
|
|
79
80
|
import org.mockito.Mockito.`when`
|
|
80
81
|
import org.mockito.junit.jupiter.MockitoExtension
|
|
81
82
|
import org.mockito.junit.jupiter.MockitoSettings
|
|
@@ -3595,6 +3596,35 @@ internal class DdSdkTest {
|
|
|
3595
3596
|
assertThat(result).isEqualTo(0.016, Offset.offset(0.001))
|
|
3596
3597
|
}
|
|
3597
3598
|
|
|
3599
|
+
@Test
|
|
3600
|
+
fun `M read supportedModes only once W normalizeFrameTime called multiple times`() {
|
|
3601
|
+
// Given
|
|
3602
|
+
val mockContext = mock(Context::class.java)
|
|
3603
|
+
val mockDisplayManager = mock(DisplayManager::class.java)
|
|
3604
|
+
val mockDisplay = mock(Display::class.java)
|
|
3605
|
+
|
|
3606
|
+
`when`(mockContext.getSystemService(Context.DISPLAY_SERVICE)).thenReturn(mockDisplayManager)
|
|
3607
|
+
`when`(mockDisplayManager.getDisplay(Display.DEFAULT_DISPLAY)).thenReturn(mockDisplay)
|
|
3608
|
+
`when`(mockDisplay.supportedModes).thenReturn(arrayOf())
|
|
3609
|
+
|
|
3610
|
+
// When
|
|
3611
|
+
testedBridgeSdk.normalizeFrameTime(
|
|
3612
|
+
frameTimeSeconds = 0.016,
|
|
3613
|
+
context = mockContext,
|
|
3614
|
+
fpsBudget = null,
|
|
3615
|
+
deviceDisplayFps = null
|
|
3616
|
+
)
|
|
3617
|
+
testedBridgeSdk.normalizeFrameTime(
|
|
3618
|
+
frameTimeSeconds = 0.016,
|
|
3619
|
+
context = mockContext,
|
|
3620
|
+
fpsBudget = null,
|
|
3621
|
+
deviceDisplayFps = null
|
|
3622
|
+
)
|
|
3623
|
+
|
|
3624
|
+
// Then
|
|
3625
|
+
verify(mockDisplay, times(1)).supportedModes
|
|
3626
|
+
}
|
|
3627
|
+
|
|
3598
3628
|
// endregion
|
|
3599
3629
|
|
|
3600
3630
|
// region Internal
|
|
@@ -93,9 +93,9 @@ public class DdLogsImplementation: NSObject {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
internal extension DatadogLogs.Logger.Configuration {
|
|
96
|
-
/// Creates a Logger configuration from
|
|
96
|
+
/// Creates a Logger configuration from bridged configuration dictionary.
|
|
97
97
|
///
|
|
98
|
-
/// - Parameter
|
|
98
|
+
/// - Parameter sdkConfiguration: The configuration from the bridge.
|
|
99
99
|
init(_ sdkConfiguration: DdSdkConfiguration) {
|
|
100
100
|
self.init(
|
|
101
101
|
networkInfoEnabled: true,
|
|
@@ -190,7 +190,6 @@ public class LogsConfiguration: NSObject {
|
|
|
190
190
|
/// A configuration object for Datadog Tracing (APM) features.
|
|
191
191
|
///
|
|
192
192
|
/// - Parameters:
|
|
193
|
-
/// - resourceTracingSamplingRate: Percentage (0–100) of network resource traces to sample.
|
|
194
193
|
/// - customEndpoint: A custom Trace intake endpoint to override the default Datadog intake.
|
|
195
194
|
public class TraceConfiguration: NSObject {
|
|
196
195
|
public var customEndpoint: String? = nil
|
|
@@ -26,8 +26,8 @@ var _utils = require("./utils");
|
|
|
26
26
|
const createDatadogMetroSerializer = customSerializer => {
|
|
27
27
|
const serializer = customSerializer || createDefaultMetroSerializer();
|
|
28
28
|
return async (entryPoint, preModules, graph, options) => {
|
|
29
|
-
// Skip for hot reload mode and
|
|
30
|
-
if (graph.transformOptions.hot || graph.transformOptions.platform === 'web') {
|
|
29
|
+
// Skip for hot reload mode, web builds and modulesOnly bundles
|
|
30
|
+
if (graph.transformOptions.hot || graph.transformOptions.platform === 'web' || options.modulesOnly) {
|
|
31
31
|
return serializer(entryPoint, preModules, graph, options);
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_debugIdHelper","require","_utils","createDatadogMetroSerializer","customSerializer","serializer","createDefaultMetroSerializer","entryPoint","preModules","graph","options","transformOptions","hot","platform","checkIfDebugIdModuleExists","debugIdModule","createDebugIdModule","DEBUG_ID_PLACEHOLDER","datadogBundleCallback","createDatadogBundleCallback","preModulesWithDebugId","addDebugIdModule","serializerOutput","code","map","getMetroBundleWithMap","debugId","getDebugIdFromBundleSource","Error","result","injectDebugIdInCodeAndSourceMap","exports","baseJSBundle","getBaseJSBundleFunction","bundle","bundleToString","getBundleToStringFunction","sourceMapString","getSourceMapStringFunction","getSortedModules","processModuleFilter","shouldAddToIgnoreList","createDebugIdFromBundle","getSource","toString","setSource","injectDebugIdInCode","pre","unstable_beforeAssetSerializationPlugin","premodules"],"sourceRoot":"../../../../src","sources":["metro/plugin/metroSerializer.ts"],"mappings":";;;;;;;AAQA,IAAAA,cAAA,GAAAC,OAAA;AAmBA,IAAAC,MAAA,GAAAD,OAAA;AA3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,4BAA4B,GACrCC,gBAAkC,IACT;EACzB,MAAMC,UAAU,GAAGD,gBAAgB,IAAIE,4BAA4B,CAAC,CAAC;EACrE,OAAO,OAAOC,UAAU,EAAEC,UAAU,EAAEC,KAAK,EAAEC,OAAO,KAAK;IACrD;IACA,IACKD,KAAK,CAACE,gBAAgB,CAASC,GAAG,IACnCH,KAAK,CAACE,gBAAgB,CAACE,QAAQ,KAAK,KAAK,
|
|
1
|
+
{"version":3,"names":["_debugIdHelper","require","_utils","createDatadogMetroSerializer","customSerializer","serializer","createDefaultMetroSerializer","entryPoint","preModules","graph","options","transformOptions","hot","platform","modulesOnly","checkIfDebugIdModuleExists","debugIdModule","createDebugIdModule","DEBUG_ID_PLACEHOLDER","datadogBundleCallback","createDatadogBundleCallback","preModulesWithDebugId","addDebugIdModule","serializerOutput","code","map","getMetroBundleWithMap","debugId","getDebugIdFromBundleSource","Error","result","injectDebugIdInCodeAndSourceMap","exports","baseJSBundle","getBaseJSBundleFunction","bundle","bundleToString","getBundleToStringFunction","sourceMapString","getSourceMapStringFunction","getSortedModules","processModuleFilter","shouldAddToIgnoreList","createDebugIdFromBundle","getSource","toString","setSource","injectDebugIdInCode","pre","unstable_beforeAssetSerializationPlugin","premodules"],"sourceRoot":"../../../../src","sources":["metro/plugin/metroSerializer.ts"],"mappings":";;;;;;;AAQA,IAAAA,cAAA,GAAAC,OAAA;AAmBA,IAAAC,MAAA,GAAAD,OAAA;AA3BA;AACA;AACA;AACA;AACA;AACA;A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B,MAAc,IAAK;IACvB,MAAMR,OAAO,GAAG,IAAAgB,sCAAuB,EAACR,MAAM,CAAC;IAC/C,MAAMX,IAAI,GAAGR,aAAa,CAAC4B,SAAS,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;IACjD7B,aAAa,CAAC8B,SAAS,CAAC,IAAAC,kCAAmB,EAACvB,IAAI,EAAEG,OAAO,CAAC,CAAC;IAC3DQ,MAAM,CAACa,GAAG,GAAG,IAAAD,kCAAmB,EAACZ,MAAM,CAACa,GAAG,EAAErB,OAAO,CAAC;IACrD,OAAOQ,MAAM;EACjB,CAAC;AACL,CAAC;;AAED;AACA;AACA;AAFAH,OAAA,CAAAZ,2BAAA,GAAAA,2BAAA;AAGO,SAAS6B,uCAAuCA,CAAC;EACpDxC,KAAK;EACLyC,UAAU;EACVvB;AAKJ,CAAC,EAAY;EACT,IACIlB,KAAK,CAACE,gBAAgB,CAACE,QAAQ,KAAK,KAAK,IACzC,CAACc,OAAO,IACR,IAAAZ,yCAA0B,EAACmC,UAAU,CAAC,EACxC;IACE,OAAOA,UAAU;EACrB;EACA,OAAO,CAAC,GAAG,IAAA5B,+BAAgB,EAAC4B,UAAU,EAAE,IAAAjC,kCAAmB,EAACU,OAAO,CAAC,CAAC,CAAC;AAC1E","ignoreList":[]}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -19,8 +19,8 @@ import { getBaseJSBundleFunction, getBundleToStringFunction, convertSerializerOu
|
|
|
19
19
|
export const createDatadogMetroSerializer = customSerializer => {
|
|
20
20
|
const serializer = customSerializer || createDefaultMetroSerializer();
|
|
21
21
|
return async (entryPoint, preModules, graph, options) => {
|
|
22
|
-
// Skip for hot reload mode and
|
|
23
|
-
if (graph.transformOptions.hot || graph.transformOptions.platform === 'web') {
|
|
22
|
+
// Skip for hot reload mode, web builds and modulesOnly bundles
|
|
23
|
+
if (graph.transformOptions.hot || graph.transformOptions.platform === 'web' || options.modulesOnly) {
|
|
24
24
|
return serializer(entryPoint, preModules, graph, options);
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DEBUG_ID_PLACEHOLDER","addDebugIdModule","checkIfDebugIdModuleExists","createDebugIdFromBundle","createDebugIdModule","getDebugIdFromBundleSource","injectDebugIdInCode","injectDebugIdInCodeAndSourceMap","getBaseJSBundleFunction","getBundleToStringFunction","convertSerializerOutput","getMetroBundleWithMap","getSortedModules","getSourceMapStringFunction","createDatadogMetroSerializer","customSerializer","serializer","createDefaultMetroSerializer","entryPoint","preModules","graph","options","transformOptions","hot","platform","debugIdModule","datadogBundleCallback","createDatadogBundleCallback","preModulesWithDebugId","serializerOutput","code","map","debugId","Error","result","baseJSBundle","bundle","bundleToString","sourceMapString","processModuleFilter","shouldAddToIgnoreList","getSource","toString","setSource","pre","unstable_beforeAssetSerializationPlugin","premodules"],"sourceRoot":"../../../../src","sources":["metro/plugin/metroSerializer.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACIA,oBAAoB,EACpBC,gBAAgB,EAChBC,0BAA0B,EAC1BC,uBAAuB,EACvBC,mBAAmB,EACnBC,0BAA0B,EAC1BC,mBAAmB,EACnBC,+BAA+B,QAC5B,iBAAiB;AAUxB,SACIC,uBAAuB,EACvBC,yBAAyB,EACzBC,uBAAuB,IAAIC,qBAAqB,EAChDC,gBAAgB,EAChBC,0BAA0B,QACvB,SAAS;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,4BAA4B,GACrCC,gBAAkC,IACT;EACzB,MAAMC,UAAU,GAAGD,gBAAgB,IAAIE,4BAA4B,CAAC,CAAC;EACrE,OAAO,OAAOC,UAAU,EAAEC,UAAU,EAAEC,KAAK,EAAEC,OAAO,KAAK;IACrD;IACA,IACKD,KAAK,CAACE,gBAAgB,CAASC,GAAG,IACnCH,KAAK,CAACE,gBAAgB,CAACE,QAAQ,KAAK,KAAK,
|
|
1
|
+
{"version":3,"names":["DEBUG_ID_PLACEHOLDER","addDebugIdModule","checkIfDebugIdModuleExists","createDebugIdFromBundle","createDebugIdModule","getDebugIdFromBundleSource","injectDebugIdInCode","injectDebugIdInCodeAndSourceMap","getBaseJSBundleFunction","getBundleToStringFunction","convertSerializerOutput","getMetroBundleWithMap","getSortedModules","getSourceMapStringFunction","createDatadogMetroSerializer","customSerializer","serializer","createDefaultMetroSerializer","entryPoint","preModules","graph","options","transformOptions","hot","platform","modulesOnly","debugIdModule","datadogBundleCallback","createDatadogBundleCallback","preModulesWithDebugId","serializerOutput","code","map","debugId","Error","result","baseJSBundle","bundle","bundleToString","sourceMapString","processModuleFilter","shouldAddToIgnoreList","getSource","toString","setSource","pre","unstable_beforeAssetSerializationPlugin","premodules"],"sourceRoot":"../../../../src","sources":["metro/plugin/metroSerializer.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACIA,oBAAoB,EACpBC,gBAAgB,EAChBC,0BAA0B,EAC1BC,uBAAuB,EACvBC,mBAAmB,EACnBC,0BAA0B,EAC1BC,mBAAmB,EACnBC,+BAA+B,QAC5B,iBAAiB;AAUxB,SACIC,uBAAuB,EACvBC,yBAAyB,EACzBC,uBAAuB,IAAIC,qBAAqB,EAChDC,gBAAgB,EAChBC,0BAA0B,QACvB,SAAS;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,4BAA4B,GACrCC,gBAAkC,IACT;EACzB,MAAMC,UAAU,GAAGD,gBAAgB,IAAIE,4BAA4B,CAAC,CAAC;EACrE,OAAO,OAAOC,UAAU,EAAEC,UAAU,EAAEC,KAAK,EAAEC,OAAO,KAAK;IACrD;IACA,IACKD,KAAK,CAACE,gBAAgB,CAASC,GAAG,IACnCH,KAAK,CAACE,gBAAgB,CAACE,QAAQ,KAAK,KAAK,IACxCH,OAAO,CAASI,WAAW,EAC9B;MACE,OAAOT,UAAU,CAACE,UAAU,EAAEC,UAAU,EAAEC,KAAK,EAAEC,OAA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R/B,0BAA0B,CAAC6C,UAAU,CAAC,EACxC;IACE,OAAOA,UAAU;EACrB;EACA,OAAO,CAAC,GAAG9C,gBAAgB,CAAC8C,UAAU,EAAE3C,mBAAmB,CAAC6B,OAAO,CAAC,CAAC,CAAC;AAC1E","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metroSerializer.d.ts","sourceRoot":"","sources":["../../../../src/metro/plugin/metroSerializer.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACR,MAAM,EACN,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,MAAM,EACN,aAAa,EAChB,MAAM,oBAAoB,CAAC;AAS5B;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,sBAClB,eAAe,KACnC,
|
|
1
|
+
{"version":3,"file":"metroSerializer.d.ts","sourceRoot":"","sources":["../../../../src/metro/plugin/metroSerializer.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACR,MAAM,EACN,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,MAAM,EACN,aAAa,EAChB,MAAM,oBAAoB,CAAC;AAS5B;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,sBAClB,eAAe,KACnC,sBAuDF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,QAAO,eAoC/C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,kBACrB,oBAAoB,cAEnB,MAAM,WAOzB,CAAC;AAEF;;GAEG;AACH,wBAAgB,uCAAuC,CAAC,EACpD,KAAK,EACL,UAAU,EACV,OAAO,EACV,EAAE;IACC,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,EAAE,CASX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "3.5.
|
|
1
|
+
export declare const version = "3.5.3";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datadog/mobile-react-native",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.3",
|
|
4
4
|
"description": "A client-side React Native module to interact with Datadog",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datadog",
|
|
@@ -118,5 +118,5 @@
|
|
|
118
118
|
"dependencies": {
|
|
119
119
|
"big-integer": "^1.6.52"
|
|
120
120
|
},
|
|
121
|
-
"gitHead": "
|
|
121
|
+
"gitHead": "7abbd15c05e878a83db1357a051d3aa3978c47a8"
|
|
122
122
|
}
|
|
@@ -45,6 +45,25 @@ describe('Datadog Metro Plugin', () => {
|
|
|
45
45
|
expect(code).not.toContain('_datadogDebugIds');
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
+
test('skips debug ID injection for modulesOnly bundles (lazy/split chunks)', async () => {
|
|
49
|
+
const serializer = createDatadogMetroSerializer();
|
|
50
|
+
const mainBundleArgs = mockSerializerArgsForEmptyModule();
|
|
51
|
+
const mainBundle = await serializer(...mainBundleArgs);
|
|
52
|
+
const { code: mainCode } = await convertSerializerOutput(
|
|
53
|
+
mainBundle
|
|
54
|
+
);
|
|
55
|
+
expect(mainCode).toContain('_datadogDebugIds');
|
|
56
|
+
|
|
57
|
+
const lazyChunkArgs = mockSerializerArgsForEmptyModule();
|
|
58
|
+
(lazyChunkArgs[3] as any).modulesOnly = true;
|
|
59
|
+
const lazyBundle = await serializer(...lazyChunkArgs);
|
|
60
|
+
const { code: lazyCode } = await convertSerializerOutput(
|
|
61
|
+
lazyBundle
|
|
62
|
+
);
|
|
63
|
+
expect(lazyCode).not.toContain('debugId');
|
|
64
|
+
expect(lazyCode).not.toContain('_datadogDebugIds');
|
|
65
|
+
});
|
|
66
|
+
|
|
48
67
|
test('generates bundle and source map with UUID v5 Debug ID', async () => {
|
|
49
68
|
const codeSnippetHash = createHash('md5');
|
|
50
69
|
codeSnippetHash.update(DEBUG_ID_CODE_SNIPPET);
|
|
@@ -45,10 +45,11 @@ export const createDatadogMetroSerializer = (
|
|
|
45
45
|
): DatadogMetroSerializer => {
|
|
46
46
|
const serializer = customSerializer || createDefaultMetroSerializer();
|
|
47
47
|
return async (entryPoint, preModules, graph, options) => {
|
|
48
|
-
// Skip for hot reload mode and
|
|
48
|
+
// Skip for hot reload mode, web builds and modulesOnly bundles
|
|
49
49
|
if (
|
|
50
50
|
(graph.transformOptions as any).hot ||
|
|
51
|
-
graph.transformOptions.platform === 'web'
|
|
51
|
+
graph.transformOptions.platform === 'web' ||
|
|
52
|
+
(options as any).modulesOnly
|
|
52
53
|
) {
|
|
53
54
|
return serializer(entryPoint, preModules, graph, options);
|
|
54
55
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '3.5.
|
|
2
|
+
export const version = '3.5.3';
|