{"_id":"@boardjs-io/next-on-pages","_rev":"1-3e64379d3647ed6770d0c65b7a2498f2","name":"@boardjs-io/next-on-pages","dist-tags":{"latest":"0.3.1"},"versions":{"0.3.0":{"name":"@boardjs-io/next-on-pages","version":"0.3.0","bin":{"next-on-pages":"bin/index.js"},"scripts":{"build":"npx esbuild --bundle --platform=node ./src/index.ts --external:esbuild --external:chokidar --outfile=./dist/index.js","publish":"npm run build && npx changeset publish"},"dependencies":{"acorn":"^8.8.0","astring":"^1.8.3","chokidar":"^3.5.3","cookie":"^0.5.0","esbuild":"^0.15.3"},"peerDependencies":{"vercel":"^28.0.2"},"devDependencies":{"@changesets/cli":"^2.26.0","@cloudflare/workers-types":"^3.14.1","@types/cookie":"^0.5.1","p-limit":"^4.0.0","prettier":"^2.7.1","typescript":"^4.7.4","vitest":"^0.24.3"},"gitHead":"9d38d4aecb6be4226c2cff628f244358e574d88c","description":"Reference:","_id":"@boardjs-io/next-on-pages@0.3.0","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-UhrmwtvcqGdegvdsioxzcU7oil11Ur8AdWIerrehJcsR+tizT1cZAn+h7L7ziP/ATawNM2vxok9N3ZAi1mWIWQ==","shasum":"9335af80dbe83bff3937dcb8afc9711601fda81f","tarball":"https://registry.npmjs.org/@boardjs-io/next-on-pages/-/next-on-pages-0.3.0.tgz","fileCount":9,"unpackedSize":241255,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDicEfL3PMm7ZVBMrBSJarzYmZ+m1FOI4Mulp2RNw9AgQIhAPvVfddEFuSw9vCpQd+jJMHoIpYxyX0Fihk3hUnMa+b2"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkEUjxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrpNQ/9GCKbCdO9TXCodSfwwAeEuPeYMvfmTAZgnm5hJhnX1Kfzwhm9\r\nDGxRZ0YukpxLwHYMuI+ZxVEsUgC9eo36QEYY40AAij/p4Csr43mB3b/hQINO\r\nY+3nhXLlNjy9NNtw8UqzZ+X55kKCwbvHuHUzRe+r/1kJxOA32XV8UL2GU0F0\r\nuRrhde1vgE7xwdijJha1E4uNv2HEpM7XHtGbq3beGOmcDLeGsSKJVjETQ/+i\r\ndkKjhBUjkEhu1h5fne3KlHurz8GfjwZd90a3brFmIDGnjyEZkh43PGFir6Cj\r\nThGJzx3W0Blj819JSdAE/xtGC2zUAKe3Cs5N5Gi1ZF+ryiOXPYKHRp/lB5pz\r\nBmF/OElSlAhypfLPGr8PscKjVC1fY65ImR3+KZ+aMse6ASFPStRqjRLGQ8L3\r\nOb86/C5w64cpNskGJtlDUJ0JFwP8sMt3p7dEIS7pHrtRJwH0a27boz9A7ziU\r\nOMKZq+6SIon3MmyAtFW4V1Z5ZNcZknEf0JjK/ceK6xUWhPoBec4m5JiMCCr1\r\nwKiwpo0DMDR5wOs189WvzEEPIGtQaY9/FuWa/i2prgQTrtEI9JWvs0Dp1eUL\r\nuzFFZwsXktyaD2xyOYr+cKgXPwNYBToa2uyivXMS23hhsln+2Tk1vuhgy7kX\r\nML9AqpXCo+eNThLMTyClGjW82WDmOAOz5Us=\r\n=bioW\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"edencoder","email":"alex@edenup.com"},"directories":{},"maintainers":[{"name":"edencoder","email":"alex@edenup.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-on-pages_0.3.0_1678854385448_0.05326869801516532"},"_hasShrinkwrap":false},"0.3.1":{"name":"@boardjs-io/next-on-pages","version":"0.3.1","bin":{"next-on-pages":"bin/index.js"},"scripts":{"build":"npx esbuild --bundle --platform=node ./src/index.ts --external:esbuild --external:chokidar --outfile=./dist/index.js","publish":"npm run build && npx changeset publish"},"dependencies":{"acorn":"^8.8.0","astring":"^1.8.3","chokidar":"^3.5.3","cookie":"^0.5.0","esbuild":"^0.15.3"},"peerDependencies":{"vercel":"^28.0.2"},"devDependencies":{"@changesets/cli":"^2.26.0","@cloudflare/workers-types":"^3.14.1","@types/cookie":"^0.5.1","p-limit":"^4.0.0","prettier":"^2.7.1","typescript":"^4.7.4","vitest":"^0.24.3"},"gitHead":"9d38d4aecb6be4226c2cff628f244358e574d88c","description":"Reference:","_id":"@boardjs-io/next-on-pages@0.3.1","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-/Eh+lZ+h/ffg/ZkC1BybpDxymNAJWBe6sAH1U0hc4acX3wI3k3qHUag5t54F4PyDvOTjknzstqbXVDTQsOu4dg==","shasum":"25ac0d8b3bc1dfb4b7b855ea979953b57ffd9ca7","tarball":"https://registry.npmjs.org/@boardjs-io/next-on-pages/-/next-on-pages-0.3.1.tgz","fileCount":9,"unpackedSize":241514,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDe7/CNZOr5gnQJNCzbQjoq3Jpf/tQODQOD8ReNnIY/cAIgb50snyElk7D3wJn7KUNd79vAlV2ijlhc/o+buvhSoMc="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkEWmYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoPYA//XpnzDiOS66jGEkP8WeaW60iKO4bf6Q8YooX+cL04Iumi+bJ9\r\nrg1SCSvP0TL4MgRYdfZ0XG40w5GrIVkBmrltKn6aO548bs9OoEDYERZonw9e\r\nsHc097wGoMD6hZxpuPHijQga1vmUE2aC2bYs/aCHjF+1heWW9GPY7tJrkdVW\r\nlwLNp+RozR01Q/PmWjMk6IBuw+psCrEzC3iIC9y7bO8ON83mMriol/9vzDII\r\n0auwM9UaZOXPHWz6pdtcWNfu0i0q/f4eOPN0KLzbrGHrfXhZtrzpSfS54M75\r\nJ+xBs59i0USF8QEjEaWqAzw7besy2cUZBw7troY/hj/qWZZihTI5UXtte9C0\r\n3X9N+5M/W8J4mpX05H/d4cTVk+q05TlN/2nuJm7B3zAuywVDOOKN4VJhOkjR\r\nV0ar5XJB0j92Hp9tLQCMMrsegN7rj6XP3MMgdGFS4MvMurcnGF7j+2cGeT7V\r\nL63y0p4rHK8XpTRF6AOYwDuMZjvwh5TPJbghsMsQTvfx+f0rJsxaJdcMBJqQ\r\nmblfHx/XaxX9labyfXNoSrIa0d3/9zFCF51LvtFRX+6Ngt/wSdMRMcaTFMxO\r\nMka2rP1MIZzR6zEUn5jxFneCjgEs7zocbsVqbuqs+i/9OqZSUnsfxh1O8kwJ\r\nCsXCgFBaCX9lDv7+RVgpG4yd/DEQQQPlRe4=\r\n=RcwC\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"edencoder","email":"alex@edenup.com"},"directories":{},"maintainers":[{"name":"edencoder","email":"alex@edenup.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/next-on-pages_0.3.1_1678862744693_0.1940341161356196"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-15T04:26:25.353Z","0.3.0":"2023-03-15T04:26:25.584Z","modified":"2023-03-15T06:45:44.987Z","0.3.1":"2023-03-15T06:45:44.892Z"},"maintainers":[{"name":"edencoder","email":"alex@edenup.com"}],"description":"Reference:","readme":"# `@cloudflare/next-on-pages`\n\nReference:\n\n- [Blog](https://blog.cloudflare.com/next-on-pages)\n- [Documentation](https://developers.cloudflare.com/pages/framework-guides/deploy-a-nextjs-site/)\n\n## Quick Start\n\n1. `npx create-next-app@latest my-app`\n\n   Note that if you elect to use eslint, there are a couple of places you need to add return types to make the default template pass the pre-build checks.\n\n1. `cd` into the new directory (e.g. `cd my-app`)\n\n1. `npm install -D @cloudflare/next-on-pages vercel`\n\n1. Configure the project to use the Edge Runtime:\n\n   1. Replace `pages/api/hello.ts` with the following:\n\n      ```typescript\n      // Next.js Edge API Routes: https://nextjs.org/docs/api-routes/edge-api-routes\n      import type { NextRequest } from \"next/server\";\n\n      export const config = {\n        runtime: \"experimental-edge\",\n      };\n\n      export default async function handler(\n        req: NextRequest\n      ): Promise<Response> {\n        return new Response(JSON.stringify({ name: \"John Doe\" }), {\n          status: 200,\n          headers: {\n            \"Content-Type\": \"application/json\",\n          },\n        });\n      }\n      ```\n\n   1. Add the following to `next.config.js`:\n\n      ```diff\n      /** @type {import('next').NextConfig} */\n      const nextConfig = {\n      + experimental: {\n      +   runtime: \"experimental-edge\",\n      + },\n        reactStrictMode: true,\n        swcMinify: true,\n      };\n\n      module.exports = nextConfig;\n      ```\n\n1. `git commit` and `git push` to a GitHub/GitLab repository.\n\n1. Create a Pages project, connect that repository, and select \"Next.js\" from the framework preset list.\n\n   | Option                 | Value                                                 |\n   | ---------------------- | ----------------------------------------------------- |\n   | Build command          | `npx @cloudflare/next-on-pages --experimental-minify` |\n   | Build output directory | `.vercel/output/static`                               |\n\n1. Add a `NODE_VERSION` environment variable set to `14` or greater.\n\n1. In the Pages project **Settings** > **Functions** > **Compatibility Flags**, add the `transformstream_enable_standard_constructor` and `streams_enable_constructors` flags. These will not be necessary once they graduate to be on by default on 2022-11-30's compatibility date.\n\n1. The project should now be ready to deploy. Create a new deployment.\n\n## `@cloudflare/next-on-pages` CLI\n\n```\n⚡️ @cloudflare/next-to-pages CLI\n⚡️\n⚡️ Usage: npx @cloudflare/next-to-pages [options]\n⚡️\n⚡️ Options:\n⚡️\n⚡️   --help:                Shows this help message\n⚡️\n⚡️   --skip-build:          Doesn't run 'vercel build' automatically\n⚡️\n⚡️   --experimental-minify: Attempts to minify the functions of a project (by de-duping webpack chunks)\n⚡️\n⚡️   --watch:               Automatically rebuilds when the project is edited\n⚡️\n⚡️\n⚡️ GitHub: https://github.com/cloudflare/next-on-pages\n⚡️ Docs: https://developers.cloudflare.com/pages/framework-guides/deploy-a-nextjs-site/\n```\n\n**Local testing**\n\nIn one terminal, run `npx @cloudflare/next-on-pages --watch`, and in another `npx wrangler pages dev .vercel/output/static --compatibility-flags=streams_enable_constructors`. We hope to soon make improvements to the refresh speed.\n\n### Build Output Configuration\n\n| `config.json` property  | Support                                                                                                                                           |\n| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |\n| version                 | `3`                                                                                                                                               |\n| routes `src`            | ✅                                                                                                                                                |\n| routes `dest`           | 🔄                                                                                                                                                |\n| routes `headers`        | 🔄                                                                                                                                                |\n| routes `methods`        | ✅                                                                                                                                                |\n| routes `continue`       | 🔄                                                                                                                                                |\n| routes `caseSensitive`  | ✅                                                                                                                                                |\n| routes `check`          | 🔄                                                                                                                                                |\n| routes `status`         | 🔄                                                                                                                                                |\n| routes `has`            | ✅                                                                                                                                                |\n| routes `missing`        | ✅                                                                                                                                                |\n| routes `locale`         | 🔄                                                                                                                                                |\n| routes `middlewarePath` | ✅                                                                                                                                                |\n| images                  | ❌ (see [Cloudflare's Image Resizing documentation](https://developers.cloudflare.com/images/image-resizing/integration-with-frameworks/#nextjs)) |\n| wildcard                | 🔄                                                                                                                                                |\n| overrides               | 🔄                                                                                                                                                |\n| cache                   | ❌                                                                                                                                                |\n\n- ✅: Supported\n- 🔄: Not currently supported, but it's probably possible and we may add support in the future\n- ❌: Not supported and unlikely we ever will support this\n\n## Examples\n\n### [Next.js 13's `app` Directory](https://beta.nextjs.org/docs/routing/fundamentals#the-app-directory)\n\nAdd the following to `next.config.js`:\n\n```diff\n/** @type {import('next').NextConfig} */\nconst nextConfig = {\n  experimental: {\n    runtime: \"experimental-edge\",\n+   appDir: true,\n  },\n  reactStrictMode: true,\n  swcMinify: true,\n};\n\nmodule.exports = nextConfig;\n```\n\nIf you're following the [Next.js 12 → 13 Upgrade Guide](https://beta.nextjs.org/docs/upgrade-guide#step-4-migrating-pages), delete any `./pages/_app.tsx` and `./pages/index.tsx` files and replace with `./app/layout.tsx` and `./app/page.tsx`:\n\n```typescript\n// ./app/layout.tsx\nimport \"../styles/globals.css\";\nimport { FC } from \"react\";\n\nconst RootLayout: FC<{\n  children: React.ReactNode;\n}> = ({\n  // Layouts must accept a children prop.\n  // This will be populated with nested layouts or pages\n  children,\n}) => {\n  return (\n    <html lang=\"en\">\n      <body>{children}</body>\n    </html>\n  );\n};\n\nexport default RootLayout;\n```\n\n```typescript\n// ./app/page.tsx\nimport { FC } from \"react\";\nimport styles from \"../styles/Home.module.css\";\n\nconst Home = async (): Promise<ReturnType<FC>> => {\n  const uuid = await fetch(\"https://uuid.rocks/plain\").then(\n    async (response) => await response.text()\n  );\n\n  return (\n    <div className={styles.container}>\n      <main className={styles.main}>\n        <h1 className={styles.title}>\n          Welcome to <a href=\"https://nextjs.org\">Next.js!</a>\n        </h1>\n\n        <p className={styles.description}>\n          Get started by editing{\" \"}\n          <code className={styles.code}>pages/index.tsx</code>\n        </p>\n\n        <p className={styles.description}>\n          Here&apos;s a server-side UUID:\n          <code className={styles.code}>{uuid}</code>\n        </p>\n      </main>\n    </div>\n  );\n};\n\nexport default Home;\n```\n\n### [Edge API Routes](https://nextjs.org/docs/api-routes/edge-api-routes)\n\n```typescript\n// ./pages/api/some_route.ts\n\nimport type { NextRequest } from \"next/server\";\n\nexport const config = {\n  runtime: \"experimental-edge\",\n};\n\nexport default async function handler(req: NextRequest) {\n  return new Response(\n    JSON.stringify({\n      name: process.env.NEXT_RUNTIME,\n    }),\n    {\n      status: 200,\n      headers: {\n        \"content-type\": \"application/json\",\n      },\n    }\n  );\n}\n```\n\n### Server-side rendering (SSR) pages with [`getServerSideProps()`](https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props)\n\n```typescript\n// ./pages/ssr.tsx\n\nimport type { NextPage } from \"next\";\nimport Head from \"next/head\";\nimport styles from \"../styles/Home.module.css\";\n\nexport const config = {\n  runtime: \"experimental-edge\",\n};\n\nexport const getServerSideProps = async () => {\n  return {\n    props: {\n      runtime: process.env.NEXT_RUNTIME,\n      uuid: await fetch(\"https://uuid.rocks/plain\").then((response) =>\n        response.text()\n      ),\n    },\n  };\n};\n\nconst Home: NextPage<{ runtime: string; uuid: string }> = ({\n  runtime,\n  uuid,\n}) => {\n  return (\n    <div className={styles.container}>\n      <Head>\n        <title>Create Next App</title>\n        <meta name=\"description\" content=\"Generated by create next app\" />\n        <link rel=\"icon\" href=\"/favicon.ico\" />\n      </Head>\n\n      <main className={styles.main}>\n        <h1 className={styles.title}>\n          Welcome to{\" \"}\n          <a href=\"https://nextjs.org\">Next.js, running at the {runtime}!</a>\n        </h1>\n\n        <p className={styles.description}>\n          Get started by editing{\" \"}\n          <code className={styles.code}>pages/index.tsx</code>\n        </p>\n\n        <p className={styles.description}>\n          Here&apos;s a server-side UUID:\n          <code className={styles.code}>{uuid}</code>\n        </p>\n      </main>\n    </div>\n  );\n};\n\nexport default Home;\n```\n\n### [Middleware](https://nextjs.org/docs/advanced-features/middleware)\n\n```typescript\nimport { NextResponse } from \"next/server\";\nimport type { NextRequest } from \"next/server\";\n\n// This function can be marked `async` if using `await` inside\nexport function middleware(request: NextRequest) {\n  return NextResponse.redirect(new URL(\"/about-2\", request.url));\n}\n\nexport const config = {\n  matcher: \"/about/:path*\",\n};\n```\n","readmeFilename":"README.md"}