Use dprint for internal formatting (#6682)

This commit is contained in:
David Sherret 2020-07-14 15:24:17 -04:00 committed by GitHub
parent 9eca71caa1
commit cde4dbb351
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
378 changed files with 3116 additions and 3121 deletions

28
.dprintrc.json Normal file
View file

@ -0,0 +1,28 @@
{
"$schema": "https://dprint.dev/schemas/v0.json",
"projectType": "openSource",
"lineWidth": 80,
"indentWidth": 2,
"typescript": {
"deno": true
},
"markdown": {
"textWrap": "always"
},
"includes": ["**/*.{ts,tsx,js,jsx,json,md}"],
"excludes": [
".cargo_home",
"deno_typescript/typescript",
"std/**/testdata",
"std/**/vendor",
"std/node_modules",
"std/hash/_wasm",
"target",
"third_party"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.19.9.wasm",
"https://plugins.dprint.dev/json-0.4.1.wasm",
"https://plugins.dprint.dev/markdown-0.2.4.wasm"
]
}

View file

@ -1,9 +0,0 @@
cli/compilers/wasm_wrap.js
cli/tests/error_syntax.js
cli/tests/badly_formatted.js
cli/tests/top_level_for_await.js
cli/tests/swc_syntax_error.ts
std/**/testdata
std/**/vendor
std/node_modules
std/hash/_wasm

View file

@ -1,3 +0,0 @@
{
"proseWrap": "always"
}

View file

@ -70,7 +70,7 @@ const ANSI_PATTERN = new RegExp(
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))",
].join("|"), ].join("|"),
"g" "g",
); );
export function stripColor(string: string): string { export function stripColor(string: string): string {

View file

@ -182,13 +182,15 @@ interface CompilerHostOptions {
incremental?: boolean; incremental?: boolean;
} }
type IncrementalCompilerHostOptions = Omit< type IncrementalCompilerHostOptions =
& Omit<
CompilerHostOptions, CompilerHostOptions,
"incremental" "incremental"
> & { >
& {
rootNames?: string[]; rootNames?: string[];
buildInfo?: string; buildInfo?: string;
}; };
interface HostConfigureResponse { interface HostConfigureResponse {
ignoredOptions?: string[]; ignoredOptions?: string[];
@ -235,7 +237,9 @@ function getExtension(fileName: string, mediaType: MediaType): ts.Extension {
case MediaType.Unknown: case MediaType.Unknown:
default: default:
throw TypeError( throw TypeError(
`Cannot resolve extension for "${fileName}" with mediaType "${MediaType[mediaType]}".` `Cannot resolve extension for "${fileName}" with mediaType "${
MediaType[mediaType]
}".`,
); );
} }
} }
@ -259,7 +263,7 @@ function configure(
defaultOptions: ts.CompilerOptions, defaultOptions: ts.CompilerOptions,
source: string, source: string,
path: string, path: string,
cwd: string cwd: string,
): ConfigureResponse { ): ConfigureResponse {
const { config, error } = ts.parseConfigFileTextToJson(path, source); const { config, error } = ts.parseConfigFileTextToJson(path, source);
if (error) { if (error) {
@ -267,7 +271,7 @@ function configure(
} }
const { options, errors } = ts.convertCompilerOptionsFromJson( const { options, errors } = ts.convertCompilerOptionsFromJson(
config.compilerOptions, config.compilerOptions,
cwd cwd,
); );
const ignoredOptions: string[] = []; const ignoredOptions: string[] = [];
for (const key of Object.keys(options)) { for (const key of Object.keys(options)) {
@ -318,7 +322,7 @@ class SourceFile {
static cacheResolvedUrl( static cacheResolvedUrl(
resolvedUrl: string, resolvedUrl: string,
rawModuleSpecifier: string, rawModuleSpecifier: string,
containingFile?: string containingFile?: string,
): void { ): void {
containingFile = containingFile || ""; containingFile = containingFile || "";
let innerCache = RESOLVED_SPECIFIER_CACHE.get(containingFile); let innerCache = RESOLVED_SPECIFIER_CACHE.get(containingFile);
@ -331,7 +335,7 @@ class SourceFile {
static getResolvedUrl( static getResolvedUrl(
moduleSpecifier: string, moduleSpecifier: string,
containingFile: string containingFile: string,
): string | undefined { ): string | undefined {
const containingCache = RESOLVED_SPECIFIER_CACHE.get(containingFile); const containingCache = RESOLVED_SPECIFIER_CACHE.get(containingFile);
if (containingCache) { if (containingCache) {
@ -399,14 +403,14 @@ class Host implements ts.CompilerHost {
configure( configure(
cwd: string, cwd: string,
path: string, path: string,
configurationText: string configurationText: string,
): HostConfigureResponse { ): HostConfigureResponse {
log("compiler::host.configure", path); log("compiler::host.configure", path);
const { options, ...result } = configure( const { options, ...result } = configure(
this.#options, this.#options,
configurationText, configurationText,
path, path,
cwd cwd,
); );
this.#options = options; this.#options = options;
return result; return result;
@ -455,7 +459,7 @@ class Host implements ts.CompilerHost {
fileName: string, fileName: string,
languageVersion: ts.ScriptTarget, languageVersion: ts.ScriptTarget,
onError?: (message: string) => void, onError?: (message: string) => void,
shouldCreateNewSourceFile?: boolean shouldCreateNewSourceFile?: boolean,
): ts.SourceFile | undefined { ): ts.SourceFile | undefined {
log("compiler::host.getSourceFile", fileName); log("compiler::host.getSourceFile", fileName);
try { try {
@ -473,7 +477,7 @@ class Host implements ts.CompilerHost {
sourceFile.tsSourceFile = ts.createSourceFile( sourceFile.tsSourceFile = ts.createSourceFile(
tsSourceFileName, tsSourceFileName,
sourceFile.sourceCode, sourceFile.sourceCode,
languageVersion languageVersion,
); );
sourceFile.tsSourceFile.version = sourceFile.versionHash; sourceFile.tsSourceFile.version = sourceFile.versionHash;
delete sourceFile.sourceCode; delete sourceFile.sourceCode;
@ -495,7 +499,7 @@ class Host implements ts.CompilerHost {
resolveModuleNames( resolveModuleNames(
moduleNames: string[], moduleNames: string[],
containingFile: string containingFile: string,
): Array<ts.ResolvedModuleFull | undefined> { ): Array<ts.ResolvedModuleFull | undefined> {
log("compiler::host.resolveModuleNames", { log("compiler::host.resolveModuleNames", {
moduleNames, moduleNames,
@ -540,7 +544,7 @@ class Host implements ts.CompilerHost {
data: string, data: string,
_writeByteOrderMark: boolean, _writeByteOrderMark: boolean,
_onError?: (message: string) => void, _onError?: (message: string) => void,
sourceFiles?: readonly ts.SourceFile[] sourceFiles?: readonly ts.SourceFile[],
): void { ): void {
log("compiler::host.writeFile", fileName); log("compiler::host.writeFile", fileName);
this.#writeFile(fileName, data, sourceFiles); this.#writeFile(fileName, data, sourceFiles);
@ -588,23 +592,23 @@ ts.libMap.set("deno.unstable", "lib.deno.unstable.d.ts");
// are available in the future when needed. // are available in the future when needed.
SNAPSHOT_HOST.getSourceFile( SNAPSHOT_HOST.getSourceFile(
`${ASSETS}/lib.deno.ns.d.ts`, `${ASSETS}/lib.deno.ns.d.ts`,
ts.ScriptTarget.ESNext ts.ScriptTarget.ESNext,
); );
SNAPSHOT_HOST.getSourceFile( SNAPSHOT_HOST.getSourceFile(
`${ASSETS}/lib.deno.window.d.ts`, `${ASSETS}/lib.deno.window.d.ts`,
ts.ScriptTarget.ESNext ts.ScriptTarget.ESNext,
); );
SNAPSHOT_HOST.getSourceFile( SNAPSHOT_HOST.getSourceFile(
`${ASSETS}/lib.deno.worker.d.ts`, `${ASSETS}/lib.deno.worker.d.ts`,
ts.ScriptTarget.ESNext ts.ScriptTarget.ESNext,
); );
SNAPSHOT_HOST.getSourceFile( SNAPSHOT_HOST.getSourceFile(
`${ASSETS}/lib.deno.shared_globals.d.ts`, `${ASSETS}/lib.deno.shared_globals.d.ts`,
ts.ScriptTarget.ESNext ts.ScriptTarget.ESNext,
); );
SNAPSHOT_HOST.getSourceFile( SNAPSHOT_HOST.getSourceFile(
`${ASSETS}/lib.deno.unstable.d.ts`, `${ASSETS}/lib.deno.unstable.d.ts`,
ts.ScriptTarget.ESNext ts.ScriptTarget.ESNext,
); );
// We never use this program; it's only created // We never use this program; it's only created
@ -624,7 +628,7 @@ const SYSTEM_LOADER = getAsset("system_loader.js");
const SYSTEM_LOADER_ES5 = getAsset("system_loader_es5.js"); const SYSTEM_LOADER_ES5 = getAsset("system_loader_es5.js");
function buildLocalSourceFileCache( function buildLocalSourceFileCache(
sourceFileMap: Record<string, SourceFileMapEntry> sourceFileMap: Record<string, SourceFileMapEntry>,
): void { ): void {
for (const entry of Object.values(sourceFileMap)) { for (const entry of Object.values(sourceFileMap)) {
assert(entry.sourceCode.length > 0); assert(entry.sourceCode.length > 0);
@ -640,8 +644,7 @@ function buildLocalSourceFileCache(
let mappedUrl = importDesc.resolvedSpecifier; let mappedUrl = importDesc.resolvedSpecifier;
const importedFile = sourceFileMap[importDesc.resolvedSpecifier]; const importedFile = sourceFileMap[importDesc.resolvedSpecifier];
assert(importedFile); assert(importedFile);
const isJsOrJsx = const isJsOrJsx = importedFile.mediaType === MediaType.JavaScript ||
importedFile.mediaType === MediaType.JavaScript ||
importedFile.mediaType === MediaType.JSX; importedFile.mediaType === MediaType.JSX;
// If JS or JSX perform substitution for types if available // If JS or JSX perform substitution for types if available
if (isJsOrJsx) { if (isJsOrJsx) {
@ -663,21 +666,21 @@ function buildLocalSourceFileCache(
SourceFile.cacheResolvedUrl( SourceFile.cacheResolvedUrl(
fileRef.resolvedSpecifier.replace("memory://", ""), fileRef.resolvedSpecifier.replace("memory://", ""),
fileRef.specifier, fileRef.specifier,
entry.url entry.url,
); );
} }
for (const fileRef of entry.libDirectives) { for (const fileRef of entry.libDirectives) {
SourceFile.cacheResolvedUrl( SourceFile.cacheResolvedUrl(
fileRef.resolvedSpecifier.replace("memory://", ""), fileRef.resolvedSpecifier.replace("memory://", ""),
fileRef.specifier, fileRef.specifier,
entry.url entry.url,
); );
} }
} }
} }
function buildSourceFileCache( function buildSourceFileCache(
sourceFileMap: Record<string, SourceFileMapEntry> sourceFileMap: Record<string, SourceFileMapEntry>,
): void { ): void {
for (const entry of Object.values(sourceFileMap)) { for (const entry of Object.values(sourceFileMap)) {
SourceFile.addToCache({ SourceFile.addToCache({
@ -700,8 +703,7 @@ function buildSourceFileCache(
if (importedFile.redirect) { if (importedFile.redirect) {
mappedUrl = importedFile.redirect; mappedUrl = importedFile.redirect;
} }
const isJsOrJsx = const isJsOrJsx = importedFile.mediaType === MediaType.JavaScript ||
importedFile.mediaType === MediaType.JavaScript ||
importedFile.mediaType === MediaType.JSX; importedFile.mediaType === MediaType.JSX;
// If JS or JSX perform substitution for types if available // If JS or JSX perform substitution for types if available
if (isJsOrJsx) { if (isJsOrJsx) {
@ -722,14 +724,14 @@ function buildSourceFileCache(
SourceFile.cacheResolvedUrl( SourceFile.cacheResolvedUrl(
fileRef.resolvedSpecifier, fileRef.resolvedSpecifier,
fileRef.specifier, fileRef.specifier,
entry.url entry.url,
); );
} }
for (const fileRef of entry.libDirectives) { for (const fileRef of entry.libDirectives) {
SourceFile.cacheResolvedUrl( SourceFile.cacheResolvedUrl(
fileRef.resolvedSpecifier, fileRef.resolvedSpecifier,
fileRef.specifier, fileRef.specifier,
entry.url entry.url,
); );
} }
} }
@ -745,7 +747,7 @@ interface EmittedSource {
type WriteFileCallback = ( type WriteFileCallback = (
fileName: string, fileName: string,
data: string, data: string,
sourceFiles?: readonly ts.SourceFile[] sourceFiles?: readonly ts.SourceFile[],
) => void; ) => void;
interface CompileWriteFileState { interface CompileWriteFileState {
@ -775,7 +777,7 @@ function createBundleWriteFile(state: BundleWriteFileState): WriteFileCallback {
return function writeFile( return function writeFile(
_fileName: string, _fileName: string,
data: string, data: string,
sourceFiles?: readonly ts.SourceFile[] sourceFiles?: readonly ts.SourceFile[],
): void { ): void {
assert(sourceFiles != null); assert(sourceFiles != null);
assert(state.host); assert(state.host);
@ -785,18 +787,18 @@ function createBundleWriteFile(state: BundleWriteFileState): WriteFileCallback {
state.rootNames[0], state.rootNames[0],
data, data,
sourceFiles, sourceFiles,
state.host.options.target ?? ts.ScriptTarget.ESNext state.host.options.target ?? ts.ScriptTarget.ESNext,
); );
}; };
} }
function createCompileWriteFile( function createCompileWriteFile(
state: CompileWriteFileState state: CompileWriteFileState,
): WriteFileCallback { ): WriteFileCallback {
return function writeFile( return function writeFile(
fileName: string, fileName: string,
data: string, data: string,
sourceFiles?: readonly ts.SourceFile[] sourceFiles?: readonly ts.SourceFile[],
): void { ): void {
const isBuildInfo = fileName === TS_BUILD_INFO; const isBuildInfo = fileName === TS_BUILD_INFO;
@ -816,12 +818,12 @@ function createCompileWriteFile(
} }
function createRuntimeCompileWriteFile( function createRuntimeCompileWriteFile(
state: CompileWriteFileState state: CompileWriteFileState,
): WriteFileCallback { ): WriteFileCallback {
return function writeFile( return function writeFile(
fileName: string, fileName: string,
data: string, data: string,
sourceFiles?: readonly ts.SourceFile[] sourceFiles?: readonly ts.SourceFile[],
): void { ): void {
assert(sourceFiles); assert(sourceFiles);
assert(sourceFiles.length === 1); assert(sourceFiles.length === 1);
@ -1020,14 +1022,14 @@ function performanceEnd(): Stats {
// TODO(Bartlomieju): this check should be done in Rust; there should be no // TODO(Bartlomieju): this check should be done in Rust; there should be no
function processConfigureResponse( function processConfigureResponse(
configResult: HostConfigureResponse, configResult: HostConfigureResponse,
configPath: string configPath: string,
): ts.Diagnostic[] | undefined { ): ts.Diagnostic[] | undefined {
const { ignoredOptions, diagnostics } = configResult; const { ignoredOptions, diagnostics } = configResult;
if (ignoredOptions) { if (ignoredOptions) {
console.warn( console.warn(
yellow(`Unsupported compiler options in "${configPath}"\n`) + yellow(`Unsupported compiler options in "${configPath}"\n`) +
cyan(` The following options were ignored:\n`) + cyan(` The following options were ignored:\n`) +
` ${ignoredOptions.map((value): string => bold(value)).join(", ")}` ` ${ignoredOptions.map((value): string => bold(value)).join(", ")}`,
); );
} }
return diagnostics; return diagnostics;
@ -1130,7 +1132,7 @@ function buildBundle(
rootName: string, rootName: string,
data: string, data: string,
sourceFiles: readonly ts.SourceFile[], sourceFiles: readonly ts.SourceFile[],
target: ts.ScriptTarget target: ts.ScriptTarget,
): string { ): string {
// when outputting to AMD and a single outfile, TypeScript makes up the module // when outputting to AMD and a single outfile, TypeScript makes up the module
// specifiers which are used to define the modules, and doesn't expose them // specifiers which are used to define the modules, and doesn't expose them
@ -1162,8 +1164,7 @@ function buildBundle(
? `await __instantiate("${rootName}", true);\n` ? `await __instantiate("${rootName}", true);\n`
: `__instantiate("${rootName}", false);\n`; : `__instantiate("${rootName}", false);\n`;
} }
const es5Bundle = const es5Bundle = target === ts.ScriptTarget.ES3 ||
target === ts.ScriptTarget.ES3 ||
target === ts.ScriptTarget.ES5 || target === ts.ScriptTarget.ES5 ||
target === ts.ScriptTarget.ES2015 || target === ts.ScriptTarget.ES2015 ||
target === ts.ScriptTarget.ES2016; target === ts.ScriptTarget.ES2016;
@ -1205,7 +1206,7 @@ function setRootExports(program: ts.Program, rootModule: string): void {
sym.flags & ts.SymbolFlags.InterfaceExcludes || sym.flags & ts.SymbolFlags.InterfaceExcludes ||
sym.flags & ts.SymbolFlags.TypeParameterExcludes || sym.flags & ts.SymbolFlags.TypeParameterExcludes ||
sym.flags & ts.SymbolFlags.TypeAliasExcludes sym.flags & ts.SymbolFlags.TypeAliasExcludes
) ),
) )
.map((sym) => sym.getName()); .map((sym) => sym.getName());
} }
@ -1408,7 +1409,7 @@ function compile({
...program.getSemanticDiagnostics(), ...program.getSemanticDiagnostics(),
]; ];
diagnostics = diagnostics.filter( diagnostics = diagnostics.filter(
({ code }) => !ignoredDiagnostics.includes(code) ({ code }) => !ignoredDiagnostics.includes(code),
); );
// We will only proceed with the emit if there are no diagnostics. // We will only proceed with the emit if there are no diagnostics.
@ -1420,7 +1421,7 @@ function compile({
if (options.checkJs) { if (options.checkJs) {
assert( assert(
emitResult.emitSkipped === false, emitResult.emitSkipped === false,
"Unexpected skip of the emit." "Unexpected skip of the emit.",
); );
} }
// emitResult.diagnostics is `readonly` in TS3.5+ and can't be assigned // emitResult.diagnostics is `readonly` in TS3.5+ and can't be assigned
@ -1458,7 +1459,7 @@ function transpile({
DEFAULT_TRANSPILE_OPTIONS, DEFAULT_TRANSPILE_OPTIONS,
configText, configText,
configPath, configPath,
cwd cwd,
); );
const diagnostics = processConfigureResponse(response, configPath); const diagnostics = processConfigureResponse(response, configPath);
if (diagnostics && diagnostics.length) { if (diagnostics && diagnostics.length) {
@ -1598,7 +1599,7 @@ function bundle({
} }
function runtimeCompile( function runtimeCompile(
request: RuntimeCompileRequest request: RuntimeCompileRequest,
): RuntimeCompileResponse { ): RuntimeCompileResponse {
const { options, rootNames, target, unstable, sourceFileMap } = request; const { options, rootNames, target, unstable, sourceFileMap } = request;
@ -1742,7 +1743,7 @@ function runtimeBundle(request: RuntimeBundleRequest): RuntimeBundleResponse {
} }
function runtimeTranspile( function runtimeTranspile(
request: RuntimeTranspileRequest request: RuntimeTranspileRequest,
): Promise<Record<string, TranspileOnlyResult>> { ): Promise<Record<string, TranspileOnlyResult>> {
const result: Record<string, TranspileOnlyResult> = {}; const result: Record<string, TranspileOnlyResult> = {};
const { sources, options } = request; const { sources, options } = request;
@ -1750,7 +1751,7 @@ function runtimeTranspile(
? Object.assign( ? Object.assign(
{}, {},
DEFAULT_RUNTIME_TRANSPILE_OPTIONS, DEFAULT_RUNTIME_TRANSPILE_OPTIONS,
convertCompilerOptions(options).options convertCompilerOptions(options).options,
) )
: DEFAULT_RUNTIME_TRANSPILE_OPTIONS; : DEFAULT_RUNTIME_TRANSPILE_OPTIONS;
@ -1760,7 +1761,7 @@ function runtimeTranspile(
{ {
fileName, fileName,
compilerOptions, compilerOptions,
} },
); );
result[fileName] = { source, map }; result[fileName] = { source, map };
} }
@ -1807,7 +1808,7 @@ async function tsCompilerOnMessage({
log( log(
`!!! unhandled CompilerRequestType: ${ `!!! unhandled CompilerRequestType: ${
(request as CompilerRequest).type (request as CompilerRequest).type
} (${CompilerRequestType[(request as CompilerRequest).type]})` } (${CompilerRequestType[(request as CompilerRequest).type]})`,
); );
} }
// Shutdown after single request // Shutdown after single request

View file

@ -18,7 +18,7 @@ function checkRelative(specifier: string): string {
// TODO(bartlomieju): change return type to interface? // TODO(bartlomieju): change return type to interface?
export function transpileOnly( export function transpileOnly(
sources: Record<string, string>, sources: Record<string, string>,
options: CompilerOptions = {} options: CompilerOptions = {},
): Promise<Record<string, TranspileOnlyResult>> { ): Promise<Record<string, TranspileOnlyResult>> {
util.log("Deno.transpileOnly", { sources: Object.keys(sources), options }); util.log("Deno.transpileOnly", { sources: Object.keys(sources), options });
const payload = { const payload = {
@ -32,7 +32,7 @@ export function transpileOnly(
export async function compile( export async function compile(
rootName: string, rootName: string,
sources?: Record<string, string>, sources?: Record<string, string>,
options: CompilerOptions = {} options: CompilerOptions = {},
): Promise<[DiagnosticItem[] | undefined, Record<string, string>]> { ): Promise<[DiagnosticItem[] | undefined, Record<string, string>]> {
const payload = { const payload = {
rootName: sources ? rootName : checkRelative(rootName), rootName: sources ? rootName : checkRelative(rootName),
@ -47,8 +47,9 @@ export async function compile(
}); });
const result = await runtimeCompilerOps.compile(payload); const result = await runtimeCompilerOps.compile(payload);
util.assert(result.emitMap); util.assert(result.emitMap);
const maybeDiagnostics = const maybeDiagnostics = result.diagnostics.length === 0
result.diagnostics.length === 0 ? undefined : result.diagnostics; ? undefined
: result.diagnostics;
const emitMap: Record<string, string> = {}; const emitMap: Record<string, string> = {};
@ -63,7 +64,7 @@ export async function compile(
export async function bundle( export async function bundle(
rootName: string, rootName: string,
sources?: Record<string, string>, sources?: Record<string, string>,
options: CompilerOptions = {} options: CompilerOptions = {},
): Promise<[DiagnosticItem[] | undefined, string]> { ): Promise<[DiagnosticItem[] | undefined, string]> {
const payload = { const payload = {
rootName: sources ? rootName : checkRelative(rootName), rootName: sources ? rootName : checkRelative(rootName),
@ -78,7 +79,8 @@ export async function bundle(
}); });
const result = await runtimeCompilerOps.compile(payload); const result = await runtimeCompilerOps.compile(payload);
util.assert(result.output); util.assert(result.output);
const maybeDiagnostics = const maybeDiagnostics = result.diagnostics.length === 0
result.diagnostics.length === 0 ? undefined : result.diagnostics; ? undefined
: result.diagnostics;
return [maybeDiagnostics, result.output]; return [maybeDiagnostics, result.output];
} }

View file

@ -91,7 +91,7 @@ function transformMessageText(messageText: string, code: number): string {
const suggestion = messageText.match(suggestionMessagePattern); const suggestion = messageText.match(suggestionMessagePattern);
const replacedMessageText = messageText.replace( const replacedMessageText = messageText.replace(
suggestionMessagePattern, suggestionMessagePattern,
"" "",
); );
if (suggestion && unstableDenoGlobalProperties.includes(property)) { if (suggestion && unstableDenoGlobalProperties.includes(property)) {
const suggestedProperty = suggestion[1]; const suggestedProperty = suggestion[1];
@ -113,7 +113,7 @@ interface SourceInformation {
} }
function fromDiagnosticCategory( function fromDiagnosticCategory(
category: ts.DiagnosticCategory category: ts.DiagnosticCategory,
): DiagnosticCategory { ): DiagnosticCategory {
switch (category) { switch (category) {
case ts.DiagnosticCategory.Error: case ts.DiagnosticCategory.Error:
@ -126,7 +126,9 @@ function fromDiagnosticCategory(
return DiagnosticCategory.Warning; return DiagnosticCategory.Warning;
default: default:
throw new Error( throw new Error(
`Unexpected DiagnosticCategory: "${category}"/"${ts.DiagnosticCategory[category]}"` `Unexpected DiagnosticCategory: "${category}"/"${
ts.DiagnosticCategory[category]
}"`,
); );
} }
} }
@ -134,7 +136,7 @@ function fromDiagnosticCategory(
function getSourceInformation( function getSourceInformation(
sourceFile: ts.SourceFile, sourceFile: ts.SourceFile,
start: number, start: number,
length: number length: number,
): SourceInformation { ): SourceInformation {
const scriptResourceName = sourceFile.fileName; const scriptResourceName = sourceFile.fileName;
const { const {
@ -142,14 +144,14 @@ function getSourceInformation(
character: startColumn, character: startColumn,
} = sourceFile.getLineAndCharacterOfPosition(start); } = sourceFile.getLineAndCharacterOfPosition(start);
const endPosition = sourceFile.getLineAndCharacterOfPosition(start + length); const endPosition = sourceFile.getLineAndCharacterOfPosition(start + length);
const endColumn = const endColumn = lineNumber === endPosition.line
lineNumber === endPosition.line ? endPosition.character : startColumn; ? endPosition.character
: startColumn;
const lastLineInFile = sourceFile.getLineAndCharacterOfPosition( const lastLineInFile = sourceFile.getLineAndCharacterOfPosition(
sourceFile.text.length sourceFile.text.length,
).line; ).line;
const lineStart = sourceFile.getPositionOfLineAndCharacter(lineNumber, 0); const lineStart = sourceFile.getPositionOfLineAndCharacter(lineNumber, 0);
const lineEnd = const lineEnd = lineNumber < lastLineInFile
lineNumber < lastLineInFile
? sourceFile.getPositionOfLineAndCharacter(lineNumber + 1, 0) ? sourceFile.getPositionOfLineAndCharacter(lineNumber + 1, 0)
: sourceFile.text.length; : sourceFile.text.length;
const sourceLine = sourceFile.text const sourceLine = sourceFile.text
@ -166,7 +168,7 @@ function getSourceInformation(
} }
function fromDiagnosticMessageChain( function fromDiagnosticMessageChain(
messageChain: ts.DiagnosticMessageChain[] | undefined messageChain: ts.DiagnosticMessageChain[] | undefined,
): DiagnosticMessageChain[] | undefined { ): DiagnosticMessageChain[] | undefined {
if (!messageChain) { if (!messageChain) {
return undefined; return undefined;
@ -184,7 +186,7 @@ function fromDiagnosticMessageChain(
} }
function parseDiagnostic( function parseDiagnostic(
item: ts.Diagnostic | ts.DiagnosticRelatedInformation item: ts.Diagnostic | ts.DiagnosticRelatedInformation,
): DiagnosticItem { ): DiagnosticItem {
const { const {
messageText, messageText,
@ -194,12 +196,12 @@ function parseDiagnostic(
start: startPosition, start: startPosition,
length, length,
} = item; } = item;
const sourceInfo = const sourceInfo = file && startPosition && length
file && startPosition && length
? getSourceInformation(file, startPosition, length) ? getSourceInformation(file, startPosition, length)
: undefined; : undefined;
const endPosition = const endPosition = startPosition && length
startPosition && length ? startPosition + length : undefined; ? startPosition + length
: undefined;
const category = fromDiagnosticCategory(sourceCategory); const category = fromDiagnosticCategory(sourceCategory);
let message: string; let message: string;
@ -224,7 +226,7 @@ function parseDiagnostic(
} }
function parseRelatedInformation( function parseRelatedInformation(
relatedInformation: readonly ts.DiagnosticRelatedInformation[] relatedInformation: readonly ts.DiagnosticRelatedInformation[],
): DiagnosticItem[] { ): DiagnosticItem[] {
const result: DiagnosticItem[] = []; const result: DiagnosticItem[] = [];
for (const item of relatedInformation) { for (const item of relatedInformation) {
@ -234,14 +236,14 @@ function parseRelatedInformation(
} }
export function fromTypeScriptDiagnostic( export function fromTypeScriptDiagnostic(
diagnostics: readonly ts.Diagnostic[] diagnostics: readonly ts.Diagnostic[],
): Diagnostic { ): Diagnostic {
const items: DiagnosticItem[] = []; const items: DiagnosticItem[] = [];
for (const sourceDiagnostic of diagnostics) { for (const sourceDiagnostic of diagnostics) {
const item: DiagnosticItem = parseDiagnostic(sourceDiagnostic); const item: DiagnosticItem = parseDiagnostic(sourceDiagnostic);
if (sourceDiagnostic.relatedInformation) { if (sourceDiagnostic.relatedInformation) {
item.relatedInformation = parseRelatedInformation( item.relatedInformation = parseRelatedInformation(
sourceDiagnostic.relatedInformation sourceDiagnostic.relatedInformation,
); );
} }
items.push(item); items.push(item);

View file

@ -149,7 +149,7 @@ function callSiteToString(callSite: CallSite, internal = false): string {
} }
if (isPromiseAll) { if (isPromiseAll) {
result += colors.bold( result += colors.bold(
colors.italic(black(`Promise.all (index ${callSite.getPromiseIndex()})`)) colors.italic(black(`Promise.all (index ${callSite.getPromiseIndex()})`)),
); );
return result; return result;
} }
@ -218,7 +218,7 @@ function prepareStackTrace(
__callSiteEvals: CallSiteEval[]; __callSiteEvals: CallSiteEval[];
__formattedFrames: string[]; __formattedFrames: string[];
}, },
callSites: CallSite[] callSites: CallSite[],
): string { ): string {
const mappedCallSites = callSites.map( const mappedCallSites = callSites.map(
(callSite): CallSite => { (callSite): CallSite => {
@ -232,11 +232,11 @@ function prepareStackTrace(
fileName, fileName,
lineNumber, lineNumber,
columnNumber, columnNumber,
}) }),
); );
} }
return callSite; return callSite;
} },
); );
Object.defineProperties(error, { Object.defineProperties(error, {
__callSiteEvals: { value: [], configurable: true }, __callSiteEvals: { value: [], configurable: true },

View file

@ -23,7 +23,7 @@ export type { OpenOptions } from "./ops/fs/open.ts";
export function openSync( export function openSync(
path: string | URL, path: string | URL,
options: OpenOptions = { read: true } options: OpenOptions = { read: true },
): File { ): File {
checkOpenOptions(options); checkOpenOptions(options);
const rid = opOpenSync(path, options); const rid = opOpenSync(path, options);
@ -32,7 +32,7 @@ export function openSync(
export async function open( export async function open(
path: string | URL, path: string | URL,
options: OpenOptions = { read: true } options: OpenOptions = { read: true },
): Promise<File> { ): Promise<File> {
checkOpenOptions(options); checkOpenOptions(options);
const rid = await opOpen(path, options); const rid = await opOpen(path, options);
@ -163,7 +163,7 @@ function checkOpenOptions(options: OpenOptions): void {
if (createOrCreateNewWithoutWriteOrAppend) { if (createOrCreateNewWithoutWriteOrAppend) {
throw new Error( throw new Error(
"'create' or 'createNew' options require 'write' or 'append' option" "'create' or 'createNew' options require 'write' or 'append' option",
); );
} }
} }

View file

@ -104,7 +104,7 @@ declare global {
evalContext( evalContext(
code: string, code: string,
scriptName?: string scriptName?: string,
): [unknown, EvalErrorInfo | null]; ): [unknown, EvalErrorInfo | null];
formatError: (e: Error) => string; formatError: (e: Error) => string;
@ -154,7 +154,7 @@ declare global {
source: string, source: string,
lineno: number, lineno: number,
colno: number, colno: number,
e: Event e: Event,
) => boolean | void) ) => boolean | void)
| undefined; | undefined;
@ -218,7 +218,7 @@ export const windowOrWorkerGlobalScopeProperties = {
AbortSignal: nonEnumerable(abortSignal.AbortSignalImpl), AbortSignal: nonEnumerable(abortSignal.AbortSignalImpl),
Blob: nonEnumerable(blob.DenoBlob), Blob: nonEnumerable(blob.DenoBlob),
ByteLengthQueuingStrategy: nonEnumerable( ByteLengthQueuingStrategy: nonEnumerable(
queuingStrategy.ByteLengthQueuingStrategyImpl queuingStrategy.ByteLengthQueuingStrategyImpl,
), ),
CountQueuingStrategy: nonEnumerable(queuingStrategy.CountQueuingStrategyImpl), CountQueuingStrategy: nonEnumerable(queuingStrategy.CountQueuingStrategyImpl),
crypto: readOnly(csprng), crypto: readOnly(csprng),
@ -254,10 +254,10 @@ export function setEventTargetData(value: any): void {
export const eventTargetProperties = { export const eventTargetProperties = {
addEventListener: readOnly( addEventListener: readOnly(
eventTarget.EventTargetImpl.prototype.addEventListener eventTarget.EventTargetImpl.prototype.addEventListener,
), ),
dispatchEvent: readOnly(eventTarget.EventTargetImpl.prototype.dispatchEvent), dispatchEvent: readOnly(eventTarget.EventTargetImpl.prototype.dispatchEvent),
removeEventListener: readOnly( removeEventListener: readOnly(
eventTarget.EventTargetImpl.prototype.removeEventListener eventTarget.EventTargetImpl.prototype.removeEventListener,
), ),
}; };

View file

@ -55,7 +55,7 @@ export async function copy(
dst: Writer, dst: Writer,
options?: { options?: {
bufSize?: number; bufSize?: number;
} },
): Promise<number> { ): Promise<number> {
let n = 0; let n = 0;
const bufSize = options?.bufSize ?? DEFAULT_BUFFER_SIZE; const bufSize = options?.bufSize ?? DEFAULT_BUFFER_SIZE;
@ -80,7 +80,7 @@ export async function* iter(
r: Reader, r: Reader,
options?: { options?: {
bufSize?: number; bufSize?: number;
} },
): AsyncIterableIterator<Uint8Array> { ): AsyncIterableIterator<Uint8Array> {
const bufSize = options?.bufSize ?? DEFAULT_BUFFER_SIZE; const bufSize = options?.bufSize ?? DEFAULT_BUFFER_SIZE;
const b = new Uint8Array(bufSize); const b = new Uint8Array(bufSize);
@ -98,7 +98,7 @@ export function* iterSync(
r: ReaderSync, r: ReaderSync,
options?: { options?: {
bufSize?: number; bufSize?: number;
} },
): IterableIterator<Uint8Array> { ): IterableIterator<Uint8Array> {
const bufSize = options?.bufSize ?? DEFAULT_BUFFER_SIZE; const bufSize = options?.bufSize ?? DEFAULT_BUFFER_SIZE;
const b = new Uint8Array(bufSize); const b = new Uint8Array(bufSize);

View file

@ -34,7 +34,7 @@ declare interface Performance {
* associated name (a "measure"). */ * associated name (a "measure"). */
measure( measure(
measureName: string, measureName: string,
options?: PerformanceMeasureOptions options?: PerformanceMeasureOptions,
): PerformanceMeasure; ): PerformanceMeasure;
} }
@ -394,7 +394,7 @@ declare namespace Deno {
dst: Writer, dst: Writer,
options?: { options?: {
bufSize?: number; bufSize?: number;
} },
): Promise<number>; ): Promise<number>;
/** Turns a Reader, `r`, into an async iterator. /** Turns a Reader, `r`, into an async iterator.
@ -430,7 +430,7 @@ declare namespace Deno {
r: Reader, r: Reader,
options?: { options?: {
bufSize?: number; bufSize?: number;
} },
): AsyncIterableIterator<Uint8Array>; ): AsyncIterableIterator<Uint8Array>;
/** Turns a ReaderSync, `r`, into an iterator. /** Turns a ReaderSync, `r`, into an iterator.
@ -466,7 +466,7 @@ declare namespace Deno {
r: ReaderSync, r: ReaderSync,
options?: { options?: {
bufSize?: number; bufSize?: number;
} },
): IterableIterator<Uint8Array>; ): IterableIterator<Uint8Array>;
/** Synchronously open a file and return an instance of `Deno.File`. The /** Synchronously open a file and return an instance of `Deno.File`. The
@ -499,7 +499,7 @@ declare namespace Deno {
*/ */
export function open( export function open(
path: string | URL, path: string | URL,
options?: OpenOptions options?: OpenOptions,
): Promise<File>; ): Promise<File>;
/** Creates a file if none exists or truncates an existing file and returns /** Creates a file if none exists or truncates an existing file and returns
@ -641,7 +641,7 @@ declare namespace Deno {
export function seekSync( export function seekSync(
rid: number, rid: number,
offset: number, offset: number,
whence: SeekMode whence: SeekMode,
): number; ): number;
/** Seek a resource ID (`rid`) to the given `offset` under mode given by `whence`. /** Seek a resource ID (`rid`) to the given `offset` under mode given by `whence`.
@ -673,7 +673,7 @@ declare namespace Deno {
export function seek( export function seek(
rid: number, rid: number,
offset: number, offset: number,
whence: SeekMode whence: SeekMode,
): Promise<number>; ): Promise<number>;
/** Close the given resource ID (rid) which has been previously opened, such /** Close the given resource ID (rid) which has been previously opened, such
@ -973,7 +973,7 @@ declare namespace Deno {
* Requires `allow-write` permission. */ * Requires `allow-write` permission. */
export function mkdir( export function mkdir(
path: string | URL, path: string | URL,
options?: MkdirOptions options?: MkdirOptions,
): Promise<void>; ): Promise<void>;
export interface MakeTempOptions { export interface MakeTempOptions {
@ -1132,7 +1132,7 @@ declare namespace Deno {
export function chownSync( export function chownSync(
path: string | URL, path: string | URL,
uid: number | null, uid: number | null,
gid: number | null gid: number | null,
): void; ): void;
/** Change owner of a regular file or directory. This functionality /** Change owner of a regular file or directory. This functionality
@ -1153,7 +1153,7 @@ declare namespace Deno {
export function chown( export function chown(
path: string | URL, path: string | URL,
uid: number | null, uid: number | null,
gid: number | null gid: number | null,
): Promise<void>; ): Promise<void>;
export interface RemoveOptions { export interface RemoveOptions {
@ -1188,7 +1188,7 @@ declare namespace Deno {
* Requires `allow-write` permission. */ * Requires `allow-write` permission. */
export function remove( export function remove(
path: string | URL, path: string | URL,
options?: RemoveOptions options?: RemoveOptions,
): Promise<void>; ): Promise<void>;
/** Synchronously renames (moves) `oldpath` to `newpath`. Paths may be files or /** Synchronously renames (moves) `oldpath` to `newpath`. Paths may be files or
@ -1417,7 +1417,7 @@ declare namespace Deno {
* Requires `allow-write` permission on toPath. */ * Requires `allow-write` permission on toPath. */
export function copyFileSync( export function copyFileSync(
fromPath: string | URL, fromPath: string | URL,
toPath: string | URL toPath: string | URL,
): void; ): void;
/** Copies the contents and permissions of one file to another specified path, /** Copies the contents and permissions of one file to another specified path,
@ -1432,7 +1432,7 @@ declare namespace Deno {
* Requires `allow-write` permission on toPath. */ * Requires `allow-write` permission on toPath. */
export function copyFile( export function copyFile(
fromPath: string | URL, fromPath: string | URL,
toPath: string | URL toPath: string | URL,
): Promise<void>; ): Promise<void>;
/** Returns the full path destination of the named symbolic link. /** Returns the full path destination of the named symbolic link.
@ -1538,7 +1538,7 @@ declare namespace Deno {
export function writeFileSync( export function writeFileSync(
path: string | URL, path: string | URL,
data: Uint8Array, data: Uint8Array,
options?: WriteFileOptions options?: WriteFileOptions,
): void; ): void;
/** Write `data` to the given `path`, by default creating a new file if needed, /** Write `data` to the given `path`, by default creating a new file if needed,
@ -1558,7 +1558,7 @@ declare namespace Deno {
export function writeFile( export function writeFile(
path: string | URL, path: string | URL,
data: Uint8Array, data: Uint8Array,
options?: WriteFileOptions options?: WriteFileOptions,
): Promise<void>; ): Promise<void>;
/** Synchronously write string `data` to the given `path`, by default creating a new file if needed, /** Synchronously write string `data` to the given `path`, by default creating a new file if needed,
@ -1573,7 +1573,7 @@ declare namespace Deno {
export function writeTextFileSync( export function writeTextFileSync(
path: string | URL, path: string | URL,
data: string, data: string,
options?: WriteFileOptions options?: WriteFileOptions,
): void; ): void;
/** Asynchronously write string `data` to the given `path`, by default creating a new file if needed, /** Asynchronously write string `data` to the given `path`, by default creating a new file if needed,
@ -1588,7 +1588,7 @@ declare namespace Deno {
export function writeTextFile( export function writeTextFile(
path: string | URL, path: string | URL,
data: string, data: string,
options?: WriteFileOptions options?: WriteFileOptions,
): Promise<void>; ): Promise<void>;
/** Synchronously truncates or extends the specified file, to reach the /** Synchronously truncates or extends the specified file, to reach the
@ -1692,7 +1692,7 @@ declare namespace Deno {
* *
* Requires `allow-net` permission. */ * Requires `allow-net` permission. */
export function listen( export function listen(
options: ListenOptions & { transport?: "tcp" } options: ListenOptions & { transport?: "tcp" },
): Listener; ): Listener;
export interface ListenTlsOptions extends ListenOptions { export interface ListenTlsOptions extends ListenOptions {
@ -1844,20 +1844,17 @@ declare namespace Deno {
*/ */
export function watchFs( export function watchFs(
paths: string | string[], paths: string | string[],
options?: { recursive: boolean } options?: { recursive: boolean },
): AsyncIterableIterator<FsEvent>; ): AsyncIterableIterator<FsEvent>;
export class Process<T extends RunOptions = RunOptions> { export class Process<T extends RunOptions = RunOptions> {
readonly rid: number; readonly rid: number;
readonly pid: number; readonly pid: number;
readonly stdin: T["stdin"] extends "piped" readonly stdin: T["stdin"] extends "piped" ? Writer & Closer
? Writer & Closer
: (Writer & Closer) | null; : (Writer & Closer) | null;
readonly stdout: T["stdout"] extends "piped" readonly stdout: T["stdout"] extends "piped" ? Reader & Closer
? Reader & Closer
: (Reader & Closer) | null; : (Reader & Closer) | null;
readonly stderr: T["stderr"] extends "piped" readonly stderr: T["stderr"] extends "piped" ? Reader & Closer
? Reader & Closer
: (Reader & Closer) | null; : (Reader & Closer) | null;
/** Resolves to the current status of the process. */ /** Resolves to the current status of the process. */
status(): Promise<ProcessStatus>; status(): Promise<ProcessStatus>;

View file

@ -31,7 +31,7 @@ declare namespace WebAssembly {
* its first `WebAssembly.Instance`. */ * its first `WebAssembly.Instance`. */
function instantiate( function instantiate(
bufferSource: BufferSource, bufferSource: BufferSource,
importObject?: object importObject?: object,
): Promise<WebAssemblyInstantiatedSource>; ): Promise<WebAssemblyInstantiatedSource>;
/** Takes an already-compiled `WebAssembly.Module` and returns a `Promise` /** Takes an already-compiled `WebAssembly.Module` and returns a `Promise`
@ -39,7 +39,7 @@ declare namespace WebAssembly {
* the `Module` has already been compiled. */ * the `Module` has already been compiled. */
function instantiate( function instantiate(
module: Module, module: Module,
importObject?: object importObject?: object,
): Promise<Instance>; ): Promise<Instance>;
/** Compiles and instantiates a WebAssembly module directly from a streamed /** Compiles and instantiates a WebAssembly module directly from a streamed
@ -47,7 +47,7 @@ declare namespace WebAssembly {
* code. */ * code. */
function instantiateStreaming( function instantiateStreaming(
source: Promise<Response>, source: Promise<Response>,
importObject?: object importObject?: object,
): Promise<WebAssemblyInstantiatedSource>; ): Promise<WebAssemblyInstantiatedSource>;
/** Validates a given typed array of WebAssembly binary code, returning /** Validates a given typed array of WebAssembly binary code, returning
@ -73,7 +73,7 @@ declare namespace WebAssembly {
* custom sections in the module with the given string name. */ * custom sections in the module with the given string name. */
static customSections( static customSections(
moduleObject: Module, moduleObject: Module,
sectionName: string sectionName: string,
): ArrayBuffer; ): ArrayBuffer;
/** Given a `Module`, returns an array containing descriptions of all the /** Given a `Module`, returns an array containing descriptions of all the
@ -246,7 +246,7 @@ declare var crypto: Crypto;
declare function addEventListener( declare function addEventListener(
type: string, type: string,
callback: EventListenerOrEventListenerObject | null, callback: EventListenerOrEventListenerObject | null,
options?: boolean | AddEventListenerOptions | undefined options?: boolean | AddEventListenerOptions | undefined,
): void; ): void;
/** Dispatches an event in the global scope, synchronously invoking any /** Dispatches an event in the global scope, synchronously invoking any
@ -267,7 +267,7 @@ declare function dispatchEvent(event: Event): boolean;
declare function removeEventListener( declare function removeEventListener(
type: string, type: string,
callback: EventListenerOrEventListenerObject | null, callback: EventListenerOrEventListenerObject | null,
options?: boolean | EventListenerOptions | undefined options?: boolean | EventListenerOptions | undefined,
): void; ): void;
interface DomIterable<K, V> { interface DomIterable<K, V> {
@ -277,7 +277,7 @@ interface DomIterable<K, V> {
[Symbol.iterator](): IterableIterator<[K, V]>; [Symbol.iterator](): IterableIterator<[K, V]>;
forEach( forEach(
callback: (value: V, key: K, parent: this) => void, callback: (value: V, key: K, parent: this) => void,
thisArg?: any thisArg?: any,
): void; ): void;
} }
@ -398,7 +398,7 @@ interface ReadableStream<R = any> {
writable: WritableStream<R>; writable: WritableStream<R>;
readable: ReadableStream<T>; readable: ReadableStream<T>;
}, },
options?: PipeOptions options?: PipeOptions,
): ReadableStream<T>; ): ReadableStream<T>;
pipeTo(dest: WritableStream<R>, options?: PipeOptions): Promise<void>; pipeTo(dest: WritableStream<R>, options?: PipeOptions): Promise<void>;
tee(): [ReadableStream<R>, ReadableStream<R>]; tee(): [ReadableStream<R>, ReadableStream<R>];
@ -411,11 +411,11 @@ declare var ReadableStream: {
prototype: ReadableStream; prototype: ReadableStream;
new ( new (
underlyingSource: UnderlyingByteSource, underlyingSource: UnderlyingByteSource,
strategy?: { highWaterMark?: number; size?: undefined } strategy?: { highWaterMark?: number; size?: undefined },
): ReadableStream<Uint8Array>; ): ReadableStream<Uint8Array>;
new <R = any>( new <R = any>(
underlyingSource?: UnderlyingSource<R>, underlyingSource?: UnderlyingSource<R>,
strategy?: QueuingStrategy<R> strategy?: QueuingStrategy<R>,
): ReadableStream<R>; ): ReadableStream<R>;
}; };
@ -428,7 +428,9 @@ interface WritableStreamDefaultControllerStartCallback {
} }
interface WritableStreamDefaultControllerWriteCallback<W> { interface WritableStreamDefaultControllerWriteCallback<W> {
(chunk: W, controller: WritableStreamDefaultController): void | PromiseLike< (chunk: W, controller: WritableStreamDefaultController):
| void
| PromiseLike<
void void
>; >;
} }
@ -451,7 +453,7 @@ interface UnderlyingSink<W = any> {
declare class WritableStream<W = any> { declare class WritableStream<W = any> {
constructor( constructor(
underlyingSink?: UnderlyingSink<W>, underlyingSink?: UnderlyingSink<W>,
strategy?: QueuingStrategy<W> strategy?: QueuingStrategy<W>,
); );
readonly locked: boolean; readonly locked: boolean;
abort(reason?: any): Promise<void>; abort(reason?: any): Promise<void>;
@ -485,7 +487,7 @@ declare class TransformStream<I = any, O = any> {
constructor( constructor(
transformer?: Transformer<I, O>, transformer?: Transformer<I, O>,
writableStrategy?: QueuingStrategy<I>, writableStrategy?: QueuingStrategy<I>,
readableStrategy?: QueuingStrategy<O> readableStrategy?: QueuingStrategy<O>,
); );
readonly readable: ReadableStream<O>; readonly readable: ReadableStream<O>;
readonly writable: WritableStream<I>; readonly writable: WritableStream<I>;
@ -513,7 +515,7 @@ interface TransformStreamDefaultControllerCallback<O> {
interface TransformStreamDefaultControllerTransformCallback<I, O> { interface TransformStreamDefaultControllerTransformCallback<I, O> {
( (
chunk: I, chunk: I,
controller: TransformStreamDefaultController<O> controller: TransformStreamDefaultController<O>,
): void | PromiseLike<void>; ): void | PromiseLike<void>;
} }
@ -589,7 +591,7 @@ declare class Console {
options?: Partial<{ options?: Partial<{
depth: number; depth: number;
indentLevel: number; indentLevel: number;
}> }>,
) => void; ) => void;
/** From MDN: /** From MDN:
@ -609,7 +611,7 @@ declare class Console {
depth: number; depth: number;
colors: boolean; colors: boolean;
indentLevel: number; indentLevel: number;
}> }>,
) => void; ) => void;
/** Writes the arguments to stdout */ /** Writes the arguments to stdout */
@ -650,9 +652,9 @@ declare interface Crypto {
| Float32Array | Float32Array
| Float64Array | Float64Array
| DataView | DataView
| null | null,
>( >(
array: T array: T,
): T; ): T;
} }
@ -724,7 +726,7 @@ interface Headers {
set(name: string, value: string): void; set(name: string, value: string): void;
forEach( forEach(
callbackfn: (value: string, key: string, parent: Headers) => void, callbackfn: (value: string, key: string, parent: Headers) => void,
thisArg?: any thisArg?: any,
): void; ): void;
} }
@ -762,7 +764,7 @@ interface Headers extends DomIterable<string, string> {
values(): IterableIterator<string>; values(): IterableIterator<string>;
forEach( forEach(
callbackfn: (value: string, key: string, parent: this) => void, callbackfn: (value: string, key: string, parent: this) => void,
thisArg?: any thisArg?: any,
): void; ): void;
/** The Symbol.iterator well-known symbol specifies the default /** The Symbol.iterator well-known symbol specifies the default
* iterator for this Headers object * iterator for this Headers object
@ -1023,7 +1025,7 @@ declare const Response: {
*/ */
declare function fetch( declare function fetch(
input: Request | URL | string, input: Request | URL | string,
init?: RequestInit init?: RequestInit,
): Promise<Response>; ): Promise<Response>;
/** Decodes a string of data which has been encoded using base-64 encoding. /** Decodes a string of data which has been encoded using base-64 encoding.
@ -1047,7 +1049,7 @@ declare class TextDecoder {
readonly ignoreBOM = false; readonly ignoreBOM = false;
constructor( constructor(
label?: string, label?: string,
options?: { fatal?: boolean; ignoreBOM?: boolean } options?: { fatal?: boolean; ignoreBOM?: boolean },
); );
/** Returns the result of running encoding's decoder. */ /** Returns the result of running encoding's decoder. */
decode(input?: BufferSource, options?: { stream?: false }): string; decode(input?: BufferSource, options?: { stream?: false }): string;
@ -1061,7 +1063,7 @@ declare class TextEncoder {
encode(input?: string): Uint8Array; encode(input?: string): Uint8Array;
encodeInto( encodeInto(
input: string, input: string,
dest: Uint8Array dest: Uint8Array,
): { read: number; written: number }; ): { read: number; written: number };
readonly [Symbol.toStringTag]: string; readonly [Symbol.toStringTag]: string;
} }
@ -1148,7 +1150,7 @@ interface URLSearchParams {
*/ */
forEach( forEach(
callbackfn: (value: string, key: string, parent: this) => void, callbackfn: (value: string, key: string, parent: this) => void,
thisArg?: any thisArg?: any,
): void; ): void;
/** Returns an iterator allowing to go through all keys contained /** Returns an iterator allowing to go through all keys contained
@ -1211,7 +1213,7 @@ interface URLSearchParams {
declare const URLSearchParams: { declare const URLSearchParams: {
prototype: URLSearchParams; prototype: URLSearchParams;
new ( new (
init?: string[][] | Record<string, string> | string | URLSearchParams init?: string[][] | Record<string, string> | string | URLSearchParams,
): URLSearchParams; ): URLSearchParams;
toString(): string; toString(): string;
}; };
@ -1330,7 +1332,7 @@ declare class Worker extends EventTarget {
* *
*/ */
deno?: boolean; deno?: boolean;
} },
); );
postMessage(message: any, transfer: ArrayBuffer[]): void; postMessage(message: any, transfer: ArrayBuffer[]): void;
postMessage(message: any, options?: PostMessageOptions): void; postMessage(message: any, options?: PostMessageOptions): void;
@ -1357,14 +1359,14 @@ declare interface Performance {
* associated name (a "measure"). */ * associated name (a "measure"). */
measure( measure(
measureName: string, measureName: string,
options?: PerformanceMeasureOptions options?: PerformanceMeasureOptions,
): PerformanceMeasure; ): PerformanceMeasure;
/** Stores the `DOMHighResTimeStamp` duration between two marks along with the /** Stores the `DOMHighResTimeStamp` duration between two marks along with the
* associated name (a "measure"). */ * associated name (a "measure"). */
measure( measure(
measureName: string, measureName: string,
startMark?: string, startMark?: string,
endMark?: string endMark?: string,
): PerformanceMeasure; ): PerformanceMeasure;
/** Returns a current time from Deno's start in milliseconds. /** Returns a current time from Deno's start in milliseconds.
@ -1540,7 +1542,7 @@ declare class EventTarget {
addEventListener( addEventListener(
type: string, type: string,
listener: EventListenerOrEventListenerObject | null, listener: EventListenerOrEventListenerObject | null,
options?: boolean | AddEventListenerOptions options?: boolean | AddEventListenerOptions,
): void; ): void;
/** Dispatches a synthetic event event to target and returns true if either /** Dispatches a synthetic event event to target and returns true if either
* event's cancelable attribute value is false or its preventDefault() method * event's cancelable attribute value is false or its preventDefault() method
@ -1551,7 +1553,7 @@ declare class EventTarget {
removeEventListener( removeEventListener(
type: string, type: string,
callback: EventListenerOrEventListenerObject | null, callback: EventListenerOrEventListenerObject | null,
options?: EventListenerOptions | boolean options?: EventListenerOptions | boolean,
): void; ): void;
[Symbol.toStringTag]: string; [Symbol.toStringTag]: string;
} }
@ -1622,22 +1624,22 @@ interface AbortSignal extends EventTarget {
addEventListener<K extends keyof AbortSignalEventMap>( addEventListener<K extends keyof AbortSignalEventMap>(
type: K, type: K,
listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any,
options?: boolean | AddEventListenerOptions options?: boolean | AddEventListenerOptions,
): void; ): void;
addEventListener( addEventListener(
type: string, type: string,
listener: EventListenerOrEventListenerObject, listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions options?: boolean | AddEventListenerOptions,
): void; ): void;
removeEventListener<K extends keyof AbortSignalEventMap>( removeEventListener<K extends keyof AbortSignalEventMap>(
type: K, type: K,
listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any,
options?: boolean | EventListenerOptions options?: boolean | EventListenerOptions,
): void; ): void;
removeEventListener( removeEventListener(
type: string, type: string,
listener: EventListenerOrEventListenerObject, listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions options?: boolean | EventListenerOptions,
): void; ): void;
} }

View file

@ -52,7 +52,7 @@ declare namespace Deno {
* ``` * ```
*/ */
export function consoleSize( export function consoleSize(
rid: number rid: number,
): { ): {
columns: number; columns: number;
rows: number; rows: number;
@ -77,7 +77,7 @@ declare namespace Deno {
export function symlinkSync( export function symlinkSync(
oldpath: string, oldpath: string,
newpath: string, newpath: string,
options?: SymlinkOptions options?: SymlinkOptions,
): void; ): void;
/** **UNSTABLE**: This API needs a security review. /** **UNSTABLE**: This API needs a security review.
@ -95,7 +95,7 @@ declare namespace Deno {
export function symlink( export function symlink(
oldpath: string, oldpath: string,
newpath: string, newpath: string,
options?: SymlinkOptions options?: SymlinkOptions,
): Promise<void>; ): Promise<void>;
/** **Unstable** There are questions around which permission this needs. And /** **Unstable** There are questions around which permission this needs. And
@ -454,7 +454,7 @@ declare namespace Deno {
*/ */
export function transpileOnly( export function transpileOnly(
sources: Record<string, string>, sources: Record<string, string>,
options?: CompilerOptions options?: CompilerOptions,
): Promise<Record<string, TranspileOnlyResult>>; ): Promise<Record<string, TranspileOnlyResult>>;
/** **UNSTABLE**: new API, yet to be vetted. /** **UNSTABLE**: new API, yet to be vetted.
@ -492,7 +492,7 @@ declare namespace Deno {
export function compile( export function compile(
rootName: string, rootName: string,
sources?: Record<string, string>, sources?: Record<string, string>,
options?: CompilerOptions options?: CompilerOptions,
): Promise<[DiagnosticItem[] | undefined, Record<string, string>]>; ): Promise<[DiagnosticItem[] | undefined, Record<string, string>]>;
/** **UNSTABLE**: new API, yet to be vetted. /** **UNSTABLE**: new API, yet to be vetted.
@ -535,7 +535,7 @@ declare namespace Deno {
export function bundle( export function bundle(
rootName: string, rootName: string,
sources?: Record<string, string>, sources?: Record<string, string>,
options?: CompilerOptions options?: CompilerOptions,
): Promise<[DiagnosticItem[] | undefined, string]>; ): Promise<[DiagnosticItem[] | undefined, string]>;
/** **UNSTABLE**: Should not have same name as `window.location` type. */ /** **UNSTABLE**: Should not have same name as `window.location` type. */
@ -657,7 +657,7 @@ declare namespace Deno {
constructor(signal: typeof Deno.Signal); constructor(signal: typeof Deno.Signal);
then<T, S>( then<T, S>(
f: (v: void) => T | Promise<T>, f: (v: void) => T | Promise<T>,
g?: (v: void) => S | Promise<S> g?: (v: void) => S | Promise<S>,
): Promise<T | S>; ): Promise<T | S>;
next(): Promise<IteratorResult<void>>; next(): Promise<IteratorResult<void>>;
[Symbol.asyncIterator](): AsyncIterableIterator<void>; [Symbol.asyncIterator](): AsyncIterableIterator<void>;
@ -777,7 +777,7 @@ declare namespace Deno {
export function utimeSync( export function utimeSync(
path: string, path: string,
atime: number | Date, atime: number | Date,
mtime: number | Date mtime: number | Date,
): void; ): void;
/** **UNSTABLE**: needs investigation into high precision time. /** **UNSTABLE**: needs investigation into high precision time.
@ -794,7 +794,7 @@ declare namespace Deno {
export function utime( export function utime(
path: string, path: string,
atime: number | Date, atime: number | Date,
mtime: number | Date mtime: number | Date,
): Promise<void>; ): Promise<void>;
/** **UNSTABLE**: Under consideration to remove `ShutdownMode` entirely. /** **UNSTABLE**: Under consideration to remove `ShutdownMode` entirely.
@ -860,7 +860,7 @@ declare namespace Deno {
* *
* Requires `allow-read` and `allow-write` permission. */ * Requires `allow-read` and `allow-write` permission. */
export function listen( export function listen(
options: UnixListenOptions & { transport: "unix" } options: UnixListenOptions & { transport: "unix" },
): Listener; ): Listener;
/** **UNSTABLE**: new API, yet to be vetted /** **UNSTABLE**: new API, yet to be vetted
@ -881,7 +881,7 @@ declare namespace Deno {
* *
* Requires `allow-net` permission. */ * Requires `allow-net` permission. */
export function listenDatagram( export function listenDatagram(
options: ListenOptions & { transport: "udp" } options: ListenOptions & { transport: "udp" },
): DatagramConn; ): DatagramConn;
/** **UNSTABLE**: new API, yet to be vetted /** **UNSTABLE**: new API, yet to be vetted
@ -897,7 +897,7 @@ declare namespace Deno {
* *
* Requires `allow-read` and `allow-write` permission. */ * Requires `allow-read` and `allow-write` permission. */
export function listenDatagram( export function listenDatagram(
options: UnixListenOptions & { transport: "unixpacket" } options: UnixListenOptions & { transport: "unixpacket" },
): DatagramConn; ): DatagramConn;
export interface UnixConnectOptions { export interface UnixConnectOptions {
@ -921,7 +921,7 @@ declare namespace Deno {
* *
* Requires `allow-net` permission for "tcp" and `allow-read` for "unix". */ * Requires `allow-net` permission for "tcp" and `allow-read` for "unix". */
export function connect( export function connect(
options: ConnectOptions | UnixConnectOptions options: ConnectOptions | UnixConnectOptions,
): Promise<Conn>; ): Promise<Conn>;
export interface StartTlsOptions { export interface StartTlsOptions {
@ -950,7 +950,7 @@ declare namespace Deno {
*/ */
export function startTls( export function startTls(
conn: Conn, conn: Conn,
options?: StartTlsOptions options?: StartTlsOptions,
): Promise<Conn>; ): Promise<Conn>;
/** **UNSTABLE**: The `signo` argument may change to require the Deno.Signal /** **UNSTABLE**: The `signo` argument may change to require the Deno.Signal

View file

@ -26,7 +26,7 @@ declare let onerror:
source: string, source: string,
lineno: number, lineno: number,
colno: number, colno: number,
e: Event e: Event,
) => boolean | void) ) => boolean | void)
| undefined; | undefined;
declare const close: typeof __workerMain.close; declare const close: typeof __workerMain.close;

View file

@ -37,7 +37,7 @@ export class ConnImpl implements Conn {
constructor( constructor(
readonly rid: number, readonly rid: number,
readonly remoteAddr: Addr, readonly remoteAddr: Addr,
readonly localAddr: Addr readonly localAddr: Addr,
) {} ) {}
write(p: Uint8Array): Promise<number> { write(p: Uint8Array): Promise<number> {
@ -97,7 +97,7 @@ export class DatagramImpl implements DatagramConn {
constructor( constructor(
readonly rid: number, readonly rid: number,
readonly addr: Addr, readonly addr: Addr,
public bufSize: number = 1024 public bufSize: number = 1024,
) {} ) {}
async receive(p?: Uint8Array): Promise<[Uint8Array, Addr]> { async receive(p?: Uint8Array): Promise<[Uint8Array, Addr]> {
@ -105,7 +105,7 @@ export class DatagramImpl implements DatagramConn {
const { size, remoteAddr } = await netOps.receive( const { size, remoteAddr } = await netOps.receive(
this.rid, this.rid,
this.addr.transport, this.addr.transport,
buf buf,
); );
const sub = buf.subarray(0, size); const sub = buf.subarray(0, size);
return [sub, remoteAddr]; return [sub, remoteAddr];
@ -150,7 +150,7 @@ export interface ListenOptions {
} }
export function listen( export function listen(
options: ListenOptions & { transport?: "tcp" } options: ListenOptions & { transport?: "tcp" },
): Listener; ): Listener;
export function listen(options: ListenOptions): Listener { export function listen(options: ListenOptions): Listener {
const res = netOps.listen({ const res = netOps.listen({
@ -174,7 +174,7 @@ export interface UnixConnectOptions {
export async function connect(options: UnixConnectOptions): Promise<Conn>; export async function connect(options: UnixConnectOptions): Promise<Conn>;
export async function connect(options: ConnectOptions): Promise<Conn>; export async function connect(options: ConnectOptions): Promise<Conn>;
export async function connect( export async function connect(
options: ConnectOptions | UnixConnectOptions options: ConnectOptions | UnixConnectOptions,
): Promise<Conn> { ): Promise<Conn> {
let res; let res;

View file

@ -30,10 +30,10 @@ export interface UnixConnectOptions {
} }
export function listen( export function listen(
options: ListenOptions & { transport?: "tcp" } options: ListenOptions & { transport?: "tcp" },
): Listener; ): Listener;
export function listen( export function listen(
options: UnixListenOptions & { transport: "unix" } options: UnixListenOptions & { transport: "unix" },
): Listener; ): Listener;
export function listen(options: ListenOptions | UnixListenOptions): Listener { export function listen(options: ListenOptions | UnixListenOptions): Listener {
if (options.transport === "unix") { if (options.transport === "unix") {
@ -45,13 +45,13 @@ export function listen(options: ListenOptions | UnixListenOptions): Listener {
} }
export function listenDatagram( export function listenDatagram(
options: ListenOptions & { transport: "udp" } options: ListenOptions & { transport: "udp" },
): DatagramConn; ): DatagramConn;
export function listenDatagram( export function listenDatagram(
options: UnixListenOptions & { transport: "unixpacket" } options: UnixListenOptions & { transport: "unixpacket" },
): DatagramConn; ): DatagramConn;
export function listenDatagram( export function listenDatagram(
options: ListenOptions | UnixListenOptions options: ListenOptions | UnixListenOptions,
): DatagramConn { ): DatagramConn {
let res; let res;
if (options.transport === "unixpacket") { if (options.transport === "unixpacket") {
@ -68,7 +68,7 @@ export function listenDatagram(
} }
export async function connect( export async function connect(
options: ConnectOptions | UnixConnectOptions options: ConnectOptions | UnixConnectOptions,
): Promise<Conn> { ): Promise<Conn> {
if (options.transport === "unix") { if (options.transport === "unix") {
const res = await netOps.connect(options); const res = await netOps.connect(options);

View file

@ -37,7 +37,7 @@ export function recordFromBufMinimal(ui8: Uint8Array): RecordMinimal {
const buf32 = new Int32Array( const buf32 = new Int32Array(
header.buffer, header.buffer,
header.byteOffset, header.byteOffset,
header.byteLength / 4 header.byteLength / 4,
); );
const promiseId = buf32[0]; const promiseId = buf32[0];
const arg = buf32[1]; const arg = buf32[1];
@ -71,7 +71,7 @@ const scratch32 = new Int32Array(3);
const scratchBytes = new Uint8Array( const scratchBytes = new Uint8Array(
scratch32.buffer, scratch32.buffer,
scratch32.byteOffset, scratch32.byteOffset,
scratch32.byteLength scratch32.byteLength,
); );
util.assert(scratchBytes.byteLength === scratch32.length * 4); util.assert(scratchBytes.byteLength === scratch32.length * 4);
@ -87,7 +87,7 @@ export function asyncMsgFromRust(ui8: Uint8Array): void {
export async function sendAsyncMinimal( export async function sendAsyncMinimal(
opName: string, opName: string,
arg: number, arg: number,
zeroCopy: Uint8Array zeroCopy: Uint8Array,
): Promise<number> { ): Promise<number> {
const promiseId = nextPromiseId(); // AKA cmdId const promiseId = nextPromiseId(); // AKA cmdId
scratch32[0] = promiseId; scratch32[0] = promiseId;
@ -111,7 +111,7 @@ export async function sendAsyncMinimal(
export function sendSyncMinimal( export function sendSyncMinimal(
opName: string, opName: string,
arg: number, arg: number,
zeroCopy: Uint8Array zeroCopy: Uint8Array,
): number { ): number {
scratch32[0] = 0; // promiseId 0 indicates sync scratch32[0] = 0; // promiseId 0 indicates sync
scratch32[1] = arg; scratch32[1] = arg;

View file

@ -17,7 +17,7 @@ export interface FetchResponse {
export function fetch( export function fetch(
args: FetchRequest, args: FetchRequest,
body?: ArrayBufferView body?: ArrayBufferView,
): Promise<FetchResponse> { ): Promise<FetchResponse> {
let zeroCopy; let zeroCopy;
if (body != null) { if (body != null) {

View file

@ -6,7 +6,7 @@ import { pathFromURL } from "../../util.ts";
export function chownSync( export function chownSync(
path: string | URL, path: string | URL,
uid: number | null, uid: number | null,
gid: number | null gid: number | null,
): void { ): void {
sendSync("op_chown", { path: pathFromURL(path), uid, gid }); sendSync("op_chown", { path: pathFromURL(path), uid, gid });
} }
@ -14,7 +14,7 @@ export function chownSync(
export async function chown( export async function chown(
path: string | URL, path: string | URL,
uid: number | null, uid: number | null,
gid: number | null gid: number | null,
): Promise<void> { ): Promise<void> {
await sendAsync("op_chown", { path: pathFromURL(path), uid, gid }); await sendAsync("op_chown", { path: pathFromURL(path), uid, gid });
} }

View file

@ -5,7 +5,7 @@ import { pathFromURL } from "../../util.ts";
export function copyFileSync( export function copyFileSync(
fromPath: string | URL, fromPath: string | URL,
toPath: string | URL toPath: string | URL,
): void { ): void {
sendSync("op_copy_file", { sendSync("op_copy_file", {
from: pathFromURL(fromPath), from: pathFromURL(fromPath),
@ -15,7 +15,7 @@ export function copyFileSync(
export async function copyFile( export async function copyFile(
fromPath: string | URL, fromPath: string | URL,
toPath: string | URL toPath: string | URL,
): Promise<void> { ): Promise<void> {
await sendAsync("op_copy_file", { await sendAsync("op_copy_file", {
from: pathFromURL(fromPath), from: pathFromURL(fromPath),

View file

@ -32,7 +32,7 @@ export function mkdirSync(path: string, options?: MkdirOptions): void {
export async function mkdir( export async function mkdir(
path: string, path: string,
options?: MkdirOptions options?: MkdirOptions,
): Promise<void> { ): Promise<void> {
await sendAsync("op_mkdir", mkdirArgs(path, options)); await sendAsync("op_mkdir", mkdirArgs(path, options));
} }

View file

@ -24,7 +24,7 @@ export function openSync(path: string | URL, options: OpenOptions): number {
export function open( export function open(
path: string | URL, path: string | URL,
options: OpenOptions options: OpenOptions,
): Promise<number> { ): Promise<number> {
const mode: number | undefined = options?.mode; const mode: number | undefined = options?.mode;
return sendAsync("op_open", { path: pathFromURL(path), options, mode }); return sendAsync("op_open", { path: pathFromURL(path), options, mode });

View file

@ -9,7 +9,7 @@ export interface RemoveOptions {
export function removeSync( export function removeSync(
path: string | URL, path: string | URL,
options: RemoveOptions = {} options: RemoveOptions = {},
): void { ): void {
sendSync("op_remove", { sendSync("op_remove", {
path: pathFromURL(path), path: pathFromURL(path),
@ -19,7 +19,7 @@ export function removeSync(
export async function remove( export async function remove(
path: string | URL, path: string | URL,
options: RemoveOptions = {} options: RemoveOptions = {},
): Promise<void> { ): Promise<void> {
await sendAsync("op_remove", { await sendAsync("op_remove", {
path: pathFromURL(path), path: pathFromURL(path),

View file

@ -6,7 +6,7 @@ import type { SeekMode } from "../../io.ts";
export function seekSync( export function seekSync(
rid: number, rid: number,
offset: number, offset: number,
whence: SeekMode whence: SeekMode,
): number { ): number {
return sendSync("op_seek", { rid, offset, whence }); return sendSync("op_seek", { rid, offset, whence });
} }
@ -14,7 +14,7 @@ export function seekSync(
export function seek( export function seek(
rid: number, rid: number,
offset: number, offset: number,
whence: SeekMode whence: SeekMode,
): Promise<number> { ): Promise<number> {
return sendAsync("op_seek", { rid, offset, whence }); return sendAsync("op_seek", { rid, offset, whence });
} }

View file

@ -9,7 +9,7 @@ export interface SymlinkOptions {
export function symlinkSync( export function symlinkSync(
oldpath: string, oldpath: string,
newpath: string, newpath: string,
options?: SymlinkOptions options?: SymlinkOptions,
): void { ): void {
sendSync("op_symlink", { oldpath, newpath, options }); sendSync("op_symlink", { oldpath, newpath, options });
} }
@ -17,7 +17,7 @@ export function symlinkSync(
export async function symlink( export async function symlink(
oldpath: string, oldpath: string,
newpath: string, newpath: string,
options?: SymlinkOptions options?: SymlinkOptions,
): Promise<void> { ): Promise<void> {
await sendAsync("op_symlink", { oldpath, newpath, options }); await sendAsync("op_symlink", { oldpath, newpath, options });
} }

View file

@ -9,7 +9,7 @@ function toSecondsFromEpoch(v: number | Date): number {
export function utimeSync( export function utimeSync(
path: string, path: string,
atime: number | Date, atime: number | Date,
mtime: number | Date mtime: number | Date,
): void { ): void {
sendSync("op_utime", { sendSync("op_utime", {
path, path,
@ -22,7 +22,7 @@ export function utimeSync(
export async function utime( export async function utime(
path: string, path: string,
atime: number | Date, atime: number | Date,
mtime: number | Date mtime: number | Date,
): Promise<void> { ): Promise<void> {
await sendAsync("op_utime", { await sendAsync("op_utime", {
path, path,

View file

@ -38,7 +38,7 @@ class FsWatcher implements AsyncIterableIterator<FsEvent> {
export function watchFs( export function watchFs(
paths: string | string[], paths: string | string[],
options: FsWatcherOptions = { recursive: true } options: FsWatcherOptions = { recursive: true },
): AsyncIterableIterator<FsEvent> { ): AsyncIterableIterator<FsEvent> {
return new FsWatcher(Array.isArray(paths) ? paths : [paths], options); return new FsWatcher(Array.isArray(paths) ? paths : [paths], options);
} }

View file

@ -11,14 +11,14 @@ export function getRandomValues<
| Int16Array | Int16Array
| Uint16Array | Uint16Array
| Int32Array | Int32Array
| Uint32Array | Uint32Array,
>(typedArray: T): T { >(typedArray: T): T {
assert(typedArray !== null, "Input must not be null"); assert(typedArray !== null, "Input must not be null");
assert(typedArray.length <= 65536, "Input must not be longer than 65536"); assert(typedArray.length <= 65536, "Input must not be longer than 65536");
const ui8 = new Uint8Array( const ui8 = new Uint8Array(
typedArray.buffer, typedArray.buffer,
typedArray.byteOffset, typedArray.byteOffset,
typedArray.byteLength typedArray.byteLength,
); );
sendSync("op_get_random_values", {}, ui8); sendSync("op_get_random_values", {}, ui8);
return typedArray; return typedArray;

View file

@ -6,7 +6,7 @@ import { sendSync } from "./dispatch_json.ts";
export function domainToAscii( export function domainToAscii(
domain: string, domain: string,
{ beStrict = false }: { beStrict?: boolean } = {} { beStrict = false }: { beStrict?: boolean } = {},
): string { ): string {
return sendSync("op_domain_to_ascii", { domain, beStrict }); return sendSync("op_domain_to_ascii", { domain, beStrict });
} }

View file

@ -17,7 +17,7 @@ export function readSync(rid: number, buffer: Uint8Array): number | null {
export async function read( export async function read(
rid: number, rid: number,
buffer: Uint8Array buffer: Uint8Array,
): Promise<number | null> { ): Promise<number | null> {
if (buffer.length === 0) { if (buffer.length === 0) {
return 0; return 0;

View file

@ -36,7 +36,7 @@ interface AcceptResponse {
export function accept( export function accept(
rid: number, rid: number,
transport: string transport: string,
): Promise<AcceptResponse> { ): Promise<AcceptResponse> {
return sendAsync("op_accept", { rid, transport }); return sendAsync("op_accept", { rid, transport });
} }
@ -72,7 +72,7 @@ interface ReceiveResponse {
export function receive( export function receive(
rid: number, rid: number,
transport: string, transport: string,
zeroCopy: Uint8Array zeroCopy: Uint8Array,
): Promise<ReceiveResponse> { ): Promise<ReceiveResponse> {
return sendAsync("op_datagram_receive", { rid, transport }, zeroCopy); return sendAsync("op_datagram_receive", { rid, transport }, zeroCopy);
} }

View file

@ -31,7 +31,7 @@ export interface TranspileOnlyResult {
} }
export function transpile( export function transpile(
request: TranspileRequest request: TranspileRequest,
): Promise<Record<string, TranspileOnlyResult>> { ): Promise<Record<string, TranspileOnlyResult>> {
return sendAsync("op_transpile", request); return sendAsync("op_transpile", request);
} }

View file

@ -24,7 +24,7 @@ interface EstablishTLSResponse {
} }
export function connectTls( export function connectTls(
args: ConnectTLSRequest args: ConnectTLSRequest,
): Promise<EstablishTLSResponse> { ): Promise<EstablishTLSResponse> {
return sendAsync("op_connect_tls", args); return sendAsync("op_connect_tls", args);
} }

View file

@ -12,7 +12,7 @@ export function createWorker(
hasSourceCode: boolean, hasSourceCode: boolean,
sourceCode: string, sourceCode: string,
useDenoNamespace: boolean, useDenoNamespace: boolean,
name?: string name?: string,
): CreateWorkerResponse { ): CreateWorkerResponse {
return sendSync("op_create_worker", { return sendSync("op_create_worker", {
specifier, specifier,

View file

@ -33,14 +33,11 @@ async function runStatus(rid: number): Promise<ProcessStatus> {
export class Process<T extends RunOptions = RunOptions> { export class Process<T extends RunOptions = RunOptions> {
readonly rid: number; readonly rid: number;
readonly pid: number; readonly pid: number;
readonly stdin!: T["stdin"] extends "piped" readonly stdin!: T["stdin"] extends "piped" ? Writer & Closer
? Writer & Closer
: (Writer & Closer) | null; : (Writer & Closer) | null;
readonly stdout!: T["stdout"] extends "piped" readonly stdout!: T["stdout"] extends "piped" ? Reader & Closer
? Reader & Closer
: (Reader & Closer) | null; : (Reader & Closer) | null;
readonly stderr!: T["stderr"] extends "piped" readonly stderr!: T["stderr"] extends "piped" ? Reader & Closer
? Reader & Closer
: (Reader & Closer) | null; : (Reader & Closer) | null;
// @internal // @internal

View file

@ -56,8 +56,7 @@ function evaluate(code: string): boolean {
if (!errInfo) { if (!errInfo) {
// when a function is eval'ed with just "use strict" sometimes the result // when a function is eval'ed with just "use strict" sometimes the result
// is "use strict" which should be discarded // is "use strict" which should be discarded
lastEvalResult = lastEvalResult = typeof result === "string" && result === "use strict"
typeof result === "string" && result === "use strict"
? undefined ? undefined
: result; : result;
if (!isCloseCalled()) { if (!isCloseCalled()) {

View file

@ -48,7 +48,7 @@ function windowClose(): void {
// This should be fine, since only Window/MainWorker has .close() // This should be fine, since only Window/MainWorker has .close()
exit(0); exit(0);
}, },
0 0,
) )
); );
} }

View file

@ -93,7 +93,7 @@ export async function workerMessageRecvCallback(data: string): Promise<void> {
e.fileName, e.fileName,
e.lineNumber, e.lineNumber,
e.columnNumber, e.columnNumber,
e e,
); );
handled = ret === true; handled = ret === true;
} }
@ -122,7 +122,7 @@ export const workerRuntimeGlobalProperties = {
export function bootstrapWorkerRuntime( export function bootstrapWorkerRuntime(
name: string, name: string,
useDenoNamespace: boolean, useDenoNamespace: boolean,
internalName?: string internalName?: string,
): void { ): void {
if (hasBootstrapped) { if (hasBootstrapped) {
throw new Error("Worker runtime already bootstrapped"); throw new Error("Worker runtime already bootstrapped");
@ -139,7 +139,7 @@ export function bootstrapWorkerRuntime(
Object.defineProperties(globalThis, { name: readOnly(name) }); Object.defineProperties(globalThis, { name: readOnly(name) });
setEventTargetData(globalThis); setEventTargetData(globalThis);
const { unstableFlag, pid, noColor, args } = runtime.start( const { unstableFlag, pid, noColor, args } = runtime.start(
internalName ?? name internalName ?? name,
); );
if (unstableFlag) { if (unstableFlag) {

View file

@ -150,7 +150,7 @@ export class SignalStream
then<T, S>( then<T, S>(
f: (v: void) => T | Promise<T>, f: (v: void) => T | Promise<T>,
g?: (v: Error) => S | Promise<S> g?: (v: Error) => S | Promise<S>,
): Promise<T | S> { ): Promise<T | S> {
return this.#pollingPromise.then(() => {}).then(f, g); return this.#pollingPromise.then(() => {}).then(f, g);
} }

View file

@ -52,7 +52,7 @@ After:
- completed: ${post.opsCompletedAsync} - completed: ${post.opsCompletedAsync}
Make sure to await all promises returned from Deno APIs before Make sure to await all promises returned from Deno APIs before
finishing test case.` finishing test case.`,
); );
}; };
} }
@ -61,7 +61,7 @@ finishing test case.`
// the test case does not "leak" resources - ie. resource table after // the test case does not "leak" resources - ie. resource table after
// the test has exactly the same contents as before the test. // the test has exactly the same contents as before the test.
function assertResources( function assertResources(
fn: () => void | Promise<void> fn: () => void | Promise<void>,
): () => void | Promise<void> { ): () => void | Promise<void> {
return async function resourceSanitizer(): Promise<void> { return async function resourceSanitizer(): Promise<void> {
const pre = resources(); const pre = resources();
@ -97,7 +97,7 @@ export function test(name: string, fn: () => void | Promise<void>): void;
// creates a new object with "name" and "fn" fields. // creates a new object with "name" and "fn" fields.
export function test( export function test(
t: string | TestDefinition, t: string | TestDefinition,
fn?: () => void | Promise<void> fn?: () => void | Promise<void>,
): void { ): void {
let testDef: TestDefinition; let testDef: TestDefinition;
const defaults = { const defaults = {
@ -220,7 +220,7 @@ function reportToConsole(message: TestMessage): void {
`${message.end.passed} passed; ${message.end.failed} failed; ` + `${message.end.passed} passed; ${message.end.failed} failed; ` +
`${message.end.ignored} ignored; ${message.end.measured} measured; ` + `${message.end.ignored} ignored; ${message.end.measured} measured; ` +
`${message.end.filtered} filtered out ` + `${message.end.filtered} filtered out ` +
`${formatDuration(message.end.duration)}\n` `${formatDuration(message.end.duration)}\n`,
); );
if (message.end.usedOnly && message.end.failed == 0) { if (message.end.usedOnly && message.end.failed == 0) {
@ -247,7 +247,7 @@ class TestRunner {
constructor( constructor(
tests: TestDefinition[], tests: TestDefinition[],
public filterFn: (def: TestDefinition) => boolean, public filterFn: (def: TestDefinition) => boolean,
public failFast: boolean public failFast: boolean,
) { ) {
const onlyTests = tests.filter(({ only }) => only); const onlyTests = tests.filter(({ only }) => only);
this.#usedOnly = onlyTests.length > 0; this.#usedOnly = onlyTests.length > 0;
@ -300,7 +300,7 @@ class TestRunner {
function createFilterFn( function createFilterFn(
filter: undefined | string | RegExp, filter: undefined | string | RegExp,
skip: undefined | string | RegExp skip: undefined | string | RegExp,
): (def: TestDefinition) => boolean { ): (def: TestDefinition) => boolean {
return (def: TestDefinition): boolean => { return (def: TestDefinition): boolean => {
let passes = true; let passes = true;

View file

@ -66,7 +66,7 @@ interface StartTlsOptions {
export async function startTls( export async function startTls(
conn: Conn, conn: Conn,
{ hostname = "127.0.0.1", certFile }: StartTlsOptions = {} { hostname = "127.0.0.1", certFile }: StartTlsOptions = {},
): Promise<Conn> { ): Promise<Conn> {
const res = await tlsOps.startTls({ const res = await tlsOps.startTls({
rid: conn.rid, rid: conn.rid,

View file

@ -73,7 +73,7 @@ export function immutableDefine(
o: any, o: any,
p: string | number | symbol, p: string | number | symbol,
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
value: any value: any,
): void { ): void {
Object.defineProperty(o, p, { Object.defineProperty(o, p, {
value, value,

View file

@ -15,7 +15,7 @@ export const version: Version = {
export function setVersions( export function setVersions(
denoVersion: string, denoVersion: string,
v8Version: string, v8Version: string,
tsVersion: string tsVersion: string,
): void { ): void {
version.deno = denoVersion; version.deno = denoVersion;
version.v8 = v8Version; version.v8 = v8Version;

View file

@ -45,7 +45,7 @@ export function byteLength(b64: string): number {
function _byteLength( function _byteLength(
b64: string, b64: string,
validLen: number, validLen: number,
placeHoldersLen: number placeHoldersLen: number,
): number { ): number {
return ((validLen + placeHoldersLen) * 3) / 4 - placeHoldersLen; return ((validLen + placeHoldersLen) * 3) / 4 - placeHoldersLen;
} }
@ -65,8 +65,7 @@ export function toByteArray(b64: string): Uint8Array {
let i; let i;
for (i = 0; i < len; i += 4) { for (i = 0; i < len; i += 4) {
tmp = tmp = (revLookup[b64.charCodeAt(i)] << 18) |
(revLookup[b64.charCodeAt(i)] << 18) |
(revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 1)] << 12) |
(revLookup[b64.charCodeAt(i + 2)] << 6) | (revLookup[b64.charCodeAt(i + 2)] << 6) |
revLookup[b64.charCodeAt(i + 3)]; revLookup[b64.charCodeAt(i + 3)];
@ -76,15 +75,13 @@ export function toByteArray(b64: string): Uint8Array {
} }
if (placeHoldersLen === 2) { if (placeHoldersLen === 2) {
tmp = tmp = (revLookup[b64.charCodeAt(i)] << 2) |
(revLookup[b64.charCodeAt(i)] << 2) |
(revLookup[b64.charCodeAt(i + 1)] >> 4); (revLookup[b64.charCodeAt(i + 1)] >> 4);
arr[curByte++] = tmp & 0xff; arr[curByte++] = tmp & 0xff;
} }
if (placeHoldersLen === 1) { if (placeHoldersLen === 1) {
tmp = tmp = (revLookup[b64.charCodeAt(i)] << 10) |
(revLookup[b64.charCodeAt(i)] << 10) |
(revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 1)] << 4) |
(revLookup[b64.charCodeAt(i + 2)] >> 2); (revLookup[b64.charCodeAt(i + 2)] >> 2);
arr[curByte++] = (tmp >> 8) & 0xff; arr[curByte++] = (tmp >> 8) & 0xff;
@ -107,8 +104,7 @@ function encodeChunk(uint8: Uint8Array, start: number, end: number): string {
let tmp; let tmp;
const output = []; const output = [];
for (let i = start; i < end; i += 3) { for (let i = start; i < end; i += 3) {
tmp = tmp = ((uint8[i] << 16) & 0xff0000) +
((uint8[i] << 16) & 0xff0000) +
((uint8[i + 1] << 8) & 0xff00) + ((uint8[i + 1] << 8) & 0xff00) +
(uint8[i + 2] & 0xff); (uint8[i + 2] & 0xff);
output.push(tripletToBase64(tmp)); output.push(tripletToBase64(tmp));
@ -129,8 +125,8 @@ export function fromByteArray(uint8: Uint8Array): string {
encodeChunk( encodeChunk(
uint8, uint8,
i, i,
i + maxChunkLength > len2 ? len2 : i + maxChunkLength i + maxChunkLength > len2 ? len2 : i + maxChunkLength,
) ),
); );
} }
@ -144,7 +140,7 @@ export function fromByteArray(uint8: Uint8Array): string {
lookup[tmp >> 10] + lookup[tmp >> 10] +
lookup[(tmp >> 4) & 0x3f] + lookup[(tmp >> 4) & 0x3f] +
lookup[(tmp << 2) & 0x3f] + lookup[(tmp << 2) & 0x3f] +
"=" "=",
); );
} }

View file

@ -51,7 +51,7 @@ function convertLineEndingsToNative(s: string): string {
function collectSequenceNotCRLF( function collectSequenceNotCRLF(
s: string, s: string,
position: number position: number,
): { collected: string; newPosition: number } { ): { collected: string; newPosition: number } {
const start = position; const start = position;
for ( for (
@ -64,7 +64,7 @@ function collectSequenceNotCRLF(
function toUint8Arrays( function toUint8Arrays(
blobParts: BlobPart[], blobParts: BlobPart[],
doNormalizeLineEndingsToNative: boolean doNormalizeLineEndingsToNative: boolean,
): Uint8Array[] { ): Uint8Array[] {
const ret: Uint8Array[] = []; const ret: Uint8Array[] = [];
const enc = new TextEncoder(); const enc = new TextEncoder();
@ -103,7 +103,7 @@ function toUint8Arrays(
function processBlobParts( function processBlobParts(
blobParts: BlobPart[], blobParts: BlobPart[],
options: BlobPropertyBag options: BlobPropertyBag,
): Uint8Array { ): Uint8Array {
const normalizeLineEndingsToNative = options.ending === "native"; const normalizeLineEndingsToNative = options.ending === "native";
// ArrayBuffer.transfer is not yet implemented in V8, so we just have to // ArrayBuffer.transfer is not yet implemented in V8, so we just have to
@ -136,7 +136,7 @@ function getStream(blobBytes: Uint8Array): ReadableStream<ArrayBufferView> {
} }
async function readBytes( async function readBytes(
reader: ReadableStreamReader<ArrayBufferView> reader: ReadableStreamReader<ArrayBufferView>,
): Promise<ArrayBuffer> { ): Promise<ArrayBuffer> {
const chunks: Uint8Array[] = []; const chunks: Uint8Array[] = [];
while (true) { while (true) {

View file

@ -40,13 +40,13 @@ function validateBodyType(owner: Body, bodySource: BodyInit | null): boolean {
return true; // null body is fine return true; // null body is fine
} }
throw new Error( throw new Error(
`Bad ${owner.constructor.name} body type: ${bodySource.constructor.name}` `Bad ${owner.constructor.name} body type: ${bodySource.constructor.name}`,
); );
} }
async function bufferFromStream( async function bufferFromStream(
stream: ReadableStreamReader, stream: ReadableStreamReader,
size?: number size?: number,
): Promise<ArrayBuffer> { ): Promise<ArrayBuffer> {
const encoder = new TextEncoder(); const encoder = new TextEncoder();
const buffer = new Buffer(); const buffer = new Buffer();
@ -154,7 +154,7 @@ export class Body implements domTypes.Body {
const value = split.join("=").replace(/\+/g, " "); const value = split.join("=").replace(/\+/g, " ");
formData.append( formData.append(
decodeURIComponent(name), decodeURIComponent(name),
decodeURIComponent(value) decodeURIComponent(value),
); );
} }
}); });
@ -191,7 +191,7 @@ export class Body implements domTypes.Body {
} else if (typeof this._bodySource === "string") { } else if (typeof this._bodySource === "string") {
const enc = new TextEncoder(); const enc = new TextEncoder();
return Promise.resolve( return Promise.resolve(
enc.encode(this._bodySource).buffer as ArrayBuffer enc.encode(this._bodySource).buffer as ArrayBuffer,
); );
} else if (this._bodySource instanceof ReadableStreamImpl) { } else if (this._bodySource instanceof ReadableStreamImpl) {
return bufferFromStream(this._bodySource.getReader(), this.#size); return bufferFromStream(this._bodySource.getReader(), this.#size);
@ -201,13 +201,13 @@ export class Body implements domTypes.Body {
) { ) {
const enc = new TextEncoder(); const enc = new TextEncoder();
return Promise.resolve( return Promise.resolve(
enc.encode(this._bodySource.toString()).buffer as ArrayBuffer enc.encode(this._bodySource.toString()).buffer as ArrayBuffer,
); );
} else if (!this._bodySource) { } else if (!this._bodySource) {
return Promise.resolve(new ArrayBuffer(0)); return Promise.resolve(new ArrayBuffer(0));
} }
throw new Error( throw new Error(
`Body type not yet implemented: ${this._bodySource.constructor.name}` `Body type not yet implemented: ${this._bodySource.constructor.name}`,
); );
} }
} }

View file

@ -94,7 +94,7 @@ interface InspectIterableOptions<T> {
ctx: ConsoleContext, ctx: ConsoleContext,
level: number, level: number,
inspectOptions: Required<InspectOptions>, inspectOptions: Required<InspectOptions>,
next: () => IteratorResult<[unknown, T], unknown> next: () => IteratorResult<[unknown, T], unknown>,
) => string; ) => string;
group: boolean; group: boolean;
sort: boolean; sort: boolean;
@ -107,7 +107,7 @@ function inspectIterable<T>(
ctx: ConsoleContext, ctx: ConsoleContext,
level: number, level: number,
options: InspectIterableOptions<T>, options: InspectIterableOptions<T>,
inspectOptions: Required<InspectOptions> inspectOptions: Required<InspectOptions>,
): string { ): string {
if (level >= inspectOptions.depth) { if (level >= inspectOptions.depth) {
return cyan(`[${options.typeName}]`); return cyan(`[${options.typeName}]`);
@ -129,8 +129,8 @@ function inspectIterable<T>(
ctx, ctx,
level + 1, level + 1,
inspectOptions, inspectOptions,
next.bind(iter) next.bind(iter),
) ),
); );
} }
entriesLength++; entriesLength++;
@ -150,25 +150,25 @@ function inspectIterable<T>(
const initIndentation = `\n${DEFAULT_INDENT.repeat(level + 1)}`; const initIndentation = `\n${DEFAULT_INDENT.repeat(level + 1)}`;
const entryIndentation = `,\n${DEFAULT_INDENT.repeat(level + 1)}`; const entryIndentation = `,\n${DEFAULT_INDENT.repeat(level + 1)}`;
const closingIndentation = `${ const closingIndentation = `${inspectOptions.trailingComma ? "," : ""}\n${
inspectOptions.trailingComma ? "," : "" DEFAULT_INDENT.repeat(level)
}\n${DEFAULT_INDENT.repeat(level)}`; }`;
let iContent: string; let iContent: string;
if (options.group && entries.length > MIN_GROUP_LENGTH) { if (options.group && entries.length > MIN_GROUP_LENGTH) {
const groups = groupEntries(entries, level, value); const groups = groupEntries(entries, level, value);
iContent = `${initIndentation}${groups.join( iContent = `${initIndentation}${
entryIndentation groups.join(entryIndentation)
)}${closingIndentation}`; }${closingIndentation}`;
} else { } else {
iContent = entries.length === 0 ? "" : ` ${entries.join(", ")} `; iContent = entries.length === 0 ? "" : ` ${entries.join(", ")} `;
if ( if (
stripColor(iContent).length > LINE_BREAKING_LENGTH || stripColor(iContent).length > LINE_BREAKING_LENGTH ||
!inspectOptions.compact !inspectOptions.compact
) { ) {
iContent = `${initIndentation}${entries.join( iContent = `${initIndentation}${
entryIndentation entries.join(entryIndentation)
)}${closingIndentation}`; }${closingIndentation}`;
} }
} }
@ -181,7 +181,7 @@ function groupEntries<T>(
entries: string[], entries: string[],
level: number, level: number,
value: Iterable<T>, value: Iterable<T>,
iterableLimit = 100 iterableLimit = 100,
): string[] { ): string[] {
let totalLength = 0; let totalLength = 0;
let maxLength = 0; let maxLength = 0;
@ -225,12 +225,12 @@ function groupEntries<T>(
// Divide that by `actualMax` to receive the correct number of columns. // Divide that by `actualMax` to receive the correct number of columns.
// The added bias increases the columns for short entries. // The added bias increases the columns for short entries.
Math.round( Math.round(
Math.sqrt(approxCharHeights * biasedMax * entriesLength) / biasedMax Math.sqrt(approxCharHeights * biasedMax * entriesLength) / biasedMax,
), ),
// Do not exceed the breakLength. // Do not exceed the breakLength.
Math.floor((LINE_BREAKING_LENGTH - (level + 1)) / actualMax), Math.floor((LINE_BREAKING_LENGTH - (level + 1)) / actualMax),
// Limit the columns to a maximum of fifteen. // Limit the columns to a maximum of fifteen.
15 15,
); );
// Return with the original output if no grouping should happen. // Return with the original output if no grouping should happen.
if (columns <= 1) { if (columns <= 1) {
@ -272,8 +272,7 @@ function groupEntries<T>(
str += `${entries[j]}, `[order](padding, " "); str += `${entries[j]}, `[order](padding, " ");
} }
if (order === "padStart") { if (order === "padStart") {
const padding = const padding = maxLineLength[j - i] +
maxLineLength[j - i] +
entries[j].length - entries[j].length -
dataLen[j] - dataLen[j] -
separatorSpace; separatorSpace;
@ -295,7 +294,7 @@ function inspectValue(
value: unknown, value: unknown,
ctx: ConsoleContext, ctx: ConsoleContext,
level: number, level: number,
inspectOptions: Required<InspectOptions> inspectOptions: Required<InspectOptions>,
): string { ): string {
switch (typeof value) { switch (typeof value) {
case "string": case "string":
@ -353,12 +352,11 @@ function inspectValueWithQuotes(
value: unknown, value: unknown,
ctx: ConsoleContext, ctx: ConsoleContext,
level: number, level: number,
inspectOptions: Required<InspectOptions> inspectOptions: Required<InspectOptions>,
): string { ): string {
switch (typeof value) { switch (typeof value) {
case "string": case "string":
const trunc = const trunc = value.length > STR_ABBREVIATE_SIZE
value.length > STR_ABBREVIATE_SIZE
? value.slice(0, STR_ABBREVIATE_SIZE) + "..." ? value.slice(0, STR_ABBREVIATE_SIZE) + "..."
: value; : value;
return green(quoteString(trunc)); // Quoted strings are green return green(quoteString(trunc)); // Quoted strings are green
@ -371,7 +369,7 @@ function inspectArray(
value: unknown[], value: unknown[],
ctx: ConsoleContext, ctx: ConsoleContext,
level: number, level: number,
inspectOptions: Required<InspectOptions> inspectOptions: Required<InspectOptions>,
): string { ): string {
const options: InspectIterableOptions<unknown> = { const options: InspectIterableOptions<unknown> = {
typeName: "Array", typeName: "Array",
@ -404,7 +402,7 @@ function inspectTypedArray(
value: TypedArray, value: TypedArray,
ctx: ConsoleContext, ctx: ConsoleContext,
level: number, level: number,
inspectOptions: Required<InspectOptions> inspectOptions: Required<InspectOptions>,
): string { ): string {
const valueLength = value.length; const valueLength = value.length;
const options: InspectIterableOptions<unknown> = { const options: InspectIterableOptions<unknown> = {
@ -425,7 +423,7 @@ function inspectSet(
value: Set<unknown>, value: Set<unknown>,
ctx: ConsoleContext, ctx: ConsoleContext,
level: number, level: number,
inspectOptions: Required<InspectOptions> inspectOptions: Required<InspectOptions>,
): string { ): string {
const options: InspectIterableOptions<unknown> = { const options: InspectIterableOptions<unknown> = {
typeName: "Set", typeName: "Set",
@ -445,7 +443,7 @@ function inspectMap(
value: Map<unknown, unknown>, value: Map<unknown, unknown>,
ctx: ConsoleContext, ctx: ConsoleContext,
level: number, level: number,
inspectOptions: Required<InspectOptions> inspectOptions: Required<InspectOptions>,
): string { ): string {
const options: InspectIterableOptions<[unknown]> = { const options: InspectIterableOptions<[unknown]> = {
typeName: "Map", typeName: "Map",
@ -453,12 +451,14 @@ function inspectMap(
delims: ["{", "}"], delims: ["{", "}"],
entryHandler: (entry, ctx, level, inspectOptions): string => { entryHandler: (entry, ctx, level, inspectOptions): string => {
const [key, val] = entry; const [key, val] = entry;
return `${inspectValueWithQuotes( return `${
inspectValueWithQuotes(
key, key,
ctx, ctx,
level + 1, level + 1,
inspectOptions inspectOptions,
)} => ${inspectValueWithQuotes(val, ctx, level + 1, inspectOptions)}`; )
} => ${inspectValueWithQuotes(val, ctx, level + 1, inspectOptions)}`;
}, },
group: false, group: false,
sort: inspectOptions.sorted, sort: inspectOptions.sorted,
@ -469,7 +469,7 @@ function inspectMap(
ctx, ctx,
level, level,
options, options,
inspectOptions inspectOptions,
); );
} }
@ -510,7 +510,7 @@ function inspectPromise(
value: Promise<unknown>, value: Promise<unknown>,
ctx: ConsoleContext, ctx: ConsoleContext,
level: number, level: number,
inspectOptions: Required<InspectOptions> inspectOptions: Required<InspectOptions>,
): string { ): string {
const [state, result] = Deno.core.getPromiseDetails(value); const [state, result] = Deno.core.getPromiseDetails(value);
@ -518,15 +518,18 @@ function inspectPromise(
return `Promise { ${cyan("<pending>")} }`; return `Promise { ${cyan("<pending>")} }`;
} }
const prefix = const prefix = state === PromiseState.Fulfilled
state === PromiseState.Fulfilled ? "" : `${red("<rejected>")} `; ? ""
: `${red("<rejected>")} `;
const str = `${prefix}${inspectValueWithQuotes( const str = `${prefix}${
inspectValueWithQuotes(
result, result,
ctx, ctx,
level + 1, level + 1,
inspectOptions inspectOptions,
)}`; )
}`;
if (str.length + PROMISE_STRING_BASE_LENGTH > LINE_BREAKING_LENGTH) { if (str.length + PROMISE_STRING_BASE_LENGTH > LINE_BREAKING_LENGTH) {
return `Promise {\n${DEFAULT_INDENT.repeat(level + 1)}${str}\n}`; return `Promise {\n${DEFAULT_INDENT.repeat(level + 1)}${str}\n}`;
@ -541,7 +544,7 @@ function inspectRawObject(
value: Record<string, unknown>, value: Record<string, unknown>,
ctx: ConsoleContext, ctx: ConsoleContext,
level: number, level: number,
inspectOptions: Required<InspectOptions> inspectOptions: Required<InspectOptions>,
): string { ): string {
if (level >= inspectOptions.depth) { if (level >= inspectOptions.depth) {
return cyan("[Object]"); // wrappers are in cyan return cyan("[Object]"); // wrappers are in cyan
@ -573,28 +576,32 @@ function inspectRawObject(
for (const key of stringKeys) { for (const key of stringKeys) {
entries.push( entries.push(
`${key}: ${inspectValueWithQuotes( `${key}: ${
inspectValueWithQuotes(
value[key], value[key],
ctx, ctx,
level + 1, level + 1,
inspectOptions inspectOptions,
)}` )
}`,
); );
} }
for (const key of symbolKeys) { for (const key of symbolKeys) {
entries.push( entries.push(
`${key.toString()}: ${inspectValueWithQuotes( `${key.toString()}: ${
inspectValueWithQuotes(
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
value[key as any], value[key as any],
ctx, ctx,
level + 1, level + 1,
inspectOptions inspectOptions,
)}` )
}`,
); );
} }
// Making sure color codes are ignored when calculating the total length // Making sure color codes are ignored when calculating the total length
const totalLength = const totalLength = entries.length + level +
entries.length + level + stripColor(entries.join("")).length; stripColor(entries.join("")).length;
ctx.delete(value); ctx.delete(value);
@ -621,7 +628,7 @@ function inspectObject(
value: {}, value: {},
consoleContext: ConsoleContext, consoleContext: ConsoleContext,
level: number, level: number,
inspectOptions: Required<InspectOptions> inspectOptions: Required<InspectOptions>,
): string { ): string {
if (customInspect in value && typeof value[customInspect] === "function") { if (customInspect in value && typeof value[customInspect] === "function") {
try { try {
@ -658,7 +665,7 @@ function inspectObject(
value, value,
consoleContext, consoleContext,
level, level,
inspectOptions inspectOptions,
); );
} else { } else {
// Otherwise, default object formatting // Otherwise, default object formatting
@ -668,7 +675,7 @@ function inspectObject(
export function inspectArgs( export function inspectArgs(
args: unknown[], args: unknown[],
inspectOptions: InspectOptions = {} inspectOptions: InspectOptions = {},
): string { ): string {
const rInspectOptions = { ...DEFAULT_INSPECT_OPTIONS, ...inspectOptions }; const rInspectOptions = { ...DEFAULT_INSPECT_OPTIONS, ...inspectOptions };
const first = args[0]; const first = args[0];
@ -717,7 +724,7 @@ export function inspectArgs(
args[++a], args[++a],
new Set<unknown>(), new Set<unknown>(),
0, 0,
rInspectOptions rInspectOptions,
); );
break; break;
case CHAR_PERCENT: case CHAR_PERCENT:
@ -808,7 +815,7 @@ export class Console {
inspectArgs(args, { inspectArgs(args, {
indentLevel: this.indentLevel, indentLevel: this.indentLevel,
}) + "\n", }) + "\n",
false false,
); );
}; };
@ -826,7 +833,7 @@ export class Console {
inspectArgs(args, { inspectArgs(args, {
indentLevel: this.indentLevel, indentLevel: this.indentLevel,
}) + "\n", }) + "\n",
true true,
); );
}; };
@ -879,7 +886,7 @@ export class Console {
if (properties !== undefined && !Array.isArray(properties)) { if (properties !== undefined && !Array.isArray(properties)) {
throw new Error( throw new Error(
"The 'properties' argument must be of type Array. " + "The 'properties' argument must be of type Array. " +
"Received type string" "Received type string",
); );
} }
@ -927,8 +934,7 @@ export class Console {
let hasPrimitives = false; let hasPrimitives = false;
Object.keys(resultData).forEach((k, idx): void => { Object.keys(resultData).forEach((k, idx): void => {
const value: unknown = resultData[k]!; const value: unknown = resultData[k]!;
const primitive = const primitive = value === null ||
value === null ||
(typeof value !== "function" && typeof value !== "object"); (typeof value !== "function" && typeof value !== "object");
if (properties === undefined && primitive) { if (properties === undefined && primitive) {
hasPrimitives = true; hasPrimitives = true;
@ -1047,7 +1053,7 @@ export const customInspect = Symbol("Deno.customInspect");
export function inspect( export function inspect(
value: unknown, value: unknown,
inspectOptions: InspectOptions = {} inspectOptions: InspectOptions = {},
): string { ): string {
if (typeof value === "string") { if (typeof value === "string") {
return value; return value;

View file

@ -94,7 +94,7 @@ export function cliTable(head: string[], columns: string[][]): string {
const columnWidths = head.map((h: string): number => getStringWidth(h)); const columnWidths = head.map((h: string): number => getStringWidth(h));
const longestColumn = columns.reduce( const longestColumn = columns.reduce(
(n: number, a: string[]): number => Math.max(n, a.length), (n: number, a: string[]): number => Math.max(n, a.length),
0 0,
); );
for (let i = 0; i < head.length; i++) { for (let i = 0; i < head.length; i++) {
@ -114,8 +114,7 @@ export function cliTable(head: string[], columns: string[][]): string {
tableChars.middleMiddle.repeat(i + 2) tableChars.middleMiddle.repeat(i + 2)
); );
let result = let result = `${tableChars.topLeft}${divider.join(tableChars.topMiddle)}` +
`${tableChars.topLeft}${divider.join(tableChars.topMiddle)}` +
`${tableChars.topRight}\n${renderRow(head, columnWidths)}\n` + `${tableChars.topRight}\n${renderRow(head, columnWidths)}\n` +
`${tableChars.leftMiddle}${divider.join(tableChars.rowMiddle)}` + `${tableChars.leftMiddle}${divider.join(tableChars.rowMiddle)}` +
`${tableChars.rightMiddle}\n`; `${tableChars.rightMiddle}\n`;
@ -124,8 +123,7 @@ export function cliTable(head: string[], columns: string[][]): string {
result += `${renderRow(row, columnWidths)}\n`; result += `${renderRow(row, columnWidths)}\n`;
} }
result += result += `${tableChars.bottomLeft}${divider.join(tableChars.bottomMiddle)}` +
`${tableChars.bottomLeft}${divider.join(tableChars.bottomMiddle)}` +
tableChars.bottomRight; tableChars.bottomRight;
return result; return result;

View file

@ -31,7 +31,7 @@ declare global {
apply<T, R>( apply<T, R>(
this: (this: T, ...args: number[]) => R, this: (this: T, ...args: number[]) => R,
thisArg: T, thisArg: T,
args: Uint16Array args: Uint16Array,
): R; ): R;
} }
} }
@ -39,7 +39,7 @@ declare global {
export function decodeUtf8( export function decodeUtf8(
input: Uint8Array, input: Uint8Array,
fatal: boolean, fatal: boolean,
ignoreBOM: boolean ignoreBOM: boolean,
): string { ): string {
let outString = ""; let outString = "";
@ -61,10 +61,11 @@ export function decodeUtf8(
for (; i < input.length; ++i) { for (; i < input.length; ++i) {
// Encoding error handling // Encoding error handling
if (state === 12 || (state !== 0 && (input[i] & 0xc0) !== 0x80)) { if (state === 12 || (state !== 0 && (input[i] & 0xc0) !== 0x80)) {
if (fatal) if (fatal) {
throw new TypeError( throw new TypeError(
`Decoder error. Invalid byte in sequence at position ${i} in data.` `Decoder error. Invalid byte in sequence at position ${i} in data.`,
); );
}
outBuffer[outIndex++] = 0xfffd; // Replacement character outBuffer[outIndex++] = 0xfffd; // Replacement character
if (outIndex === outBufferLength) { if (outIndex === outBufferLength) {
outString += String.fromCharCode.apply(null, outBuffer); outString += String.fromCharCode.apply(null, outBuffer);
@ -73,7 +74,7 @@ export function decodeUtf8(
state = 0; state = 0;
} }
// prettier-ignore // deno-fmt-ignore
type = [ type = [
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@ -84,11 +85,10 @@ export function decodeUtf8(
8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8 10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8
][input[i]]; ][input[i]];
codepoint = codepoint = state !== 0
state !== 0
? (input[i] & 0x3f) | (codepoint << 6) ? (input[i] & 0x3f) | (codepoint << 6)
: (0xff >> type) & input[i]; : (0xff >> type) & input[i];
// prettier-ignore // deno-fmt-ignore
state = [ state = [
0,12,24,36,60,96,84,12,12,12,48,72, 12,12,12,12,12,12,12,12,12,12,12,12, 0,12,24,36,60,96,84,12,12,12,48,72, 12,12,12,12,12,12,12,12,12,12,12,12,
12, 0,12,12,12,12,12, 0,12, 0,12,12, 12,24,12,12,12,12,12,24,12,24,12,12, 12, 0,12,12,12,12,12, 0,12, 0,12,12, 12,24,12,12,12,12,12,24,12,24,12,12,

View file

@ -9,7 +9,7 @@ export class DomFileImpl extends blob.DenoBlob implements File {
constructor( constructor(
fileBits: BlobPart[], fileBits: BlobPart[],
fileName: string, fileName: string,
options?: FilePropertyBag options?: FilePropertyBag,
) { ) {
const { lastModified = Date.now(), ...blobPropertyBag } = options ?? {}; const { lastModified = Date.now(), ...blobPropertyBag } = options ?? {};
super(fileBits, blobPropertyBag); super(fileBits, blobPropertyBag);

View file

@ -14,13 +14,13 @@ export interface DomIterable<K, V> {
forEach( forEach(
callback: (value: V, key: K, parent: this) => void, callback: (value: V, key: K, parent: this) => void,
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
thisArg?: any thisArg?: any,
): void; ): void;
} }
export function DomIterableMixin<K, V, TBase extends Constructor>( export function DomIterableMixin<K, V, TBase extends Constructor>(
Base: TBase, Base: TBase,
dataSymbol: symbol dataSymbol: symbol,
): TBase & Constructor<DomIterable<K, V>> { ): TBase & Constructor<DomIterable<K, V>> {
// we have to cast `this` as `any` because there is no way to describe the // we have to cast `this` as `any` because there is no way to describe the
// Base class in a way where the Symbol `dataSymbol` is defined. So the // Base class in a way where the Symbol `dataSymbol` is defined. So the
@ -56,15 +56,15 @@ export function DomIterableMixin<K, V, TBase extends Constructor>(
forEach( forEach(
callbackfn: (value: V, key: K, parent: this) => void, callbackfn: (value: V, key: K, parent: this) => void,
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
thisArg?: any thisArg?: any,
): void { ): void {
requiredArguments( requiredArguments(
`${this.constructor.name}.forEach`, `${this.constructor.name}.forEach`,
arguments.length, arguments.length,
1 1,
); );
callbackfn = callbackfn.bind( callbackfn = callbackfn.bind(
thisArg == null ? globalThis : Object(thisArg) thisArg == null ? globalThis : Object(thisArg),
); );
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
for (const [key, value] of (this as any)[dataSymbol]) { for (const [key, value] of (this as any)[dataSymbol]) {

View file

@ -220,7 +220,7 @@ interface NodeList {
item(index: number): Node | null; item(index: number): Node | null;
forEach( forEach(
callbackfn: (value: Node, key: number, parent: NodeList) => void, callbackfn: (value: Node, key: number, parent: NodeList) => void,
thisArg?: any thisArg?: any,
): void; ): void;
[index: number]: Node; [index: number]: Node;
[Symbol.iterator](): IterableIterator<Node>; [Symbol.iterator](): IterableIterator<Node>;
@ -234,7 +234,7 @@ interface NodeListOf<TNode extends Node> extends NodeList {
item(index: number): TNode; item(index: number): TNode;
forEach( forEach(
callbackfn: (value: TNode, key: number, parent: NodeListOf<TNode>) => void, callbackfn: (value: TNode, key: number, parent: NodeListOf<TNode>) => void,
thisArg?: any thisArg?: any,
): void; ): void;
[index: number]: TNode; [index: number]: TNode;
[Symbol.iterator](): IterableIterator<TNode>; [Symbol.iterator](): IterableIterator<TNode>;

View file

@ -39,7 +39,7 @@ export class ErrorEventImpl extends Event implements ErrorEvent {
lineno = 0, lineno = 0,
colno = 0, colno = 0,
error = null, error = null,
}: ErrorEventInit = {} }: ErrorEventInit = {},
) { ) {
super(type, { super(type, {
bubbles: bubbles, bubbles: bubbles,

View file

@ -53,7 +53,7 @@ export function getStopImmediatePropagation(event: Event): boolean {
export function setCurrentTarget( export function setCurrentTarget(
event: Event, event: Event,
value: EventTarget | null value: EventTarget | null,
): void { ): void {
(event as EventImpl).currentTarget = value; (event as EventImpl).currentTarget = value;
} }
@ -85,7 +85,7 @@ export function setPath(event: Event, value: EventPath[]): void {
export function setRelatedTarget<T extends Event>( export function setRelatedTarget<T extends Event>(
event: T, event: T,
value: EventTarget | null value: EventTarget | null,
): void { ): void {
if ("relatedTarget" in event) { if ("relatedTarget" in event) {
(event as T & { (event as T & {
@ -100,7 +100,7 @@ export function setTarget(event: Event, value: EventTarget | null): void {
export function setStopImmediatePropagation( export function setStopImmediatePropagation(
event: Event, event: Event,
value: boolean value: boolean,
): void { ): void {
const data = eventData.get(event as Event); const data = eventData.get(event as Event);
if (data) { if (data) {
@ -111,7 +111,7 @@ export function setStopImmediatePropagation(
// Type guards that widen the event type // Type guards that widen the event type
export function hasRelatedTarget( export function hasRelatedTarget(
event: Event event: Event,
): event is domTypes.FocusEvent | domTypes.MouseEvent { ): event is domTypes.FocusEvent | domTypes.MouseEvent {
return "relatedTarget" in event; return "relatedTarget" in event;
} }

View file

@ -46,7 +46,7 @@ function getRoot(eventTarget: EventTarget): EventTarget | null {
} }
function isNode<T extends EventTarget>( function isNode<T extends EventTarget>(
eventTarget: T | null eventTarget: T | null,
): eventTarget is T & domTypes.Node { ): eventTarget is T & domTypes.Node {
return Boolean(eventTarget && "nodeType" in eventTarget); return Boolean(eventTarget && "nodeType" in eventTarget);
} }
@ -54,7 +54,7 @@ function isNode<T extends EventTarget>(
// https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-ancestor // https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-ancestor
function isShadowInclusiveAncestor( function isShadowInclusiveAncestor(
ancestor: EventTarget | null, ancestor: EventTarget | null,
node: EventTarget | null node: EventTarget | null,
): boolean { ): boolean {
while (isNode(node)) { while (isNode(node)) {
if (node === ancestor) { if (node === ancestor) {
@ -76,12 +76,12 @@ function isShadowRoot(nodeImpl: EventTarget | null): boolean {
nodeImpl && nodeImpl &&
isNode(nodeImpl) && isNode(nodeImpl) &&
nodeImpl.nodeType === DOCUMENT_FRAGMENT_NODE && nodeImpl.nodeType === DOCUMENT_FRAGMENT_NODE &&
getHost(nodeImpl) != null getHost(nodeImpl) != null,
); );
} }
function isSlotable<T extends EventTarget>( function isSlotable<T extends EventTarget>(
nodeImpl: T | null nodeImpl: T | null,
): nodeImpl is T & domTypes.Node & domTypes.Slotable { ): nodeImpl is T & domTypes.Node & domTypes.Slotable {
return Boolean(isNode(nodeImpl) && "assignedSlot" in nodeImpl); return Boolean(isNode(nodeImpl) && "assignedSlot" in nodeImpl);
} }
@ -98,7 +98,7 @@ function appendToEventPath(
targetOverride: EventTarget | null, targetOverride: EventTarget | null,
relatedTarget: EventTarget | null, relatedTarget: EventTarget | null,
touchTargets: EventTarget[], touchTargets: EventTarget[],
slotInClosedTree: boolean slotInClosedTree: boolean,
): void { ): void {
const itemInShadowTree = isNode(target) && isShadowRoot(getRoot(target)); const itemInShadowTree = isNode(target) && isShadowRoot(getRoot(target));
const rootOfClosedTree = isShadowRoot(target) && getMode(target) === "closed"; const rootOfClosedTree = isShadowRoot(target) && getMode(target) === "closed";
@ -117,7 +117,7 @@ function appendToEventPath(
function dispatch( function dispatch(
targetImpl: EventTarget, targetImpl: EventTarget,
eventImpl: Event, eventImpl: Event,
targetOverride?: EventTarget targetOverride?: EventTarget,
): boolean { ): boolean {
let clearTargets = false; let clearTargets = false;
let activationTarget: EventTarget | null = null; let activationTarget: EventTarget | null = null;
@ -139,7 +139,7 @@ function dispatch(
targetOverride, targetOverride,
relatedTarget, relatedTarget,
touchTargets, touchTargets,
false false,
); );
const isActivationEvent = eventImpl.type === "click"; const isActivationEvent = eventImpl.type === "click";
@ -149,8 +149,9 @@ function dispatch(
} }
let slotInClosedTree = false; let slotInClosedTree = false;
let slotable = let slotable = isSlotable(targetImpl) && getAssignedSlot(targetImpl)
isSlotable(targetImpl) && getAssignedSlot(targetImpl) ? targetImpl : null; ? targetImpl
: null;
let parent = getParent(targetImpl); let parent = getParent(targetImpl);
// Populate event path // Populate event path
@ -181,7 +182,7 @@ function dispatch(
null, null,
relatedTarget, relatedTarget,
touchTargets, touchTargets,
slotInClosedTree slotInClosedTree,
); );
} else if (parent === relatedTarget) { } else if (parent === relatedTarget) {
parent = null; parent = null;
@ -202,7 +203,7 @@ function dispatch(
targetImpl, targetImpl,
relatedTarget, relatedTarget,
touchTargets, touchTargets,
slotInClosedTree slotInClosedTree,
); );
} }
@ -226,8 +227,7 @@ function dispatch(
} }
const clearTargetsTuple = path[clearTargetsTupleIndex]; const clearTargetsTuple = path[clearTargetsTupleIndex];
clearTargets = clearTargets = (isNode(clearTargetsTuple.target) &&
(isNode(clearTargetsTuple.target) &&
isShadowRoot(getRoot(clearTargetsTuple.target))) || isShadowRoot(getRoot(clearTargetsTuple.target))) ||
(isNode(clearTargetsTuple.relatedTarget) && (isNode(clearTargetsTuple.relatedTarget) &&
isShadowRoot(getRoot(clearTargetsTuple.relatedTarget))); isShadowRoot(getRoot(clearTargetsTuple.relatedTarget)));
@ -288,7 +288,7 @@ function dispatch(
* Ref: https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke */ * Ref: https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke */
function innerInvokeEventListeners( function innerInvokeEventListeners(
eventImpl: Event, eventImpl: Event,
targetListeners: Record<string, Listener[]> targetListeners: Record<string, Listener[]>,
): boolean { ): boolean {
let found = false; let found = false;
@ -381,7 +381,7 @@ function invokeEventListeners(tuple: EventPath, eventImpl: Event): void {
} }
function normalizeAddEventHandlerOptions( function normalizeAddEventHandlerOptions(
options: boolean | AddEventListenerOptions | undefined options: boolean | AddEventListenerOptions | undefined,
): AddEventListenerOptions { ): AddEventListenerOptions {
if (typeof options === "boolean" || typeof options === "undefined") { if (typeof options === "boolean" || typeof options === "undefined") {
return { return {
@ -395,7 +395,7 @@ function normalizeAddEventHandlerOptions(
} }
function normalizeEventHandlerOptions( function normalizeEventHandlerOptions(
options: boolean | EventListenerOptions | undefined options: boolean | EventListenerOptions | undefined,
): EventListenerOptions { ): EventListenerOptions {
if (typeof options === "boolean" || typeof options === "undefined") { if (typeof options === "boolean" || typeof options === "undefined") {
return { return {
@ -456,7 +456,7 @@ function getAssignedSlot(target: EventTarget): boolean {
function getHasActivationBehavior(target: EventTarget): boolean { function getHasActivationBehavior(target: EventTarget): boolean {
return Boolean( return Boolean(
eventTargetData.get(target as EventTarget)?.hasActivationBehavior eventTargetData.get(target as EventTarget)?.hasActivationBehavior,
); );
} }
@ -490,7 +490,7 @@ export class EventTargetImpl implements EventTarget {
public addEventListener( public addEventListener(
type: string, type: string,
callback: EventListenerOrEventListenerObject | null, callback: EventListenerOrEventListenerObject | null,
options?: AddEventListenerOptions | boolean options?: AddEventListenerOptions | boolean,
): void { ): void {
requiredArguments("EventTarget.addEventListener", arguments.length, 2); requiredArguments("EventTarget.addEventListener", arguments.length, 2);
if (callback === null) { if (callback === null) {
@ -522,14 +522,14 @@ export class EventTargetImpl implements EventTarget {
public removeEventListener( public removeEventListener(
type: string, type: string,
callback: EventListenerOrEventListenerObject | null, callback: EventListenerOrEventListenerObject | null,
options?: EventListenerOptions | boolean options?: EventListenerOptions | boolean,
): void { ): void {
requiredArguments("EventTarget.removeEventListener", arguments.length, 2); requiredArguments("EventTarget.removeEventListener", arguments.length, 2);
const listeners = eventTargetData.get(this ?? globalThis)!.listeners; const listeners = eventTargetData.get(this ?? globalThis)!.listeners;
if (callback !== null && type in listeners) { if (callback !== null && type in listeners) {
listeners[type] = listeners[type].filter( listeners[type] = listeners[type].filter(
(listener) => listener.callback !== callback (listener) => listener.callback !== callback,
); );
} else if (callback === null || !listeners[type]) { } else if (callback === null || !listeners[type]) {
return; return;

View file

@ -38,14 +38,13 @@ export class Response extends Body.Body implements domTypes.Response {
let status = init.status === undefined ? 200 : Number(init.status || 0); let status = init.status === undefined ? 200 : Number(init.status || 0);
let statusText = init.statusText ?? ""; let statusText = init.statusText ?? "";
let headers = let headers = init.headers instanceof Headers
init.headers instanceof Headers
? init.headers ? init.headers
: new Headers(init.headers); : new Headers(init.headers);
if (init.status !== undefined && (status < 200 || status > 599)) { if (init.status !== undefined && (status < 200 || status > 599)) {
throw new RangeError( throw new RangeError(
`The status provided (${init.status}) is outside the range [200, 599]` `The status provided (${init.status}) is outside the range [200, 599]`,
); );
} }
@ -156,7 +155,7 @@ export class Response extends Body.Body implements domTypes.Response {
static redirect(url: URL | string, status: number): domTypes.Response { static redirect(url: URL | string, status: number): domTypes.Response {
if (![301, 302, 303, 307, 308].includes(status)) { if (![301, 302, 303, 307, 308].includes(status)) {
throw new RangeError( throw new RangeError(
"The redirection status must be one of 301, 302, 303, 307 and 308." "The redirection status must be one of 301, 302, 303, 307 and 308.",
); );
} }
return new Response(null, { return new Response(null, {
@ -171,7 +170,7 @@ function sendFetchReq(
url: string, url: string,
method: string | null, method: string | null,
headers: Headers | null, headers: Headers | null,
body: ArrayBufferView | undefined body: ArrayBufferView | undefined,
): Promise<FetchResponse> { ): Promise<FetchResponse> {
let headerArray: Array<[string, string]> = []; let headerArray: Array<[string, string]> = [];
if (headers) { if (headers) {
@ -189,7 +188,7 @@ function sendFetchReq(
export async function fetch( export async function fetch(
input: (domTypes.Request & { _bodySource?: unknown }) | URL | string, input: (domTypes.Request & { _bodySource?: unknown }) | URL | string,
init?: domTypes.RequestInit init?: domTypes.RequestInit,
): Promise<Response> { ): Promise<Response> {
let url: string; let url: string;
let method: string | null = null; let method: string | null = null;
@ -203,8 +202,7 @@ export async function fetch(
if (init != null) { if (init != null) {
method = init.method || null; method = init.method || null;
if (init.headers) { if (init.headers) {
headers = headers = init.headers instanceof Headers
init.headers instanceof Headers
? init.headers ? init.headers
: new Headers(init.headers); : new Headers(init.headers);
} else { } else {

View file

@ -64,7 +64,7 @@ export class MultipartBuilder {
#writeFileHeaders = ( #writeFileHeaders = (
field: string, field: string,
filename: string, filename: string,
type?: string type?: string,
): void => { ): void => {
const headers = [ const headers = [
[ [
@ -122,7 +122,7 @@ export class MultipartParser {
return { return {
headers, headers,
disposition: getHeaderValueParams( disposition: getHeaderValueParams(
headers.get("Content-Disposition") ?? "" headers.get("Content-Disposition") ?? "",
), ),
}; };
}; };

View file

@ -16,7 +16,7 @@ class FormDataBase {
append( append(
name: string, name: string,
value: string | blob.DenoBlob | domFile.DomFileImpl, value: string | blob.DenoBlob | domFile.DomFileImpl,
filename?: string filename?: string,
): void { ): void {
requiredArguments("FormData.append", arguments.length, 2); requiredArguments("FormData.append", arguments.length, 2);
name = String(name); name = String(name);
@ -82,7 +82,7 @@ class FormDataBase {
set( set(
name: string, name: string,
value: string | blob.DenoBlob | domFile.DomFileImpl, value: string | blob.DenoBlob | domFile.DomFileImpl,
filename?: string filename?: string,
): void { ): void {
requiredArguments("FormData.set", arguments.length, 2); requiredArguments("FormData.set", arguments.length, 2);
name = String(name); name = String(name);
@ -102,7 +102,7 @@ class FormDataBase {
filename || "blob", filename || "blob",
{ {
type: value.type, type: value.type,
} },
); );
} else { } else {
this[dataSymbol][i][1] = String(value); this[dataSymbol][i][1] = String(value);

View file

@ -55,7 +55,7 @@ function validateValue(value: string): void {
function dataAppend( function dataAppend(
data: Array<[string, string]>, data: Array<[string, string]>,
key: string, key: string,
value: string value: string,
): void { ): void {
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
const [dataKey] = data[i]; const [dataKey] = data[i];
@ -85,7 +85,7 @@ function dataAppend(
* entry in the headers list. */ * entry in the headers list. */
function dataGet( function dataGet(
data: Array<[string, string]>, data: Array<[string, string]>,
key: string key: string,
): string | undefined { ): string | undefined {
const setCookieValues = []; const setCookieValues = [];
for (const [dataKey, value] of data) { for (const [dataKey, value] of data) {
@ -118,7 +118,7 @@ function dataGet(
function dataSet( function dataSet(
data: Array<[string, string]>, data: Array<[string, string]>,
key: string, key: string,
value: string value: string,
): void { ): void {
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
const [dataKey] = data[i]; const [dataKey] = data[i];
@ -169,7 +169,7 @@ class HeadersBase {
constructor(init?: HeadersInit) { constructor(init?: HeadersInit) {
if (init === null) { if (init === null) {
throw new TypeError( throw new TypeError(
"Failed to construct 'Headers'; The provided value was not valid" "Failed to construct 'Headers'; The provided value was not valid",
); );
} else if (isHeaders(init)) { } else if (isHeaders(init)) {
this[headersData] = [...init]; this[headersData] = [...init];
@ -183,7 +183,7 @@ class HeadersBase {
requiredArguments( requiredArguments(
"Headers.constructor tuple array argument", "Headers.constructor tuple array argument",
tuple.length, tuple.length,
2 2,
); );
this.append(tuple[0], tuple[1]); this.append(tuple[0], tuple[1]);

View file

@ -8,7 +8,7 @@ let performanceEntries: PerformanceEntryList = [];
function findMostRecent( function findMostRecent(
name: string, name: string,
type: "mark" | "measure" type: "mark" | "measure",
): PerformanceEntry | undefined { ): PerformanceEntry | undefined {
return performanceEntries return performanceEntries
.slice() .slice()
@ -32,12 +32,12 @@ function convertMarkToTimestamp(mark: string | number): number {
function filterByNameType( function filterByNameType(
name?: string, name?: string,
type?: "mark" | "measure" type?: "mark" | "measure",
): PerformanceEntryList { ): PerformanceEntryList {
return performanceEntries.filter( return performanceEntries.filter(
(entry) => (entry) =>
(name ? entry.name === name : true) && (name ? entry.name === name : true) &&
(type ? entry.entryType === type : true) (type ? entry.entryType === type : true),
); );
} }
@ -72,7 +72,7 @@ export class PerformanceEntryImpl implements PerformanceEntry {
name: string, name: string,
entryType: string, entryType: string,
startTime: number, startTime: number,
duration: number duration: number,
) { ) {
this.#name = name; this.#name = name;
this.#entryType = entryType; this.#entryType = entryType;
@ -111,7 +111,7 @@ export class PerformanceMarkImpl extends PerformanceEntryImpl
constructor( constructor(
name: string, name: string,
{ detail = null, startTime = now() }: PerformanceMarkOptions = {} { detail = null, startTime = now() }: PerformanceMarkOptions = {},
) { ) {
super(name, "mark", startTime, 0); super(name, "mark", startTime, 0);
if (startTime < 0) { if (startTime < 0) {
@ -133,11 +133,9 @@ export class PerformanceMarkImpl extends PerformanceEntryImpl
[customInspect](): string { [customInspect](): string {
return this.detail return this.detail
? `${this.constructor.name} {\n detail: ${inspect(this.detail, { ? `${this.constructor.name} {\n detail: ${
depth: 3, inspect(this.detail, { depth: 3 })
})},\n name: "${this.name}",\n entryType: "${ },\n name: "${this.name}",\n entryType: "${this.entryType}",\n startTime: ${this.startTime},\n duration: ${this.duration}\n}`
this.entryType
}",\n startTime: ${this.startTime},\n duration: ${this.duration}\n}`
: `${this.constructor.name} { detail: ${this.detail}, name: "${this.name}", entryType: "${this.entryType}", startTime: ${this.startTime}, duration: ${this.duration} }`; : `${this.constructor.name} { detail: ${this.detail}, name: "${this.name}", entryType: "${this.entryType}", startTime: ${this.startTime}, duration: ${this.duration} }`;
} }
} }
@ -161,7 +159,7 @@ export class PerformanceMeasureImpl extends PerformanceEntryImpl
startTime: number, startTime: number,
duration: number, duration: number,
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
detail: any = null detail: any = null,
) { ) {
super(name, "measure", startTime, duration); super(name, "measure", startTime, duration);
this.#detail = cloneValue(detail); this.#detail = cloneValue(detail);
@ -180,11 +178,9 @@ export class PerformanceMeasureImpl extends PerformanceEntryImpl
[customInspect](): string { [customInspect](): string {
return this.detail return this.detail
? `${this.constructor.name} {\n detail: ${inspect(this.detail, { ? `${this.constructor.name} {\n detail: ${
depth: 3, inspect(this.detail, { depth: 3 })
})},\n name: "${this.name}",\n entryType: "${ },\n name: "${this.name}",\n entryType: "${this.entryType}",\n startTime: ${this.startTime},\n duration: ${this.duration}\n}`
this.entryType
}",\n startTime: ${this.startTime},\n duration: ${this.duration}\n}`
: `${this.constructor.name} { detail: ${this.detail}, name: "${this.name}", entryType: "${this.entryType}", startTime: ${this.startTime}, duration: ${this.duration} }`; : `${this.constructor.name} { detail: ${this.detail}, name: "${this.name}", entryType: "${this.entryType}", startTime: ${this.startTime}, duration: ${this.duration} }`;
} }
} }
@ -193,11 +189,11 @@ export class PerformanceImpl implements Performance {
clearMarks(markName?: string): void { clearMarks(markName?: string): void {
if (markName == null) { if (markName == null) {
performanceEntries = performanceEntries.filter( performanceEntries = performanceEntries.filter(
(entry) => entry.entryType !== "mark" (entry) => entry.entryType !== "mark",
); );
} else { } else {
performanceEntries = performanceEntries.filter( performanceEntries = performanceEntries.filter(
(entry) => !(entry.name === markName && entry.entryType === "mark") (entry) => !(entry.name === markName && entry.entryType === "mark"),
); );
} }
} }
@ -205,12 +201,12 @@ export class PerformanceImpl implements Performance {
clearMeasures(measureName?: string): void { clearMeasures(measureName?: string): void {
if (measureName == null) { if (measureName == null) {
performanceEntries = performanceEntries.filter( performanceEntries = performanceEntries.filter(
(entry) => entry.entryType !== "measure" (entry) => entry.entryType !== "measure",
); );
} else { } else {
performanceEntries = performanceEntries.filter( performanceEntries = performanceEntries.filter(
(entry) => (entry) =>
!(entry.name === measureName && entry.entryType === "measure") !(entry.name === measureName && entry.entryType === "measure"),
); );
} }
} }
@ -220,7 +216,7 @@ export class PerformanceImpl implements Performance {
} }
getEntriesByName( getEntriesByName(
name: string, name: string,
type?: "mark" | "measure" type?: "mark" | "measure",
): PerformanceEntryList { ): PerformanceEntryList {
return filterByNameType(name, type); return filterByNameType(name, type);
} }
@ -230,7 +226,7 @@ export class PerformanceImpl implements Performance {
mark( mark(
markName: string, markName: string,
options: PerformanceMarkOptions = {} options: PerformanceMarkOptions = {},
): PerformanceMark { ): PerformanceMark {
// 3.1.1.1 If the global object is a Window object and markName uses the // 3.1.1.1 If the global object is a Window object and markName uses the
// same name as a read only attribute in the PerformanceTiming interface, // same name as a read only attribute in the PerformanceTiming interface,
@ -243,17 +239,17 @@ export class PerformanceImpl implements Performance {
measure( measure(
measureName: string, measureName: string,
options?: PerformanceMeasureOptions options?: PerformanceMeasureOptions,
): PerformanceMeasure; ): PerformanceMeasure;
measure( measure(
measureName: string, measureName: string,
startMark?: string, startMark?: string,
endMark?: string endMark?: string,
): PerformanceMeasure; ): PerformanceMeasure;
measure( measure(
measureName: string, measureName: string,
startOrMeasureOptions: string | PerformanceMeasureOptions = {}, startOrMeasureOptions: string | PerformanceMeasureOptions = {},
endMark?: string endMark?: string,
): PerformanceMeasure { ): PerformanceMeasure {
if (startOrMeasureOptions && typeof startOrMeasureOptions === "object") { if (startOrMeasureOptions && typeof startOrMeasureOptions === "object") {
if (endMark) { if (endMark) {
@ -271,7 +267,7 @@ export class PerformanceImpl implements Performance {
"end" in startOrMeasureOptions "end" in startOrMeasureOptions
) { ) {
throw new TypeError( throw new TypeError(
"Cannot specify start, end, and duration together in options." "Cannot specify start, end, and duration together in options.",
); );
} }
} }
@ -319,7 +315,7 @@ export class PerformanceImpl implements Performance {
endTime - startTime, endTime - startTime,
typeof startOrMeasureOptions === "object" typeof startOrMeasureOptions === "object"
? startOrMeasureOptions.detail ?? null ? startOrMeasureOptions.detail ?? null
: null : null,
); );
performanceEntries.push(entry); performanceEntries.push(entry);
return entry; return entry;

File diff suppressed because it is too large Load diff

View file

@ -15,9 +15,9 @@ export class CountQueuingStrategyImpl implements CountQueuingStrategy {
} }
[customInspect](): string { [customInspect](): string {
return `${this.constructor.name} { highWaterMark: ${String( return `${this.constructor.name} { highWaterMark: ${
this.highWaterMark String(this.highWaterMark)
)}, size: f }`; }, size: f }`;
} }
} }
@ -40,9 +40,9 @@ export class ByteLengthQueuingStrategyImpl
} }
[customInspect](): string { [customInspect](): string {
return `${this.constructor.name} { highWaterMark: ${String( return `${this.constructor.name} { highWaterMark: ${
this.highWaterMark String(this.highWaterMark)
)}, size: f }`; }, size: f }`;
} }
} }

View file

@ -42,7 +42,7 @@ export class ReadableByteStreamControllerImpl
private constructor() { private constructor() {
throw new TypeError( throw new TypeError(
"ReadableByteStreamController's constructor cannot be called." "ReadableByteStreamController's constructor cannot be called.",
); );
} }
@ -66,7 +66,7 @@ export class ReadableByteStreamControllerImpl
} }
if (this[sym.controlledReadableByteStream][sym.state] !== "readable") { if (this[sym.controlledReadableByteStream][sym.state] !== "readable") {
throw new TypeError( throw new TypeError(
"ReadableByteStreamController's stream is not in a readable state." "ReadableByteStreamController's stream is not in a readable state.",
); );
} }
readableByteStreamControllerClose(this); readableByteStreamControllerClose(this);
@ -81,12 +81,12 @@ export class ReadableByteStreamControllerImpl
} }
if (this[sym.controlledReadableByteStream][sym.state] !== "readable") { if (this[sym.controlledReadableByteStream][sym.state] !== "readable") {
throw new TypeError( throw new TypeError(
"ReadableByteStreamController's stream is not in a readable state." "ReadableByteStreamController's stream is not in a readable state.",
); );
} }
if (!ArrayBuffer.isView(chunk)) { if (!ArrayBuffer.isView(chunk)) {
throw new TypeError( throw new TypeError(
"You can only enqueue array buffer views when using a ReadableByteStreamController" "You can only enqueue array buffer views when using a ReadableByteStreamController",
); );
} }
if (isDetachedBuffer(chunk.buffer)) { if (isDetachedBuffer(chunk.buffer)) {
@ -126,8 +126,8 @@ export class ReadableByteStreamControllerImpl
readableStreamCreateReadResult( readableStreamCreateReadResult(
view, view,
false, false,
stream[sym.reader]![sym.forAuthorCode] stream[sym.reader]![sym.forAuthorCode],
) ),
); );
} }
// 3.11.5.2.5 If autoAllocateChunkSize is not undefined, // 3.11.5.2.5 If autoAllocateChunkSize is not undefined,
@ -137,13 +137,13 @@ export class ReadableByteStreamControllerImpl
} }
[customInspect](): string { [customInspect](): string {
return `${this.constructor.name} { byobRequest: ${String( return `${this.constructor.name} { byobRequest: ${
this.byobRequest String(this.byobRequest)
)}, desiredSize: ${String(this.desiredSize)} }`; }, desiredSize: ${String(this.desiredSize)} }`;
} }
} }
setFunctionName( setFunctionName(
ReadableByteStreamControllerImpl, ReadableByteStreamControllerImpl,
"ReadableByteStreamController" "ReadableByteStreamController",
); );

View file

@ -44,7 +44,7 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
highWaterMark?: number; highWaterMark?: number;
size?: undefined; size?: undefined;
} }
| QueuingStrategy<R> = {} | QueuingStrategy<R> = {},
) { ) {
initializeReadableStream(this); initializeReadableStream(this);
const { size } = strategy; const { size } = strategy;
@ -54,14 +54,14 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
if (isUnderlyingByteSource(underlyingSource)) { if (isUnderlyingByteSource(underlyingSource)) {
if (size !== undefined) { if (size !== undefined) {
throw new RangeError( throw new RangeError(
`When underlying source is "bytes", strategy.size must be undefined.` `When underlying source is "bytes", strategy.size must be undefined.`,
); );
} }
highWaterMark = validateAndNormalizeHighWaterMark(highWaterMark ?? 0); highWaterMark = validateAndNormalizeHighWaterMark(highWaterMark ?? 0);
setUpReadableByteStreamControllerFromUnderlyingSource( setUpReadableByteStreamControllerFromUnderlyingSource(
this, this,
underlyingSource, underlyingSource,
highWaterMark highWaterMark,
); );
} else if (type === undefined) { } else if (type === undefined) {
const sizeAlgorithm = makeSizeAlgorithmFromSizeFunction(size); const sizeAlgorithm = makeSizeAlgorithmFromSizeFunction(size);
@ -70,11 +70,11 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
this, this,
underlyingSource, underlyingSource,
highWaterMark, highWaterMark,
sizeAlgorithm sizeAlgorithm,
); );
} else { } else {
throw new RangeError( throw new RangeError(
`Valid values for underlyingSource are "bytes" or undefined. Received: "${type}".` `Valid values for underlyingSource are "bytes" or undefined. Received: "${type}".`,
); );
} }
} }
@ -93,7 +93,7 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
} }
if (isReadableStreamLocked(this)) { if (isReadableStreamLocked(this)) {
return Promise.reject( return Promise.reject(
new TypeError("Cannot cancel a locked ReadableStream.") new TypeError("Cannot cancel a locked ReadableStream."),
); );
} }
return readableStreamCancel(this, reason); return readableStreamCancel(this, reason);
@ -132,7 +132,7 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
writable: WritableStream<R>; writable: WritableStream<R>;
readable: ReadableStream<T>; readable: ReadableStream<T>;
}, },
{ preventClose, preventAbort, preventCancel, signal }: PipeOptions = {} { preventClose, preventAbort, preventCancel, signal }: PipeOptions = {},
): ReadableStream<T> { ): ReadableStream<T> {
if (!isReadableStream(this)) { if (!isReadableStream(this)) {
throw new TypeError("Invalid ReadableStream."); throw new TypeError("Invalid ReadableStream.");
@ -161,7 +161,7 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
preventClose, preventClose,
preventAbort, preventAbort,
preventCancel, preventCancel,
signal signal,
); );
setPromiseIsHandledToTrue(promise); setPromiseIsHandledToTrue(promise);
return readable; return readable;
@ -169,14 +169,14 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
pipeTo( pipeTo(
dest: WritableStream<R>, dest: WritableStream<R>,
{ preventClose, preventAbort, preventCancel, signal }: PipeOptions = {} { preventClose, preventAbort, preventCancel, signal }: PipeOptions = {},
): Promise<void> { ): Promise<void> {
if (!isReadableStream(this)) { if (!isReadableStream(this)) {
return Promise.reject(new TypeError("Invalid ReadableStream.")); return Promise.reject(new TypeError("Invalid ReadableStream."));
} }
if (!isWritableStream(dest)) { if (!isWritableStream(dest)) {
return Promise.reject( return Promise.reject(
new TypeError("dest is not a valid WritableStream.") new TypeError("dest is not a valid WritableStream."),
); );
} }
preventClose = Boolean(preventClose); preventClose = Boolean(preventClose);
@ -197,7 +197,7 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
preventClose, preventClose,
preventAbort, preventAbort,
preventCancel, preventCancel,
signal signal,
); );
} }
@ -215,7 +215,7 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
[Symbol.asyncIterator]( [Symbol.asyncIterator](
options: { options: {
preventCancel?: boolean; preventCancel?: boolean;
} = {} } = {},
): AsyncIterableIterator<R> { ): AsyncIterableIterator<R> {
return this.getIterator(options); return this.getIterator(options);
} }

View file

@ -12,25 +12,24 @@ import {
import { assert } from "../../util.ts"; import { assert } from "../../util.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
const AsyncIteratorPrototype: AsyncIterableIterator<any> = Object.getPrototypeOf( const AsyncIteratorPrototype: AsyncIterableIterator<any> = Object
Object.getPrototypeOf(async function* () {}).prototype .getPrototypeOf(Object.getPrototypeOf(async function* () {}).prototype);
);
export const ReadableStreamAsyncIteratorPrototype: ReadableStreamAsyncIterator = Object.setPrototypeOf( export const ReadableStreamAsyncIteratorPrototype: ReadableStreamAsyncIterator =
{ Object.setPrototypeOf({
next( next(
this: ReadableStreamAsyncIterator this: ReadableStreamAsyncIterator,
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
): Promise<ReadableStreamReadResult<any>> { ): Promise<ReadableStreamReadResult<any>> {
if (!isReadableStreamAsyncIterator(this)) { if (!isReadableStreamAsyncIterator(this)) {
return Promise.reject( return Promise.reject(
new TypeError("invalid ReadableStreamAsyncIterator.") new TypeError("invalid ReadableStreamAsyncIterator."),
); );
} }
const reader = this[sym.asyncIteratorReader]; const reader = this[sym.asyncIteratorReader];
if (!reader[sym.ownerReadableStream]) { if (!reader[sym.ownerReadableStream]) {
return Promise.reject( return Promise.reject(
new TypeError("reader owner ReadableStream is undefined.") new TypeError("reader owner ReadableStream is undefined."),
); );
} }
return readableStreamDefaultReaderRead(reader).then((result) => { return readableStreamDefaultReaderRead(reader).then((result) => {
@ -47,23 +46,23 @@ export const ReadableStreamAsyncIteratorPrototype: ReadableStreamAsyncIterator =
return( return(
this: ReadableStreamAsyncIterator, this: ReadableStreamAsyncIterator,
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
value?: any | PromiseLike<any> value?: any | PromiseLike<any>,
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
): Promise<ReadableStreamReadResult<any>> { ): Promise<ReadableStreamReadResult<any>> {
if (!isReadableStreamAsyncIterator(this)) { if (!isReadableStreamAsyncIterator(this)) {
return Promise.reject( return Promise.reject(
new TypeError("invalid ReadableStreamAsyncIterator.") new TypeError("invalid ReadableStreamAsyncIterator."),
); );
} }
const reader = this[sym.asyncIteratorReader]; const reader = this[sym.asyncIteratorReader];
if (!reader[sym.ownerReadableStream]) { if (!reader[sym.ownerReadableStream]) {
return Promise.reject( return Promise.reject(
new TypeError("reader owner ReadableStream is undefined.") new TypeError("reader owner ReadableStream is undefined."),
); );
} }
if (reader[sym.readRequests].length) { if (reader[sym.readRequests].length) {
return Promise.reject( return Promise.reject(
new TypeError("reader has outstanding read requests.") new TypeError("reader has outstanding read requests."),
); );
} }
if (!this[sym.preventCancel]) { if (!this[sym.preventCancel]) {
@ -74,8 +73,8 @@ export const ReadableStreamAsyncIteratorPrototype: ReadableStreamAsyncIterator =
); );
} }
readableStreamReaderGenericRelease(reader); readableStreamReaderGenericRelease(reader);
return Promise.resolve(readableStreamCreateReadResult(value, true, true)); return Promise.resolve(
readableStreamCreateReadResult(value, true, true),
);
}, },
}, }, AsyncIteratorPrototype);
AsyncIteratorPrototype
);

View file

@ -41,7 +41,7 @@ export class ReadableStreamDefaultControllerImpl<R = any>
private constructor() { private constructor() {
throw new TypeError( throw new TypeError(
"ReadableStreamDefaultController's constructor cannot be called." "ReadableStreamDefaultController's constructor cannot be called.",
); );
} }
@ -58,7 +58,7 @@ export class ReadableStreamDefaultControllerImpl<R = any>
} }
if (!readableStreamDefaultControllerCanCloseOrEnqueue(this)) { if (!readableStreamDefaultControllerCanCloseOrEnqueue(this)) {
throw new TypeError( throw new TypeError(
"ReadableStreamDefaultController cannot close or enqueue." "ReadableStreamDefaultController cannot close or enqueue.",
); );
} }
readableStreamDefaultControllerClose(this); readableStreamDefaultControllerClose(this);
@ -104,8 +104,8 @@ export class ReadableStreamDefaultControllerImpl<R = any>
readableStreamCreateReadResult( readableStreamCreateReadResult(
chunk, chunk,
false, false,
stream[sym.reader]![sym.forAuthorCode] stream[sym.reader]![sym.forAuthorCode],
) ),
); );
} }
const pendingPromise = readableStreamAddReadRequest(stream); const pendingPromise = readableStreamAddReadRequest(stream);
@ -114,13 +114,13 @@ export class ReadableStreamDefaultControllerImpl<R = any>
} }
[customInspect](): string { [customInspect](): string {
return `${this.constructor.name} { desiredSize: ${String( return `${this.constructor.name} { desiredSize: ${
this.desiredSize String(this.desiredSize)
)} }`; } }`;
} }
} }
setFunctionName( setFunctionName(
ReadableStreamDefaultControllerImpl, ReadableStreamDefaultControllerImpl,
"ReadableStreamDefaultController" "ReadableStreamDefaultController",
); );

View file

@ -37,7 +37,7 @@ export class ReadableStreamDefaultReaderImpl<R = any>
get closed(): Promise<void> { get closed(): Promise<void> {
if (!isReadableStreamDefaultReader(this)) { if (!isReadableStreamDefaultReader(this)) {
return Promise.reject( return Promise.reject(
new TypeError("Invalid ReadableStreamDefaultReader.") new TypeError("Invalid ReadableStreamDefaultReader."),
); );
} }
return ( return (
@ -50,7 +50,7 @@ export class ReadableStreamDefaultReaderImpl<R = any>
cancel(reason?: any): Promise<void> { cancel(reason?: any): Promise<void> {
if (!isReadableStreamDefaultReader(this)) { if (!isReadableStreamDefaultReader(this)) {
return Promise.reject( return Promise.reject(
new TypeError("Invalid ReadableStreamDefaultReader.") new TypeError("Invalid ReadableStreamDefaultReader."),
); );
} }
if (!this[sym.ownerReadableStream]) { if (!this[sym.ownerReadableStream]) {
@ -62,7 +62,7 @@ export class ReadableStreamDefaultReaderImpl<R = any>
read(): Promise<ReadableStreamReadResult<R>> { read(): Promise<ReadableStreamReadResult<R>> {
if (!isReadableStreamDefaultReader(this)) { if (!isReadableStreamDefaultReader(this)) {
return Promise.reject( return Promise.reject(
new TypeError("Invalid ReadableStreamDefaultReader.") new TypeError("Invalid ReadableStreamDefaultReader."),
); );
} }
if (!this[sym.ownerReadableStream]) { if (!this[sym.ownerReadableStream]) {

View file

@ -20,7 +20,7 @@ export const closedPromise = Symbol("closedPromise");
export const closeRequest = Symbol("closeRequest"); export const closeRequest = Symbol("closeRequest");
export const closeRequested = Symbol("closeRequested"); export const closeRequested = Symbol("closeRequested");
export const controlledReadableByteStream = Symbol( export const controlledReadableByteStream = Symbol(
"controlledReadableByteStream" "controlledReadableByteStream",
); );
export const controlledReadableStream = Symbol("controlledReadableStream"); export const controlledReadableStream = Symbol("controlledReadableStream");
export const controlledTransformStream = Symbol("controlledTransformStream"); export const controlledTransformStream = Symbol("controlledTransformStream");

View file

@ -29,7 +29,7 @@ export class TransformStreamImpl<I = any, O = any>
constructor( constructor(
transformer: Transformer<I, O> = {}, transformer: Transformer<I, O> = {},
writableStrategy: QueuingStrategy<I> = {}, writableStrategy: QueuingStrategy<I> = {},
readableStrategy: QueuingStrategy<O> = {} readableStrategy: QueuingStrategy<O> = {},
) { ) {
const writableSizeFunction = writableStrategy.size; const writableSizeFunction = writableStrategy.size;
let writableHighWaterMark = writableStrategy.highWaterMark; let writableHighWaterMark = writableStrategy.highWaterMark;
@ -38,36 +38,36 @@ export class TransformStreamImpl<I = any, O = any>
const writableType = transformer.writableType; const writableType = transformer.writableType;
if (writableType !== undefined) { if (writableType !== undefined) {
throw new RangeError( throw new RangeError(
`Expected transformer writableType to be undefined, received "${String( `Expected transformer writableType to be undefined, received "${
writableType String(writableType)
)}"` }"`,
); );
} }
const writableSizeAlgorithm = makeSizeAlgorithmFromSizeFunction( const writableSizeAlgorithm = makeSizeAlgorithmFromSizeFunction(
writableSizeFunction writableSizeFunction,
); );
if (writableHighWaterMark === undefined) { if (writableHighWaterMark === undefined) {
writableHighWaterMark = 1; writableHighWaterMark = 1;
} }
writableHighWaterMark = validateAndNormalizeHighWaterMark( writableHighWaterMark = validateAndNormalizeHighWaterMark(
writableHighWaterMark writableHighWaterMark,
); );
const readableType = transformer.readableType; const readableType = transformer.readableType;
if (readableType !== undefined) { if (readableType !== undefined) {
throw new RangeError( throw new RangeError(
`Expected transformer readableType to be undefined, received "${String( `Expected transformer readableType to be undefined, received "${
readableType String(readableType)
)}"` }"`,
); );
} }
const readableSizeAlgorithm = makeSizeAlgorithmFromSizeFunction( const readableSizeAlgorithm = makeSizeAlgorithmFromSizeFunction(
readableSizeFunction readableSizeFunction,
); );
if (readableHighWaterMark === undefined) { if (readableHighWaterMark === undefined) {
readableHighWaterMark = 1; readableHighWaterMark = 1;
} }
readableHighWaterMark = validateAndNormalizeHighWaterMark( readableHighWaterMark = validateAndNormalizeHighWaterMark(
readableHighWaterMark readableHighWaterMark,
); );
const startPromise = getDeferred<void>(); const startPromise = getDeferred<void>();
initializeTransformStream( initializeTransformStream(
@ -76,7 +76,7 @@ export class TransformStreamImpl<I = any, O = any>
writableHighWaterMark, writableHighWaterMark,
writableSizeAlgorithm, writableSizeAlgorithm,
readableHighWaterMark, readableHighWaterMark,
readableSizeAlgorithm readableSizeAlgorithm,
); );
// the brand check expects this, and the brand check occurs in the following // the brand check expects this, and the brand check occurs in the following
// but the property hasn't been defined. // but the property hasn't been defined.
@ -89,7 +89,7 @@ export class TransformStreamImpl<I = any, O = any>
const startResult: void | PromiseLike<void> = invokeOrNoop( const startResult: void | PromiseLike<void> = invokeOrNoop(
transformer, transformer,
"start", "start",
this[sym.transformStreamController] this[sym.transformStreamController],
); );
startPromise.resolve(startResult); startPromise.resolve(startResult);
} }
@ -109,9 +109,9 @@ export class TransformStreamImpl<I = any, O = any>
} }
[customInspect](): string { [customInspect](): string {
return `${this.constructor.name} {\n readable: ${inspect( return `${this.constructor.name} {\n readable: ${
this.readable inspect(this.readable)
)}\n writable: ${inspect(this.writable)}\n}`; }\n writable: ${inspect(this.writable)}\n}`;
} }
} }

View file

@ -24,7 +24,7 @@ export class TransformStreamDefaultControllerImpl<I = any, O = any>
private constructor() { private constructor() {
throw new TypeError( throw new TypeError(
"TransformStreamDefaultController's constructor cannot be called." "TransformStreamDefaultController's constructor cannot be called.",
); );
} }
@ -36,7 +36,7 @@ export class TransformStreamDefaultControllerImpl<I = any, O = any>
sym.readable sym.readable
][sym.readableStreamController]; ][sym.readableStreamController];
return readableStreamDefaultControllerGetDesiredSize( return readableStreamDefaultControllerGetDesiredSize(
readableController as ReadableStreamDefaultControllerImpl<O> readableController as ReadableStreamDefaultControllerImpl<O>,
); );
} }
@ -63,13 +63,13 @@ export class TransformStreamDefaultControllerImpl<I = any, O = any>
} }
[customInspect](): string { [customInspect](): string {
return `${this.constructor.name} { desiredSize: ${String( return `${this.constructor.name} { desiredSize: ${
this.desiredSize String(this.desiredSize)
)} }`; } }`;
} }
} }
setFunctionName( setFunctionName(
TransformStreamDefaultControllerImpl, TransformStreamDefaultControllerImpl,
"TransformStreamDefaultController" "TransformStreamDefaultController",
); );

View file

@ -36,7 +36,7 @@ export class WritableStreamImpl<W = any> implements WritableStream<W> {
constructor( constructor(
underlyingSink: UnderlyingSink = {}, underlyingSink: UnderlyingSink = {},
strategy: QueuingStrategy = {} strategy: QueuingStrategy = {},
) { ) {
initializeWritableStream(this); initializeWritableStream(this);
const size = strategy.size; const size = strategy.size;
@ -51,7 +51,7 @@ export class WritableStreamImpl<W = any> implements WritableStream<W> {
this, this,
underlyingSink, underlyingSink,
highWaterMark, highWaterMark,
sizeAlgorithm sizeAlgorithm,
); );
} }
@ -69,7 +69,7 @@ export class WritableStreamImpl<W = any> implements WritableStream<W> {
} }
if (isWritableStreamLocked(this)) { if (isWritableStreamLocked(this)) {
return Promise.reject( return Promise.reject(
new TypeError("Cannot abort a locked WritableStream.") new TypeError("Cannot abort a locked WritableStream."),
); );
} }
return writableStreamAbort(this, reason); return writableStreamAbort(this, reason);
@ -81,12 +81,12 @@ export class WritableStreamImpl<W = any> implements WritableStream<W> {
} }
if (isWritableStreamLocked(this)) { if (isWritableStreamLocked(this)) {
return Promise.reject( return Promise.reject(
new TypeError("Cannot abort a locked WritableStream.") new TypeError("Cannot abort a locked WritableStream."),
); );
} }
if (writableStreamCloseQueuedOrInFlight(this)) { if (writableStreamCloseQueuedOrInFlight(this)) {
return Promise.reject( return Promise.reject(
new TypeError("Cannot close an already closing WritableStream.") new TypeError("Cannot close an already closing WritableStream."),
); );
} }
return writableStreamClose(this); return writableStreamClose(this);

View file

@ -30,7 +30,7 @@ export class WritableStreamDefaultControllerImpl<W>
private constructor() { private constructor() {
throw new TypeError( throw new TypeError(
"WritableStreamDefaultController's constructor cannot be called." "WritableStreamDefaultController's constructor cannot be called.",
); );
} }
@ -64,5 +64,5 @@ export class WritableStreamDefaultControllerImpl<W>
setFunctionName( setFunctionName(
WritableStreamDefaultControllerImpl, WritableStreamDefaultControllerImpl,
"WritableStreamDefaultController" "WritableStreamDefaultController",
); );

View file

@ -68,7 +68,7 @@ export class WritableStreamDefaultWriterImpl<W>
get closed(): Promise<void> { get closed(): Promise<void> {
if (!isWritableStreamDefaultWriter(this)) { if (!isWritableStreamDefaultWriter(this)) {
return Promise.reject( return Promise.reject(
new TypeError("Invalid WritableStreamDefaultWriter.") new TypeError("Invalid WritableStreamDefaultWriter."),
); );
} }
return this[sym.closedPromise].promise; return this[sym.closedPromise].promise;
@ -87,7 +87,7 @@ export class WritableStreamDefaultWriterImpl<W>
get ready(): Promise<void> { get ready(): Promise<void> {
if (!isWritableStreamDefaultWriter(this)) { if (!isWritableStreamDefaultWriter(this)) {
return Promise.reject( return Promise.reject(
new TypeError("Invalid WritableStreamDefaultWriter.") new TypeError("Invalid WritableStreamDefaultWriter."),
); );
} }
return this[sym.readyPromise].promise; return this[sym.readyPromise].promise;
@ -97,12 +97,12 @@ export class WritableStreamDefaultWriterImpl<W>
abort(reason: any): Promise<void> { abort(reason: any): Promise<void> {
if (!isWritableStreamDefaultWriter(this)) { if (!isWritableStreamDefaultWriter(this)) {
return Promise.reject( return Promise.reject(
new TypeError("Invalid WritableStreamDefaultWriter.") new TypeError("Invalid WritableStreamDefaultWriter."),
); );
} }
if (!this[sym.ownerWritableStream]) { if (!this[sym.ownerWritableStream]) {
Promise.reject( Promise.reject(
new TypeError("WritableStreamDefaultWriter has no owner.") new TypeError("WritableStreamDefaultWriter has no owner."),
); );
} }
return writableStreamDefaultWriterAbort(this, reason); return writableStreamDefaultWriterAbort(this, reason);
@ -111,18 +111,18 @@ export class WritableStreamDefaultWriterImpl<W>
close(): Promise<void> { close(): Promise<void> {
if (!isWritableStreamDefaultWriter(this)) { if (!isWritableStreamDefaultWriter(this)) {
return Promise.reject( return Promise.reject(
new TypeError("Invalid WritableStreamDefaultWriter.") new TypeError("Invalid WritableStreamDefaultWriter."),
); );
} }
const stream = this[sym.ownerWritableStream]; const stream = this[sym.ownerWritableStream];
if (!stream) { if (!stream) {
Promise.reject( Promise.reject(
new TypeError("WritableStreamDefaultWriter has no owner.") new TypeError("WritableStreamDefaultWriter has no owner."),
); );
} }
if (writableStreamCloseQueuedOrInFlight(stream)) { if (writableStreamCloseQueuedOrInFlight(stream)) {
Promise.reject( Promise.reject(
new TypeError("Stream is in an invalid state to be closed.") new TypeError("Stream is in an invalid state to be closed."),
); );
} }
return writableStreamDefaultWriterClose(this); return writableStreamDefaultWriterClose(this);
@ -143,21 +143,21 @@ export class WritableStreamDefaultWriterImpl<W>
write(chunk: W): Promise<void> { write(chunk: W): Promise<void> {
if (!isWritableStreamDefaultWriter(this)) { if (!isWritableStreamDefaultWriter(this)) {
return Promise.reject( return Promise.reject(
new TypeError("Invalid WritableStreamDefaultWriter.") new TypeError("Invalid WritableStreamDefaultWriter."),
); );
} }
if (!this[sym.ownerWritableStream]) { if (!this[sym.ownerWritableStream]) {
Promise.reject( Promise.reject(
new TypeError("WritableStreamDefaultWriter has no owner.") new TypeError("WritableStreamDefaultWriter has no owner."),
); );
} }
return writableStreamDefaultWriterWrite(this, chunk); return writableStreamDefaultWriterWrite(this, chunk);
} }
[customInspect](): string { [customInspect](): string {
return `${this.constructor.name} { closed: Promise, desiredSize: ${String( return `${this.constructor.name} { closed: Promise, desiredSize: ${
this.desiredSize String(this.desiredSize)
)}, ready: Promise }`; }, ready: Promise }`;
} }
} }

View file

@ -105,7 +105,7 @@ export function atob(s: string): string {
if (rem === 1 || /[^+/0-9A-Za-z]/.test(s)) { if (rem === 1 || /[^+/0-9A-Za-z]/.test(s)) {
throw new DOMException( throw new DOMException(
"The string to be decoded is not correctly encoded", "The string to be decoded is not correctly encoded",
"DataDecodeError" "DataDecodeError",
); );
} }
@ -129,7 +129,7 @@ export function btoa(s: string): string {
if (charCode > 0xff) { if (charCode > 0xff) {
throw new TypeError( throw new TypeError(
"The string to be encoded contains characters " + "The string to be encoded contains characters " +
"outside of the Latin1 range." "outside of the Latin1 range.",
); );
} }
byteArray.push(charCode); byteArray.push(charCode);
@ -157,7 +157,7 @@ class SingleByteDecoder implements Decoder {
constructor( constructor(
index: number[], index: number[],
{ ignoreBOM = false, fatal = false }: DecoderOptions = {} { ignoreBOM = false, fatal = false }: DecoderOptions = {},
) { ) {
if (ignoreBOM) { if (ignoreBOM) {
throw new TypeError("Ignoring the BOM is available only with utf-8."); throw new TypeError("Ignoring the BOM is available only with utf-8.");
@ -222,7 +222,7 @@ const decoders = new Map<string, (options: DecoderOptions) => Decoder>();
// Single byte decoders are an array of code point lookups // Single byte decoders are an array of code point lookups
const encodingIndexes = new Map<string, number[]>(); const encodingIndexes = new Map<string, number[]>();
// prettier-ignore // deno-fmt-ignore
encodingIndexes.set("windows-1252", [ encodingIndexes.set("windows-1252", [
8364, 8364,
129, 129,
@ -358,7 +358,7 @@ for (const [key, index] of encodingIndexes) {
key, key,
(options: DecoderOptions): SingleByteDecoder => { (options: DecoderOptions): SingleByteDecoder => {
return new SingleByteDecoder(index, options); return new SingleByteDecoder(index, options);
} },
); );
} }
@ -442,7 +442,7 @@ export class TextDecoder {
const encoding = encodings.get(label); const encoding = encodings.get(label);
if (!encoding) { if (!encoding) {
throw new RangeError( throw new RangeError(
`The encoding label provided ('${label}') is invalid.` `The encoding label provided ('${label}') is invalid.`,
); );
} }
if (!decoders.has(encoding) && encoding !== "utf-8") { if (!decoders.has(encoding) && encoding !== "utf-8") {
@ -453,7 +453,7 @@ export class TextDecoder {
decode( decode(
input?: BufferSource, input?: BufferSource,
options: TextDecodeOptions = { stream: false } options: TextDecodeOptions = { stream: false },
): string { ): string {
if (options.stream) { if (options.stream) {
throw new TypeError("Stream not supported."); throw new TypeError("Stream not supported.");

View file

@ -149,7 +149,7 @@ function unschedule(timer: Timer): void {
const nextDueNode: DueNode | null = dueTree.min(); const nextDueNode: DueNode | null = dueTree.min();
setOrClearGlobalTimeout( setOrClearGlobalTimeout(
nextDueNode && nextDueNode.due, nextDueNode && nextDueNode.due,
OriginalDate.now() OriginalDate.now(),
); );
} }
} else { } else {
@ -203,7 +203,7 @@ function setTimer(
cb: (...args: Args) => void, cb: (...args: Args) => void,
delay: number, delay: number,
args: Args, args: Args,
repeat: boolean repeat: boolean,
): number { ): number {
// Bind `args` to the callback and bind `this` to globalThis(global). // Bind `args` to the callback and bind `this` to globalThis(global).
const callback: () => void = cb.bind(globalThis, ...args); const callback: () => void = cb.bind(globalThis, ...args);
@ -215,7 +215,7 @@ function setTimer(
console.warn( console.warn(
`${delay} does not fit into` + `${delay} does not fit into` +
" a 32-bit signed integer." + " a 32-bit signed integer." +
"\nTimeout duration was set to 1." "\nTimeout duration was set to 1.",
); );
delay = 1; delay = 1;
} }

View file

@ -86,14 +86,14 @@ function parse(url: string, isBase = true): URLParts | undefined {
[restAuthentication, restAuthority] = takePattern(restAuthority, /^(.*)@/); [restAuthentication, restAuthority] = takePattern(restAuthority, /^(.*)@/);
[parts.username, restAuthentication] = takePattern( [parts.username, restAuthentication] = takePattern(
restAuthentication, restAuthentication,
/^([^:]*)/ /^([^:]*)/,
); );
parts.username = encodeUserinfo(parts.username); parts.username = encodeUserinfo(parts.username);
[parts.password] = takePattern(restAuthentication, /^:(.*)/); [parts.password] = takePattern(restAuthentication, /^:(.*)/);
parts.password = encodeUserinfo(parts.password); parts.password = encodeUserinfo(parts.password);
[parts.hostname, restAuthority] = takePattern( [parts.hostname, restAuthority] = takePattern(
restAuthority, restAuthority,
/^(\[[0-9a-fA-F.:]{2,}\]|[^:]+)/ /^(\[[0-9a-fA-F.:]{2,}\]|[^:]+)/,
); );
[parts.port] = takePattern(restAuthority, /^:(.*)/); [parts.port] = takePattern(restAuthority, /^:(.*)/);
if (!isValidPort(parts.port)) { if (!isValidPort(parts.port)) {
@ -122,8 +122,7 @@ function parse(url: string, isBase = true): URLParts | undefined {
function generateUUID(): string { function generateUUID(): string {
return "00000000-0000-4000-8000-000000000000".replace(/[0]/g, (): string => return "00000000-0000-4000-8000-000000000000".replace(/[0]/g, (): string =>
// random integer from 0 to 15 as a hex digit. // random integer from 0 to 15 as a hex digit.
(getRandomValues(new Uint8Array(1))[0] % 16).toString(16) (getRandomValues(new Uint8Array(1))[0] % 16).toString(16));
);
} }
// Keep it outside of URL to avoid any attempts of access. // Keep it outside of URL to avoid any attempts of access.
@ -174,7 +173,7 @@ function normalizePath(path: string, isFilePath = false): string {
function resolvePathFromBase( function resolvePathFromBase(
path: string, path: string,
basePath: string, basePath: string,
isFilePath = false isFilePath = false,
): string { ): string {
let normalizedPath = normalizePath(path, isFilePath); let normalizedPath = normalizePath(path, isFilePath);
let normalizedBasePath = normalizePath(basePath, isFilePath); let normalizedBasePath = normalizePath(basePath, isFilePath);
@ -185,11 +184,11 @@ function resolvePathFromBase(
let baseDriveLetter: string; let baseDriveLetter: string;
[driveLetter, normalizedPath] = takePattern( [driveLetter, normalizedPath] = takePattern(
normalizedPath, normalizedPath,
/^(\/[A-Za-z]:)(?=\/)/ /^(\/[A-Za-z]:)(?=\/)/,
); );
[baseDriveLetter, normalizedBasePath] = takePattern( [baseDriveLetter, normalizedBasePath] = takePattern(
normalizedBasePath, normalizedBasePath,
/^(\/[A-Za-z]:)(?=\/)/ /^(\/[A-Za-z]:)(?=\/)/,
); );
driveLetterPrefix = driveLetter || baseDriveLetter; driveLetterPrefix = driveLetter || baseDriveLetter;
} }
@ -306,8 +305,7 @@ export class URLImpl implements URL {
} }
get href(): string { get href(): string {
const authentication = const authentication = this.username || this.password
this.username || this.password
? `${this.username}${this.password ? ":" + this.password : ""}@` ? `${this.username}${this.password ? ":" + this.password : ""}@`
: ""; : "";
const host = this.host; const host = this.host;
@ -421,8 +419,9 @@ export class URLImpl implements URL {
} }
} }
const urlParts = const urlParts = typeof url === "string"
typeof url === "string" ? parse(url, !baseParts) : parts.get(url); ? parse(url, !baseParts)
: parts.get(url);
if (urlParts == undefined) { if (urlParts == undefined) {
throw new TypeError("Invalid URL."); throw new TypeError("Invalid URL.");
} }
@ -441,7 +440,7 @@ export class URLImpl implements URL {
path: resolvePathFromBase( path: resolvePathFromBase(
urlParts.path, urlParts.path,
baseParts.path || "/", baseParts.path || "/",
baseParts.protocol == "file" baseParts.protocol == "file",
), ),
query: urlParts.query, query: urlParts.query,
hash: urlParts.hash, hash: urlParts.hash,
@ -522,28 +521,28 @@ function charInC0ControlSet(c: string): boolean {
} }
function charInSearchSet(c: string): boolean { function charInSearchSet(c: string): boolean {
// prettier-ignore // deno-fmt-ignore
return charInC0ControlSet(c) || ["\u0020", "\u0022", "\u0023", "\u0027", "\u003C", "\u003E"].includes(c) || c > "\u007E"; return charInC0ControlSet(c) || ["\u0020", "\u0022", "\u0023", "\u0027", "\u003C", "\u003E"].includes(c) || c > "\u007E";
} }
function charInFragmentSet(c: string): boolean { function charInFragmentSet(c: string): boolean {
// prettier-ignore // deno-fmt-ignore
return charInC0ControlSet(c) || ["\u0020", "\u0022", "\u003C", "\u003E", "\u0060"].includes(c); return charInC0ControlSet(c) || ["\u0020", "\u0022", "\u003C", "\u003E", "\u0060"].includes(c);
} }
function charInPathSet(c: string): boolean { function charInPathSet(c: string): boolean {
// prettier-ignore // deno-fmt-ignore
return charInFragmentSet(c) || ["\u0023", "\u003F", "\u007B", "\u007D"].includes(c); return charInFragmentSet(c) || ["\u0023", "\u003F", "\u007B", "\u007D"].includes(c);
} }
function charInUserinfoSet(c: string): boolean { function charInUserinfoSet(c: string): boolean {
// "\u0027" ("'") seemingly isn't in the spec, but matches Chrome and Firefox. // "\u0027" ("'") seemingly isn't in the spec, but matches Chrome and Firefox.
// prettier-ignore // deno-fmt-ignore
return charInPathSet(c) || ["\u0027", "\u002F", "\u003A", "\u003B", "\u003D", "\u0040", "\u005B", "\u005C", "\u005D", "\u005E", "\u007C"].includes(c); return charInPathSet(c) || ["\u0027", "\u002F", "\u003A", "\u003B", "\u003D", "\u0040", "\u005B", "\u005C", "\u005D", "\u005E", "\u007C"].includes(c);
} }
function charIsForbiddenInHost(c: string): boolean { function charIsForbiddenInHost(c: string): boolean {
// prettier-ignore // deno-fmt-ignore
return ["\u0000", "\u0009", "\u000A", "\u000D", "\u0020", "\u0023", "\u0025", "\u002F", "\u003A", "\u003C", "\u003E", "\u003F", "\u0040", "\u005B", "\u005C", "\u005D", "\u005E"].includes(c); return ["\u0000", "\u0009", "\u000A", "\u000D", "\u0020", "\u0023", "\u0025", "\u002F", "\u003A", "\u003C", "\u003E", "\u003F", "\u0040", "\u005B", "\u005C", "\u005D", "\u005E"].includes(c);
} }
@ -591,8 +590,9 @@ function encodeHostname(s: string, isSpecial = true): string {
if (result.match(/%(?![0-9A-Fa-f]{2})/) != null) { if (result.match(/%(?![0-9A-Fa-f]{2})/) != null) {
throw new TypeError("Invalid hostname."); throw new TypeError("Invalid hostname.");
} }
result = result.replace(/%(.{2})/g, (_, hex) => result = result.replace(
String.fromCodePoint(Number(`0x${hex}`)) /%(.{2})/g,
(_, hex) => String.fromCodePoint(Number(`0x${hex}`)),
); );
// IDNA domain to ASCII. // IDNA domain to ASCII.

View file

@ -57,14 +57,14 @@ export class URLSearchParamsImpl implements URLSearchParams {
}; };
#handleArrayInitialization = ( #handleArrayInitialization = (
init: string[][] | Iterable<[string, string]> init: string[][] | Iterable<[string, string]>,
): void => { ): void => {
// Overload: sequence<sequence<USVString>> // Overload: sequence<sequence<USVString>>
for (const tuple of init) { for (const tuple of init) {
// If pair does not contain exactly two items, then throw a TypeError. // If pair does not contain exactly two items, then throw a TypeError.
if (tuple.length !== 2) { if (tuple.length !== 2) {
throw new TypeError( throw new TypeError(
"URLSearchParams.constructor tuple array argument must only contain pair elements" "URLSearchParams.constructor tuple array argument must only contain pair elements",
); );
} }
this.#append(tuple[0], tuple[1]); this.#append(tuple[0], tuple[1]);
@ -175,7 +175,7 @@ export class URLSearchParamsImpl implements URLSearchParams {
forEach( forEach(
callbackfn: (value: string, key: string, parent: this) => void, callbackfn: (value: string, key: string, parent: this) => void,
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
thisArg?: any thisArg?: any,
): void { ): void {
requiredArguments("URLSearchParams.forEach", arguments.length, 1); requiredArguments("URLSearchParams.forEach", arguments.length, 1);
@ -212,7 +212,7 @@ export class URLSearchParamsImpl implements URLSearchParams {
return this.#params return this.#params
.map( .map(
(tuple) => (tuple) =>
`${encodeURIComponent(tuple[0])}=${encodeURIComponent(tuple[1])}` `${encodeURIComponent(tuple[0])}=${encodeURIComponent(tuple[1])}`,
) )
.join("&"); .join("&");
} }

View file

@ -27,7 +27,7 @@ export function isInvalidDate(x: Date): boolean {
export function requiredArguments( export function requiredArguments(
name: string, name: string,
length: number, length: number,
required: number required: number,
): void { ): void {
if (length < required) { if (length < required) {
const errMsg = `${name} requires at least ${required} argument${ const errMsg = `${name} requires at least ${required} argument${
@ -43,7 +43,7 @@ export function immutableDefine(
o: any, o: any,
p: string | number | symbol, p: string | number | symbol,
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
value: any value: any,
): void { ): void {
Object.defineProperty(o, p, { Object.defineProperty(o, p, {
value, value,
@ -64,7 +64,7 @@ export function hasOwnProperty(obj: unknown, v: PropertyKey): boolean {
* *
* @internal */ * @internal */
export function isIterable<T, P extends keyof T, K extends T[P]>( export function isIterable<T, P extends keyof T, K extends T[P]>(
o: T o: T,
): o is T & Iterable<[P, K]> { ): o is T & Iterable<[P, K]> {
// checks for null and undefined // checks for null and undefined
if (o == null) { if (o == null) {
@ -81,12 +81,12 @@ function cloneArrayBuffer(
srcBuffer: ArrayBufferLike, srcBuffer: ArrayBufferLike,
srcByteOffset: number, srcByteOffset: number,
srcLength: number, srcLength: number,
cloneConstructor: ArrayBufferConstructor | SharedArrayBufferConstructor cloneConstructor: ArrayBufferConstructor | SharedArrayBufferConstructor,
): InstanceType<typeof cloneConstructor> { ): InstanceType<typeof cloneConstructor> {
// this function fudges the return type but SharedArrayBuffer is disabled for a while anyway // this function fudges the return type but SharedArrayBuffer is disabled for a while anyway
return srcBuffer.slice( return srcBuffer.slice(
srcByteOffset, srcByteOffset,
srcByteOffset + srcLength srcByteOffset + srcLength,
) as InstanceType<typeof cloneConstructor>; ) as InstanceType<typeof cloneConstructor>;
} }
@ -122,7 +122,7 @@ export function cloneValue(value: any): any {
value, value,
0, 0,
value.byteLength, value.byteLength,
ArrayBuffer ArrayBuffer,
); );
objectCloneMemo.set(value, cloned); objectCloneMemo.set(value, cloned);
return cloned; return cloned;
@ -142,7 +142,7 @@ export function cloneValue(value: any): any {
return new (value.constructor as DataViewConstructor)( return new (value.constructor as DataViewConstructor)(
clonedBuffer, clonedBuffer,
value.byteOffset, value.byteOffset,
length length,
); );
} }
if (value instanceof Map) { if (value instanceof Map) {
@ -183,7 +183,7 @@ interface GenericConstructor<T = any> {
* are not. */ * are not. */
export function defineEnumerableProps( export function defineEnumerableProps(
Ctor: GenericConstructor, Ctor: GenericConstructor,
props: string[] props: string[],
): void { ): void {
for (const prop of props) { for (const prop of props) {
Reflect.defineProperty(Ctor.prototype, prop, { enumerable: true }); Reflect.defineProperty(Ctor.prototype, prop, { enumerable: true });

View file

@ -94,7 +94,7 @@ export class WorkerImpl extends EventTarget implements Worker {
if (type !== "module") { if (type !== "module") {
throw new Error( throw new Error(
'Not yet implemented: only "module" type workers are supported' 'Not yet implemented: only "module" type workers are supported',
); );
} }
@ -125,7 +125,7 @@ export class WorkerImpl extends EventTarget implements Worker {
hasSourceCode, hasSourceCode,
sourceCode, sourceCode,
useDenoNamespace, useDenoNamespace,
options?.name options?.name,
); );
this.#id = id; this.#id = id;
this.#poll(); this.#poll();
@ -225,7 +225,7 @@ export class WorkerImpl extends EventTarget implements Worker {
postMessage(message: any, transferOrOptions?: any): void { postMessage(message: any, transferOrOptions?: any): void {
if (transferOrOptions) { if (transferOrOptions) {
throw new Error( throw new Error(
"Not yet implemented: `transfer` and `options` are not supported." "Not yet implemented: `transfer` and `options` are not supported.",
); );
} }

View file

@ -15,7 +15,7 @@ export interface WriteFileOptions {
export function writeFileSync( export function writeFileSync(
path: string | URL, path: string | URL,
data: Uint8Array, data: Uint8Array,
options: WriteFileOptions = {} options: WriteFileOptions = {},
): void { ): void {
if (options.create !== undefined) { if (options.create !== undefined) {
const create = !!options.create; const create = !!options.create;
@ -45,7 +45,7 @@ export function writeFileSync(
export async function writeFile( export async function writeFile(
path: string | URL, path: string | URL,
data: Uint8Array, data: Uint8Array,
options: WriteFileOptions = {} options: WriteFileOptions = {},
): Promise<void> { ): Promise<void> {
if (options.create !== undefined) { if (options.create !== undefined) {
const create = !!options.create; const create = !!options.create;

View file

@ -4,7 +4,7 @@ import { writeFileSync, writeFile, WriteFileOptions } from "./write_file.ts";
export function writeTextFileSync( export function writeTextFileSync(
path: string | URL, path: string | URL,
data: string, data: string,
options: WriteFileOptions = {} options: WriteFileOptions = {},
): void { ): void {
const encoder = new TextEncoder(); const encoder = new TextEncoder();
return writeFileSync(path, encoder.encode(data), options); return writeFileSync(path, encoder.encode(data), options);
@ -13,7 +13,7 @@ export function writeTextFileSync(
export function writeTextFile( export function writeTextFile(
path: string | URL, path: string | URL,
data: string, data: string,
options: WriteFileOptions = {} options: WriteFileOptions = {},
): Promise<void> { ): Promise<void> {
const encoder = new TextEncoder(); const encoder = new TextEncoder();
return writeFile(path, encoder.encode(data), options); return writeFile(path, encoder.encode(data), options);

View file

@ -20,5 +20,5 @@ console.log(
loadedJs1, loadedJs1,
loadedJs2, loadedJs2,
loadedJs3, loadedJs3,
loadedJs4 loadedJs4,
); );

View file

@ -1,4 +1,4 @@
// @ts-expect-error // @ts-expect-error
Deno.core.evalContext( Deno.core.evalContext(
"(async () => console.log(await import('./subdir/mod4.js')))()" "(async () => console.log(await import('./subdir/mod4.js')))()",
); );

View file

@ -5,10 +5,10 @@ declare namespace JSX {
} }
const React = { const React = {
createElement(factory: any, props: any, ...children: any[]) { createElement(factory: any, props: any, ...children: any[]) {
return {factory, props, children} return { factory, props, children };
} },
} };
const View = () => ( const View = () => (
<div class="deno">land</div> <div class="deno">land</div>
) );
console.log(<View />) console.log(<View />);

View file

@ -1,9 +1,9 @@
const React = { const React = {
createElement(factory, props, ...children) { createElement(factory, props, ...children) {
return {factory, props, children} return { factory, props, children };
} },
} };
const View = () => ( const View = () => (
<div class="deno">land</div> <div class="deno">land</div>
) );
console.log(<View />) console.log(<View />);

View file

@ -29,5 +29,5 @@ console.log(
loadedJsx1, loadedJsx1,
loadedJsx2, loadedJsx2,
loadedJsx3, loadedJsx3,
loadedJsx4 loadedJsx4,
); );

View file

@ -3,11 +3,11 @@ import "http://127.0.0.1:4545/cli/tests/053_import_compression/brotli";
console.log( console.log(
await fetch( await fetch(
"http://127.0.0.1:4545/cli/tests/053_import_compression/gziped" "http://127.0.0.1:4545/cli/tests/053_import_compression/gziped",
).then((res) => res.text()) ).then((res) => res.text()),
); );
console.log( console.log(
await fetch( await fetch(
"http://127.0.0.1:4545/cli/tests/053_import_compression/brotli" "http://127.0.0.1:4545/cli/tests/053_import_compression/brotli",
).then((res) => res.text()) ).then((res) => res.text()),
); );

View file

@ -1,4 +0,0 @@
console.log("Hello World"
)

View file

@ -0,0 +1,4 @@
// Deliberately using .mjs to avoid triggering dprint
console.log("Hello World"
)

View file

@ -1 +1,2 @@
// Deliberately using .mjs to avoid triggering dprint
console.log("Hello World"); console.log("Hello World");

View file

@ -20,5 +20,5 @@ console.log(
loadedJs1, loadedJs1,
loadedJs2, loadedJs2,
loadedJs3, loadedJs3,
loadedJs4 loadedJs4,
); );

View file

@ -43,7 +43,7 @@ Deno.test({
{ {
module: "amd", module: "amd",
sourceMap: false, sourceMap: false,
} },
); );
assert(diagnostics == null); assert(diagnostics == null);
assert(actual); assert(actual);
@ -63,7 +63,7 @@ Deno.test({
}, },
{ {
lib: ["dom", "es2018", "deno.ns"], lib: ["dom", "es2018", "deno.ns"],
} },
); );
assert(diagnostics == null); assert(diagnostics == null);
assert(actual); assert(actual);
@ -81,7 +81,7 @@ Deno.test({
}, },
{ {
types: ["./subdir/foo_types.d.ts"], types: ["./subdir/foo_types.d.ts"],
} },
); );
assert(diagnostics == null); assert(diagnostics == null);
assert(actual); assert(actual);
@ -112,7 +112,7 @@ Deno.test({
{ {
sourceMap: false, sourceMap: false,
module: "amd", module: "amd",
} },
); );
assert(actual); assert(actual);
assertEquals(Object.keys(actual), ["foo.ts"]); assertEquals(Object.keys(actual), ["foo.ts"]);
@ -155,7 +155,7 @@ Deno.test({
}, },
{ {
removeComments: true, removeComments: true,
} },
); );
assert(diagnostics == null); assert(diagnostics == null);
assert(!actual.includes(`random`)); assert(!actual.includes(`random`));
@ -182,7 +182,7 @@ Deno.test({
{ {
"/foo.ts": `console.log("hello world!")\n`, "/foo.ts": `console.log("hello world!")\n`,
}, },
{ target: "es2015" } { target: "es2015" },
); );
assert(diagnostics == null); assert(diagnostics == null);
assert(actual.includes(`var __awaiter = `)); assert(actual.includes(`var __awaiter = `));

View file

@ -7,5 +7,5 @@ listener.accept().then(
await Deno.copy(conn, conn); await Deno.copy(conn, conn);
conn.close(); conn.close();
listener.close(); listener.close();
} },
); );

View file

@ -24,7 +24,7 @@
await import("./subdir/indirect_throws.js"); await import("./subdir/indirect_throws.js");
} catch (err) { } catch (err) {
console.log( console.log(
"Caught error thrown indirectly by dynamically imported module." "Caught error thrown indirectly by dynamically imported module.",
); );
console.log(err); console.log(err);
} }

View file

@ -1,2 +1,3 @@
// deno-fmt-ignore-file
const LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG = undefined; const LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG = undefined;
LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG.a; LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG.a;

View file

@ -1,3 +1,3 @@
[WILDCARD] [WILDCARD]
error: TS2532 [ERROR]: Object is possibly 'undefined'. error: TS2532 [ERROR]: Object is possibly 'undefined'.
at [WILDCARD]tests/error_017_hide_long_source_ts.ts:2:1 at [WILDCARD]tests/error_017_hide_long_source_ts.ts:3:1

View file

@ -1,2 +1,3 @@
// deno-fmt-ignore-file
const LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG = undefined; const LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG = undefined;
LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG.a; LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG.a;

View file

@ -1,2 +1,2 @@
error: Uncaught TypeError: Cannot read property 'a' of undefined error: Uncaught TypeError: Cannot read property 'a' of undefined
at file:///[WILDCARD]cli/tests/error_018_hide_long_source_js.js:2:206 at file:///[WILDCARD]cli/tests/error_018_hide_long_source_js.js:3:206

View file

@ -1,3 +1,3 @@
// prettier-ignore // deno-fmt-ignore-file
(the following is a syntax error ^^ ! ) (the following is a syntax error ^^ ! )

Some files were not shown because too many files have changed in this diff Show more