Skip to content

Commit b394c73

Browse files
authored
feat(types): Introduce @sentry/types package (#1332)
* feat(types): Introduce @sentry/types package * feat(types): Remove redundant package-lock.json
1 parent 84afef5 commit b394c73

26 files changed

+129
-22
lines changed

packages/browser/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
},
1717
"dependencies": {
1818
"@sentry/core": "0.5.4",
19-
"@sentry/shim": "0.5.4"
19+
"@sentry/shim": "0.5.4",
20+
"@sentry/types": "0.5.4"
2021
},
2122
"devDependencies": {
2223
"chai": "^4.1.2",

packages/browser/src/backend.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { Backend, Options, SentryError } from '@sentry/core';
2-
import {
3-
addBreadcrumb,
4-
captureEvent,
5-
SentryEvent,
6-
SentryException,
7-
} from '@sentry/shim';
2+
import { addBreadcrumb, captureEvent } from '@sentry/shim';
3+
import { SentryEvent, SentryException } from '@sentry/types';
84
import { Raven, SendMethod } from './raven';
95

106
/** Original raven send function. */

packages/browser/src/client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { BaseClient } from '@sentry/core';
2-
import { SdkInfo } from '@sentry/shim';
2+
import { SdkInfo } from '@sentry/types';
33
import { BrowserBackend, BrowserOptions } from './backend';
44
import { Raven } from './raven';
55

packages/browser/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export {
1010
Stacktrace,
1111
Thread,
1212
User,
13-
} from '@sentry/shim';
13+
} from '@sentry/types';
1414

1515
export {
1616
addBreadcrumb,

packages/browser/src/raven.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Breadcrumb, SentryEvent } from '@sentry/shim';
1+
import { Breadcrumb, SentryEvent } from '@sentry/types';
22
// tslint:disable-next-line:no-implicit-dependencies
33
import * as RavenJS from 'raven-js';
44

packages/core/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"access": "public"
1616
},
1717
"dependencies": {
18-
"@sentry/shim": "0.5.4"
18+
"@sentry/shim": "0.5.4",
19+
"@sentry/types": "0.5.4"
1920
},
2021
"devDependencies": {
2122
"chai": "^4.1.2",

packages/core/src/base.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Breadcrumb, Context, SdkInfo, SentryEvent } from '@sentry/shim';
1+
import { Breadcrumb, Context, SdkInfo, SentryEvent } from '@sentry/types';
22
import { DSN } from './dsn';
33
import { Backend, Client, Options, Scope } from './interfaces';
44
import { SendStatus } from './status';

packages/core/src/interfaces.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Breadcrumb, Context, SentryEvent } from '@sentry/shim';
1+
import { Breadcrumb, Context, SentryEvent } from '@sentry/types';
22
import { DSN } from './dsn';
33
import { SendStatus } from './status';
44

packages/core/src/sdk.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import * as Shim from '@sentry/shim';
1+
import {
2+
bindClient as shimBindClient,
3+
getCurrentClient as shimGetCurrentClient,
4+
} from '@sentry/shim';
25
import { Client, Options } from './interfaces';
36

