ripple 0.2.22 → 0.2.23

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 a TypeScript UI framework for the web",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.2.22",
6
+ "version": "0.2.23",
7
7
  "type": "module",
8
8
  "module": "src/runtime/index.js",
9
9
  "main": "src/runtime/index.js",
@@ -410,7 +410,11 @@ function RipplePlugin(config) {
410
410
  if (this.value === '<' && this.#path.findLast((n) => n.type === 'Component')) {
411
411
  // Check if this looks like JSX by looking ahead
412
412
  const ahead = this.lookahead();
413
- if (ahead.type.label === 'name' || ahead.value === '/' || ahead.value === '>') {
413
+ const curContext = this.curContext();
414
+ if (
415
+ curContext.token !== '(' &&
416
+ (ahead.type.label === 'name' || ahead.value === '/' || ahead.value === '>')
417
+ ) {
414
418
  // This is JSX, rewind to the end of the object expression
415
419
  // and let ASI handle the semicolon insertion naturally
416
420
  this.pos = base.end;
@@ -275,25 +275,6 @@ describe('basic', () => {
275
275
  expect(div.getAttribute('data-extra')).toBe('value');
276
276
  });
277
277
 
278
- it('renders without crashing', () => {
279
- component App() {
280
- let foo;
281
- let bar;
282
- let baz;
283
-
284
- foo = {};
285
- foo = {'test': 0};
286
- foo['abc'] = 123;
287
-
288
- bar = { 'def': 456 };
289
-
290
- baz = { 'ghi': 789 };
291
- baz['jkl'] = 987;
292
- }
293
-
294
- render(App);
295
- });
296
-
297
278
  it('renders multiple reactive lexical blocks', () => {
298
279
  component Basic() {
299
280
  <div>
@@ -0,0 +1,61 @@
1
+ import { describe, it, expect, beforeEach, afterEach } from 'vitest';
2
+
3
+ import { mount } from 'ripple';
4
+
5
+ describe('compiler success tests', () => {
6
+ let container;
7
+
8
+ function render(component) {
9
+ mount(component, {
10
+ target: container
11
+ });
12
+ }
13
+
14
+ beforeEach(() => {
15
+ container = document.createElement('div');
16
+ document.body.appendChild(container);
17
+ });
18
+
19
+ afterEach(() => {
20
+ document.body.removeChild(container);
21
+ container = null;
22
+ });
23
+
24
+ it('renders without crashing', () => {
25
+ component App() {
26
+ let foo;
27
+ let bar;
28
+ let baz;
29
+
30
+ foo = {};
31
+ foo = {'test': 0};
32
+ foo['abc'] = 123;
33
+
34
+ bar = { 'def': 456 };
35
+
36
+ baz = { 'ghi': 789 };
37
+ baz['jkl'] = 987;
38
+ }
39
+
40
+ render(App);
41
+ });
42
+
43
+
44
+ it('renders without crashing using < character', () => {
45
+ component App() {
46
+ function bar() {
47
+ for (let i = 0; i < 10; i++) {
48
+ // do nothing
49
+ }
50
+ const x = 1 < 1;
51
+ }
52
+
53
+ let x = 5 < 10
54
+
55
+ <div>{x}</div>
56
+ }
57
+
58
+ render(App);
59
+ });
60
+
61
+ });