From e6de7bdda3703fa68d8f4cf191c8a64cc0a446b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gabriel=20Fran=C3=A7a?=
<119522814+gabriel-azion@users.noreply.github.com>
Date: Mon, 20 Nov 2023 14:10:43 -0300
Subject: [PATCH] [EDU-2609] feat: cells node compatibility (#451)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* add compatibility cells-node page
* adjustments
* remove duplicate
* cells-node compatibility
* Update src/content/docs/en/pages/devtools/azion-edge-runtime/compatibility/cells-node.mdx
Co-authored-by: hannah <109289700+hannah-sk@users.noreply.github.com>
* Update src/i18n/en/runtimeMenu.ts
* Update src/content/docs/en/pages/devtools/azion-edge-runtime/compatibility/cells-node.mdx
Co-authored-by: Mariana Bellorín Aguilera <89138244+MarianaAguilera@users.noreply.github.com>
---------
Co-authored-by: hannah <109289700+hannah-sk@users.noreply.github.com>
Co-authored-by: Mariana Bellorín Aguilera <89138244+MarianaAguilera@users.noreply.github.com>
---
.../compatibility/cells-node.mdx | 68 +++++++++++++++++++
src/i18n/en/runtimeMenu.ts | 9 ++-
src/i18n/en/ui.ts | 2 +
3 files changed, 76 insertions(+), 3 deletions(-)
create mode 100644 src/content/docs/en/pages/devtools/azion-edge-runtime/compatibility/cells-node.mdx
diff --git a/src/content/docs/en/pages/devtools/azion-edge-runtime/compatibility/cells-node.mdx b/src/content/docs/en/pages/devtools/azion-edge-runtime/compatibility/cells-node.mdx
new file mode 100644
index 0000000000..5463e4055a
--- /dev/null
+++ b/src/content/docs/en/pages/devtools/azion-edge-runtime/compatibility/cells-node.mdx
@@ -0,0 +1,68 @@
+---
+title: Azion Edge Runtime and Node.js compatibility
+description: Azion Edge Runtime and Node.js compatibility
+meta_tags: edge, javascript
+namespace: documentation_products_azion_runtime_node
+permalink: /documentation/products/azion-edge-runtime/compatibility/node/
+menu_namespace: runtimeMenu
+---
+
+import Button from '~/components/Button.astro'
+
+The compatibility between **Azion Edge Runtime** and **Node.js** is an ongoing task, but a set of Node Runtime APIs are listed and are compatible with Azion Edge Runtime.
+
+The compatibility is listed below:
+
+## Node built-in
+
+### [async_hooks](https://nodejs.org/api/async_hooks.html)
+
+**Supported**: 🟡 Partially supported
+
+**Comments**: only [AsyncLocalStorage](https://nodejs.org/api/async_context.html#class-asynclocalstorage) and [AsyncResource](https://nodejs.org/api/async_hooks.html#class-asyncresource) are implemented.
+
+**Example**:
+
+```javascript
+import { AsyncLocalStorage } from "node:async_hooks";
+
+const requestId = new AsyncLocalStorage();
+
+async function logAsyncContext(state) {
+ console.log(`${requestId.getStore()} - ${state}`);
+}
+
+async function doSomething() {
+ logAsyncContext("log from async function");
+ doSomethingElse();
+}
+
+async function doSomethingElse() {
+ logAsyncContext("log from another async function");
+}
+
+async function handleRequest(request) {
+ const id = request.headers.get("X-Request-Id");
+
+ return requestId.run(id, async () => {
+ doSomething();
+ logAsyncContext("log from yet another async function");
+ requestId.exit(async () => {
+ logAsyncContext("log from exit callback");
+ });
+ return new Response("ok");
+ });
+}
+
+addEventListener("fetch", (event) => {
+ event.respondWith(handleRequest(event.request));
+});
+```
+
+For additional compatibility information:
+
+
+
+
+
+
diff --git a/src/i18n/en/runtimeMenu.ts b/src/i18n/en/runtimeMenu.ts
index ec62e269b2..3fb43fb8c3 100644
--- a/src/i18n/en/runtimeMenu.ts
+++ b/src/i18n/en/runtimeMenu.ts
@@ -15,15 +15,18 @@
/// START HERE :::: DO NOT REMOVE the strings above, it's a work around for header on mobile ///
- { text: 'Overview', header: true, anchor: true, type: 'learn', key: 'overview', slug: '/documentation/products/edge-application/edge-functions/runtime/overview' },
+ { text: 'Overview', header: true, anchor: true, type: 'learn', key: 'overview', slug: '/documentation/products/edge-application/edge-functions/runtime/overview', hasLabel: 'menu.runtime' },
{ text: 'API Reference', header: true, type: 'learn', key: 'apiReference', children: [
{ text: 'Environment Variables', slug: '/documentation/products/edge-application/edge-functions/runtime/api-reference/environment-variables', key: 'runtime/variables' },
- { text: 'Web APIs', slug: '/documentation/products/edge-application/edge-functions/runtime-apis/javascript', key: 'runtime/web-standards' },
{ text: 'Metadata API', slug: '/documentation/products/edge-application/edge-functions/runtime/api-reference/metadata', key: 'runtime/metadata' },
{ text: 'Network List interface', slug: '/documentation/products/edge-application/edge-functions/runtime/api-reference/network-list', key: 'runtime/network-list' },
+ { text: 'Web APIs', slug: '/documentation/products/edge-application/edge-functions/runtime-apis/javascript', key: 'runtime/web-standards' },
]},
- { text: 'Frameworks compatibility', header: true, anchor: true, type: 'learn', key: 'runtime/frameworks', slug: '/documentation/products/devtools/azion-edge-runtime/frameworks-compatibility/' },
+ { text: 'Compatibility', header: true, type: 'learn', key: 'runtime/compatibility', children: [
+ { text: 'Web frameworks', header: true, anchor: true, type: 'learn', key: 'runtime/frameworks', slug: '/documentation/products/devtools/azion-edge-runtime/frameworks-compatibility/' },
+ { text: 'Node.js', header: true, anchor: true, type: 'learn', key: 'runtime/node', slug: '/documentation/products/azion-edge-runtime/compatibility/node/' },
+ ]},
{ text: 'JavaScript Examples', header: true, anchor: true, type: 'learn', slug: '/documentation/products/edge-application/edge-functions/javascript-examples', key: 'runtime/jsExamples' },
{ text: 'Debugging', header: true, anchor: true, type: 'learn', slug: '/documentation/products/edge-application/edge-functions/debugging', key: 'runtime/debugging' },
diff --git a/src/i18n/en/ui.ts b/src/i18n/en/ui.ts
index 85d34dbfa9..c90ae5137d 100644
--- a/src/i18n/en/ui.ts
+++ b/src/i18n/en/ui.ts
@@ -143,4 +143,6 @@ export default {
'topbar.message': 'Azion earns Frost & Sullivan’s 2023 North American New Product Innovation Award in the edge serverless industry.',
'topbar.link': 'https://www.azion.com/en/blog/azion-frost-sullivan-award/',
'topbar.cta': 'Check it out!',
+ 'menu.runtime': 'Azion Edge Runtime',
+
};