From f5a8baa2ef2ca6dad6f369101a773398984d154c Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Sun, 21 Mar 2021 10:52:26 +0100 Subject: [PATCH] WIP --- package-lock.json | 76 ++++++++++++++++++------------------ package.json | 7 ++-- src/index.js | 6 ++- tests/selftest_ts_esbuild.js | 24 ------------ tsconfig.json | 1 + 5 files changed, 46 insertions(+), 68 deletions(-) delete mode 100644 tests/selftest_ts_esbuild.js diff --git a/package-lock.json b/package-lock.json index 261aad16..756422c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "dependencies": { "@sentry/node": "^5.15.5", "@types/glob": "^7.1.1", - "@types/puppeteer": "^5.4.0", "argparse": "^1.0.10", "axe-core": "^4.1.1", "chokidar": "^3.4.2", @@ -18,7 +17,7 @@ "emailjs-imap-client": "^3.0.7", "emailjs-mime-parser": "^2.0.5", "errorstacks": "^1.1.5", - "esbuild": "^0.9.3", + "esbuild": "^0.9.6", "esbuild-register": "^2.3.0", "form-data": "^2.3.3", "glob": "^7.1.6", @@ -52,9 +51,9 @@ "prettier": "^2.0.5", "puppeteer": "^8.0.0", "rimraf": "^3.0.2", - "ts-node": "^9.0.0", + "ts-node": "^9.1.1", "typedoc": "^0.17.4", - "typescript": "^3.8.3" + "typescript": "^4.2.3" }, "engines": { "node": ">=12.0.0" @@ -830,14 +829,6 @@ "@types/node": "*" } }, - "node_modules/@types/puppeteer": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@types/puppeteer/-/puppeteer-5.4.0.tgz", - "integrity": "sha512-zTYDLjnHjgzokrwKt7N0rgn7oZPYo1J0m8Ghu+gXqzLCEn8RWbELa2uprE2UFJ0jU/Sk0x9jXXdOH/5QQLFHhQ==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/sharp": { "version": "0.27.1", "resolved": "https://registry.npmjs.org/@types/sharp/-/sharp-0.27.1.tgz", @@ -1703,6 +1694,12 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "node_modules/cross-spawn": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", @@ -2045,9 +2042,9 @@ "integrity": "sha512-ANB+6I4d0oULE2lEEXOJNvH0mpZ5YhFUhzEhJRB2v+FJzmJYRFei2fHS755gsJ+F20exLVNS2ND9xvZ2oYGhvQ==" }, "node_modules/esbuild": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.9.3.tgz", - "integrity": "sha512-G8k0olucZp3LJ7I/p8y388t+IEyb2Y78nHrLeIxuqZqh6TYqDYP/B/7drAvYKfh83CGwKal9txVP+FTypsPJug==", + "version": "0.9.6", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.9.6.tgz", + "integrity": "sha512-F6vASxU0wT/Davt9aj2qtDwDNSkQxh9VbyO56M7PDWD+D/Vgq/rmUDGDQo7te76W5auauVojjnQr/wTu3vpaUA==", "hasInstallScript": true, "bin": { "esbuild": "bin/esbuild" @@ -5792,12 +5789,13 @@ } }, "node_modules/ts-node": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.0.0.tgz", - "integrity": "sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz", + "integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==", "dev": true, "dependencies": { "arg": "^4.1.0", + "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", "source-map-support": "^0.5.17", @@ -5811,6 +5809,9 @@ }, "engines": { "node": ">=10.0.0" + }, + "peerDependencies": { + "typescript": ">=2.7" } }, "node_modules/tslib": { @@ -5896,9 +5897,9 @@ } }, "node_modules/typescript": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", - "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz", + "integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -7024,14 +7025,6 @@ "@types/node": "*" } }, - "@types/puppeteer": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@types/puppeteer/-/puppeteer-5.4.0.tgz", - "integrity": "sha512-zTYDLjnHjgzokrwKt7N0rgn7oZPYo1J0m8Ghu+gXqzLCEn8RWbELa2uprE2UFJ0jU/Sk0x9jXXdOH/5QQLFHhQ==", - "requires": { - "@types/node": "*" - } - }, "@types/sharp": { "version": "0.27.1", "resolved": "https://registry.npmjs.org/@types/sharp/-/sharp-0.27.1.tgz", @@ -7756,6 +7749,12 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "cross-spawn": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", @@ -8044,9 +8043,9 @@ "integrity": "sha512-ANB+6I4d0oULE2lEEXOJNvH0mpZ5YhFUhzEhJRB2v+FJzmJYRFei2fHS755gsJ+F20exLVNS2ND9xvZ2oYGhvQ==" }, "esbuild": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.9.3.tgz", - "integrity": "sha512-G8k0olucZp3LJ7I/p8y388t+IEyb2Y78nHrLeIxuqZqh6TYqDYP/B/7drAvYKfh83CGwKal9txVP+FTypsPJug==" + "version": "0.9.6", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.9.6.tgz", + "integrity": "sha512-F6vASxU0wT/Davt9aj2qtDwDNSkQxh9VbyO56M7PDWD+D/Vgq/rmUDGDQo7te76W5auauVojjnQr/wTu3vpaUA==" }, "esbuild-register": { "version": "2.3.0", @@ -11070,12 +11069,13 @@ } }, "ts-node": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.0.0.tgz", - "integrity": "sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz", + "integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==", "dev": true, "requires": { "arg": "^4.1.0", + "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", "source-map-support": "^0.5.17", @@ -11147,9 +11147,9 @@ } }, "typescript": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", - "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz", + "integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==", "dev": true }, "uglify-js": { diff --git a/package.json b/package.json index b8998877..52190db4 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,6 @@ "dependencies": { "@sentry/node": "^5.15.5", "@types/glob": "^7.1.1", - "@types/puppeteer": "^5.4.0", "argparse": "^1.0.10", "axe-core": "^4.1.1", "chokidar": "^3.4.2", @@ -104,7 +103,7 @@ "emailjs-imap-client": "^3.0.7", "emailjs-mime-parser": "^2.0.5", "errorstacks": "^1.1.5", - "esbuild": "^0.9.3", + "esbuild": "^0.9.6", "esbuild-register": "^2.3.0", "form-data": "^2.3.3", "glob": "^7.1.6", @@ -135,9 +134,9 @@ "prettier": "^2.0.5", "puppeteer": "^8.0.0", "rimraf": "^3.0.2", - "ts-node": "^9.0.0", + "ts-node": "^9.1.1", "typedoc": "^0.17.4", - "typescript": "^3.8.3" + "typescript": "^4.2.3" }, "peerDependencies": { "puppeteer": "*" diff --git a/src/index.js b/src/index.js index d77d728d..e3cea4bd 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,8 @@ -const { register } = require('esbuild-register/dist/node'); +const {register} = require('esbuild-register/dist/node'); register({ - sourcemap:true + sourcemap: true, + minify: false, + keepNames: false, }); const {main} = require('./main'); diff --git a/tests/selftest_ts_esbuild.js b/tests/selftest_ts_esbuild.js deleted file mode 100644 index d65e4dd9..00000000 --- a/tests/selftest_ts_esbuild.js +++ /dev/null @@ -1,24 +0,0 @@ -const assert = require('assert').strict; -const path = require('path'); -const child_process = require('child_process'); - -async function run() { - const script = path.join(__dirname, '..', 'bin', 'cli.js'); - const {stderr} = await new Promise((resolve, reject) => { - child_process.execFile( - process.execPath, - [script, '--exit-zero', '--no-screenshots', '--no-pdf'], - (err, stdout, stderr) => { - if (err) reject(err); - else resolve({stdout, stderr}); - } - ); - }); - - assert(/1 tests passed/.test(stderr), 'Did run any tests'); -} - -module.exports = { - description: 'Support node require hooks', - run, -}; diff --git a/tsconfig.json b/tsconfig.json index 7122f428..5b48b2a9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "module": "CommonJS", + "moduleResolution": "Node", "allowJs": true, "alwaysStrict": true, "strict": true,