2.6.2 • Published 8 days ago

edge-functions v2.6.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 days ago

Vulcan - Forging The Edge

vulcan

Vulcan is a powerful tool designed to streamline the development and deployment of JavaScript applications and frameworks. This powerful utility automates polyfills for Edge Computing, significantly simplifying the process of creating Workers, particularly for the Azion platform.

One of the key highlights of Vulcan 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.

Supported

E2E tests run daily in the Vulcan Examples to ensure that the presets and frameworks continue to work correctly.

Table:

TestStatus
Next 13 5 6 I18n
Next 12 3 4 I18n
Hexo Static
Next 13 5 6 Middleware
Next 12 3 4 Middleware
Next Node Pages 12 3 1
Next 13 5 6 Config
Next 12 3 4 Config
Next Static
Gatsby Static⚠️
Next Node Pages 12 3 1 Fs
Vue Vite Static
Next 12 Static
Simple Js Env Vars
Astro Static
Eleventy Static
React Static
Angular Static
Simple Js Network List
Simple Js Firewall Event
Simple Js Network List With Firewall
Simple Js Esm UseOwnWorker
Simple Js Esm Node
Simple Js Esm
Simple Ts Esm

Date of the last time the test was run: 4/7/2024

Quick Installation

For those who just want to use Vulcan in their project without contributing to the development, you can install it directly from npm.

npm install edge-functions

or if you prefer yarn:

yarn add edge-functions

Getting Started for Development

Follow these steps to start using Vulcan:

  1. Clone the repository: Clone the Vulcan repository from GitHub to your local machine.

    git clone https://github.com/aziontech/vulcan.git
  2. Installation: Navigate to the cloned Vulcan directory and install the required dependencies.

    cd vulcan
    npm install
  3. Install the Vulcan CLI globally, which allows you to use it as a command-line tool from anywhere in your system.

    npm install -g

    This command sets up the necessary project structure and configuration files for Vulcan.

  4. Start developing: Once the project is set up, you can start developing your JavaScript applications or frameworks using the power of Vulcan. Leverage the automated polyfills, Worker creation assistance, and other features provided by Vulcan to enhance your development workflow.

Using Vulcan

See some examples below:

  • Build a JavaScript/Node project (back-end)

    vulcan build
  • Build a TypeScript/Node (back-end)

    vulcan build --preset typescript
  • Build a Static Next.js project

    vulcan build --preset next --mode deliver
  • Build a Static Astro.js project

    vulcan build --preset astro --mode deliver
  • Test your project locally (after build)

    vulcan dev

Vulcan.config.js

The vulcan.config.js file offers a robust configuration system for Vulcan. 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.

Here's a detailed breakdown of the configuration properties available in vulcan.config.js:

Entry

Type: String

Description: This represents the primary entry point for your application, where the building process begins.

Note: Entry will be ignored for jamstack solutions.

Builder

Type: String ('esbuild' or 'webpack')

Description: Defines which build tool to use. The available options are esbuild and webpack.

UseNodePolyfills

Type: Boolean

Description: 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. The use of useNodePolyfills is ignored when used in mode deliver presets, as Node.js features must be resolved at build time by the framework process itself.

UseOwnWorker

Type: Boolean

Description: 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.

Preset

Type: Object

Description: Provides preset-specific configurations.

  • Name (Type: String): Refers to the preset name, e.g., "vue" or "next".
  • Mode (Type: String): Specifies the mode for the preset, e.g., "compute" or "deliver".

MemoryFS

Type: Object

Description: Configurations related to the in-memory filesystem.

  • InjectionDirs (Type: Array of Strings): Directories to be injected into memory for runtime access via the fs API.

  • RemovePathPrefix (Type: String): A prefix path to be removed from files before injecting into memory.

Custom

Type: Object

