From 210f9466c1ff56e1be80f875c4085ad6fa3da018 Mon Sep 17 00:00:00 2001 From: Dj <43033058+DjDeveloperr@users.noreply.github.com> Date: Thu, 26 Jan 2023 10:30:02 +0530 Subject: [PATCH] fix: use new core interface --- build.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.ts b/build.ts index 4a45f2b..7f2b420 100644 --- a/build.ts +++ b/build.ts @@ -1,5 +1,3 @@ -import { encode } from "https://deno.land/std@0.173.0/encoding/base64.ts"; - const $ = (cmd: string, ...args: string[]) => { console.log(`%c$ ${cmd} ${args.join(" ")}`, "color: #888"); return new Deno.Command(cmd, { @@ -64,11 +62,15 @@ const OUT_FILE = `./glfw3_${Deno.build.os}${ Deno.build.arch === "aarch64" ? "_aarch64" : "" }.js`; +const encode = (Deno as any)[(Deno as any).internal] + .core + .ops.op_base64_encode; + Deno.writeTextFileSync( OUT_FILE, `const BASE64 = "${ 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}" ? decode(BASE64) : new Uint8Array();\nexport default DECODED;\n`, + }";\nconst DECODED = Deno.build.os === "${Deno.build.os}" && Deno.build.arch === "${Deno.build.arch}" ? Deno[Deno.internal].core.ops.op_base64_decode(BASE64) : new Uint8Array();\nexport default DECODED;\n`, ); console.log(`%cWrote ${OUT_FILE}`, "color: #888");