Skip to content

v2.1.2 — external library dependency resolution & import reliability#26

Merged
tknatwork merged 1 commit into
mainfrom
fix/external-alias-relink
Jun 11, 2026
Merged

v2.1.2 — external library dependency resolution & import reliability#26
tknatwork merged 1 commit into
mainfrom
fix/external-alias-relink

Conversation

@tknatwork

Copy link
Copy Markdown
Owner

Summary

Corrections release behind the v2.1.2 Community publish. Fixes imported variables that referenced external (team library) collections collapsing to 0 when the library wasn't connected to the target file — discovered via a real-world round trip (shadcn studio kit JSON imported into a file carrying Myna UI Tailwind tokens).

Import re-linking (src/code.ts)

  • Alias resolution now matches by content, in order: exact collection/path → unique path match across all collections → loose collection-name match (whitespace runs collapsed — fixes ☀️ Mode vs ☀️ Mode). Ambiguous matches refuse to guess and use the preserved fallback value instead of mis-linking.

Export fallback capture (src/code.ts)

  • Chained library aliases resolve recursively per mode for $localValue (previously dropped → importer had nothing → 0).
  • Chains reaching library-internal primitives the Plugin API can't fetch (unpublished, never imported) now resolve through Figma's rendering engineVariable.resolveForConsumer on a throwaway hidden node pinned to the exported mode. Applies to both preserve-bindings and raw-values export.

Import UX (ui.html + backend)

  • Asset Sources card is content-aware: per-library status connected / matched by name to variables in this file / provided by this import / partial / missing, computed by checking each referenced path against the file and the import payload itself — replaces the name-only "not connected" false alarm.
  • Import Behaviour defaults follow the dependency check: deps already present in the file → Smart Merge (Clean Import would have wiped the very collections the refs re-link to — latent footgun, now closed); deps absent → Clean Import. Manual radio choice always wins; Simple mode follows the same rule.
  • Simple tab Import button spacing: the empty undo placeholder in the action row drew a phantom 8px flex gap below the button — fixed with display: contents (verified by rect measurement in a live preview; :empty would not have worked since the slot holds a hidden undo section).

Tests & docs

  • New pure-logic test suite for the collection matcher: pnpm test (7 cases, including the real-world whitespace collision).
  • CHANGELOG: 2.1.2 entry added; 2.1.0 marked released (live on Community). Version bumped in package.json, ui.html, plugin window title, README badges.

Security notes

No permission or network changes — plugin remains networkAccess: ["none"], permissions: []. New resolveViaConsumer creates and removes a hidden 1×1 frame during export only when a chain dead-ends (net-zero document change). All new UI strings render through the existing escapeHtml sanitizer.

Test plan

  • pnpm test — 7/7 matcher cases
  • pnpm build — tsc strict + terser clean
  • Manual round trip in Figma Desktop: shadcn studio export → import into Myna-tokens file: 2. Theme/☀️ Mode/💨 Tailwind re-link, Shape/Corner/None falls back to measured value; Smart Merge auto-selected
  • Simple tab Import button spacing verified by rect measurement (0px phantom gap)

🤖 Generated with Claude Code

…llbacks (v2.1.2)

Imported variables referencing unconnected team libraries collapsed to 0.
This release fixes the full external-dependency workflow:

Import re-linking
- Alias resolution matches by content: exact collection/path -> unique path
  across collections -> loose collection-name match (whitespace runs
  collapsed); ambiguous matches refuse to guess and use the fallback value
- New pure-logic test suite for the matcher (pnpm test, 7 cases)

Export fallback capture
- Chained library aliases resolve recursively per mode for $localValue
- Chains crossing into unfetchable library-internal primitives resolve via
  Variable.resolveForConsumer on a temporary hidden node pinned to the
  exported mode (applies to preserve-bindings and raw-values modes)

Import UX
- Asset Sources card is content-aware: per-library status connected /
  matched-by-name / provided-by-this-import / partial / missing
- Import Behaviour defaults from the dependency check: Smart Merge when
  deps are already present in the file (Clean Import would wipe them),
  Clean Import otherwise; manual choice always wins; Simple mode follows
- Simple tab Import button: removed phantom gap from the empty undo slot
  (display: contents)

Docs: CHANGELOG 2.1.2 entry, 2.1.0 marked released, version bumps across
ui.html / code.ts title / package.json / READMEs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tknatwork tknatwork merged commit a76044f into main Jun 11, 2026
2 checks passed
@tknatwork tknatwork deleted the fix/external-alias-relink branch June 11, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant