Repository navigation
feat: plain Astro support, and the smoke suite run against the packed package - #17
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Three things in one PR, because they share one test story: the package can now be
used from plain Astro, the dev-only hydration bug is fixed, and
test:siteproves both from the packed tarball instead of from
dist/sitting beside therepository.
1.
@purview-dev/astroc4/integration— plain Astro, first classsrc/integration.tsholds everything that was always Astro-only: LikeC4's Viteplugin, the fence transform, the Windows preload, the
react/compiler-runtimefix.src/index.tsis now the Starlight layer that calls it (i18n injection,expressiveCode, Starlight's plugin context). Both entry points therefore cannotdrift.
Three Starlight assumptions had to go:
Astro.locals.tis read asunknown—App.Localsis an empty interfacewithout Starlight's augmentation, so a site that type-checks the components
without Starlight now passes instead of failing with
TS2339.--likec4-*layer that defaults to--sl-color-*and toscheme-neutral fallbacks, so a plain page is legible rather than transparent.
(
logger.fork('likec4-fences')), notconsole.The integration also adds
@astrojs/reactwhen the site has not, because theislands are
client:only="react". It deliberately does not add@astrojs/mdxorastro-expressive-code: those change the host's content typesand every code block, so they stay the site's decision (and a fence in a
.mdpage now says "add MDX" instead of "rename the page", which could not work).
examples/astrois a runnable plain-Astro site —bun run dev:astro, port 4322 —with a project view, an inline fence and
ec.config.mjshighlighting.2. The dev-only hydration bug
likec4/reactis React-Compiler-built and importscfrom React 19's CommonJSreact/compiler-runtime; dev served it raw and every island died withdoes not provide an export named 'c'whileastro buildstayed green. Theintegration now adds the dependency to
vite.optimizeDeps.include(only entriesthe site lacks — Astro concatenates Vite arrays).
3.
test:siteruns the real smoke suite on the packed packageIt installs the tarball into copies of both host sites —
playground/andexamples/astro/— and then runsastro check,astro build, the fullscripts/smoke.tssuite against the Starlight copy on its preview server, adev-server hydration check against the plain-Astro copy, and a rebuild of that copy
with the exact config
astro addwrites.scripts/hydration.tsis the sharedbrowser check (rendered node, no visible placeholder, no console errors, frame is
styled).
Verified locally
bun run testbun run checkexamples/astro19 files 0 errors ·tscscripts cleanbun run build+bun scripts/smoke.tsbun run test:siteastro addshapeoptimizeDepsentry removed and.vitecleared, the check reports the threedoes not provide an export named 'c'errors, 0 nodes and a visible placeholderAstro.localscast reverted,examples/astro'sastro checkfails withTS2339: Property 't' does not exist on type 'Locals'Notes for reviewers
package.jsonis bumped to1.0.0-prerelease.5, so merging this publishesthe prerelease and tags it (
release.yml).astro addworks now. The default export carries the Astroastro:config:setuphook as well as the Starlight plugin hooks; the two sets aredisjoint, so
integrations: [astroc4()](what the CLI writes) renders diagrams,and a Starlight site that ends up with that shape gets a warning naming
starlight({ plugins: [astroc4()] }).astroc4()andastroExpressiveCode()work in either order (tested), andexamples/astronowlists Expressive Code first so it stays true.
@astrojs/starlightis an optional peer now; a plain Astro site never loads it.Checklist
bun run testbun run checkbun run buildandbun scripts/smoke.tsbun run test:site(needs Chromium)guide/Plain-Astro.md, Components, ConfigurationReference, Getting Started, Architecture, Local Development, Repository
CI/CD, AGENTS.md, CHANGELOG