edge-functions 2.9.0-stage.1 → 2.9.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 (31) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +3 -3
  3. package/lib/build/dispatcher/dispatcher.js +18 -8
  4. package/lib/build/dispatcher/dispatcher.test.js +4 -0
  5. package/lib/build/dispatcher/helpers/helpers.js +20 -13
  6. package/lib/presets/angular/deliver/azion.config.js +15 -10
  7. package/lib/presets/astro/deliver/azion.config.js +19 -11
  8. package/lib/presets/eleventy/deliver/azion.config.js +19 -11
  9. package/lib/presets/emscripten/compute/azion.config.js +4 -2
  10. package/lib/presets/gatsby/deliver/azion.config.js +19 -11
  11. package/lib/presets/hexo/deliver/azion.config.js +19 -11
  12. package/lib/presets/html/deliver/azion.config.js +5 -3
  13. package/lib/presets/hugo/deliver/azion.config.js +19 -11
  14. package/lib/presets/javascript/compute/azion.config.js +4 -2
  15. package/lib/presets/jekyll/deliver/azion.config.js +19 -11
  16. package/lib/presets/next/compute/azion.config.js +17 -11
  17. package/lib/presets/next/deliver/azion.config.js +19 -11
  18. package/lib/presets/react/deliver/azion.config.js +15 -10
  19. package/lib/presets/rustwasm/compute/azion.config.js +4 -2
  20. package/lib/presets/svelte/deliver/azion.config.js +19 -11
  21. package/lib/presets/typescript/compute/azion.config.js +4 -2
  22. package/lib/presets/vue/deliver/azion.config.js +15 -11
  23. package/lib/utils/generateManifest/generateManifest.utils.js +43 -265
  24. package/lib/utils/generateManifest/generateManifest.utils.test.js +458 -68
  25. package/lib/utils/generateManifest/helpers/azion.config.example.js +263 -0
  26. package/lib/utils/generateManifest/helpers/behaviors.js +249 -0
  27. package/lib/utils/generateManifest/helpers/convertLegacyConfig.js +72 -0
  28. package/lib/utils/generateManifest/helpers/schema.js +591 -0
  29. package/package.json +3 -3
  30. package/lib/utils/generateManifest/fixtures/azion.config.js +0 -177
  31. package/lib/utils/generateManifest/fixtures/schema.js +0 -530
