Skip to content

Commit 8ec4f3a

Browse files
mitsuhikokamilogorekHazAT
authored
feat(wasm): Adds a WASM integration (#3080)
* feat(wasm): Adds a WASM integration Co-authored-by: Kamil Ogórek <[email protected]> Co-authored-by: Daniel Griesser <[email protected]>
1 parent 682ac0b commit 8ec4f3a

27 files changed

+5316
-16
lines changed

.craft.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ targets:
5353
onlyIfPresent: /^sentry-angular-.*\.tgz$/
5454
config:
5555
canonical: 'npm:@sentry/angular'
56+
- name: registry
57+
type: sdk
58+
onlyIfPresent: /^sentry-wasm-.*\.tgz$/
59+
config:
60+
canonical: 'npm:@sentry/wasm'
5661
- name: aws-lambda-layer
5762
includeNames: /^sentry-node-serverless-\d+(\.\d+)*\.zip$/
5863
layerName: SentryNodeServerlessSDK

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"packages/types",
3737
"packages/typescript",
3838
"packages/utils",
39+
"packages/wasm",
3940
"packages/vue"
4041
],
4142
"devDependencies": {
@@ -65,7 +66,8 @@
6566
"typescript": "3.7.5"
6667
},
6768
"resolutions": {
68-
"**/agent-base": "5"
69+
"**/agent-base": "5",
70+
"**/jest-environment-node": "24"
6971
},
7072
"version": "0.0.0"
7173
}

packages/types/src/debugMeta.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Holds meta information to customize the behavior of sentry's event processing.
3+
**/
4+
export interface DebugMeta {
5+
images?: Array<DebugImage>;
6+
}
7+
8+
/**
9+
* Possible choices for debug images.
10+
*/
11+
export type DebugImageType = 'wasm' | 'macho' | 'elf' | 'pe';
12+
13+
/**
14+
* References to debug images.
15+
*/
16+
export interface DebugImage {
17+
type: DebugImageType;
18+
debug_id: string;
19+
code_id?: string | null;
20+
code_file: string;
21+
debug_file?: string | null;
22+
}

packages/types/src/event.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Breadcrumb } from './breadcrumb';
22
import { Contexts } from './context';
3+
import { DebugMeta } from './debugMeta';
34
import { Exception } from './exception';
45
import { Extras } from './extra';
56
import { Primitive } from './misc';
@@ -42,6 +43,7 @@ export interface Event {
4243
type?: EventType;
4344
spans?: Span[];
4445
measurements?: Measurements;
46+
debug_meta?: DebugMeta;
4547
}
4648

4749
/** JSDoc */

packages/types/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export { Breadcrumb, BreadcrumbHint } from './breadcrumb';
22
export { Client } from './client';
33
export { Context, Contexts } from './context';
44
export { Dsn, DsnComponents, DsnLike, DsnProtocol } from './dsn';
5+
export { DebugImage, DebugImageType, DebugMeta } from './debugMeta';
56
export { ExtendedError } from './error';
67
export { Event, EventHint } from './event';
78
export { EventProcessor } from './eventprocessor';

packages/types/src/stackframe.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ export interface StackFrame {
1111
pre_context?: string[];
1212
post_context?: string[];
1313
in_app?: boolean;
14+
instruction_addr?: string;
15+
addr_mode?: string;
1416
vars?: { [key: string]: any };
1517
}

packages/wasm/.eslintrc.js

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

packages/wasm/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.js.map
2+
*.d.ts
3+
!test/*.js
4+
!.eslintrc.js

packages/wasm/.npmignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*
2+
!*.js.map
3+
!*.d.ts
4+
!*.js
5+
!/esm/**/*
6+
jest.config.js

packages/wasm/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) 2021, 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.

0 commit comments

Comments
 (0)