Skip to content

Commit

Permalink
Merge pull request #451 from withastro/next
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico authored Nov 28, 2024
2 parents 967a2bf + 683f239 commit cde14dd
Show file tree
Hide file tree
Showing 135 changed files with 2,452 additions and 3,046 deletions.
21 changes: 21 additions & 0 deletions .changeset/blue-owls-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
'@astrojs/cloudflare': major
'@astrojs/netlify': major
---

Removed support for the Squoosh image service. As the underlying library `libsquoosh` is no longer maintained, and the image service sees very little usage we have decided to remove it from Astro.

Our recommendation is to use the base Sharp image service, which is more powerful, faster, and more actively maintained.

```diff
- import { squooshImageService } from "astro/config";
import { defineConfig } from "astro/config";

export default defineConfig({
- image: {
- service: squooshImageService()
- }
});
```

If you are using this service, and cannot migrate to the base Sharp image service, a third-party extraction of the previous service is available here: https://github.com/Princesseuh/astro-image-service-squoosh
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"changelog": ["@changesets/changelog-github", { "repo": "withastro/adapters" }],
"commit": false,
"access": "public",
"baseBranch": "main",
"baseBranch": "next",
"updateInternalDependencies": "patch",
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
Expand Down
21 changes: 21 additions & 0 deletions .changeset/early-berries-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
'@astrojs/cloudflare': major
'@astrojs/netlify': major
---

Deprecates the `functionPerRoute` option

This option is now deprecated, and will be removed entirely in Astro v5.0. We suggest removing this option from your configuration as soon as you are able to:

```diff
import { defineConfig } from 'astro/config';
import vercel from '@astrojs/vercel/serverless';

export default defineConfig({
// ...
output: 'server',
adapter: vercel({
- functionPerRoute: true,
}),
});
```
8 changes: 8 additions & 0 deletions .changeset/eighty-badgers-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@astrojs/cloudflare': major
'@astrojs/netlify': major
'@astrojs/vercel': major
'@astrojs/node': major
---

Updates internal code to works with Astro 5 changes to hybrid rendering. No changes are necessary to your project, apart from using Astro 5
16 changes: 16 additions & 0 deletions .changeset/fast-singers-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@astrojs/vercel': minor
---

Deprecates the entrypoints `@astrojs/vercel/serverless` and `@astrojs/vercel/static`. These will continue to work but are no longer documented and will be removed in a future version. We recommend updating to the `@astrojs/vercel` entrypoint as soon as you are able:

```diff
-import vercel from "@astrojs/vercel/static"
+import vercel from "@astrojs/vercel"
```


```diff
-import vercel from "@astrojs/vercel/serverless"
+import vercel from "@astrojs/vercel"
```
12 changes: 12 additions & 0 deletions .changeset/flat-dolls-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@astrojs/cloudflare': major
'@astrojs/netlify': major
'@astrojs/node': major
'@astrojs/vercel': major
---

Welcome to the Astro 5 beta! This release has no changes from the latest alpha of this package, but it does bring us one step closer to the final, stable release.

Starting from this release, no breaking changes will be introduced unless absolutely necessary.

To learn how to upgrade, check out the [Astro v5.0 upgrade guide in our beta docs site](https://5-0-0-beta.docs.astro.build/en/guides/upgrade-to/v5/).
5 changes: 5 additions & 0 deletions .changeset/olive-jobs-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/vercel': major
---

Updates the adapter to use new `IntegrationRouteData` type
25 changes: 25 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"mode": "pre",
"tag": "beta",
"initialVersions": {
"@astrojs/cloudflare": "11.0.4",
"@astrojs/netlify": "5.5.3",
"@astrojs/node": "9.0.0-alpha.1",
"@astrojs/test-utils": "0.0.1",
"@astrojs/vercel": "8.0.0-alpha.1"
},
"changesets": [
"blue-owls-peel",
"early-berries-rush",
"eighty-badgers-change",
"fast-singers-design",
"flat-dolls-nail",
"olive-jobs-press",
"rare-candles-unite",
"silver-lemons-bow",
"sixty-trainers-shout",
"slow-mangos-call",
"sweet-geckos-double",
"yellow-avocados-share"
]
}
7 changes: 7 additions & 0 deletions .changeset/rare-candles-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astrojs/cloudflare': major
'@astrojs/netlify': major
'@astrojs/vercel': major
---

Updates esbuild dependency to v0.24.0
5 changes: 5 additions & 0 deletions .changeset/silver-lemons-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/vercel': major
---

Removes deprecated `speedInsights` option in favor of Vercel's direct support: https://vercel.com/docs/speed-insights/quickstart
7 changes: 7 additions & 0 deletions .changeset/sixty-trainers-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astrojs/netlify': minor
'@astrojs/vercel': minor
'@astrojs/node': minor
---

Cleans up `astro:env` support
5 changes: 5 additions & 0 deletions .changeset/slow-mangos-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/vercel': patch
---