Description: Allows you to extend the capabilities of the chosen bundler (either webpack or esbuild) with custom plugins or configurations.

  • Plugins (Type: Object): Add your custom plugins for your chosen bundler here.

Example Configuration

For a Next/Faststore-based project:

module.exports = {
  entry: 'src/index.js',
  builder: 'webpack',
  useNodePolyfills: true,
  useOwnWorker: false,
  preset: {
    name: 'next',
    mode: 'compute',
  },
  memoryFS: {
    injectionDirs: ['.faststore/@generated/graphql'],
    removePathPrefix: '.faststore/',
  },
  custom: {
    plugins: {},
  },
};

Note: Adapting vulcan.config.js to your setup allows a personalized development experience, catering to the specific needs of your JavaScript applications and frameworks.

Docs

Wasm Notes

To use wasm presets you need to install the necessary tools to build your code:

Contributing

Check the Contributing doc.

Code of Conduct

Check the Code of Conduct.

License

MIT

2.6.2-stage.4

8 days ago

2.6.2

8 days ago

2.6.2-stage.3

11 days ago

2.6.2-stage.1

11 days ago

2.6.2-stage.2

11 days ago

2.6.1

11 days ago

2.6.0

12 days ago

2.6.1-stage.1

12 days ago

2.6.0-stage.21

12 days ago

2.6.0-stage.19

13 days ago

2.6.0-stage.18

13 days ago

2.6.0-stage.17

13 days ago

2.6.0-stage.20

13 days ago

2.6.0-stage.13

15 days ago

2.6.0-stage.16

14 days ago

2.6.0-stage.15

14 days ago

2.6.0-stage.14

15 days ago

2.6.0-stage.12

19 days ago

2.6.0-stage.11

29 days ago

2.6.0-stage.10

30 days ago

2.6.0-stage.9

1 month ago

2.6.0-stage.8

1 month ago

2.6.0-stage.6

1 month ago

2.6.0-stage.7

1 month ago

2.6.0-stage.5

2 months ago

2.6.0-stage.4

2 months ago

2.6.0-stage.3

2 months ago

2.6.0-stage.2

2 months ago

2.6.0-stage.1

2 months ago

2.5.0

2 months ago

2.5.0-stage.5

2 months ago

2.5.0-stage.4

2 months ago

2.5.0-stage.3

2 months ago

2.5.0-stage.2

2 months ago

2.5.0-stage.1

2 months ago

2.4.0

2 months ago

2.4.0-stage.5

3 months ago

2.4.0-stage.4

3 months ago

2.4.0-stage.3

3 months ago

2.4.0-stage.2

3 months ago

2.4.0-stage.1

3 months ago

2.3.0-stage.3

3 months ago

2.3.0

3 months ago

2.3.0-stage.2

3 months ago

2.3.0-stage.1

3 months ago

2.2.0

5 months ago

2.2.0-stage.4

5 months ago

2.2.0-stage.3

5 months ago

2.2.0-stage.2

5 months ago

2.1.0

5 months ago

2.1.0-stage.1

5 months ago

2.0.0

6 months ago

2.0.0-stage.2

6 months ago

2.0.0-stage.1

6 months ago

2.0.0-stage.3

6 months ago

2.2.0-stage.1

5 months ago

1.7.1-stage.1

7 months ago

1.6.4

8 months ago

1.7.0-stage.3

7 months ago

1.6.3

8 months ago

1.7.1

7 months ago

1.7.0-stage.2

8 months ago

1.6.2

8 months ago

1.7.0

8 months ago

1.7.0-stage.1

8 months ago

1.6.1

8 months ago

1.6.0

8 months ago

1.5.0

8 months ago

1.6.5

8 months ago

1.6.4-stage.2

8 months ago

1.6.4-stage.1

8 months ago

1.2.0

8 months ago

1.4.0

8 months ago

1.3.0

8 months ago

1.1.0

9 months ago

1.0.0

10 months ago

0.0.1

10 months ago