Skip to content

Commit

Permalink
feat: remove deno core ops for latest canary build
Browse files Browse the repository at this point in the history
  • Loading branch information
load1n9 committed Jan 25, 2023
1 parent aef50eb commit bdbe585
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions build.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { encode } from "https://deno.land/[email protected]/encoding/base64.ts";

const $ = (cmd: string, ...args: string[]) => {
console.log(`%c$ ${cmd} ${args.join(" ")}`, "color: #888");
return new Deno.Command(cmd, {
Expand All @@ -10,7 +12,7 @@ const $ = (cmd: string, ...args: string[]) => {

try {
Deno.removeSync("./build", { recursive: true });
} catch (e) {
} catch (_e) {
// ignore
}

Expand Down Expand Up @@ -65,8 +67,8 @@ const OUT_FILE = `./glfw3_${Deno.build.os}${
Deno.writeTextFileSync(
OUT_FILE,
`const BASE64 = "${
(Deno as any).core.ops.op_base64_encode(Deno.readFileSync(BIN_FILE))
}";\nconst DECODED = Deno.build.os === "${Deno.build.os}" && Deno.build.arch === "${Deno.build.arch}" ? Deno.core.ops.op_base64_decode(BASE64) : new Uint8Array();\nexport default DECODED;\n`,
encode(Deno.readFileSync(BIN_FILE))
}";\nfunction decode(b64) {\n const binString = atob(b64);\n const size = binString.length;\n const bytes = new Uint8Array(size); \n for (let i = 0; i < size; i++) {\n bytes[i] = binString.charCodeAt(i);\n }\n return bytes;\n}\nconst DECODED = Deno.build.os === "${Deno.build.os}" && Deno.build.arch === "${Deno.build.arch}" ? Deno.core.ops.op_base64_decode(BASE64) : new Uint8Array();\nexport default DECODED;\n`,
);

console.log(`%cWrote ${OUT_FILE}`, "color: #888");

0 comments on commit bdbe585

Please sign in to comment.