From 38636cb6a53bd89665db339925d2dbdfe5d4b524 Mon Sep 17 00:00:00 2001 From: Zack921 <407473490@qq.com> Date: Mon, 21 Jun 2021 17:38:03 +0800 Subject: [PATCH] feat: hack https.createServer --- .gitignore | 3 +- examples/https/README.md | 12 + examples/https/index.js | 18 + examples/https/package.json | 16 + examples/https/tswconfig.js | 30 + examples/https/yarn.lock | 837 +++++++++++++++++++++++++ lib/core/runtime/create-server.hack.ts | 393 ++++++------ lib/index.ts | 6 +- 8 files changed, 1133 insertions(+), 182 deletions(-) create mode 100644 examples/https/README.md create mode 100644 examples/https/index.js create mode 100644 examples/https/package.json create mode 100644 examples/https/tswconfig.js create mode 100644 examples/https/yarn.lock diff --git a/.gitignore b/.gitignore index cfe87238..79ea889f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ dist .nyc_output coverage *.log -benchmark/metricsResult \ No newline at end of file +benchmark/metricsResult +*.pem \ No newline at end of file diff --git a/examples/https/README.md b/examples/https/README.md new file mode 100644 index 00000000..6840bde9 --- /dev/null +++ b/examples/https/README.md @@ -0,0 +1,12 @@ +## How to run demo + +### 1. Install Npm +```bash +yarn +// npm i +``` + +### 2. Start the server +``` +npm run serve +``` \ No newline at end of file diff --git a/examples/https/index.js b/examples/https/index.js new file mode 100644 index 00000000..1342d607 --- /dev/null +++ b/examples/https/index.js @@ -0,0 +1,18 @@ +const https = require('https'); +const fs = require('fs'); +const path = require('path'); + +const options = { + key: fs.readFileSync(path.resolve(__dirname, 'key.pem')), + cert: fs.readFileSync(path.resolve(__dirname, 'cert.pem')) +}; + +https.createServer(options, function (req, res) { + console.log("hello world"); + + res.writeHead(200); + res.end("hello world\n"); +}).listen(8000); + +console.log("origin node server is listening on 8000"); + diff --git a/examples/https/package.json b/examples/https/package.json new file mode 100644 index 00000000..71bc29dd --- /dev/null +++ b/examples/https/package.json @@ -0,0 +1,16 @@ +{ + "name": "koa-example", + "scripts": { + "serve": "tsw ./index.js", + "serve:inspect": "NODE_OPTIONS='--inspect=localhost:4442' tsw ./index.js" + }, + "version": "1.0.0", + "main": "index.js", + "license": "MIT", + "dependencies": { + "@tswjs/open-platform-plugin": "^1.3.1", + "@tswjs/tsw": "^2.5.3", + "winston": "^3.2.1", + "winston-transport": "^4.3.0" + } +} diff --git a/examples/https/tswconfig.js b/examples/https/tswconfig.js new file mode 100644 index 00000000..89326f8b --- /dev/null +++ b/examples/https/tswconfig.js @@ -0,0 +1,30 @@ +const winston = require("winston"); +const OpenPlatformPlugin = require("@tswjs/open-platform-plugin"); + +module.exports = { + plugins: [ + new OpenPlatformPlugin({ + appid: "tsw1844", + appkey: "fTctzeCnBHKJZyBYmBAB3H5R", + reportStrategy: "proxied", + // 只支持同步写法 + getUid: (request) => "xxx", + getProxyInfo: () => { + return { + "port": 80, + "name": "2.0demo", + "group": "TSW", + "groupName": "TSW团队", + "desc": "2.0demo测试环境", + "order": 30, + "owner": "demoUser", + "alphaList": ["xxx"] + }; + } + }) + ], + winstonTransports: [ + new winston.transports.File({ filename: 'error.log', level: 'error'}), + new winston.transports.File({ filename: 'debug.log', level: 'debug'}) + ] +}; diff --git a/examples/https/yarn.lock b/examples/https/yarn.lock new file mode 100644 index 00000000..19ed5832 --- /dev/null +++ b/examples/https/yarn.lock @@ -0,0 +1,837 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@dabh/diagnostics@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@dabh/diagnostics/-/diagnostics-2.0.2.tgz#290d08f7b381b8f94607dc8f471a12c675f9db31" + integrity sha512-+A1YivoVDNNVCdfozHSR8v/jyuuLTMXwjWuxPFlFlUapXoGc+Gj9mDlTDDfrwl7rXCl2tNZ0kE8sIBO6YOn96Q== + dependencies: + colorspace "1.1.x" + enabled "2.0.x" + kuler "^2.0.0" + +"@tootallnate/once@1": + version "1.1.2" + resolved "http://mirrors.tencent.com/npm/@tootallnate%2fonce/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" + integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== + +"@tswjs/open-platform-api@^1.2.2": + version "1.2.2" + resolved "https://mirrors.tencent.com/npm/@tswjs%2fopen-platform-api/-/open-platform-api-1.2.2.tgz#8b0a874e2b448ca9a517cfc22916ca693eb535d1" + integrity sha512-PkicdbN0PRRIX5VmsARk3PQp51+00M7U9X3XkupwwKbuxckxZKYTmwFxTs7Wl1NkS8q5HLSqB7OyLr8mZ8YySw== + dependencies: + http-proxy-agent "^4.0.1" + https-proxy-agent "^5.0.0" + node-fetch "^2.6.0" + proxy-from-env "^1.1.0" + +"@tswjs/open-platform-plugin@^1.3.1": + version "1.3.1" + resolved "https://mirrors.tencent.com/npm/@tswjs%2fopen-platform-plugin/-/open-platform-plugin-1.3.1.tgz#e620e0f5bd4b3cb93bdea52e0893222fd5346bc9" + integrity sha512-w0CW2tjcSL8b+FGn4v/Dan2jSOo0pM4O+4UJsU16F/MajVeL3jjbxlyCko25b8ZMFAZRaAYSFoiKpMFnSJd0JA== + dependencies: + "@tswjs/open-platform-api" "^1.2.2" + ip "^1.1.5" + +"@tswjs/tsw@^2.5.3": + version "2.5.3" + resolved "https://mirrors.tencent.com/npm/@tswjs%2ftsw/-/tsw-2.5.3.tgz#4e1451f8ad56e4418166c01ff0720a33700f79c7" + integrity sha512-gwpkFUiQtioo3MvAnLMNPgTUAEbuXJnfH3q03PS6Fc1JIOK8Jl2VW1Pv+vI2FV+68ya9QILQIintwD2w+DVCFQ== + dependencies: + chalk "^3.0.0" + ip "^1.1.5" + lodash "^4.17.15" + moment "^2.24.0" + patch-package "^6.2.2" + postinstall-postinstall "^2.1.0" + winston "^3.2.1" + winston-transport "^4.3.0" + yargs "^15.3.1" + +"@yarnpkg/lockfile@^1.1.0": + version "1.1.0" + resolved "https://mirrors.tencent.com/npm/@yarnpkg%2flockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" + integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== + +agent-base@6: + version "6.0.2" + resolved "http://mirrors.tencent.com/npm/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + dependencies: + debug "4" + +ansi-regex@^5.0.0: + version "5.0.0" + resolved "http://mirrors.tencent.com/npm/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" + integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== + +ansi-styles@^3.2.1: + version "3.2.1" + resolved "http://mirrors.tencent.com/npm/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "http://mirrors.tencent.com/npm/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +async@^3.1.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/async/-/async-3.2.0.tgz#b3a2685c5ebb641d3de02d161002c60fc9f85720" + integrity sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw== + +balanced-match@^1.0.0: + version "1.0.2" + resolved "http://mirrors.tencent.com/npm/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://mirrors.tencent.com/npm/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^3.0.1: + version "3.0.2" + resolved "http://mirrors.tencent.com/npm/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +camelcase@^5.0.0: + version "5.3.1" + resolved "http://mirrors.tencent.com/npm/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +chalk@^2.4.2: + version "2.4.2" + resolved "http://mirrors.tencent.com/npm/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^3.0.0: + version "3.0.0" + resolved "http://mirrors.tencent.com/npm/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" + integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +ci-info@^2.0.0: + version "2.0.0" + resolved "https://mirrors.tencent.com/npm/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== + +cliui@^6.0.0: + version "6.0.0" + resolved "http://mirrors.tencent.com/npm/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" + integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^6.2.0" + +color-convert@^1.9.0, color-convert@^1.9.1: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "http://mirrors.tencent.com/npm/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +color-name@^1.0.0, color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +color-string@^1.5.2: + version "1.5.4" + resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.5.4.tgz#dd51cd25cfee953d138fe4002372cc3d0e504cb6" + integrity sha512-57yF5yt8Xa3czSEW1jfQDE79Idk0+AkN/4KWad6tbdxUmAs3MvjxlWSWD4deYytcRfoZ9nhKyFl1kj5tBvidbw== + dependencies: + color-name "^1.0.0" + simple-swizzle "^0.2.2" + +color@3.0.x: + version "3.0.0" + resolved "https://registry.yarnpkg.com/color/-/color-3.0.0.tgz#d920b4328d534a3ac8295d68f7bd4ba6c427be9a" + integrity sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w== + dependencies: + color-convert "^1.9.1" + color-string "^1.5.2" + +colors@^1.2.1: + version "1.4.0" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" + integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== + +colorspace@1.1.x: + version "1.1.2" + resolved "https://registry.yarnpkg.com/colorspace/-/colorspace-1.1.2.tgz#e0128950d082b86a2168580796a0aa5d6c68d8c5" + integrity sha512-vt+OoIP2d76xLhjwbBaucYlNSpPsrJWPlBTtwCpQKIu6/CSMutyzX93O/Do0qzpH3YoHEes8YEFXyZ797rEhzQ== + dependencies: + color "3.0.x" + text-hex "1.0.x" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://mirrors.tencent.com/npm/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +cross-spawn@^6.0.5: + version "6.0.5" + resolved "http://mirrors.tencent.com/npm/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + +debug@4: + version "4.3.1" + resolved "https://mirrors.tencent.com/npm/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" + integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== + dependencies: + ms "2.1.2" + +decamelize@^1.2.0: + version "1.2.0" + resolved "http://mirrors.tencent.com/npm/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "http://mirrors.tencent.com/npm/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +enabled@2.0.x: + version "2.0.0" + resolved "https://registry.yarnpkg.com/enabled/-/enabled-2.0.0.tgz#f9dd92ec2d6f4bbc0d5d1e64e21d61cd4665e7c2" + integrity sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ== + +escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "http://mirrors.tencent.com/npm/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +fast-safe-stringify@^2.0.4: + version "2.0.7" + resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz#124aa885899261f68aedb42a7c080de9da608743" + integrity sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA== + +fecha@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/fecha/-/fecha-4.2.0.tgz#3ffb6395453e3f3efff850404f0a59b6747f5f41" + integrity sha512-aN3pcx/DSmtyoovUudctc8+6Hl4T+hI9GBBHLjA76jdZl7+b1sgh5g4k+u/GL3dTy1/pnYzKp69FpJ0OicE3Wg== + +fill-range@^7.0.1: + version "7.0.1" + resolved "http://mirrors.tencent.com/npm/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +find-up@^4.1.0: + version "4.1.0" + resolved "http://mirrors.tencent.com/npm/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + +find-yarn-workspace-root@^2.0.0: + version "2.0.0" + resolved "https://mirrors.tencent.com/npm/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz#f47fb8d239c900eb78179aa81b66673eac88f7bd" + integrity sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ== + dependencies: + micromatch "^4.0.2" + +fn.name@1.x.x: + version "1.1.0" + resolved "https://registry.yarnpkg.com/fn.name/-/fn.name-1.1.0.tgz#26cad8017967aea8731bc42961d04a3d5988accc" + integrity sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw== + +fs-extra@^7.0.1: + version "7.0.1" + resolved "http://mirrors.tencent.com/npm/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" + integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "http://mirrors.tencent.com/npm/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +get-caller-file@^2.0.1: + version "2.0.5" + resolved "https://mirrors.tencent.com/npm/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +glob@^7.1.3: + version "7.1.7" + resolved "http://mirrors.tencent.com/npm/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" + integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6: + version "4.2.6" + resolved "http://mirrors.tencent.com/npm/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee" + integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ== + +has-flag@^3.0.0: + version "3.0.0" + resolved "http://mirrors.tencent.com/npm/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +has-flag@^4.0.0: + version "4.0.0" + resolved "http://mirrors.tencent.com/npm/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +http-proxy-agent@^4.0.1: + version "4.0.1" + resolved "http://mirrors.tencent.com/npm/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz#8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a" + integrity sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg== + dependencies: + "@tootallnate/once" "1" + agent-base "6" + debug "4" + +https-proxy-agent@^5.0.0: + version "5.0.0" + resolved "http://mirrors.tencent.com/npm/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2" + integrity sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA== + dependencies: + agent-base "6" + debug "4" + +inflight@^1.0.4: + version "1.0.6" + resolved "http://mirrors.tencent.com/npm/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.3, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +ip@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" + integrity sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo= + +is-arrayish@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03" + integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ== + +is-ci@^2.0.0: + version "2.0.0" + resolved "https://mirrors.tencent.com/npm/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" + integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== + dependencies: + ci-info "^2.0.0" + +is-docker@^2.0.0: + version "2.2.1" + resolved "http://mirrors.tencent.com/npm/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" + integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "http://mirrors.tencent.com/npm/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-number@^7.0.0: + version "7.0.0" + resolved "https://mirrors.tencent.com/npm/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" + integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== + +is-wsl@^2.1.1: + version "2.2.0" + resolved "http://mirrors.tencent.com/npm/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" + integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== + dependencies: + is-docker "^2.0.0" + +isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +isexe@^2.0.0: + version "2.0.0" + resolved "http://mirrors.tencent.com/npm/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +jsonfile@^4.0.0: + version "4.0.0" + resolved "http://mirrors.tencent.com/npm/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= + optionalDependencies: + graceful-fs "^4.1.6" + +klaw-sync@^6.0.0: + version "6.0.0" + resolved "https://mirrors.tencent.com/npm/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c" + integrity sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ== + dependencies: + graceful-fs "^4.1.11" + +kuler@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/kuler/-/kuler-2.0.0.tgz#e2c570a3800388fb44407e851531c1d670b061b3" + integrity sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A== + +locate-path@^5.0.0: + version "5.0.0" + resolved "http://mirrors.tencent.com/npm/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + +lodash@^4.17.15: + version "4.17.21" + resolved "https://mirrors.tencent.com/npm/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +logform@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/logform/-/logform-2.2.0.tgz#40f036d19161fc76b68ab50fdc7fe495544492f2" + integrity sha512-N0qPlqfypFx7UHNn4B3lzS/b0uLqt2hmuoa+PpuXNYgozdJYAyauF5Ky0BWVjrxDlMWiT3qN4zPq3vVAfZy7Yg== + dependencies: + colors "^1.2.1" + fast-safe-stringify "^2.0.4" + fecha "^4.2.0" + ms "^2.1.1" + triple-beam "^1.3.0" + +micromatch@^4.0.2: + version "4.0.4" + resolved "http://mirrors.tencent.com/npm/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9" + integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== + dependencies: + braces "^3.0.1" + picomatch "^2.2.3" + +minimatch@^3.0.4: + version "3.0.4" + resolved "http://mirrors.tencent.com/npm/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist@^1.2.0: + version "1.2.5" + resolved "http://mirrors.tencent.com/npm/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" + integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== + +moment@^2.24.0: + version "2.29.1" + resolved "http://mirrors.tencent.com/npm/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3" + integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ== + +ms@2.1.2, ms@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +nice-try@^1.0.4: + version "1.0.5" + resolved "http://mirrors.tencent.com/npm/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== + +node-fetch@^2.6.0: + version "2.6.1" + resolved "http://mirrors.tencent.com/npm/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" + integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== + +once@^1.3.0: + version "1.4.0" + resolved "https://mirrors.tencent.com/npm/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +one-time@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/one-time/-/one-time-1.0.0.tgz#e06bc174aed214ed58edede573b433bbf827cb45" + integrity sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g== + dependencies: + fn.name "1.x.x" + +open@^7.4.2: + version "7.4.2" + resolved "http://mirrors.tencent.com/npm/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321" + integrity sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q== + dependencies: + is-docker "^2.0.0" + is-wsl "^2.1.1" + +os-tmpdir@~1.0.2: + version "1.0.2" + resolved "http://mirrors.tencent.com/npm/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + +p-limit@^2.2.0: + version "2.3.0" + resolved "http://mirrors.tencent.com/npm/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-locate@^4.1.0: + version "4.1.0" + resolved "http://mirrors.tencent.com/npm/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + +p-try@^2.0.0: + version "2.2.0" + resolved "http://mirrors.tencent.com/npm/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +patch-package@^6.2.2: + version "6.4.7" + resolved "https://mirrors.tencent.com/npm/patch-package/-/patch-package-6.4.7.tgz#2282d53c397909a0d9ef92dae3fdeb558382b148" + integrity sha512-S0vh/ZEafZ17hbhgqdnpunKDfzHQibQizx9g8yEf5dcVk3KOflOfdufRXQX8CSEkyOQwuM/bNz1GwKvFj54kaQ== + dependencies: + "@yarnpkg/lockfile" "^1.1.0" + chalk "^2.4.2" + cross-spawn "^6.0.5" + find-yarn-workspace-root "^2.0.0" + fs-extra "^7.0.1" + is-ci "^2.0.0" + klaw-sync "^6.0.0" + minimist "^1.2.0" + open "^7.4.2" + rimraf "^2.6.3" + semver "^5.6.0" + slash "^2.0.0" + tmp "^0.0.33" + +path-exists@^4.0.0: + version "4.0.0" + resolved "http://mirrors.tencent.com/npm/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "http://mirrors.tencent.com/npm/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-key@^2.0.1: + version "2.0.1" + resolved "http://mirrors.tencent.com/npm/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= + +picomatch@^2.2.3: + version "2.3.0" + resolved "http://mirrors.tencent.com/npm/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" + integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== + +postinstall-postinstall@^2.1.0: + version "2.1.0" + resolved "https://mirrors.tencent.com/npm/postinstall-postinstall/-/postinstall-postinstall-2.1.0.tgz#4f7f77441ef539d1512c40bd04c71b06a4704ca3" + integrity sha512-7hQX6ZlZXIoRiWNrbMQaLzUUfH+sSx39u8EJ9HYuDc1kLo9IXKWjM5RSquZN1ad5GnH8CGFM78fsAAQi3OKEEQ== + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "http://mirrors.tencent.com/npm/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + +readable-stream@^2.3.7: + version "2.3.7" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readable-stream@^3.4.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +require-directory@^2.1.1: + version "2.1.1" + resolved "http://mirrors.tencent.com/npm/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= + +require-main-filename@^2.0.0: + version "2.0.0" + resolved "http://mirrors.tencent.com/npm/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + +rimraf@^2.6.3: + version "2.7.1" + resolved "http://mirrors.tencent.com/npm/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== + dependencies: + glob "^7.1.3" + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +semver@^5.5.0, semver@^5.6.0: + version "5.7.1" + resolved "http://mirrors.tencent.com/npm/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + +set-blocking@^2.0.0: + version "2.0.0" + resolved "http://mirrors.tencent.com/npm/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + +shebang-command@^1.2.0: + version "1.2.0" + resolved "http://mirrors.tencent.com/npm/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "http://mirrors.tencent.com/npm/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= + +simple-swizzle@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" + integrity sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo= + dependencies: + is-arrayish "^0.3.1" + +slash@^2.0.0: + version "2.0.0" + resolved "http://mirrors.tencent.com/npm/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== + +stack-trace@0.0.x: + version "0.0.10" + resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" + integrity sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA= + +string-width@^4.1.0, string-width@^4.2.0: + version "4.2.2" + resolved "http://mirrors.tencent.com/npm/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5" + integrity sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.0" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^6.0.0: + version "6.0.0" + resolved "http://mirrors.tencent.com/npm/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" + +supports-color@^5.3.0: + version "5.5.0" + resolved "http://mirrors.tencent.com/npm/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^7.1.0: + version "7.2.0" + resolved "http://mirrors.tencent.com/npm/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +text-hex@1.0.x: + version "1.0.0" + resolved "https://registry.yarnpkg.com/text-hex/-/text-hex-1.0.0.tgz#69dc9c1b17446ee79a92bf5b884bb4b9127506f5" + integrity sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg== + +tmp@^0.0.33: + version "0.0.33" + resolved "http://mirrors.tencent.com/npm/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + dependencies: + os-tmpdir "~1.0.2" + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "http://mirrors.tencent.com/npm/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +triple-beam@^1.2.0, triple-beam@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.3.0.tgz#a595214c7298db8339eeeee083e4d10bd8cb8dd9" + integrity sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw== + +universalify@^0.1.0: + version "0.1.2" + resolved "https://mirrors.tencent.com/npm/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== + +util-deprecate@^1.0.1, util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +which-module@^2.0.0: + version "2.0.0" + resolved "http://mirrors.tencent.com/npm/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= + +which@^1.2.9: + version "1.3.1" + resolved "http://mirrors.tencent.com/npm/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== + dependencies: + isexe "^2.0.0" + +winston-transport@^4.3.0, winston-transport@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/winston-transport/-/winston-transport-4.4.0.tgz#17af518daa690d5b2ecccaa7acf7b20ca7925e59" + integrity sha512-Lc7/p3GtqtqPBYYtS6KCN3c77/2QCev51DvcJKbkFPQNoj1sinkGwLGFDxkXY9J6p9+EPnYs+D90uwbnaiURTw== + dependencies: + readable-stream "^2.3.7" + triple-beam "^1.2.0" + +winston@^3.2.1: + version "3.3.3" + resolved "https://registry.yarnpkg.com/winston/-/winston-3.3.3.tgz#ae6172042cafb29786afa3d09c8ff833ab7c9170" + integrity sha512-oEXTISQnC8VlSAKf1KYSSd7J6IWuRPQqDdo8eoRNaYKLvwSb5+79Z3Yi1lrl6KDpU6/VWaxpakDAtb1oQ4n9aw== + dependencies: + "@dabh/diagnostics" "^2.0.2" + async "^3.1.0" + is-stream "^2.0.0" + logform "^2.2.0" + one-time "^1.0.0" + readable-stream "^3.4.0" + stack-trace "0.0.x" + triple-beam "^1.3.0" + winston-transport "^4.4.0" + +wrap-ansi@^6.2.0: + version "6.2.0" + resolved "http://mirrors.tencent.com/npm/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" + integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://mirrors.tencent.com/npm/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +y18n@^4.0.0: + version "4.0.3" + resolved "http://mirrors.tencent.com/npm/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" + integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ== + +yargs-parser@^18.1.2: + version "18.1.3" + resolved "http://mirrors.tencent.com/npm/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" + integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs@^15.3.1: + version "15.4.1" + resolved "http://mirrors.tencent.com/npm/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" + integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== + dependencies: + cliui "^6.0.0" + decamelize "^1.2.0" + find-up "^4.1.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^4.2.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^18.1.2" diff --git a/lib/core/runtime/create-server.hack.ts b/lib/core/runtime/create-server.hack.ts index e0f3df65..5e5f8e58 100644 --- a/lib/core/runtime/create-server.hack.ts +++ b/lib/core/runtime/create-server.hack.ts @@ -7,6 +7,7 @@ */ import * as http from "http"; +import * as https from "https"; import * as domain from "domain"; import currentContext, { RequestLog } from "../context"; import { address } from "ip"; @@ -16,218 +17,240 @@ import { captureIncoming } from "./capture/incoming"; import { eventBus, EVENT_LIST } from "../bus"; let httpCreateServerHacked = false; -let originHttpCreateServer = null; +let httpsCreateServerHacked = false; -export const httpCreateServerHack = (): void => { - if (!httpCreateServerHacked) { - httpCreateServerHacked = true; - originHttpCreateServer = http.createServer; - - // eslint-disable-next-line - // @ts-ignore - // By default, ts not allow us to rewrite original methods. - http.createServer = ( - (createServer) => ( - ( - optionsOrRequestListener: http.ServerOptions, - requestListenerOrUndefined?: http.RequestListener - ): void => { - let requestListener: http.RequestListener; - let options: http.ServerOptions; - if (typeof optionsOrRequestListener === "function") { - requestListener = optionsOrRequestListener; - } else { - requestListener = requestListenerOrUndefined; - options = optionsOrRequestListener; +let originHttpCreateServer = null; +let originHttpsCreateServer = null; + +export const hack = ( + originCreateServer: T +): ( + ( + optionsOrRequestListener: http.ServerOptions, + requestListenerOrUndefined?: http.RequestListener + ) => http.Server + ) => ( + ( + optionsOrRequestListener: http.ServerOptions, + requestListenerOrUndefined?: http.RequestListener + ): http.Server => { + let requestListener: http.RequestListener; + let options: http.ServerOptions; + if (typeof optionsOrRequestListener === "function") { + requestListener = optionsOrRequestListener; + } else { + requestListener = requestListenerOrUndefined; + options = optionsOrRequestListener; + } + + const requestListenerWrap: http.RequestListener = (req, res) => { + const start = new Date(); + const timestamps: RequestLog["timestamps"] = { + dnsTime: 0, + requestStart: start, + onSocket: start, + onLookUp: start, + requestFinish: start, + socketConnect: start + } as RequestLog["timestamps"]; + + // Creating a domain and wrapping the execution. + const d = domain.create(); + + d.add(req); + d.add(res); + + const clearDomain = (): void => { + d.remove(req); + d.remove(res); + + const parser = (req.socket as any).parser as any; + if (parser && parser.domain) { + (parser.domain as domain.Domain).exit(); + parser.domain = null; } - const requestListenerWrap: http.RequestListener = (req, res) => { - const start = new Date(); - const timestamps: RequestLog["timestamps"] = { - dnsTime: 0, - requestStart: start, - onSocket: start, - onLookUp: start, - requestFinish: start, - socketConnect: start - } as RequestLog["timestamps"]; - - // Creating a domain and wrapping the execution. - const d = domain.create(); - - d.add(req); - d.add(res); - - const clearDomain = (): void => { - d.remove(req); - d.remove(res); - - const parser = (req.socket as any).parser as any; - if (parser && parser.domain) { - (parser.domain as domain.Domain).exit(); - parser.domain = null; - } - - while (process.domain) { - (process.domain as domain.Domain).exit(); - } - }; - - const requestInfo = captureIncoming(req); + while (process.domain) { + (process.domain as domain.Domain).exit(); + } + }; - res.writeHead = ((fn): typeof res.writeHead => ( - ...args: unknown[] - ): ReturnType => { - timestamps.onResponse = new Date(); + const requestInfo = captureIncoming(req); - const context = currentContext(); + res.writeHead = ((fn): typeof res.writeHead => ( + ...args: unknown[] + ): ReturnType => { + timestamps.onResponse = new Date(); - eventBus.emit(EVENT_LIST.RESPONSE_START, { - req, res, context - }); + const context = currentContext(); - captureOutgoing(res); + eventBus.emit(EVENT_LIST.RESPONSE_START, { + req, res, context + }); - return fn.apply(res, args); - })(res.writeHead); + captureOutgoing(res); - res.once("finish", () => { - const context = currentContext(); + return fn.apply(res, args); + })(res.writeHead); - context.currentRequest = { - SN: context.SN, + res.once("finish", () => { + const context = currentContext(); - protocol: "HTTP", - host: req.headers.host, - path: req.url, + context.currentRequest = { + SN: context.SN, - process: `TSW: ${process.pid}`, + protocol: "HTTP", + host: req.headers.host, + path: req.url, - clientIp: req.socket.remoteAddress, - clientPort: req.socket.remotePort, - serverIp: address(), - serverPort: (req.socket.address() as AddressInfo).port, - requestHeader: ((): string => { - const result = []; - result.push(`${req.method} ${ - req.url} HTTP/${req.httpVersion}`); + process: `TSW: ${process.pid}`, - Object.keys(req.headers).forEach((key) => { - result.push(`${key}: ${req.headers[key]}`); - }); + clientIp: req.socket.remoteAddress, + clientPort: req.socket.remotePort, + serverIp: address(), + serverPort: (req.socket.address() as AddressInfo).port, + requestHeader: ((): string => { + const result = []; + result.push(`${req.method} ${ + req.url} HTTP/${req.httpVersion}`); - result.push(""); - result.push(""); - - return result.join("\r\n"); - })(), - requestBody: requestInfo.body.toString("base64"), - responseHeader: ((): string => { - const result = []; - result.push(`HTTP/${req.httpVersion} ${ - res.statusCode} ${res.statusMessage}`); + Object.keys(req.headers).forEach((key) => { + result.push(`${key}: ${req.headers[key]}`); + }); - const resHeaders = res.getHeaders(); - Object.keys(resHeaders).forEach((key) => { - result.push(`${key}: ${resHeaders[key]}`); - }); + result.push(""); + result.push(""); - result.push(""); - result.push(""); + return result.join("\r\n"); + })(), + requestBody: requestInfo.body.toString("base64"), + responseHeader: ((): string => { + const result = []; + result.push(`HTTP/${req.httpVersion} ${ + res.statusCode} ${res.statusMessage}`); - return result.join("\r\n"); - })(), - responseBody: (res as any)._body.toString("base64"), - responseLength: (res as any)._bodyLength, - responseType: res.getHeader("content-type"), - statusCode: res.statusCode, - timestamps - } as RequestLog; + const resHeaders = res.getHeaders(); + Object.keys(resHeaders).forEach((key) => { + result.push(`${key}: ${resHeaders[key]}`); + }); - clearDomain(); + result.push(""); + result.push(""); + + return result.join("\r\n"); + })(), + responseBody: (res as any)._body.toString("base64"), + responseLength: (res as any)._bodyLength, + responseType: res.getHeader("content-type"), + statusCode: res.statusCode, + timestamps + } as RequestLog; + + clearDomain(); + + eventBus.emit(EVENT_LIST.RESPONSE_FINISH, { + req, res, context + }); + }); + + res.once("close", () => { + timestamps.responseClose = new Date(); + + const context = currentContext(); + + clearDomain(); + + eventBus.emit(EVENT_LIST.RESPONSE_CLOSE, { + req, res, context + }); + }); + + d.run(() => { + const context = currentContext(); + eventBus.emit(EVENT_LIST.REQUEST_START, { + req, context + }); + + // proxy req to proxy env when hitting uid + if ((isIP(context.proxyIp)) + && !req.headers["x-tsw-proxy"]) { + console.debug("isProxyUser..."); + + const requestOptions = { + hostname: context.proxyIp, + port: context.proxyPort, + path: req.url, + method: req.method, + headers: { "x-tsw-proxy": "true", ...req.headers } + }; + console.debug("start proxy"); + const proxyReq = http.request(requestOptions, (proxyRes) => { + proxyRes.pipe(res); + Object.keys(proxyRes.headers).forEach((headerType) => { + res.setHeader(headerType, proxyRes.headers[headerType]); + }); - eventBus.emit(EVENT_LIST.RESPONSE_FINISH, { - req, res, context + res.writeHead(proxyRes.statusCode); + proxyRes.on("end", () => { + console.debug("end proxy"); }); }); - res.once("close", () => { - timestamps.responseClose = new Date(); + if (/POST|PUT/i.test(req.method)) { + req.pipe(proxyReq); + } else { + proxyReq.end(); + } + + proxyReq.on("error", (err) => { + console.error("proxy fail..."); + console.error(JSON.stringify(err)); + if (res.headersSent) { + res.end(); + return; + } - const context = currentContext(); + res.setHeader("Content-Type", "text/html; charset=UTF-8"); + res.writeHead(500); + res.end(); + }); - clearDomain(); + return; + } - eventBus.emit(EVENT_LIST.RESPONSE_CLOSE, { - req, res, context - }); - }); + requestListener(req, res); + }); + }; - d.run(() => { - const context = currentContext(); - eventBus.emit(EVENT_LIST.REQUEST_START, { - req, context - }); + if (options) { + return originCreateServer.apply(this, [options, requestListenerWrap]); + } - // proxy req to proxy env when hitting uid - if ((isIP(context.proxyIp)) - && !req.headers["x-tsw-proxy"]) { - console.debug("isProxyUser..."); - - const requestOptions = { - hostname: context.proxyIp, - port: context.proxyPort, - path: req.url, - method: req.method, - headers: { "x-tsw-proxy": "true", ...req.headers } - }; - console.debug("start proxy"); - const proxyReq = http.request(requestOptions, (proxyRes) => { - proxyRes.pipe(res); - Object.keys(proxyRes.headers).forEach((headerType) => { - res.setHeader(headerType, proxyRes.headers[headerType]); - }); - - res.writeHead(proxyRes.statusCode); - proxyRes.on("end", () => { - console.debug("end proxy"); - }); - }); - - if (/POST|PUT/i.test(req.method)) { - req.pipe(proxyReq); - } else { - proxyReq.end(); - } - - proxyReq.on("error", (err) => { - console.error("proxy fail..."); - console.error(JSON.stringify(err)); - if (res.headersSent) { - res.end(); - return; - } - - res.setHeader("Content-Type", "text/html; charset=UTF-8"); - res.writeHead(500); - res.end(); - }); + return originCreateServer.apply(this, [requestListenerWrap]); + } + ); - return; - } +export const httpCreateServerHack = (): void => { + if (!httpCreateServerHacked) { + httpCreateServerHacked = true; + originHttpCreateServer = http.createServer; - requestListener(req, res); - }); - }; + // eslint-disable-next-line + // @ts-ignore + // By default, ts not allow us to rewrite original methods. + http.createServer = hack(http.createServer); + } +}; - if (options) { - return createServer.apply(this, [options, requestListenerWrap]); - } +export const httpsCreateServerHack = (): void => { + if (!httpsCreateServerHacked) { + httpsCreateServerHacked = true; + originHttpsCreateServer = https.createServer; - return createServer.apply(this, [requestListenerWrap]); - } - ) - )(http.createServer); + // eslint-disable-next-line + // @ts-ignore + // By default, ts not allow us to rewrite original methods. + https.createServer = hack(https.createServer); } }; @@ -240,3 +263,13 @@ export const httpCreateServerRestore = (): void => { http.createServer = originHttpCreateServer; } }; + +export const httpsCreateServerRestore = (): void => { + if (httpsCreateServerHacked) { + httpsCreateServerHacked = false; + // eslint-disable-next-line + // @ts-ignore + // By default, ts not allow us to rewrite original methods. + https.createServer = originHttpsCreateServer; + } +}; diff --git a/lib/index.ts b/lib/index.ts index d4ffbd9e..ce0634e5 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -2,7 +2,9 @@ import * as path from "path"; import { consoleHack, consoleRestore } from "./core/runtime/console.hack"; import { httpCreateServerHack, - httpCreateServerRestore + httpsCreateServerHack, + httpCreateServerRestore, + httpsCreateServerRestore } from "./core/runtime/create-server.hack"; import { dnsHack, dnsRestore } from "./core/runtime/dns.hack"; import { requestHack, requestRestore } from "./core/runtime/capture/index"; @@ -12,6 +14,7 @@ import logger from "./core/logger"; export const installHacks = (): void => { httpCreateServerHack(); + httpsCreateServerHack(); dnsHack(); consoleHack(); requestHack(); @@ -20,6 +23,7 @@ export const installHacks = (): void => { export const uninstallHacks = (): void => { httpCreateServerRestore(); + httpsCreateServerRestore(); dnsRestore(); consoleRestore(); requestRestore();