diff --git a/cypress.json b/cypress.json deleted file mode 100644 index 7288d9f..0000000 --- a/cypress.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "baseUrl": "http://localhost:3000", - "videoRecording": false, - "fixturesFolder": "test/cypress/fixtures", - "integrationFolder": "test/cypress/integration", - "pluginsFile": false, - "screenshotsFolder": "test/cypress/screenshots", - "supportFile": "test/cypress/support/index.js" -} diff --git a/mocha.opts b/mocha.opts index 985f08b..e793278 100644 --- a/mocha.opts +++ b/mocha.opts @@ -2,4 +2,4 @@ --require ts-node/register --recursive test/unit/*/*.ts -test/common/test.js \ No newline at end of file +test/apps/*/__test__.ts \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 568af3a..8a86dca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "sapper", - "version": "0.22.3", + "version": "0.22.10", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -10,6 +10,12 @@ "integrity": "sha1-MU+BaPUK5IoDLP2tX9tDb0ZKl6w=", "dev": true }, + "@polka/url": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@polka/url/-/url-0.5.0.tgz", + "integrity": "sha512-oZLYFEAzUKyi3SKnXvj32ZCEGH6RDnao7COuCVhDydMS9NrCSVXhM79VaKyP5+Zc33m0QXEd2DN3UkU7OsHcfw==", + "dev": true + }, "@types/estree": { "version": "0.0.39", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", @@ -55,11 +61,20 @@ "dev": true }, "@types/node": { - "version": "10.11.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.11.3.tgz", - "integrity": "sha512-3AvcEJAh9EMatxs+OxAlvAEs7OTy6AG94mcH1iqyVDwVVndekLxzwkWQ/Z4SDbY6GO2oyUXyWW8tQ4rENSSQVQ==", + "version": "10.11.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.11.4.tgz", + "integrity": "sha512-ojnbBiKkZFYRfQpmtnnWTMw+rzGp/JiystjluW9jgN3VzRwilXddJ6aGQ9V/7iuDG06SBgn7ozW9k3zcAnYjYQ==", "dev": true }, + "@types/puppeteer": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@types/puppeteer/-/puppeteer-1.9.0.tgz", + "integrity": "sha512-ZP3wL4Lqpgu4xZbz/0vQhbIZnllNEawVW3oTpEXyJg+uhf/YQgL8oeTrfoUwj9JXE9UUe53eqmgLl29/d2gjqQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/rimraf": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@types/rimraf/-/rimraf-2.0.2.tgz", @@ -254,16 +269,6 @@ "integrity": "sha512-FZdkNBDqBRHKQ2MEbSC17xnPFOhZxeJ2YGSfr2BKf3sujG49Qe3bB+rGCwQfIaA7WHnGeGkSijX4FuBCdrzW/g==", "dev": true }, - "accepts": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", - "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", - "dev": true, - "requires": { - "mime-types": "~2.1.18", - "negotiator": "0.6.1" - } - }, "acorn": { "version": "5.7.3", "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", @@ -318,6 +323,15 @@ } } }, + "agent-base": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", + "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", + "dev": true, + "requires": { + "es6-promisify": "^5.0.0" + } + }, "ajv": { "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", @@ -682,18 +696,6 @@ "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=", "dev": true }, - "array-find-index": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", - "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", - "dev": true - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", - "dev": true - }, "array-map": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", @@ -733,15 +735,6 @@ "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "dev": true }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "dev": true, - "requires": { - "safer-buffer": "~2.1.0" - } - }, "asn1.js": { "version": "4.10.1", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", @@ -779,12 +772,6 @@ } } }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - }, "assign-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", @@ -797,10 +784,10 @@ "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", "dev": true }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", "dev": true }, "atob": { @@ -809,18 +796,6 @@ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", "dev": true }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true - }, - "aws4": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", - "dev": true - }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -935,16 +910,6 @@ "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", "dev": true }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "dev": true, - "optional": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, "big.js": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", @@ -969,32 +934,6 @@ "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", "dev": true }, - "body-parser": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", - "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", - "dev": true, - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.1", - "http-errors": "~1.6.2", - "iconv-lite": "0.4.19", - "on-finished": "~2.3.0", - "qs": "6.5.1", - "raw-body": "2.3.2", - "type-is": "~1.6.15" - }, - "dependencies": { - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", - "dev": true - } - } - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1133,12 +1072,6 @@ "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", "dev": true }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", - "dev": true - }, "cacache": { "version": "10.0.4", "resolved": "https://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz", @@ -1209,28 +1142,6 @@ "upper-case": "^1.1.1" } }, - "camelcase": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", - "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", - "dev": true - }, - "camelcase-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", - "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", - "dev": true, - "requires": { - "camelcase": "^2.0.0", - "map-obj": "^1.0.0" - } - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true - }, "chalk": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", @@ -1476,24 +1387,12 @@ "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", "dev": true }, - "clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", - "dev": true - }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", "dev": true }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, "collection-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", @@ -1519,15 +1418,6 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, - "combined-stream": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", - "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, "commander": { "version": "2.17.1", "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", @@ -1551,30 +1441,6 @@ "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", "dev": true }, - "compressible": { - "version": "2.0.15", - "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.15.tgz", - "integrity": "sha512-4aE67DL33dSW9gw4CI2H/yTxqHLNcxp0yS6jB+4h+wr3e43+1z7vm0HU9qXOH8j+qjKuL8+UtkOxYQSMq60Ylw==", - "dev": true, - "requires": { - "mime-db": ">= 1.36.0 < 2" - } - }, - "compression": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.3.tgz", - "integrity": "sha512-HSjyBG5N1Nnz7tF2+O7A9XUhyjru71/fwgNb7oIsEVHR0WShfs2tIS/EySLgiTe98aOK18YDlMXpzjCXY/n9mg==", - "dev": true, - "requires": { - "accepts": "~1.3.5", - "bytes": "3.0.0", - "compressible": "~2.0.14", - "debug": "2.6.9", - "on-headers": "~1.0.1", - "safe-buffer": "5.1.2", - "vary": "~1.1.2" - } - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1614,30 +1480,12 @@ "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", "dev": true }, - "content-disposition": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", - "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=", - "dev": true - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", - "dev": true - }, "cookie": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", "dev": true }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=", - "dev": true - }, "copy-concurrently": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", @@ -1731,30 +1579,12 @@ "randomfill": "^1.0.3" } }, - "currently-unhandled": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", - "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", - "dev": true, - "requires": { - "array-find-index": "^1.0.1" - } - }, "cyclist": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-0.2.2.tgz", "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=", "dev": true }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, "date-now": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", @@ -1770,48 +1600,18 @@ "ms": "2.0.0" } }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, "decode-uri-component": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", "dev": true }, - "deep-defaults": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/deep-defaults/-/deep-defaults-1.0.5.tgz", - "integrity": "sha512-5ev/sNkiHTmeTqbDJEDgdQa/Ub0eOMQNix9l+dLLGbwOos7/in5HdvHXI014wqxsET4YeJG9Eq4qj0PJRL8rSw==", - "dev": true, - "requires": { - "lodash": "^4.17.5" - } - }, - "deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true - }, "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, - "defaults": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", - "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", - "dev": true, - "requires": { - "clone": "^1.0.2" - } - }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -1897,18 +1697,6 @@ "rimraf": "^2.2.8" } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "dev": true - }, "des.js": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", @@ -1919,12 +1707,6 @@ "minimalistic-assert": "^1.0.0" } }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", - "dev": true - }, "devalue": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/devalue/-/devalue-1.0.4.tgz", @@ -1981,67 +1763,6 @@ "stream-shift": "^1.0.0" } }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "dev": true, - "optional": true, - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", - "dev": true - }, - "electron": { - "version": "1.8.8", - "resolved": "https://registry.npmjs.org/electron/-/electron-1.8.8.tgz", - "integrity": "sha512-1f9zJehcTTGjrkb06o6ds+gsRq6SYhZJyxOk6zIWjRH8hVy03y/RzUDELzNas71f5vcvXmfGVvyjeEsadDI8tg==", - "dev": true, - "requires": { - "@types/node": "^8.0.24", - "electron-download": "^3.0.1", - "extract-zip": "^1.0.3" - }, - "dependencies": { - "@types/node": { - "version": "8.10.30", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.30.tgz", - "integrity": "sha512-Le8HGMI5gjFSBqcCuKP/wfHC19oURzkU2D+ERIescUoJd+CmNEMYBib9LQ4zj1HHEZOJQWhw2ZTnbD8weASh/Q==", - "dev": true - } - } - }, - "electron-download": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/electron-download/-/electron-download-3.3.0.tgz", - "integrity": "sha1-LP1U1pZsAZxNSa1l++Zcyc3vaMg=", - "dev": true, - "requires": { - "debug": "^2.2.0", - "fs-extra": "^0.30.0", - "home-path": "^1.0.1", - "minimist": "^1.2.0", - "nugget": "^2.0.0", - "path-exists": "^2.1.0", - "rc": "^1.1.2", - "semver": "^5.3.0", - "sumchecker": "^1.2.0" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } - } - }, "elliptic": { "version": "6.4.1", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", @@ -2063,12 +1784,6 @@ "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", "dev": true }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", - "dev": true - }, "end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", @@ -2089,29 +1804,6 @@ "tapable": "^1.0.0" } }, - "enqueue": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/enqueue/-/enqueue-1.0.2.tgz", - "integrity": "sha1-kBTpvOVw7pPKlubI5jrVTBkra8g=", - "dev": true, - "requires": { - "sliced": "0.0.5" - }, - "dependencies": { - "sliced": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/sliced/-/sliced-0.0.5.tgz", - "integrity": "sha1-XtwETKTrb3gW1Qui/GPiXY/kcH8=", - "dev": true - } - } - }, - "ensure-posix-path": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/ensure-posix-path/-/ensure-posix-path-1.0.2.tgz", - "integrity": "sha1-pls+QtC3HPxYXrd0+ZQ8jZuRsMI=", - "dev": true - }, "errno": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", @@ -2160,11 +1852,14 @@ "integrity": "sha512-n6wvpdE43VFtJq+lUDYDBFUwV8TZbuGXLV4D6wKafg13ldznKsyEvatubnmUe31zcvelSzOHF+XbaT+Bl9ObDg==", "dev": true }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", - "dev": true + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "dev": true, + "requires": { + "es6-promise": "^4.0.3" + } }, "escape-string-regexp": { "version": "1.0.5", @@ -2353,12 +2048,6 @@ "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", "dev": true }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", - "dev": true - }, "event-stream": { "version": "3.3.6", "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.6.tgz", @@ -2409,58 +2098,6 @@ "fill-range": "^2.1.0" } }, - "express": { - "version": "4.16.3", - "resolved": "http://registry.npmjs.org/express/-/express-4.16.3.tgz", - "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", - "dev": true, - "requires": { - "accepts": "~1.3.5", - "array-flatten": "1.1.1", - "body-parser": "1.18.2", - "content-disposition": "0.5.2", - "content-type": "~1.0.4", - "cookie": "0.3.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.1.1", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.3", - "qs": "6.5.1", - "range-parser": "~1.2.0", - "safe-buffer": "5.1.1", - "send": "0.16.2", - "serve-static": "1.13.2", - "setprototypeof": "1.1.0", - "statuses": "~1.4.0", - "type-is": "~1.6.16", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - } - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, "extend-shallow": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", @@ -2514,12 +2151,6 @@ "yauzl": "2.4.1" } }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true - }, "fast-deep-equal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", @@ -2585,21 +2216,6 @@ "repeat-string": "^1.5.2" } }, - "finalhandler": { - "version": "1.1.1", - "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", - "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", - "dev": true, - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.4.0", - "unpipe": "~1.0.0" - } - }, "find-cache-dir": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-1.0.0.tgz", @@ -2654,9 +2270,9 @@ } }, "flatmap-stream": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/flatmap-stream/-/flatmap-stream-0.1.0.tgz", - "integrity": "sha512-Nlic4ZRYxikqnK5rj3YoxDVKGGtUjcNDUtvQ7XsdGLZmMwdUYnXf10o1zcXtzEZTBgc6GxeRpQxV/Wu3WPIIHA==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/flatmap-stream/-/flatmap-stream-0.1.1.tgz", + "integrity": "sha512-lAq4tLbm3sidmdCN8G3ExaxH7cUCtP5mgDvrYowsx84dcYkJJ4I28N7gkxA6+YlSXzaGLJYIDEi9WGfXzMiXdw==", "dev": true }, "flush-write-stream": { @@ -2684,40 +2300,6 @@ "for-in": "^1.0.1" } }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true - }, - "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "1.0.6", - "mime-types": "^2.1.12" - }, - "dependencies": { - "combined-stream": { - "version": "1.0.6", - "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - } - } - }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", - "dev": true - }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -2727,12 +2309,6 @@ "map-cache": "^0.2.2" } }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", - "dev": true - }, "from": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", @@ -2749,19 +2325,6 @@ "readable-stream": "^2.0.0" } }, - "fs-extra": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", - "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0", - "path-is-absolute": "^1.0.0", - "rimraf": "^2.2.8" - } - }, "fs-write-stream-atomic": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", @@ -2793,24 +2356,28 @@ "dependencies": { "abbrev": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true, "optional": true }, "ansi-regex": { "version": "2.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, "aproba": { "version": "1.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "dev": true, "optional": true }, "are-we-there-yet": { "version": "1.1.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz", + "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", "dev": true, "optional": true, "requires": { @@ -2820,12 +2387,14 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, "brace-expansion": { "version": "1.1.11", - "bundled": true, + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { "balanced-match": "^1.0.0", @@ -2834,34 +2403,40 @@ }, "chownr": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.0.1.tgz", + "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", "dev": true, "optional": true }, "code-point-at": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, "concat-map": { "version": "0.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "dev": true }, "core-util-is": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true, "optional": true }, "debug": { "version": "2.6.9", - "bundled": true, + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, "optional": true, "requires": { @@ -2870,25 +2445,29 @@ }, "deep-extend": { "version": "0.5.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.1.tgz", + "integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==", "dev": true, "optional": true }, "delegates": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "dev": true, "optional": true }, "detect-libc": { "version": "1.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", "dev": true, "optional": true }, "fs-minipass": { "version": "1.2.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", + "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", "dev": true, "optional": true, "requires": { @@ -2897,13 +2476,15 @@ }, "fs.realpath": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true, "optional": true }, "gauge": { "version": "2.7.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "dev": true, "optional": true, "requires": { @@ -2919,7 +2500,8 @@ }, "glob": { "version": "7.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "optional": true, "requires": { @@ -2933,13 +2515,15 @@ }, "has-unicode": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", "dev": true, "optional": true }, "iconv-lite": { "version": "0.4.21", - "bundled": true, + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.21.tgz", + "integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==", "dev": true, "optional": true, "requires": { @@ -2948,7 +2532,8 @@ }, "ignore-walk": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", + "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", "dev": true, "optional": true, "requires": { @@ -2957,7 +2542,8 @@ }, "inflight": { "version": "1.0.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "optional": true, "requires": { @@ -2967,18 +2553,21 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, "ini": { "version": "1.3.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true, "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { "number-is-nan": "^1.0.0" @@ -2986,13 +2575,15 @@ }, "isarray": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true, "optional": true }, "minimatch": { "version": "3.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { "brace-expansion": "^1.1.7" @@ -3000,12 +2591,14 @@ }, "minimist": { "version": "0.0.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "minipass": { "version": "2.2.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.2.4.tgz", + "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", "dev": true, "requires": { "safe-buffer": "^5.1.1", @@ -3014,7 +2607,8 @@ }, "minizlib": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.1.0.tgz", + "integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==", "dev": true, "optional": true, "requires": { @@ -3023,7 +2617,8 @@ }, "mkdirp": { "version": "0.5.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { "minimist": "0.0.8" @@ -3031,13 +2626,15 @@ }, "ms": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true, "optional": true }, "needle": { "version": "2.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/needle/-/needle-2.2.0.tgz", + "integrity": "sha512-eFagy6c+TYayorXw/qtAdSvaUpEbBsDwDyxYFgLZ0lTojfH7K+OdBqAF7TAFwDokJaGpubpSGG0wO3iC0XPi8w==", "dev": true, "optional": true, "requires": { @@ -3048,7 +2645,8 @@ }, "node-pre-gyp": { "version": "0.10.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.10.0.tgz", + "integrity": "sha512-G7kEonQLRbcA/mOoFoxvlMrw6Q6dPf92+t/l0DFSMuSlDoWaI9JWIyPwK0jyE1bph//CUEL65/Fz1m2vJbmjQQ==", "dev": true, "optional": true, "requires": { @@ -3066,7 +2664,8 @@ }, "nopt": { "version": "4.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "dev": true, "optional": true, "requires": { @@ -3076,13 +2675,15 @@ }, "npm-bundled": { "version": "1.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.3.tgz", + "integrity": "sha512-ByQ3oJ/5ETLyglU2+8dBObvhfWXX8dtPZDMePCahptliFX2iIuhyEszyFk401PZUNQH20vvdW5MLjJxkwU80Ow==", "dev": true, "optional": true }, "npm-packlist": { "version": "1.1.10", - "bundled": true, + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.1.10.tgz", + "integrity": "sha512-AQC0Dyhzn4EiYEfIUjCdMl0JJ61I2ER9ukf/sLxJUcZHfo+VyEfz2rMJgLZSS1v30OxPQe1cN0LZA1xbcaVfWA==", "dev": true, "optional": true, "requires": { @@ -3092,7 +2693,8 @@ }, "npmlog": { "version": "4.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "dev": true, "optional": true, "requires": { @@ -3104,18 +2706,21 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, "object-assign": { "version": "4.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true, "optional": true }, "once": { "version": "1.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { "wrappy": "1" @@ -3123,19 +2728,22 @@ }, "os-homedir": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true, "optional": true }, "os-tmpdir": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true, "optional": true }, "osenv": { "version": "0.1.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "dev": true, "optional": true, "requires": { @@ -3145,19 +2753,22 @@ }, "path-is-absolute": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true, "optional": true }, "process-nextick-args": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "dev": true, "optional": true }, "rc": { "version": "1.2.7", - "bundled": true, + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.7.tgz", + "integrity": "sha512-LdLD8xD4zzLsAT5xyushXDNscEjB7+2ulnl8+r1pnESlYtlJtVSoCMBGr30eDRJ3+2Gq89jK9P9e4tCEH1+ywA==", "dev": true, "optional": true, "requires": { @@ -3169,7 +2780,8 @@ "dependencies": { "minimist": { "version": "1.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true, "optional": true } @@ -3177,7 +2789,8 @@ }, "readable-stream": { "version": "2.3.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "optional": true, "requires": { @@ -3192,7 +2805,8 @@ }, "rimraf": { "version": "2.6.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "optional": true, "requires": { @@ -3201,42 +2815,49 @@ }, "safe-buffer": { "version": "5.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", "dev": true }, "safer-buffer": { "version": "2.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true, "optional": true }, "sax": { "version": "1.2.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "dev": true, "optional": true }, "semver": { "version": "5.5.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", "dev": true, "optional": true }, "set-blocking": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true, "optional": true }, "signal-exit": { "version": "3.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true, "optional": true }, "string-width": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { "code-point-at": "^1.0.0", @@ -3246,7 +2867,8 @@ }, "string_decoder": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "optional": true, "requires": { @@ -3255,7 +2877,8 @@ }, "strip-ansi": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { "ansi-regex": "^2.0.0" @@ -3263,13 +2886,15 @@ }, "strip-json-comments": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true, "optional": true }, "tar": { "version": "4.4.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.1.tgz", + "integrity": "sha512-O+v1r9yN4tOsvl90p5HAP4AEqbYhx4036AGMm075fH9F8Qwi3oJ+v4u50FkT/KkvywNGtwkk0zRI+8eYm1X/xg==", "dev": true, "optional": true, "requires": { @@ -3284,13 +2909,15 @@ }, "util-deprecate": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true, "optional": true }, "wide-align": { "version": "1.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", + "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", "dev": true, "optional": true, "requires": { @@ -3299,12 +2926,14 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, "yallist": { "version": "3.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz", + "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=", "dev": true } } @@ -3315,39 +2944,18 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, - "function-source": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/function-source/-/function-source-0.1.0.tgz", - "integrity": "sha1-2RBL8+RniLVUaMAr8bL6vPj8Ga8=", - "dev": true - }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, - "get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", - "dev": true - }, "get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", "dev": true }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, "glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", @@ -3382,9 +2990,9 @@ } }, "globals": { - "version": "11.7.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz", - "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==", + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.8.0.tgz", + "integrity": "sha512-io6LkyPVuzCHBSQV9fmOwxZkUk6nIaGmxheLDgmuFv89j0fm2aqDbIXKAGfzCMHqz3HLF2Zf8WSG6VqMh2qFmA==", "dev": true }, "globalyzer": { @@ -3425,22 +3033,6 @@ "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true - }, - "har-validator": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", - "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", - "dev": true, - "requires": { - "ajv": "^5.3.0", - "har-schema": "^2.0.0" - } - }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -3567,12 +3159,6 @@ "minimalistic-crypto-utils": "^1.0.1" } }, - "home-path": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/home-path/-/home-path-1.0.6.tgz", - "integrity": "sha512-wo+yjrdAtoXt43Vy92a+0IPCYViiyLAHyp0QVS4xL/tfvVz5sXIW1ubLZk3nhVkD92fQpUMKX+fzMjr5F489vw==", - "dev": true - }, "hosted-git-info": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", @@ -3593,35 +3179,39 @@ "uglify-js": "3.4.x" } }, - "http-errors": { - "version": "1.6.3", - "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", - "dev": true, - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - } - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, "https-browserify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", "dev": true }, + "https-proxy-agent": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", + "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", + "dev": true, + "requires": { + "agent-base": "^4.1.0", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.5.tgz", + "integrity": "sha512-D61LaDQPQkxJ5AUM2mbSJRbPkNs/TmdmOeLAi1hgDkpDfIfetSrjmWhccwtuResSwMbACjx/xXQofvM9CE/aeg==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -3655,15 +3245,6 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, - "indent-string": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", - "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", - "dev": true, - "requires": { - "repeating": "^2.0.0" - } - }, "indexof": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", @@ -3686,12 +3267,6 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, - "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", - "dev": true - }, "inquirer": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", @@ -3714,12 +3289,6 @@ "through": "^2.3.6" } }, - "ipaddr.js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", - "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=", - "dev": true - }, "is-accessor-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", @@ -3826,15 +3395,6 @@ "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", "dev": true }, - "is-finite": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", - "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", @@ -3948,18 +3508,6 @@ "has-symbols": "^1.0.0" } }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true - }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true - }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -3987,12 +3535,6 @@ "isarray": "1.0.0" } }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true - }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", @@ -4009,31 +3551,12 @@ "esprima": "^4.0.0" } }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true, - "optional": true - }, - "jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", - "dev": true - }, "json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "dev": true }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true - }, "json-schema-traverse": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", @@ -4046,51 +3569,18 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true - }, "json5": { "version": "0.5.1", "resolved": "http://registry.npmjs.org/json5/-/json5-0.5.1.tgz", "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", "dev": true }, - "jsonfile": { - "version": "2.4.0", - "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, "jsonify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", "dev": true }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "keypress": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz", - "integrity": "sha1-SjGI1CkbZrT2XtuZ+AaqmuKTWSo=", - "dev": true - }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -4100,15 +3590,6 @@ "is-buffer": "^1.1.5" } }, - "klaw": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", - "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.9" - } - }, "kleur": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/kleur/-/kleur-2.0.2.tgz", @@ -4184,16 +3665,6 @@ "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", "dev": true }, - "loud-rejection": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", - "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", - "dev": true, - "requires": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" - } - }, "lower-case": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", @@ -4247,12 +3718,6 @@ "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", "dev": true }, - "map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true - }, "map-stream": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz", @@ -4268,15 +3733,6 @@ "object-visit": "^1.0.0" } }, - "matcher-collection": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/matcher-collection/-/matcher-collection-1.0.5.tgz", - "integrity": "sha512-nUCmzKipcJEwYsBVAFh5P+d7JBuhJaW1xs85Hara9xuMLqtCVUrW6DSC0JVIkluxEH2W45nPBM/wjHtBXa/tYA==", - "dev": true, - "requires": { - "minimatch": "^3.0.2" - } - }, "matchit": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/matchit/-/matchit-1.0.6.tgz", @@ -4293,21 +3749,16 @@ "dev": true }, "md5.js": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", - "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", "dev": true, "requires": { "hash-base": "^3.0.0", - "inherits": "^2.0.1" + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" } }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", - "dev": true - }, "memory-fs": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", @@ -4324,98 +3775,6 @@ "integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=", "dev": true }, - "meow": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", - "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", - "dev": true, - "requires": { - "camelcase-keys": "^2.0.0", - "decamelize": "^1.1.2", - "loud-rejection": "^1.0.0", - "map-obj": "^1.0.1", - "minimist": "^1.1.3", - "normalize-package-data": "^2.3.4", - "object-assign": "^4.0.1", - "read-pkg-up": "^1.0.1", - "redent": "^1.0.0", - "trim-newlines": "^1.0.0" - }, - "dependencies": { - "load-json-file": { - "version": "1.1.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - } - }, - "minimist": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - }, - "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", - "dev": true, - "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", - "dev": true, - "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - } - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dev": true, - "requires": { - "is-utf8": "^0.2.0" - } - } - } - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", - "dev": true - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", - "dev": true - }, "micromatch": { "version": "2.3.11", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", @@ -4447,27 +3806,6 @@ "brorand": "^1.0.1" } }, - "mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==", - "dev": true - }, - "mime-db": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", - "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==", - "dev": true - }, - "mime-types": { - "version": "2.1.20", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", - "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", - "dev": true, - "requires": { - "mime-db": "~1.36.0" - } - }, "mimic-fn": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", @@ -4501,26 +3839,6 @@ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, - "minstache": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minstache/-/minstache-1.2.0.tgz", - "integrity": "sha1-/xzEA6woRPaNvxjGYhKb5+sO/EE=", - "dev": true, - "requires": { - "commander": "1.0.4" - }, - "dependencies": { - "commander": { - "version": "1.0.4", - "resolved": "http://registry.npmjs.org/commander/-/commander-1.0.4.tgz", - "integrity": "sha1-Xt6xruI8T7VBprcNaSq+8ZZpotM=", - "dev": true, - "requires": { - "keypress": "0.1.x" - } - } - } - }, "mississippi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-2.0.0.tgz", @@ -4672,15 +3990,6 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "multiline": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/multiline/-/multiline-1.0.2.tgz", - "integrity": "sha1-abHyX/B00oKJBPJE3dBrfZbvbJM=", - "dev": true, - "requires": { - "strip-indent": "^1.0.0" - } - }, "mute-stream": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", @@ -4739,12 +4048,6 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "negotiator": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=", - "dev": true - }, "neo-async": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.5.2.tgz", @@ -4757,28 +4060,6 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, - "nightmare": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/nightmare/-/nightmare-3.0.1.tgz", - "integrity": "sha512-WptvyPfp5mHRRYHzt6+4xazaR9cc437BuLJI6cLFnqwwgxgdtsFImfBVDeTUCPAeLrkp5VryX5jlw7Wwg+UnFQ==", - "dev": true, - "requires": { - "debug": "^2.2.0", - "deep-defaults": "^1.0.3", - "defaults": "^1.0.2", - "electron": "^1.8.4", - "enqueue": "^1.0.2", - "function-source": "^0.1.0", - "jsesc": "^0.5.0", - "minstache": "^1.2.0", - "mkdirp": "^0.5.1", - "multiline": "^1.0.2", - "once": "^1.3.3", - "rimraf": "^2.4.3", - "sliced": "1.0.1", - "split2": "^2.0.1" - } - }, "no-case": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", @@ -4934,51 +4215,6 @@ } } }, - "nugget": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/nugget/-/nugget-2.0.1.tgz", - "integrity": "sha1-IBCVpIfhrTYIGzQy+jytpPjQcbA=", - "dev": true, - "requires": { - "debug": "^2.1.3", - "minimist": "^1.1.0", - "pretty-bytes": "^1.0.2", - "progress-stream": "^1.1.0", - "request": "^2.45.0", - "single-line-log": "^1.1.2", - "throttleit": "0.0.2" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - }, - "pretty-bytes": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", - "integrity": "sha1-CiLoIQYJrTVUL4yNXSFZr/B1HIQ=", - "dev": true, - "requires": { - "get-stdin": "^4.0.1", - "meow": "^3.1.0" - } - } - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "dev": true - }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -5007,12 +4243,6 @@ } } }, - "object-keys": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz", - "integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=", - "dev": true - }, "object-visit": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", @@ -5057,21 +4287,6 @@ } } }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "dev": true, - "requires": { - "ee-first": "1.1.1" - } - }, - "on-headers": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.1.tgz", - "integrity": "sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c=", - "dev": true - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -5271,12 +4486,6 @@ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=", - "dev": true - }, "path-type": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", @@ -5314,12 +4523,6 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true - }, "pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -5423,31 +4626,17 @@ "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", "dev": true }, - "progress-stream": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/progress-stream/-/progress-stream-1.2.0.tgz", - "integrity": "sha1-LNPP6jO6OonJwSHsM0er6asSX3c=", - "dev": true, - "requires": { - "speedometer": "~0.1.2", - "through2": "~0.2.3" - } - }, "promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", "dev": true }, - "proxy-addr": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", - "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", - "dev": true, - "requires": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.8.0" - } + "proxy-from-env": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz", + "integrity": "sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4=", + "dev": true }, "prr": { "version": "1.0.1", @@ -5470,23 +4659,18 @@ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, - "psl": { - "version": "1.1.29", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", - "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", - "dev": true - }, "public-encrypt": { - "version": "4.0.2", - "resolved": "http://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.2.tgz", - "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", "dev": true, "requires": { "bn.js": "^4.1.0", "browserify-rsa": "^4.0.0", "create-hash": "^1.1.0", "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1" + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" } }, "pump": { @@ -5516,11 +4700,44 @@ "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", "dev": true }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", - "dev": true + "puppeteer": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0.tgz", + "integrity": "sha512-GH4PmhJf9wBRAPvtJkEJLAvdNNOofZortmBZSj8cGWYni98GUFqsf66blOEfJbo5B8l0KG5HR2d/W2MejnUrzg==", + "dev": true, + "requires": { + "debug": "^3.1.0", + "extract-zip": "^1.6.6", + "https-proxy-agent": "^2.2.1", + "mime": "^2.0.3", + "progress": "^2.0.0", + "proxy-from-env": "^1.0.0", + "rimraf": "^2.6.1", + "ws": "^5.1.1" + }, + "dependencies": { + "debug": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.5.tgz", + "integrity": "sha512-D61LaDQPQkxJ5AUM2mbSJRbPkNs/TmdmOeLAi1hgDkpDfIfetSrjmWhccwtuResSwMbACjx/xXQofvM9CE/aeg==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "mime": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.3.1.tgz", + "integrity": "sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } }, "querystring": { "version": "0.2.0", @@ -5578,76 +4795,6 @@ "safe-buffer": "^5.1.0" } }, - "range-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", - "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=", - "dev": true - }, - "raw-body": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", - "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", - "dev": true, - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.2", - "iconv-lite": "0.4.19", - "unpipe": "1.0.0" - }, - "dependencies": { - "depd": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", - "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=", - "dev": true - }, - "http-errors": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", - "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", - "dev": true, - "requires": { - "depd": "1.1.1", - "inherits": "2.0.3", - "setprototypeof": "1.0.3", - "statuses": ">= 1.3.1 < 2" - } - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", - "dev": true - }, - "setprototypeof": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", - "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=", - "dev": true - } - } - }, - "rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dev": true, - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } - } - }, "read-pkg": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", @@ -5982,16 +5129,6 @@ } } }, - "redent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", - "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", - "dev": true, - "requires": { - "indent-string": "^2.1.0", - "strip-indent": "^1.0.1" - } - }, "regex-cache": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", @@ -6013,7 +5150,7 @@ }, "regexpp": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/regexpp/-/regexpp-1.1.0.tgz", "integrity": "sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw==", "dev": true }, @@ -6040,51 +5177,6 @@ "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", "dev": true }, - "repeating": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "dev": true, - "requires": { - "is-finite": "^1.0.0" - } - }, - "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", - "dev": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "dependencies": { - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "dev": true - } - } - }, "require-relative": { "version": "0.8.7", "resolved": "https://registry.npmjs.org/require-relative/-/require-relative-0.8.7.tgz", @@ -6207,6 +5299,17 @@ } } }, + "rollup-plugin-replace": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-replace/-/rollup-plugin-replace-2.0.0.tgz", + "integrity": "sha512-pK9mTd/FNrhtBxcTBXoh0YOwRIShV0gGhv9qvUtNcXHxIMRZMXqfiZKVBmCRGp8/2DJRy62z2JUE7/5tP6WxOQ==", + "dev": true, + "requires": { + "magic-string": "^0.22.4", + "minimatch": "^3.0.2", + "rollup-pluginutils": "^2.0.1" + } + }, "rollup-plugin-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/rollup-plugin-string/-/rollup-plugin-string-2.0.2.tgz", @@ -6234,6 +5337,17 @@ } } }, + "rollup-plugin-svelte": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/rollup-plugin-svelte/-/rollup-plugin-svelte-4.3.2.tgz", + "integrity": "sha512-aGFuB+hc9c5pmPCgnXiJCbRwrDw7sdPia+WBRKTMEwVv3ygiSOi5gIlGHIPRMvMisioOk0ns5Bu5Gz57JxEZTg==", + "dev": true, + "requires": { + "require-relative": "^0.8.7", + "rollup-pluginutils": "^2.3.0", + "sourcemap-codec": "^1.4.1" + } + }, "rollup-plugin-typescript": { "version": "0.8.1", "resolved": "http://registry.npmjs.org/rollup-plugin-typescript/-/rollup-plugin-typescript-0.8.1.tgz", @@ -6410,45 +5524,12 @@ "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==", "dev": true }, - "send": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", - "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", - "dev": true, - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.6.2", - "mime": "1.4.1", - "ms": "2.0.0", - "on-finished": "~2.3.0", - "range-parser": "~1.2.0", - "statuses": "~1.4.0" - } - }, "serialize-javascript": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.5.0.tgz", "integrity": "sha512-Ga8c8NjAAp46Br4+0oZ2WxJCwIzwP60Gq1YPgU+39PiTVxyed/iKE/zyZI6+UlVYH5Q4PaQdHhcegIFPZTUfoQ==", "dev": true }, - "serve-static": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", - "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", - "dev": true, - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.2", - "send": "0.16.2" - } - }, "set-value": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", @@ -6478,12 +5559,6 @@ "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", "dev": true }, - "setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", - "dev": true - }, "sha.js": { "version": "2.4.11", "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", @@ -6532,43 +5607,22 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, - "single-line-log": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/single-line-log/-/single-line-log-1.1.2.tgz", - "integrity": "sha1-wvg/Jzo+GhbtsJlWYdoO1e8DM2Q=", + "sirv": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-0.2.2.tgz", + "integrity": "sha512-X0UjfTc32MeK+rkhgdQK/blQ5ysC0CfLF9OH9d8x2RnpaD2D5BDLMeox79utmhxai4T+/VCahK5pDgAEnG/tNQ==", "dev": true, "requires": { - "string-width": "^1.0.1" + "@polka/url": "^0.5.0", + "mime": "^2.3.1", + "tiny-glob": "^0.2.0" }, "dependencies": { - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } + "mime": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.3.1.tgz", + "integrity": "sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg==", + "dev": true } } }, @@ -6581,12 +5635,6 @@ "is-fullwidth-code-point": "^2.0.0" } }, - "sliced": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", - "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=", - "dev": true - }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -6746,9 +5794,9 @@ "integrity": "sha512-vFrY/x/NdsD7Yc8mpTJXuao9S8lq08Z/kOITHz6b7YbfI9xL8Spe5EvSQUHOI7SbpY8bRPr0U3kKSsPuqEGSfA==" }, "spdx-correct": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.1.tgz", - "integrity": "sha512-hxSPZbRZvSDuOvADntOElzJpenIR7wXJkuoUcUtS0erbgt2fgeaoPIYretfKpslMhfFDY4k0MZ2F5CUzhBsSvQ==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.2.tgz", + "integrity": "sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ==", "dev": true, "requires": { "spdx-expression-parse": "^3.0.0", @@ -6756,9 +5804,9 @@ } }, "spdx-exceptions": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", - "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", "dev": true }, "spdx-expression-parse": { @@ -6777,12 +5825,6 @@ "integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==", "dev": true }, - "speedometer": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/speedometer/-/speedometer-0.1.4.tgz", - "integrity": "sha1-mHbb0qFp0xFUAtSObqYynIgWpQ0=", - "dev": true - }, "split": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", @@ -6801,56 +5843,12 @@ "extend-shallow": "^3.0.0" } }, - "split2": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", - "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", - "dev": true, - "requires": { - "through2": "^2.0.2" - }, - "dependencies": { - "through2": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", - "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", - "dev": true, - "requires": { - "readable-stream": "^2.1.5", - "xtend": "~4.0.1" - } - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true - } - } - }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, - "sshpk": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", - "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", - "dev": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, "ssri": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz", @@ -6881,12 +5879,6 @@ } } }, - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==", - "dev": true - }, "stream-browserify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", @@ -7002,31 +5994,12 @@ "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "dev": true }, - "strip-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", - "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", - "dev": true, - "requires": { - "get-stdin": "^4.0.1" - } - }, "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true }, - "sumchecker": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-1.3.1.tgz", - "integrity": "sha1-ebs7RFbdBPGOvbwNcDodHa7FEF0=", - "dev": true, - "requires": { - "debug": "^2.2.0", - "es6-promise": "^4.0.5" - } - }, "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", @@ -7082,54 +6055,12 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, - "throttleit": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-0.0.2.tgz", - "integrity": "sha1-z+34jmDADdlpe2H90qg0OptoDq8=", - "dev": true - }, "through": { "version": "2.3.8", "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, - "through2": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.2.3.tgz", - "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=", - "dev": true, - "requires": { - "readable-stream": "~1.1.9", - "xtend": "~2.1.1" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", - "dev": true - } - } - }, "timers-browserify": { "version": "2.0.10", "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.10.tgz", @@ -7212,22 +6143,6 @@ } } }, - "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", - "dev": true, - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - } - }, - "trim-newlines": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", - "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", - "dev": true - }, "trouter": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/trouter/-/trouter-1.1.0.tgz", @@ -7272,22 +6187,6 @@ "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", "dev": true }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "dev": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true, - "optional": true - }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", @@ -7297,16 +6196,6 @@ "prelude-ls": "~1.1.2" } }, - "type-is": { - "version": "1.6.16", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", - "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", - "dev": true, - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.18" - } - }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -7415,12 +6304,6 @@ "imurmurhash": "^0.1.4" } }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", - "dev": true - }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", @@ -7540,18 +6423,6 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", - "dev": true - }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", - "dev": true - }, "validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -7562,23 +6433,6 @@ "spdx-expression-parse": "^3.0.0" } }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", - "dev": true - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, "vlq": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz", @@ -7594,16 +6448,6 @@ "indexof": "0.0.1" } }, - "walk-sync": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/walk-sync/-/walk-sync-0.3.3.tgz", - "integrity": "sha512-jQgTHmCazUngGqvHZFlr30u2VLKEKErBMLFe+fBl5mn4rh9aI/QVRog8PT1hv2vaOu4EBwigfmpRTyZrbnpRVA==", - "dev": true, - "requires": { - "ensure-posix-path": "^1.0.0", - "matcher-collection": "^1.0.0" - } - }, "watchpack": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", @@ -8021,13 +6865,13 @@ "mkdirp": "^0.5.1" } }, - "xtend": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz", - "integrity": "sha1-bv7MKk2tjmlixJAbM3znuoe10os=", + "ws": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", + "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", "dev": true, "requires": { - "object-keys": "~0.4.0" + "async-limiter": "~1.0.0" } }, "y18n": { diff --git a/package.json b/package.json index 24c46c8..528ff2a 100644 --- a/package.json +++ b/package.json @@ -25,58 +25,56 @@ "tslib": "^1.9.1" }, "devDependencies": { - "@types/glob": "^5.0.34", "@types/mkdirp": "^0.5.2", "@types/mocha": "^5.2.5", "@types/node": "^10.7.1", + "@types/puppeteer": "^1.9.0", "@types/rimraf": "^2.0.2", "agadoo": "^1.0.1", "cheap-watch": "^0.3.0", - "compression": "^1.7.1", "cookie": "^0.3.1", "devalue": "^1.0.4", "eslint": "^4.13.1", "eslint-plugin-import": "^2.12.0", - "express": "^4.16.3", "kleur": "^2.0.1", "mkdirp": "^0.5.1", "mocha": "^5.2.0", - "nightmare": "^3.0.0", "node-fetch": "^2.1.1", "npm-run-all": "^4.1.3", "polka": "^0.4.0", "port-authority": "^1.0.5", "pretty-bytes": "^5.0.0", "pretty-ms": "^3.1.0", + "puppeteer": "^1.9.0", "require-relative": "^0.8.7", "rimraf": "^2.6.2", "rollup": "^0.65.0", "rollup-plugin-commonjs": "^9.1.3", "rollup-plugin-json": "^3.0.0", - "rollup-plugin-node-resolve": "^3.3.0", + "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-replace": "^2.0.0", "rollup-plugin-string": "^2.0.2", + "rollup-plugin-svelte": "^4.3.2", "rollup-plugin-typescript": "^0.8.1", "sade": "^1.4.1", "sander": "^0.6.0", - "serve-static": "^1.13.2", + "sirv": "^0.2.2", "svelte": "^2.6.3", "svelte-loader": "^2.9.0", "tiny-glob": "^0.2.2", "ts-node": "^7.0.1", "typescript": "^2.8.3", - "walk-sync": "^0.3.2", "webpack": "^4.8.3", "webpack-format-messages": "^2.0.1" }, "scripts": { - "cy:open": "cypress open", "test": "mocha --opts mocha.opts", "pretest": "npm run build", "build": "rm -rf dist && rollup -c", "prepare": "npm run build", "dev": "rollup -cw", "prepublishOnly": "npm test", - "update_mime_types": "curl http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types | grep -e \"^[^#]\" > src/middleware/mime-types.md" + "update_mime_types": "curl http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types | grep -e \"^[^#]\" > templates/src/server/middleware/mime-types.md" }, "repository": "https://github.com/sveltejs/sapper", "keywords": [ diff --git a/rollup.config.js b/rollup.config.js index 22c13b8..8fd7c4b 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -12,7 +12,7 @@ const external = [].concat( 'sapper/core.js' ); -function template(kind, external) { +function template(kind, external, target) { return { input: `templates/src/${kind}/index.ts`, output: { @@ -28,15 +28,15 @@ function template(kind, external) { }), typescript({ typescript: require('typescript'), - target: "ES2017" + target }) ] }; } export default [ - template('client', ['__ROOT__', '__ERROR__']), - template('server', builtinModules), + template('client', ['__ROOT__', '__ERROR__'], 'ES2017'), + template('server', builtinModules, 'ES2015'), { input: [ diff --git a/src/cli/build.ts b/src/cli/build.ts index 5f47eb1..20051bb 100644 --- a/src/cli/build.ts +++ b/src/cli/build.ts @@ -19,9 +19,7 @@ export function build(opts: { bundler?: string, legacy?: boolean }) { }, { dest: locations.dest(), src: locations.src(), - routes: locations.routes(), - webpack: 'webpack', - rollup: 'rollup' + routes: locations.routes() }); emitter.on('build', event => { diff --git a/src/core/create_manifests.ts b/src/core/create_manifests.ts index a71ae52..6354dfb 100644 --- a/src/core/create_manifests.ts +++ b/src/core/create_manifests.ts @@ -10,7 +10,7 @@ export function create_main_manifests({ bundler, manifest_data, dev_port }: { manifest_data: ManifestData; dev_port?: number; }) { - const manifest_dir = '__sapper__'; + const manifest_dir = path.resolve('__sapper__'); if (!fs.existsSync(manifest_dir)) fs.mkdirSync(manifest_dir); const path_to_routes = path.relative(manifest_dir, locations.routes()); @@ -19,7 +19,7 @@ export function create_main_manifests({ bundler, manifest_data, dev_port }: { const server_manifest = generate_server(manifest_data, path_to_routes); write_if_changed( - `${manifest_dir}/default-layout.html`, + `${manifest_dir}/_layout.html`, `` ); write_if_changed(`${manifest_dir}/client.js`, client_manifest); @@ -218,7 +218,7 @@ function generate_server( function get_file(path_to_routes: string, component: PageComponent) { if (component.default) { - return `./default-layout.html`; + return `./_layout.html`; } return posixify(`${path_to_routes}/${component.file}`); diff --git a/src/interfaces.ts b/src/interfaces.ts index a123903..7776f5c 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -44,9 +44,7 @@ export type ServerRoute = { export type Dirs = { dest: string, src: string, - routes: string, - webpack: string, - rollup: string + routes: string }; export type ManifestData = { diff --git a/templates/src/client/prefetch/index.ts b/templates/src/client/prefetch/index.ts index 4b601d2..cd22c63 100644 --- a/templates/src/client/prefetch/index.ts +++ b/templates/src/client/prefetch/index.ts @@ -4,7 +4,11 @@ import { Target } from '../types'; export default function prefetch(href: string) { const target: Target = select_route(new URL(href, document.baseURI)); - if (target && (!prefetching || href !== prefetching.href)) { - set_prefetching(href, prepare_page(target)); + if (target) { + if (!prefetching || href !== prefetching.href) { + set_prefetching(href, prepare_page(target)); + } + + return prefetching.promise; } } \ No newline at end of file diff --git a/templates/src/client/start/index.ts b/templates/src/client/start/index.ts index 4d64506..17979a3 100644 --- a/templates/src/client/start/index.ts +++ b/templates/src/client/start/index.ts @@ -103,7 +103,7 @@ function handle_click(event: MouseEvent) { const target = select_route(url); if (target) { - const noscroll = a.hasAttribute('sapper-noscroll') + const noscroll = a.hasAttribute('sapper-noscroll'); navigate(target, null, noscroll); event.preventDefault(); history.pushState({ id: cid }, '', url.href); diff --git a/templates/src/server/middleware/get_page_handler.ts b/templates/src/server/middleware/get_page_handler.ts index 421a2d1..c2049f2 100644 --- a/templates/src/server/middleware/get_page_handler.ts +++ b/templates/src/server/middleware/get_page_handler.ts @@ -33,7 +33,7 @@ export function get_page_handler( }, req, res, statusCode, error || new Error('Unknown error in preload function')); } - function handle_page(page: Page, req: Req, res: Res, status = 200, error: Error | string = null) { + async function handle_page(page: Page, req: Req, res: Res, status = 200, error: Error | string = null) { const build_info: { bundler: 'rollup' | 'webpack', shimport: string | null, @@ -56,12 +56,22 @@ export function get_page_handler( }); } - const link = preloaded_chunks - .filter(file => file && !file.match(/\.map$/)) - .map(file => `<${req.baseUrl}/client/${file}>;rel="preload";as="script"`) - .join(', '); + if (build_info.bundler === 'rollup') { + // TODO add dependencies and CSS + const link = preloaded_chunks + .filter(file => file && !file.match(/\.map$/)) + .map(file => `<${req.baseUrl}/client/${file}>;rel="modulepreload"`) + .join(', '); - res.setHeader('Link', link); + res.setHeader('Link', link); + } else { + const link = preloaded_chunks + .filter(file => file && !file.match(/\.map$/)) + .map(file => `<${req.baseUrl}/client/${file}>;rel="preload";as="script"`) + .join(', '); + + res.setHeader('Link', link); + } const store = store_getter ? store_getter(req, res) : null; @@ -118,30 +128,37 @@ export function get_page_handler( store }; - const root_preloaded = manifest.root.preload - ? manifest.root.preload.call(preload_context, { - path: req.path, - query: req.query, - params: {} - }) - : {}; + let preloaded; + let match; - const match = error ? null : page.pattern.exec(req.path); - - Promise.all([root_preloaded].concat(page.parts.map(part => { - if (!part) return null; - - return part.component.preload - ? part.component.preload.call(preload_context, { + try { + const root_preloaded = manifest.root.preload + ? manifest.root.preload.call(preload_context, { path: req.path, query: req.query, - params: part.params ? part.params(match) : {} + params: {} }) : {}; - }))).catch(err => { + + match = error ? null : page.pattern.exec(req.path); + + preloaded = await Promise.all([root_preloaded].concat(page.parts.map(part => { + if (!part) return null; + + return part.component.preload + ? part.component.preload.call(preload_context, { + path: req.path, + query: req.query, + params: part.params ? part.params(match) : {} + }) + : {}; + }))); + } catch (err) { preload_error = { statusCode: 500, message: err }; - return []; // appease TypeScript - }).then(preloaded => { + preloaded = []; // appease TypeScript + } + + try { if (redirect) { const location = `${req.baseUrl}/${redirect.location}`; @@ -269,7 +286,7 @@ export function get_page_handler( res.statusCode = status; res.end(body); - }).catch(err => { + } catch(err) { if (error) { // we encountered an error while rendering the error page — oops res.statusCode = 500; @@ -277,7 +294,7 @@ export function get_page_handler( } else { handle_error(req, res, 500, err); } - }); + } } return function find_route(req: Req, res: Res, next: () => void) { diff --git a/test/app/.gitignore b/test/app/.gitignore deleted file mode 100644 index 9f3fcfb..0000000 --- a/test/app/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -.DS_Store -node_modules -.sapper -yarn.lock -cypress/screenshots -templates/.* -dist diff --git a/test/app/README.md b/test/app/README.md deleted file mode 100644 index ea2230e..0000000 --- a/test/app/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# sapper-template - -The default [Sapper](https://github.com/sveltejs/sapper) template. To clone it and get started: - -```bash -npx degit sveltejs/sapper-template my-app -cd my-app -npm install # or yarn! -npm run dev -``` - -Open up [localhost:3000](http://localhost:3000) and start clicking around. - - -## Structure - -Sapper expects to find three directories in the root of your project — `assets`, `routes` and `templates`. - - -### assets - -The [assets](assets) directory contains any static assets that should be available. These are served using [serve-static](https://github.com/expressjs/serve-static). - -In your [service-worker.js](templates/service-worker.js) file, Sapper makes these files available as `__assets__` so that you can cache them (though you can choose not to, for example if you don't want to cache very large files). - - -### routes - -This is the heart of your Sapper app. There are two kinds of routes — *pages*, and *server routes*. - -**Pages** are Svelte components written in `.html` files. When a user first visits the application, they will be served a server-rendered version of the route in question, plus some JavaScript that 'hydrates' the page and initialises a client-side router. From that point forward, navigating to other pages is handled entirely on the client for a fast, app-like feel. (Sapper will preload and cache the code for these subsequent pages, so that navigation is instantaneous.) - -**Server routes** are modules written in `.js` files, that export functions corresponding to HTTP methods. Each function receives Express `request` and `response` objects as arguments, plus a `next` function. This is useful for creating a JSON API, for example. - -There are three simple rules for naming the files that define your routes: - -* A file called `routes/about.html` corresponds to the `/about` route. A file called `routes/blog/[slug].html` corresponds to the `/blog/:slug` route, in which case `params.slug` is available to the route -* The file `routes/index.html` (or `routes/index.js`) corresponds to the root of your app. `routes/about/index.html` is treated the same as `routes/about.html`. -* Files and directories with a leading underscore do *not* create routes. This allows you to colocate helper modules and components with the routes that depend on them — for example you could have a file called `routes/_helpers/datetime.js` and it would *not* create a `/_helpers/datetime` route - - -### templates - -This directory should contain the following files at a minimum: - -* [2xx.html](templates/2xx.html) — a template for the page to serve for valid requests -* [4xx.html](templates/4xx.html) — a template for 4xx-range errors (such as 404 Not Found) -* [5xx.html](templates/5xx.html) — a template for 5xx-range errors (such as 500 Internal Server Error) -* [main.js](templates/main.js) — this module initialises Sapper -* [service-worker.js](templates/service-worker.js) — your app's service worker - -Inside the HTML templates, Sapper will inject various values as indicated by `%sapper.xxxx%` tags. Inside JavaScript files, Sapper will replace strings like `__dev__` with the appropriate value. - -In lieu of documentation (bear with us), consult the files to see what variables are available and how they're used. - - -## Webpack config - -Sapper uses webpack to provide code-splitting, dynamic imports and hot module reloading, as well as compiling your Svelte components. As long as you don't do anything daft, you can edit the configuration files to add whatever loaders and plugins you'd like. - - -## Production mode and deployment - -To start a production version of your app, run `npm start`. This will disable hot module replacement, and activate the appropriate webpack plugins. - -You can deploy your application to any environment that supports Node 8 or above. As an example, to deploy to [Now](https://zeit.co/now), run these commands: - -```bash -npm install -g now -now -``` - - -## Bugs and feedback - -Sapper is in early development, and may have the odd rough edge here and there. Please be vocal over on the [Sapper issue tracker](https://github.com/sveltejs/sapper/issues). - - -## License - -[LIL](LICENSE) diff --git a/test/app/src/client.js b/test/app/src/client.js deleted file mode 100644 index 39aeea7..0000000 --- a/test/app/src/client.js +++ /dev/null @@ -1,12 +0,0 @@ -import { Store } from 'svelte/store.js'; -import * as sapper from '../__sapper__/client.js'; - -window.init = () => { - return sapper.start({ - target: document.querySelector('#sapper'), - store: data => new Store(data) - }); -}; - -window.prefetchRoutes = sapper.prefetchRoutes; -window.goto = sapper.goto; \ No newline at end of file diff --git a/test/app/src/routes/_error.html b/test/app/src/routes/_error.html deleted file mode 100644 index 9974a17..0000000 --- a/test/app/src/routes/_error.html +++ /dev/null @@ -1,6 +0,0 @@ - - {status} - - -

