ether-code 0.1.6 → 0.1.7

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 (44) hide show
  1. package/cli/ether.js +1 -1
  2. package/generators/css-generator.js +42 -55
  3. package/generators/graphql-generator.js +19 -22
  4. package/generators/html-generator.js +51 -220
  5. package/generators/js-generator.js +76 -157
  6. package/generators/node-generator.js +49 -93
  7. package/generators/php-generator.js +46 -68
  8. package/generators/python-generator.js +35 -54
  9. package/generators/react-generator.js +37 -47
  10. package/generators/ruby-generator.js +59 -119
  11. package/generators/sql-generator.js +42 -63
  12. package/generators/ts-generator.js +59 -133
  13. package/i18n/i18n-css.json +147 -147
  14. package/i18n/i18n-graphql.json +6 -6
  15. package/i18n/i18n-html.json +135 -135
  16. package/i18n/i18n-js.json +107 -107
  17. package/i18n/i18n-node.json +14 -14
  18. package/i18n/i18n-php.json +177 -177
  19. package/i18n/i18n-python.json +16 -16
  20. package/i18n/i18n-react.json +97 -97
  21. package/i18n/i18n-ruby.json +22 -22
  22. package/i18n/i18n-sql.json +153 -153
  23. package/i18n/i18n-ts.json +10 -10
  24. package/lexer/ether-lexer.js +175 -34
  25. package/lexer/tokens.js +6 -6
  26. package/package.json +1 -1
  27. package/parsers/ast-css.js +0 -545
  28. package/parsers/ast-graphql.js +0 -424
  29. package/parsers/ast-html.js +0 -886
  30. package/parsers/ast-js.js +0 -750
  31. package/parsers/ast-node.js +0 -2440
  32. package/parsers/ast-php.js +0 -957
  33. package/parsers/ast-react.js +0 -580
  34. package/parsers/ast-ruby.js +0 -895
  35. package/parsers/ast-ts.js +0 -1352
  36. package/parsers/css-parser.js +0 -1981
  37. package/parsers/graphql-parser.js +0 -2011
  38. package/parsers/html-parser.js +0 -1182
  39. package/parsers/js-parser.js +0 -2564
  40. package/parsers/node-parser.js +0 -2644
  41. package/parsers/php-parser.js +0 -3037
  42. package/parsers/react-parser.js +0 -1035
  43. package/parsers/ruby-parser.js +0 -2680
  44. package/parsers/ts-parser.js +0 -3881
