From 0e5a7e076069169333aa4851d0304372d38b4e1c Mon Sep 17 00:00:00 2001 From: James Daniels Date: Tue, 25 Oct 2022 21:44:12 -0400 Subject: [PATCH 01/13] WIP of Next 13 fixes --- src/frameworks/next/index.ts | 85 ++++++++++++++++++++++++++---------- 1 file changed, 62 insertions(+), 23 deletions(-) diff --git a/src/frameworks/next/index.ts b/src/frameworks/next/index.ts index b79c5a0510f..c9b6f076a12 100644 --- a/src/frameworks/next/index.ts +++ b/src/frameworks/next/index.ts @@ -20,6 +20,7 @@ import { gte } from "semver"; import { IncomingMessage, ServerResponse } from "http"; import { logger } from "../../logger"; import { FirebaseError } from "../../error"; +import { fileExistsSync } from "../../fsutils"; // Next.js's exposed interface is incomplete here // TODO see if there's a better way to grab this @@ -51,6 +52,10 @@ function getNextVersion(cwd: string) { return findDependency("next", { cwd, depth: 0, omitDev: false })?.version; } +function getReactVersion(cwd: string) { + return findDependency("react-dom", { cwd, omitDev: false })?.version; +} + /** * Returns whether this codebase is a Next.js backend. */ @@ -67,6 +72,13 @@ export async function discover(dir: string) { export async function build(dir: string): Promise { const { default: nextBuild } = relativeRequire(dir, "next/dist/build"); + const reactVersion = getReactVersion(dir); + // TODO use semver rather than parseInt + if (parseInt(reactVersion, 10) > 18) { + // This needs to be set for Next build to succeed with React 18 + process.env.__NEXT_REACT_ROOT = 'true'; + } + await nextBuild(dir, null, false, false, true).catch((e) => { // Err on the side of displaying this error, since this is likely a bug in // the developer's code that we want to display immediately @@ -89,6 +101,12 @@ export async function build(dir: string): Promise { const exportDetailBuffer = exportDetailExists ? await readFile(exportDetailPath) : undefined; const exportDetailJson = exportDetailBuffer && JSON.parse(exportDetailBuffer.toString()); if (exportDetailJson?.success) { + const appPathRoutesManifestPath = join(dir, distDir, "app-path-routes-manifest.json"); + const appPathRoutesManifestJSON = fileExistsSync(appPathRoutesManifestPath) ? + await readFile( + appPathRoutesManifestPath + ).then((it) => JSON.parse(it.toString())) : + {}; const prerenderManifestJSON = await readFile( join(dir, distDir, "prerender-manifest.json") ).then((it) => JSON.parse(it.toString())); @@ -100,10 +118,14 @@ export async function build(dir: string): Promise { ).then((it) => JSON.parse(it.toString())); const prerenderedRoutes = Object.keys(prerenderManifestJSON.routes); const dynamicRoutes = Object.keys(prerenderManifestJSON.dynamicRoutes); - const unrenderedPages = Object.keys(pagesManifestJSON).filter( + const unrenderedPages = [ + ...Object.keys(pagesManifestJSON), + // TODO handle fully rendered app + ...Object.values(appPathRoutesManifestJSON), + ].filter( (it) => !( - ["/_app", "/_error", "/_document", "/404"].includes(it) || + ["/_app", "/", "/_error", "/_document", "/404"].includes(it) || prerenderedRoutes.includes(it) || dynamicRoutes.includes(it) ) @@ -176,25 +198,32 @@ export async function ɵcodegenPublicDirectory(sourceDir: string, destDir: strin } await copy(join(sourceDir, distDir, "static"), join(destDir, "_next", "static")); - const serverPagesDir = join(sourceDir, distDir, "server", "pages"); - await copy(serverPagesDir, destDir, { - filter: async (filename) => { - const status = await stat(filename); - if (status.isDirectory()) return true; - return extname(filename) === ".html"; - }, - }); + // Copy over the default html files + for (const file of ['index.html', '404.html', '500.html']) { + const pagesPath = join(sourceDir, distDir, "server", "pages", file); + if (await pathExists(pagesPath)) { + await copyFile(pagesPath, join(destDir, file)); + continue; + } + const appPath = join(sourceDir, distDir, "server", "app", file); + if (await pathExists(appPath)) { + await copyFile(appPath, join(destDir, file)); + } + }; const prerenderManifestBuffer = await readFile( join(sourceDir, distDir, "prerender-manifest.json") ); const prerenderManifest = JSON.parse(prerenderManifestBuffer.toString()); - // TODO drop from hosting if revalidate - for (const route in prerenderManifest.routes) { - if (prerenderManifest.routes[route]) { + for (const path in prerenderManifest.routes) { + const route = prerenderManifest.routes[path]; + if (route) { + // Skip ISR in the deploy to hosting + if (route.initialRevalidateSeconds) continue; + // / => index.json => index.html => index.html // /foo => foo.json => foo.html - const parts = route + const parts = path .split("/") .slice(1) .filter((it) => !!it); @@ -202,16 +231,26 @@ export async function ɵcodegenPublicDirectory(sourceDir: string, destDir: strin const dataPath = `${join(...partsOrIndex)}.json`; const htmlPath = `${join(...partsOrIndex)}.html`; await mkdir(join(destDir, dirname(htmlPath)), { recursive: true }); - await copyFile( - join(sourceDir, distDir, "server", "pages", htmlPath), - join(destDir, htmlPath) - ); - const dataRoute = prerenderManifest.routes[route].dataRoute; + const pagesHtmlPath = join(sourceDir, distDir, "server", "pages", htmlPath); + if (await pathExists(pagesHtmlPath)) { + await copyFile(pagesHtmlPath, join(destDir, htmlPath)); + } else { + const appHtmlPath = join(sourceDir, distDir, "server", "app", htmlPath); + if (await pathExists(appHtmlPath)) { + await copyFile(appHtmlPath, join(destDir, htmlPath)); + } + } + const dataRoute = prerenderManifest.routes[path].dataRoute; await mkdir(join(destDir, dirname(dataRoute)), { recursive: true }); - await copyFile( - join(sourceDir, distDir, "server", "pages", dataPath), - join(destDir, dataRoute) - ); + const pagesDataPath = join(sourceDir, distDir, "server", "pages", dataPath); + if (await pathExists(pagesDataPath)) { + await copyFile(pagesDataPath, join(destDir, dataRoute)); + } else { + const appDataPath = join(sourceDir, distDir, "server", "app", dataPath); + if (await pathExists(appDataPath)) { + await copyFile(appDataPath, join(destDir, dataRoute)); + } + } } } } From 4db6cb6827333bacb32675d30c22551a14b72908 Mon Sep 17 00:00:00 2001 From: James Daniels Date: Tue, 25 Oct 2022 21:50:27 -0400 Subject: [PATCH 02/13] Formatting --- src/frameworks/next/index.ts | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/frameworks/next/index.ts b/src/frameworks/next/index.ts index c9b6f076a12..b3460c0dc10 100644 --- a/src/frameworks/next/index.ts +++ b/src/frameworks/next/index.ts @@ -1,6 +1,6 @@ import { execSync } from "child_process"; -import { readFile, mkdir, copyFile, stat } from "fs/promises"; -import { dirname, extname, join } from "path"; +import { readFile, mkdir, copyFile } from "fs/promises"; +import { dirname, join } from "path"; import type { Header, Rewrite, Redirect } from "next/dist/lib/load-custom-routes"; import type { NextConfig } from "next"; import { copy, mkdirp, pathExists } from "fs-extra"; @@ -76,7 +76,7 @@ export async function build(dir: string): Promise { // TODO use semver rather than parseInt if (parseInt(reactVersion, 10) > 18) { // This needs to be set for Next build to succeed with React 18 - process.env.__NEXT_REACT_ROOT = 'true'; + process.env.__NEXT_REACT_ROOT = "true"; } await nextBuild(dir, null, false, false, true).catch((e) => { @@ -102,11 +102,9 @@ export async function build(dir: string): Promise { const exportDetailJson = exportDetailBuffer && JSON.parse(exportDetailBuffer.toString()); if (exportDetailJson?.success) { const appPathRoutesManifestPath = join(dir, distDir, "app-path-routes-manifest.json"); - const appPathRoutesManifestJSON = fileExistsSync(appPathRoutesManifestPath) ? - await readFile( - appPathRoutesManifestPath - ).then((it) => JSON.parse(it.toString())) : - {}; + const appPathRoutesManifestJSON = fileExistsSync(appPathRoutesManifestPath) + ? await readFile(appPathRoutesManifestPath).then((it) => JSON.parse(it.toString())) + : {}; const prerenderManifestJSON = await readFile( join(dir, distDir, "prerender-manifest.json") ).then((it) => JSON.parse(it.toString())); @@ -199,7 +197,7 @@ export async function ɵcodegenPublicDirectory(sourceDir: string, destDir: strin await copy(join(sourceDir, distDir, "static"), join(destDir, "_next", "static")); // Copy over the default html files - for (const file of ['index.html', '404.html', '500.html']) { + for (const file of ["index.html", "404.html", "500.html"]) { const pagesPath = join(sourceDir, distDir, "server", "pages", file); if (await pathExists(pagesPath)) { await copyFile(pagesPath, join(destDir, file)); @@ -209,17 +207,17 @@ export async function ɵcodegenPublicDirectory(sourceDir: string, destDir: strin if (await pathExists(appPath)) { await copyFile(appPath, join(destDir, file)); } - }; + } const prerenderManifestBuffer = await readFile( join(sourceDir, distDir, "prerender-manifest.json") ); const prerenderManifest = JSON.parse(prerenderManifestBuffer.toString()); for (const path in prerenderManifest.routes) { - const route = prerenderManifest.routes[path]; - if (route) { + if (prerenderManifest.routes[path]) { // Skip ISR in the deploy to hosting - if (route.initialRevalidateSeconds) continue; + const { initialRevalidateSeconds } = prerenderManifest.routes[path]; + if (initialRevalidateSeconds) continue; // / => index.json => index.html => index.html // /foo => foo.json => foo.html From 578346a8fa6d52a53a99b4b90d0f606c6ea964ca Mon Sep 17 00:00:00 2001 From: James Daniels Date: Tue, 25 Oct 2022 21:55:38 -0400 Subject: [PATCH 03/13] gte --- src/frameworks/next/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frameworks/next/index.ts b/src/frameworks/next/index.ts index b3460c0dc10..2a6864a90f4 100644 --- a/src/frameworks/next/index.ts +++ b/src/frameworks/next/index.ts @@ -74,7 +74,7 @@ export async function build(dir: string): Promise { const reactVersion = getReactVersion(dir); // TODO use semver rather than parseInt - if (parseInt(reactVersion, 10) > 18) { + if (parseInt(reactVersion, 10) >= 18) { // This needs to be set for Next build to succeed with React 18 process.env.__NEXT_REACT_ROOT = "true"; } From 1e8665dbda88c5b4b3b9ee08b8ee0e9b9af3000f Mon Sep 17 00:00:00 2001 From: James Daniels Date: Thu, 27 Oct 2022 23:36:18 -0400 Subject: [PATCH 04/13] Bumping deploy test to next 13, adding revalidate and app dir --- .../hosting/app/bar/page.tsx | 5 + .../hosting/app/foo/page.tsx | 3 + .../hosting/app/layout.tsx | 9 + .../hosting/package-lock.json | 277 +++++++++--------- .../hosting/package.json | 2 +- scripts/webframeworks-deploy-tests/tests.ts | 4 + 6 files changed, 168 insertions(+), 132 deletions(-) create mode 100644 scripts/webframeworks-deploy-tests/hosting/app/bar/page.tsx create mode 100644 scripts/webframeworks-deploy-tests/hosting/app/foo/page.tsx create mode 100644 scripts/webframeworks-deploy-tests/hosting/app/layout.tsx diff --git a/scripts/webframeworks-deploy-tests/hosting/app/bar/page.tsx b/scripts/webframeworks-deploy-tests/hosting/app/bar/page.tsx new file mode 100644 index 00000000000..f5b50e727fe --- /dev/null +++ b/scripts/webframeworks-deploy-tests/hosting/app/bar/page.tsx @@ -0,0 +1,5 @@ +export const revalidate = 60; + +export default function Bar() { + return <>Bar; +} \ No newline at end of file diff --git a/scripts/webframeworks-deploy-tests/hosting/app/foo/page.tsx b/scripts/webframeworks-deploy-tests/hosting/app/foo/page.tsx new file mode 100644 index 00000000000..1ec9bd5dfbd --- /dev/null +++ b/scripts/webframeworks-deploy-tests/hosting/app/foo/page.tsx @@ -0,0 +1,3 @@ +export default function Foo() { + return <>Foo; +} \ No newline at end of file diff --git a/scripts/webframeworks-deploy-tests/hosting/app/layout.tsx b/scripts/webframeworks-deploy-tests/hosting/app/layout.tsx new file mode 100644 index 00000000000..f6e66e8436d --- /dev/null +++ b/scripts/webframeworks-deploy-tests/hosting/app/layout.tsx @@ -0,0 +1,9 @@ +export default function RootLayout({ children }: any) { + return ( + + + {children} + + ) +} + \ No newline at end of file diff --git a/scripts/webframeworks-deploy-tests/hosting/package-lock.json b/scripts/webframeworks-deploy-tests/hosting/package-lock.json index 5b23704afab..69330694bbc 100644 --- a/scripts/webframeworks-deploy-tests/hosting/package-lock.json +++ b/scripts/webframeworks-deploy-tests/hosting/package-lock.json @@ -8,7 +8,7 @@ "name": "hosting", "version": "0.1.0", "dependencies": { - "next": "12.3.1", + "next": "13.0.0", "react": "18.2.0", "react-dom": "18.2.0" }, @@ -113,9 +113,9 @@ "dev": true }, "node_modules/@next/env": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/env/-/env-12.3.1.tgz", - "integrity": "sha512-9P9THmRFVKGKt9DYqeC2aKIxm8rlvkK38V1P1sRE7qyoPBIs8l9oo79QoSdPtOWfzkbDAVUqvbQGgTMsb8BtJg==" + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/env/-/env-13.0.0.tgz", + "integrity": "sha512-65v9BVuah2Mplohm4+efsKEnoEuhmlGm8B2w6vD1geeEP2wXtlSJCvR/cCRJ3fD8wzCQBV41VcMBQeYET6MRkg==" }, "node_modules/@next/eslint-plugin-next": { "version": "12.3.1", @@ -127,9 +127,9 @@ } }, "node_modules/@next/swc-android-arm-eabi": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.1.tgz", - "integrity": "sha512-i+BvKA8tB//srVPPQxIQN5lvfROcfv4OB23/L1nXznP+N/TyKL8lql3l7oo2LNhnH66zWhfoemg3Q4VJZSruzQ==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.0.0.tgz", + "integrity": "sha512-+DUQkYF93gxFjWY+CYWE1QDX6gTgnUiWf+W4UqZjM1Jcef8U97fS6xYh+i+8rH4MM0AXHm7OSakvfOMzmjU6VA==", "cpu": [ "arm" ], @@ -142,9 +142,9 @@ } }, "node_modules/@next/swc-android-arm64": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.3.1.tgz", - "integrity": "sha512-CmgU2ZNyBP0rkugOOqLnjl3+eRpXBzB/I2sjwcGZ7/Z6RcUJXK5Evz+N0ucOxqE4cZ3gkTeXtSzRrMK2mGYV8Q==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-13.0.0.tgz", + "integrity": "sha512-RW9Uy3bMSc0zVGCa11klFuwfP/jdcdkhdruqnrJ7v+7XHm6OFKkSRzX6ee7yGR1rdDZvTnP4GZSRSpzjLv/N0g==", "cpu": [ "arm64" ], @@ -157,9 +157,9 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.3.1.tgz", - "integrity": "sha512-hT/EBGNcu0ITiuWDYU9ur57Oa4LybD5DOQp4f22T6zLfpoBMfBibPtR8XktXmOyFHrL/6FC2p9ojdLZhWhvBHg==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.0.0.tgz", + "integrity": "sha512-APA26nps1j4qyhOIzkclW/OmgotVHj1jBxebSpMCPw2rXfiNvKNY9FA0TcuwPmUCNqaTnm703h6oW4dvp73A4Q==", "cpu": [ "arm64" ], @@ -172,9 +172,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-12.3.1.tgz", - "integrity": "sha512-9S6EVueCVCyGf2vuiLiGEHZCJcPAxglyckTZcEwLdJwozLqN0gtS0Eq0bQlGS3dH49Py/rQYpZ3KVWZ9BUf/WA==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.0.0.tgz", + "integrity": "sha512-qsUhUdoFuRJiaJ7LnvTQ6GZv1QnMDcRXCIjxaN0FNVXwrjkq++U7KjBUaxXkRzLV4C7u0NHLNOp0iZwNNE7ypw==", "cpu": [ "x64" ], @@ -187,9 +187,9 @@ } }, "node_modules/@next/swc-freebsd-x64": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.1.tgz", - "integrity": "sha512-qcuUQkaBZWqzM0F1N4AkAh88lLzzpfE6ImOcI1P6YeyJSsBmpBIV8o70zV+Wxpc26yV9vpzb+e5gCyxNjKJg5Q==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-13.0.0.tgz", + "integrity": "sha512-sCdyCbboS7CwdnevKH9J6hkJI76LUw1jVWt4eV7kISuLiPba3JmehZSWm80oa4ADChRVAwzhLAo2zJaYRrInbg==", "cpu": [ "x64" ], @@ -202,9 +202,9 @@ } }, "node_modules/@next/swc-linux-arm-gnueabihf": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.1.tgz", - "integrity": "sha512-diL9MSYrEI5nY2wc/h/DBewEDUzr/DqBjIgHJ3RUNtETAOB3spMNHvJk2XKUDjnQuluLmFMloet9tpEqU2TT9w==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-13.0.0.tgz", + "integrity": "sha512-/X/VxfFA41C9jrEv+sUsPLQ5vbDPVIgG0CJrzKvrcc+b+4zIgPgtfsaWq9ockjHFQi3ycvlZK4TALOXO8ovQ6Q==", "cpu": [ "arm" ], @@ -217,9 +217,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.1.tgz", - "integrity": "sha512-o/xB2nztoaC7jnXU3Q36vGgOolJpsGG8ETNjxM1VAPxRwM7FyGCPHOMk1XavG88QZSQf+1r+POBW0tLxQOJ9DQ==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.0.0.tgz", + "integrity": "sha512-x6Oxr1GIi0ZtNiT6jbw+JVcbEi3UQgF7mMmkrgfL4mfchOwXtWSHKTSSPnwoJWJfXYa0Vy1n8NElWNTGAqoWFw==", "cpu": [ "arm64" ], @@ -232,9 +232,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.1.tgz", - "integrity": "sha512-2WEasRxJzgAmP43glFNhADpe8zB7kJofhEAVNbDJZANp+H4+wq+/cW1CdDi8DqjkShPEA6/ejJw+xnEyDID2jg==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.0.0.tgz", + "integrity": "sha512-SnMH9ngI+ipGh3kqQ8+mDtWunirwmhQnQeZkEq9e/9Xsgjf04OetqrqRHKM1HmJtG2qMUJbyXFJ0F81TPuT+3g==", "cpu": [ "arm64" ], @@ -247,9 +247,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.1.tgz", - "integrity": "sha512-JWEaMyvNrXuM3dyy9Pp5cFPuSSvG82+yABqsWugjWlvfmnlnx9HOQZY23bFq3cNghy5V/t0iPb6cffzRWylgsA==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.0.0.tgz", + "integrity": "sha512-VSQwTX9EmdbotArtA1J67X8964oQfe0xHb32x4tu+JqTR+wOHyG6wGzPMdXH2oKAp6rdd7BzqxUXXf0J+ypHlw==", "cpu": [ "x64" ], @@ -262,9 +262,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.1.tgz", - "integrity": "sha512-xoEWQQ71waWc4BZcOjmatuvPUXKTv6MbIFzpm4LFeCHsg2iwai0ILmNXf81rJR+L1Wb9ifEke2sQpZSPNz1Iyg==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.0.0.tgz", + "integrity": "sha512-xBCP0nnpO0q4tsytXkvIwWFINtbFRyVY5gxa1zB0vlFtqYR9lNhrOwH3CBrks3kkeaePOXd611+8sjdUtrLnXA==", "cpu": [ "x64" ], @@ -277,9 +277,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.1.tgz", - "integrity": "sha512-hswVFYQYIeGHE2JYaBVtvqmBQ1CppplQbZJS/JgrVI3x2CurNhEkmds/yqvDONfwfbttTtH4+q9Dzf/WVl3Opw==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.0.0.tgz", + "integrity": "sha512-NutwDafqhGxqPj/eiUixJq9ImS/0sgx6gqlD7jRndCvQ2Q8AvDdu1+xKcGWGNnhcDsNM/n1avf1e62OG1GaqJg==", "cpu": [ "arm64" ], @@ -292,9 +292,9 @@ } }, "node_modules/@next/swc-win32-ia32-msvc": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.1.tgz", - "integrity": "sha512-Kny5JBehkTbKPmqulr5i+iKntO5YMP+bVM8Hf8UAmjSMVo3wehyLVc9IZkNmcbxi+vwETnQvJaT5ynYBkJ9dWA==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.0.0.tgz", + "integrity": "sha512-zNaxaO+Kl/xNz02E9QlcVz0pT4MjkXGDLb25qxtAzyJL15aU0+VjjbIZAYWctG59dvggNIUNDWgoBeVTKB9xLg==", "cpu": [ "ia32" ], @@ -307,9 +307,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.1.tgz", - "integrity": "sha512-W1ijvzzg+kPEX6LAc+50EYYSEo0FVu7dmTE+t+DM4iOLqgGHoW9uYSz9wCVdkXOEEMP9xhXfGpcSxsfDucyPkA==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.0.0.tgz", + "integrity": "sha512-FFOGGWwTCRMu9W7MF496Urefxtuo2lttxF1vwS+1rIRsKvuLrWhVaVTj3T8sf2EBL6gtJbmh4TYlizS+obnGKA==", "cpu": [ "x64" ], @@ -761,6 +761,11 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -2195,43 +2200,43 @@ "dev": true }, "node_modules/next": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/next/-/next-12.3.1.tgz", - "integrity": "sha512-l7bvmSeIwX5lp07WtIiP9u2ytZMv7jIeB8iacR28PuUEFG5j0HGAPnMqyG5kbZNBG2H7tRsrQ4HCjuMOPnANZw==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/next/-/next-13.0.0.tgz", + "integrity": "sha512-puH1WGM6rGeFOoFdXXYfUxN9Sgi4LMytCV5HkQJvVUOhHfC1DoVqOfvzaEteyp6P04IW+gbtK2Q9pInVSrltPA==", "dependencies": { - "@next/env": "12.3.1", + "@next/env": "13.0.0", "@swc/helpers": "0.4.11", "caniuse-lite": "^1.0.30001406", "postcss": "8.4.14", - "styled-jsx": "5.0.7", + "styled-jsx": "5.1.0", "use-sync-external-store": "1.2.0" }, "bin": { "next": "dist/bin/next" }, "engines": { - "node": ">=12.22.0" + "node": ">=14.6.0" }, "optionalDependencies": { - "@next/swc-android-arm-eabi": "12.3.1", - "@next/swc-android-arm64": "12.3.1", - "@next/swc-darwin-arm64": "12.3.1", - "@next/swc-darwin-x64": "12.3.1", - "@next/swc-freebsd-x64": "12.3.1", - "@next/swc-linux-arm-gnueabihf": "12.3.1", - "@next/swc-linux-arm64-gnu": "12.3.1", - "@next/swc-linux-arm64-musl": "12.3.1", - "@next/swc-linux-x64-gnu": "12.3.1", - "@next/swc-linux-x64-musl": "12.3.1", - "@next/swc-win32-arm64-msvc": "12.3.1", - "@next/swc-win32-ia32-msvc": "12.3.1", - "@next/swc-win32-x64-msvc": "12.3.1" + "@next/swc-android-arm-eabi": "13.0.0", + "@next/swc-android-arm64": "13.0.0", + "@next/swc-darwin-arm64": "13.0.0", + "@next/swc-darwin-x64": "13.0.0", + "@next/swc-freebsd-x64": "13.0.0", + "@next/swc-linux-arm-gnueabihf": "13.0.0", + "@next/swc-linux-arm64-gnu": "13.0.0", + "@next/swc-linux-arm64-musl": "13.0.0", + "@next/swc-linux-x64-gnu": "13.0.0", + "@next/swc-linux-x64-musl": "13.0.0", + "@next/swc-win32-arm64-msvc": "13.0.0", + "@next/swc-win32-ia32-msvc": "13.0.0", + "@next/swc-win32-x64-msvc": "13.0.0" }, "peerDependencies": { "fibers": ">= 3.1.0", "node-sass": "^6.0.0 || ^7.0.0", - "react": "^17.0.2 || ^18.0.0-0", - "react-dom": "^17.0.2 || ^18.0.0-0", + "react": "^18.0.0-0", + "react-dom": "^18.0.0-0", "sass": "^1.3.0" }, "peerDependenciesMeta": { @@ -2859,9 +2864,12 @@ } }, "node_modules/styled-jsx": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.0.7.tgz", - "integrity": "sha512-b3sUzamS086YLRuvnaDigdAewz1/EFYlHpYBP5mZovKEdQQOIIYq8lApylub3HHZ6xFjV051kkGU7cudJmrXEA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.0.tgz", + "integrity": "sha512-/iHaRJt9U7T+5tp6TRelLnqBqiaIT0HsO0+vgyj8hK2KUk7aejFqRrumqPUlAqDwAj8IbS/1hk3IhBAAK/FCUQ==", + "dependencies": { + "client-only": "0.0.1" + }, "engines": { "node": ">= 12.0.0" }, @@ -3158,9 +3166,9 @@ "dev": true }, "@next/env": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/env/-/env-12.3.1.tgz", - "integrity": "sha512-9P9THmRFVKGKt9DYqeC2aKIxm8rlvkK38V1P1sRE7qyoPBIs8l9oo79QoSdPtOWfzkbDAVUqvbQGgTMsb8BtJg==" + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/env/-/env-13.0.0.tgz", + "integrity": "sha512-65v9BVuah2Mplohm4+efsKEnoEuhmlGm8B2w6vD1geeEP2wXtlSJCvR/cCRJ3fD8wzCQBV41VcMBQeYET6MRkg==" }, "@next/eslint-plugin-next": { "version": "12.3.1", @@ -3172,81 +3180,81 @@ } }, "@next/swc-android-arm-eabi": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.1.tgz", - "integrity": "sha512-i+BvKA8tB//srVPPQxIQN5lvfROcfv4OB23/L1nXznP+N/TyKL8lql3l7oo2LNhnH66zWhfoemg3Q4VJZSruzQ==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.0.0.tgz", + "integrity": "sha512-+DUQkYF93gxFjWY+CYWE1QDX6gTgnUiWf+W4UqZjM1Jcef8U97fS6xYh+i+8rH4MM0AXHm7OSakvfOMzmjU6VA==", "optional": true }, "@next/swc-android-arm64": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.3.1.tgz", - "integrity": "sha512-CmgU2ZNyBP0rkugOOqLnjl3+eRpXBzB/I2sjwcGZ7/Z6RcUJXK5Evz+N0ucOxqE4cZ3gkTeXtSzRrMK2mGYV8Q==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-13.0.0.tgz", + "integrity": "sha512-RW9Uy3bMSc0zVGCa11klFuwfP/jdcdkhdruqnrJ7v+7XHm6OFKkSRzX6ee7yGR1rdDZvTnP4GZSRSpzjLv/N0g==", "optional": true }, "@next/swc-darwin-arm64": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.3.1.tgz", - "integrity": "sha512-hT/EBGNcu0ITiuWDYU9ur57Oa4LybD5DOQp4f22T6zLfpoBMfBibPtR8XktXmOyFHrL/6FC2p9ojdLZhWhvBHg==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.0.0.tgz", + "integrity": "sha512-APA26nps1j4qyhOIzkclW/OmgotVHj1jBxebSpMCPw2rXfiNvKNY9FA0TcuwPmUCNqaTnm703h6oW4dvp73A4Q==", "optional": true }, "@next/swc-darwin-x64": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-12.3.1.tgz", - "integrity": "sha512-9S6EVueCVCyGf2vuiLiGEHZCJcPAxglyckTZcEwLdJwozLqN0gtS0Eq0bQlGS3dH49Py/rQYpZ3KVWZ9BUf/WA==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.0.0.tgz", + "integrity": "sha512-qsUhUdoFuRJiaJ7LnvTQ6GZv1QnMDcRXCIjxaN0FNVXwrjkq++U7KjBUaxXkRzLV4C7u0NHLNOp0iZwNNE7ypw==", "optional": true }, "@next/swc-freebsd-x64": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.1.tgz", - "integrity": "sha512-qcuUQkaBZWqzM0F1N4AkAh88lLzzpfE6ImOcI1P6YeyJSsBmpBIV8o70zV+Wxpc26yV9vpzb+e5gCyxNjKJg5Q==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-13.0.0.tgz", + "integrity": "sha512-sCdyCbboS7CwdnevKH9J6hkJI76LUw1jVWt4eV7kISuLiPba3JmehZSWm80oa4ADChRVAwzhLAo2zJaYRrInbg==", "optional": true }, "@next/swc-linux-arm-gnueabihf": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.1.tgz", - "integrity": "sha512-diL9MSYrEI5nY2wc/h/DBewEDUzr/DqBjIgHJ3RUNtETAOB3spMNHvJk2XKUDjnQuluLmFMloet9tpEqU2TT9w==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-13.0.0.tgz", + "integrity": "sha512-/X/VxfFA41C9jrEv+sUsPLQ5vbDPVIgG0CJrzKvrcc+b+4zIgPgtfsaWq9ockjHFQi3ycvlZK4TALOXO8ovQ6Q==", "optional": true }, "@next/swc-linux-arm64-gnu": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.1.tgz", - "integrity": "sha512-o/xB2nztoaC7jnXU3Q36vGgOolJpsGG8ETNjxM1VAPxRwM7FyGCPHOMk1XavG88QZSQf+1r+POBW0tLxQOJ9DQ==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.0.0.tgz", + "integrity": "sha512-x6Oxr1GIi0ZtNiT6jbw+JVcbEi3UQgF7mMmkrgfL4mfchOwXtWSHKTSSPnwoJWJfXYa0Vy1n8NElWNTGAqoWFw==", "optional": true }, "@next/swc-linux-arm64-musl": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.1.tgz", - "integrity": "sha512-2WEasRxJzgAmP43glFNhADpe8zB7kJofhEAVNbDJZANp+H4+wq+/cW1CdDi8DqjkShPEA6/ejJw+xnEyDID2jg==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.0.0.tgz", + "integrity": "sha512-SnMH9ngI+ipGh3kqQ8+mDtWunirwmhQnQeZkEq9e/9Xsgjf04OetqrqRHKM1HmJtG2qMUJbyXFJ0F81TPuT+3g==", "optional": true }, "@next/swc-linux-x64-gnu": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.1.tgz", - "integrity": "sha512-JWEaMyvNrXuM3dyy9Pp5cFPuSSvG82+yABqsWugjWlvfmnlnx9HOQZY23bFq3cNghy5V/t0iPb6cffzRWylgsA==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.0.0.tgz", + "integrity": "sha512-VSQwTX9EmdbotArtA1J67X8964oQfe0xHb32x4tu+JqTR+wOHyG6wGzPMdXH2oKAp6rdd7BzqxUXXf0J+ypHlw==", "optional": true }, "@next/swc-linux-x64-musl": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.1.tgz", - "integrity": "sha512-xoEWQQ71waWc4BZcOjmatuvPUXKTv6MbIFzpm4LFeCHsg2iwai0ILmNXf81rJR+L1Wb9ifEke2sQpZSPNz1Iyg==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.0.0.tgz", + "integrity": "sha512-xBCP0nnpO0q4tsytXkvIwWFINtbFRyVY5gxa1zB0vlFtqYR9lNhrOwH3CBrks3kkeaePOXd611+8sjdUtrLnXA==", "optional": true }, "@next/swc-win32-arm64-msvc": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.1.tgz", - "integrity": "sha512-hswVFYQYIeGHE2JYaBVtvqmBQ1CppplQbZJS/JgrVI3x2CurNhEkmds/yqvDONfwfbttTtH4+q9Dzf/WVl3Opw==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.0.0.tgz", + "integrity": "sha512-NutwDafqhGxqPj/eiUixJq9ImS/0sgx6gqlD7jRndCvQ2Q8AvDdu1+xKcGWGNnhcDsNM/n1avf1e62OG1GaqJg==", "optional": true }, "@next/swc-win32-ia32-msvc": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.1.tgz", - "integrity": "sha512-Kny5JBehkTbKPmqulr5i+iKntO5YMP+bVM8Hf8UAmjSMVo3wehyLVc9IZkNmcbxi+vwETnQvJaT5ynYBkJ9dWA==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.0.0.tgz", + "integrity": "sha512-zNaxaO+Kl/xNz02E9QlcVz0pT4MjkXGDLb25qxtAzyJL15aU0+VjjbIZAYWctG59dvggNIUNDWgoBeVTKB9xLg==", "optional": true }, "@next/swc-win32-x64-msvc": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.1.tgz", - "integrity": "sha512-W1ijvzzg+kPEX6LAc+50EYYSEo0FVu7dmTE+t+DM4iOLqgGHoW9uYSz9wCVdkXOEEMP9xhXfGpcSxsfDucyPkA==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.0.0.tgz", + "integrity": "sha512-FFOGGWwTCRMu9W7MF496Urefxtuo2lttxF1vwS+1rIRsKvuLrWhVaVTj3T8sf2EBL6gtJbmh4TYlizS+obnGKA==", "optional": true }, "@nodelib/fs.scandir": { @@ -3559,6 +3567,11 @@ "supports-color": "^7.1.0" } }, + "client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" + }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -4637,28 +4650,28 @@ "dev": true }, "next": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/next/-/next-12.3.1.tgz", - "integrity": "sha512-l7bvmSeIwX5lp07WtIiP9u2ytZMv7jIeB8iacR28PuUEFG5j0HGAPnMqyG5kbZNBG2H7tRsrQ4HCjuMOPnANZw==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/next/-/next-13.0.0.tgz", + "integrity": "sha512-puH1WGM6rGeFOoFdXXYfUxN9Sgi4LMytCV5HkQJvVUOhHfC1DoVqOfvzaEteyp6P04IW+gbtK2Q9pInVSrltPA==", "requires": { - "@next/env": "12.3.1", - "@next/swc-android-arm-eabi": "12.3.1", - "@next/swc-android-arm64": "12.3.1", - "@next/swc-darwin-arm64": "12.3.1", - "@next/swc-darwin-x64": "12.3.1", - "@next/swc-freebsd-x64": "12.3.1", - "@next/swc-linux-arm-gnueabihf": "12.3.1", - "@next/swc-linux-arm64-gnu": "12.3.1", - "@next/swc-linux-arm64-musl": "12.3.1", - "@next/swc-linux-x64-gnu": "12.3.1", - "@next/swc-linux-x64-musl": "12.3.1", - "@next/swc-win32-arm64-msvc": "12.3.1", - "@next/swc-win32-ia32-msvc": "12.3.1", - "@next/swc-win32-x64-msvc": "12.3.1", + "@next/env": "13.0.0", + "@next/swc-android-arm-eabi": "13.0.0", + "@next/swc-android-arm64": "13.0.0", + "@next/swc-darwin-arm64": "13.0.0", + "@next/swc-darwin-x64": "13.0.0", + "@next/swc-freebsd-x64": "13.0.0", + "@next/swc-linux-arm-gnueabihf": "13.0.0", + "@next/swc-linux-arm64-gnu": "13.0.0", + "@next/swc-linux-arm64-musl": "13.0.0", + "@next/swc-linux-x64-gnu": "13.0.0", + "@next/swc-linux-x64-musl": "13.0.0", + "@next/swc-win32-arm64-msvc": "13.0.0", + "@next/swc-win32-ia32-msvc": "13.0.0", + "@next/swc-win32-x64-msvc": "13.0.0", "@swc/helpers": "0.4.11", "caniuse-lite": "^1.0.30001406", "postcss": "8.4.14", - "styled-jsx": "5.0.7", + "styled-jsx": "5.1.0", "use-sync-external-store": "1.2.0" } }, @@ -5077,10 +5090,12 @@ "dev": true }, "styled-jsx": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.0.7.tgz", - "integrity": "sha512-b3sUzamS086YLRuvnaDigdAewz1/EFYlHpYBP5mZovKEdQQOIIYq8lApylub3HHZ6xFjV051kkGU7cudJmrXEA==", - "requires": {} + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.0.tgz", + "integrity": "sha512-/iHaRJt9U7T+5tp6TRelLnqBqiaIT0HsO0+vgyj8hK2KUk7aejFqRrumqPUlAqDwAj8IbS/1hk3IhBAAK/FCUQ==", + "requires": { + "client-only": "0.0.1" + } }, "supports-color": { "version": "7.2.0", diff --git a/scripts/webframeworks-deploy-tests/hosting/package.json b/scripts/webframeworks-deploy-tests/hosting/package.json index 767c471e2fb..337edffd67c 100644 --- a/scripts/webframeworks-deploy-tests/hosting/package.json +++ b/scripts/webframeworks-deploy-tests/hosting/package.json @@ -9,7 +9,7 @@ "lint": "next lint" }, "dependencies": { - "next": "12.3.1", + "next": "13.0.0", "react": "18.2.0", "react-dom": "18.2.0" }, diff --git a/scripts/webframeworks-deploy-tests/tests.ts b/scripts/webframeworks-deploy-tests/tests.ts index 120bfad0074..29087769611 100644 --- a/scripts/webframeworks-deploy-tests/tests.ts +++ b/scripts/webframeworks-deploy-tests/tests.ts @@ -2,6 +2,8 @@ import { expect } from "chai"; import * as cli from "./cli"; import { requireAuth } from "../../src/requireAuth"; +import { readdir } from "fs/promises"; +import { join } from "path"; const FIREBASE_PROJECT = process.env.GCLOUD_PROJECT || ""; const FIREBASE_DEBUG = process.env.FIREBASE_DEBUG || ""; @@ -47,5 +49,7 @@ describe("webframeworks deploy", function (this) { expect(result.stdout, "deploy result").to.match(/file upload complete/); expect(result.stdout, "deploy result").to.match(/found 16 files/); expect(result.stdout, "deploy result").to.match(/Deploy complete!/); + + expect(await readdir(join(__dirname, '.firebase', FIREBASE_PROJECT, 'hosting'))).to.eql([]); }); }); From 703737642fe204bc127239f21758bba7975e418c Mon Sep 17 00:00:00 2001 From: James Daniels Date: Thu, 27 Oct 2022 23:36:57 -0400 Subject: [PATCH 05/13] Enable appdir exp --- scripts/webframeworks-deploy-tests/hosting/next.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/webframeworks-deploy-tests/hosting/next.config.js b/scripts/webframeworks-deploy-tests/hosting/next.config.js index ae887958d3c..d3ef77accdd 100644 --- a/scripts/webframeworks-deploy-tests/hosting/next.config.js +++ b/scripts/webframeworks-deploy-tests/hosting/next.config.js @@ -2,6 +2,9 @@ const nextConfig = { reactStrictMode: true, swcMinify: true, + experimental: { + appDir: true + }, } module.exports = nextConfig From de2a50b3fb9050ae3d5293357b3a196e3654f44a Mon Sep 17 00:00:00 2001 From: James Daniels Date: Thu, 27 Oct 2022 23:43:24 -0400 Subject: [PATCH 06/13] linting, semver --- scripts/webframeworks-deploy-tests/tests.ts | 2 +- src/frameworks/next/index.ts | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/webframeworks-deploy-tests/tests.ts b/scripts/webframeworks-deploy-tests/tests.ts index 29087769611..5790cc36adf 100644 --- a/scripts/webframeworks-deploy-tests/tests.ts +++ b/scripts/webframeworks-deploy-tests/tests.ts @@ -50,6 +50,6 @@ describe("webframeworks deploy", function (this) { expect(result.stdout, "deploy result").to.match(/found 16 files/); expect(result.stdout, "deploy result").to.match(/Deploy complete!/); - expect(await readdir(join(__dirname, '.firebase', FIREBASE_PROJECT, 'hosting'))).to.eql([]); + expect(await readdir(join(__dirname, ".firebase", FIREBASE_PROJECT, "hosting"))).to.eql([]); }); }); diff --git a/src/frameworks/next/index.ts b/src/frameworks/next/index.ts index 2a6864a90f4..b37f49c599d 100644 --- a/src/frameworks/next/index.ts +++ b/src/frameworks/next/index.ts @@ -6,6 +6,7 @@ import type { NextConfig } from "next"; import { copy, mkdirp, pathExists } from "fs-extra"; import { pathToFileURL, parse } from "url"; import { existsSync } from "fs"; + import { BuildResult, createServerResponseProxy, @@ -48,11 +49,11 @@ export const name = "Next.js"; export const support = SupportLevel.Experimental; export const type = FrameworkType.MetaFramework; -function getNextVersion(cwd: string) { +function getNextVersion(cwd: string): string|undefined { return findDependency("next", { cwd, depth: 0, omitDev: false })?.version; } -function getReactVersion(cwd: string) { +function getReactVersion(cwd: string): string|undefined { return findDependency("react-dom", { cwd, omitDev: false })?.version; } @@ -73,8 +74,7 @@ export async function build(dir: string): Promise { const { default: nextBuild } = relativeRequire(dir, "next/dist/build"); const reactVersion = getReactVersion(dir); - // TODO use semver rather than parseInt - if (parseInt(reactVersion, 10) >= 18) { + if (reactVersion && gte(reactVersion, "18.0.0")) { // This needs to be set for Next build to succeed with React 18 process.env.__NEXT_REACT_ROOT = "true"; } @@ -118,7 +118,8 @@ export async function build(dir: string): Promise { const dynamicRoutes = Object.keys(prerenderManifestJSON.dynamicRoutes); const unrenderedPages = [ ...Object.keys(pagesManifestJSON), - // TODO handle fully rendered app + // TODO flush out fully rendered detection with a app directory (Next 13) + // we shouldn't go too crazy here yet, as this is currently an expiriment ...Object.values(appPathRoutesManifestJSON), ].filter( (it) => From b6a5ab90ae0fafc3482f8398a963f68730f6b229 Mon Sep 17 00:00:00 2001 From: James Daniels Date: Thu, 27 Oct 2022 23:50:37 -0400 Subject: [PATCH 07/13] Changelog and lint --- CHANGELOG.md | 2 ++ src/frameworks/next/index.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df80ce2f267..a0d63917100 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ - Releases RTDB Emulator v4.11.0: Wire protocol update for `startAfter`, `endBefore`. - Changes `superstatic` dependency to `v8`, addressing Hosting emulator issues on Windows. - Fixes internal library that was not being correctly published. +- Add support for Next.js 13 in firebase deploy. +- Next.js routes with revalidate are now handled by the a backing Cloud Function. \ No newline at end of file diff --git a/src/frameworks/next/index.ts b/src/frameworks/next/index.ts index b37f49c599d..2ee36875bb9 100644 --- a/src/frameworks/next/index.ts +++ b/src/frameworks/next/index.ts @@ -49,11 +49,11 @@ export const name = "Next.js"; export const support = SupportLevel.Experimental; export const type = FrameworkType.MetaFramework; -function getNextVersion(cwd: string): string|undefined { +function getNextVersion(cwd: string): string | undefined { return findDependency("next", { cwd, depth: 0, omitDev: false })?.version; } -function getReactVersion(cwd: string): string|undefined { +function getReactVersion(cwd: string): string | undefined { return findDependency("react-dom", { cwd, omitDev: false })?.version; } From 6853f71889112162e533cb5dde3cc787f575db1c Mon Sep 17 00:00:00 2001 From: James Daniels Date: Thu, 27 Oct 2022 23:57:38 -0400 Subject: [PATCH 08/13] newline --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0d63917100..3bdb59ef9ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,4 +2,4 @@ - Changes `superstatic` dependency to `v8`, addressing Hosting emulator issues on Windows. - Fixes internal library that was not being correctly published. - Add support for Next.js 13 in firebase deploy. -- Next.js routes with revalidate are now handled by the a backing Cloud Function. \ No newline at end of file +- Next.js routes with revalidate are now handled by the a backing Cloud Function. From e0bdfc139227a9278011235ae180123839281a94 Mon Sep 17 00:00:00 2001 From: James Daniels Date: Thu, 27 Oct 2022 23:59:40 -0400 Subject: [PATCH 09/13] Should be 17 files --- scripts/webframeworks-deploy-tests/tests.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/webframeworks-deploy-tests/tests.ts b/scripts/webframeworks-deploy-tests/tests.ts index 5790cc36adf..61ff97542e4 100644 --- a/scripts/webframeworks-deploy-tests/tests.ts +++ b/scripts/webframeworks-deploy-tests/tests.ts @@ -47,9 +47,7 @@ describe("webframeworks deploy", function (this) { const result = await setOptsAndDeploy(); expect(result.stdout, "deploy result").to.match(/file upload complete/); - expect(result.stdout, "deploy result").to.match(/found 16 files/); + expect(result.stdout, "deploy result").to.match(/found 17 files/); expect(result.stdout, "deploy result").to.match(/Deploy complete!/); - - expect(await readdir(join(__dirname, ".firebase", FIREBASE_PROJECT, "hosting"))).to.eql([]); }); }); From a4f5e4102e9b6771d083a9d17b0f3289aa050cd5 Mon Sep 17 00:00:00 2001 From: James Daniels Date: Fri, 28 Oct 2022 00:05:41 -0400 Subject: [PATCH 10/13] Unused deps --- scripts/webframeworks-deploy-tests/tests.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/webframeworks-deploy-tests/tests.ts b/scripts/webframeworks-deploy-tests/tests.ts index 61ff97542e4..17b919878ed 100644 --- a/scripts/webframeworks-deploy-tests/tests.ts +++ b/scripts/webframeworks-deploy-tests/tests.ts @@ -2,8 +2,6 @@ import { expect } from "chai"; import * as cli from "./cli"; import { requireAuth } from "../../src/requireAuth"; -import { readdir } from "fs/promises"; -import { join } from "path"; const FIREBASE_PROJECT = process.env.GCLOUD_PROJECT || ""; const FIREBASE_DEBUG = process.env.FIREBASE_DEBUG || ""; From 8acb5a9395b52e4b2430056dd2820a03e3f9f8d0 Mon Sep 17 00:00:00 2001 From: James Daniels Date: Fri, 28 Oct 2022 00:13:30 -0400 Subject: [PATCH 11/13] 20 files actually --- .../hosting/.gitignore | 2 ++ .../hosting/tsconfig.json | 24 +++++++++++++++---- scripts/webframeworks-deploy-tests/tests.ts | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/scripts/webframeworks-deploy-tests/hosting/.gitignore b/scripts/webframeworks-deploy-tests/hosting/.gitignore index c87c9b392c0..4f360c89d2a 100644 --- a/scripts/webframeworks-deploy-tests/hosting/.gitignore +++ b/scripts/webframeworks-deploy-tests/hosting/.gitignore @@ -34,3 +34,5 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +.vscode diff --git a/scripts/webframeworks-deploy-tests/hosting/tsconfig.json b/scripts/webframeworks-deploy-tests/hosting/tsconfig.json index 99710e85787..b25c4f834cb 100644 --- a/scripts/webframeworks-deploy-tests/hosting/tsconfig.json +++ b/scripts/webframeworks-deploy-tests/hosting/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -13,8 +17,20 @@ "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", - "incremental": true + "incremental": true, + "plugins": [ + { + "name": "next" + } + ] }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts" + ], + "exclude": [ + "node_modules" + ] } diff --git a/scripts/webframeworks-deploy-tests/tests.ts b/scripts/webframeworks-deploy-tests/tests.ts index 17b919878ed..84341796168 100644 --- a/scripts/webframeworks-deploy-tests/tests.ts +++ b/scripts/webframeworks-deploy-tests/tests.ts @@ -45,7 +45,7 @@ describe("webframeworks deploy", function (this) { const result = await setOptsAndDeploy(); expect(result.stdout, "deploy result").to.match(/file upload complete/); - expect(result.stdout, "deploy result").to.match(/found 17 files/); + expect(result.stdout, "deploy result").to.match(/found 20 files/); expect(result.stdout, "deploy result").to.match(/Deploy complete!/); }); }); From 7bae0421cc270822cea62165ef08884ff8877869 Mon Sep 17 00:00:00 2001 From: James Daniels Date: Fri, 28 Oct 2022 00:38:42 -0400 Subject: [PATCH 12/13] next create --use-npm --- src/frameworks/next/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frameworks/next/index.ts b/src/frameworks/next/index.ts index 2ee36875bb9..afa2714259b 100644 --- a/src/frameworks/next/index.ts +++ b/src/frameworks/next/index.ts @@ -171,7 +171,7 @@ export async function init(setup: any) { choices: ["JavaScript", "TypeScript"], }); execSync( - `npx --yes create-next-app@latest -e hello-world ${setup.hosting.source} ${ + `npx --yes create-next-app@latest -e hello-world ${setup.hosting.source} --use-npm ${ language === "TypeScript" ? "--ts" : "" }`, { stdio: "inherit" } From f4be89c139c8ed0df7b4f4c2f71ade624de201e3 Mon Sep 17 00:00:00 2001 From: James Daniels Date: Mon, 31 Oct 2022 15:57:18 -0400 Subject: [PATCH 13/13] Feedback and todo --- .../webframeworks-deploy-tests/hosting/app/bar/page.tsx | 2 +- .../webframeworks-deploy-tests/hosting/app/foo/page.tsx | 2 +- scripts/webframeworks-deploy-tests/hosting/app/layout.tsx | 1 - src/frameworks/next/index.ts | 7 ++++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/webframeworks-deploy-tests/hosting/app/bar/page.tsx b/scripts/webframeworks-deploy-tests/hosting/app/bar/page.tsx index f5b50e727fe..2db606988f1 100644 --- a/scripts/webframeworks-deploy-tests/hosting/app/bar/page.tsx +++ b/scripts/webframeworks-deploy-tests/hosting/app/bar/page.tsx @@ -2,4 +2,4 @@ export const revalidate = 60; export default function Bar() { return <>Bar; -} \ No newline at end of file +} diff --git a/scripts/webframeworks-deploy-tests/hosting/app/foo/page.tsx b/scripts/webframeworks-deploy-tests/hosting/app/foo/page.tsx index 1ec9bd5dfbd..3fb4cf4e4dc 100644 --- a/scripts/webframeworks-deploy-tests/hosting/app/foo/page.tsx +++ b/scripts/webframeworks-deploy-tests/hosting/app/foo/page.tsx @@ -1,3 +1,3 @@ export default function Foo() { return <>Foo; -} \ No newline at end of file +} diff --git a/scripts/webframeworks-deploy-tests/hosting/app/layout.tsx b/scripts/webframeworks-deploy-tests/hosting/app/layout.tsx index f6e66e8436d..7b221173feb 100644 --- a/scripts/webframeworks-deploy-tests/hosting/app/layout.tsx +++ b/scripts/webframeworks-deploy-tests/hosting/app/layout.tsx @@ -6,4 +6,3 @@ export default function RootLayout({ children }: any) { ) } - \ No newline at end of file diff --git a/src/frameworks/next/index.ts b/src/frameworks/next/index.ts index afa2714259b..e13ba65b00e 100644 --- a/src/frameworks/next/index.ts +++ b/src/frameworks/next/index.ts @@ -218,7 +218,12 @@ export async function ɵcodegenPublicDirectory(sourceDir: string, destDir: strin if (prerenderManifest.routes[path]) { // Skip ISR in the deploy to hosting const { initialRevalidateSeconds } = prerenderManifest.routes[path]; - if (initialRevalidateSeconds) continue; + if (initialRevalidateSeconds) { + continue; + } + + // TODO(jamesdaniels) explore oppertunity to simplify this now that we + // are defaulting cleanURLs to true for frameworks // / => index.json => index.html => index.html // /foo => foo.json => foo.html