Skip to content

Commit 4334375

Browse files
HazATkamilogorek
andauthored
feat: @sentry/vue (#2953)
* feat: @sentry/vue * feat: Update Vue package * fix: Add safeguard for detection wrong init * fix: Vue Readme * fix: Warning * fix: Example * fix: Tracing check * ref: Bump versions * ref: Add bundle build * feat: Add VueRouterInstrumentation * Apply suggestions from code review Co-authored-by: Kamil Ogórek <[email protected]> * Update packages/vue/src/sdk.ts Co-authored-by: Kamil Ogórek <[email protected]> * ref: CR * ref: CR * ref: CR * fix: Package * fix: VueHelper * ref: Error handling * ref: Comment Co-authored-by: Kamil Ogórek <[email protected]>
1 parent c15967e commit 4334375

22 files changed

+5334
-1
lines changed

.craft.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ targets:
3838
onlyIfPresent: /^sentry-react-.*\.tgz$/
3939
config:
4040
canonical: 'npm:@sentry/react'
41+
- name: registry
42+
type: sdk
43+
onlyIfPresent: /^sentry-vue-.*\.tgz$/
44+
config:
45+
canonical: 'npm:@sentry/vue'
4146
- name: registry
4247
type: sdk
4348
onlyIfPresent: /^sentry-gatsby-.*\.tgz$/

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ package. Please refer to the README and instructions of those SDKs for more deta
4141
including integrations for React, Angular, Ember, Vue and Backbone
4242
- [`@sentry/node`](https://github.com/getsentry/sentry-javascript/tree/master/packages/node): SDK for Node, including
4343
integrations for Express, Koa, Loopback, Sails and Connect
44+
- [`@sentry/angular`](https://github.com/getsentry/sentry-javascript/tree/master/packages/angular): SDK for Angular
45+
- [`@sentry/react`](https://github.com/getsentry/sentry-javascript/tree/master/packages/react): SDK for ReactJS
46+
- [`@sentry/ember`](https://github.com/getsentry/sentry-javascript/tree/master/packages/ember): SDK for Ember
47+
- [`@sentry/vue`](https://github.com/getsentry/sentry-javascript/tree/master/packages/vue): SDK for Vue.js
48+
- [`@sentry/gatsby`](https://github.com/getsentry/sentry-javascript/tree/master/packages/gatsby): SDK for Gatsby
4449
- [`@sentry/react-native`](https://github.com/getsentry/sentry-react-native): SDK for React Native with support for native crashes
4550
- [`@sentry/integrations`](https://github.com/getsentry/sentry-javascript/tree/master/packages/integrations): Pluggable
4651
integrations that can be used to enhance JS SDKs

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"packages/tracing",
3636
"packages/types",
3737
"packages/typescript",
38-
"packages/utils"
38+
"packages/utils",
39+
"packages/vue"
3940
],
4041
"devDependencies": {
4142
"@google-cloud/storage": "^2.5.0",

packages/integrations/src/angular.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export class Angular implements Integration {
4747
*/
4848
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4949
public constructor(options: { angular?: any } = {}) {
50+
logger.log('You are still using the Angular integration, consider moving to @sentry/angular');
51+
5052
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
5153
this._angular = options.angular || getGlobalObject<any>().angular;
5254

packages/integrations/src/vue.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ export class Vue implements Integration {
154154
public constructor(
155155
options: Partial<Omit<IntegrationOptions, 'tracingOptions'> & { tracingOptions: Partial<TracingOptions> }>,
156156
) {
157+
logger.log('You are still using the Vue.js integration, consider moving to @sentry/vue');
157158
this._options = {
158159
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
159160
Vue: getGlobalObject<any>().Vue,

packages/types/src/options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export interface Options {
2828
/**
2929
* If this is set to false, default integrations will not be added, otherwise this will internally be set to the
3030
* recommended default integrations.
31+
* TODO: We should consider changing this to `boolean | Integration[]`
3132
*/
3233
defaultIntegrations?: false | Integration[];
3334

packages/vue/.eslintrc.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
es6: true,
5+
browser: true,
6+
},
7+
parserOptions: {
8+
ecmaVersion: 2018,
9+
jsx: true,
10+
},
11+
extends: ['@sentry-internal/sdk'],
12+
ignorePatterns: ['build/**', 'dist/**', 'esm/**', 'examples/**', 'scripts/**'],
13+
overrides: [
14+
{
15+
files: ['*.ts', '*.d.ts'],
16+
parserOptions: {
17+
project: './tsconfig.json',
18+
},
19+
},
20+
{
21+
files: ['test/**'],
22+
rules: {
23+
'@typescript-eslint/no-explicit-any': 'off',
24+
},
25+
},
26+
],
27+
rules: {
28+
'react/prop-types': 'off',
29+
'@typescript-eslint/no-unsafe-member-access': 'off',
30+
},
31+
};

packages/vue/.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*
2+
!/dist/**/*
3+
!/build/**/*
4+
!/esm/**/*
5+
*.tsbuildinfo

packages/vue/LICENSE

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

packages/vue/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
# Official Sentry SDK for Vue.js
9+
10+
## Links
11+
12+
- [Official SDK Docs](https://docs.sentry.io/platforms/javascript/guides/vue/)
13+
- [TypeDoc](http://getsentry.github.io/sentry-javascript/)
14+
15+
## General
16+
17+
This package is a wrapper around `@sentry/browser`, with added functionality related to Vue.js. All methods available in
18+
`@sentry/browser` can be imported from `@sentry/vue`.
19+
20+
To use this SDK, call `Sentry.init(options)` before you create a new Vue instance.
21+
22+
```javascript
23+
import Vue from 'vue'
24+
import App from './App'
25+
import router from './router'
26+
import * as Sentry from '@sentry/vue'
27+
28+
Sentry.init({
29+
Vue: Vue,
30+
dsn: '__PUBLIC_DSN__',
31+
})
32+
33+
new Vue({
34+
el: '#app',
35+
router,
36+
components: { App },
37+
template: '<App/>'
38+
})
39+
```

0 commit comments

Comments
 (0)