diff --git a/package-lock.json b/package-lock.json index 8236daf..b8a9e0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "nexe", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -18,15 +18,20 @@ "glob-to-regexp": "^0.3.0" } }, + "@nodelib/fs.stat": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.0.tgz", + "integrity": "sha512-LAQ1d4OPfSJ/BMbI2DuizmYrrkD9JMaTdi2hQTlI53lQ4kRQPyZQRS4CYQ7O66bnBBnP/oYdRxbk++X0xuFU6A==" + }, "@sindresorhus/is": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz", "integrity": "sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==" }, "@types/chai": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.1.3.tgz", - "integrity": "sha512-f5dXGzOJycyzSMdaXVhiBhauL4dYydXwVpavfQ1mVCaGjR56a9QfklXObUxlIY9bGTmCPHEEZ04I16BZ/8w5ww==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.1.4.tgz", + "integrity": "sha512-h6+VEw2Vr3ORiFCyyJmcho2zALnUq9cvdB/IO8Xs9itrJVCenC7o26A6+m7D0ihTTr65eS259H5/Ghl/VjYs6g==", "dev": true }, "@types/events": { @@ -56,12 +61,22 @@ } }, "@types/globby": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@types/globby/-/globby-6.1.0.tgz", - "integrity": "sha512-j3XSDNoK4LO5T+ZviQD6PqfEjm07QFEacOTbJR3hnLWuWX0ZMLJl9oRPgj1PyrfGbXhfHFkksC9QZ9HFltJyrw==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@types/globby/-/globby-8.0.0.tgz", + "integrity": "sha512-xDtsX5tlctxJzvg29r/LN12z30oJpoFP9cE8eJ8nY5cbSvN0c0RdRHrVlEq4LRh362Sd+JsqxJ3QWw0Wnyto8w==", "dev": true, "requires": { - "@types/glob": "*" + "@types/glob": "*", + "fast-glob": "^2.0.2" + } + }, + "@types/got": { + "version": "8.3.3", + "resolved": "https://registry.npmjs.org/@types/got/-/got-8.3.3.tgz", + "integrity": "sha512-OXZz0iG3oX9RHTZAeVGJQCjCOGx0r7MnSWebgUoX5CiFq0aVcRJrUPLQo/dBdKOaosbp4K9NTZTSec2zWk9YIg==", + "dev": true, + "requires": { + "@types/node": "*" } }, "@types/minimatch": { @@ -86,15 +101,15 @@ } }, "@types/mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-YeDiSEzznwZwwp766SJ6QlrTyBYUGPSIwmREHVTmktUYiT/WADdWtpt9iH0KuUSf8lZLdI4lP0X6PBzPo5//JQ==", + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz", + "integrity": "sha512-lAVp+Kj54ui/vLUFxsJTMtWvZraZxum3w3Nwkble2dNuV5VnPA+Mi2oGX9XYJAaIvZi3tn3cbjS/qcJXRb6Bww==", "dev": true }, "@types/node": { - "version": "9.6.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.2.tgz", - "integrity": "sha512-UWkRY9X7RQHp5OhhRIIka58/gVVycL1zHZu0OTsT5LI86ABaMOSbUjAl+b0FeDhQcxclrkyft3kW5QWdMRs8wQ==", + "version": "10.5.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.7.tgz", + "integrity": "sha512-VkKcfuitP+Nc/TaTFH0B8qNmn+6NbI6crLkQonbedViVz7O2w8QV/GERPlkJ4bg42VGHiEWa31CoTOPs1q6z1w==", "dev": true }, "@types/ora": { @@ -146,6 +161,21 @@ "resolved": "https://registry.npmjs.org/app-builder/-/app-builder-5.2.0.tgz", "integrity": "sha512-RRj/vu8WhmMM71G9BxMLRvcwpr1QUJZ9NXURGGo1v3fPiauzkQfNi31kM7irRNqR87NV+lJ/qI62iTzcAc+V0Q==" }, + "archive-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/archive-type/-/archive-type-4.0.0.tgz", + "integrity": "sha1-+S5yIzBW38aWlHJ0nCZ72wRrHXA=", + "requires": { + "file-type": "^4.2.0" + }, + "dependencies": { + "file-type": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-4.4.0.tgz", + "integrity": "sha1-G2AOX8ofvcboDApwxxyNul95BsU=" + } + } + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -205,9 +235,9 @@ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=" }, "atob": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.0.tgz", - "integrity": "sha512-SuiKH8vbsOyCALjA/+EINmt/Kdl+TQPrtFgW7XZZcwtryFu9e5kQoX3bjCW6mIvGH1fbeAZZuvwGR5IlBRznGw==" + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.1.tgz", + "integrity": "sha1-ri1acpR38onWDdf5amMUoi3Wwio=" }, "babel-code-frame": { "version": "6.26.0", @@ -384,18 +414,18 @@ } }, "buffer-alloc": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.1.0.tgz", - "integrity": "sha1-BVFNM78WVtNUDGhPZbEgLpDsowM=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", "requires": { - "buffer-alloc-unsafe": "^0.1.0", - "buffer-fill": "^0.1.0" + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" } }, "buffer-alloc-unsafe": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-0.1.1.tgz", - "integrity": "sha1-/+H2dVHdBVc33iUzN7/oU9+rGmo=" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" }, "buffer-crc32": { "version": "0.2.13", @@ -403,14 +433,14 @@ "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" }, "buffer-fill": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-0.1.1.tgz", - "integrity": "sha512-YgBMBzdRLEfgxJIGu2wrvI2E03tMCFU1p7d1KhB4BOoMN0VxmTFjSyN5JtKt9z8Z9JajMHruI6SE25W96wNv7Q==" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" }, "buffer-from": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.0.0.tgz", - "integrity": "sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, "builtin-modules": { @@ -503,9 +533,12 @@ "dev": true }, "cherow": { - "version": "1.6.5", - "resolved": "https://registry.npmjs.org/cherow/-/cherow-1.6.5.tgz", - "integrity": "sha512-WlPae6Bq0kjipch6MODpWgjok0NTtJCJRl/lsCcNDKvv/tliVDCVJSGzD8t3ZbXnKrsovnw6SHdiL9mA1OzSzQ==" + "version": "1.6.8", + "resolved": "https://registry.npmjs.org/cherow/-/cherow-1.6.8.tgz", + "integrity": "sha512-if2GIw3fjE/KnFD5tddg4YJn2zveJ7PU7VcTrVHvsAdqJClB5555AsSti53XHjUyaOEiqq9x3/lZZVJ8s+VPkA==", + "requires": { + "rollup-plugin-uglify": "^3.0.0" + } }, "class-utils": { "version": "0.3.6", @@ -564,25 +597,22 @@ } }, "color-convert": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", - "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz", + "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==", "requires": { - "color-name": "^1.1.1" + "color-name": "1.1.1" } }, "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=" }, "commander": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", - "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", - "requires": { - "graceful-readlink": ">= 1.0.0" - } + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", + "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==" }, "component-emitter": { "version": "1.2.1", @@ -829,21 +859,29 @@ } }, "download": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/download/-/download-7.0.0.tgz", - "integrity": "sha512-0Fe/CAjKycx12IG9We9gYlLP03BEcWTpttg7P5mwfOiQTg584kpuHqP7F61RkUJM+mfEdEU9TJonm0PJp5rQLw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/download/-/download-7.1.0.tgz", + "integrity": "sha512-xqnBTVd/E+GxJVrX5/eUJiLYjCGPwMpdL+jGhGU57BvtcA7wwhtHVbXBeUk51kOpW3S7Jn3BQbN9Q1R1Km2qDQ==", "requires": { + "archive-type": "^4.0.0", "caw": "^2.0.1", "content-disposition": "^0.5.2", "decompress": "^4.2.0", "ext-name": "^5.0.0", - "file-type": "^7.7.1", + "file-type": "^8.1.0", "filenamify": "^2.0.0", "get-stream": "^3.0.0", "got": "^8.3.1", "make-dir": "^1.2.0", - "p-event": "^1.3.0", + "p-event": "^2.1.0", "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + } } }, "duplexer3": { @@ -860,9 +898,9 @@ } }, "enhanced-resolve": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.0.0.tgz", - "integrity": "sha512-jox/62b2GofV1qTUQTMPEJSDIGycS43evqYzD/KVtEb9OCoki9cnacUPxCrZa7JfPzZSYOCZhu9O9luaMxAX8g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz", + "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==", "requires": { "graceful-fs": "^4.1.2", "memory-fs": "^0.4.0", @@ -883,9 +921,9 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "eslint-plugin-prettier": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.0.tgz", - "integrity": "sha512-floiaI4F7hRkTrFe8V2ItOK97QYrX75DjmdzmVITZoAP6Cn06oEDPQRsO6MlHEP/u2SxI3xQ52Kpjw6j5WGfeQ==", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.2.tgz", + "integrity": "sha512-tGek5clmW5swrAx1mdPYM8oThrBE83ePh7LeseZHBWfHVGrHPhKn7Y5zgRMbU/9D5Td9K4CEmUPjGxA7iw98Og==", "dev": true, "requires": { "fast-diff": "^1.1.1", @@ -893,9 +931,9 @@ } }, "esprima": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, "esutils": { @@ -1053,29 +1091,30 @@ "dev": true }, "fast-glob": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.0.tgz", - "integrity": "sha512-4F75PTznkNtSKs2pbhtBwRkw8sRwa7LfXx5XaQJOe4IQ6yTjceLDTwM5gj1s80R2t/5WeDC1gVfm3jLE+l39Tw==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.2.tgz", + "integrity": "sha512-TR6zxCKftDQnUAPvkrCWdBgDq/gbqx8A3ApnBrR5rMvpp6+KMJI0Igw7fkWPgeVK0uhRXTXdvO3O+YP0CaUX2g==", "requires": { "@mrmlnc/readdir-enhanced": "^2.2.1", + "@nodelib/fs.stat": "^1.0.1", "glob-parent": "^3.1.0", "is-glob": "^4.0.0", "merge2": "^1.2.1", - "micromatch": "^3.1.8" + "micromatch": "^3.1.10" } }, "fd-slicer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", - "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", "requires": { "pend": "~1.2.0" } }, "file-type": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-7.7.1.tgz", - "integrity": "sha512-bTrKkzzZI6wH+NXhyD3SOXtb2zXTw2SbwI2RxUlRcXVsnN7jNL5hJzVQLYv7FOQhxFkK4XWdAflEaWFpaLLWpQ==" + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-8.1.0.tgz", + "integrity": "sha512-qyQ0pzAy78gVoJsmYeNgl8uH8yKhr1lVhW7JbzJmnlRi0I4R2eEDEJZVKG8agpDnLpacwNbDhLNG/LMdxHD2YQ==" }, "filename-reserved-regex": { "version": "2.0.0", @@ -1083,9 +1122,9 @@ "integrity": "sha1-q/c9+rc10EVECr/qLZHzieu/oik=" }, "filenamify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-2.0.0.tgz", - "integrity": "sha1-vRYiYsC26Uv7zc8Zo7uzdk94VpU=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-2.1.0.tgz", + "integrity": "sha512-ICw7NTT6RsDp2rnYKVd8Fu4cr6ITzGy3+u4vUujPkabyaz+03F24NWEX7fs5fp+kBonlaqPH8fAO2NM+SXt/JA==", "requires": { "filename-reserved-regex": "^2.0.0", "strip-outer": "^1.0.0", @@ -1218,12 +1257,19 @@ "ignore": "^3.3.5", "pify": "^3.0.0", "slash": "^1.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + } } }, "got": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/got/-/got-8.3.1.tgz", - "integrity": "sha512-tiLX+bnYm5A56T5N/n9Xo89vMaO1mrS9qoDqj3u/anVooqGozvY/HbXzEpDfbNeKsHCBpK40gSbz8wGYSp3i1w==", + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/got/-/got-8.3.2.tgz", + "integrity": "sha512-qjUJ5U/hawxosMryILofZCkm3C84PLJS/0grRIpjAwu+Lkxxj5cxeCU25BG0/3mDSpXKTyZr8oh8wIgLaH0QCw==", "requires": { "@sindresorhus/is": "^0.7.0", "cacheable-request": "^2.1.1", @@ -1242,6 +1288,13 @@ "timed-out": "^4.0.1", "url-parse-lax": "^3.0.0", "url-to-options": "^1.0.1" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + } } }, "graceful-fs": { @@ -1255,9 +1308,9 @@ "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=" }, "growl": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", - "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, "has-ansi": { @@ -1336,14 +1389,14 @@ "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==" }, "ieee754": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.11.tgz", - "integrity": "sha512-VhDzCKN7K8ufStx/CLj5/PDTMgph+qwN5Pkd5i0sGnVwk56zJ0lkT8Qzi1xqWLS0Wp29DgDtNeS7v8/wMoZeHg==" + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", + "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==" }, "ignore": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.7.tgz", - "integrity": "sha512-YGG3ejvBNHRqu0559EOxxNFihD0AjpvHlC/pdGKd3X3ofe+CoJkYazwNJYTNebqpPKN+VVQbh4ZFn1DivMNuHA==" + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", + "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==" }, "inflight": { "version": "1.0.6", @@ -1477,21 +1530,6 @@ "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=" }, - "is-odd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-2.0.0.tgz", - "integrity": "sha512-OTiixgpZAT1M4NHgS5IguFp/Vz2VI3U7Goh4/HA1adtwyLtSBrxYlcSYkhpAE07s4fKEcjrFxyvtQBND4vFQyQ==", - "requires": { - "is-number": "^4.0.0" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", - "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==" - } - } - }, "is-plain-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", @@ -1558,9 +1596,9 @@ "dev": true }, "js-yaml": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.11.0.tgz", - "integrity": "sha512-saJstZWv7oNeOyBh3+Dx1qWzhW0+e6/8eDzo7p5rDFqxntSztloLtuKu+Ejhtq82jsilwOIZYsCz+lIjthg1Hw==", + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", "dev": true, "requires": { "argparse": "^1.0.7", @@ -1604,6 +1642,13 @@ "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", "requires": { "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + } } }, "make-error": { @@ -1635,9 +1680,9 @@ } }, "merge2": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.2.1.tgz", - "integrity": "sha512-wUqcG5pxrAcaFI1lkqkMnk3Q7nUxV/NWfpAFSeWUwG9TRODnBDCUHa75mi3o3vLWQ5N4CQERWCauSlP0I3ZqUg==" + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.2.2.tgz", + "integrity": "sha512-bgM8twH86rWni21thii6WCMQMRMmwqqdW3sGWi9IipnVAszdLXRjwDwAnyrVXo6DuP3AjRMMttZKUB48QWIFGg==" }, "micromatch": { "version": "3.1.10", @@ -1660,9 +1705,9 @@ } }, "mime-db": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", - "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" + "version": "1.35.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" }, "mimic-fn": { "version": "1.2.0", @@ -1670,9 +1715,9 @@ "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==" }, "mimic-response": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.0.tgz", - "integrity": "sha1-3z02Uqc/3ta5sLJBRub9BSNTRY4=" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" }, "minimatch": { "version": "3.0.4", @@ -1722,28 +1767,28 @@ } }, "mocha": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.1.1.tgz", - "integrity": "sha512-kKKs/H1KrMMQIEsWNxGmb4/BGsmj0dkeyotEvbrAuQ01FcWRLssUNXCEUZk6SZtyJBi6EE7SL0zDDtItw1rGhw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", "dev": true, "requires": { "browser-stdout": "1.3.1", - "commander": "2.11.0", + "commander": "2.15.1", "debug": "3.1.0", "diff": "3.5.0", "escape-string-regexp": "1.0.5", "glob": "7.1.2", - "growl": "1.10.3", + "growl": "1.10.5", "he": "1.1.1", "minimatch": "3.0.4", "mkdirp": "0.5.1", - "supports-color": "4.4.0" + "supports-color": "5.4.0" }, "dependencies": { "commander": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, "debug": { @@ -1754,21 +1799,6 @@ "requires": { "ms": "2.0.0" } - }, - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", - "dev": true - }, - "supports-color": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", - "dev": true, - "requires": { - "has-flag": "^2.0.0" - } } } }, @@ -1778,16 +1808,15 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "nanomatch": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.9.tgz", - "integrity": "sha512-n8R9bS8yQ6eSXaV6jHUpKzD8gLsin02w1HSFiegwrs9E098Ylhw5jdyKPaYqvHknHaSCKTPp7C8dGCQ0q9koXA==", + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", "requires": { "arr-diff": "^4.0.0", "array-unique": "^0.3.2", "define-property": "^2.0.2", "extend-shallow": "^3.0.2", "fragment-cache": "^0.2.1", - "is-odd": "^2.0.0", "is-windows": "^1.0.2", "kind-of": "^6.0.2", "object.pick": "^1.3.0", @@ -1829,6 +1858,13 @@ "requires": { "config-chain": "^1.1.11", "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + } } }, "npm-run-path": { @@ -1924,21 +1960,11 @@ "integrity": "sha512-HNa1A8LvB1kie7cERyy21VNeHb2CWJJYqyyC2o3klWFfMGlFmWv2Z7sFgZH8ZiaYL95ydToKTFVXgMV/Os0bBQ==" }, "p-event": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-event/-/p-event-1.3.0.tgz", - "integrity": "sha1-jmtPT2XHK8W2/ii3XtqHT5akoIU=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-event/-/p-event-2.1.0.tgz", + "integrity": "sha512-sDEpDVnzLGlJj3k590uUdpfEUySP5yAYlvfTCu5hTDvSTXQVecYWKcEwdO49PrZlnJ5wkfAvtawnno/jyXeqvA==", "requires": { - "p-timeout": "^1.1.1" - }, - "dependencies": { - "p-timeout": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-1.2.1.tgz", - "integrity": "sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y=", - "requires": { - "p-finally": "^1.0.0" - } - } + "p-timeout": "^2.0.1" } }, "p-finally": { @@ -1981,9 +2007,9 @@ "dev": true }, "path-parse": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", - "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, "path-type": { @@ -1992,6 +2018,13 @@ "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", "requires": { "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + } } }, "pathval": { @@ -2006,9 +2039,9 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" }, "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.0.tgz", + "integrity": "sha512-zrSP/KDf9DH3K3VePONoCstgPiYJy9z0SCatZuTpOc7YdnWIqwkWdXOuwlr4uDc7em8QZRsFWsT/685x5InjYg==" }, "pinkie": { "version": "2.0.4", @@ -2034,9 +2067,9 @@ "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" }, "prettier": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.12.1.tgz", - "integrity": "sha1-wa0g6APndJ+vkFpAnSNn4Gu+cyU=", + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.14.2.tgz", + "integrity": "sha512-McHPg0n1pIke+A/4VcaS2en+pTNjy4xF+Uuq86u/5dyDO59/TtFZtQ708QIRkEZ3qwKz3GVkVa6mpxK/CpB8Rg==", "dev": true }, "process-nextick-args": { @@ -2098,24 +2131,24 @@ "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" }, "resolve": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", - "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", "dev": true, "requires": { "path-parse": "^1.0.5" } }, "resolve-dependencies": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-dependencies/-/resolve-dependencies-2.0.0.tgz", - "integrity": "sha512-N3jWgE46Tbwlsesjo6cc8OqyoTuEmP5NmXgUORd6Gp4ZMCVbWZ3HtpK9LHEMRzx4X4G35Uy6SY/Ez/MRysAGkg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/resolve-dependencies/-/resolve-dependencies-2.1.1.tgz", + "integrity": "sha512-Qmd1eEp9CmAZZx1e3scW2Cof0kauO3Y6jKMoZIm8RN/BWwkfhUdfLV+qpb7+ONITVmqWFUdHb6r62HSlmAMv5Q==", "requires": { "@calebboyd/semaphore": "^1.3.1", - "cherow": "^1.6.5", - "enhanced-resolve": "^4.0.0", + "cherow": "^1.6.8", + "enhanced-resolve": "^4.1.0", "globby": "^8.0.1", - "pify": "^3.0.0" + "pify": "^4.0.0" } }, "resolve-url": { @@ -2153,10 +2186,18 @@ "glob": "^7.0.5" } }, + "rollup-plugin-uglify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-uglify/-/rollup-plugin-uglify-3.0.0.tgz", + "integrity": "sha512-dehLu9eRRoV4l09aC+ySntRw1OAfoyKdbk8Nelblj03tHoynkSybqyEpgavemi1LBOH6S1vzI58/mpxkZIe1iQ==", + "requires": { + "uglify-es": "^3.3.7" + } + }, "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "safe-regex": { "version": "1.1.0", @@ -2172,6 +2213,16 @@ "integrity": "sha1-z+kXyz0nS8/6x5J1ivUxc+sfq9w=", "requires": { "commander": "~2.8.1" + }, + "dependencies": { + "commander": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", + "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", + "requires": { + "graceful-readlink": ">= 1.0.0" + } + } } }, "semver": { @@ -2256,6 +2307,11 @@ "requires": { "is-extendable": "^0.1.0" } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" } } }, @@ -2340,16 +2396,16 @@ } }, "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, "source-map-resolve": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz", - "integrity": "sha512-0KW2wvzfxm8NCTb30z0LMNyPqWCdDGE2viwzUaucqJdkTRXtZiSY3I+2A6nVAjmdOy0I4gU8DwnVVGsk9jvP2A==", + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", "requires": { - "atob": "^2.0.0", + "atob": "^2.1.1", "decode-uri-component": "^0.2.0", "resolve-url": "^0.2.1", "source-map-url": "^0.4.0", @@ -2357,21 +2413,13 @@ } }, "source-map-support": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.6.tgz", - "integrity": "sha512-N4KXEz7jcKqPf2b2vZF11lQIz9W5ZMuUcIOGj243lduidkf2fjkVKJS9vNxVWn3u/uxX38AcE8U9nnH9FPcq+g==", + "version": "0.5.8", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.8.tgz", + "integrity": "sha512-WqAEWPdb78u25RfKzOF0swBpY0dKrNdjc4GvLwm7ScX/o9bj8Eh/YL8mcMhBHYDGl87UkkSXDOFnW4G7GhWhGg==", "dev": true, "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } } }, "source-map-url": { @@ -2544,31 +2592,31 @@ } }, "ts-node": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-6.0.3.tgz", - "integrity": "sha512-ARaOMNFEPKg2ZuC1qJddFvHxHNFVckR0g9xLxMIoMqSSIkDc8iS4/LoV53EdDWWNq2FGwqcEf0bVVGJIWpsznw==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.0.tgz", + "integrity": "sha512-klJsfswHP0FuOLsvBZ/zzCfUvakOSSxds78mVeK7I+qP76YWtxf16hEZsp3U+b0kIo82R5UatGFeblYMqabb2Q==", "dev": true, "requires": { "arrify": "^1.0.0", - "chalk": "^2.3.0", + "buffer-from": "^1.1.0", "diff": "^3.1.0", "make-error": "^1.1.1", "minimist": "^1.2.0", "mkdirp": "^0.5.1", - "source-map-support": "^0.5.3", + "source-map-support": "^0.5.6", "yn": "^2.0.0" } }, "tslib": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", - "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", "dev": true }, "tslint": { - "version": "5.10.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.10.0.tgz", - "integrity": "sha1-EeJrzLiK+gLdDZlWyuPUVAtfVMM=", + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.11.0.tgz", + "integrity": "sha1-mPMMAurjzecAYgHkwzywi0hYHu0=", "dev": true, "requires": { "babel-code-frame": "^6.22.0", @@ -2582,21 +2630,13 @@ "resolve": "^1.3.2", "semver": "^5.3.0", "tslib": "^1.8.0", - "tsutils": "^2.12.1" - }, - "dependencies": { - "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", - "dev": true - } + "tsutils": "^2.27.2" } }, "tslint-config-prettier": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.12.0.tgz", - "integrity": "sha512-7zugK8NWpoDPYT6UNGLDGpQOhk0CSodjkyrTNiHOCjwIAleYKlyQunxpsSXBIoGEs/kFVppd6YzZeQZtrJnyRg==", + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.14.0.tgz", + "integrity": "sha512-SomD+aLvAwoihMtyCfkhhWKt9wcpSY2ZpgDV6OuxLYi8+7uOwE2g03aa+jJLSmY0Ys8s3ZLM5Iwfuwu3giCSQQ==", "dev": true }, "tslint-plugin-prettier": { @@ -2610,9 +2650,9 @@ } }, "tsutils": { - "version": "2.27.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.27.0.tgz", - "integrity": "sha512-JcyX25oM9pFcb3zh60OqG1St8p/uSqC5Bgipdo3ieacB/Ao4dPhm7hAtKT9NrEu23CyYrrgJPV3CqYfo+/+T4w==", + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", "dev": true, "requires": { "tslib": "^1.8.1" @@ -2633,11 +2673,20 @@ "dev": true }, "typescript": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.8.3.tgz", - "integrity": "sha512-K7g15Bb6Ra4lKf7Iq2l/I5/En+hLIHmxWZGq3D4DIRNFxMNV6j2SHSvDOqs2tGd4UvD/fJvrwopzQXjLrT7Itw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.1.tgz", + "integrity": "sha512-zQIMOmC+372pC/CCVLqnQ0zSBiY7HHodU7mpQdjiZddek4GMj31I3dUJ7gAs9o65X7mnRma6OokOkc6f9jjfBg==", "dev": true }, + "uglify-es": { + "version": "3.3.9", + "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", + "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", + "requires": { + "commander": "~2.13.0", + "source-map": "~0.6.1" + } + }, "unbzip2-stream": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.2.5.tgz", @@ -2734,12 +2783,9 @@ "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=" }, "use": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/use/-/use-3.1.0.tgz", - "integrity": "sha512-6UJEQM/L+mzC3ZJNM56Q4DFGLX/evKGRg15UJHGB9X5j5Z3AFbgZvjUh2yq/UJUY4U5dh7Fal++XbNg1uzpRAw==", - "requires": { - "kind-of": "^6.0.2" - } + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" }, "util-deprecate": { "version": "1.0.2", @@ -2755,9 +2801,9 @@ } }, "which": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "requires": { "isexe": "^2.0.0" @@ -2774,12 +2820,12 @@ "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" }, "yauzl": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.9.1.tgz", - "integrity": "sha1-qBmB6nCleUYTOIPwKcWCGok1mn8=", + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", "requires": { "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.0.1" + "fd-slicer": "~1.1.0" } }, "yn": { diff --git a/package.json b/package.json index d33e14c..118bf63 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "nexe", "description": "Create a single executable out of your Node.js application", "license": "MIT", - "version": "2.0.0-next.12", + "version": "2.0.0-next.13", "contributors": [ "Craig Condon (http://crcn.io)", "Jared Allard ", @@ -36,20 +36,22 @@ "app-builder": "^5.2.0", "caw": "^2.0.1", "chalk": "^2.4.1", + "cherow": "^1.6.8", "download": "^7.0.0", "globby": "^8.0.1", "got": "^8.3.1", "minimist": "^1.2.0", "mkdirp": "^0.5.1", "ora": "^2.1.0", - "pify": "^3.0.0", - "resolve-dependencies": "^2.0.0", + "pify": "^4.0.0", + "resolve-dependencies": "^2.1.1", "rimraf": "^2.6.2" }, "devDependencies": { "@types/chai": "^4.1.3", "@types/execa": "^0.9.0", - "@types/globby": "^6.1.0", + "@types/globby": "^8.0.0", + "@types/got": "^8.3.3", "@types/minimist": "^1.2.0", "@types/mkdirp": "^0.5.2", "@types/mocha": "^5.2.0", @@ -60,11 +62,11 @@ "chai": "^4.1.2", "execa": "^0.10.0", "mocha": "^5.1.1", - "prettier": "^1.12.1", - "ts-node": "6.0.3", + "prettier": "^1.14.2", + "ts-node": "^7.0.0", "tslint": "^5.10.0", "tslint-config-prettier": "^1.12.0", "tslint-plugin-prettier": "^1.3.0", - "typescript": "2.8.3" + "typescript": "^3.0.1" } } diff --git a/src/bundle/fs/package.json b/src/bundle/fs/package.json new file mode 100644 index 0000000..18678a5 --- /dev/null +++ b/src/bundle/fs/package.json @@ -0,0 +1,11 @@ +{ + "name": "nexe-bundle-fs", + "version": "1.0.0", + "description": "Set of fs patches for nexe bundles", + "main": "patch.ts", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Caleb Boyd", + "license": "MIT" +} diff --git a/src/bundle/fs/patch.ts b/src/bundle/fs/patch.ts new file mode 100644 index 0000000..1557219 --- /dev/null +++ b/src/bundle/fs/patch.ts @@ -0,0 +1,330 @@ +import { Stats } from 'fs' + +export interface NexeBinary { + blobPath: string + resources: { [key: string]: number[] } + layout: { + stat: Stats + resourceStart: number + contentSize?: number + contentStart?: number + resourceSize?: number + } +} + +let originalFsMethods: any = null + +function restoreFs(fs: any) { + if (!originalFsMethods) { + return + } + Object.assign(fs, originalFsMethods) +} + +function shimFs(binary: NexeBinary, fs: any = require('fs')) { + originalFsMethods = Object.assign({}, fs) + const { blobPath, resources: manifest } = binary + const { resourceStart, stat } = binary.layout + const directories: { [key: string]: { [key: string]: boolean } } = {}, + isString = (x: any): x is string => typeof x === 'string' || x instanceof String, + isNotFile = () => false, + isNotDirectory = isNotFile, + isFile = () => true, + noop = () => {}, + isDirectory = isFile, + path = require('path') + + let log = (text: string) => { + if ((process.env.DEBUG || '').toLowerCase().includes('nexe:require')) { + process.stderr.write('[nexe] - ' + text + '\n') + } else { + log = noop + } + } + + const getKey = process.platform.startsWith('win') + ? function getKey(filepath: string): string { + let key = path.resolve(filepath) + if (key.substr(1, 2) === ':\\') { + key = key[0].toUpperCase() + key.substr(1) + } + return key + } + : path.resolve + + const statTime = function() { + return { + dev: 0, + ino: 0, + nlink: 0, + rdev: 0, + uid: 123, + gid: 500, + blksize: 4096, + blocks: 0, + atime: new Date(stat.atime), + atimeMs: stat.atime.getTime(), + mtime: new Date(stat.mtime), + mtimeMs: stat.mtime.getTime(), + ctime: new Date(stat.ctime), + ctimMs: stat.ctime.getTime(), + birthtime: new Date(stat.birthtime), + birthtimeMs: stat.birthtime.getTime() + } + } + + const createStat = function(directoryExtensions: any, fileExtensions?: any) { + if (!fileExtensions) { + return Object.assign({}, binary.layout.stat, directoryExtensions, { size: 0 }, statTime()) + } + const size = directoryExtensions[1] + return Object.assign({}, binary.layout.stat, fileExtensions, { size }, statTime()) + } + + const ownStat = function(filepath: string) { + setupManifest() + const key = getKey(filepath) + if (directories[key]) { + return createStat({ isDirectory, isFile: isNotFile }) + } + if (manifest[key]) { + return createStat(manifest[key], { isFile, isDirectory: isNotDirectory }) + } + } + + function makeLong(filepath: string) { + return (path as any)._makeLong && (path as any)._makeLong(filepath) + } + + function fileOpts(options: any) { + return !options ? {} : isString(options) ? { encoding: options } : options + } + + let setupManifest = () => { + Object.keys(manifest).forEach(filepath => { + const entry = manifest[filepath] + const absolutePath = getKey(filepath) + const longPath = makeLong(absolutePath) + const normalizedPath = path.normalize(filepath) + + if (!manifest[absolutePath]) { + manifest[absolutePath] = entry + } + if (longPath && !manifest[longPath]) { + manifest[longPath] = entry + } + if (!manifest[normalizedPath]) { + manifest[normalizedPath] = manifest[filepath] + } + + let currentDir = path.dirname(absolutePath) + let prevDir = absolutePath + + while (currentDir !== prevDir) { + directories[currentDir] = directories[currentDir] || {} + directories[currentDir][path.basename(prevDir)] = true + const longDir = makeLong(currentDir) + if (longDir && !directories[longDir]) { + directories[longDir] = directories[currentDir] + } + prevDir = currentDir + currentDir = path.dirname(currentDir) + } + }) + setupManifest = noop + } + + //naive patches intended to work for most use cases + const nfs: any = { + existsSync: function existsSync(filepath: string) { + setupManifest() + const key = getKey(filepath) + if (manifest[key] || directories[key]) { + return true + } + return originalFsMethods.existsSync.apply(fs, arguments) + }, + realpath: function realpath(filepath: any, options: any, cb: any): void { + setupManifest() + const key = getKey(filepath) + if (isString(filepath) && (manifest[filepath] || manifest[key])) { + return process.nextTick(() => cb(null, filepath)) + } + return originalFsMethods.realpath.call(fs, filepath, options, cb) + }, + realpathSync: function realpathSync(filepath: any, options: any) { + setupManifest() + const key = getKey(filepath) + if (isString(filepath) && (manifest[filepath] || manifest[key])) { + return filepath + } + return originalFsMethods.realpathSync.call(fs, filepath, options) + }, + readdir: function readdir(filepath: string | Buffer, options: any, callback: any) { + setupManifest() + filepath = filepath.toString() + if ('function' === typeof options) { + callback = options + options = { encoding: 'utf8' } + } + const dir = directories[getKey(filepath)] + if (dir) { + process.nextTick(() => { + //todo merge with original? + callback(null, Object.keys(dir)) + }) + } else { + return originalFsMethods.readdir.apply(fs, arguments) + } + }, + + readdirSync: function readdirSync(filepath: string | Buffer, options: any) { + setupManifest() + filepath = filepath.toString() + const dir = directories[getKey(filepath)] + if (dir) { + return Object.keys(dir) + } + return originalFsMethods.readdirSync.apply(fs, arguments) + }, + + readFile: function readFile(filepath: any, options: any, callback: any) { + setupManifest() + const entry = manifest[filepath] || manifest[getKey(filepath)] + if (!entry || !isString(filepath)) { + return originalFsMethods.readFile.apply(fs, arguments) + } + const [offset, length] = entry + const resourceOffset = resourceStart + offset + const encoding = fileOpts(options).encoding + callback = typeof options === 'function' ? options : callback + + fs.open(blobPath, 'r', function(err: Error, fd: number) { + if (err) return callback(err, null) + fs.read(fd, Buffer.alloc(length), 0, length, resourceOffset, function( + error: Error, + bytesRead: number, + result: Buffer + ) { + if (error) { + return fs.close(fd, function() { + callback(error, null) + }) + } + fs.close(fd, function(err: Error) { + if (err) { + return callback(err, result) + } + callback(err, encoding ? result.toString(encoding) : result) + }) + }) + }) + }, + createReadStream: function createReadStream(filepath: any, options: any) { + setupManifest() + const entry = manifest[filepath] || manifest[getKey(filepath)] + if (!entry || !isString(filepath)) { + return originalFsMethods.createReadStream.apply(fs, arguments) + } + const [offset, length] = entry + const resourceOffset = resourceStart + offset + const opts = fileOpts(options) + + return fs.createReadStream( + blobPath, + Object.assign({}, opts, { + start: resourceOffset, + end: resourceOffset + length - 1 + }) + ) + }, + readFileSync: function readFileSync(filepath: any, options: any) { + setupManifest() + + const entry = manifest[filepath] || manifest[getKey(filepath)] + if (!entry || !isString(filepath)) { + return originalFsMethods.readFileSync.apply(fs, arguments) + } + const [offset, length] = entry + const resourceOffset = resourceStart + offset + const encoding = fileOpts(options).encoding + const fd = fs.openSync(process.execPath, 'r') + const result = Buffer.alloc(length) + fs.readSync(fd, result, 0, length, resourceOffset) + fs.closeSync(fd) + return encoding ? result.toString(encoding) : result + }, + statSync: function statSync(filepath: string | Buffer) { + const stat = isString(filepath) && ownStat(filepath) + if (stat) { + return stat + } + return originalFsMethods.statSync.apply(fs, arguments) + }, + stat: function stat(filepath: string | Buffer, callback: any) { + const stat = isString(filepath) && ownStat(filepath) + if (stat) { + process.nextTick(() => { + callback(null, stat) + }) + } else { + return originalFsMethods.stat.apply(fs, arguments) + } + } + } + + if (typeof fs.exists === 'function') { + nfs.exists = function(filepath: string, cb: Function) { + cb = cb || noop + const exists = nfs.existsSync(filepath) + process.nextTick(() => cb(exists)) + } + } + + const patches = (process as any).nexe.patches || {} + delete (process as any).nexe + patches.internalModuleReadFile = function(this: any, original: any, ...args: any[]) { + const [filepath] = args + setupManifest() + if (manifest[filepath]) { + log('read (hit) ' + filepath) + return nfs.readFileSync(filepath, 'utf-8') + } + log('read (miss) ' + filepath) + return original.call(this, ...args) + } + patches.internalModuleStat = function(this: any, original: any, ...args: any[]) { + setupManifest() + const [filepath] = args + if (manifest[filepath]) { + log('stat (hit) ' + filepath + ' ' + 0) + return 0 + } + if (directories[filepath]) { + log('stat dir (hit) ' + filepath + ' ' + 1) + return 1 + } + const res = original.call(this, ...args) + if (res === 0) { + log('stat (miss) ' + filepath + ' ' + res) + } else if (res === 1) { + log('stat dir (miss) ' + filepath + ' ' + res) + } else { + log('stat (fail) ' + filepath + ' ' + res) + } + return res + } + + if (typeof fs.exists === 'function') { + nfs.exists = function(filepath: string, cb: Function) { + cb = cb || noop + const exists = nfs.existsSync(filepath) + if (!exists) { + return originalFsMethods.exists(filepath, cb) + } + process.nextTick(() => cb(exists)) + } + } +} + +export { shimFs as applyFsPatch, restoreFs } diff --git a/src/bundle/index.ts b/src/bundle/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/bundling/bindings-rewrite.ts b/src/bundling/bindings-rewrite.ts deleted file mode 100644 index 8d6c998..0000000 --- a/src/bundling/bindings-rewrite.ts +++ /dev/null @@ -1,93 +0,0 @@ -import * as fs from 'fs' -import * as path from 'path' -import * as child from 'child_process' -import { createHash } from 'crypto' - -function findNativeModulePath(filePath: string, bindingsArg: string) { - const dirname = path.dirname(filePath) - const tempFile = Math.random() * 100 + '.js' - const tempFilePath = path.join(dirname, tempFile) - fs.writeFileSync( - tempFilePath, - ` - var bindings = require('bindings'); - var Module = require('module'); - var originalRequire = Module.prototype.require; - Module.prototype.require = function(path) { - const mod = originalRequire.apply(this, arguments); - process.stdout.write(path) - return mod - }; - bindings('${bindingsArg}') - ` - ) - //using exec because it can be done sync - const nativeFileName = child.execSync('node ' + tempFile, { cwd: dirname }).toString() - fs.unlinkSync(tempFilePath) - const relativePath = './' + path.relative(dirname, nativeFileName).replace(/\\/g, '/') - return relativePath -} -/** - * Traverse all nodes in a file and evaluate usages of the bindings module - * handles two common cases - */ -export class BindingsRewrite { - private bindingsIdNodes: any[] = [] - public nativeModulePaths: string[] = [] - public rewrite = false - - isRequire(node: any, moduleName: string) { - return node.callee.name === 'require' && node.arguments[0].value === moduleName - } - - onNode(absolutePath: string, node: any, parent: any) { - if (node.type === 'CallExpression') { - if (this.isRequire(node, 'bindings') && parent.type === 'VariableDeclarator') { - /** - * const loadBindings = require('bindings'); - * -> const loadBindings = String(''); - */ - this.bindingsIdNodes.push(parent.id) - node.callee.name = 'String' - node.arguments[0].value = '' - this.rewrite = true - return - } - - if (this.isRequire(node, 'bindings') && parent.type === 'CallExpression') { - /** - *const bindings = require('bindings')('native-module').... - * -> const bindings = require('./path/to/native/module.node')..... - */ - const bindingsArgNode = parent.arguments[0] - if (bindingsArgNode.type === 'Literal') { - parent.callee = { type: 'Identifier', name: 'require' } - bindingsArgNode.value = findNativeModulePath(absolutePath, bindingsArgNode.value) - this.nativeModulePaths.push(bindingsArgNode.value) - this.rewrite = true - return - } - } - - const bindingsInvocationIdx = this.bindingsIdNodes.findIndex(x => node.callee.name === x.name) - - if (this.bindingsIdNodes[bindingsInvocationIdx]) { - /** - * const bindings = loadBindings('native-module') - * -> const bindings = require('./path/to/native/module.node') - */ - const bindingsIdNode = this.bindingsIdNodes[bindingsInvocationIdx] - const bindingsArgNode = node.arguments[0] - this.bindingsIdNodes.splice(bindingsInvocationIdx, 1) - - if (bindingsArgNode.type === 'Literal') { - node.callee.name = 'require' - bindingsArgNode.value = findNativeModulePath(absolutePath, bindingsArgNode.value) - this.nativeModulePaths.push(bindingsArgNode.value) - this.rewrite = true - return - } - } - } - } -} diff --git a/src/bundling/embed-node.ts b/src/bundling/embed-node.ts deleted file mode 100644 index 2bc28e0..0000000 --- a/src/bundling/embed-node.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { createHash } from 'crypto' -import * as path from 'path' -import * as fs from 'fs' - -export interface EmbedNodeModuleOptions { - [key: string]: { additionalFiles: string[] } | true -} - -function hashName(name: string | Buffer) { - return createHash('md5') - .update(name) - .digest('hex') - .toString() - .slice(0, 8) -} - -export function embedDotNode( - options: EmbedNodeModuleOptions, - file: { contents: string; absPath: string } -) { - const contents = fs.readFileSync(file.absPath) - const modulePathParts = file.absPath.split(path.sep).reverse() - const module = modulePathParts[modulePathParts.findIndex(x => x === 'node_modules') - 1] - const bindingName = path.basename(file.absPath) - const settings = options[module] - const moduleDir = hashName(contents) - file.contents = ` - var fs=require('fs');var path=require('path');var binding='${contents.toString( - 'base64' - )}';function mkdirp(r,t){t=t||null,r=path.resolve(r);try{fs.mkdirSync(r),t=t||r}catch(c){if("ENOENT"===c.code)t=mkdirp(path.dirname(r),t),mkdirp(r,t);else{var i;try{i=fs.statSync(r)}catch(r){throw c}if(!i.isDirectory())throw c}}return t};` - - if (!settings || settings === true) { - file.contents += ` - mkdirp('${moduleDir}'); - var bindingPath = path.join(process.cwd(), '${moduleDir}', '${bindingName}') - - require('fs').writeFileSync(bindingPath, Buffer.from(binding, 'base64')) - process.dlopen(module, bindingPath) - `.trim() - return {} - } - - let depth = 0 - settings.additionalFiles.forEach(file => { - let ownDepth = 0 - file.split('/').forEach(x => x === '..' && ownDepth++) - depth = ownDepth > depth ? ownDepth : depth - }) - let segments = [moduleDir] - while (depth--) { - segments.push(hashName(moduleDir + depth)) - } - segments.push(bindingName) - - file.contents += ` - var cwd = process.cwd() - var bindingFileParts = ${JSON.stringify(segments)}; - var bindingFile = path.join.apply(path, [cwd].concat(bindingFileParts)); - mkdirp(path.dirname(bindingFile)); - fs.writeFileSync(bindingFile, Buffer.from(binding, 'base64')); - ${settings.additionalFiles.reduce((code, filename, i) => { - const contents = fs.readFileSync(path.join(path.dirname(file.absPath), filename)) - return (code += ` - var file${i} = '${contents.toString('base64')}'; - var filePath${i} = path.join(cwd, bindingFileParts[0], '${filename.split('../').join('')}'); - mkdirp(path.dirname(filePath${i})); - fs.writeFileSync(filePath${i}, Buffer.from(file${i}, 'base64')); - `) - }, '')}; - process.dlopen(module, bindingFile) - ` -} diff --git a/src/compiler.ts b/src/compiler.ts index 1ecbe40..a93ef0b 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -210,7 +210,7 @@ export class NexeCompiler { let current = 0 res.on('data', data => { current += data.length - this.compileStep!.modify(`Downloading...${(current / total * 100).toFixed()}%`) + this.compileStep!.modify(`Downloading...${((current / total) * 100).toFixed()}%`) }) } ) diff --git a/src/options.ts b/src/options.ts index 538d6c7..19933ca 100644 --- a/src/options.ts +++ b/src/options.ts @@ -94,7 +94,6 @@ const alias = { 'gh-token': 'ghToken' } const argv = parseArgv(process.argv, { alias, default: { ...defaults } }) -const g = c.gray let help = ` ${c.bold('nexe [options]')} @@ -207,7 +206,8 @@ export function resolveEntry(input: string, cwd: string, maybeEntry?: string) { const inputPath = padRelative(input) result = resolveFileNameSync(cwd, inputPath) } - if (result && !result.absPath && isEntryFile(maybeEntry)) { + + if (isEntryFile(maybeEntry) && (!result || !result.absPath)) { const inputPath = padRelative(maybeEntry) result = resolveFileNameSync(cwd, inputPath) } diff --git a/src/patches/boot-nexe.ts b/src/patches/boot-nexe.ts index f47acb5..3b524b3 100644 --- a/src/patches/boot-nexe.ts +++ b/src/patches/boot-nexe.ts @@ -1,7 +1,7 @@ -const fs = require('fs') -const fd = fs.openSync(process.execPath, 'r') -const stat = fs.statSync(process.execPath) -const footer = Buffer.alloc(32, 0) +const fs = require('fs'), + fd = fs.openSync(process.execPath, 'r'), + stat = fs.statSync(process.execPath), + footer = Buffer.alloc(32, 0) fs.readSync(fd, footer, 0, 32, stat.size - 32) @@ -9,10 +9,10 @@ if (!footer.slice(0, 16).equals(Buffer.from(''))) { throw 'Invalid Nexe binary' } -const contentSize = footer.readDoubleLE(16) -const resourceSize = footer.readDoubleLE(24) -const contentStart = stat.size - 32 - resourceSize - contentSize -const resourceStart = contentStart + contentSize +const contentSize = footer.readDoubleLE(16), + resourceSize = footer.readDoubleLE(24), + contentStart = stat.size - 32 - resourceSize - contentSize, + resourceStart = contentStart + contentSize Object.defineProperty( process, @@ -25,9 +25,10 @@ Object.defineProperty( }, set: function(value: any) { if (nexeHeader) { - throw new Error('__nexe cannot be reconfigured') + throw new Error('This property is readonly') } nexeHeader = Object.assign({}, value, { + blobPath: process.execPath, layout: { stat, contentSize, @@ -44,10 +45,10 @@ Object.defineProperty( })() ) -const contentBuffer = Buffer.from(Array(contentSize)) +const contentBuffer = Buffer.from(Array(contentSize)), + Module = require('module') + fs.readSync(fd, contentBuffer, 0, contentSize, contentStart) fs.closeSync(fd) -const Module = require('module') -const mod = new Module(process.execPath, null) -mod.loaded = true -mod._compile(contentBuffer.toString(), process.execPath) + +new Module(process.execPath, null)._compile(contentBuffer.toString(), process.execPath) diff --git a/src/patches/third-party-main.ts b/src/patches/third-party-main.ts index e3d3050..1ea09e4 100644 --- a/src/patches/third-party-main.ts +++ b/src/patches/third-party-main.ts @@ -1,4 +1,5 @@ import { NexeCompiler } from '../compiler' +import { parse } from 'cherow' function semverGt(version: string, operand: string) { const [cMajor, cMinor, cPatch] = version.split('.').map(Number) @@ -11,6 +12,27 @@ function semverGt(version: string, operand: string) { ) } +function walkSome(node: any, visit: Function) { + if (!node || typeof node.type !== 'string' || node._visited) { + return false + } + visit(node) + node._visited = true + for (let childNode in node) { + const child = node[childNode] + if (Array.isArray(child)) { + for (let i = 0; i < child.length; i++) { + if (walkSome(child[i], visit)) { + return true + } + } + } else if (walkSome(child, visit)) { + return true + } + } + return false +} + export default async function main(compiler: NexeCompiler, next: () => Promise) { let bootFile = 'lib/internal/bootstrap_node.js' const { version } = compiler.target @@ -18,23 +40,31 @@ export default async function main(compiler: NexeCompiler, next: () => Promise { + if (!location.start.line && node.type === 'BlockStatement') { + //Find the first block statement and mark the location + Object.assign(location, node.loc) + return true + } + }) - if (!functionHeader) { - throw new Error('Failed to find bootstrap header in node version: v' + version) - } - - file.contents = file.contents.replace( - functionHeader, - functionHeader + '\n' + '{{replace:lib/patches/bootstrap.js}}' - ) + const fileLines = file.contents.split('\n') + fileLines.splice(location.start.line, 0, '{{replace:lib/patches/bootstrap.js}}' + '\n') + file.contents = fileLines.join('\n') await compiler.setFileContentsAsync( 'lib/_third_party_main.js', diff --git a/src/steps/download.ts b/src/steps/download.ts index 780e9e1..37693f8 100644 --- a/src/steps/download.ts +++ b/src/steps/download.ts @@ -12,7 +12,7 @@ function fetchNodeSourceAsync(dest: string, url: string, step: LogStep, options let current = 0 res.on('data', data => { current += data.length - setText(current / total * 100) + setText((current / total) * 100) if (current === total) { step.log('Extracting Node...') } diff --git a/src/steps/shim-fs.ts b/src/steps/shim-fs.ts deleted file mode 100644 index bc09cc4..0000000 --- a/src/steps/shim-fs.ts +++ /dev/null @@ -1,334 +0,0 @@ -import { Stats } from 'fs' -import { ok } from 'assert' - -const binary = (process as any).__nexe as NexeBinary -ok(binary) -const manifest = binary.resources, - directories: { [key: string]: { [key: string]: boolean } } = {}, - isString = (x: any): x is string => typeof x === 'string' || x instanceof String, - isNotFile = () => false, - isNotDirectory = isNotFile, - isFile = () => true, - noop = () => {}, - isDirectory = isFile, - fs = require('fs'), - path = require('path'), - originalExistsSync = fs.existsSync, - originalReadFile = fs.readFile, - originalReadFileSync = fs.readFileSync, - originalCreateReadStream = fs.createReadStream, - originalReaddir = fs.readdir, - originalReaddirSync = fs.readdirSync, - originalStatSync = fs.statSync, - originalStat = fs.stat, - originalRealpath = fs.realpath, - originalRealpathSync = fs.realpathSync, - resourceStart = binary.layout.resourceStart - -let log = (text: string) => { - if ((process.env.DEBUG || '').toLowerCase().includes('nexe:require')) { - process.stderr.write('[nexe] - ' + text + '\n') - } else { - log = noop - } -} - -const getKey = process.platform.startsWith('win') - ? function getKey(filepath: string): string { - let key = path.resolve(filepath) - if (key.substr(1, 2) === ':\\') { - key = key[0].toUpperCase() + key.substr(1) - } - return key - } - : path.resolve - -const statTime = function() { - const stat = binary.layout.stat - return { - dev: 0, - ino: 0, - nlink: 0, - rdev: 0, - uid: 123, - gid: 500, - blksize: 4096, - blocks: 0, - atime: new Date(stat.atime), - atimeMs: stat.atime.getTime(), - mtime: new Date(stat.mtime), - mtimeMs: stat.mtime.getTime(), - ctime: new Date(stat.ctime), - ctimMs: stat.ctime.getTime(), - birthtime: new Date(stat.birthtime), - birthtimeMs: stat.birthtime.getTime() - } -} - -const createStat = function(directoryExtensions: any, fileExtensions?: any) { - if (!fileExtensions) { - return Object.assign({}, binary.layout.stat, directoryExtensions, { size: 0 }, statTime()) - } - const size = directoryExtensions[1] - return Object.assign({}, binary.layout.stat, fileExtensions, { size }, statTime()) -} - -const ownStat = function(filepath: string) { - setupManifest() - const key = getKey(filepath) - if (directories[key]) { - return createStat({ isDirectory, isFile: isNotFile }) - } - if (manifest[key]) { - return createStat(manifest[key], { isFile, isDirectory: isNotDirectory }) - } -} - -function makeLong(filepath: string) { - return (path as any)._makeLong && (path as any)._makeLong(filepath) -} - -function fileOpts(options: any) { - return !options ? {} : isString(options) ? { encoding: options } : options -} - -let setupManifest = () => { - Object.keys(manifest).forEach(filepath => { - const entry = manifest[filepath] - const absolutePath = getKey(filepath) - const longPath = makeLong(absolutePath) - const normalizedPath = path.normalize(filepath) - - if (!manifest[absolutePath]) { - manifest[absolutePath] = entry - } - if (longPath && !manifest[longPath]) { - manifest[longPath] = entry - } - if (!manifest[normalizedPath]) { - manifest[normalizedPath] = manifest[filepath] - } - - let currentDir = path.dirname(absolutePath) - let prevDir = absolutePath - - while (currentDir !== prevDir) { - directories[currentDir] = directories[currentDir] || {} - directories[currentDir][path.basename(prevDir)] = true - const longDir = makeLong(currentDir) - if (longDir && !directories[longDir]) { - directories[longDir] = directories[currentDir] - } - prevDir = currentDir - currentDir = path.dirname(currentDir) - } - }) - setupManifest = noop -} - -//naive patches intended to work for most use cases -const nfs: any = { - existsSync: function existsSync(filepath: string) { - setupManifest() - const key = getKey(filepath) - if (manifest[key] || directories[key]) { - return true - } - return originalExistsSync.apply(fs, arguments) - }, - realpath: function realpath(filepath: any, options: any, cb: any): void { - setupManifest() - const key = getKey(filepath) - if (isString(filepath) && (manifest[filepath] || manifest[key])) { - return process.nextTick(() => cb(null, filepath)) - } - return originalRealpath.call(fs, filepath, options, cb) - }, - realpathSync: function realpathSync(filepath: any, options: any) { - setupManifest() - const key = getKey(filepath) - if (isString(filepath) && (manifest[filepath] || manifest[key])) { - return filepath - } - return originalRealpathSync.call(fs, filepath, options) - }, - readdir: function readdir(filepath: string | Buffer, options: any, callback: any) { - setupManifest() - filepath = filepath.toString() - if ('function' === typeof options) { - callback = options - options = { encoding: 'utf8' } - } - const dir = directories[getKey(filepath)] - if (dir) { - process.nextTick(() => { - //todo merge with original? - callback(null, Object.keys(dir)) - }) - } else { - return originalReaddir.apply(fs, arguments) - } - }, - - readdirSync: function readdirSync(filepath: string | Buffer, options: any) { - setupManifest() - filepath = filepath.toString() - const dir = directories[getKey(filepath)] - if (dir) { - return Object.keys(dir) - } - return originalReaddirSync.apply(fs, arguments) - }, - - readFile: function readFile(filepath: any, options: any, callback: any) { - setupManifest() - const entry = manifest[filepath] || manifest[getKey(filepath)] - if (!entry || !isString(filepath)) { - return originalReadFile.apply(fs, arguments) - } - const [offset, length] = entry - const resourceOffset = resourceStart + offset - const encoding = fileOpts(options).encoding - callback = typeof options === 'function' ? options : callback - - fs.open(process.execPath, 'r', function(err: Error, fd: number) { - if (err) return callback(err, null) - fs.read(fd, Buffer.alloc(length), 0, length, resourceOffset, function( - error: Error, - bytesRead: number, - result: Buffer - ) { - if (error) { - return fs.close(fd, function() { - callback(error, null) - }) - } - fs.close(fd, function(err: Error) { - if (err) { - return callback(err, result) - } - callback(err, encoding ? result.toString(encoding) : result) - }) - }) - }) - }, - createReadStream: function createReadStream(filepath: any, options: any) { - setupManifest() - const entry = manifest[filepath] || manifest[getKey(filepath)] - if (!entry || !isString(filepath)) { - return originalCreateReadStream.apply(fs, arguments) - } - const [offset, length] = entry - const resourceOffset = resourceStart + offset - const opts = fileOpts(options) - - return fs.createReadStream( - process.execPath, - Object.assign({}, opts, { - start: resourceOffset, - end: resourceOffset + length - 1 - }) - ) - }, - readFileSync: function readFileSync(filepath: any, options: any) { - setupManifest() - - const entry = manifest[filepath] || manifest[getKey(filepath)] - if (!entry || !isString(filepath)) { - return originalReadFileSync.apply(fs, arguments) - } - const [offset, length] = entry - const resourceOffset = resourceStart + offset - const encoding = fileOpts(options).encoding - const fd = fs.openSync(process.execPath, 'r') - const result = Buffer.alloc(length) - fs.readSync(fd, result, 0, length, resourceOffset) - fs.closeSync(fd) - return encoding ? result.toString(encoding) : result - }, - statSync: function statSync(filepath: string | Buffer) { - const stat = isString(filepath) && ownStat(filepath) - if (stat) { - return stat - } - return originalStatSync.apply(fs, arguments) - }, - stat: function stat(filepath: string | Buffer, callback: any) { - const stat = isString(filepath) && ownStat(filepath) - if (stat) { - process.nextTick(() => { - callback(null, stat) - }) - } else { - return originalStat.apply(fs, arguments) - } - } -} - -if (typeof fs.exists === 'function') { - nfs.exists = function(filepath: string, cb: Function) { - cb = cb || noop - const exists = nfs.existsSync(filepath) - process.nextTick(() => cb(exists)) - } -} -Object.assign(fs, nfs) - -const patches = (process as any).nexe.patches -if (!patches) { - throw new Error('Your cached build is out of date!\nUse --clean to get a new build.\n') -} - -delete (process as any).nexe - -patches.internalModuleReadFile = function(this: any, original: any, ...args: any[]) { - const [filepath] = args - setupManifest() - if (manifest[filepath]) { - log('read (hit) ' + filepath) - return nfs.readFileSync(filepath, 'utf-8') - } - log('read (miss) ' + filepath) - return original.call(this, ...args) -} -patches.internalModuleStat = function(this: any, original: any, ...args: any[]) { - setupManifest() - const [filepath] = args - if (manifest[filepath]) { - log('stat (hit) ' + filepath + ' ' + 0) - return 0 - } - if (directories[filepath]) { - log('stat dir (hit) ' + filepath + ' ' + 1) - return 1 - } - const res = original.call(this, ...args) - if (res === 0) { - log('stat (miss) ' + filepath + ' ' + res) - } else if (res === 1) { - log('stat dir (miss) ' + filepath + ' ' + res) - } else { - log('stat (fail) ' + filepath + ' ' + res) - } - return res -} - -if (typeof fs.exists === 'function') { - nfs.exists = function(filepath: string, cb: Function) { - cb = cb || noop - const exists = nfs.existsSync(filepath) - process.nextTick(() => cb(exists)) - } -} -Object.assign(fs, nfs) - -interface NexeBinary { - resources: { [key: string]: number[] } - layout: { - stat: Stats - contentSize: number - contentStart: number - resourceSize: number - resourceStart: number - } -} diff --git a/src/steps/shim.ts b/src/steps/shim.ts index c3075bb..5b6c337 100644 --- a/src/steps/shim.ts +++ b/src/steps/shim.ts @@ -4,9 +4,12 @@ import { wrap } from '../util' export default function(compiler: NexeCompiler, next: () => Promise) { compiler.shims.push( - wrap(`process.__nexe=${JSON.stringify({ resources: compiler.resources.index })};`) + wrap( + `process.__nexe = ${JSON.stringify({ resources: compiler.resources.index })};\n` + + '{{replace:lib/bundle/fs/patch.js}}' + + '\nshimFs(process.__nexe, require("fs"))' + ) ) - compiler.shims.push(wrap('{{replace:lib/steps/shim-fs.js}}')) compiler.shims.push( wrap(` if (process.argv[1] && process.env.NODE_UNIQUE_ID) { diff --git a/src/target.ts b/src/target.ts index b916b85..07b95ba 100644 --- a/src/target.ts +++ b/src/target.ts @@ -1,8 +1,8 @@ export type NodePlatform = 'windows' | 'mac' | 'alpine' | 'linux' -export type NodeArch = 'x86' | 'x64' | 'arm7l' | 'arm6' +export type NodeArch = 'x86' | 'x64' | 'arm7l' | 'arm6l' | 'arm64' const platforms: NodePlatform[] = ['windows', 'mac', 'alpine', 'linux'], - architectures: NodeArch[] = ['x86', 'x64', 'arm7l', 'arm6'] + architectures: NodeArch[] = ['x86', 'x64', 'arm7l', 'arm6l', 'arm64'] export { platforms, architectures } @@ -12,7 +12,6 @@ export interface NexeTarget { arch: NodeArch | string } -//TODO bsd const prettyPlatform: { [key: string]: NodePlatform } = { win32: 'windows', windows: 'windows', @@ -27,7 +26,9 @@ const prettyPlatform: { [key: string]: NodePlatform } = { const prettyArch: { [key: string]: NodeArch } = { x86: 'x86', - arm6: 'arm6', + arm6: 'arm6l', + arm64: 'arm64', + arm6l: 'arm6l', arm: 'arm7l', arm7: 'arm7l', arm7l: 'arm7l', diff --git a/tasks/asset-compile.ts b/tasks/asset-compile.ts index 2c9d399..547b71c 100644 --- a/tasks/asset-compile.ts +++ b/tasks/asset-compile.ts @@ -3,15 +3,13 @@ import { getUnBuiltReleases, getLatestGitRelease } from '../lib/releases' import * as ci from './ci' import { runDockerBuild } from './docker' import { getTarget } from '../lib/target' -import { pathExistsAsync, statAsync, readFileAsync, execFileAsync } from '../lib/util' +import { pathExistsAsync, readFileAsync, execFileAsync } from '../lib/util' import got = require('got') const env = process.env, branchName = env.CIRCLE_BRANCH || env.APPVEYOR_REPO_BRANCH || env.TRAVIS_BRANCH || '', isScheduled = Boolean(env.APPVEYOR_SCHEDULED_BUILD || env.NEXE_TRIGGERED), - isLinux = Boolean(env.TRAVIS), isWindows = Boolean(env.APPVEYOR), - isMac = Boolean(env.CIRCLECI), isPullRequest = Boolean(env.CIRCLE_PR_NUMBER) || Boolean(env.APPVEYOR_PULL_REQUEST_NUMBER) || @@ -49,9 +47,9 @@ async function build() { if (windowsBuild) { await ci.triggerWindowsBuild(windowsBuild) } - } + } - if (env.NEXE_VERSION) { + if (env.NEXE_VERSION) { const target = getTarget(env.NEXE_VERSION), output = isWindows ? './out.exe' : './out', options = { @@ -62,7 +60,7 @@ async function build() { } console.log('Building: ', target) const stop = keepalive() - if (['arm71', 'alpine'].indexOf(target.platform)) { + if (['arm7l', 'arm6l', 'arm64', 'alpine'].indexOf(target.platform)) { await runDockerBuild(target) } else { await nexe.compile(options) diff --git a/tasks/ci.ts b/tasks/ci.ts index 5134557..245c40a 100644 --- a/tasks/ci.ts +++ b/tasks/ci.ts @@ -1,7 +1,7 @@ import { NexeTarget } from '../lib/releases' import got = require('got') import * as assert from 'assert' -import { getTarget } from '../lib/target'; +import { getTarget } from '../lib/target' const { env } = process export function triggerMacBuild(release: NexeTarget, branch: string) { diff --git a/tasks/post-build.ts b/tasks/post-build.ts index 99f4aea..f34a09e 100644 --- a/tasks/post-build.ts +++ b/tasks/post-build.ts @@ -1,7 +1,7 @@ import { writeFileSync, readFileSync } from 'fs' /** - * post build step to insert code files into code files. + * post build step to insert code files into code files (naively). * '{{replace:path/to/file}}' => "file contents" * And the package.json version. */ @@ -10,6 +10,8 @@ inject('lib/patches/third-party-main.js') inject('lib/steps/shim.js') inject('lib/options.js', JSON.stringify(require('../package.json').version)) +cp('src/bundle/fs/package.json', 'lib/bundle/fs/package.json') + function inject(filename: string, ...replacements: string[]) { let contents = readFileSync(filename, 'utf8') contents = contents.replace(/('{{(.*)}}')/g, (substring: string, ...matches: string[]) => { @@ -26,3 +28,9 @@ function inject(filename: string, ...replacements: string[]) { writeFileSync(filename, contents) console.log(`Wrote: ${filename}`) } + +function cp(from: string, to: string) { + const file = readFileSync(from) + writeFileSync(to, file) + console.log('Copied: ', from, 'To: ', to) +} diff --git a/tsconfig.json b/tsconfig.json index d0bf374..d75b514 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "target":"es5", + "skipLibCheck": true, "experimentalDecorators": true, "lib": ["es2017"], "module": "commonjs",