some minor changes for releasing the extension and revert failed publish PR #1123 (#1132)

* improve extension bundle

* Revert "Version Packages (alpha) (#1123)"

This reverts commit 39f8c24f1d.
This commit is contained in:
Yun Feng
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 6c9ff8183a
commit 617e63c483
20 changed files with 56 additions and 199 deletions

View File

@@ -1,11 +0,0 @@
# @rrweb/web-extension
## 2.0.0-alpha.5
### Patch Changes
- [#1044](https://github.com/rrweb-io/rrweb/pull/1044) [`282c8fa`](https://github.com/rrweb-io/rrweb/commit/282c8fa415318e56e8b63fa30ce3f173813b39c3) Thanks [@YunFeng0817](https://github.com/YunFeng0817)! - Add rrweb browser extension
- Updated dependencies [[`1385f7a`](https://github.com/rrweb-io/rrweb/commit/1385f7acc0052f83be1458a7b00e18c026ee393f), [`227d43a`](https://github.com/rrweb-io/rrweb/commit/227d43abb93d57cadc70c760b28c46911bf7d8ff), [`227d43a`](https://github.com/rrweb-io/rrweb/commit/227d43abb93d57cadc70c760b28c46911bf7d8ff), [`3cc4323`](https://github.com/rrweb-io/rrweb/commit/3cc4323094065a12f8b65afecd45061d604e245f), [`502d15d`](https://github.com/rrweb-io/rrweb/commit/502d15df9f7f43b3408ccfbb3f14c4bb007883c4), [`8d209a6`](https://github.com/rrweb-io/rrweb/commit/8d209a62f31c4c80e3e5bc36e47d7282ee854ac7)]:
- rrweb@2.0.0-alpha.5
- rrweb-player@2.0.0-alpha.5

View File

@@ -1,7 +1,7 @@
{
"name": "@rrweb/web-extension",
"private": true,
"version": "2.0.0-alpha.5",
"version": "2.0.0-alpha.4",
"description": "The web extension of rrweb which helps to run rrweb on any website out of box",
"author": "rrweb-io",
"license": "MIT",
@@ -16,7 +16,7 @@
"prepublish": "npm run pack:chrome && npm run pack:firefox"
},
"devDependencies": {
"@rrweb/types": "^2.0.0-alpha.5",
"@rrweb/types": "^2.0.0-alpha.4",
"@types/react-dom": "^18.0.6",
"@types/webextension-polyfill": "^0.9.1",
"@vitejs/plugin-react": "^2.1.0",
@@ -25,7 +25,7 @@
"typescript": "^4.7.3",
"vite": "^3.1.8",
"vite-plugin-web-extension": "^1.4.5",
"vite-plugin-zip": "^1.0.1",
"vite-plugin-zip-pack": "^1.0.5",
"webextension-polyfill": "^0.10.0"
},
"dependencies": {
@@ -41,7 +41,7 @@
"react-dom": "^18.2.0",
"react-icons": "^4.4.0",
"react-router-dom": "^6.4.1",
"rrweb": "^2.0.0-alpha.5",
"rrweb-player": "^2.0.0-alpha.5"
"rrweb": "^2.0.0-alpha.4",
"rrweb-player": "^1.0.0-alpha.4"
}
}

View File

@@ -40,7 +40,7 @@ void (() => {
);
if (isInCrossOriginIFrame()) {
void initCrossOriginIframe();
} else {
} else if (window === window.top) {
void initMainPage();
}
})();
@@ -154,7 +154,9 @@ async function initMainPage() {
}
// Before unload pages, cache the new events in the local storage.
window.addEventListener('beforeunload', () => {
window.addEventListener('beforeunload', (event) => {
event.preventDefault();
if (newEvents.length === 0) return;
void Browser.storage.local.set({
[LocalDataKey.bufferedEvents]: bufferedEvents.concat(newEvents),
});

View File

@@ -43,7 +43,13 @@ const messageHandler = (
startRecord(data.config || {});
},
[MessageName.StopRecord]: () => {
if (stopFn) stopFn();
if (stopFn) {
try {
stopFn();
} catch (e) {
//
}
}
postMessage({
message: MessageName.RecordStopped,
events,

View File

@@ -130,11 +130,20 @@ class Channel {
* @param eventName - event name
* @param handler - event handler, accepts two arguments:
* detail: event detail
* source: source of the event, chrome.runtime.MessageSender object
* source: source of the event, Browser.runtime.MessageSender object
* @returns a function to remove the handler
*/
public on(event: string, handler: (detail: unknown) => unknown) {
return this.emitter.on(event, handler);
public on(
event: string,
handler: (detail: unknown, sender: Runtime.MessageSender) => unknown,
) {
const emitHandler = ((data: {
detail: unknown;
sender: Runtime.MessageSender;
}) => {
handler(data.detail, data.sender);
}) as (data: unknown) => unknown;
return this.emitter.on(event, emitHandler);
}
/**

View File

@@ -5,7 +5,7 @@ import {
PluginOption,
} from 'vite';
import webExtension, { readJsonFile } from 'vite-plugin-web-extension';
import zip from 'vite-plugin-zip';
import zip from 'vite-plugin-zip-pack';
import * as path from 'path';
import type { PackageJson } from 'type-fest';
import react from '@vitejs/plugin-react';
@@ -94,8 +94,9 @@ export default defineConfig({
),
process.env.ZIP === 'true' &&
zip({
dir: 'dist',
outputName: process.env.TARGET_BROWSER,
inDir: `dist/${process.env.TARGET_BROWSER || 'chrome'}`,
outDir: 'dist',
outFileName: `${process.env.TARGET_BROWSER || 'chrome'}.zip`,
}),
],
resolve: {