diff --git a/package-lock.json b/package-lock.json index 74157ce624..09bb87a961 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3476,7 +3476,7 @@ "integrity": "sha512-P2OXDa3S9meOOGJm2i4/d/9HlEjg8FwwfWl4Vq7jjJlA12cJaJnXy/mKgx16eA/YSYNtfW7i4NGyeADvIGNzmg==", "dev": true, "requires": { - "@serverless/utils-china": "^0.1.7", + "@serverless/utils-china": "^0.1.8", "adm-zip": "^0.4.13", "axios": "^0.19.2", "dotenv": "^8.2.0", @@ -3491,6 +3491,24 @@ "ws": "^7.2.1" }, "dependencies": { + "@serverless/utils-china": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/@serverless/utils-china/-/utils-china-0.1.8.tgz", + "integrity": "sha512-H0CYFu9GOMffFZvxVElQr92ykGmQhPNPwptYc+W3hhIV28uLoUPlA4cCWI+Oa/MvUchkKTp+i/vWtQEiEtcmoA==", + "dev": true, + "requires": { + "@tencent-sdk/capi": "^0.2.15-alpha.0", + "dijkstrajs": "^1.0.1", + "dot-qs": "0.2.0", + "duplexify": "^4.1.1", + "end-of-stream": "^1.4.4", + "https-proxy-agent": "^5.0.0", + "object-assign": "^4.1.1", + "socket.io-client": "^2.3.0", + "socket.io-stream": "^0.9.1", + "winston": "^3.2.1" + } + }, "agent-base": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz", @@ -3500,6 +3518,18 @@ "debug": "4" } }, + "duplexify": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.1.tgz", + "integrity": "sha512-DY3xVEmVHTv1wSzKNbwoU6nVjzI369Y6sPoqfYr0/xlx3IdX2n94xIszTcjPO8W8ZIv0Wb0PXNcjuZyT4wiICA==", + "dev": true, + "requires": { + "end-of-stream": "^1.4.1", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1", + "stream-shift": "^1.0.0" + } + }, "https-proxy-agent": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", @@ -3509,6 +3539,17 @@ "agent-base": "6", "debug": "4" } + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } } } }, @@ -3596,67 +3637,6 @@ "traverse": "^0.6.6" } }, - "@serverless/utils-china": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/@serverless/utils-china/-/utils-china-0.1.7.tgz", - "integrity": "sha512-xpsokLjRK7PQtoNuA+1LxZ4whLlmAuJvtv9m9ARYtMaZhJkmlHD8cEh9Y0/uTcvzcA+pWtxRSHQ92TonpXqVow==", - "dev": true, - "requires": { - "@tencent-sdk/capi": "^0.2.15-alpha.0", - "dijkstrajs": "^1.0.1", - "dot-qs": "0.2.0", - "duplexify": "^4.1.1", - "end-of-stream": "^1.4.4", - "https-proxy-agent": "^5.0.0", - "socket.io-client": "^2.3.0", - "socket.io-stream": "^0.9.1", - "winston": "^3.2.1" - }, - "dependencies": { - "agent-base": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz", - "integrity": "sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw==", - "dev": true, - "requires": { - "debug": "4" - } - }, - "duplexify": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.1.tgz", - "integrity": "sha512-DY3xVEmVHTv1wSzKNbwoU6nVjzI369Y6sPoqfYr0/xlx3IdX2n94xIszTcjPO8W8ZIv0Wb0PXNcjuZyT4wiICA==", - "dev": true, - "requires": { - "end-of-stream": "^1.4.1", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1", - "stream-shift": "^1.0.0" - } - }, - "https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", - "dev": true, - "requires": { - "agent-base": "6", - "debug": "4" - } - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } - }, "@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", @@ -4142,57 +4122,6 @@ } } }, - "@sls-next/s3-static-assets": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@sls-next/s3-static-assets/-/s3-static-assets-1.0.1.tgz", - "integrity": "sha512-LjGb/p9ZhWeUdv7V3nzlxgcErE5lpajjw/l9R90hr7SJgLdUF9OZyiNs6TlxQQ2tJwGMclf0YoXTRHE0l1MyNg==", - "dev": true, - "requires": { - "aws-sdk": "^2.664.0", - "fs-extra": "^9.0.0", - "klaw": "^3.0.0", - "mime-types": "^2.1.27" - }, - "dependencies": { - "fs-extra": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.0.tgz", - "integrity": "sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g==", - "dev": true, - "requires": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^1.0.0" - } - }, - "jsonfile": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz", - "integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6", - "universalify": "^1.0.0" - } - }, - "klaw": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", - "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.9" - } - }, - "universalify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", - "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==", - "dev": true - } - } - }, "@szmarczak/http-timer": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", @@ -4364,12 +4293,37 @@ "integrity": "sha512-5qOlnZscTn4xxM5MeGXAMOsIOIKIbh9e85zJWfBRVPlRMEVawzoPhINYbRGkBZCI8LxvBe7tJCdWiarA99OZfQ==", "dev": true }, + "@types/prop-types": { + "version": "15.7.3", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz", + "integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==", + "dev": true + }, "@types/q": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.2.tgz", "integrity": "sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw==", "dev": true }, + "@types/react": { + "version": "16.9.35", + "resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.35.tgz", + "integrity": "sha512-q0n0SsWcGc8nDqH2GJfWQWUOmZSJhXV64CjVN5SvcNti3TdEaA3AH0D8DwNmMdzjMAC/78tB8nAZIlV8yTz+zQ==", + "dev": true, + "requires": { + "@types/prop-types": "*", + "csstype": "^2.2.0" + } + }, + "@types/react-dom": { + "version": "16.9.8", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.8.tgz", + "integrity": "sha512-ykkPQ+5nFknnlU6lDd947WbQ6TE3NNzbQAkInC2EKY1qeYdTKp7onFusmYZb+ityzx2YviqT6BXSu+LyWWJwcA==", + "dev": true, + "requires": { + "@types/react": "*" + } + }, "@types/stack-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", @@ -7809,6 +7763,12 @@ } } }, + "csstype": { + "version": "2.6.10", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.10.tgz", + "integrity": "sha512-D34BqZU4cIlMCY93rZHbrq9pjTAQJ3U8S8rfBqjwHxkGPThWFjzZDQpgMJY0QViLxth6ZKYiwFBo14RdN44U/w==", + "dev": true + }, "currently-unhandled": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", @@ -15579,7 +15539,7 @@ "dependencies": { "@types/aws-lambda": { "version": "8.10.50", - "resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.50.tgz", + "resolved": false, "integrity": "sha512-RDzmQ5mO1f0BViKiuOudENZmoCACEa461nTRVtxhsAiEqGCgwdhCYN0aFgk42X5+ELAiqJKbv2mK0LkopYRYQg==" } } @@ -21889,25 +21849,29 @@ "dependencies": { "abbrev": { "version": "1.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true, "optional": true }, "ansi-regex": { "version": "2.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true, "optional": true }, "aproba": { "version": "1.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "dev": true, "optional": true }, "are-we-there-yet": { "version": "1.1.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", "dev": true, "optional": true, "requires": { @@ -21917,13 +21881,15 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true, "optional": true }, "brace-expansion": { "version": "1.1.11", - "bundled": true, + "resolved": false, + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "optional": true, "requires": { @@ -21933,37 +21899,43 @@ }, "chownr": { "version": "1.1.4", - "bundled": true, + "resolved": false, + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", "dev": true, "optional": true }, "code-point-at": { "version": "1.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true, "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true, "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "dev": true, "optional": true }, "core-util-is": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true, "optional": true }, "debug": { "version": "3.2.6", - "bundled": true, + "resolved": false, + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "dev": true, "optional": true, "requires": { @@ -21972,25 +21944,29 @@ }, "deep-extend": { "version": "0.6.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "dev": true, "optional": true }, "delegates": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "dev": true, "optional": true }, "detect-libc": { "version": "1.0.3", - "bundled": true, + "resolved": false, + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", "dev": true, "optional": true }, "fs-minipass": { "version": "1.2.7", - "bundled": true, + "resolved": false, + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", "dev": true, "optional": true, "requires": { @@ -21999,13 +21975,15 @@ }, "fs.realpath": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true, "optional": true }, "gauge": { "version": "2.7.4", - "bundled": true, + "resolved": false, + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "dev": true, "optional": true, "requires": { @@ -22021,7 +21999,8 @@ }, "glob": { "version": "7.1.6", - "bundled": true, + "resolved": false, + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "dev": true, "optional": true, "requires": { @@ -22035,13 +22014,15 @@ }, "has-unicode": { "version": "2.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", "dev": true, "optional": true }, "iconv-lite": { "version": "0.4.24", - "bundled": true, + "resolved": false, + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, "optional": true, "requires": { @@ -22050,7 +22031,8 @@ }, "ignore-walk": { "version": "3.0.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", "dev": true, "optional": true, "requires": { @@ -22059,7 +22041,8 @@ }, "inflight": { "version": "1.0.6", - "bundled": true, + "resolved": false, + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "optional": true, "requires": { @@ -22069,19 +22052,22 @@ }, "inherits": { "version": "2.0.4", - "bundled": true, + "resolved": false, + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true, "optional": true }, "ini": { "version": "1.3.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true, "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "optional": true, "requires": { @@ -22090,13 +22076,15 @@ }, "isarray": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true, "optional": true }, "minimatch": { "version": "3.0.4", - "bundled": true, + "resolved": false, + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "optional": true, "requires": { @@ -22105,13 +22093,15 @@ }, "minimist": { "version": "1.2.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true, "optional": true }, "minipass": { "version": "2.9.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", "dev": true, "optional": true, "requires": { @@ -22121,7 +22111,8 @@ }, "minizlib": { "version": "1.3.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", "dev": true, "optional": true, "requires": { @@ -22130,7 +22121,8 @@ }, "mkdirp": { "version": "0.5.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==", "dev": true, "optional": true, "requires": { @@ -22139,13 +22131,15 @@ }, "ms": { "version": "2.1.2", - "bundled": true, + "resolved": false, + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true, "optional": true }, "needle": { "version": "2.3.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-EkY0GeSq87rWp1hoq/sH/wnTWgFVhYlnIkbJ0YJFfRgEFlz2RraCjBpFQ+vrEgEdp0ThfyHADmkChEhcb7PKyw==", "dev": true, "optional": true, "requires": { @@ -22156,7 +22150,8 @@ }, "node-pre-gyp": { "version": "0.14.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-+CvDC7ZttU/sSt9rFjix/P05iS43qHCOOGzcr3Ry99bXG7VX953+vFyEuph/tfqoYu8dttBkE86JSKBO2OzcxA==", "dev": true, "optional": true, "requires": { @@ -22174,7 +22169,8 @@ }, "nopt": { "version": "4.0.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", "dev": true, "optional": true, "requires": { @@ -22184,7 +22180,8 @@ }, "npm-bundled": { "version": "1.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA==", "dev": true, "optional": true, "requires": { @@ -22193,13 +22190,15 @@ }, "npm-normalize-package-bin": { "version": "1.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==", "dev": true, "optional": true }, "npm-packlist": { "version": "1.4.8", - "bundled": true, + "resolved": false, + "integrity": "sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==", "dev": true, "optional": true, "requires": { @@ -22210,7 +22209,8 @@ }, "npmlog": { "version": "4.1.2", - "bundled": true, + "resolved": false, + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "dev": true, "optional": true, "requires": { @@ -22222,19 +22222,22 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true, "optional": true }, "object-assign": { "version": "4.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true, "optional": true }, "once": { "version": "1.4.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "optional": true, "requires": { @@ -22243,19 +22246,22 @@ }, "os-homedir": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true, "optional": true }, "os-tmpdir": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true, "optional": true }, "osenv": { "version": "0.1.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "dev": true, "optional": true, "requires": { @@ -22265,19 +22271,22 @@ }, "path-is-absolute": { "version": "1.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true, "optional": true }, "process-nextick-args": { "version": "2.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true, "optional": true }, "rc": { "version": "1.2.8", - "bundled": true, + "resolved": false, + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "dev": true, "optional": true, "requires": { @@ -22289,7 +22298,8 @@ }, "readable-stream": { "version": "2.3.7", - "bundled": true, + "resolved": false, + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", "dev": true, "optional": true, "requires": { @@ -22304,7 +22314,8 @@ }, "rimraf": { "version": "2.7.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", "dev": true, "optional": true, "requires": { @@ -22313,43 +22324,50 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true, + "resolved": false, + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true, "optional": true }, "safer-buffer": { "version": "2.1.2", - "bundled": true, + "resolved": false, + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true, "optional": true }, "sax": { "version": "1.2.4", - "bundled": true, + "resolved": false, + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "dev": true, "optional": true }, "semver": { "version": "5.7.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true, "optional": true }, "set-blocking": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true, "optional": true }, "signal-exit": { "version": "3.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true, "optional": true }, "string-width": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "optional": true, "requires": { @@ -22360,7 +22378,8 @@ }, "string_decoder": { "version": "1.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "optional": true, "requires": { @@ -22369,7 +22388,8 @@ }, "strip-ansi": { "version": "3.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "optional": true, "requires": { @@ -22378,13 +22398,15 @@ }, "strip-json-comments": { "version": "2.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true, "optional": true }, "tar": { "version": "4.4.13", - "bundled": true, + "resolved": false, + "integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==", "dev": true, "optional": true, "requires": { @@ -22399,13 +22421,15 @@ }, "util-deprecate": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true, "optional": true }, "wide-align": { "version": "1.1.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "dev": true, "optional": true, "requires": { @@ -22414,13 +22438,15 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true, "optional": true }, "yallist": { "version": "3.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true, "optional": true } diff --git a/package.json b/package.json index bedb1e3a3c..a93ae0cb03 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,8 @@ "@babel/preset-typescript": "^7.9.0", "@sls-next/lambda-at-edge": "file:packages/lambda-at-edge", "@types/jest": "^25.2.1", + "@types/react": "^16.9.35", + "@types/react-dom": "^16.9.8", "@typescript-eslint/eslint-plugin": "^2.28.0", "@typescript-eslint/parser": "^2.28.0", "adm-zip": "^0.4.13", diff --git a/packages/lambda-at-edge-compat/package-lock.json b/packages/lambda-at-edge-compat/package-lock.json index 6078fb686f..17afc9acaa 100644 --- a/packages/lambda-at-edge-compat/package-lock.json +++ b/packages/lambda-at-edge-compat/package-lock.json @@ -6,7 +6,7 @@ "dependencies": { "@types/aws-lambda": { "version": "8.10.50", - "resolved": false, + "resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.50.tgz", "integrity": "sha512-RDzmQ5mO1f0BViKiuOudENZmoCACEa461nTRVtxhsAiEqGCgwdhCYN0aFgk42X5+ELAiqJKbv2mK0LkopYRYQg==", "dev": true } diff --git a/packages/lambda-at-edge/src/build.ts b/packages/lambda-at-edge/src/build.ts index 3e7f4dbb9c..c30c9c0f33 100644 --- a/packages/lambda-at-edge/src/build.ts +++ b/packages/lambda-at-edge/src/build.ts @@ -136,6 +136,10 @@ class Builder { ); } } + ), + fse.copy( + join(this.nextConfigDir, ".next/prerender-manifest.json"), + join(this.outputDir, DEFAULT_LAMBDA_CODE_DIR, "prerender-manifest.json") ) ]); } diff --git a/packages/lambda-at-edge/src/default-handler.ts b/packages/lambda-at-edge/src/default-handler.ts index b5d8cab928..bae23d920b 100644 --- a/packages/lambda-at-edge/src/default-handler.ts +++ b/packages/lambda-at-edge/src/default-handler.ts @@ -1,5 +1,8 @@ // @ts-ignore +import PrerenderManifest from "./prerender-manifest.json"; +// @ts-ignore import Manifest from "./manifest.json"; +import { PrerenderManifest as PrerenderManifestType } from "next/dist/build/index"; import lambdaAtEdgeCompat from "next-aws-cloudfront"; import { CloudFrontRequest, @@ -49,19 +52,23 @@ export const handler = async ( ): Promise => { const request = event.Records[0].cf.request; const uri = normaliseUri(request.uri); - const manifest = Manifest as OriginRequestDefaultHandlerManifest; + const manifest: OriginRequestDefaultHandlerManifest = Manifest; + const prerenderManifest: PrerenderManifestType = PrerenderManifest; const { pages, publicFiles } = manifest; const isStaticPage = pages.html.nonDynamic[uri]; const isPublicFile = publicFiles[uri]; + const isPrerenderedPage = prerenderManifest.routes[uri]; // prerendered pages are also static pages like "pages.html" above, but are defined in the prerender-manifest const origin = request.origin as CloudFrontOrigin; const s3Origin = origin.s3 as CloudFrontS3Origin; - if (isStaticPage || isPublicFile) { - s3Origin.path = isStaticPage ? "/static-pages" : "/public"; + const isHTMLPage = isStaticPage || isPrerenderedPage; + + if (isHTMLPage || isPublicFile) { + s3Origin.path = isHTMLPage ? "/static-pages" : "/public"; - if (isStaticPage) { + if (isHTMLPage) { request.uri = uri + ".html"; } diff --git a/packages/lambda-at-edge/src/manifest.d.ts b/packages/lambda-at-edge/src/manifest.d.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/lambda-at-edge/tests/build.test.ts b/packages/lambda-at-edge/tests/build.test.ts index 50b3ea1c6d..01b9fb233c 100644 --- a/packages/lambda-at-edge/tests/build.test.ts +++ b/packages/lambda-at-edge/tests/build.test.ts @@ -177,7 +177,8 @@ describe("Builder Tests", () => { "index.js", "manifest.json", "node_modules", - "pages" + "pages", + "prerender-manifest.json" ]); expect(compatLayerIncluded).toEqual(true); diff --git a/packages/lambda-at-edge/tests/default-handler.test.ts b/packages/lambda-at-edge/tests/default-handler.test.ts index 57695c85c0..7f474b3dc6 100644 --- a/packages/lambda-at-edge/tests/default-handler.test.ts +++ b/packages/lambda-at-edge/tests/default-handler.test.ts @@ -10,6 +10,14 @@ jest.mock( } ); +jest.mock( + "../src/prerender-manifest.json", + () => require("./fixtures/prerender-manifest.json"), + { + virtual: true + } +); + const mockPageRequire = (mockPagePath: string): void => { jest.mock( `../src/${mockPagePath}`, @@ -24,15 +32,16 @@ describe("Lambda@Edge", () => { describe("Routing", () => { describe("HTML pages routing", () => { it.each` - path | expectedPage - ${"/"} | ${"/index.html"} - ${"/index"} | ${"/index.html"} - ${"/terms"} | ${"/terms.html"} - ${"/users/batman"} | ${"/users/[user].html"} - ${"/users/test/catch/all"} | ${"/users/[...user].html"} - ${"/john/123"} | ${"/[username]/[id].html"} + path | expectedPage + ${"/"} | ${"/index.html"} + ${"/index"} | ${"/index.html"} + ${"/terms"} | ${"/terms.html"} + ${"/users/batman"} | ${"/users/[user].html"} + ${"/users/test/catch/all"} | ${"/users/[...user].html"} + ${"/john/123"} | ${"/[username]/[id].html"} + ${"/tests/prerender-manifest/example-static-page"} | ${"/tests/prerender-manifest/example-static-page.html"} `( - "serves page $expectedPage for path $path", + "serves page $expectedPage from S3 for path $path", async ({ path, expectedPage }) => { const event = createCloudFrontEvent({ uri: path, diff --git a/packages/lambda-at-edge/tests/fixtures/app-with-no-static-or-public-dir/.next/prerender-manifest.json b/packages/lambda-at-edge/tests/fixtures/app-with-no-static-or-public-dir/.next/prerender-manifest.json new file mode 100644 index 0000000000..1bf078aa61 --- /dev/null +++ b/packages/lambda-at-edge/tests/fixtures/app-with-no-static-or-public-dir/.next/prerender-manifest.json @@ -0,0 +1,10 @@ +{ + "version": 2, + "routes": { + "/": { + "initialRevalidateSeconds": false, + "srcRoute": null, + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/index.json" + } + } +} diff --git a/packages/lambda-at-edge/tests/fixtures/app-with-no-static-or-public-dir/.next/serverless/pages/index.json b/packages/lambda-at-edge/tests/fixtures/app-with-no-static-or-public-dir/.next/serverless/pages/index.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/lambda-at-edge/tests/fixtures/built-artifact/pages/users/[userId].js b/packages/lambda-at-edge/tests/fixtures/built-artifact/pages/users/[userId].js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/lambda-at-edge/tests/fixtures/dynamic-routes-precedence/.next/prerender-manifest.json b/packages/lambda-at-edge/tests/fixtures/dynamic-routes-precedence/.next/prerender-manifest.json new file mode 100644 index 0000000000..1bf078aa61 --- /dev/null +++ b/packages/lambda-at-edge/tests/fixtures/dynamic-routes-precedence/.next/prerender-manifest.json @@ -0,0 +1,10 @@ +{ + "version": 2, + "routes": { + "/": { + "initialRevalidateSeconds": false, + "srcRoute": null, + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/index.json" + } + } +} diff --git a/packages/lambda-at-edge/tests/fixtures/dynamic-routes-precedence/.next/serverless/pages/index.json b/packages/lambda-at-edge/tests/fixtures/dynamic-routes-precedence/.next/serverless/pages/index.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/lambda-at-edge/tests/fixtures/prerender-manifest.json b/packages/lambda-at-edge/tests/fixtures/prerender-manifest.json new file mode 100644 index 0000000000..6ac24c1a18 --- /dev/null +++ b/packages/lambda-at-edge/tests/fixtures/prerender-manifest.json @@ -0,0 +1,23 @@ +{ + "version": 2, + "routes": { + "/tests/prerender-manifest/example-static-page": { + "initialRevalidateSeconds": false, + "srcRoute": "/tests/prerender-manifest/[staticPageName]", + "dataRoute": "/_next/data/test-build-id/tests/prerender-manifest/example-static-page.json" + } + }, + "dynamicRoutes": { + "/tests/prerender-manifest/[staticPageName]": { + "routeRegex": "^/tests/prerender-manifest/(?:([^/]+?))/?$", + "dataRoute": "/_next/data/test-build-id/tests/prerender-manifest/[staticPageName].json", + "fallback": false, + "dataRouteRegex": "^/_next/data/test-build-id/tests/prerender-manifest/(?:([^/]+?)).json/?$" + } + }, + "preview": { + "previewModeId": "test-preview-mode-id", + "previewModeSigningKey": "test-preview-mode-signing-key", + "previewModeEncryptionKey": "test-preview-mode-enc-key" + } +} diff --git a/packages/lambda-at-edge/tests/fixtures/simple-app/.next/prerender-manifest.json b/packages/lambda-at-edge/tests/fixtures/simple-app/.next/prerender-manifest.json index e69de29bb2..1bf078aa61 100644 --- a/packages/lambda-at-edge/tests/fixtures/simple-app/.next/prerender-manifest.json +++ b/packages/lambda-at-edge/tests/fixtures/simple-app/.next/prerender-manifest.json @@ -0,0 +1,10 @@ +{ + "version": 2, + "routes": { + "/": { + "initialRevalidateSeconds": false, + "srcRoute": null, + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/index.json" + } + } +} diff --git a/packages/lambda-at-edge/tests/fixtures/simple-app/.next/serverless/pages/index.json b/packages/lambda-at-edge/tests/fixtures/simple-app/.next/serverless/pages/index.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/src/index.ts b/packages/s3-static-assets/src/index.ts index 4203f15381..c8115cf843 100644 --- a/packages/s3-static-assets/src/index.ts +++ b/packages/s3-static-assets/src/index.ts @@ -6,6 +6,7 @@ import filterOutDirectories from "./lib/filterOutDirectories"; import { IMMUTABLE_CACHE_CONTROL_HEADER } from "./lib/constants"; import S3ClientFactory, { Credentials } from "./lib/s3"; import pathToPosix from "./lib/pathToPosix"; +import { PrerenderManifest } from "next/dist/build/index"; import getPublicAssetCacheControl, { PublicDirectoryCache } from "./lib/getPublicAssetCacheControl"; @@ -69,6 +70,45 @@ const uploadStaticAssets = async ( }); }); + const prerenderManifest: PrerenderManifest = await fse.readJSON( + path.join(dotNextDirectory, "prerender-manifest.json") + ); + + const prerenderManifestJSONPropFileUploads = Object.keys( + prerenderManifest.routes + ).map(key => { + const pageFilePath = pathToPosix( + path.join( + dotNextDirectory, + `serverless/pages/${ + key.endsWith("/") ? key + "index.json" : key + ".json" + }` + ) + ); + + return s3.uploadFile({ + s3Key: prerenderManifest.routes[key].dataRoute.slice(1), + filePath: pageFilePath + }); + }); + + const prerenderManifestHTMLPageUploads = Object.keys( + prerenderManifest.routes + ).map(key => { + const relativePageFilePath = key.endsWith("/") + ? path.posix.join(key, "index.html") + : key + ".html"; + + const pageFilePath = pathToPosix( + path.join(dotNextDirectory, `serverless/pages/${relativePageFilePath}`) + ); + + return s3.uploadFile({ + s3Key: path.posix.join("static-pages", relativePageFilePath), + filePath: pageFilePath + }); + }); + const uploadPublicOrStaticDirectory = async ( directory: "public" | "static", publicDirectoryCache?: PublicDirectoryCache @@ -106,6 +146,8 @@ const uploadStaticAssets = async ( const allUploads = [ ...buildStaticFileUploads, // .next/static ...htmlPageUploads, // prerendered HTML pages + ...prerenderManifestJSONPropFileUploads, // SSG JSON files + ...prerenderManifestHTMLPageUploads, // SSG HTML files ...publicDirUploads, // app public dir ...staticDirUploads // app static dir ]; diff --git a/packages/s3-static-assets/tests/fixtures/app-basic/.next/prerender-manifest.json b/packages/s3-static-assets/tests/fixtures/app-basic/.next/prerender-manifest.json new file mode 100644 index 0000000000..0cf5b9c569 --- /dev/null +++ b/packages/s3-static-assets/tests/fixtures/app-basic/.next/prerender-manifest.json @@ -0,0 +1,20 @@ +{ + "version": 2, + "routes": { + "/": { + "initialRevalidateSeconds": false, + "srcRoute": null, + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/index.json" + }, + "/todos/terms/a": { + "initialRevalidateSeconds": false, + "srcRoute": "/todos/terms/[section]", + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/todos/terms/a.json" + }, + "/todos/terms/b": { + "initialRevalidateSeconds": false, + "srcRoute": "/todos/terms/[section]", + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/todos/terms/b.json" + } + } +} diff --git a/packages/s3-static-assets/tests/fixtures/app-basic/.next/serverless/pages/index.html b/packages/s3-static-assets/tests/fixtures/app-basic/.next/serverless/pages/index.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-basic/.next/serverless/pages/index.json b/packages/s3-static-assets/tests/fixtures/app-basic/.next/serverless/pages/index.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-basic/.next/serverless/pages/todos/terms/a.html b/packages/s3-static-assets/tests/fixtures/app-basic/.next/serverless/pages/todos/terms/a.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-basic/.next/serverless/pages/todos/terms/a.json b/packages/s3-static-assets/tests/fixtures/app-basic/.next/serverless/pages/todos/terms/a.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-basic/.next/serverless/pages/todos/terms/b.html b/packages/s3-static-assets/tests/fixtures/app-basic/.next/serverless/pages/todos/terms/b.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-basic/.next/serverless/pages/todos/terms/b.json b/packages/s3-static-assets/tests/fixtures/app-basic/.next/serverless/pages/todos/terms/b.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-no-public-dir/.next/prerender-manifest.json b/packages/s3-static-assets/tests/fixtures/app-no-public-dir/.next/prerender-manifest.json new file mode 100644 index 0000000000..0cf5b9c569 --- /dev/null +++ b/packages/s3-static-assets/tests/fixtures/app-no-public-dir/.next/prerender-manifest.json @@ -0,0 +1,20 @@ +{ + "version": 2, + "routes": { + "/": { + "initialRevalidateSeconds": false, + "srcRoute": null, + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/index.json" + }, + "/todos/terms/a": { + "initialRevalidateSeconds": false, + "srcRoute": "/todos/terms/[section]", + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/todos/terms/a.json" + }, + "/todos/terms/b": { + "initialRevalidateSeconds": false, + "srcRoute": "/todos/terms/[section]", + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/todos/terms/b.json" + } + } +} diff --git a/packages/s3-static-assets/tests/fixtures/app-no-public-dir/.next/serverless/pages/index.html b/packages/s3-static-assets/tests/fixtures/app-no-public-dir/.next/serverless/pages/index.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-no-public-dir/.next/serverless/pages/index.json b/packages/s3-static-assets/tests/fixtures/app-no-public-dir/.next/serverless/pages/index.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-no-public-dir/.next/serverless/pages/todos/terms/a.html b/packages/s3-static-assets/tests/fixtures/app-no-public-dir/.next/serverless/pages/todos/terms/a.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-no-public-dir/.next/serverless/pages/todos/terms/a.json b/packages/s3-static-assets/tests/fixtures/app-no-public-dir/.next/serverless/pages/todos/terms/a.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-no-public-dir/.next/serverless/pages/todos/terms/b.html b/packages/s3-static-assets/tests/fixtures/app-no-public-dir/.next/serverless/pages/todos/terms/b.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-no-public-dir/.next/serverless/pages/todos/terms/b.json b/packages/s3-static-assets/tests/fixtures/app-no-public-dir/.next/serverless/pages/todos/terms/b.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-public-dir-in-custom-location/nextConfigDir/.next/prerender-manifest.json b/packages/s3-static-assets/tests/fixtures/app-public-dir-in-custom-location/nextConfigDir/.next/prerender-manifest.json new file mode 100644 index 0000000000..0cf5b9c569 --- /dev/null +++ b/packages/s3-static-assets/tests/fixtures/app-public-dir-in-custom-location/nextConfigDir/.next/prerender-manifest.json @@ -0,0 +1,20 @@ +{ + "version": 2, + "routes": { + "/": { + "initialRevalidateSeconds": false, + "srcRoute": null, + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/index.json" + }, + "/todos/terms/a": { + "initialRevalidateSeconds": false, + "srcRoute": "/todos/terms/[section]", + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/todos/terms/a.json" + }, + "/todos/terms/b": { + "initialRevalidateSeconds": false, + "srcRoute": "/todos/terms/[section]", + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/todos/terms/b.json" + } + } +} diff --git a/packages/s3-static-assets/tests/fixtures/app-public-dir-in-custom-location/nextConfigDir/.next/serverless/pages/index.html b/packages/s3-static-assets/tests/fixtures/app-public-dir-in-custom-location/nextConfigDir/.next/serverless/pages/index.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-public-dir-in-custom-location/nextConfigDir/.next/serverless/pages/index.json b/packages/s3-static-assets/tests/fixtures/app-public-dir-in-custom-location/nextConfigDir/.next/serverless/pages/index.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-public-dir-in-custom-location/nextConfigDir/.next/serverless/pages/todos/terms/a.html b/packages/s3-static-assets/tests/fixtures/app-public-dir-in-custom-location/nextConfigDir/.next/serverless/pages/todos/terms/a.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-public-dir-in-custom-location/nextConfigDir/.next/serverless/pages/todos/terms/a.json b/packages/s3-static-assets/tests/fixtures/app-public-dir-in-custom-location/nextConfigDir/.next/serverless/pages/todos/terms/a.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-public-dir-in-custom-location/nextConfigDir/.next/serverless/pages/todos/terms/b.html b/packages/s3-static-assets/tests/fixtures/app-public-dir-in-custom-location/nextConfigDir/.next/serverless/pages/todos/terms/b.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-public-dir-in-custom-location/nextConfigDir/.next/serverless/pages/todos/terms/b.json b/packages/s3-static-assets/tests/fixtures/app-public-dir-in-custom-location/nextConfigDir/.next/serverless/pages/todos/terms/b.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/app-with-images/.next/prerender-manifest.json b/packages/s3-static-assets/tests/fixtures/app-with-images/.next/prerender-manifest.json new file mode 100644 index 0000000000..bcc5f6421e --- /dev/null +++ b/packages/s3-static-assets/tests/fixtures/app-with-images/.next/prerender-manifest.json @@ -0,0 +1,10 @@ +{ + "version": 2, + "routes": { + "/todos/terms": { + "initialRevalidateSeconds": false, + "srcRoute": null, + "dataRoute": "/_next/data/test-build-id/todos/terms.json" + } + } +} diff --git a/packages/s3-static-assets/tests/fixtures/app-with-images/.next/serverless/pages/todos/terms.json b/packages/s3-static-assets/tests/fixtures/app-with-images/.next/serverless/pages/todos/terms.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/packages/s3-static-assets/tests/fixtures/app-with-images/.next/serverless/pages/todos/terms.json @@ -0,0 +1 @@ +{} diff --git a/packages/s3-static-assets/tests/fixtures/basic-next-app/.next/prerender-manifest.json b/packages/s3-static-assets/tests/fixtures/basic-next-app/.next/prerender-manifest.json new file mode 100644 index 0000000000..0cf5b9c569 --- /dev/null +++ b/packages/s3-static-assets/tests/fixtures/basic-next-app/.next/prerender-manifest.json @@ -0,0 +1,20 @@ +{ + "version": 2, + "routes": { + "/": { + "initialRevalidateSeconds": false, + "srcRoute": null, + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/index.json" + }, + "/todos/terms/a": { + "initialRevalidateSeconds": false, + "srcRoute": "/todos/terms/[section]", + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/todos/terms/a.json" + }, + "/todos/terms/b": { + "initialRevalidateSeconds": false, + "srcRoute": "/todos/terms/[section]", + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/todos/terms/b.json" + } + } +} diff --git a/packages/s3-static-assets/tests/fixtures/basic-next-app/.next/serverless/pages/index.json b/packages/s3-static-assets/tests/fixtures/basic-next-app/.next/serverless/pages/index.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/basic-next-app/.next/serverless/pages/todos/terms/a.json b/packages/s3-static-assets/tests/fixtures/basic-next-app/.next/serverless/pages/todos/terms/a.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/fixtures/basic-next-app/.next/serverless/pages/todos/terms/b.json b/packages/s3-static-assets/tests/fixtures/basic-next-app/.next/serverless/pages/todos/terms/b.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/s3-static-assets/tests/upload-assets.test.ts b/packages/s3-static-assets/tests/upload-assets.test.ts index 83e7cafc09..90ebb7c254 100644 --- a/packages/s3-static-assets/tests/upload-assets.test.ts +++ b/packages/s3-static-assets/tests/upload-assets.test.ts @@ -129,7 +129,7 @@ describe.each` }); }); - it("uploads prerendered HTML pages specified in pages manifest", async () => { + it("uploads HTML pages specified in pages manifest", async () => { await upload(nextConfigDir, nextStaticDir); expect(mockUpload).toBeCalledWith( @@ -149,6 +149,54 @@ describe.each` ); }); + it("uploads staticProps JSON files specified in prerender manifest", async () => { + await upload(nextConfigDir, nextStaticDir); + + expect(mockUpload).toBeCalledWith( + expect.objectContaining({ + Key: "_next/data/zsWqBqLjpgRmswfQomanp/index.json", + ContentType: "application/json", + CacheControl: undefined + }) + ); + + expect(mockUpload).toBeCalledWith( + expect.objectContaining({ + Key: "_next/data/zsWqBqLjpgRmswfQomanp/todos/terms/a.json", + ContentType: "application/json", + CacheControl: undefined + }) + ); + + expect(mockUpload).toBeCalledWith( + expect.objectContaining({ + Key: "_next/data/zsWqBqLjpgRmswfQomanp/todos/terms/b.json", + ContentType: "application/json", + CacheControl: undefined + }) + ); + }); + + it("uploads prerendered HTML pages specified in prerender manifest", async () => { + await upload(nextConfigDir, nextStaticDir); + + expect(mockUpload).toBeCalledWith( + expect.objectContaining({ + Key: "static-pages/todos/terms/a.html", + ContentType: "text/html", + CacheControl: undefined + }) + ); + + expect(mockUpload).toBeCalledWith( + expect.objectContaining({ + Key: "static-pages/todos/terms/b.html", + ContentType: "text/html", + CacheControl: undefined + }) + ); + }); + it("uploads files in the public folder", async () => { await upload(nextConfigDir, nextStaticDir); diff --git a/packages/serverless-component/__tests__/fixtures/generic-fixture/.next/prerender-manifest.json b/packages/serverless-component/__tests__/fixtures/generic-fixture/.next/prerender-manifest.json new file mode 100644 index 0000000000..1bf078aa61 --- /dev/null +++ b/packages/serverless-component/__tests__/fixtures/generic-fixture/.next/prerender-manifest.json @@ -0,0 +1,10 @@ +{ + "version": 2, + "routes": { + "/": { + "initialRevalidateSeconds": false, + "srcRoute": null, + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/index.json" + } + } +} diff --git a/packages/serverless-component/__tests__/fixtures/generic-fixture/.next/serverless/pages/index.html b/packages/serverless-component/__tests__/fixtures/generic-fixture/.next/serverless/pages/index.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/serverless-component/__tests__/fixtures/generic-fixture/.next/serverless/pages/index.json b/packages/serverless-component/__tests__/fixtures/generic-fixture/.next/serverless/pages/index.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/serverless-component/__tests__/fixtures/simple-app/.next/prerender-manifest.json b/packages/serverless-component/__tests__/fixtures/simple-app/.next/prerender-manifest.json index e69de29bb2..1bf078aa61 100644 --- a/packages/serverless-component/__tests__/fixtures/simple-app/.next/prerender-manifest.json +++ b/packages/serverless-component/__tests__/fixtures/simple-app/.next/prerender-manifest.json @@ -0,0 +1,10 @@ +{ + "version": 2, + "routes": { + "/": { + "initialRevalidateSeconds": false, + "srcRoute": null, + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/index.json" + } + } +} diff --git a/packages/serverless-component/__tests__/fixtures/simple-app/.next/serverless/pages/index.html b/packages/serverless-component/__tests__/fixtures/simple-app/.next/serverless/pages/index.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/serverless-component/__tests__/fixtures/simple-app/.next/serverless/pages/index.json b/packages/serverless-component/__tests__/fixtures/simple-app/.next/serverless/pages/index.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/serverless-component/__tests__/fixtures/split-app/nextConfigDir/.next/prerender-manifest.json b/packages/serverless-component/__tests__/fixtures/split-app/nextConfigDir/.next/prerender-manifest.json index e69de29bb2..1bf078aa61 100644 --- a/packages/serverless-component/__tests__/fixtures/split-app/nextConfigDir/.next/prerender-manifest.json +++ b/packages/serverless-component/__tests__/fixtures/split-app/nextConfigDir/.next/prerender-manifest.json @@ -0,0 +1,10 @@ +{ + "version": 2, + "routes": { + "/": { + "initialRevalidateSeconds": false, + "srcRoute": null, + "dataRoute": "/_next/data/zsWqBqLjpgRmswfQomanp/index.json" + } + } +} diff --git a/packages/serverless-component/__tests__/fixtures/split-app/nextConfigDir/.next/serverless/pages/index.html b/packages/serverless-component/__tests__/fixtures/split-app/nextConfigDir/.next/serverless/pages/index.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/serverless-component/__tests__/fixtures/split-app/nextConfigDir/.next/serverless/pages/index.json b/packages/serverless-component/__tests__/fixtures/split-app/nextConfigDir/.next/serverless/pages/index.json new file mode 100644 index 0000000000..e69de29bb2