edge-functions 1.6.4 → 1.7.0-stage.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/.eslintignore +3 -1
  2. package/.eslintrc.json +20 -63
  3. package/.github/workflows/release.yml +1 -2
  4. package/.prettierrc.json +7 -0
  5. package/.releaserc +52 -25
  6. package/CHANGELOG.md +37 -0
  7. package/examples/next/edge-pages-13-4-8/.eslintrc.json +3 -0
  8. package/examples/next/edge-pages-13-4-8/README.md +10 -0
  9. package/examples/next/edge-pages-13-4-8/next.config.js +6 -0
  10. package/examples/next/edge-pages-13-4-8/package.json +25 -0
  11. package/examples/next/edge-pages-13-4-8/postcss.config.js +6 -0
  12. package/examples/next/edge-pages-13-4-8/src/middleware.ts +12 -0
  13. package/examples/next/edge-pages-13-4-8/src/pages/[...catSlug].tsx +66 -0
  14. package/examples/next/edge-pages-13-4-8/src/pages/[prodSlug]/x.tsx +66 -0
  15. package/examples/next/edge-pages-13-4-8/src/pages/_app.tsx +6 -0
  16. package/examples/next/edge-pages-13-4-8/src/pages/_document.tsx +13 -0
  17. package/examples/next/edge-pages-13-4-8/src/pages/api/hello.ts +21 -0
  18. package/examples/next/edge-pages-13-4-8/src/pages/index.tsx +135 -0
  19. package/examples/next/edge-pages-13-4-8/src/pages/ssr.tsx +56 -0
  20. package/examples/next/edge-pages-13-4-8/src/styles/globals.css +27 -0
  21. package/examples/next/edge-pages-13-4-8/tailwind.config.js +18 -0
  22. package/examples/next/edge-pages-13-4-8/tsconfig.json +23 -0
  23. package/examples/next/next-static/other/app-build-manifest.json +28 -0
  24. package/examples/next/next-static/other/build-manifest.json +22 -0
  25. package/examples/next/next-static/other/cache/webpack/client-development/0.pack +0 -0
  26. package/examples/next/next-static/other/cache/webpack/client-development/1.pack +0 -0
  27. package/examples/next/next-static/other/cache/webpack/client-development/index.pack +0 -0
  28. package/examples/next/next-static/other/cache/webpack/client-development/index.pack.old +0 -0
  29. package/examples/next/next-static/other/cache/webpack/server-development/0.pack +0 -0
  30. package/examples/next/next-static/other/cache/webpack/server-development/index.pack +0 -0
  31. package/examples/next/next-static/other/package.json +1 -0
  32. package/examples/next/next-static/other/react-loadable-manifest.json +1 -0
  33. package/examples/next/next-static/other/server/app/blog/[slug]/page.js +2396 -0
  34. package/examples/next/next-static/other/server/app/misty-mountains/moria/page.js +2396 -0
  35. package/examples/next/next-static/other/server/app/page.js +2539 -0
  36. package/examples/next/next-static/other/server/app-paths-manifest.json +5 -0
  37. package/examples/next/next-static/other/server/client-reference-manifest.js +1 -0
  38. package/examples/next/next-static/other/server/client-reference-manifest.json +1104 -0
  39. package/examples/next/next-static/other/server/flight-server-css-manifest.js +1 -0
  40. package/examples/next/next-static/other/server/flight-server-css-manifest.json +34 -0
  41. package/examples/next/next-static/other/server/middleware-build-manifest.js +1 -0
  42. package/examples/next/next-static/other/server/middleware-manifest.json +6 -0
  43. package/examples/next/next-static/other/server/middleware-react-loadable-manifest.js +1 -0
  44. package/examples/next/next-static/other/server/next-font-manifest.js +1 -0
  45. package/examples/next/next-static/other/server/next-font-manifest.json +1 -0
  46. package/examples/next/next-static/other/server/pages-manifest.json +1 -0
  47. package/examples/next/next-static/other/server/server-reference-manifest.js +1 -0
  48. package/examples/next/next-static/other/server/server-reference-manifest.json +4 -0
  49. package/examples/next/next-static/other/server/webpack-runtime.js +215 -0
  50. package/examples/next/next-static/other/static/chunks/app/blog/[slug]/page.js +257 -0
  51. package/examples/next/next-static/other/static/chunks/app/layout.js +59 -0
  52. package/examples/next/next-static/other/static/chunks/app/misty-mountains/moria/page.js +257 -0
  53. package/examples/next/next-static/other/static/chunks/app/page.js +647 -0
  54. package/examples/next/next-static/other/static/chunks/app-client-internals.js +116 -0
  55. package/examples/next/next-static/other/static/chunks/main-app.js +1662 -0
  56. package/examples/next/next-static/other/static/chunks/polyfills.js +1 -0
  57. package/examples/next/next-static/other/static/chunks/react-refresh.js +62 -0
  58. package/examples/next/next-static/other/static/chunks/webpack.js +1399 -0
  59. package/examples/next/next-static/other/static/css/app/blog/[slug]/page.css +234 -0
  60. package/examples/next/next-static/other/static/css/app/layout.css +180 -0
  61. package/examples/next/next-static/other/static/css/app/misty-mountains/moria/page.css +234 -0
  62. package/examples/next/next-static/other/static/css/app/page.css +234 -0
  63. package/examples/next/next-static/other/static/development/_buildManifest.js +1 -0
  64. package/examples/next/next-static/other/static/development/_ssgManifest.js +1 -0
  65. package/examples/next/next-static/other/static/media/2aaf0723e720e8b9-s.p.woff2 +0 -0
  66. package/examples/next/next-static/other/static/media/9c4f34569c9b36ca-s.woff2 +0 -0
  67. package/examples/next/next-static/other/static/media/ae9ae6716d4f8bf8-s.woff2 +0 -0
  68. package/examples/next/next-static/other/static/media/b1db3e28af9ef94a-s.woff2 +0 -0
  69. package/examples/next/next-static/other/static/media/b967158bc7d7a9fb-s.woff2 +0 -0
  70. package/examples/next/next-static/other/static/media/c0f5ec5bbf5913b7-s.woff2 +0 -0
  71. package/examples/next/next-static/other/static/media/d1d9458b69004127-s.woff2 +0 -0
  72. package/examples/next/next-static/other/static/webpack/08bbe3671c2a994f.webpack.hot-update.json +1 -0
  73. package/examples/next/next-static/other/static/webpack/475258c680428a37.webpack.hot-update.json +1 -0
  74. package/examples/next/next-static/other/static/webpack/app/layout.dff06e6c74291157.hot-update.js +21 -0
  75. package/examples/next/next-static/other/static/webpack/app/page.dff06e6c74291157.hot-update.js +21 -0
  76. package/examples/next/next-static/other/static/webpack/app-client-internals.dff06e6c74291157.hot-update.js +21 -0
  77. package/examples/next/next-static/other/static/webpack/dff06e6c74291157.webpack.hot-update.json +1 -0
  78. package/examples/next/next-static/other/static/webpack/webpack.08bbe3671c2a994f.hot-update.js +717 -0
  79. package/examples/next/next-static/other/static/webpack/webpack.475258c680428a37.hot-update.js +18 -0
  80. package/examples/next/next-static/other/static/webpack/webpack.dff06e6c74291157.hot-update.js +18 -0
  81. package/examples/next/next-static/other/trace +17 -0
  82. package/examples/next/next-static/other/types/app/blog/[slug]/page.ts +70 -0
  83. package/examples/next/next-static/other/types/app/layout.ts +70 -0
  84. package/examples/next/next-static/other/types/app/misty-mountains/moria/page.ts +70 -0
  85. package/examples/next/next-static/other/types/app/page.ts +70 -0
  86. package/examples/next/next-static/other/types/package.json +1 -0
  87. package/examples/next/next-static/public/next.svg +1 -0
  88. package/examples/next/next-static/public/vercel.svg +1 -0
  89. package/examples/next/next-static/src/app/favicon.ico +0 -0
  90. package/examples/next/node-pages-12-3-1/.eslintrc.json +3 -0
  91. package/examples/next/node-pages-12-3-1/README.md +10 -0
  92. package/examples/next/node-pages-12-3-1/next.config.js +10 -0
  93. package/examples/next/node-pages-12-3-1/package.json +25 -0
  94. package/examples/next/node-pages-12-3-1/pages/[...catSlug].js +29 -0
  95. package/examples/next/node-pages-12-3-1/pages/[prodSlug]/x.js +29 -0
  96. package/examples/next/node-pages-12-3-1/pages/_app.js +7 -0
  97. package/examples/next/node-pages-12-3-1/pages/api/hello.js +5 -0
  98. package/examples/next/node-pages-12-3-1/pages/index.js +94 -0
  99. package/examples/next/node-pages-12-3-1/pages/ssr.js +21 -0
  100. package/examples/next/node-pages-12-3-1/public/favicon.ico +0 -0
  101. package/examples/next/node-pages-12-3-1/public/vercel.svg +4 -0
  102. package/examples/next/node-pages-12-3-1/styles/Home.module.css +139 -0
  103. package/examples/next/node-pages-12-3-1/styles/globals.css +26 -0
  104. package/lib/build/dispatcher/dispatcher.js +65 -22
  105. package/lib/build/polyfills/node/dns.js +150 -0
  106. package/lib/build/polyfills/node/globals/navigator.js +5 -0
  107. package/lib/build/polyfills/node/globals/performance.js +43 -0
  108. package/lib/build/polyfills/node/http2.js +106 -0
  109. package/lib/commands/presets.commands.js +15 -3
  110. package/lib/constants/messages/build.messages.js +6 -4
  111. package/lib/env/polyfills/fetch.polyfills.js +3 -1
  112. package/lib/env/runtime.env.js +7 -1
  113. package/lib/env/server.env.js +2 -6
  114. package/lib/main.js +4 -3
  115. package/lib/presets/custom/next/compute/config.js +91 -0
  116. package/lib/presets/custom/next/compute/default/index.js +15 -0
  117. package/lib/presets/custom/next/compute/handler.js +21 -0
  118. package/lib/presets/custom/next/compute/node/custom-server/12.3.1/index.js +14 -0
  119. package/lib/presets/custom/next/compute/node/custom-server/12.3.1/server/base-http/compute-js.js +16 -0
  120. package/lib/presets/custom/next/compute/node/custom-server/12.3.1/server/compute-js.js +47 -0
  121. package/lib/presets/custom/next/compute/node/custom-server/12.3.1/server/config.js +722 -0
  122. package/lib/presets/custom/next/compute/node/custom-server/12.3.1/server/load-components.js +70 -0
  123. package/lib/presets/custom/next/compute/node/custom-server/12.3.1/server/next-compute-js-server.js +1017 -0
  124. package/lib/presets/custom/next/compute/node/custom-server/12.3.1/server/next.js +84 -0
  125. package/lib/presets/custom/next/compute/node/custom-server/12.3.1/server/require.js +153 -0
  126. package/lib/presets/custom/next/compute/node/custom-server/12.3.1/server/response-cache/index.js +113 -0
  127. package/lib/presets/custom/next/compute/node/custom-server/12.3.1/server/serve-static.js +47 -0
  128. package/lib/presets/custom/next/compute/node/custom-server/12.3.1/util/etag.js +31 -0
  129. package/lib/presets/custom/next/compute/node/index.js +57 -0
  130. package/lib/presets/custom/next/compute/node/prebuild/index.js +3 -0
  131. package/lib/presets/custom/next/compute/node/prebuild/statics/index.js +196 -0
  132. package/lib/presets/custom/next/compute/prebuild.js +98 -0
  133. package/lib/utils/generateWebpackBanner/generateWebpackBanner.utils.js +17 -0
  134. package/lib/utils/generateWebpackBanner/index.js +3 -0
  135. package/lib/utils/index.js +4 -0
  136. package/lib/utils/presets/presets.utils.js +47 -4
  137. package/lib/utils/vercel/index.js +3 -0
  138. package/lib/utils/vercel/vercel.utils.js +49 -0
  139. package/package.json +33 -3
  140. package/examples/next-12-static/package-lock.json +0 -6191
  141. package/examples/next-static/yarn.lock +0 -199
  142. /package/examples/{next-static/src/app → next/edge-pages-13-4-8/public}/favicon.ico +0 -0
  143. /package/examples/{next-static → next/edge-pages-13-4-8}/public/next.svg +0 -0
  144. /package/examples/{next-static → next/edge-pages-13-4-8}/public/vercel.svg +0 -0
  145. /package/examples/{next-12-static → next/next-12-static}/.babelrc +0 -0
  146. /package/examples/{next-12-static → next/next-12-static}/README.md +0 -0
  147. /package/examples/{next-12-static → next/next-12-static}/components/post.jsx +0 -0
  148. /package/examples/{next-12-static → next/next-12-static}/package.json +0 -0
  149. /package/examples/{next-12-static → next/next-12-static}/pages/index.jsx +0 -0
  150. /package/examples/{next-12-static → next/next-12-static}/pages/post/[id].jsx +0 -0
  151. /package/examples/{next-static → next/next-static}/README.md +0 -0
  152. /package/examples/{next-static → next/next-static}/jsconfig.json +0 -0
  153. /package/examples/{next-static → next/next-static}/next.config.js +0 -0
  154. /package/examples/{next-static → next/next-static}/package.json +0 -0
  155. /package/examples/{next-static → next/next-static}/src/app/blog/[slug]/page.js +0 -0
  156. /package/examples/{next-static → next/next-static}/src/app/globals.css +0 -0
  157. /package/examples/{next-static → next/next-static}/src/app/layout.js +0 -0
  158. /package/examples/{next-static → next/next-static}/src/app/misty-mountains/moria/page.js +0 -0
  159. /package/examples/{next-static → next/next-static}/src/app/page.js +0 -0
  160. /package/examples/{next-static → next/next-static}/src/app/page.module.css +0 -0
