mirror of
https://github.com/denoland/deno.git
synced 2024-12-11 01:58:05 -05:00
79a3ad2b95
exposes node-api symbols in denort so that `deno compile` can run native addons.
24 lines
752 B
JavaScript
Executable file
24 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 "../../ext/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(
|
|
`../../ext/napi/generated_symbol_exports_list_${os}.def`,
|
|
import.meta.url,
|
|
);
|
|
await Deno.writeTextFile(defUrl.pathname, def, { create: true });
|
|
}
|