Commit graph

290 commits

Author SHA1 Message Date
Yuji Sugiura
c4f6fdf372
Remove unused(and also vulnerable) libs from @astro/telemetry (#3898)
* Remove unused(and also vulnerable) libs from @astro/telemetry

* Add changeset
2022-07-12 09:07:21 -04:00
Nate Moore
93e1020b1e
Fix: reintroduce smoke tests across example projects (#3669)
* chore: update smoke tests

* chore: bump smoke tests to node@16

* chore: remove gitmodules

* chore(ci): prefer node@14

* wip: remove path from smoke clone step

* feat: run build:examples from test:smoke

* fix: remove no-frozen-lockfile

* fix: checkout monorepo last for pnpm setup

* wip: replace @astrojs/markdown/remark import from md

* fix: remove type defs from generated file

* fix: function order

* chore: remove ssr-utils export

* wip: remove windows from smoke test

* fix: instantiate slugger in snippet

* fix: exclude with-mdx from smoke (for now)

* fix: add quotes on filter flag for safety

* chore: changeset

* wip: try reintroducing windows smoke

* sad chore: remove client: directive from with-mdx

* Revert "wip: try reintroducing windows smoke"

This reverts commit 9529b1a45c.

Co-authored-by: Nate Moore <nate@astro.build>
Co-authored-by: bholmesdev <hey@bholmes.dev>
2022-07-11 22:51:17 -04:00
Matthew Phillips
5f4ecbad1b
Allow defining Astro components in Vite plugins (#3889)
* Allow defining Astro components in Vite plugins

* Adds a changeset

* Move non-main compilation into load

* Use the cachedCompilation in the markdown plugin

* Fix HMR test

* Simplify getNormalizedID

* Use a windows-friendly virtual module id for the test
2022-07-11 16:13:21 -04:00
Ben Holmes
faf3f3a8d1
Update with-nanostores example to match docs walkthrough (#3840)
* feat: replace with-nanostores with new example

* docs: update README with docs call-out

* chore: small formatting inconsistencies

* nit: standardize to spaces :'(

* nit: standardize to tabs!

* refactor: use html "hidden" property

* nit: beta.66 for sanity
2022-07-11 15:42:10 -04:00
Fred K. Bot
1554a37622
[ci] release (#3887)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-11 13:38:42 -05:00
Nate Moore
7c49096e86
Update compiler (#3892)
* chore: update @astrojs/compiler

* chore: add changeset

* chore: update test

Co-authored-by: Nate Moore <nate@astro.build>
2022-07-11 13:34:29 -05:00
Fred K. Bot
1785e568a0
[ci] release (#3850)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-08 20:54:39 -04:00
Erika
f9ed77bb0d
Add editor integrations to language integrations (#3864) 2022-07-08 17:47:01 -04:00
Tony Sullivan
89d76753a0
Adds a new <Picture> component to the image integration (#3866)
* moving all normalization logic out of the Image component

* refactor: only require loaders to provide the image src

* Adding a `<Picture />` component

* fixing types.ts imports

* refactor: moving getImage to it's own file

* updating component types to use astroHTML.JSX

* Revert "updating component types to use astroHTML.JSX"

This reverts commit 6e5f578da8.

* going back to letting loaders add extra HTML attributes

* Always use lazy loading and async decoding

* Cleaning up the Picture component

* Adding test coverage for <Picture>

* updating the README

* using JSX types for the Image and Picture elements

* chore: adding changeset

* Update packages/integrations/image/src/get-image.ts

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>

* allow users to override loading and async on the <img>

* renaming config to constants, exporting getPicture()

* found the right syntax to import astro-jsx

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2022-07-08 21:37:55 +00:00
Nate Moore
70b0246d4c
fix(#3843): move @babel/types to dependencies (#3863)
* fix(#3843): move @babel/types to dependencies

* chore: update lockfile

Co-authored-by: Nate Moore <nate@astro.build>
2022-07-08 14:49:06 -05:00
Nate Moore
bd11c01fa8
chore: bump Vite minimum version (#3861)
Co-authored-by: Nate Moore <nate@astro.build>
2022-07-08 11:11:02 -05:00
Matthew Phillips
c2c4e5c238
Better response.arrayBuffer() handling in Node (#3860)
* Better response.arrayBuffer() handling in Node

* Adds a changeset
2022-07-08 11:38:06 -04:00
Fred K. Bot
ed8161f3d9
[ci] update lockfile (#3858)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-07-08 10:06:52 -05:00
Fred K. Schott
2b7b626629
update lockfile (#3828) 2022-07-07 12:06:56 -07:00
Nate Moore
5afb807688
Fix slot attribute inside expressions (#3837)
* fix: use slots inside expressions

* test: add test for conditional named slots

* test: fix incorrect test fixture

* chore: update `@astrojs/compiler`

* chore: add test coverage for `switch`

Co-authored-by: Nate Moore <nate@astro.build>
2022-07-07 13:23:51 -05:00
Fred K. Schott
eedb32c797
detect package manager and improve types (#3847) 2022-07-07 11:12:31 -07:00
Nate Moore
0e01e0bb58
Upgrade to pnpm@7.4.1, remove patch-package (#3747)
* chore: upgrade to pnpm@7.4.0, remove `patch-package`

* chore: update contributing

* chore: pnpm@7.4.1

* chore: bump to pnpm@7.5.0

Co-authored-by: Nate Moore <nate@astro.build>
2022-07-07 12:52:53 -05:00
Fred K. Bot
568960f175
[ci] release (#3818)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-06 21:00:18 -04:00
Fred K. Bot
08d068496d
[ci] release (#3800)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-01 15:56:49 -05:00
Fred K. Bot
94143fcdba
[ci] release (#3789)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-01 17:43:26 +00:00
Fred K. Bot
deab65d7b3
[ci] update lockfile (#3786)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-07-01 08:50:18 -07:00
Tony Sullivan
e8593e7ead
Adds an @astrojs/image integration for optimizing images (#3694)
* initial commit

* WIP: starting to define interfaces for images and transformers

* WIP: basic sharp service to test out the API setup

* adding a few tests for sharp.toImageSrc

* Adding tests for sharp.parseImageSrc

* hooking up basic SSR support

* updating image services to return width/height

* simplifying config setup for v1

* hooking up basic SSR + SSG support (dev & build)

* refactor: a bit of code cleanup and commenting

* WIP: migrating local files to ESM + vite plugin

* WIP: starting to hook up user-provided loaderEntryPoints

* chore: update lock file

* chore: update merged lockfile

* refactor: code cleanup and type docs

* pulling over the README template for first-party integrations

* moving metadata out to the loader

* updating the test for the refactored import

* revert: remove unrelated webapi formatting

* revert: remove unrelated change

* fixing up the existing sharp tests

* fix: vite plugin wasn't dynamically loading the image service properly

* refactor: minor API renaming, removing last hard-coded use of sharp loader

* don't manipulate src for hosted image services

* Adding support for automatically calculating dimensions by aspect ratio, if needed

* a few bug fixes + renaming the aspect ratio search param to "ar"

* Adding ETag support, removing need for loaders to parse file metadata

* using the battle tested `etag` package

* Adding support for dynamically calculating partial sizes

* refactor: moving to the packages/integrations dir, Astro Labs TBD later

* refactor: renaming parse/serialize functions

* Adding tests for SSG image optimizations

* refactor: clean up outdated names related to ImageProps

* nit: reusing cached SSG filename

* chore: update pnpm lock file

* handling file URLs when resolving local image imports

* updating image file resolution to use file URLs

* increasing test timeout for image build tests

* fixing eslint error in sharp test

* adding slash for windows compat in src URLs

* chore: update lockfile after merge

* Adding README content

* adding a readme call to action for configuration options

* review: A few of the quick updates from the PR review

* hack: adds a one-off check to allow query params for the _image route

* Adds support for src={import("...")}, and named component exports

* adding SSR tests

* nit: adding a bit more comments

* limiting the query params in SSG dev to the images integration
2022-07-01 15:47:48 +00:00
Fred K. Bot
0f73ece26b
[ci] release (#3783)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-01 03:09:17 +00:00
Tony Sullivan
976e1f175a
Adding an option to disable HTTP streaming (#3777)
* Adding a flag to disable HTTP streaming

* refactor: adding support for SSG builds

* handling string responses in the server runtime, adding tests

* removing streaming CLI flag

* removing import.meta.env.STREAMING

* include Content-Length header when streaming is disabled

* Verifying content-length header in dev

* fix: default streaming to enabled in the base App server

* TEMP: disabling the production test to investigate the test-adapter

* re-enabling the test with an adapter option to disable streaming for the test

* fix: use the existing TextEncoder to get the body's byte length

* moving config to build.streaming, ignoring it in `dev`

* fixing dev test to expect response streaming

* chore: add changsets

* removing the new config option all together 🎉

* remove temp debug log

* Updating astro changeset now that streaming isn't a config option
2022-07-01 02:29:59 +00:00
Fred K. Bot
d07ad8a782
[ci] release (#3774)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-06-30 11:39:44 -07:00
Nate Moore
032ad1c047
MDX support (#3706)
* feat: first pass at MDX support

* fix: move built-in JSX renderer to come first

* chore: remove jsx example

* chore: update lockfile

* chore: cleanup example

* fix: missing deps

* refactor: move component render logic to `renderPage`

* chore: update HMR script

* chore: update MDX example

* refactor: prefer unshit

* refactor: remove TODO comment

* fix: remove duplicate identifier

* refactor: cleanup mdx entrypoint

* fix: better html handling

* fix: add tsconfig to mdx package

* chore: update lockfile

* fix: do not sort plugins unless mdx is enabled

* chore: update compiler

* fix(hmr): maybe render head for non-Astro pages

* fix: set initial pageExtensions

* refactor: cleanup addPageExtension

* refactor: remove addPageExtensions from types

* refactor: expose HookParameters type

* fix: only default to astro for MDX

* test: pick up jsx support in test fixtures

* refactor: simplify mdx entrypoint

* test: add basic MDX tests

* test(e2e): add mdx + framework tests

* chore: update lockfile

* test(e2e): fix preact mdx e2e test

* fix(mdx): disable .md support

* test(e2e): fix vue-component test missing mdx

* test(e2e): fix solid component needing import

* fix: allow `client:only="solid"` as an alias to `solid-js`

* chore: move to with-mdx example

* chore: update MDX readme

* chore: update example readme

* chore: bump astro version

* chore: update lockfile

* Update mod.d.ts

* feat: support `export const components` in MDX pages

* chore: update mdx example

* fix: update jsx-runtime with better slot support

* refactor: remove object style support

* chore: cleanup package exports

* chore: add todo comment

* refactor: improve isPage function, move to utils

* refactor: dry up manual HMR updates

* chore: add dev tests for MDX

* chore: prefer set to array

* chore: add changesets

* fix(hmr): flip public/private route

Co-authored-by: Nate Moore <nate@astro.build>
2022-06-30 13:09:09 -05:00
Fred K. Bot
d137169b7b
[ci] update lockfile (#3771)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-06-30 11:22:18 -05:00
Fred K. Bot
8cbe92b74b
[ci] release (#3772)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-06-30 08:08:09 -05:00
Fred K. Bot
38f2fd7723
[ci] release (#3759)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-06-29 17:11:48 -05:00
Fred K. Schott
4bc6c7ceaa
manual lockfile update (#3751)
* lockfile update

* update lockfile gen script

* Update index.ts
2022-06-29 14:54:40 -07:00
Chris Swithinbank
e3fdc9b403
Add preact/compat support to @astrojs/preact (#3712)
* Add preact/compat renderer (likely broken)

Based on the current Preact renderer and the old preact/compat implementation: f892aeb52f/packages/renderers/renderer-preact/compat/index.js

* Make sure name is consistent

* Switch to single integration with compat option

* fix: add module-resolver to alias react => preact/compat

* fix: preact/compat mode

* chore: remove client-compat entrypoint

* chore: add e2e test for preact/compat

* Try to fix frozen lock file error

* Add changeset

* Update README to new structure & document `compat`

* Fix changeset wording

* Fix README typo

* Tweak wording

Co-authored-by: Kevin Zuniga Cuellar <46791833+kevinzunigacuellar@users.noreply.github.com>

Co-authored-by: Nate Moore <nate@astro.build>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Co-authored-by: Kevin Zuniga Cuellar <46791833+kevinzunigacuellar@users.noreply.github.com>
2022-06-29 17:42:47 +02:00
Fred K. Bot
a59a27eb0c
[ci] release (#3733)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-06-28 15:11:59 +00:00
Fred K. Bot
768c8ed21d
[ci] update lockfile (#3740)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-06-28 08:33:13 -05:00
Tony Sullivan
79fe09fa30
Adds a prefetch integration for near-instant page navigations (#3725)
* Adds a basic @astrojs/prefetch integration

* adding tests for custom selectors

* missed in last commit

* Adding a few docs, removing the option for `selectors` to be an element array

* adding an option for the concurrency limit

* fixing test for updated integration options

* Update packages/labs/prefetch/src/client.ts

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>

* nit: removing the NodeJS.Timer type to allow typescript to infer the return

* updating docs for default selector with ~=

* Skip prefetching on 2G connections, or when data saver is enabled

* refactor: moving to packages/integrations, Astro Labs TBD down the road

* README typo fix

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2022-06-27 18:26:21 +00:00
Fred K. Schott
9d78162fd9
Prettier update with caching speedup (#3710)
* update lockfile on fresh install

* update prettier
2022-06-27 11:24:22 -07:00
github-actions[bot]
0ae1365533
[ci] release (#3726)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-06-27 10:40:35 -04:00
Fred K. Schott
c3d41d1f60
update lockfile on fresh install (#3709) 2022-06-25 10:24:59 -07:00
github-actions[bot]
701a3bd698
[ci] release (#3707)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-06-24 17:02:11 -04:00
Matthew Phillips
b5e3403fa1
Simplified Response#text() implementation (#3705)
* Simplified Response#text() implementation

* Adds a changeset

* Fix tsignore
2022-06-24 16:58:14 -04:00
Matthew Phillips
b11e3b38eb
Ensure import.meta.env.SSR is true in SSR mode (#3702)
* Ensure import.meta.env.SSR is true in SSR mode

* Define in the env plugin instead
2022-06-24 16:14:00 -04:00
Nate Moore
908c2638cb
Add *private* built-in JSX renderer (#3697)
* feat: add private `addPageExtensions` hook

* feat: experimental JSX support

* chore: remove experimental.jsx option from config

* chore: remove automatic astro JSX runtime detection

* fix: throw warning when client:* directive is used but no client entrypoint is found

* feat: add slot support to renderer

* chore: remove client entrypoint from jsx renderer

* test: add barebones JSX test

* test: add frameworks-in-jsx test

* feat: improve error message when no matching import is found

* feat: support slots

* fix: do not strip `astro-slot` when using JSX renderer

* fix: handle null values in isVNode

* fix: do not transform slots for elements

Co-authored-by: Nate Moore <nate@astro.build>
2022-06-24 15:11:17 -05:00
github-actions[bot]
67b5aa4ca4
[ci] release (#3701)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-06-24 16:05:02 -04:00
Matthew Phillips
47c81effa6
Make Astro.redirect use a 302 status code (#3700)
* Make Astro.redirect use a 302 status code

* Adds a changeset

* Add a package.json
2022-06-24 15:55:06 -04:00
Matthew Phillips
3daaf510ea
Streaming (#3696)
* Start of streaming

* New lockfile

* Base should be Uint8Arrays

* Remove the ability to throw from a component

* Add a warning when returning a Response from a non-page component

* Adds a changeset
2022-06-24 15:35:21 -04:00
github-actions[bot]
6a6047483b
[ci] release (#3692)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-06-24 12:55:36 -05:00
Matthew Phillips
fa7ed3f3a9
Remove post-rendering head injection (#3679)
* Remove post-rendering head injection

* Adds a changeset

* Use a layout component for vue
2022-06-23 15:37:55 -04:00
d-suke
446f8c4f13
Added test for dir parameter in astro:build:done. (#3649)
* Added test for dir in astro:build:done

* Added changeset

* Change pathname for Windows

* Change changeset generated file summary

* Eliminate testing of branches by os

* Eliminate OS dependence

* Change changeset generated file summary

* Using fileURLToPath

* Cross-platform fixes.

* Use posix for everything.

* Pass an empty string for relative from

* Use path.join for the correct value

* Update packages/astro/test/static-build-dir.test.js

* Update packages/astro/test/static-build-dir.test.js

* Update packages/astro/test/static-build-dir.test.js

* Remove trailing slash

* add toString

* fix syntax error

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2022-06-23 14:04:10 -05:00
Nate Moore
7373d61cdc
Enable named slots in renderers (#3652)
* feat: pass all slots to renderers

* refactor: pass `slots` as top-level props

* test: add named slot test for frameworks

* fix: nested hydration, slots that are not initially rendered

* test: add nested-recursive e2e test

* fix: render unmatched custom element children

* chore: update lockfile

* fix: unrendered slots for client:only

* fix(lit): ensure lit integration uses new slots API

* chore: add changeset

* chore: add changesets

* fix: lit slots

* feat: convert dash-case or snake_case slots to camelCase for JSX

* feat: remove tmpl special logic

* test: add slot components-in-markdown test

* refactor: prefer Object.entries.map() to for/of loop

Co-authored-by: Nate Moore <nate@astro.build>
2022-06-23 10:10:54 -05:00
github-actions[bot]
19cd962d0b
[ci] release (#3684)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-06-23 09:14:17 -04:00
Matthew Phillips
b36ecb717e
Include partytown scripts in SSR manifest (#3686)
* Include partytown scripts in SSR manifst

* Adds a changeset
2022-06-23 09:03:43 -04:00