diff --git a/.dprint.json b/.dprint.json index 1decc7863e..3f2c15a7a0 100644 --- a/.dprint.json +++ b/.dprint.json @@ -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" diff --git a/cli/bench/fs/run.mjs b/cli/bench/fs/run.mjs index 7f27438b08..727b4126ca 100644 --- a/cli/bench/fs/run.mjs +++ b/cli/bench/fs/run.mjs @@ -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 }); \ No newline at end of file +writeFileSync( + new URL(`./${runtime}.json`, import.meta.url), + new TextEncoder().encode(JSON.stringify(values, null, 2)), + { truncate: true }, +); diff --git a/cli/bench/napi/bench_node.mjs b/cli/bench/napi/bench_node.mjs index 7bfb638143..2593aadd28 100644 --- a/cli/bench/napi/bench_node.mjs +++ b/cli/bench/napi/bench_node.mjs @@ -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(); \ No newline at end of file +run(); diff --git a/cli/tests/testdata/coverage/no_tests_included/foo.test.mts b/cli/tests/testdata/coverage/no_tests_included/foo.test.mts index 5d8ae9f27b..12da76d02b 100644 --- a/cli/tests/testdata/coverage/no_tests_included/foo.test.mts +++ b/cli/tests/testdata/coverage/no_tests_included/foo.test.mts @@ -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", () => { diff --git a/cli/tests/testdata/run/cjs_imports/commonjs.cjs b/cli/tests/testdata/run/cjs_imports/commonjs.cjs index 7df7d571e6..accefceba6 100644 --- a/cli/tests/testdata/run/cjs_imports/commonjs.cjs +++ b/cli/tests/testdata/run/cjs_imports/commonjs.cjs @@ -1 +1 @@ -console.log("Hello World"); \ No newline at end of file +console.log("Hello World"); diff --git a/ext/node/polyfills/_fs/_fs_write.mjs b/ext/node/polyfills/_fs/_fs_write.mjs index aea1e72365..aa23805bf3 100644 --- a/ext/node/polyfills/_fs/_fs_write.mjs +++ b/ext/node/polyfills/_fs/_fs_write.mjs @@ -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 { diff --git a/ext/node/polyfills/_process/streams.mjs b/ext/node/polyfills/_process/streams.mjs index bb9ed69ec4..b6efef65ea 100644 --- a/ext/node/polyfills/_process/streams.mjs +++ b/ext/node/polyfills/_process/streams.mjs @@ -239,4 +239,3 @@ export const initStdin = () => { return stdin; }; - diff --git a/ext/node/polyfills/_zlib_binding.mjs b/ext/node/polyfills/_zlib_binding.mjs index ce6d2f6ccd..a04e7fed75 100644 --- a/ext/node/polyfills/_zlib_binding.mjs +++ b/ext/node/polyfills/_zlib_binding.mjs @@ -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, diff --git a/ext/node/polyfills/internal/buffer.mjs b/ext/node/polyfills/internal/buffer.mjs index 2f95463f28..29ea2e84d3 100644 --- a/ext/node/polyfills/internal/buffer.mjs +++ b/ext/node/polyfills/internal/buffer.mjs @@ -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(); diff --git a/ext/node/polyfills/internal/console/constructor.mjs b/ext/node/polyfills/internal/console/constructor.mjs index f15e677ec0..5ea9eeb3a2 100644 --- a/ext/node/polyfills/internal/console/constructor.mjs +++ b/ext/node/polyfills/internal/console/constructor.mjs @@ -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"); diff --git a/ext/node/polyfills/internal/event_target.mjs b/ext/node/polyfills/internal/event_target.mjs index 7f7ab8c609..0394b921e8 100644 --- a/ext/node/polyfills/internal/event_target.mjs +++ b/ext/node/polyfills/internal/event_target.mjs @@ -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, diff --git a/ext/node/polyfills/internal/fs/streams.mjs b/ext/node/polyfills/internal/fs/streams.mjs index ef913f6e23..a1e1ca2ac4 100644 --- a/ext/node/polyfills/internal/fs/streams.mjs +++ b/ext/node/polyfills/internal/fs/streams.mjs @@ -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"; diff --git a/ext/node/polyfills/internal/readline/callbacks.mjs b/ext/node/polyfills/internal/readline/callbacks.mjs index 51494b6b1b..d13a006148 100644 --- a/ext/node/polyfills/internal/readline/callbacks.mjs +++ b/ext/node/polyfills/internal/readline/callbacks.mjs @@ -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"; diff --git a/ext/node/polyfills/internal/readline/emitKeypressEvents.mjs b/ext/node/polyfills/internal/readline/emitKeypressEvents.mjs index 6a68e0f678..c69bbe62bc 100644 --- a/ext/node/polyfills/internal/readline/emitKeypressEvents.mjs +++ b/ext/node/polyfills/internal/readline/emitKeypressEvents.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"; diff --git a/ext/node/polyfills/internal/readline/interface.mjs b/ext/node/polyfills/internal/readline/interface.mjs index 3c214322a9..a195cf549e 100644 --- a/ext/node/polyfills/internal/readline/interface.mjs +++ b/ext/node/polyfills/internal/readline/interface.mjs @@ -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"; diff --git a/ext/node/polyfills/internal/readline/promises.mjs b/ext/node/polyfills/internal/readline/promises.mjs index dbcdd61d6e..773fa89228 100644 --- a/ext/node/polyfills/internal/readline/promises.mjs +++ b/ext/node/polyfills/internal/readline/promises.mjs @@ -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"; diff --git a/ext/node/polyfills/internal/streams/add-abort-signal.mjs b/ext/node/polyfills/internal/streams/add-abort-signal.mjs index 497fc49413..515d0e0f1d 100644 --- a/ext/node/polyfills/internal/streams/add-abort-signal.mjs +++ b/ext/node/polyfills/internal/streams/add-abort-signal.mjs @@ -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 diff --git a/ext/node/polyfills/internal/streams/destroy.mjs b/ext/node/polyfills/internal/streams/destroy.mjs index bdca4dacd1..74e6687db8 100644 --- a/ext/node/polyfills/internal/streams/destroy.mjs +++ b/ext/node/polyfills/internal/streams/destroy.mjs @@ -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"); diff --git a/ext/node/polyfills/internal/streams/end-of-stream.mjs b/ext/node/polyfills/internal/streams/end-of-stream.mjs index 021880e893..1b875aab8b 100644 --- a/ext/node/polyfills/internal/streams/end-of-stream.mjs +++ b/ext/node/polyfills/internal/streams/end-of-stream.mjs @@ -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, diff --git a/ext/node/polyfills/internal/timers.mjs b/ext/node/polyfills/internal/timers.mjs index c2e8c00e91..3dc5073c63 100644 --- a/ext/node/polyfills/internal/timers.mjs +++ b/ext/node/polyfills/internal/timers.mjs @@ -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); diff --git a/ext/node/polyfills/internal/util.mjs b/ext/node/polyfills/internal/util.mjs index 5d78902bff..5965998597 100644 --- a/ext/node/polyfills/internal/util.mjs +++ b/ext/node/polyfills/internal/util.mjs @@ -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"; diff --git a/ext/node/polyfills/internal/util/inspect.mjs b/ext/node/polyfills/internal/util/inspect.mjs index 59fd2be88c..f702c39c5d 100644 --- a/ext/node/polyfills/internal/util/inspect.mjs +++ b/ext/node/polyfills/internal/util/inspect.mjs @@ -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); diff --git a/third_party b/third_party index fd270b7927..0eb5c9cbbc 160000 --- a/third_party +++ b/third_party @@ -1 +1 @@ -Subproject commit fd270b79276bb2bed365f3fb2e4ba6acaff3234b +Subproject commit 0eb5c9cbbc6c2d72a82ae5e65b4944ef8eb8fbd7