11import * as SentryAstro from '@sentry/astro' ;
22import * as SentryBun from '@sentry/bun' ;
33import * 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' ;
56import * as SentryRemix from '@sentry/remix' ;
67import * as SentryServerless from '@sentry/serverless' ;
78import * as SentrySvelteKit from '@sentry/sveltekit' ;
89
910/* List of exports that are safe to ignore / we don't require in any depending package */
10- const NODE_EXPORTS_IGNORE = [
11+ const NODE_EXPERIMENTAL_EXPORTS_IGNORE = [
1112 'default' ,
1213 // Probably generated by transpilation, no need to require it
1314 '__esModule' ,
14- // These Node exports were only made for type definition fixes (see #10339)
15- 'Undici' ,
15+ // These are not re-exported where not needed
1616 'Http' ,
17- 'DebugSession' ,
18- 'AnrIntegrationOptions' ,
19- 'LocalVariablesIntegrationOptions' ,
17+ 'Undici' ,
18+ ] ;
19+
20+ /* List of exports that are safe to ignore / we don't require in any depending package */
21+ const NODE_EXPORTS_IGNORE = [
22+ 'default' ,
23+ // Probably generated by transpilation, no need to require it
24+ '__esModule' ,
2025] ;
2126
27+ /* Sanitized list of node exports */
28+ const nodeExperimentalExports = Object . keys ( SentryNodeExperimental ) . filter (
29+ e => ! NODE_EXPERIMENTAL_EXPORTS_IGNORE . includes ( e ) ,
30+ ) ;
31+ const nodeExports = Object . keys ( SentryNode ) . filter ( e => ! NODE_EXPORTS_IGNORE . includes ( e ) ) ;
32+
2233type Dependent = {
2334 package : string ;
2435 exports : string [ ] ;
2536 ignoreExports ?: string [ ] ;
2637 skip ?: boolean ;
38+ compareWith : string [ ] ;
2739} ;
2840
2941const DEPENDENTS : Dependent [ ] = [
3042 {
3143 package : '@sentry/astro' ,
44+ compareWith : nodeExports ,
3245 exports : Object . keys ( SentryAstro ) ,
3346 } ,
3447 {
3548 package : '@sentry/bun' ,
49+ compareWith : nodeExperimentalExports ,
3650 exports : Object . keys ( SentryBun ) ,
3751 ignoreExports : [
3852 // not supported in bun:
@@ -44,35 +58,36 @@ const DEPENDENTS: Dependent[] = [
4458 } ,
4559 {
4660 package : '@sentry/nextjs' ,
61+ compareWith : nodeExperimentalExports ,
4762 // Next.js doesn't require explicit exports, so we can just merge top level and `default` exports:
4863 // @ts -expect-error: `default` is not in the type definition but it's defined
4964 exports : Object . keys ( { ...SentryNextJs , ...SentryNextJs . default } ) ,
5065 } ,
5166 {
5267 package : '@sentry/remix' ,
68+ compareWith : nodeExperimentalExports ,
5369 exports : Object . keys ( SentryRemix ) ,
5470 } ,
5571 {
5672 package : '@sentry/serverless' ,
73+ compareWith : nodeExperimentalExports ,
5774 exports : Object . keys ( SentryServerless ) ,
5875 ignoreExports : [ 'cron' , 'hapiErrorPlugin' ] ,
5976 } ,
6077 {
6178 package : '@sentry/sveltekit' ,
79+ compareWith : nodeExperimentalExports ,
6280 exports : Object . keys ( SentrySvelteKit ) ,
6381 } ,
6482] ;
6583
66- /* Sanitized list of node exports */
67- const nodeExports = Object . keys ( SentryNode ) . filter ( e => ! NODE_EXPORTS_IGNORE . includes ( e ) ) ;
68-
6984console . log ( '🔎 Checking for consistent exports of @sentry/node exports in depending packages' ) ;
7085
7186const missingExports : Record < string , string [ ] > = { } ;
7287const dependentsToCheck = DEPENDENTS . filter ( d => ! d . skip ) ;
7388
74- for ( const nodeExport of nodeExports ) {
75- for ( const dependent of dependentsToCheck ) {
89+ for ( const dependent of dependentsToCheck ) {
90+ for ( const nodeExport of dependent . compareWith ) {
7691 if ( dependent . ignoreExports ?. includes ( nodeExport ) ) {
7792 continue ;
7893 }
0 commit comments