* Use Vite's resolve to resolve paths for client:only
* Adding a changeset
* Add it to the markdown legacy plugin too
* Remove fully resolving
* Fully resolve in the analyzer
* don't do this twice
* remove dead code
* feat: provide HOST env variable at runtime
* doc: add change to documentation
* Update documentation according to suggestions
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
* fix: empty string is considered as undefined
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
* I cant catch an error in the loadRemoteImage function when the fetch function occurs error
* I cant catch an error in the loadRemoteImage function when the fetch function occurs error
* fix ssg file
Co-authored-by: wuls <linsheng.wu@beantechs.com>
Co-authored-by: Okiki Ojo <okikio.dev@gmail.com>
* Allow Code component to run in Vercel
* Adding a changeset
* Pass theme through to `codeToHtml`
* Use script to generate languages
* another bundling approach
* fix lint warnings
* Use Vite to load non JS astro configs
* Adding a changeset
* Allow config to not exist
* Use a file url
* Use proload as a fallback
* add missing peerdep
* fix lint mistakes
* Refactor the vite-load
* First check if the file exists
* Pass through fs
* Update packages/astro/src/core/config/vite-load.ts
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
* Also load astro.config.cjs
* Do search before trying to load
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
* Revert "Revert "Allow image-pool to be used as its own Worker (#5317)" (#5360)"
This reverts commit 20e60c6e08.
* Remove special image-pool.js moving around
* Merge in assetIncludes
* changeset
* Copy to chunk folder in SSR too
* Update tidy-shoes-yawn.md
* Use base rather than site to create subpath for links/scripts
* Adding a changeset
* Warn when the site has a pathname but not using base
* fix asset test
* fix asset inlining behavior
* Properly support trailingSlash: never with a base
* adding a changeset
* Pass through the base
* only mess with pathname when trailingSlash === 'never'
* maybe fixes stuff
* Update based on review notes
* Revert "Allow image-pool to be used as its own Worker (#5317)"
This reverts commit d701ae074a.
* Adding a changeset
* Remove diff
* Remove unused code
* chore: upgrade @astrojs/compiler
* fix: update test to match new compiler behavior
* test: verify that all styles are bundled
Co-authored-by: Nate Moore <nate@astro.build>
* Handle `base` in adapters
* Use removeBase in the test adapter
* Update packages/integrations/node/src/preview.ts
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
* Update packages/integrations/cloudflare/src/server.advanced.ts
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
* Include the subpath for links
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
* Surface configuration errors to the client
* Actually start the container on restart
* Add beforeRestart to clear the console
* Some minor changes, restarted() returns an Error maybe
* Refactor testing code
* Adding a changeset
* Graceful error recovery in the dev server
Move dev-container to dev
Update for the lockfile
Invalidate modules in an error state
Test invalidation of broken modules
Remove unused error state
Normalize for windows
try a larger timeout
Fixes build
just for testing
more testing
Keep it posix
fully posix
* Fix up Windows path for testing
* some debugging
* use posix join
* finally fixed
* Remove leftover debugging
* Reset the timeout
* Adding a changeset
* test: add tests
* test: add test case
* test: update test
* fix: add new extensions to regex used to removed
* chore: add changeset
* test: update test
* Refactor error handling
* Fix import path in test
* Revert "Fix import path in test"
This reverts commit 5ca34f3c09.
* Fix import path in test
* Fix AggregateErrors actually not being.. an aggregration of errors
* Fix missing info in Vite enhanced error
* Conserve original error name if we have one
* Workaround compiler issue
* GitHub action please
* Update E2E test
* Wrap ssrFixStacktrace in try/catch
* Refactor Vite/Node methods out of the general index.ts
* Fix missing import
* Add changeset
* enable access to cloudflare runtime
* added get runtime api
added context to the runtime in "advanced" mode
* added typings and adjusted some return vars
* added default types
* added usage description to changeset and readme
Co-authored-by: AirBorne04 <unknown>
Co-authored-by: AirBorne04 <>
* fix: also pass attrs to underlying img
`class` for direct img styling, `width` & `height` to prevent layout shift, etc need to be passed to the underlying img tag to work.
* remove redundant attr from picture tag
* revert to previous commit
- seemed to break some tests
- can't deal with fixing that right now, maybe later
* only passing attributes to the img
* adding a note to the README
* chore: add changeset
Co-authored-by: Tony Sullivan <tony.f.sullivan@outlook.com>
* test1
* fixed test
* removed console.log
* changeset
* pnpm-lock
* fixed test again
* fta
* fta2
* fix: wait for fetch
* -fixed test template
* empty
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Co-authored-by: Nate Moore <nate@astro.build>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Co-authored-by: My Name <my.name@my-company.com>
* adding cookies to the an api route response, also when returning a simple result
* in dev server, convert a simple endpoint result into a response object
Co-authored-by: AirBorne04 <unknown>
Co-authored-by: AirBorne04 <>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
* Add new fields to API route context
* Add props and redirect
* Pass custom redirect status code
* Correctly pass props in api routes
* Add better docs
* Add test
* Fix build
* Add constants file
* Add links to jsdoc
* Workaround lint issue
* Thanks Chris
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
* Missed one doc change
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
* Add more detail to the changesets
* Strict redirect status type
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
* Added support for updating tsconfig.json when using astro add
* Refactor
* Remove unneeded change
* Fix build failling due to type difference
* Extend changeset description
* First run
* Works with tailwind!
* Added TSConfig to watchlist
* Changeset
* Fix eslint
* Renamed `isConfigReload` --> `isRestart` and `injectWatchTarget` --> `addWatchFile`
* Refactored watchTargets to watchFiles
* Refactor createSettings
* addWatchFile now accepts URL
* Fix getViteConfig
* Expanded description of the change
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
* Check that removal of url.hash breaks no tests
* test if status-quo is as expected
* Adapt tests to fail
* Adapt the shouldPreload function to skip same path
* Add changeset
* remove query params from file extension
* Revert changes to make change as small as possible
* moving the removeQueryParam check to basename()
* chore: adding a changeset
* adding SSR test coverage for new picture test cases
Co-authored-by: Tony Sullivan <tony.f.sullivan@outlook.com>
* adjusting cloudflare adapter (respecting user config)
define better solid ssr config
* only inline the framework
this needs to happen for worker build in order to have the correct build mode for the framework, which needs the nodejs no matter if it is for node or the browser.
Co-authored-by: AirBorne04 <daniel@floatingpixels.com>
* Yield out potentional slot instructions when rendering dynamic tags
* Adding a changeset
* yield instead of return
* Handle the fact that renderComponent returns an iterable
* Only yield out html once
* fix(astro): tag jsx vnodes with renderer so errors are properly handled
* chore: fix missing package in test
Co-authored-by: Nate Moore <nate@astro.build>
* Move module declarations for Markdown and MDX to the proper file so they're globally available
* Remove tsconfig.json depending on client.d.ts unnecessarily
* Fix CSS ordering between imported and Astro styles
* Fix linting errors
* Add changeset and upgrade compiler version
* Update test to reflect shared styles placed before page styles
* Update endpoint.ts
* add warning for post routes called when output is not server
* Update famous-camels-study.md
* Update endpoint.ts
* If not get
* Resolve changes
* Update Picture.astro
the image variable of getPicture contains a width and height property, which we usually require. In this case, the image is wrapped in a picture tag and the img tag itself should not have a width and height property as this will break the responsiveness of the image provided by the picture tag.
* added changeset
* fixing SSG picture tests that were expecting img dimensions
Co-authored-by: Tony Sullivan <tony.f.sullivan@outlook.com>
* WIP: adding a service built on @squoosh/lib
* WIP: investigating memory leaks in Squoosh
* WIP: vendoring Squoosh to work with our build
* chore: a bit of cleanup and a small perf gain
* removing a few unused deps
* fix: removing temp .only() in sharp test
* hooking up the last build steps to copy over .wasm files
* removing the duplicated lib/*.wasm files
* defaulting to Sharp for the initial @next release
* make sure pnpm always runs the postbuild script
* removing a few node dependencies
* refactor: move the copy .wasm build step out of the SSR bundle
* linter fixes
* fixing lock file
* chore: add TEMP changeset
* fix built wasm location for SSG builds
* Revert "defaulting to Sharp for the initial @next release"
This reverts commit 1a8d4f7f60.
* removing sharp dependency
* Revert "fix built wasm location for SSG builds"
This reverts commit 446b80bb53.
* chore: update lockfile
* fixing up image tests for the wasm loader
* updating the README for squoosh
* parallel wasm builds
* refactor: a bit of house keeping
* perf: allow a thread for each output encoding format
* fix: dev broke with the shift to wasm workers
* adds a new `astro:build:generated` hook for SSG builds
* fix: typo + calling cleanup methods in wasm codecs
* adding @astrojs/webapi for the TransformStream polyfill
* Revert "adding @astrojs/webapi for the TransformStream polyfill"
This reverts commit 39e5b845a5.
* perf: using sharp for most of the CI tests
* chore: update lockfile
* removing hard-coded squoosh imports
* fix: adding sharp to rollup externals
* test: using dev for the squoosh tests
* fix: updating the build output dir for wasm filles in SSG builds
* updating the changeset with migration details
* Revert "adds a new `astro:build:generated` hook for SSG builds"
This reverts commit 59b5fec7be.
* nit: adding comments for the wasm file copy
* chore: fix eslint warning
* Add HTTP Proxy Support to `fetch` Polyfill
Use `global-agent` to support HTTP_PROXY, HTTPS_PROXY, and NO_PROXY
environment variables.
* Add Changeset For HTTP Proxy Support in `fetch`
* `create-astro`: always create `tsconfig.json`
Currently, we only make sure `tsconfig.json` exists when `strict` or `strictest` is selected. Both `default` & `optout` are intended to correspond to `base` -- and will do so for all [23 official templates](https://github.com/withastro/astro/tree/main/examples), but not necessarily for third-party templates.
The [example command for installing a third-party template](https://github.com/withastro/astro/blob/a800bf7/packages/create-astro/README.md?plain=1#L31-L35) is (rather conveniently for the sake of this PR!) an example of a template without a `tsconfig.json` file, and installing it with the `default` ("Relaxed") Typescript option results in no `tsconfig.json` file, rather than a `tsconfig.json` file containing `{ "extends": "astro/tsconfigs/base" }` as would be expected.
This PR addresses this scenario.
It also explicitly sets the `tsconfig.json` file to `{ "extends": "astro/tsconfigs/base" }` when `default` (which I renamed to `base`, still presented to the user as "Relaxed") or `optout` is selected (`optout` has always printed a warning about the importance of `tsconfig.json` & `src/env.d.ts` but otherwise behaved identically to `default`). This is necessary in two scenarios:
1. When the `tsconfig.json` file was created by this script.
2. When it either didn't already include `"extends"`, or it extended a different config by default. For example, some third-party templates might default to `strict`, in which case I'm guessing we'd want to respect the user's choice and change that to `base`.
* update `del` 6.1.1 --> 7.0.0
* test: prevent excess writes
(without this it triggers many times)
* test: create-astro typescript prompt
* changeset
* fix: recursive `mkdirSync`
* test: longer timeout for `windows-latest` OS
(see if this fixes failing tests)
* better glob path creation, don't hardcode `/`
* test: longer timeout for windows-latest OS
(since I'm about to trigger another CI run by pushing a commit, might as well try this too)
* create-astro test: show last CLI output on timeout
* drop variable timeout
Typescript tests are slower than directory tests, but they are all usually less than 5000 ms. Less complexity, easier to maintain.
* DRY new error output
* Update lockfile
* Sync lockfile with main
* Update lockfile
Co-authored-by: Princesseuh <princssdev@gmail.com>
* docs: add MDXLayoutProps to README
* chore: changeset
* nit: remove "if you understand this diff"
* nit: AdD tYpE sAfEtY
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
* Update packages/integrations/mdx/README.md
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
* Revert "Update preact example to match @astrojs/preact ranges (#4840)"
This reverts commit d650a1161a.
* Revert "[ci] format"
This reverts commit e3c78c5b16.
* Revert "Support shared signals in Preact islands (#4763)"
This reverts commit 5e46be5468.
* Support signals in Preact islands
* Add a changeset
* Only add signals if we need them
* Refactor signal logic into its own module
* Keep track of the signals used
* Revert "Revert "Adds a new "astro:build:generated" hook for SSG builds (#4772)" (#4774)"
This reverts commit 13a4b0d488.
* fix: updating for latest merge with main
* supports Uint8Array/Uint16Array/Uint32Array
* update astro-island to supports the added types
* run changeset
* apply format
* pass metadata through
* using Array type
* write test cases for serializing Uint8Array/Uint16Array/Uint32Array
* fix the broken test cases
* add type assertion for psychological safety
* this changes is minor change
* feat: serialize UintArrays directly
* Update index.ts
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Co-authored-by: Nate Moore <nate@astro.build>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
* [chore] replaces hard-coded `minify` values with `vite.build.minify`
* [style] changes ternary to not-equals
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
* [chore] removes `minify` in favor of user config & Vite defaults
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
* Remove explicit `Transfer-Encoding: chunked`
This header is not necessary and is ignored by essentially all HTTP
servers when provided explicitly by the user. This is because the HTTP
transport layer handles adding this header automatically as needed.
Some variations of HTTP transport (like HTTP/2, which is enabled by
default in Deno, Netlify, and CFW) have no notion of
`Transfer-Encoding: chunked`, because all responses are streamed.
* add changeset
* Refactor to remove AstroConfig['_ctx']
* Fix type error
* Export validateConfig
* Move to an options bag for createSettings
* Move config tests into test/untils/config
* Add a changeste
* fix build
* Properly allow file uploads in the dev server
* Allow custom 404 route to handle API route missing methods
* Add a changeset
* what was i thinking
* Pass through the pathname
* Move the try/catch out and into handleRequest
* await the result of handleRoute
* Update peer dep
* Create leaders-of-the-free-world.md
Update: `@astrojs/tailwindcss` project with `tailwindcss` as a `peer-dependency`
* Removed tailwindcss as 'dependency'
* Update `pnpm-lock` with changes to deps
* Update .changeset/leaders-of-the-free-world.md
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
* fix: append forward slash to script paths for "C:/" prob
* chore: remove dead regex
* chore: changeset
* test: add client script test back to windows!
* test: add inline script test for sanity
* The actual fix
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
* Prevent locking up when encountering invalid CSS
* Add a changeset
* Move the unit test to the test folder
* ponyfill aggregateerror
* Use the exported type
* keep original errors
* fix
* fix: improve cyclic reference detection, now ignores references that are not parent/child
* fix: only track cyclic parents
Co-authored-by: Nate Moore <nate@astro.build>
* fix: use while instead of "for await" in react integration
* fix: cast HTML to string to fix other integrations
* docs: add comment on encode(String(html))
* chore: changeset
Co-authored-by: bholmesdev <hey@bholmes.dev>
* Added `background` option and prop.
This optional color specifies which background to use when removing the
alpha channel if the output format doesn't support transparency.
* Modified existing tests
* Fixed wrong dimensions in tests
* Fixing a few instances of jpeg vs jpg
* Added color checking
* working on the tests
* tests are now passing
* Adding tests
* Added tests for background color
* no need to test with subpath
* Added fixture
* Renamed test fixture for background-color
* skipping test until fixed
* Typo
* Working on tests
* tests are passing
* Updated readme and added changeset
* Updated lockfile
* Updated lockfile
* Updated lockfile
Co-authored-by: Tony Sullivan <tony.f.sullivan@outlook.com>
* feat(image): throw if no `alt` is provided
* chore: add changeset
* docs(image): update README
* updated alt text stuff throughout
* fixing with-mdx test suite
* warn for missing alt text, will throw an error in a future release
* final README tweaks
Co-authored-by: Tony Sullivan <tony.f.sullivan@outlook.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
* WIP: simplifying the use of `fs` vs. the vite plugin
* removing a few node deps (etag and node:path)
* adding ts defs for sharp
* using the same mime package as astro's core App
* fixing file URL support in windows
* using file URLs when loading local image metadata
* fixing a bug in the etag helper
* Windows compat
* splitting out dev & build tests
* why do these suites fail in parallel?
* one last windows compat case
* Adding tests for treating /public images the same as remote URLs
* a couple fixes for Astro's `base` config
* adding base path tests for SSR
* fixing a bad merge, lost the kleur dependency
* adding a test suite for images + MDX
* chore: add changeset
* simplifying the with-mdx tests
* bugfix: don't duplicate the period when using existing file extensions
* let Vite cache the image loader service
* adding some docs for using /public images
* fixing changeset
* Update packages/integrations/image/README.md
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
* Update packages/integrations/image/README.md
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
* nit: minor README syntax tweaks
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
* Add custom components to mdx integration guide
* Update packages/integrations/mdx/README.md
Co-authored-by: Ben Holmes <hey@bholmes.dev>
* Update packages/integrations/mdx/README.md
Co-authored-by: Ben Holmes <hey@bholmes.dev>
* Update packages/integrations/mdx/README.md
Co-authored-by: Ben Holmes <hey@bholmes.dev>
* Update packages/integrations/mdx/README.md
Co-authored-by: Ben Holmes <hey@bholmes.dev>
* Incorporate Sarah and Ben's Feedback
* Fix what would be an ugly background lol
* Sarah taking liberty of removing double text
* Add changeset
Co-authored-by: Ben Holmes <hey@bholmes.dev>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
* wip: try removing ssrLoadModule on styles
* chore: changeset
* fix: invalidate mod before crawling graph
* Revert "fix: invalidate mod before crawling graph"
This reverts commit 883710d21c.
* Revert "wip: try removing ssrLoadModule on styles"
This reverts commit 880e73d94a.
* SAD fix: try/catch on ssrLoadModule
* refactor: isFile -> isRootFile
* docs: update comments for new findings
* Update @astrojs/language-server to latest version
* Vendor importMeta.d.ts from Vite inside our repo to workaround TypeScript issue on Linux
* Remove unnecessary change
* Add changeset
* make remark-rehype config available in astro.config.mjs
* add test for remark-rehype config, checks that footnotes can be translated
* update lockfile to take the added test into account
* omit handlers and unkownHandler from the RemarkRehype type
* define RemarkRehype with proper references to the handler and handlers types
* formatting
* changeset
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
* Make Astro.url conform to build.format during the build
* Adding a changeset
* Better implementation
* fix some stuff that tests failed on
* Add docs
* Change to minor
* account for empty path
* Make astro package play nice with node16 module resolution
Projects using node16 module resolution in typescript uses the new
exports and imports configuration from typescript to find definition
files. This mirrors how nodejs resolves the files. If a package contains
an exports map in the package.json, typescript will ignore the "types"
field (not sure how it plays with typesVersions). This moves the typings
hirearchy of definition files into the same hierarchy that astro
produces output files in, so that typescript can discover them.
Fixes: #4172
* Add changeset
* Reorder export keys
* Update paths inside .d.ts files
Co-authored-by: Princesseuh <princssdev@gmail.com>
* feat: basic logging for long astro:build:done hooks
* feat: add long time msg to all build hooks
* feat: use logger for long time msg
* chore: changeset