edge-functions 1.1.0 → 1.4.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.
- package/.eslintrc.json +1 -1
- package/README.md +36 -0
- package/aliases.js +1 -1
- package/docs/overview.md +4 -3
- package/docs/presets.md +16 -4
- package/examples/vue-static/yarn.lock +13094 -0
- package/examples/vue-vite-static/yarn.lock +333 -0
- package/jsconfig.json +1 -1
- package/lib/build/dispatcher/dispatcher.js +62 -66
- package/lib/constants/framework-initializer.constants.js +51 -0
- package/lib/constants/index.js +4 -1
- package/lib/constants/messages/build.messages.js +2 -0
- package/lib/constants/messages/global.messages.js +4 -1
- package/lib/env/polyfills/FetchEvent.polyfills.js +13 -0
- package/lib/env/polyfills/fetch.polyfills.js +39 -0
- package/lib/env/polyfills/index.js +4 -0
- package/lib/env/runtime.env.js +9 -1
- package/lib/main.js +234 -94
- package/lib/platform/actions/core/propagation.actions.js +5 -4
- package/lib/presets/custom/angular/deliver/prebuild.js +6 -10
- package/lib/presets/custom/astro/deliver/prebuild.js +16 -20
- package/lib/presets/custom/hexo/deliver/prebuild.js +16 -20
- package/lib/presets/custom/next/deliver/prebuild.js +31 -35
- package/lib/presets/custom/react/deliver/prebuild.js +2 -6
- package/lib/presets/custom/vue/deliver/prebuild.js +26 -58
- package/lib/utils/exec/exec.utils.js +34 -24
- package/lib/utils/getAbsoluteLibDirPath/getAbsoluteLibDirPath.utils.js +1 -3
- package/lib/utils/getVulcanBuildId/getVulcanBuildId.utils.js +1 -1
- package/lib/utils/index.js +2 -2
- package/lib/utils/presets/index.js +3 -0
- package/lib/utils/presets/presets.utils.js +169 -0
- package/lib/utils/spinner/index.js +2 -2
- package/lib/utils/spinner/spinner.utils.js +1 -1
- package/package.json +9 -2
- package/lib/utils/getPresetsList/getPresetsList.utils.js +0 -68
- package/lib/utils/getPresetsList/index.js +0 -3
- /package/lib/utils/{getPresetsList/getPresetsList.utils.test.js → presets/presets.utils.test.js} +0 -0
package/.eslintrc.json
CHANGED
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
# Vulcan - Forging The Edge
|
|
3
|
+

