jsxpression 0.1.0 → 0.1.1

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 (199) hide show
  1. package/lib/analyze/analysis-error.d.ts +7 -0
  2. package/lib/analyze/analysis-error.d.ts.map +1 -1
  3. package/lib/analyze/analysis-error.js +26 -0
  4. package/lib/analyze/analysis-error.js.map +1 -0
  5. package/lib/analyze/analysis-report.d.ts +2 -2
  6. package/lib/analyze/analysis-report.d.ts.map +1 -1
  7. package/lib/analyze/analyze.d.ts +5 -0
  8. package/lib/analyze/analyze.d.ts.map +1 -1
  9. package/lib/analyze/analyze.js +11 -0
  10. package/lib/analyze/analyze.js.map +1 -0
  11. package/lib/analyze/analyze.test.js +312 -312
  12. package/lib/analyze/analyze.test.js.map +1 -1
  13. package/lib/analyze/data/analyze.d.ts +5 -0
  14. package/lib/analyze/data/analyze.d.ts.map +1 -1
  15. package/lib/analyze/data/analyze.js +12 -0
  16. package/lib/analyze/data/analyze.js.map +1 -0
  17. package/lib/analyze/data/data-access.d.ts +7 -0
  18. package/lib/analyze/data/data-access.d.ts.map +1 -1
  19. package/lib/analyze/data/data-access.js +275 -0
  20. package/lib/analyze/data/data-access.js.map +1 -0
  21. package/lib/analyze/data/index.d.ts +2 -0
  22. package/lib/analyze/data/index.d.ts.map +1 -1
  23. package/lib/analyze/data/index.js +6 -0
  24. package/lib/analyze/data/index.js.map +1 -0
  25. package/lib/analyze/data/method-calls.d.ts +6 -0
  26. package/lib/analyze/data/method-calls.d.ts.map +1 -1
  27. package/lib/analyze/data/method-calls.js +58 -0
  28. package/lib/analyze/data/method-calls.js.map +1 -0
  29. package/lib/analyze/data/utils.d.ts +10 -0
  30. package/lib/analyze/data/utils.d.ts.map +1 -1
  31. package/lib/analyze/data/utils.js +212 -0
  32. package/lib/analyze/data/utils.js.map +1 -0
  33. package/lib/analyze/index.d.ts +4 -0
  34. package/lib/analyze/index.d.ts.map +1 -1
  35. package/lib/analyze/index.js +10 -0
  36. package/lib/analyze/index.js.map +1 -0
  37. package/lib/analyze/jsx/analyze.d.ts +5 -0
  38. package/lib/analyze/jsx/analyze.d.ts.map +1 -1
  39. package/lib/analyze/jsx/analyze.js +13 -0
  40. package/lib/analyze/jsx/analyze.js.map +1 -0
  41. package/lib/analyze/jsx/element-attributes.d.ts +6 -0
  42. package/lib/analyze/jsx/element-attributes.d.ts.map +1 -1
  43. package/lib/analyze/jsx/element-attributes.js +20 -20
  44. package/lib/analyze/jsx/element-attributes.js.map +1 -1
  45. package/lib/analyze/jsx/element-children.d.ts +6 -0
  46. package/lib/analyze/jsx/element-children.d.ts.map +1 -1
  47. package/lib/analyze/jsx/element-children.js +69 -0
  48. package/lib/analyze/jsx/element-children.js.map +1 -0
  49. package/lib/analyze/jsx/element-tags.d.ts +6 -0
  50. package/lib/analyze/jsx/element-tags.d.ts.map +1 -1
  51. package/lib/analyze/jsx/element-tags.js +41 -0
  52. package/lib/analyze/jsx/element-tags.js.map +1 -0
  53. package/lib/analyze/jsx/index.d.ts +2 -0
  54. package/lib/analyze/jsx/index.d.ts.map +1 -1
  55. package/lib/analyze/jsx/index.js +6 -0
  56. package/lib/analyze/jsx/index.js.map +1 -0
  57. package/lib/analyze/security/analyze.d.ts +5 -0
  58. package/lib/analyze/security/analyze.d.ts.map +1 -1
  59. package/lib/analyze/security/analyze.js +15 -0
  60. package/lib/analyze/security/analyze.js.map +1 -0
  61. package/lib/analyze/security/call-expressions.d.ts +6 -0
  62. package/lib/analyze/security/call-expressions.d.ts.map +1 -1
  63. package/lib/analyze/security/call-expressions.js +23 -0
  64. package/lib/analyze/security/call-expressions.js.map +1 -0
  65. package/lib/analyze/security/declarations.d.ts +6 -0
  66. package/lib/analyze/security/declarations.d.ts.map +1 -1
  67. package/lib/analyze/security/declarations.js +31 -0
  68. package/lib/analyze/security/declarations.js.map +1 -0
  69. package/lib/analyze/security/expressions.d.ts +6 -0
  70. package/lib/analyze/security/expressions.d.ts.map +1 -1
  71. package/lib/analyze/security/expressions.js +52 -0
  72. package/lib/analyze/security/expressions.js.map +1 -0
  73. package/lib/analyze/security/identifiers.d.ts +6 -0
  74. package/lib/analyze/security/identifiers.d.ts.map +1 -1
  75. package/lib/analyze/security/identifiers.js +87 -0
  76. package/lib/analyze/security/identifiers.js.map +1 -0
  77. package/lib/analyze/security/index.d.ts +2 -0
  78. package/lib/analyze/security/index.d.ts.map +1 -1
  79. package/lib/analyze/security/index.js +6 -0
  80. package/lib/analyze/security/index.js.map +1 -0
  81. package/lib/analyze/security/member-access.d.ts +6 -0
  82. package/lib/analyze/security/member-access.d.ts.map +1 -1
  83. package/lib/analyze/security/member-access.js +24 -0
  84. package/lib/analyze/security/member-access.js.map +1 -0
  85. package/lib/analyze/utils.d.ts.map +1 -0
  86. package/lib/analyze/utils.js +92 -0
  87. package/lib/analyze/utils.js.map +1 -0
  88. package/lib/analyze/validation-context.d.ts.map +1 -0
  89. package/lib/analyze/validation-context.js +27 -0
  90. package/lib/analyze/validation-context.js.map +1 -0
  91. package/lib/codegen/generate-typescript-definitions.test.js +190 -190
  92. package/lib/codegen/generate-typescript-definitions.test.js.map +1 -1
  93. package/lib/compile/compilation-error.d.ts.map +1 -0
  94. package/lib/compile/compilation-error.js +28 -0
  95. package/lib/compile/compilation-error.js.map +1 -0
  96. package/lib/compile/compile.d.ts +3 -0
  97. package/lib/compile/compile.d.ts.map +1 -1
  98. package/lib/compile/compile.js +17 -17
  99. package/lib/compile/compile.js.map +1 -1
  100. package/lib/compile/compile.test.js +110 -110
  101. package/lib/compile/compile.test.js.map +1 -1
  102. package/lib/compile/index.d.ts +3 -0
  103. package/lib/compile/index.d.ts.map +1 -0
  104. package/lib/compile/index.js +8 -0
  105. package/lib/compile/index.js.map +1 -0
  106. package/lib/evaluate/evaluate.js +9 -5
  107. package/lib/evaluate/evaluate.js.map +1 -0
  108. package/lib/evaluate/evaluate.test.d.ts.map +1 -0
  109. package/lib/evaluate/evaluate.test.js +252 -0
  110. package/lib/evaluate/evaluate.test.js.map +1 -0
  111. package/lib/evaluate/evaluation-error.js +6 -1
  112. package/lib/evaluate/evaluation-error.js.map +1 -0
  113. package/lib/evaluate/index.d.ts +3 -0
  114. package/lib/evaluate/index.d.ts.map +1 -0
  115. package/lib/evaluate/index.js +8 -0
  116. package/lib/evaluate/index.js.map +1 -0
  117. package/lib/index.d.ts +7 -7
  118. package/lib/index.d.ts.map +1 -1
  119. package/lib/index.js +12 -12
  120. package/lib/index.js.map +1 -1
  121. package/lib/jsx.d.ts +92 -0
  122. package/lib/jsx.d.ts.map +1 -0
  123. package/lib/jsx.js +43 -0
  124. package/lib/jsx.js.map +1 -0
  125. package/lib/parse/index.d.ts +3 -0
  126. package/lib/parse/index.d.ts.map +1 -0
  127. package/lib/parse/index.js +8 -0
  128. package/lib/parse/index.js.map +1 -0
  129. package/lib/parse/parse-error.d.ts.map +1 -0
  130. package/lib/parse/parse-error.js +13 -0
  131. package/lib/parse/parse-error.js.map +1 -0
  132. package/lib/parse/parse.d.ts +3 -0
  133. package/lib/parse/parse.d.ts.map +1 -0
  134. package/lib/parse/parse.js +35 -0
  135. package/lib/parse/parse.js.map +1 -0
  136. package/lib/parse/parse.test.d.ts.map +1 -0
  137. package/lib/parse/parse.test.js +82 -0
  138. package/lib/parse/parse.test.js.map +1 -0
  139. package/lib/render.d.ts +2 -2
  140. package/lib/render.d.ts.map +1 -1
  141. package/lib/render.js +13 -9
  142. package/lib/render.js.map +1 -0
  143. package/lib/render.test.js +303 -0
  144. package/lib/render.test.js.map +1 -0
  145. package/lib/schema.js +39 -18
  146. package/lib/schema.js.map +1 -0
  147. package/lib/traverse.d.ts +15 -0
  148. package/lib/traverse.d.ts.map +1 -0
  149. package/lib/traverse.js +49 -0
  150. package/lib/traverse.js.map +1 -0
  151. package/lib/traverse.test.d.ts.map +1 -0
  152. package/lib/traverse.test.js +86 -0
  153. package/lib/traverse.test.js.map +1 -0
  154. package/lib/types.d.ts.map +1 -0
  155. package/lib/types.js +3 -0
  156. package/lib/types.js.map +1 -0
  157. package/lib/validate.d.ts +3 -3
  158. package/lib/validate.d.ts.map +1 -1
  159. package/lib/validate.js +11 -7
  160. package/lib/validate.js.map +1 -0
  161. package/package.json +1 -1
  162. package/src/analyze/analysis-error.ts +1 -1
  163. package/src/analyze/analysis-report.ts +2 -2
  164. package/src/analyze/analyze.test.ts +4 -4
  165. package/src/analyze/analyze.ts +5 -5
  166. package/src/analyze/data/analyze.ts +5 -5
  167. package/src/analyze/data/data-access.ts +6 -6
  168. package/src/analyze/data/index.ts +1 -1
  169. package/src/analyze/data/method-calls.ts +7 -7
  170. package/src/analyze/data/utils.ts +5 -5
  171. package/src/analyze/index.ts +3 -3
  172. package/src/analyze/jsx/analyze.ts +6 -6
  173. package/src/analyze/jsx/element-attributes.ts +6 -6
  174. package/src/analyze/jsx/element-children.ts +6 -6
  175. package/src/analyze/jsx/element-tags.ts +5 -5
  176. package/src/analyze/jsx/index.ts +1 -1
  177. package/src/analyze/security/analyze.ts +8 -8
  178. package/src/analyze/security/call-expressions.ts +5 -5
  179. package/src/analyze/security/declarations.ts +5 -5
  180. package/src/analyze/security/expressions.ts +5 -5
  181. package/src/analyze/security/identifiers.ts +6 -6
  182. package/src/analyze/security/index.ts +1 -1
  183. package/src/analyze/security/member-access.ts +5 -5
  184. package/src/codegen/generate-typescript-definitions.test.ts +2 -2
  185. package/src/compile/compile.test.ts +2 -2
  186. package/src/compile/compile.ts +2 -2
  187. package/src/compile/index.ts +2 -2
  188. package/src/evaluate/evaluate.test.ts +4 -4
  189. package/src/evaluate/evaluate.ts +1 -1
  190. package/src/evaluate/index.ts +2 -2
  191. package/src/index.ts +7 -7
  192. package/src/parse/index.ts +2 -2
  193. package/src/parse/parse.test.ts +2 -2
  194. package/src/parse/parse.ts +1 -1
  195. package/src/render.test.ts +4 -4
  196. package/src/render.ts +5 -5
  197. package/src/traverse.test.ts +2 -2
  198. package/src/traverse.ts +1 -1
  199. package/src/validate.ts +3 -3
