Skip to content

Commit

Permalink
refactor: make the code work under verbatimModuleSyntax (denoland#4406
Browse files Browse the repository at this point in the history
)

* Start

* Update

* Format

* Revert deno.json change

---------

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
  • Loading branch information
dsherret and iuioiua authored Feb 27, 2024
1 parent 2dac7a6 commit ef6b95f
Show file tree
Hide file tree
Showing 96 changed files with 153 additions and 119 deletions.
2 changes: 1 addition & 1 deletion _tools/check_circular_submodule_dependencies.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { createGraph, ModuleGraphJson, ModuleJson } from "deno_graph";
import { createGraph, type ModuleGraphJson, type ModuleJson } from "deno_graph";

/**
* Checks for circular dependencies in the std submodules.
Expand Down
2 changes: 1 addition & 1 deletion archive/untar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
HEADER_LENGTH,
readBlock,
type TarMeta,
UstarFields,
type UstarFields,
ustarStructure,
} from "./_common.ts";
import { readAll } from "../io/read_all.ts";
Expand Down
2 changes: 1 addition & 1 deletion archive/untar_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Tar, type TarMeta } from "./tar.ts";
import {
TarEntry,
type TarHeader,
TarMetaWithLinkName,
type TarMetaWithLinkName,
Untar,
} from "./untar.ts";
import { Buffer } from "../io/buffer.ts";
Expand Down
2 changes: 1 addition & 1 deletion async/debounce_test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { assertEquals, assertStrictEquals } from "../assert/mod.ts";
import { debounce, DebouncedFunction } from "./debounce.ts";
import { debounce, type DebouncedFunction } from "./debounce.ts";
import { delay } from "./delay.ts";

Deno.test("debounce() handles called", async function () {
Expand Down
4 changes: 2 additions & 2 deletions cli/parse_args_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "../assert/mod.ts";
import { Args, parseArgs, ParseOptions } from "./parse_args.ts";
import { assertType, IsExact } from "../testing/types.ts";
import { type Args, parseArgs, type ParseOptions } from "./parse_args.ts";
import { assertType, type IsExact } from "../testing/types.ts";

// flag boolean true (default all --args to boolean)
Deno.test("parseArgs() handles true boolean flag", function () {
Expand Down
2 changes: 1 addition & 1 deletion crypto/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
*/

import {
DigestAlgorithm as WasmDigestAlgorithm,
type DigestAlgorithm as WasmDigestAlgorithm,
digestAlgorithms as wasmDigestAlgorithms,
instantiateWasm,
} from "./_wasm/mod.ts";
Expand Down
2 changes: 1 addition & 1 deletion crypto/crypto_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { assert, assertEquals, assertInstanceOf, fail } from "../assert/mod.ts";
import { crypto as stdCrypto } from "./mod.ts";
import { repeat } from "../bytes/repeat.ts";
import { DigestAlgorithm, digestAlgorithms } from "./_wasm/mod.ts";
import { type DigestAlgorithm, digestAlgorithms } from "./_wasm/mod.ts";
import { encodeHex } from "../encoding/hex.ts";

const webCrypto = globalThis.crypto;
Expand Down
2 changes: 1 addition & 1 deletion csv/parse_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { assert, assertEquals, assertThrows } from "../assert/mod.ts";
import { parse, ParseError, ParseOptions } from "./parse.ts";
import { parse, ParseError, type ParseOptions } from "./parse.ts";
import type { AssertTrue, IsExact } from "../testing/types.ts";

const BYTE_ORDER_MARK = "\ufeff";
Expand Down
2 changes: 1 addition & 1 deletion data_structures/_red_black_node.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

import { BinarySearchNode, Direction } from "./_binary_search_node.ts";
import { BinarySearchNode, type Direction } from "./_binary_search_node.ts";
export type { Direction };

