Commit graph

2772 commits

Author SHA1 Message Date
Nate Moore
c2682a17c0
Fix injectRoute (#7943)
* fix: inject route! hack!

* refactor: use integration container to resolve all injected routes

* chore: add changeset

* Fix pnpm workspace injectRoute bug

See https://github.com/withastro/astro/issues/7561#issuecomment-1620063634

Closes #7561

* Revert "Fix pnpm workspace injectRoute bug"

This reverts commit 3082c7c269.

* Update .changeset/stupid-pants-press.md

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* Update packages/astro/src/vite-plugin-scripts/page-ssr.ts

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* refactor: cleanup injectedRoute resolution logic

---------

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
2023-08-07 11:24:28 -05:00
Nate Moore
6cd7290d2c
Refactor page filename logic (#7983)
* fix(#7561): refactor astro page filename logic

* chore: add changeset
2023-08-07 10:57:03 -05:00
Bjorn Lu
a4a637c8f7
Fix inline root resolve logic (#7977) 2023-08-07 21:43:03 +08:00
Timon Jurschitsch
51028f85c6
Add URL to RSSOptions.site type (#7964) 2023-08-07 16:49:55 +08:00
Matthew Phillips
a00cfb8942
Fix race condition when performing swap for fallback (#7945)
* Fix race condition when performing swap for fallback

* Adding a changeset

* Use let
2023-08-04 08:48:11 -04:00
Houston (Bot)
8226002c0a
[ci] release (#7941)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-03 16:47:20 -05:00
Nate Moore
89cd4b877e
Handle error state for version (#7939)
* fix(create-astro): handle error state for version

* fix: handle missing version
2023-08-03 16:03:04 -05:00
Houston (Bot)
49b3cf423b
[ci] release (#7937)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-03 15:16:51 -04:00
Matthew Phillips
4b6deda360
Export createTransitionScope from the runtime (#7936) 2023-08-03 14:41:08 -04:00
Nate Moore
6035bb35f2
Fix duplicate slash handling (#7935)
* fix(#7806): collapse duplicate slashes

* refactor: handle request.url with duplicate slashes

* chore: improve duplicate slash test

* fix: only collapse duplicate slashes once

* chore: appease TS
2023-08-03 13:13:39 -05:00
Houston (Bot)
39b044e09b
[ci] release (#7912)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-03 10:54:48 -04:00
Bjorn Lu
1f0ee494a5
Fix failed server restart calling integration hooks twice (#7917)
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
2023-08-03 22:26:24 +08:00
Matthew Phillips
41afb84057
Persistent DOM in ViewTransitions (#7861)
* First pass at transition:persist

* Persistent islands

* Changeset

* Updated compiler

* Use official release

* Upgrade again

* Refactor to allow head content to persist untouched

* >=

* Specify the types for "astro:persist"

* Automatically persist links

* Use reference for array

* Upgrade to latest compiler version

* Explain the feature

* Update .changeset/empty-experts-unite.md

Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>

* Update .changeset/empty-experts-unite.md

Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>

* Update .changeset/empty-experts-unite.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update .changeset/empty-experts-unite.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

---------

Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-08-02 14:42:01 -04:00
Martin Trapp
c264be3497
Fix scroll position in view transition (#7882) (#7911) 2023-08-02 13:07:30 -04:00
Bjorn Lu
00cb28f496
Improve sourcemap generation and performance (#7901) 2023-08-02 11:30:53 +08:00
ottomated
c00b6f0c49
Fix astro/app import (#7821)
* core -> core.js

* changeset

* test

---------

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-08-01 18:34:22 -05:00
Hee
560d0dab1c
feat: add cache headers to assets in Vercel adapter (#7729)
* feat: cache assets in Vercel adapter

* Update tidy-tips-doubt.md

* chore: update lockfile

* Update packages/integrations/vercel/test/static-assets.test.js

* Update packages/integrations/vercel/test/static-assets.test.js

* Update packages/integrations/vercel/test/static-assets.test.js

* chore: update split test

---------

Co-authored-by: Kid <44045911+kidonng@users.noreply.github.com>
Co-authored-by: Nate Moore <nate@astro.build>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-08-01 18:06:50 -05:00
DixCouleur
4dd6c7900c
Fix "res.writeHead is not a function" in Express/node middleware (#7708)
* fix: res.writeHead is not a function

* fix: handler params type added

* fix: handler function params error

* Update packages/integrations/node/src/nodeMiddleware.ts

---------

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-08-01 17:10:29 -05:00
Tony Dang
e1e958a758
Fix: Content Collections - Ignore .json files nested in non-underscored subdirectories within underscored directories (#7909)
* test: add test file so tests fail before fix

* fix: ignore files nested in underscore directories

* chore: add changeset

---------

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-08-01 16:08:11 -05:00
Houston (Bot)
1d9e34b136
[ci] release (#7877)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-01 23:38:24 +08:00
Sam Hulick
5c5da8d2fb
feat: add logging for when hydrate's JSON parse fails (#7887)
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
2023-08-01 16:33:38 +01:00
Nate Moore
298dbb89f2
Refactor 404 and 500 approach (#7754)
* fix(app): refactor 404 and 500 approach

* chore: refactor logic

* fix: always treat error as page

* test: migrate ssr-prerender-404 to node adapter

* feat: merge original response metadata with error response

* chore: update lockfile

* chore: trigger ci

* chore(lint): fix lint issue

* fix: ensure merged request has proper status

* fix(node): prerender test

* chore: update test label

* fix(node): improve 404 behavior in middleware mode

* fix(vercel): improve 404 behavior

* fix(netlify): improve 404 behavior

* chore: update test labels

* chore: force ci

* chore: fix lint

* fix: avoid infinite loops

* test: fix failing test in Node 18

* chore: remove volta
2023-08-01 09:52:16 -05:00
Bjorn Lu
0b8375fe82
Fix streaming Astro components (#7895) 2023-08-01 21:30:47 +08:00
Bjorn Lu
ebf7ebbf7a
Refactor and improve Astro config loading flow (#7879) 2023-08-01 17:11:26 +08:00
André Alves
9e22038472
Fix incorrect build path logging for 404.astro pages (#7885)
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-08-01 08:53:47 +01:00
Emanuele Stoppa
89d015db6c
fix: scan getStaticPaths only in .astro files (#7876) 2023-07-31 17:24:13 +01:00
Yan Thomas
1859960d04
Update old link from @astrojs/netlify README (#7862)
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
2023-07-31 13:50:53 +01:00
Houston (Bot)
d2b6dabfb3
[ci] release (#7854)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-28 12:34:00 -04:00
Matthew Phillips
861f10eafd
Fix redirect in SSR (Node and dynamic) (#7856) 2023-07-28 12:00:26 -04:00
Houston (Bot)
98ca04f915
[ci] release (#7851)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-28 09:12:05 -04:00
Matthew Phillips
49a4b28202
Scroll position restoration (#7800)
* Scroll position restoration

* Adding a changeset

* Throttle state persistence

* very important change
2023-07-28 09:07:00 -04:00
Bjorn Lu
e50f646758
Fix head propagation for MDX components (#7838) 2023-07-28 18:00:53 +08:00
Emanuele Stoppa
2275c7d56b
fix: dev server should redirect when a page doesn't exist (#7841) 2023-07-28 09:20:00 +01:00
Houston (Bot)
3b422272e6
[ci] release (#7813)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-27 15:33:13 -04:00
Matthew Phillips
59b5562326
Allow the Image component to get transitions (#7836)
* Images and view transitions

* Upgrade compiler

* Adding a changeset
2023-07-27 15:08:45 -04:00
Matthew Phillips
7dbcbc86b3
Track added links/styles/scripts to prevent duplicates (#7843)
* temporary change

* Track rendered styles and links to prevent duplicates

* Adding a changeset

* Fix names
2023-07-27 14:42:22 -04:00
Matthew Phillips
5161cf919c
Add astro:beforeload event (#7823)
* Add astro:beforeload event

* Adding a changeset

* Update .changeset/chilled-elephants-develop.md

Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>

---------

Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
2023-07-27 08:57:37 -04:00
Matthew Phillips
267487e63e
Prevent navigation on hash change (#7824) 2023-07-27 08:42:04 -04:00
Erika
b063a2d8ae
fix(assets): Fix endpoint not being injected when an integration would enable experimental.assets (#7829) 2023-07-27 11:37:27 +02:00
Erika
d5f526b339
test: add test in the Node adapter for astro:assets (#7734) 2023-07-26 23:58:47 +02:00
Erika
31c4031ba7
fix: squoosh not working on Windows in certain situations (#7826) 2023-07-26 21:38:37 +02:00
Matthew Phillips
42a21b5da6
Prevent building .html files in hybrid mode (#7805)
* Prevent building .html files in hybrid mode

* Adding a changeset
2023-07-26 07:58:57 -04:00
Houston (Bot)
db8c04002f
[ci] release (#7784)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-25 15:15:41 -04:00
Bjorn Lu
0f677c009d
Refactor Astro rendering to write results directly (#7782) 2023-07-25 23:44:25 +08:00
Matthew Phillips
188eeddd47
Execute scripts on page navigation (view transitions) (#7786)
* Execute scripts on page navigation (view transitions)

* Update .changeset/sharp-seas-smile.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

---------

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-07-25 08:35:47 -04:00
Alex Sherwin
7461e82c81
Add "allowHTML" option for Markdoc with HTML parsing/processing (#7597)
* 7576 - initial support for HTML inside Markdoc.

This uses htmlparser2 to perform a pure token transform/mutation
on the markdown-it tokens, replacing the original raw HTML string
tokens with a richer set of tokens per HTML node, and in the process
Markdoc tags are interleaved in the resulting token graph at the
appropriate locations

This removes the legacy config of the @astrojs/markdoc integration
entirely (suggested by @bholmesdev) and introduces a new type for
options to be specified in the astro config, initially, with just the new
"enableHTML" option

When "enableHTML" is *not* enabled (the default), the behavior
of the entire @astrojs/markdoc integration should remain functionally
equivalent to before this change

* 7576 - fixed issues with whitespace preservation

also:

* cleaned up " to ' for astro project preferred linting
* made the html rendering test fixture use a dynamic path

* 7576 - detailed nested HTML test coverage

* 7576 -  component + HTML interleaved tests

* 7576 -  fix lint problems from previous changes

* 7576 -  some commentary

* 7576 -  file naming, refactor html under imports, package.json exports definition for html

* 7576

* move out of extensions dir, remove export
* cdata handling changes

* 7576

* inline license from third party code
* cleanup test class copy of HTML output
* remove // third party indicators for imports (clarification: not third party code, just a indicator this group of imports is third party)

* 7576 - fixed test before/after for DRY'ness

* 7576 - no need to React-ify HTML attribute case

* 7576 - rename "enableHTML" option to "allowHTML"

* Added Markdoc allowHTML feature changeset

* 7576 - updated README with allowHTML info

* 7576 - fixed changeset typo

* 7576 - minor edits based on PR feedback for docs

* 7576 - minor edits based on PR feedback for docs
2023-07-24 19:34:06 -04:00
Kevin Whinnery
0a1b33349f
Update esbuild target for Deno (#7687)
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
2023-07-24 22:58:05 +08:00
Houston (Bot)
e80896a67c
[ci] release (#7763)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-24 17:09:11 +08:00
Bjorn Lu
3567afac44
Fix rendering TextEncoder encoding error regression (#7777) 2023-07-24 16:22:05 +08:00
Birk Skyum
0c9959704f
Bump vite to 4.4.6 (#7746) 2023-07-24 16:21:17 +08:00
Erika
da7f1128bf
Fix missing referrerpolicy attribute on script tags (#7766)
* fix(astro-jsx): Add missing `referrerpolicy` attribute for script tags

* chore: changeset
2023-07-23 15:00:41 +02:00
Erika
1792737dae
Misc improvements for astro:assets (#7759) 2023-07-21 23:59:14 +02:00
Houston (Bot)
16a41528e4
[ci] release (#7737)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-21 16:37:17 -04:00
Matthew Phillips
274e675328
Prevent FOUC with production links in ViewTransitions (#7756)
* Prevent FOUC with production links in ViewTransitions

* Adding changeset

* Move up so it works with fallback too
2023-07-21 16:26:42 -04:00
Matthew Phillips
c2d6cfd0c2
Prevent animations with prefers-reduced-motion (#7757)
* Prevent animations with prefers-reduced-motion

* Also disable animations in the fallback

* Change select to target elements
2023-07-21 16:10:48 -04:00
Matthew Phillips
201d32dcfc
Handle back navigation from page without VT (#7750)
* Handle back navigation from page without VT

* Adding a changeset
2023-07-21 10:40:36 -04:00
Anders Kaseorg
e528526289
Fix parsing image assets from a Markdown line along with other markup (#7742)
Every regex that tries to match a substring with .* or .+ is
guaranteed to be wrong.  In this case, it was giving incorrect matches
straddling multiple quoted attributes:

    <img __ASTRO_IMAGE_="../assets/image.png"> and <a href="link">link</a>
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Fixes #7741.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2023-07-21 07:59:10 +02:00
Arsh
35a0b6c8a9
fix(vercel): Switch to node 18 when local version is not supported (#7718)
* fix(vercel): switch to node 18 when needed

* fix types, reword

* reorder sentences

* add changeset

* fix(vercel): switch to node 18 when needed

* add referencce to vercel documentation

---------

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-07-20 13:39:46 -05:00
Houston (Bot)
92382ea1d4
[ci] release (#7714)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-20 12:09:38 -04:00
ottomated
3a6e42e190
Determine hoisted scripts via AST analysis (#7707)
* initial hacky

* plural importNames and exportNames

* extract into function

* Add test

* fix issue with another component importing our tracked component

* fix dynamic imports

* changeset

* add mdx to checklist

* mdx exports Content

* remove unused var

* Update packages/astro/test/hoisted-imports.test.js

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>

* Update packages/astro/src/core/build/plugins/plugin-analyzer.ts

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>

* Update packages/astro/src/core/build/plugins/plugin-analyzer.ts

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>

* Update real-drinks-melt.md

* Update .changeset/real-drinks-melt.md

Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>

* Update .changeset/real-drinks-melt.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update .changeset/real-drinks-melt.md

* Update .changeset/real-drinks-melt.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

---------

Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Co-authored-by: Matthew Phillips <matthew@matthewphillips.info>
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-07-20 12:03:40 -04:00
Nate Moore
77ffcc8f8b
fix(sitemap): ensure nested 404 and 500 pages are excluded (#7722) 2023-07-19 17:05:44 -05:00
Matthew Phillips
6a12fcecb0
Initial View Transition Support (#7511)
* Basic support

* Add the fade transition

* Move CSS into a separate file

* Add transition name

* View Transitions changeset

* Replace the boolean transition with 'morph'

* Update to use `transition:animate`

* Use head propagation

* Move CSS into a separate file

* Add builtin animations and namespaced module

* Misquote

* Remove unused code

* Add automatic prefetching to the View Transitions router

* Use a data attribute for back nav animations

* Use [data-astro-transition]

* Add view transitions to examples

* Wait on the HTML response before calling startViewTransition

* Updated stuff

* Update the compiler

* Fix

* Fallback support

* Properly do fallback

* Simplify the selectors

* Put viewTransitions support behind a flag

* Upgrade the compiler

* Remove unused import

* Add tests

* Use an explicit import instead of types

* Fix case where the click comes from within nested content

* Fix linting

* Add a test for the back button

* Prevent glitch in fallback

* Do not combine selectors

* Fallback to MPA nav if there is an issue fetching

* Fallback swap if there are no animations

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update packages/astro/components/ViewTransitions.astro

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* Update packages/astro/components/ViewTransitions.astro

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* Update the changeset

* PR review changes

* Update more based on review comments.

* Update the updateDOM default

* Pass in transitions options to the compiler

* Update broken tests

* Update .changeset/silly-garlics-live.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update .changeset/silly-garlics-live.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update .changeset/silly-garlics-live.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update .changeset/silly-garlics-live.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* h2 -> h4

* Upgrade to stable compiler

* Remove exp redirects from sitemap

* Remove usage from examples

* Remove example updates

---------

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
2023-07-19 15:18:41 -04:00
Nate Moore
d088351f54
Warn when getStaticPaths exists without a prerender statement (#7713)
* wip: warning on getStaticPaths without prerender

* refactor: move getStaticPaths warning to scanner plugin

* chore: do not add to test fixture

* chore: remove legacy getStaticPaths validation

* refactor: update warning message

* chore: typo

* chore: add changeset

* chore: remove unused variables

* refactor: make settings optional

* chore: fix lint

* chore: update message to include reason
2023-07-19 09:33:45 -05:00
Matthew Phillips
ec745d689a
Remove experimental flag for redirects config (#7686)
* Remove experimental flag for redirects config

* Remove experimental from tests

* Remove experimental CLI flag

* Add changeset

* Removing redirect test that is no longer relevant

* Remove experimental label"

* Update .changeset/dry-beers-grow.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update .changeset/dry-beers-grow.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Remove old function

---------

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-07-19 09:31:07 -04:00
Bjorn Lu
d78db48ac4
Fix absolute path handling for config validation in windows (#7704) 2023-07-19 15:53:24 +08:00
Bjorn Lu
019b797bf8
Fix redirects map object-form value validation (#7701) 2023-07-19 15:52:50 +08:00
Houston (Bot)
de65ad25ea
[ci] release (#7699)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-19 09:32:32 +02:00
Nate Moore
72bbfac976
Fix 404 status code in dev server (#7711)
* chore: update tests

* chore: update tests

* fix(#7516): set response status to 404 when rendering 404 page

* chore: add changeset

* chore: update dev container test

* refactor: improve status handling logic

* chore: remove unused import
2023-07-18 16:40:09 -05:00
Nate Moore
d401866f93
Fix 404 handling in dev server (#7693)
* fix(#7301): load 404 page in dev server when returning 404 status code

* chore: add changeset

* fix(404): expose exact pathname/URL when rendering 404

* test: add custom-404-server test
2023-07-18 12:09:18 -05:00
Erika
4f6b5ae2ba
Fix/markdoc assets (#7706) 2023-07-18 18:03:46 +02:00
Chris Swithinbank
a77741d25e
Add changeset & docs for next @astrojs/netlify release (#7700)
Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
2023-07-18 16:57:19 +01:00
Nate Moore
06c255716a
Fix routing behavior when getStaticPaths params include hyphens (#7694) 2023-07-18 10:36:43 +01:00
Houston (Bot)
d80e5fcf8e
[ci] release (#7681)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-18 16:14:39 +08:00
Bjorn Lu
d9f4126645
Revert netlify edge middleware docs (#7698) 2023-07-18 16:07:11 +08:00
Erika
cc0f81c040
fix(assets): Remove Node deps from index of assets (#7691) 2023-07-17 22:32:23 +02:00
Nate Moore
dd931a7806
Sitemap should only include page routes (#7656)
* fix(#7080): sitemap should only add trailing slash to pages

* fix(sitemap): only include pages in sitemap

* chore: add test

* chore: remove unused import

* docs: update readme
2023-07-17 15:29:56 -05:00
Emanuele Stoppa
4c93bd8154
feat(@astrojs/netlify): edge middleware support (#7632)
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
2023-07-17 15:53:10 +01:00
Emanuele Stoppa
cc8e9de881
fix: throw an error for incorrect configuration (#7680)
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
2023-07-17 14:35:29 +01:00
Alexander Niebuhr
6ec040761e
fix(@astrojs/cloudflare): SSR split file renaming misses ts endpoints (#7568)
* fix bug, where ts files where not renamed correctly

* try to make rename logic more robust

* remove log

* update tests

* update changeset

* cleanup

* fix lint

* debug windows tests

* fix windows support

* fix cloudflare directory code

* use EventContext type

* improve for loop

* change changeset

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* change changeset

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

---------

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
2023-07-17 09:12:41 -04:00
Bjorn Lu
1f0d0b5863
Fix vercel build error when passing includeFiles (#7677) 2023-07-17 20:57:27 +08:00
Bjorn Lu
1a6f833c40
Fix cloudflare runtime env var handling (#7679)
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
2023-07-17 20:57:08 +08:00
Houston (Bot)
dc7ab8af65
[ci] release (#7658)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-14 16:16:31 -05:00
Nate Moore
57a5eff5ce
fix(#7654): exclude @vercel/nft (#7659) 2023-07-14 16:01:06 -05:00
Nate Moore
c258492b72
Sitemap should only exclude 404 and 500 pages (#7655)
* fix(#7472): sitemap should only exclude 404 and 500 pages

* chore: refactor logic, add test
2023-07-14 14:30:33 -05:00
Houston (Bot)
1f2d52bd7b
[ci] release (#7645)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-14 10:44:25 -04:00
Bjorn Lu
8ee94ffbd9
Remove weird changeset symbols (#7648) 2023-07-14 17:20:44 +08:00
Matthew Phillips
213e10991a
Fixes for redirects config (#7644)
* Update redirects static generation based on recs

Got some great recommendations on how to handle our HTML written
redirect code based on SEO best practices.

See https://github.com/withastro/roadmap/issues/466#issuecomment-1595940678

This implements them all.

* Fix for using the root path / as a redirect

Fixes https://github.com/withastro/astro/issues/7478

* Fix static redirects prefer over dynamic page

Fixes https://github.com/withastro/astro/issues/7581
2023-07-13 16:09:44 -04:00
Erika
af5827d4f7
fix(assets): Fix images not following EXIF rotation (#7637) 2023-07-13 21:38:57 +02:00
Alvin Bryan
4b82e55cf1
Allow SVGs when using Assets (#7643)
* Allow SVG files when using Assets

* Fixed TypeScript error

* fix: some small nits and add a test

* chore: changeset

---------

Co-authored-by: Princesseuh <princssdev@gmail.com>
2023-07-13 21:22:31 +02:00
Houston (Bot)
db4095d3f5
[ci] release (#7624)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-13 21:43:11 +08:00
Emanuele Stoppa
f21357b69d
feat(@astrojs/netlify): add build.split support (#7615)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
2023-07-13 09:21:33 +01:00
Emanuele Stoppa
2ddf342626
fix(@astrojs/vercel): improve file detection (#7621) 2023-07-12 08:06:08 +01:00
Matthew Phillips
86e19c7cf8
Fixes Response not being cloneable by middleware (#7623) 2023-07-11 14:21:05 -04:00
Houston (Bot)
f0666b92c3
[ci] release (#7594)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-11 22:27:04 +08:00
Chris Swithinbank
831dfd1516
Filter out astro from peerDependencies in astro add (#7620) 2023-07-11 12:42:11 +02:00
Emanuele Stoppa
3669e2d276
fix: astro info command fallback for package manager (#7618) 2023-07-10 19:08:18 +01:00
Yan Thomas
131c92279e
Update prefetch README filename styling (#7613) 2023-07-10 14:37:09 +01:00
Bjorn Lu
904921cbe4
Ignore content .json files prefixed with underscores (#7611) 2023-07-10 20:39:32 +08:00
Ben Holmes
8df6a423c5
Fix: Hyphens breaking Markdoc tags (#7599)
* fix: handle hyphens in tag names

* test: add hyphen in test suite

* chore: changeset
2023-07-07 16:50:06 -04:00
Kory Smith
9807e4dc22
Updates prefetch integration to add "only prefetch link on hover/mouseover/focus" option (#6585)
* modifies prefetch to add the option to only prefetch certain pages on hover

* adds new pages to the test website to showcase prefetch-intent functionality

* adds tests to verify prefetch-intent behavior

* adds changelog

* waits until networkidle to check if the prefetching worked instead of waiting on a specific url load

* allows intentSelector to be either a string or array of strings

* Revert "allows intentSelector to be either a string or array of strings"

This reverts commit b0268eb0d5.

* fixes the multiple selector logic and adds tests

* updates docs to include new prefetch-intent integration

* Update packages/integrations/prefetch/README.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update packages/integrations/prefetch/README.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update packages/integrations/prefetch/README.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update .changeset/little-cars-exist.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update packages/integrations/prefetch/README.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

---------

Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
2023-07-07 16:01:23 -04:00
Ben Holmes
c135633bf6
Fix: Markdoc v0.4.0 docs (#7593)
* docs: add docs link to markdoc error

* docs: add named exports guide to README

* chore: changeset

* edit: no like so

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* edit: exposed as named exports

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

---------

Co-authored-by: bholmesdev <bholmesdev@gmail.com>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
2023-07-07 09:22:26 -04:00
Houston (Bot)
f224078a65
[ci] release (#7578)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-06 23:16:08 +08:00
sank.eth
2ca5bdde2b
corrected grammar. minor change (#7580) 2023-07-06 16:29:13 +08:00
Bjorn Lu
30d04db981
Refactor SSRResult and RenderContext (#7575) 2023-07-06 00:25:24 +08:00
Emanuele Stoppa
6e9c295799
feat: astro info command (#7432)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-07-05 17:02:51 +01:00
Emanuele Stoppa
9e5fafa2b2
feat: vercel edge middleware support (#7532)
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-07-05 16:45:58 +01:00
Houston (Bot)
f820bb3f0b
[ci] release (#7559)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-05 14:48:04 +08:00
Bjorn Lu
5ffdec7580
Fix style crawling logic for CSS HMR (#7565) 2023-07-05 14:13:45 +08:00
Johannes Spohr
47b756e3e1
Batch iterator buffering to reduce number of timeout calls (#7544) 2023-07-04 17:32:01 +08:00
Houston (Bot)
fc6826ff76
[ci] release (#7526)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-03 20:53:45 +08:00
Wooseop Kim
e644b34659
fix: make Picture generate valid dev URLs (#7500) 2023-07-03 16:09:40 +08:00
Nate Moore
cdc28326cf
Update style attribute behavior for better object support (#7542) 2023-07-03 15:59:35 +08:00
Ken Powers
19c2d43ea4
Make APIRoute generic like APIContext (#7521) 2023-07-03 15:58:27 +08:00
金成
1170877b51
Fix multiple create-astro registry issues (#7539)
* fix: getVersion Error when registry ends with '/'

* Update .changeset/old-seahorses-fold.md

* Update .changeset/old-seahorses-fold.md

* refactor: cleanup registry logic

* chore: update changeset

* fix(create-astro): update registry logic to rely on `fetch`

* chore: update changeset

* chore: update lockfile

* Update old-seahorses-fold.md

---------

Co-authored-by: jincheng32537 <jincheng32537@hundsun.com>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Co-authored-by: Nate Moore <nate@astro.build>
2023-06-30 17:24:36 -05:00
wackbyte
2172dd4f0d
fix: don't serialize undefined as null (#7531)
* fix: don't serialize `undefined` as `null`

* test: include more types in the pass-js test
2023-06-30 16:24:29 -05:00
Paweł Mrowiec
4256409a94
Fix image metadata generation (#7510)
* Fix problem where image metadata generation throwed error when provided url started with /@astroimage

* Remove unnecessary changes
2023-06-30 09:38:23 -05:00
Nate Moore
9e2426f756
fix(#7471): fallback to npm registry if config command fails (#7527) 2023-06-30 09:25:21 -05:00
Alexander Niebuhr
1a59185ddd
feature(astrojs/cloudflare): add support for splitted SSR bundles (#7464)
* initial commit

* try to fix windows

* output files directly into the correct folder

* allow for rest parameters

* use fixed hook

* improve tests

* apply doc's team suggestions for README

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* try to fix prerendering

* apply doc's team suggestion for changeset

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* bump to minor

* readme update

* resolve review comments

* optimize memory allocation

* resolve review comments

* add removed link, to make sure old docs keep same

* resolve comment

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

---------

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
2023-06-30 10:09:21 +01:00
Matthew Phillips
154af8f5ea
Split support in the Vercel Serverless adapter (#7514)
* start of vercel split support

* Split Mode with the Vercel Adapter

* Write routes into the config.json

* Add a changeset

* Add docs

* Better changeset
2023-06-29 16:18:28 -04:00
Houston (Bot)
56f1b1229c
[ci] release (#7496)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-29 17:14:24 +08:00
Nate Moore
d3247851f0
Pass compressHTML settings to manifest (#7488)
* fix(#7333): pass compressHTML to manifest

* chore: add compressHTML to astro:ssr-manifest test
2023-06-28 14:49:10 -05:00
Emanuele Stoppa
f4fea3b02b
fix: correctly handle prerender pages in split mode (#7509) 2023-06-28 13:06:16 +01:00
Ben Holmes
fb7af55114
feat: New Markdoc render API (#7468)
* feat: URL support for markdoc tags

* refactor: move to separate file

* feat: support URL for markdoc nodes

* feat: support `extends` with URL

* chore: changeset

* fix: bad AstroMarkdocConfig type

* fix: experimentalAssetsConfig missing

* fix: correctly merge runtime config

* chore: formatting

* deps: astro internal helpers

* feat: component() util, new astro bundling

* chore: remove now unused code

* todo: missing hint

* fix: import.meta.url type error

* wip: test nested collection calls

* feat: resolve paths from project root

* refactor: move getHeadings() to runtime module

* fix: broken collectHeadings

* test: update fixture configs

* chore: remove suggestions. Out of scope!

* fix: throw outside esbuild

* refactor: shuffle imports around

* Revert "wip: test nested collection calls"

This reverts commit 9354b3cf9222fd65b974b0cddf4e7a95ab3cd2b2.

* chore: revert back to mjs config

* chore: add jsdocs to stringified helpers

* fix: restore updated changeset

---------

Co-authored-by: bholmesdev <bholmesdev@gmail.com>
2023-06-27 15:05:17 -04:00
Ben Holmes
f6feff7a29
feat: restart server on markdoc config change (#7467)
* deps: vite-plugin-restart

* feat: restart on markdoc config change

* chore: changeset

* chore: roll our own restarter!

* deps: remove vite-plugin-restart

* refactor: use good enough option
2023-06-27 10:46:59 -04:00
Matteo Manfredi
2726098bc8
Update setTimeout() to queueMicrotask() (#7494) 2023-06-27 22:16:41 +08:00
Bjorn Lu
a3928016cc
Fix CSS error line offset (#7491) 2023-06-27 21:16:43 +08:00
Bjorn Lu
6dfd7081b7
Fix error stacktrace from Vite SSR runtime (#7273) 2023-06-27 21:16:29 +08:00
Bjorn Lu
83016795e9
Simplify nested hydration flow (#7370) 2023-06-27 21:16:10 +08:00
Houston (Bot)
da56a005d9
[ci] release (#7449)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-27 08:42:46 -04:00
Emanuele Stoppa
6014037441
fix: correct URL for entry points (#7490)
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
2023-06-27 11:58:23 +01:00
Bjorn Lu
57e603038f
Handle esbuild 0.18 changes (#7479) 2023-06-27 11:59:22 +08:00
Rasso Hilber
478cd9d8fa
fix: Installs underneath a path containing leading underscores (#7476) 2023-06-26 17:27:39 +08:00
Willow (GHOST)
6e7f38dd79
Svelte Four (#7454) 2023-06-25 22:33:00 +08:00
Bjorn Lu
869197aafd
Fix markdoc test fail in main (#7459)
* Early out if `importedModule` has no `id`

We can do this as line 97 also has this guard for each `importedModules`

* Simplify `isPropagationStoppingPoint`

* Fix actual bug

* chore: changeset

---------

Co-authored-by: bholmesdev <hey@bholmes.dev>
2023-06-23 17:00:19 -04:00
Bjorn Lu
2b75399520
Remove slash package (#7440) 2023-06-23 16:48:05 +08:00
Matthew Phillips
f359d77b18
Prevent accidental CSS inclusion in dev (#7381)
* Prevent accidental CSS inclusion in dev

* Use ssrTransformResult.deps instead

* Fix types

* Get dynamic deps too

* Handle virtual module deps

* Fix test on windows
2023-06-22 14:36:35 -04:00
Bjorn Lu
32bde967f4
Fix vercel redirects with trailingSlash always (#7447) 2023-06-22 23:40:08 +08:00
Houston (Bot)
38b104049a
[ci] release (#7434)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-22 10:06:15 -04:00
Wooseop Kim
9739adc91f
fix: encode spaces when generating srcset (#7340) 2023-06-22 15:56:41 +08:00
Benjamin MENANT
33cdc8622a
fix(astro:assets): inject /_image endpoint with prerendered=false on serverLikeOutput (#7423) 2023-06-22 15:20:35 +08:00
Ben Holmes
76fcdb84dd
Chore: remove legacy mdx content collections handler (#7353)
* chore: remove legacy mdx mapping

* chore: changeset

* chore: remove dead mdxEntryType

* nit: comments on mdx pkg name

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* smol smol smol nit: and vs or

---------

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
2023-06-21 19:51:15 -04:00
Ben Holmes
3f9f5c117e
fix: pnpm failure on create-astro (#7435)
* fix: use which-pm-runs instead of preferred-pm

* deps: remove preferred-pm

* chore: move which-pm-runs to regular deps

* chore: changeset
2023-06-21 16:02:20 -04:00
Bjorn Lu
30bb363713
Fix astro:build:setup hook updateConfig utility (#7438)
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
2023-06-21 21:56:25 +08:00
Emanuele Stoppa
459b5bd05f
feat: SSR split mode (#7220)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-06-21 13:32:20 +01:00
Emanuele Stoppa
8e2923cc62
feat: expose locals to render api and from requests in dev mode (#7385)
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Co-authored-by: wrapperup <wrapperup4@gmail.com>
2023-06-21 13:07:16 +01:00
KDTS
3943fa390a
Fix minior issue in the documentation related to port customization (#7436) 2023-06-21 10:40:52 +01:00
Ben Holmes
7877a06d82
Fix up pnpm dev (#7424)
* feat: use persistent per turbo recs

* feat: preserve types yay

* fix: *actually* solve problem

* fix: type failures from content types template

* fix: bad JS doc comments

* fix: bad src/content/template path

* chore: changeset

---------

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-06-20 14:06:36 -04:00
Emanuele Stoppa
e314a04bfb
fix: correctly emit middleware file name (#7427) 2023-06-20 17:32:30 +01:00
Houston (Bot)
1589eaabcd
[ci] release (#7428)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-20 10:32:26 -04:00
Emanuele Stoppa
2b34fc4928
fix: document open option (#7418)
Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
2023-06-20 15:24:29 +01:00
Chris Swithinbank
89a4835202
Fix telemetry reporting for integrations that return an array (#7429) 2023-06-20 14:42:49 +02:00
Torbjørn Holtmon
94afaa3e50
fix: cloudflare waitUntil not working as inteded with getRuntime (#7419)
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
2023-06-20 11:24:32 +01:00
Houston (Bot)
f87680f6df
[ci] release (#7390)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-19 11:36:45 -04:00
Bjorn Lu
bb644834ef
Simplify telemetry Vite version detection (#7414) 2023-06-19 17:18:46 +08:00
Nate Moore
d2020c29cf
Fix injected route edge case (#7399)
* fix(#7397): update astro page entryname logic

* chore: add changeset

* fix: update printed log for injected routes

* fix: ensure /index is included

* test: add custom-404-pkg test

* chore: cleanup
2023-06-16 15:58:07 -05:00
Bjorn Lu
556fd694a6
Rename tailwind integration options (#7391) 2023-06-15 23:40:42 +08:00
Arsh
d67ae84610
Node built-in modules support for Deno adapter (#7288)
* feature(deno adapter): allow built-in node modules

* Add changeset

* format
2023-06-15 10:20:35 -04:00
Tom
3f1cb6b1a0
@astrojs/tailwind: simplify, upgrade & fix support for ts config file (#6724)
Co-authored-by: bluwy <bjornlu.dev@gmail.com>
2023-06-14 17:55:37 +08:00
Houston (Bot)
06315a1fde
[ci] release (#7368)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-13 16:55:58 -04:00
beynar
6d8aa4b61f
[Cloudflare integration] Expose cf metadata and Cloudflare caches API (#7386)
* Add cf and cache properties to runtime

* add changeset

* reorder import

* fix types and add tests

* fix package name

* test
2023-06-13 16:34:44 -04:00
Ben Holmes
1c7b635956
Fix: Zod errors missing stacktrace (#7380)
* wip: figure out stack issue, weird JSON stringify bug on zod issue

* refactor: return data instead of mutating

* refactor: remove need for reassignment

* fix: e.stack only

* chore: changeset
2023-06-12 17:20:04 -04:00
Matthew Phillips
0986a44ddd
Upgrade lit deps (#7373)
* Upgrade lit deps

* Add changeset

* Downgrade peer dep

* Upgrade lockfile

* add client dep
2023-06-12 15:52:13 -04:00
adenpun
42baf62e7c
Fixed AstroUserConfig's redirect type definition (#7366) 2023-06-12 16:34:05 +08:00
Houston (Bot)
4f7091206c
[ci] release (#7354)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-10 13:54:36 -04:00
Ben Holmes
0a8d178c90
Raise error for duplicate content entry slugs (#7352)
* chore: throw error on dup slugs

* chore: move to ErrorData

* fix: remove unknownerror

* chore: changeset
2023-06-10 13:49:17 -04:00
Ben Holmes
a30f2f3de4
Fix Markdoc cloudflare errors (#7351)
* fix: move `node:` libs out of utils

* fix: node -> default

* chore: remove kleur from markdoc ex (why was this there??)

* chore: lock

* chore: changeset
2023-06-10 13:43:26 -04:00
Ben Holmes
491c2db424
Fix: better collection entry devalue error (#7341)
* feat: add clear error for devalue parse

* refactor: create error data entry

* deps: up devalue

* chore: changeset
2023-06-09 18:15:11 -04:00
Houston (Bot)
e138f66344
[ci] release (#7318)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-09 08:40:17 +03:00
Caleb Williams
1430ffb473
Fixes an issue where create Astro doesn't respect custom npm registries (#7326)
* Fixes an issue where create Astro doesn't respect custom npm registries

* chore: fix pnpm-lock

* chore: update lockfile

---------

Co-authored-by: Nate Moore <nate@astro.build>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-06-09 07:56:29 +03:00
Matthew Phillips
bbcf69e7b8
Fix redirects in dev mode (#7342)
* Fix redirects in dev mode

* Adding a changeset
2023-06-09 07:54:14 +03:00
Matthew Phillips
3d9a392a09
Remove error message for using Markdown component (#7343) 2023-06-09 07:41:08 +03:00
Ben Holmes
e3271f8c16
Better dynamic route regex error (#7339)
* feat: add helpful invalid route seg error

* chore: add errors-data entry

* refactor: add hint for non-spread errors

* chore: add `undefined` to common cases

* nit: if the param contains slashes

* chore: changeset

* chore: it's trivial my dear watson
2023-06-08 18:12:39 -04:00
Edo-San
52f0480d14
Fix/update spread attribute (#7310)
* fix: add default fallback for spreadAttributes values

* chore: add PR changeset

* chore: fix pnpm lock

---------

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-06-08 15:58:17 -05:00
Ben Holmes
e6bff651ff
Fix: catch and report config errors from handleConfigError (#7316)
* fix: catch and report config errors from `handleConfigError`

* chore: changeset
2023-06-07 09:59:20 -04:00
Bjorn Lu
a4176f98b8
Mark #7314 changeset as major (#7320) 2023-06-07 14:58:55 +08:00
wackbyte
e47e53dc0c
Update to svelte2tsx 0.6.15 and vite-plugin-svelte 2.4.1 (#7314) 2023-06-06 18:07:43 -05:00
Houston (Bot)
8a029d9889
[ci] release (#7312)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-06 17:24:57 -04:00
Ben Holmes
a11b62ee1f
Fix: Markdoc type errors (#7311)
* fix: config, prism, shiki exports

* fix: type error for `render` property

* chore: use `.ts` files in select tests for type checks

* fix: type error on shiki() promise

* chore: changeset
2023-06-06 14:48:54 -04:00
Ben Holmes
8034edd9ec
Fix [Object AsyncGenerator] logging for Markdoc components (#7307)
* Revert "Bug 6672 (#7062)"

This reverts commit cf621340b0.

* chore: remove unused test

* chore: changeset
2023-06-06 13:48:10 -04:00
Ben Holmes
2a4bb23b2f
Fix missing styles and scripts on document: {render:null} (#7309)
* fix: propagate assets when using document `render: null`

* fix: reverse spread order

* refactor: use README rec in test

* chore: changeset

* chore: revert unneeded changes
2023-06-06 13:40:04 -04:00
Houston (Bot)
d5a089810f
[ci] release (#7295)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-06 10:32:10 -05:00
Alex Sherwin
4929332c32
#7226 - fixes NodeJS adapter for multiple set-cookie headers (and other header issues) (#7227)
* Utilizes the new standard WebAPI Fetch Headers.getSetCookie() function
to safely handle multiple set-cookie headers when converting from a
WebAPI Response to a NodeJS ServerResponse

Modifies the existing nodeMiddleware logic which first set AstroCookies
on ServerResponse.setHeader(...) and then called
ServerResponse.writeHead(status, Response.headers) which means any that
if the WebAPI Response had any set-cookie headers on it, they would
replace anything from AstroCookies.

The new logic delegates appending AstroCookie values onto the WebAPI
Response Headers object, so that a single unified function safely
converts the WebAPI Response Headers into a NodeJS compatible
OutgoingHttpHeaders object utilizing the new standard
Headers.getSetCookie() function provided by the undici WebAPI polyfills.

Plus extensive test coverage.

* #7226 - changeset for NodeJS adapter set-cookie fix

* fixing all double quotes to single quotes

---------

Co-authored-by: Alex Sherwin <alex.sherwin@acadia.inc>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-06-06 10:09:16 -05:00
Riki
409c60028a
fix:query not considered in directory redirection (#7243)
* fix:query not considered in directory redirection

* feat: req.url may be empty

* test(node): add redirect + query param tests

* refactor(node): cleanup query param logic

* chore: remove log

* chore: add changeset

---------

Co-authored-by: Riki <947968273@qq.com>
Co-authored-by: Nate Moore <nate@astro.build>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-06-06 10:09:00 -05:00
André Alves
144813f730
Fix injected scripts not injected to injected routes (#7262)
* Fix injected scripts not injected to injected routes

* chore: changeset

---------

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-06-06 10:08:38 -05:00
Bjorn Lu
d72cfa7cad
Fix nested astro-island hydration race condition (#7197) 2023-06-06 17:39:25 +08:00
Nate Moore
39403c32fa
Unflag hybrid output (#7260)
* feat(hybrid): unflag hybrid output

* chore: cleanup rebase errors
2023-06-05 13:19:15 -05:00
Bjorn Lu
414eb19d2f
Remove experimental flag for custom client directives (#7237) 2023-06-06 00:04:35 +08:00
Erika
b5213654b1
feat(tsconfigs): Enable allowJs in base preset (#7274) 2023-06-05 17:31:21 +02:00
Emanuele Stoppa
101f032098
feat: remove experimental flag middleware (#7109)
* fix: middleware for API endpoints

* feat: remove experimental flag middleware

* chore: rebase and update

* chore: check if physical file exists

* chore: restore change

* merge

* merge

* fix: remove options, not needed

* remove experimental from types

* chore: don't have the middleware inside the manifest

* Update how redirects work, slightly

---------

Co-authored-by: Matthew Phillips <matthew@skypack.dev>
2023-06-05 11:25:18 -04:00
Erika
a7e2b37ff7
fix(html): Export HTML components as default export so their type is valid JSX (#7296)
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
2023-06-05 16:40:53 +02:00
Arsh
e3b8c62969
Stabilize inline stylesheets (#7180)
* changeset

* chore(inline stylesheets config): stabilize

* grammar

* not a major change

* Update inlineStylesheets version in the configuration reference

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

---------

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-06-05 10:28:29 -04:00
Matthew Phillips
57f8d14c02
Redirects (#7067)
* Redirects spike

* Allow redirects in static mode

* Support in Netlify as well

* Adding a changeset

* Rename file

* Fix build problem

* Refactor to be more modular

* Fix location ref

* Late test should only run in SSR

* Support redirects in Netlify SSR configuration (#7167)

* Implement support for dynamic routes in redirects (#7173)

* Implement support for dynamic routes in redirects

* Remove the .only

* No need to special-case redirects in static build

* Implement support for redirects config in the Vercel adapter (#7182)

* Implement support for redirects config in the Vercel adapter

* Remove unused condition

* Move to a internal helper package

* Add support for the object notation in redirects

* Use status 308 for non-GET redirects (#7186)

* Implement redirects in Cloudflare (#7198)

* Implement redirects in Cloudflare

* Fix build

* Update tests b/c of new ordering

* Debug issue

* Use posix.join

* Update packages/underscore-redirects/package.json

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* Update based on review comments

* Update broken test

---------

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* Test that redirects can come from middleware (#7213)

* Test that redirects can come from middleware

* Allow non-promise returns for middleware

* Implement priority (#7210)

* Refactor

* Fix netlify test ordering

* Fix ordering again

* Redirects: Allow preventing the output of the static HTML file (#7245)

* Do a simple push for priority

* Adding changesets

* Put the implementation behind a flag.

* Self review

* Update .changeset/chatty-actors-stare.md

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* Update docs on dynamic restrictions.

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Code review changes

* Document netlify static adapter

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Slight reword

* Update .changeset/twenty-suns-vanish.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Add a note about public/_redirects file

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

---------

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-06-05 09:03:20 -04:00
Matthew Phillips
dd1a6b6c94
Fixes cookies being set by middleware (#7294)
* Fixes cookies being set by middleware

* Adding a changeset
2023-06-05 08:28:29 -04:00
Jerry_wu
890a2bc989
remove the white space after the doctype according to the property co… (#7242) 2023-06-05 16:02:04 +08:00
Houston (Bot)
c895981386
[ci] release (#7278)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-02 13:17:55 -05:00
Nate Moore
229affca40
Add 'starlight' as template alias (#7277)
* feat(create-astro): add starlight as template alias

* chore: lint
2023-06-02 12:56:25 -05:00
Houston (Bot)
c64dfdd3d8
[ci] release (#7254)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-02 10:51:28 -04:00
Bjorn Lu
96ae37eb09
Fix Vitest with content collections (#7233) 2023-06-02 21:05:57 +08:00
Ben Holmes
9e7366567e
Content collections: ignored underscore directories in file glob (#7268)
* fix: ignored underscore dirs in glob

* chore: changeset
2023-06-02 07:54:50 -04:00
Benjamin MENANT
6e27f2f6db
fix(astro/core/app/node): support http2 requests (#7215) 2023-06-02 16:51:09 +08:00
Johannes Spohr
fea3069360
Parallel array rendering (#7136) 2023-06-02 16:46:12 +08:00
André Alves
dff0d0dda2
Fix sitemap filter (#7263) 2023-06-02 16:07:44 +08:00
Thiti Yamsung
5156c4f90e
fix: build fail upon have 'process.env' in *.md file. (#7257) 2023-06-01 10:34:02 -04:00
Ben Holmes
339529fc82
Markdoc asset bleed, second try (#7185)
* Revert "revert: markdoc asset bleed (#7178)"

This reverts commit 57e65d247f.

* fix: missing result param on `renderUniqueStylesheet`

* test: bundled styles (fails!)

* fix: use `type: 'external'` for links

* fix: split Astro components from markdoc config

* test: style bleed (it fails...)

* chore: remove unused util

* fix: revert entry change

* Stop traversing the graph when you encounter a propagated asset

* chore: cleanup unused `entry` prop

* refactor: add isPropagatedAssetsMod check

* chore: remove unused import

* chore: changeset

* Normalize path using vite

* Update packages/integrations/markdoc/src/index.ts

Co-authored-by: Ben Holmes <hey@bholmes.dev>

---------

Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Co-authored-by: bholmesdev <bholmesdev@gmail.com>
Co-authored-by: Matthew Phillips <matthew@matthewphillips.info>
2023-05-31 19:18:07 -04:00
Nate Moore
e0ca0d8c8a
Revert "feat(hybrid): unflag hybrid output (#7255)" (#7259)
This reverts commit bc5d6ed39f.
2023-05-31 12:06:24 -05:00
Nate Moore
bc5d6ed39f
feat(hybrid): unflag hybrid output (#7255) 2023-05-31 11:47:25 -05:00
Ben Holmes
563293c5d6
Markdoc: strip HTML comments from output (#7224)
* feat: strip HTML comments from output

* chore: changeset
2023-05-31 10:09:49 -04:00
Houston (Bot)
ba865f5d64
[ci] release (#7190)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-30 16:53:55 -04:00
Ben Holmes
f5063d0a01
Content collections - fix .json collection errors (#7246)
* fix: avoid error on collectionType === 'unknown'

* fix: ignore underscores in file globs

* chore: clarify [!_]

* fix: mismatch error not throwing

* fix: bad collectionType var

* test: no error for empty collection

* chore: changeset
2023-05-30 16:27:47 -04:00
Ben Holmes
bef3a75dbc
Markdoc - remove $entry variable (#7244)
* refactor: remove entry prop from `getRenderModule()`

* refactor: remove `$entry` from markdoc

* test: update entry-prop -> variables test

* refactor: unify `getEntryConfigByExt`

* chore: clean up shared content / data get logic

* docs: update `$entry` recommendation

* chore: rename entry-prop -> variables

* chore: changeset

* chore: missed a spot
2023-05-30 16:18:20 -04:00
Happydev
ee2aca80a7
fix: prioritize dynamic prerendered routes over dynamic server routes (#7235)
* test: add unit tests

* fix: prioritize prerendered routes

* chore: fix test

* add comment

* test: try avoiding race condition

* chore: changeset

* try avoiding race conditions attempt #2

* try avoiding race conditions (attempt 3)

* final fix hopefuly

* tet: add more tests

* sort conflicting dynamic routes aplhabetically

* test: fix test
2023-05-30 14:12:16 +00:00
wulinsheng123
cf621340b0
Bug 6672 (#7062)
* fix miss a head when the templaterender has a promise

* fix

* add some test

* test files move to md directory

* fix add

* delect file

---------

Co-authored-by: wuls <linsheng.wu@beantechs.com>
2023-05-30 08:05:48 -04:00
Bjorn Lu
af3c5a2e25
Use AstroError for Astro.glob errors (#7219)
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
Co-authored-by: sarah11918 <sarah11918@users.noreply.github.com>
2023-05-29 20:42:31 +08:00
Erika
f2f18b4405
feat: support images outside the project (#7139) 2023-05-26 22:03:06 +02:00
Bjorn Lu
1c77779dd6
Fix astro-static-slot hydration mismatch error (#7196) 2023-05-26 22:37:33 +08:00
Bjorn Lu
6c7df28ab3
Fix CSS deduping and missing chunks (#7218) 2023-05-26 21:30:42 +08:00
André Alves
bf63f615fc
Add global crypto to @astrojs/webapi (#6981)
* add crypto to be polyfilled

* chore: changeset

* chore: update deps for node types

---------

Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
Co-authored-by: Princesseuh <princssdev@gmail.com>
2023-05-26 15:02:35 +02:00
Bjorn Lu
52af9ad188
Add error message if Astro.glob is called outside (#7204) 2023-05-26 16:59:51 +08:00
Ben Holmes
16b8364119
Markdoc - improve syntax highlighting support (#7209)
* feat: prism and shiki support, with better exports!

* chore: update tests

* chore: fix lock

* chore: add prism test

* chore: remove `async` from prism

* docs: update syntax highlight readme

* chore: changeset

* edit: remove `await` from prism docs

* chore: update old changest with new shiki instructions

* fix: add trailing newline on ts-expect-error

* refactor: resolve promises internally

* docs: remove `await` from shiki examples
2023-05-25 11:35:07 -04:00
Emanuele Stoppa
8b041bf57c
refactor: emit pages as physical entry points (#7193) 2023-05-25 14:28:40 +01:00
Erika
f5a8cffac2
fix(vercel): Fix typo in README 🤦‍♀️ (#7208) 2023-05-25 14:59:25 +02:00
Bjorn Lu
ea16570b1e
Add MDX optimize option (#7151)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-05-25 19:43:29 +08:00
Alexander Niebuhr
6ca3b5a9e8
Export ChangeFreqEnum type for sitemap integration (#7028) 2023-05-25 17:15:26 +08:00
Akash Rajpurohit
59d8c50b84
fix: 🩹 update partytown options ts type (#7175) 2023-05-25 16:24:59 +08:00
Ben Holmes
1efaef6be0
Markdoc - Shiki (#7187)
* chore: remove unused util

* chore: changeset

* deps: shiki

* wip: first stab at shiki markdoc config

* feat: get shiki working!

* refactor: return HTML string directly from transform

* chore: move shiki to markdoc dev dep

* refactor: use async cache with clear docs on why

* test: transform units with Shiki config options

* refactor: switch to `extends` model

* refactor: nodes/ -> extensions/

* feat: raise friendly error for Promise extensions

* docs: README

* chore: lint

* chore: dead file

* chore: lowercase for fuzzy find please

* fix: bad ctx spread

* chore: clean up cache, add shiki imp error

* chore: add shiki to optional peer deps

* chore: hoist those consts

* docs: more explicit "install shiki now please"

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* oops bad find and replace

* chore: update changeset

* nit: period haunts me

---------

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-05-24 16:52:22 -04:00
Emanuele Stoppa
7851f9258f
fix: detect mdx files using full extension (#7192) 2023-05-24 10:20:06 +01:00
Bjorn Lu
27c6e01826
Remove @mdx-js/rollup dependency (#7191) 2023-05-24 17:02:04 +08:00
Barthélémy Ledoux
2bda7fb0bc
fix: add astro-static-slot to the list of inert tags in astro css (#7189) 2023-05-24 15:10:10 +08:00
Houston (Bot)
55a0439e00
[ci] release (#7181)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-23 16:24:16 -04:00
wulinsheng123
904131aec3
fix a bug when Fragment is as a slot (#6832)
* fix a bug when Fragment is as a slot

* update yaml

* fix ts errpr

* fix astro name of md

---------

Co-authored-by: wuls <linsheng.wu@beantechs.com>
2023-05-23 15:40:21 -04:00
Ben Holmes
57e65d247f
revert: markdoc asset bleed (#7178)
* revert: markdoc asset bleed

* chore: changeset
2023-05-23 12:16:50 -04:00
Houston (Bot)
cbdb0fdbd6
[ci] release (#7169)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-23 11:06:53 -04:00
Bjorn Lu
79ba74832f
Prevent Vite watching on Astro config load (#7171) 2023-05-23 22:40:40 +08:00
Emanuele Stoppa
92d1f017e5
chore(middleware): lift restriction around serializable data (#7174) 2023-05-23 15:10:30 +01:00
Emanuele Stoppa
626dd41d0a
refactor: move renderers to their own plugin (#7166) 2023-05-23 14:55:34 +01:00
Bjorn Lu
4ce8bf7c62
Make vite-plugin-content-virtual-mod run getEntrySlug 10 at a time (#7125) 2023-05-23 21:54:59 +08:00
Erika
2ca94269ed
Add types for import.meta.env.ASSETS_PREFIX and import.meta.env.SITE (#7172) 2023-05-23 14:13:10 +02:00
Alex Vukadinov
5b6a0312a8
fix: value of var could be undefined when using define:vars (#7134) 2023-05-23 12:28:44 +08:00
Houston (Bot)
64d2aba583
[ci] release (#7163)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-22 15:16:13 -04:00
Ben Holmes
f558a9e205
[Markdoc] Fix global asset bleed (#6758)
* wip: propagatedAssets flag per-component

* Propagate in TreeNode

* fix: remove unused inject comment

* feat: make asset propagation an integration opt-in

* fix: remove crawlGraph stopper

* wip: logs to understand what's happening

* SSR mdoc files in dev

* feat: add astroPropagatedAssets flag with vite

* chore: remove console logs

* chore: cleanup hasContentFlag

* fix: set handlePropagation default for legacy integrations

* chore: changeset

* temp: silence acorn type error

* chore: revert pnpm-lock changes

* fix: check correct flag

* We need to handle propagation on markdown because of layouts

* Remove use of renderStyleElement

* Fix heading tests

* Fix merge conflict

* typeof function

* Switch the check

* Add comment on injection detection regexp

---------

Co-authored-by: Matthew Phillips <matthew@skypack.dev>
2023-05-22 13:50:01 -04:00
Johannes Spohr
b41963b775
Render 404 page content when a Response with status 404 is returned from a page (#7143) 2023-05-22 12:06:06 -04:00
Houston (Bot)
d880293f79
[ci] release (#7161)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-22 09:48:21 -04:00
Akash Rajpurohit
e17ed0727e
feat: 🎨 export rss feeditem type (#7153) 2023-05-22 21:20:10 +08:00
Arsh
ba06362409
fix(hoisted scripts): consider script's dependents (#7144) 2023-05-22 09:15:21 -04:00
Happydev
8f418d13c5
fix(hybrid-output): no matched route when using getStaticPaths (#7150)
* `isPrenderDefault` ---> `isPrerenderDefault`

* test: add test fixture

* test: add hybrid getStaticPaths tests

* try fix in ci

* bring back edit lost on merge conflict fix

* back static paths guard

* move function to new file to avoid bundling issues

* remove unsued import

* debugging cleanup

* chore: update fixture's package.json

* cleanup test

* small test refactoring

* `status.ts` --> `metadata.ts`

* smol refactor

* chore: changeset

* just return the prerender metadata

* refactor tests

* chore: update lock file
2023-05-22 12:58:03 +00:00
Houston (Bot)
0616ef2551
[ci] release (#7130)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-21 00:00:31 +08:00
Ben Holmes
a9e1cd7e58
Fix: Heading ID CI flakiness (#7141)
* feat: use `ctx` object instead of leaky global

* test: heading IDs stale caches

* chore: changeset
2023-05-19 14:12:45 -04:00
Connor Bär
147373722b
fix(prefetch): Fix the inclusion of @types/network-information (#7123) 2023-05-19 23:34:34 +08:00
Johannes Spohr
72f686a689
Fix injectRoute for SSR (#7128)
* Use manifest routes for SSR app manifest instead of page components to enable injected routes with SSR

* Small refactoring

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

---------

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
2023-05-19 10:52:46 -04:00
Emanuele Stoppa
852d59a8d6
refactor(astro): emit entry.mjs to import pages via dynamic import (#7036) 2023-05-19 15:30:03 +01:00
Emanuele Stoppa
319a0a7a0a
refactor: create virtual module for middleware (#7132) 2023-05-19 13:51:47 +01:00
Erika
3257dd2890
Improve content collection error message for empty folders (#7118) 2023-05-19 13:53:46 +02:00
Bjorn Lu
530fb9ebee
Add route information for getStaticPaths warning (#7126) 2023-05-19 18:13:46 +08:00
Houston (Bot)
31cbf4357e
[ci] release (#7090)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-18 12:31:59 -04:00
Johannes Spohr
e186ecc5e2
Parallelize rendering of sibling components to avoid async waterfalls (#7071)
* Parallelize rendering of sibling components to avoid async waterfalls

* Catch and rethrow errors when eagerly rendering children

* Catch `Response` in rendering stage and throw error

* Add changeset

* Fix test error message

* Improve unit tests

* Start async generators in non-buffered mode, and only start buffering once a component doesn't resolve immediatly

* Add more documentation
2023-05-18 09:54:23 -04:00
Reuben Tier
cada10a466
Add errors for unknown experimental keys (#7011) 2023-05-18 17:39:39 +08:00
Ben Holmes
6b4fcde376
Fix: add headings to .mdoc render type (#7111)
* fix: add `headings` to `.mdoc` render type

* chore: changeset
2023-05-17 16:35:48 -04:00
Ben Holmes
c6d7ebefdd
Data collections and references (#6850)
* feat: add generated lookup-map

* feat: wire up fast getEntryBySlug() lookup

* fix: consider frontmatter slugs

* chore: changeset

* chore: lint no-shadow

* fix: revert bad rootRelativePath change

* chore: better var name

* refactor: generated `.json` to in-memory map

* chore: removed unneeded await

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>

* chore: removed unneeded await

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>

* Revert "chore: removed unneeded await"

This reverts commit 1b0a8b00c2.

* fix: bad `GetEntryImport` type

* chore: remove unused variable

* refactor: for -> Promise.all

* refactor: replace duplicate parseSlug

* refactor: add cache layer

* Revert "refactor: add cache layer"

This reverts commit 1c3bfdc6b3.

* feat: json collection POC

* wip: add test json file

* wip: playing with api ideas

* refactor: extract getCollectionName

* feat: add defineDataCollection

* refactor: variable destructure

* wip: basic data entry pipeline

* chore: revert fixture playing

* wip: basic entry array parser

* feat: basic data type gen

* chore: add with-data playground

* feat: add error when `defineDataCollection()` isn't used

* fix: missing error message

* feat: data collections are here!

* wip: play with data query APIs

* feat: reference() util!

* fix: Markdoc `$entry` variable

* play: add reference util with markdoc

* chore: delete console logs

* feat: `src/data/`!

* feat: reference() errors

* fix: handle hoisted schema parse errors

* fix: reload config and invalid on collection changes

* feat: separate maps for content and data entries

* feat: new `reference()` API that fixes type inference

* feat: support `defineCollection()` for data config

* fix: defineCollection `type` inferenenceπinference

* chore: lock

* feat: getCollection() for everything!

* feat: get full entry access from reference()

* chore: changeset

* wip: type error on acorn?

* chore: lint

* chore: add slugger to data ID processing

* chore: astro/zod -> zod

* chore: example version

* chore: remove slugifier from data id

* chore: remove dead getDataCollection

* chore: remove dead defineDataCollection

* fix: bad collection import

* chore: lock

* feat: add data collections to lookup map

* refactor: stop resolving data from reference

* feat: introduce getEntry and new reference()

* fix: update config loader

* fix: reference() type

* feat: test self references (they work 🎉)

* fix: use `slug` for content references

* fix: bad getEntry content type

* chroe: remove console logs

* fix: strict null checks on with-data

* feat: add getEntries for ref arrays

* chore: fix type hints for reference strings

* chore: change to type never for clarity

* play: try getEntries

* Return to "everything goes in `src/content/`

This reverts commit cc637ec6db4fc23afab585df5f240b7f7c0abc8a.

* fix: remove old function

* chore: update to AstroErrors

* chore: remove unused fixture files

* play: names

* deps: js-yaml

* feat: data collection YAML with error handling

* refactor: remove console log

* refactor: code cleanup

* fix: allow mixed content to pass through glob imports

* chore: move lookupMap util to virtual-mod

* refactor: new lookupMap logic, better errors

* chore: change MixedContent title

* refactor: remove unneeded try / catch

* fix: use `ws.send` for type gen errors

* fix: bubble `ws.send` errors from astro sync

* refactor: revert verbose astroContentCollectionEntry

* fix: bad with-data package name

* fix: bad virtual mod flag

* chore: remove with-data playground

* test: data collection authors

* test: translations data collection

* fix: add `.yml` support

* refactor: mix in `.yaml` just for fun

* refactor: i18n -> translations

* chore: content-collection-references fixture

* chore: bad lockfile

* fix: bad ContentLookupMap import

* chore: revert back to astroContentCollectionEntry

* test: collection references

* fix: bad error code override

* chore: remove unused asset

* test: sync errors

* chore: remove stray console log

* chore: lock

* chore: revert with-markdoc changes

* chore: doc error states, remove bad merge code

* chore: remove bad `as any`

* chore: lint

* chore: inline ContentLookupMap comments

* chore: settings -> config

* fix: put back `defineCollection()`

* fix: entry.slug for get content collection

* chore: update get-entry-type tests

* docs: totally shorten "missing a `type`"

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* docs: truncate share a `schema`

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* chore: add `test:unit` and `test:unit:match`to base

* chore:  update changeset

* refactor: cleanup runtime types and inline comments

* nit: [0] instead of shift()

* refactor: `getRelativeEntryPath()` util

* chore: capitalized Collections for test:match

* nit: ?? viteId on split

* nit: separate Params obj

* chore: add try / catch on readFile

* nit: `const data`

* chore: clean up data collection exceptions

* nit: `?? ''` for search params

* chore: remove TODO on hoisted error

---------

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-05-17 11:36:27 -04:00
Chris Swithinbank
fc52681ba2
Fix weird periods in NoMatchingRenderer error (#7110)
* Fix weird periods in `NoMatchingRenderer` error

* Add changeset
2023-05-17 17:30:47 +02:00
Erika
410428672e
Fix imports using ?raw and ?url not working when experimental.assets is enabled (#7108) 2023-05-17 17:07:57 +02:00
Matthew Phillips
3d525efc95
Prevent removal of nested slots within islands (#7093)
* Prevent removal of nested slots within islands

* Fix build errors
2023-05-17 10:18:04 -04:00
Timo Zander
e9fc2c2213
add warn message when using unsupported file types in pages/ (#6851)
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
2023-05-17 16:02:33 +02:00
Erika
c1669c0011
feat: uncomment polymorphic type (#7069) 2023-05-17 15:38:27 +02:00
wulinsheng123
763ff2d1e4
HTML minification (#6706)
* TDD pattern development

* add compact property when the user run pnpm run build

* add minification for pro

* fix yaml file collision

* fix yaml collision

* fix pageage file

* optimize unit test

* fix revert code

* fix comment

* update yaml

* fix default value

* add test for dev

* Update packages/astro/test/astro-minification-html.test.js

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* Update packages/astro/test/astro-minification-html.test.js

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* Update packages/astro/test/astro-minification-html.test.js

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* Update packages/astro/test/astro-minification-html.test.js

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* Update packages/astro/test/astro-minification-html.test.js

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* Update the docs to reflect it's opt-in

* Add tests for SSR

* Document how the tests remove the doctype line

* Expand on the changeset

* rename for slice -100

* Updates based on PR comments

* optimize description

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

---------

Co-authored-by: wuls <linsheng.wu@beantechs.com>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Co-authored-by: Matthew Phillips <matthew@matthewphillips.info>
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-05-17 09:26:49 -04:00
Happydev
719002ca5b
feat: hybrid output (#6991)
* update config schema

* adapt default route `prerender` value

* adapt error message for hybrid output

* core hybrid output support

* add JSDocs for hybrid output

* dev server hybrid output support

* defer hybrid output check

* update endpoint request warning

* support `output=hybrid` in integrations

* put constant variable out of for loop

* revert: reapply back ssr plugin in ssr mode

* change `prerender` option default

* apply `prerender` by default in hybrid mode

* simplfy conditional

* update config schema

* add `isHybridOutput` helper

* more readable prerender condition

* set default prerender value if no export is found

* only add `pagesVirtualModuleId` ro rollup input in `output=static`

* don't export vite plugin

* remove unneeded check

* don't prerender when it shouldn't

* extract fallback `prerender` meta

Extract the fallback `prerender` module meta out of the `scan` function.
It shouldn't be its responsibility to handle that

* pass missing argument to function

* test: update cloudflare integration tests

* test: update tests of vercel integration

* test: update tests of node integration

* test: update tests of netlify func integration

* test: update tests of netlify edge integration

* throw when `hybrid` mode is malconfigured

* update node integraiton `output` warning

* test(WIP): skip node prerendering tests for now

* remove non-existant import

* test: bring back prerendering tests

* remove outdated comments

* test: refactor test to support windows paths

* remove outdated comments

* apply sarah review

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* docs: `experiment.hybridOutput` jsodcs

* test: prevent import from being cached

* refactor: extract hybrid output check to  function

* add `hybrid` to output warning in adapter hooks

* chore: changeset

* add `.js` extension to import

* chore: use spaces instead of tabs for gh formating

* resolve merge conflict

* chore: move test to another file for consitency

---------

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
2023-05-17 09:23:20 -04:00
Ben Holmes
fb84622af0
[Markdoc] headings and heading IDs (#7095)
* deps: markdown-remark

* wip: heading-ids function

* chore: add `@astrojs/markdoc` to external

* feat: `headings` support

* fix: allow `render` config on headings

* fix: nonexistent `userConfig`

* test: headings, toc, astro component render

* docs: README

* chore: changeset

* refactor: expose Markdoc helpers from runtime

* fix: bad named exports (commonjsssss)

* refactor: defaultNodes -> nodes

* deps: github-slugger

* fix: reset slugger cache on each render

* fix: bad astroNodes import

* docs: explain headingSlugger export

* docs: add back double stringify comment

* chore: bump to minor for internal exports change
2023-05-17 09:13:10 -04:00
Bjorn Lu
c91e837e96
Add edge-light and worker to vercel edge bundling (#7103) 2023-05-17 09:06:18 -04:00
Bjorn Lu
73ec6f6c16
Implement custom client directives (#7074)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-05-17 20:51:27 +08:00
Emanuele Stoppa
075eee08f2
fix: middleware for API endpoints (#7106)
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
2023-05-17 11:48:02 +01:00
Bjorn Lu
826e028900
Add files field to packages (#7104) 2023-05-17 16:54:00 +08:00
Bjorn Lu
2994bc52d3
Build edge/worker runtime with webworker ssr target (#7101) 2023-05-17 15:44:20 +08:00
Erika
4516d7b22c
refactor(assets): Move generation logic out of internal.ts (#7102) 2023-05-16 16:40:32 +02:00
Johannes Spohr
2a1fa09b31
Add workerd and worker to cloudflare adapter bundling (#7092) 2023-05-16 20:00:29 +08:00
Happydev
cd410c5eb7
Fix double prepended forward slash in certain cases (#7091)
* test: add test with no base

* fix: don't always prepend a forward slash

* chore: changeset

* `'/' + base`   ------> `prependForwardSlash(base)`
2023-05-15 08:53:34 -04:00
Steffan
914c439bcc
Escape closing script tag when using define:vars (#7044) 2023-05-15 14:35:54 +08:00
Nathaniel Blackburn
06ca3702f8
Inject analytics env (#6876) 2023-05-15 14:13:47 +08:00
Reuben Tier
a37e67b520
RSS: Fix string validation of pubDate (#7066) 2023-05-15 14:10:32 +08:00
Houston (Bot)
d68e736545
[ci] release (#7088)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-15 01:06:45 +08:00
Happydev
c5f1275e9d
Fix create-astro regression (#7086) 2023-05-15 00:57:37 +08:00
Houston (Bot)
8d09a14a7b
[ci] release (#7077)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-12 15:00:17 -04:00
Emanuele Stoppa
8c14bffbd9
fix: don't exit the program if dependencies don't install (#7052) 2023-05-12 16:00:20 +01:00
Matthew Phillips
781f558c40
Correct handle directory finds when using base in the Node adapter (#7076) 2023-05-12 10:01:05 -04:00
Houston (Bot)
0fc026f63c
[ci] release (#7065)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-11 15:14:17 -04:00
Erika
4f1073a6a4
fix(image): Fix astro:assets from interfering with SSR query params ending with image extensions (#7055)
* fix(image): Fix `astro:assets` from interfering with SSR query params ending with image extensions

* test: add test

* nit: nit

* chore: changeset
2023-05-11 14:29:32 -04:00
Caleb Jasik
ebb40f5cb0
@astrojs/image: Add fetchpriority to Picture types (#7059)
* Add `fetchpriority` to `Picture` types

* Add changeset
2023-05-11 14:40:53 +02:00
Craig Jennings
c87d42e766
fix: don't require 'paths' object in tsconfig to alias paths (#7000) 2023-05-11 17:08:16 +08:00
Houston (Bot)
a44e755cc6
[ci] release (#7043)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-09 17:37:15 -04:00
Ben Holmes
3a9f72c7f3
[Markdoc] Validation and debugging improvements (#7045)
* feat: better validation logs

* chore: add warning to restart server on config chnage

* feat: expose Markdoc global from markdoc/config

* docs: update `nodes` reference

* chore: changeset

* docs: simplify headings explainer

* chore: ignore eslint log errors

* fix: make legacyConfig prop optional
2023-05-09 17:20:55 -04:00
Erika
48395c8152
fix: properly prefix endpoint path with base in SSR (#7047)
* fix: properly prefix endpoint path with base in SSR

* chore: sssss

* chore: changeset
2023-05-09 20:53:06 +02:00
Ben Holmes
630f8c8ef6
[Content collections] Fast getEntryBySlug() lookup (#6916)
* feat: add generated lookup-map

* feat: wire up fast getEntryBySlug() lookup

* fix: consider frontmatter slugs

* chore: changeset

* chore: lint no-shadow

* fix: revert bad rootRelativePath change

* chore: better var name

* refactor: generated `.json` to in-memory map

* chore: removed unneeded await

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>

* chore: removed unneeded await

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>

* Revert "chore: removed unneeded await"

This reverts commit 1b0a8b00c2.

* fix: bad `GetEntryImport` type

* chore: remove unused variable

* refactor: for -> Promise.all

* refactor: replace duplicate parseSlug

* refactor: add cache layer

* Revert "refactor: add cache layer"

This reverts commit 1c3bfdc6b3.

* refactor: add comment, move to virtual-mod

* chore: add jsdocs

* refactor: fiiiiine no more `??=`

* fix: ignore underscore files in lookup map

* chore: add unknowncollectionerror on bad file contents

---------

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
2023-05-09 12:17:08 -04:00
Reuben Tier
1b90a7a5d5
Fix generation for routes defined using getStaticPaths (#7029)
* Fix static site dynamic routes for sitemap integration

* Add changeset

* Update pnpm-lock

* Remove console.log
2023-05-08 16:12:41 -04:00
Houston (Bot)
e54dcd5943
[ci] release (#7037)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-08 13:17:09 -04:00
Raul Melo
157357e1fb
fix middleware typing export (#7032)
* fix middleware typing export

* Update .changeset/new-seals-hear.md

---------

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
2023-05-08 09:01:23 -04:00
Bjorn Lu
c009970333
Fix astro:assets SSR error (#7034) 2023-05-08 19:33:08 +08:00
Houston (Bot)
50bf66e4df
[ci] release (#7005)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-05 13:23:18 -04:00
Emanuele Stoppa
e9f0dd9b47
fix(middleware): emit warning if next is called and nothing is returned (#7010)
* fix(middleware): emit warning if `next` is called and nothing is returned

* chore: add test case

* chore: changeset

* chore: restore code, ooops!

* chore: change logic

* change namespace
2023-05-05 13:20:33 -04:00
Erika
1d4db68e64
fix: declare namespace so client-base.d.ts stays an ambient definition (#7009) 2023-05-05 16:20:37 +02:00
Waxer59
ad5c75447a
Fix partytown README (#7001)
* fix README

* add changeset
2023-05-05 09:52:41 +02:00
Houston (Bot)
170140083c
[ci] release (#6996)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-04 16:19:01 -04:00
Erika
71332cf969
fix: move service functions from astro/assets to astro/config so it can be imported (#6995)
* fix: move service functions from astro/assets to astro/config so people can import it

* chore: changeset
2023-05-04 15:57:23 -04:00
Houston (Bot)
51c8e7fe29
[ci] release (#6977)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-04 12:49:17 -04:00
Erika
818252acda
Add caching for optimized images (#6990) 2023-05-04 17:49:55 +02:00
Robin Neal
ca329bbcae
Generate unique ids within each React island (#6976) 2023-05-04 15:23:00 +01:00
Emanuele Stoppa
17c074b202
chore: update middleware changeset (#6986) 2023-05-04 08:03:52 -04:00
Arsh
80e3d4d3d0
feature: configuration for css inlining behavior (#6659)
* feature(inline stylesheets): implement as experimental

* test: rename css-inline -> css-import-as-inline

* test(content collections): add de-duplication of css

* test: add new suite for inlineStylesheets configuration

* fix(inline stylesheets): did not act on propagated styles

* hack(inline stylesheets testing): duplicate fixtures

Content collections reuses build data across multiple fixture.builds, even though a configuration change may have changed it.
Duplicating fixtures avoids usage of the stale cache.
https://cdn.discordapp.com/attachments/1039830843440504872/1097795182340092024/Screenshot_87_colored.png

* refactor(css plugin): reduce nesting

* optimization(css rendering): merge <style> tags

Chrome, but not Safari or Firefox, is slower to match rules when they are split across multiple files or style tags.
https://nolanlawson.com/2022/06/22/style-scoping-versus-shadow-dom-which-is-fastest/

Having the abiility to inline stylesheets opens us up to this optimization.
Ideally, it would extend to propagated styles, but that ended up being a rabbit hole.

* typedocs(inlineStylesheets config): ensure consistency

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* chore(build internals): update comment

* correct minor mistake in test

* test(inline stylesheets): unique package names for duplicate fixtures

* refactor(css build plugin): maps -> records

* refactor(css build plugin): remove use of spread operator

---------

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-05-03 14:49:06 -04:00
Emanuele Stoppa
831b67cdb8
feat(astro): experimental middleware (#6721)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-05-03 17:40:47 +01:00
Atila Fassina
ad907196cb
Sitemap: support SSR routes (#6534)
* feat(sitemap): support SSR generated routes

* feat(sitemap): add changeset for SSR support

* refactor: move logic to `astro:build:done`

* generate route to obey `trailingSlash` setting

* add logic to respect "directory" build format

* integration(sitemap): add unit test for ssr support
2023-05-03 12:19:45 -04:00
Bjorn Lu
cac4a321e8
Support <Code inline /> to output inline code (#6959)
* Support `<Code inline />` to output inline code

* Fix typo

* Fix typo again

* Remove expected error

---------

Co-authored-by: Matthew Phillips <matthew@skypack.dev>
2023-05-03 12:15:00 -04:00
Matthew Phillips
0883fd4875
Ensure multiple cookies set in dev result in multiple set-cookie headers (#6973)
* Ensure multiple cookies set in dev result in multiple set-cookie headers

* Adding a changeset

* Try connecting to localhost instead

* use localhost in the Host header

* Use 0.0.0.0

* localhost it is
2023-05-03 11:26:02 -04:00
Matthew Phillips
3326492b94
Implement scopedStyleStrategy (#6771)
* Implement scopedStyleStrategy

* Add changeset

* Update compiler

* Specify the eswalker version

* Update compiler

* Update .changeset/green-cups-hammer.md

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* Update .changeset/green-cups-hammer.md

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update .changeset/green-cups-hammer.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

---------

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-05-03 11:16:03 -04:00
Bjorn Lu
49514e4ce4
Upgrade shiki to v0.14.1 (#6932)
* Upgrade shiki

* Update themes

* Update languages

* Simplify

* Fix compat for other remark code

* Update theme again

* Fix language gen

* Add changeset

* Fix code

* Update test theme colors

* Update changeset

* Fix test again
2023-05-03 11:07:57 -04:00
Houston (Bot)
297a1dae51
[ci] release (#6954)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-02 15:13:10 -04:00
Bjorn Lu
77270cc2cd
Avoid removing leading slash for build.assetsPrefix (#6969)
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
2023-05-02 14:13:44 -04:00
Ben Holmes
b5482cee23
Fix: remove odd /1/ check on RSS canonicals (#6970)
* fix: remove odd `/1/` check on RSS canonicals

* chore: changeset
2023-05-02 13:48:44 -04:00
Matthew Phillips
b6797fc858
Update Solid ecosystem package logic to include packages with peerDep… (#6934)
* Update Solid ecosystem package logic to include packages with peerDep of Solid

* Remove solid as a noExternal

* Update the changeset
2023-05-02 13:23:28 -04:00
Bjorn Lu
72c6bf01fe
Fix content render imports flow (#6958) 2023-05-02 23:21:44 +08:00
Bjorn Lu
a8a319aef7
Fix astro-entry error on build with multiple JSX frameworks (#6967) 2023-05-02 23:18:34 +08:00
Erika
a695e44aed
fix(types): Fix getImage type requesting for a second parameter (#6961) 2023-05-02 14:23:37 +02:00
Erika
6063f56573
feat(vercel): Add support for image optimization API (#6845)
* feat(vercel): Add support for image optimization API

* chore: changeset

* feat: implement image service

* feat: dev service

* feat: full local service

* fix: move assets check to astro:config:done

* feat: update with new settings

* fix: remove unused param

* test: add tsets

* fix: rename to imageService

* docs: add docs

* Apply suggestions from code review

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* docs(vercel): Add Added In mentions

---------

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-05-02 09:42:48 +02:00
Arsh
367e617761
Make prerendering decision based on PageBuildData instead of BuildInternals (#6956)
* read prerender flag from PageBuildData

* add changeset
2023-05-01 16:15:04 -04:00
Nate Moore
895fa07d8b
fix: inline process.env boolean values (0, 1, false, true) (#6910) 2023-05-01 10:51:47 -05:00
Erika
e5bd084c01
fix: fix sharp semver range to allow for 0.32.0 (#6952)
* fix: fix sharp semver range to allow for 0.3é20

* fix: revert back to 0.31.0
2023-05-01 17:32:50 +02:00
Houston (Bot)
d0cf3a2c01
[ci] release (#6924)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-01 10:58:03 -04:00
Chell
50975f2ea3
Fix slot tags uncleaned in HTML String (#6948)
* fix: slot regex

* add slot test

* change set

* add test
2023-05-01 10:49:23 -04:00
Erika
dc062f6695
Upgrade to version 1.0.0 of the language server (#6953) 2023-05-01 16:41:21 +02:00
Chris Swithinbank
a98df9374d
Show injected custom 404 route in dev (#6940)
* Add unit test for injected 404 routes

* Add fixture test for injected 404 routes

* Use any route pattern to find custom 404

* Fix frozen lockfile error

* Use `route` instead of `pattern` to match custom 404

Dynamic catch-all routes can match against `/404/` but will then error because they’re not actually designed to handle a param of `'404'`. Testing `route` instead excludes dynamic routes (because they’ll contain dynamic segments inside square brackets). Not sure if someone might _want_ to render the 404 via a dynamic route, but we already don’t support that, so this doesn’t change anything.

* Fix injected 404 fixture

* Add tests for `src/pages/404.html`

* Add changeset

* Fix lockfile

* And again
2023-05-01 10:37:07 -04:00
Matthew Phillips
c405cef647
Catch errors that occur within the stream in the Node adapter (#6935)
* Catch errors that occur within the stream in the Node adapter

* Adding a changeset

* Better error message on completely uncaught errors within the stream

* Update test
2023-05-01 10:08:18 -04:00
Matthew Phillips
649d70934e
Configure redoc to be noExternal (#6933) 2023-05-01 09:31:44 -04:00
Bjorn Lu
2dca81bf21
Update dependencies to remove peer dep warnings (#6930) 2023-04-28 21:21:47 +08:00
Bjorn Lu
ac57b5549f
Upgrade undici to v5.22.0 (#6929) 2023-04-28 21:13:49 +08:00
Yan Thomas
d11d185951
Add missing code language in Cloudflare README (#6925) 2023-04-28 14:37:26 +08:00
Erika
ebae1eaf87
feat(image): Update image service config to allow passing settings to the service (#6848) 2023-04-27 18:16:40 +02:00
Bjorn Lu
de5a25f4e9
Fix changeset publish (#6923) 2023-04-27 22:55:48 +08:00
Houston (Bot)
06c527330a
[ci] release (#6914)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-04-27 22:12:14 +08:00
Bjorn Lu
b89042553e
Fix tsconfig alias baseUrl handling for "." and ".." imports (#6920) 2023-04-27 18:30:17 +08:00
Bjorn Lu
465a1a5efe
Fix changeset version run (#6917) 2023-04-27 17:15:58 +08:00
Daniel
081b2402cf
esbuild respects vite.build.minify option (#6222)
* esbuild respects `vite.build.minify` option
* Docs update
---------
Co-authored-by: AirBorne04 <>
Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
2023-04-27 10:11:05 +02:00
Phil Nash
4ea716e569
Adds extra elements to RSS items. (#6707) 2023-04-26 13:58:53 +01:00
Houston (Bot)
c6f1264586
[ci] release (#6863)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-04-25 22:48:36 +08:00
Bjorn Lu
edabf01b44
Upgrade to Vite 4.3 (#6877) 2023-04-25 22:04:45 +08:00
Bjorn Lu
0afff32741
Disable Vite optimizer for sync and config loading (#6902) 2023-04-25 20:54:41 +08:00
Bjorn Lu
b6154d2d57
Fix hoisted scripts path for linked package Astro components (#6872) 2023-04-21 10:42:23 +02:00
Nathaniel Blackburn
43230b2cac
Align adapter setup (#6874) 2023-04-19 09:36:46 +02:00
André Alves
4c7ba4da08
Fix Astro.params does not contain path parameter from URL with non-English characters (#6859) 2023-04-17 16:44:48 +02:00
jcdogo
1f2699461d
fix: astro island urls missing assetsPrefix in SSR mode (#6862)
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
2023-04-17 08:35:48 +02:00
Houston (Bot)
763b7500e5
[ci] release (#6842)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-04-14 12:11:17 -04:00
Bjorn Lu
2e3125e180
Fix vercel edge private env vars (#6841) 2023-04-14 21:46:24 +08:00
Chris Swithinbank
00a2e1d7c7
Fix warning syntax in Vercel integration README (#6840) 2023-04-14 12:08:31 +02:00
Houston (Bot)
b105ccb9ca
[ci] release (#6835)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-04-13 14:41:56 -04:00
Bjorn Lu
8539eb1643
Support tsconfig aliases in CSS @import (#6816) 2023-04-13 22:11:21 +08:00
Erika
2511d58d58
feat(mdx): Add support for turning ![]() into <Image> (#6824) 2023-04-13 11:54:40 +02:00
Erika
948a6d7be0
fix(content): Remove unsupported file warning for images (#6825) 2023-04-13 11:54:26 +02:00
André Alves
3356023443
add validation for non-printable chars in CLI (#6682) 2023-04-12 15:30:09 -04:00
wulinsheng123
a9c22994e4
fix #6420 (#6544)
* fix #6420

* add test

* add test

* fix an error that parsed path

* fix path error when in Windows environment

* fix a path error

* update comment

---------

Co-authored-by: wuls <linsheng.wu@beantechs.com>
2023-04-12 14:26:53 -04:00
Houston (Bot)
b2254bd786
[ci] release (#6818)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-04-12 08:51:55 -04:00
Bjorn Lu
7653cf9e9f
Fix CSS chunking between multiple framework components (#6582)
* Fix CSS chunking between multiple framework components

* Better CSS dedupe handling

* Add more tests

* Update docs
2023-04-12 08:24:32 -04:00
Happydev
76dd53e3f6
Fix slot fallbacks unexpectedly showing up in some cases (#6819)
* test: add test fixture

* test: add test case

* test: revert unneeded changes in fixture

* fix

* chore: changeset
2023-04-12 08:23:14 -04:00
Erika
6c09ac03bf
Fix experimental.assets's Squoosh service not working on Netlify and Vercel SSR (#6765) 2023-04-12 10:45:35 +02:00
Ben Holmes
f882bc1636
Refactor content collection transforms (#6817)
* feat: json collection POC

* wip: add test json file

* refactor: rework content flag transforms

* refactor: simplify propagatedAsset check

* chore: remove JSON playground code

* chore: respect build sourcemap option

* deps: magic-string, source-map

* chore: formatting

* fix: add sourcemaps to MDX plugin

* chore: changeset

* deps: remove magic-string from mdx

* chore: remove unecessary MagicString
2023-04-11 13:44:39 -04:00
Houston (Bot)
b1d07bcf40
[ci] release (#6809)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-04-11 13:10:00 -04:00
Bjorn Lu
60c16db6ff
Fix check CLI fs load fallback behaviour (#6811) 2023-04-11 11:57:11 +08:00
amirhhashemi
c12ca5ece3
fix(error-overlay): force error overlay direction to be LTR (#6782) 2023-04-10 16:59:17 +02:00
Alper Doğan
99479e6b95
Optional Sizes prop on Picture component (#6773) 2023-04-10 14:09:02 +02:00
Houston (Bot)
a5601a3cd3
[ci] release (#6807)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-04-10 16:57:31 +08:00
André Alves
1e3873c04a
Fix no edge functions deployed to netlify (#6793) 2023-04-10 16:50:54 +08:00
Nathaniel Blackburn
84a4648884
Revert vercel env fix (#6776) 2023-04-10 16:40:29 +08:00
Houston (Bot)
d531239201
[ci] release (#6769)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-04-07 17:25:00 -04:00
Ben Holmes
7f74326b76
Fix: astro:server:setup middleware (#6781)
* Revert "Fix: stop executing `astro:server:setup` twice (#6693)"

This reverts commit c0b7864a41.

* fix: delay `astro:server:setup` to `configureServer`

* test: middleware from astro:server:setup

* chore: lock

* chore: changeset

* chore: remove minimal example change

* chore: revert minimal env change
2023-04-07 12:28:55 -04:00
Matthew Phillips
fa84f1a7d2
Support streaming inside of slots (#6775)
* Rename renderSlot to renderSlotToString for internal sync usage

* Support streaming inside of slots

* Fix lame lint warning

* Update compiler to fix test

* Up the wait

* Use compiler 1.3.1

* It should be exactly 3
2023-04-07 11:04:31 -04:00
Matthew Phillips
a98f6f418c
Prevent body head content injection in MDX when using layout (#6779) 2023-04-06 18:33:47 -04:00
Matthew Phillips
416ceb9730
Use Deno API to set Astro.clientAddress (#6651)
* Use Deno API to set Astro.clientAddress

* Add types
2023-04-06 15:40:50 -04:00
Ben Holmes
9e88e0f23c
Fix: remove slug() from defineCollection() (#6774)
* fix: remove `slug()` from `defineCollection()`

* chore: changeset
2023-04-06 14:25:14 -04:00
Nate Moore
45bff6fccb
feat(prerender): support quoted true / false values and 0 / 1 (#6772) 2023-04-06 11:36:28 -05:00
Erika
52d7a4a011
Update client types to match Vite (#6770)
* fix(types): Update client types to match Vite's

* chore: changeset
2023-04-06 15:13:13 +02:00
Xetera
72fed684a3
Exporting ImageFunction from astro:content (#6766) 2023-04-06 13:58:34 +02:00
Houston (Bot)
29e7b82b8d
[ci] release (#6720)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-04-05 13:38:45 -04:00
Bjorn Lu
7116c021a3
Upgrade to Vite 4.2 (#6759) 2023-04-06 00:03:58 +08:00
Erika
8b88e4cf15
Show the actual error when there was an error while generating types (#6762) 2023-04-05 17:12:35 +02:00
Erika
a1108e0371
Move image() to be passed as part of schema (#6703)
* feat(images): Move image() to schema so we can do relative images easily instead of clumsily

* chore: changeset

* fix: apply feedback

* test: add more tests

* fix: properly infer type if a function is used

* feat(iamge): Add errors when using the old methods

* chore: update to minor

* feat(image): Move function shape to be experimental.asets only

* Update packages/astro/src/content/template/virtual-mod.mjs

Co-authored-by: Ben Holmes <hey@bholmes.dev>

---------

Co-authored-by: Ben Holmes <hey@bholmes.dev>
2023-04-05 15:40:05 +02:00
Bjorn Lu
ff04307863
Add build.assetsPrefix option for CDN support (#6714)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-04-05 21:31:17 +08:00
Nathaniel Blackburn
26daba8d9f
@astrojs/vercel: Fix vercel analytics id not being provided (#6751)
* fix wrong environment variable being used

* added changeset
2023-04-05 09:23:40 -04:00
Bjorn Lu
489dd8d69c
Fix getViteConfig return type (#6753) 2023-04-05 09:06:00 -04:00
Augustine Kim
c7eb0d4310
Fix lit integration nested component rendering (#6752)
* Provide renderInfo to renderShadow

* Add test for rendering nested components

* Add changeset
2023-04-05 09:05:45 -04:00
Erika
4cc1bf61b8
fix(node): Fix malformed URLs crashing the server in certain cases (#6746) 2023-04-04 15:48:28 +02:00
André Alves
1ec1df1264
Fix #6618: sitemap urls generated without slash (#6658) 2023-04-04 21:13:49 +08:00
Erika
a1a4f45b51
fix(images): Simpler logic for collecting images in Markdown (#6744) 2023-04-04 10:21:13 +02:00
Erika
2f2e572e93
feat(image): Export more types and utilities for users to use (#6739) 2023-04-03 18:11:45 +02:00
Erika
4c347ab51e
fix(images): Return the proper content-type for the chosen format (#6741) 2023-04-03 18:11:32 +02:00
Ben Holmes
73fcc7627e
[Markdoc] Fix: Support render: null (#6723)
* fix: handle array of tree nodes

* test: render null in document node

* chore: lock

* refactor: consolidate render test logic

* chore: changeset
2023-04-03 11:27:51 -04:00
Matthew Phillips
d54cbe4134
Better errors for when response is already sent (#6719)
* Better errors for when response is already sent

* Changeset

* Casing

* Change to a 300x error
2023-03-31 15:27:14 -04:00
wulinsheng123
d59e511d16
supporting top of await (#6671)
* add fix

* fix

* revert verison

* fix fn is undefined g

* add e2e test

* fix unit test

* delete redundant code

* add changeset

---------

Co-authored-by: wuls <linsheng.wu@beantechs.com>
2023-03-31 13:42:03 -04:00
Houston (Bot)
07e8a1bab4
[ci] release (#6694)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-03-31 16:32:28 +02:00
Erika
c2d4ae1cbe
fix(check): Dynamically import check command (#6717) 2023-03-31 15:18:37 +02:00
Peter Timoshevsky
08e92f4f8e
Fix incorrect path in error overlay on Win (#6679) 2023-03-31 13:07:19 +02:00
Erika
46ecf46628
Remove unnecessary image-related .wasm files inside build output when possible (#6701)
* fix(image): Remove unnecessary .wasm files after build

* chore: changeset
2023-03-30 20:57:57 +02:00
Erika
c04ea0d43c
Fix InferGetStaticParamsType and InferGetStaticPropsType not working with sync getStaticPaths (#6711)
* fix(types): Fix InferGetStaticParamsType (and its props equivalent) not working when getStaticPaths wasn't async

* chore: changeset

* fix: use type imports
2023-03-30 11:41:36 +02:00
Erika
a0bdf4ce2f
Fix multiple images being generated for the same image (#6710)
* fix(images): Fix multiple calls to same image generating multiple images

* chore: changeset
2023-03-30 11:31:04 +02:00
Aivars Liepa
b1b9b1390f
[RSS] Fix: update RSSFeedItem type to comply with strictest tsconfig (#6614)
* fix RSSFeedItem type for `strictest` tsconfig

* add .changeset

---------

Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
2023-03-30 11:25:36 +02:00
Elliott Marquez
4b077318fb
Update lit-ssr dependency (#6681)
* update lit-ssr dependency

* delete unnecessary lit shim checks

* delete another unused lit shim feature

* fix sass build

* bump lit and polyfill versions to match ssr req

* shim HTMLElement in test

* remove lit global shim workarounds

* re-shim Astro's ce.define

* remove fix window test and shim HTML Element

* Update .changeset/gold-windows-fly.md

Co-authored-by: Augustine Kim <ajk830@gmail.com>

* fix window check test

* implement suggestoins

---------

Co-authored-by: Augustine Kim <ajk830@gmail.com>
2023-03-29 12:43:40 -04:00
Erika
f0b732d326
fix(images): Improve error handling around the new assets feature (#6649)
* fix(images): Improve error handling around the new assets feature

* fix: add missing error message

* fix(images): Fix schema preprocessing logic returning undefined when the file doesn't exist

* test: add tests

* chore: lockfile

* chore: changeset

* Apply suggestions from code review

Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>

* test: remove console.logs

* fix(images): properly join with path

* fix: attempt a fix

* test: remove console.log

* Apply suggestions from code review

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* fix: add undefined test for global for SSR

---------

Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-03-29 14:58:42 +02:00