diff --git a/esbuild.mjs b/esbuild.mjs index 4dac6a9..95865df 100755 --- a/esbuild.mjs +++ b/esbuild.mjs @@ -15,9 +15,11 @@ * PERFORMANCE OF THIS SOFTWARE. */ +import cc from '@exact-realty/esbuild-plugin-closure-compiler'; import inlineScripts from '@exact-realty/esbuild-plugin-inline-js'; import esbuild from 'esbuild'; -import cc from '@exact-realty/esbuild-plugin-closure-compiler'; +import { readdir, readFile, writeFile } from 'node:fs/promises'; +import { join } from 'node:path'; import defaultAllowedGlobalProps from './defaultAllowedGlobalProps.config.mjs'; /** @@ -216,3 +218,29 @@ options.define['__buildtimeSettings__.isolationStategyIframeSole'] = 'true'; options.define['__buildtimeSettings__.isolationStategyIframeWorker'] = 'false'; await browserBuild(['./src/exports/browser-window.ts']); + +const cjsDeclarationFiles = async (directoryPath) => { + const entries = await readdir(directoryPath, { + withFileTypes: true, + recursive: true, + }); + + await Promise.all( + entries + .filter((entry) => { + return entry.isFile() && entry.name.endsWith('.d.ts'); + }) + .map(async (file) => { + const name = join(file.path, file.name); + const newName = name.slice(0, -2) + 'cts'; + + const contents = await readFile(name, { encoding: 'utf-8' }); + await writeFile( + newName, + contents.replace(/(?<=\.)js(?=['"])/g, 'cjs'), + ); + }), + ); +}; + +await cjsDeclarationFiles('dist'); diff --git a/package-lock.json b/package-lock.json index bc57d89..517d391 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,30 +1,30 @@ { "name": "@exact-realty/lot", - "version": "0.0.19", + "version": "0.0.20", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@exact-realty/lot", - "version": "0.0.19", + "version": "0.0.20", "license": "ISC", "devDependencies": { "@exact-realty/esbuild-plugin-closure-compiler": "^1.0.1", "@exact-realty/esbuild-plugin-inline-js": "^1.1.5", - "@types/selenium-webdriver": "^4.1.19", - "@typescript-eslint/eslint-plugin": "^6.9.0", - "@typescript-eslint/parser": "^6.9.0", + "@types/selenium-webdriver": "^4.1.21", + "@typescript-eslint/eslint-plugin": "^6.21.0", + "@typescript-eslint/parser": "^6.21.0", "esbuild": "^0.19.5", - "eslint": "^8.52.0", - "eslint-config-prettier": "^9.0.0", - "eslint-plugin-prettier": "^5.0.1", + "eslint": "^8.56.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.1.3", "glob": "^10.3.10", "google-closure-compiler": "^20230802.0.0", - "prettier": "^3.0.3", - "selenium-webdriver": "^4.14.0", - "ts-node": "^10.9.1", - "ts-patch": "^3.0.2", - "typescript": "^5.2.2", + "prettier": "^3.2.5", + "selenium-webdriver": "^4.17.0", + "ts-node": "^10.9.2", + "ts-patch": "^3.1.2", + "typescript": "^5.3.3", "typescript-transform-paths": "^3.4.6" }, "engines": { @@ -430,9 +430,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", - "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -453,9 +453,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz", - "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==", + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", + "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -650,19 +650,11 @@ "node": ">=14" } }, - "node_modules/@pkgr/utils": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz", - "integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==", + "node_modules/@pkgr/core": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "fast-glob": "^3.3.0", - "is-glob": "^4.0.3", - "open": "^9.1.0", - "picocolors": "^1.0.0", - "tslib": "^2.6.0" - }, "engines": { "node": "^12.20.0 || ^14.18.0 || >=16.0.0" }, @@ -695,9 +687,9 @@ "dev": true }, "node_modules/@types/json-schema": { - "version": "7.0.14", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz", - "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==", + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true }, "node_modules/@types/node": { @@ -707,18 +699,18 @@ "dev": true }, "node_modules/@types/selenium-webdriver": { - "version": "4.1.19", - "resolved": "https://registry.npmjs.org/@types/selenium-webdriver/-/selenium-webdriver-4.1.19.tgz", - "integrity": "sha512-9/vdyC3KeFQ7/vtt0H5RR0fnlrtc4dF9ssRBnh+yerua9O2Sst4nuPL4eHyKlR1/ZVV/5XPMLaJuVgv+7CDCAw==", + "version": "4.1.21", + "resolved": "https://registry.npmjs.org/@types/selenium-webdriver/-/selenium-webdriver-4.1.21.tgz", + "integrity": "sha512-QGURnImvxYlIQz5DVhvHdqpYNLBjhJ2Vm+cnQI2G9QZzkWlZm0LkLcvDcHp+qE6N2KBz4CeuvXgPO7W3XQ0Tyw==", "dev": true, "dependencies": { "@types/ws": "*" } }, "node_modules/@types/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==", + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", + "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", "dev": true }, "node_modules/@types/ws": { @@ -731,16 +723,16 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.0.tgz", - "integrity": "sha512-lgX7F0azQwRPB7t7WAyeHWVfW1YJ9NIgd9mvGhfQpRY56X6AVf8mwM8Wol+0z4liE7XX3QOt8MN1rUKCfSjRIA==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", + "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.9.0", - "@typescript-eslint/type-utils": "6.9.0", - "@typescript-eslint/utils": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/type-utils": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -766,15 +758,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.9.0.tgz", - "integrity": "sha512-GZmjMh4AJ/5gaH4XF2eXA8tMnHWP+Pm1mjQR2QN4Iz+j/zO04b9TOvJYOX2sCNIQHtRStKTxRY1FX7LhpJT4Gw==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", + "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.9.0", - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/typescript-estree": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4" }, "engines": { @@ -794,13 +786,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.0.tgz", - "integrity": "sha512-1R8A9Mc39n4pCCz9o79qRO31HGNDvC7UhPhv26TovDsWPBDx+Sg3rOZdCELIA3ZmNoWAuxaMOT7aWtGRSYkQxw==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0" + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -811,13 +803,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.9.0.tgz", - "integrity": "sha512-XXeahmfbpuhVbhSOROIzJ+b13krFmgtc4GlEuu1WBT+RpyGPIA4Y/eGnXzjbDj5gZLzpAXO/sj+IF/x2GtTMjQ==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", + "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.9.0", - "@typescript-eslint/utils": "6.9.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/utils": "6.21.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -838,9 +830,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", - "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -851,16 +843,17 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.0.tgz", - "integrity": "sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", + "minimatch": "9.0.3", "semver": "^7.5.4", "ts-api-utils": "^1.0.1" }, @@ -877,18 +870,42 @@ } } }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/utils": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.9.0.tgz", - "integrity": "sha512-5Wf+Jsqya7WcCO8me504FBigeQKVLAMPmUzYgDbWchINNh1KJbxCgVya3EQ2MjvJMVeXl3pofRmprqX6mfQkjQ==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", + "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.9.0", - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/typescript-estree": "6.9.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", "semver": "^7.5.4" }, "engines": { @@ -903,12 +920,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.0.tgz", - "integrity": "sha512-dGtAfqjV6RFOtIP8I0B4ZTBRrlTT8NHHlZZSchQx3qReaoDeXhYM++M4So2AgFK9ZB0emRPA6JI1HkafzA2Ibg==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/types": "6.21.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -1022,27 +1039,6 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, - "node_modules/big-integer": { - "version": "1.6.51", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", - "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", - "dev": true, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/bplist-parser": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", - "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", - "dev": true, - "dependencies": { - "big-integer": "^1.6.44" - }, - "engines": { - "node": ">= 5.10.0" - } - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1065,21 +1061,6 @@ "node": ">=8" } }, - "node_modules/bundle-name": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", - "integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==", - "dev": true, - "dependencies": { - "run-applescript": "^5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -1213,52 +1194,6 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, - "node_modules/default-browser": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz", - "integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==", - "dev": true, - "dependencies": { - "bundle-name": "^3.0.0", - "default-browser-id": "^3.0.0", - "execa": "^7.1.1", - "titleize": "^3.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser-id": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz", - "integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==", - "dev": true, - "dependencies": { - "bplist-parser": "^0.2.0", - "untildify": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/define-lazy-prop": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", - "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -1345,15 +1280,15 @@ } }, "node_modules/eslint": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz", - "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==", + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", + "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.52.0", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.56.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -1400,9 +1335,9 @@ } }, "node_modules/eslint-config-prettier": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.0.0.tgz", - "integrity": "sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", "dev": true, "bin": { "eslint-config-prettier": "bin/cli.js" @@ -1412,23 +1347,24 @@ } }, "node_modules/eslint-plugin-prettier": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz", - "integrity": "sha512-m3u5RnR56asrwV/lDC4GHorlW75DsFfmUcjfCYylTUs85dBRnB7VM6xG8eCMJdeDRnppzmxZVf1GEPJvl1JmNg==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz", + "integrity": "sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==", "dev": true, "dependencies": { "prettier-linter-helpers": "^1.0.0", - "synckit": "^0.8.5" + "synckit": "^0.8.6" }, "engines": { "node": "^14.18.0 || >=16.0.0" }, "funding": { - "url": "https://opencollective.com/prettier" + "url": "https://opencollective.com/eslint-plugin-prettier" }, "peerDependencies": { "@types/eslint": ">=8.0.0", "eslint": ">=8.0.0", + "eslint-config-prettier": "*", "prettier": ">=3.0.0" }, "peerDependenciesMeta": { @@ -1527,29 +1463,6 @@ "node": ">=0.10.0" } }, - "node_modules/execa": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz", - "integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.1", - "human-signals": "^4.3.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^3.0.7", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": "^14.18.0 || ^16.14.0 || >=18.0.0" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -1563,9 +1476,9 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz", - "integrity": "sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -1682,18 +1595,6 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, - "node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/glob": { "version": "10.3.10", "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", @@ -1807,9 +1708,9 @@ } }, "node_modules/globals": { - "version": "13.21.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.21.0.tgz", - "integrity": "sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==", + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -1941,15 +1842,6 @@ "node": ">=8" } }, - "node_modules/human-signals": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", - "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", - "dev": true, - "engines": { - "node": ">=14.18.0" - } - }, "node_modules/ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", @@ -2024,21 +1916,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-docker": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", - "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", - "dev": true, - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -2069,24 +1946,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-inside-container": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", - "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", - "dev": true, - "dependencies": { - "is-docker": "^3.0.0" - }, - "bin": { - "is-inside-container": "cli.js" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -2105,45 +1964,6 @@ "node": ">=8" } }, - "node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-wsl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", - "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", - "dev": true, - "dependencies": { - "is-docker": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-wsl/node_modules/is-docker": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", - "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", - "dev": true, - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -2280,12 +2100,6 @@ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -2308,18 +2122,6 @@ "node": ">=8.6" } }, - "node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -2362,33 +2164,6 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "node_modules/npm-run-path": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", - "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", - "dev": true, - "dependencies": { - "path-key": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/npm-run-path/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -2398,39 +2173,6 @@ "wrappy": "1" } }, - "node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dev": true, - "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/open": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz", - "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==", - "dev": true, - "dependencies": { - "default-browser": "^4.0.0", - "define-lazy-prop": "^3.0.0", - "is-inside-container": "^1.0.0", - "is-wsl": "^2.2.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/optionator": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", @@ -2563,12 +2305,6 @@ "node": ">=8" } }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true - }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", @@ -2591,9 +2327,9 @@ } }, "node_modules/prettier": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", - "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -2624,9 +2360,9 @@ "dev": true }, "node_modules/punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, "engines": { "node": ">=6" @@ -2753,110 +2489,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/run-applescript": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz", - "integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==", - "dev": true, - "dependencies": { - "execa": "^5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/run-applescript/node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/run-applescript/node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true, - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/run-applescript/node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/run-applescript/node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/run-applescript/node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/run-applescript/node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/run-applescript/node_modules/strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -2887,9 +2519,9 @@ "dev": true }, "node_modules/selenium-webdriver": { - "version": "4.14.0", - "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.14.0.tgz", - "integrity": "sha512-637rs8anqMKHbWxcBZpyG3Gcs+rBUtAUiqk0O/knUqH4Paj3MFUZrz88/pVGOLNryEVy2z92fZomT8p1ENl1gA==", + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.17.0.tgz", + "integrity": "sha512-e2E+2XBlGepzwgFbyQfSwo9Cbj6G5fFfs9MzAS00nC99EewmcS2rwn2MwtgfP7I5p1e7DYv4HQJXtWedsu6DvA==", "dev": true, "dependencies": { "jszip": "^3.10.1", @@ -2942,12 +2574,6 @@ "node": ">=8" } }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -3029,18 +2655,6 @@ "node": ">=8" } }, - "node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -3078,13 +2692,13 @@ } }, "node_modules/synckit": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz", - "integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==", + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.8.tgz", + "integrity": "sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==", "dev": true, "dependencies": { - "@pkgr/utils": "^2.3.1", - "tslib": "^2.5.0" + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" }, "engines": { "node": "^14.18.0 || >=16.0.0" @@ -3099,18 +2713,6 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, - "node_modules/titleize": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz", - "integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/tmp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", @@ -3148,9 +2750,9 @@ } }, "node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", @@ -3200,16 +2802,16 @@ } }, "node_modules/ts-patch": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/ts-patch/-/ts-patch-3.0.2.tgz", - "integrity": "sha512-iTg8euqiNsNM1VDfOsVIsP0bM4kAVXU38n7TGQSkky7YQX/syh6sDPIRkvSS0HjT8ZOr0pq1h+5Le6jdB3hiJQ==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/ts-patch/-/ts-patch-3.1.2.tgz", + "integrity": "sha512-n58F5AqjUMdp9RAKq+E1YBkmONltPVbt1nN+wrmZXoYZek6QcvaTuqvKMhYhr5BxtC53kD/exxIPA1cP1RQxsA==", "dev": true, "dependencies": { "chalk": "^4.1.2", "global-prefix": "^3.0.0", "minimist": "^1.2.8", "resolve": "^1.22.2", - "semver": "^7.3.8", + "semver": "^7.5.4", "strip-ansi": "^6.0.1" }, "bin": { @@ -3218,9 +2820,9 @@ } }, "node_modules/tslib": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", - "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", "dev": true }, "node_modules/type-check": { @@ -3248,9 +2850,9 @@ } }, "node_modules/typescript": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -3272,15 +2874,6 @@ "typescript": ">=3.6.5" } }, - "node_modules/untildify": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", - "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index 9068b65..0bfca16 100644 --- a/package.json +++ b/package.json @@ -1,26 +1,36 @@ { "name": "@exact-realty/lot", - "version": "0.0.19", + "version": "0.0.20", "description": "Sandbox for isolating ECMAScript code", "main": "dist/index.cjs", + "types": "dist/index.d.cts", "module": "./dist/index.mjs", "type": "module", "exports": { ".": { "browser": { - "types": "./dist/exports/browser.d.ts", + "types": { + "require": "./dist/exports/browser.d.cts", + "default": "./dist/exports/browser.d.ts" + }, "import": "./dist/exports/browser.mjs", "require": "./dist/exports/browser.cjs", "default": "./dist/exports/browser.mjs" }, "browser-window": { - "types": "./dist/exports/browser-window.d.ts", + "types": { + "require": "./dist/exports/browser-window.d.cts", + "default": "./dist/exports/browser-window.d.ts" + }, "import": "./dist/exports/browser-window.mjs", "require": "./dist/exports/browser-window.cjs", "default": "./dist/exports/browser-window.mjs" }, "browser-worker": { - "types": "./dist/exports/browser-worker.d.ts", + "types": { + "require": "./dist/exports/browser-worker.d.cts", + "default": "./dist/exports/browser-worker.d.ts" + }, "import": "./dist/exports/browser-worker.mjs", "require": "./dist/exports/browser-worker.cjs", "default": "./dist/exports/browser-worker.mjs" @@ -34,7 +44,7 @@ "default": "./dist/index.mjs" }, "require": { - "types": "./dist/index.d.ts", + "types": "./dist/index.d.cts", "default": "./dist/index.cjs" } }, @@ -44,7 +54,7 @@ "default": "./dist/exports/bare.mjs" }, "require": { - "types": "./dist/exports/bare.d.ts", + "types": "./dist/exports/bare.d.cts", "default": "./dist/exports/bare.cjs" } }, @@ -54,7 +64,7 @@ "default": "./dist/exports/browser.mjs" }, "require": { - "types": "./dist/exports/browser.d.ts", + "types": "./dist/exports/browser.d.cts", "default": "./dist/exports/browser.cjs" } }, @@ -64,7 +74,7 @@ "default": "./dist/exports/browser-window.mjs" }, "require": { - "types": "./dist/exports/browser-window.d.ts", + "types": "./dist/exports/browser-window.d.cts", "default": "./dist/exports/browser-window.cjs" } }, @@ -74,7 +84,7 @@ "default": "./dist/exports/browser-worker.mjs" }, "require": { - "types": "./dist/exports/browser-worker.d.ts", + "types": "./dist/exports/browser-worker.d.cts", "default": "./dist/exports/browser-worker.cjs" } }, @@ -84,7 +94,7 @@ "default": "./dist/exports/nodejs.mjs" }, "require": { - "types": "./dist/exports/nodejs.d.ts", + "types": "./dist/exports/nodejs.d.cts", "default": "./dist/exports/nodejs.cjs" } }, @@ -94,7 +104,7 @@ "default": "./dist/exports/worker.mjs" }, "require": { - "types": "./dist/exports/worker.d.ts", + "types": "./dist/exports/worker.d.cts", "default": "./dist/exports/worker.cjs" } } @@ -125,20 +135,20 @@ "devDependencies": { "@exact-realty/esbuild-plugin-closure-compiler": "^1.0.1", "@exact-realty/esbuild-plugin-inline-js": "^1.1.5", - "@types/selenium-webdriver": "^4.1.19", - "@typescript-eslint/eslint-plugin": "^6.9.0", - "@typescript-eslint/parser": "^6.9.0", + "@types/selenium-webdriver": "^4.1.21", + "@typescript-eslint/eslint-plugin": "^6.21.0", + "@typescript-eslint/parser": "^6.21.0", "esbuild": "^0.19.5", - "eslint": "^8.52.0", - "eslint-config-prettier": "^9.0.0", - "eslint-plugin-prettier": "^5.0.1", + "eslint": "^8.56.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.1.3", "glob": "^10.3.10", "google-closure-compiler": "^20230802.0.0", - "prettier": "^3.0.3", - "selenium-webdriver": "^4.14.0", - "ts-node": "^10.9.1", - "ts-patch": "^3.0.2", - "typescript": "^5.2.2", + "prettier": "^3.2.5", + "selenium-webdriver": "^4.17.0", + "ts-node": "^10.9.2", + "ts-patch": "^3.1.2", + "typescript": "^5.3.3", "typescript-transform-paths": "^3.4.6" }, "engines": { diff --git a/src/trusted/impl/bare/bareSandbox.ts b/src/trusted/impl/bare/bareSandbox.ts index c147c33..7a26d16 100644 --- a/src/trusted/impl/bare/bareSandbox.ts +++ b/src/trusted/impl/bare/bareSandbox.ts @@ -13,7 +13,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -import { ISandbox } from '~/types/index.js'; +import { IPerformTask, TSandboxOptions } from '~/types/index.js'; import bareSandboxManager from '~/untrusted/impl/bare/bareSandboxManager.js'; import setupSandboxListeners from '~trusted/lib/setupSandboxListeners.js'; import createErrorEventListenerFactory from '~untrusted/lib/createErrorEventEventListenerFactory.js'; @@ -21,12 +21,14 @@ import createMessageEventListenerFactory from '~untrusted/lib/createMessageEvent // TODO: wrap setTimeout and clearTimeout -const bareSandbox: ISandbox = async ( - script, - allowedGlobals, - externalMethods, - abort, -) => { +const bareSandbox = async ( + script: string, + allowedGlobals?: string[] | undefined | null, + externalMethods?: Record | null, + abort?: AbortSignal, + options?: TSandboxOptions, +): Promise> => { + void options; if (!__buildtimeSettings__.bidirectionalMessaging && externalMethods) { throw new TypeError( 'Invalid value for externalMethods. Bidirectional messaging is disabled', diff --git a/src/trusted/impl/browser/browserSandbox.ts b/src/trusted/impl/browser/browserSandbox.ts index 5cc0192..12ad3c7 100644 --- a/src/trusted/impl/browser/browserSandbox.ts +++ b/src/trusted/impl/browser/browserSandbox.ts @@ -15,7 +15,7 @@ import * as iframeSandboxInit from 'inline:~untrusted/impl/browser/iframeSandboxInit.inline.js'; import setupSandboxListeners from '~trusted/lib/setupSandboxListeners.js'; -import { ISandbox } from '~/types/index.js'; +import { IPerformTask, TSandboxOptions } from '~/types/index.js'; import type iframeSandboxInner from '~untrusted/impl/browser/iframeSandboxInner.js'; import getRandomSecret from '~untrusted/lib/getRandomSecret.js'; @@ -41,13 +41,13 @@ const safeXml = ( return String.raw(template, ...substitutions); }; -const browserSandbox: ISandbox = async ( - script, - allowedGlobals, - externalMethods, - abort, - options, -) => { +const browserSandbox = async ( + script: string, + allowedGlobals?: string[] | undefined | null, + externalMethods?: Record | null, + abort?: AbortSignal, + options?: TSandboxOptions, +): Promise> => { if ( !__buildtimeSettings__.isolationStategyIframeSole && !__buildtimeSettings__.isolationStategyIframeWorker @@ -105,10 +105,10 @@ const browserSandbox: ISandbox = async ( __buildtimeSettings__.isolationStategyIframeWorker ? `default-src 'none'; script-src 'nonce-${nonce}' '${iframeSandboxInit.sri}' 'unsafe-eval' 'unsafe-inline' 'strict-dynamic'; script-src-attr 'none'; worker-src blob:` : __buildtimeSettings__.isolationStategyIframeSole - ? `default-src 'none'; script-src 'nonce-${nonce}' '${iframeSandboxInit.sri}' 'unsafe-eval' 'unsafe-inline' 'strict-dynamic'; script-src-attr 'none'; worker-src 'none'` - : __buildtimeSettings__.isolationStategyIframeWorker - ? `default-src 'none'; script-src 'nonce-${nonce}' '${iframeSandboxInit.sri}' 'unsafe-eval'; script-src-attr 'none'; worker-src blob:` - : "default-src 'none'", + ? `default-src 'none'; script-src 'nonce-${nonce}' '${iframeSandboxInit.sri}' 'unsafe-eval' 'unsafe-inline' 'strict-dynamic'; script-src-attr 'none'; worker-src 'none'` + : __buildtimeSettings__.isolationStategyIframeWorker + ? `default-src 'none'; script-src 'nonce-${nonce}' '${iframeSandboxInit.sri}' 'unsafe-eval'; script-src-attr 'none'; worker-src blob:` + : "default-src 'none'", ); const iframeSrcUrl = self.URL.createObjectURL(blob); iframe.setAttribute('role', 'none'); @@ -202,7 +202,7 @@ const browserSandbox: ISandbox = async ( abort?.addEventListener('abort', onDestroy, false); - return setupSandboxListeners( + return setupSandboxListeners( messageChannel.port1, false, Promise.resolve.bind(Promise), diff --git a/src/trusted/impl/nodejs/nodejsSandbox.ts b/src/trusted/impl/nodejs/nodejsSandbox.ts index 75b2b06..1c82f0c 100644 --- a/src/trusted/impl/nodejs/nodejsSandbox.ts +++ b/src/trusted/impl/nodejs/nodejsSandbox.ts @@ -15,19 +15,22 @@ import * as nodejsSandboxVm from 'inline:~untrusted/impl/nodejs/nodejsSandboxVm.inline.js'; import { Worker } from 'node:worker_threads'; -import { ISandbox } from '~/types/index.js'; +import { IPerformTask, TSandboxOptions } from '~/types/index.js'; import setupSandboxListeners from '~trusted/lib/setupSandboxListeners.js'; import { INTERNAL_SOURCE_STRING } from '~untrusted/impl/nodejs/constants.js'; import type { TNodejsSandbox } from '~untrusted/impl/nodejs/nodejsSandboxVm.inline.js'; import type workerSandboxInner from '~untrusted/impl/worker/workerSandboxInner.js'; import { extractErrorInformation } from '~untrusted/lib/errorModem.js'; -const nodejsSandbox: ISandbox = async ( - script, - allowedGlobals, - externalMethods, - abort, -) => { +// TypeScript won't seem to allow implementing the type ISandbox +const nodejsSandbox = async ( + script: string, + allowedGlobals?: string[] | undefined | null, + externalMethods?: Record | null, + abort?: AbortSignal, + options?: TSandboxOptions, +): Promise> => { + void options; if (!__buildtimeSettings__.bidirectionalMessaging && externalMethods) { throw new TypeError( 'Invalid value for externalMethods. Bidirectional messaging is disabled', @@ -121,7 +124,7 @@ const nodejsSandbox: ISandbox = async ( messageChannel.port1.start(); messageChannel.port2.start(); - return setupSandboxListeners( + return setupSandboxListeners( messageChannel.port1, true, // empty manager since data are passed as workerData diff --git a/src/trusted/impl/worker/workerSandbox.ts b/src/trusted/impl/worker/workerSandbox.ts index 0f8d086..3e9ff90 100644 --- a/src/trusted/impl/worker/workerSandbox.ts +++ b/src/trusted/impl/worker/workerSandbox.ts @@ -15,17 +15,18 @@ import workerSandboxManager from '~untrusted/impl/worker/workerSandboxManager.js'; import setupSandboxListeners from '~trusted/lib/setupSandboxListeners.js'; -import { ISandbox } from '~/types/index.js'; +import { IPerformTask, TSandboxOptions } from '~/types/index.js'; import createErrorEventListenerFactory from '~untrusted/lib/createErrorEventEventListenerFactory.js'; import createMessageEventListenerFactory from '~untrusted/lib/createMessageEventListenerFactory.js'; -const workerSandbox: ISandbox = async ( - script, - allowedGlobals, - externalMethods, - abort, - options, -) => { +// TypeScript won't seem to allow implementing the type ISandbox +const workerSandbox = async ( + script: string, + allowedGlobals?: string[] | undefined | null, + externalMethods?: Record | null, + abort?: AbortSignal, + options?: TSandboxOptions, +): Promise> => { if (!__buildtimeSettings__.bidirectionalMessaging && externalMethods) { throw new TypeError( 'Invalid value for externalMethods. Bidirectional messaging is disabled', diff --git a/src/trusted/lib/setupSandboxListeners.ts b/src/trusted/lib/setupSandboxListeners.ts index d23f662..cec8e01 100644 --- a/src/trusted/lib/setupSandboxListeners.ts +++ b/src/trusted/lib/setupSandboxListeners.ts @@ -42,13 +42,13 @@ const ERROR_TIMEOUT = __buildtimeSettings__.sandboxInitDeadlineInMs; * @throws {TypeError} Throws if bidirectional messaging is disabled but * externalMethods is provided. */ -const setupSandboxListeners = ( +const setupSandboxListeners = ( messagePort: MessagePort, allowUntrusted: boolean, manager: { (): Promise }, externalMethods?: Record | null, abort?: AbortSignal, -): Promise => { +): Promise> => { if (!__buildtimeSettings__.bidirectionalMessaging && externalMethods) { throw new TypeError( 'Invalid value for externalMethods. Bidirectional messaging is disabled', @@ -58,7 +58,7 @@ const setupSandboxListeners = ( const postMessage = messagePort.postMessage.bind(messagePort); const [performTask, resultHandler, destroyTaskPerformer] = - performTaskFactory(!!abort, postMessage); + performTaskFactory(!!abort, postMessage); const eventListener = (event: MessageEvent) => { if ((!allowUntrusted && !event.isTrusted) || !Array.isArray(event.data)) diff --git a/src/types/index.ts b/src/types/index.ts index 7bf5ea3..4c1dab5 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -13,10 +13,33 @@ * PERFORMANCE OF THIS SOFTWARE. */ +export type TOp< + T, + TK = T extends object ? keyof T : string, +> = TK extends keyof T + ? T[TK] extends (...args: never) => unknown + ? TK + : never + : TK; +export type TOpArgs< + T, + TK = T extends object ? keyof T : string, +> = TK extends keyof T + ? T[TK] extends (...args: infer A) => unknown + ? A + : never + : unknown[]; +export type TOpRet< + T, + TK = T extends object ? keyof T : string, +> = TK extends keyof T + ? Awaited infer R ? R : never> + : unknown; + /** * Interface representing a function to perform a task. */ -export interface IPerformTask { +export interface IPerformTask { /** * Performs a task. * @@ -24,14 +47,14 @@ export interface IPerformTask { * @param args - Variable list of arguments. * @returns Returns a promise resolving to the result. */ - (op: string, ...args: unknown[]): Promise; + (op: TOp, ...args: TOpArgs): Promise>; } /** * Interface representing a function to execute a script in a sandboxed * environment. */ -export interface ISandbox { +export interface ISandbox { /** * Executes a script in a sandbox. * @@ -50,7 +73,7 @@ export interface ISandbox { externalMethods?: Record | null, abort?: AbortSignal, options?: TSandboxOptions, - ): Promise; + ): Promise>; } /** diff --git a/src/untrusted/impl/bare/bareSandboxManager.ts b/src/untrusted/impl/bare/bareSandboxManager.ts index 04e69be..1de7e1b 100644 --- a/src/untrusted/impl/bare/bareSandboxManager.ts +++ b/src/untrusted/impl/bare/bareSandboxManager.ts @@ -76,7 +76,7 @@ const bareSandboxManager = async ( revokeRootMessageEventListener(); revokeRootErrorEventListener(); close(); - } + } : undefined, ), ); diff --git a/src/untrusted/impl/browser/iframeSoleSandboxManager.ts b/src/untrusted/impl/browser/iframeSoleSandboxManager.ts index 5ef5d42..fa21782 100644 --- a/src/untrusted/impl/browser/iframeSoleSandboxManager.ts +++ b/src/untrusted/impl/browser/iframeSoleSandboxManager.ts @@ -78,7 +78,7 @@ const iframeSoleSandboxManager = async ( revokeRootMessageEventListener(); revokeRootErrorEventListener(); close(); - } + } : undefined, ), ); diff --git a/src/untrusted/impl/nodejs/nodejsSandboxInit.inline.ts b/src/untrusted/impl/nodejs/nodejsSandboxInit.inline.ts index e0fe6d4..2d4180d 100644 --- a/src/untrusted/impl/nodejs/nodejsSandboxInit.inline.ts +++ b/src/untrusted/impl/nodejs/nodejsSandboxInit.inline.ts @@ -229,9 +229,9 @@ if (__buildtimeSettings__.contextifyMessagePort) { const l_structuredClone = typeof structuredClone === 'function' ? // Local copy to prevent it from being overwritten - structuredClone + structuredClone : // JSON-based shim - (() => { + (() => { // Fallback for when structuredClone is unavailable // The goal is to ensure that we don't get references to the // parent context. Although structuredClone would be ideal, @@ -286,7 +286,7 @@ if (__buildtimeSettings__.contextifyMessagePort) { throw err; } }.bind(globalThis); - })(); + })(); // Messages are forced through structuredClone() to avoid some attack // vectors that involve indirect references diff --git a/src/untrusted/impl/nodejs/nodejsSandboxVm.inline.ts b/src/untrusted/impl/nodejs/nodejsSandboxVm.inline.ts index 411198c..5051426 100644 --- a/src/untrusted/impl/nodejs/nodejsSandboxVm.inline.ts +++ b/src/untrusted/impl/nodejs/nodejsSandboxVm.inline.ts @@ -152,7 +152,7 @@ const nodejsSandbox: TNodejsSandbox = ( messagePort.postMessage.bind(messagePort), }, ], - ] + ] : []), [ 'close', diff --git a/src/untrusted/impl/worker/workerSandboxInner.ts b/src/untrusted/impl/worker/workerSandboxInner.ts index 823899a..585aff7 100644 --- a/src/untrusted/impl/worker/workerSandboxInner.ts +++ b/src/untrusted/impl/worker/workerSandboxInner.ts @@ -111,7 +111,7 @@ const workerSandboxInner = ( ? () => { revokeRootMessageEventListener(); close(); - } + } : undefined, ), allowUntrusted, diff --git a/src/untrusted/lib/createContext.spec.ts b/src/untrusted/lib/createContext.spec.ts index 8ba6619..cd7ce9f 100644 --- a/src/untrusted/lib/createContext.spec.ts +++ b/src/untrusted/lib/createContext.spec.ts @@ -42,7 +42,7 @@ describe('Sandbox Context Creation', () => { const externalMethods = ['externalMethod1', 'externalMethod2']; const mockExternalCall = async () => {}; - const ctx = createContext( + const ctx = createContext( undefined, mockExternalCall, externalMethods, @@ -58,7 +58,7 @@ describe('Sandbox Context Creation', () => { const externalMethods = ['method1', 'method2']; const mockExternalCall = async () => {}; - setupExternalMethods( + setupExternalMethods( mockContext, mockExternalCall, externalMethods, diff --git a/src/untrusted/lib/createContext.ts b/src/untrusted/lib/createContext.ts index 5919869..6806139 100644 --- a/src/untrusted/lib/createContext.ts +++ b/src/untrusted/lib/createContext.ts @@ -31,7 +31,7 @@ import { oGetPrototypeOf, } from './utils.js'; -import { IPerformTask, TContext } from '~/types/index.js'; +import { IPerformTask, TContext, TOp } from '~/types/index.js'; import $global from './global.js'; /** @@ -45,10 +45,10 @@ import $global from './global.js'; * @param externalCallMethod - The method used to perform external calls. * @param externalMethodsList - List of method names to be set up. */ -const setupExternalMethods = ( +const setupExternalMethods = ( ctx: object, - externalCallMethod: IPerformTask, - externalMethodsList: string[], + externalCallMethod: IPerformTask, + externalMethodsList: TOp[], ) => { oDefineProperties( ctx, @@ -58,7 +58,10 @@ const setupExternalMethods = ( { ['configurable']: true, ['enumerable']: true, - ['value']: externalCallMethod.bind(null, external), + ['value']: externalCallMethod.bind( + null, + external as unknown as TOp, + ), }, ]), ), @@ -190,10 +193,10 @@ const descriptorToFunctionProxy = (ctx: object, a?: PropertyDescriptor) => { * @param externalMethodsList - List of external method names. * @returns The secure sandbox context. */ -const createContext = ( +const createContext = ( allowedGlobals?: string[] | undefined | null, - externalCallMethod?: IPerformTask | null, - externalMethodsList?: string[] | null, + externalCallMethod?: IPerformTask | null, + externalMethodsList?: TOp[] | null, ): TContext => { const allowedProps = (aIsArray(allowedGlobals) && allowedGlobals) || diff --git a/src/untrusted/lib/createErrorEventEventListenerFactory.ts b/src/untrusted/lib/createErrorEventEventListenerFactory.ts index 1e56227..96a80dc 100644 --- a/src/untrusted/lib/createErrorEventEventListenerFactory.ts +++ b/src/untrusted/lib/createErrorEventEventListenerFactory.ts @@ -59,12 +59,12 @@ const createErrorEventListenerFactory = ? (event: ErrorEvent) => { if (!event.isTrusted) return; handler(); - } + } : (event: ErrorEvent) => { if (!event.isTrusted) return; // TODO get error info from event instead of sending it raw postMessage([EMessageTypes.GLOBAL_ERROR, event]); - }; + }; addEventListener.call( target, diff --git a/src/untrusted/lib/createSandboxedHandler.ts b/src/untrusted/lib/createSandboxedHandler.ts index b6072a6..d509d1e 100644 --- a/src/untrusted/lib/createSandboxedHandler.ts +++ b/src/untrusted/lib/createSandboxedHandler.ts @@ -99,7 +99,7 @@ const createSandboxedHandler = ( EMessageTypes.DESTROY, EMessageTypes.RESULT, EMessageTypes.ERROR, - ] + ] : [EMessageTypes.REQUEST, EMessageTypes.DESTROY], data[0] as EMessageTypes, ) diff --git a/src/untrusted/lib/functionTypeSpecimensList.ts b/src/untrusted/lib/functionTypeSpecimensList.ts index 445b6df..17a02b7 100644 --- a/src/untrusted/lib/functionTypeSpecimensList.ts +++ b/src/untrusted/lib/functionTypeSpecimensList.ts @@ -40,12 +40,12 @@ const functionTypeSpecimensList = Boolean as unknown as { (v?: FunctionConstructor): v is FunctionConstructor; }, - ) + ) : [ function () {}, function* () {}, async function () {}, async function* () {}, - ]; + ]; export default functionTypeSpecimensList; diff --git a/src/untrusted/lib/getRandomSecret.ts b/src/untrusted/lib/getRandomSecret.ts index e64c5e7..fd625a6 100644 --- a/src/untrusted/lib/getRandomSecret.ts +++ b/src/untrusted/lib/getRandomSecret.ts @@ -56,14 +56,14 @@ const bufferToHex = (buffer: Uint8Array | number[]) => */ const getRandomSecret = cGRV ? // If crypto.getRandomValues is available, use that. - (): string => + (): string => bufferToHex( (cGRV as unknown as Crypto['getRandomValues'])(u8Alloc(16)), ) : // Otherwise, use fall back to Math.random. The values might be - // predictable, but it should be fine as the strings generated are not - // used in contexts that require secrecy as an absolute requirement. - (): string => + // predictable, but it should be fine as the strings generated are not + // used in contexts that require secrecy as an absolute requirement. + (): string => bufferToHex( aMap( u8Alloc(16) as unknown as number[], diff --git a/src/untrusted/lib/global.ts b/src/untrusted/lib/global.ts index 51a31bd..0fb7d72 100644 --- a/src/untrusted/lib/global.ts +++ b/src/untrusted/lib/global.ts @@ -17,9 +17,9 @@ const g = typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' - ? self - : typeof global !== 'undefined' - ? global - : ({} as unknown as typeof globalThis); + ? self + : typeof global !== 'undefined' + ? global + : ({} as unknown as typeof globalThis); export default g; diff --git a/src/untrusted/lib/hardenGlobals.ts b/src/untrusted/lib/hardenGlobals.ts index dfb5ecc..235fc70 100644 --- a/src/untrusted/lib/hardenGlobals.ts +++ b/src/untrusted/lib/hardenGlobals.ts @@ -192,7 +192,7 @@ const hardenGlobals: { (): void } = __buildtimeSettings__.hardenGlobals } void e; } - } + } : Boolean; /** diff --git a/src/untrusted/lib/performTaskFactory.ts b/src/untrusted/lib/performTaskFactory.ts index bd1e781..2410212 100644 --- a/src/untrusted/lib/performTaskFactory.ts +++ b/src/untrusted/lib/performTaskFactory.ts @@ -42,10 +42,14 @@ import proxyMaybeRevocable from './proxyMaybeRevocable.js'; * resultHandler function, and a cleanup function to revoke the performTask * methods and clear pending tasks. */ -const performTaskFactory = ( +const performTaskFactory = ( revocable: boolean, postMessageOutgoing: MessagePort['postMessage'], -): [IPerformTask, { (data: unknown[]): void }, { (): void }] => { +): [ + performTask: IPerformTask, + resultHandler: { (data: unknown[]): void }, + revoke: { (): void }, +] => { const pendingTasks: Record< string, [typeof Function.prototype, typeof Function.prototype] @@ -82,7 +86,7 @@ const performTaskFactory = ( } }; - const performTask: IPerformTask = async (op, ...args) => { + const performTask: IPerformTask = async (op, ...args) => { if (typeof op !== 'string') { throw TE('Operation must be of string type'); } @@ -91,7 +95,8 @@ const performTaskFactory = ( Logger.debug('Sending REQUEST for task [' + taskId + '] ' + op); - const taskPromise = new PM((resolve, reject) => { + // TODO: Fix type with real return type + const taskPromise = new PM((resolve, reject) => { pendingTasks[taskId] = [resolve, reject]; }); diff --git a/src/untrusted/lib/utils.ts b/src/untrusted/lib/utils.ts index 1c2b925..a369401 100644 --- a/src/untrusted/lib/utils.ts +++ b/src/untrusted/lib/utils.ts @@ -13,8 +13,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -type TAny = ReturnType; - const l_Array = Array; const l_aP = l_Array.prototype; const l_Object = Object; @@ -60,12 +58,12 @@ const l_Uint8Array = Uint8Array; export const aFilter = ( a: TT[], predicate: { (value: TT, index: number, array: TT[]): value is TU }, - thisArg?: TAny, + thisArg?: never, ): TU[] => fnCall(l_aFilter, a, predicate, thisArg); export const aForEach = ( a: TT[], callbackfn: { (value: TT, index: number, array: TT[]): void }, - thisArg?: TAny, + thisArg?: never, ): void => fnCall(l_aForEach, a, callbackfn, thisArg); export const aFrom = l_Array.from; export const aIncludes = ( @@ -84,7 +82,7 @@ export const aIsArray = l_Array.isArray; export const aMap = ( a: TT[], callbackfn: (value: TT, index: number, array: TT[]) => TU, - thisArg?: TAny, + thisArg?: never, ): TU[] => fnCall(l_aMap, a, callbackfn, thisArg); export const aPush = (a: TT[], ...items: TT[]): number => fnApply(l_aPush, a, items); diff --git a/test/lib/assertRejectsWithFactory.ts b/test/lib/assertRejectsWithFactory.ts index d5970e1..c566a8c 100644 --- a/test/lib/assertRejectsWithFactory.ts +++ b/test/lib/assertRejectsWithFactory.ts @@ -30,7 +30,7 @@ const assertRejectsWithFactory = globalThis[n as keyof typeof globalThis] === Error ? (globalThis[ n as unknown as keyof typeof globalThis - ] as unknown as ErrorConstructor) + ] as unknown as ErrorConstructor) : Error, ); diff --git a/test/lib/runBrowserTest.ts b/test/lib/runBrowserTest.ts index f5bbea2..d18293c 100644 --- a/test/lib/runBrowserTest.ts +++ b/test/lib/runBrowserTest.ts @@ -27,7 +27,7 @@ const runBrowserTest = (m: string, commonBundle?: boolean) => { __dirname, `../../dist/exports/${m.replace(/Sandbox$/, '')}.mjs`, 'default', - ); + ); enabledBrowsers().forEach(([browserName, browserDisplayName]) => { describe( diff --git a/test/lib/webdriverTestSuites.ts b/test/lib/webdriverTestSuites.ts index a3005da..00cb56f 100644 --- a/test/lib/webdriverTestSuites.ts +++ b/test/lib/webdriverTestSuites.ts @@ -47,10 +47,9 @@ const chromeOptions = new ChromeOptions(); chromeOptions.addArguments('--headless=new'); const edgeOptions = new EdgeOptions(); -edgeOptions.headless(); +edgeOptions.addArguments('--headless=new'); const firefoxOptions = new FirefoxOptions(); -firefoxOptions.headless(); const safariOptions = new SafariOptions(); @@ -211,7 +210,7 @@ export const webdriverTestSuites = ? 'TypeError' : errorName, }, - ], + ], ); }); }); @@ -248,25 +247,25 @@ export const webdriverTestSuites = errorName === true ? [true] : errorName === 'SyntaxError' - ? [ - null, - null, - { - name: errorName, - }, - ] - : [ - null, - { - name: - // TODO: Handle this in a different - // way. ReferenceError only happens - // when not using globalProxy - Array.isArray(errorName) - ? 'TypeError' - : errorName, - }, - ], + ? [ + null, + null, + { + name: errorName, + }, + ] + : [ + null, + { + name: + // TODO: Handle this in a different + // way. ReferenceError only happens + // when not using globalProxy + Array.isArray(errorName) + ? 'TypeError' + : errorName, + }, + ], ); }); });