diff --git a/conf/tsconfig.content_scripts.json b/conf/tsconfig.content_scripts.json index 5b9e4689928..287202b63a2 100644 --- a/conf/tsconfig.content_scripts.json +++ b/conf/tsconfig.content_scripts.json @@ -13,13 +13,13 @@ "strictFunctionTypes": false, "sourceMap": false, "checkJs": false, - "moduleResolution": "node", + "moduleResolution": "bundler", "outDir": "../build/_/content_scripts", "baseUrl": "../extension", "paths": { "dompurify": ["../node_modules/dompurify/dist/purify.cjs.d.ts"], "openpgp": ["../node_modules/openpgp/openpgp.d.ts"], - "@openpgp/web-stream-tools": ["../node_modules/@openpgp/web-stream-tools/lib/index.d.ts"], + "@openpgp/web-stream-tools": ["../node_modules/@openpgp/web-stream-tools/lib/types/index.d.ts"], "squire-rte": ["../node_modules/squire-rte/dist/types/Squire.d.ts"], "undici-types": ["../node_modules/undici-types/index.d.ts", "COMMENT"], "linkifyHtml": ["../node_modules/linkify-html/dist/linkify-html.d.mts", "COMMENT"], diff --git a/conf/tsconfig.test.json b/conf/tsconfig.test.json index c5627df06bc..20c220c2cb8 100644 --- a/conf/tsconfig.test.json +++ b/conf/tsconfig.test.json @@ -12,7 +12,7 @@ "outDir": "../build/test", "skipLibCheck": true, "paths": { - "@openpgp/web-stream-tools": ["../node_modules/@openpgp/web-stream-tools/lib/index.d.ts", "../build/generic-extension-wip/lib/streams_common.js"] + "@openpgp/web-stream-tools": ["../node_modules/@openpgp/web-stream-tools/lib/types/index.d.ts", "../build/generic-extension-wip/lib/streams_common.js"] } }, "files": [ diff --git a/package-lock.json b/package-lock.json index 3c6a672c977..d8441512889 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,7 @@ "tap-xunit": "^2.4.1" }, "devDependencies": { - "@openpgp/web-stream-tools": "0.1.3", + "@openpgp/web-stream-tools": "0.2.0", "@types/chai": "4.3.19", "@types/chai-as-promised": "7.1.8", "@types/chrome": "0.1.24", @@ -930,18 +930,22 @@ } }, "node_modules/@openpgp/web-stream-tools": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@openpgp/web-stream-tools/-/web-stream-tools-0.1.3.tgz", - "integrity": "sha512-mT/ds43cH6c+AO5RFpxs+LkACr7KjC3/dZWHrP6KPrWJu4uJ/XJ+p7telaoYiqUfdjiiIvdNSOfhezW9fkmboQ==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@openpgp/web-stream-tools/-/web-stream-tools-0.2.0.tgz", + "integrity": "sha512-vX5a0oZKyqcBuS4BSGCufJVHhhIgZKj5Tc0lA7fzivj6iszedbIua6yKCe5ZujVCD7sZlOaYhxSZnLO8FH8rbQ==", "dev": true, "license": "MIT", "engines": { "node": ">= 18.0.0" }, "peerDependencies": { - "typescript": ">=4.2" + "@types/node": ">=18.0.0", + "typescript": ">=4.7" }, "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, "typescript": { "optional": true } @@ -2235,6 +2239,29 @@ "dev": true, "license": "MIT" }, + "node_modules/addons-linter/node_modules/node-fetch": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/addons-linter/node_modules/semver": { "version": "7.7.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", @@ -10326,6 +10353,15 @@ "node": ">=8.0" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, "node_modules/ts-api-utils": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", @@ -10720,6 +10756,15 @@ "dev": true, "license": "Apache-2.0" }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true, + "license": "BSD-2-Clause", + "optional": true, + "peer": true + }, "node_modules/webpack": { "version": "5.102.1", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.102.1.tgz", @@ -10885,6 +10930,19 @@ "node": ">=6" } }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/when": { "version": "3.7.7", "resolved": "https://registry.npmjs.org/when/-/when-3.7.7.tgz", diff --git a/package.json b/package.json index ec4333b3124..930b6c2f35d 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "graceful-fs": "4.1.13" }, "devDependencies": { - "@openpgp/web-stream-tools": "0.1.3", + "@openpgp/web-stream-tools": "0.2.0", "@types/chai": "4.3.19", "@types/chai-as-promised": "7.1.8", "@types/chrome": "0.1.24", diff --git a/scripts/build.js b/scripts/build.js index 6a543d9f169..7a7de863b77 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -121,8 +121,10 @@ const main = async () => { // patch imports with .js, e.g. replace './streams' with './streams.js' // until https://github.com/openpgpjs/web-stream-tools/pull/20 is resolved const streamDir = path.join(OUTPUT_DIRECTORY, 'lib/streams'); - const streamFiles = fs.readdirSync(streamDir).map(file => path.join(streamDir, file)); - applyRegexReplace(/'(.\/(streams|util|writer|reader|node-conversions))'/g, "'$1.js'", streamFiles); + const streamFiles = fs + .readdirSync(streamDir) + .map(file => path.join(streamDir, file)) + .filter(filePath => fs.statSync(filePath).isFile()); // patch isUint8Array until https://github.com/openpgpjs/web-stream-tools/pull/23 is resolved // First patch: replaces `return Uint8Array.prototype.isPrototypeOf(input);` with fallback to globalThis diff --git a/tsconfig.json b/tsconfig.json index 1794e135b6a..4d577739d7a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,14 +13,14 @@ "useUnknownInCatchVariables": false, "outDir": "build/generic-extension-wip", "baseUrl": "./extension", - "moduleResolution": "node", + "moduleResolution": "bundler", "paths": { "jquery": ["lib/jquery.min.js", "COMMENT"], "sweetalert2": ["lib/sweetalert2.js", "COMMENT"], "openpgp": ["lib/openpgp.min.mjs", "../node_modules/openpgp/openpgp.d.js"], "pdfjs": ["lib/pdf.min.mjs", "types/pdf.js.d.ts"], "squire-rte": ["../node_modules/squire-rte/dist/types/Squire.d.ts"], - "@openpgp/web-stream-tools": ["../node_modules/@openpgp/web-stream-tools/lib/index.d.ts", "lib/streams/streams.js"], + "@openpgp/web-stream-tools": ["../node_modules/@openpgp/web-stream-tools/lib/types/index.d.ts", "lib/streams/streams.js"], "dompurify": ["../node_modules/dompurify/dist/purify.cjs.d.ts", "lib/purify.js", "COMMENT"], "fine-uploader": ["lib/fine-uploader.js", "COMMENT"], "filesize": ["lib/filesize.js", "../node_modules/filesize/types/filesize.d.ts"],