Fixes a regression where the `@astrojs/vercel` single entry point for the adapter was causing some regressions in users projects.
8 changes: 8 additions & 0 deletions .changeset/sweet-geckos-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@astrojs/cloudflare': major
'@astrojs/netlify': major
'@astrojs/vercel': major
'@astrojs/node': major
---

Updates internal code for Astro 5 changes. No changes is required to your project, apart from using Astro 5
5 changes: 5 additions & 0 deletions .changeset/yellow-avocados-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/node': major
---

Updates `send` dependency to v1.1.0
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package-lock.json
.eslintcache
.pnpm-store
.idea/
**/fixtures/**/.astro

# ignore top-level vscode settings
/.vscode/settings.json
Expand All @@ -20,4 +21,3 @@ package-lock.json

# exclude IntelliJ/WebStorm stuff
.idea

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"react-dom",
"@types/react"
],
"allowAny": ["astro"]
"allowAny": ["astro", "vite"]
}
},
"devDependencies": {
Expand All @@ -47,7 +47,7 @@
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.10",
"@types/node": "^22.10.0",
"esbuild": "^0.21.5",
"esbuild": "^0.24.0",
"eslint": "^9.15.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-no-only-tests": "^3.3.0",
Expand Down
54 changes: 54 additions & 0 deletions packages/cloudflare/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
# @astrojs/cloudflare

## 12.0.0-beta.1

### Major Changes

- [`f248546`](https://github.com/withastro/adapters/commit/f24854669a2a3da79d8bf1e89b0b54063df0668c) Thanks [@bluwy](https://github.com/bluwy)! - Updates esbuild dependency to v0.24.0

## 12.0.0-beta.0

### Major Changes

- [#367](https://github.com/withastro/adapters/pull/367) [`e02b54a`](https://github.com/withastro/adapters/commit/e02b54ad864ea25cb972f6196496b5aee36a47a3) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Removed support for the Squoosh image service. As the underlying library `libsquoosh` is no longer maintained, and the image service sees very little usage we have decided to remove it from Astro.

Our recommendation is to use the base Sharp image service, which is more powerful, faster, and more actively maintained.

```diff
- import { squooshImageService } from "astro/config";
import { defineConfig } from "astro/config";

export default defineConfig({
- image: {
- service: squooshImageService()
- }
});
```

If you are using this service, and cannot migrate to the base Sharp image service, a third-party extraction of the previous service is available here: https://github.com/Princesseuh/astro-image-service-squoosh

- [#367](https://github.com/withastro/adapters/pull/367) [`e02b54a`](https://github.com/withastro/adapters/commit/e02b54ad864ea25cb972f6196496b5aee36a47a3) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Deprecates the `functionPerRoute` option

This option is now deprecated, and will be removed entirely in Astro v5.0. We suggest removing this option from your configuration as soon as you are able to:

```diff
import { defineConfig } from 'astro/config';
import vercel from '@astrojs/vercel/serverless';

export default defineConfig({
// ...
output: 'server',
adapter: vercel({
- functionPerRoute: true,
}),
});
```

- [#375](https://github.com/withastro/adapters/pull/375) [`e7881f7`](https://github.com/withastro/adapters/commit/e7881f7928c6ca62d43c763033f9ed065a907f3b) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Updates internal code to works with Astro 5 changes to hybrid rendering. No changes are necessary to your project, apart from using Astro 5

- [#397](https://github.com/withastro/adapters/pull/397) [`776a266`](https://github.com/withastro/adapters/commit/776a26670cf483e37ec0e6eba27a0bde09db0146) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Welcome to the Astro 5 beta! This release has no changes from the latest alpha of this package, but it does bring us one step closer to the final, stable release.

Starting from this release, no breaking changes will be introduced unless absolutely necessary.

To learn how to upgrade, check out the [Astro v5.0 upgrade guide in our beta docs site](https://5-0-0-beta.docs.astro.build/en/guides/upgrade-to/v5/).

- [#392](https://github.com/withastro/adapters/pull/392) [`3a49eb7`](https://github.com/withastro/adapters/commit/3a49eb7802c44212ccfab06034b7dc5f2b060e94) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Updates internal code for Astro 5 changes. No changes is required to your project, apart from using Astro 5

## 11.2.0

### Minor Changes
Expand Down
16 changes: 8 additions & 8 deletions packages/cloudflare/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@astrojs/cloudflare",
"description": "Deploy your site to Cloudflare Workers/Pages",
"version": "11.2.0",
"version": "12.0.0-beta.1",
"type": "module",
"types": "./dist/index.d.ts",
"author": "withastro",
Expand Down Expand Up @@ -29,29 +29,29 @@
},
"dependencies": {
"@astrojs/internal-helpers": "0.4.1",
"@astrojs/underscore-redirects": "^0.3.4",
"@astrojs/underscore-redirects": "^0.4.0-alpha.0",
"@cloudflare/workers-types": "^4.20241112.0",
"esbuild": "^0.21.5",
"@inox-tools/astro-when": "^0.2.4",
"esbuild": "^0.24.0",
"estree-walker": "^3.0.3",
"magic-string": "^0.30.14",
"miniflare": "^3.20241106.1",
"tiny-glob": "^0.2.9",
"wrangler": "^3.91.0",
"@inox-tools/astro-when": "^0.2.4"
"wrangler": "^3.91.0"
},
"peerDependencies": {
"astro": "^4.10.3"
"astro": "^5.0.0"
},
"devDependencies": {
"@astrojs/test-utils": "workspace:*",
"astro": "^4.16.15",
"astro": "^5.0.0-alpha.15",
"astro-scripts": "workspace:*",
"cheerio": "1.0.0",
"execa": "^8.0.1",
"fast-glob": "^3.3.2",
"rollup": "^4.27.4",
"strip-ansi": "^7.1.0",
"vite": "^5.4.11"
"vite": "6.0.1"
},
"publishConfig": {
"provenance": true
Expand Down
2 changes: 1 addition & 1 deletion packages/cloudflare/src/entrypoints/image-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const service: ExternalImageService = {
}

const imageEndpoint = joinPaths(
// @ts-expect-error - Property 'env' does not exist on type 'ImportMeta'.ts(2339)
// @ts-expect-error Can't recognise import.meta.env
import.meta.env.BASE_URL,
'/cdn-cgi/image',
resizingParams.join(','),
Expand Down
2 changes: 2 additions & 0 deletions packages/cloudflare/src/entrypoints/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const middlewares: Record<When, MiddlewareHandler> = {
[When.DevServer]: (_, next) => next(),
[When.Server]: (_, next) => next(),
[When.Prerender]: (ctx, next) => {
// @ts-expect-error
if (ctx.locals.runtime === undefined) {
// @ts-expect-error
ctx.locals.runtime = {
env: process.env,
};
Expand Down
26 changes: 11 additions & 15 deletions packages/cloudflare/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AstroConfig, AstroIntegration, RouteData } from 'astro';
import type { AstroConfig, AstroIntegration, IntegrationRouteData } from 'astro';
import type { PluginOption } from 'vite';

import { createReadStream } from 'node:fs';
Expand Down Expand Up @@ -75,8 +75,8 @@ function wrapWithSlashes(path: string): string {
function setProcessEnv(config: AstroConfig, env: Record<string, unknown>) {
const getEnv = createGetEnv(env);

if (config.experimental.env?.schema) {
for (const key of Object.keys(config.experimental.env.schema)) {
if (config.env?.schema) {
for (const key of Object.keys(config.env.schema)) {
const value = getEnv(key);
if (value !== undefined) {
process.env[key] = value;
Expand Down Expand Up @@ -137,10 +137,10 @@ export default function createIntegration(args?: Options): AstroIntegration {
order: 'pre',
});
},
'astro:config:done': ({ setAdapter, config }) => {
if (config.output === 'static') {
throw new AstroError(
'[@astrojs/cloudflare] `output: "server"` or `output: "hybrid"` is required to use this adapter. Otherwise, this adapter is not necessary to deploy a static site to Cloudflare.'
'astro:config:done': ({ setAdapter, config, buildOutput, logger }) => {
if (buildOutput === 'static') {
logger.warn(
'[@astrojs/cloudflare] This adapter is intended to be used with server rendered pages, which this project does not contain any of. As such, this adapter is unnecessary.'
);
}

Expand All @@ -151,19 +151,15 @@ export default function createIntegration(args?: Options): AstroIntegration {
serverEntrypoint: '@astrojs/cloudflare/entrypoints/server.js',
exports: ['default'],
adapterFeatures: {
functionPerRoute: false,
edgeMiddleware: false,
buildOutput: 'server',
},
supportedAstroFeatures: {
serverOutput: 'stable',
hybridOutput: 'stable',
staticOutput: 'unsupported',
i18nDomains: 'experimental',
assets: {
supportKind: 'stable',
isSharpCompatible: false,
isSquooshCompatible: false,
},
sharpImageService: 'limited',
envGetSecret: 'experimental',
},
});
Expand Down Expand Up @@ -295,7 +291,7 @@ export default function createIntegration(args?: Options): AstroIntegration {
redirectsExists = false;
}

const redirects: RouteData['segments'][] = [];
const redirects: IntegrationRouteData['segments'][] = [];
if (redirectsExists) {
const rl = createInterface({
input: createReadStream(new URL('./_redirects', _config.outDir)),
Expand Down Expand Up @@ -342,7 +338,7 @@ export default function createIntegration(args?: Options): AstroIntegration {
);
}

const redirectRoutes: [RouteData, string][] = [];
const redirectRoutes: [IntegrationRouteData, string][] = [];
for (const route of routes) {
if (route.type === 'redirect') redirectRoutes.push([route, '']);
}
Expand Down
Loading

0 comments on commit cde14dd

Please sign in to comment.