Only shim legacy directories (#395)

* Only shim legacy directories

* nit
This commit is contained in:
Chenlei Hu
2024-08-12 21:11:30 -04:00
committed by GitHub
parent 1fc173b48f
commit f91e335ca7

View File

@@ -11,6 +11,13 @@ interface ShimResult {
exports: string[]; exports: string[];
} }
function isLegacyFile(id: string): boolean {
return id.endsWith('.ts') && (
id.includes("src/extensions/core") ||
id.includes("src/scripts")
);
}
function comfyAPIPlugin(): Plugin { function comfyAPIPlugin(): Plugin {
return { return {
name: 'comfy-api-plugin', name: 'comfy-api-plugin',
@@ -18,8 +25,7 @@ function comfyAPIPlugin(): Plugin {
if (IS_DEV) if (IS_DEV)
return null; return null;
// TODO: Remove second condition after all js files are converted to ts if (isLegacyFile(id)) {
if (id.endsWith('.ts') || (id.endsWith('.js') && id.includes("extensions/core"))) {
const result = transformExports(code, id); const result = transformExports(code, id);
if (result.exports.length > 0) { if (result.exports.length > 0) {