package/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ ## [2.9.0](https://github.com/aziontech/vulcan/compare/v2.8.1...v2.9.0) (2024-06-20)
2
+
3
+
4
+ ### Features
5
+
6
+ * add capture_match_groups rule ([e5a9238](https://github.com/aziontech/vulcan/commit/e5a9238215759c536a43da519542f9bf5184694c))
7
+ * add optional 'variable' field (azion.config) ([71e7184](https://github.com/aziontech/vulcan/commit/71e7184e052c239cb3d6116dc76216d56a3d64d2))
8
+ * behavior order, description prop and active prop (azion.config.js) ([#341](https://github.com/aziontech/vulcan/issues/341)) ([9ace596](https://github.com/aziontech/vulcan/commit/9ace5961f7bbfe66419ab0754c5975aaf63ace76))
9
+ * expand azion.config.js field support ([#340](https://github.com/aziontech/vulcan/issues/340)) ([266f257](https://github.com/aziontech/vulcan/commit/266f25743417ca57fdfbfd1667cceb0906d1cb95))
10
+ * flag to build manifest only and skip other steps ([08201ce](https://github.com/aziontech/vulcan/commit/08201ceb81420a75f4d26f57b5d0555f886bc963))
11
+ * request phase gzip field ([ac84e82](https://github.com/aziontech/vulcan/commit/ac84e82e93b33963c17d7f64e75ed49eed285eb2))
12
+ * request phase redirects + bypass cache ([f49d8f5](https://github.com/aziontech/vulcan/commit/f49d8f59168c829990de4f08573bd154ecde2079))
13
+ * support response phase in manifest ([5ee8717](https://github.com/aziontech/vulcan/commit/5ee8717804ac0004ea3c87c324956e589d5bbc92))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * request or response are required ([8c8ca7e](https://github.com/aziontech/vulcan/commit/8c8ca7e06ef391a2cfee2998ce54a38ea245d906))
19
+ * response phase criteria ([c85ef9f](https://github.com/aziontech/vulcan/commit/c85ef9f4ed9968e03a8668dcb11af2b34578b805))
20
+
21
+ ## [2.9.0-stage.2](https://github.com/aziontech/vulcan/compare/v2.9.0-stage.1...v2.9.0-stage.2) (2024-06-19)
22
+
23
+
24
+ ### Features
25
+
26
+ * behavior order, description prop and active prop (azion.config.js) ([#341](https://github.com/aziontech/vulcan/issues/341)) ([9ace596](https://github.com/aziontech/vulcan/commit/9ace5961f7bbfe66419ab0754c5975aaf63ace76))
27
+
1
28
  ## [2.9.0-stage.1](https://github.com/aziontech/vulcan/compare/v2.8.1...v2.9.0-stage.1) (2024-06-13)
2
29
 
3
30
 
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 | ✅ |
@@ -41,7 +41,7 @@ Table:
41
41
  | Simple Js Esm | ✅ |
42
42
  | Simple Ts Esm | ✅ |
43
43
 
44
- Last test run date: 06/07/24 02:58:51 AM
44
+ Last test run date: 06/20/24 03:22:41 AM
45
45
  ## Quick Installation
46
46
 
47
47
  For those who just want to use Vulcan in their project without contributing to the development, you can install it directly from npm.
@@ -1,4 +1,4 @@
1
- import { join, resolve, dirname } from 'path';
1
+ import { join, resolve, dirname, extname } from 'path';
2
2
  import { readFileSync, existsSync, writeFileSync, rmSync } from 'fs';
3
3
  import { Esbuild, Webpack } from '#bundlers';
4
4
  import {
@@ -127,18 +127,29 @@ class Dispatcher {
127
127
  * @returns {object} - Preset files
128
128
  */
129
129
  async loadPreset() {
130
- feedback.build.info('Loading build context...');
131
-
132
130
  const VALID_BUILD_PRESETS = presets.getKeys();
133
131
  const vulcanRootPath = resolve(this.vulcanLibPath, '..');
134
132
 
135
133
  const validPreset = VALID_BUILD_PRESETS.includes(this.preset.name);
134
+ const validMode = ['deliver', 'compute'].includes(this.preset.mode);
136
135
 
137
136
  if (!validPreset) {
138
137
  feedback.build.error(Messages.build.error.invalid_preset);
139
138
  process.exit(1);
140
139
  }
141
140
 
141
+ if (!validMode) {
142
+ feedback.build.error(
143
+ Messages.build.error.invalid_preset_mode(
144
+ this.preset.mode,
145
+ this.preset.name,
146
+ ),
147
+ );
148
+ process.exit(1);
149
+ }
150
+
151
+ feedback.build.info('Loading build context...');
152
+
142
153
  let configFilePath;
143
154
  let prebuildFilePath;
144
155
  let postbuildFilePath;
@@ -540,18 +551,17 @@ class Dispatcher {
540
551
  const azionConfigAlreadyExists = !!azionConfigPath;
541
552
 
542
553
  let configModule = null;
543
-
544
554
  if (azionConfigAlreadyExists) {
545
555
  const configModulePath = dirname(azionConfigPath);
556
+ const extension = extname(azionConfigPath);
546
557
  configModule = await loadModule(
547
558
  configModulePath,
548
559
  'azion.config',
549
- isCommonJS(),
560
+ extension,
550
561
  );
551
562
  }
552
563
 
553
564
  if (!azionConfigAlreadyExists) {
554
- const useCommonJS = isCommonJS();
555
565
  const presetAzionConfigPath = join(
556
566
  this.vulcanLibPath,
557
567
  'presets',
@@ -562,9 +572,9 @@ class Dispatcher {
562
572
  configModule = await loadModule(
563
573
  presetAzionConfigPath,
564
574
  'azion.config',
565
- false,
575
+ '.js',
566
576
  );
567
- await createAzionConfigFile(useCommonJS, configModule);
577
+ await createAzionConfigFile(isCommonJS(), configModule);
568
578
  }
569
579
 
570
580
  const outputPath = join(process.cwd(), '.edge');
@@ -3,6 +3,10 @@ import { expect } from '@jest/globals';
3
3
  import Dispatcher from './dispatcher.js';
4
4
  import { folderExistsInProject, getAliasPath } from './helpers/helpers.js';
5
5
 
6
+ jest.mock('prettier', () => ({
7
+ format: jest.fn((content) => content),
8
+ }));
9
+
6
10
  describe('dispatcher', () => {
7
11
  const { env } = process;
8
12
  beforeEach(() => {
@@ -7,6 +7,7 @@ import {
7
7
  } from 'fs';
8
8
  import { join } from 'path';
9
9
  import { fileURLToPath } from 'url';
10
+ import prettier from 'prettier';
10
11
 
11
12
  /**
12
13
  * Get the path corresponding to a specific alias defined in the package.json.
@@ -78,20 +79,16 @@ function isCommonJS() {
78
79
  }
79
80
 
80
81
  /**
81
- * Dynamically loads a module based on the path, filename, and whether to use CommonJS.
82
- * @param {string} inputpath - The path where the module is located.
83
- * @param {string} filename - The filename of the module without the extension.
84
- * @param {boolean} useCommonJS - If true, uses CommonJS extensions (.cjs, .js); otherwise, uses ES Modules (.js, .mjs).
85
- * @returns {Promise<*>} The imported module or null if no valid module is found.
82
+ * Carrega dinamicamente um módulo com base no caminho, nome do arquivo e formato do arquivo.
83
+ * @param {string} inputpath - O caminho onde o módulo está localizado.
84
+ * @param {string} filename - O nome do arquivo do módulo sem a extensão.
85
+ * @param {string} format - O formato do arquivo (por exemplo, '.js', '.cjs', '.mjs').
86
+ * @returns {Promise<*>} O módulo importado ou null se nenhum módulo válido for encontrado.
86
87
  */
87
- async function loadModule(inputpath, filename, useCommonJS) {
88
- const extensions = useCommonJS ? ['.cjs', '.js'] : ['.js', '.mjs'];
88
+ async function loadModule(inputpath, filename, format) {
89
+ const modulePath = join(inputpath, `${filename}${format}`);
89
90
 
90
- const modulePath = extensions
91
- .map((ext) => join(inputpath, `${filename}${ext}`))
92
- .find((path) => existsSync(path));
93
-
94
- if (modulePath) {
91
+ if (existsSync(modulePath)) {
95
92
  const module = await import(modulePath);
96
93
  return module.default || module;
97
94
  }
@@ -142,9 +139,19 @@ async function createAzionConfigFile(useCommonJS, module) {
142
139
  return p1.replace(/\\n/g, ' ').replace(/\\'/g, "'");
143
140
  },
144
141
  );
142
+ // Formatação da string JSON usando prettier
143
+ const formattedContent = await prettier.format(
144
+ `${moduleExportStyle} ${jsonString};`,
145
+ {
146
+ parser: 'babel',
147
+ semi: false,
148
+ singleQuote: true,
149
+ trailingComma: 'none',
150
+ },
151
+ );
145
152
 
146
153
  if (!existsSync(configPath)) {
147
- writeFileSync(configPath, `${moduleExportStyle} ${jsonString};`);
154
+ writeFileSync(configPath, formattedContent);
148
155
  }
149
156
  }
150
157
 
@@ -10,9 +10,11 @@ const AzionConfig = {
10
10
  {
11
11
  name: 'Set Storage Origin for All Requests',
12
12
  match: '^\\/',
13
- setOrigin: {
14
- name: 'origin-storage-default',
15
- type: 'object_storage',
13
+ behavior: {
14
+ setOrigin: {
15
+ name: 'origin-storage-default',
16
+ type: 'object_storage',
17
+ },
16
18
  },
17
19
  },
18
20
 
@@ -20,19 +22,22 @@ const AzionConfig = {
20
22
  name: 'Deliver Static Assets',
21
23
  match:
22
24
  '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$',
23
- setOrigin: {
24
- name: 'origin-storage-default',
25
- type: 'object_storage',
25
+ behavior: {
26
+ setOrigin: {
27
+ name: 'origin-storage-default',
28
+ type: 'object_storage',
29
+ },
30
+ deliver: true,
26
31
  },
27
- deliver: true,
28
32
  },
29
33
 
30
34
  {
31
35
  name: 'Redirect to index.html',
32
36
  match: '^\\/',
33
- // eslint-disable-next-line no-template-curly-in-string
34
- rewrite: {
35
- set: () => `/index.html`,
37
+ behavior: {
38
+ rewrite: {
39
+ set: () => `/index.html`,
40
+ },
36
41
  },
37
42
  },
38
43
  ],
@@ -10,33 +10,41 @@ const AzionConfig = {
10
10
  {
11
11
  name: 'Set Storage Origin for All Requests',
12
12
  match: '^\\/',
13
- setOrigin: {
14
- name: 'origin-storage-default',
15
- type: 'object_storage',
13
+ behavior: {
14
+ setOrigin: {
15
+ name: 'origin-storage-default',
16
+ type: 'object_storage',
17
+ },
16
18
  },
17
19
  },
18
20
  {
19
21
  name: 'Deliver Static Assets',
20
22
  match:
21
23
  '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$',
22
- setOrigin: {
23
- name: 'origin-storage-default',
24
- type: 'object_storage',
24
+ behavior: {
25
+ setOrigin: {
26
+ name: 'origin-storage-default',
27
+ type: 'object_storage',
28
+ },
29
+ deliver: true,
25
30
  },
26
- deliver: true,
27
31
  },
28
32
  {
29
33
  name: 'Redirect to index.html',
30
34
  match: '.*/$',
31
- rewrite: {
32
- set: (uri) => `${uri}index.html`,
35
+ behavior: {
36
+ rewrite: {
37
+ set: (uri) => `${uri}index.html`,
38
+ },
33
39
  },
34
40
  },
35
41
  {
36
42
  name: 'Redirect to index.html for Subpaths',
37
43
  match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*',
38
- rewrite: {
39
- set: (uri) => `${uri}/index.html`,
44
+ behavior: {
45
+ rewrite: {
46
+ set: (uri) => `${uri}/index.html`,
47
+ },
40
48
  },
41
49
  },
42
50
  ],
@@ -10,33 +10,41 @@ const AzionConfig = {
10
10
  {
11
11
  name: 'Set Storage Origin for All Requests',
12
12
  match: '^\\/',
13
- setOrigin: {
14
- name: 'origin-storage-default',
15
- type: 'object_storage',
13
+ behavior: {
14
+ setOrigin: {
15
+ name: 'origin-storage-default',
16
+ type: 'object_storage',
17
+ },
16
18
  },
17
19
  },
18
20
  {
19
21
  name: 'Deliver Static Assets',
20
22
  match:
21
23
  '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$',
22
- setOrigin: {
23
- name: 'origin-storage-default',
24
- type: 'object_storage',
24
+ behavior: {
25
+ setOrigin: {
26
+ name: 'origin-storage-default',
27
+ type: 'object_storage',
28
+ },
29
+ deliver: true,
25
30
  },
26
- deliver: true,
27
31
  },
28
32
  {
29
33
  name: 'Redirect to index.html',
30
34
  match: '.*/$',
31
- rewrite: {
32
- set: (uri) => `${uri}index.html`,
35
+ behavior: {
36
+ rewrite: {
37
+ set: (uri) => `${uri}index.html`,
38
+ },
33
39
  },
34
40
  },
35
41
  {
36
42
  name: 'Redirect to index.html for Subpaths',
37
43
  match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*',
38
- rewrite: {
39
- set: (uri) => `${uri}/index.html`,
44
+ behavior: {
45
+ rewrite: {
46
+ set: (uri) => `${uri}/index.html`,
47
+ },
40
48
  },
41
49
  },
42
50
  ],
@@ -4,8 +4,10 @@ const AzionConfig = {
4
4
  {
5
5
  name: 'Execute Edge Function',
6
6
  match: '^\\/',
7
- runFunction: {
8
- path: '.edge/worker.js',
7
+ behavior: {
8
+ runFunction: {
9
+ path: '.edge/worker.js',
10
+ },
9
11
  },
10
12
  },
11
13
  ],
@@ -10,33 +10,41 @@ const AzionConfig = {
10
10
  {
11
11
  name: 'Set Storage Origin for All Requests',
12
12
  match: '^\\/',
13
- setOrigin: {
14
- name: 'origin-storage-default',
15
- type: 'object_storage',
13
+ behavior: {
14
+ setOrigin: {
15
+ name: 'origin-storage-default',
16
+ type: 'object_storage',
17
+ },
16
18
  },
17
19
  },
18
20
  {
19
21
  name: 'Deliver Static Assets',
20
22
  match:
21
23
  '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$',
22
- setOrigin: {
23
- name: 'origin-storage-default',
24
- type: 'object_storage',
24
+ behavior: {
25
+ setOrigin: {
26
+ name: 'origin-storage-default',
27
+ type: 'object_storage',
28
+ },
29
+ deliver: true,
25
30
  },
26
- deliver: true,
27
31
  },
28
32
  {
29
33
  name: 'Redirect to index.html',
30
34
  match: '.*/$',
31
- rewrite: {
32
- set: (uri) => `${uri}index.html`,
35
+ behavior: {
36
+ rewrite: {
37
+ set: (uri) => `${uri}index.html`,
38
+ },
33
39
  },
34
40
  },
35
41
  {
36
42
  name: 'Redirect to index.html for Subpaths',
37
43
  match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*',
38
- rewrite: {
39
- set: (uri) => `${uri}/index.html`,
44
+ behavior: {
45
+ rewrite: {
46
+ set: (uri) => `${uri}/index.html`,
47
+ },
40
48
  },
41
49
  },
42
50
  ],
@@ -10,33 +10,41 @@ const AzionConfig = {
10
10
  {
11
11
  name: 'Set Storage Origin for All Requests',
12
12
  match: '^\\/',
13
- setOrigin: {
14
- name: 'origin-storage-default',
15
- type: 'object_storage',
13
+ behavior: {
14
+ setOrigin: {
15
+ name: 'origin-storage-default',
16
+ type: 'object_storage',
17
+ },
16
18
  },
17
19
  },
18
20
  {
19
21
  name: 'Deliver Static Assets',
20
22
  match:
21
23
  '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$',
22
- setOrigin: {
23
- name: 'origin-storage-default',
24
- type: 'object_storage',
24
+ behavior: {
25
+ setOrigin: {
26
+ name: 'origin-storage-default',
27
+ type: 'object_storage',
28
+ },
29
+ deliver: true,
25
30
  },
26
- deliver: true,
27
31
  },
28
32
  {
29
33
  name: 'Redirect to index.html',
30
34
  match: '.*/$',
31
- rewrite: {
32
- set: (uri) => `${uri}index.html`,
35
+ behavior: {
36
+ rewrite: {
37
+ set: (uri) => `${uri}index.html`,
38
+ },
33
39
  },
34
40
  },
35
41
  {
36
42
  name: 'Redirect to index.html for Subpaths',
37
43
  match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*',
38
- rewrite: {
39
- set: (uri) => `${uri}/index.html`,
44
+ behavior: {
45
+ rewrite: {
46
+ set: (uri) => `${uri}/index.html`,
47
+ },
40
48
  },
41
49
  },
42
50
  ],
@@ -10,9 +10,11 @@ const AzionConfig = {
10
10
  {
11
11
  name: 'Set Storage Origin for All Requests',
12
12
  match: '^\\/',
13
- setOrigin: {
14
- name: 'origin-storage-default',
15
- type: 'object_storage',
13
+ behavior: {
14
+ setOrigin: {
15
+ name: 'origin-storage-default',
16
+ type: 'object_storage',
17
+ },
16
18
  },
17
19
  },
18
20
  ],
@@ -10,33 +10,41 @@ const AzionConfig = {
10
10
  {
11
11
  name: 'Set Storage Origin for All Requests',
12
12
  match: '^\\/',
13
- setOrigin: {
14
- name: 'origin-storage-default',
15
- type: 'object_storage',
13
+ behavior: {
14
+ setOrigin: {
15
+ name: 'origin-storage-default',
16
+ type: 'object_storage',
17
+ },
16
18
  },
17
19
  },
18
20
  {
19
21
  name: 'Deliver Static Assets',
20
22
  match:
21
23
  '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$',
22
- setOrigin: {
23
- name: 'origin-storage-default',
24
- type: 'object_storage',
24
+ behavior: {
25
+ setOrigin: {
26
+ name: 'origin-storage-default',
27
+ type: 'object_storage',
28
+ },
29
+ deliver: true,
25
30
  },
26
- deliver: true,
27
31
  },
28
32
  {
29
33
  name: 'Redirect to index.html',
30
34
  match: '.*/$',
31
- rewrite: {
32
- set: (uri) => `${uri}index.html`,
35
+ behavior: {
36
+ rewrite: {
37
+ set: (uri) => `${uri}index.html`,
38
+ },
33
39
  },
34
40
  },
35
41
  {
36
42
  name: 'Redirect to index.html for Subpaths',
37
43
  match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*',
38
- rewrite: {
39
- set: (uri) => `${uri}/index.html`,
44
+ behavior: {
45
+ rewrite: {
46
+ set: (uri) => `${uri}/index.html`,
47
+ },
40
48
  },
41
49
  },
42
50
  ],
@@ -4,8 +4,10 @@ const AzionConfig = {
4
4
  {
5
5
  name: 'Execute Edge Function',
6
6
  match: '^\\/',
7
- runFunction: {
8
- path: '.edge/worker.js',
7
+ behavior: {
8
+ runFunction: {
9
+ path: '.edge/worker.js',
10
+ },
9
11
  },
10
12
  },
11
13
  ],
@@ -10,33 +10,41 @@ const AzionConfig = {
10
10
  {
11
11
  name: 'Set Storage Origin for All Requests',
12
12
  match: '^\\/',
13
- setOrigin: {
14
- name: 'origin-storage-default',
15
- type: 'object_storage',
13
+ behavior: {
14
+ setOrigin: {
15
+ name: 'origin-storage-default',
16
+ type: 'object_storage',
17
+ },
16
18
  },
17
19
  },
18
20
  {
19
21
  name: 'Deliver Static Assets',
20
22
  match:
21
23
  '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$',
22
- setOrigin: {
23
- name: 'origin-storage-default',
24
- type: 'object_storage',
24
+ behavior: {
25
+ setOrigin: {
26
+ name: 'origin-storage-default',
27
+ type: 'object_storage',
28
+ },
29
+ deliver: true,
25
30
  },
26
- deliver: true,
27
31
  },
28
32
  {
29
33
  name: 'Redirect to index.html',
30
34
  match: '.*/$',
31
- rewrite: {
32
- set: (uri) => `${uri}index.html`,
35
+ behavior: {
36
+ rewrite: {
37
+ set: (uri) => `${uri}index.html`,
38
+ },
33
39
  },
34
40
  },
35
41
  {
36
42
  name: 'Redirect to index.html for Subpaths',
37
43
  match: '^(?!.*\\/$)(?![\\s\\S]*\\.[a-zA-Z0-9]+$).*',
38
- rewrite: {
39
- set: (uri) => `${uri}/index.html`,
44
+ behavior: {
45
+ rewrite: {
46
+ set: (uri) => `${uri}/index.html`,
47
+ },
40
48
  },
41
49
  },
42
50
  ],
@@ -10,29 +10,35 @@ const AzionConfig = {
10
10
  {
11
11
  name: 'Set Storage Origin for All Requests',
12
12
  match: '^\\/_next\\/static\\/', // starts with '/_next/static/'
13
- setOrigin: {
14
- name: 'origin-storage-default',
15
- type: 'object_storage',
13
+ behavior: {
14
+ setOrigin: {
15
+ name: 'origin-storage-default',
16
+ type: 'object_storage',
17
+ },
18
+ deliver: true,
16
19
  },
17
- deliver: true,
18
20
  },
19
21
  {
20
22
  name: 'Deliver Static Assets',
21
23
  match:
22
24
  '.(css|js|ttf|woff|woff2|pdf|svg|jpg|jpeg|gif|bmp|png|ico|mp4|json|xml|html)$',
23
- setOrigin: {
24
- name: 'origin-storage-default',
25
- type: 'object_storage',
25
+ behavior: {
26
+ setOrigin: {
27
+ name: 'origin-storage-default',
28
+ type: 'object_storage',
29
+ },
30
+ deliver: true,
26
31
  },
27
- deliver: true,
28
32
  },
29
33
  {
30
34
  name: 'Execute Edge Function',
31
35
  match: '^/',
32
- runFunction: {
33
- path: '.edge/worker.js',
36
+ behavior: {
37
+ runFunction: {
38
+ path: '.edge/worker.js',
39
+ },
40
+ forwardCookies: true,
34
41
  },
35
- forwardCookies: true,
36
42
  },
37
43
  ],
38
44
  },