@llui/vite-plugin 0.0.15 → 0.0.17

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/dist/transform.js CHANGED
@@ -3036,11 +3036,26 @@ function computeAccessorMask(accessor, fieldBits) {
3036
3036
  let mask = 0;
3037
3037
  let readsState = false;
3038
3038
  function walk(node) {
3039
- if (ts.isIdentifier(node) && node.text === stateParam && !ts.isParameter(node.parent)) {
3039
+ // `node.parent` can be undefined for synthetic nodes produced by
3040
+ // earlier AST-transform passes (the row-factory rewrite and the
3041
+ // per-item heuristic both build new sub-trees whose inner nodes
3042
+ // have no parent pointers). Guard every parent access below —
3043
+ // crashing the whole build on a perfectly valid reactive accessor
3044
+ // like `text((_s) => \`$${item.x.toLocaleString()}\`)` was how
3045
+ // this bug first surfaced in the persistent-layout example work.
3046
+ const parent = node.parent;
3047
+ if (ts.isIdentifier(node) && node.text === stateParam && (!parent || !ts.isParameter(parent))) {
3040
3048
  readsState = true;
3041
3049
  }
3042
3050
  if (ts.isPropertyAccessExpression(node)) {
3043
- if (!ts.isPropertyAccessExpression(node.parent)) {
3051
+ // When there's no parent we can't tell if this is the top of a
3052
+ // chain, so we resolve from here. That's still correct for mask
3053
+ // accounting: `resolveChain` on an inner PAE produces a prefix
3054
+ // of the outer chain, which maps to the same `fieldBits` bit
3055
+ // via the prefix-match loop below. Worst case we resolve the
3056
+ // same chain twice (`|=` is idempotent); best case we'd have
3057
+ // resolved once from the real top. Correctness unchanged.
3058
+ if (!parent || !ts.isPropertyAccessExpression(parent)) {
3044
3059
  const chain = resolveChain(node, stateParam);
3045
3060
  if (chain) {
3046
3061
  const bit = fieldBits.get(chain);