Skip to content

Commit 018e180

Browse files
committed
chore!: remove typescript 4.7 support
1 parent d87ebc4 commit 018e180

File tree

14 files changed

+6
-220
lines changed

14 files changed

+6
-220
lines changed

package.json

Lines changed: 1 addition & 2 deletions
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

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/harmony/index.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/harmony/utils.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/harmony/versions/four-seven.ts

Lines changed: 0 additions & 125 deletions
This file was deleted.

src/harmony/versions/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/transformer.ts

Lines changed: 1 addition & 2 deletions
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

Lines changed: 1 addition & 3 deletions
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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import ts from "typescript";
2-
import tsFourSeven from "typescript-4.7";
32
import path from "node:path";
43

5-
export const tsModules = <const>[
6-
["4.7.4", tsFourSeven, "typescript-4.7"],
7-
["Latest", ts, "typescript"],
8-
];
4+
export const tsModules = <const>[["Latest", ts, "typescript"]];
95

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

test/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"ts-patch": "^3.2.1",
2222
"tsp2": "npm:ts-patch@2.*.*",
2323
"typescript": "^5.5.4",
24-
"typescript-4.7": "npm:[email protected]",
2524
"typescript-transform-paths": "portal:../"
2625
},
2726
"workspaces": [

test/prepare.mjs

Lines changed: 0 additions & 2 deletions
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,7 +26,6 @@ function patchTsModules() {
2726
tspatch(["tsc.js", "typescript.js"], { basedir, dir: basedir });
2827
}
2928

30-
patchTypescript("typescript-4.7", patch2);
3129
patchTypescript("typescript", patch);
3230
}
3331

test/tests/transformer/general.test.ts

Lines changed: 0 additions & 2 deletions
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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8069,7 +8069,6 @@ __metadata:
80698069
ts-patch: "npm:^3.2.1"
80708070
tsp2: "npm:ts-patch@2.*.*"
80718071
typescript: "npm:^5.5.4"
8072-
typescript-4.7: "npm:[email protected]"
80738072
typescript-transform-paths: "portal:../"
80748073
languageName: unknown
80758074
linkType: soft
@@ -9189,23 +9188,13 @@ __metadata:
91899188
languageName: node
91909189
linkType: hard
91919190

9192-
"typescript-4.7@npm:[email protected]":
9193-
version: 4.7.4
9194-
resolution: "typescript@npm:4.7.4"
9195-
bin:
9196-
tsc: bin/tsc
9197-
tsserver: bin/tsserver
9198-
checksum: 10c0/8c1c4007b6ce5b24c49f0e89173ab9e82687cc6ae54418d1140bb63b82d6598d085ac0f993fe3d3d1fbf87a2c76f1f81d394dc76315bc72c7a9f8561c5d8d205
9199-
languageName: node
9200-
linkType: hard
9201-
92029191
"typescript-transform-paths@portal:../::locator=root-workspace-0b6124%40workspace%3A.":
92039192
version: 0.0.0-use.local
92049193
resolution: "typescript-transform-paths@portal:../::locator=root-workspace-0b6124%40workspace%3A."
92059194
dependencies:
92069195
minimatch: "npm:^9.0.5"
92079196
peerDependencies:
9208-
typescript: ">=4"
9197+
typescript: ">=5"
92099198
languageName: node
92109199
linkType: soft
92119200

yarn.lock

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -341,16 +341,6 @@ __metadata:
341341
languageName: node
342342
linkType: hard
343343

344-
"@types/typescript-4.7@npm:[email protected]":
345-
version: 4.7.4
346-
resolution: "typescript@npm:4.7.4"
347-
bin:
348-
tsc: bin/tsc
349-
tsserver: bin/tsserver
350-
checksum: 10c0/8c1c4007b6ce5b24c49f0e89173ab9e82687cc6ae54418d1140bb63b82d6598d085ac0f993fe3d3d1fbf87a2c76f1f81d394dc76315bc72c7a9f8561c5d8d205
351-
languageName: node
352-
linkType: hard
353-
354344
"@types/unist@npm:*, @types/unist@npm:^3.0.0":
355345
version: 3.0.3
356346
resolution: "@types/unist@npm:3.0.3"
@@ -2976,7 +2966,6 @@ __metadata:
29762966
"@types/node": "npm:^22.5.2"
29772967
"@types/ts-expose-internals": "npm:[email protected]"
29782968
"@types/ts-node": "npm:ts-node@^10.9.2"
2979-
"@types/typescript-4.7": "npm:[email protected]"
29802969
changelogen: "npm:^0.5.5"
29812970
eslint: "npm:9.x"
29822971
globals: "npm:^15.9.0"
@@ -2987,7 +2976,7 @@ __metadata:
29872976
typescript: "npm:^5.5.4"
29882977
typescript-eslint: "npm:^8.3.0"
29892978
peerDependencies:
2990-
typescript: ">=4"
2979+
typescript: ">=5"
29912980
languageName: unknown
29922981
linkType: soft
29932982

0 commit comments

Comments
 (0)