diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f1b98f430a9..dcd8824f2d79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,26 +20,26 @@ ## 7.0.0-alpha.0 -- **breaking** feat: Drop support for Node 6 (#4851) -- **breaking** feat: Remove references to @sentry/apm (#4845) -- **breaking** feat: Delete deprecated startSpan and child methods (#4849) -- **breaking** feat(bundles): Stop publishing CDN bundles on npm (#4901) -- **breaking** ref(build): Rename dist directories to cjs (#4900) -- **breaking** ref(build): Update to TypeScript 3.8.3 (#4895) -- **breaking** feat(browser): Remove top level eventbuilder exports (#4887) -- **breaking** feat(core): Delete API class (#4848) -- **breaking** feat(core): Remove whitelistUrls/blacklistUrls (#4850) -- **breaking** feat(gatsby): Remove Sentry from window (#4857) -- **breaking** feat(hub): Remove getActiveDomain (#4858) -- **breaking** feat(hub): Remove setTransaction scope method (#4865) -- **breaking** feat(integrations): Remove old angular, ember, and vue integrations (#4893) -- **breaking** feat(node): Remove deprecated frameContextLines (#4884) -- **breaking** feat(tracing): Rename registerRequestInstrumentation -> instrumentOutgoingRequests (#4859) -- **breaking** feat(types): Remove deprecated user dsn field (#4864) -- **breaking** feat(types): Delete RequestSessionStatus enum (#4889) -- **breaking** feat(types): Delete Status enum (#4891) -- **breaking** feat(types): Delete SessionStatus enum (#4890) -- +- **(breaking)** feat: Drop support for Node 6 (#4851) +- **(breaking)** feat: Remove references to @sentry/apm (#4845) +- **(breaking)** feat: Delete deprecated startSpan and child methods (#4849) +- **(breaking)** feat(bundles): Stop publishing CDN bundles on npm (#4901) +- **(breaking)** ref(build): Rename dist directories to cjs (#4900) +- **(breaking)** ref(build): Update to TypeScript 3.8.3 (#4895) +- **(breaking)** feat(browser): Remove top level eventbuilder exports (#4887) +- **(breaking)** feat(core): Delete API class (#4848) +- **(breaking)** feat(core): Remove whitelistUrls/blacklistUrls (#4850) +- **(breaking)** feat(gatsby): Remove Sentry from window (#4857) +- **(breaking)** feat(hub): Remove getActiveDomain (#4858) +- **(breaking)** feat(hub): Remove setTransaction scope method (#4865) +- **(breaking)** feat(integrations): Remove old angular, ember, and vue integrations (#4893) +- **(breaking)** feat(node): Remove deprecated frameContextLines (#4884) +- **(breaking)** feat(tracing): Rename registerRequestInstrumentation -> instrumentOutgoingRequests (#4859) +- **(breaking)** feat(types): Remove deprecated user dsn field (#4864) +- **(breaking)** feat(types): Delete RequestSessionStatus enum (#4889) +- **(breaking)** feat(types): Delete Status enum (#4891) +- **(breaking)** feat(types): Delete SessionStatus enum (#4890) + ## 6.19.7 - fix(react): Add children prop type to ErrorBoundary component (#4966) diff --git a/MIGRATION.md b/MIGRATION.md index 3c5b999f11a3..0a1141cf5cac 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -10,6 +10,28 @@ Node.js version 6 has reached end of life in April 2019. For Sentry JavaScript S As far as SDK development goes, dropping support means no longer running integration tests for Node.js version 6, and also no longer handling edge cases specific to version 6. Running the new SDK version on Node.js v6 is therefore highly discouraged. +## Removal of `@sentry/minimal` + +The `@sentry/minimal` package was deleted and it's functionality was moved to `@sentry/hub`. All exports from `@sentry/minimal` should be avaliable in `@sentry/hub` other than `_callOnClient` function which was removed. + +```ts +// New in v7: +import { + addBreadcrumb, + captureException, + configureScope, + setTag, +} from '@sentry/hub'; + +// Before: +import { + addBreadcrumb, + captureException, + configureScope, + setTag, +} from '@sentry/minimal'; +``` + ## Removal Of Old Platform Integrations From `@sentry/integrations` Package The following classes will be removed from the `@sentry/integrations` package and can no longer be used: diff --git a/README.md b/README.md index 84e46f6b362a..369c363e3599 100644 --- a/README.md +++ b/README.md @@ -104,8 +104,6 @@ below: extensions for Performance Monitoring / Tracing - [`@sentry/hub`](https://github.com/getsentry/sentry-javascript/tree/master/packages/hub): Global state management of SDKs -- [`@sentry/minimal`](https://github.com/getsentry/sentry-javascript/tree/master/packages/minimal): Minimal SDK for - library authors to add Sentry support - [`@sentry/core`](https://github.com/getsentry/sentry-javascript/tree/master/packages/core): The base for all JavaScript SDKs with interfaces, type definitions and base classes. - [`@sentry/utils`](https://github.com/getsentry/sentry-javascript/tree/master/packages/utils): A set of helpers and diff --git a/package.json b/package.json index 6edf51939fc1..ab2d3e224bfc 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,6 @@ "packages/hub", "packages/integration-tests", "packages/integrations", - "packages/minimal", "packages/nextjs", "packages/node", "packages/node-integration-tests", diff --git a/packages/core/package.json b/packages/core/package.json index 8a53ffca97e3..737007cf648b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -17,7 +17,6 @@ }, "dependencies": { "@sentry/hub": "7.0.0-alpha.1", - "@sentry/minimal": "7.0.0-alpha.1", "@sentry/types": "7.0.0-alpha.1", "@sentry/utils": "7.0.0-alpha.1", "tslib": "^1.9.3" diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index f5932bdbeaa4..0cd660fdd6b4 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -15,8 +15,14 @@ export { setTags, setUser, withScope, -} from '@sentry/minimal'; -export { addGlobalEventProcessor, getCurrentHub, getHubFromCarrier, Hub, makeMain, Scope, Session } from '@sentry/hub'; + addGlobalEventProcessor, + getCurrentHub, + getHubFromCarrier, + Hub, + makeMain, + Scope, + Session, +} from '@sentry/hub'; export { getEnvelopeEndpointWithUrlEncodedAuth, getStoreEndpointWithUrlEncodedAuth, diff --git a/packages/core/test/mocks/integration.ts b/packages/core/test/mocks/integration.ts index 8b95b5673af8..2e192fb12227 100644 --- a/packages/core/test/mocks/integration.ts +++ b/packages/core/test/mocks/integration.ts @@ -1,5 +1,4 @@ -import { getCurrentHub } from '@sentry/hub'; -import { configureScope } from '@sentry/minimal'; +import { configureScope, getCurrentHub } from '@sentry/hub'; import { Event, EventProcessor, Integration } from '@sentry/types'; export class TestIntegration implements Integration { diff --git a/packages/minimal/src/index.ts b/packages/hub/src/exports.ts similarity index 61% rename from packages/minimal/src/index.ts rename to packages/hub/src/exports.ts index 7cb0271786ab..451b2b13e9ed 100644 --- a/packages/minimal/src/index.ts +++ b/packages/hub/src/exports.ts @@ -1,4 +1,3 @@ -import { getCurrentHub, Hub, Scope } from '@sentry/hub'; import { Breadcrumb, CaptureContext, @@ -9,25 +8,19 @@ import { Primitive, Severity, SeverityLevel, - Transaction, TransactionContext, User, } from '@sentry/types'; -/** - * This calls a function on the current hub. - * @param method function to call on hub. - * @param args to pass to function. - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function callOnHub(method: string, ...args: any[]): T { - const hub = getCurrentHub(); - if (hub && hub[method as keyof Hub]) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return (hub[method as keyof Hub] as any)(...args); - } - throw new Error(`No hub defined or ${method} was not found on the hub, please open a bug report.`); -} +import { getCurrentHub, Hub } from './hub'; +import { Scope } from './scope'; + +// Note: All functions in this file are typed with a return value of `ReturnType`, +// where HUB_FUNCTION is some method on the Hub class. +// +// This is done to make sure the top level SDK methods stay in sync with the hub methods. +// Although every method here has an explicit return type, some of them (that map to void returns) do not +// contain `return` keywords. This is done to save on bundle size, as `return` is not minifiable. /** * Captures an exception event and sends it to Sentry. @@ -36,14 +29,8 @@ function callOnHub(method: string, ...args: any[]): T { * @returns The generated eventId. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types -export function captureException(exception: any, captureContext?: CaptureContext): string { - const syntheticException = new Error('Sentry syntheticException'); - - return callOnHub('captureException', exception, { - captureContext, - originalException: exception, - syntheticException, - }); +export function captureException(exception: any, captureContext?: CaptureContext): ReturnType { + return getCurrentHub().captureException(exception, { captureContext }); } /** @@ -57,19 +44,12 @@ export function captureMessage( message: string, // eslint-disable-next-line deprecation/deprecation captureContext?: CaptureContext | Severity | SeverityLevel, -): string { - const syntheticException = new Error(message); - +): ReturnType { // This is necessary to provide explicit scopes upgrade, without changing the original // arity of the `captureMessage(message, level)` method. const level = typeof captureContext === 'string' ? captureContext : undefined; const context = typeof captureContext !== 'string' ? { captureContext } : undefined; - - return callOnHub('captureMessage', message, level, { - originalException: message, - syntheticException, - ...context, - }); + return getCurrentHub().captureMessage(message, level, context); } /** @@ -78,16 +58,16 @@ export function captureMessage( * @param event The event to send to Sentry. * @returns The generated eventId. */ -export function captureEvent(event: Event): string { - return callOnHub('captureEvent', event); +export function captureEvent(event: Event): ReturnType { + return getCurrentHub().captureEvent(event); } /** * Callback to set context information onto the scope. * @param callback Callback function that receives Scope. */ -export function configureScope(callback: (scope: Scope) => void): void { - callOnHub('configureScope', callback); +export function configureScope(callback: (scope: Scope) => void): ReturnType { + getCurrentHub().configureScope(callback); } /** @@ -98,8 +78,8 @@ export function configureScope(callback: (scope: Scope) => void): void { * * @param breadcrumb The breadcrumb to record. */ -export function addBreadcrumb(breadcrumb: Breadcrumb): void { - callOnHub('addBreadcrumb', breadcrumb); +export function addBreadcrumb(breadcrumb: Breadcrumb): ReturnType { + getCurrentHub().addBreadcrumb(breadcrumb); } /** @@ -108,33 +88,33 @@ export function addBreadcrumb(breadcrumb: Breadcrumb): void { * @param context Any kind of data. This data will be normalized. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -export function setContext(name: string, context: { [key: string]: any } | null): void { - callOnHub('setContext', name, context); +export function setContext(name: string, context: { [key: string]: any } | null): ReturnType { + getCurrentHub().setContext(name, context); } /** * Set an object that will be merged sent as extra data with the event. * @param extras Extras object to merge into current context. */ -export function setExtras(extras: Extras): void { - callOnHub('setExtras', extras); +export function setExtras(extras: Extras): ReturnType { + getCurrentHub().setExtras(extras); } /** - * Set an object that will be merged sent as tags data with the event. - * @param tags Tags context object to merge into current context. + * Set key:value that will be sent as extra data with the event. + * @param key String of extra + * @param extra Any kind of data. This data will be normalized. */ -export function setTags(tags: { [key: string]: Primitive }): void { - callOnHub('setTags', tags); +export function setExtra(key: string, extra: Extra): ReturnType { + getCurrentHub().setExtra(key, extra); } /** - * Set key:value that will be sent as extra data with the event. - * @param key String of extra - * @param extra Any kind of data. This data will be normalized. + * Set an object that will be merged sent as tags data with the event. + * @param tags Tags context object to merge into current context. */ -export function setExtra(key: string, extra: Extra): void { - callOnHub('setExtra', key, extra); +export function setTags(tags: { [key: string]: Primitive }): ReturnType { + getCurrentHub().setTags(tags); } /** @@ -145,8 +125,8 @@ export function setExtra(key: string, extra: Extra): void { * @param key String key of tag * @param value Value of tag */ -export function setTag(key: string, value: Primitive): void { - callOnHub('setTag', key, value); +export function setTag(key: string, value: Primitive): ReturnType { + getCurrentHub().setTag(key, value); } /** @@ -154,8 +134,8 @@ export function setTag(key: string, value: Primitive): void { * * @param user User context object to be set in the current context. Pass `null` to unset the user. */ -export function setUser(user: User | null): void { - callOnHub('setUser', user); +export function setUser(user: User | null): ReturnType { + getCurrentHub().setUser(user); } /** @@ -171,23 +151,8 @@ export function setUser(user: User | null): void { * * @param callback that will be enclosed into push/popScope. */ -export function withScope(callback: (scope: Scope) => void): void { - callOnHub('withScope', callback); -} - -/** - * Calls a function on the latest client. Use this with caution, it's meant as - * in "internal" helper so we don't need to expose every possible function in - * the shim. It is not guaranteed that the client actually implements the - * function. - * - * @param method The method to call on the client/client. - * @param args Arguments to pass to the client/fontend. - * @hidden - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export function _callOnClient(method: string, ...args: any[]): void { - callOnHub('_invokeClient', method, ...args); +export function withScope(callback: (scope: Scope) => void): ReturnType { + getCurrentHub().withScope(callback); } /** @@ -210,6 +175,6 @@ export function _callOnClient(method: string, ...args: any[]): void { export function startTransaction( context: TransactionContext, customSamplingContext?: CustomSamplingContext, -): Transaction { - return callOnHub('startTransaction', { ...context }, customSamplingContext); +): ReturnType { + return getCurrentHub().startTransaction({ ...context }, customSamplingContext); } diff --git a/packages/hub/src/hub.ts b/packages/hub/src/hub.ts index 74a810fafeea..4e97cd8aa9b3 100644 --- a/packages/hub/src/hub.ts +++ b/packages/hub/src/hub.ts @@ -185,27 +185,10 @@ export class Hub implements HubInterface { // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types public captureException(exception: any, hint?: EventHint): string { const eventId = (this._lastEventId = hint && hint.event_id ? hint.event_id : uuid4()); - let finalHint = hint; - - // If there's no explicit hint provided, mimic the same thing that would happen - // in the minimal itself to create a consistent behavior. - // We don't do this in the client, as it's the lowest level API, and doing this, - // would prevent user from having full control over direct calls. - if (!hint) { - let syntheticException: Error; - try { - throw new Error('Sentry syntheticException'); - } catch (exception) { - syntheticException = exception as Error; - } - finalHint = { - originalException: exception, - syntheticException, - }; - } - this._invokeClient('captureException', exception, { - ...finalHint, + originalException: exception, + syntheticException: new Error('Sentry syntheticException'), + ...hint, event_id: eventId, }); return eventId; @@ -221,27 +204,10 @@ export class Hub implements HubInterface { hint?: EventHint, ): string { const eventId = (this._lastEventId = hint && hint.event_id ? hint.event_id : uuid4()); - let finalHint = hint; - - // If there's no explicit hint provided, mimic the same thing that would happen - // in the minimal itself to create a consistent behavior. - // We don't do this in the client, as it's the lowest level API, and doing this, - // would prevent user from having full control over direct calls. - if (!hint) { - let syntheticException: Error; - try { - throw new Error(message); - } catch (exception) { - syntheticException = exception as Error; - } - finalHint = { - originalException: message, - syntheticException, - }; - } - this._invokeClient('captureMessage', message, level, { - ...finalHint, + originalException: message, + syntheticException: new Error(message), + ...hint, event_id: eventId, }); return eventId; diff --git a/packages/hub/src/index.ts b/packages/hub/src/index.ts index 16c99ec7bc89..92b85f370d80 100644 --- a/packages/hub/src/index.ts +++ b/packages/hub/src/index.ts @@ -4,3 +4,18 @@ export { addGlobalEventProcessor, Scope } from './scope'; export { Session } from './session'; export { SessionFlusher } from './sessionflusher'; export { getCurrentHub, getHubFromCarrier, getMainCarrier, Hub, makeMain, setHubOnCarrier } from './hub'; +export { + addBreadcrumb, + captureException, + captureEvent, + captureMessage, + configureScope, + startTransaction, + setContext, + setExtra, + setExtras, + setTag, + setTags, + setUser, + withScope, +} from './exports'; diff --git a/packages/minimal/test/lib/minimal.test.ts b/packages/hub/test/exports.test.ts similarity index 94% rename from packages/minimal/test/lib/minimal.test.ts rename to packages/hub/test/exports.test.ts index 48a117cd5c5d..91b7450b66eb 100644 --- a/packages/minimal/test/lib/minimal.test.ts +++ b/packages/hub/test/exports.test.ts @@ -1,7 +1,5 @@ -import { getCurrentHub, getHubFromCarrier, Scope } from '@sentry/hub'; - +import { getCurrentHub, getHubFromCarrier, Scope } from '../src'; import { - _callOnClient, captureEvent, captureException, captureMessage, @@ -13,13 +11,30 @@ import { setTags, setUser, withScope, -} from '../../src'; -import { init, TestClient, TestClient2 } from '../mocks/client'; +} from '../src/exports'; + +export class TestClient { + public static instance?: TestClient; + + public constructor(public options: Record) { + TestClient.instance = this; + } + + public mySecretPublicMethod(str: string): string { + return `secret: ${str}`; + } +} + +export class TestClient2 {} + +export function init(options: Record): void { + getCurrentHub().bindClient(new TestClient(options) as any); +} // eslint-disable-next-line no-var declare var global: any; -describe('Minimal', () => { +describe('Top Level API', () => { beforeEach(() => { global.__SENTRY__ = { hub: undefined, @@ -196,17 +211,6 @@ describe('Minimal', () => { expect(getCurrentHub().getClient()).toBe(TestClient.instance); }); - test('Calls function on the client', done => { - const s = jest.spyOn(TestClient.prototype, 'mySecretPublicMethod'); - getCurrentHub().withScope(() => { - getCurrentHub().bindClient(new TestClient({}) as any); - _callOnClient('mySecretPublicMethod', 'test'); - expect(s.mock.calls[0][0]).toBe('test'); - s.mockRestore(); - done(); - }); - }); - test('does not throw an error when pushing different clients', () => { init({}); expect(() => { diff --git a/packages/minimal/.eslintrc.js b/packages/minimal/.eslintrc.js deleted file mode 100644 index 5a2cc7f1ec08..000000000000 --- a/packages/minimal/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - extends: ['../../.eslintrc.js'], -}; diff --git a/packages/minimal/LICENSE b/packages/minimal/LICENSE deleted file mode 100644 index 8b42db873c95..000000000000 --- a/packages/minimal/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2019, Sentry -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/minimal/README.md b/packages/minimal/README.md deleted file mode 100644 index 4204f58846d4..000000000000 --- a/packages/minimal/README.md +++ /dev/null @@ -1,63 +0,0 @@ -

