ripple 0.2.96 → 0.2.97

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ripple is an elegant TypeScript UI framework",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.2.96",
6
+ "version": "0.2.97",
7
7
  "type": "module",
8
8
  "module": "src/runtime/index-client.js",
9
9
  "main": "src/runtime/index-client.js",
@@ -1,3 +1,5 @@
1
+ /** @import {Expression, FunctionExpression} from 'estree' */
2
+
1
3
  import { walk } from 'zimmerframe';
2
4
  import path from 'node:path';
3
5
  import { print } from 'esrap';
@@ -195,6 +197,9 @@ const visitors = {
195
197
  },
196
198
 
197
199
  CallExpression(node, context) {
200
+ if (!context.state.to_ts) {
201
+ delete node.typeArguments;
202
+ }
198
203
  const callee = node.callee;
199
204
  const parent = context.path.at(-1);
200
205
 
@@ -407,29 +412,13 @@ const visitors = {
407
412
  },
408
413
 
409
414
  VariableDeclaration(node, context) {
410
- const declarations = [];
411
-
412
415
  for (const declarator of node.declarations) {
413
- const metadata = declarator.metadata;
414
-
415
- if (declarator.id.type === 'Identifier') {
416
- const binding = context.state.scope.get(declarator.id.name);
417
-
418
- if (!context.state.to_ts) {
419
- delete declarator.id.typeAnnotation;
420
- }
421
-
422
- declarations.push(context.visit(declarator));
423
- } else {
424
- if (!context.state.to_ts) {
425
- delete declarator.id.typeAnnotation;
426
- }
427
-
428
- declarations.push(context.visit(declarator));
416
+ if (!context.state.to_ts) {
417
+ delete declarator.id.typeAnnotation;
429
418
  }
430
419
  }
431
420
 
432
- return { ...node, declarations };
421
+ return context.next();
433
422
  },
434
423
 
435
424
  FunctionDeclaration(node, context) {
@@ -106,6 +106,45 @@ const visitors = {
106
106
  );
107
107
  },
108
108
 
109
+ CallExpression(node, context) {
110
+ if (!context.state.to_ts) {
111
+ delete node.typeArguments;
112
+ }
113
+ return context.next();
114
+ },
115
+
116
+ PropertyDefinition(node, context) {
117
+ if (!context.state.to_ts) {
118
+ delete node.typeAnnotation;
119
+ }
120
+ return context.next();
121
+ },
122
+
123
+ TSAsExpression(node, context) {
124
+ if (!context.state.to_ts) {
125
+ return context.visit(node.expression);
126
+ }
127
+ return context.next();
128
+ },
129
+
130
+ ExportNamedDeclaration(node, context) {
131
+ if (!context.state.to_ts && node.exportKind === 'type') {
132
+ return b.empty;
133
+ }
134
+
135
+ return context.next();
136
+ },
137
+
138
+ VariableDeclaration(node, context) {
139
+ for (const declarator of node.declarations) {
140
+ if (!context.state.to_ts) {
141
+ delete declarator.id.typeAnnotation;
142
+ }
143
+ }
144
+
145
+ return context.next();
146
+ },
147
+
109
148
  Element(node, context) {
110
149
  const { state, visit } = context;
111
150