Skip to content

Commit 8c4b66a

Browse files
authored
Upgrade deno (#3491)
This temporarily disables some features which currently depend on puppeteer, which doesn't work on Deno 1.28.2 because of a separate bundling bug. We'll have a fix for this before 1.3 becomes stable.
1 parent f3b0ecc commit 8c4b66a

File tree

460 files changed

+36586
-12175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

460 files changed

+36586
-12175
lines changed

configuration

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# deno_dom should match release at https://github.com/b-fuze/deno-dom/releases
99

1010
# Binary dependencies
11-
export DENO=v1.26.1
11+
export DENO=v1.28.2
1212
export DENO_DOM=v0.1.23-alpha-artifacts
1313
export PANDOC=2.19.2
1414
export DARTSASS=1.32.8

package/src/common/configure.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
*
66
*/
77
import { dirname, join, SEP } from "path/mod.ts";
8-
import { ensureDirSync, existsSync } from "fs/mod.ts";
8+
import { existsSync } from "node/fs.ts";
9+
import { ensureDirSync } from "fs/mod.ts";
910
import { info, warning } from "log/mod.ts";
1011

1112
import { expandPath } from "../../../src/core/path.ts";

src/command/convert/cmd.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
*/
77

8-
import { exists } from "fs/exists.ts";
8+
import { existsSync } from "node/fs.ts";
99
import { join } from "path/mod.ts";
1010
import { info } from "log/mod.ts";
1111

@@ -51,7 +51,7 @@ export const convertCommand = new Command()
5151
.action(async (options: any, input: string) => {
5252
await initYamlIntelligenceResourcesFromFilesystem();
5353

54-
if (!await exists(input)) {
54+
if (!existsSync(input)) {
5555
throw new Error(`File not found: '${input}'`);
5656
}
5757

src/command/install/cmd.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ export const installCommand = new Command()
4343
"Install TinyTeX",
4444
"quarto install tool tinytex",
4545
)
46-
.example(
47-
"Install Chromium",
48-
"quarto install tool chromium",
49-
)
46+
// temporarily disabled until we get things in order in 1.28.*
47+
// .example(
48+
// "Install Chromium",
49+
// "quarto install tool chromium",
50+
// )
5051
.example(
5152
"Choose tool to install",
5253
"quarto install tool",

src/command/update/cmd.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ export const updateCommand = new Command()
4848
"Update TinyTeX",
4949
"quarto update tool tinytex",
5050
)
51-
.example(
52-
"Update Chromium",
53-
"quarto update tool chromium",
54-
)
51+
// temporarily disabled until we get things in order in 1.28.*
52+
// .example(
53+
// "Update Chromium",
54+
// "quarto update tool chromium",
55+
// )
5556
.example(
5657
"Choose tool to update",
5758
"quarto update tool",

src/config/metadata.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import * as ld from "../core/lodash.ts";
99

10-
import { exists } from "fs/exists.ts";
10+
import { existsSync } from "node/fs.ts";
1111
import { join } from "path/mod.ts";
1212
import { error } from "log/mod.ts";
1313

@@ -64,7 +64,7 @@ export async function includedMetadata(
6464

6565
// Read the yaml
6666
const filesMetadata = await Promise.all(yamlFiles.map(async (yamlFile) => {
67-
if (await exists(yamlFile)) {
67+
if (existsSync(yamlFile)) {
6868
try {
6969
const yaml = await readAndValidateYamlFromFile(
7070
yamlFile,

src/core/cri/cri.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import { decode } from "encoding/base64.ts";
1010
import cdp from "./deno-cri/index.js";
11-
import { getBrowserExecutablePath } from "../puppeteer.ts";
11+
// import { getBrowserExecutablePath } from "../puppeteer.ts";
1212
import { Semaphore } from "../lib/semaphore.ts";
1313
import { findOpenPort } from "../port.ts";
1414
import { getNamedLifetime, ObjectWithLifetime } from "../lifetimes.ts";
@@ -74,7 +74,10 @@ export async function criClient(appPath?: string, port?: number) {
7474
port = findOpenPort(9222);
7575
}
7676
if (appPath === undefined) {
77-
appPath = await getBrowserExecutablePath();
77+
throw new Error(
78+
"appPath is temporarily required while deno 1.28.* lacks support for puppeteer and browser discovery",
79+
);
80+
// appPath = await getBrowserExecutablePath();
7881
}
7982

8083
const cmd = [

src/core/file.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
*
66
*/
77

8-
import { TextProtoReader } from "textproto/mod.ts";
9-
import { BufReader } from "io/mod.ts";
10-
import { exists } from "fs/mod.ts";
8+
import { existsSync } from "node/fs.ts";
119
import { execProcess } from "./process.ts";
10+
import { TextLineStream } from "streams/mod.ts";
1211

1312
export async function visitLines(
1413
path: string,
1514
visitor: (line: string | null, count: number) => boolean,
1615
) {
17-
if (await exists(path)) {
16+
if (existsSync(path)) {
1817
const file = await Deno.open(path, { read: true });
1918
try {
20-
const reader = new TextProtoReader(BufReader.create(file));
19+
const stream = file.readable
20+
.pipeThrough(new TextDecoderStream())
21+
.pipeThrough(new TextLineStream());
2122

2223
let count = 0;
23-
while (true) {
24-
const line = await reader.readLine();
24+
for await (const line of stream) {
2525
if (line !== null) {
2626
if (!visitor(line, count)) {
2727
break;

src/core/handlers/base.ts

Lines changed: 10 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ import { ensureDirSync } from "fs/mod.ts";
7373
import { mappedStringFromFile } from "../mapped-text.ts";
7474
import { error } from "log/mod.ts";
7575
import { withCriClient } from "../cri/cri.ts";
76-
/* import {
77-
extractHtmlFromElements,
78-
extractImagesFromElements,
79-
} from "../puppeteer.ts";
80-
*/
8176
const handlers: Record<string, LanguageHandler> = {};
8277

8378
let globalFigureCounter: Record<string, number> = {};
@@ -114,33 +109,19 @@ function makeHandlerContext(
114109
return options.state![options.name];
115110
},
116111

117-
async extractHtml(opts: {
112+
//deno-lint-ignore require-await
113+
async extractHtml(_opts: {
118114
html: string;
119115
selector: string;
120116
resources?: [string, string][];
121117
}): Promise<string[]> {
122-
const {
123-
html: content,
124-
selector,
125-
} = opts;
126-
const nonEmptyHtmlResources: [string, string][] = opts.resources ||
127-
[];
128-
const dirName = context.options.temp.createDir();
129-
// create temporary resources
130-
for (const [name, content] of nonEmptyHtmlResources) {
131-
Deno.writeTextFileSync(join(dirName, name), content);
132-
}
133-
const fileName = join(dirName, "index.html");
134-
Deno.writeTextFileSync(fileName, content);
135-
const url = `file://${fileName}`;
136-
137-
return await withCriClient(async (client) => {
138-
await client.open(url);
139-
return await client.contents(selector);
140-
});
118+
throw new Error(
119+
"Internal error: temporarily disabled until deno 1.28.* gets puppeteer support",
120+
);
141121
},
142122

143-
async createPngsFromHtml(opts: {
123+
//deno-lint-ignore require-await
124+
async createPngsFromHtml(_opts: {
144125
prefix: string;
145126
html: string;
146127
deviceScaleFactor: number;
@@ -150,51 +131,9 @@ function makeHandlerContext(
150131
filenames: string[];
151132
elements: string[];
152133
}> {
153-
const {
154-
prefix,
155-
html: content,
156-
deviceScaleFactor,
157-
selector,
158-
} = opts;
159-
const nonEmptyHtmlResources: [string, string][] = opts.resources ||
160-
[];
161-
const dirName = context.options.temp.createDir();
162-
163-
// create temporary resources
164-
for (const [name, content] of nonEmptyHtmlResources) {
165-
Deno.writeTextFileSync(join(dirName, name), content);
166-
}
167-
const fileName = join(dirName, "index.html");
168-
Deno.writeTextFileSync(fileName, content);
169-
const url = `file://${fileName}`;
170-
171-
const { elements, images } = await withCriClient(async (client) => {
172-
await client.open(url);
173-
const elements = await client.contents(selector);
174-
const screenshots = await client.screenshots(
175-
selector,
176-
deviceScaleFactor,
177-
);
178-
return {
179-
elements,
180-
images: screenshots.map((x) => x.data),
181-
};
182-
});
183-
184-
// write figures to disk
185-
const sourceNames: string[] = [];
186-
187-
for (let i = 0; i < images.length; ++i) {
188-
const { sourceName, fullName } = context
189-
.uniqueFigureName(prefix, ".png");
190-
sourceNames.push(sourceName);
191-
Deno.writeFileSync(fullName, images[i]);
192-
}
193-
194-
return {
195-
filenames: sourceNames,
196-
elements,
197-
};
134+
throw new Error(
135+
"Internal error: temporarily disabled until deno 1.28.* gets puppeteer support",
136+
);
198137
},
199138

200139
cellContent(cell: QuartoMdCell): MappedString {

src/core/lib/yaml-intelligence/parsing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export async function getTreeSitter(): Promise<any> {
5757
const treeSitterYamlJson = (await import(
5858
"../../../resources/editor/tools/yaml/tree-sitter-yaml.json",
5959
{ assert: { type: "json" } }
60-
)) as { data: number[] };
60+
)).default as { data: number[] };
6161

6262
const YAML = await Parser.Language.load(
6363
new Uint8Array(treeSitterYamlJson.data),

0 commit comments

Comments
 (0)