From db77f995f6d7cca5b471635a393954e2bd34b65a Mon Sep 17 00:00:00 2001 From: memdmp Date: Thu, 28 Aug 2025 21:57:35 +0200 Subject: feat: exttool --- src/lib/.gitignore | 1 + src/lib/gen-webext-polyfill.ts | 15 +++++++++++++++ src/lib/tsconfig.jsonc | 1 + 3 files changed, 17 insertions(+) create mode 100644 src/lib/.gitignore create mode 100644 src/lib/gen-webext-polyfill.ts create mode 120000 src/lib/tsconfig.jsonc (limited to 'src/lib') diff --git a/src/lib/.gitignore b/src/lib/.gitignore new file mode 100644 index 0000000..6f7de8f --- /dev/null +++ b/src/lib/.gitignore @@ -0,0 +1 @@ +/webext-polyfill.ts diff --git a/src/lib/gen-webext-polyfill.ts b/src/lib/gen-webext-polyfill.ts new file mode 100644 index 0000000..5c09e07 --- /dev/null +++ b/src/lib/gen-webext-polyfill.ts @@ -0,0 +1,15 @@ +import fs from 'node:fs/promises'; +const files = {} as Record +const promises = [] as Promise[] +for (const f of await fs.readdir('node_modules/@types/webextension-polyfill', { + recursive: true, +})) + promises.push((async () => { + const fp = 'node_modules/@types/webextension-polyfill/' + f; + const stat = await fs.stat(fp) + if (!stat.isDirectory()) + files[fp] = await fs.readFile(fp, 'utf-8') + })()) +await Promise.all(promises) +await fs.writeFile('src/lib/webext-polyfill.ts', `export const files = ${JSON.stringify(files, null, 2)}; +export default files;`) diff --git a/src/lib/tsconfig.jsonc b/src/lib/tsconfig.jsonc new file mode 120000 index 0000000..fd0e474 --- /dev/null +++ b/src/lib/tsconfig.jsonc @@ -0,0 +1 @@ +../../tsconfig.json \ No newline at end of file -- cgit v1.2.3