From fca5f455dda684b17b2f07d9753a49c39aed35ba Mon Sep 17 00:00:00 2001 From: Yun Feng Date: Sun, 25 Aug 2024 21:54:51 -0700 Subject: [PATCH 01/20] fix: remove the permission not needed and update the player style link --- packages/web-extension/src/manifest.json | 2 +- packages/web-extension/src/pages/Player.tsx | 2 +- packages/web-extension/src/pages/index.html | 19 ++++++++++++------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/web-extension/src/manifest.json b/packages/web-extension/src/manifest.json index 482335d4c6..cdf9d3c443 100644 --- a/packages/web-extension/src/manifest.json +++ b/packages/web-extension/src/manifest.json @@ -14,7 +14,7 @@ "48": "icon48.png", "128": "icon128.png" }, - "permissions": ["activeTab", "tabs", "storage", "unlimitedStorage"] + "permissions": ["activeTab", "storage", "unlimitedStorage"] }, "v2": { "common": { diff --git a/packages/web-extension/src/pages/Player.tsx b/packages/web-extension/src/pages/Player.tsx index df0bf0aadf..72df2a7d57 100644 --- a/packages/web-extension/src/pages/Player.tsx +++ b/packages/web-extension/src/pages/Player.tsx @@ -31,7 +31,7 @@ export default function Player() { const linkEl = document.createElement('link'); linkEl.href = - 'https://cdn.jsdelivr.net/npm/rrweb-player@latest/dist/style.css'; + 'https://cdn.jsdelivr.net/npm/rrweb-player@2.0.0-alpha.17/dist/style.min.css'; linkEl.rel = 'stylesheet'; document.head.appendChild(linkEl); playerRef.current = new Replayer({ diff --git a/packages/web-extension/src/pages/index.html b/packages/web-extension/src/pages/index.html index bac6dabc6f..3450454799 100644 --- a/packages/web-extension/src/pages/index.html +++ b/packages/web-extension/src/pages/index.html @@ -1,9 +1,14 @@ - -rrweb - -
- - - + + + + rrweb + + + +
+ + + + \ No newline at end of file From 21fc35ba33139fc00f74ec42ad75a40b30e9bb57 Mon Sep 17 00:00:00 2001 From: Yun Feng Date: Sun, 25 Aug 2024 21:58:48 -0700 Subject: [PATCH 02/20] add change set --- .changeset/odd-onions-brush.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/odd-onions-brush.md diff --git a/.changeset/odd-onions-brush.md b/.changeset/odd-onions-brush.md new file mode 100644 index 0000000000..a0996ee8c8 --- /dev/null +++ b/.changeset/odd-onions-brush.md @@ -0,0 +1,5 @@ +--- +"@rrweb/web-extension": patch +--- + +fix: remove the permission not needed and update the player style link From d1e64d85d27fd07666f554f54711b55c23fb7de2 Mon Sep 17 00:00:00 2001 From: Yun Feng Date: Wed, 28 Aug 2024 00:04:11 -0700 Subject: [PATCH 03/20] fix: change the way of importing worker script --- packages/rrweb/src/record/observers/canvas/canvas-manager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rrweb/src/record/observers/canvas/canvas-manager.ts b/packages/rrweb/src/record/observers/canvas/canvas-manager.ts index 6e6bfdf1aa..23f072b0d5 100644 --- a/packages/rrweb/src/record/observers/canvas/canvas-manager.ts +++ b/packages/rrweb/src/record/observers/canvas/canvas-manager.ts @@ -14,7 +14,7 @@ import { CanvasContext } from '@rrweb/types'; import initCanvas2DMutationObserver from './2d'; import initCanvasContextObserver from './canvas'; import initCanvasWebGLMutationObserver from './webgl'; -import ImageBitmapDataURLWorker from '../../workers/image-bitmap-data-url-worker?worker&inline'; +import ImageBitmapDataURLWorker from '../../workers/image-bitmap-data-url-worker?worker'; import type { ImageBitmapDataURLRequestWorker } from '../../workers/image-bitmap-data-url-worker'; export type RafStamps = { latestId: number; invokeId: number | null }; From 23ed59f388967c1d5539c815a25a55591468682f Mon Sep 17 00:00:00 2001 From: Yun Feng Date: Wed, 28 Aug 2024 00:52:08 -0700 Subject: [PATCH 04/20] improve the extension version --- packages/web-extension/package.json | 2 ++ packages/web-extension/vite.config.ts | 31 ++++++++++++++++++++++++--- yarn.lock | 7 +++++- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/packages/web-extension/package.json b/packages/web-extension/package.json index 8ed096c4b0..e06edd2c96 100644 --- a/packages/web-extension/package.json +++ b/packages/web-extension/package.json @@ -20,8 +20,10 @@ "devDependencies": { "@rrweb/types": "^2.0.0-alpha.17", "@types/react-dom": "^18.0.6", + "@types/semver": "^7.5.8", "@types/webextension-polyfill": "^0.9.1", "@vitejs/plugin-react": "^4.2.1", + "semver": "^7.6.3", "type-fest": "^2.19.0", "vite": "^5.3.1", "vite-plugin-web-extension": "^4.1.3", diff --git a/packages/web-extension/vite.config.ts b/packages/web-extension/vite.config.ts index 2ca58feab9..f4fcec49d1 100644 --- a/packages/web-extension/vite.config.ts +++ b/packages/web-extension/vite.config.ts @@ -4,6 +4,7 @@ import zip from 'vite-plugin-zip-pack'; import * as path from 'path'; import type { PackageJson } from 'type-fest'; import react from '@vitejs/plugin-react'; +import semver from 'semver'; const emptyOutDir = !process.argv.includes('--watch'); @@ -39,6 +40,29 @@ function useSpecialFormat( }; } +/** + * Get the extension version based on the rrweb version. + */ +function getExtensionVersion(rrwebVersion: string): string { + const parsedVersion = semver.parse(rrwebVersion.replace('^', '')); + + if (!parsedVersion) { + throw new Error('Invalid version format'); + } + + if (parsedVersion.prerelease.length > 0) { + // If it's a pre-release version like alpha or beta, strip the pre-release identifier + return `${parsedVersion.major}.${parsedVersion.minor}.${ + parsedVersion.patch + }.${parsedVersion.prerelease[1] || 0}`; + } else if (rrwebVersion === '2.0.0') { + // This version has already been released as the first version. We need to add a patch version to it to avoid publishing conflicts. + return '2.0.0.100'; + } else { + return rrwebVersion; + } +} + export default defineConfig({ root: 'src', // Configure our outputs - nothing special, this is normal vite config @@ -73,10 +97,11 @@ export default defineConfig({ const BrowserName = process.env.TARGET_BROWSER === 'chrome' ? 'chrome' : 'firefox'; const commonManifest = originalManifest.common; + const rrwebVersion = packageJson.dependencies!.rrweb!.replace('^', ''); const manifest = { - version: '2.0.0', + version: getExtensionVersion(rrwebVersion), author: packageJson.author, - version_name: packageJson.dependencies?.rrweb?.replace('^', ''), + version_name: rrwebVersion, ...commonManifest, }; Object.assign( @@ -92,7 +117,7 @@ export default defineConfig({ watchIgnored: ['*.md', '*.log'], }, additionalInputs: ['pages/index.html', 'content/inject.ts'], - }), + }) as PluginOption, // https://github.com/aklinker1/vite-plugin-web-extension/issues/50#issuecomment-1317922947 // transfer inject.ts to iife format to avoid error useSpecialFormat( diff --git a/yarn.lock b/yarn.lock index c4ad2ac6bb..e8af6c9387 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2820,7 +2820,7 @@ "@types/prop-types" "*" csstype "^3.0.2" -"@types/semver@^7.3.12", "@types/semver@^7.5.0": +"@types/semver@^7.3.12", "@types/semver@^7.5.0", "@types/semver@^7.5.8": version "7.5.8" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== @@ -8985,6 +8985,11 @@ semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== +semver@^7.6.3: + version "7.6.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" + integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== + semver@~7.5.4: version "7.5.4" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" From 0dcdf346335d5afd2417a6d02b712847b479d84b Mon Sep 17 00:00:00 2001 From: Yun Feng Date: Fri, 13 Sep 2024 00:51:47 -0700 Subject: [PATCH 05/20] build: add process env to disable inline worker import --- .../record/observers/canvas/canvas-manager.ts | 2 +- turbo.json | 2 +- vite.config.default.ts | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/rrweb/src/record/observers/canvas/canvas-manager.ts b/packages/rrweb/src/record/observers/canvas/canvas-manager.ts index 23f072b0d5..4e379b9010 100644 --- a/packages/rrweb/src/record/observers/canvas/canvas-manager.ts +++ b/packages/rrweb/src/record/observers/canvas/canvas-manager.ts @@ -14,7 +14,7 @@ import { CanvasContext } from '@rrweb/types'; import initCanvas2DMutationObserver from './2d'; import initCanvasContextObserver from './canvas'; import initCanvasWebGLMutationObserver from './webgl'; -import ImageBitmapDataURLWorker from '../../workers/image-bitmap-data-url-worker?worker'; +import ImageBitmapDataURLWorker from '../../workers/image-bitmap-data-url-worker?worker&inline' import type { ImageBitmapDataURLRequestWorker } from '../../workers/image-bitmap-data-url-worker'; export type RafStamps = { latestId: number; invokeId: number | null }; diff --git a/turbo.json b/turbo.json index 54bd1b278f..6dbac94d2e 100644 --- a/turbo.json +++ b/turbo.json @@ -7,7 +7,7 @@ "vite.config.defaults.ts", "tsconfig.json" ], - "globalPassThroughEnv": ["PUPPETEER_HEADLESS"], + "globalPassThroughEnv": ["PUPPETEER_HEADLESS", "DISABLE_WORKER_INLINING"], "tasks": { "prepublish": { "dependsOn": ["^prepublish", "//#references:update"], diff --git a/vite.config.default.ts b/vite.config.default.ts index 4dd3cc496e..3405fbc951 100644 --- a/vite.config.default.ts +++ b/vite.config.default.ts @@ -2,13 +2,17 @@ import dts from 'vite-plugin-dts'; import { copyFileSync } from 'node:fs'; import { defineConfig, LibraryOptions, LibraryFormats, Plugin } from 'vite'; -import glob from 'fast-glob'; import { build, Format } from 'esbuild'; import { resolve } from 'path'; import { umdWrapper } from 'esbuild-plugin-umd-wrapper'; // don't empty out dir if --watch flag is passed const emptyOutDir = !process.argv.includes('--watch'); +/** + * Chrome web store does not allow base64 inline workers. + * For chrome extension, we need to disable worker inlining to pass the review. + */ +const disableWorkerInlining = process.env.DISABLE_WORKER_INLINING === 'true'; function minifyAndUMDPlugin({ name, @@ -157,6 +161,19 @@ export default function ( }, }), minifyAndUMDPlugin({ name, outDir }), + { + name: 'remove-worker-inline', + enforce: 'pre', + transform(code, id) { + if (!disableWorkerInlining) return; + if (/\.(js|ts|jsx|tsx)$/.test(id)) { + return { + code: code.replace(/\?worker&inline/g, '?worker'), + map: null, + }; + } + }, + }, ...plugins, ], })); From d1e932b6935422a4bb9b2707bdec7e352a5678b3 Mon Sep 17 00:00:00 2001 From: YunFeng0817 Date: Fri, 13 Sep 2024 07:57:42 +0000 Subject: [PATCH 06/20] Apply formatting changes --- packages/rrweb/src/record/observers/canvas/canvas-manager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rrweb/src/record/observers/canvas/canvas-manager.ts b/packages/rrweb/src/record/observers/canvas/canvas-manager.ts index 4e379b9010..6e6bfdf1aa 100644 --- a/packages/rrweb/src/record/observers/canvas/canvas-manager.ts +++ b/packages/rrweb/src/record/observers/canvas/canvas-manager.ts @@ -14,7 +14,7 @@ import { CanvasContext } from '@rrweb/types'; import initCanvas2DMutationObserver from './2d'; import initCanvasContextObserver from './canvas'; import initCanvasWebGLMutationObserver from './webgl'; -import ImageBitmapDataURLWorker from '../../workers/image-bitmap-data-url-worker?worker&inline' +import ImageBitmapDataURLWorker from '../../workers/image-bitmap-data-url-worker?worker&inline'; import type { ImageBitmapDataURLRequestWorker } from '../../workers/image-bitmap-data-url-worker'; export type RafStamps = { latestId: number; invokeId: number | null }; From 6d0d3205d527650186edfcc3ddd61f9af7496b7c Mon Sep 17 00:00:00 2001 From: Yun Feng Date: Tue, 3 Dec 2024 00:25:05 -0800 Subject: [PATCH 07/20] Create extension-release.yml --- .github/workflows/extension-release.yml | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/extension-release.yml diff --git a/.github/workflows/extension-release.yml b/.github/workflows/extension-release.yml new file mode 100644 index 0000000000..7daf0ec366 --- /dev/null +++ b/.github/workflows/extension-release.yml @@ -0,0 +1,29 @@ +name: Extension Release + +on: + workflow_dispatch: + +jobs: + chrome-web-store: + name: Chrome Web Store + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + - uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Install Dependencies + run: yarn install --frozen-lockfile + - name: Build Project + run: NODE_OPTIONS='--max-old-space-size=4096' DISABLE_WORKER_INLINING=true yarn turbo run prepublish --filter=@rrweb/web-extension + + - uses: mnao305/chrome-extension-upload@v5.0.0 + with: + extension-id: 'pdaldeopoccdhlkabbkcjmecmmoninhe' + file-path: ./packages/web-extension/dist/chrome.zip + client-id: ${{ secrets.CWS_CLIENT_ID }} + client-secret: ${{ secrets.CWS_CLIENT_SECRET }} + refresh-token: ${{ secrets.CWS_REFRESH_TOKEN }} + publish: false From 56f27cd83775ccbf1b0f7ceeb2cec459425a7b18 Mon Sep 17 00:00:00 2001 From: Yun Feng Date: Tue, 3 Dec 2024 00:55:12 -0800 Subject: [PATCH 08/20] Update extension-release.yml --- .github/workflows/extension-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/extension-release.yml b/.github/workflows/extension-release.yml index 7daf0ec366..d33add7e0c 100644 --- a/.github/workflows/extension-release.yml +++ b/.github/workflows/extension-release.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v3 with: node-version: lts/* - name: Install Dependencies From 9bf0a7a4260c393a591e77f3a9a602163e6c881d Mon Sep 17 00:00:00 2001 From: Yun Feng Date: Tue, 3 Dec 2024 00:58:12 -0800 Subject: [PATCH 09/20] Update extension-release.yml --- .github/workflows/extension-release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/extension-release.yml b/.github/workflows/extension-release.yml index d33add7e0c..1007783aae 100644 --- a/.github/workflows/extension-release.yml +++ b/.github/workflows/extension-release.yml @@ -1,7 +1,6 @@ name: Extension Release -on: - workflow_dispatch: +on: [push] jobs: chrome-web-store: From 13a85a3b68f9f793113fbe67da07a040eb666ae5 Mon Sep 17 00:00:00 2001 From: Yun Feng Date: Sun, 8 Dec 2024 22:11:41 -0800 Subject: [PATCH 10/20] Update extension-release.yml --- .github/workflows/extension-release.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/extension-release.yml b/.github/workflows/extension-release.yml index 1007783aae..bc8833fa93 100644 --- a/.github/workflows/extension-release.yml +++ b/.github/workflows/extension-release.yml @@ -1,10 +1,11 @@ name: Extension Release -on: [push] +on: + workflow_dispatch: jobs: - chrome-web-store: - name: Chrome Web Store + publish-extension: + name: Publish to Chrome Web Store runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -25,4 +26,4 @@ jobs: client-id: ${{ secrets.CWS_CLIENT_ID }} client-secret: ${{ secrets.CWS_CLIENT_SECRET }} refresh-token: ${{ secrets.CWS_REFRESH_TOKEN }} - publish: false + publish: true From 6d4abc418ea6fc4da77e8538d8d666ace2f66f99 Mon Sep 17 00:00:00 2001 From: yunfeng0817 Date: Sun, 8 Dec 2024 23:25:17 -0800 Subject: [PATCH 11/20] improve style file --- packages/web-extension/src/pages/Player.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web-extension/src/pages/Player.tsx b/packages/web-extension/src/pages/Player.tsx index 72df2a7d57..330c68ef5c 100644 --- a/packages/web-extension/src/pages/Player.tsx +++ b/packages/web-extension/src/pages/Player.tsx @@ -31,7 +31,7 @@ export default function Player() { const linkEl = document.createElement('link'); linkEl.href = - 'https://cdn.jsdelivr.net/npm/rrweb-player@2.0.0-alpha.17/dist/style.min.css'; + 'https://cdn.jsdelivr.net/npm/rrweb-player@alpha/dist/style.min.css'; linkEl.rel = 'stylesheet'; document.head.appendChild(linkEl); playerRef.current = new Replayer({ From 64838531be7ba0f101d2b386b725f7248f571412 Mon Sep 17 00:00:00 2001 From: yunfeng0817 Date: Sun, 8 Dec 2024 23:36:04 -0800 Subject: [PATCH 12/20] upgrade svelte2tsx --- packages/rrweb-player/package.json | 2 +- yarn.lock | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/rrweb-player/package.json b/packages/rrweb-player/package.json index ae90af35ea..e9e7614bea 100644 --- a/packages/rrweb-player/package.json +++ b/packages/rrweb-player/package.json @@ -14,7 +14,7 @@ "svelte": "^4.2.14", "svelte-check": "^3.4.3", "svelte-preprocess": "^5.0.3", - "svelte2tsx": "^0.7.6", + "svelte2tsx": "^0.7.30", "tslib": "^2.0.0", "vite": "^5.3.1" }, diff --git a/yarn.lock b/yarn.lock index e8af6c9387..0cfcbe03b6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9565,7 +9565,15 @@ svelte-preprocess@^5.0.3, svelte-preprocess@^5.1.3: sorcery "^0.11.0" strip-indent "^3.0.0" -svelte2tsx@^0.7.6, svelte2tsx@~0.7.0: +svelte2tsx@^0.7.30: + version "0.7.30" + resolved "https://registry.yarnpkg.com/svelte2tsx/-/svelte2tsx-0.7.30.tgz#5dbd9e38c2fe54170b441409ebb2ee46c807be9e" + integrity sha512-sHXK/vw/sVJmFuPSq6zeKrtuZKvo0jJyEi8ybN0dfrqSYVvHu8zFbO0zQKAL8y/fYackYojH41EJGe6v8rd5fw== + dependencies: + dedent-js "^1.0.1" + pascal-case "^3.1.1" + +svelte2tsx@~0.7.0: version "0.7.9" resolved "https://registry.yarnpkg.com/svelte2tsx/-/svelte2tsx-0.7.9.tgz#a2b42e218e8808b9bd4b292dedba18ae8468abb0" integrity sha512-Rm+0LAwg9wT4H2IsR8EaM9EWErTzi9LmuZKxkH5b1ua94XjQmwHstBP4VabLgA9AE6XmwBg+xK7Cjzwfm6ustQ== From 4f0bf98a9f3f0a6d3ffcf1300511023e48b1845b Mon Sep 17 00:00:00 2001 From: yunfeng0817 Date: Sun, 8 Dec 2024 23:46:01 -0800 Subject: [PATCH 13/20] fix rrweb-player dts bug --- packages/rrweb-player/src/main.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/rrweb-player/src/main.ts b/packages/rrweb-player/src/main.ts index 6d901732b3..712edf8042 100644 --- a/packages/rrweb-player/src/main.ts +++ b/packages/rrweb-player/src/main.ts @@ -1,6 +1,10 @@ import _Player from './Player.svelte'; import type { RRwebPlayerOptions } from './types'; -export class Player extends _Player { + +// Make sure generated Player type inherit all the props of _Player +type SvelteComponentProps = InstanceType; + +export class Player extends _Player implements SvelteComponentProps { constructor( options: { // for compatibility From 3f24fcb077398f8fc10c37a225f0e23adc5427ea Mon Sep 17 00:00:00 2001 From: yunfeng0817 Date: Mon, 9 Dec 2024 00:42:16 -0800 Subject: [PATCH 14/20] fix lint error --- packages/web-extension/src/content/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/web-extension/src/content/index.ts b/packages/web-extension/src/content/index.ts index 51899c5dca..0fb866c1e5 100644 --- a/packages/web-extension/src/content/index.ts +++ b/packages/web-extension/src/content/index.ts @@ -1,4 +1,4 @@ -import Browser, { type Storage } from 'webextension-polyfill'; +import Browser from 'webextension-polyfill'; import { nanoid } from 'nanoid'; import type { eventWithTime } from '@rrweb/types'; import { @@ -166,9 +166,7 @@ async function initMainPage() { async function initCrossOriginIframe() { Browser.storage.local.onChanged.addListener((change) => { if (change[LocalDataKey.recorderStatus]) { - const statusChange = change[ - LocalDataKey.recorderStatus - ] as Storage.StorageChange; + const statusChange = change[LocalDataKey.recorderStatus]; const newStatus = statusChange.newValue as LocalData[LocalDataKey.recorderStatus]; if (newStatus.status === RecorderStatus.RECORDING) startRecord(); From 32e9577a902efb0be0f468a688d938d74d40542a Mon Sep 17 00:00:00 2001 From: yunfeng0817 Date: Mon, 9 Dec 2024 00:42:25 -0800 Subject: [PATCH 15/20] Revert "fix rrweb-player dts bug" This reverts commit 4f0bf98a9f3f0a6d3ffcf1300511023e48b1845b. --- packages/rrweb-player/src/main.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/rrweb-player/src/main.ts b/packages/rrweb-player/src/main.ts index 712edf8042..6d901732b3 100644 --- a/packages/rrweb-player/src/main.ts +++ b/packages/rrweb-player/src/main.ts @@ -1,10 +1,6 @@ import _Player from './Player.svelte'; import type { RRwebPlayerOptions } from './types'; - -// Make sure generated Player type inherit all the props of _Player -type SvelteComponentProps = InstanceType; - -export class Player extends _Player implements SvelteComponentProps { +export class Player extends _Player { constructor( options: { // for compatibility From d0973885855aac7e8ba407c7b36a807090378809 Mon Sep 17 00:00:00 2001 From: yunfeng0817 Date: Mon, 9 Dec 2024 01:33:38 -0800 Subject: [PATCH 16/20] try to solve the odd eslint error --- packages/web-extension/src/pages/Player.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web-extension/src/pages/Player.tsx b/packages/web-extension/src/pages/Player.tsx index 330c68ef5c..de7ccb5d80 100644 --- a/packages/web-extension/src/pages/Player.tsx +++ b/packages/web-extension/src/pages/Player.tsx @@ -46,7 +46,7 @@ export default function Player() { console.error(err); }); return () => { - playerRef.current?.pause(); + playerRef.current?.getReplayer().pause(); }; }, [sessionId]); From df7ca9a8bfc444091c57c28c18f4ff3546b85815 Mon Sep 17 00:00:00 2001 From: yunfeng0817 Date: Tue, 10 Dec 2024 00:01:19 -0800 Subject: [PATCH 17/20] disable eslint check for that line --- packages/web-extension/src/pages/Player.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/web-extension/src/pages/Player.tsx b/packages/web-extension/src/pages/Player.tsx index de7ccb5d80..f2e3498910 100644 --- a/packages/web-extension/src/pages/Player.tsx +++ b/packages/web-extension/src/pages/Player.tsx @@ -46,7 +46,8 @@ export default function Player() { console.error(err); }); return () => { - playerRef.current?.getReplayer().pause(); + // eslint-disable-next-line + playerRef.current?.pause(); }; }, [sessionId]); From bae326890435db911cf9d43ba4d647338777c745 Mon Sep 17 00:00:00 2001 From: yunfeng0817 Date: Tue, 10 Dec 2024 00:11:42 -0800 Subject: [PATCH 18/20] merge the extension-release action into release action --- .github/workflows/extension-release.yml | 29 ------------------------- .github/workflows/release.yml | 17 +++++++++++---- 2 files changed, 13 insertions(+), 33 deletions(-) delete mode 100644 .github/workflows/extension-release.yml diff --git a/.github/workflows/extension-release.yml b/.github/workflows/extension-release.yml deleted file mode 100644 index bc8833fa93..0000000000 --- a/.github/workflows/extension-release.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Extension Release - -on: - workflow_dispatch: - -jobs: - publish-extension: - name: Publish to Chrome Web Store - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - uses: actions/setup-node@v3 - with: - node-version: lts/* - - name: Install Dependencies - run: yarn install --frozen-lockfile - - name: Build Project - run: NODE_OPTIONS='--max-old-space-size=4096' DISABLE_WORKER_INLINING=true yarn turbo run prepublish --filter=@rrweb/web-extension - - - uses: mnao305/chrome-extension-upload@v5.0.0 - with: - extension-id: 'pdaldeopoccdhlkabbkcjmecmmoninhe' - file-path: ./packages/web-extension/dist/chrome.zip - client-id: ${{ secrets.CWS_CLIENT_ID }} - client-secret: ${{ secrets.CWS_CLIENT_SECRET }} - refresh-token: ${{ secrets.CWS_REFRESH_TOKEN }} - publish: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f870937fd3..2a3b64e0d5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,16 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - # - name: Send a Slack notification if a publish happens - # if: steps.changesets.outputs.published == 'true' - # # You can do something when a publish happens. - # run: my-slack-bot send-notification --message "A new version of ${GITHUB_REPOSITORY} was published!" + - name: Build Chrome Extension + if: steps.changesets.outputs.published == 'true' + run: NODE_OPTIONS='--max-old-space-size=4096' DISABLE_WORKER_INLINING=true yarn turbo run prepublish --filter=@rrweb/web-extension + + - uses: mnao305/chrome-extension-upload@v5.0.0 + if: steps.changesets.outputs.published == 'true' + with: + extension-id: 'pdaldeopoccdhlkabbkcjmecmmoninhe' + file-path: ./packages/web-extension/dist/chrome.zip + client-id: ${{ secrets.CWS_CLIENT_ID }} + client-secret: ${{ secrets.CWS_CLIENT_SECRET }} + refresh-token: ${{ secrets.CWS_REFRESH_TOKEN }} + publish: true From e12b41549c8fc7cf48dc26cd9d4aaa6a013401af Mon Sep 17 00:00:00 2001 From: yunfeng0817 Date: Tue, 10 Dec 2024 00:25:18 -0800 Subject: [PATCH 19/20] apply review suggestions --- packages/web-extension/package.json | 1 + packages/web-extension/src/pages/Player.tsx | 6 +++-- yarn.lock | 25 +++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/packages/web-extension/package.json b/packages/web-extension/package.json index 2a4c7b39be..f9f340a53c 100644 --- a/packages/web-extension/package.json +++ b/packages/web-extension/package.json @@ -19,6 +19,7 @@ }, "devDependencies": { "@rrweb/types": "^2.0.0-alpha.18", + "@types/chrome": "^0.0.287", "@types/react-dom": "^18.0.6", "@types/semver": "^7.5.8", "@types/webextension-polyfill": "^0.9.1", diff --git a/packages/web-extension/src/pages/Player.tsx b/packages/web-extension/src/pages/Player.tsx index f2e3498910..56f3fa4d00 100644 --- a/packages/web-extension/src/pages/Player.tsx +++ b/packages/web-extension/src/pages/Player.tsx @@ -1,3 +1,4 @@ +/// import { useRef, useEffect, useState } from 'react'; import { useParams } from 'react-router-dom'; import Replayer from 'rrweb-player'; @@ -29,9 +30,10 @@ export default function Player() { .then((events) => { if (!playerElRef.current) return; + const manifest = chrome.runtime.getManifest(); + const rrwebPlayerVersion = manifest.version_name || manifest.version; const linkEl = document.createElement('link'); - linkEl.href = - 'https://cdn.jsdelivr.net/npm/rrweb-player@alpha/dist/style.min.css'; + linkEl.href = `https://cdn.jsdelivr.net/npm/rrweb-player@${rrwebPlayerVersion}/dist/style.min.css`; linkEl.rel = 'stylesheet'; document.head.appendChild(linkEl); playerRef.current = new Replayer({ diff --git a/yarn.lock b/yarn.lock index 0cfcbe03b6..ddbfc5571e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2585,6 +2585,14 @@ dependencies: "@babel/types" "^7.20.7" +"@types/chrome@^0.0.287": + version "0.0.287" + resolved "https://registry.yarnpkg.com/@types/chrome/-/chrome-0.0.287.tgz#239969b1195b441836d2137125543b5241c41157" + integrity sha512-wWhBNPNXZHwycHKNYnexUcpSbrihVZu++0rdp6GEk5ZgAglenLx+RwdEouh6FrHS0XQiOxSd62yaujM1OoQlZQ== + dependencies: + "@types/filesystem" "*" + "@types/har-format" "*" + "@types/cookie@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.6.0.tgz#eac397f28bf1d6ae0ae081363eca2f425bedf0d5" @@ -2622,6 +2630,18 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== +"@types/filesystem@*": + version "0.0.36" + resolved "https://registry.yarnpkg.com/@types/filesystem/-/filesystem-0.0.36.tgz#7227c2d76bfed1b21819db310816c7821d303857" + integrity sha512-vPDXOZuannb9FZdxgHnqSwAG/jvdGM8Wq+6N4D/d80z+D4HWH+bItqsZaVRQykAn6WEVeEkLm2oQigyHtgb0RA== + dependencies: + "@types/filewriter" "*" + +"@types/filewriter@*": + version "0.0.33" + resolved "https://registry.yarnpkg.com/@types/filewriter/-/filewriter-0.0.33.tgz#d9d611db9d9cd99ae4e458de420eeb64ad604ea8" + integrity sha512-xFU8ZXTw4gd358lb2jw25nxY9QAgqn2+bKKjKOYfNCzN4DKCFetK7sPtrlpg66Ywe3vWY9FNxprZawAh9wfJ3g== + "@types/fs-extra@11.0.1": version "11.0.1" resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-11.0.1.tgz#f542ec47810532a8a252127e6e105f487e0a6ea5" @@ -2637,6 +2657,11 @@ dependencies: "@types/node" "*" +"@types/har-format@*": + version "1.2.16" + resolved "https://registry.yarnpkg.com/@types/har-format/-/har-format-1.2.16.tgz#b71ede8681400cc08b3685f061c31e416cf94944" + integrity sha512-fluxdy7ryD3MV6h8pTfTYpy/xQzCFC7m89nOH9y94cNqJ1mDIDPut7MnRHI3F6qRmh/cT2fUjG1MLdCNb4hE9A== + "@types/http-cache-semantics@^4.0.2": version "4.0.4" resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz#b979ebad3919799c979b17c72621c0bc0a31c6c4" From d09f561073304b2fcbd426576de1f03d46241e55 Mon Sep 17 00:00:00 2001 From: yunfeng0817 Date: Tue, 10 Dec 2024 00:27:19 -0800 Subject: [PATCH 20/20] add name --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2a3b64e0d5..5ba49c811b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,7 +37,8 @@ jobs: if: steps.changesets.outputs.published == 'true' run: NODE_OPTIONS='--max-old-space-size=4096' DISABLE_WORKER_INLINING=true yarn turbo run prepublish --filter=@rrweb/web-extension - - uses: mnao305/chrome-extension-upload@v5.0.0 + - name: Publish Chrome Extension + uses: mnao305/chrome-extension-upload@v5.0.0 if: steps.changesets.outputs.published == 'true' with: extension-id: 'pdaldeopoccdhlkabbkcjmecmmoninhe'