edge-functions 1.0.0

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 (230) hide show
  1. package/.babelrc +13 -0
  2. package/.eslintignore +3 -0
  3. package/.eslintrc.json +42 -0
  4. package/.github/workflows/major.yml +28 -0
  5. package/.github/workflows/minor.yml +31 -0
  6. package/.vscode/settings.json +20 -0
  7. package/CODEOWNERS +2 -0
  8. package/CODE_OF_CONDUCT.md +73 -0
  9. package/CONTRIBUTING.md +90 -0
  10. package/LICENSE.md +21 -0
  11. package/README.md +60 -0
  12. package/aliases.js +13 -0
  13. package/docs/overview.md +36 -0
  14. package/docs/presets.md +115 -0
  15. package/examples/angular-static/.editorconfig +16 -0
  16. package/examples/angular-static/README.md +27 -0
  17. package/examples/angular-static/angular.json +98 -0
  18. package/examples/angular-static/package.json +39 -0
  19. package/examples/angular-static/src/app/app-routing.module.ts +10 -0
  20. package/examples/angular-static/src/app/app.component.css +0 -0
  21. package/examples/angular-static/src/app/app.component.html +484 -0
  22. package/examples/angular-static/src/app/app.component.spec.ts +29 -0
  23. package/examples/angular-static/src/app/app.component.ts +10 -0
  24. package/examples/angular-static/src/app/app.module.ts +18 -0
  25. package/examples/angular-static/src/assets/.gitkeep +0 -0
  26. package/examples/angular-static/src/favicon.ico +0 -0
  27. package/examples/angular-static/src/index.html +13 -0
  28. package/examples/angular-static/src/main.ts +7 -0
  29. package/examples/angular-static/src/styles.css +1 -0
  30. package/examples/angular-static/tsconfig.app.json +14 -0
  31. package/examples/angular-static/tsconfig.json +33 -0
  32. package/examples/angular-static/tsconfig.spec.json +14 -0
  33. package/examples/astro-static/README.md +55 -0
  34. package/examples/astro-static/astro.config.mjs +5 -0
  35. package/examples/astro-static/package.json +15 -0
  36. package/examples/astro-static/public/favicon.svg +9 -0
  37. package/examples/astro-static/src/components/Card.astro +63 -0
  38. package/examples/astro-static/src/env.d.ts +1 -0
  39. package/examples/astro-static/src/layouts/Layout.astro +36 -0
  40. package/examples/astro-static/src/pages/edge/index.astro +55 -0
  41. package/examples/astro-static/src/pages/index.astro +81 -0
  42. package/examples/astro-static/tsconfig.json +3 -0
  43. package/examples/hexo-static/.github/dependabot.yml +7 -0
  44. package/examples/hexo-static/_config.landscape.yml +0 -0
  45. package/examples/hexo-static/_config.yml +105 -0
  46. package/examples/hexo-static/package.json +26 -0
  47. package/examples/hexo-static/scaffolds/draft.md +4 -0
  48. package/examples/hexo-static/scaffolds/page.md +4 -0
  49. package/examples/hexo-static/scaffolds/post.md +5 -0
  50. package/examples/hexo-static/source/_posts/hello-world.md +38 -0
  51. package/examples/hexo-static/source/_posts/other-page.md +62 -0
  52. package/examples/hexo-static/themes/.gitkeep +0 -0
  53. package/examples/hexo-static/yarn.lock +1625 -0
  54. package/examples/next-12-static/.babelrc +3 -0
  55. package/examples/next-12-static/README.md +21 -0
  56. package/examples/next-12-static/components/post.jsx +27 -0
  57. package/examples/next-12-static/package-lock.json +6191 -0
  58. package/examples/next-12-static/package.json +18 -0
  59. package/examples/next-12-static/pages/index.jsx +34 -0
  60. package/examples/next-12-static/pages/post/[id].jsx +63 -0
  61. package/examples/next-static/README.md +34 -0
  62. package/examples/next-static/jsconfig.json +7 -0
  63. package/examples/next-static/next.config.js +9 -0
  64. package/examples/next-static/package.json +16 -0
  65. package/examples/next-static/public/next.svg +1 -0
  66. package/examples/next-static/public/vercel.svg +1 -0
  67. package/examples/next-static/src/app/blog/[slug]/page.js +27 -0
  68. package/examples/next-static/src/app/favicon.ico +0 -0
  69. package/examples/next-static/src/app/globals.css +107 -0
  70. package/examples/next-static/src/app/layout.js +17 -0
  71. package/examples/next-static/src/app/misty-mountains/moria/page.js +15 -0
  72. package/examples/next-static/src/app/page.js +96 -0
  73. package/examples/next-static/src/app/page.module.css +229 -0
  74. package/examples/next-static/yarn.lock +199 -0
  75. package/examples/react-static/README.md +70 -0
  76. package/examples/react-static/package.json +38 -0
  77. package/examples/react-static/public/favicon.ico +0 -0
  78. package/examples/react-static/public/index.html +43 -0
  79. package/examples/react-static/public/logo192.png +0 -0
  80. package/examples/react-static/public/logo512.png +0 -0
  81. package/examples/react-static/public/manifest.json +25 -0
  82. package/examples/react-static/public/robots.txt +3 -0
  83. package/examples/react-static/src/App.css +38 -0
  84. package/examples/react-static/src/App.js +25 -0
  85. package/examples/react-static/src/App.test.js +8 -0
  86. package/examples/react-static/src/index.css +13 -0
  87. package/examples/react-static/src/index.js +17 -0
  88. package/examples/react-static/src/logo.svg +1 -0
  89. package/examples/react-static/src/reportWebVitals.js +13 -0
  90. package/examples/react-static/src/setupTests.js +5 -0
  91. package/examples/simple-js-esm/main.js +14 -0
  92. package/examples/simple-js-esm/messages.js +7 -0
  93. package/examples/simple-js-node/main.js +18 -0
  94. package/examples/vue-static/README.md +24 -0
  95. package/examples/vue-static/babel.config.js +5 -0
  96. package/examples/vue-static/jsconfig.json +19 -0
  97. package/examples/vue-static/package.json +45 -0
  98. package/examples/vue-static/public/favicon.ico +0 -0
  99. package/examples/vue-static/public/index.html +17 -0
  100. package/examples/vue-static/src/App.vue +16 -0
  101. package/examples/vue-static/src/assets/logo.png +0 -0
  102. package/examples/vue-static/src/components/HelloWorld.vue +58 -0
  103. package/examples/vue-static/src/main.js +28 -0
  104. package/examples/vue-static/src/views/Home.vue +14 -0
  105. package/examples/vue-static/vue.config.js +4 -0
  106. package/jest.config.js +6 -0
  107. package/jsconfig.json +40 -0
  108. package/jsdoc.json +52 -0
  109. package/lib/build/bundlers/index.js +4 -0
  110. package/lib/build/bundlers/webpack/index.js +40 -0
  111. package/lib/build/bundlers/webpack/webpack.config.js +38 -0
  112. package/lib/build/dispatcher/dispatcher.js +211 -0
  113. package/lib/build/dispatcher/dispatcher.test.js +0 -0
  114. package/lib/build/dispatcher/index.js +3 -0
  115. package/lib/build/polyfills/index.js +0 -0
  116. package/lib/constants/azion-edges.constants.js +98 -0
  117. package/lib/constants/index.js +5 -0
  118. package/lib/constants/messages/build.messages.js +23 -0
  119. package/lib/constants/messages/env.messages.js +38 -0
  120. package/lib/constants/messages/global.messages.js +19 -0
  121. package/lib/constants/messages/index.js +10 -0
  122. package/lib/constants/messages/platform.messages.js +84 -0
  123. package/lib/constants/runtime-apis.constants.js +118 -0
  124. package/lib/env/index.js +5 -0
  125. package/lib/env/runtime.env.js +69 -0
  126. package/lib/env/server.env.js +90 -0
  127. package/lib/env/vulcan.env.js +93 -0
  128. package/lib/main.js +260 -0
  129. package/lib/notations/namespaces.js +30 -0
  130. package/lib/notations/typedef.js +10 -0
  131. package/lib/platform/actions/application/createApplication.actions.js +33 -0
  132. package/lib/platform/actions/application/enableEdgeFunctions.actions.js +34 -0
  133. package/lib/platform/actions/application/instantiateFunction.actions.js +37 -0
  134. package/lib/platform/actions/application/setFunctionAsDefaultRule.actions.js +33 -0
  135. package/lib/platform/actions/core/auth.actions.js +67 -0
  136. package/lib/platform/actions/core/deploy.actions.js +73 -0
  137. package/lib/platform/actions/core/propagation.actions.js +75 -0
  138. package/lib/platform/actions/core/storage.actions.js +84 -0
  139. package/lib/platform/actions/domain/createDomain.actions.js +42 -0
  140. package/lib/platform/actions/function/createFunction.actions.js +79 -0
  141. package/lib/platform/actions/function/showFunctionLogs.actions.js +149 -0
  142. package/lib/platform/edgehooks/ErrorHTML/ErrorHTML.hooks.js +101 -0
  143. package/lib/platform/edgehooks/ErrorHTML/index.js +3 -0
  144. package/lib/platform/edgehooks/index.js +5 -0
  145. package/lib/platform/edgehooks/mountSPA/index.js +3 -0
  146. package/lib/platform/edgehooks/mountSPA/mountSPA.hooks.js +55 -0
  147. package/lib/platform/edgehooks/mountSPA/mountSPA.hooks.test.js +19 -0
  148. package/lib/platform/edgehooks/mountSSG/index.js +3 -0
  149. package/lib/platform/edgehooks/mountSSG/mountSSG.hooks.js +61 -0
  150. package/lib/platform/edgehooks/mountSSG/mountSSG.hooks.test.js +0 -0
  151. package/lib/platform/index.js +65 -0
  152. package/lib/platform/services/application.service.js +140 -0
  153. package/lib/platform/services/base.service.js +200 -0
  154. package/lib/platform/services/domain.service.js +80 -0
  155. package/lib/platform/services/events.service.js +65 -0
  156. package/lib/platform/services/function.service.js +105 -0
  157. package/lib/platform/services/index.js +8 -0
  158. package/lib/platform/services/storage.service.js +59 -0
  159. package/lib/platform/services/tokens.service.js +55 -0
  160. package/lib/presets/custom/angular/deliver/config.js +12 -0
  161. package/lib/presets/custom/angular/deliver/handler.js +8 -0
  162. package/lib/presets/custom/angular/deliver/prebuild.js +20 -0
  163. package/lib/presets/custom/astro/deliver/config.js +12 -0
  164. package/lib/presets/custom/astro/deliver/handler.js +8 -0
  165. package/lib/presets/custom/astro/deliver/prebuild.js +37 -0
  166. package/lib/presets/custom/hexo/deliver/config.js +12 -0
  167. package/lib/presets/custom/hexo/deliver/handler.js +8 -0
  168. package/lib/presets/custom/hexo/deliver/prebuild.js +37 -0
  169. package/lib/presets/custom/next/deliver/config.js +14 -0
  170. package/lib/presets/custom/next/deliver/handler.js +9 -0
  171. package/lib/presets/custom/next/deliver/prebuild.js +193 -0
  172. package/lib/presets/custom/react/deliver/config.js +12 -0
  173. package/lib/presets/custom/react/deliver/handler.js +8 -0
  174. package/lib/presets/custom/react/deliver/prebuild.js +16 -0
  175. package/lib/presets/custom/vue/deliver/config.js +12 -0
  176. package/lib/presets/custom/vue/deliver/handler.js +8 -0
  177. package/lib/presets/custom/vue/deliver/prebuild.js +20 -0
  178. package/lib/presets/default/html/deliver/config.js +13 -0
  179. package/lib/presets/default/html/deliver/handler.js +9 -0
  180. package/lib/presets/default/html/deliver/prebuild.js +15 -0
  181. package/lib/presets/default/javascript/compute/config.js +13 -0
  182. package/lib/presets/default/javascript/compute/handler.js +5 -0
  183. package/lib/presets/default/javascript/compute/prebuild.js +6 -0
  184. package/lib/presets/default/typescript/compute/config.js +0 -0
  185. package/lib/presets/default/typescript/compute/handler.js +0 -0
  186. package/lib/presets/default/typescript/compute/prebuild.js +0 -0
  187. package/lib/providers/azion/worker.js +12 -0
  188. package/lib/utils/copyDirectory/copyDirectory.utils.js +54 -0
  189. package/lib/utils/copyDirectory/copyDirectory.utils.test.js +43 -0
  190. package/lib/utils/copyDirectory/index.js +3 -0
  191. package/lib/utils/debug/debug.utils.js +36 -0
  192. package/lib/utils/debug/debug.utils.test.js +43 -0
  193. package/lib/utils/debug/index.js +3 -0
  194. package/lib/utils/exec/exec.utils.js +58 -0
  195. package/lib/utils/exec/exec.utils.test.js +84 -0
  196. package/lib/utils/exec/index.js +3 -0
  197. package/lib/utils/feedback/feedback.utils.js +81 -0
  198. package/lib/utils/feedback/feedback.utils.test.js +11 -0
  199. package/lib/utils/feedback/index.js +3 -0
  200. package/lib/utils/generateTimestamp/generateTimestamp.utils.js +25 -0
  201. package/lib/utils/generateTimestamp/generateTimestamp.utils.test.js +10 -0
  202. package/lib/utils/generateTimestamp/index.js +3 -0
  203. package/lib/utils/getAbsoluteLibDirPath/getAbsoluteLibDirPath.utils.js +21 -0
  204. package/lib/utils/getAbsoluteLibDirPath/getAbsoluteLibDirPath.utils.test.js +13 -0
  205. package/lib/utils/getAbsoluteLibDirPath/index.js +3 -0
  206. package/lib/utils/getPackageManager/getPackageManager.utils.js +118 -0
  207. package/lib/utils/getPackageManager/getPackageManager.utils.test.js +35 -0
  208. package/lib/utils/getPackageManager/index.js +3 -0
  209. package/lib/utils/getPackageVersion/getPackageVersion.utils.js +25 -0
  210. package/lib/utils/getPackageVersion/getPackageVersion.utils.test.js +48 -0
  211. package/lib/utils/getPackageVersion/index.js +3 -0
  212. package/lib/utils/getPresetsList/getPresetsList.utils.js +50 -0
  213. package/lib/utils/getPresetsList/getPresetsList.utils.test.js +19 -0
  214. package/lib/utils/getPresetsList/index.js +3 -0
  215. package/lib/utils/getProjectJsonFile/getProjectJsonFile.utils.js +21 -0
  216. package/lib/utils/getProjectJsonFile/getProjectJsonFile.utils.test.js +39 -0
  217. package/lib/utils/getProjectJsonFile/index.js +3 -0
  218. package/lib/utils/getVulcanBuildId/getVulcanBuildId.utils.js +49 -0
  219. package/lib/utils/getVulcanBuildId/getVulcanBuildId.utils.test.js +36 -0
  220. package/lib/utils/getVulcanBuildId/index.js +3 -0
  221. package/lib/utils/index.js +29 -0
  222. package/lib/utils/overrideStaticOutputPath/index.js +3 -0
  223. package/lib/utils/overrideStaticOutputPath/overrideStaticOutputPath.utils.js +47 -0
  224. package/lib/utils/overrideStaticOutputPath/overrideStaticOutputPath.utils.test.js +35 -0
  225. package/lib/utils/readWorkerFile/index.js +3 -0
  226. package/lib/utils/readWorkerFile/readWorkerFile.utils.js +36 -0
  227. package/lib/utils/readWorkerFile/readWorkerFile.utils.test.js +24 -0
  228. package/package.json +99 -0
  229. package/releaserc.json +87 -0
  230. package/tasks/sync-aliases.js +115 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ "presets": ["next/babel"]