|
|
4
|
+
|
|
3
5
|
|
|
4
6
|
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.
|
|
5
7
|
|
|
@@ -45,6 +47,40 @@ Follow these steps to start using Vulcan:
|
|
|
45
47
|
|
|
46
48
|
5. 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.
|
|
47
49
|
|
|
50
|
+
## Using Vulcan
|
|
51
|
+
|
|
52
|
+
See some examples below:
|
|
53
|
+
|
|
54
|
+
* Build a JavaScript/Node project (back-end)
|
|
55
|
+
|
|
56
|
+
```shell
|
|
57
|
+
vulcan build
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
* Build a TypeScript/Node (back-end)
|
|
61
|
+
|
|
62
|
+
```shell
|
|
63
|
+
vulcan build --preset typescript
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
* Build a Static Next.js project
|
|
67
|
+
|
|
68
|
+
```shell
|
|
69
|
+
vulcan build --preset next --mode deliver
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
* Build a Static Astro.js project
|
|
73
|
+
|
|
74
|
+
```shell
|
|
75
|
+
vulcan build --preset astro --mode deliver
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
* Test your project locally (after build)
|
|
79
|
+
|
|
80
|
+
```shell
|
|
81
|
+
vulcan dev
|
|
82
|
+
```
|
|
83
|
+
|
|
48
84
|
|
|
49
85
|
## Docs
|
|
50
86
|
* [Overview](docs/overview.md)
|
package/aliases.js
CHANGED
|
@@ -2,7 +2,7 @@ export default [
|
|
|
2
2
|
['#root/*', './'],
|
|
3
3
|
['#lib/*', './lib'],
|
|
4
4
|
['#utils', './lib/utils/index.js'],
|
|
5
|
-
['#polyfills', './lib/polyfills/index.js'],
|
|
5
|
+
['#polyfills', './lib/env/polyfills/index.js'],
|
|
6
6
|
['#build', './lib/build/dispatcher/index.js'],
|
|
7
7
|
['#bundlers', './lib/build/bundlers/index.js'],
|
|
8
8
|
['#notations/*', './lib/notations'],
|
package/docs/overview.md
CHANGED
|
@@ -31,6 +31,7 @@ Polyfills can be used to generate the worker(s) file(s).
|
|
|
31
31
|
Some configs can be passed to the builder but if user tries to override `azion worker configs` this passed configs will be ignored.
|
|
32
32
|
|
|
33
33
|
### Artifacts
|
|
34
|
-
Files generated to run
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
The **'.edge'** folder will be generated representing the edge locally. Files generated to run on the infrastructure:
|
|
35
|
+
* JS worker(s) => '.edge/workers.js';
|
|
36
|
+
* Assets => '.edge/storage/*';
|
|
37
|
+
* Environment variables => '.edge/.env'.
|
package/docs/presets.md
CHANGED
|
@@ -9,8 +9,9 @@ Vulcan is an extensible platform that allows you to easily create new presets fo
|
|
|
9
9
|
To add a new preset, you need to create appropriate folders in two directories: `presets/default` or `presets/custom`. The folder representing your framework or library will automatically be included in the preset listings. Each preset has two modes, represented by folders of the same name: `compute` and `deliver`.
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
https://github.com/aziontech/vulcan/assets/12740219/84c7d7a1-4167-4e7e-993f-41a6eb653758
|
|
13
|
+
|
|
12
14
|
|
|
13
|
-
https://github.com/aziontech/vulcan/assets/12740219/06edb9a0-26cd-4055-bd2e-d400b6a06f3c
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
|
|
@@ -54,7 +55,18 @@ Each preset is made up of three primary files: `config.js`, `prebuild.js`, and `
|
|
|
54
55
|
|
|
55
56
|
Here's a step-by-step guide on how to add a new preset in Vulcan:
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
## **Use the command to automatic creation:**
|
|
59
|
+
|
|
60
|
+
vulcan presets create
|
|
61
|
+
|
|
62
|
+
https://github.com/aziontech/vulcan/assets/12740219/9ca7371e-713a-4b29-a99b-c1a18d28bc67
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Or do it manually:
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## 1. **Create a folder inside `./lib/presets/custom`:**
|
|
58
70
|
https://github.com/aziontech/vulcan/assets/12740219/abb1b2cc-5f74-473d-b731-c0b7157cb95e
|
|
59
71
|
|
|
60
72
|
- The name of this folder should represent the name of your framework or library.
|
|
@@ -65,7 +77,7 @@ Here's a step-by-step guide on how to add a new preset in Vulcan:
|
|
|
65
77
|
|
|
66
78
|
- **Deliver**: This mode should be used when you intend to use the worker only for routing requests and delivering static files that will be computed on the client side.
|
|
67
79
|
|
|
68
|
-
|
|
80
|
+
2. ## **Create the following files in your preset's folder:**
|
|
69
81
|
|
|
70
82
|
## handler.js
|
|
71
83
|
This file contains the code that is executed within the worker in the edge function. Essentially, it is the code that runs directly on the edge. In the context of the `deliver` mode, this may simply act as a router. However, in cases where computation is needed, it can be designed to perform more complex tasks. Remember, the capabilities of your handler.js are dependent on your use case and the mode of operation you've chosen for your preset.
|
|
@@ -112,4 +124,4 @@ For `deliver` mode:
|
|
|
112
124
|
|
|
113
125
|
vulcan build --preset <name> --mode deliver
|
|
114
126
|
|
|
115
|
-
Replace `<name>` with the name of your preset. This will initiate Vulcan's build process for your preset, allowing you to verify its functionality.
|
|
127
|
+
Replace `<name>` with the name of your preset. This will initiate Vulcan's build process for your preset, allowing you to verify its functionality.
|