browser-console-mcp 1.0.1 → 1.0.4
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/bin/copy-html2canvas.js +26 -2
- package/dist/browser/index.js +1 -1
- package/dist/client/browser-console-mcp.js +1 -1
- package/dist/client/index.js +13 -13
- package/dist/server/index.js +9 -9
- package/dist/server/static-server.js +4 -4
- package/package.json +10 -2
- package/readme.md +110 -196
- package/dist/browser/index.js.map +0 -1
- package/dist/client/browser-console-mcp.js.map +0 -1
- package/rollup.browser.config.js +0 -23
- package/rollup.config.js +0 -22
package/bin/copy-html2canvas.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copy html2canvas to static resources directory
|
|
3
|
+
* This script handles html2canvas as an optional dependency
|
|
3
4
|
*/
|
|
4
5
|
|
|
5
6
|
import fs from "node:fs";
|
|
@@ -35,12 +36,35 @@ function ensureDirectoryExists(dirPath) {
|
|
|
35
36
|
// Copy file
|
|
36
37
|
function copyFile(source, target) {
|
|
37
38
|
try {
|
|
39
|
+
if (!fs.existsSync(source)) {
|
|
40
|
+
console.warn(`Warning: html2canvas not found at ${source}`);
|
|
41
|
+
console.warn(
|
|
42
|
+
"Screenshot functionality will not be available unless html2canvas is installed.",
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
// Create a minimal placeholder file
|
|
46
|
+
const placeholder = `
|
|
47
|
+
// html2canvas is not installed
|
|
48
|
+
// Install it with: pnpm add html2canvas
|
|
49
|
+
console.warn("html2canvas is not installed. Screenshot functionality is disabled.");
|
|
50
|
+
export default function() {
|
|
51
|
+
throw new Error("html2canvas is not installed");
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
ensureDirectoryExists(targetDir);
|
|
56
|
+
fs.writeFileSync(target, placeholder);
|
|
57
|
+
console.log(`Created placeholder file at: ${target}`);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
38
61
|
const data = fs.readFileSync(source);
|
|
39
62
|
fs.writeFileSync(target, data);
|
|
40
63
|
console.log(`File copied successfully: ${source} -> ${target}`);
|
|
41
64
|
} catch (error) {
|
|
42
65
|
console.error(`Failed to copy file: ${error.message}`);
|
|
43
|
-
process
|
|
66
|
+
// Don't exit process, just warn
|
|
67
|
+
console.warn("Screenshot functionality may not work correctly.");
|
|
44
68
|
}
|
|
45
69
|
}
|
|
46
70
|
|
|
@@ -48,4 +72,4 @@ function copyFile(source, target) {
|
|
|
48
72
|
console.log("Starting to copy html2canvas...");
|
|
49
73
|
ensureDirectoryExists(targetDir);
|
|
50
74
|
copyFile(sourcePath, targetPath);
|
|
51
|
-
console.log("html2canvas copy completed");
|
|
75
|
+
console.log("html2canvas copy process completed");
|