File tree Expand file tree Collapse file tree 5 files changed +4
-38
lines changed Expand file tree Collapse file tree 5 files changed +4
-38
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
2
2
import { getCurrentHub } from '@sentry/core' ;
3
3
import type { ReplayRecordingData , Transport } from '@sentry/types' ;
4
- import { TextEncoder } from 'util' ;
4
+ import { TextEncoder } from 'util' ;
5
5
6
6
import type { ReplayContainer , Session } from './src/types' ;
7
7
8
- // @ts -ignore TS error, this is replaced in prod builds bc of rollup
9
- global . __SENTRY_REPLAY_VERSION__ = 'version:Test' ;
10
-
11
8
( global as any ) . TextEncoder = TextEncoder ;
12
9
13
10
type MockTransport = jest . MockedFunction < Transport [ 'send' ] > ;
Original file line number Diff line number Diff line change 1
- import replace from '@rollup/plugin-replace' ;
2
-
3
1
import { makeBaseBundleConfig , makeBundleConfigVariants } from '../../rollup/index.js' ;
4
2
5
- import pkg from './package.json' ;
6
-
7
3
const baseBundleConfig = makeBaseBundleConfig ( {
8
4
bundleType : 'addon' ,
9
5
entrypoints : [ 'src/index.ts' ] ,
10
6
jsVersion : 'es6' ,
11
7
licenseTitle : '@sentry/replay' ,
12
8
outputFileBase : ( ) => 'bundles/replay' ,
13
- packageSpecificConfig : {
14
- plugins : [
15
- replace ( {
16
- preventAssignment : true ,
17
- values : {
18
- __SENTRY_REPLAY_VERSION__ : JSON . stringify ( pkg . version ) ,
19
- } ,
20
- } ) ,
21
- ] ,
22
- } ,
23
9
} ) ;
24
10
25
11
const builds = makeBundleConfigVariants ( baseBundleConfig ) ;
Original file line number Diff line number Diff line change 1
- import replace from '@rollup/plugin-replace' ;
2
-
3
1
import { makeBaseNPMConfig , makeNPMConfigVariants } from '../../rollup/index' ;
4
2
5
- import pkg from './package.json' ;
6
-
7
3
export default makeNPMConfigVariants (
8
4
makeBaseNPMConfig ( {
9
5
hasBundles : true ,
10
6
packageSpecificConfig : {
11
- plugins : [
12
- // TODO: Remove this - replay version will be in sync w/ SDK version
13
- replace ( {
14
- preventAssignment : true ,
15
- values : {
16
- __SENTRY_REPLAY_VERSION__ : JSON . stringify ( pkg . version ) ,
17
- } ,
18
- } ) ,
19
- ] ,
20
7
output : {
21
8
// set exports to 'named' or 'auto' so that rollup doesn't warn about
22
9
// the default export in `worker/worker.js`
Original file line number Diff line number Diff line change @@ -29,10 +29,6 @@ export interface WorkerRequest {
29
29
args : unknown [ ] ;
30
30
}
31
31
32
- declare global {
33
- const __SENTRY_REPLAY_VERSION__ : string ;
34
- }
35
-
36
32
// PerformancePaintTiming and PerformanceNavigationTiming are only available with TS 4.4 and newer
37
33
// Therefore, we're exporting them here to make them available in older TS versions
38
34
export type PerformancePaintTiming = PerformanceEntry ;
Original file line number Diff line number Diff line change @@ -30,12 +30,12 @@ export async function prepareReplayEvent({
30
30
31
31
// extract the SDK name because `client._prepareEvent` doesn't add it to the event
32
32
const metadata = client . getSdkMetadata && client . getSdkMetadata ( ) ;
33
- const name = ( metadata && metadata . sdk && metadata . sdk . name ) || 'sentry.javascript.unknown' ;
33
+ const { name, version } = ( metadata && metadata . sdk ) || { } ;
34
34
35
35
preparedEvent . sdk = {
36
36
...preparedEvent . sdk ,
37
- version : __SENTRY_REPLAY_VERSION__ ,
38
- name ,
37
+ name : name || 'sentry.javascript.unknown' ,
38
+ version : version || '0.0.0' ,
39
39
} ;
40
40
41
41
return preparedEvent ;
You can’t perform that action at this time.
0 commit comments