Skip to content

Commit f5d1d53

Browse files
committed
chore - deno 2: use esbuild bundlers
1 parent 87a380d commit f5d1d53

File tree

7 files changed

+59
-202
lines changed

7 files changed

+59
-202
lines changed

package/scripts/deno_std/download.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ fi
1010

1111

1212
export DENO_DIR="$QUARTO_SRC_PATH/resources/deno_std/cache"
13-
"$QUARTO_DENO" cache --allow-all --no-config --unstable-ffi --lock "$QUARTO_SRC_PATH/resources/deno_std/deno_std.lock" "$@" "$QUARTO_PACKAGE_PATH/scripts/deno_std/deno_std.ts"
13+
"$QUARTO_DENO" cache --allow-import --no-config --unstable-ffi --lock "$QUARTO_SRC_PATH/resources/deno_std/deno_std.lock" "$@" "$QUARTO_PACKAGE_PATH/scripts/deno_std/deno_std.ts"

package/src/common/prepare-dist.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export async function prepareDist(
9090
try {
9191
await configArchDependency(dependency, targetDir, config)
9292
} catch (e) {
93+
if (!(e instanceof Error)) { throw e; }
9394
if (
9495
e.message ===
9596
"The architecture aarch64 is missing the dependency deno_dom"
@@ -121,13 +122,11 @@ export async function prepareDist(
121122
info("");
122123

123124
// Create the deno bundle
124-
const input = join(config.directoryInfo.src, "quarto.ts");
125+
// const input = join(config.directoryInfo.src, "quarto.ts");
125126
const output = join(config.directoryInfo.pkgWorking.bin, "quarto.js");
126127
info("\nCreating Deno Bundle");
127128
info(output);
128129
await bundle(
129-
input,
130-
output,
131130
config,
132131
);
133132
info("");

package/src/util/deno.ts

Lines changed: 20 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
* Copyright (C) 2020-2022 Posit Software, PBC
55
*
66
*/
7+
import { execProcess } from "../../../src/core/process.ts";
78
import { info } from "../../../src/deno_ral/log.ts";
89
import { isWindows } from "../../../src/deno_ral/platform.ts";
910
import { Configuration } from "../common/config.ts";
1011

12+
// TODO in we only use the bundler for quarto.ts
13+
// so we hardcode it in the new esbuild-based bundler
1114
export async function bundle(
12-
input: string,
13-
output: string,
1415
configuration: Configuration,
1516
) {
1617
// Bundle source code
@@ -19,28 +20,23 @@ export async function bundle(
1920
if (!denoExecPath) {
2021
throw Error("QUARTO_DENO is not defined");
2122
}
22-
denoBundleCmd.push(denoExecPath);
23-
denoBundleCmd.push("bundle");
24-
denoBundleCmd.push("--no-check");
25-
denoBundleCmd.push("--unstable-kv");
26-
denoBundleCmd.push("--unstable-ffi");
27-
denoBundleCmd.push(
28-
"--importmap=" + configuration.importmap,
29-
);
23+
denoBundleCmd.push("run");
24+
denoBundleCmd.push("--allow-all");
25+
denoBundleCmd.push("../tools/deno-esbuild-bundle.ts");
3026
/*
3127
denoBundleCmd.push("--log-level");
3228
denoBundleCmd.push("debug");
3329
*/
30+
// denoBundleCmd.push(input);
31+
// denoBundleCmd.push(output);
3432

35-
denoBundleCmd.push(input);
36-
denoBundleCmd.push(output);
37-
38-
const p = Deno.run({
39-
cmd: denoBundleCmd,
33+
const status = await execProcess({
34+
cmd: denoExecPath,
35+
args: denoBundleCmd,
36+
cwd: configuration.directoryInfo.src,
4037
});
41-
const status = await p.status();
4238
if (status.code !== 0) {
43-
throw Error(`Failure to bundle ${input}`);
39+
throw Error(`Failure to bundle src/quarto.ts`);
4440
}
4541
}
4642

@@ -50,31 +46,7 @@ export async function compile(
5046
flags: string[],
5147
configuration: Configuration,
5248
) {
53-
const denoBundleCmd: string[] = [];
54-
const denoExecPath = Deno.env.get("QUARTO_DENO");
55-
if (!denoExecPath) {
56-
throw Error("QUARTO_DENO is not defined");
57-
}
58-
denoBundleCmd.push(denoExecPath);
59-
denoBundleCmd.push("compile");
60-
denoBundleCmd.push("--unstable-kv");
61-
denoBundleCmd.push("--unstable-ffi");
62-
denoBundleCmd.push(
63-
"--importmap=" + configuration.importmap,
64-
);
65-
denoBundleCmd.push("--output");
66-
denoBundleCmd.push(output);
67-
denoBundleCmd.push(...flags);
68-
69-
denoBundleCmd.push(input);
70-
71-
const p = Deno.run({
72-
cmd: denoBundleCmd,
73-
});
74-
const status = await p.status();
75-
if (status.code !== 0) {
76-
throw Error(`Failure to compile ${input}`);
77-
}
49+
throw new Error("Not implemented");
7850
}
7951

8052
export async function install(
@@ -87,7 +59,6 @@ export async function install(
8759
if (!denoExecPath) {
8860
throw Error("QUARTO_DENO is not defined");
8961
}
90-
denoBundleCmd.push(denoExecPath);
9162
denoBundleCmd.push("install");
9263
denoBundleCmd.push("--unstable-kv");
9364
denoBundleCmd.push("--unstable-ffi");
@@ -98,24 +69,19 @@ export async function install(
9869

9970
denoBundleCmd.push(input);
10071

101-
const p = Deno.run({
102-
cmd: denoBundleCmd,
72+
const status = await execProcess({
73+
cmd: denoExecPath,
74+
args: denoBundleCmd,
10375
stdout: "piped",
10476
});
105-
const status = await p.status();
10677
if (status.code !== 0) {
10778
throw Error(`Failure to install ${input}`);
10879
}
109-
const output = await p.output();
110-
111-
if (output) {
112-
// Try to read the installation path and return it
113-
const outputTxt = new TextDecoder().decode(output);
114-
80+
if (status.stdout) {
11581
// Forward the output
116-
info(outputTxt);
82+
info(status.stdout);
11783

118-
const match = outputTxt.match(/Successfully installed.*\n(.*)/);
84+
const match = status.stdout.match(/Successfully installed.*\n(.*)/);
11985
if (match) {
12086
return match[1];
12187
}

src/resources/editor/tools/vs-code.mjs

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -22964,7 +22964,6 @@ var require_yaml_intelligence_resources = __commonJS({
2296422964
"The light theme name, theme scss file, or a mix of both.",
2296522965
"The dark theme name, theme scss file, or a mix of both.",
2296622966
"The dark theme name, theme scss file, or a mix of both.",
22967-
"Array of rendering names, e.g.&nbsp;<code>[light, dark]</code>",
2296822967
"Classes to apply to the body of the document.",
2296922968
"Disables the built in html features like theming, anchor sections,\ncode block behavior, and more.",
2297022969
"Enables inclusion of Pandoc default CSS for this document.",
@@ -23716,14 +23715,6 @@ var require_yaml_intelligence_resources = __commonJS({
2371623715
"Manuscript configuration",
2371723716
"internal-schema-hack",
2371823717
"List execution engines you want to give priority when determining\nwhich engine should render a notebook. If two engines have support for a\nnotebook, the one listed earlier will be chosen. Quarto\u2019s default order\nis \u2018knitr\u2019, \u2018jupyter\u2019, \u2018markdown\u2019, \u2018julia\u2019.",
23719-
{
23720-
short: "Include an automatically generated table of contents",
23721-
long: ""
23722-
},
23723-
{
23724-
short: "Use smart quotes in document output. Defaults to true.",
23725-
long: ""
23726-
},
2372723718
"Project configuration.",
2372823719
"Project type (<code>default</code>, <code>website</code>,\n<code>book</code>, or <code>manuscript</code>)",
2372923720
"Files to render (defaults to all files)",
@@ -24298,12 +24289,12 @@ var require_yaml_intelligence_resources = __commonJS({
2429824289
mermaid: "%%"
2429924290
},
2430024291
"handlers/mermaid/schema.yml": {
24301-
_internalId: 195e3,
24292+
_internalId: 193834,
2430224293
type: "object",
2430324294
description: "be an object",
2430424295
properties: {
2430524296
"mermaid-format": {
24306-
_internalId: 194992,
24297+
_internalId: 193826,
2430724298
type: "enum",
2430824299
enum: [
2430924300
"png",
@@ -24319,7 +24310,7 @@ var require_yaml_intelligence_resources = __commonJS({
2431924310
exhaustiveCompletions: true
2432024311
},
2432124312
theme: {
24322-
_internalId: 194999,
24313+
_internalId: 193833,
2432324314
type: "anyOf",
2432424315
anyOf: [
2432524316
{
@@ -24359,42 +24350,7 @@ var require_yaml_intelligence_resources = __commonJS({
2435924350
"case-detection": true
2436024351
},
2436124352
$id: "handlers/mermaid"
24362-
},
24363-
"schema/document-typst.yml": [
24364-
{
24365-
name: "page-numbering",
24366-
tags: {
24367-
formats: [
24368-
"typst"
24369-
]
24370-
},
24371-
schema: {
24372-
anyOf: [
24373-
"string",
24374-
{
24375-
enum: [
24376-
false
24377-
]
24378-
}
24379-
]
24380-
},
24381-
description: {
24382-
short: "Include an automatically generated table of contents"
24383-
}
24384-
},
24385-
{
24386-
name: "smart",
24387-
tags: {
24388-
formats: [
24389-
"typst"
24390-
]
24391-
},
24392-
schema: "boolean",
24393-
description: {
24394-
short: "Use smart quotes in document output. Defaults to true."
24395-
}
24396-
}
24397-
]
24353+
}
2439824354
};
2439924355
}
2440024356
});
@@ -31317,6 +31273,8 @@ function locateCursor(annotation, position) {
3131731273
annotation: innermostAnnotation
3131831274
};
3131931275
} catch (e) {
31276+
if (!(e instanceof Error))
31277+
throw e;
3132031278
if (e.message === kInternalLocateError) {
3132131279
return {
3132231280
withError: true

src/resources/editor/tools/yaml/web-worker.js

Lines changed: 6 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)