47
export {
@@ -28,11 +31,11 @@ export function initAndBind<F extends Client, O extends Options>(
2831
clientClass: ClientClass<F, O>,
2932
options: O,
3033
): void {
31-
if (Shim.getCurrentClient()) {
34+
if (shimGetCurrentClient()) {
3235
return;
3336
}
3437

3538
const client = new clientClass(options);
3639
client.install();
37-
Shim.bindClient(client);
40+
shimBindClient(client);
3841
}

packages/node/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"dependencies": {
1818
"@sentry/core": "0.5.4",
1919
"@sentry/shim": "0.5.4",
20+
"@sentry/types": "0.5.4",
2021
"raven": "^2.6.0"
2122
},
2223
"devDependencies": {

packages/node/src/backend.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Backend, DSN, Options, SentryError } from '@sentry/core';
2-
import { addBreadcrumb, captureEvent, SentryEvent } from '@sentry/shim';
2+
import { addBreadcrumb, captureEvent } from '@sentry/shim';
3+
import { SentryEvent } from '@sentry/types';
34
import {
45
HTTPSTransport,
56
HTTPTransport,

packages/node/src/client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { BaseClient } from '@sentry/core';
2-
import { SdkInfo } from '@sentry/shim';
2+
import { SdkInfo } from '@sentry/types';
33
import { NodeBackend, NodeOptions } from './backend';
44
import { Raven } from './raven';
55

packages/node/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export {
1010
Stacktrace,
1111
Thread,
1212
User,
13-
} from '@sentry/shim';
13+
} from '@sentry/types';
1414

1515
export {
1616
addBreadcrumb,

packages/node/src/raven.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Breadcrumb, SentryEvent } from '@sentry/shim';
1+
import { Breadcrumb, SentryEvent } from '@sentry/types';
22
import * as RavenNode from 'raven';
33

44
export type SendMethod = (event: SentryEvent, cb?: (err: any) => void) => void;

packages/shim/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"publishConfig": {
1515
"access": "public"
1616
},
17+
"dependencies": {
18+
"@sentry/types": "0.5.4"
19+
},
1720
"devDependencies": {
1821
"chai": "^4.1.2",
1922
"jest": "^22.4.3",

packages/shim/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export {
1010
Stacktrace,
1111
Thread,
1212
User,
13-
} from './models';
13+
} from '@sentry/types';
1414
export {
1515
_callOnClient,
1616
addBreadcrumb,

packages/shim/src/sdk.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { Breadcrumb, SentryEvent, User } from '@sentry/types';
12
import { getGlobalRegistry } from './global';
2-
import { Breadcrumb, SentryEvent, User } from './models';
33
import { API_VERSION, Shim } from './shim';
44

55
/** Default callback used for catching async errors. */

packages/types/.npmignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!/dist/**/*

packages/types/LICENSE

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2018 Sentry (https://sentry.io) and individual contributors.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice,
8+
this list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
14+
3. Neither the name of the Sentry nor the names of its contributors may be
15+
used to endorse or promote products derived from this software without specific
16+
prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

packages/types/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<p align="center">
2+
<a href="https://sentry.io" target="_blank" align="center">
3+
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280">
4+
</a>
5+
<br />
6+
</p>
7+
8+
# Sentry JavaScript SDK Types
9+
10+
[![npm version](https://img.shields.io/npm/v/@sentry/types.svg)](https://www.npmjs.com/package/@sentry/types)
11+
[![npm dm](https://img.shields.io/npm/dm/@sentry/types.svg)](https://www.npmjs.com/package/@sentry/types)
12+
[![npm dt](https://img.shields.io/npm/dt/@sentry/types.svg)](https://www.npmjs.com/package/@sentry/types)
13+
14+
Common types used by the Sentry JavaScript SDKs.

packages/types/package.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "@sentry/types",
3+
"version": "0.5.4",
4+
"description": "Types for all Sentry JavaScript SDKs",
5+
"repository": "git://github.com/getsentry/raven-js.git",
6+
"homepage": "https://github.com/getsentry/raven-js/tree/next/packages/types",
7+
"author": "Sentry",
8+
"license": "BSD-3-Clause",
9+
"engines": {
10+
"node": ">=6"
11+
},
12+
"main": "dist/index.js",
13+
"types": "dist/index.d.ts",
14+
"publishConfig": {
15+
"access": "public"
16+
},
17+
"devDependencies": {
18+
"npm-run-all": "^4.1.2",
19+
"prettier": "^1.12.1",
20+
"prettier-check": "^2.0.0",
21+
"tslint": "^5.9.1",
22+
"typescript": "^2.8.3"
23+
},
24+
"scripts": {
25+
"build": "tsc -p tsconfig.build.json",
26+
"lint": "run-s lint:prettier lint:tslint",
27+
"lint:prettier": "prettier-check '{src,test}/**/*.ts'",
28+
"lint:tslint": "tslint -t stylish -p .",
29+
"fix": "run-s fix:tslint fix:prettier",
30+
"fix:prettier": "prettier --write '{src,test}/**/*.ts'",
31+
"fix:tslint": "tslint --fix -t stylish -p ."
32+
}
33+
}
File renamed without changes.

packages/types/tsconfig.build.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"baseUrl": ".",
5+
"outDir": "dist",
6+
"rootDir": "src"
7+
},
8+
"include": ["src/**/*.ts"]
9+
}

packages/types/tsconfig.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "./tsconfig.build.json",
3+
"include": ["src/**/*.ts"],
4+
"exclude": ["dist"],
5+
"compilerOptions": {
6+
"rootDir": ".",
7+
"types": ["node"],
8+
"plugins": [{ "name": "tslint-language-service" }]
9+
}
10+
}

packages/types/tslint.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@sentry/typescript/tslint"
3+
}

packages/utils/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"publishConfig": {
1515
"access": "public"
1616
},
17+
"dependencies": {
18+
"@sentry/types": "0.5.4"
19+
},
1720
"devDependencies": {
1821
"chai": "^4.1.2",
1922
"jest": "^22.4.3",

0 commit comments

Comments
 (0)