edge-functions 4.3.0 → 4.4.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
+ ## [4.4.0](https://github.com/aziontech/bundler/compare/v4.3.0...v4.4.0) (2025-01-21)
2
+
3
+
4
+ ### Features
5
+
6
+ * transform json manifest into js command ([#417](https://github.com/aziontech/bundler/issues/417)) ([391b30d](https://github.com/aziontech/bundler/commit/391b30df01114aa0da55630e23147a6f9cfe797e))
7
+
8
+ ## [4.4.0-stage.1](https://github.com/aziontech/bundler/compare/v4.3.0...v4.4.0-stage.1) (2025-01-13)
9
+
10
+
11
+ ### Features
12
+
13
+ * transform json manifest into js command ([#417](https://github.com/aziontech/bundler/issues/417)) ([391b30d](https://github.com/aziontech/bundler/commit/391b30df01114aa0da55630e23147a6f9cfe797e))
14
+
1
15
  ## [4.3.0](https://github.com/aziontech/bundler/compare/v4.2.1...v4.3.0) (2024-12-13)
2
16
 
3
17
 
@@ -51,7 +51,7 @@ Table:
51
51
  | Fs | ✅ |
52
52
  | Async Hooks | ✅ |
53
53
 
54
- Last test run date: 12/13/24 04:00:51 AM
54
+ Last test run date: 01/21/25 03:54:16 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/)
@@ -2,5 +2,12 @@ import buildCommand from './build.commands.js';
2
2
  import devCommand from './dev.commands.js';
3
3
  import initCommand from './init.commands.js';
4
4
  import presetsCommand from './presets.commands.js';
5
+ import manifestCommand from './manifest.commands.js';
5
6
 
6
- export { buildCommand, devCommand, initCommand, presetsCommand };
7
+ export {
8
+ buildCommand,
9
+ devCommand,
10
+ initCommand,
11
+ presetsCommand,
12
+ manifestCommand,
13
+ };
@@ -0,0 +1,68 @@
1
+ import { readFileSync, writeFileSync } from 'fs';
2
+ import { resolve, extname } from 'path';
3
+ import { feedback, debug } from '#utils';
4
+ import { Messages } from '#constants';
5
+ import { convertJsonConfigToObject } from 'azion';
6
+
7
+ import { Commands } from '#namespaces';
8
+ /**
9
+ * @function manifestCommand
10
+ * @memberof Commands
11
+ * @description
12
+ * transforms a JSON manifest file to a JavaScript module.
13
+ *
14
+ * Usage:
15
+ * ```bash
16
+ * az manifest transform <input.json> -o <output.js>
17
+ * ```
18
+ *
19
+ * Example:
20
+ * ```bash
21
+ * az manifest transform .edge/manifest.json -o azion.config.js
22
+ * ```
23
+ * @param {string} command - The operation to perform (only 'transform' for now)
24
+ * @param {string} entry - Path to the input JSON file
25
+ * @param {object} options - Command options
26
+ * @param {string} options.output - Output file path for JS module
27
+ */
28
+ async function manifestCommand(command, entry, options) {
29
+ try {
30
+ if (command !== 'transform') {
31
+ feedback.error('Only transform command is supported');
32
+ process.exit(1);
33
+ }
34
+
35
+ if (!entry) {
36
+ feedback.error('Input file path is required');
37
+ process.exit(1);
38
+ }
39
+
40
+ if (!options.output) {
41
+ feedback.error('Output file path is required (--output)');
42
+ process.exit(1);
43
+ }
44
+
45
+ const fileExtension = extname(entry).toLowerCase();
46
+ if (fileExtension !== '.json') {
47
+ feedback.error('Input file must be .json');
48
+ process.exit(1);
49
+ }
50
+
51
+ const absolutePath = resolve(process.cwd(), entry);
52
+ const jsonString = readFileSync(absolutePath, 'utf8');
53
+ const config = convertJsonConfigToObject(jsonString);
54
+
55
+ const jsContent = `export default ${JSON.stringify(config, null, 2)};`;
56
+ writeFileSync(options.output, jsContent);
57
+
58
+ feedback.success(
59
+ `Azion Platform configuration transformed into JavaScript module at ${options.output}`,
60
+ );
61
+ } catch (error) {
62
+ debug.error(error);
63
+ feedback.error(Messages.errors.unknown_error);
64
+ process.exit(1);
65
+ }
66
+ }
67
+
68
+ export default manifestCommand;
package/lib/main.js CHANGED
@@ -219,13 +219,25 @@ function startVulcanProgram() {
219
219
  program
220
220
  .command('presets <command>')
221
221
  .description(
222
- 'Create <create> or list <ls> defined project presets for Edge',
222
+ 'Create <create> or list <ls> defined project presets for Azion',
223
223
  )
224
224
  .action(async (command) => {
225
225
  const { presetsCommand } = await import('#commands');
226
226
  await presetsCommand(command);
227
227
  });
228
228
 
229
+ program
230
+ .command('manifest <command>')
231
+ .description(
232
+ 'Trasnform <transform> or validate <validate> manifest files for Azion',
233
+ )
234
+ .argument('[entry]', 'Path to the input file')
235
+ .option('-o, --output <path>', 'Output file path for convert command')
236
+ .action(async (command, entry, options) => {
237
+ const { manifestCommand } = await import('#commands');
238
+ await manifestCommand(command, entry, convertOptions(options));
239
+ });
240
+
229
241
  program.parse(process.argv);
230
242
  }
231
243
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "edge-functions",
3
3
  "type": "module",
4
- "version": "4.3.0",
4
+ "version": "4.4.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.10.0",
58
+ "azion": "^1.12.0",
59
59
  "babel-loader": "^9.2.1",
60
60
  "bottleneck": "^2.19.5",
61
61
  "browserify-zlib": "^0.2.0",