@@ -0,0 +1,15 @@
1
+ import { Program } from "acorn.js";
2
+ import { SimpleVisitors } from "acorn-walk.js";
3
+ import { JSXAttribute, JSXElement, JSXExpressionContainer, JSXFragment, JSXOpeningElement, JSXSpreadAttribute } from "./jsx/index.js";
4
+ type SimpleVisitor<T> = (node: T, state: unknown) => void;
5
+ type ExtendedSimpleVisitors = SimpleVisitors<unknown> & {
6
+ JSXAttribute?: SimpleVisitor<JSXAttribute>;
7
+ JSXElement?: SimpleVisitor<JSXElement>;
8
+ JSXExpressionContainer?: SimpleVisitor<JSXExpressionContainer>;
9
+ JSXFragment?: SimpleVisitor<JSXFragment>;
10
+ JSXOpeningElement?: SimpleVisitor<JSXOpeningElement>;
11
+ JSXSpreadAttribute?: SimpleVisitor<JSXSpreadAttribute>;
12
+ };
13
+ export declare function traverse(ast: Program, visitors: Partial<ExtendedSimpleVisitors>): void;
14
+ export {};
15
+ //# sourceMappingURL=traverse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traverse.d.ts","sourceRoot":"","sources":["../src/traverse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAgB,cAAc,EAAqB,MAAM,eAAe,CAAC;AAChF,OAAO,EACL,YAAY,EACZ,UAAU,EACV,sBAAsB,EACtB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAGnB,MAAM,gBAAgB,CAAC;AAIxB,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;AAW1D,KAAK,sBAAsB,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG;IACtD,YAAY,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAC3C,UAAU,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACvC,sBAAsB,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;IAC/D,WAAW,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACzC,iBAAiB,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACrD,kBAAkB,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;CACxD,CAAC;AAEF,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,IAAI,CA0CtF"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.traverse = traverse;
4
+ const acorn_walk_js_1 = require("acorn-walk.js");
5
+ const index_js_1 = require("./jsx/index.js");
6
+ function traverse(ast, visitors) {
7
+ (0, acorn_walk_js_1.simple)(ast, visitors, {
8
+ ...acorn_walk_js_1.base,
9
+ JSXAttribute(node, state, visit) {
10
+ if (node.value) {
11
+ visit(node.value, state);
12
+ }
13
+ },
14
+ JSXElement(node, state, visit) {
15
+ const { openingElement } = node;
16
+ if (openingElement && Array.isArray(openingElement.attributes)) {
17
+ for (const attribute of openingElement.attributes) {
18
+ visit(attribute, state);
19
+ }
20
+ }
21
+ for (const child of node.children) {
22
+ if (!(0, index_js_1.isJsxText)(child)) {
23
+ visit(child, state);
24
+ }
25
+ }
26
+ },
27
+ JSXExpressionContainer(node, state, visit) {
28
+ if (!(0, index_js_1.isJsxEmptyExpression)(node.expression)) {
29
+ visit(node.expression, state);
30
+ }
31
+ },
32
+ JSXFragment(node, state, visit) {
33
+ for (const child of node.children) {
34
+ if (!(0, index_js_1.isJsxText)(child)) {
35
+ visit(child, state);
36
+ }
37
+ }
38
+ },
39
+ JSXOpeningElement(node, state, visit) {
40
+ for (const attribute of node.attributes) {
41
+ visit(attribute, state);
42
+ }
43
+ },
44
+ JSXSpreadAttribute(node, state, visit) {
45
+ visit(node.argument, state);
46
+ },
47
+ });
48
+ }
49
+ //# sourceMappingURL=traverse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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;gBAClC,IAAI,CAAC,IAAA,oBAAS,EAAC,KAAK,CAAC,EAAE,CAAC;oBACtB,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBACtB,CAAC;YACH,CAAC;QACH,CAAC;QACD,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK;YAClC,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACxC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QACD,kBAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK;YACnC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC9B,CAAC;KAC2B,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traverse.test.d.ts","sourceRoot":"","sources":["../src/traverse.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_js_1 = require("vitest.js");
4
+ const traverse_js_1 = require("./traverse.js");
5
+ const index_js_1 = require("./parse/index.js");
6
+ (0, vitest_js_1.describe)("traverse", () => {
7
+ (0, vitest_js_1.it)("should call JSXElement visitor", () => {
8
+ const ast = (0, index_js_1.parse)("<Text>Hello</Text>");
9
+ const visits = [];
10
+ (0, traverse_js_1.traverse)(ast, {
11
+ JSXElement() {
12
+ visits.push("JSXElement");
13
+ },
14
+ });
15
+ (0, vitest_js_1.expect)(visits).toContain("JSXElement");
16
+ });
17
+ (0, vitest_js_1.it)("should call JSXFragment visitor", () => {
18
+ const ast = (0, index_js_1.parse)("<>Fragment</>");
19
+ const visits = [];
20
+ (0, traverse_js_1.traverse)(ast, {
21
+ JSXFragment() {
22
+ visits.push("JSXFragment");
23
+ },
24
+ });
25
+ (0, vitest_js_1.expect)(visits).toContain("JSXFragment");
26
+ });
27
+ (0, vitest_js_1.it)("should call Identifier visitor for expressions", () => {
28
+ const ast = (0, index_js_1.parse)("<Text>{props.value}</Text>");
29
+ const identifiers = [];
30
+ (0, traverse_js_1.traverse)(ast, {
31
+ Identifier(node) {
32
+ identifiers.push(node.name);
33
+ },
34
+ });
35
+ (0, vitest_js_1.expect)(identifiers).toContain("props");
36
+ });
37
+ (0, vitest_js_1.it)("should call JSXAttribute visitor", () => {
38
+ const ast = (0, index_js_1.parse)("<Text x={10} y={20}>Hello</Text>");
39
+ let attributeCount = 0;
40
+ (0, traverse_js_1.traverse)(ast, {
41
+ JSXAttribute() {
42
+ attributeCount++;
43
+ },
44
+ });
45
+ (0, vitest_js_1.expect)(attributeCount).toBe(2);
46
+ });
47
+ (0, vitest_js_1.it)("should call JSXExpressionContainer visitor", () => {
48
+ const ast = (0, index_js_1.parse)("<Text>{props.value}</Text>");
49
+ const visits = [];
50
+ (0, traverse_js_1.traverse)(ast, {
51
+ JSXExpressionContainer() {
52
+ visits.push("JSXExpressionContainer");
53
+ },
54
+ });
55
+ (0, vitest_js_1.expect)(visits).toContain("JSXExpressionContainer");
56
+ });
57
+ (0, vitest_js_1.it)("should traverse nested JSX elements", () => {
58
+ const ast = (0, index_js_1.parse)("<Outer><Inner>Text</Inner></Outer>");
59
+ let jsxCount = 0;
60
+ (0, traverse_js_1.traverse)(ast, {
61
+ JSXElement() {
62
+ jsxCount++;
63
+ },
64
+ });
65
+ (0, vitest_js_1.expect)(jsxCount).toBe(2);
66
+ });
67
+ (0, vitest_js_1.it)("should handle multiple visitor types simultaneously", () => {
68
+ const ast = (0, index_js_1.parse)("<Text x={props.value}>Hello</Text>");
69
+ const visits = [];
70
+ (0, traverse_js_1.traverse)(ast, {
71
+ JSXElement() {
72
+ visits.push("JSXElement");
73
+ },
74
+ JSXAttribute() {
75
+ visits.push("JSXAttribute");
76
+ },
77
+ Identifier(node) {
78
+ visits.push("Identifier:" + node.name);
79
+ },
80
+ });
81
+ (0, vitest_js_1.expect)(visits).toContain("JSXElement");
82
+ (0, vitest_js_1.expect)(visits).toContain("JSXAttribute");
83
+ (0, vitest_js_1.expect)(visits).toContain("Identifier:props");
84
+ });
85
+ });
86
+ //# sourceMappingURL=traverse.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traverse.test.js","sourceRoot":"","sources":["../src/traverse.test.ts"],"names":[],"mappings":";;AAAA,yCAAiD;AACjD,+CAAyC;AACzC,+CAAyC;AAEzC,IAAA,oBAAQ,EAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAA,cAAE,EAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,GAAG,GAAG,IAAA,gBAAK,EAAC,oBAAoB,CAAC,CAAC;QACxC,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,IAAA,sBAAQ,EAAC,GAAG,EAAE;YACZ,UAAU;gBACR,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC5B,CAAC;SACF,CAAC,CAAC;QAEH,IAAA,kBAAM,EAAC,MAAM,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,IAAA,cAAE,EAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,GAAG,GAAG,IAAA,gBAAK,EAAC,eAAe,CAAC,CAAC;QACnC,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,IAAA,sBAAQ,EAAC,GAAG,EAAE;YACZ,WAAW;gBACT,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC7B,CAAC;SACF,CAAC,CAAC;QAEH,IAAA,kBAAM,EAAC,MAAM,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,IAAA,cAAE,EAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,GAAG,GAAG,IAAA,gBAAK,EAAC,4BAA4B,CAAC,CAAC;QAChD,MAAM,WAAW,GAAa,EAAE,CAAC;QAEjC,IAAA,sBAAQ,EA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AAS,EAAE,GAAG,QAAQ,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAEnG,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,IAAI,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;AAE/E,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC"}
package/lib/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/lib/validate.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { AnalysisError } from "./analyze";
2
- import { ParseError } from "./parse";
3
- import { Schema } from "./schema";
1
+ import { AnalysisError } from "./analyze/index.js";
2
+ import { ParseError } from "./parse/index.js";
3
+ import { Schema } from "./schema.js";
4
4
  export type ValidateResult = {
5
5
  ok: true;
6
6
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,aAAa,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAAA;CAAE,CAAC;AAE7F,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACzB;AACD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EAEd,EAAE,WAAe,EAAE,GAAE,eAAoB,GACxC,cAAc,CAiBhB"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAS,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAAA;CAAE,CAAC;AAE7F,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACzB;AACD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EAEd,EAAE,WAAe,EAAE,GAAE,eAAoB,GACxC,cAAc,CAiBhB"}
package/lib/validate.js CHANGED
@@ -1,5 +1,8 @@
1
- import { analyze, AnalysisError } from "./analyze";
2
- import { parse, ParseError } from "./parse";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validate = validate;
4
+ const index_js_1 = require("./analyze/index.js");
5
+ const index_js_2 = require("./parse/index.js");
3
6
  /**
4
7
  * Validates JSX expression syntax and schema compliance without execution.
5
8
  *
@@ -24,19 +27,20 @@ import { parse, ParseError } from "./parse";
24
27
  * }
25
28
  * ```
26
29
  */
