Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AOT-compiled TypeScript plugins #1

Merged
merged 4 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# `@zerda.js/runtime`

[![Known Vulnerabilities](https://snyk.io/test/github/zerdajs/runtime/badge.svg)](https://snyk.io/test/github/zerdajs/runtime)

Zerda.js Runtime Environment | Cross-platform | Modular | Wide GPU support

## What is the Zerda.js Runtime Environment?
Expand Down
14 changes: 5 additions & 9 deletions bin/zerda.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#!/usr/bin/env node


import { rm } from "fs/promises";
import readline from 'readline';
import { parseArgs } from "util";


import { getAbsolutePath } from "pathify";


import { ZerdaRuntime } from "../src/index.mjs";


Expand Down Expand Up @@ -149,20 +145,20 @@ function log (...lines) {
*
* @private
* @since v0.3.1
* @version 1.0.0
* @version 2.0.0
*
* @param {any[]} input
* @param {...any} plugins
* @returns {any}
*/
function applyPlugins (
async function applyPlugins (
input,
...plugins
) {
let output = input;

for (let plugin of plugins) {
output = plugin(output);
output = await plugin.run(output);
}

return output;
Expand Down Expand Up @@ -232,7 +228,7 @@ async function main () {

lineReader.on(
'line',
(inputString) => {
async inputString => {
inputString = inputString.trim();

let input = JSON.parse(inputString);
Expand All @@ -241,7 +237,7 @@ async function main () {
input = [ input ];
}

const output = applyPlugins(
const output = await applyPlugins(
input,
...plugins
);
Expand Down
Loading