diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3e83397 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +root = true + +[*] +indent_style = tab +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 80 + +[*.{yml,yaml,json}] +indent_style = space +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false + +[*.snap] +trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c7b5d46..fa1f9c1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,10 +18,14 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - name: Setup Git + if: matrix.os == 'windows-latest' + run: git config --global core.autocrlf input + + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: yarn diff --git a/compile-to-definitions/index.js b/compile-to-definitions/index.js index 37a87b6..729d0e3 100644 --- a/compile-to-definitions/index.js +++ b/compile-to-definitions/index.js @@ -30,14 +30,14 @@ const makeDefinitionsForSchema = async (absSchemaPath, schemasDir) => { const filename = path.resolve( root, outputFolder, - `${path.join(directory, basename)}.d.ts` + `${path.join(directory, basename)}.d.ts`, ); const schema = JSON.parse(fs.readFileSync(absSchemaPath, "utf-8")); const keys = Object.keys(schema); if (keys.length === 1 && keys[0] === "$ref") return; const prettierConfig = await prettier.resolveConfig( - path.resolve(root, outputFolder, "result.d.ts") + path.resolve(root, outputFolder, "result.d.ts"), ); const style = { printWidth: prettierConfig.printWidth, @@ -56,7 +56,7 @@ const makeDefinitionsForSchema = async (absSchemaPath, schemasDir) => { (ts) => { ts = ts.replace( /\s+\*\s+\* This interface was referenced by `.+`'s JSON-Schema\s+\* via the `definition` ".+"\./g, - "" + "", ); let normalizedContent = ""; try { @@ -70,14 +70,14 @@ const makeDefinitionsForSchema = async (absSchemaPath, schemasDir) => { fs.mkdirSync(path.dirname(filename), { recursive: true }); fs.writeFileSync(filename, ts, "utf-8"); console.error( - `declarations/${relPath.replace(/\\/g, "/")}.d.ts updated` + `declarations/${relPath.replace(/\\/g, "/")}.d.ts updated`, ); } else { console.error( `declarations/${relPath.replace( /\\/g, - "/" - )}.d.ts need to be updated` + "/", + )}.d.ts need to be updated`, ); process.exitCode = 1; } @@ -86,7 +86,7 @@ const makeDefinitionsForSchema = async (absSchemaPath, schemasDir) => { (err) => { console.error(err); process.exitCode = 1; - } + }, ); }; @@ -113,7 +113,7 @@ const preprocessSchema = (schema, root = schema, path = []) => { const result = resolvePath(root, property.$ref); if (!result) { throw new Error( - `Unable to resolve "$ref": "${property.$ref}" in ${path.join("/")}` + `Unable to resolve "$ref": "${property.$ref}" in ${path.join("/")}`, ); } schema.properties[key] = { @@ -167,7 +167,7 @@ const preprocessSchema = (schema, root = schema, path = []) => { implementedNames.push(/\/([^\/]+)$/.exec(impl)[1]); } const propEntries = Object.entries(schema.properties).filter( - ([name]) => !implementedProps.has(name) + ([name]) => !implementedProps.has(name), ); if (propEntries.length > 0) { const key = diff --git a/declarations.d.ts b/declarations.d.ts index 02c1b23..ca9463c 100644 --- a/declarations.d.ts +++ b/declarations.d.ts @@ -1,12 +1,12 @@ import * as ts from "typescript"; declare module "typescript" { export function getDeclarationModifierFlagsFromSymbol( - s: ts.Symbol + s: ts.Symbol, ): ts.ModifierFlags; export function signatureHasRestParameter(signature: ts.Signature): boolean; interface Symbol { type?: ts.Type; - parent: Symbol | undefined + parent: Symbol | undefined; } interface Declaration { expression?: ts.Expression; diff --git a/format-file-header/index.js b/format-file-header/index.js index 8fef749..65c59c4 100644 --- a/format-file-header/index.js +++ b/format-file-header/index.js @@ -45,7 +45,8 @@ const execToArray = (content, regexp) => { const schema = [ { title: "license comment", - regexp: /\/\*\n\s*MIT License http:\/\/www\.opensource\.org\/licenses\/mit-license\.php\n\s*(?:(Authors? .+)\n)?\s*\*\/\n/g, + regexp: + /\/\*\n\s*MIT License http:\/\/www\.opensource\.org\/licenses\/mit-license\.php\n\s*(?:(Authors? .+)\n)?\s*\*\/\n/g, updateMessage: "update the license comment", update(content, author) { return ( @@ -82,12 +83,13 @@ const schema = [ }, { title: "imports", - regexp: /(const (\{\s+\w+(?::\s+\w+)?(,\s+\w+(?::\s+\w+)?)*\s+\}|\w+) = (\/\*\* @type \{TODO\} \*\/\s\()?require\("[^"]+"\)\)?(\.\w+)*;\n)+\n/g, + regexp: + /(const (\{\s+\w+(?::\s+\w+)?(,\s+\w+(?::\s+\w+)?)*\s+\}|\w+) = (\/\*\* @type \{TODO\} \*\/\s\()?require\("[^"]+"\)\)?(\.\w+)*;\n)+\n/g, updateMessage: "sort imports alphabetically", update(content) { const items = execToArray( content, - /const (?:\{\s+\w+(?::\s+\w+)?(?:,\s+\w+(?::\s+\w+)?)*\s+\}|\w+) = (?:\/\*\* @type \{TODO\} \*\/\s\()?require\("([^"]+)"\)\)?((?:\.\w+)*);\n/g + /const (?:\{\s+\w+(?::\s+\w+)?(?:,\s+\w+(?::\s+\w+)?)*\s+\}|\w+) = (?:\/\*\* @type \{TODO\} \*\/\s\()?require\("([^"]+)"\)\)?((?:\.\w+)*);\n/g, ); items.sort(sortImport); return items.map((item) => item.content).join("") + "\n"; @@ -97,12 +99,13 @@ const schema = [ }, { title: "type imports", - regexp: /(\/\*\* (?:@template \w+ )*@typedef \{(?:typeof )?import\("[^"]+"\)(\.\w+)*(?:<(?:(?:\w\.)*\w+, )*(?:\w\.)*\w+>)?\} \w+(?:<(?:(?:\w\.)*\w+, )*(?:\w\.)*\w+>)? \*\/\n)+\n/g, + regexp: + /(\/\*\* (?:@template \w+ )*@typedef \{(?:typeof )?import\("[^"]+"\)(\.\w+)*(?:<(?:(?:\w\.)*\w+, )*(?:\w\.)*\w+>)?\} \w+(?:<(?:(?:\w\.)*\w+, )*(?:\w\.)*\w+>)? \*\/\n)+\n/g, updateMessage: "sort type imports alphabetically", update(content) { const items = execToArray( content, - /\/\*\* (?:@template \w+ )*@typedef \{(?:typeof )?import\("([^"]+)"\)((?:\.\w+)*(?:<(?:(?:\w\.)*\w+, )*(?:\w\.)*\w+>)?)\} \w+(?:<(?:(?:\w\.)*\w+, )*(?:\w\.)*\w+>)? \*\/\n/g + /\/\*\* (?:@template \w+ )*@typedef \{(?:typeof )?import\("([^"]+)"\)((?:\.\w+)*(?:<(?:(?:\w\.)*\w+, )*(?:\w\.)*\w+>)?)\} \w+(?:<(?:(?:\w\.)*\w+, )*(?:\w\.)*\w+>)? \*\/\n/g, ); items.sort(sortImport); return items.map((item) => item.content).join("") + "\n"; @@ -139,7 +142,7 @@ for (const filePath of allFiles) { } if (match.index !== pos) { console.log( - `${filePath}: Unexpected code at ${pos}-${match.index}, expected ${current.title}` + `${filePath}: Unexpected code at ${pos}-${match.index}, expected ${current.title}`, ); process.exitCode = 1; pos = match.index; @@ -181,12 +184,12 @@ for (const filePath of allFiles) { } const matches = content.match( - /makeSerializable\(\s*[^,]+,\s*"webpack\/lib\/[^"]+"\s*(?:,[^)]+)?\)/g + /makeSerializable\(\s*[^,]+,\s*"webpack\/lib\/[^"]+"\s*(?:,[^)]+)?\)/g, ); if (matches) { for (const match of matches) { const str = /makeSerializable\(\s*[^,]+,\s*"webpack\/lib\/([^"]+)"/.exec( - match + match, )[1]; allSerializables.add(str); } @@ -195,13 +198,13 @@ for (const filePath of allFiles) { // Check if internalSerializables.js includes all serializables in webpack for (const internalSerializables of allFiles.filter((file) => - file.includes("internalSerializables") + file.includes("internalSerializables"), )) { const content = fs.readFileSync(internalSerializables); for (const serializable of allSerializables) { if (!content.includes(`"../${serializable}"`)) { console.log( - `${internalSerializables}: must include static require to ../${serializable}` + `${internalSerializables}: must include static require to ../${serializable}`, ); process.exitCode = 1; } diff --git a/format-schemas/index.js b/format-schemas/index.js index 30eb745..e243d42 100644 --- a/format-schemas/index.js +++ b/format-schemas/index.js @@ -12,12 +12,12 @@ const minSlashes = schemas .map((p) => p.split(/[\\/]/).length) .reduce((a, b) => Math.min(a, b), Infinity); const baseSchemaPaths = schemas.filter( - (p) => p.split(/[\\/]/).length === minSlashes + (p) => p.split(/[\\/]/).length === minSlashes, ); const baseDefinitions = new Map(); for (const baseSchemaPath of baseSchemaPaths) { for (const [name, schema] of Object.entries( - require(baseSchemaPath).definitions + require(baseSchemaPath).definitions, )) { baseDefinitions.set(name, schema); } @@ -131,7 +131,7 @@ const processJson = processSchema.bind(null, { ...json, tsType: tsType.replace( /\.\.\//g, - context.importPrefix + "../" + context.importPrefix + "../", ), }; } @@ -139,7 +139,7 @@ const processJson = processSchema.bind(null, { }, }, baseDef, - {} + {}, ); json.definitions[key] = baseDef; } @@ -151,7 +151,7 @@ const processJson = processSchema.bind(null, { for (const impl of [].concat(json.implements)) { if (!impl.startsWith(prefix)) { console.warn( - `"implements": "${impl}" -> should start with "${prefix}"` + `"implements": "${impl}" -> should start with "${prefix}"`, ); continue; } @@ -159,13 +159,13 @@ const processJson = processSchema.bind(null, { const referencedSchema = context.definitions[name]; if (!referencedSchema) { console.warn( - `"implements": "${impl}" -> referenced schema not found` + `"implements": "${impl}" -> referenced schema not found`, ); continue; } if (typeof referencedSchema.properties !== "object") { console.warn( - `"implements": "${impl}" -> referenced schema has no properties` + `"implements": "${impl}" -> referenced schema has no properties`, ); continue; } diff --git a/generate-types/index.js b/generate-types/index.js index 580c7bb..d2e5fc7 100644 --- a/generate-types/index.js +++ b/generate-types/index.js @@ -29,7 +29,7 @@ const toIdentifier = (str) => { const joinIdentifer = (list) => { const str = list.join("_"); return str.replace(/([^_])_+(.|$)/g, (m, a, b) => - a !== a.toLowerCase() ? `${a}_${b}` : a + b.toUpperCase() + a !== a.toLowerCase() ? `${a}_${b}` : a + b.toUpperCase(), ); }; @@ -186,15 +186,15 @@ class TupleMap { const printError = (diagnostic) => { if (diagnostic.file && typeof diagnostic.start === "number") { let { line, character } = diagnostic.file.getLineAndCharacterOfPosition( - diagnostic.start + diagnostic.start, ); let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"); console.error( - `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}` + `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`, ); } else { console.error( - ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n") + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"), ); } }; @@ -225,7 +225,7 @@ const printError = (diagnostic) => { rootPath, { noEmit: true, - } + }, ); if (parsedConfig.errors && parsedConfig.errors.length > 0) { @@ -237,7 +237,7 @@ const printError = (diagnostic) => { const program = ts.createProgram( parsedConfig.fileNames, - parsedConfig.options + parsedConfig.options, ); const checker = program.getTypeChecker(); @@ -357,7 +357,7 @@ const printError = (diagnostic) => { name = `${current.escapedName.toString()}.${name}`; } return name; - } + }; const getTypeOfSymbol = (symbol, isValue) => { let decl; @@ -469,7 +469,7 @@ const printError = (diagnostic) => { symbol.exports.forEach((symbol, name) => { map.set( symbol, - `${namespaceName}.${ts.unescapeLeadingUnderscores(name)}` + `${namespaceName}.${ts.unescapeLeadingUnderscores(name)}`, ); }); } @@ -492,11 +492,11 @@ const printError = (diagnostic) => { for (const exposedFile of exposedFiles) { const exposedSource = program.getSourceFile( - path.resolve(rootPath, exposedFile) + path.resolve(rootPath, exposedFile), ); if (!exposedSource) { console.error( - `No source found for ${exposedFile}. These files are available:` + `No source found for ${exposedFile}. These files are available:`, ); for (const source of program.getSourceFiles()) { console.error(` - ${source.fileName}`); @@ -575,7 +575,7 @@ const printError = (diagnostic) => { .fileName.slice(rootPath.length + 1) .replace(/^.*\/(?!index)/, "") .replace(/^lib\./, "") - .replace(/\.(js|(d\.)?ts)$/, "") + .replace(/\.(js|(d\.)?ts)$/, ""), ); const syntaxType = valueDeclaration && @@ -710,7 +710,7 @@ const printError = (diagnostic) => { }; const getRootPackage = (sourceFile) => { const match = /^(node_modules\/(@[^/]+\/)?[^/]+)/.exec( - sourceFile.fileName.slice(rootPath.length + 1) + sourceFile.fileName.slice(rootPath.length + 1), ); if (!match) return undefined; const pkg = require(rootPath + "/" + match[1] + "/package.json"); @@ -816,7 +816,7 @@ const printError = (diagnostic) => { typeArguments, typeArgumentsWithoutDefaults: omitDefaults( typeArguments, - aliasType.isClassOrInterface() && aliasType.typeParameters + aliasType.isClassOrInterface() && aliasType.typeParameters, ), }; } @@ -866,7 +866,7 @@ const printError = (diagnostic) => { typeArguments: typeArgumentsTypes, typeArgumentsWithoutDefaults: omitDefaults( typeArgumentsTypes, - targetType.isClassOrInterface() && targetType.typeParameters + targetType.isClassOrInterface() && targetType.typeParameters, ), }; } @@ -980,7 +980,7 @@ const printError = (diagnostic) => { typeArguments, typeArgumentsWithoutDefaults: omitDefaults( typeArguments, - typeRef.target.typeParameters + typeRef.target.typeParameters, ), }; } @@ -1031,7 +1031,7 @@ const printError = (diagnostic) => { if (verbose) { console.log( `${parseName(type).join( - " " + " ", )} is an imported symbol, but couldn't find export in ${potentialSources.map( (source) => { const symbolToExport = getExportsOfSourceFile(source); @@ -1040,26 +1040,26 @@ const printError = (diagnostic) => { ] .sort() .join(", ")})`; - } - )}` + }, + )}`, ); } } else { if (isSourceFileModule(externalSource)) { const match = /^(.+\/node_modules\/(?:@types\/)?)((?:@[^/]+\/)?[^/]+)(.*?)(\.d\.ts)?$/.exec( - externalSource.fileName + externalSource.fileName, ); if (!match) { console.error( - `${externalSource.fileName} doesn't match node_modules import schema` + `${externalSource.fileName} doesn't match node_modules import schema`, ); } else { let from = match[2] + match[3]; try { const pkg = require(match[1] + match[2] + "/package.json"); const regExp = new RegExp( - "^(\\.\\/)?" + quoteMeta(match[3].slice(1)) + "(\\.d\\.ts)?$" + "^(\\.\\/)?" + quoteMeta(match[3].slice(1)) + "(\\.d\\.ts)?$", ); const types = pkg.types || "index.d.ts"; if (regExp.test(types)) { @@ -1121,7 +1121,7 @@ const printError = (diagnostic) => { properties: toPropMap( type.getProperties(), type.getBaseTypes(), - symbolName + symbolName, ), constructors: type.getConstructSignatures().map(parseSignature), calls: type.getCallSignatures().map(parseSignature), @@ -1331,8 +1331,8 @@ const printError = (diagnostic) => { } else if (verbose) { console.log( `${checker.typeToString( - type - )} was a class in source code, but we are unable to generate a class for it.` + type, + )} was a class in source code, but we are unable to generate a class for it.`, ); } } @@ -1419,7 +1419,7 @@ const printError = (diagnostic) => { calls: flatten(interfaceSubtypes.map((p) => p.calls)), constructors: flatten(interfaceSubtypes.map((p) => p.constructors)), properties: new Map( - flatten(interfaceSubtypes.map((p) => p.properties)) + flatten(interfaceSubtypes.map((p) => p.properties)), ), documentation: interfaceSubtypes .map((p) => p.documentation) @@ -1462,7 +1462,7 @@ const printError = (diagnostic) => { // heuristic: only referenced from other namespaces if ( !Array.from(typeReferencedBy.get(type) || [], (t) => - parsedCollectedTypes.get(t) + parsedCollectedTypes.get(t), ).every((p) => p.type === "namespace") ) { continue; @@ -1489,7 +1489,7 @@ const printError = (diagnostic) => { const getSigHash = (prefix, signature, index) => { const { args, returnType, typeParameters, documentation } = signature; const typeParametersMap = new Map( - typeParameters && typeParameters.map((t, i) => [t, i]) + typeParameters && typeParameters.map((t, i) => [t, i]), ); return [ "args", @@ -1500,7 +1500,7 @@ const printError = (diagnostic) => { arg.spread, arg.type, arg.documentation, - ]) + ]), ), "return", returnType, @@ -1547,7 +1547,7 @@ const printError = (diagnostic) => { case "intersection": { const { symbolName, types, typeParameters } = parsed; const typeParametersMap = new Map( - typeParameters && typeParameters.map((t, i) => [t, i]) + typeParameters && typeParameters.map((t, i) => [t, i]), ); return [ parsed.type, @@ -1584,11 +1584,11 @@ const printError = (diagnostic) => { const callHashes = calls.map(getSigHash.bind(null, "call")); if (callHashes.some((x) => !x)) return undefined; const constructorHashes = constructors.map( - getSigHash.bind(null, "constructor") + getSigHash.bind(null, "constructor"), ); if (constructorHashes.some((x) => !x)) return undefined; const typeParametersMap = new Map( - typeParameters && typeParameters.map((t, i) => [t, i]) + typeParameters && typeParameters.map((t, i) => [t, i]), ); return [ parsed.type, @@ -1605,7 +1605,7 @@ const printError = (diagnostic) => { name, type, optional, - ]) + ]), ), "numberIndex", numberIndex, @@ -1648,7 +1648,7 @@ const printError = (diagnostic) => { if (otherParsed === parsed) continue; if ("symbolName" in otherParsed && "symbolName" in parsed) { const commonSymbolName = otherParsed.symbolName.filter((n) => - parsed.symbolName.includes(n) + parsed.symbolName.includes(n), ); otherParsed.symbolName = commonSymbolName; } @@ -1661,7 +1661,7 @@ const printError = (diagnostic) => { target: otherType, typeArguments: [], typeArgumentsWithoutDefaults: [], - } + }, ); updates = true; } else { @@ -1745,7 +1745,9 @@ const printError = (diagnostic) => { if (requeueOnConflict) { if (verbose) { console.log( - `Naming conflict: ${name} can't be used for ${symbolName.join(" ")}` + `Naming conflict: ${name} can't be used for ${symbolName.join( + " ", + )}`, ); } const item = nameToQueueEntry.get(name); @@ -1799,7 +1801,9 @@ const printError = (diagnostic) => { const queueDeclaration = (type, variable, fn) => { if (!variable) { throw new Error( - `variable missing for queueDeclaration of ${checker.typeToString(type)}` + `variable missing for queueDeclaration of ${checker.typeToString( + type, + )}`, ); } emitDeclarations.set(type, () => { @@ -1827,7 +1831,7 @@ const printError = (diagnostic) => { set.add(exportName === name ? name : `${exportName} as ${name}`); } else { importDeclarations.add( - `type ${name} = import(${JSON.stringify(from)}).${exportName};` + `type ${name} = import(${JSON.stringify(from)}).${exportName};`, ); } }; @@ -1894,24 +1898,24 @@ const printError = (diagnostic) => { case "arrow": return `${sigTypeArgs}${args} => ${getCode( sig.returnType, - innerTypeArgs + innerTypeArgs, )}`; case "class-constructor": return `constructor${args}`; case "constructor": return `new ${sigTypeArgs}${args}: ${getCode( sig.returnType, - innerTypeArgs + innerTypeArgs, )}`; case "method": return `${sigTypeArgs}${args}: ${getCode( sig.returnType, - innerTypeArgs + innerTypeArgs, )}`; default: return `${sigTypeArgs}${args}: ${getCode( sig.returnType, - innerTypeArgs + innerTypeArgs, )}`; } }; @@ -1929,8 +1933,8 @@ const printError = (diagnostic) => { `${construct.documentation}${sigToString( construct, typeArgs, - parsed.type === "interface" ? "constructor" : "class-constructor" - )}` + parsed.type === "interface" ? "constructor" : "class-constructor", + )}`, ); } if (parsed.type === "interface") { @@ -1945,12 +1949,44 @@ const printError = (diagnostic) => { items.push(`[index: string]: ${getCode(parsed.stringIndex, typeArgs)}`); } + const hasIteratorInBaseType = (type) => { + const parsed = parsedCollectedTypes.get(type); + if (!parsed || parsed.type !== "reference") return false; + const parsedTarget = parsedCollectedTypes.get(parsed.target); + return ( + parsedTarget.type === "primitive" && + [ + "Array", + "Map", + "Set", + "String", + "Int8Array", + "Uint8Array", + "Uint8ClampedArray", + "Int16Array", + "Uint16Array", + "Int32Array", + "Uint32Array", + "Float32Array", + "Float64Array", + ].includes(parsedTarget.name) + ); + }; + const handleProperties = (properties, prefix = "") => { for (const [ name, { getter, type: propType, optional, readonly, method, documentation }, ] of properties) { if (method) { + if ( + name === "[Symbol.iterator]" && + parsed.type === "class" && + parsed.baseType && + hasIteratorInBaseType(parsed.baseType) + ) { + continue; + } let methodInfo = parsedCollectedTypes.get(propType); while ( methodInfo.type === "reference" && @@ -1976,8 +2012,8 @@ const printError = (diagnostic) => { `${Array.from(docs).join("")}${prefix}${name}${sigToString( call, typeArgs, - "method" - )}` + "method", + )}`, ); } continue; @@ -1985,13 +2021,13 @@ const printError = (diagnostic) => { console.log( `Method ${name} has weird type ${getCode(propType, typeArgs)} (${ methodInfo.type - })` + })`, ); } } const { code, optional: opt } = extractOptional( getCode(propType, typeArgs), - optional + optional, ); if (!getter) { const p = prefix + (readonly ? "readonly " : ""); @@ -2052,7 +2088,7 @@ const printError = (diagnostic) => { case "index": { return `(${getCode(parsed.objectType, typeArgs)})[${getCode( parsed.indexType, - typeArgs + typeArgs, )}]`; } case "union": @@ -2078,11 +2114,11 @@ const printError = (diagnostic) => { .map((t) => getCode(t, new Set(), "in type args")) .join(", ")}>` : "" - } = ${code(new Set())};` + } = ${code(new Set())};`, ); if (state !== "with type args" && parsed.typeParameters) { return `${variable}<${parsed.typeParameters.map((t) => - getCode(t, typeArgs) + getCode(t, typeArgs), )}>`; } return `${variable}`; @@ -2102,7 +2138,7 @@ const printError = (diagnostic) => { .join(", ")}]`; } else if (parsedTarget.name === "[...]") { const items = parsed.typeArgumentsWithoutDefaults.map((t) => - getCode(t, typeArgs) + getCode(t, typeArgs), ); const last = items.pop(); return `[${items.join(", ")}, ...(${last})[]]`; @@ -2112,14 +2148,14 @@ const printError = (diagnostic) => { ) { return `(${getCode( parsed.typeArgumentsWithoutDefaults[0], - typeArgs + typeArgs, )})[]`; } } return `${getCode( parsed.target, typeArgs, - "with type args" + "with type args", )}<${parsed.typeArgumentsWithoutDefaults .map((t) => getCode(t, typeArgs)) .join(", ")}>`; @@ -2147,7 +2183,7 @@ const printError = (diagnostic) => { }); if (state !== "with type args" && parsed.typeParameters) { return `${variable}<${parsed.typeParameters.map((t) => - getCode(t, typeArgs) + getCode(t, typeArgs), )}>`; } return `${variable}`; @@ -2188,7 +2224,7 @@ const printError = (diagnostic) => { } if (state !== "with type args" && parsed.typeParameters) { return `${variable}<${parsed.typeParameters.map((t) => - getCode(t, typeArgs) + getCode(t, typeArgs), )}>`; } return `${variable}`; @@ -2205,25 +2241,25 @@ const printError = (diagnostic) => { const code = getCode( exportedType, new Set(), - `in namespace ${name}` + `in namespace ${name}`, ); if (code.startsWith("export ")) { declarations.push(code); } else if (/^typeof [A-Za-z_0-9]+$/.test(code)) { const exportName = code.slice(`typeof `.length); exports.push( - exportName === name ? name : `${exportName} as ${name}` + exportName === name ? name : `${exportName} as ${name}`, ); } else if (name === "default") { declarations.push( - `${readonly || getter ? "const" : "let"} _default: ${code};\n` + `${readonly || getter ? "const" : "let"} _default: ${code};\n`, ); exports.push(`_default as default`); } else { declarations.push( `export ${ readonly || getter ? "const" : "let" - } ${name}: ${code};\n` + } ${name}: ${code};\n`, ); } } @@ -2236,7 +2272,7 @@ const printError = (diagnostic) => { exports.push( codeWithoutTemplateArgs === name ? name - : `${codeWithoutTemplateArgs} as ${name}` + : `${codeWithoutTemplateArgs} as ${name}`, ); } else { declarations.push(`export type ${name} = ${code};\n`); @@ -2251,8 +2287,8 @@ const printError = (diagnostic) => { } function ${variable}${sigToString( call, new Set(), - "method" - )};\n` + "method", + )};\n`, ) .join("")}${ exportNamespace ? "export" : "declare" @@ -2272,7 +2308,7 @@ const printError = (diagnostic) => { queueDeclaration( type, variable, - () => `declare const ${variable}: unique symbol;` + () => `declare const ${variable}: unique symbol;`, ); return `typeof ${variable}`; } @@ -2310,7 +2346,7 @@ const printError = (diagnostic) => { const tempName = findName( (parsed && "symbolName" in parsed && parsed.symbolName) || [ codeGenerationContext + "AnonymousCircularType", - ] + ], ); typeToCode.set(tuple, tempName); unusedTempNames.add(tuple); @@ -2364,7 +2400,7 @@ const printError = (diagnostic) => { (from) => `import { ${[...imports.get(from)] .sort() - .join(", ")} } from ${JSON.stringify(from)}` + .join(", ")} } from ${JSON.stringify(from)}`, ), ...[...importDeclarations].sort(), "", diff --git a/inherit-types/index.js b/inherit-types/index.js index 2b33923..fa75845 100644 --- a/inherit-types/index.js +++ b/inherit-types/index.js @@ -74,7 +74,7 @@ for (const sourceFile of program.getSourceFiles()) { ) { const baseDecl = findDeclarationInBaseClass( node, - member.name.getText() + member.name.getText(), ); if (baseDecl) { const memberAsAny = /** @type {any} */ (member); @@ -88,7 +88,7 @@ for (const sourceFile of program.getSourceFiles()) { if (baseJsDocText) { baseJsDocText = baseJsDocText.replace( /\t \* @abstract\r?\n/g, - "" + "", ); if (!currentJsDocText) { // add js doc @@ -145,7 +145,7 @@ for (const sourceFile of program.getSourceFiles()) { console.log(file); for (const update of updates) { console.log( - `* ${update.member} should have this JSDoc:\n\t${update.content}` + `* ${update.member} should have this JSDoc:\n\t${update.content}`, ); if (update.oldContent) { console.log(`instead of\n\t${update.oldContent}`); diff --git a/lib/argv.js b/lib/argv.js index 4df23df..bd7a882 100644 --- a/lib/argv.js +++ b/lib/argv.js @@ -2,7 +2,7 @@ module.exports = require("yargs") .boolean("write") .describe( "write", - "Write updated files to disk, otherwise it only checks if they are correct." + "Write updated files to disk, otherwise it only checks if they are correct.", ) .boolean("verbose") @@ -11,12 +11,12 @@ module.exports = require("yargs") .string("root") .describe( "root", - "Root repository directory (optional if calling from package.json scripts)." + "Root repository directory (optional if calling from package.json scripts).", ) .default( "root", process.env.INIT_CWD || process.cwd(), - "The root directory from calling package.json or the current directory" + "The root directory from calling package.json or the current directory", ) .string("schemas") @@ -26,7 +26,7 @@ module.exports = require("yargs") .string("declarations") .describe( "declarations", - "Output folder for declarations generated from schemas." + "Output folder for declarations generated from schemas.", ) .default("declarations", "declarations") diff --git a/lib/typescript-program.js b/lib/typescript-program.js index d09907d..0b89192 100644 --- a/lib/typescript-program.js +++ b/lib/typescript-program.js @@ -11,7 +11,7 @@ const parsedConfig = ts.parseJsonSourceFileConfigFileContent( configJsonFile, ts.sys, root, - { noEmit: true } + { noEmit: true }, ); const { fileNames, options } = parsedConfig; diff --git a/package.json b/package.json index 5767841..f5ef801 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,11 @@ "license": "MIT", "private": true, "scripts": { + "pretty-lint-base": "node node_modules/prettier/bin/prettier.cjs --cache --ignore-unknown .", + "pretty-lint-fix": "yarn pretty-lint-base --log-level warn --write", + "pretty-lint": "yarn pretty-lint-base --check", "test": "yarn lint", - "lint": "yarn special-lint && tsc", + "lint": "yarn special-lint && yarn pretty-lint && tsc", "special-lint": "node lockfile-lint" }, "peerDependencies": { @@ -17,10 +20,10 @@ "typescript": "*" }, "devDependencies": { - "@types/node": "^14.14.14", + "@types/node": "^22.5.4", "@types/yargs": "^15.0.12", "prettier": "^3.0.1", - "typescript": "^5.4.2" + "typescript": "^5.6.2" }, "dependencies": { "@yarnpkg/lockfile": "^1.1.0", @@ -28,7 +31,7 @@ "commondir": "^1.0.1", "glob": "^7.1.6", "json-schema-to-typescript": "^9.1.1", - "terser": "^5.6.1", + "terser": "^5.32.0", "yargs": "^16.1.1" } } diff --git a/precompile-schemas/index.js b/precompile-schemas/index.js index 943bd11..49a6f79 100644 --- a/precompile-schemas/index.js +++ b/precompile-schemas/index.js @@ -43,7 +43,7 @@ ajv.addKeyword({ code(ctx) { const { data, schema } = ctx; ctx.fail( - _`${data}.includes("!") || (absolutePathRegExp.test(${data}) !== ${schema})` + _`${data}.includes("!") || (absolutePathRegExp.test(${data}) !== ${schema})`, ); }, }); @@ -84,8 +84,8 @@ ajv.addKeyword({ `Schema precompilation only supports primitive values in enum: ${JSON.stringify( item, null, - 2 - )}` + 2, + )}`, ); } } @@ -99,7 +99,7 @@ ajv.addKeyword({ return _`${data} !== ${x}`; }) - .reduce((a, b) => _`${a} && ${b}`) + .reduce((a, b) => _`${a} && ${b}`), ); }, }); @@ -163,7 +163,7 @@ const createDeclaration = (schemaPath, title, schemasDir) => { const filename = path.resolve( root, declarations, - `${path.join(directory, basename)}` + `${path.join(directory, basename)}`, ); const fromSchemaToDeclaration = path .relative(path.dirname(schemaPath), filename) @@ -213,12 +213,12 @@ const precompileSchema = async (schemaPath, schemasDir) => { const precompiledSchemaPath = schemaPath.replace(/\.json$/, ".check.js"); const precompiledSchemaDeclarationPath = schemaPath.replace( /\.json$/, - ".check.d.ts" + ".check.d.ts", ); updateFile(precompiledSchemaPath, code); updateFile( precompiledSchemaDeclarationPath, - createDeclaration(schemaPath, title, schemasDir) + createDeclaration(schemaPath, title, schemasDir), ); } catch (e) { e.message += "\nduring precompilation of " + schemaPath; diff --git a/schemas-lint/index.js b/schemas-lint/index.js index 49c7348..25bdf85 100644 --- a/schemas-lint/index.js +++ b/schemas-lint/index.js @@ -49,7 +49,7 @@ for (const filename of schemas) { "instanceof", "tsType", "not", - "link" + "link", ]; const isReference = (schema) => { @@ -71,7 +71,7 @@ for (const filename of schemas) { process.exitCode = 1; } else if (!/^[A-Z`].*[^\.]\.$/.test(property.description)) { console.log( - `${path}.description should start with an uppercase letter and end with a single dot.` + `${path}.description should start with an uppercase letter and end with a single dot.`, ); process.exitCode = 1; } @@ -79,13 +79,13 @@ for (const filename of schemas) { const walker = (path, item) => { const otherProperties = Object.keys(item).filter( - (p) => allowedProperties.indexOf(p) < 0 + (p) => allowedProperties.indexOf(p) < 0, ); if (otherProperties.length > 0) { console.log( `${path} should not have the ${ otherProperties.length > 1 ? "properties" : "property" - } ${otherProperties.join(", ")}` + } ${otherProperties.join(", ")}`, ); process.exitCode = 1; // When allowing more properties make sure to add nice error messages for them in WebpackOptionsValidationError @@ -96,8 +96,8 @@ for (const filename of schemas) { if (otherProperties.length > 0) { console.log( `When using $ref not other properties are possible (${otherProperties.join( - ", " - )})` + ", ", + )})`, ); process.exitCode = 1; } @@ -120,7 +120,7 @@ for (const filename of schemas) { if ("absolutePath" in item) { if (item.type !== "string") { console.log( - `${path}: When using absolutePath, type must be 'string'` + `${path}: When using absolutePath, type must be 'string'`, ); process.exitCode = 1; } @@ -129,7 +129,7 @@ for (const filename of schemas) { if ("properties" in item || "additionalProperties" in item) { if (item.type !== "object") { console.log( - `${path}: When using properties or additionalProperties, type must be 'object'` + `${path}: When using properties or additionalProperties, type must be 'object'`, ); process.exitCode = 1; } @@ -172,7 +172,7 @@ for (const filename of schemas) { if ("properties" in item) { if (item.additionalProperties === undefined) { console.log( - `${path} should have additionalProperties set to some value when describing properties` + `${path} should have additionalProperties set to some value when describing properties`, ); process.exitCode = 1; } @@ -185,7 +185,7 @@ for (const filename of schemas) { if (typeof item.additionalProperties === "object") { validateProperty( `${path}.additionalProperties`, - item.additionalProperties + item.additionalProperties, ); walker(`${path}.additionalProperties`, item.additionalProperties); } diff --git a/type-coverage/index.js b/type-coverage/index.js index c0ad750..31bc820 100644 --- a/type-coverage/index.js +++ b/type-coverage/index.js @@ -55,12 +55,10 @@ for (const sourceFile of program.getSourceFiles()) { if (type) { const { line, character } = ts.getLineAndCharacterOfPosition( sourceFile, - node.getStart() + node.getStart(), ); - const { - line: lineEnd, - character: characterEnd, - } = ts.getLineAndCharacterOfPosition(sourceFile, node.getEnd()); + const { line: lineEnd, character: characterEnd } = + ts.getLineAndCharacterOfPosition(sourceFile, node.getEnd()); const typeText = typeChecker.typeToString(type); let isExternal = false; @@ -77,7 +75,7 @@ for (const sourceFile of program.getSourceFiles()) { }; if (node.parent && ts.isPropertyAccessExpression(node.parent)) { const expressionType = typeChecker.getTypeAtLocation( - node.parent.expression + node.parent.expression, ); checkDecls(expressionType); } @@ -112,5 +110,5 @@ fs.mkdirSync(outputDirectory, { recursive: true }); fs.writeFileSync( path.resolve(outputDirectory, "coverage-types.json"), JSON.stringify(coverageReport), - "utf-8" + "utf-8", ); diff --git a/yarn.lock b/yarn.lock index 858e60c..2389df5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11,6 +11,46 @@ call-me-maybe "^1.0.1" js-yaml "^3.13.1" +"@jridgewell/gen-mapping@^0.3.5": + version "0.3.5" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36" + integrity sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg== + dependencies: + "@jridgewell/set-array" "^1.2.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.24" + +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== + +"@jridgewell/set-array@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" + integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== + +"@jridgewell/source-map@^0.3.3": + version "0.3.6" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.6.tgz#9d71ca886e32502eb9362c9a74a46787c36df81a" + integrity sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ== + dependencies: + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== + +"@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": + version "0.3.25" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" + integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + "@jsdevtools/ono@^7.1.3": version "7.1.3" resolved "https://registry.yarnpkg.com/@jsdevtools/ono/-/ono-7.1.3.tgz#9df03bbd7c696a5c58885c34aa06da41c8543796" @@ -21,10 +61,12 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.6.tgz#f4c7ec43e81b319a9815115031709f26987891f0" integrity sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw== -"@types/node@^14.14.14": - version "14.14.14" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.14.tgz#f7fd5f3cc8521301119f63910f0fb965c7d761ae" - integrity sha512-UHnOPWVWV1z+VV8k6L1HhG7UbGBgIdghqF3l9Ny9ApPghbjICXkUJSd/b9gOgQfjM1r+37cipdw/HJ3F6ICEnQ== +"@types/node@^22.5.4": + version "22.5.4" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.5.4.tgz#83f7d1f65bc2ed223bdbf57c7884f1d5a4fa84e8" + integrity sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg== + dependencies: + undici-types "~6.19.2" "@types/yargs-parser@*": version "15.0.0" @@ -43,6 +85,11 @@ resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== +acorn@^8.8.2: + version "8.12.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" + integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== + ajv@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.1.0.tgz#45d5d3d36c7cdd808930cc3e603cf6200dbeb736" @@ -436,10 +483,10 @@ require-from-string@^2.0.2: resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== -source-map-support@~0.5.19: - version "0.5.19" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" - integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== +source-map-support@~0.5.20: + version "0.5.21" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" + integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" @@ -449,11 +496,6 @@ source-map@^0.6.0: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@~0.7.2: - version "0.7.3" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" - integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== - sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -480,14 +522,15 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" -terser@^5.6.1: - version "5.6.1" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.6.1.tgz#a48eeac5300c0a09b36854bf90d9c26fb201973c" - integrity sha512-yv9YLFQQ+3ZqgWCUk+pvNJwgUTdlIxUk1WTN+RnaFJe2L7ipG2csPT0ra2XRm7Cs8cxN7QXmK1rFzEwYEQkzXw== +terser@^5.32.0: + version "5.32.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.32.0.tgz#ee811c0d2d6b741c1cc34a2bc5bcbfc1b5b1f96c" + integrity sha512-v3Gtw3IzpBJ0ugkxEX8U0W6+TnPKRRCWGh1jC/iM/e3Ki5+qvO1L1EAZ56bZasc64aXHwRHNIQEzm6//i5cemQ== dependencies: + "@jridgewell/source-map" "^0.3.3" + acorn "^8.8.2" commander "^2.20.0" - source-map "~0.7.2" - source-map-support "~0.5.19" + source-map-support "~0.5.20" thenify-all@^1.0.0: version "1.6.0" @@ -521,10 +564,15 @@ type@^2.0.0: resolved "https://registry.yarnpkg.com/type/-/type-2.1.0.tgz#9bdc22c648cf8cf86dd23d32336a41cfb6475e3f" integrity sha512-G9absDWvhAWCV2gmF1zKud3OyC61nZDwWvBL2DApaVFogI07CprggiQAOOjvp2NRjYWFzPyu7vwtDrQFq8jeSA== -typescript@^5.4.2: - version "5.4.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.2.tgz#0ae9cebcfae970718474fe0da2c090cad6577372" - integrity sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ== +typescript@^5.6.2: + version "5.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.2.tgz#d1de67b6bef77c41823f822df8f0b3bcff60a5a0" + integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== + +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== uri-js@^4.2.2: version "4.4.1"