Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/package/src/common/dependencies/dartsass.ts
6451 views
1
/*
2
* dartsass.ts
3
*
4
* Copyright (C) 2020-2022 Posit Software, PBC
5
*
6
*/
7
import { ensureDirSync, existsSync } from "../../../../src/deno_ral/fs.ts";
8
import { dirname, join } from "../../../../src/deno_ral/path.ts";
9
10
import { unTar } from "../../util/tar.ts";
11
import { Configuration } from "../config.ts";
12
import { Dependency } from "./dependencies.ts";
13
14
export function dartSass(version: string): Dependency {
15
const dartRelease = (
16
filename: string,
17
) => {
18
return {
19
filename,
20
url:
21
`https://github.com/sass/dart-sass/releases/download/${version}/${filename}`,
22
configure: async (config: Configuration, path: string) => {
23
const vendor = Deno.env.get("QUARTO_VENDOR_BINARIES");
24
if (vendor === undefined || vendor === "true") {
25
// Remove existing dart-sass dir
26
const dir = dirname(path);
27
const targetDir = join(dir, config.arch);
28
ensureDirSync(targetDir);
29
30
const dartSubdir = join(targetDir, `dart-sass`);
31
if (existsSync(dartSubdir)) {
32
Deno.removeSync(dartSubdir, { recursive: true });
33
}
34
35
// Expand
36
await unTar(path, targetDir);
37
}
38
},
39
};
40
};
41
42
return {
43
name: "Dart Sass Compiler",
44
bucket: "dart-sass",
45
version,
46
architectureDependencies: {
47
"x86_64": {
48
"windows": dartRelease(`dart-sass-${version}-windows-x64.zip`),
49
"linux": dartRelease(`dart-sass-${version}-linux-x64.tar.gz`),
50
"darwin": dartRelease(`dart-sass-${version}-macos-x64.tar.gz`),
51
},
52
"aarch64": {
53
"linux": dartRelease(`dart-sass-${version}-linux-arm64.tar.gz`),
54
"darwin": dartRelease(`dart-sass-${version}-macos-arm64.tar.gz`),
55
},
56
},
57
};
58
}
59
60