edge-functions 4.4.2 → 4.5.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 +14 -0
- package/docs/nodejs-apis.md +1 -1
- package/lib/presets/qwik/azion.config.js +5 -0
- package/lib/presets/qwik/config.js +10 -0
- package/lib/presets/qwik/handler.js +17 -0
- package/lib/presets/qwik/prebuild.js +52 -0
- package/lib/utils/presets/presets.utils.test.js +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [4.5.0](https://github.com/aziontech/bundler/compare/v4.4.2...v4.5.0) (2025-01-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* new preset qwik ([#424](https://github.com/aziontech/bundler/issues/424)) ([7386214](https://github.com/aziontech/bundler/commit/7386214a1fa15fc39835524ec108bd4a2e42c7ca))
|
|
7
|
+
|
|
8
|
+
## [4.5.0-stage.1](https://github.com/aziontech/bundler/compare/v4.4.2...v4.5.0-stage.1) (2025-01-24)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* new preset qwik ([#424](https://github.com/aziontech/bundler/issues/424)) ([7386214](https://github.com/aziontech/bundler/commit/7386214a1fa15fc39835524ec108bd4a2e42c7ca))
|
|
14
|
+
|
|
1
15
|
### [4.4.2](https://github.com/aziontech/bundler/compare/v4.4.1...v4.4.2) (2025-01-21)
|
|
2
16
|
|
|
3
17
|
|
package/docs/nodejs-apis.md
CHANGED
|
@@ -51,7 +51,7 @@ Table:
|
|
|
51
51
|
| Fs | ✅ |
|
|
52
52
|
| Async Hooks | ✅ |
|
|
53
53
|
|
|
54
|
-
Last test run date: 01/
|
|
54
|
+
Last test run date: 01/30/25 03:54:42 AM
|
|
55
55
|
#### Docs support
|
|
56
56
|
|
|
57
57
|
See support for the Node.js APIs in the [https://www.azion.com/en/documentation/products/azion-edge-runtime/compatibility/node/](https://www.azion.com/en/documentation/products/azion-edge-runtime/compatibility/node/)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { mountMPA } from 'azion/utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Handles the 'fetch' event.
|
|
5
|
+
* @param {import('azion/types').FetchEvent} event - The fetch event.
|
|
6
|
+
* @returns {Promise<Response>} The response for the request.
|
|
7
|
+
*/
|
|
8
|
+
async function handler(event) {
|
|
9
|
+
try {
|
|
10
|
+
const myApp = await mountMPA(event.request.url);
|
|
11
|
+
return myApp;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
return new Response('Not Found', { status: 404 });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default handler;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { access, readFile, rm } from 'fs/promises';
|
|
2
|
+
import { exec, getPackageManager, copyDirectory } from '#utils';
|
|
3
|
+
|
|
4
|
+
const packageManager = await getPackageManager();
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Checks if a given file exists
|
|
8
|
+
* @param {string} filePath Path of the file to be checked
|
|
9
|
+
* @returns {boolean} Determines whenever the file exists or not
|
|
10
|
+
*/
|
|
11
|
+
async function fileExists(filePath) {
|
|
12
|
+
try {
|
|
13
|
+
await access(filePath);
|
|
14
|
+
return true;
|
|
15
|
+
} catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Runs custom prebuild actions
|
|
22
|
+
*/
|
|
23
|
+
async function prebuild() {
|
|
24
|
+
const newOutDir = '.edge/storage';
|
|
25
|
+
const adapterConfig = '/adapters/static/vite.config.ts';
|
|
26
|
+
let outDir = 'dist';
|
|
27
|
+
|
|
28
|
+
// Check if the project has a custom adapter configuration
|
|
29
|
+
if (await fileExists(adapterConfig)) {
|
|
30
|
+
// Check if an output path is specified in config file
|
|
31
|
+
const configFileContent = await readFile(adapterConfig, 'utf-8');
|
|
32
|
+
const attributeMatch = Array.from(
|
|
33
|
+
configFileContent.matchAll(/outDir:(.*)\n/g),
|
|
34
|
+
(match) => match,
|
|
35
|
+
)[0];
|
|
36
|
+
|
|
37
|
+
if (attributeMatch) {
|
|
38
|
+
// Get the specified value from the config file
|
|
39
|
+
outDir = attributeMatch[1].trim();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Build the project
|
|
44
|
+
await exec(`${packageManager} run build`, 'Qwik', true);
|
|
45
|
+
|
|
46
|
+
// Move files to the bundler path
|
|
47
|
+
copyDirectory(outDir, newOutDir);
|
|
48
|
+
|
|
49
|
+
rm(outDir, { recursive: true, force: true });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default prebuild;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edge-functions",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.5.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": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"ajv-errors": "^3.0.0",
|
|
56
56
|
"ajv-keywords": "^5.1.0",
|
|
57
57
|
"assert": "^2.0.0",
|
|
58
|
-
"azion": "^1.
|
|
58
|
+
"azion": "^1.13.1",
|
|
59
59
|
"babel-loader": "^9.2.1",
|
|
60
60
|
"bottleneck": "^2.19.5",
|
|
61
61
|
"browserify-zlib": "^0.2.0",
|