0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
Commit graph

30 commits

Author SHA1 Message Date
Emanuele Stoppa
a3df9d83ca
fix(core): don't noop shared modules (#9828)
* fix(core): don't noop shared modules

* address feedback

* add test

* changeset

* check astro pages

* address feedback

---------

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2024-01-26 17:17:32 +00:00
Marvin
a12196d6b5
feat(node): add trailingSlash support (#9080)
* feat(node): add trailing slash support

* add changeset

* test(node): add base route test in trailing-slash.js

detected an infinite loop in base path when trailingSlash: never

* fix(node): avoid infinite redirect when trailingSlash: never

* address test failures after rebase pt.1

* address test failures after rebase pt.2

---------

Co-authored-by: lilnasy <69170106+lilnasy@users.noreply.github.com>
2024-01-25 10:23:27 +00:00
bluwy
05628aaa3c Merge branch 'main' into next 2023-11-30 22:42:29 +08:00
Matthew Phillips
8f1d509574
Support immutable cache headers for _astro assets (#9125)
* Support immutable cache headers for _astro assets

* Update .changeset/twelve-fishes-fail.md

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

* Update packages/integrations/node/src/http-server.ts

* Update expected max-age

* Add teh docs

* Update .changeset/twelve-fishes-fail.md

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

* Update packages/integrations/node/README.md

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

---------

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-11-28 08:46:26 -05:00
Bjorn Lu
cdabf6ef02
Remove support for simple objects in endpoints (#9181)
* Deprecate simple object from endpoints

* Update changeset

* Add missing Response return

Co-authored-by: Happydev <81974850+MoustaphaDev@users.noreply.github.com>

* Update .changeset/clever-beds-notice.md

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

---------

Co-authored-by: Happydev <81974850+MoustaphaDev@users.noreply.github.com>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-11-27 12:51:57 -05:00
Bjorn Lu
153a5abb90
Remove deprecated features from Astro 3.0 (#9168) 2023-11-28 00:44:20 +08:00
pilcrowOnPaper
c9487138d6
Cancel response stream when connection closes (#9071)
* cancel stream on close

* add changeset

* add test

* Update .changeset/modern-ways-develop.md

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

---------

Co-authored-by: lilnasy <69170106+lilnasy@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-11-16 05:09:41 +05:30
Arsh
391729686b
fix(middleware): instantiate locals if the adapter does not (#8800) 2023-10-12 09:36:34 -05:00
Erika
de7a7fbdc3
nit: optimize images (#8629) 2023-09-22 12:04:39 +02:00
Emanuele Stoppa
2d50d50b6a Merge remote-tracking branch 'origin/main' into next 2023-08-22 14:02:15 +01:00
Emanuele Stoppa
d08c83ee3f
fix(@astrojs/node): handler should work with express (#8176) 2023-08-21 17:29:38 +01:00
Matthew Phillips
cbb77af978 Merge branch 'main' into next 2023-08-17 08:54:28 -04:00
Arsh
097a8e4e91
Prerendering corner cases (#8070)
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-08-17 09:34:31 +01:00
hbgl
560e459246
Stream request body instead of buffering it in memory (#8084)
Co-authored-by: Matthew Phillips <matthew@matthewphillips.info>
2023-08-15 15:26:18 +01:00
Bjorn Lu
6333651a9f Fix node test fail (#7950) 2023-08-08 11:04:16 +01:00
Nate Moore
298dbb89f2
Refactor 404 and 500 approach (#7754)
* fix(app): refactor 404 and 500 approach

* chore: refactor logic

* fix: always treat error as page

* test: migrate ssr-prerender-404 to node adapter

* feat: merge original response metadata with error response

* chore: update lockfile

* chore: trigger ci

* chore(lint): fix lint issue

* fix: ensure merged request has proper status

* fix(node): prerender test

* chore: update test label

* fix(node): improve 404 behavior in middleware mode

* fix(vercel): improve 404 behavior

* fix(netlify): improve 404 behavior

* chore: update test labels

* chore: force ci

* chore: fix lint

* fix: avoid infinite loops

* test: fix failing test in Node 18

* chore: remove volta
2023-08-01 09:52:16 -05:00
Erika
d5f526b339
test: add test in the Node adapter for astro:assets (#7734) 2023-07-26 23:58:47 +02:00
Emanuele Stoppa
8e2923cc62
feat: expose locals to render api and from requests in dev mode (#7385)
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Co-authored-by: wrapperup <wrapperup4@gmail.com>
2023-06-21 13:07:16 +01:00
Alex Sherwin
4929332c32
#7226 - fixes NodeJS adapter for multiple set-cookie headers (and other header issues) (#7227)
* 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>
2023-06-06 10:09:16 -05:00
Happydev
719002ca5b
feat: hybrid output (#6991)
* 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>
2023-05-17 09:23:20 -04:00
Matthew Phillips
c405cef647
Catch errors that occur within the stream in the Node adapter (#6935)
* 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
2023-05-01 10:08:18 -04:00
Bjorn Lu
1fa041695e
Ensure unique workspace name (#6836) 2023-04-13 22:19:08 +08:00
Erika
4cc1bf61b8
fix(node): Fix malformed URLs crashing the server in certain cases (#6746) 2023-04-04 15:48:28 +02:00
Matthew Phillips
67ccec9e16
Node adapter: handle prerendering and serving with query params (#6110)
* Node adapter: handle prerendering and serving with query params

* Adding a changeset
2023-02-02 19:10:16 -05:00
HiDeoo
60b32d5856
Fix Astro.url.protocol when using the @astrojs/node SSR adapter with HTTPS (#5992) 2023-01-26 12:39:57 -05:00
Nate Moore
63a6ceb38d
fix(core): handle encoded characters when matching routes (#5836)
Co-authored-by: Nate Moore <nate@astro.build>
2023-01-12 09:44:18 -06:00
HiDeoo
2303f95142
Add support for serving well-known URIs with the @astrojs/node SSR adapter (#5832) 2023-01-11 17:52:51 +08:00
wulinsheng123
9869f2f6d8
can jump 404 when that page does not exist (#5701) 2023-01-11 00:59:20 +08:00
Matthew Phillips
44694d8a90
Fixes binary data request bodies in the Node adapter (#4055)
* Fixes binary data request bodies in the Node adapter

* Fix type
2022-07-26 10:31:54 -04:00
Matthew Phillips
4ca6a0933d
Fixes Node adapter receiving a request body (#4023)
* Fixes Node adapter receiving a request body

* Updated lockfile
2022-07-22 15:22:31 -04:00