2022-10-15 11:21:04 -04:00
|
|
|
#!/usr/bin/env -S deno run --unstable --allow-read --allow-write
|
2023-01-02 16:00:42 -05:00
|
|
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
2022-10-15 11:21:04 -04:00
|
|
|
|
2022-11-28 17:28:54 -05:00
|
|
|
import exports from "../../cli/napi/sym/symbol_exports.json" assert {
|
2022-10-15 11:21:04 -04:00
|
|
|
type: "json",
|
|
|
|
};
|
|
|
|
|
2022-10-16 18:53:35 -04:00
|
|
|
const symbolExportLists = {
|
|
|
|
linux: `{ ${exports.symbols.map((s) => `"${s}"`).join("; ")}; };`,
|
2023-06-12 06:14:27 -04:00
|
|
|
openbsd: `{ ${exports.symbols.map((s) => `"${s}"`).join("; ")}; };`,
|
|
|
|
freebsd: `{ ${exports.symbols.map((s) => `"${s}"`).join("; ")}; };`,
|
2022-10-16 18:53:35 -04:00
|
|
|
windows: `LIBRARY\nEXPORTS\n${
|
|
|
|
exports.symbols
|
|
|
|
.map((symbol) => " " + symbol)
|
|
|
|
.join("\n")
|
|
|
|
}`,
|
|
|
|
macos: exports.symbols.map((symbol) => "_" + symbol).join("\n"),
|
|
|
|
};
|
2022-10-15 11:21:04 -04:00
|
|
|
|
2022-10-16 18:53:35 -04:00
|
|
|
for await (const [os, def] of Object.entries(symbolExportLists)) {
|
2022-10-15 11:21:04 -04:00
|
|
|
const defUrl = new URL(
|
2022-11-25 18:49:02 -05:00
|
|
|
`../../cli/napi/generated_symbol_exports_list_${os}.def`,
|
2022-10-15 11:21:04 -04:00
|
|
|
import.meta.url,
|
|
|
|
);
|
|
|
|
await Deno.writeTextFile(defUrl.pathname, def, { create: true });
|
|
|
|
}
|