Skip to content

Commit 396a8d7

Browse files
committed
deno - stdlib to 0.217.0
1 parent a1f2148 commit 396a8d7

302 files changed

Lines changed: 751 additions & 1409 deletions

File tree

Some content is hidden

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

package/src/util/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { writeAll } from "streams/write_all.ts";
1+
import { writeAll } from "io/write_all.ts";
22
import { CmdResult, runCmd } from "./cmd.ts";
33

44
// Read an environment variable

src/command/capabilities/cmd.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
* Copyright (C) 2020-2022 Posit Software, PBC
55
*/
66

7-
import { writeAllSync } from "streams/write_all.ts";
8-
7+
import { writeAllSync } from "io/write_all.ts";
98
import { Command } from "cliffy/command/mod.ts";
109
import { capabilities } from "./capabilities.ts";
1110

src/command/publish/account.ts

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

77
import { info } from "log/mod.ts";
8-
import {
9-
Checkbox,
10-
prompt,
11-
Select,
12-
SelectOption,
13-
} from "cliffy/prompt/mod.ts";
8+
import { Checkbox, prompt, Select, SelectOption } from "cliffy/prompt/mod.ts";
149

1510
import {
1611
accountTokenText,
@@ -108,7 +103,7 @@ export async function accountPrompt(
108103
_provider: PublishProvider,
109104
accounts: AccountToken[],
110105
): Promise<AccountToken | undefined> {
111-
const options: SelectOption[] = accounts
106+
const options: SelectOption<string>[] = accounts
112107
.filter((account) => account.type !== AccountTokenType.Anonymous).map((
113108
account,
114109
) => ({
@@ -175,15 +170,19 @@ export async function manageAccounts() {
175170
for (const account of accounts) {
176171
if (
177172
!keepAccounts.find((keepAccountJson) => {
178-
const keepAccount = JSON.parse(keepAccountJson) as ProviderAccountToken;
173+
const keepAccount = JSON.parse(
174+
keepAccountJson.value,
175+
) as ProviderAccountToken;
179176
return account.provider == keepAccount.provider &&
180177
account.name == keepAccount.name &&
181178
account.server == keepAccount.server;
182179
})
183180
) {
184181
info(
185-
`Removing ${findProvider(account.provider)
186-
?.description} account ${account.name}`,
182+
`Removing ${
183+
findProvider(account.provider)
184+
?.description
185+
} account ${account.name}`,
187186
);
188187
removeAccounts.push(account);
189188
}

src/command/publish/deployment.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,10 @@ export async function chooseDeployment(
232232
options,
233233
});
234234

235-
if (confirm !== kOther) {
235+
if (confirm.value !== kOther) {
236236
return depoyments.find((deployment) =>
237-
publishRecordIdentifier(deployment.target, deployment.account) === confirm
237+
publishRecordIdentifier(deployment.target, deployment.account) ===
238+
confirm.value
238239
);
239240
} else {
240241
return undefined;

src/command/remove/cmd.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ async function selectExtensions(extensions: Extension[]) {
261261
}
262262
});
263263

264-
const extsToKeep: string[] = await Checkbox.prompt({
264+
const extsToKeep: string[] = (await Checkbox.prompt({
265265
message: "Select extension(s) to keep",
266266
options: sorted.map((ext) => {
267267
return {
@@ -275,7 +275,7 @@ async function selectExtensions(extensions: Extension[]) {
275275
hint:
276276
`Use the arrow keys and spacebar to specify extensions you'd like to remove.\n` +
277277
" Press Enter to confirm the list of accounts you wish to remain available.",
278-
});
278+
})).map((x) => x.value);
279279

280280
return extensions.filter((extension) => {
281281
return !extsToKeep.includes(extensionIdString(extension.id));

src/command/render/freeze.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
join,
1313
relative,
1414
} from "path/mod.ts";
15-
import { ensureDirSync, EOL, existsSync, format } from "fs/mod.ts";
15+
import { ensureDirSync, EOL, existsSync, format, LF } from "fs/mod.ts";
1616

1717
import { cloneDeep } from "../../core/lodash.ts";
1818

@@ -38,7 +38,6 @@ import { kProjectLibDir, ProjectContext } from "../../project/types.ts";
3838
import { projectScratchPath } from "../../project/project-scratch.ts";
3939
import { copyMinimal, copyTo } from "../../core/copy.ts";
4040
import { warning } from "log/mod.ts";
41-
import { isWindows } from "../../core/platform.ts";
4241

4342
export const kProjectFreezeDir = "_freeze";
4443
export const kOldFreezeExecuteResults = "execute";
@@ -58,7 +57,7 @@ export function freezeExecuteResult(
5857
if (result.includes[name]) {
5958
result.includes[name] = result.includes[name]!.map((file) =>
6059
// Storing file content using LF line ending
61-
format(Deno.readTextFileSync(file), EOL.LF)
60+
format(Deno.readTextFileSync(file), LF)
6261
);
6362
}
6463
}
@@ -142,7 +141,7 @@ export function defrostExecuteResult(
142141
result.includes[name] = result.includes[name]!.map((content) => {
143142
const includeFile = temp.createFile();
144143
// Restoring content in file using the OS line ending character
145-
content = format(content, isWindows() ? EOL.CRLF : EOL.LF);
144+
content = format(content, EOL);
146145
Deno.writeTextFileSync(includeFile, content);
147146
return includeFile;
148147
});
@@ -305,7 +304,7 @@ export function removeFreezeResults(filesDir: string) {
305304
function freezeInputHash(input: string) {
306305
// Calculate the hash on a content with LF line ending to avoid
307306
// different hash on different OS (#3599)
308-
return md5Hash(format(Deno.readTextFileSync(input), EOL.LF));
307+
return md5Hash(format(Deno.readTextFileSync(input), LF));
309308
}
310309

311310
// don't use _files suffix in freezer

src/command/render/pandoc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { info } from "log/mod.ts";
1111
import { existsSync, expandGlobSync } from "fs/mod.ts";
1212

1313
import { stringify } from "yaml/mod.ts";
14-
import { encode as base64Encode } from "encoding/base64.ts";
14+
import { encodeBase64 } from "encoding/base64.ts";
1515

1616
import * as ld from "../../core/lodash.ts";
1717

@@ -213,7 +213,7 @@ export async function runPandoc(
213213
const pandocEnv: { [key: string]: string } = {};
214214

215215
const setupPandocEnv = () => {
216-
pandocEnv["QUARTO_FILTER_PARAMS"] = base64Encode(paramsJson);
216+
pandocEnv["QUARTO_FILTER_PARAMS"] = encodeBase64(paramsJson);
217217

218218
const traceFilters = pandocMetadata?.["_quarto"]?.["trace-filters"] ||
219219
Deno.env.get("QUARTO_TRACE_FILTERS");

src/core/console.ts

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

77
import { ansi } from "cliffy/ansi/mod.ts";
8-
import { writeAllSync } from "streams/write_all.ts";
9-
import { readAllSync } from "streams/read_all.ts";
8+
import { writeAllSync } from "io/write_all.ts";
9+
import { readAllSync } from "io/read_all.ts";
1010
import { info } from "log/mod.ts";
1111
import { runningInCI } from "./ci-info.ts";
1212
import { SpinnerOptions } from "./console-types.ts";
@@ -55,7 +55,7 @@ export function progressBar(total: number, prefixMessage?: string): {
5555
clearLine();
5656
}
5757

58-
if (typeof (finalMsg) === "string") {
58+
if (typeof finalMsg === "string") {
5959
if (isCi) {
6060
info(finalMsg);
6161
} else {
@@ -94,7 +94,7 @@ export function spinner(
9494
let spin = 0;
9595

9696
// status fn
97-
const statusFn = typeof (status) === "string"
97+
const statusFn = typeof status === "string"
9898
? () => {
9999
return status;
100100
}
@@ -129,7 +129,7 @@ export function spinner(
129129

130130
// Clear the line and display an optional final message
131131
clearLine();
132-
if (typeof (finalMsg) === "string") {
132+
if (typeof finalMsg === "string") {
133133
completeMessage(finalMsg);
134134
} else {
135135
if (finalMsg !== false) {

src/core/download.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Copyright (C) 2020-2022 Posit Software, PBC
55
*/
66

7-
import { writeAll } from "streams/write_all.ts";
7+
import { writeAll } from "io/write_all.ts";
88
import { progressBar } from "./console.ts";
99

1010
export interface DownloadError extends Error {

src/core/log.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import { dirname } from "path/mod.ts";
99
import * as colors from "fmt/colors.ts";
1010
import * as log from "log/mod.ts";
1111
import { LogRecord } from "log/logger.ts";
12-
import { BaseHandler, FileHandler } from "log/handlers.ts";
12+
import { BaseHandler } from "log/base_handler.ts";
13+
import { FileHandler } from "log/file_handler.ts";
1314
import { Command } from "cliffy/command/mod.ts";
1415

1516
import { getenv } from "./env.ts";
@@ -224,13 +225,22 @@ export class LogFileHandler extends FileHandler {
224225
}
225226
}
226227

227-
log(msg: string): void {
228+
async log(msg: string) {
228229
// Ignore any messages that are blank
229230
if (msg !== "") {
230231
// Strip any color information that may have been applied
231232
msg = colors.stripColor(msg);
232-
this._buf.writeSync(this._encoder.encode(msg));
233-
this._buf.flush();
233+
if (!this._file) {
234+
throw new Error("Internal error: logging file not open");
235+
}
236+
let buf = this._encoder.encode(msg);
237+
let total = 0;
238+
while (total < buf.length) {
239+
const offset = this._file.writeSync(buf);
240+
total += offset;
241+
buf = buf.subarray(offset);
242+
}
243+
Deno.fsyncSync(this._file.rid);
234244
}
235245
}
236246
}

0 commit comments

Comments
 (0)