@@ -1,580 +0,0 @@
1
- const JSAST = require('./ast-js')
2
-
3
- class JSXElement extends JSAST.ASTNode {
4
- constructor(openingElement, closingElement = null, children = [], loc = null) {
5
- super('JSXElement', loc)
6
- this.openingElement = openingElement
7
- this.closingElement = closingElement
8
- this.children = children
9
- }
10
- }
11
-
12
- class JSXOpeningElement extends JSAST.ASTNode {
13
- constructor(name, attributes = [], selfClosing = false, loc = null) {
14
- super('JSXOpeningElement', loc)
15
- this.name = name
16
- this.attributes = attributes
17
- this.selfClosing = selfClosing
18
- }
19
- }
20
-
21
- class JSXClosingElement extends JSAST.ASTNode {
22
- constructor(name, loc = null) {
23
- super('JSXClosingElement', loc)
24
- this.name = name
25
- }
26
- }
27
-
28
- class JSXFragment extends JSAST.ASTNode {
29
- constructor(openingFragment, closingFragment, children = [], loc = null) {
30
- super('JSXFragment', loc)
31
- this.openingFragment = openingFragment
32
- this.closingFragment = closingFragment
33
- this.children = children
34
- }
35
- }
36
-
37
- class JSXOpeningFragment extends JSAST.ASTNode {
38
- constructor(loc = null) {
39
- super('JSXOpeningFragment', loc)
40
- }
41
- }
42
-
43
- class JSXClosingFragment extends JSAST.ASTNode {
44
- constructor(loc = null) {
45
- super('JSXClosingFragment', loc)
46
- }
47
- }
48
-
49
- class JSXIdentifier extends JSAST.ASTNode {
50
- constructor(name, loc = null) {
51
- super('JSXIdentifier', loc)
52
- this.name = name
53
- }
54
- }
55
-
56
- class JSXMemberExpression extends JSAST.ASTNode {
57
- constructor(object, property, loc = null) {
58
- super('JSXMemberExpression', loc)
59
- this.object = object
60
- this.property = property
61
- }
62
- }
63
-
64
- class JSXNamespacedName extends JSAST.ASTNode {
65
- constructor(namespace, name, loc = null) {
66
- super('JSXNamespacedName', loc)
67
- this.namespace = namespace
68
- this.name = name
69
- }
70
- }
71
-
72
- class JSXAttribute extends JSAST.ASTNode {
73
- constructor(name, value = null, loc = null) {
74
- super('JSXAttribute', loc)
75
- this.name = name
76
- this.value = value
77
- }
78
- }
79
-
80
- class JSXSpreadAttribute extends JSAST.ASTNode {
81
- constructor(argument, loc = null) {
82
- super('JSXSpreadAttribute', loc)
83
- this.argument = argument
84
- }
85
- }
86
-
87
- class JSXText extends JSAST.ASTNode {
88
- constructor(value, raw = null, loc = null) {
89
- super('JSXText', loc)
90
- this.value = value
91
- this.raw = raw || value
92
- }
93
- }
94
-
95
- class JSXExpressionContainer extends JSAST.ASTNode {
96
- constructor(expression, loc = null) {
97
- super('JSXExpressionContainer', loc)
98
- this.expression = expression
99
- }
100
- }
101
-
102
- class JSXSpreadChild extends JSAST.ASTNode {
103
- constructor(expression, loc = null) {
104
- super('JSXSpreadChild', loc)
105
- this.expression = expression
106
- }
107
- }
108
-
109
- class JSXEmptyExpression extends JSAST.ASTNode {
110
- constructor(loc = null) {
111
- super('JSXEmptyExpression', loc)
112
- }
113
- }
114
-
115
- class ReactComponent extends JSAST.ASTNode {
116
- constructor(name, type = 'function', props = [], body = null, loc = null) {
117
- super('ReactComponent', loc)
118
- this.name = name
119
- this.componentType = type
120
- this.props = props
121
- this.body = body
122
- }
123
- }
124
-
125
- class ReactHookCall extends JSAST.ASTNode {
126
- constructor(hookName, arguments_ = [], loc = null) {
127
- super('ReactHookCall', loc)
128
- this.hookName = hookName
129
- this.arguments = arguments_
130
- }
131
- }
132
-
133
- class UseStateHook extends JSAST.ASTNode {
134
- constructor(stateName, setterName, initialValue = null, loc = null) {
135
- super('UseStateHook', loc)
136
- this.stateName = stateName
137
- this.setterName = setterName
138
- this.initialValue = initialValue
139
- }
140
- }
141
-
142
- class UseEffectHook extends JSAST.ASTNode {
143
- constructor(callback, dependencies = null, loc = null) {
144
- super('UseEffectHook', loc)
145
- this.callback = callback
146
- this.dependencies = dependencies
147
- }
148
- }
149
-
150
- class UseRefHook extends JSAST.ASTNode {
151
- constructor(refName, initialValue = null, loc = null) {
152
- super('UseRefHook', loc)
153
- this.refName = refName
154
- this.initialValue = initialValue
155
- }
156
- }
157
-
158
- class UseContextHook extends JSAST.ASTNode {
159
- constructor(context, loc = null) {
160
- super('UseContextHook', loc)
161
- this.context = context
162
- }
163
- }
164
-
165
- class UseReducerHook extends JSAST.ASTNode {
166
- constructor(stateName, dispatchName, reducer, initialState, loc = null) {
167
- super('UseReducerHook', loc)
168
- this.stateName = stateName
169
- this.dispatchName = dispatchName
170
- this.reducer = reducer
171
- this.initialState = initialState
172
- }
173
- }
174
-
175
- class UseMemoHook extends JSAST.ASTNode {
176
- constructor(factory, dependencies = [], loc = null) {
177
- super('UseMemoHook', loc)
178
- this.factory = factory
179
- this.dependencies = dependencies
180
- }
181
- }
182
-
183
- class UseCallbackHook extends JSAST.ASTNode {
184
- constructor(callback, dependencies = [], loc = null) {
185
- super('UseCallbackHook', loc)
186
- this.callback = callback
187
- this.dependencies = dependencies
188
- }
189
- }
190
-
191
- class UseTransitionHook extends JSAST.ASTNode {
192
- constructor(isPendingName, startTransitionName, loc = null) {
193
- super('UseTransitionHook', loc)
194
- this.isPendingName = isPendingName
195
- this.startTransitionName = startTransitionName
196
- }
197
- }
198
-
199
- class UseDeferredValueHook extends JSAST.ASTNode {
200
- constructor(value, loc = null) {
201
- super('UseDeferredValueHook', loc)
202
- this.value = value
203
- }
204
- }
205
-
206
- class UseIdHook extends JSAST.ASTNode {
207
- constructor(idName, loc = null) {
208
- super('UseIdHook', loc)
209
- this.idName = idName
210
- }
211
- }
212
-
213
- class UseImperativeHandleHook extends JSAST.ASTNode {
214
- constructor(ref, createHandle, dependencies = null, loc = null) {
215
- super('UseImperativeHandleHook', loc)
216
- this.ref = ref
217
- this.createHandle = createHandle
218
- this.dependencies = dependencies
219
- }
220
- }
221
-
222
- class UseLayoutEffectHook extends JSAST.ASTNode {
223
- constructor(callback, dependencies = null, loc = null) {
224
- super('UseLayoutEffectHook', loc)
225
- this.callback = callback
226
- this.dependencies = dependencies
227
- }
228
- }
229
-
230
- class UseInsertionEffectHook extends JSAST.ASTNode {
231
- constructor(callback, dependencies = null, loc = null) {
232
- super('UseInsertionEffectHook', loc)
233
- this.callback = callback
234
- this.dependencies = dependencies
235
- }
236
- }
237
-
238
- class UseSyncExternalStoreHook extends JSAST.ASTNode {
239
- constructor(subscribe, getSnapshot, getServerSnapshot = null, loc = null) {
240
- super('UseSyncExternalStoreHook', loc)
241
- this.subscribe = subscribe
242
- this.getSnapshot = getSnapshot
243
- this.getServerSnapshot = getServerSnapshot
244
- }
245
- }
246
-
247
- class UseDebugValueHook extends JSAST.ASTNode {
248
- constructor(value, formatter = null, loc = null) {
249
- super('UseDebugValueHook', loc)
250
- this.value = value
251
- this.formatter = formatter
252
- }
253
- }
254
-
255
- class UseActionStateHook extends JSAST.ASTNode {
256
- constructor(stateName, actionName, action, initialState, permalink = null, loc = null) {
257
- super('UseActionStateHook', loc)
258
- this.stateName = stateName
259
- this.actionName = actionName
260
- this.action = action
261
- this.initialState = initialState
262
- this.permalink = permalink
263
- }
264
- }
265
-
266
- class UseFormStatusHook extends JSAST.ASTNode {
267
- constructor(loc = null) {
268
- super('UseFormStatusHook', loc)
269
- }
270
- }
271
-
272
- class UseOptimisticHook extends JSAST.ASTNode {
273
- constructor(optimisticName, setOptimisticName, state, updateFn, loc = null) {
274
- super('UseOptimisticHook', loc)
275
- this.optimisticName = optimisticName
276
- this.setOptimisticName = setOptimisticName
277
- this.state = state
278
- this.updateFn = updateFn
279
- }
280
- }
281
-
282
- class UseHook extends JSAST.ASTNode {
283
- constructor(resource, loc = null) {
284
- super('UseHook', loc)
285
- this.resource = resource
286
- }
287
- }
288
-
289
- class ReactDirective extends JSAST.ASTNode {
290
- constructor(directive, loc = null) {
291
- super('ReactDirective', loc)
292
- this.directive = directive
293
- }
294
- }
295
-
296
- class CreateContextCall extends JSAST.ASTNode {
297
- constructor(defaultValue = null, loc = null) {
298
- super('CreateContextCall', loc)
299
- this.defaultValue = defaultValue
300
- }
301
- }
302
-
303
- class ContextProvider extends JSAST.ASTNode {
304
- constructor(context, value, children = [], loc = null) {
305
- super('ContextProvider', loc)
306
- this.context = context
307
- this.value = value
308
- this.children = children
309
- }
310
- }
311
-
312
- class ContextConsumer extends JSAST.ASTNode {
313
- constructor(context, children, loc = null) {
314
- super('ContextConsumer', loc)
315
- this.context = context
316
- this.children = children
317
- }
318
- }
319
-
320
- class ForwardRefCall extends JSAST.ASTNode {
321
- constructor(render, loc = null) {
322
- super('ForwardRefCall', loc)
323
- this.render = render
324
- }
325
- }
326
-
327
- class MemoCall extends JSAST.ASTNode {
328
- constructor(component, areEqual = null, loc = null) {
329
- super('MemoCall', loc)
330
- this.component = component
331
- this.areEqual = areEqual
332
- }
333
- }
334
-
335
- class LazyCall extends JSAST.ASTNode {
336
- constructor(load, loc = null) {
337
- super('LazyCall', loc)
338
- this.load = load
339
- }
340
- }
341
-
342
- class SuspenseComponent extends JSAST.ASTNode {
343
- constructor(fallback, children = [], loc = null) {
344
- super('SuspenseComponent', loc)
345
- this.fallback = fallback
346
- this.children = children
347
- }
348
- }
349
-
350
- class StrictModeComponent extends JSAST.ASTNode {
351
- constructor(children = [], loc = null) {
352
- super('StrictModeComponent', loc)
353
- this.children = children
354
- }
355
- }
356
-
357
- class ProfilerComponent extends JSAST.ASTNode {
358
- constructor(id, onRender, children = [], loc = null) {
359
- super('ProfilerComponent', loc)
360
- this.id = id
361
- this.onRender = onRender
362
- this.children = children
363
- }
364
- }
365
-
366
- class ErrorBoundary extends JSAST.ASTNode {
367
- constructor(fallback, onError = null, children = [], loc = null) {
368
- super('ErrorBoundary', loc)
369
- this.fallback = fallback
370
- this.onError = onError
371
- this.children = children
372
- }
373
- }
374
-
375
- class CreatePortalCall extends JSAST.ASTNode {
376
- constructor(children, container, key = null, loc = null) {
377
- super('CreatePortalCall', loc)
378
- this.children = children
379
- this.container = container
380
- this.key = key
381
- }
382
- }
383
-
384
- class CreateRootCall extends JSAST.ASTNode {
385
- constructor(container, options = null, loc = null) {
386
- super('CreateRootCall', loc)
387
- this.container = container
388
- this.options = options
389
- }
390
- }
391
-
392
- class HydrateRootCall extends JSAST.ASTNode {
393
- constructor(container, initialChildren, options = null, loc = null) {
394
- super('HydrateRootCall', loc)
395
- this.container = container
396
- this.initialChildren = initialChildren
397
- this.options = options
398
- }
399
- }
400
-
401
- class StartTransitionCall extends JSAST.ASTNode {
402
- constructor(callback, loc = null) {
403
- super('StartTransitionCall', loc)
404
- this.callback = callback
405
- }
406
- }
407
-
408
- class FlushSyncCall extends JSAST.ASTNode {
409
- constructor(callback, loc = null) {
410
- super('FlushSyncCall', loc)
411
- this.callback = callback
412
- }
413
- }
414
-
415
- class CreateElementCall extends JSAST.ASTNode {
416
- constructor(type, props = null, children = [], loc = null) {
417
- super('CreateElementCall', loc)
418
- this.elementType = type
419
- this.props = props
420
- this.children = children
421
- }
422
- }
423
-
424
- class CloneElementCall extends JSAST.ASTNode {
425
- constructor(element, props = null, children = [], loc = null) {
426
- super('CloneElementCall', loc)
427
- this.element = element
428
- this.props = props
429
- this.children = children
430
- }
431
- }
432
-
433
- class IsValidElementCall extends JSAST.ASTNode {
434
- constructor(object, loc = null) {
435
- super('IsValidElementCall', loc)
436
- this.object = object
437
- }
438
- }
439
-
440
- class ChildrenMapCall extends JSAST.ASTNode {
441
- constructor(children, fn, thisArg = null, loc = null) {
442
- super('ChildrenMapCall', loc)
443
- this.children = children
444
- this.fn = fn
445
- this.thisArg = thisArg
446
- }
447
- }
448
-
449
- class ChildrenForEachCall extends JSAST.ASTNode {
450
- constructor(children, fn, thisArg = null, loc = null) {
451
- super('ChildrenForEachCall', loc)
452
- this.children = children
453
- this.fn = fn
454
- this.thisArg = thisArg
455
- }
456
- }
457
-
458
- class ChildrenCountCall extends JSAST.ASTNode {
459
- constructor(children, loc = null) {
460
- super('ChildrenCountCall', loc)
461
- this.children = children
462
- }
463
- }
464
-
465
- class ChildrenOnlyCall extends JSAST.ASTNode {
466
- constructor(children, loc = null) {
467
- super('ChildrenOnlyCall', loc)
468
- this.children = children
469
- }
470
- }
471
-
472
- class ChildrenToArrayCall extends JSAST.ASTNode {
473
- constructor(children, loc = null) {
474
- super('ChildrenToArrayCall', loc)
475
- this.children = children
476
- }
477
- }
478
-
479
- class ServerActionFunction extends JSAST.ASTNode {
480
- constructor(name, params = [], body, loc = null) {
481
- super('ServerActionFunction', loc)
482
- this.name = name
483
- this.params = params
484
- this.body = body
485
- }
486
- }
487
-
488
- class FormActionAttribute extends JSAST.ASTNode {
489
- constructor(action, loc = null) {
490
- super('FormActionAttribute', loc)
491
- this.action = action
492
- }
493
- }
494
-
495
- class EtherReactComponent extends JSAST.ASTNode {
496
- constructor(name, props = [], returnJSX, hooks = [], loc = null) {
497
- super('EtherReactComponent', loc)
498
- this.name = name
499
- this.props = props
500
- this.returnJSX = returnJSX
501
- this.hooks = hooks
502
- }
503
- }
504
-
505
- class EtherHookDeclaration extends JSAST.ASTNode {
506
- constructor(hookType, bindings = [], arguments_ = [], loc = null) {
507
- super('EtherHookDeclaration', loc)
508
- this.hookType = hookType
509
- this.bindings = bindings
510
- this.arguments = arguments_
511
- }
512
- }
513
-
514
- module.exports = {
515
- ...JSAST,
516
- JSXElement,
517
- JSXOpeningElement,
518
- JSXClosingElement,
519
- JSXFragment,
520
- JSXOpeningFragment,
521
- JSXClosingFragment,
522
- JSXIdentifier,
523
- JSXMemberExpression,
524
- JSXNamespacedName,
525
- JSXAttribute,
526
- JSXSpreadAttribute,
527
- JSXText,
528
- JSXExpressionContainer,
529
- JSXSpreadChild,
530
- JSXEmptyExpression,
531
- ReactComponent,
532
- ReactHookCall,
533
- UseStateHook,
534
- UseEffectHook,
535
- UseRefHook,
536
- UseContextHook,
537
- UseReducerHook,
538
- UseMemoHook,
539
- UseCallbackHook,
540
- UseTransitionHook,
541
- UseDeferredValueHook,
542
- UseIdHook,
543
- UseImperativeHandleHook,
544
- UseLayoutEffectHook,
545
- UseInsertionEffectHook,
546
- UseSyncExternalStoreHook,
547
- UseDebugValueHook,
548
- UseActionStateHook,
549
- UseFormStatusHook,
550
- UseOptimisticHook,
551
- UseHook,
552
- ReactDirective,
553
- CreateContextCall,
554
- ContextProvider,
555
- ContextConsumer,
556
- ForwardRefCall,
557
- MemoCall,
558
- LazyCall,
559
- SuspenseComponent,
560
- StrictModeComponent,
561
- ProfilerComponent,
562
- ErrorBoundary,
563
- CreatePortalCall,
564
- CreateRootCall,
565
- HydrateRootCall,
566
- StartTransitionCall,
567
- FlushSyncCall,
568
- CreateElementCall,
569
- CloneElementCall,
570
- IsValidElementCall,
571
- ChildrenMapCall,
572
- ChildrenForEachCall,
573
- ChildrenCountCall,
574
- ChildrenOnlyCall,
575
- ChildrenToArrayCall,
576
- ServerActionFunction,
577
- FormActionAttribute,
578
- EtherReactComponent,
579
- EtherHookDeclaration
580
- }