deno/tools/napi/generate_symbols_lists.js
Bartek Iwańczuk 3f8efe5289
Revert "chore: move all node-api impl to ext (#24662)" (#24680)
This reverts commit d00fbd7025.

Reverting because, it caused a failure during v1.45.3 publish:

https://github.com/denoland/deno/actions/runs/10048730693/job/27773718095
2024-07-23 00:01:31 +00:00

25 lines
752 B
JavaScript
Executable File

#!/usr/bin/env -S deno run --allow-read --allow-write
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import exports from "../../cli/napi/sym/symbol_exports.json" with {
type: "json",
};
const symbolExportLists = {
linux: `{ ${exports.symbols.map((s) => `"${s}"`).join("; ")}; };`,
windows: `LIBRARY\nEXPORTS\n${
exports.symbols
.map((symbol) => " " + symbol)
.join("\n")
}`,
macos: exports.symbols.map((symbol) => "_" + symbol).join("\n"),
};
for await (const [os, def] of Object.entries(symbolExportLists)) {
const defUrl = new URL(
`../../cli/napi/generated_symbol_exports_list_${os}.def`,
import.meta.url,
);
await Deno.writeTextFile(defUrl.pathname, def, { create: true });
}