-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnode.cjs
More file actions
24 lines (22 loc) · 755 Bytes
/
node.cjs
File metadata and controls
24 lines (22 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const { join } = require("node:path");
const { pathToFileURL } = require("node:url");
const { readFile } = require("node:fs/promises");
const { createActionlint } = require("./actionlint.cjs");
/**
* @typedef {(go: Go) => Promise<WebAssembly.WebAssemblyInstantiatedSource>} WasmLoader
* @typedef {import("./types").RunActionlint} RunActionlint
* @typedef {import("./types").LintResult} LintResult
*/
/**
* @param {URL} url
* @returns {Promise<RunActionlint>}
*/
module.exports.createLinter = async function createLinter(
url = pathToFileURL(join(__dirname, "main.wasm"))
) {
return await createActionlint(
/** @type {WasmLoader} */ async (go) => {
return WebAssembly.instantiate(await readFile(url), go.importObject);
}
);
};