@hadss/hmrouter-plugin
Version:
HMRouter Compiler Plugin
20 lines (19 loc) • 571 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TsAstUtil = void 0;
const ts_morph_1 = require("ts-morph");
class TsAstUtil {
static getSourceFile(filePath) {
if (!this.project) {
this.project = new ts_morph_1.Project({
compilerOptions: { target: ts_morph_1.ScriptTarget.ES2021 },
});
}
return this.project.addSourceFileAtPath(filePath);
}
static clearProject() {
this.project = null;
}
}
exports.TsAstUtil = TsAstUtil;
TsAstUtil.project = null;