{status}

-

{error.message}

\ No newline at end of file diff --git a/test/app/src/routes/about.html b/test/app/src/routes/about.html deleted file mode 100644 index af0dd1d..0000000 --- a/test/app/src/routes/about.html +++ /dev/null @@ -1,19 +0,0 @@ - - About - - -

About this site

- -

This is the 'about' page. There's not much here.

- - - - \ No newline at end of file diff --git a/test/app/src/routes/blog/[slug].html b/test/app/src/routes/blog/[slug].html deleted file mode 100644 index 7fdc8b4..0000000 --- a/test/app/src/routes/blog/[slug].html +++ /dev/null @@ -1,36 +0,0 @@ - - {post.title} - - -

{post.title}

- -
- {@html post.html} -
- - \ No newline at end of file diff --git a/test/app/src/routes/blog/[slug].json.js b/test/app/src/routes/blog/[slug].json.js deleted file mode 100644 index 61ebee8..0000000 --- a/test/app/src/routes/blog/[slug].json.js +++ /dev/null @@ -1,23 +0,0 @@ -import posts from './_posts.js'; - -const lookup = {}; -posts.forEach(post => { - lookup[post.slug] = JSON.stringify(post); -}); - -export function get(req, res, next) { - // the `slug` parameter is available because this file - // is called [slug].js - const { slug } = req.params; - - if (slug in lookup) { - res.writeHead(200, { - 'Content-Type': 'application/json', - 'Cache-Control': `no-cache` - }); - - res.end(lookup[slug]); - } else { - next(); - } -} \ No newline at end of file diff --git a/test/app/src/routes/blog/_posts.js b/test/app/src/routes/blog/_posts.js deleted file mode 100644 index a9a9717..0000000 --- a/test/app/src/routes/blog/_posts.js +++ /dev/null @@ -1,151 +0,0 @@ -// Ordinarily, you'd generate this data from markdown files in your -// repo, or fetch them from a database of some kind. But in order to -// avoid unnecessary dependencies in the starter template, and in the -// service of obviousness, we're just going to leave it here. - -// This file is called `_posts.js` rather than `posts.js`, because -// we don't want to create an `/api/blog/posts` route — the leading -// underscore tells Sapper not to do that. - -const posts = [ - { - title: 'What is Sapper?', - slug: 'what-is-sapper', - html: ` -

First, you have to know what Svelte is. Svelte is a UI framework with a bold new idea: rather than providing a library that you write code with (like React or Vue, for example), it's a compiler that turns your components into highly optimized vanilla JavaScript. If you haven't already read the introductory blog post, you should!

- -

Sapper is a Next.js-style framework (more on that here) built around Svelte. It makes it embarrassingly easy to create extremely high performance web apps. Out of the box, you get:

- - - -

It's implemented as Express middleware. Everything is set up and waiting for you to get started, but you keep complete control over the server, service worker, webpack config and everything else, so it's as flexible as you need it to be.

- ` - }, - - { - title: 'How to use Sapper', - slug: 'how-to-use-sapper', - html: ` -

Step one

-

Create a new project, using degit:

- -
npx degit sveltejs/sapper-template my-app
-			cd my-app
-			npm install # or yarn!
-			npm run dev
-			
- -

Step two

-

Go to localhost:3000. Open my-app in your editor. Edit the files in the routes directory or add new ones.

- -

Step three

-

...

- -

Step four

-

Resist overdone joke formats.

- ` - }, - - { - title: 'Why the name?', - slug: 'why-the-name', - html: ` -

In war, the soldiers who build bridges, repair roads, clear minefields and conduct demolitions — all under combat conditions — are known as sappers.

- -

For web developers, the stakes are generally lower than those for combat engineers. But we face our own hostile environment: underpowered devices, poor network connections, and the complexity inherent in front-end engineering. Sapper, which is short for Svelte app maker, is your courageous and dutiful ally.

- ` - }, - - { - title: 'How is Sapper different from Next.js?', - slug: 'how-is-sapper-different-from-next', - html: ` -

Next.js is a React framework from Zeit, and is the inspiration for Sapper. There are a few notable differences, however:

- - - ` - }, - - { - title: 'How can I get involved?', - slug: 'how-can-i-get-involved', - html: ` -

We're so glad you asked! Come on over to the Svelte and Sapper repos, and join us in the Gitter chatroom. Everyone is welcome, especially you!

- ` - }, - - { - title: 'A very long post with deep links', - slug: 'a-very-long-post', - html: ` -

One

-

I'll have a vodka rocks. (Mom, it's breakfast time.) And a piece of toast. Let me out that Queen. Fried cheese… with club sauce.

