@vesk/vesk-cli 0.2.19 → 0.2.20

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.
Files changed (2) hide show
  1. package/dist/cli.js +99 -0
  2. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -16904,6 +16904,20 @@ var init_parser = __esm({
16904
16904
  import { walk } from "zimmerframe";
16905
16905
  import { print } from "esrap";
16906
16906
  import ts from "esrap/languages/ts";
16907
+ function isTypeOnlyImportExport(node) {
16908
+ if (!node) return false;
16909
+ if (node.type === "ImportDeclaration") return node.importKind === "type";
16910
+ if (node.type === "ExportNamedDeclaration" || node.type === "ExportAllDeclaration") {
16911
+ return node.exportKind === "type";
16912
+ }
16913
+ return false;
16914
+ }
16915
+ function isTypeOnlySpecifier(node) {
16916
+ if (!node) return false;
16917
+ if (node.importKind === "type") return true;
16918
+ if (node.exportKind === "type") return true;
16919
+ return false;
16920
+ }
16907
16921
  function hasTsSyntax(ast) {
16908
16922
  let found = false;
16909
16923
  walk(ast, null, {
@@ -16912,6 +16926,10 @@ function hasTsSyntax(ast) {
16912
16926
  found = true;
16913
16927
  return;
16914
16928
  }
16929
+ if (isTypeOnlyImportExport(node) || isTypeOnlySpecifier(node)) {
16930
+ found = true;
16931
+ return;
16932
+ }
16915
16933
  return context.next();
16916
16934
  }
16917
16935
  });
@@ -16920,8 +16938,12 @@ function hasTsSyntax(ast) {
16920
16938
  function isTypeOnlyStatement(node) {
16921
16939
  if (!node) return true;
16922
16940
  if (node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration") {
16941
+ if (node.exportKind === "type") return true;
16923
16942
  return !!node.declaration && isTypeOnlyStatement(node.declaration);
16924
16943
  }
16944
+ if (node.type === "ImportDeclaration" || node.type === "ExportAllDeclaration") {
16945
+ return isTypeOnlyImportExport(node);
16946
+ }
16925
16947
  return TYPE_ONLY_STATEMENTS.has(node.type);
16926
16948
  }
16927
16949
  function stripTsTypes(ast) {
@@ -16969,6 +16991,28 @@ function stripTsTypes(ast) {
16969
16991
  if (node.typeAnnotation) node.typeAnnotation = null;
16970
16992
  return context.next();
16971
16993
  },
16994
+ ImportDeclaration(node, context) {
16995
+ if (isTypeOnlyImportExport(node)) return null;
16996
+ if (Array.isArray(node.specifiers)) {
16997
+ const kept = node.specifiers.filter((s) => !isTypeOnlySpecifier(s));
16998
+ if (kept.length === 0) return null;
16999
+ node.specifiers = kept;
17000
+ }
17001
+ return context.next();
17002
+ },
17003
+ ExportNamedDeclaration(node, context) {
17004
+ if (isTypeOnlyImportExport(node)) return null;
17005
+ if (Array.isArray(node.specifiers)) {
17006
+ const kept = node.specifiers.filter((s) => !isTypeOnlySpecifier(s));
17007
+ if (kept.length === 0 && node.declaration == null) return null;
17008
+ node.specifiers = kept;
17009
+ }
17010
+ return context.next();
17011
+ },
17012
+ ExportAllDeclaration(node, context) {
17013
+ if (isTypeOnlyImportExport(node)) return null;
17014
+ return context.next();
17015
+ },
16972
17016
  TSInterfaceDeclaration(node) {
16973
17017
  return null;
16974
17018
  },
@@ -39707,6 +39751,25 @@ var TS_NODE_TYPES2 = /* @__PURE__ */ new Set([
39707
39751
  "TSImportEqualsDeclaration",
39708
39752
  "TSParameterProperty"
39709
39753
  ]);
39754
+ function isTypeOnlyImportExport2(node) {
39755
+ if (!node)
39756
+ return false;
39757
+ if (node.type === "ImportDeclaration")
39758
+ return node.importKind === "type";
39759
+ if (node.type === "ExportNamedDeclaration" || node.type === "ExportAllDeclaration") {
39760
+ return node.exportKind === "type";
39761
+ }
39762
+ return false;
39763
+ }
39764
+ function isTypeOnlySpecifier2(node) {
39765
+ if (!node)
39766
+ return false;
39767
+ if (node.importKind === "type")
39768
+ return true;
39769
+ if (node.exportKind === "type")
39770
+ return true;
39771
+ return false;
39772
+ }
39710
39773
  function hasTsSyntax2(ast) {
39711
39774
  let found = false;
39712
39775
  walk4(ast, null, {
@@ -39715,6 +39778,10 @@ function hasTsSyntax2(ast) {
39715
39778
  found = true;
39716
39779
  return;
39717
39780
  }
39781
+ if (isTypeOnlyImportExport2(node) || isTypeOnlySpecifier2(node)) {
39782
+ found = true;
39783
+ return;
39784
+ }
39718
39785
  return context.next();
39719
39786
  }
39720
39787
  });
@@ -39733,8 +39800,13 @@ function isTypeOnlyStatement2(node) {
39733
39800
  if (!node)
39734
39801
  return true;
39735
39802
  if (node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration") {
39803
+ if (node.exportKind === "type")
39804
+ return true;
39736
39805
  return !!node.declaration && isTypeOnlyStatement2(node.declaration);
39737
39806
  }
39807
+ if (node.type === "ImportDeclaration" || node.type === "ExportAllDeclaration") {
39808
+ return isTypeOnlyImportExport2(node);
39809
+ }
39738
39810
  return TYPE_ONLY_STATEMENTS2.has(node.type);
39739
39811
  }
39740
39812
  function stripTsTypes2(ast) {
@@ -39786,6 +39858,33 @@ function stripTsTypes2(ast) {
39786
39858
  node.typeAnnotation = null;
39787
39859
  return context.next();
39788
39860
  },
39861
+ ImportDeclaration(node, context) {
39862
+ if (isTypeOnlyImportExport2(node))
39863
+ return null;
39864
+ if (Array.isArray(node.specifiers)) {
39865
+ const kept = node.specifiers.filter((s) => !isTypeOnlySpecifier2(s));
39866
+ if (kept.length === 0)
39867
+ return null;
39868
+ node.specifiers = kept;
39869
+ }
39870
+ return context.next();
39871
+ },
39872
+ ExportNamedDeclaration(node, context) {
39873
+ if (isTypeOnlyImportExport2(node))
39874
+ return null;
39875
+ if (Array.isArray(node.specifiers)) {
39876
+ const kept = node.specifiers.filter((s) => !isTypeOnlySpecifier2(s));
39877
+ if (kept.length === 0 && node.declaration == null)
39878
+ return null;
39879
+ node.specifiers = kept;
39880
+ }
39881
+ return context.next();
39882
+ },
39883
+ ExportAllDeclaration(node, context) {
39884
+ if (isTypeOnlyImportExport2(node))
39885
+ return null;
39886
+ return context.next();
39887
+ },
39789
39888
  TSInterfaceDeclaration(node) {
39790
39889
  return null;
39791
39890
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesk/vesk-cli",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "type": "module",
5
5
  "description": "Vesk — compiler-first framework for the post-VDOM web. vesk dev, vesk build.",
6
6
  "bin": {
@@ -8,10 +8,10 @@
8
8
  },
9
9
  "main": "./dist/cli.js",
10
10
  "dependencies": {
11
- "@vesk/adapter": "^0.2.19",
12
- "@vesk/compiler": "^0.2.19",
13
- "@vesk/plugin-tailwind": "^0.2.19",
14
- "@vesk/runtime": "^0.2.19",
11
+ "@vesk/adapter": "^0.2.20",
12
+ "@vesk/compiler": "^0.2.20",
13
+ "@vesk/plugin-tailwind": "^0.2.20",
14
+ "@vesk/runtime": "^0.2.20",
15
15
  "esrap": "^2.3.0",
16
16
  "typescript": "^5.8.0",
17
17
  "ws": "^8.18.0",