edge-functions 6.0.0 → 6.1.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/README.md CHANGED
@@ -157,13 +157,13 @@ Commands:
157
157
  delete Delete configuration properties
158
158
 
159
159
  Options:
160
- -k, --key <key> Property key (e.g., build.preset or edgeApplications[0].name)
160
+ -k, --key <key> Property key (e.g., build.preset or applications[0].name)
161
161
  -v, --value <value> Value to be set (for create/update commands)
162
162
  -a, --all Read or delete entire configuration (for read/delete commands)
163
163
 
164
164
  Examples:
165
165
  $ ef config create -k "build.preset" -v "typescript"
166
- $ ef config read -k "edgeApplications[0].name"
166
+ $ ef config read -k "applications[0].name"
167
167
  $ ef config update -k "build.bundler" -v "esbuild"
168
168
  $ ef config delete -k "build.polyfills"
169
169
  $ ef config read --all
@@ -356,43 +356,43 @@ E2E tests run daily in the [Bundler Examples](https://github.com/aziontech/bundl
356
356
  Table:
357
357
  | Test | Status |
358
358
  | ------------------------------------ | ------ |
359
- | Next 14 2 15 Middleware | ⚠️ |
360
- | Next 13 5 6 I18n | ⚠️ |
361
- | Next 12 3 4 I18n | ⚠️ |
362
- | Hexo Static | ⚠️ |
363
- | Next 13 5 6 Middleware | ⚠️ |
364
- | Next 12 3 4 Middleware | ⚠️ |
365
- | Next Node Pages 12 3 1 | ⚠️ |
366
- | Next 13 5 6 Config | ⚠️ |
367
- | Next 12 3 4 Config | ⚠️ |
368
- | Next Static | ⚠️ |
369
- | Gatsby Static | ⚠️ |
370
- | Next Node Pages 12 3 1 Fs | ⚠️ |
371
- | Vue Vite Static | ⚠️ |
372
- | Next 12 Static | ⚠️ |
373
- | Astro Static | ⚠️ |
374
- | Qwik Static | ⚠️ |
375
- | Simple Js Env Vars | ⚠️ |
376
- | Eleventy Static | ⚠️ |
359
+ | Next 14 2 15 Middleware | |
360
+ | Next 13 5 6 I18n | |
361
+ | Next 12 3 4 I18n | |
362
+ | Hexo Static | |
363
+ | Next 13 5 6 Middleware | |
364
+ | Next 12 3 4 Middleware | |
365
+ | Next Node Pages 12 3 1 | |
366
+ | Next 13 5 6 Config | |
367
+ | Next 12 3 4 Config | |
368
+ | Next Static | |
369
+ | Gatsby Static | |
370
+ | Next Node Pages 12 3 1 Fs | |
371
+ | Vue Vite Static | |
372
+ | Next 12 Static | |
373
+ | Astro Static | |
374
+ | Qwik Static | |
375
+ | Simple Js Env Vars | |
376
+ | Eleventy Static | |
377
377
  | Simple Js Network List | ⚠️ |
378
- | Angular Static | ⚠️ |
379
- | React Static | ⚠️ |
380
- | Svelte Static | ⚠️ |
381
- | Stencil Static | ⚠️ |
382
- | Vitepress Static | ⚠️ |
383
- | Preact Static | ⚠️ |
384
- | Vuepress Static | ⚠️ |
385
- | Nuxt Static | ⚠️ |
386
- | Docusaurus Static | ⚠️ |
387
- | Simple Js Firewall Event | ⚠️ |
378
+ | Angular Static | |
379
+ | React Static | |
380
+ | Svelte Static | |
381
+ | Stencil Static | |
382
+ | Vitepress Static | |
383
+ | Preact Static | |
384
+ | Vuepress Static | |
385
+ | Nuxt Static | |
386
+ | Docusaurus Static | |
387
+ | Simple Js Firewall Event | |
388
388
  | Simple Js Network List With Firewall | ⚠️ |
389
- | Jekyll Static | ⚠️ |
390
- | Simple Js Esm Worker | ⚠️ |
391
- | Simple Js Esm Node | ⚠️ |
392
- | Simple Ts Esm | ⚠️ |
393
- | Simple Js Esm | ⚠️ |
389
+ | Jekyll Static | |
390
+ | Simple Js Esm Worker | |
391
+ | Simple Js Esm Node | |
392
+ | Simple Ts Esm | |
393
+ | Simple Js Esm | |
394
394
 
395
- Last test run date: 08/19/25 03:14:09 AM
395
+ Last test run date: 09/01/25 03:38:29 AM
396
396
 
397
397
  ## Contributing
398
398
 
@@ -1381,16 +1381,16 @@ var injectBindingsIntoFile = async (func, bucketsSetup, isProduction) => {
1381
1381
  debug.info(`Function ${func.name} does not have storage bindings`);
1382
1382
  return;
1383
1383
  }
1384
- const edgeFunctionsPath = resolveFunctionPath(
1384
+ const functionsPath = resolveFunctionPath(
1385
1385
  func.path.replace(/\.js$/, isProduction ? ".js" : ".dev.js")
1386
1386
  );
1387
- if (!await fileExists(edgeFunctionsPath)) {
1388
- feedback4.bindings.warn(`Function file not found: ${edgeFunctionsPath}.`);
1387
+ if (!await fileExists(functionsPath)) {
1388
+ feedback4.bindings.warn(`Function file not found: ${functionsPath}.`);
1389
1389
  feedback4.bindings.info(`Binding injection skipped for function ${func.name}`);
1390
1390
  return;
1391
1391
  }
1392
1392
  try {
1393
- const entryContent = await fsPromises5.readFile(edgeFunctionsPath, "utf-8");
1393
+ const entryContent = await fsPromises5.readFile(functionsPath, "utf-8");
1394
1394
  if (entryContent.includes("//storages:") || entryContent.includes("//---")) {
1395
1395
  debug.info(`Function ${func.name} already has injected bindings`);
1396
1396
  return;
@@ -1415,8 +1415,8 @@ var injectBindingsIntoFile = async (func, bucketsSetup, isProduction) => {
1415
1415
  debug.info(`Generated binding template for ${func.name}: ${bindingTemplate}`);
1416
1416
  const contentWithBindings = `${bindingTemplate}
1417
1417
  ${entryContent}`;
1418
- await fsPromises5.writeFile(edgeFunctionsPath, contentWithBindings);
1419
- debug.info(`Bindings injected into ${edgeFunctionsPath} for function ${func.name}`);
1418
+ await fsPromises5.writeFile(functionsPath, contentWithBindings);
1419
+ debug.info(`Bindings injected into ${functionsPath} for function ${func.name}`);
1420
1420
  } catch (error) {
1421
1421
  debug.error(`Failed to process bindings for function ${func.name}:`, error);
1422
1422
  throw error;
@@ -1428,7 +1428,7 @@ var setupBindings = async ({
1428
1428
  isProduction
1429
1429
  }) => {
1430
1430
  try {
1431
- const functions = config.edgeFunctions || [];
1431
+ const functions = config.functions || [];
1432
1432
  if (functions.length === 0) {
1433
1433
  debug.info("No functions found to inject bindings");
1434
1434
  return;
@@ -1545,7 +1545,7 @@ var validateStorageConfig = (storage) => {
1545
1545
  };
1546
1546
  var setupStorage = async ({ config }) => {
1547
1547
  try {
1548
- const storages = config.edgeStorage || [];
1548
+ const storages = config.storage || [];
1549
1549
  const processedStorages = [];
1550
1550
  if (storages.length === 0) {
1551
1551
  debug.info("No storages found to setup");
@@ -1560,7 +1560,7 @@ var setupStorage = async ({ config }) => {
1560
1560
  if (!await directoryExists(sourceDir)) {
1561
1561
  throw new Error(
1562
1562
  `Storage directory not found: ${sourceDir}.
1563
- - Please check the path provided in the azion.config file on edgeStorage[].dir`
1563
+ - Please check the path provided in the azion.config file on storage[].dir`
1564
1564
  );
1565
1565
  }
1566
1566
  const providedPrefix = storage.prefix;
@@ -1796,9 +1796,9 @@ async function initializeServer(port, workerCode) {
1796
1796
  const execution = runtime_default(initialCode, isFirewallEvent);
1797
1797
  return runServer({ port, host: "0.0.0.0", runtime: execution });
1798
1798
  }
1799
- function setCurrentBucketName(edgeFunction, config) {
1800
- const bucketName = edgeFunction?.bindings?.storage?.bucket || config?.edgeStorage?.[0].name || "";
1801
- const prefix = edgeFunction?.bindings?.storage?.prefix || config?.edgeStorage?.[0].prefix || "";
1799
+ function setCurrentBucketName(runtimeFunction, config) {
1800
+ const bucketName = runtimeFunction?.bindings?.storage?.bucket || config?.storage?.[0].name || "";
1801
+ const prefix = runtimeFunction?.bindings?.storage?.prefix || config?.storage?.[0].prefix || "";
1802
1802
  return { bucketName, prefix };
1803
1803
  }
1804
1804
  function findEntryPathForFunction(entries, functionName, targetFunctionPath) {
@@ -1819,7 +1819,7 @@ function defineCurrentFunction(entries, config, functionName) {
1819
1819
  throw new Error("No entries provided");
1820
1820
  }
1821
1821
  if (functionName) {
1822
- const targetFunction = config.edgeFunctions?.find((f) => f.name === functionName);
1822
+ const targetFunction = config.functions?.find((f) => f.name === functionName);
1823
1823
  if (!targetFunction) {
1824
1824
  throw new Error(`Function "${functionName}" not found in edge functions configuration`);
1825
1825
  }
@@ -1833,7 +1833,7 @@ function defineCurrentFunction(entries, config, functionName) {
1833
1833
  };
1834
1834
  }
1835
1835
  const entryPath = Object.keys(entries)[0];
1836
- const defaultFunction = config.edgeFunctions?.[0];
1836
+ const defaultFunction = config.functions?.[0];
1837
1837
  const bucketName = setCurrentBucketName(defaultFunction, config);
1838
1838
  return {
1839
1839
  name: defaultFunction?.name,
@@ -1849,7 +1849,7 @@ async function manageServer(workerPath, port, skipFrameworkBuild = false, functi
1849
1849
  }
1850
1850
  const {
1851
1851
  setup: { entry },
1852
- config: { edgeFunctions, edgeStorage }
1852
+ config: { functions, storage }
1853
1853
  } = await buildCommand({ production: false, skipFrameworkBuild });
1854
1854
  let workerCode;
1855
1855
  try {
@@ -1857,7 +1857,7 @@ async function manageServer(workerPath, port, skipFrameworkBuild = false, functi
1857
1857
  path: finalPath,
1858
1858
  bucket,
1859
1859
  prefix
1860
- } = defineCurrentFunction(entry, { edgeFunctions, edgeStorage }, functionName);
1860
+ } = defineCurrentFunction(entry, { functions, storage }, functionName);
1861
1861
  globalThis.AZION_BUCKET_NAME = bucket;
1862
1862
  globalThis.AZION_BUCKET_PREFIX = prefix;
1863
1863
  workerCode = await readWorkerFile(finalPath);
@@ -7,7 +7,7 @@ import {
7
7
  readAzionConfig,
8
8
  writeStore,
9
9
  writeUserConfig
10
- } from "./chunk-IHOEJARI.js";
10
+ } from "./chunk-VFS4TJYC.js";
11
11
 
12
12
  // lib/commands/dev/command.ts
13
13
  async function devCommand({
@@ -17,7 +17,7 @@ async function devCommand({
17
17
  functionName
18
18
  }) {
19
19
  const parsedPort = parseInt(port, 10);
20
- const { server } = await import("./env-TY2DPD5S.js");
20
+ const { server } = await import("./env-APUAS3VL.js");
21
21
  const entryPoint = entry || null;
22
22
  server(entryPoint, parsedPort, skipFrameworkBuild, functionName);
23
23
  }
@@ -6,7 +6,7 @@ import {
6
6
  server_default,
7
7
  writeStore,
8
8
  writeUserConfig
9
- } from "./chunk-IHOEJARI.js";
9
+ } from "./chunk-VFS4TJYC.js";
10
10
  export {
11
11
  env_default as default,
12
12
  readAzionConfig,
package/dist/main.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  BUNDLER,
4
4
  debug,
5
5
  executeCleanup
6
- } from "./chunk-IHOEJARI.js";
6
+ } from "./chunk-VFS4TJYC.js";
7
7
 
8
8
  // lib/main.ts
9
9
  import { Command } from "commander";
@@ -70,7 +70,7 @@ function setupBundlerProcessHandlers() {
70
70
  function startBundler() {
71
71
  AzionBundler.version(globalThis.bundler.version);
72
72
  AzionBundler.command("store <command>").description("Manage store configuration").option("-c, --config <json>", `Configuration in JSON format (e.g., '{"key": "value"}')`).option("-s, --scope <scope>", "Scope of the store (default: global)").action(async (command, options) => {
73
- const { storeCommand } = await import("./commands-YEJQLZ4H.js");
73
+ const { storeCommand } = await import("./commands-QK6LAWEK.js");
74
74
  await storeCommand({
75
75
  command,
76
76
  options
@@ -92,7 +92,7 @@ Examples:
92
92
  $ ef build --preset opennextjs --skip-framework-build
93
93
  `
94
94
  ).action(async (options) => {
95
- const { buildCommand, manifestCommand } = await import("./commands-YEJQLZ4H.js");
95
+ const { buildCommand, manifestCommand } = await import("./commands-QK6LAWEK.js");
96
96
  const { dev, experimental, ...buildOptions } = options;
97
97
  if (experimental) globalThis.bundler.experimental = true;
98
98
  const { config } = await buildCommand({
@@ -102,13 +102,13 @@ Examples:
102
102
  await manifestCommand({ action: "generate", config });
103
103
  });
104
104
  AzionBundler.command("dev").description("Start local development environment").argument("[entry]", "Specify the entry file (default: .edge/worker.dev.js)").option("-p, --port <port>", "Specify the port", "3333").option("-x, --experimental [boolean]", "Enable experimental features", false).option("--skip-framework-build", "Skip framework build step", false).option("--function-name <name>", "Specify the function name").action(async (entry, options) => {
105
- const { devCommand } = await import("./commands-YEJQLZ4H.js");
105
+ const { devCommand } = await import("./commands-QK6LAWEK.js");
106
106
  const { experimental } = options;
107
107
  if (experimental) globalThis.bundler.experimental = true;
108
108
  await devCommand({ entry, ...options });
109
109
  });
110
110
  AzionBundler.command("presets <command>").description("Manage presets for Azion projects").argument("[preset]", "Preset name (required for config command)").action(async (command, preset) => {
111
- const { presetsCommand } = await import("./commands-YEJQLZ4H.js");
111
+ const { presetsCommand } = await import("./commands-QK6LAWEK.js");
112
112
  await presetsCommand(command, { preset });
113
113
  });
114
114
  AzionBundler.command("manifest [action]").description("Manage manifest files for Azion").argument(
@@ -124,13 +124,13 @@ Examples:
124
124
  $ ef manifest -e azion.config.js -o .edge
125
125
  `
126
126
  ).action(async (action, options) => {
127
- const { manifestCommand } = await import("./commands-YEJQLZ4H.js");
127
+ const { manifestCommand } = await import("./commands-QK6LAWEK.js");
128
128
  await manifestCommand({
129
129
  ...options,
130
130
  action
131
131
  });
132
132
  });
133
- AzionBundler.command("config <command>").description("Manage azion.config settings").option("-k, --key <key...>", "Property key (e.g., build.preset or edgeApplications[0].name)").option("-v, --value <value...>", "Value to be set").option("-a, --all", "Read or delete entire configuration (for read/delete commands)").addHelpText(
133
+ AzionBundler.command("config <command>").description("Manage azion.config settings").option("-k, --key <key...>", "Property key (e.g., build.preset or applications[0].name)").option("-v, --value <value...>", "Value to be set").option("-a, --all", "Read or delete entire configuration (for read/delete commands)").addHelpText(
134
134
  "after",
135
135
  `
136
136
  Examples:
@@ -143,7 +143,7 @@ Examples:
143
143
  $ ef config replace -k '$EDGE_FUNCTION_NAME' -v "my-func"
144
144
  `
145
145
  ).action(async (command, options) => {
146
- const { configCommand } = await import("./commands-YEJQLZ4H.js");
146
+ const { configCommand } = await import("./commands-QK6LAWEK.js");
147
147
  await configCommand({
148
148
  command,
149
149
  options
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edge-functions",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "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.",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/main.ts",
@@ -44,7 +44,7 @@
44
44
  "dependencies": {
45
45
  "@edge-runtime/primitives": "4.0.5",
46
46
  "@netlify/framework-info": "^9.9.1",
47
- "azion": "~2.0.0",
47
+ "azion": "~2.1.0",
48
48
  "chokidar": "^3.5.3",
49
49
  "commander": "^10.0.1",
50
50
  "cosmiconfig": "^9.0.0",