27
- export function validate(source, schema, { minSeverity = 3 } = {}) {
30
+ function validate(source, schema, { minSeverity = 3 } = {}) {
28
31
  try {
29
- const ast = parse(source);
30
- const report = analyze(ast, schema);
32
+ const ast = (0, index_js_2.parse)(source);
33
+ const report = (0, index_js_1.analyze)(ast, schema);
31
34
  if (report.hasIssues(minSeverity)) {
32
- return { ok: false, error: AnalysisError.fromReport(report) };
35
+ return { ok: false, error: index_js_1.AnalysisError.fromReport(report) };
33
36
  }
34
37
  return { ok: true };
35
38
  }
36
39
  catch (error) {
37
- if (error instanceof ParseError) {
40
+ if (error instanceof index_js_2.ParseError) {
38
41
  return { ok: false, error };
39
42
  }
40
43
  throw error;
41
44
  }
42
45
  }
46
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":";;AAoCA,4BAsBC;AA1DD,iDAA4D;AAC5D,+CAAqD;AAWrD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,QAAQ,CACtB,MAAc,EACd,MAAc,EAEd,EAAE,WAAW,GAAG,CAAC,KAAsB,EAAE;IAEzC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAA,gBAAK,EAAC,MAAM,CAAC,CAAC;QAC1B,MAAM,MAAM,GAAG,IAAA,kBAAO,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAEpC,IAAI,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;YAClC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,wBAAa,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAChE,CAAC;QAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACtB,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IAAI,KAAK,YAAY,qBAAU,EAAE,CAAC;YAChC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QAC9B,CAAC;QAED,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsxpression",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Validate and safely render JSX expressions",
5
5
  "author": "Divid AB <info@divid.se>",
6
6
  "repository": "https://github.com/dividab/abstract-visuals/tree/master/packages/jsxpression",
@@ -1,4 +1,4 @@
1
- import { AnalysisReport } from "./analysis-report";
1
+ import { AnalysisReport } from "./analysis-report.js";
2
2
 
3
3
  export class AnalysisError extends Error {
4
4
  static fromReport(report: AnalysisReport): AnalysisError {
@@ -1,5 +1,5 @@
1
- import { Range } from "./utils";
2
- import { ValidationContextSnapshot } from "./validation-context";
1
+ import { Range } from "./utils.js";
2
+ import { ValidationContextSnapshot } from "./validation-context.js";
3
3
 
4
4
  type IssueSeverity = 1 | 2 | 3;
5
5
 
@@ -1,8 +1,8 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { analyze } from "./analyze";
3
- import { parse } from "../parse";
4
- import { type Schema } from "../schema";
5
- import { getBuiltins } from "../builtins";
2
+ import { analyze } from "./analyze.js";
3
+ import { parse } from "../parse/index.js";
4
+ import { type Schema } from "../schema.js";
5
+ import { getBuiltins } from "../builtins.js";
6
6
 
7
7
  describe("analyze - consolidated tests", () => {
8
8
  const baseSchema = {
@@ -1,9 +1,9 @@
1
1
  import type { Program } from "acorn";
2
- import type { Schema } from "../schema";
3
- import { AnalysisReport } from "./analysis-report";
4
- import { analyzeSecurity } from "./security";
5
- import { analyzeJsx } from "./jsx";
6
- import { analyzeData } from "./data";
2
+ import type { Schema } from "../schema.js";
3
+ import { AnalysisReport } from "./analysis-report.js";
4
+ import { analyzeSecurity } from "./security/index.js";
5
+ import { analyzeJsx } from "./jsx/index.js";
6
+ import { analyzeData } from "./data/index.js";
7
7
 
8
8
  export function analyze(ast: Program, schema: Schema): AnalysisReport {
9
9
  return new AnalysisReport().merge(analyzeSecurity(ast, schema), analyzeJsx(ast, schema), analyzeData(ast, schema));
@@ -1,9 +1,9 @@
1
1
  import { Program } from "acorn";
2
- import { Schema } from "../../schema";
3
- import { AnalysisReport } from "../analysis-report";
4
- import { ValidationContext } from "../validation-context";
5
- import { analyzeDataAccess } from "./data-access";
6
- import { analyzeMethodCalls } from "./method-calls";
2
+ import { Schema } from "../../schema.js";
3
+ import { AnalysisReport } from "../analysis-report.js";
4
+ import { ValidationContext } from "../validation-context.js";
5
+ import { analyzeDataAccess } from "./data-access.js";
6
+ import { analyzeMethodCalls } from "./method-calls.js";
7
7
 
8
8
  export function analyzeData(ast: Program, schema: Schema): AnalysisReport {
9
9
  const validationContext = new ValidationContext();
@@ -1,10 +1,10 @@
1
1
  import type { Program } from "acorn";
2
- import { traverse } from "../../traverse";
3
- import type { ArrayPropertySchema, PropertySchema, Schema } from "../../schema";
4
- import { ValidationContext } from "../validation-context";
5
- import { AnalysisReport } from "../analysis-report";
6
- import { isSimpleDataAccess, extractPath, getParentNode, validateSchemaPath } from "./utils";
7
- import { getNodeRange } from "../utils";
2
+ import { traverse } from "../../traverse.js";
3
+ import type { ArrayPropertySchema, PropertySchema, Schema } from "../../schema.js";
4
+ import { ValidationContext } from "../validation-context.js";
5
+ import { AnalysisReport } from "../analysis-report.js";
6
+ import { isSimpleDataAccess, extractPath, getParentNode, validateSchemaPath } from "./utils.js";
7
+ import { getNodeRange } from "../utils.js";
8
8
 
9
9
  export function analyzeDataAccess(ast: Program, schema: Schema, validationContext: ValidationContext): AnalysisReport {
10
10
  const analysisReport = new AnalysisReport();
@@ -1 +1 @@
1
- export { analyzeData } from "./analyze";
1
+ export { analyzeData } from "./analyze.js";
@@ -1,11 +1,11 @@
1
1
  import type { Program } from "acorn";
2
- import { traverse } from "../../traverse";
3
- import type { Schema } from "../../schema";
4
- import { isMethodAllowed, getMethodDefinition, getMethodDisplayName } from "../../builtins";
5
- import { ValidationContext } from "../validation-context";
6
- import { AnalysisReport } from "../analysis-report";
7
- import { isSimpleDataAccess, extractPath, validateSchemaPath } from "./utils";
8
- import { getNodeRange } from "../utils";
2
+ import { traverse } from "../../traverse.js";
3
+ import type { Schema } from "../../schema.js";
4
+ import { isMethodAllowed, getMethodDefinition, getMethodDisplayName } from "../../builtins.js";
5
+ import { ValidationContext } from "../validation-context.js";
6
+ import { AnalysisReport } from "../analysis-report.js";
7
+ import { isSimpleDataAccess, extractPath, validateSchemaPath } from "./utils.js";
8
+ import { getNodeRange } from "../utils.js";
9
9
 
10
10
  export function analyzeMethodCalls(ast: Program, schema: Schema, validationContext: ValidationContext): AnalysisReport {
11
11
  const analysisReport = new AnalysisReport();
@@ -4,11 +4,11 @@ import {
4
4
  isAllowedOnString,
5
5
  getAvailableArrayMembers,
6
6
  getAvailableStringMembers,
7
- } from "../../builtins";
8
- import { Schema, ArrayPropertySchema, PropertySchema } from "../../schema";
9
- import { AnalysisReport } from "../analysis-report";
10
- import { getNodeRange } from "../utils";
11
- import { ValidationContext } from "../validation-context";
7
+ } from "../../builtins.js";
8
+ import { Schema, ArrayPropertySchema, PropertySchema } from "../../schema.js";
9
+ import { AnalysisReport } from "../analysis-report.js";
10
+ import { getNodeRange } from "../utils.js";
11
+ import { ValidationContext } from "../validation-context.js";
12
12
 
13
13
  export function isSimpleDataAccess(node: MemberExpression): boolean {
14
14
  if (node.computed) {
@@ -1,3 +1,3 @@
1
- export { analyze } from "./analyze";
2
- export { AnalysisError } from "./analysis-error";
3
- export { AnalysisReport } from "./analysis-report";
1
+ export { analyze } from "./analyze.js";
2
+ export { AnalysisError } from "./analysis-error.js";
3
+ export { AnalysisReport } from "./analysis-report.js";
@@ -1,10 +1,10 @@
1
1
  import { Program } from "acorn";
2
- import { Schema } from "../../schema";
3
- import { AnalysisReport } from "../analysis-report";
4
- import { ValidationContext } from "../validation-context";
5
- import { analyzeElementAttributes } from "./element-attributes";
6
- import { analyzeElementChildren } from "./element-children";
7
- import { analyzeElementTags } from "./element-tags";
2
+ import { Schema } from "../../schema.js";
3
+ import { AnalysisReport } from "../analysis-report.js";
4
+ import { ValidationContext } from "../validation-context.js";
5
+ import { analyzeElementAttributes } from "./element-attributes.js";
6
+ import { analyzeElementChildren } from "./element-children.js";
7
+ import { analyzeElementTags } from "./element-tags.js";
8
8
 
9
9
  export function analyzeJsx(ast: Program, schema: Schema): AnalysisReport {
10
10
  const validationContext = new ValidationContext();
@@ -1,5 +1,5 @@
1
1
  import type { Program } from "acorn";
2
- import { traverse } from "../../traverse";
2
+ import { traverse } from "../../traverse.js";
3
3
  import {
4
4
  type Schema,
5
5
  isAttributeAllowed,
@@ -7,12 +7,12 @@ import {
7
7
  getRequiredAttributes,
8
8
  getAttributeSchema,
9
9
  getEnumValues,
10
- } from "../../schema";
11
- import { isJsxAttribute, isJsxExpressionContainer, type JSXAttribute } from "../../jsx";
12
- import { ValidationContext } from "../validation-context";
13
- import { AnalysisReport } from "../analysis-report";
10
+ } from "../../schema.js";
11
+ import { isJsxAttribute, isJsxExpressionContainer, type JSXAttribute } from "../../jsx.js";
12
+ import { ValidationContext } from "../validation-context.js";
13
+ import { AnalysisReport } from "../analysis-report.js";
14
14
 
15
- import { getNodeRange, getAttributeSimilarityMatchers, getBestSimilarityMatcherSuggestion } from "../utils";
15
+ import { getNodeRange, getAttributeSimilarityMatchers, getBestSimilarityMatcherSuggestion } from "../utils.js";
16
16
 
17
17
  export function analyzeElementAttributes(
18
18
  ast: Program,
@@ -1,10 +1,10 @@
1
1
  import type { Program } from "acorn";
2
- import { traverse } from "../../traverse";
3
- import { type Schema, getAllowedChildren, isSelfClosing } from "../../schema";
4
- import { isJsxElement, isJsxFragment, isJsxText, isJsxLeafNode } from "../../jsx";
5
- import { ValidationContext } from "../validation-context";
6
- import { AnalysisReport } from "../analysis-report";
7
- import { getNodeRange, getElementSimilarityMatchers, getBestSimilarityMatcherSuggestion } from "../utils";
2
+ import { traverse } from "../../traverse.js";
3
+ import { type Schema, getAllowedChildren, isSelfClosing } from "../../schema.js";
4
+ import { isJsxElement, isJsxFragment, isJsxText, isJsxLeafNode } from "../../jsx.js";
5
+ import { ValidationContext } from "../validation-context.js";
6
+ import { AnalysisReport } from "../analysis-report.js";
7
+ import { getNodeRange, getElementSimilarityMatchers, getBestSimilarityMatcherSuggestion } from "../utils.js";
8
8
 
9
9
  export function analyzeElementChildren(
10
10
  ast: Program,
@@ -1,9 +1,9 @@
1
1
  import type { Program } from "acorn";
2
- import { traverse } from "../../traverse";
3
- import { type Schema, isElementAllowed, getAllElements } from "../../schema";
4
- import { ValidationContext } from "../validation-context";
5
- import { AnalysisReport } from "../analysis-report";
6
- import { getNodeRange, getElementSimilarityMatchers, getBestSimilarityMatcherSuggestion } from "../utils";
2
+ import { traverse } from "../../traverse.js";
3
+ import { type Schema, isElementAllowed, getAllElements } from "../../schema.js";
4
+ import { ValidationContext } from "../validation-context.js";
5
+ import { AnalysisReport } from "../analysis-report.js";
6
+ import { getNodeRange, getElementSimilarityMatchers, getBestSimilarityMatcherSuggestion } from "../utils.js";
7
7
 
8
8
  export function analyzeElementTags(ast: Program, schema: Schema, validationContext: ValidationContext): AnalysisReport {
9
9
  const analysisReport = new AnalysisReport();
@@ -1 +1 @@
1
- export { analyzeJsx } from "./analyze";
1
+ export { analyzeJsx } from "./analyze.js";
@@ -1,12 +1,12 @@
1
1
  import { Program } from "acorn";
2
- import { Schema } from "../../schema";
3
- import { AnalysisReport } from "../analysis-report";
4
- import { ValidationContext } from "../validation-context";
5
- import { analyzeCallExpressions } from "./call-expressions";
6
- import { analyzeDeclarations } from "./declarations";
7
- import { analyzeExpressions } from "./expressions";
8
- import { analyzeIdentifiers } from "./identifiers";
9
- import { analyzeMemberAccess } from "./member-access";
2
+ import { Schema } from "../../schema.js";
3
+ import { AnalysisReport } from "../analysis-report.js";
4
+ import { ValidationContext } from "../validation-context.js";
5
+ import { analyzeCallExpressions } from "./call-expressions.js";
6
+ import { analyzeDeclarations } from "./declarations.js";
7
+ import { analyzeExpressions } from "./expressions.js";
8
+ import { analyzeIdentifiers } from "./identifiers.js";
9
+ import { analyzeMemberAccess } from "./member-access.js";
10
10
 
11
11
  export function analyzeSecurity(ast: Program, schema: Schema): AnalysisReport {
12
12
  const validationContext = new ValidationContext();
@@ -1,9 +1,9 @@
1
1
  import type { Program } from "acorn";
2
- import { traverse } from "../../traverse";
3
- import type { Schema } from "../../schema";
4
- import { ValidationContext } from "../validation-context";
5
- import { AnalysisReport } from "../analysis-report";
6
- import { getNodeRange } from "../utils";
2
+ import { traverse } from "../../traverse.js";
3
+ import type { Schema } from "../../schema.js";
4
+ import { ValidationContext } from "../validation-context.js";
5
+ import { AnalysisReport } from "../analysis-report.js";
6
+ import { getNodeRange } from "../utils.js";
7
7
 
8
8
  export function analyzeCallExpressions(
9
9
  ast: Program,
@@ -1,9 +1,9 @@
1
1
  import type { Program } from "acorn";
2
- import { traverse } from "../../traverse";
3
- import type { Schema } from "../../schema";
4
- import { ValidationContext } from "../validation-context";
5
- import { AnalysisReport } from "../analysis-report";
6
- import { getNodeRange } from "../utils";
2
+ import { traverse } from "../../traverse.js";
3
+ import type { Schema } from "../../schema.js";
4
+ import { ValidationContext } from "../validation-context.js";
5
+ import { AnalysisReport } from "../analysis-report.js";
6
+ import { getNodeRange } from "../utils.js";
7
7
 
8
8
  export function analyzeDeclarations(
9
9
  ast: Program,
@@ -1,9 +1,9 @@
1
1
  import type { Program } from "acorn";
2
- import { traverse } from "../../traverse";
3
- import type { Schema } from "../../schema";
4
- import { ValidationContext } from "../validation-context";
5
- import { AnalysisReport } from "../analysis-report";
6
- import { getNodeRange } from "../utils";
2
+ import { traverse } from "../../traverse.js";
3
+ import type { Schema } from "../../schema.js";
4
+ import { ValidationContext } from "../validation-context.js";
5
+ import { AnalysisReport } from "../analysis-report.js";
6
+ import { getNodeRange } from "../utils.js";
7
7
 
8
8
  export function analyzeExpressions(
9
9
  ast: Program,
@@ -1,10 +1,10 @@
1
1
  import type { AnyNode, ArrowFunctionExpression, Identifier, Program } from "acorn";
2
- import { traverse } from "../../traverse";
3
- import type { Schema } from "../../schema";
4
- import { getBuiltinGlobals } from "../../builtins";
5
- import { ValidationContext } from "../validation-context";
6
- import { AnalysisReport } from "../analysis-report";
7
- import { getNodeRange } from "../utils";
2
+ import { traverse } from "../../traverse.js";
3
+ import type { Schema } from "../../schema.js";
4
+ import { getBuiltinGlobals } from "../../builtins.js";
5
+ import { ValidationContext } from "../validation-context.js";
6
+ import { AnalysisReport } from "../analysis-report.js";
7
+ import { getNodeRange } from "../utils.js";
8
8
 
9
9
  export function analyzeIdentifiers(
10
10
  ast: Program,
@@ -1 +1 @@
1
- export { analyzeSecurity } from "./analyze";
1
+ export { analyzeSecurity } from "./analyze.js";
@@ -1,9 +1,9 @@
1
1
  import type { Program, Expression, Super } from "acorn";
2
- import { traverse } from "../../traverse";
3
- import type { Schema } from "../../schema";
4
- import { ValidationContext } from "../validation-context";
5
- import { AnalysisReport } from "../analysis-report";
6
- import { getNodeRange } from "../utils";
2
+ import { traverse } from "../../traverse.js";
3
+ import type { Schema } from "../../schema.js";
4
+ import { ValidationContext } from "../validation-context.js";
5
+ import { AnalysisReport } from "../analysis-report.js";
6
+ import { getNodeRange } from "../utils.js";
7
7
 
8
8
  export function analyzeMemberAccess(
9
9
  ast: Program,
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { generateTypeScriptDefinitions } from "./generate-typescript-definitions";
3
- import type { Schema } from "../schema";
2
+ import { generateTypeScriptDefinitions } from "./generate-typescript-definitions.js";
3
+ import type { Schema } from "../schema.js";
4
4
 
5
5
  describe("generateTypeScriptDefinitions", () => {
6
6
  describe("basic structure", () => {
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { compile } from "../compile";
3
- import { parse } from "../parse";
2
+ import { compile } from "../compile/index.js";
3
+ import { parse } from "../parse/index.js";
4
4
 
5
5
  describe("compile", () => {
6
6
  it("should compile ternary expression", () => {
@@ -15,8 +15,8 @@ import {
15
15
  type JSXAttribute,
16
16
  type JSXSpreadAttribute,
17
17
  type JSXNameNode,
18
- } from "../jsx";
19
- import { CompilationError } from "./compilation-error";
18
+ } from "../jsx.js";
19
+ import { CompilationError } from "./compilation-error.js";
20
20
 
21
21
  type CompilableExpression = Expression | PrivateIdentifier | Super | JSXElement | JSXFragment | JSXEmptyExpression;
22
22
 
@@ -1,2 +1,2 @@
1
- export { compile } from "./compile";
2
- export { CompilationError } from "./compilation-error";
1
+ export { compile } from "./compile.js";
2
+ export { CompilationError } from "./compilation-error.js";