Skip to content

Commit 0cbf1a7

Browse files
authored
Merge branch 'main' into post-render/logging
2 parents 68e812e + be2992e commit 0cbf1a7

File tree

13 files changed

+1355
-1235
lines changed

13 files changed

+1355
-1235
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ body:
1313
1414
- If you're reporting an issue with the **Visual Editor** or with the **Visual Studio Code / Positron extension**, please visit https://github.com/quarto-dev/quarto
1515
- If you're reporting an issue inside **RStudio**, please visit https://github.com/rstudio/rstudio
16-
- If you're reporting an issue inside **Positron**, please visit https://github.com/posit-dev/positron
16+
- If you're reporting an issue inside **Positron**, please visit https://github.com/posit-dev/positron/discussions
1717
- If you want to ask for a feature, please use the [Feature Requests GitHub Discussions](https://github.com/quarto-dev/quarto-cli/discussions/categories/feature-requests).
1818
- If you want to ask for help, please use the [Q&A GitHub Discussions](https://github.com/quarto-dev/quarto-cli/discussions/categories/q-a).
1919

.github/workflows/create-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ jobs:
194194

195195
make-tarball-rhel:
196196
runs-on: ubuntu-latest
197+
# temporarily disable due to unavailability of latest deno in conda-forge
198+
if: false
197199
needs: [configure]
198200
steps:
199201
- uses: actions/checkout@v4

configuration

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
# in src/command/check/check.ts
1212

1313
# Binary dependencies
14-
export DENO=v2.3.1
14+
export DENO=v2.4.5
1515
# TODO figure out where 0.1.41 apple silicon libs are available
1616
export DENO_DOM=v0.1.41-alpha-artifacts
1717
export PANDOC=3.6.3
1818
export DARTSASS=1.87.0
19-
export ESBUILD=0.25.3
19+
export ESBUILD=0.25.10
2020
export TYPST=0.13.0
2121

2222

news/changelog-1.9.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
All changes included in 1.9:
22

3+
## Regression fixes
34

5+
- ([#13396](https://github.com/quarto-dev/quarto-cli/issues/13396)): Fix `quarto publish connect` regression.
6+
7+
## Dependencies
8+
9+
- Update `esbuild` to 0.25.10
10+
- Update `deno` to 2.4.5

src/command/render/latexmk/texlive.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ async function installPackage(
238238
quiet,
239239
);
240240
if (updateResult.code !== 0) {
241-
return Promise.reject("Problem running `tlgmr update`.");
241+
return Promise.reject("Problem running `tlmgr update`.");
242242
}
243243

244244
// Rebuild format tree
@@ -277,7 +277,7 @@ async function installPackage(
277277
quiet,
278278
);
279279
if (updateResult.code !== 0) {
280-
return Promise.reject("Problem running `tlgmr update`.");
280+
return Promise.reject("Problem running `tlmgr update`.");
281281
}
282282

283283
// Rebuild format tree

src/deno_ral/tar.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,47 @@
66
* Abstraction layer over Deno's `tar` utilities.
77
*/
88

9-
import { TarStream, type TarStreamInput } from "jsr:@std/tar/tar-stream";
9+
import { TarStream, type TarStreamInput } from "tar/tar-stream";
10+
import { join } from "../deno_ral/path.ts";
11+
import { pathWithForwardSlashes } from "../core/path.ts";
1012

1113
/**
1214
* Creates a tar archive from the specified files and directories.
1315
* @param outputPath The path where the tar archive will be created.
14-
* @param filePaths An array of file and directory paths to include in the tar archive. Paths are relative to outputPath.
16+
* @param filePaths An array of file and directory paths to include in the tar archive.
17+
* @param options Optional configuration for tar creation.
18+
* @param options.baseDir Base directory for resolving relative paths in the archive.
1519
* @returns A promise that resolves when the tar archive is created.
1620
*/
1721
export async function createTarFromFiles(
1822
outputPath: string,
1923
filePaths: string[],
24+
options?: { baseDir?: string },
2025
) {
26+
const baseDir = options?.baseDir;
27+
2128
// Create array of TarStreamInput objects from file paths
2229
const inputs: TarStreamInput[] = await Promise.all(
2330
filePaths.map(async (path) => {
24-
const stat = await Deno.stat(path);
31+
const fullPath = baseDir ? join(baseDir, path) : path;
32+
const stat = await Deno.stat(fullPath);
33+
34+
// Use original path for archive, full path for reading
35+
const archivePath = pathWithForwardSlashes(path);
2536

2637
if (stat.isDirectory) {
2738
// Handle directory
2839
return {
2940
type: "directory",
30-
path: path + (path.endsWith("/") ? "" : "/"),
41+
path: archivePath + (archivePath.endsWith("/") ? "" : "/"),
3142
};
3243
} else {
3344
// Handle file
3445
return {
3546
type: "file",
36-
path: path,
47+
path: archivePath,
3748
size: stat.size,
38-
readable: (await Deno.open(path)).readable,
49+
readable: (await Deno.open(fullPath)).readable,
3950
};
4051
}
4152
}),

src/execute/julia.ts

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import { join } from "../deno_ral/path.ts";
33
import { MappedString, mappedStringFromFile } from "../core/mapped-text.ts";
44
import { partitionMarkdown } from "../core/pandoc/pandoc-partition.ts";
55
import { readYamlFromMarkdown } from "../core/yaml.ts";
6-
import { asMappedString } from "../core/lib/mapped-text.ts";
6+
import {
7+
asMappedString,
8+
mappedIndexToLineCol,
9+
mappedLines,
10+
} from "../core/lib/mapped-text.ts";
711
import { ProjectContext } from "../project/types.ts";
812
import {
913
DependenciesOptions,
@@ -52,6 +56,13 @@ import {
5256
isJupyterPercentScript,
5357
markdownFromJupyterPercentScript,
5458
} from "./jupyter/percent.ts";
59+
import { resolve } from "path";
60+
61+
export interface SourceRange {
62+
lines: [number, number];
63+
file?: string;
64+
sourceLines?: [number, number];
65+
}
5566

5667
export interface JuliaExecuteOptions extends ExecuteOptions {
5768
oneShot: boolean; // if true, the file's worker process is closed before and after running
@@ -578,6 +589,64 @@ function getConsoleColumns(): number | null {
578589
}
579590
}
580591

592+
function buildSourceRanges(markdown: MappedString): Array<SourceRange> {
593+
const lines = mappedLines(markdown);
594+
const sourceRanges: Array<SourceRange> = [];
595+
let currentRange: SourceRange | null = null;
596+
597+
lines.forEach((line, index) => {
598+
// Get mapping info directly from the line's MappedString
599+
const mapResult = line.map(0, true);
600+
if (mapResult) {
601+
const { originalString } = mapResult;
602+
const lineColFunc = mappedIndexToLineCol(originalString);
603+
const lineCol = lineColFunc(mapResult.index);
604+
const fileName = originalString.fileName
605+
? resolve(originalString.fileName) // resolve to absolute path using cwd
606+
: undefined;
607+
const sourceLineNum = lineCol.line;
608+
609+
// Check if this line continues the current range
610+
if (
611+
currentRange &&
612+
currentRange.file === fileName &&
613+
fileName !== undefined &&
614+
currentRange.sourceLines &&
615+
currentRange.sourceLines[1] === sourceLineNum
616+
) {
617+
// Extend current range
618+
currentRange.lines[1] = index + 1; // +1 because lines are 1-indexed
619+
currentRange.sourceLines[1] = sourceLineNum + 1;
620+
} else {
621+
// Start new range
622+
if (currentRange) {
623+
sourceRanges.push(currentRange);
624+
}
625+
currentRange = {
626+
lines: [index + 1, index + 1], // +1 because lines are 1-indexed
627+
};
628+
if (fileName !== undefined) {
629+
currentRange.file = fileName;
630+
currentRange.sourceLines = [sourceLineNum + 1, sourceLineNum + 1];
631+
}
632+
}
633+
} else {
634+
// No mapping available - treat as separate range
635+
if (currentRange) {
636+
sourceRanges.push(currentRange);
637+
currentRange = null;
638+
}
639+
}
640+
});
641+
642+
// Don't forget the last range
643+
if (currentRange) {
644+
sourceRanges.push(currentRange);
645+
}
646+
647+
return sourceRanges;
648+
}
649+
581650
async function executeJulia(
582651
options: JuliaExecuteOptions,
583652
): Promise<JupyterNotebook> {
@@ -600,9 +669,12 @@ async function executeJulia(
600669
);
601670
}
602671
}
672+
673+
const sourceRanges = buildSourceRanges(options.target.markdown);
674+
603675
const response = await writeJuliaCommand(
604676
conn,
605-
{ type: "run", content: { file, options } },
677+
{ type: "run", content: { file, options, sourceRanges } },
606678
transportOptions.key,
607679
options,
608680
(update: ProgressUpdate) => {
@@ -643,7 +715,14 @@ interface ProgressUpdate {
643715
type empty = Record<string | number | symbol, never>;
644716

645717
type ServerCommand =
646-
| { type: "run"; content: { file: string; options: JuliaExecuteOptions } }
718+
| {
719+
type: "run";
720+
content: {
721+
file: string;
722+
options: JuliaExecuteOptions;
723+
sourceRanges: Array<SourceRange>;
724+
};
725+
}
647726
| { type: "close"; content: { file: string } }
648727
| { type: "forceclose"; content: { file: string } }
649728
| { type: "isopen"; content: { file: string } }
@@ -854,7 +933,9 @@ function populateJuliaEngineCommand(command: Command) {
854933
"Get status information on the currently running Julia server process.",
855934
).action(logStatus)
856935
.command("kill", "Kill server")
857-
.description("Kill the control server if it is currently running. This will also kill all notebook worker processes.")
936+
.description(
937+
"Kill the control server if it is currently running. This will also kill all notebook worker processes.",
938+
)
858939
.action(killJuliaServer)
859940
.command("log", "Print julia server log")
860941
.description(

src/publish/common/bundle.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ import { ensureDirSync } from "../../deno_ral/fs.ts";
1010
import { PublishFiles } from "../provider-types.ts";
1111
import { TempContext } from "../../core/temp-types.ts";
1212
import { md5HashBytes } from "../../core/hash.ts";
13-
import { pathWithForwardSlashes } from "../../core/path.ts";
1413

15-
import { copy } from "io/copy";
16-
import { TarStream, type TarStreamInput } from "tar/tar-stream";
1714
import { createTarFromFiles } from "../../deno_ral/tar.ts";
1815

1916
interface ManifestMetadata {
@@ -110,7 +107,7 @@ export async function createBundle(
110107
// await copy(tar.getReader(), writer);
111108
// writer.close();
112109

113-
await createTarFromFiles(tarFile, tarFiles);
110+
await createTarFromFiles(tarFile, tarFiles, { baseDir: stageDir });
114111

115112
// compress to tar.gz
116113
const targzFile = `${tarFile}.gz`;

src/resources/julia/Project.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
[deps]
22
QuartoNotebookRunner = "4c0109c6-14e9-4c88-93f0-2b974d3468f4"
33

4-
[compat]
5-
QuartoNotebookRunner = "=0.17.3"
4+
# [compat]
5+
# QuartoNotebookRunner = "=0.17.3"
6+
7+
[sources]
8+
QuartoNotebookRunner = {url = "https://github.com/PumasAI/QuartoNotebookRunner.jl", rev = "jk/source-ranges"}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```{julia}
2+
"$(@__FILE__):$(@__LINE__)"
3+
```

0 commit comments

Comments
 (0)