-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(wasm): Adds a WASM integration #3080
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
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c67e154
feat(wasm): Adds a WASM integration
mitsuhiko 37cdf64
ref: extenralize debug_file
mitsuhiko 26f4b20
wip: test crappery
mitsuhiko 11f6541
test infra
kamilogorek 1d6622f
Merge branch 'master' into feature/wasm
mitsuhiko 5bc9bdd
Merge branch 'master' into feature/wasm
mitsuhiko 16a8fdd
fix: resolve circular dependency
mitsuhiko b287855
fix: Build
HazAT e72000e
Merge branch 'master' into feature/wasm
HazAT f66f513
ref: Bump version
HazAT e5253a5
ref: Add wasm to registry, Don't run node tests
HazAT b9e7df6
ref: Don't run utils in node6
HazAT 0a0b004
ref: CI
HazAT 2c5dc4a
build: lock jest-environment-node version for node 6 support
kamilogorek 9b20e37
Merge branch 'master' into feature/wasm
kamilogorek 4187f18
Merge branch 'master' into feature/wasm
kamilogorek 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Holds meta information to customize the behavior of sentry's event processing. | ||
**/ | ||
export interface DebugMeta { | ||
images?: Array<DebugImage>; | ||
} | ||
|
||
/** | ||
* Possible choices for debug images. | ||
*/ | ||
export type DebugImageType = 'wasm' | 'macho' | 'elf' | 'pe'; | ||
|
||
/** | ||
* References to debug images. | ||
*/ | ||
export interface DebugImage { | ||
type: DebugImageType; | ||
debug_id: string; | ||
code_id?: string | null; | ||
code_file: string; | ||
debug_file?: string | null; | ||
} |
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,29 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
es6: true, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
}, | ||
extends: ['@sentry-internal/sdk'], | ||
ignorePatterns: ['build/**', 'dist/**', 'esm/**', 'examples/**', 'scripts/**'], | ||
overrides: [ | ||
{ | ||
files: ['*.ts', '*.tsx', '*.d.ts'], | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
}, | ||
}, | ||
{ | ||
files: ['test/**'], | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
}, | ||
}, | ||
], | ||
rules: { | ||
'max-lines': '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,4 @@ | ||
*.js.map | ||
*.d.ts | ||
!test/*.js | ||
!.eslintrc.js |
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,6 @@ | ||
* | ||
!*.js.map | ||
!*.d.ts | ||
!*.js | ||
!/esm/**/* | ||
jest.config.js |
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) 2021, 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,22 @@ | ||
<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> | ||
|
||
# Sentry JavaScript WebAssembly Support | ||
|
||
[](https://www.npmjs.com/package/@sentry/wasm) | ||
[](https://www.npmjs.com/package/@sentry/wasm) | ||
[](https://www.npmjs.com/package/@sentry/wasm) | ||
[](http://getsentry.github.io/sentry-javascript/) | ||
|
||
## Links | ||
|
||
- [Official SDK Docs](https://docs.sentry.io/quickstart/) | ||
- [TypeDoc](http://getsentry.github.io/sentry-javascript/) | ||
|
||
## General | ||
|
||
This package provides support for WebAssembly in stack traces. |
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,6 @@ | ||
module.exports = { | ||
server: { | ||
command: 'node test/server.js', | ||
port: process.env.PORT, | ||
}, | ||
}; |
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,69 @@ | ||
{ | ||
"name": "@sentry/wasm", | ||
"version": "5.29.2", | ||
"description": "Support for WASM.", | ||
"repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/wasm", | ||
"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.29.2", | ||
"@sentry/types": "5.29.2", | ||
"tslib": "^1.9.3" | ||
}, | ||
"devDependencies": { | ||
"@sentry-internal/eslint-config-sdk": "5.29.2", | ||
"@types/jest-environment-puppeteer": "^4.4.0", | ||
"@types/puppeteer": "^5.4.0", | ||
"eslint": "7.6.0", | ||
"express": "^4.17.1", | ||
"jest": "^24.7.1", | ||
"jest-puppeteer": "^4.4.0", | ||
"npm-run-all": "^4.1.2", | ||
"prettier": "1.19.0", | ||
"puppeteer": "^5.5.0", | ||
"rimraf": "^2.6.3", | ||
"rollup": "^1.10.1", | ||
"rollup-plugin-commonjs": "^9.3.4", | ||
"rollup-plugin-node-resolve": "^4.2.3", | ||
"rollup-plugin-terser": "^4.0.4", | ||
"rollup-plugin-typescript2": "^0.21.0", | ||
"typescript": "3.7.5" | ||
}, | ||
"scripts": { | ||
"build": "run-p build:es5 build:esm build:bundle", | ||
"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", | ||
"build:bundle": "rollup --config", | ||
"clean": "rimraf dist esm coverage *.js *.js.map *.d.ts", | ||
"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": "PORT=1337 jest", | ||
"test:watch": "jest --watch", | ||
"pack": "npm pack" | ||
}, | ||
"volta": { | ||
"extends": "../../package.json" | ||
}, | ||
"jest": { | ||
"preset": "jest-puppeteer" | ||
}, | ||
"sideEffects": false | ||
} |
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,83 @@ | ||
import { terser } from 'rollup-plugin-terser'; | ||
import typescript from 'rollup-plugin-typescript2'; | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
|
||
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: false, | ||
}, | ||
}); | ||
|
||
const plugins = [ | ||
typescript({ | ||
tsconfig: 'tsconfig.build.json', | ||
tsconfigOverride: { | ||
compilerOptions: { | ||
declaration: false, | ||
module: 'ES2015', | ||
paths: { | ||
'@sentry/utils': ['../utils/src'], | ||
'@sentry/core': ['../core/src'], | ||
'@sentry/hub': ['../hub/src'], | ||
'@sentry/types': ['../types/src'], | ||
'@sentry/minimal': ['../minimal/src'], | ||
}, | ||
}, | ||
}, | ||
include: ['*.ts+(|x)', '**/*.ts+(|x)', '../**/*.ts+(|x)'], | ||
}), | ||
resolve({ | ||
mainFields: ['module'], | ||
}), | ||
commonjs(), | ||
]; | ||
|
||
function mergeIntoSentry() { | ||
return ` | ||
__window.Sentry = __window.Sentry || {}; | ||
__window.Sentry.Integrations = __window.Sentry.Integrations || {}; | ||
for (var key in exports) { | ||
if (Object.prototype.hasOwnProperty.call(exports, key)) { | ||
__window.Sentry.Integrations[key] = exports[key]; | ||
} | ||
} | ||
`; | ||
} | ||
|
||
function loadAllIntegrations() { | ||
const builds = []; | ||
[ | ||
{ | ||
extension: '.js', | ||
plugins, | ||
}, | ||
{ | ||
extension: '.min.js', | ||
plugins: [...plugins, terserInstance], | ||
}, | ||
].forEach(build => { | ||
builds.push({ | ||
input: `src/index.ts`, | ||
output: { | ||
banner: '(function (__window) {', | ||
intro: 'var exports = {};', | ||
outro: mergeIntoSentry(), | ||
footer: '}(window));', | ||
file: `build/wasm${build.extension}`, | ||
format: 'cjs', | ||
sourcemap: true, | ||
strict: false, | ||
}, | ||
plugins: build.plugins, | ||
}); | ||
}); | ||
return builds; | ||
} | ||
|
||
export default loadAllIntegrations(); |
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.