Skip to content

Commit

Permalink
release: 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
skanehira committed Nov 5, 2023
1 parent a81ccc8 commit c38a6cb
Showing 1 changed file with 28 additions and 29 deletions.
57 changes: 28 additions & 29 deletions bindings/bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,40 @@ function readPointer(v: any): Uint8Array {
return buf
}

const url = new URL("../target/debug", import.meta.url)
const url = new URL(
"https://github.com/skanehira/deno-silicon/releases/download/v1.0.0/",
import.meta.url,
)

let uri = url.pathname
import { dlopen, FetchOptions } from "https://deno.land/x/plug@1.0.1/mod.ts"
let uri = url.toString()
if (!uri.endsWith("/")) uri += "/"

// https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibrarya#parameters
if (Deno.build.os === "windows") {
uri = uri.replace(/\//g, "\\")
// Remove leading slash
if (uri.startsWith("\\")) {
uri = uri.slice(1)
}
}
let darwin: string | { aarch64: string; x86_64: string } = uri

const { symbols } = Deno.dlopen(
{
darwin: uri + "libdeno_silicon.dylib",
windows: uri + "deno_silicon.dll",
linux: uri + "libdeno_silicon.so",
freebsd: uri + "libdeno_silicon.so",
netbsd: uri + "libdeno_silicon.so",
aix: uri + "libdeno_silicon.so",
solaris: uri + "libdeno_silicon.so",
illumos: uri + "libdeno_silicon.so",
}[Deno.build.os],
{
font_list: { parameters: [], result: "buffer", nonblocking: false },
generate: {
parameters: ["buffer", "usize"],
result: "buffer",
nonblocking: false,
const opts: FetchOptions = {
name: "deno_silicon",
url: {
darwin,
windows: uri,
linux: uri,
},
suffixes: {
darwin: {
aarch64: "_arm64",
},
theme_list: { parameters: [], result: "buffer", nonblocking: false },
},
)
cache: "use",
}
const { symbols } = await dlopen(opts, {
font_list: { parameters: [], result: "buffer", nonblocking: false },
generate: {
parameters: ["buffer", "usize"],
result: "buffer",
nonblocking: false,
},
theme_list: { parameters: [], result: "buffer", nonblocking: false },
})
export type Options = {
/**
* Source code
Expand Down

0 comments on commit c38a6cb

Please sign in to comment.