-

Her lawyers are claiming the seal is worth $250,000. And that's not even including Buster's Swatch. This was a big get for God. What, so the guy we are meeting with can't even grow his own hair? COME ON! She's always got to wedge herself in the middle of us so that she can control everything. Yeah. Mom's awesome. It's, like, Hey, you want to go down to the whirlpool? Yeah, I don't have a husband. I call it Swing City. The CIA should've just Googled for his hideout, evidently. There are dozens of us! DOZENS! Yeah, like I'm going to take a whiz through this $5,000 suit. COME ON.

- -

Two

-

Tobias Fünke costume. Heart attack never stopped old big bear.

-

Nellie is blowing them all AWAY. I will be a bigger and hairier mole than the one on your inner left thigh! I'll sacrifice anything for my children.

-

Up yours, granny! You couldn't handle it! Hey, Dad. Look at you. You're a year older…and a year closer to death. Buster: Oh yeah, I guess that's kind of funny. Bob Loblaw Law Blog. The guy runs a prison, he can have any piece of ass he wants.

- -

clicking this link should reset scroll

-

clicking this link should not affect scroll

- -

Three

-

I prematurely shot my wad on what was supposed to be a dry run, so now I'm afraid I have something of a mess on my hands. Dead Dove DO NOT EAT. Never once touched my per diem. I'd go to Craft Service, get some raw veggies, bacon, Cup-A-Soup…baby, I got a stew goin'. You're losing blood, aren't you? Gob: Probably, my socks are wet. Sure, let the little fruit do it. HUZZAH! Although George Michael had only got to second base, he'd gone in head first, like Pete Rose. I will pack your sweet pink mouth with so much ice cream you'll be the envy of every Jerry and Jane on the block!

-

Gosh Mom… after all these years, God's not going to take a call from you. Come on, this is a Bluth family celebration. It's no place for children.

-

And I wouldn't just lie there, if that's what you're thinking. That's not what I WAS thinking. Who? i just dont want him to point out my cracker ass in front of ann. When a man needs to prove to a woman that he's actually… When a man loves a woman… Heyyyyyy Uncle Father Oscar. [Stabbing Gob] White power! Gob: I'm white! Let me take off my assistant's skirt and put on my Barbra-Streisand-in-The-Prince-of-Tides ass-masking therapist pantsuit. In the mid '90s, Tobias formed a folk music band with Lindsay and Maebe which he called Dr. Funke's 100 Percent Natural Good Time Family Band Solution. The group was underwritten by the Natural Food Life Company, a division of Chem-Grow, an Allen Crayne acqusition, which was part of the Squimm Group. Their motto was simple: We keep you alive.

- -

Four

-

If you didn't have adult onset diabetes, I wouldn't mind giving you a little sugar. Everybody dance NOW. And the soup of the day is bread. Great, now I'm gonna smell to high heaven like a tuna melt!

-

That's how Tony Wonder lost a nut. She calls it a Mayonegg. Go ahead, touch the Cornballer. There's a new daddy in town. A discipline daddy.

- ` - }, - - { - title: 'Another long post', - slug: 'another-long-post', - html: ` -

One

-

I'll have a vodka rocks. (Mom, it's breakfast time.) And a piece of toast. Let me out that Queen. Fried cheese… with club sauce.

-

Her lawyers are claiming the seal is worth $250,000. And that's not even including Buster's Swatch. This was a big get for God. What, so the guy we are meeting with can't even grow his own hair? COME ON! She's always got to wedge herself in the middle of us so that she can control everything. Yeah. Mom's awesome. It's, like, Hey, you want to go down to the whirlpool? Yeah, I don't have a husband. I call it Swing City. The CIA should've just Googled for his hideout, evidently. There are dozens of us! DOZENS! Yeah, like I'm going to take a whiz through this $5,000 suit. COME ON.

- -

Two

-

Tobias Fünke costume. Heart attack never stopped old big bear.

-

Nellie is blowing them all AWAY. I will be a bigger and hairier mole than the one on your inner left thigh! I'll sacrifice anything for my children.

-

Up yours, granny! You couldn't handle it! Hey, Dad. Look at you. You're a year older…and a year closer to death. Buster: Oh yeah, I guess that's kind of funny. Bob Loblaw Law Blog. The guy runs a prison, he can have any piece of ass he wants.

- -

Three

-

I prematurely shot my wad on what was supposed to be a dry run, so now I'm afraid I have something of a mess on my hands. Dead Dove DO NOT EAT. Never once touched my per diem. I'd go to Craft Service, get some raw veggies, bacon, Cup-A-Soup…baby, I got a stew goin'. You're losing blood, aren't you? Gob: Probably, my socks are wet. Sure, let the little fruit do it. HUZZAH! Although George Michael had only got to second base, he'd gone in head first, like Pete Rose. I will pack your sweet pink mouth with so much ice cream you'll be the envy of every Jerry and Jane on the block!

-

Gosh Mom… after all these years, God's not going to take a call from you. Come on, this is a Bluth family celebration. It's no place for children.

-

And I wouldn't just lie there, if that's what you're thinking. That's not what I WAS thinking. Who? i just dont want him to point out my cracker ass in front of ann. When a man needs to prove to a woman that he's actually… When a man loves a woman… Heyyyyyy Uncle Father Oscar. [Stabbing Gob] White power! Gob: I'm white! Let me take off my assistant's skirt and put on my Barbra-Streisand-in-The-Prince-of-Tides ass-masking therapist pantsuit. In the mid '90s, Tobias formed a folk music band with Lindsay and Maebe which he called Dr. Funke's 100 Percent Natural Good Time Family Band Solution. The group was underwritten by the Natural Food Life Company, a division of Chem-Grow, an Allen Crayne acqusition, which was part of the Squimm Group. Their motto was simple: We keep you alive.

- -

Four

-

If you didn't have adult onset diabetes, I wouldn't mind giving you a little sugar. Everybody dance NOW. And the soup of the day is bread. Great, now I'm gonna smell to high heaven like a tuna melt!

-

That's how Tony Wonder lost a nut. She calls it a Mayonegg. Go ahead, touch the Cornballer. There's a new daddy in town. A discipline daddy.

- ` - }, - - { - title: 'Encödïng test', - slug: 'encödïng-test', - html: ` -

It works

