1
1
import * as SentryAstro from '@sentry/astro' ;
2
2
import * as SentryBun from '@sentry/bun' ;
3
3
import * as SentryNextJs from '@sentry/nextjs' ;
4
- import * as SentryNode from '@sentry/node-experimental' ;
4
+ import * as SentryNode from '@sentry/node' ;
5
+ import * as SentryNodeExperimental from '@sentry/node-experimental' ;
5
6
import * as SentryRemix from '@sentry/remix' ;
6
7
import * as SentryServerless from '@sentry/serverless' ;
7
8
import * as SentrySvelteKit from '@sentry/sveltekit' ;
8
9
10
+ /* List of exports that are safe to ignore / we don't require in any depending package */
11
+ const NODE_EXPERIMENTAL_EXPORTS_IGNORE = [
12
+ 'default' ,
13
+ // Probably generated by transpilation, no need to require it
14
+ '__esModule' ,
15
+ ] ;
16
+
9
17
/* List of exports that are safe to ignore / we don't require in any depending package */
10
18
const NODE_EXPORTS_IGNORE = [
11
19
'default' ,
12
20
// Probably generated by transpilation, no need to require it
13
21
'__esModule' ,
14
- // These Node exports were only made for type definition fixes (see #10339)
15
- 'Undici' ,
16
- 'Http' ,
17
- 'DebugSession' ,
18
- 'AnrIntegrationOptions' ,
19
- 'LocalVariablesIntegrationOptions' ,
20
22
] ;
21
23
24
+ /* Sanitized list of node exports */
25
+ const nodeExperimentalExports = Object . keys ( SentryNodeExperimental ) . filter (
26
+ e => ! NODE_EXPERIMENTAL_EXPORTS_IGNORE . includes ( e ) ,
27
+ ) ;
28
+ const nodeExports = Object . keys ( SentryNode ) . filter ( e => ! NODE_EXPORTS_IGNORE . includes ( e ) ) ;
29
+
22
30
type Dependent = {
23
31
package : string ;
24
32
exports : string [ ] ;
25
33
ignoreExports ?: string [ ] ;
26
34
skip ?: boolean ;
35
+ compareWith : string [ ] ;
27
36
} ;
28
37
29
38
const DEPENDENTS : Dependent [ ] = [
30
39
{
31
40
package : '@sentry/astro' ,
41
+ compareWith : nodeExports ,
32
42
exports : Object . keys ( SentryAstro ) ,
33
43
} ,
34
44
{
35
45
package : '@sentry/bun' ,
46
+ compareWith : nodeExperimentalExports ,
36
47
exports : Object . keys ( SentryBun ) ,
37
48
ignoreExports : [
38
49
// not supported in bun:
@@ -44,35 +55,36 @@ const DEPENDENTS: Dependent[] = [
44
55
} ,
45
56
{
46
57
package : '@sentry/nextjs' ,
58
+ compareWith : nodeExperimentalExports ,
47
59
// Next.js doesn't require explicit exports, so we can just merge top level and `default` exports:
48
60
// @ts -expect-error: `default` is not in the type definition but it's defined
49
61
exports : Object . keys ( { ...SentryNextJs , ...SentryNextJs . default } ) ,
50
62
} ,
51
63
{
52
64
package : '@sentry/remix' ,
65
+ compareWith : nodeExperimentalExports ,
53
66
exports : Object . keys ( SentryRemix ) ,
54
67
} ,
55
68
{
56
69
package : '@sentry/serverless' ,
70
+ compareWith : nodeExperimentalExports ,
57
71
exports : Object . keys ( SentryServerless ) ,
58
72
ignoreExports : [ 'cron' , 'hapiErrorPlugin' ] ,
59
73
} ,
60
74
{
61
75
package : '@sentry/sveltekit' ,
76
+ compareWith : nodeExperimentalExports ,
62
77
exports : Object . keys ( SentrySvelteKit ) ,
63
78
} ,
64
79
] ;
65
80
66
- /* Sanitized list of node exports */
67
- const nodeExports = Object . keys ( SentryNode ) . filter ( e => ! NODE_EXPORTS_IGNORE . includes ( e ) ) ;
68
-
69
81
console . log ( '🔎 Checking for consistent exports of @sentry/node exports in depending packages' ) ;
70
82
71
83
const missingExports : Record < string , string [ ] > = { } ;
72
84
const dependentsToCheck = DEPENDENTS . filter ( d => ! d . skip ) ;
73
85
74
- for ( const nodeExport of nodeExports ) {
75
- for ( const dependent of dependentsToCheck ) {
86
+ for ( const dependent of dependentsToCheck ) {
87
+ for ( const nodeExport of dependent . compareWith ) {
76
88
if ( dependent . ignoreExports ?. includes ( nodeExport ) ) {
77
89
continue ;
78
90
}
0 commit comments