- - - -
-

- -# Sentry JavaScript SDK Minimal - -[![npm version](https://img.shields.io/npm/v/@sentry/minimal.svg)](https://www.npmjs.com/package/@sentry/minimal) -[![npm dm](https://img.shields.io/npm/dm/@sentry/minimal.svg)](https://www.npmjs.com/package/@sentry/minimal) -[![npm dt](https://img.shields.io/npm/dt/@sentry/minimal.svg)](https://www.npmjs.com/package/@sentry/minimal) -[![typedoc](https://img.shields.io/badge/docs-typedoc-blue.svg)](http://getsentry.github.io/sentry-javascript/) - -## Links - -- [Official SDK Docs](https://docs.sentry.io/quickstart/) -- [TypeDoc](http://getsentry.github.io/sentry-javascript/) - -## General - -A minimal Sentry SDK that uses a configured client when embedded into an application. It allows library authors add -support for a Sentry SDK without having to bundle the entire SDK or being dependent on a specific platform. If the user -is using Sentry in their application and your library uses `@sentry/minimal`, the user receives all -breadcrumbs/messages/events you added to your libraries codebase. - -## Usage - -To use the minimal, you do not have to initialize an SDK. This should be handled by the user of your library. Instead, -directly use the exported functions of `@sentry/minimal` to add breadcrumbs or capture events: - -```javascript -import * as Sentry from '@sentry/minimal'; - -// Add a breadcrumb for future events -Sentry.addBreadcrumb({ - message: 'My Breadcrumb', - // ... -}); - -// Capture exceptions, messages or manual events -Sentry.captureMessage('Hello, world!'); -Sentry.captureException(new Error('Good bye')); -Sentry.captureEvent({ - message: 'Manual', - stacktrace: [ - // ... - ], -}); -``` - -Note that while strictly possible, it is discouraged to interfere with the event context. If for some reason your -library needs to inject context information, beware that this might override the user's context values: - -```javascript -// Set user information, as well as tags and further extras -Sentry.configureScope(scope => { - scope.setExtra('battery', 0.7); - scope.setTag('user_mode', 'admin'); - scope.setUser({ id: '4711' }); - // scope.clear(); -}); -``` diff --git a/packages/minimal/test/mocks/client.ts b/packages/minimal/test/mocks/client.ts deleted file mode 100644 index 813fd694c38a..000000000000 --- a/packages/minimal/test/mocks/client.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { getCurrentHub } from '@sentry/hub'; - -export class TestClient { - public static instance?: TestClient; - - public constructor(public options: Record) { - TestClient.instance = this; - } - - public mySecretPublicMethod(str: string): string { - return `secret: ${str}`; - } -} - -export class TestClient2 {} - -export function init(options: Record): void { - getCurrentHub().bindClient(new TestClient(options) as any); -} diff --git a/packages/minimal/tsconfig.esm.json b/packages/minimal/tsconfig.esm.json deleted file mode 100644 index 0b86c52918cc..000000000000 --- a/packages/minimal/tsconfig.esm.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.json", - - "compilerOptions": { - "module": "es6", - "outDir": "build/esm" - } -} diff --git a/packages/minimal/tsconfig.json b/packages/minimal/tsconfig.json deleted file mode 100644 index bf45a09f2d71..000000000000 --- a/packages/minimal/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - - "include": ["src/**/*"], - - "compilerOptions": { - // package-specific options - } -} diff --git a/packages/minimal/tsconfig.test.json b/packages/minimal/tsconfig.test.json deleted file mode 100644 index 87f6afa06b86..000000000000 --- a/packages/minimal/tsconfig.test.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "./tsconfig.json", - - "include": ["test/**/*"], - - "compilerOptions": { - // should include all types from `./tsconfig.json` plus types for all test frameworks used - "types": ["node", "jest"] - - // other package-specific, test-specific options - } -} diff --git a/packages/minimal/tsconfig.types.json b/packages/minimal/tsconfig.types.json deleted file mode 100644 index 65455f66bd75..000000000000 --- a/packages/minimal/tsconfig.types.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - - "compilerOptions": { - "declaration": true, - "declarationMap": true, - "emitDeclarationOnly": true, - "outDir": "build/types" - } -} diff --git a/packages/nextjs/test/integration/package.json b/packages/nextjs/test/integration/package.json index 5523ee933d20..2d8588dbf1a3 100644 --- a/packages/nextjs/test/integration/package.json +++ b/packages/nextjs/test/integration/package.json @@ -28,7 +28,6 @@ "@sentry/core": "file:../../../core", "@sentry/hub": "file:../../../hub", "@sentry/integrations": "file:../../../integrations", - "@sentry/minimal": "file:../../../minimal", "@sentry/node": "file:../../../node", "@sentry/react": "file:../../../react", "@sentry/tracing": "file:../../../tracing", diff --git a/packages/node/test/handlers.test.ts b/packages/node/test/handlers.test.ts index a423a92aa3d0..57f6528139f9 100644 --- a/packages/node/test/handlers.test.ts +++ b/packages/node/test/handlers.test.ts @@ -374,24 +374,21 @@ describe('tracingHandler', () => { const tracesSampler = jest.fn(); const options = getDefaultNodeClientOptions({ tracesSampler }); const hub = new Hub(new NodeClient(options)); - // we need to mock both of these because the tracing handler relies on `@sentry/core` while the sampler relies on - // `@sentry/hub`, and mocking breaks the link between the two - jest.spyOn(sentryCore, 'getCurrentHub').mockReturnValue(hub); - jest.spyOn(sentryHub, 'getCurrentHub').mockReturnValue(hub); - - sentryTracingMiddleware(req, res, next); - - expect(tracesSampler).toHaveBeenCalledWith( - expect.objectContaining({ - request: { - headers, - method, - url: `http://${hostname}${path}?${queryString}`, - cookies: { favorite: 'zukes' }, - query_string: queryString, - }, - }), - ); + hub.run(() => { + sentryTracingMiddleware(req, res, next); + + expect(tracesSampler).toHaveBeenCalledWith( + expect.objectContaining({ + request: { + headers, + method, + url: `http://${hostname}${path}?${queryString}`, + cookies: { favorite: 'zukes' }, + query_string: queryString, + }, + }), + ); + }); }); it('puts its transaction on the scope', () => { @@ -773,13 +770,13 @@ describe('errorHandler()', () => { const hub = new Hub(client, scope); jest.spyOn(client, '_captureRequestSession'); - jest.spyOn(sentryCore, 'getCurrentHub').mockReturnValue(hub); - jest.spyOn(sentryHub, 'getCurrentHub').mockReturnValue(hub); - scope?.setRequestSession({ status: 'ok' }); - sentryErrorMiddleware({ name: 'error', message: 'this is an error' }, req, res, next); - const requestSession = scope?.getRequestSession(); - expect(requestSession).toEqual({ status: 'crashed' }); + hub.run(() => { + scope?.setRequestSession({ status: 'ok' }); + sentryErrorMiddleware({ name: 'error', message: 'this is an error' }, req, res, next); + const requestSession = scope?.getRequestSession(); + expect(requestSession).toEqual({ status: 'crashed' }); + }); }); it('when autoSessionTracking is enabled, should not set requestSession status on Crash when it occurs outside the bounds of a request', () => { diff --git a/packages/react/package.json b/packages/react/package.json index 2fea1d64d5be..0365a6968bc5 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -17,7 +17,6 @@ }, "dependencies": { "@sentry/browser": "7.0.0-alpha.1", - "@sentry/minimal": "7.0.0-alpha.1", "@sentry/types": "7.0.0-alpha.1", "@sentry/utils": "7.0.0-alpha.1", "hoist-non-react-statics": "^3.3.2", diff --git a/packages/react/src/redux.ts b/packages/react/src/redux.ts index e1d0f42c3046..eb67a0a05a7f 100644 --- a/packages/react/src/redux.ts +++ b/packages/react/src/redux.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { configureScope } from '@sentry/minimal'; +import { configureScope } from '@sentry/browser'; import { Scope } from '@sentry/types'; interface Action { diff --git a/packages/react/test/redux.test.ts b/packages/react/test/redux.test.ts index 55729ddc860b..9c75bc944d91 100644 --- a/packages/react/test/redux.test.ts +++ b/packages/react/test/redux.test.ts @@ -1,4 +1,4 @@ -import * as Sentry from '@sentry/minimal'; +import * as Sentry from '@sentry/browser'; import { Scope } from '@sentry/types'; import * as Redux from 'redux'; @@ -7,7 +7,8 @@ import { createReduxEnhancer } from '../src/redux'; const mockAddBreadcrumb = jest.fn(); const mockSetContext = jest.fn(); -jest.mock('@sentry/minimal', () => ({ +jest.mock('@sentry/browser', () => ({ + ...jest.requireActual('@sentry/browser'), configureScope: (callback: (scope: any) => Partial) => callback({ addBreadcrumb: mockAddBreadcrumb, diff --git a/packages/serverless/package.json b/packages/serverless/package.json index d77177b66c1a..c7a83cfdaa20 100644 --- a/packages/serverless/package.json +++ b/packages/serverless/package.json @@ -16,7 +16,6 @@ "access": "public" }, "dependencies": { - "@sentry/minimal": "7.0.0-alpha.1", "@sentry/node": "7.0.0-alpha.1", "@sentry/tracing": "7.0.0-alpha.1", "@sentry/types": "7.0.0-alpha.1", diff --git a/packages/tracing/package.json b/packages/tracing/package.json index f9465746e0e0..8d4225dfdbe6 100644 --- a/packages/tracing/package.json +++ b/packages/tracing/package.json @@ -17,7 +17,6 @@ }, "dependencies": { "@sentry/hub": "7.0.0-alpha.1", - "@sentry/minimal": "7.0.0-alpha.1", "@sentry/types": "7.0.0-alpha.1", "@sentry/utils": "7.0.0-alpha.1", "tslib": "^1.9.3" diff --git a/packages/vue/package.json b/packages/vue/package.json index b6eefc1ab6f3..406f335f05de 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -18,7 +18,6 @@ "dependencies": { "@sentry/browser": "7.0.0-alpha.1", "@sentry/core": "7.0.0-alpha.1", - "@sentry/minimal": "7.0.0-alpha.1", "@sentry/types": "7.0.0-alpha.1", "@sentry/utils": "7.0.0-alpha.1", "tslib": "^1.9.3" diff --git a/rollup/plugins/bundlePlugins.js b/rollup/plugins/bundlePlugins.js index 17c8d5977044..c678152a7b63 100644 --- a/rollup/plugins/bundlePlugins.js +++ b/rollup/plugins/bundlePlugins.js @@ -109,7 +109,6 @@ export function makeTSPlugin(jsVersion) { '@sentry/browser': ['../browser/src'], '@sentry/core': ['../core/src'], '@sentry/hub': ['../hub/src'], - '@sentry/minimal': ['../minimal/src'], '@sentry/types': ['../types/src'], '@sentry/utils': ['../utils/src'], }, diff --git a/yarn.lock b/yarn.lock index 2d280ea21e26..1bf0c3d2554b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8527,11 +8527,21 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30001032, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001173, caniuse-lite@^1.0.30001179, caniuse-lite@^1.0.30001254, caniuse-lite@^1.0.30001274, caniuse-lite@^1.0.30001280, caniuse-lite@^1.0.30001317: +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30001173, caniuse-lite@^1.0.30001179, caniuse-lite@^1.0.30001254: + version "1.0.30001257" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001257.tgz#150aaf649a48bee531104cfeda57f92ce587f6e5" + integrity sha512-JN49KplOgHSXpIsVSF+LUyhD8PUp6xPpAXeRrrcBh4KBeP7W864jHn6RvzJgDlrReyeVjMFJL3PLpPvKIxlIHA== + +caniuse-lite@^1.0.30001032, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001280, caniuse-lite@^1.0.30001317: version "1.0.30001332" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001332.tgz#39476d3aa8d83ea76359c70302eafdd4a1d727dd" integrity sha512-10T30NYOEQtN6C11YGg411yebhvpnC6Z102+B95eAsN0oB6KUs01ivE8u+G6FMIRtIrVlYXhL+LUwQ3/hXwDWw== +caniuse-lite@^1.0.30001274: + version "1.0.30001279" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001279.tgz#eb06818da481ef5096a3b3760f43e5382ed6b0ce" + integrity sha512-VfEHpzHEXj6/CxggTwSFoZBBYGQfQv9Cf42KPlO79sWXCD1QNKWKsKzFeWL7QpZHJQYAvocqV6Rty1yJMkqWLQ== + canonical-path@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/canonical-path/-/canonical-path-1.0.0.tgz#fcb470c23958def85081856be7a86e904f180d1d"