@xylabs/ts-scripts-yarn3 6.4.4 → 6.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -783,13 +783,14 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
783
783
  );
784
784
  const imports = [];
785
785
  const typeImports = [];
786
+ const isDeclarationFile = filePath.endsWith(".d.ts");
786
787
  function visit(node) {
787
788
  if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
788
789
  const moduleSpecifier = node.moduleSpecifier?.getFullText();
789
790
  const isTypeImport = ts.isImportDeclaration(node) ? node.importClause?.isTypeOnly ?? false : false;
790
791
  if (moduleSpecifier) {
791
792
  const trimmed = moduleSpecifier.split("'").at(1) ?? moduleSpecifier;
792
- if (isTypeImport) {
793
+ if (isTypeImport && !isDeclarationFile) {
793
794
  typeImports.push(trimmed);
794
795
  } else {
795
796
  imports.push(trimmed);
@@ -822,7 +823,7 @@ function findFilesByGlob(cwd4, pattern) {
822
823
  return globSync(pattern, { cwd: cwd4, absolute: true });
823
824
  }
824
825
  function findFiles(path9) {
825
- const allSourceInclude = ["./src/**/*.{ts,tsx}"];
826
+ const allSourceInclude = ["./src/**/*.{ts,tsx}", "./dist/**/*.d.ts"];
826
827
  const prodExcludeEndswith = [".spec.ts", ".stories.tsx"];
827
828
  const prodExcludeIncludes = ["/spec/", "/stories/", "/scripts/"];
828
829
  const allSourceFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path9, pattern));