Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
ref(replay): Extract worker into dedicated package#7139
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
8d7514903c26ed4f0b6e44612c97ce9790deb66ee9201fad3File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| vendor |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Note: All paths are relative to the directory in which eslint is being run, rather than the directory where this file | ||
| // lives | ||
| // ESLint config docs: https://eslint.org/docs/user-guide/configuring/ | ||
| module.exports = { | ||
| extends: ['../../.eslintrc.js'], | ||
| overrides: [ | ||
| { | ||
| files: ['src/**/*.ts'], | ||
| rules: { | ||
| // We cannot use backticks, as that conflicts with the stringified worker | ||
| 'prefer-template': 'off', | ||
| }, | ||
| }, | ||
| ], | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| node_modules | ||
| /*.tgz | ||
| .eslintcache | ||
| build | ||
| !vendor/*.d.ts |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| Copyright (c) 2023 Sentry (https://sentry.io) and individual contributors. All rights reserved. | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
| documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
| rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit | ||
| persons to whom the Software is furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | ||
| Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | ||
| WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <p align="center"> | ||
| <a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank"> | ||
| <img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84"> | ||
| </a> | ||
| </p> | ||
| # Sentry Session Replay Worker | ||
| This is an internal package that is used by @sentry/replay. | ||
| It generates a web worker and converts it to a string, so that we can process it easier in replay. | ||
| By extracting this into a dedicated (private, internal) package, we can streamline the build of replay. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| module.exports = require('../../jest/jest.config.js'); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| { | ||
| "name": "@sentry-internal/replay-worker", | ||
| "version": "7.37.2", | ||
| "description": "Worker for @sentry/replay", | ||
| "main": "build/index.js", | ||
| "module": "build/index.js", | ||
| "sideEffects": false, | ||
| "private": true, | ||
| "scripts": { | ||
| "build": "yarn build:transpile", | ||
| "build:transpile": "rollup -c rollup.worker.config.js", | ||
| "build:types": "yarn build:transpile", | ||
| "build:dev": "yarn build", | ||
| "build:watch": "run-p build:transpile:watch", | ||
| "build:dev:watch": "run-p build:watch", | ||
| "build:transpile:watch": "yarn build:rollup --watch", | ||
| "clean": "rimraf build", | ||
| "fix": "run-s fix:eslint fix:prettier", | ||
| "fix:eslint": "eslint . --format stylish --fix", | ||
| "fix:prettier": "prettier --write \"{src,test}/**/*.ts\"", | ||
| "lint": "run-s lint:prettier lint:eslint", | ||
| "lint:eslint": "eslint . --format stylish", | ||
| "lint:prettier": "prettier --check \"{src,test}/**/*.ts\"", | ||
| "test": "jest", | ||
| "test:watch": "jest --watch" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/getsentry/sentry-javascript.git" | ||
| }, | ||
| "author": "Sentry", | ||
| "license": "MIT", | ||
| "bugs": { | ||
| "url": "https://github.com/getsentry/sentry-javascript/issues" | ||
| }, | ||
| "homepage": "https://docs.sentry.io/platforms/javascript/session-replay/", | ||
| "devDependencies": { | ||
| "@types/pako": "^2.0.0", | ||
| "rollup-plugin-copy": "~3.4.0", | ||
| "tslib": "^1.9.3" | ||
| }, | ||
| "dependencies": { | ||
| "pako": "^2.1.0" | ||
| }, | ||
| "engines": { | ||
| "node": ">=12" | ||
| }, | ||
| "volta": { | ||
| "extends": "../../package.json" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| // TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as | ||
| // it's purely a placeholder to satisfy VSCode. | ||
| { | ||
| "extends": "../tsconfig.test.json", | ||
| "include": ["./**/*"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "extends": "../../tsconfig.json", | ||
| "compilerOptions": { | ||
| "module": "esnext", | ||
| "lib": ["webworker", "scripthost"], | ||
| "esModuleInterop": true, | ||
| "target": "es6", | ||
| "strictPropertyInitialization": false | ||
| }, | ||
| "include": ["src/**/*.ts"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "extends": "./tsconfig.json", | ||
| "include": ["test/**/*.ts"], | ||
| "compilerOptions": { | ||
| "types": ["node", "jest"] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export function getWorkerURL(): string; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import workerString from './worker'; | ||
| export function getWorkerURL() { | ||
| const workerBlob = new Blob([workerString]); | ||
| return URL.createObjectURL(workerBlob); | ||
| } | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if
vendoris the best name, but these are basically pre-built files.We need this because
workerStringis built by rollup at build-time, so we can't reference it at dev-time. I figured this is simple enough code to just pipe this through without any build step for now.Note that this is transparent for the replay package, it doesn't really care about how we build stuff here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static? not sure if that's any betterThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll just merge it as
vendorfor now and we can revisit this later, this is purely internal anyhow.