0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00
Commit graph

8261 commits

Author SHA1 Message Date
Emanuele Stoppa
0ac090dca3 [ci] format 2024-05-09 09:53:06 +00:00
Emanuele Stoppa
814d7c1bd6
chore: move error in the correct section (#10980) 2024-05-09 10:52:15 +01:00
Bryce Russell
354536042e [ci] format 2024-05-09 08:17:30 +00:00
Bryce Russell
59571e8812
Fix error when accessing clientAddress on prerendered routes (#10977) 2024-05-09 16:16:29 +08:00
renovate[bot]
f9b6f4fc2f
chore(deps): update all non-major dependencies (#10958)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: bluwy <bjornlu.dev@gmail.com>
2024-05-09 15:20:13 +08:00
Emanuele Stoppa
e39ee5662d
fix: logic for printing warning (#10976) 2024-05-08 16:03:03 +01:00
Florian Lefebvre
562054e8e1 [ci] format 2024-05-08 14:51:02 +00:00
Florian Lefebvre
7179930ac8
feat(solid): add support for devtools (#10937)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2024-05-08 16:48:17 +02:00
Emanuele Stoppa
f0acd30a12
feat(vercel): skew protection (#10761)
* feat(vercel): skew protection

* feat(vercel): skew protection
2024-05-08 15:05:03 +01:00
Martin Trapp
a020d0028d [ci] format 2024-05-08 13:10:30 +00:00
Martin Trapp
35c0984230
proposal for better support for custom swap functions (#10908)
* proposal for custom swap function support

* correct 'Fix typos'

* Suggestion

* update tests to use new pattern

* test order of chaining

* tidy up

* renaming 'swapper: CustomSwapper' to 'swapSteps: SwapSteps'

* after first review

* fix linter error

* updated test to not use swap-steps

* removed another swapSteps reference

---------

Co-authored-by: Luiz Ferraz <luiz@lferraz.com>
2024-05-08 15:08:55 +02:00
Emanuele Stoppa
8422600921
fix: error message grammar (#10973) 2024-05-08 13:38:34 +01:00
Matthew Phillips
8ef2f62c53 [ci] format 2024-05-08 12:29:08 +00:00
Matthew Phillips
a1343184da
Convert saved non-UTC dates to UTC (#10967)
* Convert saved non-UTC dates to UTC

* Simplify the check

* Simplify check and add link
2024-05-08 08:27:55 -04:00
Eduardo Pereira
fa240ff2f2
Fix markdown of markdown-style-guide.md in the blog example (#10962) 2024-05-08 20:03:25 +08:00
Ben Holmes
87066c648a [ci] format 2024-05-08 11:54:14 +00:00
Ben Holmes
c0c509b6bf
Actions experimental release (#10858)
* feat: port astro-actions poc

* feat: basic blog example

* feat: basic validationError class

* feat: standard error types and safe() wrapper

* refactor: move enhanceProps to astro:actions

* fix: throw internal server errors

* chore: refine enhance: true error message

* fix: remove FormData fallback from route

* refactor: clarify what enhance: true allows

* feat: progressively enhanced comments

* chore: changeset

* refactor: enhance -> acceptFormData

* wip: migrate actions to core

* feat: working actions demo from astro core!

* chore: changeset

* chore: delete old changeset

* fix: Function type lint

* refactor: expose defineAction from `astro:actions`

* fix: add null check to experimental

* fix: export `types/actions.d.ts`

* feat: more robust form data parsing

* feat: support formData from rpc call

* feat: remove acceptFormData flag requirement

* feat: add actions.d.ts type reference on startup

* refactor: actionNameProps -> getNameProps

* fix: actions type import

* chore: expose zod from `astro:actions`

* fix: zod export path

* feat: add explicit `accept` property

* Use zod package instead of relative path outside of src

* feat: clean up error throwing and handling flow

* fix: make `accept` optional

* docs: beef up actions experimental docs

* fix: defineAction type narrowing on `accept`

* fix: bad `getNameProps()` arg type

* refactor: move to single `error` object + `isInputError()` util

* fix: move res.json() parse to avoid double parse

* feat: support async zod schemas

* feat: serialize and expose zod properties on input error

* feat: test input error in comment example

* fix: remove ZodError import

* fix: add actions-module to files export

* fix: use workspace for test pkg versions

* refactor: default export -> server export

* fix: type inference for json vs. form

* refactor: accept form -> defineFormAction

* refactor: better callSafely signature

* feat: block action calls from the server with RFC link

* feat: move getActionResult to global

* refactor: getNameProps -> getActionProps

* refactor: body.toString()

* edit: capitAl

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

* edit: highlight `actions`

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

* edit: add actions file name

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

* edit: not you can. You DO

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

* edit: declare with feeling

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

* edit: clarify what the `handler` does

* edit: schema -> input

* edit: add FormData mdn reference

* edit: add defineFormAction() explainer

* refactor: inline getDotAstroTypeRefs

* edit: yeah yeah maybe

* fix: existsSync test mock

* refactor: use callSafely in middleware

* test: upgradeFormData()

* chore: stray console log

* refactor: extract helper functions

* fix: include status in error response

* fix: return `undefined` when there's no action result

* fix: content-type

* test: e2e like button action

* test: comment e2e

* fix: existsSync mock for other sync test

* test: action dev server raw fetch

* test: build preview

* chore: fix lock

* fix: add dotAstroDir to existsSync

* chore: slim down e2e fixture

* chore: remove unneeded disabled test

* refactor: better api context error

* fix: return `false` for envDts

* refactor: defineFormAction -> defineAction with accept

* fix: check FormData on getActionProps

* edit: uppercase

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

* fix: add switch default for 500

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

* fix: add `toLowerCase()` on content-type check

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

* chore: use VIRTUAL_MODULE_ID for plugin

* fix: remove incorrect ts-ignore

* chore: remove unneeded POST method check

* refactor: route callSafely

* refactor: error switch case to map

* chore: add link to trpc error code table

* fix: add readable error on failed json.stringify

* refactor: add param -> callerParam with comment

* feat: always return safe from getActionResult()

* refactor: move actions module to templates/

* refactor: remove unneeded existsSync on dotAstro

* fix: hasContentType util for toLowerCase()

* chore: comment on 415 code

* refactor: upgradeFormData -> formDataToObj

* fix: avoid leaking stack in production

* refactor: defineProperty with write false

* fix: revert package.json back to spaces

* edit: use config docs for changeset

* refactor: stringifiedActionsPath -> stringifiedActionsImport

* fix: avoid double-handling for route

* fix: support zero arg actions

* refactor: move actionHandler to helper fn

* fix: restore mdast deps

* docs: add `output` to config

---------

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Co-authored-by: bholmesdev <bholmesdev@gmail.com>
2024-05-08 07:53:17 -04:00
Goulven CLEC'H
6382d7d238 [ci] format 2024-05-08 10:34:18 +00:00
Goulven CLEC'H
698c2d9bb5
fix(page-data): add key to allPages (#10625)
* fix(page-data): add key to allPages

* add fryuni's test

* replaced object.entries(allpages)

* tmp: change pagesByComponents by pagesByKeys

* fix pagesByKeys.get() in plugin-ssr & plugin-manifest

* remove logs

* remove useless generators

* another useless generator

* use null byte in key

* tmp function in pipeline.ts

* refactor getVirtualModulePageName

* refactor getPageKeyFromVirtualModulePageName

* clean & comments

* better key and fix build

* utils: add makePageDataKey

* fix(pipeline): retrieveRoutesToGenerate for ssr

* internals: getPageData function

* tmp(ssr-split-manifest): fix test ?

* fix?: ssr clean static output

* internals: getPageDatasWithPublicKey

* internals: getPageDatasByHoistedScriptId & getPagesDatasByComponent

* remove broken & useless virtualModuleNameFromResolvedId

* chore: changeset

* fix: sanitize slashes in filepaths

* Revert "fix: sanitize slashes in filepaths"

This reverts commit 5c3a75fac8.

* fix?: remove route from virtual module name

* fix: concat & array.from

* update changeset

* clean unnecessary change

* remove unnecessary pageInfo

* add return types to utils functions

* revert a comment deletion

* fix cleanStaticOutput

* changes from ematipico review

* moving a todo outside jsdoc (cc @ematipico )

* Update .changeset/great-turtles-greet.md

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

* Update .changeset/great-turtles-greet.md

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

* chore: fix merge conflicts

* fix: incorrect function

* remove logs

* revert: codepoint change

---------

Co-authored-by: Princesseuh <3019731+Princesseuh@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
2024-05-08 11:33:19 +01:00
Chris Swithinbank
61f47a6842
Support passing inline Astro config to getViteConfig() (#10963)
* Support passing inline Astro config to `getViteConfig()`

* Add changeset
2024-05-08 11:19:54 +01:00
Emanuele Stoppa
4436398642 [ci] format 2024-05-08 09:27:28 +00:00
Emanuele Stoppa
47877a7540
feat: rewriting (experimental) (#10867)
* feat: implement reroute in dev (#10818)

* chore: implement reroute in dev

* chore: revert naming change

* chore: conditionally create the new request

* chore: handle error

* remove only

* remove only

* chore: add tests and remove logs

* chore: fix regression

* chore: fix regression route matching

* chore: remove unwanted test

* feat: reroute in SSG (#10843)

* feat: rerouting in ssg

* linting

* feat: reroute for SSR (#10845)

* feat: implement reroute in dev (#10818)

* chore: implement reroute in dev

* chore: revert naming change

* chore: conditionally create the new request

* chore: handle error

* remove only

* remove only

* chore: add tests and remove logs

* chore: fix regression

* chore: fix regression route matching

* chore: remove unwanted test

* feat: reroute in SSG (#10843)

* feat: rerouting in ssg

* linting

* feat: rerouting in ssg

* linting

* feat: reroute for SSR

* fix rebase

* fix merge issue

* feat: rerouting in the middleware (#10853)

* feat: implement reroute in dev (#10818)

* chore: implement reroute in dev

* chore: revert naming change

* chore: conditionally create the new request

* chore: handle error

* remove only

* remove only

* chore: add tests and remove logs

* chore: fix regression

* chore: fix regression route matching

* chore: remove unwanted test

* feat: reroute in SSG (#10843)

* feat: rerouting in ssg

* linting

* feat: rerouting in ssg

* linting

* feat: reroute for SSR

* fix rebase

* fix merge issue

* feat: implement the `next(payload)` feature for rerouting

* chore: revert code

* chore: fix code

* Apply suggestions from code review

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

---------

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

* feat: rerouting

* chore: rename to `rewrite`

* chore: better error message

* chore: update the chageset

* Apply suggestions from code review

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

* chore: update docs based on feedback

* lock file

* Apply suggestions from code review

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by:  Matthew Phillips <matthew@skypack.dev>
Co-authored-by: Ben Holmes <hey@bholmes.dev>

* feedback

* rename

* add tests for 404

* revert change

* fix regression

* Update .changeset/pink-ligers-share.md

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

---------

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Co-authored-by: Ben Holmes <hey@bholmes.dev>
2024-05-08 10:26:31 +01:00
Erika
7bbd66459d
feat: Add new component to toolbar library (#10906)
* feat: progress

* chore: changeset
2024-05-08 10:26:00 +01:00
Bjorn Lu
ddd8e49d1a
MDX integration v3 (#10935)
* fix(mdx): convert remark-images-to-component plugin to a rehype plugin (#10697)

* Remove fs read for MDX transform (#10866)

* Tag MDX component for faster checks when rendering (#10864)

* Use unified plugin only for MDX transform (#10869)

* Only traverse children and handle mdxJsxTextElement when optimizing (#10885)

* Rename to `optimize.ignoreComponentNames` in MDX (#10884)

* Allow remark/rehype plugins added after mdx to work (#10877)

* Improve MDX optimize with sibling nodes (#10887)

* Improve types in rehype-optimize-static.ts

* Rename `ignoreComponentNames` to `ignoreElementNames`

I think this better reflects what it's actually doing

* Simplify plain MDX nodes in optimize option (#10934)

* Format code

* Minimize diff changes

* Update .changeset/slimy-cobras-end.md

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

---------

Co-authored-by: Armand Philippot <59021693+ArmandPhilippot@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2024-05-08 10:25:27 +01:00
Bjorn Lu
685fc22bc6
Improve content collection styles and scripts build perf (#10959)
* Improve content collection styles and scripts build perf

* Update test

It was actually a bug. There was an empty module script injected.

* Skip test

* Fix test not matching non-ccc behaviour

* Workaround bug to make test pass

* Update .changeset/grumpy-pillows-develop.md

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

---------

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2024-05-08 10:24:47 +01:00
Matthew Phillips
cceeafb62a [ci] format 2024-05-07 17:13:57 +00:00
Matthew Phillips
d47baa466a
Support React 19 (#10942)
* Support React 19

* Fix lint

* Update .changeset/short-phones-breathe.md

* fix: update types peer dep

---------

Co-authored-by: bholmesdev <hey@bholmes.dev>
2024-05-07 13:13:03 -04:00
Chris Swithinbank
4b693c0476 [ci] format 2024-05-06 20:03:49 +00:00
Chris Swithinbank
e63e96bf32
Import metric table from astro:db (#10947) 2024-05-06 22:02:54 +02:00
Florian Lefebvre
23fb790f40 [ci] format 2024-05-06 15:36:13 +00:00
Florian Lefebvre
2978287f92
fix(astro): handle AstroUserError during sync and exports types (#10955)
Co-authored-by: Luiz Ferraz <luiz@lferraz.com>
2024-05-06 17:35:17 +02:00
Matthew Phillips
4efe519456 [ci] format 2024-05-06 15:28:05 +00:00
Matthew Phillips
4d905ccef6
Preserve content modules properly in cache (#10889)
* Wait until after build to preserve content modules

* Properly build hoisted scripts

* Add changeset

* Fix tests hitting each other

* Global state, the shame

* Move the file copying over to earlier in the process
2024-05-06 11:27:07 -04:00
Florian Lefebvre
082abb82d5
feat(vue): add support for devtools (#10929)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2024-05-06 16:02:06 +02:00
Martin Trapp
11c58a9c5a
Adds missing readonly (#10956) 2024-05-06 15:55:37 +02:00
Florian Lefebvre
fd508a0fbb
feat(preact): add support for devtools (#10938)
* feat(preact): add support for devtools

* Update little-dryers-stare.md
2024-05-03 15:21:37 -04:00
Jakob Hellermann
3412535be4
fix: don't include port twice from x-forwarded-host and x-forwarded-port headers (#10917)
* fix: don't include port twice from x-forwarded-host and x-forwarded-port headers

* add changeset

* add test for port both in forwarded host and forwarded port

* don't include port if undefined

* Update .changeset/forty-wolves-turn.md

Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>

---------

Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
2024-05-03 15:01:25 -04:00
Houston (Bot)
2dcbcdb857
[ci] release (#10943)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-03 17:55:43 +02:00
Chris Swithinbank
6c603bcc97 [ci] format 2024-05-03 15:41:58 +00:00
Chris Swithinbank
a37d76a42a
Add web-vitals integration (#10883) 2024-05-03 17:40:53 +02:00
Ben Holmes
befbda7fa3 [ci] format 2024-05-03 15:09:39 +00:00
Ben Holmes
44bafa989a
[db] Fix duplicate calls to recreate tables on startup (#10919)
* fix: move recreateTables() to integration hooks

* feat: recreate and seed at load, not in virtual runtime

* feat: eager build db on startup and seed file change

* fix: respect database_file in dbUrl

* chore: remove duplicate recreateTables call

* chore: remove now self-explanatory comments

* fix: remove invalidateModule call for eager loading

* feat: respect seed package paths

* fix: remove duplicate recreateTables() call

* refactor: move recreateTables() to vite-plugin-db

* refactor: move queries.ts from runtime/ to core/

* fix: update test import to core/queries

* refactor: move executeSeedFile to vite-plugin-db

* refactor: extract seeding and recreating to helper fns

* chore: changeset

* chore: revert connectToStudio refactor

* wip: log db url

* fix(test): normalize astro_database_file flag for windows

* Revert "wip: log db url"

This reverts commit 558e2de67a09a611377929b625127c649b8504d6.

* Revert "Revert "wip: log db url""

This reverts commit ffd004e00dff485b7bc5ddde0278dde6ff058b9e.

* fix: correctly resolve relative paths with unit test

* chore: remove unused dbDirPath

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

* chore: remove unused import

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

* chore: remove unused type

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

* fix: remove bad import

* [db] Load seed files with vite dev server (#10941)

* feat: load seed files with full vite dev server

* chore: remove unused export

---------

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
2024-05-03 11:08:50 -04:00
Houston (Bot)
9a231a4dd7
[ci] release (#10890)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-02 19:59:20 +08:00
Erika
007d17fee0
Fixes toggleState (#10933) 2024-05-02 10:31:19 +02:00
ktym4a
4ce5ced44d
change: NotificationPayload type (#10931)
* change: NotificationPayload type

* Create silent-zoos-work.md

---------

Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
2024-05-02 08:58:40 +02:00
Bjorn Lu
5248ed1fb3
Delete unused changeset (#10927) 2024-05-01 23:06:00 +08:00
Erika
77e206d7e5 [ci] format 2024-05-01 12:04:47 +00:00
Erika
a0c77fc716
chore: changeset (#10925) 2024-05-01 08:03:55 -04:00
Ikko Eltociear Ashimine
dd1d937621
fix: typo in build.js (#10915) 2024-05-01 14:14:36 +08:00
Yugo Ogura
85f407efae
docs: fix typo in CONTRIBUTING.md (#10910) 2024-05-01 14:08:53 +08:00