Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/package/src/common/dependencies/deno_dom.ts
6452 views
1
/*
2
* deno_dom.ts
3
*
4
* Copyright (C) 2020-2022 Posit Software, PBC
5
*
6
*/
7
8
import { ensureDir } from "../../../../src/deno_ral/fs.ts";
9
import { basename, dirname, join } from "../../../../src/deno_ral/path.ts";
10
import { Configuration } from "../config.ts";
11
12
import { Dependency } from "./dependencies.ts";
13
14
export function deno_dom(version: string): Dependency {
15
const deno_dom_release = (filename: string, baseUrl="https://github.com/b-fuze/deno-dom", targetFileName?: string) => {
16
return {
17
filename,
18
url:
19
`${baseUrl}/releases/download/${version}/${filename}`,
20
configure: async (config: Configuration, path: string) => {
21
const vendor = Deno.env.get("QUARTO_VENDOR_BINARIES");
22
if (vendor === undefined || vendor === "true") {
23
const targetPath = join(dirname(path), config.arch, "deno_dom", targetFileName || basename(path));
24
await ensureDir(dirname(targetPath));
25
await Deno.copyFile(path, targetPath);
26
} else {
27
if (Deno.env.get("DENO_DOM_PLUGIN") === undefined) {
28
throw new Error(
29
`DENO_DOM_PLUGIN is not set, and vendoring is turned off. Please install deno-dom and set DENO_DOM_PLUGIN.`,
30
);
31
}
32
}
33
},
34
};
35
};
36
37
const deno_dom_release_quarto_dev = (filename: string, targetFileName: string) => {
38
return deno_dom_release(filename, "https://github.com/quarto-dev/deno-dom-apple-silicon", targetFileName)
39
}
40
41
return {
42
name: "deno_dom",
43
bucket: "deno_dom",
44
version,
45
architectureDependencies: {
46
"x86_64": {
47
darwin: deno_dom_release("libplugin.dylib"),
48
linux: deno_dom_release("libplugin.so"),
49
windows: deno_dom_release("plugin.dll"),
50
},
51
"aarch64": {
52
linux: deno_dom_release("libplugin-linux-aarch64.so"),
53
darwin: deno_dom_release_quarto_dev("libplugin-aarch64.dylib", "libplugin.dylib")
54
},
55
},
56
};
57
}
58
59