{"_id":"@cfpreview/vercel-to-pages","_rev":"1-eab5b1b3af20e3d497818d575809db37","name":"@cfpreview/vercel-to-pages","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@cfpreview/vercel-to-pages","version":"0.0.1","bin":{"vercel-to-pages":"bin/index.js"},"scripts":{"build":"npx esbuild --bundle --platform=node ./src/index.ts --external:esbuild --outfile=./dist/index.js"},"dependencies":{"esbuild":"^0.15.3","shellac":"^0.7.2"},"peerDependencies":{"vercel":"^28.0.2"},"devDependencies":{"@cloudflare/workers-types":"^3.14.1","esbuild-plugin-fileloc":"^0.0.6","prettier":"^2.7.1","typescript":"^4.7.4"},"gitHead":"c2846609b17f7e657c84c91fa26033f12620a463","description":"## WARNING!","_id":"@cfpreview/vercel-to-pages@0.0.1","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-Y1WkVCpbyKNQH5giXWmtGNMEhrjjP1t3YL1A1fxHQjVcYLM0JQW/P69CMPUPGhF9qCtz2bBWQhGOOK4jTsQJcw==","shasum":"ccbde9539c3bb5fb90cfc0a8415075fbaf926554","tarball":"https://registry.npmjs.org/@cfpreview/vercel-to-pages/-/vercel-to-pages-0.0.1.tgz","fileCount":8,"unpackedSize":40614,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAVDfph9/TMM8AiYNB6t4XMbN9m1Y9vHVpYJsCOV1ENDAiEAzACfGLoYTyNBNJhrzCPVn4slg8PPtn/LuIvDxKm8mcY="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi++heACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq+Xg//aqTg63svsN7PcA2IMFGfKVAly2V7AY3sxMaOdMzeb00ca0FD\r\n87XlsrASypV6wWpBiQBmovaZl+E8jEj+L6obYfSXGr08r/E946PgP/JluVPi\r\nVCGy4sVVGjK7f2G9VLEqI6QME3+emUByI1TI3n+Iryq9GmKjM9X3PS2aWu8t\r\nvvycNZjXykc1PKFBCcCVm4I2iw8Yx2POAXqnxEYqLH7BBnBSo4fG7ofPplYF\r\nPrWjZVocnHoXygrQAR1gpkKl3I27YRs1kr9Sn5q2IvvfFXYteF+pL1kLVnX2\r\nNv6FKLBa33fyHe7GkC462mY/8tkaH4UZ8UPWMY/HQoNJikDinJugRElIsQdh\r\nztIo12x/VZ9EIW1Fcq0FV64R/nUQ2yEg5H0F9mmeEvgPzqeLY4rtTvsPv2/l\r\n75/00E4S7SSsp4NFloMwSX5pDrxnisSgv0IIvyzIOn9WyBmfwuoelBTOGSpO\r\n0mOfoYy/j7NFRW7D0eE131+YLWiJ5JQhh1nhytPq0n0Yy6v5Sc9VKtJh+8rB\r\ndBsPtVS6lyw/CmX6MFR2OTmSrx74vE2E+SUOcnJLpIyOy8Z4d1zpe5t7eAkR\r\nqaqrbSUX3UVJ42rG+QHx58JP/sHTTvVhYgPYvp0qs7eW7LtsiqYx7qwVrg9y\r\n22aS8joT1tm5SfNl8bYLObV35DwhUheJnSQ=\r\n=qRYL\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"gregbrimble","email":"developer@gregbrimble.com"},"directories":{},"maintainers":[{"name":"gregbrimble","email":"developer@gregbrimble.com"},{"name":"1000hz","email":"itscina@gmail.com"},{"name":"geelen","email":"glen@glenmaddern.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vercel-to-pages_0.0.1_1660676190290_0.8095412778307993"},"_hasShrinkwrap":false},"0.0.2":{"name":"@cfpreview/vercel-to-pages","version":"0.0.2","bin":{"vercel-to-pages":"bin/index.js"},"scripts":{"build":"npx esbuild --bundle --platform=node ./src/index.ts --external:esbuild --external:chokidar --outfile=./dist/index.js"},"dependencies":{"chokidar":"^3.5.3","esbuild":"^0.15.3"},"peerDependencies":{"vercel":"^28.0.2"},"devDependencies":{"@cloudflare/workers-types":"^3.14.1","prettier":"^2.7.1","typescript":"^4.7.4","p-limit":"^4.0.0"},"gitHead":"c2846609b17f7e657c84c91fa26033f12620a463","description":"## WARNING!","_id":"@cfpreview/vercel-to-pages@0.0.2","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-WaJgEw12gvuILBLo/Qby0uSAwrYlIpk1h8SArXvR4BqcqgS177uIUj2525WhhX757SrfolT14cBbbGIWcejZKA==","shasum":"8e9ea3bd3326053b01221e7b1aa1fa0092ae51a1","tarball":"https://registry.npmjs.org/@cfpreview/vercel-to-pages/-/vercel-to-pages-0.0.2.tgz","fileCount":8,"unpackedSize":20689,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDYDcEkN7320UUHiOPn1JDTBOZUh9DVdFeIdTDNMvGUsAIhAIhNr/Zk+UFc3p476u5oyJithTLL4Ib8oLxY7eXXikyD"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjSWKYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpqbRAAhbec83mLL5yqyL2a/ZIYAQyMcN5ezLneCO8/2W4jO1X4s1WC\r\nnvHjqv35PN/19krq3QndA2U7h6isR2XqBLlVLiEJ+E6fJ8g45anCo6HdXg/e\r\nQvxH0pc+OrHXz4AFg/FYpp8CyuQLwkof9ELH5DArQatDypyqwqnKhFh6lo3d\r\nQDasSdHPJDjhmdXH4cLx1+4lE6ng/xQ5tpQ+3mMb+728qGIHz30hvFt9codL\r\niNth9NVCn4aCp7K6qAe1PsTgrjrZsOWXhNygsdPdWa4jsThvsdljGBW2IJup\r\nTuAL9gpixZYBKFnBwbTPNWqH1peZXhz5BW25+PNUtdC2+t9SRh/H8Nk8cW9t\r\nvco7LIj1H8L6MtB3rPl47g/iz6su9aNMwpdfL2O5NdkCA42+AyJNO43igG0w\r\nQWhSM7WBEkScQ/5lYjVmkNz5WwV+2BlUqDdNFsESGm9EZJh5zuJcGzkwTp6e\r\nacPY4KkyV8w5n+3VAWQEQ652PEwE47PJEpd5Pq/4j5mJQLM1fDMHlUfd+e1S\r\nK0TYTsyl/UXpNrMHh5a0uG72SsggHk4Dpsmlt1JwCGjBukLW0CrBBYIDA0zq\r\n+zFQFFs6wnLaeS7V8Xowsz7ACtrI8dDhRpTHquaNzZ+/rCw6Lpbo71qy6tQO\r\nM9JH7MbmKj6u8oKE027pKVpxd4FbMx/TYvs=\r\n=QD1R\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"gregbrimble","email":"developer@gregbrimble.com"},"directories":{},"maintainers":[{"name":"gregbrimble","email":"developer@gregbrimble.com"},{"name":"1000hz","email":"itscina@gmail.com"},{"name":"geelen","email":"glen@glenmaddern.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vercel-to-pages_0.0.2_1665753752205_0.6005009720922045"},"_hasShrinkwrap":false}},"time":{"created":"2022-08-16T18:56:30.225Z","0.0.1":"2022-08-16T18:56:30.516Z","modified":"2022-10-14T13:22:32.565Z","0.0.2":"2022-10-14T13:22:32.469Z"},"maintainers":[{"name":"gregbrimble","email":"developer@gregbrimble.com"},{"name":"1000hz","email":"itscina@gmail.com"},{"name":"geelen","email":"glen@glenmaddern.com"}],"description":"## WARNING!","readme":"# Vercel to Pages\n\n## WARNING!\n\nThis is a crazy super experimental alpha. Do not rely on any security mechanisms firing. We haven't finished implementing all the routing logic yet.\n\n## Getting Started\n\n1. `npx create-next-app@latest --typescript --use-npm`\n\n   1. Enter a project name e.g. `my-next-app`\n\n1. `cd` into the new directory (e.g. `cd my-next-app`)\n\n1. `npm install -D @cfpreview/vercel-to-pages-cli vercel`\n\n1. `rm -rf pages/api/hello.ts`\n\n   The default API endpoint they give you is a Node.js one. Easiest to just remove it and start fresh.\n\n1. `npx @cfpreview/vercel-to-pages`\n\n1. `npx wrangler pages project create`\n\n   1. Enter a project name e.g. `my-next-app-on-pages`\n\n1. `curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/pages/projects/$PROJECT_NAME -H 'X-Auth-Email: $ACCOUNT_EMAIL_ADDRESS' -H 'X-Auth-Key: $ACCOUNT_API_KEY' -X PATCH -d '{\"deployment_configs\":{\"production\":{\"compatibility_date\": \"2022-08-16\", \"compatibility_flags\": [\"transformstream_enable_standard_constructor\",\"streams_enable_constructors\"]},\"preview\":{\"compatibility_date\": \"2022-08-16\", \"compatibility_flags\": [\"transformstream_enable_standard_constructor\",\"streams_enable_constructors\"]}}}'`\n\n1. `npx wrangler pages publish .vercel/output/static`\n\n## What now?\n\nAdd some dynamic functionality to your app! Export the following on your routes:\n\n```typescript\nexport const config = {\n  runtime: \"experimental-edge\",\n};\n```\n\n### Edge API Routes\n\nNext.js supports [Edge API Routes](https://nextjs.org/docs/api-routes/edge-api-routes):\n\n```typescript\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### SSR Routes\n\n[`getServerSideProps()`](https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props) can be evaluated in Workers:\n\n```typescript\n// ./pages/ssr.tsx\n\nimport type { NextPage } from \"next\";\nimport Head from \"next/head\";\nimport Image from \"next/image\";\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\n        <div className={styles.grid}>\n          <a href=\"https://nextjs.org/docs\" className={styles.card}>\n            <h2>Documentation &rarr;</h2>\n            <p>Find in-depth information about Next.js features and API.</p>\n          </a>\n\n          <a href=\"https://nextjs.org/learn\" className={styles.card}>\n            <h2>Learn &rarr;</h2>\n            <p>Learn about Next.js in an interactive course with quizzes!</p>\n          </a>\n\n          <a\n            href=\"https://github.com/vercel/next.js/tree/canary/examples\"\n            className={styles.card}\n          >\n            <h2>Examples &rarr;</h2>\n            <p>Discover and deploy boilerplate example Next.js projects.</p>\n          </a>\n\n          <a\n            href=\"https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app\"\n            className={styles.card}\n          >\n            <h2>Deploy &rarr;</h2>\n            <p>\n              Instantly deploy your Next.js site to a public URL with Vercel.\n            </p>\n          </a>\n        </div>\n      </main>\n\n      <footer className={styles.footer}>\n        <a\n          href=\"https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app\"\n          target=\"_blank\"\n          rel=\"noopener noreferrer\"\n        >\n          Powered by{\" \"}\n          <span className={styles.logo}>\n            <Image src=\"/vercel.svg\" alt=\"Vercel Logo\" width={72} height={16} />\n          </span>\n        </a>\n      </footer>\n    </div>\n  );\n};\n\nexport default Home;\n```\n\n## Middleware\n\n[Middleware](https://nextjs.org/docs/advanced-features/middleware) is likely also be possible, but we haven't connected it up yet.\n","readmeFilename":"README.md"}