diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index dbc3758b..db2ab5f0 100755 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -github: [nonara] +github: [nonara, danielpza] diff --git a/CHANGELOG.md b/CHANGELOG.md index 278c9d13..acfe2cff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,39 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## v3.5.1 + +[compare changes](https://github.com/LeDDGroup/typescript-transform-paths/compare/v3.5.0...v3.5.1) + +### 🩹 Fixes + +- Downgrade minimatch from 10.0.1 to 9.0.5 ([#272](https://github.com/LeDDGroup/typescript-transform-paths/pull/272)) + +### 💅 Refactors + +- Always patch ([ed3ed1f](https://github.com/LeDDGroup/typescript-transform-paths/commit/ed3ed1f)) +- Rename typescript-number to typescript-x ([36643ff](https://github.com/LeDDGroup/typescript-transform-paths/commit/36643ff)) +- Use strictest typescript configuration ([a67e739](https://github.com/LeDDGroup/typescript-transform-paths/commit/a67e739)) +- Enable @typescript-eslint/no-explicit-any warning ([1cddaac](https://github.com/LeDDGroup/typescript-transform-paths/commit/1cddaac)) +- Add eslint-plugin-unicorn ([44ad2e0](https://github.com/LeDDGroup/typescript-transform-paths/commit/44ad2e0)) +- Remove anys ([07e5c27](https://github.com/LeDDGroup/typescript-transform-paths/commit/07e5c27)) + +### 🏡 Chore + +- Rename nx test project to avoid conflict with package name ([3ee03d1](https://github.com/LeDDGroup/typescript-transform-paths/commit/3ee03d1)) +- **deps-dev:** Bump typescript-eslint from 8.1.0 to 8.2.0 ([#249](https://github.com/LeDDGroup/typescript-transform-paths/pull/249)) +- **deps-dev:** Bump @types/node from 22.2.0 to 22.4.1 ([#248](https://github.com/LeDDGroup/typescript-transform-paths/pull/248)) +- Add danielpza to funding.yml ([9aa6941](https://github.com/LeDDGroup/typescript-transform-paths/commit/9aa6941)) +- **deps-dev:** Bump typescript-eslint from 8.2.0 to 8.3.0 ([#254](https://github.com/LeDDGroup/typescript-transform-paths/pull/254)) +- **deps-dev:** Bump @types/node from 22.4.1 to 22.5.0 ([#253](https://github.com/LeDDGroup/typescript-transform-paths/pull/253)) +- **deps-dev:** Update some dependencies ([164aeac](https://github.com/LeDDGroup/typescript-transform-paths/commit/164aeac)) +- Remove eslint-plugin-unicorn ([8c6ccf4](https://github.com/LeDDGroup/typescript-transform-paths/commit/8c6ccf4)) + +### ❤️ Contributors + +- Spdaley +- Daniel Perez Alvarez + ## v3.5.0 [compare changes](https://github.com/LeDDGroup/typescript-transform-paths/compare/v3.4.11...v3.5.0) diff --git a/eslint.config.mjs b/eslint.config.mjs index 78a19a48..b0b69497 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,3 +1,4 @@ +// @ts-check import globals from "globals"; import pluginJs from "@eslint/js"; import tseslint from "typescript-eslint"; @@ -23,9 +24,4 @@ export default [ "@typescript-eslint/no-require-imports": "off", }, }, - { - rules: { - "@typescript-eslint/no-explicit-any": "off", - }, - }, ]; diff --git a/package.json b/package.json index 5281a345..76a20db9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typescript-transform-paths", - "version": "3.5.0", + "version": "3.5.1", "description": "Transforms module resolution paths using TypeScript path mapping and/or custom paths", "type": "commonjs", "main": "./dist/index.js", @@ -60,11 +60,12 @@ "Ron S. (https://twitter.com/Ron)" ], "devDependencies": { - "@eslint/js": "^9.8.0", + "@eslint/js": "^9.9.1", "@tsconfig/node18": "^18.2.4", + "@tsconfig/strictest": "^2.0.5", "@types/eslint": "^9", "@types/minimatch": "^5.1.2", - "@types/node": "^22.2.0", + "@types/node": "^22.5.2", "@types/ts-expose-internals": "npm:ts-expose-internals@4.9.5", "@types/ts-node": "npm:ts-node@^10.9.2", "@types/typescript-3": "npm:typescript@3.x", @@ -76,13 +77,13 @@ "prettier-plugin-jsdoc": "^1.3.0", "ts-patch": "^3.2.1", "typescript": "^5.5.4", - "typescript-eslint": "^8.0.1" + "typescript-eslint": "^8.3.0" }, "peerDependencies": { "typescript": ">=3.6.5" }, "dependencies": { - "minimatch": "^10.0.1" + "minimatch": "^9.0.5" }, "prettier": { "plugins": [ diff --git a/src/harmony/harmony-factory.ts b/src/harmony/harmony-factory.ts index 6fa4b8a3..1b002762 100644 --- a/src/harmony/harmony-factory.ts +++ b/src/harmony/harmony-factory.ts @@ -23,7 +23,8 @@ export function createHarmonyFactory(context: TsTransformPathsContext): HarmonyF } else if (TsFourSeven.predicate(context)) { return TsFourSeven.handler(context, prop); } else { - return (target)[prop]; + // @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expression of type 'string | symbol' can't be used to index type 'typeof import("typescript") | NodeFactory'. + return target[prop]; } }, }) as HarmonyFactory; diff --git a/src/harmony/utils.ts b/src/harmony/utils.ts index 48c15a4a..2f0cb8e3 100644 --- a/src/harmony/utils.ts +++ b/src/harmony/utils.ts @@ -4,8 +4,8 @@ // @formatter:off // @prettier-ignore -export type DownSampleTsTypes = { - [i in keyof Tuple]: Tuple[i] extends any[] +export type DownSampleTsTypes = { + [i in keyof Tuple]: Tuple[i] extends unknown[] ? DownSampleTsTypes : DownSampleTsType; } & { @@ -13,8 +13,8 @@ export type DownSampleTsTypes = - T extends Exclude ? Extract[1] : T; +type DownSampleTsType = + T extends Exclude ? Extract[1] : T; // @formatter:on // endregion diff --git a/src/harmony/versions/four-seven.ts b/src/harmony/versions/four-seven.ts index ae8faca5..b09638da 100644 --- a/src/harmony/versions/four-seven.ts +++ b/src/harmony/versions/four-seven.ts @@ -46,10 +46,10 @@ export function handler(context: TsTransformPathsContext, prop: string | symbol) const factory = context.tsFactory as unknown as TsFourSevenModule.NodeFactory; switch (prop) { - case "updateImportDeclaration": + case "updateImportDeclaration": { return function ( node: ImportDeclaration, - modifiers: readonly Modifier[] | undefined, + _modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined, @@ -70,10 +70,11 @@ export function handler(context: TsTransformPathsContext, prop: string | symbol) dsAssertClause, ); }; - case "updateExportDeclaration": + } + case "updateExportDeclaration": { return function ( node: ExportDeclaration, - modifiers: readonly Modifier[] | undefined, + _modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, @@ -96,10 +97,11 @@ export function handler(context: TsTransformPathsContext, prop: string | symbol) dsAssertClause, ); }; - case "updateModuleDeclaration": + } + case "updateModuleDeclaration": { return function ( node: ModuleDeclaration, - modifiers: readonly Modifier[] | undefined, + _modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, ) { @@ -107,13 +109,17 @@ export function handler(context: TsTransformPathsContext, prop: string | symbol) return factory.updateModuleDeclaration(dsNode, dsNode.decorators, dsNode.modifiers, dsName, dsBody); }; - default: - return (...args: any) => (factory)[prop](...args); + } + default: { + // @ts-expect-error TS(7019) FIXME: Rest parameter 'args' implicitly has an 'any[]' type. + return (...args) => factory[prop](...args); + } } } export function downSample(...args: T): DownSampleTsTypes { - return args; + // @ts-expect-error TS(2322) FIXME: Type 'T' is not assignable to type 'DownSampleTsTypes'. + return args; } // endregion diff --git a/src/harmony/versions/three-eight.ts b/src/harmony/versions/three-eight.ts index 7097ab76..e9e615eb 100644 --- a/src/harmony/versions/three-eight.ts +++ b/src/harmony/versions/three-eight.ts @@ -65,22 +65,25 @@ export function handler(context: TsTransformPathsContext, prop: string | symbol) const ts = context.tsInstance as unknown as typeof TsThreeEightModule; switch (prop) { - case "updateCallExpression": - return (...args: any) => ts.updateCall.apply(void 0, args); - case "updateImportClause": + case "updateCallExpression": { + // @ts-expect-error TS(7019) FIXME: Rest parameter 'args' implicitly has an 'any[]' type. + return (...args) => ts.updateCall.apply(void 0, args); + } + case "updateImportClause": { return function ( node: ImportClause, - isTypeOnly: boolean, + _isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined, ) { // @ts-expect-error TODO investigate type issue return ts.updateImportClause.apply(void 0, downSample(node, name, namedBindings)); }; - case "updateImportDeclaration": + } + case "updateImportDeclaration": { return function ( node: ImportDeclaration, - modifiers: readonly Modifier[] | undefined, + _modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, ) { @@ -94,11 +97,12 @@ export function handler(context: TsTransformPathsContext, prop: string | symbol) dsModuleSpecifier, ); }; - case "updateExportDeclaration": + } + case "updateExportDeclaration": { return function ( node: ExportDeclaration, - modifiers: readonly Modifier[] | undefined, - isTypeOnly: boolean, + _modifiers: readonly Modifier[] | undefined, + _isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, ) { @@ -112,10 +116,11 @@ export function handler(context: TsTransformPathsContext, prop: string | symbol) dsNode.isTypeOnly, ); }; - case "updateModuleDeclaration": + } + case "updateModuleDeclaration": { return function ( node: ModuleDeclaration, - modifiers: readonly Modifier[] | undefined, + _modifiers: readonly Modifier[] | undefined, name: ModuleName, body: ModuleBody | undefined, ) { @@ -123,11 +128,12 @@ export function handler(context: TsTransformPathsContext, prop: string | symbol) return ts.updateModuleDeclaration(dsNode, dsNode.decorators, dsNode.modifiers, dsName, dsBody); }; - case "updateImportTypeNode": + } + case "updateImportTypeNode": { return function ( node: ImportTypeNode, argument: TypeNode, - assertions: ImportTypeAssertionContainer | undefined, + _assertions: ImportTypeAssertionContainer | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean, @@ -136,13 +142,17 @@ export function handler(context: TsTransformPathsContext, prop: string | symbol) return ts.updateImportTypeNode(dsNode, dsArgument, dsQualifier, dsTypeArguments, isTypeOf); }; - default: - return (...args: any) => (ts)[prop](...args); + } + default: { + // @ts-expect-error TS(7019) FIXME: Rest parameter 'args' implicitly has an 'any[]' type. + return (...args) => ts[prop](...args); + } } } export function downSample(...args: T): DownSampleTsTypes { - return args; + // @ts-expect-error TS(2322) FIXME: Type 'T' is not assignable to type 'DownSampleTsTypes'. + return args; } // endregion diff --git a/src/index.ts b/src/index.ts index 76582630..7d4f27dc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,5 @@ -import transformer from "./transformer"; -export default transformer; - -export { TsTransformPathsConfig } from "./types"; +export type { TsTransformPathsConfig } from "./types"; export { register } from "./register"; export { nxTransformerPlugin } from "./plugins"; + +export { default } from "./transformer"; diff --git a/src/plugins/nx-transformer-plugin.ts b/src/plugins/nx-transformer-plugin.ts index a10309d3..90396ffa 100644 --- a/src/plugins/nx-transformer-plugin.ts +++ b/src/plugins/nx-transformer-plugin.ts @@ -33,4 +33,4 @@ export const before: NxTransformerFactory = (pluginConfig, program) => pluginConfig?.afterDeclarations ? voidTransformer : transformer(program, { ...pluginConfig }); export const afterDeclarations: NxTransformerFactory = (pluginConfig, program) => - !pluginConfig?.afterDeclarations ? voidTransformer : transformer(program, { ...pluginConfig }); + pluginConfig?.afterDeclarations ? transformer(program, { ...pluginConfig }) : voidTransformer; diff --git a/src/register.ts b/src/register.ts index 1da39f14..43d0161f 100755 --- a/src/register.ts +++ b/src/register.ts @@ -1,4 +1,4 @@ -import type TSNode from "ts-node"; +import TSNode from "ts-node"; import type { REGISTER_INSTANCE } from "ts-node"; import ts from "typescript"; import transformer from "./transformer"; @@ -7,11 +7,18 @@ import transformer from "./transformer"; // region: Helpers /* ****************************************************************************************************************** */ +type PluginExtended = ts.PluginImport & { + transform?: string; + after?: boolean; + before?: boolean; + afterDeclarations?: boolean; +}; + function getProjectTransformerConfig(pcl: ts.ParsedCommandLine) { - const plugins = pcl.options.plugins as Record[] | undefined; + const plugins = pcl.options.plugins as PluginExtended[]; if (!plugins) return; - const res: { afterDeclarations?: Record; before?: Record } = {}; + const res: { afterDeclarations?: PluginExtended; before?: PluginExtended } = {}; for (const plugin of plugins) { if (plugin.transform === "typescript-transform-paths" && !plugin.after) res[plugin.afterDeclarations ? "afterDeclarations" : "before"] = plugin; @@ -22,8 +29,8 @@ function getProjectTransformerConfig(pcl: ts.ParsedCommandLine) { function getTransformers( program?: ts.Program, - beforeConfig?: Record, - afterDeclarationsConfig?: Record, + beforeConfig?: PluginExtended, + afterDeclarationsConfig?: PluginExtended, ): ts.CustomTransformers { return { ...(beforeConfig && { before: [transformer(program, beforeConfig)] }), diff --git a/src/transformer.ts b/src/transformer.ts index fee6078b..e4990f8e 100755 --- a/src/transformer.ts +++ b/src/transformer.ts @@ -1,4 +1,4 @@ -import path from "path"; +import path from "node:path"; import ts, { CompilerOptions } from "typescript"; import { RunMode, TsNodeState, TsTransformPathsConfig, TsTransformPathsContext, VisitorContext } from "./types"; import { nodeVisitor } from "./visitor"; @@ -7,10 +7,6 @@ import { Minimatch } from "minimatch"; import { createSyntheticEmitHost, getTsNodeRegistrationProperties } from "./utils/ts-helpers"; import { TransformerExtras } from "ts-patch"; -/* ****************************************************************************************************************** */ -// region: Helpers -/* ****************************************************************************************************************** */ - function getTsProperties(args: Parameters) { let fileNames: readonly string[] | undefined; let compilerOptions: CompilerOptions; @@ -56,7 +52,7 @@ function getTsProperties(args: Parameters) { tsNodeState === TsNodeState.Full ? compilerOptions! : { - ...(program?.getCompilerOptions() ?? {}), + ...program?.getCompilerOptions(), ...tsNodeProps!.compilerOptions, }; } else { @@ -69,12 +65,6 @@ function getTsProperties(args: Parameters) { return { tsInstance, compilerOptions, fileNames, runMode, tsNodeState }; } -// endregion - -/* ****************************************************************************************************************** */ -// region: Transformer -/* ****************************************************************************************************************** */ - export default function transformer( program?: ts.Program, pluginConfig?: TsTransformPathsConfig, @@ -114,6 +104,8 @@ export default function transformer( const { tryParsePatterns } = tsInstance; const [tsVersionMajor, tsVersionMinor] = tsInstance.versionMajorMinor.split(".").map((v) => +v); + if (!tsVersionMajor || !tsVersionMinor) throw new Error("Expected version to be parsed"); + const tsTransformPathsContext: TsTransformPathsContext = { compilerOptions, config, @@ -154,5 +146,3 @@ export default function transformer( }; }; } - -// endregion diff --git a/src/utils/elide-import-export.ts b/src/utils/elide-import-export.ts index c60a7392..57a0a505 100755 --- a/src/utils/elide-import-export.ts +++ b/src/utils/elide-import-export.ts @@ -117,7 +117,8 @@ export function elideImportOrExportDeclaration( importClause, newModuleSpecifier, // This will be changed in the next release of TypeScript, but by that point we can drop elision entirely - (node as any).attributes || node.assertClause, + // @ts-expect-error TS(2339) FIXME: Property 'attributes' does not exist on type 'ImportDeclaration'. + node.attributes || node.assertClause, ); else return undefined; } else { @@ -131,7 +132,7 @@ export function elideImportOrExportDeclaration( } const allowEmpty = - !!compilerOptions.verbatimModuleSyntax || + !!compilerOptions["verbatimModuleSyntax"] || (!!node.moduleSpecifier && (compilerOptions.importsNotUsedAsValues === ImportsNotUsedAsValues.Preserve || compilerOptions.importsNotUsedAsValues === ImportsNotUsedAsValues.Error)); @@ -150,7 +151,8 @@ export function elideImportOrExportDeclaration( exportClause, newModuleSpecifier, // This will be changed in the next release of TypeScript, but by that point we can drop elision entirely - (node as any).attributes || node.assertClause, + // @ts-expect-error TS(2339) FIXME: Property 'attributes' does not exist on type 'ExportDeclaration'. + node.attributes || node.assertClause, ) : undefined; } @@ -187,7 +189,7 @@ export function elideImportOrExportDeclaration( } else { // Elide named imports if all of its import specifiers are elided. const allowEmpty = - compilerOptions.verbatimModuleSyntax || + compilerOptions["verbatimModuleSyntax"] || (compilerOptions.preserveValueImports && (compilerOptions.importsNotUsedAsValues === ImportsNotUsedAsValues.Preserve || compilerOptions.importsNotUsedAsValues === ImportsNotUsedAsValues.Error)); @@ -234,14 +236,14 @@ export function elideImportOrExportDeclaration( */ function visitExportSpecifier(node: ExportSpecifier): VisitResult { // Elide an export specifier if it does not reference a value. - return !node.isTypeOnly && (compilerOptions.verbatimModuleSyntax || resolver.isValueAliasDeclaration(node)) + return !node.isTypeOnly && (compilerOptions["verbatimModuleSyntax"] || resolver.isValueAliasDeclaration(node)) ? node : undefined; } function shouldEmitAliasDeclaration(node: Node): boolean { return ( - !!compilerOptions.verbatimModuleSyntax || + !!compilerOptions["verbatimModuleSyntax"] || isInJSFile(node) || (compilerOptions.preserveValueImports ? resolver.isValueAliasDeclaration(node) diff --git a/src/utils/general-utils.ts b/src/utils/general-utils.ts index 9c21c24b..57567716 100755 --- a/src/utils/general-utils.ts +++ b/src/utils/general-utils.ts @@ -1,11 +1,11 @@ -import url from "url"; -import path from "path"; +import url from "node:url"; +import path from "node:path"; /* ****************************************************************************************************************** * * General Utilities & Helpers * ****************************************************************************************************************** */ -export const isURL = (s: string): boolean => !!s && (!!url.parse(s).host || !!url.parse(s).hostname); +export const isURL = (s: string | undefined): s is string => !!s && (!!url.parse(s).host || !!url.parse(s).hostname); export const isBaseDir = (baseDir: string, testDir: string): boolean => { const relative = path.relative(baseDir, testDir); diff --git a/src/utils/get-relative-path.ts b/src/utils/get-relative-path.ts index 2a2f1405..38d17584 100644 --- a/src/utils/get-relative-path.ts +++ b/src/utils/get-relative-path.ts @@ -1,6 +1,6 @@ -import fs from "fs"; -import * as os from "os"; -import path from "path"; +import fs from "node:fs"; +import * as os from "node:os"; +import path from "node:path"; /* ****************************************************************************************************************** */ // region: Locals @@ -21,7 +21,7 @@ function tryRmFile(fileName: string) { } function getIsFsCaseSensitive() { - if (isCaseSensitiveFilesystem != null) return isCaseSensitiveFilesystem; + if (isCaseSensitiveFilesystem != undefined) return isCaseSensitiveFilesystem; for (let i = 0; i < 1000; i++) { const tmpFileName = path.join(os.tmpdir(), `tstp~${i}.tmp`); diff --git a/src/utils/resolve-module-name.ts b/src/utils/resolve-module-name.ts index 676502d4..09da886b 100755 --- a/src/utils/resolve-module-name.ts +++ b/src/utils/resolve-module-name.ts @@ -1,14 +1,10 @@ import { VisitorContext } from "../types"; import { isBaseDir, isURL, maybeAddRelativeLocalPrefix } from "./general-utils"; -import * as path from "path"; +import * as path from "node:path"; import { removeFileExtension, removeSuffix, ResolvedModuleFull, SourceFile } from "typescript"; import { getOutputDirForSourceFile } from "./ts-helpers"; import { getRelativePath } from "./get-relative-path"; -/* ****************************************************************************************************************** */ -// region: Types -/* ****************************************************************************************************************** */ - export interface ResolvedModule { /** Absolute path to resolved module */ resolvedPath: string | undefined; @@ -25,12 +21,6 @@ enum IndexType { ImplicitPackage, } -// endregion - -/* ****************************************************************************************************************** */ -// region: Helpers -/* ****************************************************************************************************************** */ - function getPathDetail(moduleName: string, resolvedModule: ResolvedModuleFull) { const resolvedFileName = resolvedModule.originalPath ?? resolvedModule.resolvedFileName; const implicitPackageIndex = resolvedModule.packageId?.subModuleName; @@ -42,7 +32,7 @@ function getPathDetail(moduleName: string, resolvedModule: ResolvedModuleFull) { const resolvedBaseNameNoExtension = resolvedBaseName && removeFileExtension(resolvedBaseName); const resolvedExtName = resolvedBaseName && path.extname(resolvedFileName); - let baseName = !implicitPackageIndex ? path.basename(moduleName) : void 0; + let baseName = implicitPackageIndex ? void 0 : path.basename(moduleName); let baseNameNoExtension = baseName && removeFileExtension(baseName); let extName = baseName && path.extname(moduleName); @@ -105,12 +95,6 @@ function getResolvedSourceFile(context: VisitorContext, fileName: string): Sourc return tsInstance.createSourceFile(fileName, ``, tsInstance.ScriptTarget.ESNext, /* setParentNodes */ false); } -// endregion - -/* ****************************************************************************************************************** */ -// region: Utils -/* ****************************************************************************************************************** */ - /** Resolve a module name */ export function resolveModuleName(context: VisitorContext, moduleName: string): ResolvedModule | undefined { const { tsInstance, compilerOptions, sourceFile, config, rootDirs } = context; @@ -126,10 +110,10 @@ export function resolveModuleName(context: VisitorContext, moduleName: string): // Handle non-resolvable module if (!resolvedModule) { const maybeURL = failedLookupLocations[0]; - if (!isURL(maybeURL)) return void 0; + if (!isURL(maybeURL)) return undefined; return { isURL: true, - resolvedPath: void 0, + resolvedPath: undefined, outputPath: maybeURL, }; } @@ -172,5 +156,3 @@ export function resolveModuleName(context: VisitorContext, moduleName: string): return { isURL: false, outputPath, resolvedPath: resolvedFileName }; } - -// endregion diff --git a/src/utils/resolve-path-update-node.ts b/src/utils/resolve-path-update-node.ts index a164dd7d..c39d8604 100755 --- a/src/utils/resolve-path-update-node.ts +++ b/src/utils/resolve-path-update-node.ts @@ -4,10 +4,6 @@ import { isURL, maybeAddRelativeLocalPrefix } from "./general-utils"; import { isModulePathsMatch } from "./ts-helpers"; import { resolveModuleName } from "./resolve-module-name"; -/* ****************************************************************************************************************** */ -// region: Node Updater Utility -/* ****************************************************************************************************************** */ - /** Gets proper path and calls updaterFn to get the new node if it should be updated */ export function resolvePathAndUpdateNode( context: VisitorContext, @@ -26,9 +22,9 @@ export function resolvePathAndUpdateNode( // Accommodate direct override via @transform-path tag if (tags.overridePath) { - const transformedPath = !isURL(tags.overridePath) - ? maybeAddRelativeLocalPrefix(normalizePath(tags.overridePath)) - : tags.overridePath; + const transformedPath = isURL(tags.overridePath) + ? tags.overridePath + : maybeAddRelativeLocalPrefix(normalizePath(tags.overridePath)); return updaterFn(factory.createStringLiteral(transformedPath)); } @@ -67,9 +63,10 @@ export function resolvePathAndUpdateNode( if (targetNode.pos >= 0) { try { const trivia = targetNode.getFullText(sourceFile).slice(0, targetNode.getLeadingTriviaWidth(sourceFile)); - const regex = /^\s*\/\/\/?\s*@(transform-path|no-transform-path)(?:[^\S\r\n](.+?))?$/gim; + const regex = /^\s*\/{2,3}\s*@(transform-path|no-transform-path)(?:[^\S\n\r](.+?))?$/gim; - for (let match = regex.exec(trivia); match; match = regex.exec(trivia)) commentTags.set(match[1], match[2]); + for (let match = regex.exec(trivia); match; match = regex.exec(trivia)) + if (match[1]) commentTags.set(match[1], match[2]); } catch {} } @@ -83,7 +80,7 @@ export function resolvePathAndUpdateNode( function findTag(expected: string): boolean | string | undefined { if (commentTags.has(expected)) return commentTags.get(expected) || true; - if (!jsDocTags?.length) return void 0; + if (!jsDocTags?.length) return undefined; for (const tag of jsDocTags) { const tagName = tag.tagName.text.toLowerCase(); @@ -103,8 +100,8 @@ export function resolvePathAndUpdateNode( : void 0; } } + + return undefined; } } } - -// endregion diff --git a/src/utils/ts-helpers.ts b/src/utils/ts-helpers.ts index 63962609..a11a66da 100755 --- a/src/utils/ts-helpers.ts +++ b/src/utils/ts-helpers.ts @@ -1,5 +1,5 @@ import ts, { GetCanonicalFileName, SourceFile } from "typescript"; -import path from "path"; +import path from "node:path"; import { VisitorContext } from "../types"; import type { REGISTER_INSTANCE } from "ts-node"; @@ -68,7 +68,7 @@ export function createSyntheticEmitHost( !tsInstance.sys.useCaseSensitiveFileNames, ), getCanonicalFileName, - } as unknown as ts.EmitHost; + } as ts.EmitHost; } /** Get ts-node register info */ @@ -78,17 +78,16 @@ export function getTsNodeRegistrationProperties(tsInstance: typeof ts) { // eslint-disable-next-line @typescript-eslint/no-require-imports tsNodeSymbol = require("ts-node")?.["REGISTER_INSTANCE"]; } catch { - return undefined; + return; } - if (!global.process[tsNodeSymbol]) return undefined; + if (!global.process[tsNodeSymbol]) return; const { config, options } = global.process[tsNodeSymbol]!; const { configFilePath } = config.options; - const pcl = configFilePath - ? tsInstance.getParsedCommandLineOfConfigFile(configFilePath, {}, tsInstance.sys) - : void 0; + // @ts-expect-error TS(2345) FIXME: Argument of type 'System' is not assignable to parameter of type 'ParseConfigFileHost'. + const pcl = configFilePath ? tsInstance.getParsedCommandLineOfConfigFile(configFilePath, {}, tsInstance.sys) : void 0; const fileNames = pcl?.fileNames || config.fileNames; const compilerOptions = Object.assign({}, config.options, options.compilerOptions, { outDir: pcl?.options.outDir }); diff --git a/src/visitor.ts b/src/visitor.ts index d46b849c..c9d5f81f 100755 --- a/src/visitor.ts +++ b/src/visitor.ts @@ -2,13 +2,10 @@ import ts from "typescript"; import { VisitorContext } from "./types"; import { elideImportOrExportDeclaration, resolvePathAndUpdateNode } from "./utils"; -/* ****************************************************************************************************************** * - * Helpers - * ****************************************************************************************************************** */ - const isAsyncImport = ({ tsInstance }: VisitorContext, node: ts.Node): node is ts.CallExpression => tsInstance.isCallExpression(node) && node.expression.kind === tsInstance.SyntaxKind.ImportKeyword && + !!node.arguments[0] && tsInstance.isStringLiteral(node.arguments[0]) && node.arguments.length === 1; @@ -16,13 +13,10 @@ const isRequire = ({ tsInstance }: VisitorContext, node: ts.Node): node is ts.Ca tsInstance.isCallExpression(node) && tsInstance.isIdentifier(node.expression) && node.expression.text === "require" && + !!node.arguments[0] && tsInstance.isStringLiteral(node.arguments[0]) && node.arguments.length === 1; -/* ****************************************************************************************************************** * - * Node Visitor - * ****************************************************************************************************************** */ - /** Visit and replace nodes with module specifiers */ export function nodeVisitor(this: VisitorContext, node: ts.Node): ts.Node | undefined { const { factory, tsInstance, transformationContext } = this; @@ -40,7 +34,8 @@ export function nodeVisitor(this: VisitorContext, node: ts.Node): ts.Node | unde /* Handle comments */ const textNode = node.arguments[0]; - const commentRanges = tsInstance.getLeadingCommentRanges(textNode.getFullText(), 0) || []; + if (!textNode) throw new Error("Expected textNode"); + const commentRanges = tsInstance.getLeadingCommentRanges(textNode.getFullText(), 0) ?? []; for (const range of commentRanges) { const { kind, pos, end, hasTrailingNewLine } = range; diff --git a/test/config.ts b/test/config.ts index 5b081415..51bdc5ea 100755 --- a/test/config.ts +++ b/test/config.ts @@ -1,23 +1,11 @@ import ts from "typescript"; -import tsThree from "typescript-three"; -import tsFourSeven from "typescript-four-seven"; -import path from "path"; - -/* ****************************************************************************************************************** */ -// region: TS Instances -/* ****************************************************************************************************************** */ - -export { ts, tsThree, tsFourSeven }; - -// endregion - -/* ****************************************************************************************************************** */ -// region: Config -/* ****************************************************************************************************************** */ +import tsThree from "typescript-3"; +import tsFourSeven from "typescript-4.7"; +import path from "node:path"; export const tsModules = [ - ["3.6.5", tsThree, "typescript-three"], - ["4.7.4", tsFourSeven, "typescript-four-seven"], + ["3.6.5", tsThree, "typescript-3"], + ["4.7.4", tsFourSeven, "typescript-4.7"], ["Latest", ts, "typescript"], ]; @@ -27,4 +15,4 @@ export const builtTransformerPath = require.resolve("typescript-transform-paths" Error.stackTraceLimit = 120; -// endregion +export { default as ts } from "typescript"; diff --git a/test/jest.config.ts b/test/jest.config.ts index 2204dca4..8e08ee1a 100755 --- a/test/jest.config.ts +++ b/test/jest.config.ts @@ -3,7 +3,7 @@ import type { JestConfigWithTsJest } from "ts-jest"; const config: JestConfigWithTsJest = { testEnvironment: "node", preset: "ts-jest", - testRegex: ".*(test|spec)\\.tsx?$", + testRegex: String.raw`.*(test|spec)\.tsx?$`, moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], }; diff --git a/test/package.json b/test/package.json index dcb76542..86340d79 100755 --- a/test/package.json +++ b/test/package.json @@ -22,8 +22,8 @@ "tsp1": "npm:ts-patch@1.*.*", "tsp2": "npm:ts-patch@2.*.*", "typescript": "^5.5.4", - "typescript-four-seven": "npm:typescript@4.7.4", - "typescript-three": "npm:typescript@3.6.5", + "typescript-3": "npm:typescript@3.6.5", + "typescript-4.7": "npm:typescript@4.7.4", "typescript-transform-paths": "portal:../" }, "workspaces": [ diff --git a/test/prepare.mjs b/test/prepare.mjs index e4574919..9a08fa33 100755 --- a/test/prepare.mjs +++ b/test/prepare.mjs @@ -1,7 +1,7 @@ // @ts-check import { existsSync } from "node:fs"; import { symlink } from "node:fs/promises"; -import { dirname, join, resolve } from "node:path"; +import { dirname, resolve } from "node:path"; import { fileURLToPath } from "node:url"; import { patch } from "ts-patch"; import { patch as patch1 } from "tsp1"; @@ -20,27 +20,17 @@ async function symlinkTsNode() { } function patchTsModules() { - /* ****************************************************************************************************************** * - * Config - * ****************************************************************************************************************** */ const rootDir = __dirname; - const tsDirs = ["typescript-three", "typescript-four-seven", "typescript"]; - /* ****************************************************************************************************************** * - * Patch TS Modules - * ****************************************************************************************************************** */ - const baseDirs = new Map(); - - for (const tsDirName of tsDirs) { - const mainDir = resolve(rootDir, "node_modules", tsDirName); - if (!existsSync(join(mainDir, "lib-backup"))) baseDirs.set(tsDirName, mainDir); + /** @param {string} moduleName */ + function patchTypescript(moduleName, tspatch) { + const basedir = resolve(rootDir, "node_modules", moduleName); + tspatch(["tsc.js", "typescript.js"], { basedir, dir: basedir }); } - // Patch discovered modules - for (const [dirName, dir] of baseDirs) - if (dirName === "typescript-three") patch1(["tsc.js", "typescript.js"], { basedir: dir }); - else if (dirName === "typescript-four-seven") patch2(["tsc.js", "typescript.js"], { dir }); - else patch(["tsc.js", "typescript.js"], { dir }); + patchTypescript("typescript-3", patch1); + patchTypescript("typescript-4.7", patch2); + patchTypescript("typescript", patch); } patchTsModules(); diff --git a/test/projects/nx/nx.json b/test/projects/nx/nx.json index 35d8d9e6..340da909 100644 --- a/test/projects/nx/nx.json +++ b/test/projects/nx/nx.json @@ -1,6 +1,6 @@ { "extends": "@nrwl/workspace/presets/core.json", - "npmScope": "nx", + "npmScope": "project-nx", "affected": { "defaultBase": "main" }, diff --git a/test/projects/nx/package.json b/test/projects/nx/package.json index fcea0faf..2ed81c84 100644 --- a/test/projects/nx/package.json +++ b/test/projects/nx/package.json @@ -1,5 +1,5 @@ { - "name": "nx", + "name": "project-nx", "version": "0.0.0", "scripts": { "build": "nx build library1 --skip-nx-cache" diff --git a/test/tests/extras.test.ts b/test/tests/extras.test.ts index 26e26e6a..58ffb730 100755 --- a/test/tests/extras.test.ts +++ b/test/tests/extras.test.ts @@ -1,9 +1,9 @@ import { createTsProgram, getEmitResultFromProgram, ModuleNotFoundError } from "../utils"; import { projectsPaths } from "../config"; -import path from "path"; +import path from "node:path"; import ts from "typescript"; import * as config from "../config"; -import { execSync } from "child_process"; +import { execSync } from "node:child_process"; /* ****************************************************************************************************************** * * Tests diff --git a/test/tests/nx.test.ts b/test/tests/nx.test.ts index cdfaba1e..a027faea 100644 --- a/test/tests/nx.test.ts +++ b/test/tests/nx.test.ts @@ -17,10 +17,11 @@ describe(`NX Transformer`, () => { describe("Plugin", () => { let mockedTransformer: jest.SpyInstance; - const program: any = { x: 1 }; + const program = { x: 1 }; beforeAll(async () => { - mockedTransformer = jest.spyOn(transformerModule, "default").mockReturnValue((() => {})); + // @ts-expect-error TS(2345) FIXME: Argument of type '() => void' is not assignable to parameter of type '(transformationContext: TransformationContext) => (sourceFile: SourceFile) => SourceFile'. + mockedTransformer = jest.spyOn(transformerModule, "default").mockReturnValue(() => {}); }); afterAll(() => { mockedTransformer.mockClear(); @@ -30,8 +31,9 @@ describe(`NX Transformer`, () => { }); test(`Before properly routes transform`, () => { - const config: any = { a: 2 }; + const config = { a: 2 }; + // @ts-expect-error TS(2559) FIXME: Type '{ a: number; }' has no properties in common with type 'Omit'. nxTransformerPlugin.before(config, program); expect(mockedTransformer).toHaveBeenCalledTimes(1); @@ -43,8 +45,9 @@ describe(`NX Transformer`, () => { }); test(`After properly routes transform`, () => { - const config: any = { a: 2, afterDeclarations: true }; + const config = { a: 2, afterDeclarations: true }; + // @ts-expect-error TS(2345) FIXME: Argument of type '{ x: number; }' is not assignable to parameter of type 'Program'. nxTransformerPlugin.afterDeclarations(config, program); expect(mockedTransformer).toHaveBeenCalledTimes(1); diff --git a/test/tests/project-ref.test.ts b/test/tests/project-ref.test.ts index 656c7fa1..12161702 100755 --- a/test/tests/project-ref.test.ts +++ b/test/tests/project-ref.test.ts @@ -1,5 +1,5 @@ // noinspection ES6UnusedImports -import * as path from "path"; +import * as path from "node:path"; import { createTsSolutionBuilder, EmittedFiles } from "../utils"; import { projectsPaths, ts } from "../config"; diff --git a/test/tests/register.test.ts b/test/tests/register.test.ts index 15842804..356f4f43 100755 --- a/test/tests/register.test.ts +++ b/test/tests/register.test.ts @@ -24,14 +24,16 @@ const configs = { const configMap = Object.entries(configs).map(([label, cfg]) => { let hasBefore: boolean = false; let hasAfterDeclarations: boolean = false; - const transformers = [cfg] - .flat() - .map((c) => { - if ((c).before || !(c).afterDeclarations) hasBefore = true; - if ((c).afterDeclarations) hasAfterDeclarations = true; + const transformers = [ + ...[cfg].flat().map((c) => { + // @ts-expect-error TS(2339) FIXME: Property 'before' does not exist on type '{} | { readonly before: true; } | { readonly afterDeclarations: true; } | {} | { readonly afterDeclarations: true; } | { readonly before: true; } | { readonly afterDeclarations: true; }'. + if (c.before || !c.afterDeclarations) hasBefore = true; + // @ts-expect-error TS(2339) FIXME: Property 'afterDeclarations' does not exist on type '{} | { readonly before: true; } | { readonly afterDeclarations: true; } | {} | { readonly afterDeclarations: true; } | { readonly before: true; } | { readonly afterDeclarations: true; }'. + if (c.afterDeclarations) hasAfterDeclarations = true; return { transform: "typescript-transform-paths", ...c, ...pluginOptions } as PluginConfig; - }) - .concat([otherTransformer]); + }), + otherTransformer, + ] as PluginConfig[]; return { label, transformers, hasBefore, hasAfterDeclarations }; }); @@ -63,9 +65,10 @@ describe(`Register script`, () => { } }); test(`Uses existing ts-node if found`, () => { - const fakeInstance: any = {}; + const fakeInstance: unknown = {}; const originalTsNodeInstance = global.process[instanceSymbol]; + // @ts-expect-error TS(2322) FIXME: Type 'unknown' is not assignable to type 'Service | undefined'. global.process[instanceSymbol] = fakeInstance; let registerSpy: jest.SpyInstance | undefined; try { @@ -128,26 +131,32 @@ describe(`Register script`, () => { "Existing Transformer Config Factory", "No Existing Transformers", ] as const)(`%s`, (configKind) => { - const fakeExistingTransformer = function fakeExistingTransformer(): any {}; - const fakeTransformer = function fakeTransformer(): any {}; + // @ts-expect-error TS(2355) FIXME: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. + const fakeExistingTransformer = function fakeExistingTransformer(): unknown {}; + // @ts-expect-error TS(2355) FIXME: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value. + const fakeTransformer = function fakeTransformer(): unknown {}; const fakeTransformerConfig = { before: [fakeExistingTransformer], after: [fakeExistingTransformer], afterDeclarations: [fakeExistingTransformer], }; const transformerFactoryFn = jest.fn().mockReturnValue(fakeTransformerConfig); - const fakeProgram: any = {}; + const fakeProgram: unknown = {}; let existingTransformers: CustomTransformers | ((p: Program) => CustomTransformers) | undefined; switch (configKind) { - case "Existing Transformer Config Factory": + case "Existing Transformer Config Factory": { existingTransformers = transformerFactoryFn; break; - case "Existing Transformer Config": + } + case "Existing Transformer Config": { + // @ts-expect-error TS(2322) FIXME: Type '{ before: (() => unknown)[]; after: (() => unknown)[]; afterDeclarations: (() => unknown)[]; }' is not assignable to type 'CustomTransformers | ((p: Program) => CustomTransformers) | undefined'. existingTransformers = { ...fakeTransformerConfig }; break; - case "No Existing Transformers": + } + case "No Existing Transformers": { existingTransformers = void 0; + } } describe.each(configMap)(`$label`, ({ transformers, hasBefore, hasAfterDeclarations }) => { @@ -158,6 +167,7 @@ describe(`Register script`, () => { let mergedTransformers: CustomTransformers; beforeAll(() => { + // @ts-expect-error TS(2345) FIXME: Argument of type '() => unknown' is not assignable to parameter of type '(transformationContext: TransformationContext) => (sourceFile: SourceFile) => SourceFile'. mockTransformer = jest.spyOn(transformerModule, "default").mockReturnValue(fakeTransformer); global.process[instanceSymbol] = void 0; @@ -180,7 +190,8 @@ describe(`Register script`, () => { mergedTransformers = typeof registerResult.transformers === "function" - ? registerResult.transformers(fakeProgram) + ? // @ts-expect-error TS(2345) FIXME: Argument of type 'unknown' is not assignable to parameter of type 'Program'. + registerResult.transformers(fakeProgram) : registerResult.transformers!; }); afterAll(() => { diff --git a/test/tests/transformer/general.test.ts b/test/tests/transformer/general.test.ts index 800820fd..3f987961 100755 --- a/test/tests/transformer/general.test.ts +++ b/test/tests/transformer/general.test.ts @@ -1,5 +1,5 @@ // noinspection ES6UnusedImports -import * as path from "path"; +import * as path from "node:path"; import { createTsProgram, EmittedFiles, getEmitResultFromProgram } from "../../utils"; import { ts, tsModules, projectsPaths } from "../../config"; @@ -15,8 +15,8 @@ const makeRelative = (tsInstance: typeof ts, fileName: string, p: string, rootDi const getExpected = (tsInstance: typeof ts, fileName: string, original: string, rootDir: string): string => original - .replace(/"@(.*)"/g, (_, p) => makeRelative(tsInstance, fileName, p, rootDir)) - .replace(/"#utils\/(.*)"/g, (_, p) => + .replaceAll(/"@(.*)"/g, (_, p) => makeRelative(tsInstance, fileName, p, rootDir)) + .replaceAll(/"#utils\/(.*)"/g, (_, p) => makeRelative(tsInstance, fileName, path.join(p === "hello" ? "secondary" : "utils", p), rootDir), ) .replace('"path"', '"https://external.url/path.js"') @@ -50,8 +50,10 @@ describe(`Transformer -> General Tests`, () => { beforeAll(() => { transformed = transformedFiles[file]; expected = { - js: getExpected(tsInstance, file, originalFiles[file].js, projectRoot), - dts: getExpected(tsInstance, file, originalFiles[file].dts, projectRoot), + // @ts-expect-error TS(2345) FIXME: Argument of type 'typeof ts | typeof ts | typeof import("typescript")' is not assignable to parameter of type 'typeof import("typescript")'. + js: getExpected(tsInstance, file, originalFiles[file].js, projectRoot), + // @ts-expect-error TS(2345) FIXME: Argument of type 'typeof ts | typeof ts | typeof import("typescript")' is not assignable to parameter of type 'typeof import("typescript")'. + dts: getExpected(tsInstance, file, originalFiles[file].dts, projectRoot), }; }); diff --git a/test/tests/transformer/specific.test.ts b/test/tests/transformer/specific.test.ts index 47af8ce1..91a3565b 100755 --- a/test/tests/transformer/specific.test.ts +++ b/test/tests/transformer/specific.test.ts @@ -1,5 +1,5 @@ // noinspection ES6UnusedImports -import * as path from "path"; +import * as path from "node:path"; import { createTsProgram, EmittedFiles, @@ -19,7 +19,7 @@ const baseConfig: TsTransformPathsConfig = { exclude: ["**/excluded/**", "exclud /* Test Mapping */ const modes = ["program", "manual", "ts-node"] as const; -const testConfigs: { label: string; tsInstance: any; mode: (typeof modes)[number]; tsSpecifier: string }[] = []; +const testConfigs: { label: string; tsInstance: unknown; mode: (typeof modes)[number]; tsSpecifier: string }[] = []; for (const cfg of tsModules) testConfigs.push(...modes.map((mode) => ({ label: cfg[0], tsInstance: cfg[1], mode, tsSpecifier: cfg[2] }))); @@ -53,6 +53,7 @@ declare global { describe(`Specific Tests`, () => { describe.each(testConfigs)(`TypeScript $label - Mode: $mode`, ({ tsInstance, mode, tsSpecifier }) => { + // @ts-expect-error TS(18046) FIXME: 'tsInstance' is of type 'unknown'. const tsVersion = +tsInstance.versionMajorMinor.split(".").slice(0, 2).join(""); let normalEmit: EmittedFiles; let rootDirsEmit: EmittedFiles; @@ -62,6 +63,7 @@ describe(`Specific Tests`, () => { switch (mode) { case "program": { const program = createTsProgram({ + // @ts-expect-error TS(2322) FIXME: Type 'unknown' is not assignable to type 'typeof import("typescript")'. tsInstance, tsConfigFile, pluginOptions: { @@ -72,6 +74,7 @@ describe(`Specific Tests`, () => { normalEmit = getEmitResultFromProgram(program); const rootDirsProgram = createTsProgram({ + // @ts-expect-error TS(2322) FIXME: Type 'unknown' is not assignable to type 'typeof import("typescript")'. tsInstance, tsConfigFile, pluginOptions: { @@ -84,20 +87,24 @@ describe(`Specific Tests`, () => { } case "manual": { skipDts = true; + // @ts-expect-error TS(18046) FIXME: 'tsInstance' is of type 'unknown'. const pcl = tsInstance.getParsedCommandLineOfConfigFile( tsConfigFile, {}, - tsInstance.sys, + // @ts-expect-error TS(18046) FIXME: 'tsInstance' is of type 'unknown'. + tsInstance.sys, )! as TS.ParsedCommandLine; normalEmit = getManualEmitResult({ ...baseConfig, useRootDirs: false }, tsInstance, pcl); rootDirsEmit = getManualEmitResult({ ...baseConfig, useRootDirs: true }, tsInstance, pcl); break; } case "ts-node": { + // @ts-expect-error TS(18046) FIXME: 'tsInstance' is of type 'unknown'. const pcl = tsInstance.getParsedCommandLineOfConfigFile( tsConfigFile, {}, - tsInstance.sys, + // @ts-expect-error TS(18046) FIXME: 'tsInstance' is of type 'unknown'. + tsInstance.sys, )! as TS.ParsedCommandLine; skipDts = true; normalEmit = getTsNodeEmitResult({ ...baseConfig, useRootDirs: false }, pcl, tsSpecifier); @@ -119,12 +126,12 @@ describe(`Specific Tests`, () => { for (const base of bases) { for (const kind of kinds) { const content = base[fileName][kind]; - const isValid = typeof expected === "string" ? content.indexOf(expected) >= 0 : expected.test(content); + const isValid = typeof expected === "string" ? content.includes(expected) : expected.test(content); if (!isValid) { failed = true; messages.push( `File: ${fileName}\nKind: ${kind}\nrootDirs: ${base === normalEmit}\n\n` + - `Expected: \`${expected}\`\nReceived:\n\t${content.replace(/(\r?\n)+/g, "$1\t")}`, + `Expected: \`${expected}\`\nReceived:\n\t${content.replaceAll(/(\r?\n)+/g, "$1\t")}`, ); } } @@ -204,11 +211,11 @@ describe(`Specific Tests`, () => { /* Unreferenced w/ type-only keyword on import specifier */ expect(typeElisionIndex).not.transformedMatches( - /import { ConstB as ____, type TypeAndConst as TypeAndConst3 } from "\.\/a";\s/, + /import { ConstB as _{4}, type TypeAndConst as TypeAndConst3 } from "\.\/a";\s/, { kind: ["dts"] }, ); - expect(typeElisionIndex).not.transformedMatches(/import { ConstB as ____ } from "\.\/a";\s/, { kind: ["js"] }); + expect(typeElisionIndex).not.transformedMatches(/import { ConstB as _{4} } from "\.\/a";\s/, { kind: ["js"] }); } }); @@ -255,7 +262,7 @@ describe(`Specific Tests`, () => { }; for (const exp of [a, b, c, sub]) { - expect(subPackagesFile).transformedMatches(mode !== "program" ? exp.full : exp.js, { kind: ["js"] }); + expect(subPackagesFile).transformedMatches(mode === "program" ? exp.js : exp.full, { kind: ["js"] }); if (!skipDts) expect(subPackagesFile).transformedMatches(exp.full, { kind: ["dts"] }); } @@ -278,7 +285,7 @@ describe(`Specific Tests`, () => { ); }); - (!skipDts ? test : test.skip)(`Resolves module augmentation`, () => { + (skipDts ? test.skip : test)(`Resolves module augmentation`, () => { expect(moduleAugmentFile).transformedMatches(`declare module "./general" {`, { kind: ["dts"] }); expect(moduleAugmentFile).transformedMatches(`declare module "./excluded-file" {`, { kind: ["dts"] }); }); diff --git a/test/utils/helpers.ts b/test/utils/helpers.ts index d6ef815a..8f57e392 100755 --- a/test/utils/helpers.ts +++ b/test/utils/helpers.ts @@ -1,5 +1,5 @@ import { default as tstpTransform, TsTransformPathsConfig } from "typescript-transform-paths"; -import fs from "fs"; +import fs from "node:fs"; import ts from "typescript"; import * as tsNode from "ts-node"; import * as config from "../config"; @@ -36,7 +36,7 @@ function createWriteFile(outputFiles: EmittedFiles) { if (!ext) return; rootName = `${rootName}.ts`; const key = ext.replace(".", "") as keyof EmittedFiles[string]; - if (!outputFiles[rootName]) outputFiles[rootName] = {}; + outputFiles[rootName] ??= {} as EmittedFiles[string]; outputFiles[rootName][key] = data; }; } @@ -94,27 +94,28 @@ export function createTsProgram( let host: ts.CompilerHost | undefined; if (opt.tsConfigFile) { - const pcl = tsInstance.getParsedCommandLineOfConfigFile(opt.tsConfigFile, extendOptions, tsInstance.sys)!; + // @ts-expect-error TS(2345) FIXME: Argument of type 'System' is not assignable to parameter of type 'ParseConfigFileHost'. + const pcl = tsInstance.getParsedCommandLineOfConfigFile(opt.tsConfigFile, extendOptions, tsInstance.sys)!; compilerOptions = pcl.options; fileNames = pcl.fileNames; } else { - const files = Object.entries(compilerOptions.files!).reduce( - (p, [fileName, data]) => { - p[tsInstance.normalizePath(fileName)] = data; - return p; - }, - {}, - ); + const files = Object.entries(compilerOptions.files!).reduce((p, [fileName, data]) => { + // @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. + p[tsInstance.normalizePath(fileName)] = data; + return p; + }, {}); fileNames = Object.keys(files); host = tsInstance.createCompilerHost(compilerOptions); compilerOptions = extendOptions; /* Patch host to feed mock files */ - const originalGetSourceFile: any = host.getSourceFile; + const originalGetSourceFile: unknown = host.getSourceFile; host.getSourceFile = function (fileName: string, scriptTarget: ts.ScriptTarget, ...rest) { if (Object.keys(files).includes(fileName)) + // @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. return tsInstance.createSourceFile(fileName, files[fileName], scriptTarget); + // @ts-expect-error TS(18046) FIXME: 'originalGetSourceFile' is of type 'unknown'. else originalGetSourceFile(fileName, scriptTarget, ...rest); }; } @@ -153,22 +154,34 @@ export function getEmitResultFromProgram(program: ts.Program): EmittedFiles { return outputFiles; } -export function getManualEmitResult(pluginConfig: TsTransformPathsConfig, tsInstance: any, pcl: ts.ParsedCommandLine) { +export function getManualEmitResult( + pluginConfig: TsTransformPathsConfig, + tsInstance: unknown, + pcl: ts.ParsedCommandLine, +) { const { options: compilerOptions, fileNames } = pcl; - const transformer = tstpTransform(void 0, pluginConfig, { ts: tsInstance } as any, { compilerOptions, fileNames }); + // @ts-expect-error TS(2345) FIXME: Argument of type 'unknown' is not assignable to parameter of type 'TransformerExtras | undefined'. + const transformer = tstpTransform(void 0, pluginConfig, { ts: tsInstance } as unknown, { + compilerOptions, + fileNames, + }); + // @ts-expect-error TS(18046) FIXME: 'tsInstance' is of type 'unknown'. const { transformed } = tsInstance.transform( fileNames.map((f) => + // @ts-expect-error TS(18046) FIXME: 'tsInstance' is of type 'unknown'. tsInstance.createSourceFile(f, fs.readFileSync(f, "utf8"), tsInstance.ScriptTarget.ESNext, true), ), [transformer], compilerOptions, ); + // @ts-expect-error TS(18046) FIXME: 'tsInstance' is of type 'unknown'. const printer = tsInstance.createPrinter(); const res: EmittedFiles = {}; - for (const sourceFile of transformed) res[sourceFile.fileName] = { js: printer.printFile(sourceFile) }; + // @ts-expect-error TS(2322) FIXME: Type 'unknown' is not assignable to type '{ js: string; dts: string; }'. + for (const sourceFile of transformed) res[sourceFile.fileName] = { js: printer.printFile(sourceFile) }; return res; } @@ -181,8 +194,9 @@ export function getTsNodeEmitResult( const compiler = tsNode.create({ transpileOnly: true, transformers: { + // @ts-expect-error TS(2345) FIXME: Argument of type 'unknown' is not assignable to parameter of type 'TransformerExtras | undefined'. // eslint-disable-next-line @typescript-eslint/no-require-imports - before: [tstpTransform(void 0, pluginConfig, { ts: require(tsSpecifier) })], + before: [tstpTransform(void 0, pluginConfig, { ts: require(tsSpecifier) })], }, project: pcl.options.configFilePath, compiler: tsSpecifier, @@ -194,8 +208,10 @@ export function getTsNodeEmitResult( global.process[tsNode.REGISTER_INSTANCE] = compiler; try { const res: EmittedFiles = {}; - for (const fileName of pcl.fileNames.filter((f) => !/\.d\.ts$/.test(f))) - res[fileName] = { js: compiler.compile(fs.readFileSync(fileName, "utf8"), fileName) }; + for (const fileName of pcl.fileNames.filter((f) => !/\.d\.ts$/.test(f))) { + // @ts-expect-error TS(2322) FIXME: Type 'unknown' is not assignable to type '{ js: string; dts: string; }'. + res[fileName] = { js: compiler.compile(fs.readFileSync(fileName, "utf8"), fileName) }; + } return res; } finally { diff --git a/test/yarn.lock b/test/yarn.lock index 552e3e6e..392ca813 100644 --- a/test/yarn.lock +++ b/test/yarn.lock @@ -2296,27 +2296,7 @@ __metadata: languageName: node linkType: hard -"@types/eslint-scope@npm:^3.7.3": - version: 3.7.7 - resolution: "@types/eslint-scope@npm:3.7.7" - dependencies: - "@types/eslint": "npm:*" - "@types/estree": "npm:*" - checksum: 10c0/a0ecbdf2f03912679440550817ff77ef39a30fa8bfdacaf6372b88b1f931828aec392f52283240f0d648cf3055c5ddc564544a626bcf245f3d09fcb099ebe3cc - languageName: node - linkType: hard - -"@types/eslint@npm:*": - version: 9.6.0 - resolution: "@types/eslint@npm:9.6.0" - dependencies: - "@types/estree": "npm:*" - "@types/json-schema": "npm:*" - checksum: 10c0/69301356bc73b85e381ae00931291de2e96d1cc49a112c592c74ee32b2f85412203dea6a333b4315fd9839bb14f364f265cbfe7743fc5a78492ee0326dd6a2c1 - languageName: node - linkType: hard - -"@types/estree@npm:*, @types/estree@npm:^1.0.5": +"@types/estree@npm:^1.0.5": version: 1.0.5 resolution: "@types/estree@npm:1.0.5" checksum: 10c0/b3b0e334288ddb407c7b3357ca67dbee75ee22db242ca7c56fe27db4e1a31989cb8af48a84dd401deb787fe10cc6b2ab1ee82dc4783be87ededbe3d53c79c70d @@ -2407,7 +2387,7 @@ __metadata: languageName: node linkType: hard -"@types/json-schema@npm:*, @types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9": +"@types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9": version: 7.0.15 resolution: "@types/json-schema@npm:7.0.15" checksum: 10c0/a996a745e6c5d60292f36731dd41341339d4eeed8180bb09226e5c8d23759067692b1d88e5d91d72ee83dfc00d3aca8e7bd43ea120516c17922cbcb7c3e252db @@ -4309,7 +4289,7 @@ __metadata: languageName: node linkType: hard -"enhanced-resolve@npm:^5.0.0, enhanced-resolve@npm:^5.17.0, enhanced-resolve@npm:^5.7.0": +"enhanced-resolve@npm:^5.0.0, enhanced-resolve@npm:^5.17.1, enhanced-resolve@npm:^5.7.0": version: 5.17.1 resolution: "enhanced-resolve@npm:5.17.1" dependencies: @@ -6599,15 +6579,6 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^10.0.1": - version: 10.0.1 - resolution: "minimatch@npm:10.0.1" - dependencies: - brace-expansion: "npm:^2.0.1" - checksum: 10c0/e6c29a81fe83e1877ad51348306be2e8aeca18c88fdee7a99df44322314279e15799e41d7cb274e4e8bb0b451a3bc622d6182e157dfa1717d6cda75e9cd8cd5d - languageName: node - linkType: hard - "minimatch@npm:^3.0.4, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2": version: 3.1.2 resolution: "minimatch@npm:3.1.2" @@ -6626,7 +6597,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.4": +"minimatch@npm:^9.0.4, minimatch@npm:^9.0.5": version: 9.0.5 resolution: "minimatch@npm:9.0.5" dependencies: @@ -7009,12 +6980,6 @@ __metadata: languageName: node linkType: hard -"nx@workspace:projects/nx": - version: 0.0.0-use.local - resolution: "nx@workspace:projects/nx" - languageName: unknown - linkType: soft - "object-inspect@npm:^1.13.1": version: 1.13.2 resolution: "object-inspect@npm:1.13.2" @@ -7735,6 +7700,12 @@ __metadata: languageName: node linkType: hard +"project-nx@workspace:projects/nx": + version: 0.0.0-use.local + resolution: "project-nx@workspace:projects/nx" + languageName: unknown + linkType: soft + "promise-retry@npm:^2.0.1": version: 2.0.1 resolution: "promise-retry@npm:2.0.1" @@ -8099,8 +8070,8 @@ __metadata: tsp1: "npm:ts-patch@1.*.*" tsp2: "npm:ts-patch@2.*.*" typescript: "npm:^5.5.4" - typescript-four-seven: "npm:typescript@4.7.4" - typescript-three: "npm:typescript@3.6.5" + typescript-3: "npm:typescript@3.6.5" + typescript-4.7: "npm:typescript@4.7.4" typescript-transform-paths: "portal:../" languageName: unknown linkType: soft @@ -9239,23 +9210,23 @@ __metadata: languageName: node linkType: hard -"typescript-four-seven@npm:typescript@4.7.4": - version: 4.7.4 - resolution: "typescript@npm:4.7.4" +"typescript-3@npm:typescript@3.6.5": + version: 3.6.5 + resolution: "typescript@npm:3.6.5" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10c0/8c1c4007b6ce5b24c49f0e89173ab9e82687cc6ae54418d1140bb63b82d6598d085ac0f993fe3d3d1fbf87a2c76f1f81d394dc76315bc72c7a9f8561c5d8d205 + checksum: 10c0/b6f0d5d2e2325b28460b8cf3a4a1237d79aec9951ad727014d4ca570327cc5947decec5d262044979cc0a9ab63746b58e6d8438d73d33ce8415e5369d0490dff languageName: node linkType: hard -"typescript-three@npm:typescript@3.6.5": - version: 3.6.5 - resolution: "typescript@npm:3.6.5" +"typescript-4.7@npm:typescript@4.7.4": + version: 4.7.4 + resolution: "typescript@npm:4.7.4" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10c0/b6f0d5d2e2325b28460b8cf3a4a1237d79aec9951ad727014d4ca570327cc5947decec5d262044979cc0a9ab63746b58e6d8438d73d33ce8415e5369d0490dff + checksum: 10c0/8c1c4007b6ce5b24c49f0e89173ab9e82687cc6ae54418d1140bb63b82d6598d085ac0f993fe3d3d1fbf87a2c76f1f81d394dc76315bc72c7a9f8561c5d8d205 languageName: node linkType: hard @@ -9263,7 +9234,7 @@ __metadata: version: 0.0.0-use.local resolution: "typescript-transform-paths@portal:../::locator=root-workspace-0b6124%40workspace%3A." dependencies: - minimatch: "npm:^10.0.1" + minimatch: "npm:^9.0.5" peerDependencies: typescript: ">=3.6.5" languageName: node @@ -9557,10 +9528,9 @@ __metadata: linkType: hard "webpack@npm:^5.75.0": - version: 5.93.0 - resolution: "webpack@npm:5.93.0" + version: 5.94.0 + resolution: "webpack@npm:5.94.0" dependencies: - "@types/eslint-scope": "npm:^3.7.3" "@types/estree": "npm:^1.0.5" "@webassemblyjs/ast": "npm:^1.12.1" "@webassemblyjs/wasm-edit": "npm:^1.12.1" @@ -9569,7 +9539,7 @@ __metadata: acorn-import-attributes: "npm:^1.9.5" browserslist: "npm:^4.21.10" chrome-trace-event: "npm:^1.0.2" - enhanced-resolve: "npm:^5.17.0" + enhanced-resolve: "npm:^5.17.1" es-module-lexer: "npm:^1.2.1" eslint-scope: "npm:5.1.1" events: "npm:^3.2.0" @@ -9589,7 +9559,7 @@ __metadata: optional: true bin: webpack: bin/webpack.js - checksum: 10c0/f0c72f1325ff57a4cc461bb978e6e1296f2a7d45c9765965271aa686ccdd448512956f4d7fdcf8c164d073af046c5a0aba17ce85ea98e33e5e2bfbfe13aa5808 + checksum: 10c0/b4d1b751f634079bd177a89eef84d80fa5bb8d6fc15d72ab40fc2b9ca5167a79b56585e1a849e9e27e259803ee5c4365cb719e54af70a43c06358ec268ff4ebf languageName: node linkType: hard diff --git a/tsconfig.json b/tsconfig.json index f041ef40..e338950a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,13 @@ { - "extends": "@tsconfig/node18", + "extends": ["@tsconfig/strictest", "@tsconfig/node18"], "include": ["src"], "exclude": ["src/declarations"], "compilerOptions": { "rootDir": "src", "outDir": "dist", "declaration": true, - "sourceMap": true + "sourceMap": true, + // less strict + "exactOptionalPropertyTypes": false } } diff --git a/yarn.lock b/yarn.lock index 6c62a9e9..c20b8d3e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -60,13 +60,20 @@ __metadata: languageName: node linkType: hard -"@eslint/js@npm:9.9.0, @eslint/js@npm:^9.8.0": +"@eslint/js@npm:9.9.0": version: 9.9.0 resolution: "@eslint/js@npm:9.9.0" checksum: 10c0/6ec9f1f0d576132444d6a5c66a8a08b0be9444e3ebb563fa6a6bebcf5299df3da7e454dc04c0fa601bb811197f00764b3a04430d8458cdb8e3a4677993d23f30 languageName: node linkType: hard +"@eslint/js@npm:^9.9.1": + version: 9.9.1 + resolution: "@eslint/js@npm:9.9.1" + checksum: 10c0/a3a91de2ce78469f7c4eee78c1eba77360706e1d0fa0ace2e19102079bcf237b851217c85ea501dc92c4c3719d60d9df966977abc8554d4c38e3638c1f53dcb2 + languageName: node + linkType: hard + "@eslint/object-schema@npm:^2.1.4": version: 2.1.4 resolution: "@eslint/object-schema@npm:2.1.4" @@ -217,6 +224,13 @@ __metadata: languageName: node linkType: hard +"@tsconfig/strictest@npm:^2.0.5": + version: 2.0.5 + resolution: "@tsconfig/strictest@npm:2.0.5" + checksum: 10c0/cfc86da2d57f7b4b0827701b132c37a4974284e5c40649656c0e474866dfd8a69f57c6718230d8a8139967e2a95438586b8224c13ab0ff9d3a43eda771c50cc4 + languageName: node + linkType: hard + "@types/debug@npm:^4.0.0": version: 4.1.12 resolution: "@types/debug@npm:4.1.12" @@ -273,12 +287,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^22.2.0": - version: 22.2.0 - resolution: "@types/node@npm:22.2.0" +"@types/node@npm:^22.5.2": + version: 22.5.2 + resolution: "@types/node@npm:22.5.2" dependencies: - undici-types: "npm:~6.13.0" - checksum: 10c0/c17900b34faecfec204f72970bd658d0c217aaf739c1bf7690c969465b6b26b77a8be1cd9ba735aadbd1dd20b5c3e4f406ec33528bf7c6eec90744886c5d5608 + undici-types: "npm:~6.19.2" + checksum: 10c0/624a7fd76229eacc6c158eb3b9afd55b811d7f01976c5f92c630d5b9d47047cc218928c343988484a165ac400e5eb6fe70ea300fc7242deeb0e920c7724290f6 languageName: node linkType: hard @@ -354,15 +368,15 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:8.1.0": - version: 8.1.0 - resolution: "@typescript-eslint/eslint-plugin@npm:8.1.0" +"@typescript-eslint/eslint-plugin@npm:8.3.0": + version: 8.3.0 + resolution: "@typescript-eslint/eslint-plugin@npm:8.3.0" dependencies: "@eslint-community/regexpp": "npm:^4.10.0" - "@typescript-eslint/scope-manager": "npm:8.1.0" - "@typescript-eslint/type-utils": "npm:8.1.0" - "@typescript-eslint/utils": "npm:8.1.0" - "@typescript-eslint/visitor-keys": "npm:8.1.0" + "@typescript-eslint/scope-manager": "npm:8.3.0" + "@typescript-eslint/type-utils": "npm:8.3.0" + "@typescript-eslint/utils": "npm:8.3.0" + "@typescript-eslint/visitor-keys": "npm:8.3.0" graphemer: "npm:^1.4.0" ignore: "npm:^5.3.1" natural-compare: "npm:^1.4.0" @@ -373,68 +387,68 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10c0/7bbeae588f859b59c34d6a76cac06ef0fa605921b40c5d3b65b94829984280ea84c4dd3f5cb9ce2eb326f5563e9abb4c90ebff05c47f83f4def296c2ea1fa86c + checksum: 10c0/d5242b16b8602ab5817cf04b35ac7208b6bee530730eeed6eab886667d1f2c5fac1537b3e33c453393090a1c6fcd50f727c07f5168985a00e7d23d1f99576988 languageName: node linkType: hard -"@typescript-eslint/parser@npm:8.1.0": - version: 8.1.0 - resolution: "@typescript-eslint/parser@npm:8.1.0" +"@typescript-eslint/parser@npm:8.3.0": + version: 8.3.0 + resolution: "@typescript-eslint/parser@npm:8.3.0" dependencies: - "@typescript-eslint/scope-manager": "npm:8.1.0" - "@typescript-eslint/types": "npm:8.1.0" - "@typescript-eslint/typescript-estree": "npm:8.1.0" - "@typescript-eslint/visitor-keys": "npm:8.1.0" + "@typescript-eslint/scope-manager": "npm:8.3.0" + "@typescript-eslint/types": "npm:8.3.0" + "@typescript-eslint/typescript-estree": "npm:8.3.0" + "@typescript-eslint/visitor-keys": "npm:8.3.0" debug: "npm:^4.3.4" peerDependencies: eslint: ^8.57.0 || ^9.0.0 peerDependenciesMeta: typescript: optional: true - checksum: 10c0/b94b2d3ab5ca505484d100701fad6a04a5dc8d595029bac1b9f5b8a4a91d80fd605b0f65d230b36a97ab7e5d55eeb0c28af2ab63929a3e4ab8fdefd2a548c36b + checksum: 10c0/8185e7f1f570cded8719cfb1e8147fcbbc5b8796de628d68024d2929ce6fb02d1f6101b741161229e877be1c30c720701e1e1f7c4313dba33d4bb1190a85f705 languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:8.1.0": - version: 8.1.0 - resolution: "@typescript-eslint/scope-manager@npm:8.1.0" +"@typescript-eslint/scope-manager@npm:8.3.0": + version: 8.3.0 + resolution: "@typescript-eslint/scope-manager@npm:8.3.0" dependencies: - "@typescript-eslint/types": "npm:8.1.0" - "@typescript-eslint/visitor-keys": "npm:8.1.0" - checksum: 10c0/2bcf8cd176a1819bddcae16c572e7da8fba821b995a91cd53d64d8d6b85a17f5a895522f281ba57e34929574bddd4d6684ee3e545ec4e8096be4c3198e253a9a + "@typescript-eslint/types": "npm:8.3.0" + "@typescript-eslint/visitor-keys": "npm:8.3.0" + checksum: 10c0/24d093505d444a07db88f9ab44af04eb738ce523ac3f98b0a641cf3a3ee38d18aff9f72bbf2b2e2d9f45e57c973f31016f1e224cd8ab773f6e7c3477c5a09ad3 languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:8.1.0": - version: 8.1.0 - resolution: "@typescript-eslint/type-utils@npm:8.1.0" +"@typescript-eslint/type-utils@npm:8.3.0": + version: 8.3.0 + resolution: "@typescript-eslint/type-utils@npm:8.3.0" dependencies: - "@typescript-eslint/typescript-estree": "npm:8.1.0" - "@typescript-eslint/utils": "npm:8.1.0" + "@typescript-eslint/typescript-estree": "npm:8.3.0" + "@typescript-eslint/utils": "npm:8.3.0" debug: "npm:^4.3.4" ts-api-utils: "npm:^1.3.0" peerDependenciesMeta: typescript: optional: true - checksum: 10c0/62753941c4136e8d2daa72fe0410dea48e5317a6f12ece6382ca85e29912bd1b3f739b61d1060fc0a1f8c488dfc905beab4c8b8497951a21c3138a659c7271ec + checksum: 10c0/0e4b42ff2bfcd1727893bb7fe5fcf1aa808b45b5f690c249c68ce7aff68ddfba3d8b1565de2f08972915df23fa7ab114c09f507668e9b0b63faf1e34a5091706 languageName: node linkType: hard -"@typescript-eslint/types@npm:8.1.0": - version: 8.1.0 - resolution: "@typescript-eslint/types@npm:8.1.0" - checksum: 10c0/ceade44455f45974e68956016c4d1c6626580732f7f9675e14ffa63db80b551752b0df596b20473dae9f0dc6ed966e17417dc2cf36e1a82b6ab0edc97c5eaa50 +"@typescript-eslint/types@npm:8.3.0": + version: 8.3.0 + resolution: "@typescript-eslint/types@npm:8.3.0" + checksum: 10c0/5cd733af7ffa0cdaa5842f6c5e275b3a5c9b98dc49bf1bb9df1f0b51d346bef2a10a827d886f60492d502218a272e935cef50b4f7c69100217d5b10a2499c7b1 languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:8.1.0": - version: 8.1.0 - resolution: "@typescript-eslint/typescript-estree@npm:8.1.0" +"@typescript-eslint/typescript-estree@npm:8.3.0": + version: 8.3.0 + resolution: "@typescript-eslint/typescript-estree@npm:8.3.0" dependencies: - "@typescript-eslint/types": "npm:8.1.0" - "@typescript-eslint/visitor-keys": "npm:8.1.0" + "@typescript-eslint/types": "npm:8.3.0" + "@typescript-eslint/visitor-keys": "npm:8.3.0" debug: "npm:^4.3.4" - globby: "npm:^11.1.0" + fast-glob: "npm:^3.3.2" is-glob: "npm:^4.0.3" minimatch: "npm:^9.0.4" semver: "npm:^7.6.0" @@ -442,31 +456,31 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10c0/a7bc8275df1c79c4cb14ef086c56674316dd4907efec53eddca35d0b5220428b69c82178ce2d95138da2e398269c8bd0764cae8020a36417e411e35c3c47bc4b + checksum: 10c0/dd73aa1a9d7b5c7e6238e766e6ecdb6d87a9b28a24815258b7bbdc59c49fb525d3fe15d9b7c672e2220678f9d5fabdd9615e4cd5ee97a102fd46023ec0735d50 languageName: node linkType: hard -"@typescript-eslint/utils@npm:8.1.0": - version: 8.1.0 - resolution: "@typescript-eslint/utils@npm:8.1.0" +"@typescript-eslint/utils@npm:8.3.0": + version: 8.3.0 + resolution: "@typescript-eslint/utils@npm:8.3.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.4.0" - "@typescript-eslint/scope-manager": "npm:8.1.0" - "@typescript-eslint/types": "npm:8.1.0" - "@typescript-eslint/typescript-estree": "npm:8.1.0" + "@typescript-eslint/scope-manager": "npm:8.3.0" + "@typescript-eslint/types": "npm:8.3.0" + "@typescript-eslint/typescript-estree": "npm:8.3.0" peerDependencies: eslint: ^8.57.0 || ^9.0.0 - checksum: 10c0/c95503a6bdcd98b1ff04d1adbf46377b2036b1c510d90a4a056401f996f775f06c3108c95fb81cd6babc9c97b73b91b8e848f0337bc508de8a49c993582f0e75 + checksum: 10c0/e4e9e820cf4b4775bb66b2293a2a827897edaba88577b63df317b50752a01d542be521cc4842976fbbd93e08b9e273ce9d20e23768d06de68a83d68cc0f68a93 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:8.1.0": - version: 8.1.0 - resolution: "@typescript-eslint/visitor-keys@npm:8.1.0" +"@typescript-eslint/visitor-keys@npm:8.3.0": + version: 8.3.0 + resolution: "@typescript-eslint/visitor-keys@npm:8.3.0" dependencies: - "@typescript-eslint/types": "npm:8.1.0" + "@typescript-eslint/types": "npm:8.3.0" eslint-visitor-keys: "npm:^3.4.3" - checksum: 10c0/b7544dbb0eec1ddbfcd95c04b51b9a739c2e768c16d1c88508f976a2b0d1bc02fefb7491930e06e48073a5c07c6f488cd8403bba3a8b918888b93a88d5ac3869 + checksum: 10c0/4c19216636f2cc25026fe20d2832d857f05c262eba78bc4159121c696199e44cac68443565959f9336372f7686a14b452867300cf4deb3c0507b8dbde88ac0e6 languageName: node linkType: hard @@ -589,13 +603,6 @@ __metadata: languageName: node linkType: hard -"array-union@npm:^2.1.0": - version: 2.1.0 - resolution: "array-union@npm:2.1.0" - checksum: 10c0/429897e68110374f39b771ec47a7161fc6a8fc33e196857c0a396dc75df0b5f65e4d046674db764330b6bb66b39ef48dd7c53b6a2ee75cfb0681e0c1a7033962 - languageName: node - linkType: hard - "balanced-match@npm:^1.0.0": version: 1.0.2 resolution: "balanced-match@npm:1.0.2" @@ -976,15 +983,6 @@ __metadata: languageName: node linkType: hard -"dir-glob@npm:^3.0.1": - version: 3.0.1 - resolution: "dir-glob@npm:3.0.1" - dependencies: - path-type: "npm:^4.0.0" - checksum: 10c0/dcac00920a4d503e38bb64001acb19df4efc14536ada475725e12f52c16777afdee4db827f55f13a908ee7efc0cb282e2e3dbaeeb98c0993dd93d1802d3bf00c - languageName: node - linkType: hard - "dotenv@npm:^16.4.5": version: 16.4.5 resolution: "dotenv@npm:16.4.5" @@ -1224,7 +1222,7 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:^3.2.9": +"fast-glob@npm:^3.3.2": version: 3.3.2 resolution: "fast-glob@npm:3.3.2" dependencies: @@ -1450,20 +1448,6 @@ __metadata: languageName: node linkType: hard -"globby@npm:^11.1.0": - version: 11.1.0 - resolution: "globby@npm:11.1.0" - dependencies: - array-union: "npm:^2.1.0" - dir-glob: "npm:^3.0.1" - fast-glob: "npm:^3.2.9" - ignore: "npm:^5.2.0" - merge2: "npm:^1.4.1" - slash: "npm:^3.0.0" - checksum: 10c0/b39511b4afe4bd8a7aead3a27c4ade2b9968649abab0a6c28b1a90141b96ca68ca5db1302f7c7bd29eab66bf51e13916b8e0a3d0ac08f75e1e84a39b35691189 - languageName: node - linkType: hard - "graceful-fs@npm:^4.2.6": version: 4.2.11 resolution: "graceful-fs@npm:4.2.11" @@ -1900,7 +1884,7 @@ __metadata: languageName: node linkType: hard -"merge2@npm:^1.3.0, merge2@npm:^1.4.1": +"merge2@npm:^1.3.0": version: 1.4.1 resolution: "merge2@npm:1.4.1" checksum: 10c0/254a8a4605b58f450308fc474c82ac9a094848081bf4c06778200207820e5193726dc563a0d2c16468810516a5c97d9d3ea0ca6585d23c58ccfff2403e8dbbeb @@ -2167,15 +2151,6 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^10.0.1": - version: 10.0.1 - resolution: "minimatch@npm:10.0.1" - dependencies: - brace-expansion: "npm:^2.0.1" - checksum: 10c0/e6c29a81fe83e1877ad51348306be2e8aeca18c88fdee7a99df44322314279e15799e41d7cb274e4e8bb0b451a3bc622d6182e157dfa1717d6cda75e9cd8cd5d - languageName: node - linkType: hard - "minimatch@npm:^3.1.2": version: 3.1.2 resolution: "minimatch@npm:3.1.2" @@ -2185,7 +2160,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.4": +"minimatch@npm:^9.0.4, minimatch@npm:^9.0.5": version: 9.0.5 resolution: "minimatch@npm:9.0.5" dependencies: @@ -2556,13 +2531,6 @@ __metadata: languageName: node linkType: hard -"path-type@npm:^4.0.0": - version: 4.0.0 - resolution: "path-type@npm:4.0.0" - checksum: 10c0/666f6973f332f27581371efaf303fd6c272cc43c2057b37aa99e3643158c7e4b2626549555d88626e99ea9e046f82f32e41bbde5f1508547e9a11b149b52387c - languageName: node - linkType: hard - "pathe@npm:^1.1.1, pathe@npm:^1.1.2": version: 1.1.2 resolution: "pathe@npm:1.1.2" @@ -2792,13 +2760,6 @@ __metadata: languageName: node linkType: hard -"slash@npm:^3.0.0": - version: 3.0.0 - resolution: "slash@npm:3.0.0" - checksum: 10c0/e18488c6a42bdfd4ac5be85b2ced3ccd0224773baae6ad42cfbb9ec74fc07f9fa8396bd35ee638084ead7a2a0818eb5e7151111544d4731ce843019dab4be47b - languageName: node - linkType: hard - "smart-buffer@npm:^4.2.0": version: 4.2.0 resolution: "smart-buffer@npm:4.2.0" @@ -2999,17 +2960,17 @@ __metadata: languageName: node linkType: hard -"typescript-eslint@npm:^8.0.1": - version: 8.1.0 - resolution: "typescript-eslint@npm:8.1.0" +"typescript-eslint@npm:^8.3.0": + version: 8.3.0 + resolution: "typescript-eslint@npm:8.3.0" dependencies: - "@typescript-eslint/eslint-plugin": "npm:8.1.0" - "@typescript-eslint/parser": "npm:8.1.0" - "@typescript-eslint/utils": "npm:8.1.0" + "@typescript-eslint/eslint-plugin": "npm:8.3.0" + "@typescript-eslint/parser": "npm:8.3.0" + "@typescript-eslint/utils": "npm:8.3.0" peerDependenciesMeta: typescript: optional: true - checksum: 10c0/9b5769b95aeca54ae9fa15cd2f0e5656747f643a7be220513555de143ff19d70c5945eb82259a3fb29ab4d37f4d158f7f088e7b2cf98e2e8253a7429ac19d072 + checksum: 10c0/90134b4b601d6fa582a95c9bee23c254f6ac2ca38aed07986d0a3bb75e1ddfdceeb9650c8647b34148696115d5fe0ce281413e4a8ec001e1e928356242a1756d languageName: node linkType: hard @@ -3017,11 +2978,12 @@ __metadata: version: 0.0.0-use.local resolution: "typescript-transform-paths@workspace:." dependencies: - "@eslint/js": "npm:^9.8.0" + "@eslint/js": "npm:^9.9.1" "@tsconfig/node18": "npm:^18.2.4" + "@tsconfig/strictest": "npm:^2.0.5" "@types/eslint": "npm:^9" "@types/minimatch": "npm:^5.1.2" - "@types/node": "npm:^22.2.0" + "@types/node": "npm:^22.5.2" "@types/ts-expose-internals": "npm:ts-expose-internals@4.9.5" "@types/ts-node": "npm:ts-node@^10.9.2" "@types/typescript-3": "npm:typescript@3.x" @@ -3029,12 +2991,12 @@ __metadata: changelogen: "npm:^0.5.5" eslint: "npm:9.x" globals: "npm:^15.9.0" - minimatch: "npm:^10.0.1" + minimatch: "npm:^9.0.5" prettier: "npm:^3.3.3" prettier-plugin-jsdoc: "npm:^1.3.0" ts-patch: "npm:^3.2.1" typescript: "npm:^5.5.4" - typescript-eslint: "npm:^8.0.1" + typescript-eslint: "npm:^8.3.0" peerDependencies: typescript: ">=3.6.5" languageName: unknown @@ -3067,10 +3029,10 @@ __metadata: languageName: node linkType: hard -"undici-types@npm:~6.13.0": - version: 6.13.0 - resolution: "undici-types@npm:6.13.0" - checksum: 10c0/2de55181f569c77a4f08063f8bf2722fcbb6ea312a26a9e927bd1f5ea5cf3a281c5ddf23155061db083e0a25838f54813543ff13b0ac34d230d5c1205ead66c1 +"undici-types@npm:~6.19.2": + version: 6.19.8 + resolution: "undici-types@npm:6.19.8" + checksum: 10c0/078afa5990fba110f6824823ace86073b4638f1d5112ee26e790155f481f2a868cc3e0615505b6f4282bdf74a3d8caad715fd809e870c2bb0704e3ea6082f344 languageName: node linkType: hard