edge-functions 5.0.0-stage.1 → 5.0.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
@@ -1,53 +1,37 @@
1
- # Azion Bundler - Building Applications for Azion Runtime
1
+ <p align="center">
2
+ <img src="assets/logo.png" alt="Azion Bundler Logo" width="200"/>
3
+ </p>
4
+
5
+ # Azion Bundler - The Edge Developer's Toolkit
6
+
7
+ [![Version](https://img.shields.io/npm/v/edge-functions.svg)](https://www.npmjs.com/package/edge-functions)
8
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md)
9
+ [![Downloads](https://img.shields.io/npm/dm/edge-functions.svg)](https://www.npmjs.com/package/edge-functions)
10
+ [![GitHub Stars](https://img.shields.io/github/stars/aziontech/bundler.svg)](https://github.com/aziontech/bundler/stargazers)
11
+ [![Maintainers](https://img.shields.io/badge/maintainers-jotanarciso,%20jcbsfilho-blue.svg)](https://github.com/aziontech/bundler/graphs/contributors)
12
+
13
+ Azion Bundler is a powerful tool designed to build and adapt projects for edge computing. It handles module resolution and applies necessary polyfills through [unjs/unenv](https://github.com/unjs/unenv) while providing an abstraction layer over popular bundlers like esbuild and webpack. The tool includes a local development environment for testing and debugging, and processes Infrastructure as Code (IaC) through its manifest system.
14
+
15
+ ## Table of Contents
16
+
17
+ - [Azion Bundler - The Edge Developer's Toolkit](#azion-bundler---the-edge-developers-toolkit)
18
+ - [Table of Contents](#table-of-contents)
19
+ - [Quick Installation](#quick-installation)
20
+ - [Getting Started for Development](#getting-started-for-development)
21
+ - [Using](#using)
22
+ - [Commands](#commands)
23
+ - [`build`](#build)
24
+ - [`dev`](#dev)
25
+ - [`store`](#store)
26
+ - [`presets`](#presets)
27
+ - [`manifest`](#manifest)
28
+ - [Configuration](#configuration)
29
+ - [Build Process Flow](#build-process-flow)
30
+ - [Documentation](#documentation)
31
+ - [Supported Features](#supported-features)
32
+ - [Contributing](#contributing)
33
+ - [License](#license)
2
34
 
3
- Azion Bundler is a powerful tool designed to streamline the development and deployment of JavaScript applications and frameworks. This powerful utility automates polyfills for Azion Runtime, significantly simplifying the process of creating Workers.
4
-
5
- One of the key highlights of Azion Bundler is its ability to establish an intuitive and efficient protocol for facilitating the creation of presets. This makes customization and adaptation to specific project needs even more accessible, providing developers with the necessary flexibility to optimize their applications effectively and efficiently.
6
-
7
- ## Supported
8
-
9
- E2E tests run daily in the [Bundler Examples](https://github.com/aziontech/bundler-examples/tree/main/examples) to ensure that the presets and frameworks continue to work correctly.
10
-
11
- Table:
12
- | Test | Status |
13
- | ------------------------------------ | ------ |
14
- | Next 14 2 15 Middleware | ⚠️ |
15
- | Next 13 5 6 I18n | ⚠️ |
16
- | Next 12 3 4 I18n | ⚠️ |
17
- | Hexo Static | ✅ |
18
- | Next 13 5 6 Middleware | ⚠️ |
19
- | Next 12 3 4 Middleware | ⚠️ |
20
- | Next Node Pages 12 3 1 | ⚠️ |
21
- | Next 13 5 6 Config | ⚠️ |
22
- | Next 12 3 4 Config | ⚠️ |
23
- | Next Static | ⚠️ |
24
- | Gatsby Static | ✅ |
25
- | Next Node Pages 12 3 1 Fs | ⚠️ |
26
- | Vue Vite Static | ✅ |
27
- | Next 12 Static | ⚠️ |
28
- | Astro Static | ✅ |
29
- | Qwik Static | ✅ |
30
- | Eleventy Static | ✅ |
31
- | Simple Js Env Vars | ✅ |
32
- | React Static | ✅ |
33
- | Angular Static | ✅ |
34
- | Svelte Static | ✅ |
35
- | Preact Static | ✅ |
36
- | Stencil Static | ✅ |
37
- | Simple Js Network List | ✅ |
38
- | Vitepress Static | ✅ |
39
- | Nuxt Static | ✅ |
40
- | Vuepress Static | ✅ |
41
- | Docusaurus Static | ✅ |
42
- | Simple Js Firewall Event | ✅ |
43
- | Jekyll Static | ✅ |
44
- | Simple Js Network List With Firewall | ✅ |
45
- | Simple Js Esm Worker | ✅ |
46
- | Simple Js Esm Node | ✅ |
47
- | Simple Ts Esm | ✅ |
48
- | Simple Js Esm | ✅ |
49
-
50
- Last test run date: 03/14/25 03:35:17 AM
51
35
  ## Quick Installation
52
36
 
53
37
  For those who just want to use Azion Bundler in their project without contributing to the development, you can install it directly from npm.
@@ -87,136 +71,211 @@ Follow these steps to start using Azion Bundler:
87
71
 
88
72
  This command sets up the necessary project structure and configuration files for Azion Bundler.
89
73
 
90
- 4. Start developing: Once the project is set up, you can start developing your JavaScript applications or frameworks using the power of Bundler. Leverage the automated polyfills, Worker creation assistance, and other features provided by Bundler to enhance your development workflow.
74
+ 4. Start developing: Once the project is set up, you can start developing your JavaScript applications or frameworks using the power of Bundler.
91
75
 
92
- ## Using Azion Bundler
76
+ ## Using
93
77
 
94
78
  See some examples below:
95
79
 
96
80
  - Build a JavaScript/Node project (back-end)
97
81
 
98
82
  ```shell
99
- azbundler build
83
+ ef build
100
84
  ```
101
85
 
102
86
  - Build a TypeScript/Node (back-end)
103
87
 
104
88
  ```shell
105
- azbundler build --preset typescript
89
+ ef build --preset typescript
106
90
  ```
107
91
 
108
92
  - Build a Next.js project
109
93
 
110
94
  ```shell
111
- azbundler build --preset next
95
+ ef build --preset next
112
96
  ```
113
97
 
114
98
  - Build Astro.js project
115
99
 
116
100
  ```shell
117
- azbundler build --preset astro
101
+ ef build --preset astro
118
102
  ```
119
103
 
120
104
  - Test your project locally (after build)
121
105
 
122
106
  ```shell
123
- azbundler dev
107
+ ef dev
124
108
  ```
125
109
 
126
- ## Azion.config.js
110
+ ## Commands
127
111
 
128
- The `azion.config.js` file offers a robust configuration system for Bundler. This file is not mandatory but acts as an override mechanism. If you define properties in this file, they will supersede the preset configurations. Properties not defined will rely on the preset.
112
+ The Azion Bundler CLI provides several commands to help you manage your edge applications:
129
113
 
130
- Here's a detailed breakdown of the configuration properties available in `azion.config.js`:
114
+ ### `build`
115
+ Builds your project for edge deployment.
131
116
 
132
- ### Entry
117
+ ```shell
118
+ ef build [options]
119
+
120
+ Options:
121
+ --entry <string> Code entrypoint (default: ./main.js or ./main.ts)
122
+ --preset <type> Preset of build target (e.g., vue, next, javascript)
123
+ --polyfills Use node polyfills in build (default: true)
124
+ --worker Enable worker mode with addEventListener signature (default: false)
125
+ --development Build in development mode (default: false)
126
+ ```
133
127
 
134
- **Type:** String
128
+ ### `dev`
129
+ Starts a local development environment.
135
130
 
136
- **Description:**
137
- This represents the primary entry point for your application, where the building process begins.
131
+ ```shell
132
+ ef dev [entry] [options]
138
133
 
139
- **Note:** `Entry` will be ignored for jamstack solutions.
134
+ Arguments:
135
+ entry Specify the entry file (default: .edge/worker.dev.js)
140
136
 
141
- ### Builder
137
+ Options:
138
+ -p, --port <port> Specify the port (default: "3333")
139
+ ```
142
140
 
143
- **Type:** String ('esbuild' or 'webpack')
141
+ ### `store`
142
+ Manages store configuration.
144
143
 
145
- **Description:**
146
- Defines which build tool to use. The available options are `esbuild` and `webpack`.
144
+ ```shell
145
+ ef store <command> [options]
146
+
147
+ Commands:
148
+ init Initialize store configuration
149
+ destroy Remove store configuration
150
+
151
+ Options:
152
+ --scope <scope> Project scope (default: "global")
153
+ --preset <string> Preset name
154
+ --entry <string> Code entrypoint
155
+ --bundler <type> Bundler type (webpack/esbuild)
156
+ --polyfills Use node polyfills in build
157
+ --worker Enable worker mode
158
+ ```
147
159
 
148
- ### Polyfills
160
+ ### `presets`
161
+ Lists available project presets.
149
162
 
150
- **Type:** Boolean
163
+ ```shell
164
+ ef presets <command>
151
165
 
152
- **Description:**
153
- Determines whether Node.js polyfills should be applied. This is useful for projects that leverage specific Node.js functionality but target environments without these built-in features.
166
+ Commands:
167
+ ls List all available presets
168
+ ```
154
169
 
155
- ### Worker
170
+ ### `manifest`
171
+ Manages manifest files for Azion.
156
172
 
157
- **Type:** Boolean
173
+ ```shell
174
+ ef manifest [action] [options]
158
175
 
159
- **Description:**
160
- This flag indicates that the constructed code inserts its own worker expression, such as `addEventListener("fetch")`.
176
+ Arguments:
177
+ action Action to perform: "transform" (JSON to JS) or "generate" (config to manifest)
178
+ (default: "generate")
161
179
 
162
- ### Preset
180
+ Options:
181
+ --entry <path> Path to the input file or configuration file
182
+ --output <path> Output file/directory path
163
183
 
164
- **Type:** Object
184
+ Examples:
185
+ $ ef manifest transform --entry=manifest.json --output=azion.config.js
186
+ $ ef manifest generate --entry=azion.config.js --output=.edge
187
+ $ ef manifest --entry=azion.config.js --output=.edge
188
+ ```
165
189
 
166
- **Description:**
167
- Provides preset-specific configurations.
190
+ ## Configuration
168
191
 
169
- - **Name (Type: String):** Refers to the preset name, e.g., "vue" or "next"..
192
+ The configuration file (`azion.config.js` or `azion.config.ts`) offers a robust configuration system for Bundler. With Azion Bundler, you can extend configurations and leverage pre-configured framework presets for immediate use. The tool empowers users to create their own automations and extensions, making it highly customizable for specific project needs.
170
193
 
171
- ### MemoryFS
194
+ As the JavaScript engine powering the [Azion CLI](https://github.com/aziontech/azion), it seamlessly integrates with [Azion Libraries](https://github.com/aziontech/lib) to read presets and pre-configured bundler settings from `azion/bundler` and framework presets from `azion/presets`. The bundler follows a modular architecture with specialized modules like `@build`, `@prebuild`, and `@postbuild` through the `build` command.
172
195
 
173
- **Type:** Object
196
+ The configuration is divided into two main areas:
197
+ - The `build` property manages all bundler-related settings, including entry points, presets, and build configurations
198
+ - Other properties (like domain, origin, cache, rules) are related to Azion CDN and Edge Computing platform settings
174
199
 
175
- **Description:**
176
- Configurations related to the in-memory filesystem.
200
+ While these hooks are pre-configured in framework presets, you can customize them in your `azion.config.ts` to fit your specific needs. You can either create your own configuration from scratch or extend existing presets. Here's an example of extending the Next.js preset:
177
201
 
178
- - **InjectionDirs (Type: Array of Strings):** Directories to be injected into memory for runtime access via the fs API.
202
+ ```typescript
203
+ import { defineConfig } from 'azion';
204
+ import type { AzionPrebuildResult, AzionConfig } from 'azion/config';
205
+ import { Next } from 'azion/presets';
179
206
 
180
- - **RemovePathPrefix (Type: String):** A prefix path to be removed from files before injecting into memory.
207
+ export default defineConfig({
208
+ build: {
209
+ preset: {
210
+ ...Next,
211
+ config: {
212
+ ...Next.config,
213
+ bundler: 'esbuild',
214
+ extend: (config) => {
215
+ config.define = {
216
+ ...config.define,
217
+ 'global.customFeature': 'JSON.stringify(true)',
218
+ 'process.env.CUSTOM_VAR': 'JSON.stringify("value")'
219
+ }
220
+ return config
221
+ }
222
+ },
223
+ prebuild: async (config: AzionConfig, ctx: BuildContext): Promise<AzionPrebuildResult> => {
224
+ // Your custom prebuild logic here
225
+ const result = await doSomething();
226
+ return {
227
+ ...result,
228
+ // Additional prebuild configurations
229
+ }
230
+ }
231
+ }
232
+ }
233
+ });
234
+ ```
181
235
 
182
- ### Custom
236
+ ## Build Process Flow
183
237
 
184
- **Type:** Object
238
+ 1. **Preset Resolution** (`@modules/preset`)
239
+ - Resolves preset from string name or custom module
240
+ - Loads built-in presets from azion/presets
241
+ - Validates preset interface
185
242
 
186
- **Description:**
187
- Allows you to extend the capabilities of the chosen bundler (either `webpack` or `esbuild`) with custom plugins or configurations.
243
+ 2. **Build Config Setup** (`@modules/config`)
244
+ - Resolves configuration priorities in the following order:
245
+ 1. CLI arguments (highest priority)
246
+ 2. User config file (`azion.config.js`)
247
+ 3. Local store settings
248
+ 4. Preset defaults (lowest priority)
249
+ - Sets up bundler configuration
250
+ - Configures build options and extensions
188
251
 
189
- - **Plugins (Type: Object):** Add your custom plugins for your chosen bundler here.
252
+ 3. **Entry Resolution** (`@modules/entrypoint`)
253
+ - Resolves entry point from CLI args, preset, or user config (azion.config.js)
254
+ - Validates file existence
190
255
 
191
- ### Example Configuration
256
+ 4. **Worker Setup** (`@modules/worker`)
257
+ - Converts ESM exports to worker format
258
+ - Injects worker runtime and globals
259
+ - Sets up event listeners
192
260
 
193
- For a Next/Faststore-based project:
261
+ 5. **Prebuild Phase** (`@modules/prebuild`)
262
+ - Executes preset's prebuild hooks
194
263
 
195
- ```javascript
196
- module.exports = {
197
- build: {
198
- entry: 'src/index.js',
199
- builder: 'webpack',
200
- polyfills: true,
201
- worker: false,
202
- preset: { name: 'next' },
203
- memoryFS: {
204
- injectionDirs: ['.faststore/@generated/graphql'],
205
- removePathPrefix: '.faststore/',
206
- },
207
- custom: {
208
- plugins: {},
209
- },
210
- }
211
- };
212
- ```
264
+ 6. **Core Build** (`@modules/core`)
265
+ - Processes bundler configuration (esbuild/webpack)
266
+ - Handles file imports and dependencies
267
+ - Applies polyfills and transformations
268
+
269
+ 7. **Postbuild Phase** (`@modules/postbuild`)
270
+ - Executes preset's postbuild hooks
213
271
 
214
- **Note:** Adapting `azion.config.js` to your setup allows a personalized development experience, catering to the specific needs of your JavaScript applications and frameworks.
272
+ 8. **Environment Setup** (`@modules/environment`)
273
+ - Creates initial `azion.config.js` from preset if none exists
274
+ - Merges configurations (user config takes precedence over preset defaults)
275
+ - Stores build settings locally for development and subsequent builds
215
276
 
216
- ## Docs
277
+ ## Documentation
217
278
 
218
- - [Overview](docs/overview.md)
219
- - [Presets](docs/presets.md)
220
279
  - [Nextjs](docs/nextjs.md)
221
280
  - [Rust/Wasm example](https://github.com/aziontech/vulcan-examples/tree/main/examples/rust-wasm-yew-ssr/)
222
281
  - [Emscripten/Wasm example](https://github.com/aziontech/vulcan-examples/tree/main/examples/emscripten-wasm/)
@@ -224,44 +283,55 @@ module.exports = {
224
283
  - [Storage example](https://github.com/aziontech/vulcan-examples/tree/main/examples/javascript/simple-js-esm-storage)
225
284
  - [Firewall example](https://github.com/aziontech/vulcan-examples/tree/main/examples/javascript/simple-js-firewall-event)
226
285
 
227
- ## Wasm Notes
228
-
229
- To use wasm presets you need to install the necessary tools to build your code:
230
-
231
- - Emscripten: [emsdk](https://emscripten.org/docs/getting_started/downloads.html);
232
- - Rust/Wasm: [wasm-bindgen-cli](https://crates.io/crates/wasm-bindgen-cli)
233
-
234
- ## Node.js Support and Report
235
-
236
- The compatibility between Azion Runtime and Node.js is an ongoing task, but a set of Node Runtime APIs are listed and compatible with Azion Runtime.
237
-
238
- - [Node.js APIs support](docs/nodejs-apis.md)
239
-
240
- ## Development
241
-
242
- To compile the project, run the following command:
286
+ ## Supported Features
243
287
 
244
- ```shell
245
- yarn build
246
- ```
247
-
248
- To run the Bundler commands, use the following command:
249
-
250
- ```shell
251
- yarn link
288
+ E2E tests run daily in the [Bundler Examples](https://github.com/aziontech/bundler-examples/tree/main/examples) to ensure that the presets and frameworks continue to work correctly.
252
289
 
253
- azbundler --help
290
+ Table:
291
+ | Test | Status |
292
+ | ------------------------------------ | ------ |
293
+ | Next 14 2 15 Middleware | ✅ |
294
+ | Next 13 5 6 I18n | ✅ |
295
+ | Next 12 3 4 I18n | ✅ |
296
+ | Hexo Static | ✅ |
297
+ | Next 13 5 6 Middleware | ✅ |
298
+ | Next 12 3 4 Middleware | ✅ |
299
+ | Next Node Pages 12 3 1 | ✅ |
300
+ | Next 13 5 6 Config | ✅ |
301
+ | Next 12 3 4 Config | ✅ |
302
+ | Next Static | ✅ |
303
+ | Gatsby Static | ✅ |
304
+ | Next Node Pages 12 3 1 Fs | ⚠️ |
305
+ | Vue Vite Static | ✅ |
306
+ | Next 12 Static | ⚠️ |
307
+ | Astro Static | ✅ |
308
+ | Qwik Static | ✅ |
309
+ | Eleventy Static | ✅ |
310
+ | Simple Js Env Vars | ⚠️ |
311
+ | React Static | ✅ |
312
+ | Angular Static | ✅ |
313
+ | Svelte Static | ✅ |
314
+ | Preact Static | ✅ |
315
+ | Stencil Static | ✅ |
316
+ | Simple Js Network List | ⚠️ |
317
+ | Vitepress Static | ⚠️ |
318
+ | Nuxt Static | ✅ |
319
+ | Vuepress Static | ✅ |
320
+ | Docusaurus Static | ✅ |
321
+ | Simple Js Firewall Event | ⚠️ |
322
+ | Jekyll Static | ✅ |
323
+ | Simple Js Network List With Firewall | ⚠️ |
324
+ | Simple Js Esm Worker | ⚠️ |
325
+ | Simple Js Esm Node | ⚠️ |
326
+ | Simple Ts Esm | ⚠️ |
327
+ | Simple Js Esm | ⚠️ |
254
328
 
255
- ```
329
+ Last test run date: 03/14/25 03:35:17 AM
256
330
 
257
331
  ## Contributing
258
332
 
259
333
  Check the [Contributing doc](CONTRIBUTING.md).
260
334
 
261
- ## Code of Conduct
262
-
263
- Check the [Code of Conduct](CODE_OF_CONDUCT.md).
264
-
265
335
  ## License
266
336
 
267
337
  [MIT](LICENSE.md)
@@ -366,6 +366,7 @@ var setupBuildConfig = (azionConfig, preset) => {
366
366
  const buildConfigSetup = {
367
367
  ...azionConfig.build,
368
368
  entry: join2(process.cwd(), tempFile),
369
+ bundler: azionConfig.build?.bundler || preset.config.build?.bundler || "esbuild",
369
370
  preset,
370
371
  setup: {
371
372
  contentToInject: void 0,
@@ -593,10 +594,7 @@ ${memoryFiles}`;
593
594
  };
594
595
  };
595
596
 
596
- // lib/commands/build/modules/core/core.ts
597
- import fsPromises3 from "fs/promises";
598
-
599
- // lib/commands/build/modules/core/bundler-execute/index.ts
597
+ // lib/commands/build/modules/core/bundlers/index.ts
600
598
  import {
601
599
  createAzionESBuildConfig,
602
600
  executeESBuildBuild,
@@ -615,7 +613,7 @@ var executeESBuildBuildWrapper = async (esbuildConfig) => {
615
613
  var executeWebpackBuildWrapper = async (webpackConfig) => {
616
614
  return executeWebpackBuild(webpackConfig);
617
615
  };
618
- var bundler_execute_default = {
616
+ var bundlers_default = {
619
617
  createAzionESBuildConfigWrapper,
620
618
  createAzionWebpackConfigWrapper,
621
619
  executeESBuildBuildWrapper,
@@ -642,7 +640,7 @@ ${newCode.trim()}`;
642
640
  };
643
641
 
644
642
  // lib/commands/build/modules/core/core.ts
645
- import fs5 from "fs";
643
+ import fsPromises3 from "fs/promises";
646
644
  var injectHybridFsPolyfill = (code, buildConfig, ctx) => {
647
645
  if (buildConfig.polyfills && ctx.production) {
648
646
  return `import SRC_NODE_FS from "node:fs";
@@ -661,10 +659,11 @@ var executeBuild = async ({
661
659
  buildConfig.entry,
662
660
  "utf-8"
663
661
  );
664
- const filesContent = prebuildResult.filesToInject.reduce(
665
- (accumulator, filePath) => `${accumulator} ${fs5.readFileSync(filePath, "utf-8")}`,
666
- " "
662
+ const filesContentPromises = prebuildResult.filesToInject.map(
663
+ (filePath) => fsPromises3.readFile(filePath, "utf-8")
667
664
  );
665
+ const filesContentArray = await Promise.all(filesContentPromises);
666
+ const filesContent = filesContentArray.join(" ");
668
667
  const contentWithInjection = `${filesContent} ${entryContent}`;
669
668
  const contentWithTopLevelImports = moveImportsToTopLevel(contentWithInjection);
670
669
  await fsPromises3.writeFile(buildConfig.entry, contentWithTopLevelImports);
@@ -679,32 +678,36 @@ var executeBuild = async ({
679
678
  )
680
679
  }
681
680
  };
682
- const bundler = buildConfig.bundler;
681
+ const { bundler } = buildConfig;
683
682
  switch (bundler) {
684
683
  case "esbuild": {
685
- const esbuildConfig = bundler_execute_default.createAzionESBuildConfigWrapper(
684
+ const esbuildConfig = bundlers_default.createAzionESBuildConfigWrapper(
686
685
  bundlerConfig,
687
686
  ctx
688
687
  );
689
- await bundler_execute_default.executeESBuildBuildWrapper(esbuildConfig);
688
+ await bundlers_default.executeESBuildBuildWrapper(esbuildConfig);
690
689
  break;
691
690
  }
692
691
  case "webpack": {
693
- const webpackConfig = bundler_execute_default.createAzionWebpackConfigWrapper(
692
+ const webpackConfig = bundlers_default.createAzionWebpackConfigWrapper(
694
693
  bundlerConfig,
695
694
  ctx
696
695
  );
697
- await bundler_execute_default.executeWebpackBuildWrapper(webpackConfig);
696
+ await bundlers_default.executeWebpackBuildWrapper(webpackConfig);
698
697
  break;
699
698
  }
700
699
  default:
701
700
  throw new Error(`Unsupported bundler: ${bundler}`);
702
701
  }
703
- let bundledCode = "";
704
- if (ctx.production === true) {
705
- bundledCode = await fsPromises3.readFile(ctx.output, "utf-8");
706
- bundledCode = injectHybridFsPolyfill(bundledCode, buildConfig, ctx);
707
- await fsPromises3.writeFile(ctx.output, bundledCode);
702
+ const bundledCode = await fsPromises3.readFile(ctx.output, "utf-8");
703
+ if (ctx.production) {
704
+ const bundledCodeWithHybridFsPolyfill = injectHybridFsPolyfill(
705
+ bundledCode,
706
+ buildConfig,
707
+ ctx
708
+ );
709
+ await fsPromises3.writeFile(ctx.output, bundledCodeWithHybridFsPolyfill);
710
+ return bundledCodeWithHybridFsPolyfill;
708
711
  }
709
712
  return bundledCode;
710
713
  } catch (error) {
@@ -884,10 +887,10 @@ var resolveEntrypoint = async ({
884
887
  "azion",
885
888
  "packages",
886
889
  "presets",
887
- "src",
890
+ "dist",
888
891
  "presets",
889
892
  preset.metadata.name,
890
- "handler.ts"
893
+ "handler.js"
891
894
  );
892
895
  utilsNode2.feedback.build.info(
893
896
  `Using built-in handler from "${preset.metadata.name}" preset.`
@@ -971,7 +974,7 @@ async function buildCommand(options) {
971
974
  inputValue: void 0,
972
975
  fileValue: userBuildConfig?.bundler,
973
976
  storeValue: bundlerStore?.bundler,
974
- defaultValue: "esbuild"
977
+ defaultValue: void 0
975
978
  }),
976
979
  polyfills: resolveConfigPriority({
977
980
  inputValue: userBuildConfig?.polyfills,
@@ -1006,7 +1009,7 @@ async function buildCommand(options) {
1006
1009
 
1007
1010
  // lib/env/server.ts
1008
1011
  import { runServer } from "edge-runtime";
1009
- import fs6 from "fs/promises";
1012
+ import fs5 from "fs/promises";
1010
1013
  var currentServer;
1011
1014
  var isChangeHandlerRunning = false;
1012
1015
  var checkAndChangeAddEventListener = (eventTarget, newEvent, code, replaceCode = true) => {
@@ -1055,8 +1058,8 @@ function checkPortAvailability(port) {
1055
1058
  }
1056
1059
  async function readWorkerFile(filePath) {
1057
1060
  try {
1058
- await fs6.access(filePath);
1059
- return await fs6.readFile(filePath, "utf8");
1061
+ await fs5.access(filePath);
1062
+ return await fs5.readFile(filePath, "utf8");
1060
1063
  } catch (error) {
1061
1064
  const errorMessage = error.message.includes("ENOENT") ? "File does not exist." : `An error occurred while reading the ${filePath} file.`;
1062
1065
  throw new Error(errorMessage);
@@ -2,7 +2,7 @@ import {
2
2
  buildCommand,
3
3
  bundler_default,
4
4
  writeStore
5
- } from "./chunk-ACWSA73O.js";
5
+ } from "./chunk-3227WMCF.js";
6
6
  import {
7
7
  debug
8
8
  } from "./chunk-GVUH3USH.js";
@@ -14,7 +14,7 @@ async function devCommand({
14
14
  port
15
15
  }) {
16
16
  const parsedPort = parseInt(port, 10);
17
- const { server } = await import("./env-LSTI67LB.js");
17
+ const { server } = await import("./env-S5T4OJLE.js");
18
18
  const edgeDir = join(process.cwd(), ".edge");
19
19
  const devWorkerPath = join(edgeDir, "worker.dev.js");
20
20
  const entryPoint = entry || devWorkerPath;
@@ -6,7 +6,7 @@ import {
6
6
  server_default,
7
7
  writeStore,
8
8
  writeUserConfig
9
- } from "./chunk-ACWSA73O.js";
9
+ } from "./chunk-3227WMCF.js";
10
10
  import "./chunk-GVUH3USH.js";
11
11
  export {
12
12
  env_default as default,
package/dist/main.js CHANGED
@@ -90,7 +90,7 @@ function setupBundlerProcessHandlers() {
90
90
  function startBundler() {
91
91
  AzionBundler.version(BUNDLER_CURRENT_VERSION);
92
92
  AzionBundler.command("store <command>").description("Manage store configuration (init/destroy)").option("--scope <scope>", "Project scope", "global").option("--preset <string>", "Preset name").option("--entry <string>", "Code entrypoint").option("--bundler <type>", "Bundler type (webpack/esbuild)").option("--polyfills [boolean]", "Use node polyfills in build").option("--worker [boolean]", "Indicates worker expression").action(async (command, options) => {
93
- const { storeCommand } = await import("./commands-LW4LOJNI.js");
93
+ const { storeCommand } = await import("./commands-TBH7MDI3.js");
94
94
  await storeCommand({ command, options });
95
95
  });
96
96
  AzionBundler.command("build").description("Build a project for edge deployment").option(
@@ -106,7 +106,7 @@ function startBundler() {
106
106
  "--worker [boolean]",
107
107
  "Indicates that the constructed code inserts its own worker expression. Use --worker or --worker=true to enable, --worker=false to disable"
108
108
  ).option("--development", "Build in development mode", false).action(async (options) => {
109
- const { buildCommand, manifestCommand } = await import("./commands-LW4LOJNI.js");
109
+ const { buildCommand, manifestCommand } = await import("./commands-TBH7MDI3.js");
110
110
  const { config } = await buildCommand({
111
111
  ...options,
112
112
  production: !options.development
@@ -117,11 +117,11 @@ function startBundler() {
117
117
  "[entry]",
118
118
  "Specify the entry file (default: .edge/worker.dev.js)"
119
119
  ).option("-p, --port <port>", "Specify the port", "3333").action(async (entry, options) => {
120
- const { devCommand } = await import("./commands-LW4LOJNI.js");
120
+ const { devCommand } = await import("./commands-TBH7MDI3.js");
121
121
  await devCommand({ entry, ...options });
122
122
  });
123
123
  AzionBundler.command("presets <command>").description("List <ls> defined project presets for Azion").action(async (command) => {
124
- const { presetsCommand } = await import("./commands-LW4LOJNI.js");
124
+ const { presetsCommand } = await import("./commands-TBH7MDI3.js");
125
125
  await presetsCommand(command);
126
126
  });
127
127
  AzionBundler.command("manifest [action]").description(
@@ -139,7 +139,7 @@ Examples:
139
139
  $ az manifest --entry=azion.config.js --output=.edge
140
140
  `
141
141
  ).action(async (action, options) => {
142
- const { manifestCommand } = await import("./commands-LW4LOJNI.js");
142
+ const { manifestCommand } = await import("./commands-TBH7MDI3.js");
143
143
  await manifestCommand({
144
144
  ...options,
145
145
  action
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edge-functions",
3
- "version": "5.0.0-stage.1",
3
+ "version": "5.0.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",
@@ -28,7 +28,7 @@
28
28
  "test:e2e": "yarn e2e:start && NODE_OPTIONS='--experimental-vm-modules' jest --maxWorkers 1 --config=./jest-e2e.config.js tests/e2e/ --json --outputFile e2e_results.json && yarn e2e:stop; yarn task:reports",
29
29
  "test:nodejs-apis": "yarn e2e:start && NODE_OPTIONS='--experimental-vm-modules' jest --maxWorkers 1 --config=./jest-e2e.config.js tests/nodejs-apis/ --json --outputFile nodejs_apis_results.json && yarn e2e:stop && yarn task:reports-nodejs-apis",
30
30
  "prepare": "husky install",
31
- "submodule:update": "git submodule update --init --recursive && git submodule foreach git pull origin chore/update-config-azion"
31
+ "submodule:update": "git submodule update --init --recursive && git submodule foreach git pull origin main"
32
32
  },
33
33
  "author": "aziontech",
34
34
  "contributors": [
@@ -43,7 +43,7 @@
43
43
  "license": "MIT",
44
44
  "dependencies": {
45
45
  "@netlify/framework-info": "^9.9.1",
46
- "azion": "~1.17.0-stage.6",
46
+ "azion": "~1.17.3",
47
47
  "chokidar": "^3.5.3",
48
48
  "commander": "^10.0.1",
49
49
  "edge-runtime": "^2.4.5",
@@ -72,6 +72,7 @@
72
72
  "clean-jsdoc-theme": "^4.2.9",
73
73
  "conventional-changelog-conventionalcommits": "^4.6.0",
74
74
  "eslint": "^8.57.0",
75
+ "globals": "^16.0.0",
75
76
  "husky": "^8.0.3",
76
77
  "jest": "^29.7.0",
77
78
  "jest-puppeteer": "^9.0.1",