edge-functions 2.11.0 → 2.12.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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [2.12.0](https://github.com/aziontech/vulcan/compare/v2.11.0...v2.12.0) (2024-07-15)
2
+
3
+
4
+ ### Features
5
+
6
+ * vitepress ([#356](https://github.com/aziontech/vulcan/issues/356)) ([9d5310e](https://github.com/aziontech/vulcan/commit/9d5310e62f45c8e0cc12d2ac334bbcf76203dd0c))
7
+
8
+ ## [2.12.0-stage.1](https://github.com/aziontech/vulcan/compare/v2.11.0...v2.12.0-stage.1) (2024-07-12)
9
+
10
+
11
+ ### Features
12
+
13
+ * vitepress ([#356](https://github.com/aziontech/vulcan/issues/356)) ([9d5310e](https://github.com/aziontech/vulcan/commit/9d5310e62f45c8e0cc12d2ac334bbcf76203dd0c))
14
+
1
15
  ## [2.11.0](https://github.com/aziontech/vulcan/compare/v2.10.0...v2.11.0) (2024-07-11)
2
16
 
3
17
 
package/README.md CHANGED
@@ -19,10 +19,10 @@ Table:
19
19
  | Next 13 5 6 Middleware | ✅ |
20
20
  | Next 12 3 4 Middleware | ✅ |
21
21
  | Next Node Pages 12 3 1 | ✅ |
22
- | Next 13 5 6 Config | |
22
+ | Next 13 5 6 Config | ⚠️ |
23
23
  | Next 12 3 4 Config | ✅ |
24
24
  | Next Static | ✅ |
25
- | Gatsby Static | ⚠️ |
25
+ | Gatsby Static | |
26
26
  | Next Node Pages 12 3 1 Fs | ✅ |
27
27
  | Vue Vite Static | ✅ |
28
28
  | Next 12 Static | ✅ |
@@ -33,6 +33,7 @@ Table:
33
33
  | Angular Static | ✅ |
34
34
  | Simple Js Network List | ✅ |
35
35
  | Svelte Static | ✅ |
36
+ | Docusaurus Static | ✅ |
36
37
  | Simple Js Firewall Event | ✅ |
37
38
  | Simple Js Network List With Firewall | ✅ |
38
39
  | Jekyll Static | ✅ |
@@ -41,7 +42,9 @@ Table:
41
42
  | Simple Js Esm | ✅ |
42
43
  | Simple Ts Esm | ✅ |
43
44
 
44
- Last test run date: 07/02/24 03:23:16 AM
45
+
46
+ Last test run date: 07/12/24 03:25:57 AM
47
+
45
48
  ## Quick Installation
46
49
 
47
50
  For those who just want to use Vulcan in their project without contributing to the development, you can install it directly from npm.
@@ -0,0 +1,50 @@
1
+ const AzionConfig = {
2
+ origin: [
3
+ {
4
+ name: 'origin-storage-default',
5
+ type: 'object_storage',
6
+ },
7
+ ],
8
+ rules: {
9
+ request: [
10
+ {
11
+ name: 'Set Storage Origin for All Requests',
12
+ match: '^\\/',
13
+ behavior: {
14
+ setOrigin: {
15
+ name: 'origin-storage-default',
16
+ type: 'object_storage',
17
+ },
18
+ },
19
+ },
20
+ {
21
+ name: 'Deliver Static Assets',
22
+ match:
23
+ '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$',
24
+ behavior: {
25
+ setOrigin: {
26
+ name: 'origin-storage-default',
27
+ type: 'object_storage',
28
+ },
29
+ deliver: true,
30
+ },
31
+ },
32
+ {
33
+ name: 'Redirect to index.html',
34
+ match: '.*/$',
35
+ behavior: {
36
+ rewrite: '${uri}index.html',
37
+ },
38
+ },
39
+ {
40
+ name: 'Redirect to index.html for Subpaths',
41
+ match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*',
42
+ behavior: {
43
+ rewrite: '${uri}/index.html',
44
+ },
45
+ },
46
+ ],
47
+ },
48
+ };
49
+
50
+ export default AzionConfig;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Config to be used in build context.
3
+ */
4
+ const config = {
5
+ builder: 'webpack',
6
+ useNodePolyfills: false,
7
+ custom: {},
8
+ };
9
+
10
+ export default config;
@@ -0,0 +1,16 @@
1
+ import { mountSSG, ErrorHTML } from '#edge';
2
+ /**
3
+ * Handles the 'fetch' event.
4
+ * @param {any} event - The fetch event.
5
+ * @returns {Promise<Response>} The response for the request.
6
+ */
7
+ async function handler(event) {
8
+ try {
9
+ const myApp = await mountSSG(event.request.url);
10
+ return myApp;
11
+ } catch (error) {
12
+ return ErrorHTML('404');
13
+ }
14
+ }
15
+
16
+ export default handler;
@@ -0,0 +1,39 @@
1
+ import { lstat, rm } from 'fs/promises';
2
+ import { exec, getPackageManager, copyDirectory } from '#utils';
3
+
4
+ const packageManager = await getPackageManager();
5
+
6
+ /**
7
+ * Check if the project uses the "/docs"
8
+ * @returns {boolean} True if the structure is being used, false otherwise.
9
+ */
10
+ async function docsFolderExists() {
11
+ try {
12
+ await lstat('docs/');
13
+ return true;
14
+ } catch (err) {
15
+ return false;
16
+ }
17
+ }
18
+
19
+ /**
20
+ * Runs custom prebuild actions
21
+ */
22
+ async function prebuild() {
23
+ const newOutDir = '.edge/storage';
24
+
25
+ // The main folder for VitePress usually is 'docs',
26
+ // however the users also might use the root folder
27
+ const outDir = (await docsFolderExists())
28
+ ? 'docs/.vitepress/dist'
29
+ : '.vitepress/dist';
30
+
31
+ await exec(`${packageManager} run docs:build`, 'Vitepress', true);
32
+
33
+ // move files to vulcan default path
34
+ copyDirectory(outDir, newOutDir);
35
+
36
+ rm(outDir, { recursive: true, force: true });
37
+ }
38
+
39
+ export default prebuild;
@@ -25,6 +25,7 @@ describe('getPresetsList utils', () => {
25
25
  'rustwasm',
26
26
  'svelte',
27
27
  'typescript',
28
+ 'vitepress',
28
29
  'vue',
29
30
  ];
30
31
 
@@ -91,6 +92,7 @@ describe('getPresetsList utils', () => {
91
92
  'Rustwasm (Compute)',
92
93
  'Svelte (Deliver)',
93
94
  'Typescript (Compute)',
95
+ 'Vitepress (Deliver)',
94
96
  'Vue (Deliver)',
95
97
  ];
96
98
  const beautifiedResults = presets.getBeautify();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "edge-functions",
3
3
  "type": "module",
4
- "version": "2.11.0",
4
+ "version": "2.12.0",
5
5
  "description": "Tool to launch and build JavaScript/Frameworks. This tool automates polyfills for Edge Computing and assists in creating Workers, notably for the Azion platform.",
6
6
  "main": "lib/main.js",
7
7
  "bin": {