@elizaos/plugin-pdf 1.0.2 → 2.0.0-alpha.10

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/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "@elizaos/plugin-pdf",
3
- "version": "1.0.2",
3
+ "version": "2.0.0-alpha.10",
4
4
  "type": "module",
5
- "main": "dist/index.js",
6
- "module": "dist/index.js",
5
+ "main": "dist/cjs/index.node.cjs",
6
+ "module": "dist/node/index.node.js",
7
7
  "types": "dist/index.d.ts",
8
+ "browser": "dist/browser/index.browser.js",
9
+ "sideEffects": false,
8
10
  "repository": {
9
11
  "type": "git",
10
12
  "url": "git+https://github.com/elizaos-plugins/plugin-pdf.git"
@@ -12,60 +14,64 @@
12
14
  "exports": {
13
15
  "./package.json": "./package.json",
14
16
  ".": {
15
- "import": {
16
- "types": "./dist/index.d.ts",
17
- "default": "./dist/index.js"
18
- }
17
+ "types": "./dist/index.d.ts",
18
+ "browser": {
19
+ "types": "./dist/browser/index.d.ts",
20
+ "import": "./dist/browser/index.browser.js",
21
+ "default": "./dist/browser/index.browser.js"
22
+ },
23
+ "node": {
24
+ "types": "./dist/node/index.d.ts",
25
+ "import": "./dist/node/index.node.js",
26
+ "require": "./dist/cjs/index.node.cjs",
27
+ "default": "./dist/node/index.node.js"
28
+ },
29
+ "default": "./dist/node/index.node.js"
19
30
  }
20
31
  },
21
32
  "files": [
22
- "dist",
23
- "scripts",
24
- "package.json",
25
- "LICENSE",
26
- "tsup.config.ts"
33
+ "dist"
27
34
  ],
28
35
  "dependencies": {
29
- "@aws-sdk/client-s3": "^3.812.0",
30
- "@aws-sdk/s3-request-presigner": "^3.812.0",
31
- "@elizaos/core": "^1.0.0",
32
- "@types/uuid": "10.0.0",
33
- "capsolver-npm": "2.1.9",
34
- "esbuild-plugin-copy": "^2.1.1",
35
- "fluent-ffmpeg": "2.1.3",
36
- "glob": "11.0.2",
37
- "patchright": "1.52.4",
38
- "pdfjs-dist": "3.11.174",
39
- "uuid": "11.1.0",
40
- "youtube-dl-exec": "3.0.21"
36
+ "@elizaos/core": "alpha",
37
+ "unpdf": "^1.4.0"
41
38
  },
42
- "trustedDependencies": [
43
- "youtube-dl-exec"
44
- ],
45
39
  "devDependencies": {
46
- "@types/node": "22.15.18",
47
- "prettier": "3.5.3",
48
- "typescript": "5.8.3",
49
- "tsup": "8.5.0"
40
+ "@biomejs/biome": "^2.3.11",
41
+ "@types/bun": "^1.3.10",
42
+ "@types/node": "^25.0.3",
43
+ "typescript": "^5.9.3",
44
+ "vitest": "^2.0.0"
50
45
  },
51
46
  "scripts": {
52
- "build": "tsup",
53
- "dev": "tsup --watch",
54
- "postinstall": "node scripts/postinstall.js",
55
- "lint": "prettier --write ./src",
56
- "clean": "rm -rf dist .turbo node_modules .turbo-tsconfig.json tsconfig.tsbuildinfo",
57
- "format": "prettier --write ./src",
58
- "format:check": "prettier --check ./src"
59
- },
60
- "peerDependencies": {
61
- "whatwg-url": "7.1.0"
47
+ "build:ts": "bun run build.ts",
48
+ "dev": "bun --hot build.ts",
49
+ "lint": "bunx @biomejs/biome check --write --unsafe .",
50
+ "lint:check": "bunx @biomejs/biome check .",
51
+ "clean": "rm -rf dist .turbo node_modules",
52
+ "format": "bunx @biomejs/biome format --write .",
53
+ "format:check": "bunx @biomejs/biome format .",
54
+ "typecheck": "tsc --noEmit",
55
+ "test": "vitest run --passWithNoTests",
56
+ "test:ts": "vitest run --passWithNoTests",
57
+ "build": "bun run build.ts"
62
58
  },
63
59
  "publishConfig": {
64
60
  "access": "public"
65
61
  },
66
- "gitHead": "646c632924826e2b75c2304a75ee56959fe4a460",
67
62
  "agentConfig": {
68
63
  "pluginType": "elizaos:plugin:1.0.0",
69
64
  "pluginParameters": {}
65
+ },
66
+ "milady": {
67
+ "platforms": [
68
+ "browser",
69
+ "node"
70
+ ],
71
+ "runtime": "both",
72
+ "platformDetails": {
73
+ "browser": "Browser-compatible build available via exports.browser",
74
+ "node": "Node.js build available via exports.node"
75
+ }
70
76
  }
71
- }
77
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Shaw Walters and elizaOS Contributors
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 DELETED
@@ -1,107 +0,0 @@
1
- # @elizaos/plugin-pdf
2
-
3
- This plugin integrates PDF text extraction capabilities into the ElizaOS platform, allowing agents to read and process content from PDF documents.
4
-
5
- ## Overview
6
-
7
- The `@elizaos/plugin-pdf` provides a service to extract text from PDF files. This enables Eliza OS agents to understand and utilize information contained within PDF documents as part of their operational workflows.
8
-
9
- ## Installation
10
-
11
- To add this plugin to your Eliza OS project, run the following command:
12
-
13
- ```bash
14
- elizaos plugins add @elizaos/plugin-pdf
15
- ```
16
-
17
- ```
18
- bun add @elizaos/plugin-pdf
19
- ```
20
-
21
- ## Configuration
22
-
23
- This plugin does not require any specific environment variables or settings beyond the standard Eliza OS setup. It uses `pdfjs-dist` for local PDF processing and does not rely on external API keys or services for its core functionality.
24
-
25
- ## Usage
26
-
27
- To use this plugin, add its name to the `plugins` array within your character configuration object. Eliza OS will then load and initialize the plugin automatically.
28
-
29
- **Example Character Configuration:**
30
-
31
- ```typescript
32
- const character: Partial<Character> = {
33
- name: 'MyAgent',
34
- plugins: [
35
- // ... other plugins
36
- '@elizaos/plugin-pdf',
37
- // ... other plugins
38
- ],
39
- settings: {
40
- // ... character specific settings
41
- }
42
- };
43
-
44
- // The Eliza OS runtime will automatically make the PdfService available
45
- // when the '@elizaos/plugin-pdf' is included in the character's plugin list.
46
- ```
47
-
48
- Once the plugin is part of the character's configuration, you can access the `PdfService` through the Eliza OS runtime to interact with PDF files.
49
-
50
- ## Services
51
-
52
- ### `PdfService`
53
-
54
- The `PdfService` is responsible for parsing PDF files and extracting their text content.
55
-
56
- **Capabilities:**
57
-
58
- - Converts PDF documents (provided as a Buffer) into plain text.
59
- - Processes multi-page PDF documents.
60
-
61
- **Key Method:**
62
-
63
- - `convertPdfToText(pdfBuffer: Buffer): Promise<string>`: Asynchronously converts a PDF file buffer into a single string containing the text from all pages.
64
-
65
- **Example of using the service:**
66
-
67
- ```typescript
68
- import * as fs from 'node:fs/promises';
69
- import { ServiceType, type IPdfService } from '@elizaos/core'; // Assuming ServiceType and IPdfService are available
70
-
71
- async function extractTextFromPdf(runtime: IAgentRuntime, filePath: string) {
72
- try {
73
- // Obtain the PdfService instance from the runtime
74
- const pdfService = runtime.getService<IPdfService>(ServiceType.PDF);
75
-
76
- if (!pdfService) {
77
- console.error('PdfService not found. Ensure the plugin is registered.');
78
- return;
79
- }
80
-
81
- // Read the PDF file into a buffer
82
- const pdfBuffer = await fs.readFile(filePath);
83
-
84
- // Convert the PDF buffer to text
85
- const textContent = await pdfService.convertPdfToText(pdfBuffer);
86
- console.log('Extracted Text:', textContent);
87
- return textContent;
88
- } catch (error) {
89
- console.error('Error extracting text from PDF:', error);
90
- }
91
- }
92
-
93
- // Assuming 'agentRuntime' is your initialized IAgentRuntime instance
94
- // extractTextFromPdf(agentRuntime, 'path/to/your/document.pdf');
95
- ```
96
-
97
- ## Dependencies
98
-
99
- The primary dependency for PDF processing is:
100
-
101
- - `pdfjs-dist`: A general-purpose, web standards-based platform for parsing and rendering PDFs.
102
-
103
- Ensure that your project's dependencies are correctly installed for the plugin to function.
104
-
105
- ## License
106
-
107
- This plugin is part of the Eliza project. See the main project repository for license information.
package/dist/index.js DELETED
@@ -1,105 +0,0 @@
1
- // src/services/pdf.ts
2
- import { Service, ServiceType, logger } from "@elizaos/core";
3
- import pkg from "pdfjs-dist";
4
- var { getDocument } = pkg;
5
- var PdfService = class _PdfService extends Service {
6
- static serviceType = ServiceType.PDF;
7
- capabilityDescription = "The agent is able to convert PDF files to text";
8
- /**
9
- * Constructor for creating a new instance of the class.
10
- *
11
- * @param {IAgentRuntime} runtime - The runtime object passed to the constructor.
12
- */
13
- constructor(runtime) {
14
- super();
15
- this.runtime = runtime;
16
- }
17
- /**
18
- * Starts the PdfService asynchronously.
19
- * @param {IAgentRuntime} runtime - The runtime object for the agent.
20
- * @returns {Promise<PdfService>} A promise that resolves with the PdfService instance.
21
- */
22
- static async start(runtime) {
23
- const service = new _PdfService(runtime);
24
- return service;
25
- }
26
- /**
27
- * Stop the PDF service in the given runtime.
28
- *
29
- * @param {IAgentRuntime} runtime - The runtime to stop the PDF service in.
30
- * @returns {Promise<void>} - A promise that resolves once the PDF service is stopped.
31
- */
32
- static async stop(runtime) {
33
- const service = runtime.getService(ServiceType.PDF);
34
- if (service) {
35
- await service.stop();
36
- }
37
- }
38
- /**
39
- * Asynchronously stops the process.
40
- * Does nothing.
41
- */
42
- async stop() {
43
- }
44
- /**
45
- * Converts a PDF Buffer to text.
46
- *
47
- * @param {Buffer} pdfBuffer - The PDF Buffer to convert to text.
48
- * @returns {Promise<string>} A Promise that resolves with the text content of the PDF.
49
- */
50
- async convertPdfToText(pdfBuffer) {
51
- try {
52
- const uint8Array = new Uint8Array(pdfBuffer);
53
- const pdf = await getDocument({ data: uint8Array }).promise;
54
- const numPages = pdf.numPages;
55
- const textPages = [];
56
- for (let pageNum = 1; pageNum <= numPages; pageNum++) {
57
- const page = await pdf.getPage(pageNum);
58
- const textContent = await page.getTextContent();
59
- const pageText = textContent.items.filter(isTextItem).map((item) => item.str).join(" ");
60
- textPages.push(pageText);
61
- }
62
- const rawText = textPages.join("\n");
63
- return this.cleanUpContent(rawText);
64
- } catch (error) {
65
- logger.error(`PdfService: Failed to convert PDF to text - error: ${error}, bufferSize: ${pdfBuffer.length}, runtimeId: ${this.runtime?.agentId || "unknown"}`);
66
- throw error;
67
- }
68
- }
69
- /**
70
- * Cleans up PDF text content by removing problematic characters.
71
- *
72
- * @param {string} content - The raw text content from PDF.
73
- * @returns {string} The cleaned text content.
74
- */
75
- cleanUpContent(content) {
76
- try {
77
- const filtered = content.split("").filter((char) => {
78
- const charCode = char.charCodeAt(0);
79
- return !(charCode === 0 || charCode >= 1 && charCode <= 8 || charCode >= 11 && charCode <= 12 || charCode >= 14 && charCode <= 31 || charCode === 127);
80
- }).join("");
81
- const cleaned = filtered.replace(/[^\S\r\n]+/g, " ").replace(/[ \t]+(\r?\n)/g, "$1").trim();
82
- return cleaned;
83
- } catch (error) {
84
- logger.error(`PdfService: Failed to clean up content - error: ${error}, contentLength: ${content.length}`);
85
- return content;
86
- }
87
- }
88
- };
89
- function isTextItem(item) {
90
- return "str" in item;
91
- }
92
-
93
- // src/index.ts
94
- var pdfPlugin = {
95
- name: "pdf",
96
- description: "Plugin for PDF reading and processing",
97
- services: [PdfService],
98
- actions: []
99
- };
100
- var index_default = pdfPlugin;
101
- export {
102
- index_default as default,
103
- pdfPlugin
104
- };
105
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/services/pdf.ts","../src/index.ts"],"sourcesContent":["import { type IAgentRuntime, Service, type ServiceTypeName, ServiceType, logger } from '@elizaos/core';\nimport pkg from 'pdfjs-dist';\nconst { getDocument } = pkg;\nimport type { TextItem, TextMarkedContent } from 'pdfjs-dist/types/src/display/api';\n\n/**\n * Class representing a PDF service that can convert PDF files to text.\n * * @extends Service\n */\nexport class PdfService extends Service {\n static serviceType: ServiceTypeName = ServiceType.PDF;\n capabilityDescription = 'The agent is able to convert PDF files to text';\n\n /**\n * Constructor for creating a new instance of the class.\n *\n * @param {IAgentRuntime} runtime - The runtime object passed to the constructor.\n */\n constructor(runtime: IAgentRuntime) {\n super();\n this.runtime = runtime;\n }\n\n /**\n * Starts the PdfService asynchronously.\n * @param {IAgentRuntime} runtime - The runtime object for the agent.\n * @returns {Promise<PdfService>} A promise that resolves with the PdfService instance.\n */\n static async start(runtime: IAgentRuntime): Promise<PdfService> {\n const service = new PdfService(runtime);\n return service;\n }\n\n /**\n * Stop the PDF service in the given runtime.\n *\n * @param {IAgentRuntime} runtime - The runtime to stop the PDF service in.\n * @returns {Promise<void>} - A promise that resolves once the PDF service is stopped.\n */\n static async stop(runtime: IAgentRuntime) {\n const service = runtime.getService(ServiceType.PDF);\n if (service) {\n await service.stop();\n }\n }\n\n /**\n * Asynchronously stops the process.\n * Does nothing.\n */\n async stop() {\n // do nothing\n }\n\n /**\n * Converts a PDF Buffer to text.\n *\n * @param {Buffer} pdfBuffer - The PDF Buffer to convert to text.\n * @returns {Promise<string>} A Promise that resolves with the text content of the PDF.\n */\n async convertPdfToText(pdfBuffer: Buffer): Promise<string> {\n try {\n const uint8Array = new Uint8Array(pdfBuffer);\n\n const pdf = await getDocument({ data: uint8Array }).promise;\n const numPages = pdf.numPages;\n\n const textPages: string[] = [];\n\n for (let pageNum = 1; pageNum <= numPages; pageNum++) {\n const page = await pdf.getPage(pageNum);\n const textContent = await page.getTextContent();\n const pageText = textContent.items\n .filter(isTextItem)\n .map((item: TextItem) => item.str)\n .join(' ');\n textPages.push(pageText);\n }\n const rawText = textPages.join('\\n');\n\n return this.cleanUpContent(rawText);\n } catch (error) {\n logger.error(`PdfService: Failed to convert PDF to text - error: ${error}, bufferSize: ${pdfBuffer.length}, runtimeId: ${this.runtime?.agentId || 'unknown'}`);\n throw error;\n }\n }\n\n /**\n * Cleans up PDF text content by removing problematic characters.\n *\n * @param {string} content - The raw text content from PDF.\n * @returns {string} The cleaned text content.\n */\n cleanUpContent(content: string): string {\n try {\n // Filter out null characters and other problematic control characters\n const filtered = content\n .split('')\n .filter(char => {\n const charCode = char.charCodeAt(0);\n // Keep all characters except control characters (0-31 and 127)\n // but preserve tab (9), newline (10), and carriage return (13)\n return !(charCode === 0 ||\n (charCode >= 1 && charCode <= 8) ||\n (charCode >= 11 && charCode <= 12) ||\n (charCode >= 14 && charCode <= 31) ||\n charCode === 127);\n })\n .join('');\n\n const cleaned = filtered\n // Collapse spaces and tabs but preserve newlines\n .replace(/[^\\S\\r\\n]+/g, ' ')\n // Trim trailing spaces at end of lines\n .replace(/[ \\t]+(\\r?\\n)/g, '$1')\n // Trim whitespace from start and end\n .trim();\n\n return cleaned;\n } catch (error) {\n logger.error(`PdfService: Failed to clean up content - error: ${error}, contentLength: ${content.length}`);\n // Return original content if cleanup fails\n return content;\n }\n }\n}\n\n// Type guard function\n/**\n * Check if the input is a TextItem.\n *\n * @param item - The input item to check.\n * @returns A boolean indicating if the input is a TextItem.\n */\nfunction isTextItem(item: TextItem | TextMarkedContent): item is TextItem {\n return 'str' in item;\n}\n","import type { Plugin } from \"@elizaos/core\";\n\nimport { PdfService } from \"./services/pdf\";\n\nexport const pdfPlugin: Plugin = {\n name: \"pdf\",\n description: \"Plugin for PDF reading and processing\",\n services: [PdfService],\n actions: [],\n};\n\nexport default pdfPlugin;\n"],"mappings":";AAAA,SAA6B,SAA+B,aAAa,cAAc;AACvF,OAAO,SAAS;AAChB,IAAM,EAAE,YAAY,IAAI;AAOjB,IAAM,aAAN,MAAM,oBAAmB,QAAQ;AAAA,EACtC,OAAO,cAA+B,YAAY;AAAA,EAClD,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOxB,YAAY,SAAwB;AAClC,UAAM;AACN,SAAK,UAAU;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,MAAM,SAA6C;AAC9D,UAAM,UAAU,IAAI,YAAW,OAAO;AACtC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,aAAa,KAAK,SAAwB;AACxC,UAAM,UAAU,QAAQ,WAAW,YAAY,GAAG;AAClD,QAAI,SAAS;AACX,YAAM,QAAQ,KAAK;AAAA,IACrB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,OAAO;AAAA,EAEb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,iBAAiB,WAAoC;AACzD,QAAI;AACF,YAAM,aAAa,IAAI,WAAW,SAAS;AAE3C,YAAM,MAAM,MAAM,YAAY,EAAE,MAAM,WAAW,CAAC,EAAE;AACpD,YAAM,WAAW,IAAI;AAErB,YAAM,YAAsB,CAAC;AAE7B,eAAS,UAAU,GAAG,WAAW,UAAU,WAAW;AACpD,cAAM,OAAO,MAAM,IAAI,QAAQ,OAAO;AACtC,cAAM,cAAc,MAAM,KAAK,eAAe;AAC9C,cAAM,WAAW,YAAY,MAC1B,OAAO,UAAU,EACjB,IAAI,CAAC,SAAmB,KAAK,GAAG,EAChC,KAAK,GAAG;AACX,kBAAU,KAAK,QAAQ;AAAA,MACzB;AACA,YAAM,UAAU,UAAU,KAAK,IAAI;AAEnC,aAAO,KAAK,eAAe,OAAO;AAAA,IACpC,SAAS,OAAO;AACd,aAAO,MAAM,sDAAsD,KAAK,iBAAiB,UAAU,MAAM,gBAAgB,KAAK,SAAS,WAAW,SAAS,EAAE;AAC7J,YAAM;AAAA,IACR;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,eAAe,SAAyB;AACtC,QAAI;AAEF,YAAM,WAAW,QACd,MAAM,EAAE,EACR,OAAO,UAAQ;AACd,cAAM,WAAW,KAAK,WAAW,CAAC;AAGlC,eAAO,EAAE,aAAa,KACnB,YAAY,KAAK,YAAY,KAC7B,YAAY,MAAM,YAAY,MAC9B,YAAY,MAAM,YAAY,MAC/B,aAAa;AAAA,MACjB,CAAC,EACA,KAAK,EAAE;AAEV,YAAM,UAAU,SAEb,QAAQ,eAAe,GAAG,EAE1B,QAAQ,kBAAkB,IAAI,EAE9B,KAAK;AAER,aAAO;AAAA,IACT,SAAS,OAAO;AACd,aAAO,MAAM,mDAAmD,KAAK,oBAAoB,QAAQ,MAAM,EAAE;AAEzG,aAAO;AAAA,IACT;AAAA,EACF;AACF;AASA,SAAS,WAAW,MAAsD;AACxE,SAAO,SAAS;AAClB;;;ACpIO,IAAM,YAAoB;AAAA,EAC/B,MAAM;AAAA,EACN,aAAa;AAAA,EACb,UAAU,CAAC,UAAU;AAAA,EACrB,SAAS,CAAC;AACZ;AAEA,IAAO,gBAAQ;","names":[]}
@@ -1,70 +0,0 @@
1
- import { execSync } from "node:child_process";
2
- import fs from "node:fs";
3
- import os from "node:os";
4
-
5
- const platform = os.platform();
6
- const rel = os.release();
7
-
8
- if (platform !== "linux") {
9
- console.log(
10
- "Skipping [patchright] installation: non-Linux platform detected:",
11
- platform
12
- );
13
- process.exit(0);
14
- }
15
-
16
- function getDistroName() {
17
- try {
18
- const osReleaseContent = fs.readFileSync("/etc/os-release", "utf8");
19
- const lines = osReleaseContent.split("\n");
20
- const info = {};
21
- for (const line of lines) {
22
- const [key, value] = line.split("=");
23
- if (key && value) {
24
- info[key.toLowerCase()] = value.replace(/"/g, "").toLowerCase().trim();
25
- }
26
- }
27
- return info.id || info.id_like || null;
28
- } catch (err) {
29
- console.error("Error reading /etc/os-release:", err.message);
30
- }
31
- return null;
32
- }
33
-
34
- const distro = getDistroName();
35
- console.log("Detected Linux distribution:", distro || "unknown");
36
-
37
- const supportedDistros = [
38
- "ubuntu",
39
- "debian",
40
- "pve",
41
- "raspbian",
42
- "pop",
43
- "zorin",
44
- "linuxmint",
45
- "elementary",
46
- "pureos",
47
- "kali",
48
- ];
49
-
50
- if (!distro || !supportedDistros.some((name) => distro.includes(name))) {
51
- console.log(
52
- "Skipping [patchright] installation on unsupported platform:",
53
- platform,
54
- rel,
55
- distro || "unknown distro"
56
- );
57
- process.exit(0);
58
- }
59
-
60
- try {
61
- execSync("npx patchright install", {
62
- stdio: "inherit",
63
- });
64
- } catch (err) {
65
- console.error(
66
- "Failed to install [patchright] you may need to install [patchright] deps with 'sudo npx patchright install-deps'. Error: ",
67
- err.message
68
- );
69
- process.exit(1);
70
- }
package/tsup.config.ts DELETED
@@ -1,36 +0,0 @@
1
- import path from 'path';
2
- import { defineConfig } from 'tsup';
3
- import { copy } from 'esbuild-plugin-copy';
4
-
5
- export default defineConfig({
6
- entry: ['src/index.ts'],
7
- outDir: 'dist',
8
- tsconfig: './tsconfig.build.json', // Use build-specific tsconfig
9
- sourcemap: true,
10
- clean: true,
11
- format: ['esm'], // Ensure you're targeting CommonJS
12
- dts: true,
13
- external: [
14
- 'dotenv', // Externalize dotenv to prevent bundling
15
- 'fs', // Externalize fs to use Node.js built-in module
16
- 'path', // Externalize other built-ins if necessary
17
- '@reflink/reflink',
18
- 'https',
19
- 'http',
20
- 'agentkeepalive',
21
- 'zod',
22
- ],
23
- esbuildOptions(options) {
24
- options.alias = {
25
- '@/src': './src',
26
- };
27
- },
28
- esbuildPlugins: [
29
- copy({
30
- assets: {
31
- from: [path.resolve(__dirname, '../../node_modules/pdfjs-dist/legacy/build/pdf.worker.js')],
32
- to: [path.resolve(__dirname, 'dist')],
33
- },
34
- }),
35
- ],
36
- });