ripple 0.2.6 → 0.2.8
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/README.md +1 -1
- package/package.json +1 -1
- package/src/compiler/errors.js +20 -22
- package/src/compiler/phases/1-parse/index.js +21 -19
- package/src/compiler/phases/1-parse/style.js +27 -27
- package/src/compiler/phases/2-analyze/index.js +25 -25
- package/src/compiler/phases/2-analyze/prune.js +64 -27
- package/src/compiler/phases/3-transform/index.js +150 -113
- package/src/compiler/phases/3-transform/segments.js +25 -20
- package/src/compiler/phases/3-transform/stylesheet.js +28 -28
- package/src/compiler/scope.js +3 -3
- package/src/compiler/utils.js +7 -9
- package/src/constants.js +1 -2
- package/src/jsx-runtime.d.ts +59 -59
- package/src/jsx-runtime.js +13 -13
- package/src/runtime/array.js +15 -15
- package/src/runtime/index.js +2 -0
- package/src/runtime/internal/client/blocks.js +16 -5
- package/src/runtime/internal/client/constants.js +1 -1
- package/src/runtime/internal/client/events.js +2 -2
- package/src/runtime/internal/client/for.js +6 -7
- package/src/runtime/internal/client/operations.js +1 -1
- package/src/runtime/internal/client/runtime.js +41 -20
- package/src/runtime/internal/client/template.js +1 -1
- package/src/runtime/internal/client/try.js +2 -2
- package/src/utils/ast.js +9 -9
- package/src/utils/builders.js +66 -28
- package/tests/__snapshots__/for.test.ripple.snap +81 -0
- package/tests/basic.test.ripple +292 -263
- package/tests/composite.test.ripple +151 -0
- package/tests/for.test.ripple +58 -0
- package/tests/ref.test.ripple +52 -0
- package/tests/use.test.ripple +24 -22
- package/types/index.d.ts +7 -1
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
destroy_non_branch_children,
|
|
4
4
|
effect,
|
|
5
5
|
is_destroyed,
|
|
6
|
-
render
|
|
6
|
+
render,
|
|
7
7
|
} from './blocks.js';
|
|
8
8
|
import {
|
|
9
9
|
ASYNC_BLOCK,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
TRACKED_OBJECT,
|
|
24
24
|
TRY_BLOCK,
|
|
25
25
|
UNINITIALIZED,
|
|
26
|
-
USE_PROP
|
|
26
|
+
USE_PROP,
|
|
27
27
|
} from './constants';
|
|
28
28
|
import { capture, suspend } from './try.js';
|
|
29
29
|
import { define_property, is_array } from './utils';
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
object_keys as original_object_keys,
|
|
32
32
|
object_values as original_object_values,
|
|
33
33
|
object_entries as original_object_entries,
|
|
34
|
-
structured_clone as original_structured_clone
|
|
34
|
+
structured_clone as original_structured_clone,
|
|
35
35
|
} from './utils.js';
|
|
36
36
|
|
|
37
37
|
const FLUSH_MICROTASK = 0;
|
|
@@ -215,7 +215,7 @@ export function tracked(v, b) {
|
|
|
215
215
|
b,
|
|
216
216
|
c: 0,
|
|
217
217
|
f: TRACKED,
|
|
218
|
-
v
|
|
218
|
+
v,
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
221
|
|
|
@@ -227,7 +227,7 @@ export function computed(fn, block) {
|
|
|
227
227
|
d: null,
|
|
228
228
|
f: TRACKED | COMPUTED,
|
|
229
229
|
fn,
|
|
230
|
-
v: UNINITIALIZED
|
|
230
|
+
v: UNINITIALIZED,
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
233
|
|
|
@@ -246,7 +246,7 @@ function create_dependency(tracked) {
|
|
|
246
246
|
return {
|
|
247
247
|
c: tracked.c,
|
|
248
248
|
t: tracked,
|
|
249
|
-
n: null
|
|
249
|
+
n: null,
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
252
|
|
|
@@ -351,7 +351,7 @@ export function deferred(fn) {
|
|
|
351
351
|
|
|
352
352
|
define_property(res, TRACKED_OBJECT, {
|
|
353
353
|
value: tracked_properties,
|
|
354
|
-
enumerable: false
|
|
354
|
+
enumerable: false,
|
|
355
355
|
});
|
|
356
356
|
|
|
357
357
|
render(() => {
|
|
@@ -618,12 +618,6 @@ export function set(tracked, value, block) {
|
|
|
618
618
|
|
|
619
619
|
tracked.v = value;
|
|
620
620
|
tracked.c = increment_clock();
|
|
621
|
-
|
|
622
|
-
if (tracked_block !== block) {
|
|
623
|
-
throw new Error(
|
|
624
|
-
'Tracked state can only be updated within the same component context that it was created in (that includes effects or event handler within that component).'
|
|
625
|
-
);
|
|
626
|
-
}
|
|
627
621
|
schedule_update(tracked_block);
|
|
628
622
|
}
|
|
629
623
|
}
|
|
@@ -674,7 +668,7 @@ export function tracked_spread_object(fn) {
|
|
|
674
668
|
|
|
675
669
|
define_property(obj, SPREAD_OBJECT, {
|
|
676
670
|
value: fn,
|
|
677
|
-
enumerable: false
|
|
671
|
+
enumerable: false,
|
|
678
672
|
});
|
|
679
673
|
|
|
680
674
|
return obj;
|
|
@@ -687,7 +681,7 @@ export function tracked_object(obj, properties, block) {
|
|
|
687
681
|
tracked_properties = {};
|
|
688
682
|
define_property(obj, TRACKED_OBJECT, {
|
|
689
683
|
value: tracked_properties,
|
|
690
|
-
enumerable: false
|
|
684
|
+
enumerable: false,
|
|
691
685
|
});
|
|
692
686
|
}
|
|
693
687
|
|
|
@@ -717,7 +711,7 @@ export function tracked_object(obj, properties, block) {
|
|
|
717
711
|
export function computed_property(fn) {
|
|
718
712
|
define_property(fn, COMPUTED_PROPERTY, {
|
|
719
713
|
value: true,
|
|
720
|
-
enumerable: false
|
|
714
|
+
enumerable: false,
|
|
721
715
|
});
|
|
722
716
|
return fn;
|
|
723
717
|
}
|
|
@@ -766,6 +760,10 @@ export function increment(tracked, block) {
|
|
|
766
760
|
set(tracked, tracked.v + 1, block);
|
|
767
761
|
}
|
|
768
762
|
|
|
763
|
+
export function decrement(tracked, block) {
|
|
764
|
+
set(tracked, tracked.v - 1, block);
|
|
765
|
+
}
|
|
766
|
+
|
|
769
767
|
export function update_pre(tracked, block, d = 1) {
|
|
770
768
|
var value = get(tracked);
|
|
771
769
|
|
|
@@ -783,7 +781,12 @@ export function update_property(obj, property, block, d = 1) {
|
|
|
783
781
|
var value = get(tracked);
|
|
784
782
|
var result = d === 1 ? value++ : value--;
|
|
785
783
|
|
|
786
|
-
|
|
784
|
+
if (d === 1) {
|
|
785
|
+
increment(tracked, block);
|
|
786
|
+
} else {
|
|
787
|
+
decrement(tracked, block);
|
|
788
|
+
}
|
|
789
|
+
|
|
787
790
|
return result;
|
|
788
791
|
}
|
|
789
792
|
|
|
@@ -798,7 +801,12 @@ export function update_pre_property(obj, property, block, d = 1) {
|
|
|
798
801
|
var value = get(tracked);
|
|
799
802
|
var result = d === 1 ? ++value : --value;
|
|
800
803
|
|
|
801
|
-
|
|
804
|
+
if (d === 1) {
|
|
805
|
+
increment(tracked, block);
|
|
806
|
+
} else {
|
|
807
|
+
decrement(tracked, block);
|
|
808
|
+
}
|
|
809
|
+
|
|
802
810
|
return result;
|
|
803
811
|
}
|
|
804
812
|
|
|
@@ -896,7 +904,7 @@ export function push_component() {
|
|
|
896
904
|
var component = {
|
|
897
905
|
e: null,
|
|
898
906
|
m: false,
|
|
899
|
-
p: active_component
|
|
907
|
+
p: active_component,
|
|
900
908
|
};
|
|
901
909
|
active_component = component;
|
|
902
910
|
}
|
|
@@ -927,4 +935,17 @@ export function pop_component() {
|
|
|
927
935
|
|
|
928
936
|
export function use_prop() {
|
|
929
937
|
return Symbol(USE_PROP);
|
|
930
|
-
}
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
export function ref(value) {
|
|
941
|
+
var block = active_block || active_scope;
|
|
942
|
+
if (!block) {
|
|
943
|
+
throw new Error('ref() must be called within a component or reactive context');
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// Create a tracked object with a $current property
|
|
947
|
+
var ref_obj = { $current: value };
|
|
948
|
+
|
|
949
|
+
// Make the $current property reactive
|
|
950
|
+
return tracked_object(ref_obj, ['$current'], block);
|
|
951
|
+
}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
set_active_component,
|
|
11
11
|
set_active_reaction,
|
|
12
12
|
set_tracking,
|
|
13
|
-
tracking
|
|
13
|
+
tracking,
|
|
14
14
|
} from './runtime';
|
|
15
15
|
|
|
16
16
|
export function try_block(node, fn, catch_fn, pending_fn = null) {
|
|
@@ -74,7 +74,7 @@ export function try_block(node, fn, catch_fn, pending_fn = null) {
|
|
|
74
74
|
|
|
75
75
|
var state = {
|
|
76
76
|
a: pending_fn !== null ? handle_await : null,
|
|
77
|
-
c: catch_fn !== null ? handle_error : null
|
|
77
|
+
c: catch_fn !== null ? handle_error : null,
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
create_try_block(() => {
|
package/src/utils/ast.js
CHANGED
|
@@ -64,7 +64,7 @@ export function extract_paths(param) {
|
|
|
64
64
|
param,
|
|
65
65
|
(node) => /** @type {ESTree.Identifier | ESTree.MemberExpression} */ (node),
|
|
66
66
|
(node) => /** @type {ESTree.Identifier | ESTree.MemberExpression} */ (node),
|
|
67
|
-
false
|
|
67
|
+
false,
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -77,7 +77,7 @@ function _extract_paths(assignments = [], param, expression, update_expression,
|
|
|
77
77
|
is_rest: false,
|
|
78
78
|
has_default_value,
|
|
79
79
|
expression,
|
|
80
|
-
update_expression
|
|
80
|
+
update_expression,
|
|
81
81
|
});
|
|
82
82
|
break;
|
|
83
83
|
|
|
@@ -110,7 +110,7 @@ function _extract_paths(assignments = [], param, expression, update_expression,
|
|
|
110
110
|
is_rest: true,
|
|
111
111
|
has_default_value,
|
|
112
112
|
expression: rest_expression,
|
|
113
|
-
update_expression: rest_expression
|
|
113
|
+
update_expression: rest_expression,
|
|
114
114
|
});
|
|
115
115
|
} else {
|
|
116
116
|
_extract_paths(
|
|
@@ -118,7 +118,7 @@ function _extract_paths(assignments = [], param, expression, update_expression,
|
|
|
118
118
|
prop.argument,
|
|
119
119
|
rest_expression,
|
|
120
120
|
rest_expression,
|
|
121
|
-
has_default_value
|
|
121
|
+
has_default_value,
|
|
122
122
|
);
|
|
123
123
|
}
|
|
124
124
|
} else {
|
|
@@ -130,7 +130,7 @@ function _extract_paths(assignments = [], param, expression, update_expression,
|
|
|
130
130
|
prop.value,
|
|
131
131
|
object_expression,
|
|
132
132
|
object_expression,
|
|
133
|
-
has_default_value
|
|
133
|
+
has_default_value,
|
|
134
134
|
);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
@@ -151,7 +151,7 @@ function _extract_paths(assignments = [], param, expression, update_expression,
|
|
|
151
151
|
is_rest: true,
|
|
152
152
|
has_default_value,
|
|
153
153
|
expression: rest_expression,
|
|
154
|
-
update_expression: rest_expression
|
|
154
|
+
update_expression: rest_expression,
|
|
155
155
|
});
|
|
156
156
|
} else {
|
|
157
157
|
_extract_paths(
|
|
@@ -159,7 +159,7 @@ function _extract_paths(assignments = [], param, expression, update_expression,
|
|
|
159
159
|
element.argument,
|
|
160
160
|
rest_expression,
|
|
161
161
|
rest_expression,
|
|
162
|
-
has_default_value
|
|
162
|
+
has_default_value,
|
|
163
163
|
);
|
|
164
164
|
}
|
|
165
165
|
} else {
|
|
@@ -170,7 +170,7 @@ function _extract_paths(assignments = [], param, expression, update_expression,
|
|
|
170
170
|
element,
|
|
171
171
|
array_expression,
|
|
172
172
|
array_expression,
|
|
173
|
-
has_default_value
|
|
173
|
+
has_default_value,
|
|
174
174
|
);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
@@ -188,7 +188,7 @@ function _extract_paths(assignments = [], param, expression, update_expression,
|
|
|
188
188
|
is_rest: false,
|
|
189
189
|
has_default_value: true,
|
|
190
190
|
expression: fallback_expression,
|
|
191
|
-
update_expression
|
|
191
|
+
update_expression,
|
|
192
192
|
});
|
|
193
193
|
} else {
|
|
194
194
|
_extract_paths(assignments, param.left, fallback_expression, update_expression, true);
|
package/src/utils/builders.js
CHANGED
|
@@ -40,7 +40,7 @@ export function arrow(params, body, async = false) {
|
|
|
40
40
|
expression: body.type !== 'BlockStatement',
|
|
41
41
|
generator: false,
|
|
42
42
|
async,
|
|
43
|
-
metadata: /** @type {any} */ (null) // should not be used by codegen
|
|
43
|
+
metadata: /** @type {any} */ (null), // should not be used by codegen
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -126,7 +126,7 @@ export function call(callee, ...args) {
|
|
|
126
126
|
type: 'CallExpression',
|
|
127
127
|
callee,
|
|
128
128
|
arguments: /** @type {Array<ESTree.Expression | ESTree.SpreadElement>} */ (args),
|
|
129
|
-
optional: false
|
|
129
|
+
optional: false,
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -141,7 +141,7 @@ export function maybe_call(callee, ...args) {
|
|
|
141
141
|
|
|
142
142
|
return {
|
|
143
143
|
type: 'ChainExpression',
|
|
144
|
-
expression
|
|
144
|
+
expression,
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
|
|
@@ -183,7 +183,7 @@ export function declaration(kind, declarations) {
|
|
|
183
183
|
return {
|
|
184
184
|
type: 'VariableDeclaration',
|
|
185
185
|
kind,
|
|
186
|
-
declarations
|
|
186
|
+
declarations,
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
189
|
|
|
@@ -199,7 +199,7 @@ export function declarator(pattern, init) {
|
|
|
199
199
|
|
|
200
200
|
/** @type {ESTree.EmptyStatement} */
|
|
201
201
|
export const empty = {
|
|
202
|
-
type: 'EmptyStatement'
|
|
202
|
+
type: 'EmptyStatement',
|
|
203
203
|
};
|
|
204
204
|
|
|
205
205
|
/**
|
|
@@ -224,7 +224,7 @@ export function function_declaration(id, params, body) {
|
|
|
224
224
|
body,
|
|
225
225
|
generator: false,
|
|
226
226
|
async: false,
|
|
227
|
-
metadata: /** @type {any} */ (null) // should not be used by codegen
|
|
227
|
+
metadata: /** @type {any} */ (null), // should not be used by codegen
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
230
|
|
|
@@ -260,7 +260,7 @@ export function private_id(name) {
|
|
|
260
260
|
function import_namespace(local) {
|
|
261
261
|
return {
|
|
262
262
|
type: 'ImportNamespaceSpecifier',
|
|
263
|
-
local: id(local)
|
|
263
|
+
local: id(local),
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
266
|
|
|
@@ -458,7 +458,7 @@ function new_builder(expression, ...args) {
|
|
|
458
458
|
return {
|
|
459
459
|
callee: expression,
|
|
460
460
|
arguments: args,
|
|
461
|
-
type: 'NewExpression'
|
|
461
|
+
type: 'NewExpression',
|
|
462
462
|
};
|
|
463
463
|
}
|
|
464
464
|
|
|
@@ -487,12 +487,12 @@ const null_instane = literal(null);
|
|
|
487
487
|
|
|
488
488
|
/** @type {ESTree.DebuggerStatement} */
|
|
489
489
|
const debugger_builder = {
|
|
490
|
-
type: 'DebuggerStatement'
|
|
490
|
+
type: 'DebuggerStatement',
|
|
491
491
|
};
|
|
492
492
|
|
|
493
493
|
/** @type {ESTree.ThisExpression} */
|
|
494
494
|
const this_instance = {
|
|
495
|
-
type: 'ThisExpression'
|
|
495
|
+
type: 'ThisExpression',
|
|
496
496
|
};
|
|
497
497
|
|
|
498
498
|
/**
|
|
@@ -562,7 +562,7 @@ export function method(kind, key, params, body, computed = false, is_static = fa
|
|
|
562
562
|
kind,
|
|
563
563
|
value: function_builder(null, params, block(body)),
|
|
564
564
|
computed,
|
|
565
|
-
static: is_static
|
|
565
|
+
static: is_static,
|
|
566
566
|
};
|
|
567
567
|
}
|
|
568
568
|
|
|
@@ -581,7 +581,7 @@ function function_builder(id, params, body) {
|
|
|
581
581
|
body,
|
|
582
582
|
generator: false,
|
|
583
583
|
async: false,
|
|
584
|
-
metadata: /** @type {any} */ (null) // should not be used by codegen
|
|
584
|
+
metadata: /** @type {any} */ (null), // should not be used by codegen
|
|
585
585
|
};
|
|
586
586
|
}
|
|
587
587
|
|
|
@@ -604,7 +604,7 @@ export function import_all(as, source) {
|
|
|
604
604
|
return {
|
|
605
605
|
type: 'ImportDeclaration',
|
|
606
606
|
source: literal(source),
|
|
607
|
-
specifiers: [import_namespace(as)]
|
|
607
|
+
specifiers: [import_namespace(as)],
|
|
608
608
|
};
|
|
609
609
|
}
|
|
610
610
|
|
|
@@ -620,8 +620,8 @@ export function imports(parts, source) {
|
|
|
620
620
|
specifiers: parts.map((p) => ({
|
|
621
621
|
type: 'ImportSpecifier',
|
|
622
622
|
imported: id(p[0]),
|
|
623
|
-
local: id(p[1])
|
|
624
|
-
}))
|
|
623
|
+
local: id(p[1]),
|
|
624
|
+
})),
|
|
625
625
|
};
|
|
626
626
|
}
|
|
627
627
|
|
|
@@ -640,10 +640,39 @@ function return_builder(argument = null) {
|
|
|
640
640
|
export function throw_error(str) {
|
|
641
641
|
return {
|
|
642
642
|
type: 'ThrowStatement',
|
|
643
|
-
argument: new_builder('Error', literal(str))
|
|
643
|
+
argument: new_builder('Error', literal(str)),
|
|
644
644
|
};
|
|
645
645
|
}
|
|
646
646
|
|
|
647
|
+
/**
|
|
648
|
+
* @param {ESTree.BlockStatement} block
|
|
649
|
+
* @param {ESTree.CatchClause | null} handler
|
|
650
|
+
* @param {ESTree.BlockStatement | null} finalizer
|
|
651
|
+
* @returns {ESTree.TryStatement}
|
|
652
|
+
*/
|
|
653
|
+
export function try_builder(block, handler = null, finalizer = null) {
|
|
654
|
+
return {
|
|
655
|
+
type: 'TryStatement',
|
|
656
|
+
block,
|
|
657
|
+
handler,
|
|
658
|
+
finalizer
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* @param {ESTree.Pattern | null} param
|
|
664
|
+
* @param {ESTree.BlockStatement} body
|
|
665
|
+
* @returns {ESTree.CatchClause}
|
|
666
|
+
*/
|
|
667
|
+
export function catch_clause_builder(param, body) {
|
|
668
|
+
return {
|
|
669
|
+
type: 'CatchClause',
|
|
670
|
+
param,
|
|
671
|
+
body
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
export { catch_clause_builder as catch_clause };
|
|
647
676
|
|
|
648
677
|
/**
|
|
649
678
|
* @param {string} name
|
|
@@ -662,7 +691,7 @@ export function jsx_attribute(name, value = null) {
|
|
|
662
691
|
return {
|
|
663
692
|
type: 'JSXAttribute',
|
|
664
693
|
name,
|
|
665
|
-
value
|
|
694
|
+
value,
|
|
666
695
|
};
|
|
667
696
|
}
|
|
668
697
|
|
|
@@ -673,22 +702,30 @@ export function jsx_attribute(name, value = null) {
|
|
|
673
702
|
* @param {boolean} self_closing
|
|
674
703
|
* @returns {{ element: ESTree.JSXElement, opening_element: ESTree.JSXOpeningElement }}
|
|
675
704
|
*/
|
|
676
|
-
export function jsx_element(
|
|
705
|
+
export function jsx_element(
|
|
706
|
+
name,
|
|
707
|
+
attributes = [],
|
|
708
|
+
children = [],
|
|
709
|
+
self_closing = false,
|
|
710
|
+
closing_name = name,
|
|
711
|
+
) {
|
|
677
712
|
const opening_element = {
|
|
678
713
|
type: 'JSXOpeningElement',
|
|
679
714
|
name,
|
|
680
715
|
attributes,
|
|
681
|
-
selfClosing: self_closing
|
|
716
|
+
selfClosing: self_closing,
|
|
682
717
|
};
|
|
683
718
|
|
|
684
719
|
const element = {
|
|
685
720
|
type: 'JSXElement',
|
|
686
721
|
openingElement: opening_element,
|
|
687
|
-
closingElement: self_closing
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
722
|
+
closingElement: self_closing
|
|
723
|
+
? null
|
|
724
|
+
: {
|
|
725
|
+
type: 'JSXClosingElement',
|
|
726
|
+
name: closing_name,
|
|
727
|
+
},
|
|
728
|
+
children,
|
|
692
729
|
};
|
|
693
730
|
|
|
694
731
|
return element;
|
|
@@ -701,7 +738,7 @@ export function jsx_element(name, attributes = [], children = [], self_closing =
|
|
|
701
738
|
export function jsx_expression_container(expression) {
|
|
702
739
|
return {
|
|
703
740
|
type: 'JSXExpressionContainer',
|
|
704
|
-
expression
|
|
741
|
+
expression,
|
|
705
742
|
};
|
|
706
743
|
}
|
|
707
744
|
|
|
@@ -712,7 +749,7 @@ export function jsx_expression_container(expression) {
|
|
|
712
749
|
export function jsx_id(name) {
|
|
713
750
|
return {
|
|
714
751
|
type: 'JSXIdentifier',
|
|
715
|
-
name
|
|
752
|
+
name,
|
|
716
753
|
};
|
|
717
754
|
}
|
|
718
755
|
|
|
@@ -723,7 +760,7 @@ export function jsx_id(name) {
|
|
|
723
760
|
export function jsx_spread_attribute(argument) {
|
|
724
761
|
return {
|
|
725
762
|
type: 'JSXSpreadAttribute',
|
|
726
|
-
argument
|
|
763
|
+
argument,
|
|
727
764
|
};
|
|
728
765
|
}
|
|
729
766
|
|
|
@@ -740,5 +777,6 @@ export {
|
|
|
740
777
|
if_builder as if,
|
|
741
778
|
this_instance as this,
|
|
742
779
|
null_instane as null,
|
|
743
|
-
debugger_builder as debugger
|
|
780
|
+
debugger_builder as debugger,
|
|
781
|
+
try_builder as try,
|
|
744
782
|
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`for statements > render a simple dynamic array 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<!---->
|
|
6
|
+
<div
|
|
7
|
+
class="Item 1"
|
|
8
|
+
>
|
|
9
|
+
Item 1
|
|
10
|
+
</div>
|
|
11
|
+
<div
|
|
12
|
+
class="Item 2"
|
|
13
|
+
>
|
|
14
|
+
Item 2
|
|
15
|
+
</div>
|
|
16
|
+
<div
|
|
17
|
+
class="Item 3"
|
|
18
|
+
>
|
|
19
|
+
Item 3
|
|
20
|
+
</div>
|
|
21
|
+
<!---->
|
|
22
|
+
<button>
|
|
23
|
+
Add Item
|
|
24
|
+
</button>
|
|
25
|
+
|
|
26
|
+
</div>
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
exports[`for statements > render a simple dynamic array 2`] = `
|
|
30
|
+
<div>
|
|
31
|
+
<!---->
|
|
32
|
+
<div
|
|
33
|
+
class="Item 1"
|
|
34
|
+
>
|
|
35
|
+
Item 1
|
|
36
|
+
</div>
|
|
37
|
+
<div
|
|
38
|
+
class="Item 2"
|
|
39
|
+
>
|
|
40
|
+
Item 2
|
|
41
|
+
</div>
|
|
42
|
+
<div
|
|
43
|
+
class="Item 3"
|
|
44
|
+
>
|
|
45
|
+
Item 3
|
|
46
|
+
</div>
|
|
47
|
+
<div
|
|
48
|
+
class="Item 4"
|
|
49
|
+
>
|
|
50
|
+
Item 4
|
|
51
|
+
</div>
|
|
52
|
+
<!---->
|
|
53
|
+
<button>
|
|
54
|
+
Add Item
|
|
55
|
+
</button>
|
|
56
|
+
|
|
57
|
+
</div>
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
exports[`for statements > render a simple static array 1`] = `
|
|
61
|
+
<div>
|
|
62
|
+
<!---->
|
|
63
|
+
<div
|
|
64
|
+
class="Item 1"
|
|
65
|
+
>
|
|
66
|
+
Item 1
|
|
67
|
+
</div>
|
|
68
|
+
<div
|
|
69
|
+
class="Item 2"
|
|
70
|
+
>
|
|
71
|
+
Item 2
|
|
72
|
+
</div>
|
|
73
|
+
<div
|
|
74
|
+
class="Item 3"
|
|
75
|
+
>
|
|
76
|
+
Item 3
|
|
77
|
+
</div>
|
|
78
|
+
<!---->
|
|
79
|
+
|
|
80
|
+
</div>
|
|
81
|
+
`;
|