mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
chore: upgrade to dprint 0.39 (#19768)
This commit is contained in:
parent
e4870d84be
commit
f3095b8d31
23 changed files with 148 additions and 70 deletions
|
@ -13,9 +13,6 @@
|
|||
"associations": "**/*.rs",
|
||||
"rustfmt": "rustfmt --config imports_granularity=item"
|
||||
},
|
||||
"includes": [
|
||||
"**/*.{ts,tsx,js,jsx,json,md,toml,rs}"
|
||||
],
|
||||
"excludes": [
|
||||
".cargo_home",
|
||||
".git",
|
||||
|
@ -38,6 +35,7 @@
|
|||
"cli/tests/testdata/lint/glob/*",
|
||||
"cli/tests/testdata/test/glob/*",
|
||||
"cli/tests/testdata/import_assertions/json_with_shebang.json",
|
||||
"cli/tests/testdata/run/error_syntax_empty_trailing_line.mjs",
|
||||
"cli/tests/testdata/run/inline_js_source_map*",
|
||||
"cli/tests/testdata/malformed_config/*",
|
||||
"cli/tests/testdata/npm/registry/",
|
||||
|
@ -56,8 +54,8 @@
|
|||
"ext/websocket/autobahn/reports"
|
||||
],
|
||||
"plugins": [
|
||||
"https://plugins.dprint.dev/typescript-0.85.0.wasm",
|
||||
"https://plugins.dprint.dev/json-0.17.3.wasm",
|
||||
"https://plugins.dprint.dev/typescript-0.85.1.wasm",
|
||||
"https://plugins.dprint.dev/json-0.17.4.wasm",
|
||||
"https://plugins.dprint.dev/markdown-0.15.3.wasm",
|
||||
"https://plugins.dprint.dev/toml-0.5.4.wasm",
|
||||
"https://plugins.dprint.dev/exec-0.3.5.json@d687dda57be0fe9a0088ccdaefa5147649ff24127d8b3ea227536c68ee7abeab"
|
||||
|
|
|
@ -63,4 +63,8 @@ const readFileSync = getFunction("readFileSync");
|
|||
writeFileSync("test", new Uint8Array(1024), { truncate: true });
|
||||
bench(() => readFileSync("test"));
|
||||
|
||||
writeFileSync(new URL(`./${runtime}.json`, import.meta.url), new TextEncoder().encode(JSON.stringify(values, null, 2)), { truncate: true });
|
||||
writeFileSync(
|
||||
new URL(`./${runtime}.json`, import.meta.url),
|
||||
new TextEncoder().encode(JSON.stringify(values, null, 2)),
|
||||
{ truncate: true },
|
||||
);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { run, bench } from "mitata";
|
||||
import { bench, run } from "mitata";
|
||||
import { createRequire } from "module";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
@ -7,4 +7,4 @@ const lib = require("../../../test_napi.node");
|
|||
bench("warmup", () => {});
|
||||
bench("napi_get_undefined", () => lib.test_get_undefined(0));
|
||||
|
||||
run();
|
||||
run();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { addNumbers } from './foo.ts';
|
||||
import { addNumbers } from "./foo.ts";
|
||||
import { assertEquals } from "../../../../../test_util/std/testing/asserts.ts";
|
||||
|
||||
Deno.test("addNumbers works", () => {
|
||||
|
|
|
@ -1 +1 @@
|
|||
console.log("Hello World");
|
||||
console.log("Hello World");
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
// deno-lint-ignore-file prefer-primordials
|
||||
|
||||
import { Buffer } from "node:buffer";
|
||||
import { validateEncoding, validateInteger } from "ext:deno_node/internal/validators.mjs";
|
||||
import {
|
||||
validateEncoding,
|
||||
validateInteger,
|
||||
} from "ext:deno_node/internal/validators.mjs";
|
||||
import * as io from "ext:deno_io/12_io.js";
|
||||
import * as fs from "ext:deno_fs/30_fs.js";
|
||||
import {
|
||||
|
|
|
@ -239,4 +239,3 @@ export const initStdin = () => {
|
|||
|
||||
return stdin;
|
||||
};
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ class Zlib {
|
|||
switch (err) {
|
||||
case Z_BUF_ERROR:
|
||||
this.#error("unexpected end of file", err);
|
||||
return false;
|
||||
return false;
|
||||
case Z_OK:
|
||||
case Z_STREAM_END:
|
||||
// normal statuses, not fatal
|
||||
|
@ -141,8 +141,8 @@ class Zlib {
|
|||
level,
|
||||
memLevel,
|
||||
strategy,
|
||||
dictionary,
|
||||
) {
|
||||
dictionary,
|
||||
) {
|
||||
const err = ops.op_zlib_init(
|
||||
this.#handle,
|
||||
level,
|
||||
|
|
|
@ -8,7 +8,10 @@
|
|||
import { TextDecoder, TextEncoder } from "ext:deno_web/08_text_encoding.js";
|
||||
import { codes } from "ext:deno_node/internal/error_codes.ts";
|
||||
import { encodings } from "ext:deno_node/internal_binding/string_decoder.ts";
|
||||
import { indexOfBuffer, indexOfNumber } from "ext:deno_node/internal_binding/buffer.ts";
|
||||
import {
|
||||
indexOfBuffer,
|
||||
indexOfNumber,
|
||||
} from "ext:deno_node/internal_binding/buffer.ts";
|
||||
import {
|
||||
asciiToBytes,
|
||||
base64ToBytes,
|
||||
|
@ -18,15 +21,21 @@ import {
|
|||
hexToBytes,
|
||||
utf16leToBytes,
|
||||
} from "ext:deno_node/internal_binding/_utils.ts";
|
||||
import { isAnyArrayBuffer, isArrayBufferView } from "ext:deno_node/internal/util/types.ts";
|
||||
import {
|
||||
isAnyArrayBuffer,
|
||||
isArrayBufferView,
|
||||
} from "ext:deno_node/internal/util/types.ts";
|
||||
import { normalizeEncoding } from "ext:deno_node/internal/util.mjs";
|
||||
import { validateBuffer } from "ext:deno_node/internal/validators.mjs";
|
||||
import { isUint8Array } from "ext:deno_node/internal/util/types.ts";
|
||||
import { forgivingBase64Encode, forgivingBase64UrlEncode } from "ext:deno_web/00_infra.js";
|
||||
import {
|
||||
forgivingBase64Encode,
|
||||
forgivingBase64UrlEncode,
|
||||
} from "ext:deno_web/00_infra.js";
|
||||
import { atob, btoa } from "ext:deno_web/05_base64.js";
|
||||
import { Blob } from "ext:deno_web/09_file.js";
|
||||
|
||||
export { atob, btoa, Blob };
|
||||
export { atob, Blob, btoa };
|
||||
|
||||
const utf8Encoder = new TextEncoder();
|
||||
|
||||
|
|
|
@ -30,7 +30,10 @@ const previewEntries = (iter, isKeyValue) => {
|
|||
};
|
||||
import { Buffer } from "node:buffer";
|
||||
const { isBuffer } = Buffer;
|
||||
import { formatWithOptions, inspect } from "ext:deno_node/internal/util/inspect.mjs";
|
||||
import {
|
||||
formatWithOptions,
|
||||
inspect,
|
||||
} from "ext:deno_node/internal/util/inspect.mjs";
|
||||
import {
|
||||
isMap,
|
||||
isMapIterator,
|
||||
|
@ -44,7 +47,10 @@ import {
|
|||
CHAR_LOWERCASE_N as kTraceInstant,
|
||||
CHAR_UPPERCASE_C as kTraceCount,
|
||||
} from "ext:deno_node/internal/constants.ts";
|
||||
import { clearScreenDown, cursorTo } from "ext:deno_node/internal/readline/callbacks.mjs";
|
||||
import {
|
||||
clearScreenDown,
|
||||
cursorTo,
|
||||
} from "ext:deno_node/internal/readline/callbacks.mjs";
|
||||
import cliTable from "ext:deno_node/internal/cli_table.ts";
|
||||
const kCounts = Symbol("counts");
|
||||
|
||||
|
|
|
@ -10,10 +10,16 @@ import {
|
|||
ERR_INVALID_THIS,
|
||||
ERR_MISSING_ARGS,
|
||||
} from "ext:deno_node/internal/errors.ts";
|
||||
import { validateObject, validateString } from "ext:deno_node/internal/validators.mjs";
|
||||
import {
|
||||
validateObject,
|
||||
validateString,
|
||||
} from "ext:deno_node/internal/validators.mjs";
|
||||
import { emitWarning } from "node:process";
|
||||
import { nextTick } from "ext:deno_node/_next_tick.ts";
|
||||
import { Event as WebEvent, EventTarget as WebEventTarget } from "ext:deno_web/02_event.js";
|
||||
import {
|
||||
Event as WebEvent,
|
||||
EventTarget as WebEventTarget,
|
||||
} from "ext:deno_web/02_event.js";
|
||||
|
||||
import {
|
||||
customInspectSymbol,
|
||||
|
|
|
@ -4,10 +4,16 @@
|
|||
// TODO(petamoriken): enable prefer-primordials for node polyfills
|
||||
// deno-lint-ignore-file prefer-primordials
|
||||
|
||||
import { ERR_INVALID_ARG_TYPE, ERR_OUT_OF_RANGE } from "ext:deno_node/internal/errors.ts";
|
||||
import {
|
||||
ERR_INVALID_ARG_TYPE,
|
||||
ERR_OUT_OF_RANGE,
|
||||
} from "ext:deno_node/internal/errors.ts";
|
||||
import { kEmptyObject } from "ext:deno_node/internal/util.mjs";
|
||||
import { deprecate } from "node:util";
|
||||
import { validateFunction, validateInteger } from "ext:deno_node/internal/validators.mjs";
|
||||
import {
|
||||
validateFunction,
|
||||
validateInteger,
|
||||
} from "ext:deno_node/internal/validators.mjs";
|
||||
import { errorOrDestroy } from "ext:deno_node/internal/streams/destroy.mjs";
|
||||
import { open as fsOpen } from "ext:deno_node/_fs/_fs_open.ts";
|
||||
import { read as fsRead } from "ext:deno_node/_fs/_fs_read.ts";
|
||||
|
|
|
@ -25,7 +25,10 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
import { ERR_INVALID_ARG_VALUE, ERR_INVALID_CURSOR_POS } from "ext:deno_node/internal/errors.ts";
|
||||
import {
|
||||
ERR_INVALID_ARG_VALUE,
|
||||
ERR_INVALID_CURSOR_POS,
|
||||
} from "ext:deno_node/internal/errors.ts";
|
||||
|
||||
import { validateFunction } from "ext:deno_node/internal/validators.mjs";
|
||||
|
||||
|
|
|
@ -23,7 +23,11 @@
|
|||
// TODO(petamoriken): enable prefer-primordials for node polyfills
|
||||
// deno-lint-ignore-file prefer-primordials
|
||||
|
||||
import { charLengthAt, CSI, emitKeys } from "ext:deno_node/internal/readline/utils.mjs";
|
||||
import {
|
||||
charLengthAt,
|
||||
CSI,
|
||||
emitKeys,
|
||||
} from "ext:deno_node/internal/readline/utils.mjs";
|
||||
import { kSawKeyPress } from "ext:deno_node/internal/readline/symbols.mjs";
|
||||
import { clearTimeout, setTimeout } from "node:timers";
|
||||
|
||||
|
|
|
@ -24,7 +24,10 @@
|
|||
// deno-lint-ignore-file prefer-primordials
|
||||
// deno-lint-ignore-file camelcase no-inner-declarations no-this-alias
|
||||
|
||||
import { ERR_INVALID_ARG_VALUE, ERR_USE_AFTER_CLOSE } from "ext:deno_node/internal/errors.ts";
|
||||
import {
|
||||
ERR_INVALID_ARG_VALUE,
|
||||
ERR_USE_AFTER_CLOSE,
|
||||
} from "ext:deno_node/internal/errors.ts";
|
||||
import {
|
||||
validateAbortSignal,
|
||||
validateArray,
|
||||
|
@ -44,7 +47,11 @@ import {
|
|||
commonPrefix,
|
||||
kSubstringSearch,
|
||||
} from "ext:deno_node/internal/readline/utils.mjs";
|
||||
import { clearScreenDown, cursorTo, moveCursor } from "ext:deno_node/internal/readline/callbacks.mjs";
|
||||
import {
|
||||
clearScreenDown,
|
||||
cursorTo,
|
||||
moveCursor,
|
||||
} from "ext:deno_node/internal/readline/callbacks.mjs";
|
||||
import { Readable } from "ext:deno_node/_stream.mjs";
|
||||
import process from "node:process";
|
||||
|
||||
|
|
|
@ -4,10 +4,16 @@
|
|||
// TODO(petamoriken): enable prefer-primordials for node polyfills
|
||||
// deno-lint-ignore-file prefer-primordials
|
||||
|
||||
import { ArrayPrototypeJoin, ArrayPrototypePush } from "ext:deno_node/internal/primordials.mjs";
|
||||
import {
|
||||
ArrayPrototypeJoin,
|
||||
ArrayPrototypePush,
|
||||
} from "ext:deno_node/internal/primordials.mjs";
|
||||
|
||||
import { CSI } from "ext:deno_node/internal/readline/utils.mjs";
|
||||
import { validateBoolean, validateInteger } from "ext:deno_node/internal/validators.mjs";
|
||||
import {
|
||||
validateBoolean,
|
||||
validateInteger,
|
||||
} from "ext:deno_node/internal/validators.mjs";
|
||||
import { isWritable } from "ext:deno_node/internal/streams/utils.mjs";
|
||||
import { ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts";
|
||||
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// deno-lint-ignore-file
|
||||
|
||||
import { AbortError, ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts";
|
||||
import {
|
||||
AbortError,
|
||||
ERR_INVALID_ARG_TYPE,
|
||||
} from "ext:deno_node/internal/errors.ts";
|
||||
import eos from "ext:deno_node/internal/streams/end-of-stream.mjs";
|
||||
|
||||
// This method is inlined here for readable-stream
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// deno-lint-ignore-file
|
||||
|
||||
import { aggregateTwoErrors, ERR_MULTIPLE_CALLBACK } from "ext:deno_node/internal/errors.ts";
|
||||
import {
|
||||
aggregateTwoErrors,
|
||||
ERR_MULTIPLE_CALLBACK,
|
||||
} from "ext:deno_node/internal/errors.ts";
|
||||
import * as process from "ext:deno_node/_process/process.ts";
|
||||
|
||||
const kDestroy = Symbol("kDestroy");
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// deno-lint-ignore-file
|
||||
|
||||
import { AbortError, ERR_STREAM_PREMATURE_CLOSE } from "ext:deno_node/internal/errors.ts";
|
||||
import {
|
||||
AbortError,
|
||||
ERR_STREAM_PREMATURE_CLOSE,
|
||||
} from "ext:deno_node/internal/errors.ts";
|
||||
import { once } from "ext:deno_node/internal/util.mjs";
|
||||
import {
|
||||
validateAbortSignal,
|
||||
|
|
|
@ -12,13 +12,16 @@ const {
|
|||
} = primordials;
|
||||
|
||||
import { inspect } from "ext:deno_node/internal/util/inspect.mjs";
|
||||
import { validateFunction, validateNumber } from "ext:deno_node/internal/validators.mjs";
|
||||
import {
|
||||
validateFunction,
|
||||
validateNumber,
|
||||
} from "ext:deno_node/internal/validators.mjs";
|
||||
import { ERR_OUT_OF_RANGE } from "ext:deno_node/internal/errors.ts";
|
||||
import { emitWarning } from "node:process";
|
||||
import {
|
||||
setTimeout as setTimeout_,
|
||||
clearTimeout as clearTimeout_,
|
||||
setInterval as setInterval_,
|
||||
setTimeout as setTimeout_,
|
||||
} from "ext:deno_web/02_timers.js";
|
||||
|
||||
// Timeout values > TIMEOUT_MAX are set to 1.
|
||||
|
@ -55,10 +58,10 @@ Timeout.prototype[createTimer] = function () {
|
|||
const callback = this._onTimeout;
|
||||
const cb = (...args) => {
|
||||
if (!this._isRepeat) {
|
||||
MapPrototypeDelete(activeTimers, this[kTimerId])
|
||||
MapPrototypeDelete(activeTimers, this[kTimerId]);
|
||||
}
|
||||
return callback.bind(this)(...args);
|
||||
}
|
||||
};
|
||||
const id = this._isRepeat
|
||||
? setInterval_(cb, this._idleTimeout, ...this._timerArgs)
|
||||
: setTimeout_(cb, this._idleTimeout, ...this._timerArgs);
|
||||
|
|
|
@ -4,9 +4,15 @@
|
|||
// deno-lint-ignore-file prefer-primordials
|
||||
|
||||
import { validateFunction } from "ext:deno_node/internal/validators.mjs";
|
||||
import { normalizeEncoding, slowCases } from "ext:deno_node/internal/normalize_encoding.mjs";
|
||||
import {
|
||||
normalizeEncoding,
|
||||
slowCases,
|
||||
} from "ext:deno_node/internal/normalize_encoding.mjs";
|
||||
export { normalizeEncoding, slowCases };
|
||||
import { ObjectCreate, StringPrototypeToUpperCase } from "ext:deno_node/internal/primordials.mjs";
|
||||
import {
|
||||
ObjectCreate,
|
||||
StringPrototypeToUpperCase,
|
||||
} from "ext:deno_node/internal/primordials.mjs";
|
||||
import { ERR_UNKNOWN_SIGNAL } from "ext:deno_node/internal/errors.ts";
|
||||
import { os } from "ext:deno_node/internal_binding/constants.ts";
|
||||
|
||||
|
|
|
@ -23,11 +23,19 @@
|
|||
// TODO(petamoriken): enable prefer-primordials for node polyfills
|
||||
// deno-lint-ignore-file prefer-primordials
|
||||
|
||||
import { validateObject, validateString } from "ext:deno_node/internal/validators.mjs";
|
||||
import {
|
||||
validateObject,
|
||||
validateString,
|
||||
} from "ext:deno_node/internal/validators.mjs";
|
||||
import { codes } from "ext:deno_node/internal/error_codes.ts";
|
||||
import { createStylizeWithColor, formatValue, formatNumber, formatBigInt, styles, colors } from "ext:deno_console/01_console.js";
|
||||
|
||||
|
||||
import {
|
||||
colors,
|
||||
createStylizeWithColor,
|
||||
formatBigInt,
|
||||
formatNumber,
|
||||
formatValue,
|
||||
styles,
|
||||
} from "ext:deno_console/01_console.js";
|
||||
|
||||
// Set Graphics Rendition https://en.wikipedia.org/wiki/ANSI_escape_code#graphics
|
||||
// Each color consists of an array with the color code as first entry and the
|
||||
|
@ -95,38 +103,37 @@ function defineColorAlias(target, alias) {
|
|||
});
|
||||
}
|
||||
|
||||
defineColorAlias('gray', 'grey');
|
||||
defineColorAlias('gray', 'blackBright');
|
||||
defineColorAlias('bgGray', 'bgGrey');
|
||||
defineColorAlias('bgGray', 'bgBlackBright');
|
||||
defineColorAlias('dim', 'faint');
|
||||
defineColorAlias('strikethrough', 'crossedout');
|
||||
defineColorAlias('strikethrough', 'strikeThrough');
|
||||
defineColorAlias('strikethrough', 'crossedOut');
|
||||
defineColorAlias('hidden', 'conceal');
|
||||
defineColorAlias('inverse', 'swapColors');
|
||||
defineColorAlias('inverse', 'swapcolors');
|
||||
defineColorAlias('doubleunderline', 'doubleUnderline');
|
||||
defineColorAlias("gray", "grey");
|
||||
defineColorAlias("gray", "blackBright");
|
||||
defineColorAlias("bgGray", "bgGrey");
|
||||
defineColorAlias("bgGray", "bgBlackBright");
|
||||
defineColorAlias("dim", "faint");
|
||||
defineColorAlias("strikethrough", "crossedout");
|
||||
defineColorAlias("strikethrough", "strikeThrough");
|
||||
defineColorAlias("strikethrough", "crossedOut");
|
||||
defineColorAlias("hidden", "conceal");
|
||||
defineColorAlias("inverse", "swapColors");
|
||||
defineColorAlias("inverse", "swapcolors");
|
||||
defineColorAlias("doubleunderline", "doubleUnderline");
|
||||
|
||||
// TODO(BridgeAR): Add function style support for more complex styles.
|
||||
// Don't use 'blue' not visible on cmd.exe
|
||||
inspect.styles = Object.assign(Object.create(null), {
|
||||
special: 'cyan',
|
||||
number: 'yellow',
|
||||
bigint: 'yellow',
|
||||
boolean: 'yellow',
|
||||
undefined: 'grey',
|
||||
null: 'bold',
|
||||
string: 'green',
|
||||
symbol: 'green',
|
||||
date: 'magenta',
|
||||
special: "cyan",
|
||||
number: "yellow",
|
||||
bigint: "yellow",
|
||||
boolean: "yellow",
|
||||
undefined: "grey",
|
||||
null: "bold",
|
||||
string: "green",
|
||||
symbol: "green",
|
||||
date: "magenta",
|
||||
// "name": intentionally not styling
|
||||
// TODO(BridgeAR): Highlight regular expressions properly.
|
||||
regexp: 'red',
|
||||
module: 'underline',
|
||||
regexp: "red",
|
||||
module: "underline",
|
||||
});
|
||||
|
||||
|
||||
const inspectDefaultOptions = {
|
||||
indentationLvl: 0,
|
||||
currentDepth: 0,
|
||||
|
@ -207,7 +214,9 @@ export function inspect(value, opts) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (ctx.colors) ctx.stylize = createStylizeWithColor(inspect.styles, inspect.colors);
|
||||
if (ctx.colors) {
|
||||
ctx.stylize = createStylizeWithColor(inspect.styles, inspect.colors);
|
||||
}
|
||||
if (ctx.maxArrayLength === null) ctx.maxArrayLength = Infinity;
|
||||
if (ctx.maxStringLength === null) ctx.maxStringLength = Infinity;
|
||||
return formatValue(ctx, value, 0);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit fd270b79276bb2bed365f3fb2e4ba6acaff3234b
|
||||
Subproject commit 0eb5c9cbbc6c2d72a82ae5e65b4944ef8eb8fbd7
|
Loading…
Reference in a new issue