cevek / ttypescript

Over TypeScript tool to use custom transformers in the tsconfig.json
1.53k stars 56 forks source link

Fix #134 - support TS 4.9 #135

Closed samchon closed 1 year ago

samchon commented 1 year ago

Just followed ts-patch of @nonara and it works fine in my case.

@cevek - hope ttypescript to support TS 4.9 ASAP.

cevek commented 1 year ago

released ttypescript@1.5.14 thank you @samchon!

samchon commented 1 year ago

@cevek: I think you have published the new version without compilation.

This is tsc.js of ttypescript@1.5.14

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fs = require("fs");
var resolve = require("resolve");
var loadTypescript_1 = require("./loadTypescript");
var path_1 = require("path");
var vm_1 = require("vm");
var ts = (0, loadTypescript_1.loadTypeScript)('typescript', { folder: process.cwd(), forceConfigLoad: true });
var tscFileName = resolve.sync('typescript/lib/tsc', { basedir: process.cwd() });
var commandLineTsCode = fs
    .readFileSync(tscFileName, 'utf8')
    .replace(/^[\s\S]+(\(function \(ts\) \{\s+function countLines[\s\S]+)$/, '$1');
var globalCode = (fs.readFileSync(tscFileName, 'utf8').match(/^([\s\S]*?)var ts;/) || ['', ''])[1];
(0, vm_1.runInThisContext)("(function (exports, require, module, __filename, __dirname, ts) {".concat(globalCode).concat(commandLineTsCode, "\n});"), {
    filename: tscFileName,
    lineOffset: 0,
    displayErrors: true,
}).call(ts, ts, require, { exports: ts }, tscFileName, (0, path_1.dirname)(tscFileName), ts);
cevek commented 1 year ago

@samchon oh, yeah, you're right! shame on me 🤦‍♂️ Fixed it on 1.5.15