@@ -0,0 +1,56 @@
1
+ import Image from 'next/image'
2
+ import { Inter } from 'next/font/google'
3
+
4
+ const inter = Inter({ subsets: ['latin'] })
5
+
6
+ export const config = {
7
+ runtime: "experimental-edge"
8
+ }
9
+
10
+ export const getServerSideProps = async ({ req, res }: any) => {
11
+ console.log("Running server side EdgeSsrExample!");
12
+
13
+ const message = `Current Time : ${new Date()}`;
14
+
15
+ return { props: { message } }
16
+ }
17
+
18
+ export default function Home({ message }: any) {
19
+ return (
20
+ <main
21
+ className={`flex min-h-screen flex-col items-center justify-between p-24 ${inter.className}`}
22
+ >
23
+ <div className="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">
24
+ <p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
25
+ SSR Example
26
+ </p>
27
+ <div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none">
28
+ <a
29
+ className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
30
+ href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app"
31
+ target="_blank"
32
+ rel="noopener noreferrer"
33
+ >
34
+ By{' '}
35
+ <Image
36
+ src="/vercel.svg"
37
+ alt="Vercel Logo"
38
+ className="dark:invert"
39
+ width={100}
40
+ height={24}
41
+ priority
42
+ />
43
+ </a>
44
+ </div>
45
+ </div>
46
+
47
+ <div className="relative flex place-items-center before:absolute before:h-[300px] before:w-[480px] before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-[240px] after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700/10 after:dark:from-sky-900 after:dark:via-[#0141ff]/40 before:lg:h-[360px]">
48
+ <h3>Server message = {message}</h3>
49
+ </div>
50
+
51
+ <div className="mb-32 grid text-center lg:mb-0 lg:grid-cols-4 lg:text-left">
52
+ <p></p>
53
+ </div>
54
+ </main>
55
+ )
56
+ }
@@ -0,0 +1,27 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ :root {
6
+ --foreground-rgb: 0, 0, 0;
7
+ --background-start-rgb: 214, 219, 220;
8
+ --background-end-rgb: 255, 255, 255;
9
+ }
10
+
11
+ @media (prefers-color-scheme: dark) {
12
+ :root {
13
+ --foreground-rgb: 255, 255, 255;
14
+ --background-start-rgb: 0, 0, 0;
15
+ --background-end-rgb: 0, 0, 0;
16
+ }
17
+ }
18
+
19
+ body {
20
+ color: rgb(var(--foreground-rgb));
21
+ background: linear-gradient(
22
+ to bottom,
23
+ transparent,
24
+ rgb(var(--background-end-rgb))
25
+ )
26
+ rgb(var(--background-start-rgb));
27
+ }
@@ -0,0 +1,18 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+ content: [
4
+ './src/pages/**/*.{js,ts,jsx,tsx,mdx}',
5
+ './src/components/**/*.{js,ts,jsx,tsx,mdx}',
6
+ './src/app/**/*.{js,ts,jsx,tsx,mdx}',
7
+ ],
8
+ theme: {
9
+ extend: {
10
+ backgroundImage: {
11
+ 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
12
+ 'gradient-conic':
13
+ 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
14
+ },
15
+ },
16
+ },
17
+ plugins: [],
18
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "noEmit": true,
10
+ "esModuleInterop": true,
11
+ "module": "esnext",
12
+ "moduleResolution": "node",
13
+ "resolveJsonModule": true,
14
+ "isolatedModules": true,
15
+ "jsx": "preserve",
16
+ "incremental": true,
17
+ "paths": {
18
+ "@/*": ["./src/*"]
19
+ }
20
+ },
21
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
22
+ "exclude": ["node_modules"]
23
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "pages": {
3
+ "/layout": [
4
+ "static/chunks/webpack.js",
5
+ "static/chunks/main-app.js",
6
+ "static/css/app/layout.css",
7
+ "static/chunks/app/layout.js"
8
+ ],
9
+ "/page": [
10
+ "static/chunks/webpack.js",
11
+ "static/chunks/main-app.js",
12
+ "static/css/app/page.css",
13
+ "static/chunks/app/page.js"
14
+ ],
15
+ "/misty-mountains/moria/page": [
16
+ "static/chunks/webpack.js",
17
+ "static/chunks/main-app.js",
18
+ "static/css/app/misty-mountains/moria/page.css",
19
+ "static/chunks/app/misty-mountains/moria/page.js"
20
+ ],
21
+ "/blog/[slug]/page": [
22
+ "static/chunks/webpack.js",
23
+ "static/chunks/main-app.js",
24
+ "static/css/app/blog/[slug]/page.css",
25
+ "static/chunks/app/blog/[slug]/page.js"
26
+ ]
27
+ }
28
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "polyfillFiles": [
3
+ "static/chunks/polyfills.js"
4
+ ],
5
+ "devFiles": [
6
+ "static/chunks/webpack.js",
7
+ "static/chunks/react-refresh.js"
8
+ ],
9
+ "ampDevFiles": [],
10
+ "lowPriorityFiles": [
11
+ "static/development/_buildManifest.js",
12
+ "static/development/_ssgManifest.js"
13
+ ],
14
+ "rootMainFiles": [
15
+ "static/chunks/webpack.js",
16
+ "static/chunks/main-app.js"
17
+ ],
18
+ "pages": {
19
+ "/_app": []
20
+ },
21
+ "ampFirstPages": []
22
+ }
@@ -0,0 +1 @@
1
+ {"type": "commonjs"}