Skip to content

Commit 238d3d7

Browse files
authored
Merge branch 'main' into fix/issue10235
2 parents 63296e3 + f94063c commit 238d3d7

File tree

22 files changed

+275
-83
lines changed

22 files changed

+275
-83
lines changed

.vscode/launch.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"runtimeExecutable": "${workspaceFolder}/package/dist/bin/tools/deno",
1515
"runtimeArgs": [
1616
"run",
17+
"--unstable-kv",
1718
"--unstable-ffi",
1819
"--importmap=${workspaceFolder}/src/import_map.json",
1920
"--inspect-brk",
@@ -42,6 +43,7 @@
4243
"runtimeArgs": [
4344
"test",
4445
"--config=test-conf.json",
46+
"--unstable-kv",
4547
"--unstable-ffi",
4648
"--allow-all",
4749
"--check",

news/changelog-1.6.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ All changes included in 1.6:
1515
- ([#10168](https://github.com/quarto-dev/quarto-cli/issues/10168)): support `csl` bibliography style.
1616
- ([#10181](https://github.com/quarto-dev/quarto-cli/issues/10181)): Remove workaround for image dimensions which is no longer necessary and mishandled image paths with spaces.
1717
- ([#10217](https://github.com/quarto-dev/quarto-cli/issues/10217)): Explicitly compute units for image dimensions in `typst` format when they're not given.
18+
- ([#10212](https://github.com/quarto-dev/quarto-cli/issues/10212)): Moves Pandoc variables to the function declaration for the default template.
19+
20+
## Engines
21+
22+
### `julia`
23+
24+
- ([#10225](https://github.com/quarto-dev/quarto-cli/issues/10225)): Handle API change in is_manifest_current in Julia 1.11
1825

1926
## Other Fixes and Improvements
2027

package/launcher/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ fn main() {
8282

8383
// Define the base deno options
8484
let mut deno_options: Vec<String> = vec![
85+
String::from("--unstable-kv"),
8586
String::from("--unstable-ffi"),
8687
String::from("--no-config"),
8788
String::from("--cached-only"),

package/scripts/common/quarto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fi
169169
export DENO_TLS_CA_STORE=system,mozilla
170170
export DENO_NO_UPDATE_CHECK=1
171171
# Be sure to include any already defined QUARTO_DENO_OPTIONS
172-
QUARTO_DENO_OPTIONS="--unstable-ffi --no-config ${QUARTO_CACHE_OPTIONS} --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi ${QUARTO_DENO_OPTIONS}"
172+
QUARTO_DENO_OPTIONS="--unstable-ffi --unstable-kv --no-config ${QUARTO_CACHE_OPTIONS} --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi ${QUARTO_DENO_OPTIONS}"
173173

174174
# --enable-experimental-regexp-engine is required for /regex/l, https://github.com/quarto-dev/quarto-cli/issues/9737
175175
if [ "$QUARTO_DENO_V8_OPTIONS" != "" ]; then

package/scripts/windows/quarto.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ IF NOT DEFINED QUARTO_DENO (
9999

100100
SET "DENO_TLS_CA_STORE=system,mozilla"
101101
SET "DENO_NO_UPDATE_CHECK=1"
102-
SET "QUARTO_DENO_OPTIONS=--unstable-ffi --no-config --cached-only --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi"
102+
SET "QUARTO_DENO_OPTIONS=--unstable-kv --unstable-ffi --no-config --cached-only --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi"
103103

104104
REM Add expected V8 options to QUARTO_DENO_V8_OPTIONS
105105
IF DEFINED QUARTO_DENO_V8_OPTIONS (

package/src/quarto-bld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ export DENO_NO_UPDATE_CHECK=1
1717

1818
# TODO: Consider generating a source map or something to get a good stack
1919
# Create the Deno bundle
20-
"$QUARTO_DENO" run --unstable-ffi --allow-env --allow-read --allow-write --allow-run --allow-net --allow-ffi --v8-flags=--stack-trace-limit=100 --importmap="${SCRIPT_PATH}/../../src/dev_import_map.json" "$SCRIPT_PATH/bld.ts" $@
20+
"$QUARTO_DENO" run --unstable-kv --unstable-ffi --allow-env --allow-read --allow-write --allow-run --allow-net --allow-ffi --v8-flags=--stack-trace-limit=100 --importmap="${SCRIPT_PATH}/../../src/dev_import_map.json" "$SCRIPT_PATH/bld.ts" $@

package/src/quarto-bld.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ if NOT DEFINED QUARTO_DENO (
99
SET "RUST_BACKTRACE=full"
1010
SET "DENO_NO_UPDATE_CHECK=1"
1111

12-
"%QUARTO_DENO%" run --unstable-ffi --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi --importmap=%~dp0\..\..\src\dev_import_map.json %~dp0\bld.ts %*
12+
"%QUARTO_DENO%" run --unstable-kv --unstable-ffi --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi --importmap=%~dp0\..\..\src\dev_import_map.json %~dp0\bld.ts %*

package/src/util/deno.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export async function bundle(
2020
}
2121
denoBundleCmd.push(denoExecPath);
2222
denoBundleCmd.push("bundle");
23+
denoBundleCmd.push("--unstable-kv");
2324
denoBundleCmd.push("--unstable-ffi");
2425
denoBundleCmd.push(
2526
"--importmap=" + configuration.importmap,
@@ -54,6 +55,7 @@ export async function compile(
5455
}
5556
denoBundleCmd.push(denoExecPath);
5657
denoBundleCmd.push("compile");
58+
denoBundleCmd.push("--unstable-kv");
5759
denoBundleCmd.push("--unstable-ffi");
5860
denoBundleCmd.push(
5961
"--importmap=" + configuration.importmap,
@@ -85,6 +87,7 @@ export async function install(
8587
}
8688
denoBundleCmd.push(denoExecPath);
8789
denoBundleCmd.push("install");
90+
denoBundleCmd.push("--unstable-kv");
8891
denoBundleCmd.push("--unstable-ffi");
8992
denoBundleCmd.push(
9093
"--importmap=" + configuration.importmap,

src/core/run/deno.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export const denoRunHandler: RunHandler = {
4444
importMap,
4545
"--cached-only",
4646
"--allow-all",
47+
"--unstable-kv",
4748
"--unstable-ffi",
4849
script,
4950
...args,

src/core/sass.ts

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ import { dartCompile } from "./dart-sass.ts";
1515

1616
import * as ld from "./lodash.ts";
1717
import { lines } from "./text.ts";
18-
import { md5Hash } from "./hash.ts";
19-
import { debug } from "../deno_ral/log.ts";
20-
import { safeExistsSync } from "./path.ts";
18+
import { sassCache } from "./sass/cache.ts";
2119

2220
export interface SassVariable {
2321
name: string;
@@ -300,10 +298,6 @@ export async function compileWithCache(
300298
cacheIdentifier?: string,
301299
) {
302300
if (cacheIdentifier) {
303-
// Calculate a hash for the input and identifier
304-
const identifierHash = md5Hash(cacheIdentifier);
305-
const inputHash = md5Hash(input);
306-
307301
// If there are imports, the computed input Hash is incorrect
308302
// so we should be using a session cache which will cache
309303
// across renders, but not persistently
@@ -313,50 +307,8 @@ export async function compileWithCache(
313307
const cacheDir = useSessionCache
314308
? join(temp.baseDir, "sass")
315309
: quartoCacheDir("sass");
316-
const cacheIdxPath = join(cacheDir, "index.json");
317-
318-
const outputFile = `${identifierHash}.css`;
319-
const outputFilePath = join(cacheDir, outputFile);
320-
321-
// Check whether we can use a cached file
322-
let cacheIndex: { [key: string]: { key: string; hash: string } } = {};
323-
let writeCache = true;
324-
if (existsSync(outputFilePath)) {
325-
try {
326-
cacheIndex = JSON.parse(Deno.readTextFileSync(cacheIdxPath));
327-
const existingEntry = cacheIndex[identifierHash];
328-
writeCache = !existingEntry || (existingEntry.hash !== inputHash);
329-
} catch {
330-
debug(`The scss cache index file ${cacheIdxPath} can't be read.`);
331-
}
332-
}
333-
334-
// We need to refresh the cache
335-
if (writeCache) {
336-
try {
337-
await dartCompile(
338-
input,
339-
outputFilePath,
340-
temp,
341-
loadPaths,
342-
compressed,
343-
);
344-
} catch (error) {
345-
// Compilation failed, so clear out the output file (if exists)
346-
// which will be invalid CSS
347-
try {
348-
if (safeExistsSync(outputFilePath)) {
349-
Deno.removeSync(outputFilePath);
350-
}
351-
} finally {
352-
//doesn't matter
353-
}
354-
throw error;
355-
}
356-
cacheIndex[identifierHash] = { key: cacheIdentifier, hash: inputHash };
357-
Deno.writeTextFileSync(cacheIdxPath, JSON.stringify(cacheIndex));
358-
}
359-
return outputFilePath;
310+
const cache = await sassCache(cacheDir);
311+
return cache.getOrSet(input, loadPaths, temp, cacheIdentifier, compressed);
360312
} else {
361313
const outputFilePath = temp.createFile({ suffix: ".css" });
362314
// Skip the cache and just compile

0 commit comments

Comments
 (0)