diff --git a/packages/browser/package.json b/packages/browser/package.json index 8938c47c01a6..c66cd1b9788a 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -16,7 +16,8 @@ }, "dependencies": { "@sentry/core": "0.5.4", - "@sentry/shim": "0.5.4" + "@sentry/shim": "0.5.4", + "@sentry/types": "0.5.4" }, "devDependencies": { "chai": "^4.1.2", diff --git a/packages/browser/src/backend.ts b/packages/browser/src/backend.ts index 0dce7ff2534d..43a562a335ad 100644 --- a/packages/browser/src/backend.ts +++ b/packages/browser/src/backend.ts @@ -1,10 +1,6 @@ import { Backend, Options, SentryError } from '@sentry/core'; -import { - addBreadcrumb, - captureEvent, - SentryEvent, - SentryException, -} from '@sentry/shim'; +import { addBreadcrumb, captureEvent } from '@sentry/shim'; +import { SentryEvent, SentryException } from '@sentry/types'; import { Raven, SendMethod } from './raven'; /** Original raven send function. */ diff --git a/packages/browser/src/client.ts b/packages/browser/src/client.ts index 3a25fd62d48e..69ce1084377b 100644 --- a/packages/browser/src/client.ts +++ b/packages/browser/src/client.ts @@ -1,5 +1,5 @@ import { BaseClient } from '@sentry/core'; -import { SdkInfo } from '@sentry/shim'; +import { SdkInfo } from '@sentry/types'; import { BrowserBackend, BrowserOptions } from './backend'; import { Raven } from './raven'; diff --git a/packages/browser/src/index.ts b/packages/browser/src/index.ts index 74e68096fb06..0b3bc3ffcd0c 100644 --- a/packages/browser/src/index.ts +++ b/packages/browser/src/index.ts @@ -10,7 +10,7 @@ export { Stacktrace, Thread, User, -} from '@sentry/shim'; +} from '@sentry/types'; export { addBreadcrumb, diff --git a/packages/browser/src/raven.ts b/packages/browser/src/raven.ts index 2d49b7cc0d93..22ae68af75be 100644 --- a/packages/browser/src/raven.ts +++ b/packages/browser/src/raven.ts @@ -1,4 +1,4 @@ -import { Breadcrumb, SentryEvent } from '@sentry/shim'; +import { Breadcrumb, SentryEvent } from '@sentry/types'; // tslint:disable-next-line:no-implicit-dependencies import * as RavenJS from 'raven-js'; diff --git a/packages/core/package.json b/packages/core/package.json index 70e5b37daff7..40d4c3bcdcef 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -15,7 +15,8 @@ "access": "public" }, "dependencies": { - "@sentry/shim": "0.5.4" + "@sentry/shim": "0.5.4", + "@sentry/types": "0.5.4" }, "devDependencies": { "chai": "^4.1.2", diff --git a/packages/core/src/base.ts b/packages/core/src/base.ts index c89d65523b38..eda4d7514e33 100644 --- a/packages/core/src/base.ts +++ b/packages/core/src/base.ts @@ -1,4 +1,4 @@ -import { Breadcrumb, Context, SdkInfo, SentryEvent } from '@sentry/shim'; +import { Breadcrumb, Context, SdkInfo, SentryEvent } from '@sentry/types'; import { DSN } from './dsn'; import { Backend, Client, Options, Scope } from './interfaces'; import { SendStatus } from './status'; diff --git a/packages/core/src/interfaces.ts b/packages/core/src/interfaces.ts index 2d04d0e7b58b..32c83ba5b92d 100644 --- a/packages/core/src/interfaces.ts +++ b/packages/core/src/interfaces.ts @@ -1,4 +1,4 @@ -import { Breadcrumb, Context, SentryEvent } from '@sentry/shim'; +import { Breadcrumb, Context, SentryEvent } from '@sentry/types'; import { DSN } from './dsn'; import { SendStatus } from './status'; diff --git a/packages/core/src/sdk.ts b/packages/core/src/sdk.ts index a4bf95cc5395..d52011aba8b2 100644 --- a/packages/core/src/sdk.ts +++ b/packages/core/src/sdk.ts @@ -1,4 +1,7 @@ -import * as Shim from '@sentry/shim'; +import { + bindClient as shimBindClient, + getCurrentClient as shimGetCurrentClient, +} from '@sentry/shim'; import { Client, Options } from './interfaces'; export { @@ -28,11 +31,11 @@ export function initAndBind( clientClass: ClientClass, options: O, ): void { - if (Shim.getCurrentClient()) { + if (shimGetCurrentClient()) { return; } const client = new clientClass(options); client.install(); - Shim.bindClient(client); + shimBindClient(client); } diff --git a/packages/node/package.json b/packages/node/package.json index 0309209e5428..44fb311656d2 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -17,6 +17,7 @@ "dependencies": { "@sentry/core": "0.5.4", "@sentry/shim": "0.5.4", + "@sentry/types": "0.5.4", "raven": "^2.6.0" }, "devDependencies": { diff --git a/packages/node/src/backend.ts b/packages/node/src/backend.ts index 87e5a738a826..e86bc432275d 100644 --- a/packages/node/src/backend.ts +++ b/packages/node/src/backend.ts @@ -1,5 +1,6 @@ import { Backend, DSN, Options, SentryError } from '@sentry/core'; -import { addBreadcrumb, captureEvent, SentryEvent } from '@sentry/shim'; +import { addBreadcrumb, captureEvent } from '@sentry/shim'; +import { SentryEvent } from '@sentry/types'; import { HTTPSTransport, HTTPTransport, diff --git a/packages/node/src/client.ts b/packages/node/src/client.ts index 98eb479bcabe..fdcba01394d4 100644 --- a/packages/node/src/client.ts +++ b/packages/node/src/client.ts @@ -1,5 +1,5 @@ import { BaseClient } from '@sentry/core'; -import { SdkInfo } from '@sentry/shim'; +import { SdkInfo } from '@sentry/types'; import { NodeBackend, NodeOptions } from './backend'; import { Raven } from './raven'; diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index 218d1b1c8a38..a27c87ad42b9 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -10,7 +10,7 @@ export { Stacktrace, Thread, User, -} from '@sentry/shim'; +} from '@sentry/types'; export { addBreadcrumb, diff --git a/packages/node/src/raven.ts b/packages/node/src/raven.ts index 95bbd4a1eabd..c7fee3b13c5a 100644 --- a/packages/node/src/raven.ts +++ b/packages/node/src/raven.ts @@ -1,4 +1,4 @@ -import { Breadcrumb, SentryEvent } from '@sentry/shim'; +import { Breadcrumb, SentryEvent } from '@sentry/types'; import * as RavenNode from 'raven'; export type SendMethod = (event: SentryEvent, cb?: (err: any) => void) => void; diff --git a/packages/shim/package.json b/packages/shim/package.json index d683409b7092..2f479c104398 100644 --- a/packages/shim/package.json +++ b/packages/shim/package.json @@ -14,6 +14,9 @@ "publishConfig": { "access": "public" }, + "dependencies": { + "@sentry/types": "0.5.4" + }, "devDependencies": { "chai": "^4.1.2", "jest": "^22.4.3", diff --git a/packages/shim/src/index.ts b/packages/shim/src/index.ts index be8e3d3d4959..b42cc2b6b2e1 100644 --- a/packages/shim/src/index.ts +++ b/packages/shim/src/index.ts @@ -10,7 +10,7 @@ export { Stacktrace, Thread, User, -} from './models'; +} from '@sentry/types'; export { _callOnClient, addBreadcrumb, diff --git a/packages/shim/src/sdk.ts b/packages/shim/src/sdk.ts index 180cc7a549e3..c58113c6c354 100644 --- a/packages/shim/src/sdk.ts +++ b/packages/shim/src/sdk.ts @@ -1,5 +1,5 @@ +import { Breadcrumb, SentryEvent, User } from '@sentry/types'; import { getGlobalRegistry } from './global'; -import { Breadcrumb, SentryEvent, User } from './models'; import { API_VERSION, Shim } from './shim'; /** Default callback used for catching async errors. */ diff --git a/packages/types/.npmignore b/packages/types/.npmignore new file mode 100644 index 000000000000..aa36c10c6872 --- /dev/null +++ b/packages/types/.npmignore @@ -0,0 +1,2 @@ +* +!/dist/**/* diff --git a/packages/types/LICENSE b/packages/types/LICENSE new file mode 100644 index 000000000000..862c9698194b --- /dev/null +++ b/packages/types/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2018 Sentry (https://sentry.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + + 2. 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. + + 3. Neither the name of the Sentry 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/types/README.md b/packages/types/README.md new file mode 100644 index 000000000000..ed475e2e4360 --- /dev/null +++ b/packages/types/README.md @@ -0,0 +1,14 @@ +

+ + + +
+

+ +# Sentry JavaScript SDK Types + +[![npm version](https://img.shields.io/npm/v/@sentry/types.svg)](https://www.npmjs.com/package/@sentry/types) +[![npm dm](https://img.shields.io/npm/dm/@sentry/types.svg)](https://www.npmjs.com/package/@sentry/types) +[![npm dt](https://img.shields.io/npm/dt/@sentry/types.svg)](https://www.npmjs.com/package/@sentry/types) + +Common types used by the Sentry JavaScript SDKs. diff --git a/packages/types/package.json b/packages/types/package.json new file mode 100644 index 000000000000..99d6d12e64a1 --- /dev/null +++ b/packages/types/package.json @@ -0,0 +1,33 @@ +{ + "name": "@sentry/types", + "version": "0.5.4", + "description": "Types for all Sentry JavaScript SDKs", + "repository": "git://github.com/getsentry/raven-js.git", + "homepage": "https://github.com/getsentry/raven-js/tree/next/packages/types", + "author": "Sentry", + "license": "BSD-3-Clause", + "engines": { + "node": ">=6" + }, + "main": "dist/index.js", + "types": "dist/index.d.ts", + "publishConfig": { + "access": "public" + }, + "devDependencies": { + "npm-run-all": "^4.1.2", + "prettier": "^1.12.1", + "prettier-check": "^2.0.0", + "tslint": "^5.9.1", + "typescript": "^2.8.3" + }, + "scripts": { + "build": "tsc -p tsconfig.build.json", + "lint": "run-s lint:prettier lint:tslint", + "lint:prettier": "prettier-check '{src,test}/**/*.ts'", + "lint:tslint": "tslint -t stylish -p .", + "fix": "run-s fix:tslint fix:prettier", + "fix:prettier": "prettier --write '{src,test}/**/*.ts'", + "fix:tslint": "tslint --fix -t stylish -p ." + } +} diff --git a/packages/shim/src/models.ts b/packages/types/src/index.ts similarity index 100% rename from packages/shim/src/models.ts rename to packages/types/src/index.ts diff --git a/packages/types/tsconfig.build.json b/packages/types/tsconfig.build.json new file mode 100644 index 000000000000..c0816d87b819 --- /dev/null +++ b/packages/types/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "outDir": "dist", + "rootDir": "src" + }, + "include": ["src/**/*.ts"] +} diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json new file mode 100644 index 000000000000..3f9fafbd5678 --- /dev/null +++ b/packages/types/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.build.json", + "include": ["src/**/*.ts"], + "exclude": ["dist"], + "compilerOptions": { + "rootDir": ".", + "types": ["node"], + "plugins": [{ "name": "tslint-language-service" }] + } +} diff --git a/packages/types/tslint.json b/packages/types/tslint.json new file mode 100644 index 000000000000..3016a27a85cc --- /dev/null +++ b/packages/types/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "@sentry/typescript/tslint" +} diff --git a/packages/utils/package.json b/packages/utils/package.json index bc73f8f4976a..217b27c0e1d9 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -14,6 +14,9 @@ "publishConfig": { "access": "public" }, + "dependencies": { + "@sentry/types": "0.5.4" + }, "devDependencies": { "chai": "^4.1.2", "jest": "^22.4.3",