import * as esbuild from "esbuild";
import { denoPlugins } from "@luca/esbuild-deno-loader";
import { expandGlob } from "jsr:@std/fs";
const decoder = new TextDecoder();
await esbuild.build({
plugins: [...denoPlugins()],
entryPoints: ["src/main.ts"],
outfile: "./dist/main.js",
bundle: true,
format: "esm",
});
await esbuild.stop();
const includes = await Array.fromAsync(
expandGlob("dist/*.wasm"),
(file) => `--include=${file.path}`,
);
async function compile() {
const args = [
"compile",
"--allow-all",
"--no-lock",
"--no-check",
"--no-remote",
"--no-config",
"--import-map=import-map-bundle.json",
...includes,
`--output=dist/bin/design-tokens-language-server`,
"dist/main.js",
"--stdio",
].filter((x) => typeof x === "string");
const { code, stdout, stderr } = await new Deno.Command(Deno.execPath(), {
stdout: "piped",
args,
}).output();
if (code === 0) {
console.log(`Built ${arch ?? "native"}`);
} else {
console.log(`deno ${args.join(" ")}\n`);
console.log(decoder.decode(stdout));
console.log(decoder.decode(stderr));
throw new Error(`Could not build ${arch ?? "native"}`);
}
}
await compile();
import * as esbuild from "esbuild";
import { denoPlugins } from "@luca/esbuild-deno-loader";
import { expandGlob } from "jsr:@std/fs";
const decoder = new TextDecoder();
await esbuild.build({
plugins: [...denoPlugins()],
entryPoints: ["src/main.ts"],
outfile: "./dist/main.js",
bundle: true,
format: "esm",
});
await esbuild.stop();
const includes = await Array.fromAsync(
expandGlob("dist/*.wasm"),
(file) => `--include=${file.path}`,
);
async function compile() {
const args = [
"compile",
"--allow-all",
"--no-lock",
"--no-check",
"--no-remote",
"--no-config",
"--import-map=import-map-bundle.json",
...includes,
`--output=dist/bin/design-tokens-language-server`,
"dist/main.js",
"--stdio",
].filter((x) => typeof x === "string");
const { code, stdout, stderr } = await new Deno.Command(Deno.execPath(), {
stdout: "piped",
args,
}).output();
if (code === 0) {
console.log(`Built ${arch ?? "native"}`);
} else {
console.log(`deno ${args.join(" ")}\n`);
console.log(decoder.decode(stdout));
console.log(decoder.decode(stderr));
throw new Error(`Could not build ${arch ?? "native"}`);
}
}
await compile();