edge-functions 2.8.1 → 2.9.0-stage.2
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 +26 -0
- package/lib/build/dispatcher/dispatcher.js +74 -60
- package/lib/build/dispatcher/dispatcher.test.js +4 -0
- package/lib/build/dispatcher/helpers/helpers.js +20 -13
- package/lib/commands/build.commands.js +11 -2
- package/lib/constants/messages/build.messages.js +2 -1
- package/lib/main.js +1 -0
- package/lib/presets/angular/deliver/azion.config.js +15 -10
- package/lib/presets/astro/deliver/azion.config.js +19 -11
- package/lib/presets/eleventy/deliver/azion.config.js +19 -11
- package/lib/presets/emscripten/compute/azion.config.js +4 -2
- package/lib/presets/gatsby/deliver/azion.config.js +19 -11
- package/lib/presets/hexo/deliver/azion.config.js +19 -11
- package/lib/presets/html/deliver/azion.config.js +5 -3
- package/lib/presets/hugo/deliver/azion.config.js +19 -11
- package/lib/presets/javascript/compute/azion.config.js +4 -2
- package/lib/presets/jekyll/deliver/azion.config.js +19 -11
- package/lib/presets/next/compute/azion.config.js +17 -11
- package/lib/presets/next/deliver/azion.config.js +19 -11
- package/lib/presets/react/deliver/azion.config.js +15 -10
- package/lib/presets/rustwasm/compute/azion.config.js +4 -2
- package/lib/presets/svelte/deliver/azion.config.js +19 -11
- package/lib/presets/typescript/compute/azion.config.js +4 -2
- package/lib/presets/vue/deliver/azion.config.js +15 -11
- package/lib/utils/generateManifest/generateManifest.utils.js +65 -128
- package/lib/utils/generateManifest/generateManifest.utils.test.js +652 -56
- package/lib/utils/generateManifest/helpers/azion.config.example.js +263 -0
- package/lib/utils/generateManifest/helpers/behaviors.js +249 -0
- package/lib/utils/generateManifest/helpers/convertLegacyConfig.js +72 -0
- package/lib/utils/generateManifest/helpers/schema.js +591 -0
- package/package.json +3 -3
- package/lib/utils/generateManifest/fixtures/azion.config.js +0 -59
- package/lib/utils/generateManifest/fixtures/schema.js +0 -352
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
## [2.9.0-stage.2](https://github.com/aziontech/vulcan/compare/v2.9.0-stage.1...v2.9.0-stage.2) (2024-06-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* 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))
|
|
7
|
+
|
|
8
|
+
## [2.9.0-stage.1](https://github.com/aziontech/vulcan/compare/v2.8.1...v2.9.0-stage.1) (2024-06-13)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add capture_match_groups rule ([e5a9238](https://github.com/aziontech/vulcan/commit/e5a9238215759c536a43da519542f9bf5184694c))
|
|
14
|
+
* add optional 'variable' field (azion.config) ([71e7184](https://github.com/aziontech/vulcan/commit/71e7184e052c239cb3d6116dc76216d56a3d64d2))
|
|
15
|
+
* expand azion.config.js field support ([#340](https://github.com/aziontech/vulcan/issues/340)) ([266f257](https://github.com/aziontech/vulcan/commit/266f25743417ca57fdfbfd1667cceb0906d1cb95))
|
|
16
|
+
* flag to build manifest only and skip other steps ([08201ce](https://github.com/aziontech/vulcan/commit/08201ceb81420a75f4d26f57b5d0555f886bc963))
|
|
17
|
+
* request phase gzip field ([ac84e82](https://github.com/aziontech/vulcan/commit/ac84e82e93b33963c17d7f64e75ed49eed285eb2))
|
|
18
|
+
* request phase redirects + bypass cache ([f49d8f5](https://github.com/aziontech/vulcan/commit/f49d8f59168c829990de4f08573bd154ecde2079))
|
|
19
|
+
* support response phase in manifest ([5ee8717](https://github.com/aziontech/vulcan/commit/5ee8717804ac0004ea3c87c324956e589d5bbc92))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* request or response are required ([8c8ca7e](https://github.com/aziontech/vulcan/commit/8c8ca7e06ef391a2cfee2998ce54a38ea245d906))
|
|
25
|
+
* response phase criteria ([c85ef9f](https://github.com/aziontech/vulcan/commit/c85ef9f4ed9968e03a8668dcb11af2b34578b805))
|
|
26
|
+
|
|
1
27
|
### [2.8.1](https://github.com/aziontech/vulcan/compare/v2.8.0...v2.8.1) (2024-06-07)
|
|
2
28
|
|
|
3
29
|
|
|
@@ -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;
|
|
@@ -469,86 +480,88 @@ class Dispatcher {
|
|
|
469
480
|
|
|
470
481
|
/**
|
|
471
482
|
* Run the build process.
|
|
483
|
+
* @param {boolean} processOnlyManifst - Boolean for Skip build and process just the manifest
|
|
472
484
|
*/
|
|
473
|
-
async run() {
|
|
485
|
+
async run(processOnlyManifst) {
|
|
474
486
|
let buildEntryTemp;
|
|
475
487
|
try {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
488
|
+
if (!processOnlyManifst) {
|
|
489
|
+
await Dispatcher.checkNodeModules();
|
|
490
|
+
|
|
491
|
+
// Load files from preset
|
|
492
|
+
const { handler, prebuild, config, postbuild } =
|
|
493
|
+
await this.loadPreset();
|
|
494
|
+
const buildConfig = Dispatcher.configureBuild(
|
|
495
|
+
{
|
|
496
|
+
localCustom: this.custom,
|
|
497
|
+
preset: this.preset,
|
|
498
|
+
useNodePolyfills: this.useNodePolyfills,
|
|
499
|
+
useOwnWorker: this.useOwnWorker,
|
|
500
|
+
memoryFS: this.memoryFS,
|
|
501
|
+
},
|
|
502
|
+
config,
|
|
503
|
+
);
|
|
504
|
+
buildEntryTemp = buildConfig.entry;
|
|
505
|
+
// temp entry
|
|
506
|
+
writeFileSync(buildConfig?.entry, handler);
|
|
493
507
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
508
|
+
const prebuildContext = await Dispatcher.runPrebuild(
|
|
509
|
+
{ handler, prebuild },
|
|
510
|
+
buildConfig,
|
|
511
|
+
);
|
|
512
|
+
const { codeToInjectInHandler, builderPlugins, defineVars } =
|
|
513
|
+
prebuildContext;
|
|
514
|
+
|
|
515
|
+
// inject code in handler (build is necessary to pull the modules,
|
|
516
|
+
// this is not a simples code append)
|
|
517
|
+
if (codeToInjectInHandler && codeToInjectInHandler.onEntry !== '') {
|
|
518
|
+
let entryContent = readFileSync(buildConfig?.entry, 'utf-8');
|
|
519
|
+
entryContent = `${codeToInjectInHandler.onEntry} ${entryContent}`;
|
|
520
|
+
entryContent = relocateImportsAndRequires(entryContent);
|
|
521
|
+
writeFileSync(buildConfig?.entry, entryContent);
|
|
522
|
+
}
|
|
509
523
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
524
|
+
// inject code banner
|
|
525
|
+
if (codeToInjectInHandler && codeToInjectInHandler.onBanner !== '') {
|
|
526
|
+
buildConfig.contentToInject = codeToInjectInHandler.onBanner;
|
|
527
|
+
}
|
|
514
528
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
529
|
+
if (builderPlugins) {
|
|
530
|
+
buildConfig.custom.plugins = buildConfig.custom.plugins
|
|
531
|
+
? [...buildConfig.custom.plugins, ...builderPlugins]
|
|
532
|
+
: builderPlugins;
|
|
533
|
+
}
|
|
520
534
|
|
|
521
|
-
|
|
535
|
+
Dispatcher.setVulcanLibAbsolutePath(buildConfig.entry);
|
|
522
536
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
537
|
+
// prebuildContext.defineVars
|
|
538
|
+
if (defineVars) {
|
|
539
|
+
buildConfig.defineVars = defineVars;
|
|
540
|
+
}
|
|
527
541
|
|
|
528
|
-
|
|
542
|
+
await Dispatcher.executeBuild(this.entry, this.builder, buildConfig);
|
|
529
543
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
544
|
+
if (postbuild) {
|
|
545
|
+
feedback.postbuild.info('Running postbuild actions...');
|
|
546
|
+
await postbuild(buildConfig);
|
|
547
|
+
}
|
|
533
548
|
}
|
|
534
|
-
|
|
535
549
|
// manifest
|
|
536
550
|
const azionConfigPath = await getAzionConfigPath();
|
|
537
551
|
const azionConfigAlreadyExists = !!azionConfigPath;
|
|
538
552
|
|
|
539
553
|
let configModule = null;
|
|
540
|
-
|
|
541
554
|
if (azionConfigAlreadyExists) {
|
|
542
555
|
const configModulePath = dirname(azionConfigPath);
|
|
556
|
+
const extension = extname(azionConfigPath);
|
|
543
557
|
configModule = await loadModule(
|
|
544
558
|
configModulePath,
|
|
545
559
|
'azion.config',
|
|
546
|
-
|
|
560
|
+
extension,
|
|
547
561
|
);
|
|
548
562
|
}
|
|
549
563
|
|
|
550
564
|
if (!azionConfigAlreadyExists) {
|
|
551
|
-
const useCommonJS = isCommonJS();
|
|
552
565
|
const presetAzionConfigPath = join(
|
|
553
566
|
this.vulcanLibPath,
|
|
554
567
|
'presets',
|
|
@@ -559,13 +572,14 @@ class Dispatcher {
|
|
|
559
572
|
configModule = await loadModule(
|
|
560
573
|
presetAzionConfigPath,
|
|
561
574
|
'azion.config',
|
|
562
|
-
|
|
575
|
+
'.js',
|
|
563
576
|
);
|
|
564
|
-
await createAzionConfigFile(
|
|
577
|
+
await createAzionConfigFile(isCommonJS(), configModule);
|
|
565
578
|
}
|
|
566
579
|
|
|
567
580
|
const outputPath = join(process.cwd(), '.edge');
|
|
568
581
|
await generateManifest(configModule, outputPath);
|
|
582
|
+
feedback.build.success(Messages.build.success.manifest_succeeded);
|
|
569
583
|
feedback.build.success(Messages.build.success.vulcan_build_succeeded);
|
|
570
584
|
} catch (error) {
|
|
571
585
|
if (existsSync(buildEntryTemp)) {
|
|
@@ -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
|
-
*
|
|
82
|
-
* @param {string} inputpath -
|
|
83
|
-
* @param {string} filename -
|
|
84
|
-
* @param {
|
|
85
|
-
* @returns {Promise<*>}
|
|
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,
|
|
88
|
-
const
|
|
88
|
+
async function loadModule(inputpath, filename, format) {
|
|
89
|
+
const modulePath = join(inputpath, `${filename}${format}`);
|
|
89
90
|
|
|
90
|
-
|
|
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,
|
|
154
|
+
writeFileSync(configPath, formattedContent);
|
|
148
155
|
}
|
|
149
156
|
}
|
|
150
157
|
|
|
@@ -65,6 +65,7 @@ function getPresetValue(
|
|
|
65
65
|
* @param {string} [options.mode] - Mode in which to run the build (e.g., 'deliver', 'compute').
|
|
66
66
|
* @param {boolean} [options.useNodePolyfills] - Whether to use Node.js polyfills.
|
|
67
67
|
* @param {boolean} [options.useOwnWorker] - 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.
|
|
68
|
+
* @param {boolean} [options.onlyManifest] - Skip build and process. just the manifest.
|
|
68
69
|
* @param {boolean} [isFirewall] - (Experimental) Enable isFirewall for local environment.
|
|
69
70
|
* @returns {Promise<void>} - A promise that resolves when the build is complete.
|
|
70
71
|
* @example
|
|
@@ -77,7 +78,15 @@ function getPresetValue(
|
|
|
77
78
|
* });
|
|
78
79
|
*/
|
|
79
80
|
async function buildCommand(
|
|
80
|
-
{
|
|
81
|
+
{
|
|
82
|
+
entry,
|
|
83
|
+
builder,
|
|
84
|
+
preset,
|
|
85
|
+
mode,
|
|
86
|
+
useNodePolyfills,
|
|
87
|
+
useOwnWorker,
|
|
88
|
+
onlyManifest,
|
|
89
|
+
},
|
|
81
90
|
isFirewall,
|
|
82
91
|
) {
|
|
83
92
|
const customConfigurationModule = await vulcan.loadVulcanConfigFile();
|
|
@@ -142,7 +151,7 @@ async function buildCommand(
|
|
|
142
151
|
const BuildDispatcher = (await import('#build')).default;
|
|
143
152
|
const buildDispatcher = new BuildDispatcher(config, undefined, isFirewall);
|
|
144
153
|
|
|
145
|
-
await buildDispatcher.run();
|
|
154
|
+
await buildDispatcher.run(onlyManifest);
|
|
146
155
|
}
|
|
147
156
|
|
|
148
157
|
export default buildCommand;
|
|
@@ -7,7 +7,8 @@ Build messages object.
|
|
|
7
7
|
const build = {
|
|
8
8
|
success: {
|
|
9
9
|
prebuild_succeeded: 'Prebuild succeeded!',
|
|
10
|
-
vulcan_build_succeeded: '
|
|
10
|
+
vulcan_build_succeeded: 'Build completed!',
|
|
11
|
+
manifest_succeeded: 'Manifest generated successfully!',
|
|
11
12
|
},
|
|
12
13
|
info: {
|
|
13
14
|
rebuilding: 'We are rebuilding with the new changes...',
|
package/lib/main.js
CHANGED
|
@@ -135,6 +135,7 @@ function startVulcanProgram() {
|
|
|
135
135
|
)
|
|
136
136
|
.option('--mode <type>', 'Mode of build target (e.g., deliver, compute)')
|
|
137
137
|
.option('--useNodePolyfills <boolean>', 'Use node polyfills in build.')
|
|
138
|
+
.option('--onlyManifest', 'Process just the azion.config.js')
|
|
138
139
|
.option(
|
|
139
140
|
'--useOwnWorker <boolean>',
|
|
140
141
|
'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.',
|
|
@@ -10,9 +10,11 @@ const AzionConfig = {
|
|
|
10
10
|
{
|
|
11
11
|
name: 'Set Storage Origin for All Requests',
|
|
12
12
|
match: '^\\/',
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
32
|
-
|
|
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
|
-
|
|
39
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
32
|
-
|
|
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
|
-
|
|
39
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
32
|
-
|
|
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
|
-
|
|
39
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
32
|
-
|
|
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
|
-
|
|
39
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
behavior: {
|
|
14
|
+
setOrigin: {
|
|
15
|
+
name: 'origin-storage-default',
|
|
16
|
+
type: 'object_storage',
|
|
17
|
+
},
|
|
16
18
|
},
|
|
17
19
|
},
|
|
18
20
|
],
|