diff --git a/.eslintignore b/.eslintignore index bf92b420..2cd9862c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -7,7 +7,7 @@ build/ lib/ # Generated files -tsconfig.tsbuildinfo +**/*.tsbuildinfo puppeteer.api.json puppeteer*.tgz yarn.lock @@ -18,9 +18,11 @@ yarn.lock test/output-*/ .dev_profile* coverage/ +src/generated # IDE Artifacts .vscode +.devcontainer # Misc .DS_Store @@ -32,6 +34,7 @@ coverage/ npm-debug.log* yarn-debug.log* yarn-error.log* + ## [END] Keep in sync with .gitignore # ESLint ignores. diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 22a43fef..23881e78 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -20,7 +20,7 @@ jobs: run: npm install - name: Build run: | - node utils/generate_version_file.js + ts-node utils/generate_sources.ts npm run docs - name: Version docs working-directory: ./website diff --git a/.gitignore b/.gitignore index de382d4b..81ab684a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ yarn.lock test/output-*/ .dev_profile* coverage/ +src/generated # IDE Artifacts .vscode diff --git a/.prettierignore b/.prettierignore index d3d64d2a..738ed9e5 100644 --- a/.prettierignore +++ b/.prettierignore @@ -7,7 +7,7 @@ build/ lib/ # Generated files -tsconfig.tsbuildinfo +**/*.tsbuildinfo puppeteer.api.json puppeteer*.tgz yarn.lock @@ -18,9 +18,11 @@ yarn.lock test/output-*/ .dev_profile* coverage/ +src/generated # IDE Artifacts .vscode +.devcontainer # Misc .DS_Store diff --git a/package-lock.json b/package-lock.json index 1bb30341..ee717277 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,6 +50,7 @@ "commonmark": "0.30.0", "cross-env": "7.0.3", "diff": "5.1.0", + "esbuild": "^0.15.5", "eslint": "8.21.0", "eslint-config-prettier": "8.5.0", "eslint-formatter-codeframe": "7.32.1", @@ -84,33 +85,33 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", - "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", + "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", "dev": true, "dependencies": { - "@babel/highlight": "^7.16.7" + "@babel/highlight": "^7.18.6" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", - "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz", + "integrity": "sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.17.12", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.12.tgz", - "integrity": "sha512-7yykMVF3hfZY2jsHZEEgLc+3x4o1O+fYyULu11GynEUQNwB6lua+IIQn1FiJxNucd5UlyJryrwsOh8PL9Sn8Qg==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.16.7", + "@babel/helper-validator-identifier": "^7.18.6", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, @@ -467,6 +468,22 @@ "node": ">=12" } }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.5.tgz", + "integrity": "sha512-UHkDFCfSGTuXq08oQltXxSZmH1TXyWsL+4QhZDWvvLl6mEJQqk3u7/wq1LjhrrAXYIllaTtRSzUXl4Olkf2J8A==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@eslint/eslintrc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", @@ -837,6 +854,327 @@ "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", "dev": true }, + "node_modules/@swc/core": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.2.237.tgz", + "integrity": "sha512-Di1WUEA913jzOJLJ59ouzOWudQym3ODCxRnSKcOT7dgOxb+X76Xpj1kBkN5u5o2SsTjYj32Cm34rQM4TjzXZIg==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "peer": true, + "bin": { + "swcx": "run_swcx.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/swc" + }, + "optionalDependencies": { + "@swc/core-android-arm-eabi": "1.2.237", + "@swc/core-android-arm64": "1.2.237", + "@swc/core-darwin-arm64": "1.2.237", + "@swc/core-darwin-x64": "1.2.237", + "@swc/core-freebsd-x64": "1.2.237", + "@swc/core-linux-arm-gnueabihf": "1.2.237", + "@swc/core-linux-arm64-gnu": "1.2.237", + "@swc/core-linux-arm64-musl": "1.2.237", + "@swc/core-linux-x64-gnu": "1.2.237", + "@swc/core-linux-x64-musl": "1.2.237", + "@swc/core-win32-arm64-msvc": "1.2.237", + "@swc/core-win32-ia32-msvc": "1.2.237", + "@swc/core-win32-x64-msvc": "1.2.237" + } + }, + "node_modules/@swc/core-android-arm-eabi": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.2.237.tgz", + "integrity": "sha512-Jc9EGzp9zJzV3piPy2w92glNbp3MW7jDGk8c62pJbRBBymbJ2DSujmFiHaU9vTwFdGHRpJAMAuHGotBYSgRigw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "peer": true, + "dependencies": { + "@swc/wasm": "1.2.122" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-android-arm64": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm64/-/core-android-arm64-1.2.237.tgz", + "integrity": "sha512-nJVCxuz1p6/H7RSv2vz5hsxp0oCrg/Gke0OitWgLvEOtuw9hcyAeYeK4/hYsT0DSt1qqagFj8W+tkHcJcyl55g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "peer": true, + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-android-arm64/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/@swc/core-darwin-arm64": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.2.237.tgz", + "integrity": "sha512-Epq+MDE9M92h2DyEaY3XP1uCUI9KFms7rtYeCQxqB1Md84WSpXitg/2rloeDJYBU73y4i/Gv1Zew+7Noimzptg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-darwin-x64": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.2.237.tgz", + "integrity": "sha512-CXqSyZV62aG5ybMjJg7SiJAPvQxshfhCwV/Mp5InlABrQoiyyNyri1yQFpWWMx0ZVmiMiLMkFfJjcuUTpSSWkQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-freebsd-x64": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-freebsd-x64/-/core-freebsd-x64-1.2.237.tgz", + "integrity": "sha512-uW7FLWzEH8JOWO8ydXt47Fg1qD76zUGrCGNA3YXvNUal5I9k/KWfw4SbL8XZBRlES3lyBBs2Gl6tJiv+RdgIkQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "peer": true, + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-freebsd-x64/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/@swc/core-linux-arm-gnueabihf": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.2.237.tgz", + "integrity": "sha512-i76H/tvYDGjqAaPn58tAMxDNlj91Mp4nVscCn0iJ4sv8/zHXInYlYCnDaPIUsjudh9C3V6rXzKqdEVthGo/Vhw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm-gnueabihf/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/@swc/core-linux-arm64-gnu": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.2.237.tgz", + "integrity": "sha512-kOQtBtzq+U1edoi7aVazuGN6zWV/61ecO4jHBxYsR2YKePLBh9fpoZ8QKByprlN1l3rGFfI4nuRFEwdMQh2f/Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm64-musl": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.2.237.tgz", + "integrity": "sha512-8NcG6oY323JmsUvxwTdt55lCvDZmQoiJn0tkp/4GXNo/KVn1tJ6GCAgQ43vohCHPitOWokPyaIOdn0HbZrbbZw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-x64-gnu": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.2.237.tgz", + "integrity": "sha512-bEsroO1ysD8mF2H6aQHz8OjjdVEODXoK3tzGB2jyFqNxxfai3St0c9vF+iOnOmiwXEKZiEU268gZO6uki34TlA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-x64-musl": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.2.237.tgz", + "integrity": "sha512-xU9CwzyWWlW0kJ6/AVrXH8hTUCsWWLtL32gcpgAdEyiwUlRBD5MvqPGkEsa0sMvGOuCkUPYRflPAFFc5aLRFiw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-arm64-msvc": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.2.237.tgz", + "integrity": "sha512-ySZU45r2KAfLNOsbm4XdOat2d/d9Tp4M16bY1+f+tdve57Pre6KPBbLjVH8WLZBlYPW/dqcO/Kvey9hYuBEIqw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-arm64-msvc/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/@swc/core-win32-ia32-msvc": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.2.237.tgz", + "integrity": "sha512-q6oVDD54KphaM1xQDuDjrGvcEskW0ZXett3VsjhWbehcxQnOmfCe1CBKitpJDC53S/S+Xv9rAce9wsIxRClaTw==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-ia32-msvc/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/@swc/core-win32-x64-msvc": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.2.237.tgz", + "integrity": "sha512-R9P4DkLi46eW+KRRh3le/OWjuDwb76SdBSMLC9kQ5iSxaXkQxGFcrruKiw/SfXyLylSVY+WQ5dy7b5S8QFQQdA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/wasm": { + "version": "1.2.122", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.122.tgz", + "integrity": "sha512-sM1VCWQxmNhFtdxME+8UXNyPNhxNu7zdb6ikWpz0YKAQQFRGT5ThZgJrubEpah335SUToNg8pkdDF7ibVCjxbQ==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -2262,6 +2600,362 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/esbuild": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.5.tgz", + "integrity": "sha512-VSf6S1QVqvxfIsSKb3UKr3VhUCis7wgDbtF4Vd9z84UJr05/Sp2fRKmzC+CSPG/dNAPPJZ0BTBLTT1Fhd6N9Gg==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/linux-loong64": "0.15.5", + "esbuild-android-64": "0.15.5", + "esbuild-android-arm64": "0.15.5", + "esbuild-darwin-64": "0.15.5", + "esbuild-darwin-arm64": "0.15.5", + "esbuild-freebsd-64": "0.15.5", + "esbuild-freebsd-arm64": "0.15.5", + "esbuild-linux-32": "0.15.5", + "esbuild-linux-64": "0.15.5", + "esbuild-linux-arm": "0.15.5", + "esbuild-linux-arm64": "0.15.5", + "esbuild-linux-mips64le": "0.15.5", + "esbuild-linux-ppc64le": "0.15.5", + "esbuild-linux-riscv64": "0.15.5", + "esbuild-linux-s390x": "0.15.5", + "esbuild-netbsd-64": "0.15.5", + "esbuild-openbsd-64": "0.15.5", + "esbuild-sunos-64": "0.15.5", + "esbuild-windows-32": "0.15.5", + "esbuild-windows-64": "0.15.5", + "esbuild-windows-arm64": "0.15.5" + } + }, + "node_modules/esbuild-android-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.5.tgz", + "integrity": "sha512-dYPPkiGNskvZqmIK29OPxolyY3tp+c47+Fsc2WYSOVjEPWNCHNyqhtFqQadcXMJDQt8eN0NMDukbyQgFcHquXg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-android-arm64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.5.tgz", + "integrity": "sha512-YyEkaQl08ze3cBzI/4Cm1S+rVh8HMOpCdq8B78JLbNFHhzi4NixVN93xDrHZLztlocEYqi45rHHCgA8kZFidFg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.5.tgz", + "integrity": "sha512-Cr0iIqnWKx3ZTvDUAzG0H/u9dWjLE4c2gTtRLz4pqOBGjfjqdcZSfAObFzKTInLLSmD0ZV1I/mshhPoYSBMMCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.5.tgz", + "integrity": "sha512-WIfQkocGtFrz7vCu44ypY5YmiFXpsxvz2xqwe688jFfSVCnUsCn2qkEVDo7gT8EpsLOz1J/OmqjExePL1dr1Kg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.5.tgz", + "integrity": "sha512-M5/EfzV2RsMd/wqwR18CELcenZ8+fFxQAAEO7TJKDmP3knhWSbD72ILzrXFMMwshlPAS1ShCZ90jsxkm+8FlaA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-arm64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.5.tgz", + "integrity": "sha512-2JQQ5Qs9J0440F/n/aUBNvY6lTo4XP/4lt1TwDfHuo0DY3w5++anw+jTjfouLzbJmFFiwmX7SmUhMnysocx96w==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-32": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.5.tgz", + "integrity": "sha512-gO9vNnIN0FTUGjvTFucIXtBSr1Woymmx/aHQtuU+2OllGU6YFLs99960UD4Dib1kFovVgs59MTXwpFdVoSMZoQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.5.tgz", + "integrity": "sha512-ne0GFdNLsm4veXbTnYAWjbx3shpNKZJUd6XpNbKNUZaNllDZfYQt0/zRqOg0sc7O8GQ+PjSMv9IpIEULXVTVmg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.5.tgz", + "integrity": "sha512-wvAoHEN+gJ/22gnvhZnS/+2H14HyAxM07m59RSLn3iXrQsdS518jnEWRBnJz3fR6BJa+VUTo0NxYjGaNt7RA7Q==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.5.tgz", + "integrity": "sha512-7EgFyP2zjO065XTfdCxiXVEk+f83RQ1JsryN1X/VSX2li9rnHAt2swRbpoz5Vlrl6qjHrCmq5b6yxD13z6RheA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-mips64le": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.5.tgz", + "integrity": "sha512-KdnSkHxWrJ6Y40ABu+ipTZeRhFtc8dowGyFsZY5prsmMSr1ZTG9zQawguN4/tunJ0wy3+kD54GaGwdcpwWAvZQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-ppc64le": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.5.tgz", + "integrity": "sha512-QdRHGeZ2ykl5P0KRmfGBZIHmqcwIsUKWmmpZTOq573jRWwmpfRmS7xOhmDHBj9pxv+6qRMH8tLr2fe+ZKQvCYw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-riscv64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.5.tgz", + "integrity": "sha512-p+WE6RX+jNILsf+exR29DwgV6B73khEQV0qWUbzxaycxawZ8NE0wA6HnnTxbiw5f4Gx9sJDUBemh9v49lKOORA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-s390x": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.5.tgz", + "integrity": "sha512-J2ngOB4cNzmqLHh6TYMM/ips8aoZIuzxJnDdWutBw5482jGXiOzsPoEF4j2WJ2mGnm7FBCO4StGcwzOgic70JQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-netbsd-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.5.tgz", + "integrity": "sha512-MmKUYGDizYjFia0Rwt8oOgmiFH7zaYlsoQ3tIOfPxOqLssAsEgG0MUdRDm5lliqjiuoog8LyDu9srQk5YwWF3w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-openbsd-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.5.tgz", + "integrity": "sha512-2mMFfkLk3oPWfopA9Plj4hyhqHNuGyp5KQyTT9Rc8hFd8wAn5ZrbJg+gNcLMo2yzf8Uiu0RT6G9B15YN9WQyMA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-sunos-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.5.tgz", + "integrity": "sha512-2sIzhMUfLNoD+rdmV6AacilCHSxZIoGAU2oT7XmJ0lXcZWnCvCtObvO6D4puxX9YRE97GodciRGDLBaiC6x1SA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-32": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.5.tgz", + "integrity": "sha512-e+duNED9UBop7Vnlap6XKedA/53lIi12xv2ebeNS4gFmu7aKyTrok7DPIZyU5w/ftHD4MUDs5PJUkQPP9xJRzg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.5.tgz", + "integrity": "sha512-v+PjvNtSASHOjPDMIai9Yi+aP+Vwox+3WVdg2JB8N9aivJ7lyhp4NVU+J0MV2OkWFPnVO8AE/7xH+72ibUUEnw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-arm64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.5.tgz", + "integrity": "sha512-Yz8w/D8CUPYstvVQujByu6mlf48lKmXkq6bkeSZZxTA626efQOJb26aDGLzmFWx6eg/FwrXgt6SZs9V8Pwy/aA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -7025,27 +7719,27 @@ }, "dependencies": { "@babel/code-frame": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", - "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", + "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", "dev": true, "requires": { - "@babel/highlight": "^7.16.7" + "@babel/highlight": "^7.18.6" } }, "@babel/helper-validator-identifier": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", - "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz", + "integrity": "sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==", "dev": true }, "@babel/highlight": { - "version": "7.17.12", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.12.tgz", - "integrity": "sha512-7yykMVF3hfZY2jsHZEEgLc+3x4o1O+fYyULu11GynEUQNwB6lua+IIQn1FiJxNucd5UlyJryrwsOh8PL9Sn8Qg==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.16.7", + "@babel/helper-validator-identifier": "^7.18.6", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, @@ -7327,6 +8021,13 @@ "@jridgewell/trace-mapping": "0.3.9" } }, + "@esbuild/linux-loong64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.5.tgz", + "integrity": "sha512-UHkDFCfSGTuXq08oQltXxSZmH1TXyWsL+4QhZDWvvLl6mEJQqk3u7/wq1LjhrrAXYIllaTtRSzUXl4Olkf2J8A==", + "dev": true, + "optional": true + }, "@eslint/eslintrc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", @@ -7656,6 +8357,209 @@ "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", "dev": true }, + "@swc/core": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.2.237.tgz", + "integrity": "sha512-Di1WUEA913jzOJLJ59ouzOWudQym3ODCxRnSKcOT7dgOxb+X76Xpj1kBkN5u5o2SsTjYj32Cm34rQM4TjzXZIg==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "@swc/core-android-arm-eabi": "1.2.237", + "@swc/core-android-arm64": "1.2.237", + "@swc/core-darwin-arm64": "1.2.237", + "@swc/core-darwin-x64": "1.2.237", + "@swc/core-freebsd-x64": "1.2.237", + "@swc/core-linux-arm-gnueabihf": "1.2.237", + "@swc/core-linux-arm64-gnu": "1.2.237", + "@swc/core-linux-arm64-musl": "1.2.237", + "@swc/core-linux-x64-gnu": "1.2.237", + "@swc/core-linux-x64-musl": "1.2.237", + "@swc/core-win32-arm64-msvc": "1.2.237", + "@swc/core-win32-ia32-msvc": "1.2.237", + "@swc/core-win32-x64-msvc": "1.2.237" + } + }, + "@swc/core-android-arm-eabi": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.2.237.tgz", + "integrity": "sha512-Jc9EGzp9zJzV3piPy2w92glNbp3MW7jDGk8c62pJbRBBymbJ2DSujmFiHaU9vTwFdGHRpJAMAuHGotBYSgRigw==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "@swc/wasm": "1.2.122" + } + }, + "@swc/core-android-arm64": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm64/-/core-android-arm64-1.2.237.tgz", + "integrity": "sha512-nJVCxuz1p6/H7RSv2vz5hsxp0oCrg/Gke0OitWgLvEOtuw9hcyAeYeK4/hYsT0DSt1qqagFj8W+tkHcJcyl55g==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true, + "peer": true + } + } + }, + "@swc/core-darwin-arm64": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.2.237.tgz", + "integrity": "sha512-Epq+MDE9M92h2DyEaY3XP1uCUI9KFms7rtYeCQxqB1Md84WSpXitg/2rloeDJYBU73y4i/Gv1Zew+7Noimzptg==", + "dev": true, + "optional": true, + "peer": true + }, + "@swc/core-darwin-x64": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.2.237.tgz", + "integrity": "sha512-CXqSyZV62aG5ybMjJg7SiJAPvQxshfhCwV/Mp5InlABrQoiyyNyri1yQFpWWMx0ZVmiMiLMkFfJjcuUTpSSWkQ==", + "dev": true, + "optional": true, + "peer": true + }, + "@swc/core-freebsd-x64": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-freebsd-x64/-/core-freebsd-x64-1.2.237.tgz", + "integrity": "sha512-uW7FLWzEH8JOWO8ydXt47Fg1qD76zUGrCGNA3YXvNUal5I9k/KWfw4SbL8XZBRlES3lyBBs2Gl6tJiv+RdgIkQ==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true, + "peer": true + } + } + }, + "@swc/core-linux-arm-gnueabihf": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.2.237.tgz", + "integrity": "sha512-i76H/tvYDGjqAaPn58tAMxDNlj91Mp4nVscCn0iJ4sv8/zHXInYlYCnDaPIUsjudh9C3V6rXzKqdEVthGo/Vhw==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true, + "peer": true + } + } + }, + "@swc/core-linux-arm64-gnu": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.2.237.tgz", + "integrity": "sha512-kOQtBtzq+U1edoi7aVazuGN6zWV/61ecO4jHBxYsR2YKePLBh9fpoZ8QKByprlN1l3rGFfI4nuRFEwdMQh2f/Q==", + "dev": true, + "optional": true, + "peer": true + }, + "@swc/core-linux-arm64-musl": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.2.237.tgz", + "integrity": "sha512-8NcG6oY323JmsUvxwTdt55lCvDZmQoiJn0tkp/4GXNo/KVn1tJ6GCAgQ43vohCHPitOWokPyaIOdn0HbZrbbZw==", + "dev": true, + "optional": true, + "peer": true + }, + "@swc/core-linux-x64-gnu": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.2.237.tgz", + "integrity": "sha512-bEsroO1ysD8mF2H6aQHz8OjjdVEODXoK3tzGB2jyFqNxxfai3St0c9vF+iOnOmiwXEKZiEU268gZO6uki34TlA==", + "dev": true, + "optional": true, + "peer": true + }, + "@swc/core-linux-x64-musl": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.2.237.tgz", + "integrity": "sha512-xU9CwzyWWlW0kJ6/AVrXH8hTUCsWWLtL32gcpgAdEyiwUlRBD5MvqPGkEsa0sMvGOuCkUPYRflPAFFc5aLRFiw==", + "dev": true, + "optional": true, + "peer": true + }, + "@swc/core-win32-arm64-msvc": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.2.237.tgz", + "integrity": "sha512-ySZU45r2KAfLNOsbm4XdOat2d/d9Tp4M16bY1+f+tdve57Pre6KPBbLjVH8WLZBlYPW/dqcO/Kvey9hYuBEIqw==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true, + "peer": true + } + } + }, + "@swc/core-win32-ia32-msvc": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.2.237.tgz", + "integrity": "sha512-q6oVDD54KphaM1xQDuDjrGvcEskW0ZXett3VsjhWbehcxQnOmfCe1CBKitpJDC53S/S+Xv9rAce9wsIxRClaTw==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true, + "peer": true + } + } + }, + "@swc/core-win32-x64-msvc": { + "version": "1.2.237", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.2.237.tgz", + "integrity": "sha512-R9P4DkLi46eW+KRRh3le/OWjuDwb76SdBSMLC9kQ5iSxaXkQxGFcrruKiw/SfXyLylSVY+WQ5dy7b5S8QFQQdA==", + "dev": true, + "optional": true, + "peer": true + }, + "@swc/wasm": { + "version": "1.2.122", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.122.tgz", + "integrity": "sha512-sM1VCWQxmNhFtdxME+8UXNyPNhxNu7zdb6ikWpz0YKAQQFRGT5ThZgJrubEpah335SUToNg8pkdDF7ibVCjxbQ==", + "dev": true, + "optional": true, + "peer": true + }, "@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -8742,6 +9646,175 @@ "is-symbol": "^1.0.2" } }, + "esbuild": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.5.tgz", + "integrity": "sha512-VSf6S1QVqvxfIsSKb3UKr3VhUCis7wgDbtF4Vd9z84UJr05/Sp2fRKmzC+CSPG/dNAPPJZ0BTBLTT1Fhd6N9Gg==", + "dev": true, + "requires": { + "@esbuild/linux-loong64": "0.15.5", + "esbuild-android-64": "0.15.5", + "esbuild-android-arm64": "0.15.5", + "esbuild-darwin-64": "0.15.5", + "esbuild-darwin-arm64": "0.15.5", + "esbuild-freebsd-64": "0.15.5", + "esbuild-freebsd-arm64": "0.15.5", + "esbuild-linux-32": "0.15.5", + "esbuild-linux-64": "0.15.5", + "esbuild-linux-arm": "0.15.5", + "esbuild-linux-arm64": "0.15.5", + "esbuild-linux-mips64le": "0.15.5", + "esbuild-linux-ppc64le": "0.15.5", + "esbuild-linux-riscv64": "0.15.5", + "esbuild-linux-s390x": "0.15.5", + "esbuild-netbsd-64": "0.15.5", + "esbuild-openbsd-64": "0.15.5", + "esbuild-sunos-64": "0.15.5", + "esbuild-windows-32": "0.15.5", + "esbuild-windows-64": "0.15.5", + "esbuild-windows-arm64": "0.15.5" + } + }, + "esbuild-android-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.5.tgz", + "integrity": "sha512-dYPPkiGNskvZqmIK29OPxolyY3tp+c47+Fsc2WYSOVjEPWNCHNyqhtFqQadcXMJDQt8eN0NMDukbyQgFcHquXg==", + "dev": true, + "optional": true + }, + "esbuild-android-arm64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.5.tgz", + "integrity": "sha512-YyEkaQl08ze3cBzI/4Cm1S+rVh8HMOpCdq8B78JLbNFHhzi4NixVN93xDrHZLztlocEYqi45rHHCgA8kZFidFg==", + "dev": true, + "optional": true + }, + "esbuild-darwin-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.5.tgz", + "integrity": "sha512-Cr0iIqnWKx3ZTvDUAzG0H/u9dWjLE4c2gTtRLz4pqOBGjfjqdcZSfAObFzKTInLLSmD0ZV1I/mshhPoYSBMMCQ==", + "dev": true, + "optional": true + }, + "esbuild-darwin-arm64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.5.tgz", + "integrity": "sha512-WIfQkocGtFrz7vCu44ypY5YmiFXpsxvz2xqwe688jFfSVCnUsCn2qkEVDo7gT8EpsLOz1J/OmqjExePL1dr1Kg==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.5.tgz", + "integrity": "sha512-M5/EfzV2RsMd/wqwR18CELcenZ8+fFxQAAEO7TJKDmP3knhWSbD72ILzrXFMMwshlPAS1ShCZ90jsxkm+8FlaA==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-arm64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.5.tgz", + "integrity": "sha512-2JQQ5Qs9J0440F/n/aUBNvY6lTo4XP/4lt1TwDfHuo0DY3w5++anw+jTjfouLzbJmFFiwmX7SmUhMnysocx96w==", + "dev": true, + "optional": true + }, + "esbuild-linux-32": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.5.tgz", + "integrity": "sha512-gO9vNnIN0FTUGjvTFucIXtBSr1Woymmx/aHQtuU+2OllGU6YFLs99960UD4Dib1kFovVgs59MTXwpFdVoSMZoQ==", + "dev": true, + "optional": true + }, + "esbuild-linux-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.5.tgz", + "integrity": "sha512-ne0GFdNLsm4veXbTnYAWjbx3shpNKZJUd6XpNbKNUZaNllDZfYQt0/zRqOg0sc7O8GQ+PjSMv9IpIEULXVTVmg==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.5.tgz", + "integrity": "sha512-wvAoHEN+gJ/22gnvhZnS/+2H14HyAxM07m59RSLn3iXrQsdS518jnEWRBnJz3fR6BJa+VUTo0NxYjGaNt7RA7Q==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.5.tgz", + "integrity": "sha512-7EgFyP2zjO065XTfdCxiXVEk+f83RQ1JsryN1X/VSX2li9rnHAt2swRbpoz5Vlrl6qjHrCmq5b6yxD13z6RheA==", + "dev": true, + "optional": true + }, + "esbuild-linux-mips64le": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.5.tgz", + "integrity": "sha512-KdnSkHxWrJ6Y40ABu+ipTZeRhFtc8dowGyFsZY5prsmMSr1ZTG9zQawguN4/tunJ0wy3+kD54GaGwdcpwWAvZQ==", + "dev": true, + "optional": true + }, + "esbuild-linux-ppc64le": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.5.tgz", + "integrity": "sha512-QdRHGeZ2ykl5P0KRmfGBZIHmqcwIsUKWmmpZTOq573jRWwmpfRmS7xOhmDHBj9pxv+6qRMH8tLr2fe+ZKQvCYw==", + "dev": true, + "optional": true + }, + "esbuild-linux-riscv64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.5.tgz", + "integrity": "sha512-p+WE6RX+jNILsf+exR29DwgV6B73khEQV0qWUbzxaycxawZ8NE0wA6HnnTxbiw5f4Gx9sJDUBemh9v49lKOORA==", + "dev": true, + "optional": true + }, + "esbuild-linux-s390x": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.5.tgz", + "integrity": "sha512-J2ngOB4cNzmqLHh6TYMM/ips8aoZIuzxJnDdWutBw5482jGXiOzsPoEF4j2WJ2mGnm7FBCO4StGcwzOgic70JQ==", + "dev": true, + "optional": true + }, + "esbuild-netbsd-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.5.tgz", + "integrity": "sha512-MmKUYGDizYjFia0Rwt8oOgmiFH7zaYlsoQ3tIOfPxOqLssAsEgG0MUdRDm5lliqjiuoog8LyDu9srQk5YwWF3w==", + "dev": true, + "optional": true + }, + "esbuild-openbsd-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.5.tgz", + "integrity": "sha512-2mMFfkLk3oPWfopA9Plj4hyhqHNuGyp5KQyTT9Rc8hFd8wAn5ZrbJg+gNcLMo2yzf8Uiu0RT6G9B15YN9WQyMA==", + "dev": true, + "optional": true + }, + "esbuild-sunos-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.5.tgz", + "integrity": "sha512-2sIzhMUfLNoD+rdmV6AacilCHSxZIoGAU2oT7XmJ0lXcZWnCvCtObvO6D4puxX9YRE97GodciRGDLBaiC6x1SA==", + "dev": true, + "optional": true + }, + "esbuild-windows-32": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.5.tgz", + "integrity": "sha512-e+duNED9UBop7Vnlap6XKedA/53lIi12xv2ebeNS4gFmu7aKyTrok7DPIZyU5w/ftHD4MUDs5PJUkQPP9xJRzg==", + "dev": true, + "optional": true + }, + "esbuild-windows-64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.5.tgz", + "integrity": "sha512-v+PjvNtSASHOjPDMIai9Yi+aP+Vwox+3WVdg2JB8N9aivJ7lyhp4NVU+J0MV2OkWFPnVO8AE/7xH+72ibUUEnw==", + "dev": true, + "optional": true + }, + "esbuild-windows-arm64": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.5.tgz", + "integrity": "sha512-Yz8w/D8CUPYstvVQujByu6mlf48lKmXkq6bkeSZZxTA626efQOJb26aDGLzmFWx6eg/FwrXgt6SZs9V8Pwy/aA==", + "dev": true, + "optional": true + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", diff --git a/package.json b/package.json index ba862a62..0819f78e 100644 --- a/package.json +++ b/package.json @@ -41,8 +41,9 @@ "lint:prettier": "prettier --check .", "lint:eslint": "([ \"$CI\" = true ] && eslint --ext js --ext ts --quiet -f codeframe . || eslint --ext js --ext ts .)", "install": "node install.js", + "generate:sources": "ts-node utils/generate_sources.ts", "generate:types": "node utils/export_all.js && api-extractor run --local --verbose && eslint --ext ts --no-ignore --no-eslintrc -c .eslintrc.types.cjs --fix lib/types.d.ts", - "generate:markdown": "ts-node -O '{\"module\":\"commonjs\"}' utils/generate_docs.ts && prettier --ignore-path none --write docs", + "generate:markdown": "ts-node utils/generate_docs.ts && prettier --ignore-path none --write docs", "generate:esm-package-json": "echo '{\"type\": \"module\"}' > lib/esm/package.json", "format": "run-s format:*", "format:prettier": "prettier --write .", @@ -54,7 +55,7 @@ "check": "run-p check:*", "check:protocol-revision": "ts-node -s scripts/ensure-correct-devtools-protocol-package", "check:pinned-deps": "ts-node -s scripts/ensure-pinned-deps", - "build": "run-s build:tsc generate:types generate:esm-package-json", + "build": "run-s generate:sources build:tsc generate:types generate:esm-package-json", "build:tsc": "tsc --version && run-p build:tsc:*", "build:tsc:esm": "tsc -b src/tsconfig.esm.json", "build:tsc:cjs": "tsc -b src/tsconfig.cjs.json", @@ -109,6 +110,7 @@ "commonmark": "0.30.0", "cross-env": "7.0.3", "diff": "5.1.0", + "esbuild": "0.15.5", "eslint": "8.21.0", "eslint-config-prettier": "8.5.0", "eslint-formatter-codeframe": "7.32.1", diff --git a/src/common/AriaQueryHandler.ts b/src/common/AriaQueryHandler.ts index 774ea53a..03088487 100644 --- a/src/common/AriaQueryHandler.ts +++ b/src/common/AriaQueryHandler.ts @@ -15,7 +15,7 @@ */ import {Protocol} from 'devtools-protocol'; -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {CDPSession} from './Connection.js'; import { IsolatedWorld, diff --git a/src/common/Browser.ts b/src/common/Browser.ts index c77ac34b..253cfff2 100644 --- a/src/common/Browser.ts +++ b/src/common/Browser.ts @@ -16,7 +16,7 @@ import {ChildProcess} from 'child_process'; import {Protocol} from 'devtools-protocol'; -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {CDPSession, Connection, ConnectionEmittedEvents} from './Connection.js'; import {EventEmitter} from './EventEmitter.js'; import {waitWithTimeout} from './util.js'; diff --git a/src/common/BrowserConnector.ts b/src/common/BrowserConnector.ts index 3d4346f2..8d65873c 100644 --- a/src/common/BrowserConnector.ts +++ b/src/common/BrowserConnector.ts @@ -14,9 +14,10 @@ * limitations under the License. */ -import {debugError, isErrorLike} from './util.js'; +import {debugError} from './util.js'; +import {isErrorLike} from '../util/ErrorLike.js'; import {isNode} from '../environment.js'; -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import { Browser, IsPageTargetCallback, diff --git a/src/common/ChromeTargetManager.ts b/src/common/ChromeTargetManager.ts index fb775a01..f08001e0 100644 --- a/src/common/ChromeTargetManager.ts +++ b/src/common/ChromeTargetManager.ts @@ -15,7 +15,7 @@ */ import Protocol from 'devtools-protocol'; -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {CDPSession, Connection} from './Connection.js'; import {EventEmitter} from './EventEmitter.js'; import {Target} from './Target.js'; diff --git a/src/common/Connection.ts b/src/common/Connection.ts index 076ed459..541e225e 100644 --- a/src/common/Connection.ts +++ b/src/common/Connection.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {debug} from './Debug.js'; const debugProtocolSend = debug('puppeteer:protocol:SEND ►'); const debugProtocolReceive = debug('puppeteer:protocol:RECV ◀'); diff --git a/src/common/Coverage.ts b/src/common/Coverage.ts index f130f4c8..10b811b8 100644 --- a/src/common/Coverage.ts +++ b/src/common/Coverage.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {addEventListener, debugError, PuppeteerEventListener} from './util.js'; import {Protocol} from 'devtools-protocol'; import {CDPSession} from './Connection.js'; diff --git a/src/common/Dialog.ts b/src/common/Dialog.ts index 259c67aa..6d84fd0d 100644 --- a/src/common/Dialog.ts +++ b/src/common/Dialog.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {CDPSession} from './Connection.js'; import {Protocol} from 'devtools-protocol'; diff --git a/src/common/ElementHandle.ts b/src/common/ElementHandle.ts index fc1e7b22..d6a95199 100644 --- a/src/common/ElementHandle.ts +++ b/src/common/ElementHandle.ts @@ -1,5 +1,5 @@ import {Protocol} from 'devtools-protocol'; -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {CDPSession} from './Connection.js'; import {ExecutionContext} from './ExecutionContext.js'; import {Frame, FrameManager} from './FrameManager.js'; diff --git a/src/common/ExecutionContext.ts b/src/common/ExecutionContext.ts index 6a755428..86c44d47 100644 --- a/src/common/ExecutionContext.ts +++ b/src/common/ExecutionContext.ts @@ -15,7 +15,7 @@ */ import {Protocol} from 'devtools-protocol'; -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {CDPSession} from './Connection.js'; import {Frame} from './FrameManager.js'; import {IsolatedWorld} from './IsolatedWorld.js'; diff --git a/src/common/FileChooser.ts b/src/common/FileChooser.ts index 5c434c29..c0a68ff9 100644 --- a/src/common/FileChooser.ts +++ b/src/common/FileChooser.ts @@ -15,7 +15,7 @@ */ import {Protocol} from 'devtools-protocol'; -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {ElementHandle} from './ElementHandle.js'; /** diff --git a/src/common/FirefoxTargetManager.ts b/src/common/FirefoxTargetManager.ts index c3b33a4a..e31a205a 100644 --- a/src/common/FirefoxTargetManager.ts +++ b/src/common/FirefoxTargetManager.ts @@ -15,7 +15,7 @@ */ import Protocol from 'devtools-protocol'; -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {CDPSession, Connection} from './Connection.js'; import {Target} from './Target.js'; import {TargetFilterCallback} from './Browser.js'; diff --git a/src/common/FrameManager.ts b/src/common/FrameManager.ts index 99923860..dcbdcc91 100644 --- a/src/common/FrameManager.ts +++ b/src/common/FrameManager.ts @@ -15,7 +15,7 @@ */ import {Protocol} from 'devtools-protocol'; -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {CDPSession} from './Connection.js'; import {ElementHandle} from './ElementHandle.js'; import {EventEmitter} from './EventEmitter.js'; @@ -35,12 +35,12 @@ import {Page} from './Page.js'; import {Target} from './Target.js'; import {TimeoutSettings} from './TimeoutSettings.js'; import {EvaluateFunc, HandleFor, NodeFor} from './types.js'; +import {debugError} from './util.js'; +import {isErrorLike} from '../util/ErrorLike.js'; import { createDeferredPromiseWithTimer, - debugError, DeferredPromise, - isErrorLike, -} from './util.js'; +} from '../util/DeferredPromise.js'; const UTILITY_WORLD_NAME = '__puppeteer_utility_world__'; diff --git a/src/common/HTTPRequest.ts b/src/common/HTTPRequest.ts index d2d6412a..7c2603dc 100644 --- a/src/common/HTTPRequest.ts +++ b/src/common/HTTPRequest.ts @@ -15,7 +15,7 @@ */ import {Protocol} from 'devtools-protocol'; import {ProtocolMapping} from 'devtools-protocol/types/protocol-mapping.js'; -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {ProtocolError} from './Errors.js'; import {EventEmitter} from './EventEmitter.js'; import {Frame} from './FrameManager.js'; diff --git a/src/common/Input.ts b/src/common/Input.ts index 7896a351..8234f493 100644 --- a/src/common/Input.ts +++ b/src/common/Input.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {CDPSession} from './Connection.js'; import {_keyDefinitions, KeyDefinition, KeyInput} from './USKeyboardLayout.js'; import {Protocol} from 'devtools-protocol'; diff --git a/src/common/IsolatedWorld.ts b/src/common/IsolatedWorld.ts index 66990916..630048fa 100644 --- a/src/common/IsolatedWorld.ts +++ b/src/common/IsolatedWorld.ts @@ -15,7 +15,7 @@ */ import {Protocol} from 'devtools-protocol'; -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {CDPSession} from './Connection.js'; import {ElementHandle} from './ElementHandle.js'; import {TimeoutError} from './Errors.js'; @@ -28,16 +28,18 @@ import {getQueryHandlerAndSelector} from './QueryHandler.js'; import {TimeoutSettings} from './TimeoutSettings.js'; import {EvaluateFunc, HandleFor, NodeFor} from './types.js'; import { - createDeferredPromise, createJSHandle, debugError, - DeferredPromise, importFS, isNumber, isString, makePredicateString, pageBindingInitString, } from './util.js'; +import { + createDeferredPromise, + DeferredPromise, +} from '../util/DeferredPromise.js'; // predicateQueryHandler and checkWaitForOptions are declared here so that // TypeScript knows about them when used in the predicate function below. @@ -722,9 +724,7 @@ export class IsolatedWorld { waitForVisible: boolean, waitForHidden: boolean ): Promise { - const node = predicateQueryHandler - ? ((await predicateQueryHandler(root, selector)) as Element) - : root.querySelector(selector); + const node = (await predicateQueryHandler(root, selector)) as Element; return checkWaitForOptions(node, waitForVisible, waitForHidden); } const waitTaskOptions: WaitTaskOptions = { diff --git a/src/common/JSHandle.ts b/src/common/JSHandle.ts index 3e0149ca..70536309 100644 --- a/src/common/JSHandle.ts +++ b/src/common/JSHandle.ts @@ -15,7 +15,7 @@ */ import {Protocol} from 'devtools-protocol'; -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {CDPSession} from './Connection.js'; import type {ElementHandle} from './ElementHandle.js'; import {ExecutionContext} from './ExecutionContext.js'; diff --git a/src/common/LifecycleWatcher.ts b/src/common/LifecycleWatcher.ts index 55e4c8af..ea758544 100644 --- a/src/common/LifecycleWatcher.ts +++ b/src/common/LifecycleWatcher.ts @@ -14,14 +14,16 @@ * limitations under the License. */ -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import { addEventListener, PuppeteerEventListener, removeEventListeners, +} from './util.js'; +import { DeferredPromise, createDeferredPromise, -} from './util.js'; +} from '../util/DeferredPromise.js'; import {TimeoutError} from './Errors.js'; import { FrameManager, diff --git a/src/common/NetworkManager.ts b/src/common/NetworkManager.ts index 5e37c45d..43d43fa7 100644 --- a/src/common/NetworkManager.ts +++ b/src/common/NetworkManager.ts @@ -16,18 +16,17 @@ import {Protocol} from 'devtools-protocol'; import {ProtocolMapping} from 'devtools-protocol/types/protocol-mapping.js'; -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {EventEmitter} from './EventEmitter.js'; import {Frame} from './FrameManager.js'; import {HTTPRequest} from './HTTPRequest.js'; import {HTTPResponse} from './HTTPResponse.js'; import {FetchRequestId, NetworkEventManager} from './NetworkEventManager.js'; +import {debugError, isString} from './util.js'; import { - debugError, - isString, createDeferredPromiseWithTimer, DeferredPromise, -} from './util.js'; +} from '../util/DeferredPromise.js'; /** * @public diff --git a/src/common/Page.ts b/src/common/Page.ts index ffd65287..797ca52c 100644 --- a/src/common/Page.ts +++ b/src/common/Page.ts @@ -17,7 +17,7 @@ import {Protocol} from 'devtools-protocol'; import type {Readable} from 'stream'; import {Accessibility} from './Accessibility.js'; -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {Browser, BrowserContext} from './Browser.js'; import {CDPSession, CDPSessionEmittedEvents} from './Connection.js'; import {ConsoleMessage, ConsoleMessageType} from './ConsoleMessage.js'; @@ -59,7 +59,6 @@ import { importFS, getReadableAsBuffer, getReadableFromProtocolStream, - isErrorLike, isNumber, isString, pageBindingDeliverErrorString, @@ -70,9 +69,12 @@ import { valueFromRemoteObject, waitForEvent, waitWithTimeout, +} from './util.js'; +import {isErrorLike} from '../util/ErrorLike.js'; +import { createDeferredPromiseWithTimer, DeferredPromise, -} from './util.js'; +} from '../util/DeferredPromise.js'; import {WebWorker} from './WebWorker.js'; /** diff --git a/src/common/Tracing.ts b/src/common/Tracing.ts index c8f85d94..500e1726 100644 --- a/src/common/Tracing.ts +++ b/src/common/Tracing.ts @@ -13,12 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {assert} from './assert.js'; -import { - getReadableAsBuffer, - getReadableFromProtocolStream, - isErrorLike, -} from './util.js'; +import {assert} from '../util/assert.js'; +import {getReadableAsBuffer, getReadableFromProtocolStream} from './util.js'; +import {isErrorLike} from '../util/ErrorLike.js'; import {CDPSession} from './Connection.js'; /** diff --git a/src/common/util.ts b/src/common/util.ts index f69b1aa7..b242d2c3 100644 --- a/src/common/util.ts +++ b/src/common/util.ts @@ -17,10 +17,11 @@ import {Protocol} from 'devtools-protocol'; import type {Readable} from 'stream'; import {isNode} from '../environment.js'; -import {assert} from './assert.js'; +import {assert} from '../util/assert.js'; import {CDPSession} from './Connection.js'; import {debug} from './Debug.js'; import {ElementHandle} from './ElementHandle.js'; +import {isErrorLike} from '../util/ErrorLike.js'; import {TimeoutError} from './Errors.js'; import {CommonEventEmitter} from './EventEmitter.js'; import {ExecutionContext} from './ExecutionContext.js'; @@ -341,7 +342,7 @@ export function pageBindingDeliverErrorValueString( */ export function makePredicateString( predicate: Function, - predicateQueryHandler?: Function + predicateQueryHandler: Function ): string { function checkWaitForOptions( node: Node | null, @@ -371,12 +372,10 @@ export function makePredicateString( return !!(rect.top || rect.bottom || rect.width || rect.height); } } - const predicateQueryHandlerDef = predicateQueryHandler - ? `const predicateQueryHandler = ${predicateQueryHandler};` - : ''; + return ` (() => { - ${predicateQueryHandlerDef} + const predicateQueryHandler = ${predicateQueryHandler}; const checkWaitForOptions = ${checkWaitForOptions}; return (${predicate})(...args) })() `; @@ -496,104 +495,3 @@ export async function getReadableFromProtocolStream( }, }); } - -/** - * @internal - */ -export interface ErrorLike extends Error { - name: string; - message: string; -} - -/** - * @internal - */ -export function isErrorLike(obj: unknown): obj is ErrorLike { - return ( - typeof obj === 'object' && obj !== null && 'name' in obj && 'message' in obj - ); -} - -/** - * @internal - */ -export function isErrnoException(obj: unknown): obj is NodeJS.ErrnoException { - return ( - isErrorLike(obj) && - ('errno' in obj || 'code' in obj || 'path' in obj || 'syscall' in obj) - ); -} - -/** - * @internal - */ -export interface DeferredPromise extends Promise { - resolved: () => boolean; - resolve: (_: T) => void; - reject: (_: Error) => void; -} - -/** - * Creates an returns a promise along with the resolve/reject functions. - * - * If the promise has not been resolved/rejected withing the `timeout` period, - * the promise gets rejected with a timeout error. - * - * @internal - */ -export function createDeferredPromiseWithTimer( - timeoutMessage: string, - timeout = 5000 -): DeferredPromise { - let isResolved = false; - let resolver = (_: T): void => {}; - let rejector = (_: Error) => {}; - const taskPromise = new Promise((resolve, reject) => { - resolver = resolve; - rejector = reject; - }); - const timeoutId = setTimeout(() => { - rejector(new TimeoutError(timeoutMessage)); - }, timeout); - return Object.assign(taskPromise, { - resolved: () => { - return isResolved; - }, - resolve: (value: T) => { - clearTimeout(timeoutId); - isResolved = true; - resolver(value); - }, - reject: (err: Error) => { - clearTimeout(timeoutId); - rejector(err); - }, - }); -} - -/** - * Creates an returns a promise along with the resolve/reject functions. - * - * @internal - */ -export function createDeferredPromise(): DeferredPromise { - let isResolved = false; - let resolver = (_: T): void => {}; - let rejector = (_: Error) => {}; - const taskPromise = new Promise((resolve, reject) => { - resolver = resolve; - rejector = reject; - }); - return Object.assign(taskPromise, { - resolved: () => { - return isResolved; - }, - resolve: (value: T) => { - isResolved = true; - resolver(value); - }, - reject: (err: Error) => { - rejector(err); - }, - }); -} diff --git a/src/generated/README.md b/src/generated/README.md deleted file mode 100644 index 3e5c7eb0..00000000 --- a/src/generated/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Generated Artifacts - -**Do not edit manually edit any TypeScript files in this folder** All TS files are generated from their respectively named template file (ext. `tmpl`) in the `templates` directory. Edit them there is needed. diff --git a/src/generated/version.ts b/src/generated/version.ts deleted file mode 100644 index 93876969..00000000 --- a/src/generated/version.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * @internal - */ -export const packageVersion = '16.1.1'; diff --git a/src/injected/Poller.ts b/src/injected/Poller.ts new file mode 100644 index 00000000..c6748ebb --- /dev/null +++ b/src/injected/Poller.ts @@ -0,0 +1,156 @@ +import { + createDeferredPromise, + DeferredPromise, +} from '../util/DeferredPromise.js'; +import {assert} from '../util/assert.js'; + +interface Poller { + start(): Promise; + stop(): Promise; + result(): Promise; +} + +export class MutationPoller implements Poller { + #fn: () => Promise; + + #root: Node; + + #observer?: MutationObserver; + #promise?: DeferredPromise; + constructor(fn: () => Promise, root: Node) { + this.#fn = fn; + this.#root = root; + } + + async start(): Promise { + const promise = (this.#promise = createDeferredPromise()); + const result = await this.#fn(); + if (result) { + promise.resolve(result); + return result; + } + + this.#observer = new MutationObserver(async () => { + const result = await this.#fn(); + if (!result) { + return; + } + promise.resolve(result); + await this.stop(); + }); + this.#observer.observe(this.#root, { + childList: true, + subtree: true, + attributes: true, + }); + + return this.#promise; + } + + async stop(): Promise { + assert(this.#promise, 'Polling never started.'); + if (!this.#promise.finished()) { + this.#promise.reject(new Error('Polling stopped')); + } + if (this.#observer) { + this.#observer.disconnect(); + } + } + + result(): Promise { + assert(this.#promise, 'Polling never started.'); + return this.#promise; + } +} + +export class RAFPoller implements Poller { + #fn: () => Promise; + #promise?: DeferredPromise; + constructor(fn: () => Promise) { + this.#fn = fn; + } + + async start(): Promise { + const promise = (this.#promise = createDeferredPromise()); + const result = await this.#fn(); + if (result) { + promise.resolve(result); + return result; + } + + const poll = async () => { + if (promise.finished()) { + return; + } + const result = await this.#fn(); + if (!result) { + window.requestAnimationFrame(poll); + return; + } + promise.resolve(result); + await this.stop(); + }; + window.requestAnimationFrame(poll); + + return this.#promise; + } + + async stop(): Promise { + assert(this.#promise, 'Polling never started.'); + if (!this.#promise.finished()) { + this.#promise.reject(new Error('Polling stopped')); + } + } + + result(): Promise { + assert(this.#promise, 'Polling never started.'); + return this.#promise; + } +} + +export class IntervalPoller implements Poller { + #fn: () => Promise; + #ms: number; + + #interval?: NodeJS.Timer; + #promise?: DeferredPromise; + constructor(fn: () => Promise, ms: number) { + this.#fn = fn; + this.#ms = ms; + } + + async start(): Promise { + const promise = (this.#promise = createDeferredPromise()); + const result = await this.#fn(); + if (result) { + promise.resolve(result); + return result; + } + + this.#interval = setInterval(async () => { + const result = await this.#fn(); + if (!result) { + return; + } + promise.resolve(result); + await this.stop(); + }, this.#ms); + + return this.#promise; + } + + async stop(): Promise { + assert(this.#promise, 'Polling never started.'); + if (!this.#promise.finished()) { + this.#promise.reject(new Error('Polling stopped')); + } + if (this.#interval) { + clearInterval(this.#interval); + } + } + + result(): Promise { + assert(this.#promise, 'Polling never started.'); + return this.#promise; + } +} diff --git a/src/injected/README.md b/src/injected/README.md new file mode 100644 index 00000000..0a4af11c --- /dev/null +++ b/src/injected/README.md @@ -0,0 +1,5 @@ +# Injected + +This folder contains code that is injected into every Puppeteer execution context. Each file is transpiled using esbuild into a script in `src/generated` which is then imported into server code. + +See `utils/generate_injected.ts` for more information. diff --git a/src/injected/injected.ts b/src/injected/injected.ts new file mode 100644 index 00000000..ed9e2f6b --- /dev/null +++ b/src/injected/injected.ts @@ -0,0 +1 @@ +export * from './Poller.js'; diff --git a/src/node/BrowserFetcher.ts b/src/node/BrowserFetcher.ts index 3bbbf049..7c425c2d 100644 --- a/src/node/BrowserFetcher.ts +++ b/src/node/BrowserFetcher.ts @@ -33,7 +33,7 @@ import createHttpsProxyAgent, { HttpsProxyAgentOptions, } from 'https-proxy-agent'; import {getProxyForUrl} from 'proxy-from-env'; -import {assert} from '../common/assert.js'; +import {assert} from '../util/assert.js'; import tar from 'tar-fs'; import bzip from 'unbzip2-stream'; diff --git a/src/node/BrowserRunner.ts b/src/node/BrowserRunner.ts index bdcdda75..c18350a6 100644 --- a/src/node/BrowserRunner.ts +++ b/src/node/BrowserRunner.ts @@ -20,18 +20,17 @@ import * as path from 'path'; import * as readline from 'readline'; import removeFolder from 'rimraf'; import {promisify} from 'util'; -import {assert} from '../common/assert.js'; +import {assert} from '../util/assert.js'; import {Connection} from '../common/Connection.js'; import {debug} from '../common/Debug.js'; import {TimeoutError} from '../common/Errors.js'; import { debugError, addEventListener, - isErrnoException, - isErrorLike, PuppeteerEventListener, removeEventListeners, } from '../common/util.js'; +import {isErrnoException, isErrorLike} from '../util/ErrorLike.js'; import {Product} from '../common/Product.js'; import {NodeWebSocketTransport as WebSocketTransport} from '../node/NodeWebSocketTransport.js'; import {LaunchOptions} from './LaunchOptions.js'; diff --git a/src/node/ChromeLauncher.ts b/src/node/ChromeLauncher.ts index f09701f1..ab07b56f 100644 --- a/src/node/ChromeLauncher.ts +++ b/src/node/ChromeLauncher.ts @@ -1,6 +1,6 @@ import fs from 'fs'; import path from 'path'; -import {assert} from '../common/assert.js'; +import {assert} from '../util/assert.js'; import {Browser} from '../common/Browser.js'; import {Product} from '../common/Product.js'; import {BrowserRunner} from './BrowserRunner.js'; diff --git a/src/node/FirefoxLauncher.ts b/src/node/FirefoxLauncher.ts index 2e40894e..c27f1b8d 100644 --- a/src/node/FirefoxLauncher.ts +++ b/src/node/FirefoxLauncher.ts @@ -1,7 +1,7 @@ import fs from 'fs'; import os from 'os'; import path from 'path'; -import {assert} from '../common/assert.js'; +import {assert} from '../util/assert.js'; import {Browser} from '../common/Browser.js'; import {Product} from '../common/Product.js'; import {BrowserFetcher} from './BrowserFetcher.js'; diff --git a/src/node/PipeTransport.ts b/src/node/PipeTransport.ts index a622a9bb..3b7b042b 100644 --- a/src/node/PipeTransport.ts +++ b/src/node/PipeTransport.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {assert} from '../common/assert.js'; +import {assert} from '../util/assert.js'; import {ConnectionTransport} from '../common/ConnectionTransport.js'; import { addEventListener, diff --git a/src/templates/README.md b/src/templates/README.md new file mode 100644 index 00000000..548987ea --- /dev/null +++ b/src/templates/README.md @@ -0,0 +1,3 @@ +# Templated Artifacts + +These files are generated as TypeScript files in the `src/generated` folder. diff --git a/src/types.ts b/src/types.ts index 33c405d6..53187a3a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -52,7 +52,6 @@ export * from './common/TimeoutSettings.js'; export * from './common/Tracing.js'; export * from './common/USKeyboardLayout.js'; export * from './common/WebWorker.js'; -export * from './common/assert.js'; export * from './common/fetch.js'; export * from './common/types.js'; export * from './common/util.js'; @@ -71,4 +70,5 @@ export * from './node/install.js'; export * from './node/util.js'; // Exports from `generated` +export * from './generated/injected.js'; export * from './generated/version.js'; diff --git a/src/util/DeferredPromise.ts b/src/util/DeferredPromise.ts new file mode 100644 index 00000000..cc8d7f15 --- /dev/null +++ b/src/util/DeferredPromise.ts @@ -0,0 +1,88 @@ +import {TimeoutError} from '../common/Errors.js'; + +/** + * @internal + */ + +export interface DeferredPromise extends Promise { + finished: () => boolean; + resolved: () => boolean; + resolve: (_: T) => void; + reject: (_: Error) => void; +} +/** + * Creates an returns a promise along with the resolve/reject functions. + * + * If the promise has not been resolved/rejected withing the `timeout` period, + * the promise gets rejected with a timeout error. + * + * @internal + */ + +export function createDeferredPromiseWithTimer( + timeoutMessage: string, + timeout = 5000 +): DeferredPromise { + let isResolved = false; + let isRejected = false; + let resolver = (_: T): void => {}; + let rejector = (_: Error) => {}; + const taskPromise = new Promise((resolve, reject) => { + resolver = resolve; + rejector = reject; + }); + const timeoutId = setTimeout(() => { + isRejected = true; + rejector(new TimeoutError(timeoutMessage)); + }, timeout); + return Object.assign(taskPromise, { + resolved: () => { + return isResolved; + }, + finished: () => { + return isResolved || isRejected; + }, + resolve: (value: T) => { + clearTimeout(timeoutId); + isResolved = true; + resolver(value); + }, + reject: (err: Error) => { + clearTimeout(timeoutId); + isRejected = true; + rejector(err); + }, + }); +} +/** + * Creates an returns a promise along with the resolve/reject functions. + * + * @internal + */ + +export function createDeferredPromise(): DeferredPromise { + let isResolved = false; + let isRejected = false; + let resolver = (_: T): void => {}; + let rejector = (_: Error) => {}; + const taskPromise = new Promise((resolve, reject) => { + resolver = resolve; + rejector = reject; + }); + return Object.assign(taskPromise, { + resolved: () => { + return isResolved; + }, + finished: () => { + return isResolved || isRejected; + }, + resolve: (value: T) => { + isResolved = true; + resolver(value); + }, + reject: (err: Error) => { + isRejected = true; + rejector(err); + }, + }); +} diff --git a/src/util/ErrorLike.ts b/src/util/ErrorLike.ts new file mode 100644 index 00000000..e5659ce3 --- /dev/null +++ b/src/util/ErrorLike.ts @@ -0,0 +1,27 @@ +/** + * @internal + */ + +export interface ErrorLike extends Error { + name: string; + message: string; +} +/** + * @internal + */ + +export function isErrorLike(obj: unknown): obj is ErrorLike { + return ( + typeof obj === 'object' && obj !== null && 'name' in obj && 'message' in obj + ); +} +/** + * @internal + */ + +export function isErrnoException(obj: unknown): obj is NodeJS.ErrnoException { + return ( + isErrorLike(obj) && + ('errno' in obj || 'code' in obj || 'path' in obj || 'syscall' in obj) + ); +} diff --git a/src/common/assert.ts b/src/util/assert.ts similarity index 100% rename from src/common/assert.ts rename to src/util/assert.ts diff --git a/test/src/CDPSession.spec.ts b/test/src/CDPSession.spec.ts index e5f29b2a..920c3105 100644 --- a/test/src/CDPSession.spec.ts +++ b/test/src/CDPSession.spec.ts @@ -22,7 +22,7 @@ import { setupTestPageAndContextHooks, describeChromeOnly, } from './mocha-utils.js'; -import {isErrorLike} from '../../lib/cjs/puppeteer/common/util.js'; +import {isErrorLike} from '../../lib/cjs/puppeteer/util/ErrorLike.js'; describeChromeOnly('Target.createCDPSession', function () { setupTestBrowserHooks(); diff --git a/test/src/mocha-utils.ts b/test/src/mocha-utils.ts index b60428fe..709a6715 100644 --- a/test/src/mocha-utils.ts +++ b/test/src/mocha-utils.ts @@ -26,7 +26,7 @@ import { BrowserContext, } from '../../lib/cjs/puppeteer/common/Browser.js'; import {Page} from '../../lib/cjs/puppeteer/common/Page.js'; -import {isErrorLike} from '../../lib/cjs/puppeteer/common/util.js'; +import {isErrorLike} from '../../lib/cjs/puppeteer/util/ErrorLike.js'; import { PuppeteerLaunchOptions, PuppeteerNode, diff --git a/test/src/waittask.spec.ts b/test/src/waittask.spec.ts index 6eccf9ca..d28afb5a 100644 --- a/test/src/waittask.spec.ts +++ b/test/src/waittask.spec.ts @@ -15,7 +15,7 @@ */ import expect from 'expect'; -import {isErrorLike} from '../../lib/cjs/puppeteer/common/util.js'; +import {isErrorLike} from '../../lib/cjs/puppeteer/util/ErrorLike.js'; import { getTestState, itFailsFirefox, diff --git a/typescript-if-required.js b/typescript-if-required.js index 9b997c15..e1a1e8bb 100644 --- a/typescript-if-required.js +++ b/typescript-if-required.js @@ -45,7 +45,7 @@ const fileExists = async filePath => { * place. */ async function compileTypeScript() { - return exec('npm run build:tsc').catch(error => { + return exec('npm run build').catch(error => { console.error('Error running TypeScript', error); process.exit(1); }); diff --git a/utils/.eslintrc.js b/utils/.eslintrc.js new file mode 100644 index 00000000..b4780f0a --- /dev/null +++ b/utils/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + extends: ['../.eslintrc.js'], + rules: { + 'import/extensions': 0, + }, +}; diff --git a/utils/generate_docs.ts b/utils/generate_docs.ts index 31ae71b3..e932a413 100644 --- a/utils/generate_docs.ts +++ b/utils/generate_docs.ts @@ -20,8 +20,6 @@ import {chdir} from 'process'; import semver from 'semver'; import {versionsPerRelease} from '../versions.js'; import versionsArchived from '../website/versionsArchived.json'; - -// eslint-disable-next-line import/extensions import {generateDocs} from './internal/custom_markdown_action'; function getOffsetAndLimit( diff --git a/utils/generate_sources.ts b/utils/generate_sources.ts new file mode 100644 index 00000000..89d0f2c7 --- /dev/null +++ b/utils/generate_sources.ts @@ -0,0 +1,69 @@ +#!/usr/bin/env node +import esbuild from 'esbuild'; +import {mkdir, mkdtemp, readFile, writeFile} from 'fs/promises'; +import path from 'path'; +import rimraf from 'rimraf'; +import {job} from './internal/job'; + +(async () => { + await job('', async ({outputs}) => { + await Promise.all( + outputs.map(outputs => { + return mkdir(outputs, {recursive: true}); + }) + ); + }) + .outputs(['src/generated']) + .build(); + + await job('', async ({name, inputs, outputs}) => { + const tmp = await mkdtemp(name); + await esbuild.build({ + entryPoints: [inputs[0]!], + bundle: true, + outdir: tmp, + format: 'cjs', + platform: 'browser', + target: 'ES2019', + }); + const baseName = path.basename(inputs[0]!); + const content = await readFile( + path.join(tmp, baseName.replace('.ts', '.js')), + 'utf-8' + ); + const scriptContent = `/** @internal */ +export const source = ${JSON.stringify(content)}; +`; + await writeFile(outputs[0]!, scriptContent); + await rimraf.sync(tmp); + }) + .inputs(['src/injected/**.ts']) + .outputs(['src/generated/injected.ts']) + .build(); + + job('', async ({inputs, outputs}) => { + const version = JSON.parse(await readFile(inputs[0]!, 'utf8')).version; + await writeFile( + outputs[0]!, + ( + await readFile(outputs[0]!, { + encoding: 'utf-8', + }) + ).replace("'NEXT'", `v${version}`) + ); + }) + .inputs(['package.json']) + .outputs(['versions.js']) + .build(); + + job('', async ({inputs, outputs}) => { + const version = JSON.parse(await readFile(inputs[0]!, 'utf8')).version; + await writeFile( + outputs[0]!, + (await readFile(inputs[1]!, 'utf8')).replace('PACKAGE_VERSION', version) + ); + }) + .inputs(['package.json', 'src/templates/version.ts.tmpl']) + .outputs(['src/generated/version.ts']) + .build(); +})(); diff --git a/utils/generate_version_file.js b/utils/generate_version_file.js deleted file mode 100644 index a77dfe8a..00000000 --- a/utils/generate_version_file.js +++ /dev/null @@ -1,18 +0,0 @@ -const {writeFileSync, readFileSync} = require('fs'); -const {join} = require('path'); - -const version = require('../package.json').version; - -writeFileSync( - join(__dirname, '../src/generated/version.ts'), - readFileSync(join(__dirname, '../src/templates/version.ts.tmpl'), { - encoding: 'utf-8', - }).replace('PACKAGE_VERSION', version) -); - -writeFileSync( - join(__dirname, '../versions.js'), - readFileSync(join(__dirname, '../versions.js'), { - encoding: 'utf-8', - }).replace('NEXT', `v${version}`) -); diff --git a/utils/internal/job.ts b/utils/internal/job.ts new file mode 100644 index 00000000..5ccd2105 --- /dev/null +++ b/utils/internal/job.ts @@ -0,0 +1,96 @@ +import {Stats} from 'fs'; +import {stat} from 'fs/promises'; +import {glob} from 'glob'; +import path from 'path'; + +interface JobContext { + name: string; + inputs: string[]; + outputs: string[]; +} + +class JobBuilder { + #inputs: string[] = []; + #outputs: string[] = []; + #callback: (ctx: JobContext) => Promise; + #name: string; + + constructor(name: string, callback: (ctx: JobContext) => Promise) { + this.#name = name; + this.#callback = callback; + } + + inputs(inputs: string[]): JobBuilder { + this.#inputs = inputs.flatMap(value => { + value = path.resolve(__dirname, '..', '..', value); + const paths = glob.sync(value); + return paths.length ? paths : [value]; + }); + return this; + } + + outputs(outputs: string[]): JobBuilder { + if (!this.#name) { + this.#name = outputs[0]!; + } + + this.#outputs = outputs.map(value => { + return path.resolve(__dirname, '..', '..', value); + }); + return this; + } + + async build(): Promise { + console.log(`Running job ${this.#name}...`); + + let shouldRun = true; + + const inputStats = await Promise.all( + this.#inputs.map(input => { + return stat(input); + }) + ); + let outputStats: Stats[]; + try { + outputStats = await Promise.all( + this.#outputs.map(output => { + return stat(output); + }) + ); + + if ( + outputStats.reduce(reduceMaxTime, 0) >= + inputStats.reduce(reduceMinTime, Infinity) + ) { + shouldRun = false; + } + } catch {} + + if (shouldRun) { + this.#run(); + } + } + + #run(): Promise { + return this.#callback({ + name: this.#name, + inputs: this.#inputs, + outputs: this.#outputs, + }); + } +} + +export const job = ( + name: string, + callback: (ctx: JobContext) => Promise +): JobBuilder => { + return new JobBuilder(name, callback); +}; + +const reduceMaxTime = (time: number, stat: Stats) => { + return time < stat.mtimeMs ? stat.mtimeMs : time; +}; + +const reduceMinTime = (time: number, stat: Stats) => { + return time > stat.mtimeMs ? stat.mtimeMs : time; +}; diff --git a/utils/tsconfig.json b/utils/tsconfig.json new file mode 100644 index 00000000..2552d660 --- /dev/null +++ b/utils/tsconfig.json @@ -0,0 +1,12 @@ +/** + * This configuration only exists for the API Extractor tool and for VSCode to use. It is NOT the tsconfig used for compilation. + * For CJS builds, `tsconfig.cjs.json` is used, and for ESM, it's `tsconfig.esm.json`. + * See the details in CONTRIBUTING.md that describes our TypeScript setup. + */ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "noEmit": true, + "module": "CommonJS" + } +} diff --git a/versions.js b/versions.js index 7a07926b..5b04bdba 100644 --- a/versions.js +++ b/versions.js @@ -16,7 +16,7 @@ const versionsPerRelease = new Map([ // This is a mapping from Chromium version => Puppeteer version. - // In Chromium roll patches, use 'v16.1.1' for the Puppeteer version. + // In Chromium roll patches, use `NEXT` for the Puppeteer version. ['105.0.5173.0', 'v15.5.0'], ['104.0.5109.0', 'v15.1.0'], ['103.0.5059.0', 'v14.2.0'],