Skip to content

Commit 7895ac4

Browse files
Merge branch 'quarto-dev:main' into main
2 parents 3fe4d94 + 68ea0b2 commit 7895ac4

File tree

21 files changed

+3130
-1908
lines changed

21 files changed

+3130
-1908
lines changed

.github/workflows/create-release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ jobs:
3535
with:
3636
fetch-depth: 0
3737

38+
# we _also_ need npm, specifically for webui/preview
39+
- uses: actions/setup-node@v4
40+
with:
41+
node-version: 18
42+
3843
- name: Get previous version
3944
id: read-version
4045
run: |

package/scripts/common/quarto

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ else
9292
QUARTO_ACTION=run
9393
QUARTO_TARGET=${SCRIPT_PATH}/quarto.js
9494
export QUARTO_BIN_PATH=$SCRIPT_PATH
95-
export DENO_DIR=$QUARTO_BIN_PATH/deno_cache
9695
QUARTO_CACHE_OPTIONS="--cached-only"
9796

9897
# Turn off type checking for bundled version

package/src/common/configure.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
kDependencies,
2020
} from "./dependencies/dependencies.ts";
2121
import { suggestUserBinPaths } from "../../../src/core/path.ts";
22-
import { buildQuartoPreviewJs } from "../../../src/core/previewjs.ts";
22+
import { buildQuartoPreviewJs } from "./previewjs.ts";
2323
import { isWindows } from "../../../src/deno_ral/platform.ts";
2424

2525
export async function configure(

package/src/common/prepare-dist.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Dependency,
2121
} from "./dependencies/dependencies.ts";
2222
import { copyQuartoScript } from "./configure.ts";
2323
import { deno } from "./dependencies/deno.ts";
24-
import { buildQuartoPreviewJs } from "../../../src/core/previewjs.ts";
24+
import { buildQuartoPreviewJs } from "./previewjs.ts";
2525

2626
export async function prepareDist(
2727
config: Configuration,

src/core/previewjs.ts renamed to package/src/common/previewjs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
* Copyright (C) 2020-2023 Posit Software, PBC
55
*/
66

7-
import { join } from "../deno_ral/path.ts";
7+
import { join } from "../../../src/deno_ral/path.ts";
88

99
export function buildQuartoPreviewJs(
1010
srcDir: string,
1111
denoDir?: string,
1212
force?: boolean,
1313
) {
14-
const args = ["run", "-A", "build.ts"];
14+
const args = ["run", "--no-config", "-A", "build.ts"];
1515
if (force) {
1616
args.push("--force");
1717
}

src/command/dev-call/build-artifacts/cmd.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export async function buildAssets() {
157157
}
158158

159159
export const buildJsCommand = new Command()
160-
.name("build-js")
160+
.name("build-artifacts")
161161
.hidden()
162162
.description(
163163
"Builds all the javascript assets necessary for IDE support.\n\n",

src/command/dev-call/cmd.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Command } from "cliffy/command/mod.ts";
22
import { quartoConfig } from "../../core/quarto.ts";
33
import { commands } from "../command.ts";
44
import { buildJsCommand } from "./build-artifacts/cmd.ts";
5+
import { hidden } from "../../core/lib/external/colors.ts";
56

67
type CommandOptionInfo = {
78
name: string;
@@ -13,6 +14,7 @@ type CommandOptionInfo = {
1314
};
1415

1516
type CommandInfo = {
17+
hidden: boolean;
1618
name: string;
1719
description: string;
1820
options: CommandOptionInfo[];
@@ -33,10 +35,19 @@ const generateCliInfoCommand = new Command()
3335
output["version"] = quartoConfig.version();
3436
const commandsInfo: CommandInfo[] = [];
3537
output["commands"] = commandsInfo;
38+
39+
// Cliffy doesn't export the "hidden" property, so we maintain our own list
40+
// here
41+
const hiddenCommands = [
42+
"dev-call",
43+
"editor-support",
44+
"create-project",
45+
];
3646
// deno-lint-ignore no-explicit-any
3747
const cmdAsJson = (cmd: any): CommandInfo => {
3848
return {
3949
name: cmd.getName(),
50+
hidden: hiddenCommands.includes(cmd.getName()),
4051
description: cmd.getDescription(),
4152
options: cmd.getOptions(),
4253
usage: cmd.getUsage(),
@@ -50,6 +61,7 @@ const generateCliInfoCommand = new Command()
5061

5162
export const devCallCommand = new Command()
5263
.name("dev-call")
64+
.hidden()
5365
.description(
5466
"Access internals of Quarto - this command is not intended for general use.",
5567
)

src/command/preview/preview.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,7 @@ import {
8484
} from "../../core/platform.ts";
8585
import { isJupyterNotebook } from "../../core/jupyter/jupyter.ts";
8686
import { watchForFileChanges } from "../../core/watch.ts";
87-
import {
88-
previewEnsureResources,
89-
previewMonitorResources,
90-
} from "../../core/quarto.ts";
87+
import { previewMonitorResources } from "../../core/quarto.ts";
9188
import { exitWithCleanup } from "../../core/cleanup.ts";
9289
import {
9390
extensionFilesFromDirs,
@@ -200,9 +197,6 @@ export async function preview(
200197
// const listener = Deno.listen({ port: options.port!, hostname: options.host });
201198
const stopServer = () => ac.abort();
202199

203-
// ensure resources
204-
previewEnsureResources(stopServer);
205-
206200
// create client reloader
207201
const reloader = httpDevServer(
208202
options.timeout!,

src/core/jupyter/jupyter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ export function mdFromContentCell(
10301030
: data as string;
10311031
// base 64 decode if its not svg
10321032
if (!imageText.trimStart().startsWith("<svg")) {
1033-
const imageData = base64decode(imageText);
1033+
const imageData = base64decode(imageText.replaceAll("\n", ""));
10341034
Deno.writeFileSync(outputFile, imageData);
10351035
} else {
10361036
Deno.writeTextFileSync(outputFile, imageText);

src/core/quarto.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { exitWithCleanup } from "./cleanup.ts";
1414
import { onActiveProfileChanged } from "../project/project-profile.ts";
1515
import { onDotenvChanged } from "../quarto-core/dotenv.ts";
1616
import { normalizePath, safeExistsSync } from "./path.ts";
17-
import { buildQuartoPreviewJs } from "./previewjs.ts";
1817
import { isWindows } from "../deno_ral/platform.ts";
1918

2019
export const kLocalDevelopment = "99.9.9";
@@ -78,12 +77,6 @@ export const quartoConfig = {
7877
},
7978
};
8079

81-
export function previewEnsureResources(cleanup?: VoidFunction) {
82-
if (quartoConfig.isDebug()) {
83-
buildPreviewJs(quartoSrcDir(), cleanup);
84-
}
85-
}
86-
8780
export function previewMonitorResources(cleanup?: VoidFunction) {
8881
// active profile changed
8982
onActiveProfileChanged(() => {
@@ -129,10 +122,3 @@ function terminatePreview(reason: string, cleanup?: VoidFunction) {
129122
function quartoSrcDir() {
130123
return normalizePath(join(quartoConfig.binPath(), "../../../src"));
131124
}
132-
133-
function buildPreviewJs(srcDir: string, cleanup?: VoidFunction) {
134-
const output = buildQuartoPreviewJs(srcDir);
135-
if (!output.success) {
136-
terminatePreview("Error building quarto-preview.js", cleanup);
137-
}
138-
}

0 commit comments

Comments
 (0)