* 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
* 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>
* 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
* 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>
* start of vercel split support
* Split Mode with the Vercel Adapter
* Write routes into the config.json
* Add a changeset
* Add docs
* Better changeset
* fix: move `node:` libs out of utils
* fix: node -> default
* chore: remove kleur from markdoc ex (why was this there??)
* chore: lock
* chore: changeset
* test: add fixture
* chore: remove unneeded files in fixture
* test: update test mdx filfe
* test: add test case
* mark component as mdx
* add error builder utility
* throw error when it comes from an MDX component
* chore: update lock file
* Add comment to refactor later
* apply review
* add missing comma
* 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>
* 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>
* 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>
* 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
* 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>
* 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
* 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>
* 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
* 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
* 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>
* 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
* 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
* 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>
* 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