export class RedBlackNode<T> extends BinarySearchNode<T> {
Expand Down
2 changes: 1 addition & 1 deletion data_structures/binary_heap_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { assert, assertEquals } from "../assert/mod.ts";
import { BinaryHeap } from "./binary_heap.ts";
import { ascend, descend } from "./comparators.ts";
import { Container, MyMath } from "./_test_utils.ts";
import { type Container, MyMath } from "./_test_utils.ts";

Deno.test("BinaryHeap works with default descend comparator", () => {
const maxHeap = new BinaryHeap<number>();
Expand Down
2 changes: 1 addition & 1 deletion data_structures/red_black_tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { ascend } from "./comparators.ts";
import { BinarySearchTree } from "./binary_search_tree.ts";
import { Direction, RedBlackNode } from "./_red_black_node.ts";
import { type Direction, RedBlackNode } from "./_red_black_node.ts";

/**
* A red-black tree. This is a kind of self-balancing binary search tree. The
Expand Down
2 changes: 1 addition & 1 deletion data_structures/red_black_tree_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { assertEquals, assertStrictEquals } from "../assert/mod.ts";
import { RedBlackTree } from "./red_black_tree.ts";
import { ascend, descend } from "./comparators.ts";
import { Container, MyMath } from "./_test_utils.ts";
import { type Container, MyMath } from "./_test_utils.ts";

Deno.test("RedBlackTree works as expected with default ascend comparator", () => {
const trees = [
Expand Down
6 changes: 5 additions & 1 deletion encoding/ascii85_test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "../assert/mod.ts";
import { Ascii85Standard, decodeAscii85, encodeAscii85 } from "./ascii85.ts";
import {
type Ascii85Standard,
decodeAscii85,
encodeAscii85,
} from "./ascii85.ts";
type TestCases = Partial<{ [index in Ascii85Standard]: string[][] }>;
const utf8encoder = new TextEncoder();
const testCasesNoDelimiter: TestCases = {
Expand Down
2 changes: 1 addition & 1 deletion expect/_assert_equals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { AssertionError } from "../assert/assertion_error.ts";
import { buildEqualErrorMessage } from "./_build_message.ts";
import { equal } from "./_equal.ts";
import { EqualOptions } from "./_types.ts";
import type { EqualOptions } from "./_types.ts";

/**
* Make an assertion that `actual` and `expected` are equal, deeply. If not
Expand Down
2 changes: 1 addition & 1 deletion expect/_assert_not_equals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { AssertionError } from "../assert/assertion_error.ts";
import { buildNotEqualErrorMessage } from "./_build_message.ts";
import { equal } from "./_equal.ts";
import { EqualOptions } from "./_types.ts";
import type { EqualOptions } from "./_types.ts";

/**
* Make an assertion that `actual` and `expected` are not equal, deeply.
Expand Down
2 changes: 1 addition & 1 deletion expect/_build_message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { red } from "../fmt/colors.ts";
import { CAN_NOT_DISPLAY } from "./_constants.ts";
import { buildMessage, diff, diffstr } from "./_diff.ts";
import { format } from "./_format.ts";
import { EqualOptions } from "./_types.ts";
import type { EqualOptions } from "./_types.ts";

type EqualErrorMessageOptions = Pick<
EqualOptions,
Expand Down
2 changes: 1 addition & 1 deletion expect/_custom_equality_tester.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { Tester } from "./_types.ts";
import type { Tester } from "./_types.ts";

const customEqualityTesters: Tester[] = [];

Expand Down
2 changes: 1 addition & 1 deletion expect/_equal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// This file is copied from `std/assert`.

import { EqualOptions } from "./_types.ts";
import type { EqualOptions } from "./_types.ts";

function isKeyedCollection(x: unknown): x is Set<unknown> {
return [Symbol.iterator, "size"].every((k) => k in (x as Set<unknown>));
Expand Down
2 changes: 1 addition & 1 deletion expect/_matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { assertEquals } from "./_assert_equals.ts";
import { assertNotEquals } from "./_assert_not_equals.ts";
import { equal } from "./_equal.ts";
import { format } from "./_format.ts";
import { AnyConstructor, MatcherContext, MatchResult } from "./_types.ts";
import type { AnyConstructor, MatcherContext, MatchResult } from "./_types.ts";
import { getMockCalls } from "./_mock_util.ts";
import { inspectArg, inspectArgs } from "./_inspect_args.ts";
import { buildEqualOptions } from "./_utils.ts";
Expand Down
2 changes: 1 addition & 1 deletion expect/_to_have_returned_with.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { MatcherContext, MatchResult } from "./_types.ts";
import type { MatcherContext, MatchResult } from "./_types.ts";
import { AssertionError } from "../assert/assertion_error.ts";
import { equal } from "../assert/equal.ts";
import { getMockCalls } from "./_mock_util.ts";
Expand Down
2 changes: 1 addition & 1 deletion expect/_utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { EqualOptions, EqualOptionUtil } from "./_types.ts";
import type { EqualOptions, EqualOptionUtil } from "./_types.ts";

export function buildEqualOptions(options: EqualOptionUtil): EqualOptions {
const { customMessage, customTesters = [], strictCheck } = options || {};
Expand Down
2 changes: 1 addition & 1 deletion expect/fn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright 2019 Allain Lalonde. All rights reserved. ISC License.
// deno-lint-ignore-file no-explicit-any ban-types

import { MOCK_SYMBOL, MockCall } from "./_mock_util.ts";
import { MOCK_SYMBOL, type MockCall } from "./_mock_util.ts";

export function fn(...stubs: Function[]): Function {
const calls: MockCall[] = [];
Expand Down
6 changes: 5 additions & 1 deletion front_matter/any.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { createExtractor, type Extractor, Parser } from "./create_extractor.ts";
import {
createExtractor,
type Extractor,
type Parser,
} from "./create_extractor.ts";
import { parse as parseYAML } from "../yaml/parse.ts";
import { parse as parseTOML } from "../toml/parse.ts";

Expand Down
2 changes: 1 addition & 1 deletion front_matter/create_extractor_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
runExtractYAMLTests1,
runExtractYAMLTests2,
} from "./_test_utils.ts";
import { createExtractor, Parser } from "./create_extractor.ts";
import { createExtractor, type Parser } from "./create_extractor.ts";

const extractYAML = createExtractor({ "yaml": parseYAML as Parser });
const extractTOML = createExtractor({ "toml": parseTOML as Parser });
Expand Down
6 changes: 5 additions & 1 deletion front_matter/json.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { createExtractor, type Extractor, Parser } from "./create_extractor.ts";
import {
createExtractor,
type Extractor,
type Parser,
} from "./create_extractor.ts";

export const extract: Extractor = createExtractor({
json: JSON.parse as Parser,
Expand Down
6 changes: 5 additions & 1 deletion front_matter/toml.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { createExtractor, type Extractor, Parser } from "./create_extractor.ts";
import {
createExtractor,
type Extractor,
type Parser,
} from "./create_extractor.ts";
import { parse } from "../toml/parse.ts";

export const extract: Extractor = createExtractor({
Expand Down
6 changes: 5 additions & 1 deletion front_matter/yaml.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { createExtractor, type Extractor, Parser } from "./create_extractor.ts";
import {
createExtractor,
type Extractor,
type Parser,
} from "./create_extractor.ts";
import { parse } from "../yaml/parse.ts";

export const extract: Extractor = createExtractor({
Expand Down
2 changes: 1 addition & 1 deletion fs/_get_file_info_type_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { assertEquals } from "../assert/mod.ts";
import * as path from "../path/mod.ts";
import { getFileInfoType, PathType } from "./_get_file_info_type.ts";
import { getFileInfoType, type PathType } from "./_get_file_info_type.ts";
import { ensureFileSync } from "./ensure_file.ts";
import { ensureDirSync } from "./ensure_dir.ts";

Expand Down
2 changes: 1 addition & 1 deletion fs/expand_glob_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from "../path/mod.ts";
import {
expandGlob,
ExpandGlobOptions,
type ExpandGlobOptions,
expandGlobSync,
} from "./expand_glob.ts";

Expand Down
2 changes: 1 addition & 1 deletion fs/walk_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { walk, WalkError, WalkOptions, walkSync } from "./walk.ts";
import { walk, WalkError, type WalkOptions, walkSync } from "./walk.ts";
import {
assertArrayIncludes,
assertEquals,
Expand Down
2 changes: 1 addition & 1 deletion http/_negotiation/encoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

import { compareSpecs, isQuality, Specificity } from "./common.ts";
import { compareSpecs, isQuality, type Specificity } from "./common.ts";

interface EncodingSpecificity extends Specificity {
encoding?: string;
Expand Down
2 changes: 1 addition & 1 deletion http/_negotiation/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

import { compareSpecs, isQuality, Specificity } from "./common.ts";
import { compareSpecs, isQuality, type Specificity } from "./common.ts";

interface LanguageSpecificity extends Specificity {
prefix: string;
Expand Down
2 changes: 1 addition & 1 deletion http/_negotiation/media_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

import { compareSpecs, isQuality, Specificity } from "./common.ts";
import { compareSpecs, isQuality, type Specificity } from "./common.ts";

interface MediaTypeSpecificity extends Specificity {
type: string;
Expand Down
2 changes: 1 addition & 1 deletion http/file_server_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
assertStringIncludes,
} from "../assert/mod.ts";
import { stub } from "../testing/mock.ts";
import { serveDir, ServeDirOptions, serveFile } from "./file_server.ts";
import { serveDir, type ServeDirOptions, serveFile } from "./file_server.ts";
import { calculate } from "./etag.ts";
import {
basename,
Expand Down
8 changes: 7 additions & 1 deletion http/server_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { ConnInfo, serve, serveListener, Server, serveTls } from "./server.ts";
import {
type ConnInfo,
serve,
serveListener,
Server,
serveTls,
} from "./server.ts";
import { mockConn as createMockConn } from "./_mock_conn.ts";
import { dirname, fromFileUrl, join, resolve } from "../path/mod.ts";
import { writeAll } from "../io/write_all.ts";
Expand Down
2 changes: 1 addition & 1 deletion ini/parse.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { IniMap, ParseOptions } from "./ini_map.ts";
import { IniMap, type ParseOptions } from "./ini_map.ts";
/** Parse an INI config string into an object. Provide formatting options to override the default assignment operator. */
export function parse(
text: string,
Expand Down
2 changes: 1 addition & 1 deletion ini/parse_test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { IniMap, parse, ParseOptions } from "./mod.ts";
import { IniMap, parse, type ParseOptions } from "./mod.ts";
import {
assert,
assertEquals,
Expand Down
2 changes: 1 addition & 1 deletion ini/stringify.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { IniMap, StringifyOptions } from "./ini_map.ts";
import { IniMap, type StringifyOptions } from "./ini_map.ts";

/** Compile an object into an INI config string. Provide formatting options to modify the output. */
export function stringify(
Expand Down
2 changes: 1 addition & 1 deletion ini/stringify_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { stringify, StringifyOptions } from "./mod.ts";
import { stringify, type StringifyOptions } from "./mod.ts";
import { assertEquals } from "../assert/mod.ts";

function assertValidStringify(
Expand Down
2 changes: 1 addition & 1 deletion io/read_int.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { type BufReader } from "./buf_reader.ts";
import type { BufReader } from "./buf_reader.ts";
import { readShort } from "./read_short.ts";

/**
Expand Down
2 changes: 1 addition & 1 deletion io/read_lines.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

import { type Reader } from "./types.ts";
import type { Reader } from "./types.ts";
import { BufReader } from "./buf_reader.ts";
import { concat } from "../bytes/concat.ts";

Expand Down
2 changes: 1 addition & 1 deletion io/read_long.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { type BufReader } from "./buf_reader.ts";
import type { BufReader } from "./buf_reader.ts";
import { readInt } from "./read_int.ts";

const MAX_SAFE_INTEGER = BigInt(Number.MAX_SAFE_INTEGER);
Expand Down
2 changes: 1 addition & 1 deletion io/read_short.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { type BufReader } from "./buf_reader.ts";
import type { BufReader } from "./buf_reader.ts";

/**
* Read big endian 16bit short from BufReader
Expand Down
Loading

0 comments on commit ef6b95f

Please sign in to comment.