-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: @sentry/vue #2953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: @sentry/vue #2953
Changes from 10 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
3837979
feat: @sentry/vue
HazAT b89625b
feat: Update Vue package
HazAT 07d69f4
fix: Add safeguard for detection wrong init
HazAT 77c8b5a
fix: Vue Readme
HazAT ffd91c3
fix: Warning
HazAT cef9a8f
fix: Example
HazAT b4e2e44
fix: Tracing check
HazAT e5d5e98
ref: Bump versions
HazAT 18041b3
ref: Add bundle build
HazAT feb24d9
feat: Add VueRouterInstrumentation
HazAT 384b53c
Apply suggestions from code review
HazAT 30b62dd
Update packages/vue/src/sdk.ts
HazAT 2ad3d19
ref: CR
HazAT b6732f6
ref: CR
HazAT f7c99ba
ref: CR
HazAT e7860ae
fix: Package
HazAT df82804
fix: VueHelper
HazAT 7e2000e
ref: Error handling
HazAT e4124f3
ref: Comment
HazAT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
es6: true, | ||
browser: true, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
jsx: true, | ||
}, | ||
extends: ['@sentry-internal/sdk'], | ||
ignorePatterns: ['build/**', 'dist/**', 'esm/**', 'examples/**', 'scripts/**'], | ||
overrides: [ | ||
{ | ||
files: ['*.ts', '*.tsx', '*.d.ts'], | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
}, | ||
}, | ||
{ | ||
files: ['*.tsx'], | ||
HazAT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
rules: { | ||
'jsdoc/require-jsdoc': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['test/**'], | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
}, | ||
}, | ||
], | ||
rules: { | ||
'react/prop-types': 'off', | ||
'@typescript-eslint/no-unsafe-member-access': 'off', | ||
}, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* | ||
!/dist/**/* | ||
!/build/**/* | ||
!/esm/**/* | ||
*.tsbuildinfo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
MIT 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<p align="center"> | ||
<a href="https://sentry.io" target="_blank" align="center"> | ||
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280"> | ||
</a> | ||
<br /> | ||
</p> | ||
|
||
# Official Sentry SDK for VueJS | ||
|
||
## Links | ||
|
||
- [Official SDK Docs](https://docs.sentry.io/platforms/javascript/guides/vue/) | ||
- [TypeDoc](http://getsentry.github.io/sentry-javascript/) | ||
|
||
## General | ||
|
||
This package is a wrapper around `@sentry/browser`, with added functionality related to VueJS. All methods available in | ||
HazAT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
`@sentry/browser` can be imported from `@sentry/vue`. | ||
|
||
To use this SDK, call `Sentry.init(options)` before you create a new Vue instance. | ||
|
||
```javascript | ||
import Vue from 'vue' | ||
import App from './App' | ||
import router from './router' | ||
import * as Sentry from '@sentry/vue' | ||
|
||
Vue.config.productionTip = false | ||
|
||
HazAT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Sentry.init({ | ||
Vue: Vue, | ||
dsn: '__PUBLIC_DSN__', | ||
}) | ||
|
||
/* eslint-disable no-new */ | ||
HazAT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
new Vue({ | ||
el: '#app', | ||
router, | ||
components: { App }, | ||
template: '<App/>' | ||
}) | ||
|
||
HazAT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
{ | ||
"name": "@sentry/vue", | ||
"version": "5.27.4", | ||
"description": "Offical Sentry SDK for Vue.js", | ||
"repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/react", | ||
"author": "Sentry", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"main": "dist/index.js", | ||
"module": "esm/index.js", | ||
"types": "dist/index.d.ts", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@sentry/browser": "5.27.4", | ||
"@sentry/core": "5.27.4", | ||
"@sentry/minimal": "5.27.4", | ||
"@sentry/types": "5.27.4", | ||
"@sentry/utils": "5.27.4", | ||
"tslib": "^1.9.3" | ||
}, | ||
"peerDependencies": { | ||
"vue": "2.x" | ||
}, | ||
"devDependencies": { | ||
"@sentry-internal/eslint-config-sdk": "5.27.4", | ||
"eslint": "7.6.0", | ||
"jest": "^24.7.1", | ||
"jsdom": "^16.2.2", | ||
"npm-run-all": "^4.1.2", | ||
"prettier": "1.19.0", | ||
"react": "^16.0.0", | ||
HazAT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"rimraf": "^2.6.3", | ||
"rollup": "^1.10.1", | ||
"rollup-plugin-commonjs": "^9.3.4", | ||
"rollup-plugin-license": "^0.8.1", | ||
"rollup-plugin-node-resolve": "^4.2.3", | ||
"rollup-plugin-terser": "^4.0.4", | ||
"rollup-plugin-typescript2": "^0.21.0", | ||
"typescript": "3.7.5", | ||
"vue": "^2.6", | ||
"vue-router": "^3.0.1" | ||
}, | ||
"scripts": { | ||
"build": "run-p build:es5 build:esm build:bundle", | ||
"build:bundle": "rollup --config", | ||
"build:bundle:watch": "rollup --config --watch", | ||
"build:es5": "tsc -p tsconfig.build.json", | ||
"build:esm": "tsc -p tsconfig.esm.json", | ||
"build:watch": "run-p build:watch:es5 build:watch:esm", | ||
"build:watch:es5": "tsc -p tsconfig.build.json -w --preserveWatchOutput", | ||
"build:watch:esm": "tsc -p tsconfig.esm.json -w --preserveWatchOutput", | ||
"clean": "rimraf dist coverage build esm", | ||
"link:yarn": "yarn link", | ||
"lint": "run-s lint:prettier lint:eslint", | ||
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"", | ||
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish", | ||
"fix": "run-s fix:eslint fix:prettier", | ||
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"", | ||
"fix:eslint": "eslint . --format stylish --fix", | ||
"test": "jest --passWithNoTests", | ||
"test:watch": "jest --watch", | ||
"pack": "npm pack" | ||
}, | ||
"volta": { | ||
"extends": "../../package.json" | ||
}, | ||
"jest": { | ||
"collectCoverage": true, | ||
"transform": { | ||
"^.+\\.ts$": "ts-jest" | ||
}, | ||
"moduleFileExtensions": [ | ||
"js", | ||
"ts" | ||
], | ||
"testEnvironment": "jsdom", | ||
"testMatch": [ | ||
"**/*.test.ts" | ||
], | ||
"globals": { | ||
"ts-jest": { | ||
"tsConfig": "./tsconfig.json", | ||
"diagnostics": false | ||
} | ||
} | ||
}, | ||
"sideEffects": [ | ||
"./src/index.ts" | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { terser } from 'rollup-plugin-terser'; | ||
HazAT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import typescript from 'rollup-plugin-typescript2'; | ||
import license from 'rollup-plugin-license'; | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
|
||
const commitHash = require('child_process') | ||
.execSync('git rev-parse --short HEAD', { encoding: 'utf-8' }) | ||
.trim(); | ||
|
||
const terserInstance = terser({ | ||
mangle: { | ||
// captureExceptions and captureMessage are public API methods and they don't need to be listed here | ||
// as mangler doesn't touch user-facing thing, however sentryWrapped is not, and it would be mangled into a minified version. | ||
// We need those full names to correctly detect our internal frames for stripping. | ||
// I listed all of them here just for the clarity sake, as they are all used in the frames manipulation process. | ||
reserved: ['captureException', 'captureMessage', 'sentryWrapped'], | ||
properties: { | ||
regex: /^_[^_]/, | ||
}, | ||
}, | ||
}); | ||
|
||
const paths = { | ||
'@sentry/utils': ['../utils/src'], | ||
'@sentry/core': ['../core/src'], | ||
'@sentry/hub': ['../hub/src'], | ||
'@sentry/types': ['../types/src'], | ||
'@sentry/minimal': ['../minimal/src'], | ||
'@sentry/browser': ['../browser/src'], | ||
}; | ||
|
||
const plugins = [ | ||
typescript({ | ||
tsconfig: 'tsconfig.build.json', | ||
tsconfigOverride: { | ||
compilerOptions: { | ||
declaration: false, | ||
declarationMap: false, | ||
module: 'ES2015', | ||
paths, | ||
}, | ||
}, | ||
include: ['*.ts+(|x)', '**/*.ts+(|x)', '../**/*.ts+(|x)'], | ||
}), | ||
resolve({ | ||
mainFields: ['module'], | ||
}), | ||
commonjs(), | ||
]; | ||
|
||
const bundleConfig = { | ||
input: 'src/index.ts', | ||
output: { | ||
format: 'iife', | ||
name: 'Sentry', | ||
sourcemap: true, | ||
strict: false, | ||
}, | ||
context: 'window', | ||
plugins: [ | ||
...plugins, | ||
license({ | ||
sourcemap: true, | ||
banner: `/*! @sentry/vue <%= pkg.version %> (${commitHash}) | https://github.com/getsentry/sentry-javascript */`, | ||
}), | ||
], | ||
}; | ||
|
||
export default [ | ||
// ES5 Browser Tracing Bundle | ||
{ | ||
...bundleConfig, | ||
input: 'src/index.bundle.ts', | ||
output: { | ||
...bundleConfig.output, | ||
file: 'build/bundle.vue.js', | ||
}, | ||
plugins: bundleConfig.plugins, | ||
}, | ||
{ | ||
...bundleConfig, | ||
input: 'src/index.bundle.ts', | ||
output: { | ||
...bundleConfig.output, | ||
file: 'build/bundle.vue.min.js', | ||
}, | ||
// Uglify has to be at the end of compilation, BUT before the license banner | ||
plugins: bundleConfig.plugins | ||
.slice(0, -1) | ||
.concat(terserInstance) | ||
.concat(bundleConfig.plugins.slice(-1)), | ||
}, | ||
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { addGlobalEventProcessor, SDK_VERSION } from '@sentry/browser'; | ||
|
||
/** | ||
* A global side effect that makes sure Sentry events that user | ||
* `@sentry/react` will correctly have Sentry events associated | ||
* with it. | ||
*/ | ||
export function createVueEventProcessor(): void { | ||
if (addGlobalEventProcessor) { | ||
HazAT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
addGlobalEventProcessor(event => { | ||
event.sdk = { | ||
...event.sdk, | ||
name: 'sentry.javascript.vue', | ||
packages: [ | ||
...((event.sdk && event.sdk.packages) || []), | ||
{ | ||
name: 'npm:@sentry/vue', | ||
version: SDK_VERSION, | ||
}, | ||
], | ||
version: SDK_VERSION, | ||
}; | ||
|
||
return event; | ||
}); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.