Commit graph

1482 commits

Author SHA1 Message Date
Matthew Phillips
8f9791d840
Upgrade Astro compiler to 0.26.0 (#4990)
* Upgrade Astro compiler

* Add changeset
2022-10-05 16:29:30 -04:00
Bjorn Lu
a6bb2694b4
Refactor hydration path handling (#4918)
* Refactor hydration path handling

* Remove old code

* Fix jsx strip

* Postprocess fix

* Handle jsx to tsx stuff

* Skip bigint tests

* Fix deno

* Try fix windows

* Fix windows

* Add more comments
2022-10-04 12:59:35 -04:00
董雨航
61d26f3352
fix: import.meta.env.BASE_URL will be '/' in client loaded component on dev mode (#4886) 2022-10-04 12:57:35 -04:00
Calvin Liang
37cb2fc02a
fix object styles not escaped (#4887)
* fix object styles not escaped

* fix `shouldEscape` not passed down

* add tests

* fix package name

* fix pnpm-lock

* add changeset
2022-10-04 12:56:11 -04:00
Tony Sullivan
4f73b98ae0
closes #4633 (#4977)
* closes #4633

* chore: add changeset
2022-10-04 16:16:47 +00:00
Bjorn Lu
c733d4fb81
Support Astro.slots.render for mdx (#4973)
* Support Astro.slots.render for mdx

* Remove extra imports
2022-10-04 10:18:34 -04:00
Fred K. Bot
5d58787f7a
[ci] release (#4968)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-03 18:48:40 -04:00
Matthew Phillips
e6a881081f
Fix regression in rendering strings (#4967) 2022-10-03 18:21:34 -04:00
Fred K. Bot
bb022f5230
[ci] release (#4957)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-03 11:52:23 -04:00
Matthew Phillips
ee8dd424fd
Improve rendering perf (#4956)
* Improve rendering perf

* Adding a changeset

* Disable eslint warning
2022-10-03 11:44:58 -04:00
Bjorn Lu
a59731995b
Suppress eslint warnings (#4953) 2022-10-03 23:37:21 +08:00
Bjorn Lu
5bcd76e3ab
Refactor ViteConfigWithSSR type (#4952) 2022-10-03 22:54:34 +08:00
Fred K. Bot
16688162b4
[ci] release (#4945)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-01 08:11:59 -04:00
Scott Willsey
a8f1a91e7e
Astro image cache dependency fix scottaw66 (#4944)
* Moves http-cache-semantics from dev dependency to dependency

* Pull request for astro image http-cache-semantics dependency
2022-09-30 22:25:37 -05:00
Fred K. Bot
5565782d70
[ci] release (#4943)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-30 19:51:17 -04:00
Matthew Phillips
9898088c0a
Convert HTMLString to regular string, preventing hydration script fro… (#4932)
* Convert HTMLString to regular string, preventing hydration script from being missing

* Add a changeset
2022-09-30 18:25:22 -05:00
Nate Moore
cf2bba1e4a
P5: fix MDX memory leak (#4939)
* 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>
2022-09-30 17:13:44 -05:00
Fred K. Bot
2ffdafff45
[ci] release (#4921)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-30 20:15:38 +00:00
Tony Sullivan
64a1d712ef
[@astrojs/image] fixes a bug in dev when <Image /> is used with no transformation props (#4933)
* fix: return the original file in dev if no image transforms were used

* chore: add changeset
2022-09-30 17:27:56 +00:00
Tony Sullivan
b5e25afa94
Update seven-shrimps-hope.md (#4934)
Upgrading the image caching feature as a minor release
2022-09-30 16:38:21 +00:00
Erika
7690849a87
Move module declarations for Markdown and MDX so they're available everywhere (#4928)
* 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
2022-09-30 12:06:14 -03:00
Tony Sullivan
9892989619
[@astrojs/image] adding caching support for SSG builds (#4909)
* adds a caching feature for SSG builds

* chore: add changeset

* nit: eslint fix

* chore: add readme docs for caching

* adding basic test coverage for cached images
2022-09-29 21:20:48 +00:00
Fred K. Bot
d08093f7d4
[ci] release (#4903)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-29 11:20:00 -04:00
Bjorn Lu
fd9d323a68
Support Vue JSX (#4897)
Co-authored-by: Dan Jutan <danjutan@gmail.com>
2022-09-29 11:25:45 +08:00
Matthew Phillips
01c1aaa003
Fix CSS ordering between imported and Astro styles (#4907)
* 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
2022-09-28 18:12:22 -04:00
Matthew Phillips
d3091f89e9
Astro.cookies implementation (#4876)
* Astro.cookies implementation

* Remove unused var

* Fix build

* Add a changesetp

* Remove spoken-word expires
2022-09-28 16:55:27 -04:00
Tony Sullivan
ec55745ae5
Fix: let Squoosh default image quality internally (#4906)
* removes our quality defaults, allowing Squoosh format-specific defaults to be used

* chore: add changeset
2022-09-28 20:55:09 +00:00
Bjorn Lu
812658ad2a
Remove shamefully-hoist (#4842) 2022-09-28 23:13:33 +08:00
Matthew Phillips
87a7cf48e7
Hoist hydration script out of slot templates (#4891)
* Hoist hydration script out of slot templates

* Add changeset

* Fix HTML components

* Mark as html string
2022-09-28 10:55:14 -04:00
Matthew Phillips
ff7ba0ee0f
Ensure head content rendered once with lazy layouts (#4892)
* Ensure head content rendered once with lazy layouts

* Add changeset
2022-09-28 10:55:06 -04:00
Fred K. Bot
077134ae2c
[ci] release (#4846)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-27 12:12:44 -04:00
Rishi Raj Jain
90c2072990
fix: post API routes in SSG should warn or error during dev mode (#4878)
* 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
2022-09-27 10:17:58 -04:00
Bjorn Lu
fb91d04a5c
Set SSR target webworker for Vercel edge (#4884) 2022-09-27 08:40:10 -04:00
Ben Holmes
58a2dca228
Fix: correctly transform import.meta.env.* in MDX (#4858)
* fix: serialize route pattern for Netlify edge

Co-authored-by: Jackie Macharia <jackiewmacharia>

* fix: escape import.meta.env in MDX compiler output

* test: env vars in mdx

* chore: changeset

* deps: estree-util-visit, @types/estree

* feat: inject import.meta.env w/ recma

* feat: pull importMetaEnv from vite + astro configs

* test: `import.meta.env` in JSX

* fix: lockfile

* chore: update changeset

* fix: remove stray stashed commit
2022-09-26 18:23:47 -04:00
Rishi Raj Jain
42fe8e0c7f
fix: Script with innerHTML not working on Safari (#4861)
* fix: Script with innerHTML not working on Safari

* Update cool-camels-tease.md
2022-09-26 14:03:53 -04:00
Bjorn Lu
83ed1cc1f2
Prevent /undefined catch-all routes in dev (#4873) 2022-09-26 14:03:14 -04:00
Rishi Raj Jain
03e8b750ad
fix: 🐛 BUG: class:list directive adding class attribute when undefined (#4867)
* Update hydration.ts

* Create lucky-comics-bow.md
2022-09-26 12:53:07 -04:00
Rishi Raj Jain
b99f9902b7
fix: "chunks" directory appears in build output, if custom modules are imported in Astro files (#4868) 2022-09-26 18:01:44 +08:00
Matthew Phillips
49ca9e1291
Define toStringTag another way (#4855)
* Define toStringTag another way

* Adding a changeset
2022-09-23 13:27:07 -04:00
Rishi Raj Jain
edb7bead6e
fix: Can't overwrite vite's MODE environment variable (#4850)
* Add flags to the build options

* replace mode: 'production' as fallback

* Update mode support

* Add changeset
2022-09-23 08:08:57 -04:00
Rishi Raj Jain
ee5fdeffdd
fix: getFileInfo does not add .html extension in url when build.format is file (#4849)
* Create appendExtension

* Add html to file URLs if build.format is file

* Add changeset
2022-09-23 08:07:27 -04:00
Gerard de Brieder
944d24e9ee
Update Picture.astro so it no longer passes height and width attributes (#4797)
* 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>
2022-09-22 21:01:38 +00:00
Rishi Raj Jain
4b092269c1
Resolves #4825 (#4841)
* Resolves #4825

* Add changeset

* Update late-cups-jam.md

* Update late-cups-jam.md
2022-09-22 16:37:49 -04:00
Matthew Phillips
3389f0ce91
Prevent the root from being deleted during the build (#4845)
* Prevent the root from being deleted during the build

* Adding a changeset
2022-09-22 16:37:16 -04:00
Tony Sullivan
fad3867adb
Adding an optional image service based on Squoosh (#4738)
* 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
2022-09-22 19:48:14 +00:00
Bjorn Lu
6a1a17dd28
Add CSS @import test (#4454)
* Add css hmr test

* Allow HMR in e2e tests

* Add changeset

* Actually fix test

* Fix lint

* Skip windows for now
2022-09-22 15:06:49 -04:00
Zicklag
5e4c5252bd
Http proxy for fetch (#4676)
* 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`
2022-09-22 14:47:06 -04:00
Michael Rienstra
7481ffda02
create-astro: always create tsconfig.json (#4810)
* `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>
2022-09-22 14:37:01 -04:00
Ben Holmes
e5f71142eb
docs: add MDXLayoutProps to README (#4700)
* 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>
2022-09-22 14:35:37 -04:00
梁峰宁
17dbc67018
Fix slashes for paths containing non-ASCII characters on Windows. (#4712)
* Fix slashes for paths containing non-ASCII characters on Windows.

* Add non-ASCII path test

* Fix slashes in pnpm-lock.yaml
2022-09-22 14:33:28 -04:00