edge-functions 2.11.0-stage.1 → 2.11.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,18 @@
1
+ ## [2.11.0](https://github.com/aziontech/vulcan/compare/v2.10.0...v2.11.0) (2024-07-11)
2
+
3
+
4
+ ### Features
5
+
6
+ * New preset Docusaurus ([#353](https://github.com/aziontech/vulcan/issues/353)) ([0c05e76](https://github.com/aziontech/vulcan/commit/0c05e76955afa500adc5c7e8762d007725c9b58b))
7
+ * use runtime in async fs ([#352](https://github.com/aziontech/vulcan/issues/352)) ([6a6f195](https://github.com/aziontech/vulcan/commit/6a6f19543a31ab9d39efbc4eb165fa6b2780c95e))
8
+
9
+ ## [2.11.0-stage.2](https://github.com/aziontech/vulcan/compare/v2.11.0-stage.1...v2.11.0-stage.2) (2024-07-09)
10
+
11
+
12
+ ### Features
13
+
14
+ * New preset Docusaurus ([#353](https://github.com/aziontech/vulcan/issues/353)) ([0c05e76](https://github.com/aziontech/vulcan/commit/0c05e76955afa500adc5c7e8762d007725c9b58b))
15
+
1
16
  ## [2.11.0-stage.1](https://github.com/aziontech/vulcan/compare/v2.10.0...v2.11.0-stage.1) (2024-07-08)
2
17
 
3
18
 
@@ -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,21 @@
1
+ import { rm } from 'fs/promises';
2
+ import { exec, getPackageManager, copyDirectory } from '#utils';
3
+
4
+ const packageManager = await getPackageManager();
5
+
6
+ /**
7
+ * Runs custom prebuild actions
8
+ */
9
+ async function prebuild() {
10
+ const newOutDir = '.edge/storage';
11
+ const outDir = 'build';
12
+
13
+ await exec(`${packageManager} run build`, 'Docusaurus', true);
14
+
15
+ // move files to vulcan default path
16
+ copyDirectory(outDir, newOutDir);
17
+
18
+ rm(outDir, { recursive: true, force: true });
19
+ }
20
+
21
+ export default prebuild;
@@ -11,6 +11,7 @@ describe('getPresetsList utils', () => {
11
11
  const expectedOutput = [
12
12
  'angular',
13
13
  'astro',
14
+ 'docusaurus',
14
15
  'eleventy',
15
16
  'emscripten',
16
17
  'gatsby',
@@ -75,6 +76,7 @@ describe('getPresetsList utils', () => {
75
76
  const expectedResult = [
76
77
  'Angular (Deliver)',
77
78
  'Astro (Deliver)',
79
+ 'Docusaurus (Deliver)',
78
80
  'Eleventy (Deliver)',
79
81
  'Emscripten (Compute)',
80
82
  'Gatsby (Deliver)',
@@ -102,6 +104,7 @@ describe('getPresetsList utils', () => {
102
104
  'typescript',
103
105
  'angular',
104
106
  'astro',
107
+ 'docusaurus',
105
108
  'eleventy',
106
109
  'emscripten',
107
110
  'hexo',
@@ -120,6 +123,7 @@ describe('getPresetsList utils', () => {
120
123
  ['Deliver'],
121
124
  ['Deliver'],
122
125
  ['Deliver'],
126
+ ['Deliver'],
123
127
  ['Compute'],
124
128
  ['Deliver'],
125
129
  ['Deliver'],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "edge-functions",
3
3
  "type": "module",
4
- "version": "2.11.0-stage.1",
4
+ "version": "2.11.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": {