Skip to content

Commit 1a8f5b4

Browse files
committed
chore!: remove typescript 4.7 support
1 parent 391214f commit 1a8f5b4

14 files changed

+6
-250
lines changed

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
"@types/node": "^22.5.2",
6767
"@types/ts-expose-internals": "npm:[email protected]",
6868
"@types/ts-node": "npm:ts-node@^10.9.2",
69-
"@types/typescript-4.7": "npm:[email protected]",
7069
"changelogen": "^0.5.5",
7170
"eslint": "9.x",
7271
"globals": "^15.9.0",
@@ -77,7 +76,7 @@
7776
"typescript-eslint": "^8.3.0"
7877
},
7978
"peerDependencies": {
80-
"typescript": ">=4"
79+
"typescript": ">=5"
8180
},
8281
"dependencies": {
8382
"minimatch": "^9.0.5"

src/harmony/harmony-factory.ts

-31
This file was deleted.

src/harmony/index.ts

-2
This file was deleted.

src/harmony/utils.ts

-20
This file was deleted.

src/harmony/versions/four-seven.ts

-125
This file was deleted.

src/harmony/versions/index.ts

-1
This file was deleted.

src/transformer.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import path from "node:path";
22
import ts, { CompilerOptions } from "typescript";
33
import { RunMode, TsNodeState, TsTransformPathsConfig, TsTransformPathsContext, VisitorContext } from "./types";
44
import { nodeVisitor } from "./visitor";
5-
import { createHarmonyFactory } from "./harmony";
65
import { Minimatch } from "minimatch";
76
import { createSyntheticEmitHost, getTsNodeRegistrationProperties } from "./utils/ts-helpers";
87
import { TransformerExtras } from "ts-patch";
@@ -139,7 +138,7 @@ export default function transformer(
139138
getVisitor() {
140139
return nodeVisitor.bind(this);
141140
},
142-
factory: createHarmonyFactory(tsTransformPathsContext),
141+
factory: (tsTransformPathsContext.tsFactory ?? tsTransformPathsContext.tsInstance) as ts.NodeFactory,
143142
};
144143

145144
return tsInstance.visitEachChild(sourceFile, visitorContext.getVisitor(), transformationContext);

src/types.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import ts, { CompilerOptions, EmitHost, Pattern, SourceFile } from "typescript";
22
import { PluginConfig } from "ts-patch";
33
import { Minimatch } from "minimatch";
44

5-
import { HarmonyFactory } from "./harmony";
6-
75
/* ****************************************************************************************************************** */
86
// region: TS Types
97
/* ****************************************************************************************************************** */
@@ -49,7 +47,7 @@ export interface TsTransformPathsContext {
4947
}
5048

5149
export interface VisitorContext extends TsTransformPathsContext {
52-
readonly factory: HarmonyFactory;
50+
readonly factory: ts.NodeFactory;
5351
readonly sourceFile: ts.SourceFile;
5452
readonly isDeclarationFile: boolean;
5553
readonly originalSourceFile: ts.SourceFile;

test/config.ts

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
import ts from "typescript";
2-
import tsFourSeven from "typescript-4.7";
3-
import tsFiveFive from "typescript-5.5";
4-
import tsFiveSix from "typescript-5.6";
52
import path from "node:path";
63

7-
export const tsModules = <const>[
8-
["4.7.4", tsFourSeven, "typescript-4.7"],
9-
["5.5.4", tsFiveFive, "typescript-5.5"],
10-
["5.6.3", tsFiveSix, "typescript-5.6"],
11-
["Latest", ts, "typescript"],
12-
];
4+
export const tsModules = <const>[["Latest", ts, "typescript"]];
135

146
export const projectsPaths = path.join(__dirname, "./projects");
157
export const transformerPath = require.resolve("typescript-transform-paths");

test/package.json

-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
"tsp1": "npm:ts-patch@1.*.*",
2323
"tsp2": "npm:ts-patch@2.*.*",
2424
"typescript": "^5.7.2",
25-
"typescript-4.7": "npm:[email protected]",
26-
"typescript-5.5": "npm:[email protected]",
27-
"typescript-5.6": "npm:[email protected]",
2825
"typescript-transform-paths": "portal:../"
2926
},
3027
"workspaces": [

test/prepare.mjs

-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { symlink } from "node:fs/promises";
44
import { dirname, resolve } from "node:path";
55
import { fileURLToPath } from "node:url";
66
import { patch } from "ts-patch";
7-
import { patch as patch2 } from "tsp2";
87

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

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

30-
patchTypescript("typescript-4.7", patch2);
31-
patchTypescript("typescript-5.5", patch);
32-
patchTypescript("typescript-5.6", patch);
3329
patchTypescript("typescript", patch);
3430
}
3531

test/tests/transformer/general.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ describe(`Transformer -> General Tests`, () => {
5050
beforeAll(() => {
5151
transformed = transformedFiles[file];
5252
expected = {
53-
// @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")'.
5453
js: getExpected(tsInstance, file, originalFiles[file].js, projectRoot),
55-
// @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")'.
5654
dts: getExpected(tsInstance, file, originalFiles[file].dts, projectRoot),
5755
};
5856
});

test/yarn.lock

+1-34
Original file line numberDiff line numberDiff line change
@@ -8095,9 +8095,6 @@ __metadata:
80958095
tsp1: "npm:ts-patch@1.*.*"
80968096
tsp2: "npm:ts-patch@2.*.*"
80978097
typescript: "npm:^5.7.2"
8098-
typescript-4.7: "npm:[email protected]"
8099-
typescript-5.5: "npm:[email protected]"
8100-
typescript-5.6: "npm:[email protected]"
81018098
typescript-transform-paths: "portal:../"
81028099
languageName: unknown
81038100
linkType: soft
@@ -9236,43 +9233,13 @@ __metadata:
92369233
languageName: node
92379234
linkType: hard
92389235

9239-
"typescript-4.7@npm:[email protected]":
9240-
version: 4.7.4
9241-
resolution: "typescript@npm:4.7.4"
9242-
bin:
9243-
tsc: bin/tsc
9244-
tsserver: bin/tsserver
9245-
checksum: 10c0/8c1c4007b6ce5b24c49f0e89173ab9e82687cc6ae54418d1140bb63b82d6598d085ac0f993fe3d3d1fbf87a2c76f1f81d394dc76315bc72c7a9f8561c5d8d205
9246-
languageName: node
9247-
linkType: hard
9248-
9249-
"typescript-5.5@npm:[email protected]":
9250-
version: 5.5.4
9251-
resolution: "typescript@npm:5.5.4"
9252-
bin:
9253-
tsc: bin/tsc
9254-
tsserver: bin/tsserver
9255-
checksum: 10c0/422be60f89e661eab29ac488c974b6cc0a660fb2228003b297c3d10c32c90f3bcffc1009b43876a082515a3c376b1eefcce823d6e78982e6878408b9a923199c
9256-
languageName: node
9257-
linkType: hard
9258-
9259-
"typescript-5.6@npm:[email protected]":
9260-
version: 5.6.3
9261-
resolution: "typescript@npm:5.6.3"
9262-
bin:
9263-
tsc: bin/tsc
9264-
tsserver: bin/tsserver
9265-
checksum: 10c0/44f61d3fb15c35359bc60399cb8127c30bae554cd555b8e2b46d68fa79d680354b83320ad419ff1b81a0bdf324197b29affe6cc28988cd6a74d4ac60c94f9799
9266-
languageName: node
9267-
linkType: hard
9268-
92699236
"typescript-transform-paths@portal:../::locator=root-workspace-0b6124%40workspace%3A.":
92709237
version: 0.0.0-use.local
92719238
resolution: "typescript-transform-paths@portal:../::locator=root-workspace-0b6124%40workspace%3A."
92729239
dependencies:
92739240
minimatch: "npm:^9.0.5"
92749241
peerDependencies:
9275-
typescript: ">=4"
9242+
typescript: ">=5"
92769243
languageName: node
92779244
linkType: soft
92789245

yarn.lock

+1-12
Original file line numberDiff line numberDiff line change
@@ -395,16 +395,6 @@ __metadata:
395395
languageName: node
396396
linkType: hard
397397

398-
"@types/typescript-4.7@npm:[email protected]":
399-
version: 4.7.4
400-
resolution: "typescript@npm:4.7.4"
401-
bin:
402-
tsc: bin/tsc
403-
tsserver: bin/tsserver
404-
checksum: 10c0/8c1c4007b6ce5b24c49f0e89173ab9e82687cc6ae54418d1140bb63b82d6598d085ac0f993fe3d3d1fbf87a2c76f1f81d394dc76315bc72c7a9f8561c5d8d205
405-
languageName: node
406-
linkType: hard
407-
408398
"@types/unist@npm:*, @types/unist@npm:^3.0.0":
409399
version: 3.0.3
410400
resolution: "@types/unist@npm:3.0.3"
@@ -2928,7 +2918,6 @@ __metadata:
29282918
"@types/node": "npm:^22.5.2"
29292919
"@types/ts-expose-internals": "npm:[email protected]"
29302920
"@types/ts-node": "npm:ts-node@^10.9.2"
2931-
"@types/typescript-4.7": "npm:[email protected]"
29322921
changelogen: "npm:^0.5.5"
29332922
eslint: "npm:9.x"
29342923
globals: "npm:^15.9.0"
@@ -2939,7 +2928,7 @@ __metadata:
29392928
typescript: "npm:^5.5.4"
29402929
typescript-eslint: "npm:^8.3.0"
29412930
peerDependencies:
2942-
typescript: ">=4"
2931+
typescript: ">=5"
29432932
languageName: unknown
29442933
linkType: soft
29452934

0 commit comments

Comments
 (0)