@sola-air-ui/compiler 1.5.3 → 1.5.4

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sola-air-ui/compiler",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "Compiler for Sola single-file components (.sola) \u2014 transforms template + script + style to ES modules",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/check-cli.js CHANGED
File without changes
package/src/check.js CHANGED
@@ -105,7 +105,7 @@ export function checkSource(source, filename = 'component.sola') {
105
105
  add(at, 'error', 'SOLA001', '`{:else if}` is missing a condition. It renders as literal text.');
106
106
  }
107
107
  } else {
108
- add(at, 'error', 'SOLA001', '`{:else}` unexpected token (use `{:else}` or `{:else if <condition>}`). It renders as literal text.');
108
+ add(at, 'error', 'SOLA001', '`{:else}` has extra text after it (use `{:else}` or `{:else if <condition>}`). It renders as literal text.');
109
109
  }
110
110
  }
111
111
  }
package/src/index.js CHANGED
@@ -73,9 +73,9 @@ function addScopeToCompound(compound, scopeHash) {
73
73
  // :global(body) → body
74
74
  // The scope class always goes on the last compound that is not global.
75
75
  function scopeSelector(selector, scopeHash) {
76
- const tokens = []; // alternating compounds and combinators
76
+ const pieces = []; // alternating compounds and combinators
77
77
  let depth = 0, cur = '', comb = '';
78
- const flushCompound = () => { if (cur) { tokens.push({ compound: cur }); cur = ''; } };
78
+ const flushCompound = () => { if (cur) { pieces.push({ compound: cur }); cur = ''; } };
79
79
  for (let i = 0; i < selector.length; i++) {
80
80
  const c = selector[i];
81
81
  if (c === '(' || c === '[') depth++;
@@ -85,15 +85,15 @@ function scopeSelector(selector, scopeHash) {
85
85
  comb += c;
86
86
  continue;
87
87
  }
88
- if (comb) { tokens.push({ comb }); comb = ''; }
88
+ if (comb) { pieces.push({ comb }); comb = ''; }
89
89
  cur += c;
90
90
  }
91
91
  flushCompound();
92
- if (comb) tokens.push({ comb });
92
+ if (comb) pieces.push({ comb });
93
93
 
94
94
  let last = -1;
95
- for (let i = 0; i < tokens.length; i++) {
96
- const t = tokens[i];
95
+ for (let i = 0; i < pieces.length; i++) {
96
+ const t = pieces[i];
97
97
  if (t.compound === undefined) continue;
98
98
  const m = t.compound.match(/^:global\(([\s\S]*)\)$/);
99
99
  // A comma list must stay grouped, or `.a :global(.x, .y)` would turn into
@@ -105,8 +105,8 @@ function scopeSelector(selector, scopeHash) {
105
105
  t.global = true;
106
106
  } else { last = i; }
107
107
  }
108
- if (last >= 0) tokens[last].compound = addScopeToCompound(tokens[last].compound, scopeHash);
109
- return tokens.map(t => t.compound ?? t.comb).join('');
108
+ if (last >= 0) pieces[last].compound = addScopeToCompound(pieces[last].compound, scopeHash);
109
+ return pieces.map(t => t.compound ?? t.comb).join('');
110
110
  }
111
111
 
112
112
  function scopeSelectorList(selector, scopeHash) {