Skip to content

Commit

Permalink
chore!: remove typescript 4.7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpza committed Dec 22, 2024
1 parent 9917058 commit d69d010
Show file tree
Hide file tree
Showing 14 changed files with 6 additions and 250 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"@types/node": "^22.5.2",
"@types/ts-expose-internals": "npm:[email protected]",
"@types/ts-node": "npm:ts-node@^10.9.2",
"@types/typescript-4.7": "npm:[email protected]",
"changelogen": "^0.5.5",
"eslint": "9.x",
"globals": "^15.9.0",
Expand All @@ -77,7 +76,7 @@
"typescript-eslint": "^8.3.0"
},
"peerDependencies": {
"typescript": ">=4"
"typescript": ">=5"
},
"dependencies": {
"minimatch": "^9.0.5"
Expand Down
31 changes: 0 additions & 31 deletions src/harmony/harmony-factory.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/harmony/index.ts

This file was deleted.

20 changes: 0 additions & 20 deletions src/harmony/utils.ts

This file was deleted.

125 changes: 0 additions & 125 deletions src/harmony/versions/four-seven.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/harmony/versions/index.ts

This file was deleted.

3 changes: 1 addition & 2 deletions src/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import path from "node:path";
import ts, { CompilerOptions } from "typescript";
import { RunMode, TsNodeState, TsTransformPathsConfig, TsTransformPathsContext, VisitorContext } from "./types";
import { nodeVisitor } from "./visitor";
import { createHarmonyFactory } from "./harmony";
import { Minimatch } from "minimatch";
import { createSyntheticEmitHost, getTsNodeRegistrationProperties } from "./utils/ts-helpers";
import { TransformerExtras } from "ts-patch";
Expand Down Expand Up @@ -139,7 +138,7 @@ export default function transformer(
getVisitor() {
return nodeVisitor.bind(this);
},
factory: createHarmonyFactory(tsTransformPathsContext),
factory: (tsTransformPathsContext.tsFactory ?? tsTransformPathsContext.tsInstance) as ts.NodeFactory,
};

return tsInstance.visitEachChild(sourceFile, visitorContext.getVisitor(), transformationContext);
Expand Down
4 changes: 1 addition & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import ts, { CompilerOptions, EmitHost, Pattern, SourceFile } from "typescript";
import { PluginConfig } from "ts-patch";
import { Minimatch } from "minimatch";

import { HarmonyFactory } from "./harmony";

/* ****************************************************************************************************************** */
// region: TS Types
/* ****************************************************************************************************************** */
Expand Down Expand Up @@ -49,7 +47,7 @@ export interface TsTransformPathsContext {
}

export interface VisitorContext extends TsTransformPathsContext {
readonly factory: HarmonyFactory;
readonly factory: ts.NodeFactory;
readonly sourceFile: ts.SourceFile;
readonly isDeclarationFile: boolean;
readonly originalSourceFile: ts.SourceFile;
Expand Down
10 changes: 1 addition & 9 deletions test/config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import ts from "typescript";
import tsFourSeven from "typescript-4.7";
import tsFiveFive from "typescript-5.5";
import tsFiveSix from "typescript-5.6";
import path from "node:path";

export const tsModules = <const>[
["4.7.4", tsFourSeven, "typescript-4.7"],
["5.5.4", tsFiveFive, "typescript-5.5"],
["5.6.3", tsFiveSix, "typescript-5.6"],
["Latest", ts, "typescript"],
];
export const tsModules = <const>[["Latest", ts, "typescript"]];

export const projectsPaths = path.join(__dirname, "./projects");
export const transformerPath = require.resolve("typescript-transform-paths");
Expand Down
3 changes: 0 additions & 3 deletions test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
"tsp1": "npm:ts-patch@1.*.*",
"tsp2": "npm:ts-patch@2.*.*",
"typescript": "^5.7.2",
"typescript-4.7": "npm:[email protected]",
"typescript-5.5": "npm:[email protected]",
"typescript-5.6": "npm:[email protected]",
"typescript-transform-paths": "portal:../"
},
"workspaces": [
Expand Down
4 changes: 0 additions & 4 deletions test/prepare.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { symlink } from "node:fs/promises";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { patch } from "ts-patch";
import { patch as patch2 } from "tsp2";

const __dirname = dirname(fileURLToPath(import.meta.url)); // https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules

Expand All @@ -27,9 +26,6 @@ function patchTsModules() {
tspatch(["tsc.js", "typescript.js"], { basedir, dir: basedir });
}

patchTypescript("typescript-4.7", patch2);
patchTypescript("typescript-5.5", patch);
patchTypescript("typescript-5.6", patch);
patchTypescript("typescript", patch);
}

Expand Down
2 changes: 0 additions & 2 deletions test/tests/transformer/general.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ describe(`Transformer -> General Tests`, () => {
beforeAll(() => {
transformed = transformedFiles[file];
expected = {
// @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),
};
});
Expand Down
35 changes: 1 addition & 34 deletions test/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8095,9 +8095,6 @@ __metadata:
tsp1: "npm:ts-patch@1.*.*"
tsp2: "npm:ts-patch@2.*.*"
typescript: "npm:^5.7.2"
typescript-4.7: "npm:[email protected]"
typescript-5.5: "npm:[email protected]"
typescript-5.6: "npm:[email protected]"
typescript-transform-paths: "portal:../"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -9236,43 +9233,13 @@ __metadata:
languageName: node
linkType: hard

"typescript-4.7@npm:[email protected]":
version: 4.7.4
resolution: "typescript@npm:4.7.4"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10c0/8c1c4007b6ce5b24c49f0e89173ab9e82687cc6ae54418d1140bb63b82d6598d085ac0f993fe3d3d1fbf87a2c76f1f81d394dc76315bc72c7a9f8561c5d8d205
languageName: node
linkType: hard

"typescript-5.5@npm:[email protected]":
version: 5.5.4
resolution: "typescript@npm:5.5.4"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10c0/422be60f89e661eab29ac488c974b6cc0a660fb2228003b297c3d10c32c90f3bcffc1009b43876a082515a3c376b1eefcce823d6e78982e6878408b9a923199c
languageName: node
linkType: hard

"typescript-5.6@npm:[email protected]":
version: 5.6.3
resolution: "typescript@npm:5.6.3"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10c0/44f61d3fb15c35359bc60399cb8127c30bae554cd555b8e2b46d68fa79d680354b83320ad419ff1b81a0bdf324197b29affe6cc28988cd6a74d4ac60c94f9799
languageName: node
linkType: hard

"typescript-transform-paths@portal:../::locator=root-workspace-0b6124%40workspace%3A.":
version: 0.0.0-use.local
resolution: "typescript-transform-paths@portal:../::locator=root-workspace-0b6124%40workspace%3A."
dependencies:
minimatch: "npm:^9.0.5"
peerDependencies:
typescript: ">=4"
typescript: ">=5"
languageName: node
linkType: soft

Expand Down
13 changes: 1 addition & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -395,16 +395,6 @@ __metadata:
languageName: node
linkType: hard

"@types/typescript-4.7@npm:[email protected]":
version: 4.7.4
resolution: "typescript@npm:4.7.4"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10c0/8c1c4007b6ce5b24c49f0e89173ab9e82687cc6ae54418d1140bb63b82d6598d085ac0f993fe3d3d1fbf87a2c76f1f81d394dc76315bc72c7a9f8561c5d8d205
languageName: node
linkType: hard

"@types/unist@npm:*, @types/unist@npm:^3.0.0":
version: 3.0.3
resolution: "@types/unist@npm:3.0.3"
Expand Down Expand Up @@ -2928,7 +2918,6 @@ __metadata:
"@types/node": "npm:^22.5.2"
"@types/ts-expose-internals": "npm:[email protected]"
"@types/ts-node": "npm:ts-node@^10.9.2"
"@types/typescript-4.7": "npm:[email protected]"
changelogen: "npm:^0.5.5"
eslint: "npm:9.x"
globals: "npm:^15.9.0"
Expand All @@ -2939,7 +2928,7 @@ __metadata:
typescript: "npm:^5.5.4"
typescript-eslint: "npm:^8.3.0"
peerDependencies:
typescript: ">=4"
typescript: ">=5"
languageName: unknown
linkType: soft

Expand Down

0 comments on commit d69d010

Please sign in to comment.