- ` - } -]; - -posts.forEach(post => { - post.html = post.html.replace(/^\t{3}/gm, ''); -}); - -export default posts; \ No newline at end of file diff --git a/test/app/src/routes/blog/index.html b/test/app/src/routes/blog/index.html deleted file mode 100644 index 2e9f428..0000000 --- a/test/app/src/routes/blog/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - Blog - - -

Recent posts

- - - - \ No newline at end of file diff --git a/test/app/src/routes/blog/index.json.js b/test/app/src/routes/blog/index.json.js deleted file mode 100644 index 9d73d78..0000000 --- a/test/app/src/routes/blog/index.json.js +++ /dev/null @@ -1,17 +0,0 @@ -import posts from './_posts.js'; - -const contents = JSON.stringify(posts.map(post => { - return { - title: post.title, - slug: post.slug - }; -})); - -export function get(req, res) { - res.writeHead(200, { - 'Content-Type': 'application/json', - 'Cache-Control': `max-age=${30 * 60 * 1e3}` // cache for 30 minutes - }); - - res.end(contents); -} \ No newline at end of file diff --git a/test/app/src/routes/index.html b/test/app/src/routes/index.html deleted file mode 100644 index 65c7e59..0000000 --- a/test/app/src/routes/index.html +++ /dev/null @@ -1,31 +0,0 @@ - - Sapper project template - - -

Great success!

- -home -about -slow preload -redirect -redirect -redirect (root) -broken link -error link -credentials -blog -const -echo/page/encöded?message=hëllö+wörld -echo/page/empty?message - -
- - \ No newline at end of file diff --git a/test/app/src/routes/missing-index/ok.html b/test/app/src/routes/missing-index/ok.html deleted file mode 100644 index 7cc8f66..0000000 --- a/test/app/src/routes/missing-index/ok.html +++ /dev/null @@ -1 +0,0 @@ -

it works

\ No newline at end of file diff --git a/test/app/src/routes/non-sapper-redirect-to.html b/test/app/src/routes/non-sapper-redirect-to.html deleted file mode 100644 index eeb0dfc..0000000 --- a/test/app/src/routes/non-sapper-redirect-to.html +++ /dev/null @@ -1 +0,0 @@ -

redirected

\ No newline at end of file diff --git a/test/app/src/routes/throw-an-error.js b/test/app/src/routes/throw-an-error.js deleted file mode 100644 index 523f2bc..0000000 --- a/test/app/src/routes/throw-an-error.js +++ /dev/null @@ -1,3 +0,0 @@ -export function get() { - throw new Error('nope'); -} \ No newline at end of file diff --git a/test/app/src/server.js b/test/app/src/server.js deleted file mode 100644 index b75ceeb..0000000 --- a/test/app/src/server.js +++ /dev/null @@ -1,126 +0,0 @@ -import fs from 'fs'; -import { resolve } from 'url'; -import express from 'express'; -import serve from 'serve-static'; -import { Store } from 'svelte/store.js'; -import * as sapper from '../__sapper__/server.js'; - -let pending; -let ended; - -process.on('message', message => { - if (message.action === 'start') { - if (pending) { - throw new Error(`Already capturing`); - } - - pending = new Set(); - ended = false; - process.send({ type: 'ready' }); - } - - if (message.action === 'end') { - ended = true; - if (pending.size === 0) { - process.send({ type: 'done' }); - pending = null; - } - } -}); - -const app = express(); - -const { PORT = 3000, BASEPATH = '' } = process.env; -const base = `http://localhost:${PORT}${BASEPATH}/`; - -// this allows us to do e.g. `fetch('/api/blog')` on the server -const fetch = require('node-fetch'); -global.fetch = (url, opts) => { - return fetch(resolve(base, url), opts); -}; - -const middlewares = [ - serve('assets'), - - // set test cookie - (req, res, next) => { - res.setHeader('Set-Cookie', ['a=1; Path=/', 'b=2; Path=/']); - next(); - }, - - // emit messages so we can capture requests - (req, res, next) => { - if (!pending) return next(); - - pending.add(req.url); - - const { write, end } = res; - const chunks = []; - - res.write = function(chunk) { - chunks.push(new Buffer(chunk)); - write.apply(res, arguments); - }; - - res.end = function(chunk) { - if (chunk) chunks.push(new Buffer(chunk)); - end.apply(res, arguments); - - if (pending) pending.delete(req.url); - - process.send({ - method: req.method, - url: req.url, - status: res.statusCode, - headers: res._headers, - body: Buffer.concat(chunks).toString() - }); - - if (pending && pending.size === 0 && ended) { - process.send({ type: 'done' }); - } - }; - - next(); - }, - - // set up some values for the store - (req, res, next) => { - req.hello = 'hello'; - res.locals = { name: 'world' }; - next(); - }, - - sapper.middleware({ - store: (req, res) => { - return new Store({ - title: `${req.hello} ${res.locals.name}` - }); - }, - ignore: [ - /foobar/i, - '/buzz', - 'fizz', - x => x === '/hello' - ] - }), -]; - -app.get(`${BASEPATH}/non-sapper-redirect-from`, (req, res) => { - res.writeHead(301, { - Location: `${BASEPATH}/non-sapper-redirect-to` - }); - res.end(); -}); - -if (BASEPATH) { - app.use(BASEPATH, ...middlewares); -} else { - app.use(...middlewares); -} - -['foobar', 'buzz', 'fizzer', 'hello'].forEach(uri => { - app.get('/'+uri, (req, res) => res.end(uri)); -}); - -app.listen(PORT); diff --git a/test/app/src/template.html b/test/app/src/template.html deleted file mode 100644 index 0ea5e17..0000000 --- a/test/app/src/template.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - %sapper.base% - - - - - - - %sapper.styles% - - - %sapper.head% - - - -
%sapper.html%
- - - %sapper.scripts% - - \ No newline at end of file diff --git a/test/app/static/favicon.png b/test/app/static/favicon.png deleted file mode 100644 index f76753e..0000000 Binary files a/test/app/static/favicon.png and /dev/null differ diff --git a/test/app/static/global.css b/test/app/static/global.css deleted file mode 100644 index 3831b79..0000000 --- a/test/app/static/global.css +++ /dev/null @@ -1,45 +0,0 @@ -body { - margin: 0; - font-family: Roboto, -apple-system, BlinkMacSystemFont, Segoe UI, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; - font-size: 14px; - line-height: 1.5; - color: #333; -} - -main { - position: relative; - max-width: 56em; - background-color: white; - padding: 2em; - margin: 0 auto; - box-sizing: border-box; -} - -h1, h2, h3, h4, h5, h6 { - margin: 0 0 0.5em 0; - font-weight: 400; - line-height: 1.2; -} - -h1 { - font-size: 2em; -} - -a { - color: inherit; -} - -code { - font-family: menlo, inconsolata, monospace; - font-size: calc(1em - 2px); - color: #555; - background-color: #f0f0f0; - padding: 0.2em 0.4em; - border-radius: 2px; -} - -@media (min-width: 400px) { - body { - font-size: 16px; - } -} \ No newline at end of file diff --git a/test/app/static/great-success.png b/test/app/static/great-success.png deleted file mode 100644 index c38720c..0000000 Binary files a/test/app/static/great-success.png and /dev/null differ diff --git a/test/app/static/manifest.json b/test/app/static/manifest.json deleted file mode 100644 index 2b4ac3e..0000000 --- a/test/app/static/manifest.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "background_color": "#ffffff", - "theme_color": "#aa1e1e", - "name": "TODO", - "short_name": "TODO", - "display": "minimal-ui", - "start_url": "/", - "icons": [ - { - "src": "svelte-logo-192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "svelte-logo-512.png", - "sizes": "512x512", - "type": "image/png" - } - ] -} diff --git a/test/app/static/svelte-logo-192.png b/test/app/static/svelte-logo-192.png deleted file mode 100644 index d12fc1a..0000000 Binary files a/test/app/static/svelte-logo-192.png and /dev/null differ diff --git a/test/app/static/svelte-logo-512.png b/test/app/static/svelte-logo-512.png deleted file mode 100644 index 37e8198..0000000 Binary files a/test/app/static/svelte-logo-512.png and /dev/null differ diff --git a/test/app/webpack.config.js b/test/app/webpack.config.js deleted file mode 100644 index 78d0c85..0000000 --- a/test/app/webpack.config.js +++ /dev/null @@ -1,84 +0,0 @@ -const path = require('path'); -const webpack = require('webpack'); -const config = require('../../config/webpack.js'); -const sapper_pkg = require('../../package.json'); - -const mode = process.env.NODE_ENV; -const isDev = mode === 'development'; - -module.exports = { - client: { - entry: config.client.entry(), - output: config.client.output(), - resolve: { - extensions: ['.js', '.html'] - }, - module: { - rules: [ - { - test: /\.html$/, - exclude: /node_modules/, - use: { - loader: 'svelte-loader', - options: { - hydratable: true, - cascade: false, - store: true - } - } - } - ] - }, - mode, - optimization: { - minimize: false - }, - plugins: [ - isDev && new webpack.HotModuleReplacementPlugin() - ].filter(Boolean), - devtool: isDev && 'inline-source-map' - }, - - server: { - entry: config.server.entry(), - output: config.server.output(), - target: 'node', - resolve: { - extensions: ['.js', '.html'] - }, - externals: [].concat( - Object.keys(sapper_pkg.dependencies), - Object.keys(sapper_pkg.devDependencies) - ), - module: { - rules: [ - { - test: /\.html$/, - exclude: /node_modules/, - use: { - loader: 'svelte-loader', - options: { - css: false, - cascade: false, - store: true, - generate: 'ssr' - } - } - } - ] - }, - mode, - optimization: { - minimize: false - }, - performance: { - hints: false // it doesn't matter if server.js is large - } - }, - - serviceworker: { - entry: config.serviceworker.entry(), - output: config.serviceworker.output(), - mode - } -}; \ No newline at end of file diff --git a/test/apps/AppRunner.ts b/test/apps/AppRunner.ts new file mode 100644 index 0000000..6a1a48c --- /dev/null +++ b/test/apps/AppRunner.ts @@ -0,0 +1,122 @@ +import * as path from 'path'; +import * as puppeteer from 'puppeteer'; +import * as ports from 'port-authority'; +import { fork, ChildProcess } from 'child_process'; + +declare const start: () => Promise; +declare const prefetchRoutes: () => Promise; +declare const prefetch: (href: string) => Promise; +declare const goto: (href: string) => Promise; + +export class AppRunner { + cwd: string; + entry: string; + port: number; + proc: ChildProcess; + messages: any[]; + + browser: puppeteer.Browser; + page: puppeteer.Page; + + constructor(cwd: string, entry: string) { + this.cwd = cwd; + this.entry = path.join(cwd, entry); + this.messages = []; + } + + async start() { + this.port = await ports.find(3000); + + this.proc = fork(this.entry, [], { + cwd: this.cwd, + env: { + PORT: String(this.port) + } + }); + + this.proc.on('message', message => { + if (!message.__sapper__) return; + this.messages.push(message); + }); + + this.browser = await puppeteer.launch({ args: ['--no-sandbox'] }); + + this.page = await this.browser.newPage(); + this.page.on('console', msg => { + const text = msg.text(); + + if (!text.startsWith('Failed to load resource')) { + console.log(text); + } + }); + + return { + page: this.page, + base: `http://localhost:${this.port}`, + + // helpers + start: () => this.page.evaluate(() => start()), + prefetchRoutes: () => this.page.evaluate(() => prefetchRoutes()), + prefetch: (href: string) => this.page.evaluate((href: string) => prefetch(href), href), + goto: (href: string) => this.page.evaluate((href: string) => goto(href), href) + }; + } + + capture(fn: () => any): Promise { + return new Promise((fulfil, reject) => { + const requests: string[] = []; + const pending: Set = new Set(); + let done = false; + + function handle_request(request: puppeteer.Request) { + const url = request.url(); + requests.push(url); + pending.add(url); + } + + function handle_requestfinished(request: puppeteer.Request) { + const url = request.url(); + pending.delete(url); + + if (done && pending.size === 0) { + cleanup(); + fulfil(requests); + } + } + + function handle_requestfailed(request: puppeteer.Request) { + cleanup(); + reject(new Error(`failed to fetch ${request.url()}`)) + } + + const cleanup = () => { + this.page.removeListener('request', handle_request); + this.page.removeListener('requestfinished', handle_requestfinished); + this.page.removeListener('requestfailed', handle_requestfailed); + }; + + this.page.on('request', handle_request); + this.page.on('requestfinished', handle_requestfinished); + this.page.on('requestfailed', handle_requestfailed); + + return Promise.resolve(fn()).then(() => { + if (pending.size === 0) { + cleanup(); + fulfil(requests); + } + + done = true; + }); + }); + } + + end() { + return Promise.all([ + this.browser.close(), + new Promise(fulfil => { + this.proc.once('exit', fulfil); + this.proc.kill(); + }) + ]); + } +} \ No newline at end of file diff --git a/test/apps/basics/__test__.ts b/test/apps/basics/__test__.ts new file mode 100644 index 0000000..5f35532 --- /dev/null +++ b/test/apps/basics/__test__.ts @@ -0,0 +1,270 @@ +import * as path from 'path'; +import * as assert from 'assert'; +import * as puppeteer from 'puppeteer'; +import * as http from 'http'; +import { build } from '../../../api'; +import { AppRunner } from '../AppRunner'; +import { wait } from '../../utils'; + +declare let deleted: { id: number }; +declare let el: any; + +describe('basics', function() { + this.timeout(10000); + + let runner: AppRunner; + let page: puppeteer.Page; + let base: string; + + // helpers + let start: () => Promise; + let prefetchRoutes: () => Promise; + let prefetch: (href: string) => Promise; + let goto: (href: string) => Promise; + + // hooks + before(() => { + return new Promise((fulfil, reject) => { + // TODO this is brittle. Make it unnecessary + process.chdir(__dirname); + process.env.NODE_ENV = 'production'; + + // TODO this API isn't great. Rethink it + const emitter = build({ + bundler: 'rollup' + }, { + src: path.join(__dirname, 'src'), + routes: path.join(__dirname, 'src/routes'), + dest: path.join(__dirname, '__sapper__/build') + }); + + emitter.on('error', reject); + + emitter.on('done', async () => { + try { + runner = new AppRunner(__dirname, '__sapper__/build/server/server.js'); + ({ base, page, start, prefetchRoutes, prefetch, goto } = await runner.start()); + + fulfil(); + } catch (err) { + reject(err); + } + }); + }); + }); + + after(() => runner.end()); + + const title = () => page.$eval('h1', node => node.textContent); + + it('serves /', async () => { + await page.goto(base); + + assert.equal( + await title(), + 'Great success!' + ); + }); + + it('serves /?', async () => { + await page.goto(`${base}?`); + + assert.equal( + await title(), + 'Great success!' + ); + }); + + it('serves static route', async () => { + await page.goto(`${base}/a`); + + assert.equal( + await title(), + 'a' + ); + }); + + it('serves static route from dir/index.html file', async () => { + await page.goto(`${base}/b`); + + assert.equal( + await title(), + 'b' + ); + }); + + it('serves dynamic route', async () => { + await page.goto(`${base}/test-slug`); + + assert.equal( + await title(), + 'TEST-SLUG' + ); + }); + + it('navigates to a new page without reloading', async () => { + await page.goto(base); + await start(); + await prefetchRoutes(); + + const requests: string[] = await runner.capture(async () => { + await page.click('a[href="a"]'); + }); + + assert.deepEqual(requests, []); + + assert.equal( + await title(), + 'a' + ); + }); + + it('navigates programmatically', async () => { + await page.goto(`${base}/a`); + await start(); + + await goto('b'); + + assert.equal( + await title(), + 'b' + ); + }); + + it('prefetches programmatically', async () => { + await page.goto(`${base}/a`); + await start(); + + const requests = await runner.capture(() => prefetch('b')); + + assert.equal(requests.length, 2); + assert.equal(requests[1], `${base}/b.json`); + }); + + + // TODO equivalent test for a webpack app + it('sets Content-Type, Link...modulepreload, and Cache-Control headers', () => { + return new Promise((fulfil, reject) => { + const req = http.get(base, res => { + try { + const { headers } = res; + + assert.equal( + headers['content-type'], + 'text/html' + ); + + assert.equal( + headers['cache-control'], + 'max-age=600' + ); + + // TODO preload more than just the entry point + const regex = /<\/client\/client\.\w+\.js>;rel="modulepreload"/; + const link = headers['link']; + + assert.ok(regex.test(link), link); + + fulfil(); + } catch (err) { + reject(err); + } + }); + + req.on('error', reject); + }); + }); + + it('calls a delete handler', async () => { + await page.goto(`${base}/delete-test`); + await start(); + + await page.click('.del'); + await page.waitForFunction(() => deleted); + + assert.equal(await page.evaluate(() => deleted.id), 42); + }); + + it('hydrates initial route', async () => { + await page.goto(base); + + await page.evaluate(() => { + el = document.querySelector('.hydrate-test'); + }); + + await start(); + + assert.ok(await page.evaluate(() => { + return document.querySelector('.hydrate-test') === el; + })); + }); + + it('does not attempt client-side navigation to server routes', async () => { + await page.goto(base); + await start(); + await prefetchRoutes(); + + await page.click(`[href="ambiguous/ok.json"]`); + await wait(50); + + assert.equal( + await page.evaluate(() => document.body.textContent), + 'ok' + ); + }); + + it('allows reserved words as route names', async () => { + await page.goto(`${base}/const`); + await start(); + + assert.equal( + await title(), + 'reserved words are okay as routes' + ); + }); + + it('accepts value-less query string parameter on server', async () => { + await page.goto(`${base}/echo-query?message`); + + assert.equal( + await title(), + 'message: ""' + ); + }); + + it('accepts value-less query string parameter on client', async () => { + await page.goto(base); + await start(); + await prefetchRoutes(); + + await page.click('a[href="echo-query?message"]') + + assert.equal( + await title(), + 'message: ""' + ); + }); + + // skipped because Nightmare doesn't seem to focus the correctly + it('resets the active element after navigation', async () => { + await page.goto(base); + await start(); + await prefetchRoutes(); + + await page.click('[href="a"]'); + await wait(50); + + assert.equal( + await page.evaluate(() => document.activeElement.nodeName), + 'BODY' + ); + }); + + it('replaces %sapper.xxx% tags safely', async () => { + await page.goto(`${base}/unsafe-replacement`); + await start(); + + const html = await page.evaluate(() => document.body.innerHTML); + assert.equal(html.indexOf('%sapper'), -1); + }); +}); \ No newline at end of file diff --git a/test/apps/basics/rollup.config.js b/test/apps/basics/rollup.config.js new file mode 100644 index 0000000..943b676 --- /dev/null +++ b/test/apps/basics/rollup.config.js @@ -0,0 +1,64 @@ +import resolve from 'rollup-plugin-node-resolve'; +import replace from 'rollup-plugin-replace'; +import svelte from 'rollup-plugin-svelte'; + +const mode = process.env.NODE_ENV; +const dev = mode === 'development'; + +const config = require('../../../config/rollup.js'); + +export default { + client: { + input: config.client.input(), + output: config.client.output(), + plugins: [ + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + dev, + hydratable: true, + emitCss: true + }), + resolve() + ], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + server: { + input: config.server.input(), + output: config.server.output(), + plugins: [ + replace({ + 'process.browser': false, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + generate: 'ssr', + dev + }), + resolve({ + preferBuiltins: true + }) + ], + external: ['sirv', 'polka'], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + serviceworker: { + input: config.serviceworker.input(), + output: config.serviceworker.output(), + plugins: [ + resolve(), + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }) + ] + } +}; \ No newline at end of file diff --git a/test/apps/basics/src/client.js b/test/apps/basics/src/client.js new file mode 100644 index 0000000..0865a4a --- /dev/null +++ b/test/apps/basics/src/client.js @@ -0,0 +1,9 @@ +import * as sapper from '../__sapper__/client.js'; + +window.start = () => sapper.start({ + target: document.querySelector('#sapper') +}); + +window.prefetchRoutes = () => sapper.prefetchRoutes(); +window.prefetch = href => sapper.prefetch(href); +window.goto = href => sapper.goto(href); \ No newline at end of file diff --git a/test/apps/basics/src/routes/[slug].html b/test/apps/basics/src/routes/[slug].html new file mode 100644 index 0000000..ade66de --- /dev/null +++ b/test/apps/basics/src/routes/[slug].html @@ -0,0 +1 @@ +

{params.slug.toUpperCase()}

\ No newline at end of file diff --git a/test/apps/basics/src/routes/_error.html b/test/apps/basics/src/routes/_error.html new file mode 100644 index 0000000..4cd55d2 --- /dev/null +++ b/test/apps/basics/src/routes/_error.html @@ -0,0 +1,3 @@ +

{status}

+ +

{error.message}

\ No newline at end of file diff --git a/test/apps/basics/src/routes/a.html b/test/apps/basics/src/routes/a.html new file mode 100644 index 0000000..0e6757b --- /dev/null +++ b/test/apps/basics/src/routes/a.html @@ -0,0 +1 @@ +

a

\ No newline at end of file diff --git a/test/apps/basics/src/routes/ambiguous/[slug].html b/test/apps/basics/src/routes/ambiguous/[slug].html new file mode 100644 index 0000000..e69de29 diff --git a/test/apps/basics/src/routes/ambiguous/[slug].json.js b/test/apps/basics/src/routes/ambiguous/[slug].json.js new file mode 100644 index 0000000..adc3102 --- /dev/null +++ b/test/apps/basics/src/routes/ambiguous/[slug].json.js @@ -0,0 +1,3 @@ +export function get(req, res) { + res.end(req.params.slug); +} \ No newline at end of file diff --git a/test/apps/basics/src/routes/b/index.html b/test/apps/basics/src/routes/b/index.html new file mode 100644 index 0000000..d93079d --- /dev/null +++ b/test/apps/basics/src/routes/b/index.html @@ -0,0 +1,11 @@ +

{letter}

+ + \ No newline at end of file diff --git a/test/apps/basics/src/routes/b/index.json.js b/test/apps/basics/src/routes/b/index.json.js new file mode 100644 index 0000000..29b7ede --- /dev/null +++ b/test/apps/basics/src/routes/b/index.json.js @@ -0,0 +1,3 @@ +export function get(req, res) { + res.end(JSON.stringify('b')); +} \ No newline at end of file diff --git a/test/app/src/routes/const.html b/test/apps/basics/src/routes/const.html similarity index 100% rename from test/app/src/routes/const.html rename to test/apps/basics/src/routes/const.html diff --git a/test/app/src/routes/api/delete/[id].js b/test/apps/basics/src/routes/delete-test/[id].json.js similarity index 100% rename from test/app/src/routes/api/delete/[id].js rename to test/apps/basics/src/routes/delete-test/[id].json.js diff --git a/test/app/src/routes/delete-test.html b/test/apps/basics/src/routes/delete-test/index.html similarity index 67% rename from test/app/src/routes/delete-test.html rename to test/apps/basics/src/routes/delete-test/index.html index 428ab3c..a5280cb 100644 --- a/test/app/src/routes/delete-test.html +++ b/test/apps/basics/src/routes/delete-test/index.html @@ -2,9 +2,13 @@ \ No newline at end of file diff --git a/test/apps/basics/src/routes/index.html b/test/apps/basics/src/routes/index.html new file mode 100644 index 0000000..221c0f5 --- /dev/null +++ b/test/apps/basics/src/routes/index.html @@ -0,0 +1,7 @@ +

Great success!

+ +
a +ok +ok + +
\ No newline at end of file diff --git a/test/app/src/routes/unsafe-replacement.html b/test/apps/basics/src/routes/unsafe-replacement.html similarity index 100% rename from test/app/src/routes/unsafe-replacement.html rename to test/apps/basics/src/routes/unsafe-replacement.html diff --git a/test/apps/basics/src/server.js b/test/apps/basics/src/server.js new file mode 100644 index 0000000..0e7741c --- /dev/null +++ b/test/apps/basics/src/server.js @@ -0,0 +1,8 @@ +import polka from 'polka'; +import * as sapper from '../__sapper__/server.js'; + +const { PORT } = process.env; + +polka() + .use(sapper.middleware()) + .listen(PORT); diff --git a/test/app/src/service-worker.js b/test/apps/basics/src/service-worker.js similarity index 75% rename from test/app/src/service-worker.js rename to test/apps/basics/src/service-worker.js index b19f2d6..9d2ac9d 100644 --- a/test/app/src/service-worker.js +++ b/test/apps/basics/src/service-worker.js @@ -1,10 +1,10 @@ -import { files, shell, timestamp, routes } from '../__sapper__/service-worker.js'; +import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js'; -const ASSETS = `cachetimestamp`; +const ASSETS = `cache${timestamp}`; // `shell` is an array of all the files generated by webpack, -// `assets` is an array of everything in the `assets` directory -const to_cache = shell.concat(files); +// `files` is an array of everything in the `static` directory +const to_cache = shell.concat(ASSETS); const cached = new Set(to_cache); self.addEventListener('install', event => { @@ -26,19 +26,24 @@ self.addEventListener('activate', event => { if (key !== ASSETS) await caches.delete(key); } - await self.clients.claim(); + self.clients.claim(); }) ); }); self.addEventListener('fetch', event => { + if (event.request.method !== 'GET') return; + const url = new URL(event.request.url); // don't try to handle e.g. data: URIs if (!url.protocol.startsWith('http')) return; + // ignore dev server requests + if (url.hostname === self.location.hostname && url.port !== self.location.port) return; + // always serve assets and webpack-generated files from cache - if (cached.has(url.pathname)) { + if (url.host === self.location.host && cached.has(url.pathname)) { event.respondWith(caches.match(event.request)); return; } @@ -53,12 +58,14 @@ self.addEventListener('fetch', event => { } */ + if (event.request.cache === 'only-if-cached') return; + // for everything else, try the network first, falling back to // cache if the user is offline. (If the pages never change, you // might prefer a cache-first approach to a network-first one.) event.respondWith( caches - .open('offline') + .open(`offline${timestamp}`) .then(async cache => { try { const response = await fetch(event.request); diff --git a/test/apps/basics/src/template.html b/test/apps/basics/src/template.html new file mode 100644 index 0000000..0eb1f3b --- /dev/null +++ b/test/apps/basics/src/template.html @@ -0,0 +1,14 @@ + + + + + + %sapper.base% + %sapper.styles% + %sapper.head% + + +
%sapper.html%
+ %sapper.scripts% + + diff --git a/test/apps/credentials/__test__.ts b/test/apps/credentials/__test__.ts new file mode 100644 index 0000000..0f755d2 --- /dev/null +++ b/test/apps/credentials/__test__.ts @@ -0,0 +1,83 @@ +import * as path from 'path'; +import * as assert from 'assert'; +import * as puppeteer from 'puppeteer'; +import { build } from '../../../api'; +import { wait } from '../../utils'; +import { AppRunner } from '../AppRunner'; + +describe('credentials', function() { + this.timeout(10000); + + let runner: AppRunner; + let page: puppeteer.Page; + let base: string; + + // helpers + let start: () => Promise; + let prefetchRoutes: () => Promise; + + // hooks + before(() => { + return new Promise((fulfil, reject) => { + // TODO this is brittle. Make it unnecessary + process.chdir(__dirname); + process.env.NODE_ENV = 'production'; + + // TODO this API isn't great. Rethink it + const emitter = build({ + bundler: 'rollup' + }, { + src: path.join(__dirname, 'src'), + routes: path.join(__dirname, 'src/routes'), + dest: path.join(__dirname, '__sapper__/build') + }); + + emitter.on('error', reject); + + emitter.on('done', async () => { + try { + runner = new AppRunner(__dirname, '__sapper__/build/server/server.js'); + ({ base, page, start, prefetchRoutes } = await runner.start()); + + fulfil(); + } catch (err) { + reject(err); + } + }); + }); + }); + + after(() => runner.end()); + + it('sends cookies when using this.fetch with credentials: "include"', async () => { + await page.goto(`${base}/credentials?creds=include`); + + assert.equal( + await page.$eval('h1', node => node.textContent), + 'a: 1, b: 2, max-age: undefined' + ); + }); + + it('does not send cookies when using this.fetch without credentials', async () => { + await page.goto(`${base}/credentials`); + + assert.equal( + await page.$eval('h1', node => node.textContent), + 'unauthorized' + ); + }); + + it('delegates to fetch on the client', async () => { + await page.goto(base) + await start(); + await prefetchRoutes(); + + await page.click('[href="credentials?creds=include"]'); + await wait(50); + + assert.equal( + await page.$eval('h1', node => node.textContent), + 'a: 1, b: 2, max-age: undefined' + ); + }); +}); \ No newline at end of file diff --git a/test/apps/credentials/rollup.config.js b/test/apps/credentials/rollup.config.js new file mode 100644 index 0000000..045746e --- /dev/null +++ b/test/apps/credentials/rollup.config.js @@ -0,0 +1,64 @@ +import resolve from 'rollup-plugin-node-resolve'; +import replace from 'rollup-plugin-replace'; +import svelte from 'rollup-plugin-svelte'; + +const mode = process.env.NODE_ENV; +const dev = mode === 'development'; + +const config = require('../../../config/rollup.js'); + +export default { + client: { + input: config.client.input(), + output: config.client.output(), + plugins: [ + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + dev, + hydratable: true, + emitCss: true + }), + resolve() + ], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + server: { + input: config.server.input(), + output: config.server.output(), + plugins: [ + replace({ + 'process.browser': false, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + generate: 'ssr', + dev + }), + resolve({ + preferBuiltins: true + }) + ], + external: ['sirv', 'polka', 'cookie'], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + serviceworker: { + input: config.serviceworker.input(), + output: config.serviceworker.output(), + plugins: [ + resolve(), + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }) + ] + } +}; \ No newline at end of file diff --git a/test/apps/credentials/src/client.js b/test/apps/credentials/src/client.js new file mode 100644 index 0000000..0865a4a --- /dev/null +++ b/test/apps/credentials/src/client.js @@ -0,0 +1,9 @@ +import * as sapper from '../__sapper__/client.js'; + +window.start = () => sapper.start({ + target: document.querySelector('#sapper') +}); + +window.prefetchRoutes = () => sapper.prefetchRoutes(); +window.prefetch = href => sapper.prefetch(href); +window.goto = href => sapper.goto(href); \ No newline at end of file diff --git a/test/apps/credentials/src/routes/_error.html b/test/apps/credentials/src/routes/_error.html new file mode 100644 index 0000000..4cd55d2 --- /dev/null +++ b/test/apps/credentials/src/routes/_error.html @@ -0,0 +1,3 @@ +

{status}

+ +

{error.message}

\ No newline at end of file diff --git a/test/app/src/routes/credentials/index.html b/test/apps/credentials/src/routes/credentials/index.html similarity index 100% rename from test/app/src/routes/credentials/index.html rename to test/apps/credentials/src/routes/credentials/index.html diff --git a/test/app/src/routes/credentials/test.json.js b/test/apps/credentials/src/routes/credentials/test.json.js similarity index 100% rename from test/app/src/routes/credentials/test.json.js rename to test/apps/credentials/src/routes/credentials/test.json.js diff --git a/test/apps/credentials/src/routes/index.html b/test/apps/credentials/src/routes/index.html new file mode 100644 index 0000000..fdd338f --- /dev/null +++ b/test/apps/credentials/src/routes/index.html @@ -0,0 +1,3 @@ +

Great success!

+ +link \ No newline at end of file diff --git a/test/apps/credentials/src/server.js b/test/apps/credentials/src/server.js new file mode 100644 index 0000000..2761f50 --- /dev/null +++ b/test/apps/credentials/src/server.js @@ -0,0 +1,13 @@ +import polka from 'polka'; +import * as sapper from '../__sapper__/server.js'; + +const { PORT } = process.env; + +polka() + .use((req, res, next) => { + // set test cookie + res.setHeader('Set-Cookie', ['a=1; Max-Age=3600', 'b=2; Max-Age=3600']); + next(); + }) + .use(sapper.middleware()) + .listen(PORT); diff --git a/test/apps/credentials/src/service-worker.js b/test/apps/credentials/src/service-worker.js new file mode 100644 index 0000000..9d2ac9d --- /dev/null +++ b/test/apps/credentials/src/service-worker.js @@ -0,0 +1,82 @@ +import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js'; + +const ASSETS = `cache${timestamp}`; + +// `shell` is an array of all the files generated by webpack, +// `files` is an array of everything in the `static` directory +const to_cache = shell.concat(ASSETS); +const cached = new Set(to_cache); + +self.addEventListener('install', event => { + event.waitUntil( + caches + .open(ASSETS) + .then(cache => cache.addAll(to_cache)) + .then(() => { + self.skipWaiting(); + }) + ); +}); + +self.addEventListener('activate', event => { + event.waitUntil( + caches.keys().then(async keys => { + // delete old caches + for (const key of keys) { + if (key !== ASSETS) await caches.delete(key); + } + + self.clients.claim(); + }) + ); +}); + +self.addEventListener('fetch', event => { + if (event.request.method !== 'GET') return; + + const url = new URL(event.request.url); + + // don't try to handle e.g. data: URIs + if (!url.protocol.startsWith('http')) return; + + // ignore dev server requests + if (url.hostname === self.location.hostname && url.port !== self.location.port) return; + + // always serve assets and webpack-generated files from cache + if (url.host === self.location.host && cached.has(url.pathname)) { + event.respondWith(caches.match(event.request)); + return; + } + + // for pages, you might want to serve a shell `index.html` file, + // which Sapper has generated for you. It's not right for every + // app, but if it's right for yours then uncomment this section + /* + if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) { + event.respondWith(caches.match('/index.html')); + return; + } + */ + + if (event.request.cache === 'only-if-cached') return; + + // for everything else, try the network first, falling back to + // cache if the user is offline. (If the pages never change, you + // might prefer a cache-first approach to a network-first one.) + event.respondWith( + caches + .open(`offline${timestamp}`) + .then(async cache => { + try { + const response = await fetch(event.request); + cache.put(event.request, response.clone()); + return response; + } catch(err) { + const response = await cache.match(event.request); + if (response) return response; + + throw err; + } + }) + ); +}); diff --git a/test/apps/credentials/src/template.html b/test/apps/credentials/src/template.html new file mode 100644 index 0000000..0eb1f3b --- /dev/null +++ b/test/apps/credentials/src/template.html @@ -0,0 +1,14 @@ + + + + + + %sapper.base% + %sapper.styles% + %sapper.head% + + +
%sapper.html%
+ %sapper.scripts% + + diff --git a/test/apps/encoding/__test__.ts b/test/apps/encoding/__test__.ts new file mode 100644 index 0000000..c63e029 --- /dev/null +++ b/test/apps/encoding/__test__.ts @@ -0,0 +1,92 @@ +import * as path from 'path'; +import * as assert from 'assert'; +import * as puppeteer from 'puppeteer'; +import { build } from '../../../api'; +import { AppRunner } from '../AppRunner'; +import { wait } from '../../utils'; + +describe('encoding', function() { + this.timeout(10000); + + let runner: AppRunner; + let page: puppeteer.Page; + let base: string; + + // helpers + let start: () => Promise; + let prefetchRoutes: () => Promise; + + // hooks + before(() => { + return new Promise((fulfil, reject) => { + // TODO this is brittle. Make it unnecessary + process.chdir(__dirname); + process.env.NODE_ENV = 'production'; + + // TODO this API isn't great. Rethink it + const emitter = build({ + bundler: 'rollup' + }, { + src: path.join(__dirname, 'src'), + routes: path.join(__dirname, 'src/routes'), + dest: path.join(__dirname, '__sapper__/build') + }); + + emitter.on('error', reject); + + emitter.on('done', async () => { + try { + runner = new AppRunner(__dirname, '__sapper__/build/server/server.js'); + ({ base, page, start, prefetchRoutes } = await runner.start()); + + fulfil(); + } catch (err) { + reject(err); + } + }); + }); + }); + + after(() => runner.end()); + + it('encodes routes', async () => { + await page.goto(`${base}/fünke`); + + assert.equal( + await page.$eval('h1', node => node.textContent), + `I'm afraid I just blue myself` + ); + }); + + it('encodes req.params and req.query for server-rendered pages', async () => { + await page.goto(`${base}/echo/page/encöded?message=hëllö+wörld`); + + assert.equal( + await page.$eval('h1', node => node.textContent), + 'encöded (hëllö wörld)' + ); + }); + + it('encodes req.params and req.query for client-rendered pages', async () => { + await page.goto(base); + await start(); + await prefetchRoutes(); + + await page.click('a[href="echo/page/encöded?message=hëllö+wörld"]'); + await wait(50); + + assert.equal( + await page.$eval('h1', node => node.textContent), + 'encöded (hëllö wörld)' + ); + }); + + it('encodes req.params for server routes', async () => { + await page.goto(`${base}/echo/server-route/encöded`); + + assert.equal( + await page.$eval('h1', node => node.textContent), + 'encöded' + ); + }); +}); \ No newline at end of file diff --git a/test/apps/encoding/rollup.config.js b/test/apps/encoding/rollup.config.js new file mode 100644 index 0000000..943b676 --- /dev/null +++ b/test/apps/encoding/rollup.config.js @@ -0,0 +1,64 @@ +import resolve from 'rollup-plugin-node-resolve'; +import replace from 'rollup-plugin-replace'; +import svelte from 'rollup-plugin-svelte'; + +const mode = process.env.NODE_ENV; +const dev = mode === 'development'; + +const config = require('../../../config/rollup.js'); + +export default { + client: { + input: config.client.input(), + output: config.client.output(), + plugins: [ + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + dev, + hydratable: true, + emitCss: true + }), + resolve() + ], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + server: { + input: config.server.input(), + output: config.server.output(), + plugins: [ + replace({ + 'process.browser': false, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + generate: 'ssr', + dev + }), + resolve({ + preferBuiltins: true + }) + ], + external: ['sirv', 'polka'], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + serviceworker: { + input: config.serviceworker.input(), + output: config.serviceworker.output(), + plugins: [ + resolve(), + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }) + ] + } +}; \ No newline at end of file diff --git a/test/apps/encoding/src/client.js b/test/apps/encoding/src/client.js new file mode 100644 index 0000000..0865a4a --- /dev/null +++ b/test/apps/encoding/src/client.js @@ -0,0 +1,9 @@ +import * as sapper from '../__sapper__/client.js'; + +window.start = () => sapper.start({ + target: document.querySelector('#sapper') +}); + +window.prefetchRoutes = () => sapper.prefetchRoutes(); +window.prefetch = href => sapper.prefetch(href); +window.goto = href => sapper.goto(href); \ No newline at end of file diff --git a/test/apps/encoding/src/routes/_error.html b/test/apps/encoding/src/routes/_error.html new file mode 100644 index 0000000..4cd55d2 --- /dev/null +++ b/test/apps/encoding/src/routes/_error.html @@ -0,0 +1,3 @@ +

{status}

+ +

{error.message}

\ No newline at end of file diff --git a/test/app/src/routes/echo/page/[slug].html b/test/apps/encoding/src/routes/echo/page/[slug].html similarity index 100% rename from test/app/src/routes/echo/page/[slug].html rename to test/apps/encoding/src/routes/echo/page/[slug].html diff --git a/test/app/src/routes/echo/server-route/[slug].js b/test/apps/encoding/src/routes/echo/server-route/[slug].js similarity index 100% rename from test/app/src/routes/echo/server-route/[slug].js rename to test/apps/encoding/src/routes/echo/server-route/[slug].js diff --git a/test/app/src/routes/fünke.html b/test/apps/encoding/src/routes/fünke.html similarity index 100% rename from test/app/src/routes/fünke.html rename to test/apps/encoding/src/routes/fünke.html diff --git a/test/app/src/routes/fünke.json.js b/test/apps/encoding/src/routes/fünke.json.js similarity index 100% rename from test/app/src/routes/fünke.json.js rename to test/apps/encoding/src/routes/fünke.json.js diff --git a/test/apps/encoding/src/routes/index.html b/test/apps/encoding/src/routes/index.html new file mode 100644 index 0000000..bedde7e --- /dev/null +++ b/test/apps/encoding/src/routes/index.html @@ -0,0 +1,3 @@ +

Great success!

+ +link \ No newline at end of file diff --git a/test/apps/encoding/src/server.js b/test/apps/encoding/src/server.js new file mode 100644 index 0000000..0e7741c --- /dev/null +++ b/test/apps/encoding/src/server.js @@ -0,0 +1,8 @@ +import polka from 'polka'; +import * as sapper from '../__sapper__/server.js'; + +const { PORT } = process.env; + +polka() + .use(sapper.middleware()) + .listen(PORT); diff --git a/test/apps/encoding/src/service-worker.js b/test/apps/encoding/src/service-worker.js new file mode 100644 index 0000000..9d2ac9d --- /dev/null +++ b/test/apps/encoding/src/service-worker.js @@ -0,0 +1,82 @@ +import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js'; + +const ASSETS = `cache${timestamp}`; + +// `shell` is an array of all the files generated by webpack, +// `files` is an array of everything in the `static` directory +const to_cache = shell.concat(ASSETS); +const cached = new Set(to_cache); + +self.addEventListener('install', event => { + event.waitUntil( + caches + .open(ASSETS) + .then(cache => cache.addAll(to_cache)) + .then(() => { + self.skipWaiting(); + }) + ); +}); + +self.addEventListener('activate', event => { + event.waitUntil( + caches.keys().then(async keys => { + // delete old caches + for (const key of keys) { + if (key !== ASSETS) await caches.delete(key); + } + + self.clients.claim(); + }) + ); +}); + +self.addEventListener('fetch', event => { + if (event.request.method !== 'GET') return; + + const url = new URL(event.request.url); + + // don't try to handle e.g. data: URIs + if (!url.protocol.startsWith('http')) return; + + // ignore dev server requests + if (url.hostname === self.location.hostname && url.port !== self.location.port) return; + + // always serve assets and webpack-generated files from cache + if (url.host === self.location.host && cached.has(url.pathname)) { + event.respondWith(caches.match(event.request)); + return; + } + + // for pages, you might want to serve a shell `index.html` file, + // which Sapper has generated for you. It's not right for every + // app, but if it's right for yours then uncomment this section + /* + if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) { + event.respondWith(caches.match('/index.html')); + return; + } + */ + + if (event.request.cache === 'only-if-cached') return; + + // for everything else, try the network first, falling back to + // cache if the user is offline. (If the pages never change, you + // might prefer a cache-first approach to a network-first one.) + event.respondWith( + caches + .open(`offline${timestamp}`) + .then(async cache => { + try { + const response = await fetch(event.request); + cache.put(event.request, response.clone()); + return response; + } catch(err) { + const response = await cache.match(event.request); + if (response) return response; + + throw err; + } + }) + ); +}); diff --git a/test/apps/encoding/src/template.html b/test/apps/encoding/src/template.html new file mode 100644 index 0000000..0eb1f3b --- /dev/null +++ b/test/apps/encoding/src/template.html @@ -0,0 +1,14 @@ + + + + + + %sapper.base% + %sapper.styles% + %sapper.head% + + +
%sapper.html%
+ %sapper.scripts% + + diff --git a/test/apps/errors/__test__.ts b/test/apps/errors/__test__.ts new file mode 100644 index 0000000..f718b06 --- /dev/null +++ b/test/apps/errors/__test__.ts @@ -0,0 +1,137 @@ +import * as path from 'path'; +import * as assert from 'assert'; +import * as puppeteer from 'puppeteer'; +import { build } from '../../../api'; +import { AppRunner } from '../AppRunner'; +import { wait } from '../../utils'; + +describe('errors', function() { + this.timeout(10000); + + let runner: AppRunner; + let page: puppeteer.Page; + let base: string; + + // helpers + let start: () => Promise; + let prefetchRoutes: () => Promise; + + // hooks + before(() => { + return new Promise((fulfil, reject) => { + // TODO this is brittle. Make it unnecessary + process.chdir(__dirname); + process.env.NODE_ENV = 'production'; + + // TODO this API isn't great. Rethink it + const emitter = build({ + bundler: 'rollup' + }, { + src: path.join(__dirname, 'src'), + routes: path.join(__dirname, 'src/routes'), + dest: path.join(__dirname, '__sapper__/build') + }); + + emitter.on('error', reject); + + emitter.on('done', async () => { + try { + runner = new AppRunner(__dirname, '__sapper__/build/server/server.js'); + ({ base, page, start, prefetchRoutes } = await runner.start()); + + fulfil(); + } catch (err) { + reject(err); + } + }); + }); + }); + + after(() => runner.end()); + + it('handles missing route on server', async () => { + await page.goto(`${base}/nope`); + + assert.equal( + await page.$eval('h1', node => node.textContent), + '404' + ); + }); + + it('handles missing route on client', async () => { + await page.goto(base); + await start(); + + await page.click('[href="nope"]'); + await wait(50); + + assert.equal( + await page.$eval('h1', node => node.textContent), + '404' + ); + }); + + it('handles explicit 4xx on server', async () => { + await page.goto(`${base}/blog/nope`); + + assert.equal( + await page.$eval('h1', node => node.textContent), + '404' + ); + }); + + it('handles explicit 4xx on client', async () => { + await page.goto(base); + await start(); + await prefetchRoutes(); + + await page.click('[href="blog/nope"]'); + await wait(50); + + assert.equal( + await page.$eval('h1', node => node.textContent), + '404' + ); + }); + + it('handles error on server', async () => { + await page.goto(`${base}/throw`); + + assert.equal( + await page.$eval('h1', node => node.textContent), + '500' + ); + }); + + it('handles error on client', async () => { + await page.goto(base); + await start(); + await prefetchRoutes(); + + await page.click('[href="throw"]'); + await wait(50); + + assert.equal( + await page.$eval('h1', node => node.textContent), + '500' + ); + }); + + it('does not serve error page for explicit non-page errors', async () => { + await page.goto(`${base}/nope.json`); + + assert.equal( + await page.evaluate(() => document.body.textContent), + 'nope' + ); + }); + + it('does not serve error page for thrown non-page errors', async () => { + await page.goto(`${base}/throw.json`); + + assert.equal( + await page.evaluate(() => document.body.textContent), + 'oops' + ); + }); +}); \ No newline at end of file diff --git a/test/apps/errors/rollup.config.js b/test/apps/errors/rollup.config.js new file mode 100644 index 0000000..943b676 --- /dev/null +++ b/test/apps/errors/rollup.config.js @@ -0,0 +1,64 @@ +import resolve from 'rollup-plugin-node-resolve'; +import replace from 'rollup-plugin-replace'; +import svelte from 'rollup-plugin-svelte'; + +const mode = process.env.NODE_ENV; +const dev = mode === 'development'; + +const config = require('../../../config/rollup.js'); + +export default { + client: { + input: config.client.input(), + output: config.client.output(), + plugins: [ + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + dev, + hydratable: true, + emitCss: true + }), + resolve() + ], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + server: { + input: config.server.input(), + output: config.server.output(), + plugins: [ + replace({ + 'process.browser': false, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + generate: 'ssr', + dev + }), + resolve({ + preferBuiltins: true + }) + ], + external: ['sirv', 'polka'], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + serviceworker: { + input: config.serviceworker.input(), + output: config.serviceworker.output(), + plugins: [ + resolve(), + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }) + ] + } +}; \ No newline at end of file diff --git a/test/apps/errors/src/client.js b/test/apps/errors/src/client.js new file mode 100644 index 0000000..0865a4a --- /dev/null +++ b/test/apps/errors/src/client.js @@ -0,0 +1,9 @@ +import * as sapper from '../__sapper__/client.js'; + +window.start = () => sapper.start({ + target: document.querySelector('#sapper') +}); + +window.prefetchRoutes = () => sapper.prefetchRoutes(); +window.prefetch = href => sapper.prefetch(href); +window.goto = href => sapper.goto(href); \ No newline at end of file diff --git a/test/apps/errors/src/routes/_error.html b/test/apps/errors/src/routes/_error.html new file mode 100644 index 0000000..4cd55d2 --- /dev/null +++ b/test/apps/errors/src/routes/_error.html @@ -0,0 +1,3 @@ +

{status}

+ +

{error.message}

\ No newline at end of file diff --git a/test/apps/errors/src/routes/blog/[slug].html b/test/apps/errors/src/routes/blog/[slug].html new file mode 100644 index 0000000..8a304d0 --- /dev/null +++ b/test/apps/errors/src/routes/blog/[slug].html @@ -0,0 +1,19 @@ +

{post.title}

+ + \ No newline at end of file diff --git a/test/apps/errors/src/routes/blog/[slug].json.js b/test/apps/errors/src/routes/blog/[slug].json.js new file mode 100644 index 0000000..5e2e2a7 --- /dev/null +++ b/test/apps/errors/src/routes/blog/[slug].json.js @@ -0,0 +1,9 @@ +export function get(req, res) { + res.writeHead(404, { + 'Content-Type': 'application/json' + }); + + res.end(JSON.stringify({ + message: 'not found' + })); +} \ No newline at end of file diff --git a/test/apps/errors/src/routes/index.html b/test/apps/errors/src/routes/index.html new file mode 100644 index 0000000..a6b7896 --- /dev/null +++ b/test/apps/errors/src/routes/index.html @@ -0,0 +1,5 @@ +

root

+ +nope +blog/nope +throw \ No newline at end of file diff --git a/test/apps/errors/src/routes/nope.json.js b/test/apps/errors/src/routes/nope.json.js new file mode 100644 index 0000000..3813784 --- /dev/null +++ b/test/apps/errors/src/routes/nope.json.js @@ -0,0 +1,4 @@ +export function get(req, res) { + res.writeHead(500); + res.end('nope'); +} \ No newline at end of file diff --git a/test/apps/errors/src/routes/throw.html b/test/apps/errors/src/routes/throw.html new file mode 100644 index 0000000..16b4131 --- /dev/null +++ b/test/apps/errors/src/routes/throw.html @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/test/apps/errors/src/routes/throw.json.js b/test/apps/errors/src/routes/throw.json.js new file mode 100644 index 0000000..5247b57 --- /dev/null +++ b/test/apps/errors/src/routes/throw.json.js @@ -0,0 +1,3 @@ +export function get(req, res) { + throw new Error('oops'); +} \ No newline at end of file diff --git a/test/apps/errors/src/server.js b/test/apps/errors/src/server.js new file mode 100644 index 0000000..0e7741c --- /dev/null +++ b/test/apps/errors/src/server.js @@ -0,0 +1,8 @@ +import polka from 'polka'; +import * as sapper from '../__sapper__/server.js'; + +const { PORT } = process.env; + +polka() + .use(sapper.middleware()) + .listen(PORT); diff --git a/test/apps/errors/src/service-worker.js b/test/apps/errors/src/service-worker.js new file mode 100644 index 0000000..9d2ac9d --- /dev/null +++ b/test/apps/errors/src/service-worker.js @@ -0,0 +1,82 @@ +import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js'; + +const ASSETS = `cache${timestamp}`; + +// `shell` is an array of all the files generated by webpack, +// `files` is an array of everything in the `static` directory +const to_cache = shell.concat(ASSETS); +const cached = new Set(to_cache); + +self.addEventListener('install', event => { + event.waitUntil( + caches + .open(ASSETS) + .then(cache => cache.addAll(to_cache)) + .then(() => { + self.skipWaiting(); + }) + ); +}); + +self.addEventListener('activate', event => { + event.waitUntil( + caches.keys().then(async keys => { + // delete old caches + for (const key of keys) { + if (key !== ASSETS) await caches.delete(key); + } + + self.clients.claim(); + }) + ); +}); + +self.addEventListener('fetch', event => { + if (event.request.method !== 'GET') return; + + const url = new URL(event.request.url); + + // don't try to handle e.g. data: URIs + if (!url.protocol.startsWith('http')) return; + + // ignore dev server requests + if (url.hostname === self.location.hostname && url.port !== self.location.port) return; + + // always serve assets and webpack-generated files from cache + if (url.host === self.location.host && cached.has(url.pathname)) { + event.respondWith(caches.match(event.request)); + return; + } + + // for pages, you might want to serve a shell `index.html` file, + // which Sapper has generated for you. It's not right for every + // app, but if it's right for yours then uncomment this section + /* + if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) { + event.respondWith(caches.match('/index.html')); + return; + } + */ + + if (event.request.cache === 'only-if-cached') return; + + // for everything else, try the network first, falling back to + // cache if the user is offline. (If the pages never change, you + // might prefer a cache-first approach to a network-first one.) + event.respondWith( + caches + .open(`offline${timestamp}`) + .then(async cache => { + try { + const response = await fetch(event.request); + cache.put(event.request, response.clone()); + return response; + } catch(err) { + const response = await cache.match(event.request); + if (response) return response; + + throw err; + } + }) + ); +}); diff --git a/test/apps/errors/src/template.html b/test/apps/errors/src/template.html new file mode 100644 index 0000000..0eb1f3b --- /dev/null +++ b/test/apps/errors/src/template.html @@ -0,0 +1,14 @@ + + + + + + %sapper.base% + %sapper.styles% + %sapper.head% + + +
%sapper.html%
+ %sapper.scripts% + + diff --git a/test/apps/export/__test__.ts b/test/apps/export/__test__.ts new file mode 100644 index 0000000..9d422e3 --- /dev/null +++ b/test/apps/export/__test__.ts @@ -0,0 +1,70 @@ +import * as path from 'path'; +import * as assert from 'assert'; +import { walk } from '../../utils'; +import * as api from '../../../api'; + +describe('export', function() { + this.timeout(10000); + + // hooks + before(() => { + return new Promise((fulfil, reject) => { + // TODO this is brittle. Make it unnecessary + process.chdir(__dirname); + process.env.NODE_ENV = 'production'; + + // TODO this API isn't great. Rethink it + const builder = api.build({ + bundler: 'rollup' + }, { + src: path.join(__dirname, 'src'), + routes: path.join(__dirname, 'src/routes'), + dest: path.join(__dirname, '__sapper__/build') + }); + + builder.on('error', reject); + builder.on('done', () => { + // TODO it'd be nice if build and export returned promises. + // not sure how best to combine promise and event emitter + const exporter = api.exporter({ + build: '__sapper__/build', + dest: '__sapper__/export', + static: 'static', + basepath: '', + timeout: 5000 + }); + + exporter.on('error', (err: Error) => { + console.error(err); + reject(err); + }); + exporter.on('done', () => fulfil()); + }); + }); + }); + + it('crawls a site', () => { + const files = walk('__sapper__/export'); + + const client_assets = files.filter(file => file.startsWith('client/')); + const non_client_assets = files.filter(file => !file.startsWith('client/')).sort(); + + assert.ok(client_assets.length > 0); + + assert.deepEqual(non_client_assets, [ + 'blog.json', + 'blog/bar.json', + 'blog/bar/index.html', + 'blog/baz.json', + 'blog/baz/index.html', + 'blog/foo.json', + 'blog/foo/index.html', + 'blog/index.html', + 'global.css', + 'index.html', + 'service-worker.js' + ]); + }); + + // TODO test timeout, basepath +}); \ No newline at end of file diff --git a/test/apps/export/rollup.config.js b/test/apps/export/rollup.config.js new file mode 100644 index 0000000..943b676 --- /dev/null +++ b/test/apps/export/rollup.config.js @@ -0,0 +1,64 @@ +import resolve from 'rollup-plugin-node-resolve'; +import replace from 'rollup-plugin-replace'; +import svelte from 'rollup-plugin-svelte'; + +const mode = process.env.NODE_ENV; +const dev = mode === 'development'; + +const config = require('../../../config/rollup.js'); + +export default { + client: { + input: config.client.input(), + output: config.client.output(), + plugins: [ + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + dev, + hydratable: true, + emitCss: true + }), + resolve() + ], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + server: { + input: config.server.input(), + output: config.server.output(), + plugins: [ + replace({ + 'process.browser': false, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + generate: 'ssr', + dev + }), + resolve({ + preferBuiltins: true + }) + ], + external: ['sirv', 'polka'], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + serviceworker: { + input: config.serviceworker.input(), + output: config.serviceworker.output(), + plugins: [ + resolve(), + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }) + ] + } +}; \ No newline at end of file diff --git a/test/apps/export/src/client.js b/test/apps/export/src/client.js new file mode 100644 index 0000000..0865a4a --- /dev/null +++ b/test/apps/export/src/client.js @@ -0,0 +1,9 @@ +import * as sapper from '../__sapper__/client.js'; + +window.start = () => sapper.start({ + target: document.querySelector('#sapper') +}); + +window.prefetchRoutes = () => sapper.prefetchRoutes(); +window.prefetch = href => sapper.prefetch(href); +window.goto = href => sapper.goto(href); \ No newline at end of file diff --git a/test/apps/export/src/routes/_error.html b/test/apps/export/src/routes/_error.html new file mode 100644 index 0000000..4cd55d2 --- /dev/null +++ b/test/apps/export/src/routes/_error.html @@ -0,0 +1,3 @@ +

{status}

+ +

{error.message}

\ No newline at end of file diff --git a/test/apps/export/src/routes/blog/[slug].html b/test/apps/export/src/routes/blog/[slug].html new file mode 100644 index 0000000..f44adaa --- /dev/null +++ b/test/apps/export/src/routes/blog/[slug].html @@ -0,0 +1,11 @@ +

{post.title}

+ + \ No newline at end of file diff --git a/test/apps/export/src/routes/blog/[slug].json.js b/test/apps/export/src/routes/blog/[slug].json.js new file mode 100644 index 0000000..66781ad --- /dev/null +++ b/test/apps/export/src/routes/blog/[slug].json.js @@ -0,0 +1,19 @@ +import posts from './_posts.js'; + +export function get(req, res) { + const post = posts.find(post => post.slug === req.params.slug); + + if (post) { + res.writeHead(200, { + 'Content-Type': 'application/json' + }); + + res.end(JSON.stringify(post)); + } else { + res.writeHead(404, { + 'Content-Type': 'application/json' + }); + + res.end(JSON.stringify({ message: 'not found' })); + } +} \ No newline at end of file diff --git a/test/apps/export/src/routes/blog/_posts.js b/test/apps/export/src/routes/blog/_posts.js new file mode 100644 index 0000000..d283aa6 --- /dev/null +++ b/test/apps/export/src/routes/blog/_posts.js @@ -0,0 +1,5 @@ +export default [ + { slug: 'foo', title: 'once upon a foo' }, + { slug: 'bar', title: 'a bar is born' }, + { slug: 'baz', title: 'bazzily ever after' } +]; \ No newline at end of file diff --git a/test/apps/export/src/routes/blog/index.html b/test/apps/export/src/routes/blog/index.html new file mode 100644 index 0000000..2eea681 --- /dev/null +++ b/test/apps/export/src/routes/blog/index.html @@ -0,0 +1,15 @@ +

blog

+ +{#each posts as post} +

{post.title}

+{/each} + + \ No newline at end of file diff --git a/test/apps/export/src/routes/blog/index.json.js b/test/apps/export/src/routes/blog/index.json.js new file mode 100644 index 0000000..0097f77 --- /dev/null +++ b/test/apps/export/src/routes/blog/index.json.js @@ -0,0 +1,9 @@ +import posts from './_posts.js'; + +export function get(req, res) { + res.writeHead(200, { + 'Content-Type': 'application/json' + }); + + res.end(JSON.stringify(posts)); +} \ No newline at end of file diff --git a/test/apps/export/src/routes/index.html b/test/apps/export/src/routes/index.html new file mode 100644 index 0000000..37f82e0 --- /dev/null +++ b/test/apps/export/src/routes/index.html @@ -0,0 +1,3 @@ +

Great success!

+ +blog \ No newline at end of file diff --git a/test/apps/export/src/server.js b/test/apps/export/src/server.js new file mode 100644 index 0000000..d5a668b --- /dev/null +++ b/test/apps/export/src/server.js @@ -0,0 +1,15 @@ +import sirv from 'sirv'; +import polka from 'polka'; +import * as sapper from '../__sapper__/server.js'; + +const { PORT, NODE_ENV } = process.env; +const dev = NODE_ENV === 'development'; + +polka() + .use( + sirv('static', { dev }), + sapper.middleware() + ) + .listen(PORT, err => { + if (err) console.log('error', err); + }); diff --git a/test/apps/export/src/service-worker.js b/test/apps/export/src/service-worker.js new file mode 100644 index 0000000..9d2ac9d --- /dev/null +++ b/test/apps/export/src/service-worker.js @@ -0,0 +1,82 @@ +import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js'; + +const ASSETS = `cache${timestamp}`; + +// `shell` is an array of all the files generated by webpack, +// `files` is an array of everything in the `static` directory +const to_cache = shell.concat(ASSETS); +const cached = new Set(to_cache); + +self.addEventListener('install', event => { + event.waitUntil( + caches + .open(ASSETS) + .then(cache => cache.addAll(to_cache)) + .then(() => { + self.skipWaiting(); + }) + ); +}); + +self.addEventListener('activate', event => { + event.waitUntil( + caches.keys().then(async keys => { + // delete old caches + for (const key of keys) { + if (key !== ASSETS) await caches.delete(key); + } + + self.clients.claim(); + }) + ); +}); + +self.addEventListener('fetch', event => { + if (event.request.method !== 'GET') return; + + const url = new URL(event.request.url); + + // don't try to handle e.g. data: URIs + if (!url.protocol.startsWith('http')) return; + + // ignore dev server requests + if (url.hostname === self.location.hostname && url.port !== self.location.port) return; + + // always serve assets and webpack-generated files from cache + if (url.host === self.location.host && cached.has(url.pathname)) { + event.respondWith(caches.match(event.request)); + return; + } + + // for pages, you might want to serve a shell `index.html` file, + // which Sapper has generated for you. It's not right for every + // app, but if it's right for yours then uncomment this section + /* + if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) { + event.respondWith(caches.match('/index.html')); + return; + } + */ + + if (event.request.cache === 'only-if-cached') return; + + // for everything else, try the network first, falling back to + // cache if the user is offline. (If the pages never change, you + // might prefer a cache-first approach to a network-first one.) + event.respondWith( + caches + .open(`offline${timestamp}`) + .then(async cache => { + try { + const response = await fetch(event.request); + cache.put(event.request, response.clone()); + return response; + } catch(err) { + const response = await cache.match(event.request); + if (response) return response; + + throw err; + } + }) + ); +}); diff --git a/test/apps/export/src/template.html b/test/apps/export/src/template.html new file mode 100644 index 0000000..0eb1f3b --- /dev/null +++ b/test/apps/export/src/template.html @@ -0,0 +1,14 @@ + + + + + + %sapper.base% + %sapper.styles% + %sapper.head% + + +
%sapper.html%
+ %sapper.scripts% + + diff --git a/test/apps/export/static/global.css b/test/apps/export/static/global.css new file mode 100644 index 0000000..800f57a --- /dev/null +++ b/test/apps/export/static/global.css @@ -0,0 +1,3 @@ +body { + font-family: 'Comic Sans MS'; +} \ No newline at end of file diff --git a/test/apps/ignore/__test__.ts b/test/apps/ignore/__test__.ts new file mode 100644 index 0000000..b38423b --- /dev/null +++ b/test/apps/ignore/__test__.ts @@ -0,0 +1,82 @@ +import * as path from 'path'; +import * as assert from 'assert'; +import * as puppeteer from 'puppeteer'; +import { build } from '../../../api'; +import { AppRunner } from '../AppRunner'; + +describe('ignore', function() { + this.timeout(10000); + + let runner: AppRunner; + let page: puppeteer.Page; + let base: string; + + // hooks + before(() => { + return new Promise((fulfil, reject) => { + // TODO this is brittle. Make it unnecessary + process.chdir(__dirname); + process.env.NODE_ENV = 'production'; + + // TODO this API isn't great. Rethink it + const emitter = build({ + bundler: 'rollup' + }, { + src: path.join(__dirname, 'src'), + routes: path.join(__dirname, 'src/routes'), + dest: path.join(__dirname, '__sapper__/build') + }); + + emitter.on('error', reject); + + emitter.on('done', async () => { + try { + runner = new AppRunner(__dirname, '__sapper__/build/server/server.js'); + ({ base, page } = await runner.start()); + + fulfil(); + } catch (err) { + reject(err); + } + }); + }); + }); + + after(() => runner.end()); + + it('respects `options.ignore` values (RegExp)', async () => { + await page.goto(`${base}/foobar`); + + assert.equal( + await page.evaluate(() => document.documentElement.textContent), + 'foobar' + ); + }); + + it('respects `options.ignore` values (String #1)', async () => { + await page.goto(`${base}/buzz`); + + assert.equal( + await page.evaluate(() => document.documentElement.textContent), + 'buzz' + ); + }); + + it('respects `options.ignore` values (String #2)', async () => { + await page.goto(`${base}/fizzer`); + + assert.equal( + await page.evaluate(() => document.documentElement.textContent), + 'fizzer' + ); + }); + + it('respects `options.ignore` values (Function)', async () => { + await page.goto(`${base}/hello`); + + assert.equal( + await page.evaluate(() => document.documentElement.textContent), + 'hello' + ); + }); +}); \ No newline at end of file diff --git a/test/apps/ignore/rollup.config.js b/test/apps/ignore/rollup.config.js new file mode 100644 index 0000000..943b676 --- /dev/null +++ b/test/apps/ignore/rollup.config.js @@ -0,0 +1,64 @@ +import resolve from 'rollup-plugin-node-resolve'; +import replace from 'rollup-plugin-replace'; +import svelte from 'rollup-plugin-svelte'; + +const mode = process.env.NODE_ENV; +const dev = mode === 'development'; + +const config = require('../../../config/rollup.js'); + +export default { + client: { + input: config.client.input(), + output: config.client.output(), + plugins: [ + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + dev, + hydratable: true, + emitCss: true + }), + resolve() + ], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + server: { + input: config.server.input(), + output: config.server.output(), + plugins: [ + replace({ + 'process.browser': false, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + generate: 'ssr', + dev + }), + resolve({ + preferBuiltins: true + }) + ], + external: ['sirv', 'polka'], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + serviceworker: { + input: config.serviceworker.input(), + output: config.serviceworker.output(), + plugins: [ + resolve(), + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }) + ] + } +}; \ No newline at end of file diff --git a/test/apps/ignore/src/client.js b/test/apps/ignore/src/client.js new file mode 100644 index 0000000..0865a4a --- /dev/null +++ b/test/apps/ignore/src/client.js @@ -0,0 +1,9 @@ +import * as sapper from '../__sapper__/client.js'; + +window.start = () => sapper.start({ + target: document.querySelector('#sapper') +}); + +window.prefetchRoutes = () => sapper.prefetchRoutes(); +window.prefetch = href => sapper.prefetch(href); +window.goto = href => sapper.goto(href); \ No newline at end of file diff --git a/test/apps/ignore/src/routes/[slug].html b/test/apps/ignore/src/routes/[slug].html new file mode 100644 index 0000000..ade66de --- /dev/null +++ b/test/apps/ignore/src/routes/[slug].html @@ -0,0 +1 @@ +

{params.slug.toUpperCase()}

\ No newline at end of file diff --git a/test/apps/ignore/src/routes/_error.html b/test/apps/ignore/src/routes/_error.html new file mode 100644 index 0000000..4cd55d2 --- /dev/null +++ b/test/apps/ignore/src/routes/_error.html @@ -0,0 +1,3 @@ +

{status}

+ +

{error.message}

\ No newline at end of file diff --git a/test/apps/ignore/src/routes/a.html b/test/apps/ignore/src/routes/a.html new file mode 100644 index 0000000..0e6757b --- /dev/null +++ b/test/apps/ignore/src/routes/a.html @@ -0,0 +1 @@ +

a

\ No newline at end of file diff --git a/test/apps/ignore/src/routes/b/index.html b/test/apps/ignore/src/routes/b/index.html new file mode 100644 index 0000000..d93079d --- /dev/null +++ b/test/apps/ignore/src/routes/b/index.html @@ -0,0 +1,11 @@ +

{letter}

+ + \ No newline at end of file diff --git a/test/apps/ignore/src/routes/b/index.json.js b/test/apps/ignore/src/routes/b/index.json.js new file mode 100644 index 0000000..29b7ede --- /dev/null +++ b/test/apps/ignore/src/routes/b/index.json.js @@ -0,0 +1,3 @@ +export function get(req, res) { + res.end(JSON.stringify('b')); +} \ No newline at end of file diff --git a/test/apps/ignore/src/routes/index.html b/test/apps/ignore/src/routes/index.html new file mode 100644 index 0000000..e08c0cb --- /dev/null +++ b/test/apps/ignore/src/routes/index.html @@ -0,0 +1,3 @@ +

Great success!

+ +a \ No newline at end of file diff --git a/test/apps/ignore/src/server.js b/test/apps/ignore/src/server.js new file mode 100644 index 0000000..f987e4a --- /dev/null +++ b/test/apps/ignore/src/server.js @@ -0,0 +1,19 @@ +import polka from 'polka'; +import * as sapper from '../__sapper__/server.js'; + +const { PORT } = process.env; + +const app = polka().use(sapper.middleware({ + ignore: [ + /foobar/i, + '/buzz', + 'fizz', + x => x === '/hello' + ] +})); + +['foobar', 'buzz', 'fizzer', 'hello'].forEach(uri => { + app.get('/'+uri, (req, res) => res.end(uri)); +}); + +app.listen(PORT); diff --git a/test/apps/ignore/src/service-worker.js b/test/apps/ignore/src/service-worker.js new file mode 100644 index 0000000..9d2ac9d --- /dev/null +++ b/test/apps/ignore/src/service-worker.js @@ -0,0 +1,82 @@ +import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js'; + +const ASSETS = `cache${timestamp}`; + +// `shell` is an array of all the files generated by webpack, +// `files` is an array of everything in the `static` directory +const to_cache = shell.concat(ASSETS); +const cached = new Set(to_cache); + +self.addEventListener('install', event => { + event.waitUntil( + caches + .open(ASSETS) + .then(cache => cache.addAll(to_cache)) + .then(() => { + self.skipWaiting(); + }) + ); +}); + +self.addEventListener('activate', event => { + event.waitUntil( + caches.keys().then(async keys => { + // delete old caches + for (const key of keys) { + if (key !== ASSETS) await caches.delete(key); + } + + self.clients.claim(); + }) + ); +}); + +self.addEventListener('fetch', event => { + if (event.request.method !== 'GET') return; + + const url = new URL(event.request.url); + + // don't try to handle e.g. data: URIs + if (!url.protocol.startsWith('http')) return; + + // ignore dev server requests + if (url.hostname === self.location.hostname && url.port !== self.location.port) return; + + // always serve assets and webpack-generated files from cache + if (url.host === self.location.host && cached.has(url.pathname)) { + event.respondWith(caches.match(event.request)); + return; + } + + // for pages, you might want to serve a shell `index.html` file, + // which Sapper has generated for you. It's not right for every + // app, but if it's right for yours then uncomment this section + /* + if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) { + event.respondWith(caches.match('/index.html')); + return; + } + */ + + if (event.request.cache === 'only-if-cached') return; + + // for everything else, try the network first, falling back to + // cache if the user is offline. (If the pages never change, you + // might prefer a cache-first approach to a network-first one.) + event.respondWith( + caches + .open(`offline${timestamp}`) + .then(async cache => { + try { + const response = await fetch(event.request); + cache.put(event.request, response.clone()); + return response; + } catch(err) { + const response = await cache.match(event.request); + if (response) return response; + + throw err; + } + }) + ); +}); diff --git a/test/apps/ignore/src/template.html b/test/apps/ignore/src/template.html new file mode 100644 index 0000000..0eb1f3b --- /dev/null +++ b/test/apps/ignore/src/template.html @@ -0,0 +1,14 @@ + + + + + + %sapper.base% + %sapper.styles% + %sapper.head% + + +
%sapper.html%
+ %sapper.scripts% + + diff --git a/test/apps/layout/__test__.ts b/test/apps/layout/__test__.ts new file mode 100644 index 0000000..7edc390 --- /dev/null +++ b/test/apps/layout/__test__.ts @@ -0,0 +1,74 @@ +import * as path from 'path'; +import * as assert from 'assert'; +import * as puppeteer from 'puppeteer'; +import { build } from '../../../api'; +import { AppRunner } from '../AppRunner'; +import { wait } from '../../utils'; + +describe('layout', function() { + this.timeout(10000); + + let runner: AppRunner; + let page: puppeteer.Page; + let base: string; + + // helpers + let start: () => Promise; + + // hooks + before(() => { + return new Promise((fulfil, reject) => { + // TODO this is brittle. Make it unnecessary + process.chdir(__dirname); + process.env.NODE_ENV = 'production'; + + // TODO this API isn't great. Rethink it + const emitter = build({ + bundler: 'rollup' + }, { + src: path.join(__dirname, 'src'), + routes: path.join(__dirname, 'src/routes'), + dest: path.join(__dirname, '__sapper__/build') + }); + + emitter.on('error', reject); + + emitter.on('done', async () => { + try { + runner = new AppRunner(__dirname, '__sapper__/build/server/server.js'); + ({ base, page, start } = await runner.start()); + + fulfil(); + } catch (err) { + reject(err); + } + }); + }); + }); + + after(() => runner.end()); + + it('only recreates components when necessary', async () => { + await page.goto(`${base}/foo/bar/baz`); + await start(); + + const text1 = await page.evaluate(() => document.querySelector('#sapper').textContent); + assert.deepEqual(text1.split('\n').filter(Boolean), [ + 'y: bar 1', + 'z: baz 1', + 'click me', + 'child segment: baz' + ]); + + await page.click('[href="foo/bar/qux"]'); + await wait(50); + + const text2 = await page.evaluate(() => document.querySelector('#sapper').textContent); + assert.deepEqual(text2.split('\n').filter(Boolean), [ + 'y: bar 1', + 'z: qux 2', + 'click me', + 'child segment: qux' + ]); + }); +}); \ No newline at end of file diff --git a/test/apps/layout/rollup.config.js b/test/apps/layout/rollup.config.js new file mode 100644 index 0000000..943b676 --- /dev/null +++ b/test/apps/layout/rollup.config.js @@ -0,0 +1,64 @@ +import resolve from 'rollup-plugin-node-resolve'; +import replace from 'rollup-plugin-replace'; +import svelte from 'rollup-plugin-svelte'; + +const mode = process.env.NODE_ENV; +const dev = mode === 'development'; + +const config = require('../../../config/rollup.js'); + +export default { + client: { + input: config.client.input(), + output: config.client.output(), + plugins: [ + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + dev, + hydratable: true, + emitCss: true + }), + resolve() + ], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + server: { + input: config.server.input(), + output: config.server.output(), + plugins: [ + replace({ + 'process.browser': false, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + generate: 'ssr', + dev + }), + resolve({ + preferBuiltins: true + }) + ], + external: ['sirv', 'polka'], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + serviceworker: { + input: config.serviceworker.input(), + output: config.serviceworker.output(), + plugins: [ + resolve(), + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }) + ] + } +}; \ No newline at end of file diff --git a/test/apps/layout/src/client.js b/test/apps/layout/src/client.js new file mode 100644 index 0000000..0865a4a --- /dev/null +++ b/test/apps/layout/src/client.js @@ -0,0 +1,9 @@ +import * as sapper from '../__sapper__/client.js'; + +window.start = () => sapper.start({ + target: document.querySelector('#sapper') +}); + +window.prefetchRoutes = () => sapper.prefetchRoutes(); +window.prefetch = href => sapper.prefetch(href); +window.goto = href => sapper.goto(href); \ No newline at end of file diff --git a/test/apps/layout/src/routes/[slug].html b/test/apps/layout/src/routes/[slug].html new file mode 100644 index 0000000..ade66de --- /dev/null +++ b/test/apps/layout/src/routes/[slug].html @@ -0,0 +1 @@ +

{params.slug.toUpperCase()}

\ No newline at end of file diff --git a/test/app/src/routes/[x]/[y]/[z].html b/test/apps/layout/src/routes/[x]/[y]/[z].html similarity index 87% rename from test/app/src/routes/[x]/[y]/[z].html rename to test/apps/layout/src/routes/[x]/[y]/[z].html index 787e413..018f001 100644 --- a/test/app/src/routes/[x]/[y]/[z].html +++ b/test/apps/layout/src/routes/[x]/[y]/[z].html @@ -1,5 +1,5 @@ z: {segment} {count} - +click me + \ No newline at end of file diff --git a/test/app/src/routes/redirect-to.html b/test/apps/redirects/src/routes/redirect-to.html similarity index 100% rename from test/app/src/routes/redirect-to.html rename to test/apps/redirects/src/routes/redirect-to.html diff --git a/test/apps/redirects/src/server.js b/test/apps/redirects/src/server.js new file mode 100644 index 0000000..0e7741c --- /dev/null +++ b/test/apps/redirects/src/server.js @@ -0,0 +1,8 @@ +import polka from 'polka'; +import * as sapper from '../__sapper__/server.js'; + +const { PORT } = process.env; + +polka() + .use(sapper.middleware()) + .listen(PORT); diff --git a/test/apps/redirects/src/service-worker.js b/test/apps/redirects/src/service-worker.js new file mode 100644 index 0000000..9d2ac9d --- /dev/null +++ b/test/apps/redirects/src/service-worker.js @@ -0,0 +1,82 @@ +import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js'; + +const ASSETS = `cache${timestamp}`; + +// `shell` is an array of all the files generated by webpack, +// `files` is an array of everything in the `static` directory +const to_cache = shell.concat(ASSETS); +const cached = new Set(to_cache); + +self.addEventListener('install', event => { + event.waitUntil( + caches + .open(ASSETS) + .then(cache => cache.addAll(to_cache)) + .then(() => { + self.skipWaiting(); + }) + ); +}); + +self.addEventListener('activate', event => { + event.waitUntil( + caches.keys().then(async keys => { + // delete old caches + for (const key of keys) { + if (key !== ASSETS) await caches.delete(key); + } + + self.clients.claim(); + }) + ); +}); + +self.addEventListener('fetch', event => { + if (event.request.method !== 'GET') return; + + const url = new URL(event.request.url); + + // don't try to handle e.g. data: URIs + if (!url.protocol.startsWith('http')) return; + + // ignore dev server requests + if (url.hostname === self.location.hostname && url.port !== self.location.port) return; + + // always serve assets and webpack-generated files from cache + if (url.host === self.location.host && cached.has(url.pathname)) { + event.respondWith(caches.match(event.request)); + return; + } + + // for pages, you might want to serve a shell `index.html` file, + // which Sapper has generated for you. It's not right for every + // app, but if it's right for yours then uncomment this section + /* + if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) { + event.respondWith(caches.match('/index.html')); + return; + } + */ + + if (event.request.cache === 'only-if-cached') return; + + // for everything else, try the network first, falling back to + // cache if the user is offline. (If the pages never change, you + // might prefer a cache-first approach to a network-first one.) + event.respondWith( + caches + .open(`offline${timestamp}`) + .then(async cache => { + try { + const response = await fetch(event.request); + cache.put(event.request, response.clone()); + return response; + } catch(err) { + const response = await cache.match(event.request); + if (response) return response; + + throw err; + } + }) + ); +}); diff --git a/test/apps/redirects/src/template.html b/test/apps/redirects/src/template.html new file mode 100644 index 0000000..0eb1f3b --- /dev/null +++ b/test/apps/redirects/src/template.html @@ -0,0 +1,14 @@ + + + + + + %sapper.base% + %sapper.styles% + %sapper.head% + + +
%sapper.html%
+ %sapper.scripts% + + diff --git a/test/apps/scroll/__test__.ts b/test/apps/scroll/__test__.ts new file mode 100644 index 0000000..4e6e403 --- /dev/null +++ b/test/apps/scroll/__test__.ts @@ -0,0 +1,86 @@ +import * as assert from 'assert'; +import * as path from 'path'; +import * as puppeteer from 'puppeteer'; +import { build } from '../../../api'; +import { AppRunner } from '../AppRunner'; +import { wait } from '../../utils'; + +describe('scroll', function() { + this.timeout(10000); + + let runner: AppRunner; + let page: puppeteer.Page; + let base: string; + + // helpers + let start: () => Promise; + let prefetchRoutes: () => Promise; + + // hooks + before(() => { + return new Promise((fulfil, reject) => { + // TODO this is brittle. Make it unnecessary + process.chdir(__dirname); + process.env.NODE_ENV = 'production'; + + // TODO this API isn't great. Rethink it + const emitter = build({ + bundler: 'rollup' + }, { + src: path.join(__dirname, 'src'), + routes: path.join(__dirname, 'src/routes'), + dest: path.join(__dirname, '__sapper__/build') + }); + + emitter.on('error', reject); + + emitter.on('done', async () => { + try { + runner = new AppRunner(__dirname, '__sapper__/build/server/server.js'); + ({ base, page, start, prefetchRoutes } = await runner.start()); + + fulfil(); + } catch (err) { + reject(err); + } + }); + }); + }); + + after(() => runner.end()); + + it('scrolls to active deeplink', async () => { + await page.goto(`${base}/tall-page#foo`); + await start(); + + const scrollY = await page.evaluate(() => window.scrollY); + assert.ok(scrollY > 0, scrollY); + }); + + it('resets scroll when a link is clicked', async () => { + await page.goto(`${base}/tall-page#foo`); + await start(); + await prefetchRoutes(); + + await page.click('[href="another-tall-page"]'); + await wait(50); + + assert.equal( + await page.evaluate(() => window.scrollY), + 0 + ); + }); + + it('preserves scroll when a link with sapper-noscroll is clicked', async () => { + await page.goto(`${base}/tall-page#foo`); + await start(); + await prefetchRoutes(); + + await page.click('[href="another-tall-page"][sapper-noscroll]'); + await wait(50); + + const scrollY = await page.evaluate(() => window.scrollY); + + assert.ok(scrollY > 0); + }); +}); \ No newline at end of file diff --git a/test/apps/scroll/rollup.config.js b/test/apps/scroll/rollup.config.js new file mode 100644 index 0000000..943b676 --- /dev/null +++ b/test/apps/scroll/rollup.config.js @@ -0,0 +1,64 @@ +import resolve from 'rollup-plugin-node-resolve'; +import replace from 'rollup-plugin-replace'; +import svelte from 'rollup-plugin-svelte'; + +const mode = process.env.NODE_ENV; +const dev = mode === 'development'; + +const config = require('../../../config/rollup.js'); + +export default { + client: { + input: config.client.input(), + output: config.client.output(), + plugins: [ + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + dev, + hydratable: true, + emitCss: true + }), + resolve() + ], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + server: { + input: config.server.input(), + output: config.server.output(), + plugins: [ + replace({ + 'process.browser': false, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + generate: 'ssr', + dev + }), + resolve({ + preferBuiltins: true + }) + ], + external: ['sirv', 'polka'], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + serviceworker: { + input: config.serviceworker.input(), + output: config.serviceworker.output(), + plugins: [ + resolve(), + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }) + ] + } +}; \ No newline at end of file diff --git a/test/apps/scroll/src/client.js b/test/apps/scroll/src/client.js new file mode 100644 index 0000000..0865a4a --- /dev/null +++ b/test/apps/scroll/src/client.js @@ -0,0 +1,9 @@ +import * as sapper from '../__sapper__/client.js'; + +window.start = () => sapper.start({ + target: document.querySelector('#sapper') +}); + +window.prefetchRoutes = () => sapper.prefetchRoutes(); +window.prefetch = href => sapper.prefetch(href); +window.goto = href => sapper.goto(href); \ No newline at end of file diff --git a/test/apps/scroll/src/routes/_error.html b/test/apps/scroll/src/routes/_error.html new file mode 100644 index 0000000..4cd55d2 --- /dev/null +++ b/test/apps/scroll/src/routes/_error.html @@ -0,0 +1,3 @@ +

{status}

+ +

{error.message}

\ No newline at end of file diff --git a/test/apps/scroll/src/routes/another-tall-page.html b/test/apps/scroll/src/routes/another-tall-page.html new file mode 100644 index 0000000..d3e148c --- /dev/null +++ b/test/apps/scroll/src/routes/another-tall-page.html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/test/apps/scroll/src/routes/index.html b/test/apps/scroll/src/routes/index.html new file mode 100644 index 0000000..0cc4b72 --- /dev/null +++ b/test/apps/scroll/src/routes/index.html @@ -0,0 +1 @@ +

Great success!

\ No newline at end of file diff --git a/test/apps/scroll/src/routes/tall-page.html b/test/apps/scroll/src/routes/tall-page.html new file mode 100644 index 0000000..7e42ff9 --- /dev/null +++ b/test/apps/scroll/src/routes/tall-page.html @@ -0,0 +1,6 @@ +
+ +
+ link + link +
\ No newline at end of file diff --git a/test/apps/scroll/src/server.js b/test/apps/scroll/src/server.js new file mode 100644 index 0000000..0e7741c --- /dev/null +++ b/test/apps/scroll/src/server.js @@ -0,0 +1,8 @@ +import polka from 'polka'; +import * as sapper from '../__sapper__/server.js'; + +const { PORT } = process.env; + +polka() + .use(sapper.middleware()) + .listen(PORT); diff --git a/test/apps/scroll/src/service-worker.js b/test/apps/scroll/src/service-worker.js new file mode 100644 index 0000000..9d2ac9d --- /dev/null +++ b/test/apps/scroll/src/service-worker.js @@ -0,0 +1,82 @@ +import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js'; + +const ASSETS = `cache${timestamp}`; + +// `shell` is an array of all the files generated by webpack, +// `files` is an array of everything in the `static` directory +const to_cache = shell.concat(ASSETS); +const cached = new Set(to_cache); + +self.addEventListener('install', event => { + event.waitUntil( + caches + .open(ASSETS) + .then(cache => cache.addAll(to_cache)) + .then(() => { + self.skipWaiting(); + }) + ); +}); + +self.addEventListener('activate', event => { + event.waitUntil( + caches.keys().then(async keys => { + // delete old caches + for (const key of keys) { + if (key !== ASSETS) await caches.delete(key); + } + + self.clients.claim(); + }) + ); +}); + +self.addEventListener('fetch', event => { + if (event.request.method !== 'GET') return; + + const url = new URL(event.request.url); + + // don't try to handle e.g. data: URIs + if (!url.protocol.startsWith('http')) return; + + // ignore dev server requests + if (url.hostname === self.location.hostname && url.port !== self.location.port) return; + + // always serve assets and webpack-generated files from cache + if (url.host === self.location.host && cached.has(url.pathname)) { + event.respondWith(caches.match(event.request)); + return; + } + + // for pages, you might want to serve a shell `index.html` file, + // which Sapper has generated for you. It's not right for every + // app, but if it's right for yours then uncomment this section + /* + if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) { + event.respondWith(caches.match('/index.html')); + return; + } + */ + + if (event.request.cache === 'only-if-cached') return; + + // for everything else, try the network first, falling back to + // cache if the user is offline. (If the pages never change, you + // might prefer a cache-first approach to a network-first one.) + event.respondWith( + caches + .open(`offline${timestamp}`) + .then(async cache => { + try { + const response = await fetch(event.request); + cache.put(event.request, response.clone()); + return response; + } catch(err) { + const response = await cache.match(event.request); + if (response) return response; + + throw err; + } + }) + ); +}); diff --git a/test/apps/scroll/src/template.html b/test/apps/scroll/src/template.html new file mode 100644 index 0000000..0eb1f3b --- /dev/null +++ b/test/apps/scroll/src/template.html @@ -0,0 +1,14 @@ + + + + + + %sapper.base% + %sapper.styles% + %sapper.head% + + +
%sapper.html%
+ %sapper.scripts% + + diff --git a/test/apps/store/__test__.ts b/test/apps/store/__test__.ts new file mode 100644 index 0000000..c61f3c0 --- /dev/null +++ b/test/apps/store/__test__.ts @@ -0,0 +1,60 @@ +import * as path from 'path'; +import * as assert from 'assert'; +import * as puppeteer from 'puppeteer'; +import { build } from '../../../api'; +import { AppRunner } from '../AppRunner'; + +describe('store', function() { + this.timeout(10000); + + let runner: AppRunner; + let page: puppeteer.Page; + let base: string; + + // helpers + let start: () => Promise; + + // hooks + before(() => { + return new Promise((fulfil, reject) => { + // TODO this is brittle. Make it unnecessary + process.chdir(__dirname); + process.env.NODE_ENV = 'production'; + + // TODO this API isn't great. Rethink it + const emitter = build({ + bundler: 'rollup' + }, { + src: path.join(__dirname, 'src'), + routes: path.join(__dirname, 'src/routes'), + dest: path.join(__dirname, '__sapper__/build') + }); + + emitter.on('error', reject); + + emitter.on('done', async () => { + try { + runner = new AppRunner(__dirname, '__sapper__/build/server/server.js'); + ({ base, page, start } = await runner.start()); + + fulfil(); + } catch (err) { + reject(err); + } + }); + }); + }); + + after(() => runner.end()); + + const title = () => page.$eval('h1', node => node.textContent); + + it('renders store props', async () => { + await page.goto(`${base}/store`); + + assert.equal(await title(), 'hello world'); + + await start(); + assert.equal(await title(), 'hello world'); + }); +}); \ No newline at end of file diff --git a/test/apps/store/rollup.config.js b/test/apps/store/rollup.config.js new file mode 100644 index 0000000..943b676 --- /dev/null +++ b/test/apps/store/rollup.config.js @@ -0,0 +1,64 @@ +import resolve from 'rollup-plugin-node-resolve'; +import replace from 'rollup-plugin-replace'; +import svelte from 'rollup-plugin-svelte'; + +const mode = process.env.NODE_ENV; +const dev = mode === 'development'; + +const config = require('../../../config/rollup.js'); + +export default { + client: { + input: config.client.input(), + output: config.client.output(), + plugins: [ + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + dev, + hydratable: true, + emitCss: true + }), + resolve() + ], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + server: { + input: config.server.input(), + output: config.server.output(), + plugins: [ + replace({ + 'process.browser': false, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + generate: 'ssr', + dev + }), + resolve({ + preferBuiltins: true + }) + ], + external: ['sirv', 'polka'], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + serviceworker: { + input: config.serviceworker.input(), + output: config.serviceworker.output(), + plugins: [ + resolve(), + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }) + ] + } +}; \ No newline at end of file diff --git a/test/apps/store/src/client.js b/test/apps/store/src/client.js new file mode 100644 index 0000000..df66471 --- /dev/null +++ b/test/apps/store/src/client.js @@ -0,0 +1,11 @@ +import { Store } from 'svelte/store.js'; +import * as sapper from '../__sapper__/client.js'; + +window.start = () => sapper.start({ + target: document.querySelector('#sapper'), + store: data => new Store(data) +}); + +window.prefetchRoutes = () => sapper.prefetchRoutes(); +window.prefetch = href => sapper.prefetch(href); +window.goto = href => sapper.goto(href); \ No newline at end of file diff --git a/test/apps/store/src/routes/_error.html b/test/apps/store/src/routes/_error.html new file mode 100644 index 0000000..4cd55d2 --- /dev/null +++ b/test/apps/store/src/routes/_error.html @@ -0,0 +1,3 @@ +

{status}

+ +

{error.message}

\ No newline at end of file diff --git a/test/apps/store/src/routes/index.html b/test/apps/store/src/routes/index.html new file mode 100644 index 0000000..221c0f5 --- /dev/null +++ b/test/apps/store/src/routes/index.html @@ -0,0 +1,7 @@ +

Great success!

+ +a +ok +ok + +
\ No newline at end of file diff --git a/test/app/src/routes/store.html b/test/apps/store/src/routes/store.html similarity index 100% rename from test/app/src/routes/store.html rename to test/apps/store/src/routes/store.html diff --git a/test/apps/store/src/server.js b/test/apps/store/src/server.js new file mode 100644 index 0000000..c40e690 --- /dev/null +++ b/test/apps/store/src/server.js @@ -0,0 +1,22 @@ +import polka from 'polka'; +import { Store } from 'svelte/store.js'; +import * as sapper from '../__sapper__/server.js'; + +const { PORT } = process.env; + +polka() + .use((req, res, next) => { + req.hello = 'hello'; + res.locals = { name: 'world' }; + next(); + }) + .use( + sapper.middleware({ + store: (req, res) => { + return new Store({ + title: `${req.hello} ${res.locals.name}` + }); + } + }) + ) + .listen(PORT); diff --git a/test/apps/store/src/service-worker.js b/test/apps/store/src/service-worker.js new file mode 100644 index 0000000..9d2ac9d --- /dev/null +++ b/test/apps/store/src/service-worker.js @@ -0,0 +1,82 @@ +import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js'; + +const ASSETS = `cache${timestamp}`; + +// `shell` is an array of all the files generated by webpack, +// `files` is an array of everything in the `static` directory +const to_cache = shell.concat(ASSETS); +const cached = new Set(to_cache); + +self.addEventListener('install', event => { + event.waitUntil( + caches + .open(ASSETS) + .then(cache => cache.addAll(to_cache)) + .then(() => { + self.skipWaiting(); + }) + ); +}); + +self.addEventListener('activate', event => { + event.waitUntil( + caches.keys().then(async keys => { + // delete old caches + for (const key of keys) { + if (key !== ASSETS) await caches.delete(key); + } + + self.clients.claim(); + }) + ); +}); + +self.addEventListener('fetch', event => { + if (event.request.method !== 'GET') return; + + const url = new URL(event.request.url); + + // don't try to handle e.g. data: URIs + if (!url.protocol.startsWith('http')) return; + + // ignore dev server requests + if (url.hostname === self.location.hostname && url.port !== self.location.port) return; + + // always serve assets and webpack-generated files from cache + if (url.host === self.location.host && cached.has(url.pathname)) { + event.respondWith(caches.match(event.request)); + return; + } + + // for pages, you might want to serve a shell `index.html` file, + // which Sapper has generated for you. It's not right for every + // app, but if it's right for yours then uncomment this section + /* + if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) { + event.respondWith(caches.match('/index.html')); + return; + } + */ + + if (event.request.cache === 'only-if-cached') return; + + // for everything else, try the network first, falling back to + // cache if the user is offline. (If the pages never change, you + // might prefer a cache-first approach to a network-first one.) + event.respondWith( + caches + .open(`offline${timestamp}`) + .then(async cache => { + try { + const response = await fetch(event.request); + cache.put(event.request, response.clone()); + return response; + } catch(err) { + const response = await cache.match(event.request); + if (response) return response; + + throw err; + } + }) + ); +}); diff --git a/test/apps/store/src/template.html b/test/apps/store/src/template.html new file mode 100644 index 0000000..0eb1f3b --- /dev/null +++ b/test/apps/store/src/template.html @@ -0,0 +1,14 @@ + + + + + + %sapper.base% + %sapper.styles% + %sapper.head% + + +
%sapper.html%
+ %sapper.scripts% + + diff --git a/test/apps/with-basepath/__test__.ts b/test/apps/with-basepath/__test__.ts new file mode 100644 index 0000000..83a4916 --- /dev/null +++ b/test/apps/with-basepath/__test__.ts @@ -0,0 +1,97 @@ +import * as path from 'path'; +import * as assert from 'assert'; +import * as puppeteer from 'puppeteer'; +import * as api from '../../../api'; +import { walk } from '../../utils'; +import { AppRunner } from '../AppRunner'; + +describe('with-basepath', function() { + this.timeout(10000); + + let runner: AppRunner; + let page: puppeteer.Page; + let base: string; + + // hooks + before(() => { + return new Promise((fulfil, reject) => { + // TODO this is brittle. Make it unnecessary + process.chdir(__dirname); + process.env.NODE_ENV = 'production'; + + // TODO this API isn't great. Rethink it + const builder = api.build({ + bundler: 'rollup' + }, { + src: path.join(__dirname, 'src'), + routes: path.join(__dirname, 'src/routes'), + dest: path.join(__dirname, '__sapper__/build') + }); + + builder.on('error', reject); + builder.on('done', () => { + // TODO it'd be nice if build and export returned promises. + // not sure how best to combine promise and event emitter + const exporter = api.exporter({ + build: '__sapper__/build', + dest: '__sapper__/export', + static: 'static', + basepath: 'custom-basepath', + timeout: 5000 + }); + + exporter.on('error', (err: Error) => { + console.error(err); + reject(err); + }); + + exporter.on('done', async () => { + try { + runner = new AppRunner(__dirname, '__sapper__/build/server/server.js'); + ({ base, page } = await runner.start()); + + fulfil(); + } catch (err) { + reject(err); + } + }); + }); + }); + }); + + after(() => runner.end()); + + it('serves /custom-basepath', async () => { + await page.goto(`${base}/custom-basepath`); + + assert.equal( + await page.$eval('h1', node => node.textContent), + 'Great success!' + ); + }); + + it('emits a basepath message', async () => { + await page.goto(`${base}/custom-basepath`); + + assert.deepEqual(runner.messages, [{ + __sapper__: true, + event: 'basepath', + basepath: '/custom-basepath' + }]); + }); + + it('crawls an exported site with basepath', () => { + const files = walk('__sapper__/export'); + + const client_assets = files.filter(file => file.startsWith('custom-basepath/client/')); + const non_client_assets = files.filter(file => !file.startsWith('custom-basepath/client/')).sort(); + + assert.ok(client_assets.length > 0); + + assert.deepEqual(non_client_assets, [ + 'custom-basepath/global.css', + 'custom-basepath/index.html', + 'custom-basepath/service-worker.js' + ]); + }); +}); \ No newline at end of file diff --git a/test/apps/with-basepath/rollup.config.js b/test/apps/with-basepath/rollup.config.js new file mode 100644 index 0000000..943b676 --- /dev/null +++ b/test/apps/with-basepath/rollup.config.js @@ -0,0 +1,64 @@ +import resolve from 'rollup-plugin-node-resolve'; +import replace from 'rollup-plugin-replace'; +import svelte from 'rollup-plugin-svelte'; + +const mode = process.env.NODE_ENV; +const dev = mode === 'development'; + +const config = require('../../../config/rollup.js'); + +export default { + client: { + input: config.client.input(), + output: config.client.output(), + plugins: [ + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + dev, + hydratable: true, + emitCss: true + }), + resolve() + ], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + server: { + input: config.server.input(), + output: config.server.output(), + plugins: [ + replace({ + 'process.browser': false, + 'process.env.NODE_ENV': JSON.stringify(mode) + }), + svelte({ + generate: 'ssr', + dev + }), + resolve({ + preferBuiltins: true + }) + ], + external: ['sirv', 'polka'], + + // temporary, pending Rollup 1.0 + experimentalCodeSplitting: true + }, + + serviceworker: { + input: config.serviceworker.input(), + output: config.serviceworker.output(), + plugins: [ + resolve(), + replace({ + 'process.browser': true, + 'process.env.NODE_ENV': JSON.stringify(mode) + }) + ] + } +}; \ No newline at end of file diff --git a/test/apps/with-basepath/src/client.js b/test/apps/with-basepath/src/client.js new file mode 100644 index 0000000..0865a4a --- /dev/null +++ b/test/apps/with-basepath/src/client.js @@ -0,0 +1,9 @@ +import * as sapper from '../__sapper__/client.js'; + +window.start = () => sapper.start({ + target: document.querySelector('#sapper') +}); + +window.prefetchRoutes = () => sapper.prefetchRoutes(); +window.prefetch = href => sapper.prefetch(href); +window.goto = href => sapper.goto(href); \ No newline at end of file diff --git a/test/apps/with-basepath/src/routes/_error.html b/test/apps/with-basepath/src/routes/_error.html new file mode 100644 index 0000000..4cd55d2 --- /dev/null +++ b/test/apps/with-basepath/src/routes/_error.html @@ -0,0 +1,3 @@ +

{status}

+ +

{error.message}

\ No newline at end of file diff --git a/test/apps/with-basepath/src/routes/index.html b/test/apps/with-basepath/src/routes/index.html new file mode 100644 index 0000000..0cc4b72 --- /dev/null +++ b/test/apps/with-basepath/src/routes/index.html @@ -0,0 +1 @@ +

Great success!

\ No newline at end of file diff --git a/test/apps/with-basepath/src/server.js b/test/apps/with-basepath/src/server.js new file mode 100644 index 0000000..b187dad --- /dev/null +++ b/test/apps/with-basepath/src/server.js @@ -0,0 +1,16 @@ +import sirv from 'sirv'; +import polka from 'polka'; +import * as sapper from '../__sapper__/server.js'; + +const { PORT, NODE_ENV } = process.env; +const dev = NODE_ENV === 'development'; + +polka() + .use( + 'custom-basepath', + sirv('static', { dev }), + sapper.middleware() + ) + .listen(PORT, err => { + if (err) console.log('error', err); + }); diff --git a/test/apps/with-basepath/src/service-worker.js b/test/apps/with-basepath/src/service-worker.js new file mode 100644 index 0000000..9d2ac9d --- /dev/null +++ b/test/apps/with-basepath/src/service-worker.js @@ -0,0 +1,82 @@ +import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js'; + +const ASSETS = `cache${timestamp}`; + +// `shell` is an array of all the files generated by webpack, +// `files` is an array of everything in the `static` directory +const to_cache = shell.concat(ASSETS); +const cached = new Set(to_cache); + +self.addEventListener('install', event => { + event.waitUntil( + caches + .open(ASSETS) + .then(cache => cache.addAll(to_cache)) + .then(() => { + self.skipWaiting(); + }) + ); +}); + +self.addEventListener('activate', event => { + event.waitUntil( + caches.keys().then(async keys => { + // delete old caches + for (const key of keys) { + if (key !== ASSETS) await caches.delete(key); + } + + self.clients.claim(); + }) + ); +}); + +self.addEventListener('fetch', event => { + if (event.request.method !== 'GET') return; + + const url = new URL(event.request.url); + + // don't try to handle e.g. data: URIs + if (!url.protocol.startsWith('http')) return; + + // ignore dev server requests + if (url.hostname === self.location.hostname && url.port !== self.location.port) return; + + // always serve assets and webpack-generated files from cache + if (url.host === self.location.host && cached.has(url.pathname)) { + event.respondWith(caches.match(event.request)); + return; + } + + // for pages, you might want to serve a shell `index.html` file, + // which Sapper has generated for you. It's not right for every + // app, but if it's right for yours then uncomment this section + /* + if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) { + event.respondWith(caches.match('/index.html')); + return; + } + */ + + if (event.request.cache === 'only-if-cached') return; + + // for everything else, try the network first, falling back to + // cache if the user is offline. (If the pages never change, you + // might prefer a cache-first approach to a network-first one.) + event.respondWith( + caches + .open(`offline${timestamp}`) + .then(async cache => { + try { + const response = await fetch(event.request); + cache.put(event.request, response.clone()); + return response; + } catch(err) { + const response = await cache.match(event.request); + if (response) return response; + + throw err; + } + }) + ); +}); diff --git a/test/apps/with-basepath/src/template.html b/test/apps/with-basepath/src/template.html new file mode 100644 index 0000000..0eb1f3b --- /dev/null +++ b/test/apps/with-basepath/src/template.html @@ -0,0 +1,14 @@ + + + + + + %sapper.base% + %sapper.styles% + %sapper.head% + + +
%sapper.html%
+ %sapper.scripts% + + diff --git a/test/apps/with-basepath/static/global.css b/test/apps/with-basepath/static/global.css new file mode 100644 index 0000000..800f57a --- /dev/null +++ b/test/apps/with-basepath/static/global.css @@ -0,0 +1,3 @@ +body { + font-family: 'Comic Sans MS'; +} \ No newline at end of file diff --git a/test/common/test.js b/test/common/test.js deleted file mode 100644 index b48303b..0000000 --- a/test/common/test.js +++ /dev/null @@ -1,874 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const assert = require('assert'); -const Nightmare = require('nightmare'); -const walkSync = require('walk-sync'); -const rimraf = require('rimraf'); -const ports = require('port-authority'); -const fetch = require('node-fetch'); - -Nightmare.action('page', { - title(done) { - this.evaluate_now(() => document.querySelector('h1').textContent, done); - }, - - html(done) { - this.evaluate_now(() => document.documentElement.innerHTML, done); - }, - - text(done) { - this.evaluate_now(() => document.body.textContent, done); - } -}); - -Nightmare.action('init', function(done) { - this.evaluate_now(() => window.init(), done); -}); - -Nightmare.action('prefetchRoutes', function(done) { - this.evaluate_now(() => window.prefetchRoutes(), done); -}); - -const cli = path.resolve(__dirname, '../../sapper'); - -const wait = ms => new Promise(f => setTimeout(f, ms)); - -describe('sapper', function() { - process.chdir(path.resolve(__dirname, '../app')); - - // clean up after previous test runs - rimraf.sync('__sapper__'); - - this.timeout(process.env.CI ? 30000 : 15000); - - // TODO reinstate dev tests - // run({ - // mode: 'development' - // }); - - run({ - mode: 'production' - }); - - run({ - mode: 'production', - basepath: '/custom-basepath' - }); - - testExport({}); - - testExport({ basepath: '/custom-basepath' }); -}); - -function testExport({ basepath = '' }) { - describe(basepath ? `export --basepath ${basepath}` : 'export', () => { - before(() => { - if (basepath) { - process.env.BASEPATH = basepath; - } - - return exec(`node ${cli} export ${basepath ? `--basepath ${basepath}` : ''}`); - }); - - it('export all pages', () => { - const dest = path.resolve(__dirname, '../app/__sapper__/export'); - - // Pages that should show up in the extraction directory. - const expectedPages = [ - 'index.html', - 'about/index.html', - 'slow-preload/index.html', - - 'redirect-from/index.html', - 'redirect-to/index.html', - 'non-sapper-redirect-from/index.html', - 'non-sapper-redirect-to/index.html', - - 'blog/index.html', - 'blog/a-very-long-post/index.html', - 'blog/how-can-i-get-involved/index.html', - 'blog/how-is-sapper-different-from-next/index.html', - 'blog/how-to-use-sapper/index.html', - 'blog/what-is-sapper/index.html', - 'blog/why-the-name/index.html', - 'blog/encödïng-test/index.html', - - 'blog.json', - 'blog/a-very-long-post.json', - 'blog/how-can-i-get-involved.json', - 'blog/how-is-sapper-different-from-next.json', - 'blog/how-to-use-sapper.json', - 'blog/what-is-sapper.json', - 'blog/why-the-name.json', - 'blog/encödïng-test.json', - - 'favicon.png', - 'global.css', - 'great-success.png', - 'manifest.json', - 'service-worker.js', - 'svelte-logo-192.png', - 'svelte-logo-512.png', - ].map(file => { - return basepath ? `${basepath.replace(/^[\/\\]/, '')}/${file}` : file; - }); - - // Client scripts that should show up in the extraction directory. - const expectedClientRegexes = [ - /client\/[^/]+\/main(\.\d+)?\.js/, - /client\/[^/]+\/index(\.\d+)?\.js/, - /client\/[^/]+\/about(\.\d+)?\.js/, - /client\/[^/]+\/blog_\$slug(\.\d+)?\.js/, - /client\/[^/]+\/blog(\.\d+)?\.js/, - /client\/[^/]+\/slow\$45preload(\.\d+)?\.js/, - ]; - const allPages = walkSync(dest); - - expectedPages.forEach((expectedPage) => { - assert.ok(allPages.includes(expectedPage),`Could not find page matching ${expectedPage}`); - }); - - expectedClientRegexes.forEach((expectedRegex) => { - // Ensure each client page regular expression matches at least one - // generated page. - let matched = false; - for (const page of allPages) { - if (expectedRegex.test(page)) { - matched = true; - break; - } - } - assert.ok(matched, `Could not find client page matching ${expectedRegex}`); - }); - }); - }); -} - -function run({ mode, basepath = '' }) { - describe(`mode=${mode}`, function () { - let proc; - let capture; - - let base; - let captured_basepath; - - const nightmare = new Nightmare(); - - nightmare.on('console', (type, ...args) => { - console[type](...args); - }); - - nightmare.on('page', (type, ...args) => { - if (type === 'error') { - console.error(args[1]); - } else { - console.warn(type, args); - } - }); - - before(() => { - const promise = mode === 'production' - ? exec(`node ${cli} build -l`).then(() => ports.find(3000)) - : ports.find(3000).then(port => { - exec(`node ${cli} dev`); - return ports.wait(port).then(() => port); - }); - - return promise.then(port => { - base = `http://localhost:${port}`; - if (basepath) base += basepath; - - const dir = mode === 'production' ? '__sapper__/build' : '__sapper__/dev'; - - if (mode === 'production') { - assert.ok(fs.existsSync('__sapper__/build/index.js')); - } - - proc = require('child_process').fork(`${dir}/server/server.js`, { - cwd: process.cwd(), - env: { - NODE_ENV: mode, - BASEPATH: basepath, - SAPPER_DEST: dir, - PORT: port - } - }); - - let handler; - - proc.on('message', message => { - if (message.__sapper__) { - if (message.event === 'basepath') { - captured_basepath = basepath; - } - return; - } - - if (handler) handler(message); - }); - - capture = fn => { - return new Promise((fulfil, reject) => { - const captured = []; - - let start = Date.now(); - - handler = message => { - if (message.type === 'ready') { - fn().then(() => { - proc.send({ - action: 'end' - }); - }, reject); - } - - else if (message.type === 'done') { - fulfil(captured); - handler = null; - } - - else { - captured.push(message); - } - }; - - proc.send({ - action: 'start' - }); - }); - }; - }); - }); - - after(() => { - // give a chance to clean up - return Promise.all([ - nightmare.end(), - new Promise(fulfil => { - proc.on('exit', fulfil); - proc.kill(); - }) - ]); - }); - - describe('basic functionality', () => { - it('serves /', () => { - return nightmare.goto(base).page.title().then(title => { - assert.equal(title, 'Great success!'); - }); - }); - - it('serves /?', () => { - return nightmare.goto(`${base}?`).page.title().then(title => { - assert.equal(title, 'Great success!'); - }); - }); - - it('serves static route', () => { - return nightmare.goto(`${base}/about`).page.title().then(title => { - assert.equal(title, 'About this site'); - }); - }); - - it('serves dynamic route', () => { - return nightmare.goto(`${base}/blog/what-is-sapper`).page.title().then(title => { - assert.equal(title, 'What is Sapper?'); - }); - }); - - it('navigates to a new page without reloading', () => { - return nightmare.goto(base).init().prefetchRoutes() - .then(() => { - return capture(() => nightmare.click('a[href="about"]')); - }) - .then(requests => { - assert.deepEqual(requests.map(r => r.url), []); - }) - .then(() => wait(100)) - .then(() => nightmare.path()) - .then(path => { - assert.equal(path, `${basepath}/about`); - return nightmare.title(); - }) - .then(title => { - assert.equal(title, 'About'); - }); - }); - - it('navigates programmatically', () => { - return nightmare - .goto(`${base}/about`) - .init() - .evaluate(() => window.goto('blog/what-is-sapper')) - .title() - .then(title => { - assert.equal(title, 'What is Sapper?'); - }); - }); - - it('prefetches programmatically', () => { - return capture(() => nightmare.goto(`${base}/about`).init()) - .then(() => { - return capture(() => { - return nightmare - .click('.prefetch') - .wait(200); - }); - }) - .then(requests => { - assert.ok(!!requests.find(r => r.url === `/blog/why-the-name.json`)); - }); - }); - - it('scrolls to active deeplink', () => { - return nightmare - .goto(`${base}/blog/a-very-long-post#four`) - .init() - .evaluate(() => window.scrollY) - .then(scrollY => { - assert.ok(scrollY > 0, scrollY); - }); - }); - - it.skip('reuses prefetch promise', () => { - return nightmare - .goto(`${base}/blog`) - .init() - .then(() => { - return capture(() => { - return nightmare - .evaluate(() => { - const a = document.querySelector('[href="blog/what-is-sapper"]'); - a.dispatchEvent(new MouseEvent('mousemove')); - }) - .wait(200); - }); - }) - .then(mouseover_requests => { - assert.ok(mouseover_requests.findIndex(r => r.url === `/blog/what-is-sapper.json`) !== -1); - - return capture(() => { - return nightmare - .click('[href="blog/what-is-sapper"]') - .wait(200); - }); - }) - .then(click_requests => { - assert.ok(click_requests.findIndex(r => r.url === `/blog/what-is-sapper.json`) === -1); - }); - }); - - it('cancels navigation if subsequent navigation occurs during preload', () => { - return nightmare - .goto(base) - .init() - .click('a[href="slow-preload"]') - .wait(100) - .click('a[href="about"]') - .wait(100) - .then(() => nightmare.path()) - .then(path => { - assert.equal(path, `${basepath}/about`); - return nightmare.title(); - }) - .then(title => { - assert.equal(title, 'About'); - return nightmare.evaluate(() => window.fulfil({})).wait(100); - }) - .then(() => nightmare.path()) - .then(path => { - assert.equal(path, `${basepath}/about`); - return nightmare.title(); - }) - .then(title => { - assert.equal(title, 'About'); - }); - }); - - it('calls a delete handler', () => { - return nightmare - .goto(`${base}/delete-test`) - .init() - .click('.del') - .wait(() => window.deleted) - .evaluate(() => window.deleted.id) - .then(id => { - assert.equal(id, 42); - }); - }); - - it('hydrates initial route', () => { - return nightmare.goto(base) - .wait('.hydrate-test') - .evaluate(() => { - window.el = document.querySelector('.hydrate-test'); - }) - .init() - .evaluate(() => { - return document.querySelector('.hydrate-test') === window.el; - }) - .then(matches => { - assert.ok(matches); - }); - }); - - it('redirects on server', () => { - return nightmare.goto(`${base}/redirect-from`) - .path() - .then(path => { - assert.equal(path, `${basepath}/redirect-to`); - }) - .then(() => nightmare.page.title()) - .then(title => { - assert.equal(title, 'redirected'); - }); - }); - - it('redirects in client', () => { - return nightmare.goto(base) - .wait('[href="redirect-from"]') - .click('[href="redirect-from"]') - .wait(200) - .path() - .then(path => { - assert.equal(path, `${basepath}/redirect-to`); - }) - .then(() => nightmare.page.title()) - .then(title => { - assert.equal(title, 'redirected'); - }); - }); - - it('redirects on server (root)', () => { - return nightmare.goto(`${base}/redirect-root`) - .path() - .then(path => { - assert.equal(path, `${basepath}/`); - }) - .then(() => nightmare.page.title()) - .then(title => { - assert.equal(title, 'Great success!'); - }); - }); - - it('redirects in client (root)', () => { - return nightmare.goto(base) - .wait('[href="redirect-root"]') - .click('[href="redirect-root"]') - .wait(200) - .path() - .then(path => { - assert.equal(path, `${basepath}/`); - }) - .then(() => nightmare.page.title()) - .then(title => { - assert.equal(title, 'Great success!'); - }); - }); - - it('handles 4xx error on server', () => { - return nightmare.goto(`${base}/blog/nope`) - .path() - .then(path => { - assert.equal(path, `${basepath}/blog/nope`); - }) - .then(() => nightmare.page.title()) - .then(title => { - assert.equal(title, '404') - }); - }); - - it('handles 4xx error in client', () => { - return nightmare.goto(base) - .init() - .click('[href="blog/nope"]') - .wait(200) - .path() - .then(path => { - assert.equal(path, `${basepath}/blog/nope`); - }) - .then(() => nightmare.page.title()) - .then(title => { - assert.equal(title, '404'); - }); - }); - - it('handles non-4xx error on server', () => { - return nightmare.goto(`${base}/blog/throw-an-error`) - .path() - .then(path => { - assert.equal(path, `${basepath}/blog/throw-an-error`); - }) - .then(() => nightmare.page.title()) - .then(title => { - assert.equal(title, '500') - }); - }); - - it('handles non-4xx error in client', () => { - return nightmare.goto(base) - .init() - .click('[href="blog/throw-an-error"]') - .wait(200) - .path() - .then(path => { - assert.equal(path, `${basepath}/blog/throw-an-error`); - }) - .then(() => nightmare.page.title()) - .then(title => { - assert.equal(title, '500'); - }); - }); - - // Ignores are meant for top-level escape. - // ~> Sapper **should** own the entire {basepath} when designated. - if (!basepath) { - it('respects `options.ignore` values (RegExp)', () => { - return nightmare.goto(`${base}/foobar`) - .evaluate(() => document.documentElement.textContent) - .then(text => { - assert.equal(text, 'foobar'); - }); - }); - - it('respects `options.ignore` values (String #1)', () => { - return nightmare.goto(`${base}/buzz`) - .evaluate(() => document.documentElement.textContent) - .then(text => { - assert.equal(text, 'buzz'); - }); - }); - - it('respects `options.ignore` values (String #2)', () => { - return nightmare.goto(`${base}/fizzer`) - .evaluate(() => document.documentElement.textContent) - .then(text => { - assert.equal(text, 'fizzer'); - }); - }); - - it('respects `options.ignore` values (Function)', () => { - return nightmare.goto(`${base}/hello`) - .evaluate(() => document.documentElement.textContent) - .then(text => { - assert.equal(text, 'hello'); - }); - }); - } - - it('does not attempt client-side navigation to server routes', () => { - return nightmare.goto(`${base}/blog/how-is-sapper-different-from-next`) - .init() - .click(`[href="blog/how-is-sapper-different-from-next.json"]`) - .wait(200) - .page.text() - .then(text => { - JSON.parse(text); - }); - }); - - it('does not serve error page for non-page errors', () => { - return nightmare.goto(`${base}/throw-an-error`) - .page.text() - .then(text => { - assert.equal(text, 'nope'); - }); - }); - - it('encodes routes', () => { - return nightmare.goto(`${base}/fünke`) - .page.title() - .then(title => { - assert.equal(title, `I'm afraid I just blue myself`); - }); - }); - - it('serializes Set objects returned from preload', () => { - return nightmare.goto(`${base}/preload-values/set`) - .page.title() - .then(title => { - assert.equal(title, 'true'); - return nightmare.init().page.title(); - }) - .then(title => { - assert.equal(title, 'true'); - }); - }); - - it('bails on custom classes returned from preload', () => { - return nightmare.goto(`${base}/preload-values/custom-class`) - .page.title() - .then(title => { - assert.equal(title, '42'); - return nightmare.init().page.title(); - }) - .then(title => { - assert.equal(title, '42'); - }); - }); - - it('renders store props', () => { - return nightmare.goto(`${base}/store`) - .page.title() - .then(title => { - assert.equal(title, 'hello world'); - return nightmare.init().page.title(); - }) - .then(title => { - assert.equal(title, 'hello world'); - }); - }); - - it('sends cookies when using this.fetch with credentials: "include"', () => { - return nightmare.goto(`${base}/credentials?creds=include`) - .page.title() - .then(title => { - assert.equal(title, 'a: 1, b: 2, max-age: undefined'); - }); - }); - - it('does not send cookies when using this.fetch without credentials', () => { - return nightmare.goto(`${base}/credentials`) - .page.title() - .then(title => { - assert.equal(title, 'unauthorized'); - }); - }); - - it('delegates to fetch on the client', () => { - return nightmare.goto(base).init() - .click('[href="credentials?creds=include"]') - .wait(100) - .page.title() - .then(title => { - assert.equal(title, 'a: 1, b: 2, max-age: undefined'); - }); - }); - - it('includes service worker', () => { - return nightmare.goto(base).page.html().then(html => { - assert.ok(html.indexOf('service-worker.js') !== -1); - }); - }); - - it('sets preloading true when appropriate', () => { - return nightmare - .goto(base) - .init() - .click('a[href="slow-preload"]') - .wait(100) - .evaluate(() => { - const progress = document.querySelector('progress'); - return !!progress; - }) - .then(hasProgressIndicator => { - assert.ok(hasProgressIndicator); - }) - .then(() => nightmare.evaluate(() => window.fulfil())) - .then(() => nightmare.evaluate(() => { - const progress = document.querySelector('progress'); - return !!progress; - })) - .then(hasProgressIndicator => { - assert.ok(!hasProgressIndicator); - }); - }); - - it('emits a basepath', () => { - assert.equal(captured_basepath, basepath); - }); - - // skipped because Nightmare doesn't seem to focus the correctly - it.skip('resets the active element after navigation', () => { - return nightmare - .goto(base) - .init() - .click('a[href="about"]') - .wait(100) - .evaluate(() => document.activeElement.nodeName) - .then(name => { - assert.equal(name, 'BODY'); - }); - }); - - it('replaces %sapper.xxx% tags safely', () => { - return nightmare - .goto(`${base}/unsafe-replacement`) - .init() - .page.html() - .then(html => { - assert.equal(html.indexOf('%sapper'), -1); - }); - }); - - it('only recreates components when necessary', () => { - return nightmare - .goto(`${base}/foo/bar/baz`) - .init() - .evaluate(() => document.querySelector('#sapper').textContent) - .then(text => { - assert.deepEqual(text.split('\n').filter(Boolean), [ - 'y: bar 1', - 'z: baz 1', - 'child segment: baz' - ]); - - return nightmare.click(`a`) - .then(() => wait(100)) - .then(() => { - return nightmare.evaluate(() => document.querySelector('#sapper').textContent); - }); - }) - .then(text => { - assert.deepEqual(text.split('\n').filter(Boolean), [ - 'y: bar 1', - 'z: qux 2', - 'child segment: qux' - ]); - }); - }); - - it('uses a fallback index component if none is provided', () => { - return nightmare.goto(`${base}/missing-index/ok`) - .page.title() - .then(title => { - assert.equal(title, 'it works'); - }); - }); - - it('runs preload in root component', () => { - return nightmare.goto(`${base}/preload-root`) - .page.title() - .then(title => { - assert.equal(title, 'root preload function ran: true'); - }); - }); - - it('allows reserved words as route names', () => { - return nightmare.goto(`${base}/const`).init() - .page.title() - .then(title => { - assert.equal(title, 'reserved words are okay as routes'); - }); - }); - - it('encodes req.params and req.query for server-rendered pages', () => { - return nightmare.goto(`${base}/echo/page/encöded?message=hëllö+wörld`) - .page.title() - .then(title => { - assert.equal(title, 'encöded (hëllö wörld)'); - }); - }); - - it('encodes req.params and req.query for client-rendered pages', () => { - return nightmare.goto(base).init() - .click('a[href="echo/page/encöded?message=hëllö+wörld"]') - .wait(100) - .page.title() - .then(title => { - assert.equal(title, 'encöded (hëllö wörld)'); - }); - }); - - it('accepts value-less query string parameter on server', () => { - return nightmare.goto(`${base}/echo/page/empty?message`) - .page.title() - .then(title => { - assert.equal(title, 'empty ()'); - }); - }); - - it('accepts value-less query string parameter on client', () => { - return nightmare.goto(base).init() - .click('a[href="echo/page/empty?message"]') - .wait(100) - .page.title() - .then(title => { - assert.equal(title, 'empty ()'); - }); - }); - - it('encodes req.params for server routes', () => { - return nightmare.goto(`${base}/echo/server-route/encöded`) - .page.title() - .then(title => { - assert.equal(title, 'encöded'); - }); - }); - - it('resets scroll when a link is clicked', () => { - return nightmare.goto(`${base}/blog/a-very-long-post`) - .init() - .evaluate(() => window.scrollTo(0, 200)) - .click('[href="blog/another-long-post"]') - .wait(100) - .evaluate(() => window.scrollY) - .then(scrollY => { - assert.equal(scrollY, 0); - }); - }); - - it('preserves scroll when a link with sapper-noscroll is clicked', () => { - return nightmare.goto(`${base}/blog/a-very-long-post`) - .init() - .evaluate(() => window.scrollTo(0, 200)) - .click('[href="blog/another-long-post"][sapper-noscroll]') - .wait(100) - .evaluate(() => window.scrollY) - .then(scrollY => { - assert.equal(scrollY, 200); - }); - }); - }); - - describe('headers', () => { - it('sets Content-Type, Link...preload, and Cache-Control headers', () => { - return capture(() => fetch(base)).then(responses => { - const { headers } = responses[0]; - - assert.equal( - headers['content-type'], - 'text/html' - ); - - assert.equal( - headers['cache-control'], - 'max-age=600' - ); - - const str = ['main', '.+?\\.\\d+'] - .map(file => { - return `<${basepath}/client/[^/]+/${file}\\.js>;rel="preload";as="script"`; - }) - .join(', '); - - const regex = new RegExp(str); - - assert.ok( - regex.test(headers['link']), - headers['link'] - ); - }); - }); - }); - }); -} - -function exec(cmd) { - return new Promise((fulfil, reject) => { - const parts = cmd.trim().split(' '); - const proc = require('child_process').spawn(parts.shift(), parts); - - proc.stdout.on('data', data => { - process.stdout.write(data); - }); - - proc.stderr.on('data', data => { - process.stderr.write(data); - }); - - proc.on('error', reject); - - proc.on('close', () => fulfil()); - }); -} diff --git a/test/utils.ts b/test/utils.ts new file mode 100644 index 0000000..fa802fa --- /dev/null +++ b/test/utils.ts @@ -0,0 +1,23 @@ +import * as fs from 'fs'; +import * as path from 'path'; + +export function wait(ms: number) { + return new Promise(fulfil => setTimeout(fulfil, ms)); +} + +export function walk(cwd: string, dir = cwd, files: string[] = []) { + fs.readdirSync(dir).forEach(file => { + const resolved = path.resolve(dir, file); + if (fs.statSync(resolved).isDirectory()) { + walk(cwd, resolved, files); + } else { + files.push(posixify(path.relative(cwd, resolved))); + } + }); + + return files; +} + +function posixify(str: string) { + return str.replace(/\\/g, '/'); +} \ No newline at end of file