edge-functions 5.1.0 → 5.2.0-stage.1
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
|
@@ -111,6 +111,9 @@ See some examples below:
|
|
|
111
111
|
|
|
112
112
|
The Azion Bundler CLI provides several commands to help you manage your edge applications:
|
|
113
113
|
|
|
114
|
+
> ⚠️ \*Deprecation Notice:
|
|
115
|
+
> Support for the webpack bundler will be discontinued in future releases. While it is still available for now, new features, fixes, and improvements will be focused exclusively on esbuild. We recommend migrating to esbuild as soon as possible to ensure compatibility and better performance in upcoming versions.
|
|
116
|
+
|
|
114
117
|
### `build`
|
|
115
118
|
Builds your project for edge deployment.
|
|
116
119
|
|
|
@@ -18,7 +18,10 @@ import {
|
|
|
18
18
|
EnvVarsContext,
|
|
19
19
|
NetworkListContext,
|
|
20
20
|
fsContext,
|
|
21
|
-
FirewallEventContext
|
|
21
|
+
FirewallEventContext,
|
|
22
|
+
streamContext,
|
|
23
|
+
cryptoContext,
|
|
24
|
+
promisesContext
|
|
22
25
|
} from "azion/bundler/polyfills";
|
|
23
26
|
function runtime(code, isFirewallEvent = false) {
|
|
24
27
|
const extend = (context) => {
|
|
@@ -35,6 +38,10 @@ function runtime(code, isFirewallEvent = false) {
|
|
|
35
38
|
context.ENV_VARS_CONTEXT = EnvVarsContext;
|
|
36
39
|
context.NETWORK_LIST_CONTEXT = NetworkListContext;
|
|
37
40
|
context.FS_CONTEXT = fsContext;
|
|
41
|
+
context.STREAM_CONTEXT = streamContext;
|
|
42
|
+
context.CRYPTO_CONTEXT = cryptoContext;
|
|
43
|
+
context.Promise = Promise;
|
|
44
|
+
context.Promise.withResolvers = promisesContext;
|
|
38
45
|
return context;
|
|
39
46
|
};
|
|
40
47
|
const edgeRuntime = new EdgeRuntime({
|
|
@@ -330,29 +337,24 @@ var injectWorkerMemoryFiles = async ({
|
|
|
330
337
|
dirs
|
|
331
338
|
}) => {
|
|
332
339
|
const result = {};
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
Object.assign(result, subDirContent);
|
|
348
|
-
} else if (stats.isFile()) {
|
|
349
|
-
const bufferContent = await fsPromises.readFile(filePath);
|
|
350
|
-
let key = filePath;
|
|
351
|
-
if (!filePath.startsWith("/")) key = `/${filePath}`;
|
|
352
|
-
result[key] = { content: bufferContent.toString("base64") };
|
|
340
|
+
const processDirectory = async (currentDirs) => {
|
|
341
|
+
for (const dir of currentDirs) {
|
|
342
|
+
const files = await fsPromises.readdir(dir);
|
|
343
|
+
for (const file of files) {
|
|
344
|
+
const filePath = join4(dir, file);
|
|
345
|
+
const stats = await fsPromises.stat(filePath);
|
|
346
|
+
if (stats.isDirectory()) {
|
|
347
|
+
await processDirectory([filePath]);
|
|
348
|
+
} else if (stats.isFile()) {
|
|
349
|
+
const bufferContent = await fsPromises.readFile(filePath);
|
|
350
|
+
let key = filePath;
|
|
351
|
+
if (!filePath.startsWith("/")) key = `/${filePath}`;
|
|
352
|
+
result[key] = { content: bufferContent.toString("base64") };
|
|
353
|
+
}
|
|
353
354
|
}
|
|
354
355
|
}
|
|
355
|
-
}
|
|
356
|
+
};
|
|
357
|
+
await processDirectory(dirs);
|
|
356
358
|
return `globalThis.${namespace}.${property}=${JSON.stringify(result)};`;
|
|
357
359
|
};
|
|
358
360
|
var copyFilesToLocalEdgeStorage = async ({ dirs, prefix, outputPath }) => {
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
buildCommand,
|
|
3
3
|
bundler_default,
|
|
4
4
|
writeStore
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FMHRFHTZ.js";
|
|
6
6
|
import {
|
|
7
7
|
DOCS_MESSAGE,
|
|
8
8
|
debug
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
// lib/commands/dev/command.ts
|
|
12
12
|
async function devCommand({ entry, port }) {
|
|
13
13
|
const parsedPort = parseInt(port, 10);
|
|
14
|
-
const { server } = await import("./env-
|
|
14
|
+
const { server } = await import("./env-XHCWYPE4.js");
|
|
15
15
|
const entryPoint = entry || null;
|
|
16
16
|
server(entryPoint, parsedPort);
|
|
17
17
|
}
|
package/dist/main.js
CHANGED
|
@@ -71,7 +71,7 @@ function startBundler() {
|
|
|
71
71
|
AzionBundler.version(globalThis.bundler.version);
|
|
72
72
|
if (process.argv.length === 2) process.argv.push("build");
|
|
73
73
|
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) => {
|
|
74
|
-
const { storeCommand } = await import("./commands-
|
|
74
|
+
const { storeCommand } = await import("./commands-PYMXWFSU.js");
|
|
75
75
|
await storeCommand({ command, options });
|
|
76
76
|
});
|
|
77
77
|
AzionBundler.command("build").description("Build a project for edge deployment").option("--entry <entries...>", "Code entrypoint (default: ./main.js or ./main.ts)").option("--preset <type>", "Preset of build target (e.g., vue, next, javascript)").option(
|
|
@@ -81,7 +81,7 @@ function startBundler() {
|
|
|
81
81
|
"--worker [boolean]",
|
|
82
82
|
"Indicates that the constructed code inserts its own worker expression. Use --worker or --worker=true to enable, --worker=false to disable"
|
|
83
83
|
).option("--dev", "Build in development mode", false).option("--experimental [boolean]", "Enable experimental features", false).action(async (options) => {
|
|
84
|
-
const { buildCommand, manifestCommand } = await import("./commands-
|
|
84
|
+
const { buildCommand, manifestCommand } = await import("./commands-PYMXWFSU.js");
|
|
85
85
|
const { dev, experimental, ...buildOptions } = options;
|
|
86
86
|
if (experimental) globalThis.bundler.experimental = true;
|
|
87
87
|
const { config } = await buildCommand({
|
|
@@ -91,13 +91,13 @@ function startBundler() {
|
|
|
91
91
|
await manifestCommand({ action: "generate", config });
|
|
92
92
|
});
|
|
93
93
|
AzionBundler.command("dev").description("Start local environment").argument("[entry]", "Specify the entry file (default: .edge/worker.dev.js)").option("-p, --port <port>", "Specify the port", "3333").option("--experimental [boolean]", "Enable experimental features", false).action(async (entry, options) => {
|
|
94
|
-
const { devCommand } = await import("./commands-
|
|
94
|
+
const { devCommand } = await import("./commands-PYMXWFSU.js");
|
|
95
95
|
const { experimental } = options;
|
|
96
96
|
if (experimental) globalThis.bundler.experimental = true;
|
|
97
97
|
await devCommand({ entry, ...options });
|
|
98
98
|
});
|
|
99
99
|
AzionBundler.command("presets <command>").description("List <ls> defined project presets for Azion").action(async (command) => {
|
|
100
|
-
const { presetsCommand } = await import("./commands-
|
|
100
|
+
const { presetsCommand } = await import("./commands-PYMXWFSU.js");
|
|
101
101
|
await presetsCommand(command);
|
|
102
102
|
});
|
|
103
103
|
AzionBundler.command("manifest [action]").description("Manage manifest files for Azion. Available actions: transform, generate").argument(
|
|
@@ -113,7 +113,7 @@ Examples:
|
|
|
113
113
|
$ ef manifest --entry=azion.config.js --output=.edge
|
|
114
114
|
`
|
|
115
115
|
).action(async (action, options) => {
|
|
116
|
-
const { manifestCommand } = await import("./commands-
|
|
116
|
+
const { manifestCommand } = await import("./commands-PYMXWFSU.js");
|
|
117
117
|
await manifestCommand({
|
|
118
118
|
...options,
|
|
119
119
|
action
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edge-functions",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0-stage.1",
|
|
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
|
|
31
|
+
"submodule:update": "git submodule update --init --recursive && git submodule foreach git pull origin proposal/unenv2"
|
|
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.
|
|
46
|
+
"azion": "1.20.0-stage.1",
|
|
47
47
|
"chokidar": "^3.5.3",
|
|
48
48
|
"commander": "^10.0.1",
|
|
49
49
|
"cosmiconfig": "^9.0.0",
|