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 Sep 14, 2024
1 parent d87ebc4 commit a5398a0
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 183 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
24 changes: 1 addition & 23 deletions src/harmony/harmony-factory.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,9 @@
import TS from "typescript";
import { TsTransformPathsContext } from "../types";
import { TsFourSeven } from "./versions";

/* ****************************************************************************************************************** */
// region: Types
/* ****************************************************************************************************************** */

export interface HarmonyFactory extends TS.NodeFactory {}

// endregion

/* ****************************************************************************************************************** */
// region: Utilities
/* ****************************************************************************************************************** */

/** Creates a node factory compatible with TS v3+ */
export function createHarmonyFactory(context: TsTransformPathsContext): HarmonyFactory {
return new Proxy(context.tsFactory ?? context.tsInstance, {
get(target, prop) {
if (TsFourSeven.predicate(context)) {
return TsFourSeven.handler(context, prop);
} else {
// @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;
return (context.tsFactory ?? context.tsInstance) as HarmonyFactory;
}

// endregion
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.

6 changes: 1 addition & 5 deletions test/config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import ts from "typescript";
import tsFourSeven from "typescript-4.7";
import path from "node:path";

export const tsModules = <const>[
["4.7.4", tsFourSeven, "typescript-4.7"],
["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
1 change: 0 additions & 1 deletion test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"ts-patch": "^3.2.1",
"tsp2": "npm:ts-patch@2.*.*",
"typescript": "^5.5.4",
"typescript-4.7": "npm:[email protected]",
"typescript-transform-paths": "portal:../"
},
"workspaces": [
Expand Down
2 changes: 0 additions & 2 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,7 +26,6 @@ function patchTsModules() {
tspatch(["tsc.js", "typescript.js"], { basedir, dir: basedir });
}

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

Expand Down
13 changes: 1 addition & 12 deletions test/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8069,7 +8069,6 @@ __metadata:
ts-patch: "npm:^3.2.1"
tsp2: "npm:ts-patch@2.*.*"
typescript: "npm:^5.5.4"
typescript-4.7: "npm:[email protected]"
typescript-transform-paths: "portal:../"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -9189,23 +9188,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-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 @@ -341,16 +341,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 @@ -2976,7 +2966,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 @@ -2987,7 +2976,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 a5398a0

Please sign in to comment.