From 3d5dfe95d2c9f5acdd124f40ed16ea2024a2fd00 Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Tue, 25 Jan 2022 21:09:08 -0800 Subject: [PATCH 1/2] turn `isolatedModules` on in main tsconfig --- packages/typescript/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/typescript/tsconfig.json b/packages/typescript/tsconfig.json index d6858094b969..3a427cc596c9 100644 --- a/packages/typescript/tsconfig.json +++ b/packages/typescript/tsconfig.json @@ -6,6 +6,7 @@ "downlevelIteration": true, "importHelpers": true, "inlineSources": true, + "isolatedModules": true, "lib": ["es6", "dom"], // "module": "commonjs", // implied by "target" : "es5" "moduleResolution": "node", From 40b583201df04af9a8ef237d70140bb54f125a91 Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Tue, 25 Jan 2022 22:19:17 -0800 Subject: [PATCH 2/2] use `export type` when re-exporting types --- packages/angular/src/index.ts | 4 +- packages/browser/src/exports.ts | 10 +-- packages/core/src/index.ts | 22 +++--- packages/hub/src/index.ts | 13 +--- packages/nextjs/src/index.server.ts | 2 +- packages/node/src/index.ts | 5 +- packages/node/src/transports/index.ts | 4 +- .../serverless/src/gcpfunction/general.ts | 2 +- packages/tracing/src/browser/index.ts | 8 +-- packages/tracing/src/index.bundle.ts | 7 +- packages/tracing/src/index.ts | 11 ++- packages/types/src/index.ts | 70 +++++++++---------- packages/vue/src/index.bundle.ts | 6 +- 13 files changed, 82 insertions(+), 82 deletions(-) diff --git a/packages/angular/src/index.ts b/packages/angular/src/index.ts index 4b282610a16c..b6f188a35d14 100644 --- a/packages/angular/src/index.ts +++ b/packages/angular/src/index.ts @@ -1,7 +1,9 @@ +export type { ErrorHandlerOptions } from './errorhandler'; + export * from '@sentry/browser'; export { init } from './sdk'; -export { createErrorHandler, ErrorHandlerOptions, SentryErrorHandler } from './errorhandler'; +export { createErrorHandler, SentryErrorHandler } from './errorhandler'; export { getActiveTransaction, // TODO `instrumentAngularRouting` is just an alias for `routingInstrumentation`; deprecate the latter at some point diff --git a/packages/browser/src/exports.ts b/packages/browser/src/exports.ts index 1ee859e354d6..1af8a7d8aaf5 100644 --- a/packages/browser/src/exports.ts +++ b/packages/browser/src/exports.ts @@ -1,4 +1,4 @@ -export { +export type { Breadcrumb, BreadcrumbHint, Request, @@ -17,6 +17,9 @@ export { User, } from '@sentry/types'; +export type { BrowserOptions } from './client'; +export type { ReportDialogOptions } from './helpers'; + export { addGlobalEventProcessor, addBreadcrumb, @@ -41,8 +44,7 @@ export { withScope, } from '@sentry/core'; -export { BrowserClient, BrowserOptions } from './client'; - +export { BrowserClient } from './client'; export { defaultStackParsers, chromeStackParser, @@ -51,6 +53,6 @@ export { opera11StackParser, winjsStackParser, } from './stack-parsers'; -export { injectReportDialog, ReportDialogOptions } from './helpers'; +export { injectReportDialog } from './helpers'; export { defaultIntegrations, forceLoad, init, lastEventId, onLoad, showReportDialog, flush, close, wrap } from './sdk'; export { SDK_NAME } from './version'; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index e4143f098e4a..ccf2aa519775 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,3 +1,13 @@ +export type { APIDetails } from './api'; +export type { ClientClass } from './sdk'; +export type { + BaseTransportOptions, + NewTransport, + TransportMakeRequestResponse, + TransportRequest, + TransportRequestExecutor, +} from './transports/base'; + export { addBreadcrumb, captureException, @@ -15,7 +25,6 @@ export { } from '@sentry/minimal'; export { addGlobalEventProcessor, getCurrentHub, getHubFromCarrier, Hub, makeMain, Scope, Session } from '@sentry/hub'; export { - APIDetails, getEnvelopeEndpointWithUrlEncodedAuth, getStoreEndpointWithUrlEncodedAuth, getRequestHeaders, @@ -24,16 +33,9 @@ export { } from './api'; export { BaseClient } from './baseclient'; export { eventToSentryRequest, sessionToSentryRequest } from './request'; -export { initAndBind, ClientClass } from './sdk'; +export { initAndBind } from './sdk'; export { NoopTransport } from './transports/noop'; -export { - BaseTransportOptions, - createTransport, - NewTransport, - TransportMakeRequestResponse, - TransportRequest, - TransportRequestExecutor, -} from './transports/base'; +export { createTransport } from './transports/base'; export { SDK_VERSION } from './version'; import * as Integrations from './integrations'; diff --git a/packages/hub/src/index.ts b/packages/hub/src/index.ts index 3d3b97fa239b..16c99ec7bc89 100644 --- a/packages/hub/src/index.ts +++ b/packages/hub/src/index.ts @@ -1,13 +1,6 @@ +export type { Carrier, Layer } from './hub'; + export { addGlobalEventProcessor, Scope } from './scope'; export { Session } from './session'; export { SessionFlusher } from './sessionflusher'; -export { - getCurrentHub, - getHubFromCarrier, - getMainCarrier, - Hub, - makeMain, - setHubOnCarrier, - Carrier, - Layer, -} from './hub'; +export { getCurrentHub, getHubFromCarrier, getMainCarrier, Hub, makeMain, setHubOnCarrier } from './hub'; diff --git a/packages/nextjs/src/index.server.ts b/packages/nextjs/src/index.server.ts index a57ee89443a5..35ef814d97cd 100644 --- a/packages/nextjs/src/index.server.ts +++ b/packages/nextjs/src/index.server.ts @@ -135,8 +135,8 @@ function filterTransactions(event: Event): Event | null { return event.type === 'transaction' && event.transaction === '/404' ? null : event; } +export type { SentryWebpackPluginOptions } from './config/types'; export { withSentryConfig } from './config'; -export { SentryWebpackPluginOptions } from './config/types'; export { withSentry } from './utils/withSentry'; // Wrap various server methods to enable error monitoring and tracing. (Note: This only happens for non-Vercel diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index cb83bd07cdcf..0e8febd8a92a 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -1,4 +1,4 @@ -export { +export type { Breadcrumb, BreadcrumbHint, Request, @@ -17,6 +17,8 @@ export { User, } from '@sentry/types'; +export type { NodeOptions } from './types'; + export { addGlobalEventProcessor, addBreadcrumb, @@ -41,7 +43,6 @@ export { withScope, } from '@sentry/core'; -export { NodeOptions } from './types'; export { NodeClient } from './client'; export { defaultIntegrations, init, lastEventId, flush, close, getSentryRelease } from './sdk'; export { deepReadDirSync } from './utils'; diff --git a/packages/node/src/transports/index.ts b/packages/node/src/transports/index.ts index 2cabeee08d5f..958562933321 100644 --- a/packages/node/src/transports/index.ts +++ b/packages/node/src/transports/index.ts @@ -1,4 +1,6 @@ +export type { NodeTransportOptions } from './new'; + export { BaseTransport } from './base'; export { HTTPTransport } from './http'; export { HTTPSTransport } from './https'; -export { makeNodeTransport, NodeTransportOptions } from './new'; +export { makeNodeTransport } from './new'; diff --git a/packages/serverless/src/gcpfunction/general.ts b/packages/serverless/src/gcpfunction/general.ts index becad86b5b0f..4ba794958ec4 100644 --- a/packages/serverless/src/gcpfunction/general.ts +++ b/packages/serverless/src/gcpfunction/general.ts @@ -62,4 +62,4 @@ export function configureScopeWithContext(scope: Scope, context: Context): void scope.setContext('gcp.function.context', { ...context } as SentryContext); } -export { Request, Response }; +export type { Request, Response }; diff --git a/packages/tracing/src/browser/index.ts b/packages/tracing/src/browser/index.ts index dd022fe2b8ec..2f7a3fe0d522 100644 --- a/packages/tracing/src/browser/index.ts +++ b/packages/tracing/src/browser/index.ts @@ -1,6 +1,4 @@ +export type { RequestInstrumentationOptions } from './request'; + export { BrowserTracing } from './browsertracing'; -export { - instrumentOutgoingRequests, - RequestInstrumentationOptions, - defaultRequestInstrumentationOptions, -} from './request'; +export { instrumentOutgoingRequests, defaultRequestInstrumentationOptions } from './request'; diff --git a/packages/tracing/src/index.bundle.ts b/packages/tracing/src/index.bundle.ts index 72ce4f3c19db..56e35e0ceaaa 100644 --- a/packages/tracing/src/index.bundle.ts +++ b/packages/tracing/src/index.bundle.ts @@ -1,4 +1,4 @@ -export { +export type { Breadcrumb, Request, SdkInfo, @@ -15,6 +15,8 @@ export { User, } from '@sentry/types'; +export type { BrowserOptions, ReportDialogOptions } from '@sentry/browser'; + export { addGlobalEventProcessor, addBreadcrumb, @@ -37,8 +39,7 @@ export { withScope, } from '@sentry/browser'; -export { BrowserOptions } from '@sentry/browser'; -export { BrowserClient, ReportDialogOptions } from '@sentry/browser'; +export { BrowserClient } from '@sentry/browser'; export { defaultIntegrations, forceLoad, diff --git a/packages/tracing/src/index.ts b/packages/tracing/src/index.ts index dcfea00f422a..0085ad5f6b0a 100644 --- a/packages/tracing/src/index.ts +++ b/packages/tracing/src/index.ts @@ -1,6 +1,9 @@ import { addExtensionMethods } from './hubextensions'; import * as Integrations from './integrations'; +export type { RequestInstrumentationOptions } from './browser'; +export type { SpanStatusType } from './span'; + export { Integrations }; // This is already exported as part of `Integrations` above (and for the moment will remain so for @@ -21,15 +24,11 @@ export { Integrations }; // For an example of of the new usage of BrowserTracing, see @sentry/nextjs index.client.ts export { BrowserTracing } from './browser'; -export { Span, SpanStatusType, spanStatusfromHttpCode } from './span'; +export { Span, spanStatusfromHttpCode } from './span'; // eslint-disable-next-line deprecation/deprecation export { SpanStatus } from './spanstatus'; export { Transaction } from './transaction'; -export { - instrumentOutgoingRequests, - RequestInstrumentationOptions, - defaultRequestInstrumentationOptions, -} from './browser'; +export { instrumentOutgoingRequests, defaultRequestInstrumentationOptions } from './browser'; export { IdleTransaction } from './idletransaction'; export { startIdleTransaction } from './hubextensions'; diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index b104f2e85930..84430c1d3976 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -1,10 +1,10 @@ -export { Breadcrumb, BreadcrumbHint } from './breadcrumb'; -export { Client } from './client'; -export { ClientReport } from './clientreport'; -export { Context, Contexts } from './context'; -export { DsnComponents, DsnLike, DsnProtocol } from './dsn'; -export { DebugImage, DebugImageType, DebugMeta } from './debugMeta'; -export { +export type { Breadcrumb, BreadcrumbHint } from './breadcrumb'; +export type { Client } from './client'; +export type { ClientReport } from './clientreport'; +export type { Context, Contexts } from './context'; +export type { DsnComponents, DsnLike, DsnProtocol } from './dsn'; +export type { DebugImage, DebugImageType, DebugMeta } from './debugMeta'; +export type { AttachmentItem, BaseEnvelopeHeaders, BaseEnvelopeItemHeaders, @@ -17,25 +17,25 @@ export { SessionItem, UserFeedbackItem, } from './envelope'; -export { ExtendedError } from './error'; -export { Event, EventHint } from './event'; -export { EventStatus } from './eventstatus'; -export { EventProcessor } from './eventprocessor'; -export { Exception } from './exception'; -export { Extra, Extras } from './extra'; -export { Hub } from './hub'; -export { Integration, IntegrationClass } from './integration'; -export { Mechanism } from './mechanism'; -export { ExtractedNodeRequestData, Primitive, WorkerLocation } from './misc'; -export { Options } from './options'; -export { Package } from './package'; -export { QueryParams, Request, SentryRequest, SentryRequestType } from './request'; -export { Response } from './response'; -export { Runtime } from './runtime'; -export { CaptureContext, Scope, ScopeContext } from './scope'; -export { SdkInfo } from './sdkinfo'; -export { SdkMetadata } from './sdkmetadata'; -export { +export type { ExtendedError } from './error'; +export type { Event, EventHint } from './event'; +export type { EventStatus } from './eventstatus'; +export type { EventProcessor } from './eventprocessor'; +export type { Exception } from './exception'; +export type { Extra, Extras } from './extra'; +export type { Hub } from './hub'; +export type { Integration, IntegrationClass } from './integration'; +export type { Mechanism } from './mechanism'; +export type { ExtractedNodeRequestData, Primitive, WorkerLocation } from './misc'; +export type { Options } from './options'; +export type { Package } from './package'; +export type { QueryParams, Request, SentryRequest, SentryRequestType } from './request'; +export type { Response } from './response'; +export type { Runtime } from './runtime'; +export type { CaptureContext, Scope, ScopeContext } from './scope'; +export type { SdkInfo } from './sdkinfo'; +export type { SdkMetadata } from './sdkmetadata'; +export type { SessionAggregates, AggregationCounts, Session, @@ -47,11 +47,11 @@ export { } from './session'; // eslint-disable-next-line deprecation/deprecation -export { Severity, SeverityLevel } from './severity'; -export { Span, SpanContext } from './span'; -export { StackFrame } from './stackframe'; -export { Stacktrace, StackParser, StackLineParser, StackLineParserFn } from './stacktrace'; -export { +export type { Severity, SeverityLevel } from './severity'; +export type { Span, SpanContext } from './span'; +export type { StackFrame } from './stackframe'; +export type { Stacktrace, StackParser, StackLineParser, StackLineParserFn } from './stacktrace'; +export type { CustomSamplingContext, Measurements, SamplingContext, @@ -61,7 +61,7 @@ export { TransactionMetadata, TransactionSamplingMethod, } from './transaction'; -export { Thread } from './thread'; -export { Outcome, Transport, TransportOptions, TransportClass } from './transport'; -export { User, UserFeedback } from './user'; -export { WrappedFunction } from './wrappedfunction'; +export type { Thread } from './thread'; +export type { Outcome, Transport, TransportOptions, TransportClass } from './transport'; +export type { User, UserFeedback } from './user'; +export type { WrappedFunction } from './wrappedfunction'; diff --git a/packages/vue/src/index.bundle.ts b/packages/vue/src/index.bundle.ts index 232ec67cd0c1..c2b744280372 100644 --- a/packages/vue/src/index.bundle.ts +++ b/packages/vue/src/index.bundle.ts @@ -1,4 +1,4 @@ -export { +export type { Breadcrumb, Request, SdkInfo, @@ -13,9 +13,10 @@ export { User, } from '@sentry/types'; +export type { BrowserOptions, ReportDialogOptions } from '@sentry/browser'; + export { BrowserClient, - BrowserOptions, defaultIntegrations, forceLoad, lastEventId, @@ -24,7 +25,6 @@ export { flush, close, wrap, - ReportDialogOptions, addGlobalEventProcessor, addBreadcrumb, captureException,