Skip to content

feat!: named projects and transparent image aliases - #21

Merged
kieronlanning merged 15 commits into
mainfrom
feat/named-projects-alias-icons
Nov 9, 2026
Merged

kieronlanning merged 15 commits into
mainfrom
feat/named-projects-alias-icons

Conversation

@kieronlanning

Copy link
Copy Markdown
Contributor

Summary

1.0.0-prerelease.6: LikeC4 imageAliases work with no change to the project, projects can be named from anywhere, and a page picks a diagram by project, single file or fence.

  • Transparent image aliases. Every icon LikeC4 compiles to a local file (alias or relative path) is mapped to /_astroc4/<project>/<path>, served from the original file in astro dev, copied into the build output, and rendered (SVGs inline, by LikeC4's own icons module). public/ icons keep their public URL. No file:// path reaches the client bundle for any icon.
  • Named projects. projects: { name: folder } (relative or absolute) compiles alongside the projects discovered under the site root, through junctions in .astro/astroc4/workspace (LikeC4 excludes node_modules). Paths LikeC4 resolves lexically against the junction are mapped back to the real project folder, so aliases that climb out of the project (../../.assets/images) work.
  • project / file props, and project= / file= on fences. projectId is a deprecated alias.
  • Breaking: with more than one project, omitting project (or naming an unknown one) fails the build listing the names, instead of rendering the first project found.

Test plan

  • node node_modules/vitest/vitest.mjs run — 190 passed, 2 skipped
  • bun run check — 0 errors (playground and examples/astro)
  • bun run build and bun run build:astro
  • bun scripts/smoke.ts against the built playground — all checks pass, including the @ alias icon of a project outside the site, its /_astroc4/ URL (200, image/svg+xml), and no file:// in playground/dist
  • astro dev: editing playground-external/model.c4 updates the open page without a restart

Note

bun run test (Vitest under Bun) fails one pre-existing test on Windows, as on main: plugin.test.ts › does not name a dependency the site cannot resolve — Bun's createRequire resolves react from outside the temp site. It passes under Node. Recorded under Known in the CHANGELOG; not changed here.

Publishing is left to the maintainer's release flow.

…ghout

- Read all of LikeC4's ConfigFilenames: JSON5 for .likec4rc and the .json
  names, bundle-require for likec4.config.{ts,mts,cts,js,mjs,cjs} with
  likec4/config stubbed; `name` defaults to the folder name.
- Components read --likec4-* tokens into private --_likec4-* properties and
  never declare them, so site overrides on any ancestor apply; tokens.test.ts
  enforces it.
- .md fences: build-time project checks, title/collapsible/defaultOpen.
- Vite optimizeDeps check walks node_modules instead of createRequire, which
  under Bun also sees Bun's global cache.
- test:site uses the long TEMP path so Vite's dev server finds its own
  virtual scripts on Windows.
- astro.config.ts everywhere, .ts import specifiers, comments trimmed.
- README, wiki, skills, AGENTS.md and CHANGELOG updated.
@kieronlanning
kieronlanning merged commit 90a9a5b into main Nov 9, 2026
4 checks passed
@kieronlanning
kieronlanning deleted the feat/named-projects-alias-icons branch November 9, 2026 17:36
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