@cldcvr/custom-elements-manifest-to-types
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -196,2 +196,3 @@ "use strict"; | ||
const moduleName = modulePath || "./src"; //module.path.slice(0, -3); | ||
const extractedTypes = new Set(); | ||
(_a = module.declarations) === null || _a === void 0 ? void 0 : _a.forEach((declaration) => { | ||
@@ -202,3 +203,2 @@ if (!("customElement" in declaration) || !declaration.customElement) { | ||
if (declaration.attributes) { | ||
const extractedTypes = new Set(); | ||
declaration.attributes.forEach((attribute) => { | ||
@@ -215,12 +215,12 @@ var _a; | ||
}); | ||
if (extractedTypes.size > 0) { | ||
let importStatement = `import type { `; | ||
Array.from(extractedTypes).forEach((et, idx) => { | ||
importStatement += `${et}${idx < extractedTypes.size - 1 ? "," : ""}`; | ||
}); | ||
importStatement += `} from '${moduleName}';`; | ||
moduleTypeImports.push(importStatement); | ||
} | ||
} | ||
}); | ||
if (extractedTypes.size > 0) { | ||
let importStatement = `import type { `; | ||
Array.from(extractedTypes).forEach((et, idx) => { | ||
importStatement += `${et}${idx < extractedTypes.size - 1 ? "," : ""}`; | ||
}); | ||
importStatement += `} from '${moduleName}';`; | ||
moduleTypeImports.push(importStatement); | ||
} | ||
}); | ||
@@ -227,0 +227,0 @@ return moduleTypeImports; |
19
index.ts
@@ -220,2 +220,3 @@ import { Declaration, Package, PropertyLike } from "custom-elements-manifest/schema"; | ||
const moduleName = modulePath || "./src"; //module.path.slice(0, -3); | ||
const extractedTypes: Set<string> = new Set(); | ||
module.declarations?.forEach((declaration) => { | ||
@@ -227,3 +228,2 @@ if (!("customElement" in declaration) || !declaration.customElement) { | ||
if (declaration.attributes) { | ||
const extractedTypes: Set<string> = new Set(); | ||
declaration.attributes.forEach((attribute) => { | ||
@@ -239,13 +239,12 @@ if (attribute.type?.text) { | ||
}); | ||
if (extractedTypes.size > 0) { | ||
let importStatement = `import type { `; | ||
Array.from(extractedTypes).forEach((et, idx) => { | ||
importStatement += `${et}${idx < extractedTypes.size - 1 ? "," : ""}`; | ||
}); | ||
importStatement += `} from '${moduleName}';`; | ||
moduleTypeImports.push(importStatement); | ||
} | ||
} | ||
}); | ||
if (extractedTypes.size > 0) { | ||
let importStatement = `import type { `; | ||
Array.from(extractedTypes).forEach((et, idx) => { | ||
importStatement += `${et}${idx < extractedTypes.size - 1 ? "," : ""}`; | ||
}); | ||
importStatement += `} from '${moduleName}';`; | ||
moduleTypeImports.push(importStatement); | ||
} | ||
}); | ||
@@ -252,0 +251,0 @@ |
{ | ||
"name": "@cldcvr/custom-elements-manifest-to-types", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
59301