vite-plugin-observe 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Vite Plugin Runtime
2
+
3
+ This is an vite plugin.
package/dist/index.cjs ADDED
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ default: () => viteObserverPlugin
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+ function viteObserverPlugin(options = {}) {
27
+ const { type = "default", serverPrefix = "", sourcePrefix = "", scripts = [] } = options;
28
+ const errorReportUrl = `${serverPrefix}/runtime/error`;
29
+ const sourceUrl = sourcePrefix || "https://appgo-app-prod.bj.bcebos.com/mali/js";
30
+ const defaultScripts = type === "default" ? [
31
+ {
32
+ tag: "script",
33
+ injectTo: "head-prepend",
34
+ attrs: {
35
+ src: `${sourceUrl}/error.js`
36
+ }
37
+ },
38
+ {
39
+ tag: "script",
40
+ injectTo: "head-prepend",
41
+ attrs: {
42
+ src: `${sourceUrl}/inspector.js`
43
+ }
44
+ }
45
+ ] : [
46
+ {
47
+ tag: "script",
48
+ injectTo: "head-prepend",
49
+ children: `
50
+ (function() {
51
+ function reportError(error) {
52
+ fetch("${errorReportUrl}", {
53
+ method: "POST",
54
+ headers: { "Content-Type": "application/json" },
55
+ body: JSON.stringify({
56
+ timestamp: Date.now(),
57
+ userAgent: navigator.userAgent,
58
+ ...error
59
+ })
60
+ }).catch(() => {});
61
+ }
62
+
63
+ window.addEventListener('error', e => {
64
+ reportError({
65
+ type: 'error',
66
+ message: e?.message,
67
+ stack: e.error?.stack,
68
+ filename: e?.filename,
69
+ lineno: e?.lineno,
70
+ colno: e?.colno,
71
+ error: e?.error,
72
+ });
73
+ });
74
+
75
+ window.addEventListener('unhandledrejection', e => {
76
+ reportError({
77
+ type: 'unhandledrejection',
78
+ message: e.reason?.message ?? e.reason,
79
+ stack: e.reason?.stack ?? '',
80
+ filename: window.location.href,
81
+ });
82
+ });
83
+ })();
84
+ `
85
+ }
86
+ ];
87
+ return {
88
+ name: "vite-plugin-observe",
89
+ apply: "serve",
90
+ configureServer(server) {
91
+ server.middlewares.use((req, res, next) => {
92
+ if (req.url === errorReportUrl && req.method === "POST") {
93
+ let body = "";
94
+ req.on("data", (chunk) => body += chunk);
95
+ req.on("end", () => {
96
+ try {
97
+ const { type: type2, message, stack, filename, lineno, colno } = JSON.parse(body);
98
+ console.error(`${(/* @__PURE__ */ new Date()).toLocaleString()} ${type2}: ${message}`);
99
+ if (filename) console.error(`${filename}:${lineno ?? ""}:${colno ?? ""}`);
100
+ if (stack) console.error(stack);
101
+ } catch (e) {
102
+ console.error(`${(/* @__PURE__ */ new Date()).toLocaleString()} error: ${e}`);
103
+ }
104
+ res.statusCode = 204;
105
+ res.end();
106
+ });
107
+ } else {
108
+ next();
109
+ }
110
+ });
111
+ },
112
+ transformIndexHtml() {
113
+ return [
114
+ {
115
+ tag: "script",
116
+ injectTo: "head-prepend",
117
+ children: `window.__ERROR_REPORT_URL__ = '${errorReportUrl}';`
118
+ },
119
+ ...defaultScripts,
120
+ ...scripts
121
+ ];
122
+ }
123
+ };
124
+ }
125
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Plugin } from 'vite';\nimport type { PluginOptions } from './types';\n\nexport default function viteObserverPlugin(options: PluginOptions = {}): Plugin {\n const { type = 'default', serverPrefix = '', sourcePrefix = '', scripts = [] } = options;\n\n const errorReportUrl = `${serverPrefix}/runtime/error`;\n\n const sourceUrl = sourcePrefix || 'https://appgo-app-prod.bj.bcebos.com/mali/js';\n\n const defaultScripts =\n type === 'default'\n ? [\n {\n tag: 'script',\n injectTo: 'head-prepend' as const,\n attrs: {\n src: `${sourceUrl}/error.js`,\n },\n },\n {\n tag: 'script',\n injectTo: 'head-prepend' as const,\n attrs: {\n src: `${sourceUrl}/inspector.js`,\n },\n },\n ]\n : [\n {\n tag: 'script',\n injectTo: 'head-prepend' as const,\n children: `\n (function() {\n function reportError(error) {\n fetch(\"${errorReportUrl}\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n timestamp: Date.now(),\n userAgent: navigator.userAgent,\n ...error\n })\n }).catch(() => {});\n }\n\n window.addEventListener('error', e => {\n reportError({\n type: 'error',\n message: e?.message,\n stack: e.error?.stack,\n filename: e?.filename,\n lineno: e?.lineno,\n colno: e?.colno,\n error: e?.error,\n });\n });\n\n window.addEventListener('unhandledrejection', e => {\n reportError({\n type: 'unhandledrejection',\n message: e.reason?.message ?? e.reason,\n stack: e.reason?.stack ?? '',\n filename: window.location.href,\n });\n });\n })();\n `,\n },\n ];\n\n return {\n name: 'vite-plugin-observe',\n apply: 'serve',\n configureServer(server) {\n server.middlewares.use((req, res, next) => {\n if (req.url === errorReportUrl && req.method === 'POST') {\n let body = '';\n req.on('data', (chunk) => (body += chunk));\n req.on('end', () => {\n try {\n const { type, message, stack, filename, lineno, colno } = JSON.parse(body);\n console.error(`${new Date().toLocaleString()} ${type}: ${message}`);\n if (filename) console.error(`${filename}:${lineno ?? ''}:${colno ?? ''}`);\n if (stack) console.error(stack);\n } catch (e) {\n console.error(`${new Date().toLocaleString()} error: ${e}`);\n }\n res.statusCode = 204;\n res.end();\n });\n } else {\n next();\n }\n });\n },\n\n transformIndexHtml() {\n return [\n {\n tag: 'script',\n injectTo: 'head-prepend' as const,\n children: `window.__ERROR_REPORT_URL__ = '${errorReportUrl}';`,\n },\n ...defaultScripts,\n ...scripts,\n ];\n },\n };\n}\n\nexport type { PluginOptions } from './types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGe,SAAR,mBAAoC,UAAyB,CAAC,GAAW;AAC5E,QAAM,EAAE,OAAO,WAAW,eAAe,IAAI,eAAe,IAAI,UAAU,CAAC,EAAE,IAAI;AAEjF,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YAClC,SAAS,GAAG;AACR,sBAAQ,MAAM,IAAG,oBAAI,KAAK,GAAE,eAAe,CAAC,WAAW,CAAC,EAAE;AAAA,YAC9D;AACA,gBAAI,aAAa;AACjB,gBAAI,IAAI;AAAA,UACZ,CAAC;AAAA,QACL,OAAO;AACH,eAAK;AAAA,QACT;AAAA,MACJ,CAAC;AAAA,IACL;AAAA,IAEA,qBAAqB;AACjB,aAAO;AAAA,QACH;AAAA,UACI,KAAK;AAAA,UACL,UAAU;AAAA,UACV,UAAU,kCAAkC,cAAc;AAAA,QAC9D;AAAA,QACA,GAAG;AAAA,QACH,GAAG;AAAA,MACP;AAAA,IACJ;AAAA,EACJ;AACJ;","names":["type"]}
@@ -0,0 +1,17 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ interface PluginOptions {
4
+ type?: 'default' | 'custom';
5
+ serverPrefix?: string;
6
+ sourcePrefix?: string;
7
+ scripts?: Array<{
8
+ tag: string;
9
+ injectTo: 'head' | 'body' | 'head-prepend' | 'body-prepend';
10
+ attrs?: Record<string, string>;
11
+ children?: string;
12
+ }>;
13
+ }
14
+
15
+ declare function viteObserverPlugin(options?: PluginOptions): Plugin;
16
+
17
+ export { type PluginOptions, viteObserverPlugin as default };
@@ -0,0 +1,17 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ interface PluginOptions {
4
+ type?: 'default' | 'custom';
5
+ serverPrefix?: string;
6
+ sourcePrefix?: string;
7
+ scripts?: Array<{
8
+ tag: string;
9
+ injectTo: 'head' | 'body' | 'head-prepend' | 'body-prepend';
10
+ attrs?: Record<string, string>;
11
+ children?: string;
12
+ }>;
13
+ }
14
+
15
+ declare function viteObserverPlugin(options?: PluginOptions): Plugin;
16
+
17
+ export { type PluginOptions, viteObserverPlugin as default };
package/dist/index.js ADDED
@@ -0,0 +1,104 @@
1
+ // src/index.ts
2
+ function viteObserverPlugin(options = {}) {
3
+ const { type = "default", serverPrefix = "", sourcePrefix = "", scripts = [] } = options;
4
+ const errorReportUrl = `${serverPrefix}/runtime/error`;
5
+ const sourceUrl = sourcePrefix || "https://appgo-app-prod.bj.bcebos.com/mali/js";
6
+ const defaultScripts = type === "default" ? [
7
+ {
8
+ tag: "script",
9
+ injectTo: "head-prepend",
10
+ attrs: {
11
+ src: `${sourceUrl}/error.js`
12
+ }
13
+ },
14
+ {
15
+ tag: "script",
16
+ injectTo: "head-prepend",
17
+ attrs: {
18
+ src: `${sourceUrl}/inspector.js`
19
+ }
20
+ }
21
+ ] : [
22
+ {
23
+ tag: "script",
24
+ injectTo: "head-prepend",
25
+ children: `
26
+ (function() {
27
+ function reportError(error) {
28
+ fetch("${errorReportUrl}", {
29
+ method: "POST",
30
+ headers: { "Content-Type": "application/json" },
31
+ body: JSON.stringify({
32
+ timestamp: Date.now(),
33
+ userAgent: navigator.userAgent,
34
+ ...error
35
+ })
36
+ }).catch(() => {});
37
+ }
38
+
39
+ window.addEventListener('error', e => {
40
+ reportError({
41
+ type: 'error',
42
+ message: e?.message,
43
+ stack: e.error?.stack,
44
+ filename: e?.filename,
45
+ lineno: e?.lineno,
46
+ colno: e?.colno,
47
+ error: e?.error,
48
+ });
49
+ });
50
+
51
+ window.addEventListener('unhandledrejection', e => {
52
+ reportError({
53
+ type: 'unhandledrejection',
54
+ message: e.reason?.message ?? e.reason,
55
+ stack: e.reason?.stack ?? '',
56
+ filename: window.location.href,
57
+ });
58
+ });
59
+ })();
60
+ `
61
+ }
62
+ ];
63
+ return {
64
+ name: "vite-plugin-observe",
65
+ apply: "serve",
66
+ configureServer(server) {
67
+ server.middlewares.use((req, res, next) => {
68
+ if (req.url === errorReportUrl && req.method === "POST") {
69
+ let body = "";
70
+ req.on("data", (chunk) => body += chunk);
71
+ req.on("end", () => {
72
+ try {
73
+ const { type: type2, message, stack, filename, lineno, colno } = JSON.parse(body);
74
+ console.error(`${(/* @__PURE__ */ new Date()).toLocaleString()} ${type2}: ${message}`);
75
+ if (filename) console.error(`${filename}:${lineno ?? ""}:${colno ?? ""}`);
76
+ if (stack) console.error(stack);
77
+ } catch (e) {
78
+ console.error(`${(/* @__PURE__ */ new Date()).toLocaleString()} error: ${e}`);
79
+ }
80
+ res.statusCode = 204;
81
+ res.end();
82
+ });
83
+ } else {
84
+ next();
85
+ }
86
+ });
87
+ },
88
+ transformIndexHtml() {
89
+ return [
90
+ {
91
+ tag: "script",
92
+ injectTo: "head-prepend",
93
+ children: `window.__ERROR_REPORT_URL__ = '${errorReportUrl}';`
94
+ },
95
+ ...defaultScripts,
96
+ ...scripts
97
+ ];
98
+ }
99
+ };
100
+ }
101
+ export {
102
+ viteObserverPlugin as default
103
+ };
104
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Plugin } from 'vite';\nimport type { PluginOptions } from './types';\n\nexport default function viteObserverPlugin(options: PluginOptions = {}): Plugin {\n const { type = 'default', serverPrefix = '', sourcePrefix = '', scripts = [] } = options;\n\n const errorReportUrl = `${serverPrefix}/runtime/error`;\n\n const sourceUrl = sourcePrefix || 'https://appgo-app-prod.bj.bcebos.com/mali/js';\n\n const defaultScripts =\n type === 'default'\n ? [\n {\n tag: 'script',\n injectTo: 'head-prepend' as const,\n attrs: {\n src: `${sourceUrl}/error.js`,\n },\n },\n {\n tag: 'script',\n injectTo: 'head-prepend' as const,\n attrs: {\n src: `${sourceUrl}/inspector.js`,\n },\n },\n ]\n : [\n {\n tag: 'script',\n injectTo: 'head-prepend' as const,\n children: `\n (function() {\n function reportError(error) {\n fetch(\"${errorReportUrl}\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n timestamp: Date.now(),\n userAgent: navigator.userAgent,\n ...error\n })\n }).catch(() => {});\n }\n\n window.addEventListener('error', e => {\n reportError({\n type: 'error',\n message: e?.message,\n stack: e.error?.stack,\n filename: e?.filename,\n lineno: e?.lineno,\n colno: e?.colno,\n error: e?.error,\n });\n });\n\n window.addEventListener('unhandledrejection', e => {\n reportError({\n type: 'unhandledrejection',\n message: e.reason?.message ?? e.reason,\n stack: e.reason?.stack ?? '',\n filename: window.location.href,\n });\n });\n })();\n `,\n },\n ];\n\n return {\n name: 'vite-plugin-observe',\n apply: 'serve',\n configureServer(server) {\n server.middlewares.use((req, res, next) => {\n if (req.url === errorReportUrl && req.method === 'POST') {\n let body = '';\n req.on('data', (chunk) => (body += chunk));\n req.on('end', () => {\n try {\n const { type, message, stack, filename, lineno, colno } = JSON.parse(body);\n console.error(`${new Date().toLocaleString()} ${type}: ${message}`);\n if (filename) console.error(`${filename}:${lineno ?? ''}:${colno ?? ''}`);\n if (stack) console.error(stack);\n } catch (e) {\n console.error(`${new Date().toLocaleString()} error: ${e}`);\n }\n res.statusCode = 204;\n res.end();\n });\n } else {\n next();\n }\n });\n },\n\n transformIndexHtml() {\n return [\n {\n tag: 'script',\n injectTo: 'head-prepend' as const,\n children: `window.__ERROR_REPORT_URL__ = '${errorReportUrl}';`,\n },\n ...defaultScripts,\n ...scripts,\n ];\n },\n };\n}\n\nexport type { PluginOptions } from './types';\n"],"mappings":";AAGe,SAAR,mBAAoC,UAAyB,CAAC,GAAW;AAC5E,QAAM,EAAE,OAAO,WAAW,eAAe,IAAI,eAAe,IAAI,UAAU,CAAC,EAAE,IAAI;AAEjF,QAAM,iBAAiB,GAAG,YAAY;AAEtC,QAAM,YAAY,gBAAgB;AAElC,QAAM,iBACF,SAAS,YACH;AAAA,IACI;AAAA,MACI,KAAK;AAAA,MACL,UAAU;AAAA,MACV,OAAO;AAAA,QACH,KAAK,GAAG,SAAS;AAAA,MACrB;AAAA,IACJ;AAAA,IACA;AAAA,MACI,KAAK;AAAA,MACL,UAAU;AAAA,MACV,OAAO;AAAA,QACH,KAAK,GAAG,SAAS;AAAA,MACrB;AAAA,IACJ;AAAA,EACJ,IACA;AAAA,IACI;AAAA,MACI,KAAK;AAAA,MACL,UAAU;AAAA,MACV,UAAU;AAAA;AAAA;AAAA,iCAGC,cAAc;AAAA;AAAA;AAA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/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "vite-plugin-observe",
3
+ "version": "1.0.0",
4
+ "description": "vite-plugin-observe",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "dev": "pnpm run build --watch",
21
+ "build": "tsup src/index.ts --format cjs,esm --dts --sourcemap --clean",
22
+ "prepublishOnly": "pnpm run build",
23
+ "demo:dev": "cd demo && pnpm run dev",
24
+ "demo:build": "cd demo && pnpm run build"
25
+ },
26
+ "keywords": [
27
+ "vite",
28
+ "vite-plugin",
29
+ "observer",
30
+ "error"
31
+ ],
32
+ "author": "",
33
+ "license": "MIT",
34
+ "devDependencies": {
35
+ "@types/node": "^22.10.2",
36
+ "tsup": "^8.3.5",
37
+ "typescript": "^5.7.2",
38
+ "vite": "^7.3.0"
39
+ },
40
+ "peerDependencies": {
41
+ "vite": "*"
42
+ },
43
+ "peerDependenciesMeta": {
44
+ "vite": {
45
+ "optional": true
46
+ }
47
+ }
48
+ }