3
+ }
@@ -0,0 +1,21 @@
1
+ # Static export example
2
+
3
+ This example show how to export to static HTML files your Next.js application fetching data from an API to generate a dynamic list of pages.
4
+
5
+ When trying to run `npm start` it will build and export your pages into the `out` folder and serve them on `localhost:5000`.
6
+
7
+ ## Preview
8
+
9
+ Preview the example live on [StackBlitz](http://stackblitz.com/):
10
+
11
+ [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/with-static-export)
12
+
13
+ ## How to use
14
+
15
+ Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
16
+
17
+ ```bash
18
+ npx create-next-app --example with-static-export with-static-export-app
19
+ # or
20
+ yarn create next-app --example with-static-export with-static-export-app
21
+ ```
@@ -0,0 +1,27 @@
1
+ import Link from 'next/link';
2
+ import React, { useState } from 'react';
3
+
4
+ function Example() {
5
+ // Declare a new state variable, which we'll call "count"
6
+ const [count, setCount] = useState(0);
7
+
8
+ return (
9
+ <div>
10
+ <p>You clicked {count} times</p>
11
+ <button onClick={() => setCount(count + 1)}>Click me</button>
12
+ </div>
13
+ );
14
+ }
15
+
16
+ export default function Post({ title, body, id }) {
17
+ return (
18
+ <article>
19
+ <h2>{title}</h2>
20
+ <p>{body}</p>
21
+ <Link href={`/post/${id}`}>
22
+ <a>Read more...</a>
23
+ </Link>
24
+ <Example />
25
+ </article>
26
+ );
27
+ }