edge-functions 3.2.1 → 3.3.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 (192) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +46 -48
  3. package/aliases.js +0 -1
  4. package/lib/build/bundlers/base.bundlers.js +2 -17
  5. package/lib/build/bundlers/esbuild/esbuild.bundlers.js +6 -7
  6. package/lib/build/bundlers/esbuild/esbuild.bundlers.test.js +6 -12
  7. package/lib/build/bundlers/polyfills/polyfills-manager.js +7 -1
  8. package/lib/build/bundlers/polyfills/polyfills-manager.test.js +1 -0
  9. package/lib/build/bundlers/webpack/webpack.bundlers.js +7 -8
  10. package/lib/build/bundlers/webpack/webpack.bundlers.test.js +6 -12
  11. package/lib/build/dispatcher/dispatcher.js +53 -128
  12. package/lib/build/dispatcher/dispatcher.test.js +5 -6
  13. package/lib/build/dispatcher/helpers/helpers.js +0 -62
  14. package/lib/commands/build.commands.js +28 -44
  15. package/lib/commands/init.commands.js +6 -8
  16. package/lib/commands/presets.commands.js +6 -28
  17. package/lib/constants/index.js +1 -2
  18. package/lib/constants/messages/build.messages.js +7 -7
  19. package/lib/env/env.test.js +138 -105
  20. package/lib/env/polyfills/azion/storage/context/storage.context.js +1 -1
  21. package/lib/env/server.env.js +4 -4
  22. package/lib/env/vulcan.env.js +153 -27
  23. package/lib/main.js +54 -17
  24. package/lib/presets/{eleventy/deliver → angular}/config.js +1 -1
  25. package/lib/presets/{vue/deliver → angular}/handler.js +3 -3
  26. package/lib/presets/angular/{deliver/prebuild.js → prebuild.js} +1 -15
  27. package/lib/presets/{docusaurus/deliver → astro}/config.js +1 -1
  28. package/lib/presets/astro/handler.js +17 -0
  29. package/lib/presets/{angular/deliver → docusaurus}/config.js +1 -1
  30. package/lib/presets/docusaurus/handler.js +17 -0
  31. package/lib/presets/{astro/deliver → eleventy}/config.js +1 -1
  32. package/lib/presets/eleventy/handler.js +17 -0
  33. package/lib/presets/emscripten/{compute/config.js → config.js} +1 -1
  34. package/lib/presets/emscripten/{compute/handler.js → handler.js} +2 -2
  35. package/lib/presets/emscripten/{compute/prebuild.js → prebuild.js} +1 -1
  36. package/lib/presets/gatsby/config.js +10 -0
  37. package/lib/presets/gatsby/handler.js +17 -0
  38. package/lib/presets/hexo/config.js +10 -0
  39. package/lib/presets/hexo/handler.js +17 -0
  40. package/lib/presets/html/config.js +10 -0
  41. package/lib/presets/html/handler.js +17 -0
  42. package/lib/presets/hugo/config.js +10 -0
  43. package/lib/presets/hugo/handler.js +17 -0
  44. package/lib/presets/javascript/{compute/config.js → config.js} +1 -1
  45. package/lib/presets/javascript/{compute/handler.js → handler.js} +2 -3
  46. package/lib/presets/jekyll/config.js +10 -0
  47. package/lib/presets/jekyll/handler.js +17 -0
  48. package/lib/presets/next/{compute/config.js → config.js} +1 -1
  49. package/lib/presets/next/{compute/default → default}/prebuild/index.js +2 -2
  50. package/lib/presets/next/{compute/default → default}/prebuild/mapping/index.js +2 -2
  51. package/lib/presets/next/{compute/handler.js → handler.js} +13 -5
  52. package/lib/presets/next/{compute/node → node}/custom-server/12.3.x/server/config.js +1 -1
  53. package/lib/presets/next/{compute/node → node}/handler/index.js +2 -2
  54. package/lib/presets/next/{compute/node → node}/prebuild/index.js +0 -1
  55. package/lib/presets/next/{compute/prebuild.js → prebuild.js} +20 -1
  56. package/lib/presets/next/static/handler.js +17 -0
  57. package/lib/presets/next/{deliver → static}/prebuild.js +6 -0
  58. package/lib/presets/react/config.js +10 -0
  59. package/lib/presets/{angular/deliver → react}/handler.js +3 -4
  60. package/lib/presets/rustwasm/{compute/config.js → config.js} +1 -1
  61. package/lib/presets/rustwasm/{compute/handler.js → handler.js} +1 -1
  62. package/lib/presets/svelte/config.js +10 -0
  63. package/lib/presets/svelte/handler.js +17 -0
  64. package/lib/presets/typescript/{compute/config.js → config.js} +1 -1
  65. package/lib/presets/typescript/{compute/handler.js → handler.js} +1 -2
  66. package/lib/presets/vitepress/config.js +10 -0
  67. package/lib/presets/vitepress/handler.js +17 -0
  68. package/lib/presets/vue/config.js +10 -0
  69. package/lib/presets/{react/deliver → vue}/handler.js +4 -4
  70. package/lib/utils/exec/exec.utils.js +2 -2
  71. package/lib/utils/feedback/feedback.utils.js +17 -13
  72. package/lib/utils/generateManifest/generateManifest.utils.js +3 -61
  73. package/lib/utils/presets/presets.utils.js +8 -30
  74. package/lib/utils/presets/presets.utils.test.js +9 -83
  75. package/package.json +7 -7
  76. package/lib/constants/azion-edges.constants.js +0 -98
  77. package/lib/env/edgehooks/ErrorHTML/ErrorHTML.hooks.js +0 -104
  78. package/lib/env/edgehooks/ErrorHTML/index.js +0 -3
  79. package/lib/env/edgehooks/debugRequest/debugRequest.hooks.js +0 -28
  80. package/lib/env/edgehooks/debugRequest/index.js +0 -3
  81. package/lib/env/edgehooks/index.js +0 -6
  82. package/lib/env/edgehooks/mountSPA/index.js +0 -3
  83. package/lib/env/edgehooks/mountSPA/mountSPA.hooks.js +0 -56
  84. package/lib/env/edgehooks/mountSPA/mountSPA.hooks.test.js +0 -36
  85. package/lib/env/edgehooks/mountSSG/index.js +0 -3
  86. package/lib/env/edgehooks/mountSSG/mountSSG.hooks.js +0 -64
  87. package/lib/env/edgehooks/mountSSG/mountSSG.hooks.test.js +0 -36
  88. package/lib/presets/astro/deliver/handler.js +0 -16
  89. package/lib/presets/docusaurus/deliver/handler.js +0 -16
  90. package/lib/presets/eleventy/deliver/handler.js +0 -16
  91. package/lib/presets/gatsby/deliver/config.js +0 -10
  92. package/lib/presets/gatsby/deliver/handler.js +0 -16
  93. package/lib/presets/hexo/deliver/config.js +0 -10
  94. package/lib/presets/hexo/deliver/handler.js +0 -16
  95. package/lib/presets/html/deliver/config.js +0 -10
  96. package/lib/presets/html/deliver/handler.js +0 -17
  97. package/lib/presets/hugo/deliver/config.js +0 -10
  98. package/lib/presets/hugo/deliver/handler.js +0 -16
  99. package/lib/presets/jekyll/deliver/config.js +0 -10
  100. package/lib/presets/jekyll/deliver/handler.js +0 -16
  101. package/lib/presets/next/deliver/config.js +0 -10
  102. package/lib/presets/next/deliver/handler.js +0 -17
  103. package/lib/presets/react/deliver/config.js +0 -10
  104. package/lib/presets/svelte/deliver/config.js +0 -10
  105. package/lib/presets/svelte/deliver/handler.js +0 -16
  106. package/lib/presets/vitepress/deliver/azion.config.js +0 -50
  107. package/lib/presets/vitepress/deliver/config.js +0 -10
  108. package/lib/presets/vitepress/deliver/handler.js +0 -16
  109. package/lib/presets/vue/deliver/config.js +0 -10
  110. package/lib/utils/generateManifest/generateManifest.utils.test.js +0 -2225
  111. package/lib/utils/generateManifest/helpers/azion.config.example.js +0 -322
  112. package/lib/utils/generateManifest/helpers/behaviors.js +0 -216
  113. package/lib/utils/generateManifest/helpers/convertLegacyConfig.js +0 -72
  114. package/lib/utils/generateManifest/helpers/schema.js +0 -863
  115. package/lib/utils/generateManifest/strategy/implementations/cacheManifestStrategy.js +0 -90
  116. package/lib/utils/generateManifest/strategy/implementations/domainManifestStrategy.js +0 -64
  117. package/lib/utils/generateManifest/strategy/implementations/originManifestStrategy.js +0 -97
  118. package/lib/utils/generateManifest/strategy/implementations/purgeManifestStrategy.js +0 -53
  119. package/lib/utils/generateManifest/strategy/implementations/rulesManifestStrategy.js +0 -106
  120. package/lib/utils/generateManifest/strategy/manifestContext.js +0 -35
  121. package/lib/utils/generateManifest/strategy/manifestStrategy.js +0 -20
  122. /package/lib/presets/angular/{deliver/azion.config.js → azion.config.js} +0 -0
  123. /package/lib/presets/astro/{deliver/azion.config.js → azion.config.js} +0 -0
  124. /package/lib/presets/astro/{deliver/prebuild.js → prebuild.js} +0 -0
  125. /package/lib/presets/docusaurus/{deliver/azion.config.js → azion.config.js} +0 -0
  126. /package/lib/presets/docusaurus/{deliver/prebuild.js → prebuild.js} +0 -0
  127. /package/lib/presets/eleventy/{deliver/azion.config.js → azion.config.js} +0 -0
  128. /package/lib/presets/eleventy/{deliver/prebuild.js → prebuild.js} +0 -0
  129. /package/lib/presets/emscripten/{compute/azion.config.js → azion.config.js} +0 -0
  130. /package/lib/presets/gatsby/{deliver/azion.config.js → azion.config.js} +0 -0
  131. /package/lib/presets/gatsby/{deliver/prebuild.js → prebuild.js} +0 -0
  132. /package/lib/presets/hexo/{deliver/azion.config.js → azion.config.js} +0 -0
  133. /package/lib/presets/hexo/{deliver/prebuild.js → prebuild.js} +0 -0
  134. /package/lib/presets/html/{deliver/azion.config.js → azion.config.js} +0 -0
  135. /package/lib/presets/html/{deliver/prebuild.js → prebuild.js} +0 -0
  136. /package/lib/presets/hugo/{deliver/azion.config.js → azion.config.js} +0 -0
  137. /package/lib/presets/hugo/{deliver/prebuild.js → prebuild.js} +0 -0
  138. /package/lib/presets/javascript/{compute/azion.config.js → azion.config.js} +0 -0
  139. /package/lib/presets/javascript/{compute/prebuild.js → prebuild.js} +0 -0
  140. /package/lib/presets/jekyll/{deliver/azion.config.js → azion.config.js} +0 -0
  141. /package/lib/presets/jekyll/{deliver/prebuild.js → prebuild.js} +0 -0
  142. /package/lib/presets/next/{compute/azion.config.js → azion.config.js} +0 -0
  143. /package/lib/presets/next/{compute/default → default}/handler/async-local-storage.js +0 -0
  144. /package/lib/presets/next/{compute/default → default}/handler/images.js +0 -0
  145. /package/lib/presets/next/{compute/default → default}/handler/routing/http.js +0 -0
  146. /package/lib/presets/next/{compute/default → default}/handler/routing/http.test.js +0 -0
  147. /package/lib/presets/next/{compute/default → default}/handler/routing/index.js +0 -0
  148. /package/lib/presets/next/{compute/default → default}/handler/routing/libs.js +0 -0
  149. /package/lib/presets/next/{compute/default → default}/handler/routing/matcher.js +0 -0
  150. /package/lib/presets/next/{compute/default → default}/handler/routing/matcher.test.js +0 -0
  151. /package/lib/presets/next/{compute/default → default}/handler/routing/pcre.js +0 -0
  152. /package/lib/presets/next/{compute/default → default}/handler/routing/pcre.test.js +0 -0
  153. /package/lib/presets/next/{compute/default → default}/handler/routing/routes-matcher.js +0 -0
  154. /package/lib/presets/next/{compute/default → default}/handler/routing/utils.js +0 -0
  155. /package/lib/presets/next/{compute/default → default}/handler/routing/utils.test.js +0 -0
  156. /package/lib/presets/next/{compute/default → default}/prebuild/edge/index.js +0 -0
  157. /package/lib/presets/next/{compute/default → default}/prebuild/mapping/assets.js +0 -0
  158. /package/lib/presets/next/{compute/default → default}/prebuild/mapping/assets.test.js +0 -0
  159. /package/lib/presets/next/{compute/default → default}/prebuild/mapping/index.test.js +0 -0
  160. /package/lib/presets/next/{compute/default → default}/prebuild/mapping/process-mapping.js +0 -0
  161. /package/lib/presets/next/{compute/default → default}/prebuild/mapping/process-mapping.test.js +0 -0
  162. /package/lib/presets/next/{compute/default → default}/prebuild/prerendered/index.js +0 -0
  163. /package/lib/presets/next/{compute/default → default}/prebuild/validation/support.js +0 -0
  164. /package/lib/presets/next/{compute/default → default}/prebuild/validation/support.test.js +0 -0
  165. /package/lib/presets/next/{compute/default → default}/prebuild/validation/supported-versions.js +0 -0
  166. /package/lib/presets/next/{compute/node → node}/custom-server/12.3.x/index.js +0 -0
  167. /package/lib/presets/next/{compute/node → node}/custom-server/12.3.x/server/base-http/compute-js.js +0 -0
  168. /package/lib/presets/next/{compute/node → node}/custom-server/12.3.x/server/compute-js.js +0 -0
  169. /package/lib/presets/next/{compute/node → node}/custom-server/12.3.x/server/load-components.js +0 -0
  170. /package/lib/presets/next/{compute/node → node}/custom-server/12.3.x/server/next-compute-js-server.js +0 -0
  171. /package/lib/presets/next/{compute/node → node}/custom-server/12.3.x/server/next.js +0 -0
  172. /package/lib/presets/next/{compute/node → node}/custom-server/12.3.x/server/require.js +0 -0
  173. /package/lib/presets/next/{compute/node → node}/custom-server/12.3.x/server/response-cache/index.js +0 -0
  174. /package/lib/presets/next/{compute/node → node}/custom-server/12.3.x/server/serve-static.js +0 -0
  175. /package/lib/presets/next/{compute/node → node}/custom-server/12.3.x/util/etag.js +0 -0
  176. /package/lib/presets/next/{compute/node → node}/prebuild/statics/index.js +0 -0
  177. /package/lib/presets/next/{compute/postbuild.js → postbuild.js} +0 -0
  178. /package/lib/presets/next/{compute/utils → utils}/fs.js +0 -0
  179. /package/lib/presets/next/{compute/utils → utils}/next.js +0 -0
  180. /package/lib/presets/next/{compute/utils → utils}/routing.js +0 -0
  181. /package/lib/presets/react/{deliver/azion.config.js → azion.config.js} +0 -0
  182. /package/lib/presets/react/{deliver/prebuild.js → prebuild.js} +0 -0
  183. /package/lib/presets/rustwasm/{compute/azion.config.js → azion.config.js} +0 -0
  184. /package/lib/presets/rustwasm/{compute/prebuild.js → prebuild.js} +0 -0
  185. /package/lib/presets/svelte/{deliver/azion.config.js → azion.config.js} +0 -0
  186. /package/lib/presets/svelte/{deliver/prebuild.js → prebuild.js} +0 -0
  187. /package/lib/presets/typescript/{compute/azion.config.js → azion.config.js} +0 -0
  188. /package/lib/presets/typescript/{compute/prebuild.js → prebuild.js} +0 -0
  189. /package/lib/presets/{next/deliver → vitepress}/azion.config.js +0 -0
  190. /package/lib/presets/vitepress/{deliver/prebuild.js → prebuild.js} +0 -0
  191. /package/lib/presets/vue/{deliver/azion.config.js → azion.config.js} +0 -0
  192. /package/lib/presets/vue/{deliver/prebuild.js → prebuild.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,39 @@
1
+ ## [3.3.0](https://github.com/aziontech/bundler/compare/v3.2.1...v3.3.0) (2024-09-18)
2
+
3
+
4
+ ### Features
5
+
6
+ * useNodePolyfills true ([69ffa0f](https://github.com/aziontech/bundler/commit/69ffa0f56cc4935aac37faa6e7485f532c4fbce8))
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * config module empty ([30c9c66](https://github.com/aziontech/bundler/commit/30c9c665edb552c3a9d5e12391801a49f91f4b5c))
12
+ * ignore node_modules changes ([6c6b6dd](https://github.com/aziontech/bundler/commit/6c6b6ddf317b821b5f48322119d7d9790ee889a1))
13
+ * inserting the import azion/utils into the polyfills manager ([10f7d3f](https://github.com/aziontech/bundler/commit/10f7d3f38caa16ae2f11f9f4f2326e325c57056c))
14
+ * local env dev server ([a5f9da4](https://github.com/aziontech/bundler/commit/a5f9da4f62beb68d5e12fa92fca788c2e45b2ef6))
15
+ * pnpm changes ([d951cc9](https://github.com/aziontech/bundler/commit/d951cc9c1b5a1b32d4d566c59e50deca0b8b9162))
16
+ * startwith local server ([e6fcc01](https://github.com/aziontech/bundler/commit/e6fcc01dafcbeb7392a201f0ad330e74cef1faad))
17
+ * temp file sufix ([5013387](https://github.com/aziontech/bundler/commit/5013387ee7c9b1bad11e8ee17a992f5b6515fb63))
18
+
19
+ ## [3.3.0-stage.1](https://github.com/aziontech/vulcan/compare/v3.2.1...v3.3.0-stage.1) (2024-09-17)
20
+
21
+
22
+ ### Features
23
+
24
+ * useNodePolyfills true ([69ffa0f](https://github.com/aziontech/vulcan/commit/69ffa0f56cc4935aac37faa6e7485f532c4fbce8))
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * config module empty ([30c9c66](https://github.com/aziontech/vulcan/commit/30c9c665edb552c3a9d5e12391801a49f91f4b5c))
30
+ * ignore node_modules changes ([6c6b6dd](https://github.com/aziontech/vulcan/commit/6c6b6ddf317b821b5f48322119d7d9790ee889a1))
31
+ * inserting the import azion/utils into the polyfills manager ([10f7d3f](https://github.com/aziontech/vulcan/commit/10f7d3f38caa16ae2f11f9f4f2326e325c57056c))
32
+ * local env dev server ([a5f9da4](https://github.com/aziontech/vulcan/commit/a5f9da4f62beb68d5e12fa92fca788c2e45b2ef6))
33
+ * pnpm changes ([d951cc9](https://github.com/aziontech/vulcan/commit/d951cc9c1b5a1b32d4d566c59e50deca0b8b9162))
34
+ * startwith local server ([e6fcc01](https://github.com/aziontech/vulcan/commit/e6fcc01dafcbeb7392a201f0ad330e74cef1faad))
35
+ * temp file sufix ([5013387](https://github.com/aziontech/vulcan/commit/5013387ee7c9b1bad11e8ee17a992f5b6515fb63))
36
+
1
37
  ### [3.2.1](https://github.com/aziontech/vulcan/compare/v3.2.0...v3.2.1) (2024-08-20)
2
38
 
3
39
 
package/README.md CHANGED
@@ -1,16 +1,15 @@
1
- # Vulcan - Forging The Edge
1
+ # Azion Bundler - Building Applications for Azion Runtime
2
2
 
3
- ![vulcan](https://github.com/aziontech/vulcan/assets/12740219/a5043e6f-11cb-4498-a300-5bdb617a9989)
3
+ Azion Bundler is a powerful tool designed to streamline the development and deployment of JavaScript applications and frameworks. This powerful utility automates polyfills for Azion Runtime, significantly simplifying the process of creating Workers.
4
4
 
5
- Vulcan is a powerful tool designed to streamline the development and deployment of JavaScript applications and frameworks. This powerful utility automates polyfills for Edge Computing, significantly simplifying the process of creating Workers, particularly for the Azion platform.
6
-
7
- One of the key highlights of Vulcan is its ability to establish an intuitive and efficient protocol for facilitating the creation of presets. This makes customization and adaptation to specific project needs even more accessible, providing developers with the necessary flexibility to optimize their applications effectively and efficiently.
5
+ One of the key highlights of Azion Bundler is its ability to establish an intuitive and efficient protocol for facilitating the creation of presets. This makes customization and adaptation to specific project needs even more accessible, providing developers with the necessary flexibility to optimize their applications effectively and efficiently.
8
6
 
9
7
  ## Supported
10
8
 
11
9
  E2E tests run daily in the [Vulcan Examples](https://github.com/aziontech/vulcan-examples/tree/main/examples) to ensure that the presets and frameworks continue to work correctly.
12
10
 
13
11
  Table:
12
+
14
13
  | Test | Status |
15
14
  | ------------------------------------ | ------ |
16
15
  | Next 13 5 6 I18n | ✅ |
@@ -44,9 +43,10 @@ Table:
44
43
  | Simple Ts Esm | ✅ |
45
44
 
46
45
  Last test run date: 08/01/24 03:39:54 AM
46
+
47
47
  ## Quick Installation
48
48
 
49
- For those who just want to use Vulcan in their project without contributing to the development, you can install it directly from npm.
49
+ For those who just want to use Azion Bundler in their project without contributing to the development, you can install it directly from npm.
50
50
 
51
51
  ```shell
52
52
  npm install edge-functions
@@ -60,70 +60,70 @@ yarn add edge-functions
60
60
 
61
61
  ## Getting Started for Development
62
62
 
63
- Follow these steps to start using Vulcan:
63
+ Follow these steps to start using Azion Bundler:
64
64
 
65
- 1. Clone the repository: Clone the Vulcan repository from GitHub to your local machine.
65
+ 1. Clone the repository: Clone the Azion Bundler repository from GitHub to your local machine.
66
66
 
67
67
  ```shell
68
- git clone https://github.com/aziontech/vulcan.git
68
+ git clone https://github.com/aziontech/bundler.git
69
69
  ```
70
70
 
71
- 2. Installation: Navigate to the cloned Vulcan directory and install the required dependencies.
71
+ 2. Installation: Navigate to the cloned Azion Bundler directory and install the required dependencies.
72
72
 
73
73
  ```shell
74
- cd vulcan
75
- npm install
74
+ cd bundler
75
+ npm yarn install
76
76
  ```
77
77
 
78
- 3. Install the Vulcan CLI globally, which allows you to use it as a command-line tool from anywhere in your system.
78
+ 3. Install the Azion Bundler CLI globally, which allows you to use it as a command-line tool from anywhere in your system.
79
79
 
80
80
  ```shell
81
81
  npm install -g
82
82
  ```
83
83
 
84
- This command sets up the necessary project structure and configuration files for Vulcan.
84
+ This command sets up the necessary project structure and configuration files for Azion Bundler.
85
85
 
86
- 4. Start developing: Once the project is set up, you can start developing your JavaScript applications or frameworks using the power of Vulcan. Leverage the automated polyfills, Worker creation assistance, and other features provided by Vulcan to enhance your development workflow.
86
+ 4. Start developing: Once the project is set up, you can start developing your JavaScript applications or frameworks using the power of Bundler. Leverage the automated polyfills, Worker creation assistance, and other features provided by Bundler to enhance your development workflow.
87
87
 
88
- ## Using Vulcan
88
+ ## Using Azion Bundler
89
89
 
90
90
  See some examples below:
91
91
 
92
92
  - Build a JavaScript/Node project (back-end)
93
93
 
94
94
  ```shell
95
- vulcan build
95
+ azbundler build
96
96
  ```
97
97
 
98
98
  - Build a TypeScript/Node (back-end)
99
99
 
100
100
  ```shell
101
- vulcan build --preset typescript
101
+ azbundler build --preset typescript
102
102
  ```
103
103
 
104
- - Build a Static Next.js project
104
+ - Build a Next.js project
105
105
 
106
106
  ```shell
107
- vulcan build --preset next --mode deliver
107
+ azbundler build --preset next
108
108
  ```
109
109
 
110
- - Build a Static Astro.js project
110
+ - Build Astro.js project
111
111
 
112
112
  ```shell
113
- vulcan build --preset astro --mode deliver
113
+ azbundler build --preset astro
114
114
  ```
115
115
 
116
116
  - Test your project locally (after build)
117
117
 
118
118
  ```shell
119
- vulcan dev
119
+ azbundler dev
120
120
  ```
121
121
 
122
- ## Vulcan.config.js
122
+ ## Azion.config.js
123
123
 
124
- The `vulcan.config.js` file offers a robust configuration system for Vulcan. This file is not mandatory but acts as an override mechanism. If you define properties in this file, they will supersede the preset configurations. Properties not defined will rely on the preset.
124
+ The `azion.config.js` file offers a robust configuration system for Bundler. This file is not mandatory but acts as an override mechanism. If you define properties in this file, they will supersede the preset configurations. Properties not defined will rely on the preset.
125
125
 
126
- Here's a detailed breakdown of the configuration properties available in `vulcan.config.js`:
126
+ Here's a detailed breakdown of the configuration properties available in `azion.config.js`:
127
127
 
128
128
  ### Entry
129
129
 
@@ -141,19 +141,19 @@ This represents the primary entry point for your application, where the building
141
141
  **Description:**
142
142
  Defines which build tool to use. The available options are `esbuild` and `webpack`.
143
143
 
144
- ### UseNodePolyfills
144
+ ### Polyfills
145
145
 
146
146
  **Type:** Boolean
147
147
 
148
148
  **Description:**
149
- Determines whether Node.js polyfills should be applied. This is useful for projects that leverage specific Node.js functionality but target environments without these built-in features. The use of useNodePolyfills is ignored when used in mode `deliver` presets, as Node.js features must be resolved at build time by the framework process itself.
149
+ Determines whether Node.js polyfills should be applied. This is useful for projects that leverage specific Node.js functionality but target environments without these built-in features.
150
150
 
151
- ### UseOwnWorker
151
+ ### Worker
152
152
 
153
153
  **Type:** Boolean
154
154
 
155
155
  **Description:**
156
- This flag indicates that the constructed code inserts its own worker expression, such as `addEventListener("fetch")` or similar, without the need to inject a provider.
156
+ This flag indicates that the constructed code inserts its own worker expression, such as `addEventListener("fetch")`.
157
157
 
158
158
  ### Preset
159
159
 
@@ -162,8 +162,7 @@ This flag indicates that the constructed code inserts its own worker expression,
162
162
  **Description:**
163
163
  Provides preset-specific configurations.
164
164
 
165
- - **Name (Type: String):** Refers to the preset name, e.g., "vue" or "next".
166
- - **Mode (Type: String):** Specifies the mode for the preset, e.g., "compute" or "deliver".
165
+ - **Name (Type: String):** Refers to the preset name, e.g., "vue" or "next"..
167
166
 
168
167
  ### MemoryFS
169
168
 
@@ -191,25 +190,24 @@ For a Next/Faststore-based project:
191
190
 
192
191
  ```javascript
193
192
  module.exports = {
194
- entry: 'src/index.js',
195
- builder: 'webpack',
196
- useNodePolyfills: true,
197
- useOwnWorker: false,
198
- preset: {
199
- name: 'next',
200
- mode: 'compute',
201
- },
202
- memoryFS: {
203
- injectionDirs: ['.faststore/@generated/graphql'],
204
- removePathPrefix: '.faststore/',
205
- },
206
- custom: {
207
- plugins: {},
208
- },
193
+ build: {
194
+ entry: 'src/index.js',
195
+ builder: 'webpack',
196
+ polyfills: true,
197
+ worker: false,
198
+ preset: { name: 'next' },
199
+ memoryFS: {
200
+ injectionDirs: ['.faststore/@generated/graphql'],
201
+ removePathPrefix: '.faststore/',
202
+ },
203
+ custom: {
204
+ plugins: {},
205
+ },
206
+ }
209
207
  };
210
208
  ```
211
209
 
212
- **Note:** Adapting `vulcan.config.js` to your setup allows a personalized development experience, catering to the specific needs of your JavaScript applications and frameworks.
210
+ **Note:** Adapting `azion.config.js` to your setup allows a personalized development experience, catering to the specific needs of your JavaScript applications and frameworks.
213
211
 
214
212
  ## Docs
215
213
 
package/aliases.js CHANGED
@@ -11,6 +11,5 @@ export default [
11
11
  ['#env', './lib/env/index.js'],
12
12
  ['#platform', './lib/platform/index.js'],
13
13
  ['#constants', './lib/constants/index.js'],
14
- ['#edge', './lib/env/edgehooks/index.js'],
15
14
  ['#commands', './lib/commands/index.js'],
16
15
  ];
@@ -1,5 +1,3 @@
1
- import { Messages } from '#constants';
2
- import { feedback } from '#utils';
3
1
  import merge from 'lodash.merge';
4
2
 
5
3
  /**
@@ -11,8 +9,8 @@ class BaseBundlers {
11
9
  * Represents a configuration object.
12
10
  * @typedef {object} BuilderConfig
13
11
  * @property {string} entry - The entry point for the configuration
14
- * @property {boolean} useNodePolyfills - Indicates if Node polyfills are being used
15
- * @property {boolean} useOwnWorker - Indicates if a custom worker is being used
12
+ * @property {boolean} polyfills - Indicates if Node polyfills are being used
13
+ * @property {boolean} worker - Indicates if a custom worker is being used
16
14
  * @property {object} custom - Custom configuration.
17
15
  * @property {*} localCustom - Local custom data
18
16
  * @property {*} preset - The preset configuration
@@ -41,12 +39,6 @@ class BaseBundlers {
41
39
  * @type {object}
42
40
  */
43
41
  this.customConfigLocal = builderConfig.localCustom;
44
-
45
- /**
46
- * Preset mode. e.g deliver | mode
47
- * @type {object}
48
- */
49
- this.presetMode = builderConfig?.preset?.mode;
50
42
  }
51
43
 
52
44
  /**
@@ -83,13 +75,6 @@ class BaseBundlers {
83
75
  * @returns {object} - The merged configuration.
84
76
  */
85
77
  mergeConfig(config = {}) {
86
- const isDeliverMode = this.presetMode === 'deliver';
87
- // waring mode deliver when useNodePolyfills
88
- if (this.builderConfig.useNodePolyfills && isDeliverMode) {
89
- feedback.build.warn(
90
- Messages.build.warning.use_node_polyfill_mode_deliver,
91
- );
92
- }
93
78
  const hasCustomConfig = Object.keys(this.customConfigPreset).length > 0;
94
79
  const hasCustomConfigLocal = Object.keys(this.customConfigLocal).length > 0;
95
80
  if (hasCustomConfig || hasCustomConfigLocal) {
@@ -41,15 +41,14 @@ class Esbuild extends BaseBundlers {
41
41
  */
42
42
  applyConfig(config) {
43
43
  const updatedConfig = { ...config };
44
- // use polyfill with useNodePolyfills and preset mode compute
45
- const useNodePolyfills =
46
- (this.builderConfig?.useNodePolyfills ||
47
- this.customConfigPreset?.useNodePolyfills ||
48
- this.customConfigLocal?.useNodePolyfills) &&
49
- this.presetMode === 'compute';
44
+ // use polyfill with polyfills
45
+ const polyfills =
46
+ this.builderConfig?.polyfills ||
47
+ this.customConfigPreset?.polyfills ||
48
+ this.customConfigLocal?.polyfills;
50
49
 
51
50
  if (!updatedConfig.plugins) updatedConfig.plugins = [];
52
- if (useNodePolyfills) {
51
+ if (polyfills) {
53
52
  updatedConfig.plugins.push(
54
53
  ESBuildNodeModulePlugin(globalThis.vulcan.buildProd),
55
54
  );
@@ -45,12 +45,9 @@ describe('Esbuild Bundler', () => {
45
45
  outfile: tmpOutput.name,
46
46
  minify: false,
47
47
  },
48
- useNodePolyfills: true,
49
- useOwnWorker: false,
50
- preset: {
51
- name: 'javascript',
52
- mode: 'compute',
53
- },
48
+ polyfills: true,
49
+ worker: false,
50
+ preset: { name: 'javascript' },
54
51
  });
55
52
  await bundler.run();
56
53
 
@@ -73,12 +70,9 @@ describe('Esbuild Bundler', () => {
73
70
  outfile: tmpOutput.name,
74
71
  minify: false,
75
72
  },
76
- useNodePolyfills: false,
77
- useOwnWorker: false,
78
- preset: {
79
- name: 'javascript',
80
- mode: 'compute',
81
- },
73
+ polyfills: false,
74
+ worker: false,
75
+ preset: { name: 'javascript' },
82
76
  });
83
77
  let config = AzionEsbuildConfig;
84
78
  config = bundler.mergeConfig(config);
@@ -4,7 +4,7 @@ import { getAbsoluteLibDirPath } from '#utils';
4
4
  const require = createRequire(import.meta.url);
5
5
  const libDirPath = getAbsoluteLibDirPath();
6
6
  const polyfillsPath = `${libDirPath}/build/bundlers/polyfills`;
7
- const nextNodePresetPath = `${libDirPath}/presets/next/compute/node`;
7
+ const nextNodePresetPath = `${libDirPath}/presets/next/node`;
8
8
  const nodePolyfillsPath = `${polyfillsPath}/node`;
9
9
 
10
10
  /**
@@ -144,10 +144,16 @@ class PolyfillsManager {
144
144
  require.resolve('@fastly/http-compute-js'),
145
145
  );
146
146
 
147
+ // set azion utils lib for esbuild to solve this
148
+ this.setLib('azion/utils', require.resolve('azion/utils'));
149
+
147
150
  // alias polyfills
148
151
  this.setAlias('util', require.resolve('util/'));
149
152
  this.setAlias('process', `${nodePolyfillsPath}/globals/process.cjs`);
150
153
 
154
+ // set azion utils alias for esbuild and webpack to solve this
155
+ this.setAlias('azion/utils', require.resolve('azion/utils'));
156
+
151
157
  // external polyfills
152
158
  this.setExternal(
153
159
  'async_hooks',
@@ -7,6 +7,7 @@ describe('Polyfills Manager', () => {
7
7
  it('Should return map of polyfills', () => {
8
8
  const expectedPolyfills = new Set([
9
9
  'accepts',
10
+ 'azion/utils',
10
11
  'buffer',
11
12
  'child_process',
12
13
  'cluster',
@@ -84,14 +84,13 @@ class Webpack extends BaseBundlers {
84
84
  );
85
85
  }
86
86
 
87
- // use polyfill with useNodePolyfills and preset mode compute
88
- const useNodePolyfills =
89
- (this.builderConfig?.useNodePolyfills ||
90
- this.customConfigPreset?.useNodePolyfills ||
91
- this.customConfigLocal?.useNodePolyfills) &&
92
- this.presetMode === 'compute';
93
-
94
- if (useNodePolyfills) {
87
+ // use polyfill with polyfills
88
+ const polyfills =
89
+ this.builderConfig?.polyfills ||
90
+ this.customConfigPreset?.polyfills ||
91
+ this.customConfigLocal?.polyfills;
92
+
93
+ if (polyfills) {
95
94
  updatedConfig.plugins.push(
96
95
  new NodePolyfillPlugin(globalThis.vulcan.buildProd),
97
96
  );
@@ -53,12 +53,9 @@ describe('Webpack Bundler', () => {
53
53
  level: 'error',
54
54
  },
55
55
  },
56
- useNodePolyfills: true,
57
- useOwnWorker: false,
58
- preset: {
59
- name: 'javascript',
60
- mode: 'compute',
61
- },
56
+ polyfills: true,
57
+ worker: false,
58
+ preset: { name: 'javascript' },
62
59
  });
63
60
  await bundler.run();
64
61
 
@@ -84,12 +81,9 @@ describe('Webpack Bundler', () => {
84
81
  minimize: false,
85
82
  },
86
83
  },
87
- useNodePolyfills: false,
88
- useOwnWorker: false,
89
- preset: {
90
- name: 'javascript',
91
- mode: 'compute',
92
- },
84
+ polyfills: false,
85
+ worker: false,
86
+ preset: { name: 'javascript' },
93
87
  });
94
88
  let config = AzionWebpackConfig;
95
89
  config = bundler.mergeConfig(config);