Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump plug #142

Merged
merged 1 commit into from
Sep 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
export {
CachePolicy,
download,
prepare,
} from "https://deno.land/x/plug@0.5.2/plug.ts";
export { join } from "https://deno.land/std@0.153.0/path/mod.ts";
export { dlopen, download } from "https://deno.land/x/plug@1.0.0-rc.2/mod.ts";
2 changes: 1 addition & 1 deletion examples/multi-window/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { serve } from "https://deno.land/std@0.153.0/http/server.ts";
import { serve } from "https://deno.land/std@0.157.0/http/server.ts";
import { preload } from "../../mod.ts";
await preload();

Expand Down
2 changes: 1 addition & 1 deletion examples/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { serve } from "https://deno.land/std@0.153.0/http/server.ts";
import { serve } from "https://deno.land/std@0.157.0/http/server.ts";
import { Webview } from "../mod.ts";

const controller = new AbortController();
Expand Down
2 changes: 1 addition & 1 deletion examples/ssr/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { dirname, join } from "https://deno.land/std@0.153.0/path/mod.ts";
import { dirname, join } from "https://deno.land/std@0.157.0/path/mod.ts";
import { Webview } from "../../mod.ts";

const worker = new Worker(
Expand Down
2 changes: 1 addition & 1 deletion examples/ssr/worker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// <reference lib="dom.asynciterable" />
/// <reference lib="deno.ns" />

import { serve } from "https://deno.land/std@0.153.0/http/server.ts";
import { serve } from "https://deno.land/std@0.157.0/http/server.ts";
import { h, ssr, tw } from "https://crux.land/nanossr@0.0.1";

const Hello = (props: { name: string }) => (
Expand Down
2 changes: 1 addition & 1 deletion script/build.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ensureDir } from "https://deno.land/std@0.153.0/fs/ensure_dir.ts";
import { ensureDir } from "https://deno.land/std@0.157.0/fs/ensure_dir.ts";

const decoder = new TextDecoder();
const architectures = [["x86_64", "x86_64"], ["aarch64", "arm64"]] as const;
Expand Down
25 changes: 12 additions & 13 deletions src/ffi.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { CachePolicy, download, join, prepare } from "../deps.ts";
import { dlopen, download } from "../deps.ts";
import { Webview } from "./webview.ts";

const version = "0.7.3";
const policy = Deno.env.get("PLUGIN_URL") === undefined
? CachePolicy.STORE
: CachePolicy.NONE;
let url = Deno.env.get("PLUGIN_URL") ??
const cache = Deno.env.get("PLUGIN_URL") === undefined ? "use" : "reloadAll";
const url = Deno.env.get("PLUGIN_URL") ??
`https://github.com/webview/webview_deno/releases/download/${version}/`;

const encoder = new TextEncoder();
Expand Down Expand Up @@ -58,7 +56,10 @@ export async function preload() {
await Deno.remove("./WebView2Loader.dll");
}

const webview2loader = await download(`${url}WebView2Loader.dll`);
const webview2loader = await download({
url: `${url}/WebView2Loader.dll`,
cache,
});
await Deno.copyFile(webview2loader, "./WebView2Loader.dll");

self.addEventListener("unload", unload);
Expand Down Expand Up @@ -94,16 +95,14 @@ if (Deno.build.os === "windows") {
}
}

// Make sure to load the right dylib for the arch when on darwin
if (Deno.build.os === "darwin" && !url.endsWith("dylib")) {
url = join(url, `libwebview.${Deno.build.arch}.dylib`);
}

export const lib = await prepare(
export const lib = await dlopen(
{
name: "webview",
url,
policy,
cache,
suffixes: {
darwin: `.${Deno.build.arch}`,
},
},
{
"webview_create": {
Expand Down