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 018e180
Show file tree
Hide file tree
Showing 14 changed files with 6 additions and 220 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
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
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
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 018e180

Please sign in to comment.