ripple 0.2.46 → 0.2.48
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 +1 -1
- package/src/compiler/phases/1-parse/index.js +52 -2
- package/src/compiler/phases/2-analyze/index.js +640 -667
- package/src/compiler/phases/3-transform/index.js +1878 -1879
- package/src/compiler/phases/3-transform/segments.js +2 -2
- package/src/compiler/utils.js +598 -550
- package/src/jsx-runtime.js +12 -12
- package/src/runtime/array.js +611 -609
- package/src/runtime/index.js +29 -17
- package/src/runtime/internal/client/array.js +121 -121
- package/src/runtime/internal/client/blocks.js +206 -206
- package/src/runtime/internal/client/constants.js +2 -2
- package/src/runtime/internal/client/context.js +40 -40
- package/src/runtime/internal/client/events.js +191 -191
- package/src/runtime/internal/client/for.js +355 -355
- package/src/runtime/internal/client/if.js +25 -25
- package/src/runtime/internal/client/index.js +57 -56
- package/src/runtime/internal/client/operations.js +32 -32
- package/src/runtime/internal/client/portal.js +19 -19
- package/src/runtime/internal/client/render.js +132 -132
- package/src/runtime/internal/client/runtime.js +839 -835
- package/src/runtime/internal/client/template.js +36 -36
- package/src/runtime/internal/client/try.js +113 -113
- package/src/runtime/internal/client/types.d.ts +12 -11
- package/src/runtime/internal/client/utils.js +5 -5
- package/src/runtime/map.js +139 -139
- package/src/runtime/set.js +130 -130
- package/src/utils/ast.js +189 -189
- package/src/utils/builders.js +244 -244
- package/src/utils/sanitize_template_string.js +1 -1
- package/tests/__snapshots__/composite.test.ripple.snap +1 -1
- package/tests/accessors-props.test.ripple +9 -9
- package/tests/basic.test.ripple +4 -4
- package/tests/boundaries.test.ripple +17 -17
- package/tests/compiler.test.ripple +14 -14
- package/tests/composite.test.ripple +43 -72
- package/tests/context.test.ripple +35 -12
- package/types/index.d.ts +38 -34
package/package.json
CHANGED
|
@@ -25,6 +25,7 @@ function RipplePlugin(config) {
|
|
|
25
25
|
|
|
26
26
|
class RippleParser extends Parser {
|
|
27
27
|
#path = [];
|
|
28
|
+
skip_decorator = false;
|
|
28
29
|
|
|
29
30
|
// Helper method to get the element name from a JSX identifier or member expression
|
|
30
31
|
getElementName(node) {
|
|
@@ -237,9 +238,9 @@ function RipplePlugin(config) {
|
|
|
237
238
|
return this.finishNode(node, 'SpreadAttribute');
|
|
238
239
|
} else {
|
|
239
240
|
const id = this.parseIdentNode();
|
|
240
|
-
|
|
241
|
+
id.tracked = false;
|
|
241
242
|
if (id.name.startsWith('@')) {
|
|
242
|
-
|
|
243
|
+
id.tracked = true;
|
|
243
244
|
id.name = id.name.slice(1);
|
|
244
245
|
}
|
|
245
246
|
this.finishNode(id, 'Identifier');
|
|
@@ -274,6 +275,7 @@ function RipplePlugin(config) {
|
|
|
274
275
|
}
|
|
275
276
|
}
|
|
276
277
|
|
|
278
|
+
|
|
277
279
|
parseTryStatement(node) {
|
|
278
280
|
this.next();
|
|
279
281
|
node.block = this.parseBlock();
|
|
@@ -702,6 +704,54 @@ function RipplePlugin(config) {
|
|
|
702
704
|
return node;
|
|
703
705
|
}
|
|
704
706
|
|
|
707
|
+
if (this.type.label === '@') {
|
|
708
|
+
// Try to parse as an expression statement first using tryParse
|
|
709
|
+
// This allows us to handle Ripple @ syntax like @count++ without
|
|
710
|
+
// interfering with legitimate decorator syntax
|
|
711
|
+
this.skip_decorator = true;
|
|
712
|
+
const expressionResult = this.tryParse(() => {
|
|
713
|
+
const node = this.startNode();
|
|
714
|
+
this.next();
|
|
715
|
+
// Force expression context to ensure @ is tokenized correctly
|
|
716
|
+
const oldExprAllowed = this.exprAllowed;
|
|
717
|
+
this.exprAllowed = true;
|
|
718
|
+
node.expression = this.parseExpression();
|
|
719
|
+
|
|
720
|
+
if (node.expression.type === 'UpdateExpression') {
|
|
721
|
+
let object = node.expression.argument;
|
|
722
|
+
while (object.type === 'MemberExpression') {
|
|
723
|
+
object = object.object;
|
|
724
|
+
}
|
|
725
|
+
if (object.type === 'Identifier') {
|
|
726
|
+
object.tracked = true;
|
|
727
|
+
}
|
|
728
|
+
} else if (node.expression.type === 'AssignmentExpression') {
|
|
729
|
+
let object = node.expression.left;
|
|
730
|
+
while (object.type === 'MemberExpression') {
|
|
731
|
+
object = object.object;
|
|
732
|
+
}
|
|
733
|
+
if (object.type === 'Identifier') {
|
|
734
|
+
object.tracked = true;
|
|
735
|
+
}
|
|
736
|
+
} else if (node.expression.type === 'Identifier') {
|
|
737
|
+
node.expression.tracked = true;
|
|
738
|
+
} else {
|
|
739
|
+
// TODO?
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
this.exprAllowed = oldExprAllowed;
|
|
743
|
+
return this.finishNode(node, 'ExpressionStatement');
|
|
744
|
+
});
|
|
745
|
+
this.skip_decorator = false;
|
|
746
|
+
|
|
747
|
+
// If parsing as expression statement succeeded, use that result
|
|
748
|
+
if (expressionResult.node) {
|
|
749
|
+
return expressionResult.node;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
// Otherwise, fall back to default decorator parsing
|
|
753
|
+
}
|
|
754
|
+
|
|
705
755
|
return super.parseStatement(context, topLevel, exports);
|
|
706
756
|
}
|
|
707
757
|
|