[pull] main from withastro:main#622
Merged
Merged
Conversation
* Pre-bundle Cloudflare worker server entrypoint in dev * Apply suggestion from @matthewp
…slot markup (#17232) * Fix styles dropped when await precedes a propagating component in slot markup Gates async slot pre-render awaiting on routes that use head propagation and discovers propagators via a fixpoint loop, so propagating components behind an await in slot markup are collected without blocking the head on unrelated markup awaits. Closes #17218 * Clarify head-collection loop comments from review
* Resolve tsconfig aliases in Astro style preprocessing Fixes: #17163 Related: 3cf76c0, 4766f37 Goal: restore Astro 6-style tsconfig alias handling for CSS references that are written inside .astro <style> blocks and therefore go through Astro's direct preprocessCSS() path instead of Vite's normal transform pipeline. Issue #17163 reported that the earlier CSS alias repair still missed @import url("@/...") and Tailwind-style @reference declarations in component styles. The issue discussion later added @config. Testing resolve.tsconfigPaths showed it is not a replacement here: with Vite 8.1.0/Rolldown 1.1.2 it fails existing Astro alias tests on its own, and even when combined with Astro's custom alias plugin it does not fix the <style> preprocessCSS() path. Decision: keep Astro's existing config alias plugin, extract its CSS alias rewriting into resolveCssAliases(), and call that same helper from createStylePreprocessor before preprocessCSS(). This preserves the standalone .css transform behavior while covering the compiler preprocessing path that previously bypassed the transform hook. The helper now matches @import, @reference, and @config path-bearing at-rules, plus the existing quoted url() handling. It resolves only aliases that map to existing files, matching the previous best-effort behavior. Testing: added an alias-path-alias-style fixture page with @import url('@/styles/base.css'), @reference '@/styles/reference.css', and @config '@/tailwind.config.ts' inside a component <style>. The test asserts the imported CSS is bundled and no @/ alias remains in output CSS. Verification run: - pnpm -C packages/astro run build:ci - pnpm -C packages/astro exec tsc -b - pnpm -C packages/astro exec astro-scripts test "test/{alias-tsconfig,alias-tsconfig-no-baseurl,alias-path-alias-style,alias-css-url}.test.ts" - pnpm format * Enable native tsconfig path resolution Related: bdeee80 Enable Vite's resolve.tsconfigPaths by default so Astro uses the native resolver where it works. Keep the existing custom config alias plugin as a deprecated fallback because testing showed resolve.tsconfigPaths alone does not pass Astro's existing alias suite with the current Vite/Rolldown stack. The fallback comments now explicitly document supported cases: - standalone CSS: @import, @reference, @config, and quoted url() references - Astro <style> preprocessing: the same supported CSS references before preprocessCSS() - module imports: JS/TS/Astro specifiers via resolveId The comments also state the fallback is deprecated and should be removed in a future Astro version once Vite covers these paths. Verification run: - pnpm format - pnpm -C packages/astro run build:ci - pnpm -C packages/astro exec tsc -b - pnpm -C packages/astro exec astro-scripts test "test/{alias-tsconfig,alias-tsconfig-no-baseurl,alias-path-alias-style,alias-css-url}.test.ts" * Update changeset for native tsconfig paths * Narrow tsconfig path fallback changes Remove the new #17163 regression fixture and the style-preprocessor alias rewrite. The PR is intentionally minimal now: enable Vite's resolve.tsconfigPaths and keep Astro's existing custom alias plugin only as a deprecated fallback for the cases it already supports. The fallback comments now document the supported CSS cases explicitly without claiming broader @reference/@config support. Verification run: - pnpm format - pnpm -C packages/astro run build:ci - pnpm -C packages/astro exec tsc -b - pnpm -C packages/astro exec astro-scripts test "test/{alias-tsconfig,alias-tsconfig-no-baseurl,alias-path-alias-style,alias-css-url}.test.ts" * Clarify deprecated alias fallback scope Use an @deprecated JSDoc tag on the custom tsconfig alias fallback and make the supported syntax explicit. The comments now state that the fallback only covers the already-supported CSS syntax (@import string, @import url(), and quoted url()) plus JS/TS/Astro module specifiers. They also explicitly tell future maintainers and agents not to expand this plugin for @use, @forward, @reference, @config, unquoted url(), or other file-reference syntax. Verification run: - pnpm format - pnpm -C packages/astro run build:ci - pnpm -C packages/astro exec tsc -b - pnpm -C packages/astro exec astro-scripts test "test/{alias-tsconfig,alias-tsconfig-no-baseurl,alias-path-alias-style,alias-css-url}.test.ts" * Address review feedback on alias resolution
Co-authored-by: Matthew Phillips <matthewphillips@cloudflare.com>
…s with server:defer component (#17123) * fix(transitions): prevent head elements loss during page transitions with server:defer component * Potential fix for pull request finding The test description mentions client:defer, but the fixture uses server:defer (server island). This makes the test intent misleading when debugging failures. (Copilot code review) Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * reformat * introduce SERVER_ISLAND_START constant to improve maintainability * fixed broken syntax --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…ify` is false (#17226) * fix(build): apply CSS target lowering when cssMinify is disabled (#17225) When `vite.build.minify: false` is set, Astro couples `cssMinify` to `minify`, forcing `cssMinify: false`. Vite's CSS target lowering only runs inside `finalizeCss` → `minifyCSS`, which is gated on `cssMinify` being truthy. This means no CSS gets target-lowered — neither imported stylesheets nor inline `.astro` `<style>` blocks. Add a new Vite plugin (`astro:css-target-lowering`) that applies lightningcss target lowering with `minify: false` to all CSS assets in `generateBundle` when `cssMinify` is falsy and a CSS target is configured. This decouples target lowering from minification, ensuring CSS respects the configured `build.target`/`cssTarget` regardless of minification settings. The plugin: - Converts esbuild/Vite target strings to lightningcss format - Resolves lightningcss from Vite's dependencies (not a direct dep) - Runs in generateBundle before inline-stylesheets processing - Only activates when cssMinify is disabled and cssTarget is set * fix(ci): update pnpm-lock.yaml for new test fixture --------- Co-authored-by: Matthew Phillips <matthew@matthewphillips.info>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )