Skip to content

Commit 8912870

Browse files
chore: bump plug (#142)
1 parent b8bb12d commit 8912870

File tree

7 files changed

+18
-24
lines changed

7 files changed

+18
-24
lines changed

deps.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
export {
2-
CachePolicy,
3-
download,
4-
prepare,
5-
} from "https://deno.land/x/[email protected]/plug.ts";
6-
export { join } from "https://deno.land/[email protected]/path/mod.ts";
1+
export { dlopen, download } from "https://deno.land/x/[email protected]/mod.ts";

examples/multi-window/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { serve } from "https://deno.land/std@0.153.0/http/server.ts";
1+
import { serve } from "https://deno.land/std@0.157.0/http/server.ts";
22
import { preload } from "../../mod.ts";
33
await preload();
44

examples/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { serve } from "https://deno.land/std@0.153.0/http/server.ts";
1+
import { serve } from "https://deno.land/std@0.157.0/http/server.ts";
22
import { Webview } from "../mod.ts";
33

44
const controller = new AbortController();

examples/ssr/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { dirname, join } from "https://deno.land/std@0.153.0/path/mod.ts";
1+
import { dirname, join } from "https://deno.land/std@0.157.0/path/mod.ts";
22
import { Webview } from "../../mod.ts";
33

44
const worker = new Worker(

examples/ssr/worker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/// <reference lib="dom.asynciterable" />
55
/// <reference lib="deno.ns" />
66

7-
import { serve } from "https://deno.land/std@0.153.0/http/server.ts";
7+
import { serve } from "https://deno.land/std@0.157.0/http/server.ts";
88
import { h, ssr, tw } from "https://crux.land/[email protected]";
99

1010
const Hello = (props: { name: string }) => (

script/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ensureDir } from "https://deno.land/std@0.153.0/fs/ensure_dir.ts";
1+
import { ensureDir } from "https://deno.land/std@0.157.0/fs/ensure_dir.ts";
22

33
const decoder = new TextDecoder();
44
const architectures = [["x86_64", "x86_64"], ["aarch64", "arm64"]] as const;

src/ffi.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import { CachePolicy, download, join, prepare } from "../deps.ts";
1+
import { dlopen, download } from "../deps.ts";
22
import { Webview } from "./webview.ts";
33

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

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

61-
const webview2loader = await download(`${url}WebView2Loader.dll`);
59+
const webview2loader = await download({
60+
url: `${url}/WebView2Loader.dll`,
61+
cache,
62+
});
6263
await Deno.copyFile(webview2loader, "./WebView2Loader.dll");
6364

6465
self.addEventListener("unload", unload);
@@ -94,16 +95,14 @@ if (Deno.build.os === "windows") {
9495
}
9596
}
9697

97-
// Make sure to load the right dylib for the arch when on darwin
98-
if (Deno.build.os === "darwin" && !url.endsWith("dylib")) {
99-
url = join(url, `libwebview.${Deno.build.arch}.dylib`);
100-
}
101-
102-
export const lib = await prepare(
98+
export const lib = await dlopen(
10399
{
104100
name: "webview",
105101
url,
106-
policy,
102+
cache,
103+
suffixes: {
104+
darwin: `.${Deno.build.arch}`,
105+
},
107106
},
108107
{
109108
"webview_create": {

0 commit comments

Comments
 (0)