diff --git a/packages/integrations/cloudflare/.gitignore b/packages/integrations/cloudflare/.gitignore new file mode 100644 index 000000000000..45f8ec847d8f --- /dev/null +++ b/packages/integrations/cloudflare/.gitignore @@ -0,0 +1,5 @@ +# Astro cloudflare directory mode creates a function directory +functions +.mf +.wrangler +.astro \ No newline at end of file diff --git a/packages/integrations/cloudflare/CHANGELOG.md b/packages/integrations/cloudflare/CHANGELOG.md new file mode 100644 index 000000000000..3422975350ca --- /dev/null +++ b/packages/integrations/cloudflare/CHANGELOG.md @@ -0,0 +1,1709 @@ +# @astrojs/cloudflare + +## 12.2.1 + +### Patch Changes + +- [#506](https://github.com/withastro/adapters/pull/506) [`ce66003`](https://github.com/withastro/adapters/commit/ce66003c093daa0e53a7ab1cf46ddd1d4ddcbee4) Thanks [@bluwy](https://github.com/bluwy)! - Removes internal `vue` handling + +## 12.2.0 + +### Minor Changes + +- [#496](https://github.com/withastro/adapters/pull/496) [`4b5cd22`](https://github.com/withastro/adapters/commit/4b5cd2268e8ed5e720772f50241b299762ea1eb8) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Stabilizes `astro:env` secrets support + +### Patch Changes + +- [#454](https://github.com/withastro/adapters/pull/454) [`83cedad`](https://github.com/withastro/adapters/commit/83cedad780bf7a23ae9f6ca0c44a7b7f1c1767e1) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Improves Astro 5 support + +- [#501](https://github.com/withastro/adapters/pull/501) [`012b31d`](https://github.com/withastro/adapters/commit/012b31d98ce87c1199eb38b7aba2a28b7c1cf8cc) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Refactor of the redirects logic + +## 12.1.0 + +### Minor Changes + +- [#455](https://github.com/withastro/adapters/pull/455) [`1d4e6fc`](https://github.com/withastro/adapters/commit/1d4e6fca41b67277a21dcf2a42910e12206a0299) Thanks [@meyer](https://github.com/meyer)! - Adds `wrangler.jsonc` to the default watched config files. If a config file is specified in `platformProxy.configPath`, that file location is watched instead of the defaults. + +### Patch Changes + +- [#476](https://github.com/withastro/adapters/pull/476) [`a8a8ab1`](https://github.com/withastro/adapters/commit/a8a8ab12d9cfb5157e6a350b93a505010367b8e4) Thanks [@bluwy](https://github.com/bluwy)! - Removes resolving with "node" conditionto fix Vue imports + +## 12.0.1 + +### Patch Changes + +- [#465](https://github.com/withastro/adapters/pull/465) [`70e0054`](https://github.com/withastro/adapters/commit/70e0054aade5368f1bd9b1595766826af7e9ec8d) Thanks [@bluwy](https://github.com/bluwy)! - Fixes setting custom `workerd` and `worker` conditions for the ssr environment only + +## 12.0.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/). + +- [#451](https://github.com/withastro/adapters/pull/451) [`f248546`](https://github.com/withastro/adapters/commit/f24854669a2a3da79d8bf1e89b0b54063df0668c) Thanks [@ematipico](https://github.com/ematipico)! - Updates esbuild dependency to v0.24.0 + +- [#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 + +### Patch Changes + +- [#431](https://github.com/withastro/adapters/pull/431) [`9cedc9b`](https://github.com/withastro/adapters/commit/9cedc9b23175e3b1d74f2d1d10410c2beac1b774) Thanks [@renovate](https://github.com/apps/renovate)! - Inherits `platformProxy` option types from `wrangler` + +## 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 + +- [#423](https://github.com/withastro/adapters/pull/423) [`169ac24`](https://github.com/withastro/adapters/commit/169ac24451d8ac0e47dda27f7148d2ddad66e3dc) Thanks [@schummar](https://github.com/schummar)! - Changes the logic which generates the `_routes.json` file to improve generation for projects with many static pages, while still making sure all routes work as expected. + +### Patch Changes + +- [#409](https://github.com/withastro/adapters/pull/409) [`d63bed8`](https://github.com/withastro/adapters/commit/d63bed81afe549f98d705573d365de5204cab134) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes an issue where `cloudflare:` scoped imports made the build fail. We externalize all imports with the `cloudflare:` scope by default now. + +## 11.1.0 + +### Minor Changes + +- [#394](https://github.com/withastro/adapters/pull/394) [`44dfa99`](https://github.com/withastro/adapters/commit/44dfa9935e22edab16490d625a88aaa0f1942a19) Thanks [@veitbjarsch](https://github.com/veitbjarsch)! - Added functionality to compare include and exclude rules to reduce the amount of cloudflare rules + +## 11.0.5 + +### Patch Changes + +- [#387](https://github.com/withastro/adapters/pull/387) [`04e5c38`](https://github.com/withastro/adapters/commit/04e5c389f251efa02fe7b973ed95cdc61fad3389) Thanks [@veitbjarsch](https://github.com/veitbjarsch)! - Fixes a bug which was caused on windows when splitting static file paths + +## 11.0.4 + +### Patch Changes + +- [#344](https://github.com/withastro/adapters/pull/344) [`8d7766e`](https://github.com/withastro/adapters/commit/8d7766ea89e7663f7de4edf7d0ee3e74b79e73af) Thanks [@Fryuni](https://github.com/Fryuni)! - Updates a dependency to align the peer dependency version for Astro + +## 11.0.3 + +### Patch Changes + +- [#341](https://github.com/withastro/adapters/pull/341) [`a430ab1`](https://github.com/withastro/adapters/commit/a430ab17e525492db2ff9ecc4d00eb710dd92874) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes an issue if environment variables where used inside the middleware and a prerendering occured. + +- [#335](https://github.com/withastro/adapters/pull/335) [`237f332`](https://github.com/withastro/adapters/commit/237f332a819a92cdc2128d1564f5b8558318ad2b) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes an issue displaying images which are optimized during `astro build` + +## 11.0.2 + +### Patch Changes + +- [#340](https://github.com/withastro/adapters/pull/340) [`45d0abb`](https://github.com/withastro/adapters/commit/45d0abb52b8e940a7c702a148be779428836396c) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes an issue if environment variables where used inside the middleware and a prerendering occured. + +## 11.0.1 + +### Patch Changes + +- [#302](https://github.com/withastro/adapters/pull/302) [`dc0039f`](https://github.com/withastro/adapters/commit/dc0039fa23de59c95f2943186b403c82eacf6f7a) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes an issue where projects break when no `wrangler.toml` file was present + +## 11.0.0 + +### Major Changes + +- [#290](https://github.com/withastro/adapters/pull/290) [`1c4145e`](https://github.com/withastro/adapters/commit/1c4145e1f9a27b2eee1f17f0689bf29345ba2ca6) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Cloudflare v11 + + ## Upgrades + + ### Supported Astro versions + + This release drops support for Astro versions `<= 4.10.2`. The new supported and required Astro versions are `>= 4.10.3`. This allowed us to remove additional workarounds related to projects with many prerendered pages. This should fix all bundling issues that are not caused by an upstream package. + + #### What should I do? + + If you still observe an issue, please check current open issues or create a new one in the repository. + + To upgrade an existing project, use the automated `@astrojs/upgrade` CLI tool. Alternatively, upgrade manually by running the upgrade command from your package manager: + + ``` + # Recommended: + npx @astrojs/upgrade + + # Manual: + npm install astro@latest + pnpm upgrade astro --latest + yarn upgrade astro --latest + ``` + + ## Changes + + ### `astro:env` + + This release adds experimental support for `astro:env`, which helps to streamline the usage of environment variables for Astro projects. You can read more about it in [Astro Docs](https://docs.astro.build/en/reference/configuration-reference/#experimentalenv). **IMPORTANT:** Cloudflare Bindings are not supported by `astro:env`, and still should be accessed by using `Astro.locals.runtime.env` or `context.locals.runtime.env`. `astro:env` supports environment variables only. + + #### What should I do? + + If you observe any issues, please check current open issues or create a new one in the repository. + + To add environment variables to your project, you still need to make sure they are available in three places. You're setup might require different steps to achieve this, so we can't give you a complete step-by-step guide, on how to achieve the requirements, but here are some guidance to get you started: + + - `process.env` during build in your node process (`astro build`) + - `wrangler.toml` for local development (`astro dev`) + - `Cloudflare Pages Dashboard` for production deployments + + Add "public" environment variables to your `wrangler.toml`. _(If you add `pages_build_output_dir = "./dist"` to your `wrangler.toml`, these will be synced to your Cloudflare Pages Dashboard, and you don't have to add them there manually)_: + + ```diff + # wrangler.toml + name = "test" + + +[vars] + +API_URL = "https://google.de" + +PORT = 4322 + + # ... + ``` + + If you also need "secret" environment variables _(e.g. API Keys, etc.)_, you add them to your `.dev.vars` file. _(These won't be synced automatically, and you need to add them manually as encrypted variables to the Cloudflare Pages Dashboard or use `wrangler` CLI to push them)_: + + ```diff + # .dev.vars + + API_SECRET=123456789 + ``` + + With your environment variables added to those two files and synced to the Cloudflare Pages Dashboard, you should be able to use them with `astro:env` when running `astro dev` & `astro build`, **but** you need to use Cloudflare's Build Pipeline and Cloudflare's GitHub App connection. + + However if you build your project locally or inside a custom GitHub Action and deploy with direct upload to Cloudflare, you need to ensure that the environment variables are also available for your build process. The simplest but not safest is to use your shell, e.g. `API_URL=https://google.de PORT=4322 API_SECRET=123456789 astro build`. For more complex setups, you should find out the way for your specific setup to provide environment variables to the build process. + + Additionally, you need to define your schema inside your `astro.config.mjs` file: + + ```diff + import { defineConfig, envField } from "astro/config" + + export default defineConfig({ + + experimental: { + + env: { + + schema: { + + API_URL: envField.string({ context: "client", access: "public", optional: true }), + + PORT: envField.number({ context: "server", access: "public", default: 4321 }), + + API_SECRET: envField.string({ context: "server", access: "secret" }), + + } + + } + + } + }) + ``` + + Finally, you should be able to access your environment variables in your Astro project, according to the [Astro Docs](https://docs.astro.build/en/reference/configuration-reference/#experimentalenv), e.g. `import { API_URL } from "astro:env/client"` or `import { PORT, API_SECRET } from "astro:env/server"`. + + **NOTE:** If you want to use environment variables in other files that are not `.astro` or `middleware` files, you still need to make sure you don't access the variable in a global scope. We recommend wrapping your logic with a function, which you then call from your `.astro` or `middleware` files inside the request scope. + + ```ts + // foo.ts + import { MY_SECRET } from 'astro:env/server'; + + // DOESN'T WORK + const client = myLib(MY_SECRET); + + // WORKS + export const bar = () => { + const client = myLib(MY_SECRET); + return client; + }; + ``` + + ### watch config files + + This release starts monitoring your `wrangler.toml` and `.dev.vars` files for changes and restarting the dev server if you update them. + + #### What should I do? + + If you observe any issues, please check current open issues or create a new one in the repository. + + ### BREAKING: `imageService` + + This release changes the default behavior of `imageService`. In the past the default behavior was falling back to a `noop` service, which disabled image optimization for your project, because Cloudflare doesn's support it. The new default is `compile`, which enables image optimization for prerendered pages during build, but disallows the usage of any `astro:assets` feature inside of on-demand pages. + + #### What should I do? + + If you experience issues with the new setting, you can revert back to the old setting by setting `imageService` to `passthrough`. Furthermore if you observe any issues, please check current open issues or create a new one in the repository. + + ```diff + // astro.config.mjs + + // ... + adapter: cloudflare({ + - imageService: 'compile', + }), + // ... + ``` + + ### BREAKING: `platformProxy` + + This release enables `platformProxy` by default. While most projects shouldn't be affected, this is a breaking change on paper. + + #### What should I do? + + If you experience issues with the new default, you can deactivate it by setting `platformProxy.enabled` to `false`. Furthermore if you observe any issues, please check current open issues or create a new one in the repository. + + ```diff + // astro.config.mjs + + // ... + adapter: cloudflare({ + - platformProxy: { + - enabled: true, + - }, + }), + // ... + ``` + + ### BREAKING: `passThroughOnException` + + This release throws an error if you use Cloudflare's `passThroughOnException` function because, as stated in [Cloudflare docs](https://developers.cloudflare.com/pages/platform/known-issues/#pages-functions), the function doesn't work with Cloudflare Pages. + + #### What should I do? + + If you observe any issues, please check current open issues or create a new one in the repository. + + ## Deprecations + + ### `wasmModuleImports` + + This release removes the previous deprecated `wasmModuleImports` adapter option and replaces it with the `cloudflareModules` option, which offers flexibility and support for more file types. + + #### What should I do? + + If you observe any issues, please check current open issues or create a new one in the repository. + + ```diff + // astro.config.mjs + + // ... + adapter: cloudflare({ + - wasmModuleImports: true, + }), + // ... + ``` + +## 10.4.2 + +### Patch Changes + +- [#292](https://github.com/withastro/adapters/pull/292) [`8972d60`](https://github.com/withastro/adapters/commit/8972d60c45af7cd163c193457baff49b0346f155) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Removes experimental support for `astro:env` + +## 10.4.1 + +### Patch Changes + +- [#282](https://github.com/withastro/adapters/pull/282) [`65337f3`](https://github.com/withastro/adapters/commit/65337f3aa67a1f2a40ea8c20a6fcc462e8cbfe94) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes backwards compatibility with Astro <= 4.9 + +## 10.4.0 + +### Minor Changes + +- [#258](https://github.com/withastro/adapters/pull/258) [`033847d`](https://github.com/withastro/adapters/commit/033847d6b58333a40a6a3da0eba49c4f41360dd8) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Adds support for experimental `astro:env` released in Astro 4.10 + +## 10.3.0 + +### Minor Changes + +- [#251](https://github.com/withastro/adapters/pull/251) [`b826675`](https://github.com/withastro/adapters/commit/b826675e845c2115daa774ee697013de4ce5690f) Thanks [@adrianlyjak](https://github.com/adrianlyjak)! - Adds support for `.bin` and `.txt` files + +## 10.2.6 + +### Patch Changes + +- [#226](https://github.com/withastro/adapters/pull/226) [`de6f3eb`](https://github.com/withastro/adapters/commit/de6f3eba4ad4135fd762320b1219850ba9b3d7e9) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes chunk issues when bundling node_modules dependencies + +## 10.2.5 + +### Patch Changes + +- [#249](https://github.com/withastro/adapters/pull/249) [`72fc8ac`](https://github.com/withastro/adapters/commit/72fc8ac6faee9eae2463bab23407c2b619abb39f) Thanks [@adrianlyjak](https://github.com/adrianlyjak)! - Fixes build errors when wasm modules are imported from a file that is shared in both prerendered static pages and server side rendered pages + +## 10.2.4 + +### Patch Changes + +- [#247](https://github.com/withastro/adapters/pull/247) [`e08cd4c`](https://github.com/withastro/adapters/commit/e08cd4ca6cf9a517941576f54a4b60ed17b6f077) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes an issue where redirect rules where not excluded from routing due to ordering issues + +## 10.2.3 + +### Patch Changes + +- [#243](https://github.com/withastro/adapters/pull/243) [`71ba51d`](https://github.com/withastro/adapters/commit/71ba51d2983eef89b5692f351724081507c2f82f) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes an issue where the bundle was not cleaned up correctly + +## 10.2.2 + +### Patch Changes + +- [#241](https://github.com/withastro/adapters/pull/241) [`82d81d9`](https://github.com/withastro/adapters/commit/82d81d9a55da93792d7f9244fb5aa3ec86939620) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Removes a debug log + +## 10.2.1 + +### Patch Changes + +- [#238](https://github.com/withastro/adapters/pull/238) [`1927f94`](https://github.com/withastro/adapters/commit/1927f941b41ac7156054c337edb031be8132e3e2) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes `astro build` which throws an error if it can't clean up dynamic imports for prerendered pages. + +## 10.2.0 + +### Minor Changes + +- [#222](https://github.com/withastro/adapters/pull/222) [`8f312da`](https://github.com/withastro/adapters/commit/8f312dabc31bd17a699d172d1366ef63a5e0f8f4) Thanks [@Fryuni](https://github.com/Fryuni)! - Fixes an issue, where unused code was not removed from the output, which led to issues with large projects with a lot of prerendered pages. + +## 10.1.0 + +### Minor Changes + +- [#229](https://github.com/withastro/adapters/pull/229) [`1f4e40b`](https://github.com/withastro/adapters/commit/1f4e40b7c1ad586b58159b12b8f5b6a2da7ce1d9) Thanks [@FlorianFlatscher](https://github.com/FlorianFlatscher)! - Adds a new option for the Image service to the Cloudflare adapter. `imageService: 'custom'` does use the user defined settings, without applying any modification to it. **You need to make sure that the configured settings are compatible with Cloudflare's `workerd` runtime yourself.** + +## 10.0.3 + +### Patch Changes + +- [#225](https://github.com/withastro/adapters/pull/225) [`9e7d0ea`](https://github.com/withastro/adapters/commit/9e7d0eae05a2ba8d7234e909e724b220b602fc5a) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes `locals.runtime` API to match between `astro dev` and `astro build` + +## 10.0.2 + +### Patch Changes + +- [#217](https://github.com/withastro/adapters/pull/217) [`0349bd4`](https://github.com/withastro/adapters/commit/0349bd41a9d10421907eb0e46bd6472c85a10ec7) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - fixes an issue where the automatic `_routes.json` generation was not working as expected for some projects, which had a dynamic route as the first segment + +- [#217](https://github.com/withastro/adapters/pull/217) [`0349bd4`](https://github.com/withastro/adapters/commit/0349bd41a9d10421907eb0e46bd6472c85a10ec7) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - fixes an issue where the automatic `_routes.json` generation was not limited correctly, which had manual extend patterns + +## 10.0.1 + +### Patch Changes + +- [#212](https://github.com/withastro/adapters/pull/212) [`c22bb21`](https://github.com/withastro/adapters/commit/c22bb21f6bb0fece2bf29b9acaff08a78a6fce43) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - fixes an issue where projects using `@astrojs/solid-js` were unusable, due to wrong vite config + +- [#210](https://github.com/withastro/adapters/pull/210) [`317bd95`](https://github.com/withastro/adapters/commit/317bd9533b32558f481c50ec807d72ce1aa12cbb) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - fixes an issue where projects using `@astrojs/vue` were unusable, due to marking dependencies as external + +## 10.0.0 + +### Major Changes + +- [#159](https://github.com/withastro/adapters/pull/159) [`adb8bf2a4caeead9a1a255740c7abe8666a6f852`](https://github.com/withastro/adapters/commit/adb8bf2a4caeead9a1a255740c7abe8666a6f852) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Updates and prepares the adapter to be more flexibile, stable and composable for the future. Includes several breaking changes. + + ## Upgrade Guide + + We are commited to provide a smooth upgrade path for our users. This guide will describe what has changed from v9.x to v10 to help you to migrate your existing projects to the latest version of the adapter. For complete documentation of all v10 configuration settings and usage, please see [the current, updated Cloudflare adapter documentation](https://docs.astro.build/en/guides/integrations-guide/cloudflare/). + + We will provide at least 4 weeks of limited maintanance support for the previous version 9 of the adapter. Please plan to upgrade your project within this time frame, using the instructions below. + + ### Adapter's `mode` option & Cloudflare Functions + + The `mode` option has been removed from the adapter. The adapter now defaults to the previous `advanced` mode and this is the only official supported option moving forward. + + If you are already using `mode: 'advanced'` in your `astro.config.mjs` file, you can safely remove it. + + ```diff + import cloudflare from '@astrojs/cloudflare'; + import { defineConfig } from 'astro/config'; + + export default defineConfig({ + adapter: cloudflare({ + - mode: 'advanced', + }), + }); + ``` + + If you are using `mode: 'directory'`, and don't have any custom Cloudflare functions in the `/function` folder, you should be able to remove the `mode` option, without any issues. + + ```diff + import cloudflare from '@astrojs/cloudflare'; + import { defineConfig } from 'astro/config'; + + export default defineConfig({ + adapter: cloudflare({ + - mode: 'directory', + }), + }); + ``` + + If you are using `mode: 'directory'`, **and you have custom Cloudflare functions in the `/function` folder**, you will need to manually migrate them to [Astro Server Endpoints (API Routes)](https://docs.astro.build/en/guides/endpoints/#server-endpoints-api-routes). If you need to access Cloudflare Bindings, you can use `ctx.locals`. For further reference, please check the [Adapters Documentation on Cloudflare Runtime Usage](https://docs.astro.build/en/guides/integrations-guide/cloudflare/#usage). + + ### Adapter's `functionPerRoute` option + + The `functionPerRoute` option has been removed from the adapter. The adapter now defaults to the previous `false` value. If you are using `functionPerRoute: true` in your `astro.config.mjs` file, you can safely remove it. This change will not break any existing projects, but you will no longer be generating a single function for each route. + + ```diff + import cloudflare from '@astrojs/cloudflare'; + import { defineConfig } from 'astro/config'; + + export default defineConfig({ + adapter: cloudflare({ + - functionPerRoute: true, + }), + }); + ``` + + ### Local Runtime + + The adapter replaces the `runtime` options with a new set of `platformProxy` options to enable local runtime support when using `astro dev`. + + If you are already using a `wrangler.toml` file, you can safely replace your existing `runtime` options with the appropriate `platformProxy` options. + + ```diff + import cloudflare from '@astrojs/cloudflare'; + import { defineConfig } from 'astro/config'; + + export default defineConfig({ + adapter: cloudflare({ + - runtime: { + - mode: 'local', + - type: 'workers', + - }, + + platformProxy: { + + enabled: true, + + }, + }), + }); + ``` + + If you define your bindings in the `astro.config.mjs` file, you need to first migrate your project to use a `wrangler.toml` configuration file for defining your bindings. You can find more information on how to do this in the [Cloudflare docs about wrangler](https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases). Then, replace `runtime` options with the new corresponding `platformProxy` options as above. + + ```diff + import cloudflare from '@astrojs/cloudflare'; + import { defineConfig } from 'astro/config'; + + export default defineConfig({ + adapter: cloudflare({ + - runtime: { + - mode: 'local', + - type: 'pages', + - bindings: { + - // ... + - }, + - }, + + platformProxy: { + + enabled: true, + + }, + }), + }); + ``` + + If you have typed `locals` in your `./src/env.d.ts` file, you need to run `wrangler types` in your project and update the file. + + ```diff + /// + + - type KVNamespace = import('@cloudflare/workers-types/experimental').KVNamespace; + - type ENV = { + - SERVER_URL: string; + - KV_BINDING: KVNamespace; + - }; + + - type Runtime = import('@astrojs/cloudflare').AdvancedRuntime; + + type Runtime = import('@astrojs/cloudflare').Runtime; + + declare namespace App { + interface Locals extends Runtime { + + name: string; + surname: string; + }; + } + } + ``` + + ### Routes + + The `routes.strategy` option has been removed as you will no longer have the option to choose a strategy in v10 of this adpater. + + If you are using `routes.strategy`, you can remove it. You might observe a different `dist/_routes.json` file, but it should not affect your project's behavior. + + ```diff + import cloudflare from '@astrojs/cloudflare'; + import { defineConfig } from 'astro/config'; + + export default defineConfig({ + adapter: cloudflare({ + - routes: { + - strategy: 'include', + - }, + }), + }); + ``` + + Additionally the `routes.include` & `routes.exclude` options have changed their name and type. If you were previously using them, move these to the new `routes.extend` property and update their types: + + ```diff + import cloudflare from '@astrojs/cloudflare'; + import { defineConfig } from 'astro/config'; + + export default defineConfig({ + adapter: cloudflare({ + routes: { + - include: ['/api/*'], + - exclude: ['/fonts/*'], + + extend: { + + include: [{ pattern: '/api/*' }], + + exclude: [{ pattern: '/fonts/*' }], + + }, + }, + }), + }); + ``` + + ### process.env + + In the old version of the adapter we used to expose all the environment variables to `process.env`. This is no longer the case, as it was unsafe. If you need to use environment variables, you need to use either `Astro.locals.runtime.env` or `context.locals.runtime.env`. There is no way to access the environment variables directly from `process.env` or in the global scope. + + If you need to access the environment variables in global scope, you should refactor your code to pass the environment variables as arguments to your function or file. + + If you rely on any third library that uses `process.env`, please open an issue and we can investigate what the best way to handle this is. + + ### Node.js APIs compatibility + + The adapter still supports the same Node.js APIs as Cloudflare does, but you need to adapt your vite configuration and enable the Cloudflare `nodejs_compat` flag. + + ```diff + import {defineConfig} from "astro/config"; + import cloudflare from '@astrojs/cloudflare'; + + export default defineConfig({ + adapter: cloudflare({}), + output: 'server', + + vite: { + + ssr: { + + external: ['node:buffer'], + + }, + + }, + }) + ``` + +## 9.2.1 + +### Patch Changes + +- [#204](https://github.com/withastro/adapters/pull/204) [`826bb4fe1fa2a95a38397f927210cdf37079c38a`](https://github.com/withastro/adapters/commit/826bb4fe1fa2a95a38397f927210cdf37079c38a) Thanks [@dario-piotrowicz](https://github.com/dario-piotrowicz)! - Fixes a typo for a Cloudflare runtime .dev.vars warning + +## 9.2.0 + +### Minor Changes + +- [#192](https://github.com/withastro/adapters/pull/192) [`256b7024624ab45d5087d774cb4c30b117f1636a`](https://github.com/withastro/adapters/commit/256b7024624ab45d5087d774cb4c30b117f1636a) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Prepares for major breaking changes to adapter configuration in the upcoming v10 release. + + _(Full documentation to help you migrate your project to the upgraded Cloudflare adapter will be provided with the release of v10.0.)_ + + **Deprecates** the following adapter configuration options (to be **removed entirely in v10**): + + - **`mode`:** All projects will deploy to Cloudflare pages using [advanced mode](https://developers.cloudflare.com/pages/functions/advanced-mode/) (the previous default setting). This is no longer a configurable option. [Cloudflare Functions](https://developers.cloudflare.com/pages/functions/get-started/) will no longer be supported. If you were using `mode: 'directory'`, please migrate to [Astro Endpoints](https://docs.astro.build/en/guides/endpoints/). + - **`functionPerRoute`:** Discontinued due to Cloudflare's single execution context approach. You will no longer have the option to compile a separate bundle for each page. + - **`routes.strategy`:** Projects will use the auto-generated `_route.json` for route management unless you [provide your own `public/_routes.json`](/en/guides/integrations-guide/cloudflare/#custom-_routesjson). This change aims to eliminate confusion and promote consistency. + - **`routes.include`:** Will be replaced by a new `routes.extend.include` option to allow you to include additional routes. + - **`routes.exclude`:** Will be replaced by a new `routes.extend.exclude` option to allow you to exclude additional routes. + - **`runtime`:** Local runtime bindings will be configured in `wrangler.toml` at the root of your project as described in the [adapters documentation](https://docs.astro.build/en/guides/integrations-guide/cloudflare/#cloudflare-workers). You will no longer configure these directly in the adapter configuration. A new `platformProxy` setting will be introduced to enable and configure the platformProxy (local runtime) provided by wrangler. + + These changes are part of ongoing efforts to streamline functionality, improve performance, and align with best practices and platform capabilities. + + We strongly recommend upgrading to v10 upon its release. To ensure a smooth migration, we commit to at least 4 weeks of additional maintenance for v9 following the release of v10. During this period, we will actively assist with migration efforts to ensure that all users can transition without major issues. + +## 9.1.0 + +### Minor Changes + +- [#179](https://github.com/withastro/adapters/pull/179) [`6ad25929ce37344d9de7063643434ca0b01df306`](https://github.com/withastro/adapters/commit/6ad25929ce37344d9de7063643434ca0b01df306) Thanks [@F0rce](https://github.com/F0rce)! - Adds [Service bindings](https://developers.cloudflare.com/workers/configuration/bindings/about-service-bindings/) to the runtime bindings. + +## 9.0.2 + +### Patch Changes + +- [#171](https://github.com/withastro/adapters/pull/171) [`0463483141c2a09ed983fd8053e6bee6d4b0567d`](https://github.com/withastro/adapters/commit/0463483141c2a09ed983fd8053e6bee6d4b0567d) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes an error with automatic deduplication of `_routes.json` for more complex project structures + +## 9.0.1 + +### Patch Changes + +- [#168](https://github.com/withastro/adapters/pull/168) [`25908149cd5b9e82d6746529e44473ae93be6e32`](https://github.com/withastro/adapters/commit/25908149cd5b9e82d6746529e44473ae93be6e32) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes an error where the `astro dev` command would fail if the cache directory already existed + +## 9.0.0 + +### Major Changes + +- [#130](https://github.com/withastro/adapters/pull/130) [`2b5aaa4cfeda4bc7f1bf8db6210162c495866a95`](https://github.com/withastro/adapters/commit/2b5aaa4cfeda4bc7f1bf8db6210162c495866a95) Thanks [@asdfjkalsdfla](https://github.com/asdfjkalsdfla)! - Updates the internals of the integration to support Astro 4.0. See this [upstream pull request](https://github.com/withastro/astro/pull/9199) for additional details. **Warning:** Make sure to upgrade your Astro version to `>4.2` as previous versions are no longer supported. + +### Patch Changes + +- [#137](https://github.com/withastro/adapters/pull/137) [`d67df0e24ad0d9fca317f01e877f3dc650831488`](https://github.com/withastro/adapters/commit/d67df0e24ad0d9fca317f01e877f3dc650831488) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes an issue with `_routes.json` generation, where duplicates where not removed correctly and an explicit user strategy setting was ignored. + +## 8.1.0 + +### Minor Changes + +- [#58](https://github.com/withastro/adapters/pull/58) [`ecdb8f5bc21b19cc86e581711a1c360fc723a007`](https://github.com/withastro/adapters/commit/ecdb8f5bc21b19cc86e581711a1c360fc723a007) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Adds the option to only run image optimization on images during build-time. **Warning:** This mode does not work with on-demand (SSR) image optimization. + + ```diff + import {defineConfig} from "astro/config"; + import cloudflare from '@astrojs/cloudflare'; + + export default defineConfig({ + output: 'server' + adapter: cloudflare({ + + imageService: 'compile' + }), + }) + ``` + +## 8.0.2 + +### Patch Changes + +- [#125](https://github.com/withastro/adapters/pull/125) [`200dea9`](https://github.com/withastro/adapters/commit/200dea9d5a98e9348b2368b846f385ab850ca053) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Updates miniflare version + +## 8.0.1 + +### Patch Changes + +- [#108](https://github.com/withastro/adapters/pull/108) [`63fa4e6`](https://github.com/withastro/adapters/commit/63fa4e6acfabc398460be788120c03329198a02d) Thanks [@sarah11918](https://github.com/sarah11918)! - Updates Cloudflare README.md + +## 8.0.0 + +### Major Changes + +- [#94](https://github.com/withastro/adapters/pull/94) [`13ddae8`](https://github.com/withastro/adapters/commit/13ddae81d31922e4e7bf096eea44148dbcc246c8) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Removes deprecated option `build.split`. Use `functionPerRoute` instead. + +- [#94](https://github.com/withastro/adapters/pull/94) [`13ddae8`](https://github.com/withastro/adapters/commit/13ddae81d31922e4e7bf096eea44148dbcc246c8) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Changes the way that bindings are configured for the local runtime using `astro dev`. This change is developed in cooperation with Cloudflare and aligns Astro more closely to the behavior of Wrangler. + + :warning: This is a breaking change for anyone deploying to Cloudflare Pages. You need to update your astro config file to set new the bindings. Follow the updated docs for [configuring `@astrojs/cloudflare`](https://docs.astro.build/en/guides/integrations-guide/cloudflare/#cloudflare-pages) + +### Patch Changes + +- [#94](https://github.com/withastro/adapters/pull/94) [`13ddae8`](https://github.com/withastro/adapters/commit/13ddae81d31922e4e7bf096eea44148dbcc246c8) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Improves compatibility with Astro 4.0. using WASM modules + +- [#94](https://github.com/withastro/adapters/pull/94) [`13ddae8`](https://github.com/withastro/adapters/commit/13ddae81d31922e4e7bf096eea44148dbcc246c8) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Updates `peerDependency` of `astro` to be less strict + +## 7.7.1 + +### Patch Changes + +- [#69](https://github.com/withastro/adapters/pull/69) [`473e9fa`](https://github.com/withastro/adapters/commit/473e9fabdc2f5a87daf6a71c8869e8430903590f) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes a regression which caused the adapter to falsely generate `_routes.json` for on-demand rendered 404 pages, which causes unexpected behavior in Cloudflare's SPA routing. + +- [#66](https://github.com/withastro/adapters/pull/66) [`5b62509`](https://github.com/withastro/adapters/commit/5b625096c7115aa0496a6c7053c4226c8fd118f3) Thanks [@ToxiWoxi](https://github.com/ToxiWoxi)! - Fixes a regression which caused the adapter to falsely return an empty 404 response, caused by an upstream change https://github.com/withastro/astro/pull/7754. + +## 7.7.0 + +### Minor Changes + +- [#34](https://github.com/withastro/adapters/pull/34) [`4e1060b`](https://github.com/withastro/adapters/commit/4e1060b9b6bc758a3163f6a9b7d5074954a83e22) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Adds an `imageService` adapter option to configure which image service is used. Read more in the [Cloudflare adapter docs](https://docs.astro.build/en/guides/integrations-guide/cloudflare/). + +- [#34](https://github.com/withastro/adapters/pull/34) [`4e1060b`](https://github.com/withastro/adapters/commit/4e1060b9b6bc758a3163f6a9b7d5074954a83e22) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Adds support for using Cloudflare's Image Resizing service as an external image service in Astro. See [Cloudflare's image docs](https://developers.cloudflare.com/images/image-resizing/) for more information about pricing and features. + +## 7.6.4 + +### Patch Changes + +- [#51](https://github.com/withastro/adapters/pull/51) [`acf4c82`](https://github.com/withastro/adapters/commit/acf4c824f8e066d25d94ddf59a486083586567c4) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Updates dependencies + +## 7.6.3 + +### Patch Changes + +- [#46](https://github.com/withastro/adapters/pull/46) [`1611ff7`](https://github.com/withastro/adapters/commit/1611ff7cf8e94d5f5267b6a86fca535eedaa5651) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes a regression introduced in 7.6.2, which breaks building + +## 7.6.2 + +### Patch Changes + +- [#33](https://github.com/withastro/adapters/pull/33) [`78baf24`](https://github.com/withastro/adapters/commit/78baf24c34f155305bcb5116e14373d4ddf58ce9) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes override of a valid `astro:assets` image service configuration. Now overrides are only applied when the configuration is known to be incompatible with Cloudflare. + +## 7.6.1 + +### Patch Changes + +- [#28](https://github.com/withastro/adapters/pull/28) [`1665a39`](https://github.com/withastro/adapters/commit/1665a3913373d02e73a3557bc045d1f0158979b6) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes missing persistence setting for `cache` + +- [#30](https://github.com/withastro/adapters/pull/30) [`625c41b`](https://github.com/withastro/adapters/commit/625c41b4b69058933e1d14f1c153574a992c0519) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fixes a regression introduced in 7.6.0, which breaks when no argument is set + +## 7.6.0 + +### Minor Changes + +- [#23](https://github.com/withastro/adapters/pull/23) [`4a03af2`](https://github.com/withastro/adapters/commit/4a03af28f6101185c56fb3973de217780533755b) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Adds a new property `persistTo` which allows setting the directory for local state files when using Cloudflare runtime with `astro dev`. This is useful when you want to persist state between restarts of the dev server, for example when using KV, D1, R2 to store data. + + Additionally, updates the format of the `runtime` configuration and adds a warning when the deprecated format is used. The current format is now `runtime: { mode: 'off' | 'local', persistTo: string }`. See [runtime documentation](https://docs.astro.build/en/guides/integrations-guide/cloudflare/#runtime) for more information. + +## 7.5.4 + +### Patch Changes + +- [#21](https://github.com/withastro/adapters/pull/21) [`09d2504`](https://github.com/withastro/adapters/commit/09d25043125250e65ccb59549f527d5d876c3a06) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Updates repository information + +## 7.5.3 + +### Patch Changes + +- [#8782](https://github.com/withastro/astro/pull/8782) [`75781643a`](https://github.com/withastro/astro/commit/75781643a2f53656fc3fde3a7f28cb62db40b015) Thanks [@helloimalastair](https://github.com/helloimalastair)! - fixes `AdvancedRuntime` & `DirectoryRuntime` types to work woth Cloudflare caches + +- Updated dependencies [[`2993055be`](https://github.com/withastro/astro/commit/2993055bed2764c31ff4b4f55b81ab6b1ae6b401), [`c4270e476`](https://github.com/withastro/astro/commit/c4270e47681ee2453f3fea07fed7b238645fd6ea), [`bd5aa1cd3`](https://github.com/withastro/astro/commit/bd5aa1cd35ecbd2784f30dd836ff814684fee02b), [`f369fa250`](https://github.com/withastro/astro/commit/f369fa25055a3497ebaf61c88fb0e8af56c73212), [`391729686`](https://github.com/withastro/astro/commit/391729686bcc8404a7dd48c5987ee380daf3200f), [`f999365b8`](https://github.com/withastro/astro/commit/f999365b8248b8b14f3743e68a42d450d06acff3), [`b2ae9ee0c`](https://github.com/withastro/astro/commit/b2ae9ee0c42b11ffc1d3f070d1d5ac881aef84ed), [`0abff97fe`](https://github.com/withastro/astro/commit/0abff97fed3db14be3c75ff9ece3aab67c4ba783), [`3bef32f81`](https://github.com/withastro/astro/commit/3bef32f81c56bc600ca307f1bd40787e23e625a5)]: + - astro@3.3.0 + - @astrojs/underscore-redirects@0.3.1 + +## 7.5.2 + +### Patch Changes + +- [#8766](https://github.com/withastro/astro/pull/8766) [`054c5c644`](https://github.com/withastro/astro/commit/054c5c6447d79dd4ea7ab6ce0f9ec836abebd211) Thanks [@jadbox](https://github.com/jadbox)! - Adds `cloudflare:sockets` compile support + +- [#8788](https://github.com/withastro/astro/pull/8788) [`0ab6bad7d`](https://github.com/withastro/astro/commit/0ab6bad7dffd413c975ab00e545f8bc150f6a92f) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Adds support for `node:crypto` + +- Updated dependencies [[`160d1cd75`](https://github.com/withastro/astro/commit/160d1cd755e70af1d8ec294d01dd2cb32d60db50), [`30de32436`](https://github.com/withastro/astro/commit/30de324361bc261956eb9fc08fe60a82ff602a9b), [`c4a7ec425`](https://github.com/withastro/astro/commit/c4a7ec4255e7acb9555cb8bb74ea13c5fbb2ac17), [`c24f70d91`](https://github.com/withastro/astro/commit/c24f70d91601dd3a6b5a84f04d61824e775e9b44), [`93b092266`](https://github.com/withastro/astro/commit/93b092266febfad16a48575f8eee12d5910bf071), [`29cdfa024`](https://github.com/withastro/astro/commit/29cdfa024886dd581cb207586f7dfec6966bdd4e), [`eaed844ea`](https://github.com/withastro/astro/commit/eaed844ea8f2f52e0c9caa40bb3ec7377e10595f)]: + - astro@3.2.4 + - @astrojs/underscore-redirects@0.3.1 + +## 7.5.1 + +### Patch Changes + +- [#8737](https://github.com/withastro/astro/pull/8737) [`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c) Thanks [@ematipico](https://github.com/ematipico)! - Add provenance statement when publishing the library from CI + +- Updated dependencies [[`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c), [`d78806dfe`](https://github.com/withastro/astro/commit/d78806dfe0301ea7ffe6c7c1f783bd415ac7cda9), [`d1c75fe15`](https://github.com/withastro/astro/commit/d1c75fe158839699c59728cf3a83888e8c72a459), [`aa265d730`](https://github.com/withastro/astro/commit/aa265d73024422967c1b1c68ad268c419c6c798f), [`78adbc443`](https://github.com/withastro/astro/commit/78adbc4433208458291e36713909762e148e1e5d), [`21e0757ea`](https://github.com/withastro/astro/commit/21e0757ea22a57d344c934045ca19db93b684436), [`357270f2a`](https://github.com/withastro/astro/commit/357270f2a3d0bf2aa634ba7e52e9d17618eff4a7)]: + - @astrojs/underscore-redirects@0.3.1 + - astro@3.2.3 + +## 7.5.0 + +### Minor Changes + +- [#8655](https://github.com/withastro/astro/pull/8655) [`3dd65bf88`](https://github.com/withastro/astro/commit/3dd65bf8895faedfa4c92599961acca07457c62f) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Introduces support for local KV bindings. Enhances development experience by allowing direct integration with `astro dev`. + +- [#8655](https://github.com/withastro/astro/pull/8655) [`3dd65bf88`](https://github.com/withastro/astro/commit/3dd65bf8895faedfa4c92599961acca07457c62f) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Introduces support for local Durable Objects bindings. Enhances development experience by allowing direct integration with `astro dev`. + +- [#8655](https://github.com/withastro/astro/pull/8655) [`3dd65bf88`](https://github.com/withastro/astro/commit/3dd65bf8895faedfa4c92599961acca07457c62f) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Introduces support for local D1 bindings. Enhances development experience by allowing direct integration with `astro dev`. + +- [#8655](https://github.com/withastro/astro/pull/8655) [`3dd65bf88`](https://github.com/withastro/astro/commit/3dd65bf8895faedfa4c92599961acca07457c62f) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Introduces support for local R2 bindings. Enhances development experience by allowing direct integration with `astro dev`. + +- [#8655](https://github.com/withastro/astro/pull/8655) [`3dd65bf88`](https://github.com/withastro/astro/commit/3dd65bf8895faedfa4c92599961acca07457c62f) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Introduces support for local Caches bindings. Enhances development experience by allowing direct integration with `astro dev`. + +### Patch Changes + +- Updated dependencies [[`455af3235`](https://github.com/withastro/astro/commit/455af3235b3268852e6988accecc796f03f6d16e), [`4c2bec681`](https://github.com/withastro/astro/commit/4c2bec681b0752e7215b8a32bd2d44bf477adac1)]: + - astro@3.2.2 + - @astrojs/underscore-redirects@0.3.0 + +## 7.4.0 + +### Minor Changes + +- [#8682](https://github.com/withastro/astro/pull/8682) [`c3572fd5e`](https://github.com/withastro/astro/commit/c3572fd5e0e3864cd728f83502a52e9274793ee2) Thanks [@dario-piotrowicz](https://github.com/dario-piotrowicz)! - Change build target from `es2020` to `es2022`, for better support + +### Patch Changes + +- Updated dependencies [[`31c59ad8b`](https://github.com/withastro/astro/commit/31c59ad8b6a72f95c98a306ecf92d198c03110b4), [`47ea310f0`](https://github.com/withastro/astro/commit/47ea310f01d06ed1562c790bec348718a2fa8277), [`345808170`](https://github.com/withastro/astro/commit/345808170fce783ddd3c9a4035a91fa64dcc5f46)]: + - astro@3.2.1 + - @astrojs/underscore-redirects@0.3.0 + +## 7.3.1 + +### Patch Changes + +- [#7776](https://github.com/withastro/astro/pull/7776) [`f5c617e3a`](https://github.com/withastro/astro/commit/f5c617e3a3ed8f010ff28f0cfe0f322ad54ed6e0) Thanks [@aditsachde](https://github.com/aditsachde)! - Include generated files starting with a dot in \_routes.json + +- [#8654](https://github.com/withastro/astro/pull/8654) [`f6ba533df`](https://github.com/withastro/astro/commit/f6ba533df6861e09d39a29f6ef7a80271bbc8d0a) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Refactor codebase to enhance code readability and structure, to prioritize maintainability for long-term. + +- Updated dependencies [[`2167ffd72`](https://github.com/withastro/astro/commit/2167ffd72f58904f449ffc6e53581a2d8faf7317), [`408b50c5e`](https://github.com/withastro/astro/commit/408b50c5ea5aba66252424f54788557274a58571), [`2167ffd72`](https://github.com/withastro/astro/commit/2167ffd72f58904f449ffc6e53581a2d8faf7317), [`2167ffd72`](https://github.com/withastro/astro/commit/2167ffd72f58904f449ffc6e53581a2d8faf7317), [`2167ffd72`](https://github.com/withastro/astro/commit/2167ffd72f58904f449ffc6e53581a2d8faf7317), [`e797b6816`](https://github.com/withastro/astro/commit/e797b6816072f63f38d9a91dd2a66765c558d46c), [`824dd4670`](https://github.com/withastro/astro/commit/824dd4670a145c47337eff84a5ae412bf7443117), [`2167ffd72`](https://github.com/withastro/astro/commit/2167ffd72f58904f449ffc6e53581a2d8faf7317), [`cfd895d87`](https://github.com/withastro/astro/commit/cfd895d877fdb7fc69e745665a374fc32cb3ef7d)]: + - astro@3.2.0 + - @astrojs/underscore-redirects@0.3.0 + +## 7.3.0 + +### Minor Changes + +- [#8459](https://github.com/withastro/astro/pull/8459) [`2365c1246`](https://github.com/withastro/astro/commit/2365c124645d5067a12987f205cee23a45d1d13d) Thanks [@schummar](https://github.com/schummar)! - Adds three new config options for `_routes.json` generation: `routes.strategy`, `routes.include`, and `routes.exclude`. + +- [#8542](https://github.com/withastro/astro/pull/8542) [`faeead423`](https://github.com/withastro/astro/commit/faeead42325f378f9edac4e081eb7d6d50905136) Thanks [@adrianlyjak](https://github.com/adrianlyjak)! - Add support for loading wasm modules in the cloudflare adapter + +### Patch Changes + +- Updated dependencies [[`863f5171e`](https://github.com/withastro/astro/commit/863f5171e8e7516c9d72f2e48ea7db1dea71c4f5), [`63141f3f3`](https://github.com/withastro/astro/commit/63141f3f3e4a57d2f55ccfebd7e506ea1033a1ab), [`974d5117a`](https://github.com/withastro/astro/commit/974d5117abc8b47f8225e455b9285c88e305272f), [`cb838b84b`](https://github.com/withastro/astro/commit/cb838b84b457041b0442996f7611b04aa940a620), [`f36c4295b`](https://github.com/withastro/astro/commit/f36c4295be1ef2bcfa4aecb3c59551388419c53d), [`4c4ad9d16`](https://github.com/withastro/astro/commit/4c4ad9d167e8d15ff2c15e3336ede8ca22f646b2)]: + - astro@3.1.3 + - @astrojs/underscore-redirects@0.3.0 + +## 7.2.0 + +### Minor Changes + +- [#8595](https://github.com/withastro/astro/pull/8595) [`5b0b3c9a8`](https://github.com/withastro/astro/commit/5b0b3c9a8e0c0e6b6c7472b82008ab57985f2a04) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Add support for the following Node.js Runtime APIs, which are availabe in [Cloudflare](https://developers.cloudflare.com/workers/runtime-apis/nodejs) using the `node:` syntax. + + - assert + - AsyncLocalStorage + - Buffer + - Diagnostics Channel + - EventEmitter + - path + - process + - Streams + - StringDecoder + - util + + ```js + import { Buffer } from 'node:buffer'; + ``` + +### Patch Changes + +- Updated dependencies [[`bcad715ce`](https://github.com/withastro/astro/commit/bcad715ce67bc73a7927c941d1e7f02a82d638c2), [`bdd267d08`](https://github.com/withastro/astro/commit/bdd267d08937611984d074a2872af11ecf3e1a12), [`e522a5eb4`](https://github.com/withastro/astro/commit/e522a5eb41c7df1e62c307c84cd14d53777439ff), [`ed54d4644`](https://github.com/withastro/astro/commit/ed54d46449accc99ad117d6b0d50a8905e4d65d7), [`70f2a8003`](https://github.com/withastro/astro/commit/70f2a80039d232731f63ea735e896997ec0eac7a), [`4398e9298`](https://github.com/withastro/astro/commit/4398e929877dfadd2067af28413284afdfde9d8b), [`8f8b9069d`](https://github.com/withastro/astro/commit/8f8b9069ddd21cf57d37955ab3a92710492226f5), [`5a988eaf6`](https://github.com/withastro/astro/commit/5a988eaf609ddc1b9609acb0cdc2dda43d10a5c2)]: + - astro@3.1.2 + - @astrojs/underscore-redirects@0.3.0 + +## 7.1.1 + +### Patch Changes + +- [#8560](https://github.com/withastro/astro/pull/8560) [`3da5d8404`](https://github.com/withastro/astro/commit/3da5d8404e56a05da93f6b0a70841acda5ca1a8f) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - add the option to type environment variables using a generic + +- Updated dependencies [[`8d361169b`](https://github.com/withastro/astro/commit/8d361169b8e487933d671ce347f0ce74922c80cc), [`95b5f6280`](https://github.com/withastro/astro/commit/95b5f6280d124f8d6f866dc3286406c272ee91bf), [`0586e20e8`](https://github.com/withastro/astro/commit/0586e20e8338e077b8eb1a3a96bdd19f5950c22f)]: + - astro@3.1.1 + - @astrojs/underscore-redirects@0.3.0 + +## 7.1.0 + +### Minor Changes + +- [#8426](https://github.com/withastro/astro/pull/8426) [`2c9614469`](https://github.com/withastro/astro/commit/2c9614469674509b3e3bc21a4471a1aeb9b4141f) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Add support for Cloudflare Runtime (env vars, caches and req object), using `astro dev` + +### Patch Changes + +- Updated dependencies [[`78b82bb39`](https://github.com/withastro/astro/commit/78b82bb3929bee5d8d9bd32d65374956ddb05859), [`5e1099f68`](https://github.com/withastro/astro/commit/5e1099f686abcc7026bd4fa74727f3b311c6d6d6), [`644825845`](https://github.com/withastro/astro/commit/644825845c11c8d100a9b0d16b69a23c165c529e), [`fa77fa63d`](https://github.com/withastro/astro/commit/fa77fa63d944f709a37f08be93f0d14fe1d91188), [`23f9536de`](https://github.com/withastro/astro/commit/23f9536de0456ed2ddc9a77f7aef773ab6a8e73c), [`2db9762eb`](https://github.com/withastro/astro/commit/2db9762eb06d8a95021556c64e0cbb56c61352d5), [`435b10549`](https://github.com/withastro/astro/commit/435b10549878281ad2bb60207cb86f312a4a809f), [`a6a516d94`](https://github.com/withastro/astro/commit/a6a516d9446a50cc32fbd7201b243c63b3a4db43), [`43bc5f2a5`](https://github.com/withastro/astro/commit/43bc5f2a55173218bcfeec50242b72ae999930e2), [`0ca332ba4`](https://github.com/withastro/astro/commit/0ca332ba4ab82cc04872776398952867b0f43d33)]: + - astro@3.0.13 + - @astrojs/underscore-redirects@0.3.0 + +## 7.0.2 + +### Patch Changes + +- [#8429](https://github.com/withastro/astro/pull/8429) [`bd8aa9a99`](https://github.com/withastro/astro/commit/bd8aa9a996c8a9f9283995360fd495c291d1f766) Thanks [@sarah11918](https://github.com/sarah11918)! - Update code sample in the README to use uppercase `GET`. + +- Updated dependencies [[`7d95bd9ba`](https://github.com/withastro/astro/commit/7d95bd9baaf755239fd7d35e4813861b2dbccf42), [`1947ef7a9`](https://github.com/withastro/astro/commit/1947ef7a99ce3d1d6ea797842edd31d5edffa5de), [`61ad70fdc`](https://github.com/withastro/astro/commit/61ad70fdc52035964c43ecdb4cf7468f6c2b61e7), [`d2f2a11cd`](https://github.com/withastro/astro/commit/d2f2a11cdb42b0de79be21c798eda8e7e7b2a277), [`5126c6a40`](https://github.com/withastro/astro/commit/5126c6a40f88bff66ee5d3c3a21eea8c4a44ce7a), [`48ff7855b`](https://github.com/withastro/astro/commit/48ff7855b238536a3df17cb29335c90029fc41a4), [`923a443cb`](https://github.com/withastro/astro/commit/923a443cb060a0e936a0e1cc87c0360232f77914), [`8935b3b46`](https://github.com/withastro/astro/commit/8935b3b4672d6c54c7b79e6c4575298f75eeb9f4)]: + - astro@3.0.9 + - @astrojs/underscore-redirects@0.3.0 + +## 7.0.1 + +### Patch Changes + +- [#8346](https://github.com/withastro/astro/pull/8346) [`b74dacdb6`](https://github.com/withastro/astro/commit/b74dacdb6a49755f979f15091355f06bd6bd64bf) Thanks [@delucis](https://github.com/delucis)! - Update README + +- Updated dependencies [[`c5633434f`](https://github.com/withastro/astro/commit/c5633434f02cc477ee8da380e22efaccfa55d459), [`405ad9501`](https://github.com/withastro/astro/commit/405ad950173dadddc519cf1c2e7f2523bf5326a8), [`6b1e79814`](https://github.com/withastro/astro/commit/6b1e7981469d30aa4c3658487abed6ffea94797f)]: + - astro@3.0.7 + - @astrojs/underscore-redirects@0.3.0 + +## 7.0.0 + +### Major Changes + +- [#8188](https://github.com/withastro/astro/pull/8188) [`d0679a666`](https://github.com/withastro/astro/commit/d0679a666f37da0fca396d42b9b32bbb25d29312) Thanks [@ematipico](https://github.com/ematipico)! - Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023. + +- [#8179](https://github.com/withastro/astro/pull/8179) [`6011d52d3`](https://github.com/withastro/astro/commit/6011d52d38e43c3e3d52bc3bc41a60e36061b7b7) Thanks [@matthewp](https://github.com/matthewp)! - Astro 3.0 Release Candidate + +- [#8188](https://github.com/withastro/astro/pull/8188) [`7511a4980`](https://github.com/withastro/astro/commit/7511a4980fd36536464c317de33a5190427f430a) Thanks [@ematipico](https://github.com/ematipico)! - When using an adapter that supports neither Squoosh or Sharp, Astro will now automatically use an image service that does not support processing, but still provides the other benefits of `astro:assets` such as enforcing `alt`, no CLS etc to users + +- [#8078](https://github.com/withastro/astro/pull/8078) [`2540feedb`](https://github.com/withastro/astro/commit/2540feedb06785d5a20eecc3668849f147d778d4) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - The configuration `build.split` and `build.excludeMiddleware` are deprecated. + + You can now configure this behavior using `functionPerRoute` in your Cloudflare integration config: + + ```diff + import {defineConfig} from "astro/config"; + import cloudflare from '@astrojs/cloudflare'; + + export default defineConfig({ + - build: { + - split: true + - }, + - adapter: cloudflare() + + adapter: cloudflare({ + + mode: 'directory', + + functionPerRoute: true + + }) + }) + ``` + +### Minor Changes + +- [#8188](https://github.com/withastro/astro/pull/8188) [`cd2d7e769`](https://github.com/withastro/astro/commit/cd2d7e76981ef9b9013453aa2629838e1e9fd422) Thanks [@ematipico](https://github.com/ematipico)! - Introduced the concept of feature map. A feature map is a list of features that are built-in in Astro, and an Adapter + can tell Astro if it can support it. + + ```ts + import { AstroIntegration } from './astro'; + + function myIntegration(): AstroIntegration { + return { + name: 'astro-awesome-list', + // new feature map + supportedAstroFeatures: { + hybridOutput: 'experimental', + staticOutput: 'stable', + serverOutput: 'stable', + assets: { + supportKind: 'stable', + isSharpCompatible: false, + isSquooshCompatible: false, + }, + }, + }; + } + ``` + +### Patch Changes + +- [#8079](https://github.com/withastro/astro/pull/8079) [`7b77b34ce`](https://github.com/withastro/astro/commit/7b77b34cef8b46c4d14ecf9e5fcb45fb276331ec) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Sync Astro Asset support across both modes + +- Updated dependencies [[`d0679a666`](https://github.com/withastro/astro/commit/d0679a666f37da0fca396d42b9b32bbb25d29312), [`db39206cb`](https://github.com/withastro/astro/commit/db39206cbb85b034859ac416179f141184bb2bff), [`adf9fccfd`](https://github.com/withastro/astro/commit/adf9fccfdda107c2224558f1c2e6a77847ac0a8a), [`0c7b42dc6`](https://github.com/withastro/astro/commit/0c7b42dc6780e687e416137539f55a3a427d1d10), [`46c4c0e05`](https://github.com/withastro/astro/commit/46c4c0e053f830585b9ef229ce1c259df00a80f8), [`364d861bd`](https://github.com/withastro/astro/commit/364d861bd527b8511968e2837728148f090bedef), [`2484dc408`](https://github.com/withastro/astro/commit/2484dc4080e5cd84b9a53648a1de426d7c907be2), [`81545197a`](https://github.com/withastro/astro/commit/81545197a32fd015d763fc386c8b67e0e08b7393), [`6011d52d3`](https://github.com/withastro/astro/commit/6011d52d38e43c3e3d52bc3bc41a60e36061b7b7), [`c2c71d90c`](https://github.com/withastro/astro/commit/c2c71d90c264a2524f99e0373ab59015f23ad4b1), [`cd2d7e769`](https://github.com/withastro/astro/commit/cd2d7e76981ef9b9013453aa2629838e1e9fd422), [`80f1494cd`](https://github.com/withastro/astro/commit/80f1494cdaf72e58a420adb4f7c712d4089e1923), [`e45f30293`](https://github.com/withastro/astro/commit/e45f3029340db718b6ed7e91b5d14f5cf14cd71d), [`c0de7a7b0`](https://github.com/withastro/astro/commit/c0de7a7b0f042cd49cbea4f4ac1b2ab6f9fef644), [`65c354969`](https://github.com/withastro/astro/commit/65c354969e6fe0ef6d622e8f4c545e2f717ce8c6), [`3c3100851`](https://github.com/withastro/astro/commit/3c31008519ce68b5b1b1cb23b71fbe0a2d506882), [`34cb20021`](https://github.com/withastro/astro/commit/34cb2002161ba88df6bcb72fecfd12ed867c134b), [`a824863ab`](https://github.com/withastro/astro/commit/a824863ab1c451f4068eac54f28dd240573e1cba), [`44f7a2872`](https://github.com/withastro/astro/commit/44f7a28728c56c04ac377b6e917329f324874043), [`1048aca55`](https://github.com/withastro/astro/commit/1048aca550769415e528016e42b358ffbfd44b61), [`be6bbd2c8`](https://github.com/withastro/astro/commit/be6bbd2c86b9bf5268e765bb937dda00ff15781a), [`9e021a91c`](https://github.com/withastro/astro/commit/9e021a91c57d10809f588dd47968fc0e7f8b4d5c), [`7511a4980`](https://github.com/withastro/astro/commit/7511a4980fd36536464c317de33a5190427f430a), [`c37632a20`](https://github.com/withastro/astro/commit/c37632a20d06164fb97a4c2fc48df6d960398832), [`acf652fc1`](https://github.com/withastro/astro/commit/acf652fc1d5db166231e87e22d0d50444f5556d8), [`42785c7b7`](https://github.com/withastro/astro/commit/42785c7b784b151e6d582570e5d74482129e8eb8), [`8450379db`](https://github.com/withastro/astro/commit/8450379db854fb1eaa9f38f21d65db240bc616cd), [`dbc97b121`](https://github.com/withastro/astro/commit/dbc97b121f42583728f1cdfdbf14575fda943f5b), [`7d2f311d4`](https://github.com/withastro/astro/commit/7d2f311d428e3d1c8c13b9bf2a708d6435713fc2), [`2540feedb`](https://github.com/withastro/astro/commit/2540feedb06785d5a20eecc3668849f147d778d4), [`ea7ff5177`](https://github.com/withastro/astro/commit/ea7ff5177dbcd7b2508cb1eef1b22b8ee1f47079), [`68efd4a8b`](https://github.com/withastro/astro/commit/68efd4a8b29f248397667801465b3152dc98e9a7), [`7bd1b86f8`](https://github.com/withastro/astro/commit/7bd1b86f85c06fdde0a1ed9146d01bac69990671), [`036388f66`](https://github.com/withastro/astro/commit/036388f66dab68ad54b895ed86f9176958dd83c8), [`519a1c4e8`](https://github.com/withastro/astro/commit/519a1c4e8407c7abcb8d879b67a9f4b960652cae), [`1f58a7a1b`](https://github.com/withastro/astro/commit/1f58a7a1bea6888868b689dac94801d554319b02), [`2ae9d37f0`](https://github.com/withastro/astro/commit/2ae9d37f0a9cb21ab288d3c30aecb6d84db87788), [`a8f35777e`](https://github.com/withastro/astro/commit/a8f35777e7e322068a4e2f520c2c9e43ade19e58), [`70f34f5a3`](https://github.com/withastro/astro/commit/70f34f5a355f42526ee9e5355f3de8e510002ea2), [`5208a3c8f`](https://github.com/withastro/astro/commit/5208a3c8fefcec7694857fb344af351f4631fc34), [`84af8ed9d`](https://github.com/withastro/astro/commit/84af8ed9d1e6401c6ebc9c60fe8cddb44d5044b0), [`f003e7364`](https://github.com/withastro/astro/commit/f003e7364317cafdb8589913b26b28e928dd07c9), [`ffc9e2d3d`](https://github.com/withastro/astro/commit/ffc9e2d3de46049bf3d82140ef018f524fb03187), [`732111cdc`](https://github.com/withastro/astro/commit/732111cdce441639db31f40f621df48442d00969), [`0f637c71e`](https://github.com/withastro/astro/commit/0f637c71e511cb4c51712128d217a26c8eee4d40), [`33b8910cf`](https://github.com/withastro/astro/commit/33b8910cfdce5713891c50a84a0a8fe926311710), [`8a5b0c1f3`](https://github.com/withastro/astro/commit/8a5b0c1f3a4be6bb62db66ec70144109ff5b4c59), [`148e61d24`](https://github.com/withastro/astro/commit/148e61d2492456811f8a3c8daaab1c3429a2ffdc), [`e79e3779d`](https://github.com/withastro/astro/commit/e79e3779df0ad35253abcdb931d622847d9adb12), [`632579dc2`](https://github.com/withastro/astro/commit/632579dc2094cc342929261c89e689f0dd358284), [`3674584e0`](https://github.com/withastro/astro/commit/3674584e02b161a698b429ceb66723918fdc56ac), [`1db4e92c1`](https://github.com/withastro/astro/commit/1db4e92c12ed73681217f5cefd39f2f47542f961), [`e7f872e91`](https://github.com/withastro/astro/commit/e7f872e91e852b901cf221a5151077dec64305bf), [`16f09dfff`](https://github.com/withastro/astro/commit/16f09dfff7722fda99dd0412e3006a7a39c80829), [`4477bb41c`](https://github.com/withastro/astro/commit/4477bb41c8ed688785c545731ef5b184b629f4e5), [`55c10d1d5`](https://github.com/withastro/astro/commit/55c10d1d564e805efc3c1a7c48e0d9a1cdf0c7ed), [`3e834293d`](https://github.com/withastro/astro/commit/3e834293d47ab2761a7aa013916e8371871efb7f), [`96beb883a`](https://github.com/withastro/astro/commit/96beb883ad87f8bbf5b2f57e14a743763d2a6f58), [`997a0db8a`](https://github.com/withastro/astro/commit/997a0db8a4e3851edd69384cf5eadbb969e1d547), [`80f1494cd`](https://github.com/withastro/astro/commit/80f1494cdaf72e58a420adb4f7c712d4089e1923), [`0f0625504`](https://github.com/withastro/astro/commit/0f0625504145f18cba7dc6cf20291cb2abddc5a9), [`e1ae56e72`](https://github.com/withastro/astro/commit/e1ae56e724d0f83db1230359e06cd6bc26f5fa26), [`f32d093a2`](https://github.com/withastro/astro/commit/f32d093a280faafff024228c12bb438156ec34d7), [`f01eb585e`](https://github.com/withastro/astro/commit/f01eb585e7c972d940761309b1595f682b6922d2), [`b76c166bd`](https://github.com/withastro/astro/commit/b76c166bdd8e28683f62806aef968d1e0c3b06d9), [`a87cbe400`](https://github.com/withastro/astro/commit/a87cbe400314341d5f72abf86ea264e6b47c091f), [`866ed4098`](https://github.com/withastro/astro/commit/866ed4098edffb052239cdb26e076cf8db61b1d9), [`767eb6866`](https://github.com/withastro/astro/commit/767eb68666eb777965baa0d6ade20bbafecf95bf), [`32669cd47`](https://github.com/withastro/astro/commit/32669cd47555e9c7433c3998a2b6e624dfb2d8e9)]: + - astro@3.0.0 + - @astrojs/underscore-redirects@0.3.0 + +## 7.0.0-rc.3 + +### Major Changes + +- [#8179](https://github.com/withastro/astro/pull/8179) [`6011d52d3`](https://github.com/withastro/astro/commit/6011d52d38e43c3e3d52bc3bc41a60e36061b7b7) Thanks [@matthewp](https://github.com/matthewp)! - Astro 3.0 Release Candidate + +### Patch Changes + +- Updated dependencies [[`adf9fccfd`](https://github.com/withastro/astro/commit/adf9fccfdda107c2224558f1c2e6a77847ac0a8a), [`582132328`](https://github.com/withastro/astro/commit/5821323285646aee7ff9194a505f708028e4db57), [`81545197a`](https://github.com/withastro/astro/commit/81545197a32fd015d763fc386c8b67e0e08b7393), [`6011d52d3`](https://github.com/withastro/astro/commit/6011d52d38e43c3e3d52bc3bc41a60e36061b7b7), [`be6bbd2c8`](https://github.com/withastro/astro/commit/be6bbd2c86b9bf5268e765bb937dda00ff15781a), [`42785c7b7`](https://github.com/withastro/astro/commit/42785c7b784b151e6d582570e5d74482129e8eb8), [`95120efbe`](https://github.com/withastro/astro/commit/95120efbe817163663492181cbeb225849354493), [`2ae9d37f0`](https://github.com/withastro/astro/commit/2ae9d37f0a9cb21ab288d3c30aecb6d84db87788), [`f003e7364`](https://github.com/withastro/astro/commit/f003e7364317cafdb8589913b26b28e928dd07c9), [`732111cdc`](https://github.com/withastro/astro/commit/732111cdce441639db31f40f621df48442d00969), [`33b8910cf`](https://github.com/withastro/astro/commit/33b8910cfdce5713891c50a84a0a8fe926311710), [`e79e3779d`](https://github.com/withastro/astro/commit/e79e3779df0ad35253abcdb931d622847d9adb12), [`179796405`](https://github.com/withastro/astro/commit/179796405e053b559d83f84507e5a465861a029a), [`a87cbe400`](https://github.com/withastro/astro/commit/a87cbe400314341d5f72abf86ea264e6b47c091f), [`767eb6866`](https://github.com/withastro/astro/commit/767eb68666eb777965baa0d6ade20bbafecf95bf)]: + - astro@3.0.0-rc.5 + - @astrojs/underscore-redirects@0.3.0-rc.1 + +## 7.0.0-beta.2 + +### Major Changes + +- [#8078](https://github.com/withastro/astro/pull/8078) [`2540feedb`](https://github.com/withastro/astro/commit/2540feedb06785d5a20eecc3668849f147d778d4) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - The configuration `build.split` and `build.excludeMiddleware` are deprecated. + + You can now configure this behavior using `functionPerRoute` in your Cloudflare integration config: + + ```diff + import {defineConfig} from "astro/config"; + import cloudflare from '@astrojs/cloudflare'; + + export default defineConfig({ + - build: { + - split: true + - }, + - adapter: cloudflare() + + adapter: cloudflare({ + + mode: 'directory', + + functionPerRoute: true + + }) + }) + ``` + +### Patch Changes + +- [#8079](https://github.com/withastro/astro/pull/8079) [`7b77b34ce`](https://github.com/withastro/astro/commit/7b77b34cef8b46c4d14ecf9e5fcb45fb276331ec) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Sync Astro Asset support across both modes + +- Updated dependencies [[`2484dc408`](https://github.com/withastro/astro/commit/2484dc4080e5cd84b9a53648a1de426d7c907be2), [`c2c71d90c`](https://github.com/withastro/astro/commit/c2c71d90c264a2524f99e0373ab59015f23ad4b1), [`7177f7579`](https://github.com/withastro/astro/commit/7177f7579b6e866f0fd895b3fd079d8ba330b1a9), [`097a8e4e9`](https://github.com/withastro/astro/commit/097a8e4e916c7df18eafdaa6c8d6ce2991c17ab6), [`dbc97b121`](https://github.com/withastro/astro/commit/dbc97b121f42583728f1cdfdbf14575fda943f5b), [`2540feedb`](https://github.com/withastro/astro/commit/2540feedb06785d5a20eecc3668849f147d778d4), [`ea7ff5177`](https://github.com/withastro/astro/commit/ea7ff5177dbcd7b2508cb1eef1b22b8ee1f47079), [`68efd4a8b`](https://github.com/withastro/astro/commit/68efd4a8b29f248397667801465b3152dc98e9a7), [`0e0fa605d`](https://github.com/withastro/astro/commit/0e0fa605d109cc91e08a1ae1cc560ea240fe631b), [`5208a3c8f`](https://github.com/withastro/astro/commit/5208a3c8fefcec7694857fb344af351f4631fc34), [`8a5b0c1f3`](https://github.com/withastro/astro/commit/8a5b0c1f3a4be6bb62db66ec70144109ff5b4c59), [`d6b494376`](https://github.com/withastro/astro/commit/d6b4943764989c0e89df2d6875cd19691566dfb3), [`4477bb41c`](https://github.com/withastro/astro/commit/4477bb41c8ed688785c545731ef5b184b629f4e5), [`3e834293d`](https://github.com/withastro/astro/commit/3e834293d47ab2761a7aa013916e8371871efb7f), [`b76c166bd`](https://github.com/withastro/astro/commit/b76c166bdd8e28683f62806aef968d1e0c3b06d9)]: + - astro@3.0.0-beta.3 + - @astrojs/underscore-redirects@0.3.0-beta.0 + +## 7.0.0-beta.1 + +### Minor Changes + +- [#7846](https://github.com/withastro/astro/pull/7846) [`ea30a9d4f`](https://github.com/withastro/astro/commit/ea30a9d4f2d7a12345869e971f3051cf803dbe74) Thanks [@schummar](https://github.com/schummar)! - More efficient \_routes.json + +### Patch Changes + +- Updated dependencies [[`65c354969`](https://github.com/withastro/astro/commit/65c354969e6fe0ef6d622e8f4c545e2f717ce8c6), [`3c3100851`](https://github.com/withastro/astro/commit/3c31008519ce68b5b1b1cb23b71fbe0a2d506882), [`34cb20021`](https://github.com/withastro/astro/commit/34cb2002161ba88df6bcb72fecfd12ed867c134b), [`7bd1b86f8`](https://github.com/withastro/astro/commit/7bd1b86f85c06fdde0a1ed9146d01bac69990671), [`519a1c4e8`](https://github.com/withastro/astro/commit/519a1c4e8407c7abcb8d879b67a9f4b960652cae), [`70f34f5a3`](https://github.com/withastro/astro/commit/70f34f5a355f42526ee9e5355f3de8e510002ea2), [`0f637c71e`](https://github.com/withastro/astro/commit/0f637c71e511cb4c51712128d217a26c8eee4d40), [`866ed4098`](https://github.com/withastro/astro/commit/866ed4098edffb052239cdb26e076cf8db61b1d9), [`5b1e39ef6`](https://github.com/withastro/astro/commit/5b1e39ef6ec6dcebea96584f95d9530bd9aa715d)]: + - astro@3.0.0-beta.1 + - @astrojs/underscore-redirects@0.3.0-beta.0 + +## 7.0.0-beta.0 + +### Major Changes + +- [`1eae2e3f7`](https://github.com/withastro/astro/commit/1eae2e3f7d693c9dfe91c8ccfbe606d32bf2fb81) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023. + +- [`c022a4217`](https://github.com/withastro/astro/commit/c022a4217a805d223c1494e9eda4e48bbf810388) Thanks [@Princesseuh](https://github.com/Princesseuh)! - When using an adapter that supports neither Squoosh or Sharp, Astro will now automatically use an image service that does not support processing, but still provides the other benefits of `astro:assets` such as enforcing `alt`, no CLS etc to users + +### Minor Changes + +- [`9b4f70a62`](https://github.com/withastro/astro/commit/9b4f70a629f55e461759ba46f68af7097a2e9215) Thanks [@ematipico](https://github.com/ematipico)! - Introduced the concept of feature map. A feature map is a list of features that are built-in in Astro, and an Adapter + can tell Astro if it can support it. + + ```ts + import { AstroIntegration } from './astro'; + + function myIntegration(): AstroIntegration { + return { + name: 'astro-awesome-list', + // new feature map + supportedAstroFeatures: { + hybridOutput: 'experimental', + staticOutput: 'stable', + serverOutput: 'stable', + assets: { + supportKind: 'stable', + isSharpCompatible: false, + isSquooshCompatible: false, + }, + }, + }; + } + ``` + +### Patch Changes + +- Updated dependencies [[`1eae2e3f7`](https://github.com/withastro/astro/commit/1eae2e3f7d693c9dfe91c8ccfbe606d32bf2fb81), [`76ddef19c`](https://github.com/withastro/astro/commit/76ddef19ccab6e5f7d3a5740cd41acf10e334b38), [`9b4f70a62`](https://github.com/withastro/astro/commit/9b4f70a629f55e461759ba46f68af7097a2e9215), [`3fdf509b2`](https://github.com/withastro/astro/commit/3fdf509b2731a9b2f972d89291e57cf78d62c769), [`2f951cd40`](https://github.com/withastro/astro/commit/2f951cd403dfcc2c3ca6aae618ae3e1409516e32), [`c022a4217`](https://github.com/withastro/astro/commit/c022a4217a805d223c1494e9eda4e48bbf810388), [`67becaa58`](https://github.com/withastro/astro/commit/67becaa580b8f787df58de66b7008b7098f1209c), [`bc37331d8`](https://github.com/withastro/astro/commit/bc37331d8154e3e95a8df9131e4e014e78a7a9e7), [`dfc2d93e3`](https://github.com/withastro/astro/commit/dfc2d93e3c645995379358fabbdfa9aab99f43d8), [`3dc1ca2fa`](https://github.com/withastro/astro/commit/3dc1ca2fac8d9965cc5085a5d09e72ed87b4281a), [`1be84dfee`](https://github.com/withastro/astro/commit/1be84dfee3ce8e6f5cc624f99aec4e980f6fde37), [`35f01df79`](https://github.com/withastro/astro/commit/35f01df797d23315f2bee2fc3fd795adb0559c58), [`3fdf509b2`](https://github.com/withastro/astro/commit/3fdf509b2731a9b2f972d89291e57cf78d62c769), [`78de801f2`](https://github.com/withastro/astro/commit/78de801f21fd4ca1653950027d953bf08614566b), [`59d6e569f`](https://github.com/withastro/astro/commit/59d6e569f63e175c97e82e94aa7974febfb76f7c), [`7723c4cc9`](https://github.com/withastro/astro/commit/7723c4cc93298c2e6530e55da7afda048f22cf81), [`fb5cd6b56`](https://github.com/withastro/astro/commit/fb5cd6b56dc27a71366ed5e1ab8bfe9b8f96bac5), [`631b9c410`](https://github.com/withastro/astro/commit/631b9c410d5d66fa384674027ba95d69ebb5063f)]: + - astro@3.0.0-beta.0 + - @astrojs/underscore-redirects@0.3.0-beta.0 + +## 6.8.1 + +### Patch Changes + +- [#8190](https://github.com/withastro/astro/pull/8190) [`0be8d9bfa`](https://github.com/withastro/astro/commit/0be8d9bfa9fa811c4b7e15c4ffd2d37c93f856fe) Thanks [@ematipico](https://github.com/ematipico)! - Improve documentation and export the types needed to type the `runtime` object. + +- Updated dependencies [[`52606a390`](https://github.com/withastro/astro/commit/52606a3909f9de5ced9b9ba3ba25832f73a8689e)]: + - astro@2.10.14 + +## 6.8.0 + +### Minor Changes + +- [#7541](https://github.com/withastro/astro/pull/7541) [`ffcfcddb7`](https://github.com/withastro/astro/commit/ffcfcddb7575030d62b4ef979d46a74425e6d3fe) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - The `getRuntime` utility has been deprecated and should be updated to the new [`Astro.locals`](https://docs.astro.build/en/guides/middleware/#locals) API. + + ```diff + - import { getRuntime } from '@astrojs/cloudflare/runtime'; + - getRuntime(Astro.request); + + + const runtime = Astro.locals.runtime; + ``` + +### Patch Changes + +- Updated dependencies [[`1b8d30209`](https://github.com/withastro/astro/commit/1b8d3020990130dabfaaf753db73a32c6e0c896a), [`405913cdf`](https://github.com/withastro/astro/commit/405913cdf20b26407aa351c090f0a0859a4e6f54), [`87d4b1843`](https://github.com/withastro/astro/commit/87d4b18437c7565c48cad4bea81831c2a244ebb8), [`c23377caa`](https://github.com/withastro/astro/commit/c23377caafbc75deb91c33b9678c1b6868ad40ea), [`86bee2812`](https://github.com/withastro/astro/commit/86bee2812185df6e14025e5962a335f51853587b)]: + - astro@2.10.6 + +## 6.7.0 + +### Minor Changes + +- [#7846](https://github.com/withastro/astro/pull/7846) [`ea30a9d4f`](https://github.com/withastro/astro/commit/ea30a9d4f2d7a12345869e971f3051cf803dbe74) Thanks [@schummar](https://github.com/schummar)! - More efficient \_routes.json + +### Patch Changes + +- Updated dependencies [[`5b1e39ef6`](https://github.com/withastro/astro/commit/5b1e39ef6ec6dcebea96584f95d9530bd9aa715d)]: + - astro@2.10.5 + +## 6.6.2 + +### Patch Changes + +- [#7568](https://github.com/withastro/astro/pull/7568) [`6ec040761`](https://github.com/withastro/astro/commit/6ec040761ef657df0e0f5ac103788da4b98fa688) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fix a bug where asset redirects caused Cloudflare error + +- [#7679](https://github.com/withastro/astro/pull/7679) [`1a6f833c4`](https://github.com/withastro/astro/commit/1a6f833c404ba2e64e3497929b64c863b5a348c8) Thanks [@bluwy](https://github.com/bluwy)! - Fix runtime env var handling + +- [#7568](https://github.com/withastro/astro/pull/7568) [`6ec040761`](https://github.com/withastro/astro/commit/6ec040761ef657df0e0f5ac103788da4b98fa688) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Fix bug where `.ts` files are not renamed to `.js` + +- Updated dependencies [[`cc8e9de88`](https://github.com/withastro/astro/commit/cc8e9de88179d2ed4b70980c60b41448db393429), [`1a6f833c4`](https://github.com/withastro/astro/commit/1a6f833c404ba2e64e3497929b64c863b5a348c8), [`cc0f81c04`](https://github.com/withastro/astro/commit/cc0f81c040e912cff0c09e89327ef1655f96b67d)]: + - astro@2.8.4 + +## 6.6.1 + +### Patch Changes + +- Updated dependencies [[`f21357b69`](https://github.com/withastro/astro/commit/f21357b69d94fe8d81f267efddb182d1a3cc678a), [`86e19c7cf`](https://github.com/withastro/astro/commit/86e19c7cf8696e065c1ccdc2eb841ad0a2b61ede)]: + - @astrojs/underscore-redirects@0.2.0 + - astro@2.8.2 + +## 6.6.0 + +### Minor Changes + +- [#7464](https://github.com/withastro/astro/pull/7464) [`1a59185dd`](https://github.com/withastro/astro/commit/1a59185ddd393bf8894ec0c981b26d6fecdb3c67) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Split Support in Cloudflare + + Adds support for configuring `build.split` when using the Cloudflare adapter + +### Patch Changes + +- Updated dependencies [[`9e2426f75`](https://github.com/withastro/astro/commit/9e2426f75637a6318961f483de90b635f3fdadeb), [`cdc28326c`](https://github.com/withastro/astro/commit/cdc28326cf21f305924363e9c8c02ce54b6ff895), [`19c2d43ea`](https://github.com/withastro/astro/commit/19c2d43ea41efdd8741007de0774e7e394f174b0), [`2172dd4f0`](https://github.com/withastro/astro/commit/2172dd4f0dd8f87d1adbc5ae90f44724e66eb964), [`1170877b5`](https://github.com/withastro/astro/commit/1170877b51aaa13203e8c488dcf4e39d1b5553ee)]: + - astro@2.7.3 + +## 6.5.1 + +### Patch Changes + +- [#7419](https://github.com/withastro/astro/pull/7419) [`94afaa3e5`](https://github.com/withastro/astro/commit/94afaa3e501f77e919c719937eb1dbfe170e3dc9) Thanks [@TorbjornHoltmon](https://github.com/TorbjornHoltmon)! - Fixed issue with cloudflare runtime `waitUntil` not working as intended. + +- Updated dependencies [[`2b34fc492`](https://github.com/withastro/astro/commit/2b34fc49282cbf5bf89de46359b51a67a5c4b8bb), [`89a483520`](https://github.com/withastro/astro/commit/89a4835202f05d9571aeb42740dbe907a8afc28b)]: + - astro@2.6.6 + +## 6.5.0 + +### Minor Changes + +- [#7386](https://github.com/withastro/astro/pull/7386) [`6d8aa4b61`](https://github.com/withastro/astro/commit/6d8aa4b61f22df2c5052d06dac8e53bbce73f5f5) Thanks [@beynar](https://github.com/beynar)! - Expose cf metadata and Cloudflare Worker Cache API through `caches` in runtime. + +### Patch Changes + +- Updated dependencies [[`42baf62e7`](https://github.com/withastro/astro/commit/42baf62e7ca0351a2f2c7d06ec58086f90519bb7), [`1c7b63595`](https://github.com/withastro/astro/commit/1c7b6359563f5e83325121efb2e61915d818a35a)]: + - astro@2.6.4 + +## 6.4.0 + +### Minor Changes + +- [#7067](https://github.com/withastro/astro/pull/7067) [`57f8d14c0`](https://github.com/withastro/astro/commit/57f8d14c027c30919363e12c664ccff4ed64d0fc) Thanks [@matthewp](https://github.com/matthewp)! - Support for experimental redirects + + This adds support for the redirects RFC in the Cloudflare adapter. No changes are necessary, simply use configured redirects and the adapter will update your `_redirects` file. + +### Patch Changes + +- [#7260](https://github.com/withastro/astro/pull/7260) [`39403c32f`](https://github.com/withastro/astro/commit/39403c32faea58399c61d3344b770f195be60d5b) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Unflags support for `output: 'hybrid'` mode, which enables pre-rendering by default. The additional `experimental.hybridOutput` flag can be safely removed from your configuration. + +- Updated dependencies [[`57f8d14c0`](https://github.com/withastro/astro/commit/57f8d14c027c30919363e12c664ccff4ed64d0fc), [`414eb19d2`](https://github.com/withastro/astro/commit/414eb19d2fcb55758f9d053076773b11b62f4c97), [`a7e2b37ff`](https://github.com/withastro/astro/commit/a7e2b37ff73871c46895c615846a86a539f45330), [`dd1a6b6c9`](https://github.com/withastro/astro/commit/dd1a6b6c941aeb7af934bd12db22412af262f5a1), [`d72cfa7ca`](https://github.com/withastro/astro/commit/d72cfa7cad758192163712ceb269405659fd14bc), [`144813f73`](https://github.com/withastro/astro/commit/144813f7308dcb9de64ebe3f0f2c6cba9ad81eb1), [`b5213654b`](https://github.com/withastro/astro/commit/b5213654b1b7f3ba573a48d3be688b2bdde7870f), [`e3b8c6296`](https://github.com/withastro/astro/commit/e3b8c62969d680d1915a122c610d281d6711aa63), [`890a2bc98`](https://github.com/withastro/astro/commit/890a2bc9891a2449ab99b01b65468f6dddba6b12), [`39403c32f`](https://github.com/withastro/astro/commit/39403c32faea58399c61d3344b770f195be60d5b), [`101f03209`](https://github.com/withastro/astro/commit/101f032098148b3daaac8d46ff1e535b79232e43)]: + - astro@2.6.0 + +## 6.3.0 + +### Minor Changes + +- [#7092](https://github.com/withastro/astro/pull/7092) [`2a1fa09b3`](https://github.com/withastro/astro/commit/2a1fa09b3199ae35801dd0d02ae293198d9a7382) Thanks [@johannesspohr](https://github.com/johannesspohr)! - Add `worked` and `worker` import condition for worker bundling + +### Patch Changes + +- [#6991](https://github.com/withastro/astro/pull/6991) [`719002ca5`](https://github.com/withastro/astro/commit/719002ca5b128744fb4316d4a52c5dcd46a42759) Thanks [@MoustaphaDev](https://github.com/MoustaphaDev)! - Enable experimental support for hybrid SSR with pre-rendering enabled by default + + **astro.config.mjs** + + ```js + import { defineConfig } from 'astro/config'; + export defaultdefineConfig({ + output: 'hybrid', + experimental: { + hybridOutput: true, + }, + }) + ``` + + Then add `export const prerender = false` to any page or endpoint you want to opt-out of pre-rendering. + + **src/pages/contact.astro** + + ```astro + --- + export const prerender = false; + + if (Astro.request.method === 'POST') { + // handle form submission + } + --- + +
+ + + +
+ ``` + +- [#7101](https://github.com/withastro/astro/pull/7101) [`2994bc52d`](https://github.com/withastro/astro/commit/2994bc52d360bf7ca3681c5f6976e64577cf5209) Thanks [@bluwy](https://github.com/bluwy)! - Always build edge/worker runtime with Vite `webworker` SSR target + +- [#7104](https://github.com/withastro/astro/pull/7104) [`826e02890`](https://github.com/withastro/astro/commit/826e0289005f645b902375b98d5549c6a95ccafa) Thanks [@bluwy](https://github.com/bluwy)! - Specify `"files"` field to only publish necessary files + +- Updated dependencies [[`4516d7b22`](https://github.com/withastro/astro/commit/4516d7b22c5979cde4537f196b53ae2826ba9561), [`e186ecc5e`](https://github.com/withastro/astro/commit/e186ecc5e292de8c6a2c441a2d588512c0813068), [`c6d7ebefd`](https://github.com/withastro/astro/commit/c6d7ebefdd554a9ef29cfeb426ac55cab80d6473), [`914c439bc`](https://github.com/withastro/astro/commit/914c439bccee9fec002c6d92beaa501c398e62ac), [`e9fc2c221`](https://github.com/withastro/astro/commit/e9fc2c2213036d47cd30a47a6cdad5633481a0f8), [`075eee08f`](https://github.com/withastro/astro/commit/075eee08f2e2b0baea008b97f3523f2cb937ee44), [`719002ca5`](https://github.com/withastro/astro/commit/719002ca5b128744fb4316d4a52c5dcd46a42759), [`fc52681ba`](https://github.com/withastro/astro/commit/fc52681ba2f8fe8bcd92eeedf3c6a52fd86a390e), [`fb84622af`](https://github.com/withastro/astro/commit/fb84622af04f795de8d17f24192de105f70fe910), [`cada10a46`](https://github.com/withastro/astro/commit/cada10a466f81f8edb0aa664f9cffdb6b5b8f307), [`cd410c5eb`](https://github.com/withastro/astro/commit/cd410c5eb71f825259279c27c4c39d0ad282c3f0), [`73ec6f6c1`](https://github.com/withastro/astro/commit/73ec6f6c16cadb71dafe9f664f0debde072c3173), [`410428672`](https://github.com/withastro/astro/commit/410428672ed97bba7ca0b3352c1a7ee564921462), [`763ff2d1e`](https://github.com/withastro/astro/commit/763ff2d1e44f54b899d7c65386f1b4b877c95737), [`c1669c001`](https://github.com/withastro/astro/commit/c1669c0011eecfe65a459d727848c18c189a54ca), [`3d525efc9`](https://github.com/withastro/astro/commit/3d525efc95cfb2deb5d9e04856d02965d66901c9)]: + - astro@2.5.0 + +## 6.2.4 + +### Patch Changes + +- [#6925](https://github.com/withastro/astro/pull/6925) [`d11d18595`](https://github.com/withastro/astro/commit/d11d1859518f9fdc94390aab9be29f8667bb27cb) Thanks [@Yan-Thomas](https://github.com/Yan-Thomas)! - Fix missing code language in Cloudflare README + +- Updated dependencies [[`a98df9374`](https://github.com/withastro/astro/commit/a98df9374dec65c678fa47319cb1481b1af123e2), [`50975f2ea`](https://github.com/withastro/astro/commit/50975f2ea3a59f9e023cc631a9372c0c7986eec9), [`ebae1eaf8`](https://github.com/withastro/astro/commit/ebae1eaf87f49399036033c673b513338f7d9c42), [`dc062f669`](https://github.com/withastro/astro/commit/dc062f6695ce577dc569781fc0678c903012c336)]: + - astro@2.3.3 + +## 6.2.3 + +### Patch Changes + +- [#6222](https://github.com/withastro/astro/pull/6222) [`081b2402c`](https://github.com/withastro/astro/commit/081b2402cfb48b5eb8dbd02664d8af2f7c798edf) Thanks [@AirBorne04](https://github.com/AirBorne04)! - add option to compile unminified code + +- Updated dependencies [[`b89042553`](https://github.com/withastro/astro/commit/b89042553ec45d5f6bc71747e0f3470ba969e679)]: + - astro@2.3.2 + +## 6.2.2 + +### Patch Changes + +- [#6550](https://github.com/withastro/astro/pull/6550) [`2c829fdf6`](https://github.com/withastro/astro/commit/2c829fdf65bcb91485837c9cfb5a3b453c6fccc7) Thanks [@RichiCoder1](https://github.com/RichiCoder1)! - fix `config.base` trimming logic for cloudflare integration `_routes.json` generation + +- Updated dependencies [[`04dddd783`](https://github.com/withastro/astro/commit/04dddd783da3235aa9ed523d2856adf86b792b5f), [`ea9b3dd72`](https://github.com/withastro/astro/commit/ea9b3dd72b98b3f5a542ca24a275f673faa6c7c5), [`bf024cb34`](https://github.com/withastro/astro/commit/bf024cb3429c5929d98378108230bc946a376b17), [`22955b895`](https://github.com/withastro/astro/commit/22955b895ce4343e282355db64b3a5c1415f3944), [`f413446a8`](https://github.com/withastro/astro/commit/f413446a859e497395b3612e44d1540cc6b9dad7), [`90e5f87d0`](https://github.com/withastro/astro/commit/90e5f87d03215a833bb6ac91f9548670a25ce659), [`388190102`](https://github.com/withastro/astro/commit/3881901028cbb586f5a4de1b4953e2d6730458ab), [`035c0c4df`](https://github.com/withastro/astro/commit/035c0c4df2a623bcc2f2a1cb9e490df35fa29adc), [`f112c12b1`](https://github.com/withastro/astro/commit/f112c12b15dfbb278d66699f54809674dd1bded0), [`689884251`](https://github.com/withastro/astro/commit/68988425119255382f94c983796574050006f003), [`fa132e35c`](https://github.com/withastro/astro/commit/fa132e35c23f2cfe368fd0a7239584a2bc5c4f12), [`f5fddafc2`](https://github.com/withastro/astro/commit/f5fddafc248bb1ef57b7349bfecc25539ae2b5ea), [`283734525`](https://github.com/withastro/astro/commit/28373452503bc6ca88221ffd39a5590e015e4d71), [`66858f1f2`](https://github.com/withastro/astro/commit/66858f1f238a0edf6ded2b0f693bc738785d5aa3), [`6c465e958`](https://github.com/withastro/astro/commit/6c465e958e088ff55e5b895e67c64c0dfd4277a6)]: + - astro@2.1.4 + +## 6.2.1 + +### Patch Changes + +- [#6531](https://github.com/withastro/astro/pull/6531) [`4ddf34893`](https://github.com/withastro/astro/commit/4ddf3489384ed53f25df190a3478da44bd38600e) Thanks [@matthewp](https://github.com/matthewp)! - Remove false-positive warnings from Cloudflare's build. + + Cloudflare includes warnings when it bundles the already-built output from astro.build. Those warnings are mostly due to `"sideEffects": false` packages that are included in the Vite built output because they are marked as external. Rollup will remove unused imports from these packages but will not remove the actual import, causing the false-positive warning. + +- [#6473](https://github.com/withastro/astro/pull/6473) [`1c3e8f6c3`](https://github.com/withastro/astro/commit/1c3e8f6c3b839087aa51de2e2fb665cd907f2847) Thanks [@RichiCoder1](https://github.com/RichiCoder1)! - fix automatic routes generation not respecting config.base + +- [#6494](https://github.com/withastro/astro/pull/6494) [`a13e9d7e3`](https://github.com/withastro/astro/commit/a13e9d7e33baccf51e7d4815f99b481ad174bc57) Thanks [@Yan-Thomas](https://github.com/Yan-Thomas)! - Consistency improvements to several package descriptions + +- Updated dependencies [[`acf78c5e2`](https://github.com/withastro/astro/commit/acf78c5e271ec3d4f589782078e2a2044cc1c391), [`04e624d06`](https://github.com/withastro/astro/commit/04e624d062c6ce385f6293afba26f3942c2290c6), [`cc90d7219`](https://github.com/withastro/astro/commit/cc90d72197e1139195e9545105b9a1d339f38e1b), [`a9a6ae298`](https://github.com/withastro/astro/commit/a9a6ae29812339ea00f3b9afd3de09bd9d3733a9), [`6a7cf0712`](https://github.com/withastro/astro/commit/6a7cf0712da23e2c095f4bc4f2512e618bceb38e), [`bfd67ea74`](https://github.com/withastro/astro/commit/bfd67ea749dbc6ffa7c9a671fcc48bea6c04a075), [`f6eddffa0`](https://github.com/withastro/astro/commit/f6eddffa0414d54767e9f9e1ee5a936b8a20146b), [`c63874090`](https://github.com/withastro/astro/commit/c6387409062f1d7c2afc93319748ad57086837c5), [`d637d1ea5`](https://github.com/withastro/astro/commit/d637d1ea5b347b9c724adc895c9006c696ac8fc8), [`637f9bc72`](https://github.com/withastro/astro/commit/637f9bc728ea7d56fc82a862d761385f0dcd9528), [`77a046e88`](https://github.com/withastro/astro/commit/77a046e886c370b737208574b6934f5a1cf2b177)]: + - astro@2.1.3 + +## 6.2.0 + +### Minor Changes + +- [#6213](https://github.com/withastro/astro/pull/6213) [`afbbc4d5b`](https://github.com/withastro/astro/commit/afbbc4d5bfafc1779bac00b41c2a1cb1c90f2808) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Updated compilation settings to disable downlevelling for Node 14 + +### Patch Changes + +- Updated dependencies [[`fec583909`](https://github.com/withastro/astro/commit/fec583909ab62829dc0c1600e2387979365f2b94), [`b087b83fe`](https://github.com/withastro/astro/commit/b087b83fe266c431fe34a07d5c2293cc4ab011c6), [`694918a56`](https://github.com/withastro/astro/commit/694918a56b01104831296be0c25456135a63c784), [`a20610609`](https://github.com/withastro/astro/commit/a20610609863ae3b48afe96819b8f11ae4f414d5), [`a4a74ab70`](https://github.com/withastro/astro/commit/a4a74ab70cd2aa0d812a1f6b202c4e240a8913bf), [`75921b3cd`](https://github.com/withastro/astro/commit/75921b3cd916d439f6392c487c21532fde35ed13), [`afbbc4d5b`](https://github.com/withastro/astro/commit/afbbc4d5bfafc1779bac00b41c2a1cb1c90f2808)]: + - astro@2.1.0 + +## 6.1.3 + +### Patch Changes + +- [#6208](https://github.com/withastro/astro/pull/6208) [`79f49acbe`](https://github.com/withastro/astro/commit/79f49acbe13673bfc27e794bcfae518f38c4a4fe) Thanks [@mfrachet](https://github.com/mfrachet)! - Fix path file that was generated outside the functions folder + +- Updated dependencies [[`79783fc01`](https://github.com/withastro/astro/commit/79783fc0181153a8e379d3f023422510a7467ead), [`baa2dbb3b`](https://github.com/withastro/astro/commit/baa2dbb3b5678b2bd56fb80df99d386f32e274b7), [`8b7cb64da`](https://github.com/withastro/astro/commit/8b7cb64dadfca93c65d62df54754633d398cb2ed)]: + - astro@2.0.11 + +## 6.1.2 + +### Patch Changes + +- [#6075](https://github.com/withastro/astro/pull/6075) [`45b41d98f`](https://github.com/withastro/astro/commit/45b41d98f50dc9f76a5004a8b3346f393f1a6cb6) Thanks [@NachoVazquez](https://github.com/NachoVazquez)! - Uses config root path as location for Cloudflare Pages Functions + +- Updated dependencies [[`f6fc662c3`](https://github.com/withastro/astro/commit/f6fc662c3c59d164584c6287a930fcd1c9086ee6), [`592386b75`](https://github.com/withastro/astro/commit/592386b75541f3b7f7d95c631f86024b7e2d314d), [`1b591a143`](https://github.com/withastro/astro/commit/1b591a1431b44eacd239ed8f76809916cabca1db), [`bf8d7366a`](https://github.com/withastro/astro/commit/bf8d7366acb57e1b21181cc40fff55a821d8119e), [`ec38a8921`](https://github.com/withastro/astro/commit/ec38a8921f02a275949abcababe1b8afdf8184a2), [`f20a85b64`](https://github.com/withastro/astro/commit/f20a85b642994f240d8c94260fc55ffa1fd14294), [`9f22ac3d0`](https://github.com/withastro/astro/commit/9f22ac3d097ef2cb3b2bbe5343b8a8a49d83425d), [`cee70f5c6`](https://github.com/withastro/astro/commit/cee70f5c6ac9b0d2edc1f8a6f8f5043605576026), [`ac7fb04d6`](https://github.com/withastro/astro/commit/ac7fb04d6b162f28a337918138d5737e2c0fffad), [`d1f5611fe`](https://github.com/withastro/astro/commit/d1f5611febfd020cca4078c71bafe599015edd16), [`2189170be`](https://github.com/withastro/astro/commit/2189170be523f74f244e84ccab22c655219773ce), [`32abe49bd`](https://github.com/withastro/astro/commit/32abe49bd073417b480b1b990f432a837c12eb6f)]: + - astro@2.0.7 + +## 6.1.1 + +### Patch Changes + +- [#6046](https://github.com/withastro/astro/pull/6046) [`df3201165`](https://github.com/withastro/astro/commit/df320116528e00ab082396531b4deffbb0707b78) Thanks [@matthewp](https://github.com/matthewp)! - Cloudflare fix for building to directory mode + +- Updated dependencies [[`41e97158b`](https://github.com/withastro/astro/commit/41e97158ba90d23d346b6e3ff6c7c14b5ecbe903), [`e779c6242`](https://github.com/withastro/astro/commit/e779c6242418d1d4102e683ca5b851b764c89688)]: + - astro@2.0.4 + +## 6.1.0 + +### Minor Changes + +- [#5914](https://github.com/withastro/astro/pull/5914) [`088f5194c`](https://github.com/withastro/astro/commit/088f5194c55a6ec15b2eaf2cfb97f9ef45a24a33) Thanks [@AngusMorton](https://github.com/AngusMorton)! - Re-enable streaming in Cloudflare Pages. + +### Patch Changes + +- [#5993](https://github.com/withastro/astro/pull/5993) [`9855db676`](https://github.com/withastro/astro/commit/9855db676e61ad616c64382adeaa8c74de05f7e1) Thanks [@matthewp](https://github.com/matthewp)! - Support for prerendering in the Cloudflare integration + + This fixes prerendering in the Cloudflare adapter. Now any prerendered routes are added to the `_routes.json` config so that the worker script is skipped for those routes. + +- Updated dependencies [[`b53e0717b`](https://github.com/withastro/astro/commit/b53e0717b7f6b042baaeec7f87999e99c76c031c), [`60b32d585`](https://github.com/withastro/astro/commit/60b32d58565d87e87573eb268408293fc28ec657), [`883e0cc29`](https://github.com/withastro/astro/commit/883e0cc29968d51ed6c7515be035a40b28bafdad), [`dabce6b8c`](https://github.com/withastro/astro/commit/dabce6b8c684f851c3535f8acead06cbef6dce2a), [`aedf23f85`](https://github.com/withastro/astro/commit/aedf23f8582e32a6b94b81ddba9b323831f2b22a)]: + - astro@2.0.2 + +## 6.0.0 + +### Major Changes + +- [#5707](https://github.com/withastro/astro/pull/5707) [`5eba34fcc`](https://github.com/withastro/astro/commit/5eba34fcc663def20bdf6e0daad02a6a5472776b) Thanks [@bluwy](https://github.com/bluwy)! - Remove `astro:build:start` backwards compatibility code + +- [#5806](https://github.com/withastro/astro/pull/5806) [`7572f7402`](https://github.com/withastro/astro/commit/7572f7402238da37de748be58d678fedaf863b53) Thanks [@matthewp](https://github.com/matthewp)! - Make astro a `peerDependency` of integrations + + This marks `astro` as a `peerDependency` of several packages that are already getting `major` version bumps. This is so we can more properly track the dependency between them and what version of Astro they are being used with. + +### Patch Changes + +- Updated dependencies [[`93e633922`](https://github.com/withastro/astro/commit/93e633922c2e449df3bb2357b3683af1d3c0e07b), [`16dc36a87`](https://github.com/withastro/astro/commit/16dc36a870df47a4151a8ed2d91d0bd1bb812458), [`01f3f463b`](https://github.com/withastro/astro/commit/01f3f463bf2918b310d130a9fabbf3ee21d14029), [`e2019be6f`](https://github.com/withastro/astro/commit/e2019be6ffa46fa33d92cfd346f9ecbe51bb7144), [`05caf445d`](https://github.com/withastro/astro/commit/05caf445d4d2728f1010aeb2179a9e756c2fd17d), [`49ab4f231`](https://github.com/withastro/astro/commit/49ab4f231c23b34891c3ee86f4b92bf8d6d267a3), [`a342a486c`](https://github.com/withastro/astro/commit/a342a486c2831461e24e6c2f1ca8a9d3e15477b6), [`8fb28648f`](https://github.com/withastro/astro/commit/8fb28648f66629741cb976bfe34ccd9d8f55661e), [`1f92d64ea`](https://github.com/withastro/astro/commit/1f92d64ea35c03fec43aff64eaf704dc5a9eb30a), [`c2180746b`](https://github.com/withastro/astro/commit/c2180746b4f6d9ef1b6f86924f21f52cc6ab4e63), [`ae8a012a7`](https://github.com/withastro/astro/commit/ae8a012a7b6884a03c50494332ee37b4505c2c3b), [`cf2de5422`](https://github.com/withastro/astro/commit/cf2de5422c26bfdea4c75f76e57b57299ded3e3a), [`ce5c5dbd4`](https://github.com/withastro/astro/commit/ce5c5dbd46afbe738b03600758bf5c35113de522), [`ec09bb664`](https://github.com/withastro/astro/commit/ec09bb6642064dbd7d2f3369afb090363ae18de2), [`665a2c222`](https://github.com/withastro/astro/commit/665a2c2225e42881f5a9550599e8f3fc1deea0b4), [`259a539d7`](https://github.com/withastro/astro/commit/259a539d7d70c783330c797794b15716921629cf), [`f7aa1ec25`](https://github.com/withastro/astro/commit/f7aa1ec25d1584f7abd421903fbef66b1c050e2a), [`4987d6f44`](https://github.com/withastro/astro/commit/4987d6f44cfd0d81d88f21f5c380503403dc1e6a), [`304823811`](https://github.com/withastro/astro/commit/304823811eddd8e72aa1d8e2d39b40ab5cda3565), [`302e0ef8f`](https://github.com/withastro/astro/commit/302e0ef8f5d5232e3348afe680e599f3e537b5c5), [`55cea0a9d`](https://github.com/withastro/astro/commit/55cea0a9d8c8df91a46590fc04a9ac28089b3432), [`dd56c1941`](https://github.com/withastro/astro/commit/dd56c19411b126439b8bc42d681b6fa8c06e8c61), [`9963c6e4d`](https://github.com/withastro/astro/commit/9963c6e4d50c392c3d1ac4492237020f15ccb1de), [`be901dc98`](https://github.com/withastro/astro/commit/be901dc98c4a7f6b5536540aa8f7ba5108e939a0), [`f6cf92b48`](https://github.com/withastro/astro/commit/f6cf92b48317a19a3840ad781b77d6d3cae143bb), [`e818cc046`](https://github.com/withastro/astro/commit/e818cc0466a942919ea3c41585e231c8c80cb3d0), [`8c100a6fe`](https://github.com/withastro/astro/commit/8c100a6fe6cc652c3799d1622e12c2c969f30510), [`116d8835c`](https://github.com/withastro/astro/commit/116d8835ca9e78f8b5e477ee5a3d737b69f80706), [`840412128`](https://github.com/withastro/astro/commit/840412128b00a04515156e92c314a929d6b94f6d), [`1f49cddf9`](https://github.com/withastro/astro/commit/1f49cddf9e9ffc651efc171b2cbde9fbe9e8709d), [`7325df412`](https://github.com/withastro/astro/commit/7325df412107fc0e65cd45c1b568fb686708f723), [`16c7d0bfd`](https://github.com/withastro/astro/commit/16c7d0bfd49d2b9bfae45385f506bcd642f9444a), [`a9c292026`](https://github.com/withastro/astro/commit/a9c2920264e36cc5dc05f4adc1912187979edb0d), [`2a5786419`](https://github.com/withastro/astro/commit/2a5786419599b8674473c699300172b9aacbae2e), [`4a1cabfe6`](https://github.com/withastro/astro/commit/4a1cabfe6b9ef8a6fbbcc0727a0dc6fa300cedaa), [`a8d3e7924`](https://github.com/withastro/astro/commit/a8d3e79246605d252dcddad159e358e2d79bd624), [`fa8c131f8`](https://github.com/withastro/astro/commit/fa8c131f88ef67d14c62f1c00c97ed74d43a80ac), [`64b8082e7`](https://github.com/withastro/astro/commit/64b8082e776b832f1433ed288e6f7888adb626d0), [`c4b0cb8bf`](https://github.com/withastro/astro/commit/c4b0cb8bf2b41887d9106440bb2e70d421a5f481), [`23dc9ea96`](https://github.com/withastro/astro/commit/23dc9ea96a10343852d965efd41fe6665294f1fb), [`63a6ceb38`](https://github.com/withastro/astro/commit/63a6ceb38d88331451dca64d0034c7c58e3d26f1), [`a3a7fc929`](https://github.com/withastro/astro/commit/a3a7fc9298e6d88abb4b7bee1e58f05fa9558cf1), [`52209ca2a`](https://github.com/withastro/astro/commit/52209ca2ad72a30854947dcb3a90ab4db0ac0a6f), [`5fd9208d4`](https://github.com/withastro/astro/commit/5fd9208d447f5ab8909a2188b6c2491a0debd49d), [`5eba34fcc`](https://github.com/withastro/astro/commit/5eba34fcc663def20bdf6e0daad02a6a5472776b), [`899214298`](https://github.com/withastro/astro/commit/899214298cee5f0c975c7245e623c649e1842d73), [`3a00ecb3e`](https://github.com/withastro/astro/commit/3a00ecb3eb4bc44be758c064f2bde6e247e8a593), [`5eba34fcc`](https://github.com/withastro/astro/commit/5eba34fcc663def20bdf6e0daad02a6a5472776b), [`2303f9514`](https://github.com/withastro/astro/commit/2303f95142aa740c99213a098f82b99dd37d74a0), [`1ca81c16b`](https://github.com/withastro/astro/commit/1ca81c16b8b66236e092e6eb6ec3f73f5668421c), [`b66d7195c`](https://github.com/withastro/astro/commit/b66d7195c17a55ea0931bc3744888bd4f5f01ce6)]: + - astro@2.0.0 + +## 6.0.0-beta.1 + +
+See changes in 6.0.0-beta.1 + +### Major Changes + +- [#5806](https://github.com/withastro/astro/pull/5806) [`7572f7402`](https://github.com/withastro/astro/commit/7572f7402238da37de748be58d678fedaf863b53) Thanks [@matthewp](https://github.com/matthewp)! - Make astro a `peerDependency` of integrations + + This marks `astro` as a `peerDependency` of several packages that are already getting `major` version bumps. This is so we can more properly track the dependency between them and what version of Astro they are being used with. + +### Patch Changes + +- Updated dependencies [[`01f3f463b`](https://github.com/withastro/astro/commit/01f3f463bf2918b310d130a9fabbf3ee21d14029), [`1f92d64ea`](https://github.com/withastro/astro/commit/1f92d64ea35c03fec43aff64eaf704dc5a9eb30a), [`c2180746b`](https://github.com/withastro/astro/commit/c2180746b4f6d9ef1b6f86924f21f52cc6ab4e63), [`ae8a012a7`](https://github.com/withastro/astro/commit/ae8a012a7b6884a03c50494332ee37b4505c2c3b), [`cf2de5422`](https://github.com/withastro/astro/commit/cf2de5422c26bfdea4c75f76e57b57299ded3e3a), [`ec09bb664`](https://github.com/withastro/astro/commit/ec09bb6642064dbd7d2f3369afb090363ae18de2), [`665a2c222`](https://github.com/withastro/astro/commit/665a2c2225e42881f5a9550599e8f3fc1deea0b4), [`f7aa1ec25`](https://github.com/withastro/astro/commit/f7aa1ec25d1584f7abd421903fbef66b1c050e2a), [`302e0ef8f`](https://github.com/withastro/astro/commit/302e0ef8f5d5232e3348afe680e599f3e537b5c5), [`840412128`](https://github.com/withastro/astro/commit/840412128b00a04515156e92c314a929d6b94f6d), [`1f49cddf9`](https://github.com/withastro/astro/commit/1f49cddf9e9ffc651efc171b2cbde9fbe9e8709d), [`4a1cabfe6`](https://github.com/withastro/astro/commit/4a1cabfe6b9ef8a6fbbcc0727a0dc6fa300cedaa), [`c4b0cb8bf`](https://github.com/withastro/astro/commit/c4b0cb8bf2b41887d9106440bb2e70d421a5f481), [`23dc9ea96`](https://github.com/withastro/astro/commit/23dc9ea96a10343852d965efd41fe6665294f1fb), [`63a6ceb38`](https://github.com/withastro/astro/commit/63a6ceb38d88331451dca64d0034c7c58e3d26f1), [`52209ca2a`](https://github.com/withastro/astro/commit/52209ca2ad72a30854947dcb3a90ab4db0ac0a6f), [`2303f9514`](https://github.com/withastro/astro/commit/2303f95142aa740c99213a098f82b99dd37d74a0)]: + - astro@2.0.0-beta.2 + +
+ +## 6.0.0-beta.0 + +
+See changes in 6.0.0-beta.0 + +### Major Changes + +- [#5707](https://github.com/withastro/astro/pull/5707) [`5eba34fcc`](https://github.com/withastro/astro/commit/5eba34fcc663def20bdf6e0daad02a6a5472776b) Thanks [@bluwy](https://github.com/bluwy)! - Remove `astro:build:start` backwards compatibility code + +### Patch Changes + +- Updated dependencies [[`e2019be6f`](https://github.com/withastro/astro/commit/e2019be6ffa46fa33d92cfd346f9ecbe51bb7144), [`8fb28648f`](https://github.com/withastro/astro/commit/8fb28648f66629741cb976bfe34ccd9d8f55661e), [`dd56c1941`](https://github.com/withastro/astro/commit/dd56c19411b126439b8bc42d681b6fa8c06e8c61), [`f6cf92b48`](https://github.com/withastro/astro/commit/f6cf92b48317a19a3840ad781b77d6d3cae143bb), [`16c7d0bfd`](https://github.com/withastro/astro/commit/16c7d0bfd49d2b9bfae45385f506bcd642f9444a), [`a9c292026`](https://github.com/withastro/astro/commit/a9c2920264e36cc5dc05f4adc1912187979edb0d), [`5eba34fcc`](https://github.com/withastro/astro/commit/5eba34fcc663def20bdf6e0daad02a6a5472776b), [`5eba34fcc`](https://github.com/withastro/astro/commit/5eba34fcc663def20bdf6e0daad02a6a5472776b)]: + - astro@2.0.0-beta.0 + +
+ +## 5.0.0 + +### Patch Changes + +- Updated dependencies [[`d85ec7484`](https://github.com/withastro/astro/commit/d85ec7484ce14a4c7d3f480da8f38fcb9aff388f), [`d2960984c`](https://github.com/withastro/astro/commit/d2960984c59af7b60a3ea472c6c58fb00534a8e6), [`31ec84797`](https://github.com/withastro/astro/commit/31ec8479721a1cd65538ec041458c5ffe8f50ee9), [`5ec0f6ed5`](https://github.com/withastro/astro/commit/5ec0f6ed55b0a14a9663a90a03428345baf126bd), [`dced4a8a2`](https://github.com/withastro/astro/commit/dced4a8a2657887ec569860d9862d20f695dc23a), [`6b156dd3b`](https://github.com/withastro/astro/commit/6b156dd3b467884839a571c53114aadf26fa4b0b)]: + - astro@1.7.0 + +## 4.1.1 + +### Patch Changes + +- [#5534](https://github.com/withastro/astro/pull/5534) [`fabd9124b`](https://github.com/withastro/astro/commit/fabd9124bd3e654e885054f30e9c0d01eabf0470) Thanks [@bluwy](https://github.com/bluwy)! - Update esbuild dependency + +- Updated dependencies [[`9082a850e`](https://github.com/withastro/astro/commit/9082a850eef4ab0187fc3bfdd5a377f0c7040070), [`4f7f20616`](https://github.com/withastro/astro/commit/4f7f20616ed2b63f94ebf43bc5fdc1be55062a94), [`05915fec0`](https://github.com/withastro/astro/commit/05915fec01a51f27ab5051644f01e6112ecf06bc), [`1aeabe417`](https://github.com/withastro/astro/commit/1aeabe417077505bc0cdb8d2e47366ddbc616072), [`795f00f73`](https://github.com/withastro/astro/commit/795f00f73c549727e05d5b7bf0e39cce87add4e7), [`2c836b9d1`](https://github.com/withastro/astro/commit/2c836b9d1283a0707128d172e92ee2bba767486c), [`8f3f67c96`](https://github.com/withastro/astro/commit/8f3f67c96aee63be64de77f374293761ff73f6ce)]: + - astro@1.6.14 + +## 4.1.0 + +### Minor Changes + +- [#5347](https://github.com/withastro/astro/pull/5347) [`743000cc7`](https://github.com/withastro/astro/commit/743000cc70274a2d2fed01c72e2ac51aa6b876a6) Thanks [@AirBorne04](https://github.com/AirBorne04)! - Now building for Cloudflare directory mode takes advantage of the standard asset handling from Cloudflare Pages, and therefore does not call a function script to deliver static assets anymore. + Also supports the use of `_routes.json`, `_redirects` and `_headers` files when placed into the `public` folder. + +### Patch Changes + +- Updated dependencies [[`936c1e411`](https://github.com/withastro/astro/commit/936c1e411d77c69b2b60a061c54704200716800a), [`4b188132e`](https://github.com/withastro/astro/commit/4b188132ef68f8d9951cec86418ef50bb4df4a96), [`f5ed630bc`](https://github.com/withastro/astro/commit/f5ed630bca05ebbfcc6ac994ced3911e41daedcc)]: + - astro@1.6.11 + +## 4.0.1 + +### Patch Changes + +- [#5301](https://github.com/withastro/astro/pull/5301) [`a79a37cad`](https://github.com/withastro/astro/commit/a79a37cad549b21f91599ff86899e456d9dcc7df) Thanks [@bluwy](https://github.com/bluwy)! - Fix environment variables usage in worker output and warn if environment variables are accessedd too early + +- Updated dependencies [[`88c1bbe3a`](https://github.com/withastro/astro/commit/88c1bbe3a71f85e92f42f13d0f310c6b2a264ade), [`a79a37cad`](https://github.com/withastro/astro/commit/a79a37cad549b21f91599ff86899e456d9dcc7df)]: + - astro@1.6.5 + +## 4.0.0 + +### Major Changes + +- [#5290](https://github.com/withastro/astro/pull/5290) [`b2b291d29`](https://github.com/withastro/astro/commit/b2b291d29143703cece0d12c8e74b2e1151d2061) Thanks [@matthewp](https://github.com/matthewp)! - Handle base configuration in adapters + + This allows adapters to correctly handle `base` configuration. Internally Astro now matches routes when the URL includes the `base`. + + Adapters now also have access to the `removeBase` method which will remove the `base` from a pathname. This is useful to look up files for static assets. + +### Patch Changes + +- Updated dependencies [[`b2b291d29`](https://github.com/withastro/astro/commit/b2b291d29143703cece0d12c8e74b2e1151d2061), [`97e2b6ad7`](https://github.com/withastro/astro/commit/97e2b6ad7a6fa23e82be28b2f57cdf3f85fab112), [`4af4d8fa0`](https://github.com/withastro/astro/commit/4af4d8fa0035130fbf31c82d72777c3679bc1ca5), [`f6add3924`](https://github.com/withastro/astro/commit/f6add3924d5cd59925a6ea4bf7f2f731709bc893), [`247eb7411`](https://github.com/withastro/astro/commit/247eb7411f429317e5cd7d401a6660ee73641313)]: + - astro@1.6.4 + +## 3.1.2 + +### Patch Changes + +- [#5230](https://github.com/withastro/astro/pull/5230) [`69a532ab6`](https://github.com/withastro/astro/commit/69a532ab60a85d30c2395969593c4d38f9a2fbbe) Thanks [@matthewp](https://github.com/matthewp)! - Exports new runtime entrypoint's types + +## 3.1.1 + +### Patch Changes + +- [#5103](https://github.com/withastro/astro/pull/5103) [`d151d9f3f`](https://github.com/withastro/astro/commit/d151d9f3f29c0a57c59b8029a18717808ccc7f8f) Thanks [@AirBorne04](https://github.com/AirBorne04)! - enable access to Cloudflare runtime [KV, R2, Durable Objects] + - access native Cloudflare runtime through `import { getRuntime } from "@astrojs/cloudflare/runtime"`; now you can call `getRuntime(Astro.request)` and get access to the runtime environment. + +## 3.1.0 + +### Minor Changes + +- [#5056](https://github.com/withastro/astro/pull/5056) [`e55af8a23`](https://github.com/withastro/astro/commit/e55af8a23233b6335f45b7a04b9d026990fb616c) Thanks [@matthewp](https://github.com/matthewp)! - # New build configuration + + The ability to customize SSR build configuration more granularly is now available in Astro. You can now customize the output folder for `server` (the server code for SSR), `client` (your client-side JavaScript and assets), and `serverEntry` (the name of the entrypoint server module). Here are the defaults: + + ```js + import { defineConfig } from 'astro/config'; + + export default defineConfig({ + output: 'server', + build: { + server: './dist/server/', + client: './dist/client/', + serverEntry: 'entry.mjs', + }, + }); + ``` + + These new configuration options are only supported in SSR mode and are ignored when building to SSG (a static site). + + ## Integration hook change + + The integration hook `astro:build:start` includes a param `buildConfig` which includes all of these same options. You can continue to use this param in Astro 1.x, but it is deprecated in favor of the new `build.config` options. All of the built-in adapters have been updated to the new format. If you have an integration that depends on this param we suggest upgrading to do this instead: + + ```js + export default function myIntegration() { + return { + name: 'my-integration', + hooks: { + 'astro:config:setup': ({ updateConfig }) => { + updateConfig({ + build: { + server: '...', + }, + }); + }, + }, + }; + } + ``` + +## 3.0.0 + +### Major Changes + +- [#4888](https://github.com/withastro/astro/pull/4888) [`2dc582ac5`](https://github.com/withastro/astro/commit/2dc582ac5e2d6e1d434ccfe21616182e453feec3) Thanks [@AirBorne04](https://github.com/AirBorne04)! - adjusting the build settings for cloudflare (reverting back to platform browser over neutral) + adjusting the ssr settings for solidjs (to build for node) + +## 2.1.0 + +### Minor Changes + +- [#4876](https://github.com/withastro/astro/pull/4876) [`d3091f89e`](https://github.com/withastro/astro/commit/d3091f89e92fcfe1ad48daca74055d54b1c853a3) Thanks [@matthewp](https://github.com/matthewp)! - Adds the Astro.cookies API + + `Astro.cookies` is a new API for manipulating cookies in Astro components and API routes. + + In Astro components, the new `Astro.cookies` object is a map-like object that allows you to get, set, delete, and check for a cookie's existence (`has`): + + ```astro + --- + type Prefs = { + darkMode: boolean; + }; + + Astro.cookies.set( + 'prefs', + { darkMode: true }, + { + expires: '1 month', + }, + ); + + const prefs = Astro.cookies.get('prefs').json(); + --- + + + ``` + + Once you've set a cookie with Astro.cookies it will automatically be included in the outgoing response. + + This API is also available with the same functionality in API routes: + + ```js + export function post({ cookies }) { + cookies.set('loggedIn', false); + + return new Response(null, { + status: 302, + headers: { + Location: '/login', + }, + }); + } + ``` + + See [the RFC](https://github.com/withastro/rfcs/blob/main/proposals/0025-cookie-management.md) to learn more. + +## 2.0.0 + +### Major Changes + +- [#4815](https://github.com/withastro/astro/pull/4815) [`ce0b92ba7`](https://github.com/withastro/astro/commit/ce0b92ba73072c0f0143829a53f870155ad4c7ff) Thanks [@AirBorne04](https://github.com/AirBorne04)! - adjusted esbuild config to work with worker environment (fixing solid js ssr) + +## 1.0.2 + +### Patch Changes + +- [#4558](https://github.com/withastro/astro/pull/4558) [`742966456`](https://github.com/withastro/astro/commit/7429664566f05ecebf6d57906f950627e62e690c) Thanks [@tony-sull](https://github.com/tony-sull)! - Adding the `withastro` keyword to include the adapters on the [Integrations Catalog](https://astro.build/integrations) + +## 1.0.1 + +### Patch Changes + +- [#4232](https://github.com/withastro/astro/pull/4232) [`bfbd32588`](https://github.com/withastro/astro/commit/bfbd32588f7e2c0a9e43cd1a571a0dc9c5f7e645) Thanks [@Ekwuno](https://github.com/Ekwuno)! - Update README + +## 1.0.0 + +### Major Changes + +- [`04ad44563`](https://github.com/withastro/astro/commit/04ad445632c67bdd60c1704e1e0dcbcaa27b9308) - > Astro v1.0 is out! Read the [official announcement post](https://astro.build/blog/astro-1/). + + **No breaking changes**. This package is now officially stable and compatible with `astro@1.0.0`! + +## 0.5.0 + +### Minor Changes + +- [#3806](https://github.com/withastro/astro/pull/3806) [`f4c571bdb`](https://github.com/withastro/astro/commit/f4c571bdb0bbcd0dfed68a484dfbfe274f8a5f45) Thanks [@nrgnrg](https://github.com/nrgnrg)! - add support for compiling functions to a functions directory rather than `_worker.js` + +## 0.4.0 + +### Minor Changes + +- [#4068](https://github.com/withastro/astro/pull/4068) [`54b33d50f`](https://github.com/withastro/astro/commit/54b33d50fdb995ac056461be7e2128d911624f2d) Thanks [@matthewp](https://github.com/matthewp)! - Add explicit errors when omitting output config + +### Patch Changes + +- [#4072](https://github.com/withastro/astro/pull/4072) [`a198028b0`](https://github.com/withastro/astro/commit/a198028b04234d0b8dcb0b6bcb47c5831d7a15f9) Thanks [@matthewp](https://github.com/matthewp)! - Fixes Cloudflare throwing an error for process + +## 0.3.0 + +### Minor Changes + +- [#4015](https://github.com/withastro/astro/pull/4015) [`6fd161d76`](https://github.com/withastro/astro/commit/6fd161d7691cbf9d3ffa4646e46059dfd0940010) Thanks [@matthewp](https://github.com/matthewp)! - New `output` configuration option + + This change introduces a new "output target" configuration option (`output`). Setting the output target lets you decide the format of your final build, either: + + - `"static"` (default): A static site. Your final build will be a collection of static assets (HTML, CSS, JS) that you can deploy to any static site host. + - `"server"`: A dynamic server application. Your final build will be an application that will run in a hosted server environment, generating HTML dynamically for different requests. + + If `output` is omitted from your config, the default value `"static"` will be used. + + When using the `"server"` output target, you must also include a runtime adapter via the `adapter` configuration. An adapter will _adapt_ your final build to run on the deployed platform of your choice (Netlify, Vercel, Node.js, Deno, etc). + + To migrate: No action is required for most users. If you currently define an `adapter`, you will need to also add `output: 'server'` to your config file to make it explicit that you are building a server. Here is an example of what that change would look like for someone deploying to Netlify: + + ```diff + import { defineConfig } from 'astro/config'; + import netlify from '@astrojs/netlify/functions'; + + export default defineConfig({ + adapter: netlify(), + + output: 'server', + }); + ``` + +* [#4018](https://github.com/withastro/astro/pull/4018) [`0cc6ede36`](https://github.com/withastro/astro/commit/0cc6ede362996b9faba57481a790d6eb7fba2045) Thanks [@okikio](https://github.com/okikio)! - Support for 404 and 500 pages in SSR + +- [#3973](https://github.com/withastro/astro/pull/3973) [`5a23483ef`](https://github.com/withastro/astro/commit/5a23483efb3ba614b05a00064f84415620605204) Thanks [@matthewp](https://github.com/matthewp)! - Adds support for Astro.clientAddress + + The new `Astro.clientAddress` property allows you to get the IP address of the requested user. + + ```astro + + ``` + + This property is only available when building for SSR, and only if the adapter you are using supports providing the IP address. If you attempt to access the property in a SSG app it will throw an error. + +## 0.2.4 + +### Patch Changes + +- [#3885](https://github.com/withastro/astro/pull/3885) [`bf5d1cc1e`](https://github.com/withastro/astro/commit/bf5d1cc1e71da38a14658c615e9481f2145cc6e7) Thanks [@delucis](https://github.com/delucis)! - Integration README fixes + +## 0.2.3 + +### Patch Changes + +- [#3854](https://github.com/withastro/astro/pull/3854) [`b012ee55`](https://github.com/withastro/astro/commit/b012ee55b107dea0730286263b27d83e530fad5d) Thanks [@bholmesdev](https://github.com/bholmesdev)! - [astro add] Support adapters and third party packages + +## 0.2.2 + +### Patch Changes + +- [#3777](https://github.com/withastro/astro/pull/3777) [`976e1f17`](https://github.com/withastro/astro/commit/976e1f175a95ea39f737b8575e4fdf3c3d89e1ee) Thanks [@tony-sull](https://github.com/tony-sull)! - Disables HTTP streaming in Cloudflare Pages deployments + +## 0.2.1 + +### Patch Changes + +- [#3695](https://github.com/withastro/astro/pull/3695) [`0d667d0e`](https://github.com/withastro/astro/commit/0d667d0e572d76d4c819816ddf51ed14b43e2551) Thanks [@nrgnrg](https://github.com/nrgnrg)! - fix custom 404 pages not rendering + +## 0.2.0 + +### Minor Changes + +- [#3600](https://github.com/withastro/astro/pull/3600) [`7f423581`](https://github.com/withastro/astro/commit/7f423581411648c9a69b68918ff930581f12cf16) Thanks [@nrgnrg](https://github.com/nrgnrg)! - add SSR adaptor for Cloudflare Pages functions diff --git a/packages/integrations/cloudflare/README.md b/packages/integrations/cloudflare/README.md index 1f8e7271f8fb..7190ec946354 100644 --- a/packages/integrations/cloudflare/README.md +++ b/packages/integrations/cloudflare/README.md @@ -1,3 +1,38 @@ # @astrojs/cloudflare -The Cloudflare adapter package has moved. Please see [the new repository for the Cloudflare adapter](https://github.com/withastro/adapters/tree/main/packages/cloudflare). +An SSR adapter for use with Cloudflare Pages Functions targets. Write your code in Astro/Javascript and deploy to Cloudflare Pages. + +## Documentation + +Read the [`@astrojs/cloudflare` docs][docs] + +## Support + +- Get help in the [Astro Discord][discord]. Post questions in our `#support` forum, or visit our dedicated `#dev` channel to discuss current development and more! + +- Check our [Astro Integration Documentation][astro-integration] for more on integrations. + +- Submit bug reports and feature requests as [GitHub issues][issues]. + +## Contributing + +This package is maintained by Astro's Core team. You're welcome to submit an issue or PR! These links will help you get started: + +- [Contributor Manual][contributing] +- [Code of Conduct][coc] +- [Community Guide][community] + +## License + +MIT + +Copyright (c) 2023–present [Astro][astro] + +[astro]: https://astro.build/ +[docs]: https://docs.astro.build/en/guides/integrations-guide/cloudflare/ +[contributing]: https://github.com/withastro/astro/blob/main/CONTRIBUTING.md +[coc]: https://github.com/withastro/.github/blob/main/CODE_OF_CONDUCT.md +[community]: https://github.com/withastro/.github/blob/main/COMMUNITY_GUIDE.md +[discord]: https://astro.build/chat/ +[issues]: https://github.com/withastro/adapter/issues +[astro-integration]: https://docs.astro.build/en/guides/integrations-guide/ diff --git a/packages/integrations/cloudflare/package.json b/packages/integrations/cloudflare/package.json index 05e18bc64727..4888946cbdd3 100644 --- a/packages/integrations/cloudflare/package.json +++ b/packages/integrations/cloudflare/package.json @@ -1,8 +1,62 @@ { "name": "@astrojs/cloudflare", - "version": "0.0.0", - "private": true, + "description": "Deploy your site to Cloudflare Workers/Pages", + "version": "12.2.1", "type": "module", - "keywords": [], - "dont_remove": "This is a placeholder for the sake of the docs smoke test" + "types": "./dist/index.d.ts", + "author": "withastro", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/withastro/adapters.git", + "directory": "packages/cloudflare" + }, + "keywords": [ + "withastro", + "astro-adapter" + ], + "bugs": "https://github.com/withastro/adapters/issues", + "homepage": "https://docs.astro.build/en/guides/integrations-guide/cloudflare/", + "exports": { + ".": "./dist/index.js", + "./entrypoints/server.js": "./dist/entrypoints/server.js", + "./entrypoints/middleware.js": "./dist/entrypoints/middleware.js", + "./image-service": "./dist/entrypoints/image-service.js", + "./image-endpoint": "./dist/entrypoints/image-endpoint.js", + "./package.json": "./package.json" + }, + "files": [ + "dist" + ], + "scripts": { + "build": "astro-scripts build \"src/**/*.ts\" && tsc", + "test": "astro-scripts test \"test/**/*.test.js\"" + }, + "dependencies": { + "@astrojs/internal-helpers": "0.4.2", + "@astrojs/underscore-redirects": "^0.6.0", + "@cloudflare/workers-types": "^4.20250109.0", + "esbuild": "^0.24.0", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.17", + "miniflare": "^3.20241230.1", + "tiny-glob": "^0.2.9", + "vite": "^6.0.7", + "wrangler": "^3.101.0" + }, + "peerDependencies": { + "astro": "^5.0.0" + }, + "devDependencies": { + "astro": "workspace:*", + "astro-scripts": "workspace:*", + "cheerio": "1.0.0", + "execa": "^8.0.1", + "fast-glob": "^3.3.3", + "rollup": "^4.30.1", + "strip-ansi": "^7.1.0" + }, + "publishConfig": { + "provenance": true + } } diff --git a/packages/integrations/cloudflare/src/entrypoints/image-endpoint.ts b/packages/integrations/cloudflare/src/entrypoints/image-endpoint.ts new file mode 100644 index 000000000000..dbc1e1f5ae5e --- /dev/null +++ b/packages/integrations/cloudflare/src/entrypoints/image-endpoint.ts @@ -0,0 +1,15 @@ +import type { APIRoute } from 'astro'; + +export const prerender = false; + +export const GET: APIRoute = (ctx) => { + const href = ctx.url.searchParams.get('href'); + if (!href) { + return new Response("Missing 'href' query parameter", { + status: 400, + statusText: "Missing 'href' query parameter", + }); + } + + return fetch(new URL(href, ctx.url.origin)); +}; diff --git a/packages/integrations/cloudflare/src/entrypoints/image-service.ts b/packages/integrations/cloudflare/src/entrypoints/image-service.ts new file mode 100644 index 000000000000..fa970c45fbf4 --- /dev/null +++ b/packages/integrations/cloudflare/src/entrypoints/image-service.ts @@ -0,0 +1,39 @@ +import type { ExternalImageService } from 'astro'; + +import { joinPaths } from '@astrojs/internal-helpers/path'; +import { baseService } from 'astro/assets'; +import { isESMImportedImage, isRemoteAllowed } from '../utils/assets.js'; + +const service: ExternalImageService = { + ...baseService, + getURL: (options, imageConfig) => { + const resizingParams = []; + if (options.width) resizingParams.push(`width=${options.width}`); + if (options.height) resizingParams.push(`height=${options.height}`); + if (options.quality) resizingParams.push(`quality=${options.quality}`); + if (options.fit) resizingParams.push(`fit=${options.fit}`); + if (options.format) resizingParams.push(`format=${options.format}`); + + let imageSource = ''; + if (isESMImportedImage(options.src)) { + imageSource = options.src.src; + } else if (isRemoteAllowed(options.src, imageConfig)) { + imageSource = options.src; + } else { + // If it's not an imported image, nor is it allowed using the current domains or remote patterns, we'll just return the original URL + return options.src; + } + + const imageEndpoint = joinPaths( + // @ts-expect-error Can't recognise import.meta.env + import.meta.env.BASE_URL, + '/cdn-cgi/image', + resizingParams.join(','), + imageSource, + ); + + return imageEndpoint; + }, +}; + +export default service; diff --git a/packages/integrations/cloudflare/src/entrypoints/middleware.ts b/packages/integrations/cloudflare/src/entrypoints/middleware.ts new file mode 100644 index 000000000000..187aface592b --- /dev/null +++ b/packages/integrations/cloudflare/src/entrypoints/middleware.ts @@ -0,0 +1,12 @@ +import type { MiddlewareHandler } from 'astro'; + +export const onRequest: MiddlewareHandler = (context, next) => { + if (context.isPrerendered) { + // @ts-expect-error + context.locals.runtime ??= { + env: process.env, + }; + } + + return next(); +}; diff --git a/packages/integrations/cloudflare/src/entrypoints/server.ts b/packages/integrations/cloudflare/src/entrypoints/server.ts new file mode 100644 index 000000000000..d9ae17be0fe2 --- /dev/null +++ b/packages/integrations/cloudflare/src/entrypoints/server.ts @@ -0,0 +1,96 @@ +import type { + CacheStorage as CLOUDFLARE_CACHESTORAGE, + Request as CLOUDFLARE_REQUEST, + ExecutionContext, +} from '@cloudflare/workers-types'; +import type { SSRManifest } from 'astro'; +import { App } from 'astro/app'; +import { setGetEnv } from 'astro/env/setup'; +import { createGetEnv } from '../utils/env.js'; + +type Env = { + [key: string]: unknown; + ASSETS: { fetch: (req: Request | string) => Promise }; + ASTRO_STUDIO_APP_TOKEN?: string; +}; + +export interface Runtime { + runtime: { + env: Env & T; + cf: CLOUDFLARE_REQUEST['cf']; + caches: CLOUDFLARE_CACHESTORAGE; + ctx: ExecutionContext; + }; +} + +export function createExports(manifest: SSRManifest) { + const app = new App(manifest); + + const fetch = async ( + request: Request & CLOUDFLARE_REQUEST, + env: Env, + context: ExecutionContext, + ) => { + const { pathname } = new URL(request.url); + + // static assets fallback, in case default _routes.json is not used + if (manifest.assets.has(pathname)) { + return env.ASSETS.fetch(request.url.replace(/\.html$/, '')); + } + + const routeData = app.match(request); + if (!routeData) { + // https://developers.cloudflare.com/pages/functions/api-reference/#envassetsfetch + const asset = await env.ASSETS.fetch( + request.url.replace(/index.html$/, '').replace(/\.html$/, ''), + ); + if (asset.status !== 404) { + return asset; + } + } + + Reflect.set( + request, + Symbol.for('astro.clientAddress'), + request.headers.get('cf-connecting-ip'), + ); + + process.env.ASTRO_STUDIO_APP_TOKEN ??= (() => { + if (typeof env.ASTRO_STUDIO_APP_TOKEN === 'string') { + return env.ASTRO_STUDIO_APP_TOKEN; + } + })(); + + const locals: Runtime = { + runtime: { + env: env, + cf: request.cf, + caches: caches as unknown as CLOUDFLARE_CACHESTORAGE, + ctx: { + waitUntil: (promise: Promise) => context.waitUntil(promise), + // Currently not available: https://developers.cloudflare.com/pages/platform/known-issues/#pages-functions + passThroughOnException: () => { + throw new Error( + '`passThroughOnException` is currently not available in Cloudflare Pages. See https://developers.cloudflare.com/pages/platform/known-issues/#pages-functions.', + ); + }, + props: {}, + }, + }, + }; + + setGetEnv(createGetEnv(env)); + + const response = await app.render(request, { routeData, locals }); + + if (app.setCookieHeaders) { + for (const setCookieHeader of app.setCookieHeaders(response)) { + response.headers.append('Set-Cookie', setCookieHeader); + } + } + + return response; + }; + + return { default: { fetch } }; +} diff --git a/packages/integrations/cloudflare/src/index.ts b/packages/integrations/cloudflare/src/index.ts new file mode 100644 index 000000000000..b0c08cdcfe59 --- /dev/null +++ b/packages/integrations/cloudflare/src/index.ts @@ -0,0 +1,357 @@ +import type { + AstroConfig, + AstroIntegration, + HookParameters, + IntegrationResolvedRoute, +} from 'astro'; +import type { PluginOption } from 'vite'; + +import { createReadStream } from 'node:fs'; +import { appendFile, rename, stat } from 'node:fs/promises'; +import { createInterface } from 'node:readline/promises'; +import { + appendForwardSlash, + prependForwardSlash, + removeLeadingForwardSlash, +} from '@astrojs/internal-helpers/path'; +import { createRedirectsFromAstroRoutes } from '@astrojs/underscore-redirects'; +import { AstroError } from 'astro/errors'; +import { defaultClientConditions } from 'vite'; +import { type GetPlatformProxyOptions, getPlatformProxy } from 'wrangler'; +import { + type CloudflareModulePluginExtra, + cloudflareModuleLoader, +} from './utils/cloudflare-module-loader.js'; +import { createGetEnv } from './utils/env.js'; +import { createRoutesFile, getParts } from './utils/generate-routes-json.js'; +import { setImageConfig } from './utils/image-config.js'; + +export type { Runtime } from './entrypoints/server.js'; + +export type Options = { + /** Options for handling images. */ + imageService?: 'passthrough' | 'cloudflare' | 'compile' | 'custom'; + /** Configuration for `_routes.json` generation. A _routes.json file controls when your Function is invoked. This file will include three different properties: + * + * - version: Defines the version of the schema. Currently there is only one version of the schema (version 1), however, we may add more in the future and aim to be backwards compatible. + * - include: Defines routes that will be invoked by Functions. Accepts wildcard behavior. + * - exclude: Defines routes that will not be invoked by Functions. Accepts wildcard behavior. `exclude` always take priority over `include`. + * + * Wildcards match any number of path segments (slashes). For example, `/users/*` will match everything after the `/users/` path. + * + */ + routes?: { + /** Extend `_routes.json` */ + extend: { + /** Paths which should be routed to the SSR function */ + include?: { + /** Generally this is in pathname format, but does support wildcards, e.g. `/users`, `/products/*` */ + pattern: string; + }[]; + /** Paths which should be routed as static assets */ + exclude?: { + /** Generally this is in pathname format, but does support wildcards, e.g. `/static`, `/assets/*`, `/images/avatar.jpg` */ + pattern: string; + }[]; + }; + }; + /** + * Proxy configuration for the platform. + */ + platformProxy?: GetPlatformProxyOptions & { + /** Toggle the proxy. Default `undefined`, which equals to `true`. */ + enabled?: boolean; + }; + + /** + * Allow bundling cloudflare worker specific file types as importable modules. Defaults to true. + * When enabled, allows imports of '.wasm', '.bin', and '.txt' file types + * + * See https://developers.cloudflare.com/pages/functions/module-support/ + * for reference on how these file types are exported + */ + cloudflareModules?: boolean; +}; + +function wrapWithSlashes(path: string): string { + return prependForwardSlash(appendForwardSlash(path)); +} + +function setProcessEnv(config: AstroConfig, env: Record) { + const getEnv = createGetEnv(env); + + if (config.env?.schema) { + for (const key of Object.keys(config.env.schema)) { + const value = getEnv(key); + if (value !== undefined) { + process.env[key] = value; + } + } + } +} + +export default function createIntegration(args?: Options): AstroIntegration { + let _config: AstroConfig; + let finalBuildOutput: HookParameters<'astro:config:done'>['buildOutput']; + + const cloudflareModulePlugin: PluginOption & CloudflareModulePluginExtra = cloudflareModuleLoader( + args?.cloudflareModules ?? true, + ); + + let _routes: IntegrationResolvedRoute[]; + + return { + name: '@astrojs/cloudflare', + hooks: { + 'astro:config:setup': ({ + command, + config, + updateConfig, + logger, + addWatchFile, + addMiddleware, + }) => { + updateConfig({ + build: { + client: new URL(`.${wrapWithSlashes(config.base)}`, config.outDir), + server: new URL('./_worker.js/', config.outDir), + serverEntry: 'index.js', + redirects: false, + }, + vite: { + plugins: [ + // https://developers.cloudflare.com/pages/functions/module-support/ + // Allows imports of '.wasm', '.bin', and '.txt' file types + cloudflareModulePlugin, + { + name: 'vite:cf-imports', + enforce: 'pre', + resolveId(source) { + if (source.startsWith('cloudflare:')) { + return { id: source, external: true }; + } + return null; + }, + }, + ], + }, + image: setImageConfig(args?.imageService ?? 'compile', config.image, command, logger), + }); + if (args?.platformProxy?.configPath) { + addWatchFile(new URL(args.platformProxy.configPath, config.root)); + } else { + addWatchFile(new URL('./wrangler.toml', config.root)); + addWatchFile(new URL('./wrangler.json', config.root)); + addWatchFile(new URL('./wrangler.jsonc', config.root)); + } + addMiddleware({ + entrypoint: '@astrojs/cloudflare/entrypoints/middleware.js', + order: 'pre', + }); + }, + 'astro:routes:resolved': ({ routes }) => { + _routes = routes; + }, + '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.', + ); + } + + _config = config; + finalBuildOutput = buildOutput; + + setAdapter({ + name: '@astrojs/cloudflare', + serverEntrypoint: '@astrojs/cloudflare/entrypoints/server.js', + exports: ['default'], + adapterFeatures: { + edgeMiddleware: false, + buildOutput: 'server', + }, + supportedAstroFeatures: { + serverOutput: 'stable', + hybridOutput: 'stable', + staticOutput: 'unsupported', + i18nDomains: 'experimental', + sharpImageService: { + support: 'limited', + message: + 'Cloudflare does not support sharp. You can use the `compile` image service to compile images at build time. It will not work for any on-demand rendered images.', + }, + envGetSecret: 'stable', + }, + }); + }, + 'astro:server:setup': async ({ server }) => { + if ((args?.platformProxy?.enabled ?? true) === true) { + const platformProxy = await getPlatformProxy(args?.platformProxy); + + setProcessEnv(_config, platformProxy.env); + + const clientLocalsSymbol = Symbol.for('astro.locals'); + + server.middlewares.use(async function middleware(req, _res, next) { + Reflect.set(req, clientLocalsSymbol, { + runtime: { + env: platformProxy.env, + cf: platformProxy.cf, + caches: platformProxy.caches, + ctx: { + waitUntil: (promise: Promise) => platformProxy.ctx.waitUntil(promise), + // Currently not available: https://developers.cloudflare.com/pages/platform/known-issues/#pages-functions + passThroughOnException: () => { + throw new AstroError( + '`passThroughOnException` is currently not available in Cloudflare Pages. See https://developers.cloudflare.com/pages/platform/known-issues/#pages-functions.', + ); + }, + }, + }, + }); + next(); + }); + } + }, + 'astro:build:setup': ({ vite, target }) => { + if (target === 'server') { + vite.resolve ||= {}; + vite.resolve.alias ||= {}; + + const aliases = [ + { + find: 'react-dom/server', + replacement: 'react-dom/server.browser', + }, + ]; + + if (Array.isArray(vite.resolve.alias)) { + vite.resolve.alias = [...vite.resolve.alias, ...aliases]; + } else { + for (const alias of aliases) { + (vite.resolve.alias as Record)[alias.find] = alias.replacement; + } + } + + // Support `workerd` and `worker` conditions for the ssr environment + // (previously supported in esbuild instead: https://github.com/withastro/astro/pull/7092) + vite.ssr ||= {}; + vite.ssr.resolve ||= {}; + vite.ssr.resolve.conditions ||= [...defaultClientConditions]; + vite.ssr.resolve.conditions.push('workerd', 'worker'); + + vite.ssr.target = 'webworker'; + vite.ssr.noExternal = true; + + vite.build ||= {}; + vite.build.rollupOptions ||= {}; + vite.build.rollupOptions.output ||= {}; + // @ts-expect-error + vite.build.rollupOptions.output.banner ||= + 'globalThis.process ??= {}; globalThis.process.env ??= {};'; + + // Cloudflare env is only available per request. This isn't feasible for code that access env vars + // in a global way, so we shim their access as `process.env.*`. This is not the recommended way for users to access environment variables. But we'll add this for compatibility for chosen variables. Mainly to support `@astrojs/db` + vite.define = { + 'process.env': 'process.env', + ...vite.define, + }; + } + }, + 'astro:build:done': async ({ pages, dir, logger, assets }) => { + await cloudflareModulePlugin.afterBuildCompleted(_config); + const PLATFORM_FILES = ['_headers', '_redirects', '_routes.json']; + if (_config.base !== '/') { + for (const file of PLATFORM_FILES) { + try { + await rename(new URL(file, _config.build.client), new URL(file, _config.outDir)); + } catch (_e) { + logger.error( + `There was an error moving ${file} to the root of the output directory.`, + ); + } + } + } + + let redirectsExists = false; + try { + const redirectsStat = await stat(new URL('./_redirects', _config.outDir)); + if (redirectsStat.isFile()) { + redirectsExists = true; + } + } catch (_error) { + redirectsExists = false; + } + + const redirects: IntegrationResolvedRoute['segments'][] = []; + if (redirectsExists) { + const rl = createInterface({ + input: createReadStream(new URL('./_redirects', _config.outDir)), + crlfDelay: Number.POSITIVE_INFINITY, + }); + + for await (const line of rl) { + const parts = line.split(' '); + if (parts.length >= 2) { + const p = removeLeadingForwardSlash(parts[0]) + .split('/') + .filter(Boolean) + .map((s: string) => { + const syntax = s + .replace(/\/:.*?(?=\/|$)/g, '/*') + // remove query params as they are not supported by cloudflare + .replace(/\?.*$/, ''); + return getParts(syntax); + }); + redirects.push(p); + } + } + } + + let routesExists = false; + try { + const routesStat = await stat(new URL('./_routes.json', _config.outDir)); + if (routesStat.isFile()) { + routesExists = true; + } + } catch (_error) { + routesExists = false; + } + + if (!routesExists) { + await createRoutesFile( + _config, + logger, + _routes, + pages, + redirects, + args?.routes?.extend?.include, + args?.routes?.extend?.exclude, + ); + } + + const trueRedirects = createRedirectsFromAstroRoutes({ + config: _config, + routeToDynamicTargetMap: new Map( + Array.from( + _routes + .filter((route) => route.type === 'redirect') + .map((route) => [route, ''] as const), + ), + ), + dir, + buildOutput: finalBuildOutput, + assets, + }); + + if (!trueRedirects.empty()) { + try { + await appendFile(new URL('./_redirects', _config.outDir), trueRedirects.print()); + } catch (_error) { + logger.error('Failed to write _redirects file'); + } + } + }, + }, + }; +} diff --git a/packages/integrations/cloudflare/src/utils/assets.ts b/packages/integrations/cloudflare/src/utils/assets.ts new file mode 100644 index 000000000000..21ba28690bfb --- /dev/null +++ b/packages/integrations/cloudflare/src/utils/assets.ts @@ -0,0 +1,82 @@ +import { isRemotePath } from '@astrojs/internal-helpers/path'; +import type { AstroConfig, ImageMetadata, RemotePattern } from 'astro'; + +export function isESMImportedImage(src: ImageMetadata | string): src is ImageMetadata { + return typeof src === 'object'; +} +export function matchHostname(url: URL, hostname?: string, allowWildcard?: boolean) { + if (!hostname) { + return true; + } + if (!allowWildcard || !hostname.startsWith('*')) { + return hostname === url.hostname; + } + if (hostname.startsWith('**.')) { + const slicedHostname = hostname.slice(2); // ** length + return slicedHostname !== url.hostname && url.hostname.endsWith(slicedHostname); + } + if (hostname.startsWith('*.')) { + const slicedHostname = hostname.slice(1); // * length + const additionalSubdomains = url.hostname + .replace(slicedHostname, '') + .split('.') + .filter(Boolean); + return additionalSubdomains.length === 1; + } + + return false; +} +export function matchPort(url: URL, port?: string) { + return !port || port === url.port; +} +export function matchProtocol(url: URL, protocol?: string) { + return !protocol || protocol === url.protocol.slice(0, -1); +} +export function matchPathname(url: URL, pathname?: string, allowWildcard?: boolean) { + if (!pathname) { + return true; + } + if (!allowWildcard || !pathname.endsWith('*')) { + return pathname === url.pathname; + } + if (pathname.endsWith('/**')) { + const slicedPathname = pathname.slice(0, -2); // ** length + return slicedPathname !== url.pathname && url.pathname.startsWith(slicedPathname); + } + if (pathname.endsWith('/*')) { + const slicedPathname = pathname.slice(0, -1); // * length + const additionalPathChunks = url.pathname + .replace(slicedPathname, '') + .split('/') + .filter(Boolean); + return additionalPathChunks.length === 1; + } + + return false; +} +export function matchPattern(url: URL, remotePattern: RemotePattern) { + return ( + matchProtocol(url, remotePattern.protocol) && + matchHostname(url, remotePattern.hostname, true) && + matchPort(url, remotePattern.port) && + matchPathname(url, remotePattern.pathname, true) + ); +} +export function isRemoteAllowed( + src: string, + { + domains = [], + remotePatterns = [], + }: Partial>, +): boolean { + if (!isRemotePath(src)) return false; + + const url = new URL(src); + return ( + domains.some((domain) => matchHostname(url, domain)) || + remotePatterns.some((remotePattern) => matchPattern(url, remotePattern)) + ); +} +export function isString(path: unknown): path is string { + return typeof path === 'string' || path instanceof String; +} diff --git a/packages/integrations/cloudflare/src/utils/cloudflare-module-loader.ts b/packages/integrations/cloudflare/src/utils/cloudflare-module-loader.ts new file mode 100644 index 000000000000..7017acd57d27 --- /dev/null +++ b/packages/integrations/cloudflare/src/utils/cloudflare-module-loader.ts @@ -0,0 +1,252 @@ +import * as fs from 'node:fs/promises'; +import * as path from 'node:path'; +import * as url from 'node:url'; +import type { AstroConfig } from 'astro'; +import type { OutputBundle } from 'rollup'; +import type { PluginOption } from 'vite'; + +export interface CloudflareModulePluginExtra { + afterBuildCompleted(config: AstroConfig): Promise; +} + +export type ModuleType = 'CompiledWasm' | 'Text' | 'Data'; + +/** + * Enables support for various non-standard extensions in module imports that cloudflare workers supports. + * + * See https://developers.cloudflare.com/pages/functions/module-support/ for reference + * + * This adds supports for imports in the following formats: + * - .wasm + * - .wasm?module + * - .bin + * - .txt + * + * @param enabled - if true, will load all cloudflare pages supported types + * @returns Vite plugin with additional extension method to hook into astro build + */ +export function cloudflareModuleLoader( + enabled: boolean, +): PluginOption & CloudflareModulePluginExtra { + /** + * It's likely that eventually cloudflare will add support for custom extensions, like they do in vanilla cloudflare workers, + * by adding rules to your wrangler.tome + * https://developers.cloudflare.com/workers/wrangler/bundling/ + */ + const adaptersByExtension: Record = enabled ? { ...defaultAdapters } : {}; + + const extensions = Object.keys(adaptersByExtension); + + let isDev = false; + const MAGIC_STRING = '__CLOUDFLARE_ASSET__'; + const replacements: Replacement[] = []; + + return { + name: 'vite:cf-module-loader', + enforce: 'pre', + configResolved(config) { + isDev = config.command === 'serve'; + }, + config(_, __) { + // let vite know that file format and the magic import string is intentional, and will be handled in this plugin + return { + assetsInclude: extensions.map((x) => `**/*${x}`), + build: { + rollupOptions: { + // mark the wasm files as external so that they are not bundled and instead are loaded from the files + external: extensions.map( + (x) => new RegExp(`^${MAGIC_STRING}.+${escapeRegExp(x)}.mjs$`, 'i'), + ), + }, + }, + }; + }, + + async load(id, _) { + const maybeExtension = extensions.find((x) => id.endsWith(x)); + const moduleType: ModuleType | undefined = + (maybeExtension && adaptersByExtension[maybeExtension]) || undefined; + if (!moduleType || !maybeExtension) { + return; + } + if (!enabled) { + throw new Error( + `Cloudflare module loading is experimental. The ${maybeExtension} module cannot be loaded unless you add \`cloudflareModules: true\` to your astro config.`, + ); + } + + const moduleLoader = renderers[moduleType]; + + const filePath = id.replace(/\?\w+$/, ''); + const extension = maybeExtension.replace(/\?\w+$/, ''); + + const data = await fs.readFile(filePath); + const base64 = data.toString('base64'); + + const inlineModule = moduleLoader(data); + + if (isDev) { + // no need to wire up the assets in dev mode, just rewrite + return inlineModule; + } + // just some shared ID + const hash = hashString(base64); + // emit the wasm binary as an asset file, to be picked up later by the esbuild bundle for the worker. + // give it a shared deterministic name to make things easy for esbuild to switch on later + const assetName = `${path.basename(filePath).split('.')[0]}.${hash}${extension}`; + this.emitFile({ + type: 'asset', + // emit the data explicitly as an esset with `fileName` rather than `name` so that + // vite doesn't give it a random hash-id in its name--We need to be able to easily rewrite from + // the .mjs loader and the actual wasm asset later in the ESbuild for the worker + fileName: assetName, + source: data, + }); + + // however, by default, the SSG generator cannot import the .wasm as a module, so embed as a base64 string + const chunkId = this.emitFile({ + type: 'prebuilt-chunk', + fileName: `${assetName}.mjs`, + code: inlineModule, + }); + + return `import module from "${MAGIC_STRING}${chunkId}${extension}.mjs";export default module;`; + }, + + // output original wasm file relative to the chunk now that chunking has been achieved + renderChunk(code, chunk, _) { + if (isDev) return; + + if (!code.includes(MAGIC_STRING)) return; + + // SSR will need the .mjs suffix removed from the import before this works in cloudflare, but this is done as a final step + // so as to support prerendering from nodejs runtime + let replaced = code; + for (const ext of extensions) { + const extension = ext.replace(/\?\w+$/, ''); + // chunk id can be many things, (alpha numeric, dollars, or underscores, maybe more) + replaced = replaced.replaceAll( + new RegExp(`${MAGIC_STRING}([^\\s]+?)${escapeRegExp(extension)}\\.mjs`, 'g'), + (_s, assetId) => { + const fileName = this.getFileName(assetId); + const relativePath = path + .relative(path.dirname(chunk.fileName), fileName) + .replaceAll('\\', '/'); // fix windows paths for import + + // record this replacement for later, to adjust it to import the unbundled asset + replacements.push({ + chunkName: chunk.name, + cloudflareImport: relativePath.replace(/\.mjs$/, ''), + nodejsImport: relativePath, + }); + return `./${relativePath}`; + }, + ); + } + + return { code: replaced }; + }, + + generateBundle(_, bundle: OutputBundle) { + // associate the chunk name to the final file name. After the prerendering is done, we can use this to replace the imports in the _worker.js + // in a targetted way + const replacementsByChunkName = new Map(); + for (const replacement of replacements) { + const repls = replacementsByChunkName.get(replacement.chunkName) || []; + if (!repls.length) { + replacementsByChunkName.set(replacement.chunkName, repls); + } + repls.push(replacement); + } + for (const chunk of Object.values(bundle)) { + const repls = chunk.name && replacementsByChunkName.get(chunk.name); + for (const replacement of repls || []) { + if (!replacement.fileName) { + replacement.fileName = [] as string[]; + } + replacement.fileName.push(chunk.fileName); + } + } + }, + + /** + * Once prerendering is complete, restore the imports in the _worker.js to cloudflare compatible ones, removing the .mjs suffix. + */ + async afterBuildCompleted(config: AstroConfig) { + const baseDir = url.fileURLToPath(config.outDir); + const replacementsByFileName = new Map(); + for (const replacement of replacements) { + if (!replacement.fileName) { + continue; + } + for (const fileName of replacement.fileName) { + const repls = replacementsByFileName.get(fileName) || []; + if (!repls.length) { + replacementsByFileName.set(fileName, repls); + } + repls.push(replacement); + } + } + for (const [fileName, repls] of replacementsByFileName.entries()) { + const filepath = path.join(baseDir, '_worker.js', fileName); + const contents = await fs.readFile(filepath, 'utf-8'); + let updated = contents; + for (const replacement of repls) { + updated = updated.replaceAll(replacement.nodejsImport, replacement.cloudflareImport); + } + await fs.writeFile(filepath, updated, 'utf-8'); + } + }, + }; +} + +interface Replacement { + fileName?: string[]; + chunkName: string; + // desired import for cloudflare + cloudflareImport: string; + // nodejs import that simulates a wasm module + nodejsImport: string; +} + +const renderers: Record string> = { + CompiledWasm(fileContents: Buffer) { + const base64 = fileContents.toString('base64'); + return `const wasmModule = new WebAssembly.Module(Uint8Array.from(atob("${base64}"), c => c.charCodeAt(0)));export default wasmModule;`; + }, + Data(fileContents: Buffer) { + const base64 = fileContents.toString('base64'); + return `const binModule = Uint8Array.from(atob("${base64}"), c => c.charCodeAt(0)).buffer;export default binModule;`; + }, + Text(fileContents: Buffer) { + const escaped = JSON.stringify(fileContents.toString('utf-8')); + return `const stringModule = ${escaped};export default stringModule;`; + }, +}; + +const defaultAdapters: Record = { + // Loads '*.wasm?module' imports as WebAssembly modules, which is the only way to load WASM in cloudflare workers. + // Current proposal for WASM modules: https://github.com/WebAssembly/esm-integration/tree/main/proposals/esm-integration + '.wasm?module': 'CompiledWasm', + // treats the module as a WASM module + '.wasm': 'CompiledWasm', + '.bin': 'Data', + '.txt': 'Text', +}; + +/** + * Returns a deterministic 32 bit hash code from a string + */ +function hashString(str: string): string { + let hash = 0; + for (let i = 0; i < str.length; i++) { + const char = str.charCodeAt(i); + hash = (hash << 5) - hash + char; + hash &= hash; // Convert to 32bit integer + } + return new Uint32Array([hash])[0].toString(36); +} + +function escapeRegExp(string: string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string +} diff --git a/packages/integrations/cloudflare/src/utils/env.ts b/packages/integrations/cloudflare/src/utils/env.ts new file mode 100644 index 000000000000..e450038ebd90 --- /dev/null +++ b/packages/integrations/cloudflare/src/utils/env.ts @@ -0,0 +1,15 @@ +import type { GetEnv } from 'astro/env/setup'; + +export const createGetEnv = + (env: Record): GetEnv => + (key) => { + const v = env[key]; + if (typeof v === 'undefined' || typeof v === 'string') { + return v; + } + if (typeof v === 'boolean' || typeof v === 'number') { + // let astro:env handle the validation and transformation + return v.toString(); + } + return undefined; + }; diff --git a/packages/integrations/cloudflare/src/utils/generate-routes-json.ts b/packages/integrations/cloudflare/src/utils/generate-routes-json.ts new file mode 100644 index 000000000000..eea7c38e1ca7 --- /dev/null +++ b/packages/integrations/cloudflare/src/utils/generate-routes-json.ts @@ -0,0 +1,348 @@ +import type { + AstroConfig, + AstroIntegrationLogger, + IntegrationResolvedRoute, + RoutePart, +} from 'astro'; + +import { existsSync } from 'node:fs'; +import { writeFile } from 'node:fs/promises'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { + prependForwardSlash, + removeLeadingForwardSlash, + removeTrailingForwardSlash, +} from '@astrojs/internal-helpers/path'; +import glob from 'tiny-glob'; + +// Copied from https://github.com/withastro/astro/blob/3776ecf0aa9e08a992d3ae76e90682fd04093721/packages/astro/src/core/routing/manifest/create.ts#L45-L70 +// We're not sure how to improve this regex yet +// eslint-disable-next-line regexp/no-super-linear-backtracking +const ROUTE_DYNAMIC_SPLIT = /\[(.+?\(.+?\)|.+?)\]/; +const ROUTE_SPREAD = /^\.{3}.+$/; +export function getParts(part: string) { + const result: RoutePart[] = []; + part.split(ROUTE_DYNAMIC_SPLIT).map((str, i) => { + if (!str) return; + const dynamic = i % 2 === 1; + + const [, content] = dynamic ? /([^(]+)$/.exec(str) || [null, null] : [null, str]; + + if (!content || (dynamic && !/^(?:\.\.\.)?[\w$]+$/.test(content))) { + throw new Error('Parameter name must match /^[a-zA-Z0-9_$]+$/'); + } + + result.push({ + content, + dynamic, + spread: dynamic && ROUTE_SPREAD.test(content), + }); + }); + + return result; +} + +async function writeRoutesFileToOutDir( + _config: AstroConfig, + logger: AstroIntegrationLogger, + include: string[], + exclude: string[], +) { + try { + await writeFile( + new URL('./_routes.json', _config.outDir), + JSON.stringify( + { + version: 1, + include: include, + exclude: exclude, + }, + null, + 2, + ), + 'utf-8', + ); + } catch (_error) { + logger.error("There was an error writing the '_routes.json' file to the output directory."); + } +} + +function segmentsToCfSyntax(segments: IntegrationResolvedRoute['segments'], _config: AstroConfig) { + const pathSegments = []; + if (removeLeadingForwardSlash(removeTrailingForwardSlash(_config.base)).length > 0) { + pathSegments.push(removeLeadingForwardSlash(removeTrailingForwardSlash(_config.base))); + } + for (const segment of segments.flat()) { + if (segment.dynamic) pathSegments.push('*'); + else pathSegments.push(segment.content); + } + return pathSegments; +} + +class TrieNode { + children = new Map(); + isEndOfPath = false; + hasWildcardChild = false; +} + +class PathTrie { + root: TrieNode; + returnHasWildcard = false; + + constructor() { + this.root = new TrieNode(); + } + + insert(thisPath: string[]) { + let node = this.root; + for (const segment of thisPath) { + if (segment === '*') { + node.hasWildcardChild = true; + break; + } + if (!node.children.has(segment)) { + node.children.set(segment, new TrieNode()); + } + + node = node.children.get(segment)!; + } + + node.isEndOfPath = true; + } + + /** + * Depth-first search (dfs), traverses the "graph" segment by segment until the end or wildcard (*). + * It makes sure that all necessary paths are returned, but not paths with an existing wildcard prefix. + * e.g. if we have a path like /foo/* and /foo/bar, we only want to return /foo/* + */ + private dfs(node: TrieNode, thisPath: string[], allPaths: string[][]): void { + if (node.hasWildcardChild) { + this.returnHasWildcard = true; + allPaths.push([...thisPath, '*']); + return; + } + + if (node.isEndOfPath) { + allPaths.push([...thisPath]); + } + + for (const [segment, childNode] of node.children) { + this.dfs(childNode, [...thisPath, segment], allPaths); + } + } + + /** + * The reduce function is used to remove unnecessary paths from the trie. + * It receives a trie node to compare with the current node. + */ + private reduce(compNode: TrieNode, node: TrieNode): void { + if (node.hasWildcardChild || compNode.hasWildcardChild) return; + + for (const [segment, childNode] of node.children) { + if (childNode.children.size === 0) continue; + + const compChildNode = compNode.children.get(segment); + if (compChildNode === undefined) { + childNode.hasWildcardChild = true; + continue; + } + + this.reduce(compChildNode, childNode); + } + } + + reduceAllPaths(compTrie: PathTrie): this { + this.reduce(compTrie.root, this.root); + return this; + } + + getAllPaths(): [string[][], boolean] { + const allPaths: string[][] = []; + this.dfs(this.root, [], allPaths); + return [allPaths, this.returnHasWildcard]; + } +} + +export async function createRoutesFile( + _config: AstroConfig, + logger: AstroIntegrationLogger, + routes: IntegrationResolvedRoute[], + pages: { + pathname: string; + }[], + redirects: IntegrationResolvedRoute['segments'][], + includeExtends: + | { + pattern: string; + }[] + | undefined, + excludeExtends: + | { + pattern: string; + }[] + | undefined, +) { + const includePaths: string[][] = []; + const excludePaths: string[][] = []; + + /** + * All files in the `_config.build.assets` path, e.g. `_astro` + * are considered static assets and should not be handled by the function + * therefore we exclude a wildcard for that, e.g. `/_astro/*` + */ + const assetsPath = segmentsToCfSyntax( + [ + [{ content: _config.build.assets, dynamic: false, spread: false }], + [{ content: '', dynamic: true, spread: false }], + ], + _config, + ); + excludePaths.push(assetsPath); + + for (const redirect of redirects) { + excludePaths.push(segmentsToCfSyntax(redirect, _config)); + } + + if (existsSync(fileURLToPath(_config.publicDir))) { + const staticFiles = await glob(`${fileURLToPath(_config.publicDir)}/**/*`, { + cwd: fileURLToPath(_config.publicDir), + filesOnly: true, + dot: true, + }); + for (const staticFile of staticFiles) { + if (['_headers', '_redirects', '_routes.json'].includes(staticFile)) continue; + const staticPath = staticFile; + + const segments = removeLeadingForwardSlash(staticPath) + .split(path.sep) + .filter(Boolean) + .map((s: string) => { + return getParts(s); + }); + excludePaths.push(segmentsToCfSyntax(segments, _config)); + } + } + + let hasPrerendered404 = false; + for (const route of routes) { + const convertedPath = segmentsToCfSyntax(route.segments, _config); + if (route.pathname === '/404' && route.isPrerendered === true) hasPrerendered404 = true; + + // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check + switch (route.type) { + case 'page': + if (route.isPrerendered === false) includePaths.push(convertedPath); + + break; + + case 'endpoint': + if (route.isPrerendered === false) includePaths.push(convertedPath); + else excludePaths.push(convertedPath); + + break; + + case 'redirect': + excludePaths.push(convertedPath); + + break; + + default: + /** + * We don't know the type, so we are conservative! + * Invoking the function on these is a safe-bet because + * the function will fallback to static asset fetching + */ + includePaths.push(convertedPath); + + break; + } + } + + for (const page of pages) { + if (page.pathname === '404') hasPrerendered404 = true; + const pageSegments = removeLeadingForwardSlash(page.pathname) + .split(path.posix.sep) + .filter(Boolean) + .map((s) => { + return getParts(s); + }); + excludePaths.push(segmentsToCfSyntax(pageSegments, _config)); + } + + const includeTrie = new PathTrie(); + for (const includePath of includePaths) { + includeTrie.insert(includePath); + } + + const excludeTrie = new PathTrie(); + for (const excludePath of excludePaths) { + /** + * A excludePath with starts with a wildcard (*) is a catch-all + * that would mean all routes are static, that would be equal to a full SSG project + * the adapter is not needed in this case, so we do not consider such paths + */ + if (excludePath[0] === '*') continue; + excludeTrie.insert(excludePath); + } + + const [deduplicatedIncludePaths, includedPathsHaveWildcard] = includeTrie + .reduceAllPaths(excludeTrie) + .getAllPaths(); + + const [deduplicatedExcludePaths, _excludedPathsHaveWildcard] = excludeTrie + .reduceAllPaths(includeTrie) + .getAllPaths(); + + /** + * Cloudflare allows no more than 100 include/exclude rules combined + * https://developers.cloudflare.com/pages/functions/routing/#limits + */ + const CLOUDFLARE_COMBINED_LIMIT = 100; + /** + * Caluclate the number of automated and extended include rules + */ + const AUTOMATIC_INCLUDE_RULES_COUNT = deduplicatedIncludePaths.length; + const EXTENDED_INCLUDE_RULES_COUNT = includeExtends?.length ?? 0; + const INCLUDE_RULES_COUNT = AUTOMATIC_INCLUDE_RULES_COUNT + EXTENDED_INCLUDE_RULES_COUNT; + /** + * Caluclate the number of automated and extended exclude rules + */ + const AUTOMATIC_EXCLUDE_RULES_COUNT = deduplicatedExcludePaths.length; + const EXTENDED_EXCLUDE_RULES_COUNT = excludeExtends?.length ?? 0; + const EXCLUDE_RULES_COUNT = AUTOMATIC_EXCLUDE_RULES_COUNT + EXTENDED_EXCLUDE_RULES_COUNT; + + const OPTION2_TOTAL_COUNT = + INCLUDE_RULES_COUNT + (includedPathsHaveWildcard ? EXCLUDE_RULES_COUNT : 0); + + if (!hasPrerendered404 || OPTION2_TOTAL_COUNT > CLOUDFLARE_COMBINED_LIMIT) { + await writeRoutesFileToOutDir( + _config, + logger, + ['/*'].concat(includeExtends?.map((entry) => entry.pattern) ?? []), + deduplicatedExcludePaths + .map((thisPath) => `${prependForwardSlash(thisPath.join('/'))}`) + .slice( + 0, + CLOUDFLARE_COMBINED_LIMIT - + EXTENDED_INCLUDE_RULES_COUNT - + EXTENDED_EXCLUDE_RULES_COUNT - + 1, + ) + .concat(excludeExtends?.map((entry) => entry.pattern) ?? []), + ); + } else { + await writeRoutesFileToOutDir( + _config, + logger, + deduplicatedIncludePaths + .map((thisPath) => `${prependForwardSlash(thisPath.join('/'))}`) + .concat(includeExtends?.map((entry) => entry.pattern) ?? []), + includedPathsHaveWildcard + ? deduplicatedExcludePaths + .map((thisPath) => `${prependForwardSlash(thisPath.join('/'))}`) + .concat(excludeExtends?.map((entry) => entry.pattern) ?? []) + : [], + ); + } +} diff --git a/packages/integrations/cloudflare/src/utils/image-config.ts b/packages/integrations/cloudflare/src/utils/image-config.ts new file mode 100644 index 000000000000..f9ed1a709fd1 --- /dev/null +++ b/packages/integrations/cloudflare/src/utils/image-config.ts @@ -0,0 +1,44 @@ +import type { AstroConfig, AstroIntegrationLogger, HookParameters } from 'astro'; +import { passthroughImageService, sharpImageService } from 'astro/config'; + +export function setImageConfig( + service: string, + config: AstroConfig['image'], + command: HookParameters<'astro:config:setup'>['command'], + logger: AstroIntegrationLogger, +) { + switch (service) { + case 'passthrough': + return { ...config, service: passthroughImageService() }; + + case 'cloudflare': + return { + ...config, + service: + command === 'dev' + ? sharpImageService() + : { entrypoint: '@astrojs/cloudflare/image-service' }, + }; + + case 'compile': + return { + ...config, + service: sharpImageService(), + endpoint: { + entrypoint: command === 'dev' ? undefined : '@astrojs/cloudflare/image-endpoint', + }, + }; + + case 'custom': + return { ...config }; + + default: + if (config.service.entrypoint === 'astro/assets/services/sharp') { + logger.warn( + `The current configuration does not support image optimization. To allow your project to build with the original, unoptimized images, the image service has been automatically switched to the 'noop' option. See https://docs.astro.build/en/reference/configuration-reference/#imageservice`, + ); + return { ...config, service: passthroughImageService() }; + } + return { ...config }; + } +} diff --git a/packages/integrations/cloudflare/src/utils/non-server-chunk-detector.ts b/packages/integrations/cloudflare/src/utils/non-server-chunk-detector.ts new file mode 100644 index 000000000000..16ba2aed9af5 --- /dev/null +++ b/packages/integrations/cloudflare/src/utils/non-server-chunk-detector.ts @@ -0,0 +1,85 @@ +import type { OutputBundle } from 'rollup'; +import type { PluginOption } from 'vite'; + +/** + * A Vite bundle analyzer that identifies chunks that are not used for server rendering. + * + * The chunks injected by Astro for prerendering are flagged as non-server chunks. + * Any chunks that is only used by a non-server chunk are also flagged as non-server chunks. + * This continues transitively until all non-server chunks are found. + */ +export class NonServerChunkDetector { + private nonServerChunks?: string[]; + + public getPlugin(): PluginOption { + return { + name: 'non-server-chunk-detector', + generateBundle: (_, bundle) => { + // Skip if we bundle for client + if (!bundle['index.js']) return; + this.processBundle(bundle); + }, + }; + } + + private processBundle(bundle: OutputBundle) { + const chunkNamesToFiles = new Map(); + + const entryChunks: string[] = []; + const chunkToDependencies = new Map(); + + for (const chunk of Object.values(bundle)) { + if (chunk.type !== 'chunk') continue; + + // Construct a mapping from a chunk name to its file name + chunkNamesToFiles.set(chunk.name, chunk.fileName); + // Construct a mapping from a chunk file to all the modules it imports + chunkToDependencies.set(chunk.fileName, [...chunk.imports, ...chunk.dynamicImports]); + + if (chunk.isEntry) { + // Entry chunks should always be kept around since they are to be imported by the runtime + entryChunks.push(chunk.fileName); + } + } + + const chunkDecisions = new Map(); + + for (const entry of entryChunks) { + // Entry chunks are used on the server + chunkDecisions.set(entry, true); + } + + for (const chunk of ['prerender', 'prerender@_@astro']) { + // Prerender chunks are not used on the server + const fileName = chunkNamesToFiles.get(chunk); + if (fileName) { + chunkDecisions.set(fileName, false); + } + } + + // Start a stack of chunks that are used on the server + const chunksToWalk = [...entryChunks]; + + // Iterate over the chunks, traversing the transitive dependencies of the chunks used on the server + for (let chunk = chunksToWalk.pop(); chunk; chunk = chunksToWalk.pop()) { + for (const dep of chunkToDependencies.get(chunk) ?? []) { + // Skip dependencies already flagged, dependencies may be repeated and/or circular + if (chunkDecisions.has(dep)) continue; + + // A dependency of a module used on the server is also used on the server + chunkDecisions.set(dep, true); + // Add the dependency to the stack so its own dependencies are also flagged + chunksToWalk.push(dep); + } + } + + // Any chunk not flagged as used on the server is a non-server chunk + this.nonServerChunks = Array.from(chunkToDependencies.keys()).filter( + (chunk) => !chunkDecisions.get(chunk), + ); + } + + public getNonServerChunks(): string[] { + return this.nonServerChunks ?? []; + } +} diff --git a/packages/integrations/cloudflare/test/_test-utils.js b/packages/integrations/cloudflare/test/_test-utils.js new file mode 100644 index 000000000000..381c66a8b8b0 --- /dev/null +++ b/packages/integrations/cloudflare/test/_test-utils.js @@ -0,0 +1,67 @@ +import { fileURLToPath } from 'node:url'; +import { execa } from 'execa'; +import { loadFixture as baseLoadFixture } from '../../../astro/test/test-utils.js'; + +/** + * @typedef {{ stop: Promise, port: number }} WranglerCLI + */ + +const astroPath = fileURLToPath(new URL('../node_modules/astro/astro.js', import.meta.url)); +/** Returns a process running the Astro CLI. */ +export function astroCli(cwd, /** @type {string[]} */ ...args) { + const spawned = execa(astroPath, [...args], { + env: { ASTRO_TELEMETRY_DISABLED: true }, + cwd: cwd, + }); + + spawned.stdout.setEncoding('utf8'); + + return spawned; +} + +const wranglerPath = fileURLToPath( + new URL('../node_modules/wrangler/bin/wrangler.js', import.meta.url), +); + +/** Returns a process running the Wrangler CLI. */ +export function wranglerCli(cwd) { + const spawned = execa( + wranglerPath, + [ + 'pages', + 'dev', + 'dist', + '--ip', + '127.0.0.1', + '--port', + '8788', + '--compatibility-date', + new Date().toISOString().slice(0, 10), + '--log-level', + 'info', + ], + { + env: { CI: 1, CF_PAGES: 1 }, + cwd: cwd, + }, + ); + + spawned.stdout.setEncoding('utf8'); + spawned.stderr.setEncoding('utf8'); + + return spawned; +} + +/** + * @typedef {import('../../../astro/test/test-utils').Fixture} Fixture + */ +export function loadFixture(inlineConfig) { + if (!inlineConfig?.root) throw new Error("Must provide { root: './fixtures/...' }"); + + // resolve the relative root (i.e. "./fixtures/tailwindcss") to a full filepath + // without this, the main `loadFixture` helper will resolve relative to `packages/astro/test` + return baseLoadFixture({ + ...inlineConfig, + root: new URL(inlineConfig.root, import.meta.url).toString(), + }); +} diff --git a/packages/integrations/cloudflare/test/astro-dev-platform.test.js b/packages/integrations/cloudflare/test/astro-dev-platform.test.js new file mode 100644 index 000000000000..ab47e0aa494f --- /dev/null +++ b/packages/integrations/cloudflare/test/astro-dev-platform.test.js @@ -0,0 +1,72 @@ +import * as assert from 'node:assert/strict'; +import { after, before, describe, it } from 'node:test'; +import { fileURLToPath } from 'node:url'; +import * as cheerio from 'cheerio'; +import { astroCli } from './_test-utils.js'; + +const root = new URL('./fixtures/astro-dev-platform/', import.meta.url); +describe('AstroDevPlatform', () => { + let cli; + before(async () => { + cli = astroCli(fileURLToPath(root), 'dev', '--host', '127.0.0.1'); + await new Promise((resolve) => { + cli.stdout.on('data', (data) => { + if (data.includes('http://127.0.0.1:4321/')) { + resolve(); + } + }); + }); + }); + + after((_done) => { + cli.kill(); + }); + + it('exists', async () => { + const res = await fetch('http://127.0.0.1:4321/'); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('#hasRuntime').text().includes('true'), true); + }); + + it('adds cf object', async () => { + const res = await fetch('http://127.0.0.1:4321/'); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('#hasCF').text(), 'true'); + }); + + it('adds cache mocking', async () => { + const res = await fetch('http://127.0.0.1:4321/caches'); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('#hasCACHE').text(), 'true'); + }); + + it('adds D1 mocking', async () => { + const res = await fetch('http://127.0.0.1:4321/d1'); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('#hasDB').text(), 'true'); + assert.equal($('#hasPRODDB').text(), 'true'); + assert.equal($('#hasACCESS').text(), 'true'); + }); + + it('adds R2 mocking', async () => { + const res = await fetch('http://127.0.0.1:4321/r2'); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('#hasBUCKET').text(), 'true'); + assert.equal($('#hasPRODBUCKET').text(), 'true'); + assert.equal($('#hasACCESS').text(), 'true'); + }); + + it('adds KV mocking', async () => { + const res = await fetch('http://127.0.0.1:4321/kv'); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('#hasKV').text(), 'true'); + assert.equal($('#hasPRODKV').text(), 'true'); + assert.equal($('#hasACCESS').text(), 'true'); + }); +}); diff --git a/packages/integrations/cloudflare/test/astro-env.test.js b/packages/integrations/cloudflare/test/astro-env.test.js new file mode 100644 index 000000000000..a20d20dd9698 --- /dev/null +++ b/packages/integrations/cloudflare/test/astro-env.test.js @@ -0,0 +1,65 @@ +import * as assert from 'node:assert/strict'; +import { after, before, describe, it } from 'node:test'; +import { fileURLToPath } from 'node:url'; +import * as cheerio from 'cheerio'; +import { astroCli, wranglerCli } from './_test-utils.js'; + +const root = new URL('./fixtures/astro-env/', import.meta.url); + +describe('astro:env', () => { + let wrangler; + + before(async () => { + process.env.API_URL = 'https://google.de'; + process.env.PORT = '4322'; + await astroCli(fileURLToPath(root), 'build'); + + wrangler = wranglerCli(fileURLToPath(root)); + await new Promise((resolve) => { + wrangler.stdout.on('data', (data) => { + // console.log('[stdout]', data.toString()); + if (data.toString().includes('http://127.0.0.1:8788')) resolve(); + }); + wrangler.stderr.on('data', (_data) => { + // console.log('[stderr]', data.toString()); + }); + }); + }); + + after(() => { + wrangler.kill(); + }); + + it('runtime', async () => { + const res = await fetch('http://127.0.0.1:8788/'); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal( + $('#runtime').text().includes('https://google.de') && + $('#runtime').text().includes('4322') && + $('#runtime').text().includes('123456789'), + true, + ); + }); + + it('client', async () => { + const res = await fetch('http://127.0.0.1:8788/'); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('#client').text().includes('https://google.de'), true); + }); + + it('server', async () => { + const res = await fetch('http://127.0.0.1:8788/'); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('#server').text().includes('4322'), true); + }); + + it('secret', async () => { + const res = await fetch('http://127.0.0.1:8788/'); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('#secret').text().includes('123456789'), true); + }); +}); diff --git a/packages/integrations/cloudflare/test/external-image-service.test.js b/packages/integrations/cloudflare/test/external-image-service.test.js new file mode 100644 index 000000000000..80ff2140fcb9 --- /dev/null +++ b/packages/integrations/cloudflare/test/external-image-service.test.js @@ -0,0 +1,22 @@ +import * as assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { describe, it } from 'node:test'; +import { fileURLToPath } from 'node:url'; +import glob from 'tiny-glob'; +import { astroCli } from './_test-utils.js'; + +const root = new URL('./fixtures/external-image-service/', import.meta.url); + +describe('ExternalImageService', () => { + it('has correct image service', async () => { + await astroCli(fileURLToPath(root), 'build'); + const files = await glob('**/image-service_*.mjs', { + cwd: fileURLToPath(new URL('dist/_worker.js', root)), + filesOnly: true, + absolute: true, + flush: true, + }); + const outFileToCheck = readFileSync(files[0], 'utf-8'); + assert.equal(outFileToCheck.includes('cdn-cgi/image'), true); + }); +}); diff --git a/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/.dev.vars b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/.dev.vars new file mode 100644 index 000000000000..641dd0791d50 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/.dev.vars @@ -0,0 +1 @@ +DATABASE_URL="postgresql://loremMe" diff --git a/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/astro.config.ts b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/astro.config.ts new file mode 100644 index 000000000000..95234c069ab7 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/astro.config.ts @@ -0,0 +1,11 @@ +import cloudflare from '@astrojs/cloudflare'; +import { defineConfig } from 'astro/config'; + +export default defineConfig({ + adapter: cloudflare({ + platformProxy: { + enabled: true, + }, + }), + output: 'server', +}); diff --git a/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/package.json b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/package.json new file mode 100644 index 000000000000..2363224b1371 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/package.json @@ -0,0 +1,12 @@ +{ + "name": "@test/astro-cloudflare-astro-dev-platform", + "version": "0.0.0", + "private": true, + "dependencies": { + "@astrojs/cloudflare": "workspace:*", + "astro": "workspace:*" + }, + "devDependencies": { + "wrangler": "^3.101.0" + } +} diff --git a/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/env.d.ts b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/env.d.ts new file mode 100644 index 000000000000..9bc5cb41c24e --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/env.d.ts @@ -0,0 +1 @@ +/// \ No newline at end of file diff --git a/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/pages/caches.astro b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/pages/caches.astro new file mode 100644 index 000000000000..743111721e53 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/pages/caches.astro @@ -0,0 +1,15 @@ +--- +const runtime = Astro.locals.runtime; +--- + + + + + + + CACHES + + +
{!!runtime.caches}
+ + diff --git a/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/pages/d1.astro b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/pages/d1.astro new file mode 100644 index 000000000000..a28940e9fe46 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/pages/d1.astro @@ -0,0 +1,21 @@ +--- +const runtime = Astro.locals.runtime; +const db = runtime.env?.D1; +await db.exec("CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT)"); +await db.exec("INSERT INTO test (name) VALUES ('true')"); +const result = await db.prepare("SELECT * FROM test").all(); +--- + + + + + + + D1 + + +
{!!runtime.env?.D1}
+
{!!runtime.env?.D1_PROD}
+
{!!result.results[0].name}
+ + diff --git a/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/pages/index.astro b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/pages/index.astro new file mode 100644 index 000000000000..7d2ce1ef157f --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/pages/index.astro @@ -0,0 +1,13 @@ +--- +const runtime = Astro.locals.runtime; +--- + + + Testing + + +

Testing

+
{!!runtime}
+
{!!runtime.cf?.colo}
+ + diff --git a/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/pages/kv.astro b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/pages/kv.astro new file mode 100644 index 000000000000..d21f163a092c --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/pages/kv.astro @@ -0,0 +1,20 @@ +--- +const runtime = Astro.locals.runtime; +const kv = runtime.env?.KV; +await kv.put("test", "true"); +const result = await kv.get("test") +--- + + + + + + + KV + + +
{!!runtime.env?.KV}
+
{!!runtime.env?.KV_PROD}
+
{!!result}
+ + diff --git a/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/pages/r2.astro b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/pages/r2.astro new file mode 100644 index 000000000000..fbb9fc61b03f --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/src/pages/r2.astro @@ -0,0 +1,20 @@ +--- +const runtime = Astro.locals.runtime; +const bucket = runtime.env?.R2; +await bucket.put("test", "true"); +const result = await (await bucket.get("test")).text() +--- + + + + + + + R2 + + +
{!!runtime.env?.R2}
+
{!!runtime.env?.R2_PROD}
+
{!!result}
+ + diff --git a/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/wrangler.toml b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/wrangler.toml new file mode 100644 index 000000000000..3119ab45b902 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-dev-platform/wrangler.toml @@ -0,0 +1,29 @@ +name = "test" + +kv_namespaces = [ + { binding = "KV", id = "", preview_id = "" }, + { binding = "KV_PROD", id = "", preview_id = "" }, +] + +[vars] +COOL = "ME" + +[[d1_databases]] +binding = "D1" +database_name = "" +database_id = "" +preview_database_id = "D1" + +[[d1_databases]] +binding = "D1_PROD" +database_name = "" +database_id = "" +preview_database_id = "D1_PROD" + +[[r2_buckets]] +binding = 'R2' +bucket_name = '' + +[[r2_buckets]] +binding = 'R2_PROD' +bucket_name = '' diff --git a/packages/integrations/cloudflare/test/fixtures/astro-env/.dev.vars b/packages/integrations/cloudflare/test/fixtures/astro-env/.dev.vars new file mode 100644 index 000000000000..3cf69c1f5fdb --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-env/.dev.vars @@ -0,0 +1 @@ +API_SECRET=123456789 diff --git a/packages/integrations/cloudflare/test/fixtures/astro-env/astro.config.ts b/packages/integrations/cloudflare/test/fixtures/astro-env/astro.config.ts new file mode 100644 index 000000000000..b7d556b3bda5 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-env/astro.config.ts @@ -0,0 +1,14 @@ +import cloudflare from '@astrojs/cloudflare'; +import { defineConfig, envField } from 'astro/config'; + +export default defineConfig({ + env: { + schema: { + API_URL: envField.string({ context: 'client', access: 'public', optional: true }), + PORT: envField.number({ context: 'server', access: 'public', default: 4321 }), + API_SECRET: envField.string({ context: 'server', access: 'secret' }), + }, + }, + adapter: cloudflare(), + output: 'server', +}); diff --git a/packages/integrations/cloudflare/test/fixtures/astro-env/package.json b/packages/integrations/cloudflare/test/fixtures/astro-env/package.json new file mode 100644 index 000000000000..f91b3fe6e7e5 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-env/package.json @@ -0,0 +1,12 @@ +{ + "name": "@test/astro-cloudflare-astro-env", + "version": "0.0.0", + "private": true, + "dependencies": { + "@astrojs/cloudflare": "workspace:*", + "astro": "workspace:*" + }, + "devDependencies": { + "wrangler": "^3.101.0" + } +} diff --git a/packages/integrations/cloudflare/test/fixtures/astro-env/src/env.d.ts b/packages/integrations/cloudflare/test/fixtures/astro-env/src/env.d.ts new file mode 100644 index 000000000000..60f5ec0d0784 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-env/src/env.d.ts @@ -0,0 +1,13 @@ +/// +/// +/// + +type Runtime = import('@astrojs/cloudflare').Runtime; + +declare namespace App { + interface Locals extends Runtime { + otherLocals: { + test: string; + }; + } +} \ No newline at end of file diff --git a/packages/integrations/cloudflare/test/fixtures/astro-env/src/pages/index.astro b/packages/integrations/cloudflare/test/fixtures/astro-env/src/pages/index.astro new file mode 100644 index 000000000000..7e50474edd94 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-env/src/pages/index.astro @@ -0,0 +1,27 @@ +--- +import { API_URL } from "astro:env/client" +import { PORT, API_SECRET } from "astro:env/server" + +const runtime = Astro.locals.runtime; +--- + + + Astro Env + + +

Astro Env

+
{JSON.stringify(runtime.env, null, 2)}
+
+ API_URL + {API_URL} +
+
+ PORT + {PORT} +
+
+ API_SECRET + {API_SECRET} +
+ + diff --git a/packages/integrations/cloudflare/test/fixtures/astro-env/tsconfig.json b/packages/integrations/cloudflare/test/fixtures/astro-env/tsconfig.json new file mode 100644 index 000000000000..c02b48a37e86 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-env/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "astro/tsconfigs/strict" +} \ No newline at end of file diff --git a/packages/integrations/cloudflare/test/fixtures/astro-env/wrangler.toml b/packages/integrations/cloudflare/test/fixtures/astro-env/wrangler.toml new file mode 100644 index 000000000000..121ab5993ac1 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/astro-env/wrangler.toml @@ -0,0 +1,5 @@ +name = "astro-env" + +[vars] +API_URL = "https://google.de" +PORT = 4322 diff --git a/packages/integrations/cloudflare/test/fixtures/compile-image-service/astro.config.mjs b/packages/integrations/cloudflare/test/fixtures/compile-image-service/astro.config.mjs new file mode 100644 index 000000000000..7c98bbb98803 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/compile-image-service/astro.config.mjs @@ -0,0 +1,9 @@ +import cloudflare from '@astrojs/cloudflare'; +import { defineConfig } from 'astro/config'; + +export default defineConfig({ + adapter: cloudflare({ + imageService: 'compile', + }), + output: 'static', +}); diff --git a/packages/integrations/cloudflare/test/fixtures/compile-image-service/package.json b/packages/integrations/cloudflare/test/fixtures/compile-image-service/package.json new file mode 100644 index 000000000000..4dd1c0bb70ad --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/compile-image-service/package.json @@ -0,0 +1,9 @@ +{ + "name": "@test/astro-cloudflare-compile-image-service", + "version": "0.0.0", + "private": true, + "dependencies": { + "@astrojs/cloudflare": "workspace:*", + "astro": "workspace:*" + } +} diff --git a/packages/integrations/cloudflare/test/fixtures/compile-image-service/src/content/blog/post/index.md b/packages/integrations/cloudflare/test/fixtures/compile-image-service/src/content/blog/post/index.md new file mode 100644 index 000000000000..01654f3eacb6 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/compile-image-service/src/content/blog/post/index.md @@ -0,0 +1,5 @@ +--- +image: './placeholder.jpg' +--- + +![placeholder](./placeholder.jpg) diff --git a/packages/integrations/cloudflare/test/fixtures/compile-image-service/src/content/blog/post/placeholder.jpg b/packages/integrations/cloudflare/test/fixtures/compile-image-service/src/content/blog/post/placeholder.jpg new file mode 100644 index 000000000000..f4fc88e293c2 Binary files /dev/null and b/packages/integrations/cloudflare/test/fixtures/compile-image-service/src/content/blog/post/placeholder.jpg differ diff --git a/packages/integrations/cloudflare/test/fixtures/compile-image-service/src/content/config.ts b/packages/integrations/cloudflare/test/fixtures/compile-image-service/src/content/config.ts new file mode 100644 index 000000000000..ce06042f6ae3 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/compile-image-service/src/content/config.ts @@ -0,0 +1,23 @@ +import type { ImageMetadata } from 'astro'; +import { defineCollection, z } from 'astro:content'; + +const blog = defineCollection({ + schema: ({ image }) => + z.object({ + image: z + .string() + .regex(/^https:.*/) + .transform( + (url) => + ({ + src: url, + width: 1200, + height: 630, + format: 'jpeg', + }) satisfies ImageMetadata + ) + .or(image()), + }), +}); + +export const collections = { blog }; diff --git a/packages/integrations/cloudflare/test/fixtures/compile-image-service/src/env.d.ts b/packages/integrations/cloudflare/test/fixtures/compile-image-service/src/env.d.ts new file mode 100644 index 000000000000..9bc5cb41c24e --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/compile-image-service/src/env.d.ts @@ -0,0 +1 @@ +/// \ No newline at end of file diff --git a/packages/integrations/cloudflare/test/fixtures/compile-image-service/src/pages/blog/[...slug].astro b/packages/integrations/cloudflare/test/fixtures/compile-image-service/src/pages/blog/[...slug].astro new file mode 100644 index 000000000000..f5f8ed847951 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/compile-image-service/src/pages/blog/[...slug].astro @@ -0,0 +1,34 @@ +--- +import { Image } from "astro:assets"; +import { getEntry, type CollectionEntry } from "astro:content"; + +export const prerender = false; + +type Props = CollectionEntry<"blog">; + +const post = await getEntry("blog", Astro.params.slug!); +if (!post) return Astro.rewrite("/404"); + +const { Content } = await post.render(); + +--- + + + + + + + Document + + +
+ +
+ + + + diff --git a/packages/integrations/cloudflare/test/fixtures/external-image-service/astro.config.mjs b/packages/integrations/cloudflare/test/fixtures/external-image-service/astro.config.mjs new file mode 100644 index 000000000000..f8c5f63a7761 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/external-image-service/astro.config.mjs @@ -0,0 +1,9 @@ +import cloudflare from '@astrojs/cloudflare'; +import { defineConfig } from 'astro/config'; + +export default defineConfig({ + adapter: cloudflare({ + imageService: 'cloudflare', + }), + output: 'server', +}); diff --git a/packages/integrations/cloudflare/test/fixtures/external-image-service/package.json b/packages/integrations/cloudflare/test/fixtures/external-image-service/package.json new file mode 100644 index 000000000000..2b9646ed952a --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/external-image-service/package.json @@ -0,0 +1,9 @@ +{ + "name": "@test/astro-cloudflare-external-image-service", + "version": "0.0.0", + "private": true, + "dependencies": { + "@astrojs/cloudflare": "workspace:*", + "astro": "workspace:*" + } +} diff --git a/packages/integrations/cloudflare/test/fixtures/external-image-service/src/env.d.ts b/packages/integrations/cloudflare/test/fixtures/external-image-service/src/env.d.ts new file mode 100644 index 000000000000..9bc5cb41c24e --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/external-image-service/src/env.d.ts @@ -0,0 +1 @@ +/// \ No newline at end of file diff --git a/packages/integrations/cloudflare/test/fixtures/module-loader/astro.config.mjs b/packages/integrations/cloudflare/test/fixtures/module-loader/astro.config.mjs new file mode 100644 index 000000000000..38365a374fbb --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/module-loader/astro.config.mjs @@ -0,0 +1,7 @@ +import cloudflare from '@astrojs/cloudflare'; +import { defineConfig } from 'astro/config'; + +export default defineConfig({ + adapter: cloudflare({}), + output: 'static' +}); diff --git a/packages/integrations/cloudflare/test/fixtures/module-loader/package.json b/packages/integrations/cloudflare/test/fixtures/module-loader/package.json new file mode 100644 index 000000000000..4abd8513c3c6 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/module-loader/package.json @@ -0,0 +1,9 @@ +{ + "name": "@test/astro-cloudflare-wasm", + "version": "0.0.0", + "private": true, + "dependencies": { + "@astrojs/cloudflare": "workspace:*", + "astro": "workspace:*" + } +} diff --git a/packages/integrations/cloudflare/test/fixtures/module-loader/src/env.d.ts b/packages/integrations/cloudflare/test/fixtures/module-loader/src/env.d.ts new file mode 100644 index 000000000000..9bc5cb41c24e --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/module-loader/src/env.d.ts @@ -0,0 +1 @@ +/// \ No newline at end of file diff --git a/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/add/[a]/[b].ts b/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/add/[a]/[b].ts new file mode 100644 index 000000000000..0f09faa0a410 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/add/[a]/[b].ts @@ -0,0 +1,20 @@ +import { type APIContext } from 'astro'; +// @ts-ignore +import mod from '../../../util/add.wasm?module'; + +const addModule: any = new WebAssembly.Instance(mod); + +export const prerender = false; + +export async function GET( + context: APIContext +): Promise { + const a = Number.parseInt(context.params.a!); + const b = Number.parseInt(context.params.b!); + return new Response(JSON.stringify({ answer: addModule.exports.add(a, b) }), { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }); +} diff --git a/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/bin.ts b/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/bin.ts new file mode 100644 index 000000000000..a4e097782cbe --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/bin.ts @@ -0,0 +1,16 @@ +import { type APIContext } from 'astro'; + +import data from '../util/file.bin'; + +export const prerender = false; + +export async function GET( + context: APIContext +): Promise { + return new Response(data, { + status: 200, + headers: { + 'Content-Type': 'binary/octet-stream', + }, + }); +} diff --git a/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/compound.ts b/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/compound.ts new file mode 100644 index 000000000000..9dde1838060b --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/compound.ts @@ -0,0 +1,17 @@ + +import { type APIContext } from 'astro'; + +import text from '../util/file.1.md.txt'; + +export const prerender = false; + +export async function GET( + context: APIContext +): Promise { + return new Response(text, { + status: 200, + headers: { + 'Content-Type': 'text/plain; charset=utf-8', + }, + }); +} diff --git a/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/hybrid.ts b/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/hybrid.ts new file mode 100644 index 000000000000..14d3d0fbe82f --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/hybrid.ts @@ -0,0 +1,16 @@ +import { type APIContext } from 'astro'; +// @ts-ignore +import mod from '../util/add.wasm'; + +const addModule: any = new WebAssembly.Instance(mod); + +export async function GET( + context: APIContext +): Promise { + return new Response(JSON.stringify({ answer: addModule.exports.add(20, 1) }), { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }); +} diff --git a/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/hybridshared.ts b/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/hybridshared.ts new file mode 100644 index 000000000000..ea04408f7f68 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/hybridshared.ts @@ -0,0 +1,16 @@ +import { type APIContext } from 'astro'; + +import {add} from '../util/add'; + +export const prerender = true + +export async function GET( + context: APIContext +): Promise { + return new Response(JSON.stringify({ answer: add(20, 1) }), { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }); +} diff --git a/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/shared/[a]/[b].ts b/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/shared/[a]/[b].ts new file mode 100644 index 000000000000..9a8283d85c32 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/shared/[a]/[b].ts @@ -0,0 +1,18 @@ +import { type APIContext } from 'astro'; +import { add } from '../../../util/add'; + + +export const prerender = false; + +export async function GET( + context: APIContext +): Promise { + const a = Number.parseInt(context.params.a ?? "0"); + const b = Number.parseInt(context.params.b ?? "0"); + return new Response(JSON.stringify({ answer: add(a, b) }), { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }); +} diff --git a/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/text.ts b/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/text.ts new file mode 100644 index 000000000000..7306a5b067a7 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/module-loader/src/pages/text.ts @@ -0,0 +1,16 @@ +import { type APIContext } from 'astro'; + +import text from '../util/file.txt'; + +export const prerender = false; + +export async function GET( + context: APIContext +): Promise { + return new Response(text, { + status: 200, + headers: { + 'Content-Type': 'text/plain; charset=utf-8', + }, + }); +} diff --git a/packages/integrations/cloudflare/test/fixtures/module-loader/src/util/add.ts b/packages/integrations/cloudflare/test/fixtures/module-loader/src/util/add.ts new file mode 100644 index 000000000000..ccdb7310366f --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/module-loader/src/util/add.ts @@ -0,0 +1,8 @@ +import mod from './add.wasm'; + + +const addModule: any = new WebAssembly.Instance(mod); + +export function add(a, b) { + return addModule.exports.add(a, b); +} diff --git a/packages/integrations/cloudflare/test/fixtures/module-loader/src/util/add.wasm b/packages/integrations/cloudflare/test/fixtures/module-loader/src/util/add.wasm new file mode 100644 index 000000000000..357f72da7a0d Binary files /dev/null and b/packages/integrations/cloudflare/test/fixtures/module-loader/src/util/add.wasm differ diff --git a/packages/integrations/cloudflare/test/fixtures/module-loader/src/util/file.1.md.txt b/packages/integrations/cloudflare/test/fixtures/module-loader/src/util/file.1.md.txt new file mode 100644 index 000000000000..e965047ad7c5 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/module-loader/src/util/file.1.md.txt @@ -0,0 +1 @@ +Hello diff --git a/packages/integrations/cloudflare/test/fixtures/module-loader/src/util/file.bin b/packages/integrations/cloudflare/test/fixtures/module-loader/src/util/file.bin new file mode 100644 index 000000000000..b0ecc2680f78 Binary files /dev/null and b/packages/integrations/cloudflare/test/fixtures/module-loader/src/util/file.bin differ diff --git a/packages/integrations/cloudflare/test/fixtures/module-loader/src/util/file.txt b/packages/integrations/cloudflare/test/fixtures/module-loader/src/util/file.txt new file mode 100644 index 000000000000..e965047ad7c5 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/module-loader/src/util/file.txt @@ -0,0 +1 @@ +Hello diff --git a/packages/integrations/cloudflare/test/fixtures/no-output/astro.config.mjs b/packages/integrations/cloudflare/test/fixtures/no-output/astro.config.mjs new file mode 100644 index 000000000000..f445bcd48cb2 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/no-output/astro.config.mjs @@ -0,0 +1,6 @@ +import cloudflare from '@astrojs/cloudflare'; +import { defineConfig } from 'astro/config'; + +export default defineConfig({ + adapter: cloudflare() +}); diff --git a/packages/integrations/cloudflare/test/fixtures/no-output/package.json b/packages/integrations/cloudflare/test/fixtures/no-output/package.json new file mode 100644 index 000000000000..569c30890043 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/no-output/package.json @@ -0,0 +1,9 @@ +{ + "name": "@test/astro-cloudflare-no-output", + "version": "0.0.0", + "private": true, + "dependencies": { + "@astrojs/cloudflare": "workspace:*", + "astro": "workspace:*" + } +} diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/astro.config.mjs b/packages/integrations/cloudflare/test/fixtures/routes-json/astro.config.mjs new file mode 100644 index 000000000000..3aaa37d9aea7 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/astro.config.mjs @@ -0,0 +1,8 @@ +import { defineConfig } from 'astro/config'; + +export default defineConfig({ + output: 'static', + redirects: { + '/a/redirect': '/', + }, +}); diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/package.json b/packages/integrations/cloudflare/test/fixtures/routes-json/package.json new file mode 100644 index 000000000000..4ff746f02bde --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/package.json @@ -0,0 +1,9 @@ +{ + "name": "@test/astro-cloudflare-routes-json", + "version": "0.0.0", + "private": true, + "dependencies": { + "@astrojs/cloudflare": "workspace:*", + "astro": "workspace:*" + } +} diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/public/_redirects b/packages/integrations/cloudflare/test/fixtures/routes-json/public/_redirects new file mode 100644 index 000000000000..14e38c465f84 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/public/_redirects @@ -0,0 +1 @@ +/redirectme / 302 diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/public/public.txt b/packages/integrations/cloudflare/test/fixtures/routes-json/public/public.txt new file mode 100644 index 000000000000..9766475a4185 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/public/public.txt @@ -0,0 +1 @@ +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/dynamicOnly/env.d.ts b/packages/integrations/cloudflare/test/fixtures/routes-json/src/dynamicOnly/env.d.ts new file mode 100644 index 000000000000..2da76ba243c5 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/dynamicOnly/env.d.ts @@ -0,0 +1,2 @@ +/// +/// \ No newline at end of file diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/dynamicOnly/pages/dynamic1.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/dynamicOnly/pages/dynamic1.astro new file mode 100644 index 000000000000..9a2306b864fa --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/dynamicOnly/pages/dynamic1.astro @@ -0,0 +1,5 @@ +--- +export const prerender=false; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/dynamicOnly/pages/dynamic2.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/dynamicOnly/pages/dynamic2.astro new file mode 100644 index 000000000000..9a2306b864fa --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/dynamicOnly/pages/dynamic2.astro @@ -0,0 +1,5 @@ +--- +export const prerender=false; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/dynamicOnly/pages/dynamic3.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/dynamicOnly/pages/dynamic3.astro new file mode 100644 index 000000000000..9a2306b864fa --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/dynamicOnly/pages/dynamic3.astro @@ -0,0 +1,5 @@ +--- +export const prerender=false; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/dynamicOnly/pages/index.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/dynamicOnly/pages/index.astro new file mode 100644 index 000000000000..9a2306b864fa --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/dynamicOnly/pages/index.astro @@ -0,0 +1,5 @@ +--- +export const prerender=false; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStatic/env.d.ts b/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStatic/env.d.ts new file mode 100644 index 000000000000..4e6b85c4ac1e --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStatic/env.d.ts @@ -0,0 +1 @@ +/// \ No newline at end of file diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStatic/pages/[id].astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStatic/pages/[id].astro new file mode 100644 index 000000000000..1931fc8a6e5a --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStatic/pages/[id].astro @@ -0,0 +1,16 @@ +--- +import type { GetStaticPaths } from "astro"; + +export const getStaticPaths = (() => { + + return Array.from({length:100}).map((_, i) => ({ + params: { + id: i.toString() + } + })); +}) satisfies GetStaticPaths; + +const { id } = Astro.params; +--- + +id={id} diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStatic/pages/dynamic.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStatic/pages/dynamic.astro new file mode 100644 index 000000000000..13502d70c372 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStatic/pages/dynamic.astro @@ -0,0 +1,5 @@ +--- +export const prerender = false; +--- + +dynamic diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStaticWith404/env.d.ts b/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStaticWith404/env.d.ts new file mode 100644 index 000000000000..4e6b85c4ac1e --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStaticWith404/env.d.ts @@ -0,0 +1 @@ +/// \ No newline at end of file diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStaticWith404/pages/404.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStaticWith404/pages/404.astro new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStaticWith404/pages/[id].astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStaticWith404/pages/[id].astro new file mode 100644 index 000000000000..1931fc8a6e5a --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStaticWith404/pages/[id].astro @@ -0,0 +1,16 @@ +--- +import type { GetStaticPaths } from "astro"; + +export const getStaticPaths = (() => { + + return Array.from({length:100}).map((_, i) => ({ + params: { + id: i.toString() + } + })); +}) satisfies GetStaticPaths; + +const { id } = Astro.params; +--- + +id={id} diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStaticWith404/pages/dynamic.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStaticWith404/pages/dynamic.astro new file mode 100644 index 000000000000..13502d70c372 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/manyStaticWith404/pages/dynamic.astro @@ -0,0 +1,5 @@ +--- +export const prerender = false; +--- + +dynamic diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/env.d.ts b/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/env.d.ts new file mode 100644 index 000000000000..1fc1db4594de --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/env.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/404.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/404.astro new file mode 100644 index 000000000000..42af67a78f67 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/404.astro @@ -0,0 +1,3 @@ +--- +export const prerender = true; +--- diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/a/[...rest].astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/a/[...rest].astro new file mode 100644 index 000000000000..9a2306b864fa --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/a/[...rest].astro @@ -0,0 +1,5 @@ +--- +export const prerender=false; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/a/[id].astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/a/[id].astro new file mode 100644 index 000000000000..9a2306b864fa --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/a/[id].astro @@ -0,0 +1,5 @@ +--- +export const prerender=false; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/a/endpoint.ts b/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/a/endpoint.ts new file mode 100644 index 000000000000..d43d0cd2a55d --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/a/endpoint.ts @@ -0,0 +1 @@ +export const prerender = false; diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/a/index.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/a/index.astro new file mode 100644 index 000000000000..9766475a4185 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/a/index.astro @@ -0,0 +1 @@ +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/b/index.html b/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/b/index.html new file mode 100644 index 000000000000..9766475a4185 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/mixed/pages/b/index.html @@ -0,0 +1 @@ +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/env.d.ts b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/env.d.ts new file mode 100644 index 000000000000..2da76ba243c5 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/env.d.ts @@ -0,0 +1,2 @@ +/// +/// \ No newline at end of file diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/404.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/404.astro new file mode 100644 index 000000000000..42af67a78f67 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/404.astro @@ -0,0 +1,3 @@ +--- +export const prerender = true; +--- diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/dynamicPages/dynamic1.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/dynamicPages/dynamic1.astro new file mode 100644 index 000000000000..9a2306b864fa --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/dynamicPages/dynamic1.astro @@ -0,0 +1,5 @@ +--- +export const prerender=false; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/dynamicPages/dynamic2.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/dynamicPages/dynamic2.astro new file mode 100644 index 000000000000..9a2306b864fa --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/dynamicPages/dynamic2.astro @@ -0,0 +1,5 @@ +--- +export const prerender=false; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/dynamicPages/dynamic3.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/dynamicPages/dynamic3.astro new file mode 100644 index 000000000000..9a2306b864fa --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/dynamicPages/dynamic3.astro @@ -0,0 +1,5 @@ +--- +export const prerender=false; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/index.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/index.astro new file mode 100644 index 000000000000..9a2306b864fa --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/index.astro @@ -0,0 +1,5 @@ +--- +export const prerender=false; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/mixedPages/dynamic.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/mixedPages/dynamic.astro new file mode 100644 index 000000000000..9a2306b864fa --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/mixedPages/dynamic.astro @@ -0,0 +1,5 @@ +--- +export const prerender=false; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/mixedPages/static.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/mixedPages/static.astro new file mode 100644 index 000000000000..d5683c216b8d --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/mixedPages/static.astro @@ -0,0 +1,5 @@ +--- +export const prerender=true; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/mixedPages/subfolder/dynamic.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/mixedPages/subfolder/dynamic.astro new file mode 100644 index 000000000000..9a2306b864fa --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/mixedPages/subfolder/dynamic.astro @@ -0,0 +1,5 @@ +--- +export const prerender=false; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/mixedPages/subfolder/static.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/mixedPages/subfolder/static.astro new file mode 100644 index 000000000000..d5683c216b8d --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/mixedPages/subfolder/static.astro @@ -0,0 +1,5 @@ +--- +export const prerender=true; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/staticPages/static1.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/staticPages/static1.astro new file mode 100644 index 000000000000..d5683c216b8d --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/staticPages/static1.astro @@ -0,0 +1,5 @@ +--- +export const prerender=true; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/staticPages/static2.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/staticPages/static2.astro new file mode 100644 index 000000000000..d5683c216b8d --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/staticPages/static2.astro @@ -0,0 +1,5 @@ +--- +export const prerender=true; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/staticPages/static3.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/staticPages/static3.astro new file mode 100644 index 000000000000..d5683c216b8d --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/reduceComplexity/pages/staticPages/static3.astro @@ -0,0 +1,5 @@ +--- +export const prerender=true; +--- + +ok diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/staticOnly/env.d.ts b/packages/integrations/cloudflare/test/fixtures/routes-json/src/staticOnly/env.d.ts new file mode 100644 index 000000000000..2da76ba243c5 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/staticOnly/env.d.ts @@ -0,0 +1,2 @@ +/// +/// \ No newline at end of file diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/staticOnly/pages/404.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/staticOnly/pages/404.astro new file mode 100644 index 000000000000..42af67a78f67 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/staticOnly/pages/404.astro @@ -0,0 +1,3 @@ +--- +export const prerender = true; +--- diff --git a/packages/integrations/cloudflare/test/fixtures/routes-json/src/staticOnly/pages/index.astro b/packages/integrations/cloudflare/test/fixtures/routes-json/src/staticOnly/pages/index.astro new file mode 100644 index 000000000000..9766475a4185 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/routes-json/src/staticOnly/pages/index.astro @@ -0,0 +1 @@ +ok diff --git a/packages/integrations/cloudflare/test/fixtures/with-solid-js/astro.config.mjs b/packages/integrations/cloudflare/test/fixtures/with-solid-js/astro.config.mjs new file mode 100644 index 000000000000..b4358ad9925c --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/with-solid-js/astro.config.mjs @@ -0,0 +1,9 @@ +import cloudflare from '@astrojs/cloudflare'; +import solidJs from "@astrojs/solid-js"; +import { defineConfig } from 'astro/config'; + +export default defineConfig({ + integrations: [solidJs()], + adapter: cloudflare(), + output: 'server', +}); diff --git a/packages/integrations/cloudflare/test/fixtures/with-solid-js/package.json b/packages/integrations/cloudflare/test/fixtures/with-solid-js/package.json new file mode 100644 index 000000000000..9db1436ca6b3 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/with-solid-js/package.json @@ -0,0 +1,11 @@ +{ + "name": "@test/astro-cloudflare-with-solid-js", + "version": "0.0.0", + "private": true, + "dependencies": { + "@astrojs/cloudflare": "workspace:*", + "@astrojs/solid-js": "^5.0.2", + "astro": "workspace:*", + "solid-js": "^1.9.4" + } +} diff --git a/packages/integrations/cloudflare/test/fixtures/with-solid-js/src/components/Component.tsx b/packages/integrations/cloudflare/test/fixtures/with-solid-js/src/components/Component.tsx new file mode 100644 index 000000000000..d223d4f1ca47 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/with-solid-js/src/components/Component.tsx @@ -0,0 +1 @@ +export const Component = () =>
Solid Content
diff --git a/packages/integrations/cloudflare/test/fixtures/with-solid-js/src/env.d.ts b/packages/integrations/cloudflare/test/fixtures/with-solid-js/src/env.d.ts new file mode 100644 index 000000000000..9bc5cb41c24e --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/with-solid-js/src/env.d.ts @@ -0,0 +1 @@ +/// \ No newline at end of file diff --git a/packages/integrations/cloudflare/test/fixtures/with-solid-js/src/pages/index.astro b/packages/integrations/cloudflare/test/fixtures/with-solid-js/src/pages/index.astro new file mode 100644 index 000000000000..f185a95d35e1 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/with-solid-js/src/pages/index.astro @@ -0,0 +1,13 @@ +--- +import {Component} from "../components/Component"; +--- + + + + Testing + + +

Testing

+ + + diff --git a/packages/integrations/cloudflare/test/fixtures/with-svelte/astro.config.mjs b/packages/integrations/cloudflare/test/fixtures/with-svelte/astro.config.mjs new file mode 100644 index 000000000000..a98a7eade957 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/with-svelte/astro.config.mjs @@ -0,0 +1,9 @@ +import cloudflare from '@astrojs/cloudflare'; +import svelte from "@astrojs/svelte"; +import { defineConfig } from 'astro/config'; + +export default defineConfig({ + integrations: [svelte()], + adapter: cloudflare(), + output: 'server', +}); diff --git a/packages/integrations/cloudflare/test/fixtures/with-svelte/package.json b/packages/integrations/cloudflare/test/fixtures/with-svelte/package.json new file mode 100644 index 000000000000..10c6b65186a6 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/with-svelte/package.json @@ -0,0 +1,11 @@ +{ + "name": "@test/astro-cloudflare-with-svelte", + "version": "0.0.0", + "private": true, + "dependencies": { + "@astrojs/cloudflare": "workspace:*", + "@astrojs/svelte": "^7.0.3", + "astro": "workspace:*", + "svelte": "^5.17.4" + } +} diff --git a/packages/integrations/cloudflare/test/fixtures/with-svelte/src/components/Component.svelte b/packages/integrations/cloudflare/test/fixtures/with-svelte/src/components/Component.svelte new file mode 100644 index 000000000000..a8a85aeb417a --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/with-svelte/src/components/Component.svelte @@ -0,0 +1 @@ +
Svelte Content
diff --git a/packages/integrations/cloudflare/test/fixtures/with-svelte/src/pages/index.astro b/packages/integrations/cloudflare/test/fixtures/with-svelte/src/pages/index.astro new file mode 100644 index 000000000000..dc3e227d34ba --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/with-svelte/src/pages/index.astro @@ -0,0 +1,13 @@ +--- +import Component from '../components/Component.svelte'; +--- + + + + Testing + + +

Testing

+ + + diff --git a/packages/integrations/cloudflare/test/fixtures/with-vue/astro.config.mjs b/packages/integrations/cloudflare/test/fixtures/with-vue/astro.config.mjs new file mode 100644 index 000000000000..4a4fbd8a4bc3 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/with-vue/astro.config.mjs @@ -0,0 +1,9 @@ +import cloudflare from '@astrojs/cloudflare'; +import vue from "@astrojs/vue"; +import { defineConfig } from 'astro/config'; + +export default defineConfig({ + integrations: [vue()], + adapter: cloudflare(), + output: 'server', +}); diff --git a/packages/integrations/cloudflare/test/fixtures/with-vue/package.json b/packages/integrations/cloudflare/test/fixtures/with-vue/package.json new file mode 100644 index 000000000000..1192fe7810fb --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/with-vue/package.json @@ -0,0 +1,11 @@ +{ + "name": "@test/astro-cloudflare-with-vue", + "version": "0.0.0", + "private": true, + "dependencies": { + "@astrojs/cloudflare": "workspace:*", + "@astrojs/vue": "^5.0.4", + "astro": "workspace:*", + "vue": "^3.5.13" + } +} diff --git a/packages/integrations/cloudflare/test/fixtures/with-vue/src/components/Component.vue b/packages/integrations/cloudflare/test/fixtures/with-vue/src/components/Component.vue new file mode 100644 index 000000000000..70630a9a466c --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/with-vue/src/components/Component.vue @@ -0,0 +1,3 @@ + diff --git a/packages/integrations/cloudflare/test/fixtures/with-vue/src/pages/index.astro b/packages/integrations/cloudflare/test/fixtures/with-vue/src/pages/index.astro new file mode 100644 index 000000000000..fc04d52acd01 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/with-vue/src/pages/index.astro @@ -0,0 +1,13 @@ +--- +import Component from '../components/Component.vue'; +--- + + + + Testing + + +

Testing

+ + + diff --git a/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/.dev.vars b/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/.dev.vars new file mode 100644 index 000000000000..9296c384b23f --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/.dev.vars @@ -0,0 +1 @@ +DATABASE_URL="postgresql://lorem" diff --git a/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/astro.config.mjs b/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/astro.config.mjs new file mode 100644 index 000000000000..23896421728c --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/astro.config.mjs @@ -0,0 +1,8 @@ +import cloudflare from '@astrojs/cloudflare'; +import { defineConfig } from 'astro/config'; + + +export default defineConfig({ + adapter: cloudflare(), + output: 'server', +}); diff --git a/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/package.json b/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/package.json new file mode 100644 index 000000000000..25ab99120020 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/package.json @@ -0,0 +1,9 @@ +{ + "name": "@test/astro-cloudflare-wrangler-preview-platform", + "version": "0.0.0", + "private": true, + "dependencies": { + "@astrojs/cloudflare": "workspace:*", + "astro": "workspace:*" + } +} diff --git a/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/src/env.d.ts b/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/src/env.d.ts new file mode 100644 index 000000000000..9bc5cb41c24e --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/src/env.d.ts @@ -0,0 +1 @@ +/// \ No newline at end of file diff --git a/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/src/pages/index.astro b/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/src/pages/index.astro new file mode 100644 index 000000000000..8a3b20925173 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/src/pages/index.astro @@ -0,0 +1,15 @@ +--- +const runtime = Astro.locals.runtime; +--- + + + Testing + + +

Testing

+
{!!runtime}
+
{!!runtime.env?.COOL}
+
{!!runtime.cf?.colo}
+
{!!runtime.caches}
+ + diff --git a/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/wrangler.toml b/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/wrangler.toml new file mode 100644 index 000000000000..ba0fa64c4b09 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform/wrangler.toml @@ -0,0 +1,4 @@ +name = "test" + +[vars] +COOL = "ME" diff --git a/packages/integrations/cloudflare/test/module-loader.test.js b/packages/integrations/cloudflare/test/module-loader.test.js new file mode 100644 index 000000000000..a455ccdec820 --- /dev/null +++ b/packages/integrations/cloudflare/test/module-loader.test.js @@ -0,0 +1,72 @@ +import * as assert from 'node:assert/strict'; +import { after, before, describe, it } from 'node:test'; +import { fileURLToPath } from 'node:url'; +import zlib from 'node:zlib'; +import { astroCli, wranglerCli } from './_test-utils.js'; + +const root = new URL('./fixtures/module-loader/', import.meta.url); + +describe('CloudflareModuleLoading', () => { + let wrangler; + before(async () => { + await astroCli(fileURLToPath(root), 'build'); + + wrangler = wranglerCli(fileURLToPath(root)); + await new Promise((resolve) => { + wrangler.stdout.on('data', (data) => { + // console.log('[stdout]', data.toString()); + if (data.toString().includes('http://127.0.0.1:8788')) resolve(); + }); + wrangler.stderr.on('data', (_data) => { + // console.log('[stderr]', data.toString()); + }); + }); + }); + + after((_done) => { + wrangler.kill(); + }); + + it('can render server side', async () => { + const res = await fetch('http://127.0.0.1:8788/add/40/2'); + assert.equal(res.status, 200); + const json = await res.json(); + assert.deepEqual(json, { answer: 42 }); + }); + it('can render static', async () => { + const res = await fetch('http://127.0.0.1:8788/hybrid'); + assert.equal(res.status, 200); + const json = await res.json(); + assert.deepEqual(json, { answer: 21 }); + }); + it('can render shared', async () => { + const res = await fetch('http://127.0.0.1:8788/shared/40/2'); + assert.equal(res.status, 200); + const json = await res.json(); + assert.deepEqual(json, { answer: 42 }); + }); + it('can render static shared', async () => { + const res = await fetch('http://127.0.0.1:8788/hybridshared'); + assert.equal(res.status, 200); + const json = await res.json(); + assert.deepEqual(json, { answer: 21 }); + }); + it('can render txt', async () => { + const res = await fetch('http://127.0.0.1:8788/text'); + assert.equal(res.status, 200); + const text = await res.text(); + assert.equal(text, 'Hello\n'); + }); + it('can render binary', async () => { + const res = await fetch('http://127.0.0.1:8788/bin'); + assert.equal(res.status, 200); + const text = zlib.gunzipSync(await res.arrayBuffer()).toString('utf-8'); + assert.equal(text, 'Hello\n'); + }); + it('can render compound paths', async () => { + const res = await fetch('http://127.0.0.1:8788/compound'); + assert.equal(res.status, 200); + const text = await res.text(); + assert.equal(text, 'Hello\n'); + }); +}); diff --git a/packages/integrations/cloudflare/test/routes-json.test.js b/packages/integrations/cloudflare/test/routes-json.test.js new file mode 100644 index 000000000000..27839599d057 --- /dev/null +++ b/packages/integrations/cloudflare/test/routes-json.test.js @@ -0,0 +1,347 @@ +import * as assert from 'node:assert/strict'; +import { before, describe, it } from 'node:test'; +import { loadFixture } from './_test-utils.js'; +import cloudflare from '../dist/index.js'; + +/** @type {import('./test-utils.js').Fixture} */ +describe('_routes.json generation', () => { + describe('of on-demand and prerenderd', () => { + let fixture; + + before(async () => { + fixture = await loadFixture({ + root: new URL('./fixtures/routes-json/', import.meta.url).toString(), + srcDir: './src/mixed', + adapter: cloudflare({}), + }); + await fixture.build(); + }); + + it('creates `include` for on-demand and `exclude` for prerenderd', async () => { + const _routesJson = await fixture.readFile('/_routes.json'); + const routes = JSON.parse(_routesJson); + + assert.deepEqual(routes, { + version: 1, + include: ['/_server-islands/*', '/_image', '/a/*'], + exclude: ['/_astro/*', '/redirectme', '/public.txt', '/a', '/a/redirect', '/404', '/b'], + }); + }); + }); + + describe('of only on-demand', () => { + let fixture; + + before(async () => { + fixture = await loadFixture({ + root: new URL('./fixtures/routes-json/', import.meta.url).toString(), + srcDir: './src/dynamicOnly', + adapter: cloudflare({}), + }); + await fixture.build(); + }); + + it('creates a wildcard `include` and `exclude` only for static assets and redirects', async () => { + const _routesJson = await fixture.readFile('/_routes.json'); + const routes = JSON.parse(_routesJson); + + assert.deepEqual(routes, { + version: 1, + include: ['/*'], + exclude: ['/_astro/*', '/redirectme', '/public.txt', '/a/*'], + }); + }); + }); + + describe('of only prerenderd', () => { + let fixture; + + before(async () => { + fixture = await loadFixture({ + root: new URL('./fixtures/routes-json/', import.meta.url).toString(), + srcDir: './src/staticOnly', + adapter: cloudflare({}), + }); + await fixture.build(); + }); + + it( + 'create only one `include` and `exclude` that are supposed to match nothing', + { todo: 'Review test, because the expectation is to have empty include and exclude.' }, + async () => { + const _routesJson = await fixture.readFile('/_routes.json'); + const routes = JSON.parse(_routesJson); + + assert.deepEqual(routes, { + version: 1, + include: ['/_server-islands/*'], + exclude: ['/', '/_astro/*', '/redirectme', '/public.txt', '/a/*', '/404'], + }); + }, + ); + }); + + describe('with additional `include` entries', () => { + let fixture; + + before(async () => { + fixture = await loadFixture({ + root: new URL('./fixtures/routes-json/', import.meta.url).toString(), + srcDir: './src/mixed', + adapter: cloudflare({ + routes: { + extend: { + include: [{ pattern: '/another' }], + }, + }, + }), + }); + await fixture.build(); + }); + + it('creates `include` for functions and `exclude` for static files where needed', async () => { + const _routesJson = await fixture.readFile('/_routes.json'); + const routes = JSON.parse(_routesJson); + + assert.deepEqual(routes, { + version: 1, + include: ['/_server-islands/*', '/_image', '/a/*', '/another'], + exclude: ['/_astro/*', '/redirectme', '/public.txt', '/a', '/a/redirect', '/404', '/b'], + }); + }); + }); + + describe('with additional `exclude` entries', () => { + let fixture; + + before(async () => { + fixture = await loadFixture({ + root: new URL('./fixtures/routes-json/', import.meta.url).toString(), + srcDir: './src/mixed', + adapter: cloudflare({ + routes: { + extend: { + exclude: [{ pattern: '/another' }, { pattern: '/a/index.html' }], + }, + }, + }), + }); + await fixture.build(); + }); + + it('creates `include` for functions and `exclude` for static files where needed', async () => { + const _routesJson = await fixture.readFile('/_routes.json'); + const routes = JSON.parse(_routesJson); + + assert.deepEqual(routes, { + version: 1, + include: ['/_server-islands/*', '/_image', '/a/*'], + exclude: [ + '/_astro/*', + '/redirectme', + '/public.txt', + '/a', + '/a/redirect', + '/404', + '/b', + '/another', + '/a/index.html', + ], + }); + }); + }); + + describe('with nested on demand and prerendered routes', () => { + let fixture; + + before(async () => { + fixture = await loadFixture({ + root: new URL('./fixtures/routes-json/', import.meta.url).toString(), + srcDir: './src/reduceComplexity', + adapter: cloudflare({}), + }); + await fixture.build(); + }); + + it('reduces the amount of include and exclude entries by applying wildcards wherever possible', async () => { + const _routesJson = await fixture.readFile('/_routes.json'); + const routes = JSON.parse(_routesJson); + + assert.deepEqual(routes, { + version: 1, + include: [ + '/', + '/_server-islands/*', + '/_image', + '/dynamicPages/*', + '/mixedPages/dynamic', + '/mixedPages/subfolder/dynamic', + ], + exclude: [ + '/_astro/*', + '/redirectme', + '/public.txt', + '/a/*', + '/404', + '/mixedPages/static', + '/mixedPages/subfolder/static', + '/staticPages/*', + ], + }); + }); + }); + + describe('with many static files', () => { + let fixture; + + before(async () => { + fixture = await loadFixture({ + root: new URL('./fixtures/routes-json/', import.meta.url).toString(), + srcDir: './src/manyStatic', + adapter: cloudflare({}), + }); + await fixture.build(); + }); + + it('creates a wildcard `include` and `exclude` for as many static assets and redirects as possible, truncating after 100 rules', async () => { + const _routesJson = await fixture.readFile('/_routes.json'); + const routes = JSON.parse(_routesJson); + + assert.deepEqual(routes, { + version: 1, + include: ['/*'], + exclude: [ + '/_astro/*', + '/redirectme', + '/public.txt', + '/a/*', + ...Array.from({ length: 95 }, (_, i) => `/${i}`), + ], + }); + }); + }); + + describe('with many static files when a static 404 is present', () => { + let fixture; + + before(async () => { + fixture = await loadFixture({ + root: new URL('./fixtures/routes-json/', import.meta.url).toString(), + srcDir: './src/manyStaticWith404', + adapter: cloudflare({}), + }); + await fixture.build(); + }); + + it('creates `include` for on-demand and `exclude` that are supposed to match nothing', async () => { + const _routesJson = await fixture.readFile('/_routes.json'); + const routes = JSON.parse(_routesJson); + + assert.deepEqual(routes, { + version: 1, + include: ['/*'], + exclude: [ + '/_astro/*', + '/redirectme', + '/public.txt', + '/a/*', + '/404', + '/0', + '/1', + '/2', + '/3', + '/4', + '/5', + '/6', + '/7', + '/8', + '/9', + '/10', + '/11', + '/12', + '/13', + '/14', + '/15', + '/16', + '/17', + '/18', + '/19', + '/20', + '/21', + '/22', + '/23', + '/24', + '/25', + '/26', + '/27', + '/28', + '/29', + '/30', + '/31', + '/32', + '/33', + '/34', + '/35', + '/36', + '/37', + '/38', + '/39', + '/40', + '/41', + '/42', + '/43', + '/44', + '/45', + '/46', + '/47', + '/48', + '/49', + '/50', + '/51', + '/52', + '/53', + '/54', + '/55', + '/56', + '/57', + '/58', + '/59', + '/60', + '/61', + '/62', + '/63', + '/64', + '/65', + '/66', + '/67', + '/68', + '/69', + '/70', + '/71', + '/72', + '/73', + '/74', + '/75', + '/76', + '/77', + '/78', + '/79', + '/80', + '/81', + '/82', + '/83', + '/84', + '/85', + '/86', + '/87', + '/88', + '/89', + '/90', + '/91', + '/92', + '/93', + ], + }); + }); + }); +}); diff --git a/packages/integrations/cloudflare/test/with-solid-js.test.js b/packages/integrations/cloudflare/test/with-solid-js.test.js new file mode 100644 index 000000000000..46527442269b --- /dev/null +++ b/packages/integrations/cloudflare/test/with-solid-js.test.js @@ -0,0 +1,37 @@ +import * as assert from 'node:assert/strict'; +import { after, before, describe, it } from 'node:test'; +import { fileURLToPath } from 'node:url'; +import * as cheerio from 'cheerio'; +import { astroCli, wranglerCli } from './_test-utils.js'; + +const root = new URL('./fixtures/with-solid-js/', import.meta.url); + +describe('SolidJS', () => { + let wrangler; + before(async () => { + await astroCli(fileURLToPath(root), 'build'); + + wrangler = wranglerCli(fileURLToPath(root)); + await new Promise((resolve) => { + wrangler.stdout.on('data', (data) => { + // console.log('[stdout]', data.toString()); + if (data.toString().includes('http://127.0.0.1:8788')) resolve(); + }); + wrangler.stderr.on('data', (_data) => { + // console.log('[stderr]', data.toString()); + }); + }); + }); + + after((_done) => { + wrangler.kill(); + }); + + it('renders the solid component', async () => { + const res = await fetch('http://127.0.0.1:8788/'); + assert.equal(res.status, 200); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('.solid').text(), 'Solid Content'); + }); +}); diff --git a/packages/integrations/cloudflare/test/with-svelte.test.js b/packages/integrations/cloudflare/test/with-svelte.test.js new file mode 100644 index 000000000000..4f1e72a7df3f --- /dev/null +++ b/packages/integrations/cloudflare/test/with-svelte.test.js @@ -0,0 +1,37 @@ +import * as assert from 'node:assert/strict'; +import { after, before, describe, it } from 'node:test'; +import { fileURLToPath } from 'node:url'; +import * as cheerio from 'cheerio'; +import { astroCli, wranglerCli } from './_test-utils.js'; + +const root = new URL('./fixtures/with-svelte/', import.meta.url); + +describe('Svelte', () => { + let wrangler; + before(async () => { + await astroCli(fileURLToPath(root), 'build'); + + wrangler = wranglerCli(fileURLToPath(root)); + await new Promise((resolve) => { + wrangler.stdout.on('data', (data) => { + // console.log('[stdout]', data.toString()); + if (data.toString().includes('http://127.0.0.1:8788')) resolve(); + }); + wrangler.stderr.on('data', (_data) => { + // console.log('[stderr]', data.toString()); + }); + }); + }); + + after((_done) => { + wrangler.kill(); + }); + + it('renders the svelte component', async () => { + const res = await fetch('http://127.0.0.1:8788/'); + assert.equal(res.status, 200); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('.svelte').text(), 'Svelte Content'); + }); +}); diff --git a/packages/integrations/cloudflare/test/with-vue.test.js b/packages/integrations/cloudflare/test/with-vue.test.js new file mode 100644 index 000000000000..8e7befae65d0 --- /dev/null +++ b/packages/integrations/cloudflare/test/with-vue.test.js @@ -0,0 +1,37 @@ +import * as assert from 'node:assert/strict'; +import { after, before, describe, it } from 'node:test'; +import { fileURLToPath } from 'node:url'; +import * as cheerio from 'cheerio'; +import { astroCli, wranglerCli } from './_test-utils.js'; + +const root = new URL('./fixtures/with-vue/', import.meta.url); + +describe('Vue', () => { + let wrangler; + before(async () => { + await astroCli(fileURLToPath(root), 'build'); + + wrangler = wranglerCli(fileURLToPath(root)); + await new Promise((resolve) => { + wrangler.stdout.on('data', (data) => { + // console.log('[stdout]', data.toString()); + if (data.toString().includes('http://127.0.0.1:8788')) resolve(); + }); + wrangler.stderr.on('data', (_data) => { + // console.log('[stderr]', data.toString()); + }); + }); + }); + + after((_done) => { + wrangler.kill(); + }); + + it('renders the vue component', async () => { + const res = await fetch('http://127.0.0.1:8788/'); + assert.equal(res.status, 200); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('.vue').text(), 'Vue Content'); + }); +}); diff --git a/packages/integrations/cloudflare/test/wrangler-preview-platform.test.js b/packages/integrations/cloudflare/test/wrangler-preview-platform.test.js new file mode 100644 index 000000000000..bf1fb5c4724d --- /dev/null +++ b/packages/integrations/cloudflare/test/wrangler-preview-platform.test.js @@ -0,0 +1,58 @@ +import * as assert from 'node:assert/strict'; +import { after, before, describe, it } from 'node:test'; +import { fileURLToPath } from 'node:url'; +import * as cheerio from 'cheerio'; +import { astroCli, wranglerCli } from './_test-utils.js'; + +const root = new URL('./fixtures/wrangler-preview-platform/', import.meta.url); + +describe('WranglerPreviewPlatform', () => { + let wrangler; + + before(async () => { + await astroCli(fileURLToPath(root), 'build'); + + wrangler = wranglerCli(fileURLToPath(root)); + await new Promise((resolve) => { + wrangler.stdout.on('data', (data) => { + // console.log('[stdout]', data.toString()); + if (data.toString().includes('http://127.0.0.1:8788')) resolve(); + }); + wrangler.stderr.on('data', (_data) => { + // console.log('[stderr]', data.toString()); + }); + }); + }); + + after((_done) => { + wrangler.kill(); + }); + + it('exists', async () => { + const res = await fetch('http://127.0.0.1:8788/'); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('#hasRuntime').text().includes('true'), true); + }); + + it('has environment variables', async () => { + const res = await fetch('http://127.0.0.1:8788/'); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('#hasENV').text().includes('true'), true); + }); + + it('has Cloudflare request object', async () => { + const res = await fetch('http://127.0.0.1:8788/'); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('#hasCF').text().includes('true'), true); + }); + + it('has Cloudflare cache', async () => { + const res = await fetch('http://127.0.0.1:8788/'); + const html = await res.text(); + const $ = cheerio.load(html); + assert.equal($('#hasCACHES').text().includes('true'), true); + }); +}); diff --git a/packages/integrations/cloudflare/tsconfig.json b/packages/integrations/cloudflare/tsconfig.json new file mode 100644 index 000000000000..1504b4b6dfa4 --- /dev/null +++ b/packages/integrations/cloudflare/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../../tsconfig.base.json", + "include": ["src"], + "compilerOptions": { + "outDir": "./dist" + } +} diff --git a/packages/integrations/node/src/log-listening-on.ts b/packages/integrations/node/src/log-listening-on.ts index f78b5b7f19c8..b7a9f0bf9127 100644 --- a/packages/integrations/node/src/log-listening-on.ts +++ b/packages/integrations/node/src/log-listening-on.ts @@ -31,11 +31,9 @@ function getResolvedHostForHttpServer(host: string | boolean | undefined) { if (host === false) { // Use a secure default return 'localhost'; - // biome-ignore lint/style/noUselessElse: } else if (host === true) { // If passed --host in the CLI without arguments return undefined; // undefined typically means 0.0.0.0 or :: (listen on all IPs) - // biome-ignore lint/style/noUselessElse: } else { return host; } @@ -48,7 +46,6 @@ interface NetworkAddressOpt { // this code from vite https://github.com/vitejs/vite/blob/d09bbd093a4b893e78f0bbff5b17c7cf7821f403/packages/vite/src/node/utils.ts#L892-L914 export function getNetworkAddress( - // biome-ignore lint/style/useDefaultParameterLast: protocol: 'http' | 'https' = 'http', hostname: string | undefined, port: number, @@ -58,12 +55,10 @@ export function getNetworkAddress( local: [], network: [], }; - // biome-ignore lint/complexity/noForEach: Object.values(os.networkInterfaces()) .flatMap((nInterface) => nInterface ?? []) .filter( (detail) => - // biome-ignore lint/complexity/useOptionalChain: detail && detail.address && (detail.family === 'IPv4' || diff --git a/packages/integrations/vercel/CHANGELOG.md b/packages/integrations/vercel/CHANGELOG.md index f60e0ff75a68..93d9830280b6 100644 --- a/packages/integrations/vercel/CHANGELOG.md +++ b/packages/integrations/vercel/CHANGELOG.md @@ -1424,7 +1424,7 @@ { darkMode: true }, { expires: '1 month', - } + }, ); const prefs = Astro.cookies.get('prefs').json(); diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json index c7206fdb3524..f64350839713 100644 --- a/packages/integrations/vercel/package.json +++ b/packages/integrations/vercel/package.json @@ -10,7 +10,10 @@ "url": "https://github.com/withastro/adapters.git", "directory": "packages/vercel" }, - "keywords": ["withastro", "astro-adapter"], + "keywords": [ + "withastro", + "astro-adapter" + ], "bugs": "https://github.com/withastro/adapters/issues", "homepage": "https://docs.astro.build/en/guides/integrations-guide/vercel/", "exports": { @@ -25,11 +28,18 @@ }, "typesVersions": { "*": { - "serverless": ["dist/serverless/adapter.d.ts"], - "static": ["dist/static/adapter.d.ts"] + "serverless": [ + "dist/serverless/adapter.d.ts" + ], + "static": [ + "dist/static/adapter.d.ts" + ] } }, - "files": ["dist", "types.d.ts"], + "files": [ + "dist", + "types.d.ts" + ], "scripts": { "build": "astro-scripts build \"src/**/*.ts\" && tsc", "test": "astro-scripts test --timeout 50000 \"test/**/!(hosted).test.js\"", diff --git a/packages/integrations/vercel/src/image/shared.ts b/packages/integrations/vercel/src/image/shared.ts index e21b79e6a7b9..eb9681243d16 100644 --- a/packages/integrations/vercel/src/image/shared.ts +++ b/packages/integrations/vercel/src/image/shared.ts @@ -68,7 +68,7 @@ export function getAstroImageConfig( imagesConfig: VercelImageConfig | undefined, command: string, devImageService: DevImageService, - astroImageConfig: AstroConfig['image'] + astroImageConfig: AstroConfig['image'], ) { let devService = '@astrojs/vercel/dev-image-service'; @@ -102,7 +102,7 @@ export function getAstroImageConfig( export function sharedValidateOptions( options: ImageTransform, serviceConfig: Record, - mode: 'development' | 'production' + mode: 'development' | 'production', ) { const vercelImageOptions = serviceConfig as VercelImageConfig; diff --git a/packages/integrations/vercel/src/index.ts b/packages/integrations/vercel/src/index.ts index db61b0d3c824..4aeb3e568d20 100644 --- a/packages/integrations/vercel/src/index.ts +++ b/packages/integrations/vercel/src/index.ts @@ -205,7 +205,7 @@ export default function vercelAdapter({ 'head-inline', await getInjectableWebAnalyticsContent({ mode: command === 'dev' ? 'development' : 'production', - }) + }), ); } @@ -240,7 +240,7 @@ export default function vercelAdapter({ imagesConfig, command, devImageService, - config.image + config.image, ), }); }, @@ -253,10 +253,10 @@ export default function vercelAdapter({ if (_buildOutput === 'server') { if (maxDuration && maxDuration > 900) { logger.warn( - `maxDuration is set to ${maxDuration} seconds, which is longer than the maximum allowed duration of 900 seconds.` + `maxDuration is set to ${maxDuration} seconds, which is longer than the maximum allowed duration of 900 seconds.`, ); logger.warn( - `Please make sure that your plan allows for this duration. See https://vercel.com/docs/functions/serverless-functions/runtimes#maxduration for more information.` + `Please make sure that your plan allows for this duration. See https://vercel.com/docs/functions/serverless-functions/runtimes#maxduration for more information.`, ); } const vercelConfigPath = new URL('vercel.json', config.root); @@ -276,7 +276,7 @@ export default function vercelAdapter({ Your "vercel.json" \`trailingSlash\` configuration (set to \`${vercelConfig.trailingSlash}\`) will conflict with your Astro \`trailingSlash\` configuration (set to \`${JSON.stringify(config.trailingSlash)}\`). This would cause infinite redirects or duplicate content issues. Please remove the \`trailingSlash\` configuration from your \`vercel.json\` file or Astro config. -` +`, ); } } catch (_err) { @@ -289,7 +289,7 @@ export default function vercelAdapter({ edgeMiddleware, middlewareSecret, skewProtection, - }) + }), ); } else { setAdapter( @@ -298,7 +298,7 @@ export default function vercelAdapter({ middlewareSecret: '', skewProtection, buildOutput: _buildOutput, - }) + }), ); } _config = config; @@ -319,7 +319,7 @@ export default function vercelAdapter({ patternRegex: routeData.pattern, }, url, - ]) + ]), ); _middlewareEntryPoint = middlewareEntryPoint; }, @@ -376,7 +376,7 @@ export default function vercelAdapter({ includeFiles, logger, outDir, - maxDuration + maxDuration, ); // Multiple entrypoint support @@ -435,7 +435,7 @@ export default function vercelAdapter({ await builder.buildMiddlewareFolder( _middlewareEntryPoint, MIDDLEWARE_PATH, - middlewareSecret + middlewareSecret, ); } } @@ -492,7 +492,7 @@ export default function vercelAdapter({ if (error) { throw new AstroError( `Error generating redirects: ${error.message}`, - error.link ? `${error.action ?? 'More info'}: ${error.link}` : undefined + error.link ? `${error.action ?? 'More info'}: ${error.link}` : undefined, ); } @@ -521,7 +521,7 @@ export default function vercelAdapter({ `Error generating routes: ${normalized.error.message}`, normalized.error.link ? `${normalized.error.action ?? 'More info'}: ${normalized.error.link}` - : undefined + : undefined, ); } @@ -567,7 +567,7 @@ class VercelBuilder { readonly logger: AstroIntegrationLogger, readonly outDir: URL, readonly maxDuration?: number, - readonly runtime = getRuntime(process, logger) + readonly runtime = getRuntime(process, logger), ) {} async buildServerlessFolder(entry: URL, functionName: string, root: URL) { @@ -587,7 +587,7 @@ class VercelBuilder { logger, root, }, - NTF_CACHE + NTF_CACHE, ); // Enable ESM @@ -609,7 +609,7 @@ class VercelBuilder { await this.buildServerlessFolder(entry, functionName, root); const prerenderConfig = new URL( `./functions/${functionName}.prerender-config.json`, - this.outDir + this.outDir, ); // https://vercel.com/docs/build-output-api/v3/primitives#prerender-configuration-file await writeJson(prerenderConfig, { @@ -629,7 +629,7 @@ class VercelBuilder { new URL(VERCEL_EDGE_MIDDLEWARE_FILE, this.config.srcDir), new URL('./middleware.mjs', functionFolder), middlewareSecret, - this.logger + this.logger, ); await writeJson(new URL(`./.vc-config.json`, functionFolder), { @@ -648,7 +648,7 @@ function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Ru `\n` + `\tThe local Node.js version (${major}) is not supported by Vercel Serverless Functions.\n` + `\tYour project will use Node.js 18 as the runtime instead.\n` + - `\tConsider switching your local version to 18.\n` + `\tConsider switching your local version to 18.\n`, ); return 'nodejs18.x'; } @@ -658,26 +658,26 @@ function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Ru if (support.status === 'retiring') { if (support.warnDate && new Date() >= support.warnDate) { logger.warn( - `Your project is being built for Node.js ${major} as the runtime, which is retiring by ${support.removal}.` + `Your project is being built for Node.js ${major} as the runtime, which is retiring by ${support.removal}.`, ); } return `nodejs${major}.x`; } if (support.status === 'beta') { logger.warn( - `Your project is being built for Node.js ${major} as the runtime, which is currently in beta for Vercel Serverless Functions.` + `Your project is being built for Node.js ${major} as the runtime, which is currently in beta for Vercel Serverless Functions.`, ); return `nodejs${major}.x`; } if (support.status === 'deprecated') { const removeDate = new Intl.DateTimeFormat(undefined, { dateStyle: 'long' }).format( - support.removal + support.removal, ); logger.warn( `\n` + `\tYour project is being built for Node.js ${major} as the runtime.\n` + `\tThis version is deprecated by Vercel Serverless Functions, and scheduled to be disabled on ${removeDate}.\n` + - `\tConsider upgrading your local version to 18.\n` + `\tConsider upgrading your local version to 18.\n`, ); return `nodejs${major}.x`; } diff --git a/packages/integrations/vercel/src/lib/nft.ts b/packages/integrations/vercel/src/lib/nft.ts index d72979e890bc..4381943bb7a5 100644 --- a/packages/integrations/vercel/src/lib/nft.ts +++ b/packages/integrations/vercel/src/lib/nft.ts @@ -22,7 +22,7 @@ export async function copyDependenciesToFunction( root: URL; }, // we want to pass the caching by reference, and not by value - cache: object + cache: object, ): Promise<{ handler: string }> { const entryPath = fileURLToPath(entry); logger.info(`Bundling function ${relativePath(fileURLToPath(outDir), entryPath)}`); @@ -52,11 +52,11 @@ export async function copyDependenciesToFunction( if (entryPath === file) { logger.debug( - `[@astrojs/vercel] The module "${module}" couldn't be resolved. This may not be a problem, but it's worth checking.` + `[@astrojs/vercel] The module "${module}" couldn't be resolved. This may not be a problem, but it's worth checking.`, ); } else { logger.debug( - `[@astrojs/vercel] The module "${module}" inside the file "${file}" couldn't be resolved. This may not be a problem, but it's worth checking.` + `[@astrojs/vercel] The module "${module}" inside the file "${file}" couldn't be resolved. This may not be a problem, but it's worth checking.`, ); } } @@ -73,7 +73,7 @@ export async function copyDependenciesToFunction( const commonAncestor = await copyFilesToFolder( [...result.fileList].map((file) => new URL(file, base)).concat(includeFiles), outDir, - excludeFiles + excludeFiles, ); return { diff --git a/packages/integrations/vercel/src/lib/searchRoot.ts b/packages/integrations/vercel/src/lib/searchRoot.ts index 832f6e498b67..e630c8b43ee4 100644 --- a/packages/integrations/vercel/src/lib/searchRoot.ts +++ b/packages/integrations/vercel/src/lib/searchRoot.ts @@ -88,7 +88,7 @@ export function searchForPackageRoot(current: string, root = current): string { */ export function searchForWorkspaceRoot( current: string, - root = searchForPackageRoot(current) + root = searchForPackageRoot(current), ): string { if (hasRootFile(current)) return current; if (hasWorkspacePackageJSON(current)) return current; diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts index 86464f89beb5..1c12f611a9b6 100644 --- a/packages/integrations/vercel/src/serverless/adapter.ts +++ b/packages/integrations/vercel/src/serverless/adapter.ts @@ -4,7 +4,7 @@ import vercelIntegration from '../index.js'; export default function serverless(config: VercelServerlessConfig): AstroIntegration { console.warn( - 'The "@astrojs/vercel/serverless" import is deprecated and will be removed in a future release. Please import from "@astrojs/vercel" instead.' + 'The "@astrojs/vercel/serverless" import is deprecated and will be removed in a future release. Please import from "@astrojs/vercel" instead.', ); return vercelIntegration(config); } diff --git a/packages/integrations/vercel/src/serverless/entrypoint.ts b/packages/integrations/vercel/src/serverless/entrypoint.ts index f1f1f256cf25..5b64fa506527 100644 --- a/packages/integrations/vercel/src/serverless/entrypoint.ts +++ b/packages/integrations/vercel/src/serverless/entrypoint.ts @@ -15,7 +15,7 @@ setGetEnv((key) => process.env[key]); export const createExports = ( manifest: SSRManifest, - { middlewareSecret, skewProtection }: { middlewareSecret: string; skewProtection: boolean } + { middlewareSecret, skewProtection }: { middlewareSecret: string; skewProtection: boolean }, ) => { const app = new NodeApp(manifest); const handler = async (req: IncomingMessage, res: ServerResponse) => { diff --git a/packages/integrations/vercel/src/serverless/middleware.ts b/packages/integrations/vercel/src/serverless/middleware.ts index 3980186f5ba3..b1927ca3bc85 100644 --- a/packages/integrations/vercel/src/serverless/middleware.ts +++ b/packages/integrations/vercel/src/serverless/middleware.ts @@ -30,13 +30,13 @@ export async function generateEdgeMiddleware( vercelEdgeMiddlewareHandlerPath: URL, outPath: URL, middlewareSecret: string, - logger: AstroIntegrationLogger + logger: AstroIntegrationLogger, ): Promise { const code = edgeMiddlewareTemplate( astroMiddlewareEntryPointPath, vercelEdgeMiddlewareHandlerPath, middlewareSecret, - logger + logger, ); // https://vercel.com/docs/concepts/functions/edge-middleware#create-edge-middleware const bundledFilePath = fileURLToPath(outPath); @@ -77,17 +77,17 @@ function edgeMiddlewareTemplate( astroMiddlewareEntryPointPath: URL, vercelEdgeMiddlewareHandlerPath: URL, middlewareSecret: string, - logger: AstroIntegrationLogger + logger: AstroIntegrationLogger, ) { const middlewarePath = JSON.stringify( - fileURLToPath(astroMiddlewareEntryPointPath).replace(/\\/g, '/') + fileURLToPath(astroMiddlewareEntryPointPath).replace(/\\/g, '/'), ); const filePathEdgeMiddleware = fileURLToPath(vercelEdgeMiddlewareHandlerPath); let handlerTemplateImport = ''; let handlerTemplateCall = '{}'; if (existsSync(filePathEdgeMiddleware + '.js') || existsSync(filePathEdgeMiddleware + '.ts')) { logger.warn( - 'Usage of `vercel-edge-middleware.js` is deprecated. You can now use the `waitUntil(promise)` function directly as `ctx.locals.waitUntil(promise)`.' + 'Usage of `vercel-edge-middleware.js` is deprecated. You can now use the `waitUntil(promise)` function directly as `ctx.locals.waitUntil(promise)`.', ); const stringified = JSON.stringify(filePathEdgeMiddleware.replace(/\\/g, '/')); handlerTemplateImport = `import handler from ${stringified}`; diff --git a/packages/integrations/vercel/src/static/adapter.ts b/packages/integrations/vercel/src/static/adapter.ts index 348994902c36..d140f354d06c 100644 --- a/packages/integrations/vercel/src/static/adapter.ts +++ b/packages/integrations/vercel/src/static/adapter.ts @@ -4,7 +4,7 @@ import vercelIntegration from '../index.js'; export default function staticAdapter(config: VercelServerlessConfig): AstroIntegration { console.warn( - 'The "@astrojs/vercel/static" import is deprecated and will be removed in a future release. Please import from "@astrojs/vercel" instead.' + 'The "@astrojs/vercel/static" import is deprecated and will be removed in a future release. Please import from "@astrojs/vercel" instead.', ); return vercelIntegration(config); } diff --git a/packages/integrations/vercel/test/edge-middleware.test.js b/packages/integrations/vercel/test/edge-middleware.test.js index 50c282a3773e..6a4ac525f589 100644 --- a/packages/integrations/vercel/test/edge-middleware.test.js +++ b/packages/integrations/vercel/test/edge-middleware.test.js @@ -14,7 +14,7 @@ describe('Vercel edge middleware', () => { it('an edge function is created', async () => { const contents = await build.readFile( - '../.vercel/output/functions/_middleware.func/.vc-config.json' + '../.vercel/output/functions/_middleware.func/.vc-config.json', ); const contentsJSON = JSON.parse(contents); assert.equal(contentsJSON.runtime, 'edge'); @@ -26,14 +26,14 @@ describe('Vercel edge middleware', () => { const { routes } = JSON.parse(contents); assert.equal( routes.some((route) => route.dest === '_middleware'), - true + true, ); }); it('edge sets Set-Cookie headers', async () => { const entry = new URL( '../.vercel/output/functions/_middleware.func/middleware.mjs', - build.config.outDir + build.config.outDir, ); const module = await import(entry); const request = new Request('http://example.com/foo'); @@ -50,7 +50,7 @@ describe('Vercel edge middleware', () => { await fixture.build(); const contents = await fixture.readFile( // this is abysmal... - '../.vercel/output/functions/render.func/www/withastro/astro/packages/vercel/test/fixtures/middleware-with-edge-file/dist/middleware.mjs' + '../.vercel/output/functions/render.func/www/withastro/astro/packages/vercel/test/fixtures/middleware-with-edge-file/dist/middleware.mjs', ); // assert.equal(contents.includes('title:')).to.be.true; // chaiJestSnapshot.setTestName('Middleware with handler file'); @@ -65,7 +65,7 @@ describe('Vercel edge middleware', () => { await fixture.build(); const contents = await fixture.readFile( // this is abysmal... - '../.vercel/output/functions/render.func/www/withastro/astro/packages/vercel/test/fixtures/middleware-without-edge-file/dist/middleware.mjs' + '../.vercel/output/functions/render.func/www/withastro/astro/packages/vercel/test/fixtures/middleware-without-edge-file/dist/middleware.mjs', ); // assert.equal(contents.includes('title:')).to.be.false; // chaiJestSnapshot.setTestName('Middleware without handler file'); diff --git a/packages/integrations/vercel/test/hosted/hosted.test.js b/packages/integrations/vercel/test/hosted/hosted.test.js index d7c2ece2065c..b5f6b876e827 100644 --- a/packages/integrations/vercel/test/hosted/hosted.test.js +++ b/packages/integrations/vercel/test/hosted/hosted.test.js @@ -7,7 +7,7 @@ describe('Hosted Vercel Tests', () => { it('Image endpoint works', async () => { const image = await fetch( // biome-ignore lint/style/useTemplate: - VERCEL_TEST_URL + '/_image?href=%2F_astro%2Fpenguin.e9c64733.png&w=300&f=webp' + VERCEL_TEST_URL + '/_image?href=%2F_astro%2Fpenguin.e9c64733.png&w=300&f=webp', ); assert.equal(image.status, 200); diff --git a/packages/integrations/vercel/test/isr.test.js b/packages/integrations/vercel/test/isr.test.js index 10da611926c6..1e5b329ef6dd 100644 --- a/packages/integrations/vercel/test/isr.test.js +++ b/packages/integrations/vercel/test/isr.test.js @@ -15,7 +15,7 @@ describe('ISR', () => { it('generates expected prerender config', async () => { const vcConfig = JSON.parse( - await fixture.readFile('../.vercel/output/functions/_isr.prerender-config.json') + await fixture.readFile('../.vercel/output/functions/_isr.prerender-config.json'), ); assert.deepEqual(vcConfig, { expiration: 120, diff --git a/packages/integrations/vercel/test/max-duration.test.js b/packages/integrations/vercel/test/max-duration.test.js index 2a7698663f98..d5e26fc1a999 100644 --- a/packages/integrations/vercel/test/max-duration.test.js +++ b/packages/integrations/vercel/test/max-duration.test.js @@ -15,7 +15,7 @@ describe('maxDuration', () => { it('makes it to vercel function configuration', async () => { const vcConfig = JSON.parse( - await fixture.readFile('../.vercel/output/functions/_render.func/.vc-config.json') + await fixture.readFile('../.vercel/output/functions/_render.func/.vc-config.json'), ); assert.equal(vcConfig.maxDuration, 60); }); diff --git a/packages/integrations/vercel/test/prerendered-error-pages.test.js b/packages/integrations/vercel/test/prerendered-error-pages.test.js index a20233932592..79a1f4aafe0f 100644 --- a/packages/integrations/vercel/test/prerendered-error-pages.test.js +++ b/packages/integrations/vercel/test/prerendered-error-pages.test.js @@ -21,7 +21,7 @@ describe('prerendered error pages routing', () => { src: '^/.*$', dest: '/404.html', status: 404, - } + }, ); }); }); diff --git a/packages/integrations/vercel/test/serverless-prerender.test.js b/packages/integrations/vercel/test/serverless-prerender.test.js index 2752123ab31c..662e74ac39fd 100644 --- a/packages/integrations/vercel/test/serverless-prerender.test.js +++ b/packages/integrations/vercel/test/serverless-prerender.test.js @@ -20,7 +20,7 @@ describe('Serverless prerender', () => { it('outDir is tree-shaken if not needed', async () => { const [file] = await fixture.glob( - '../.vercel/output/functions/_render.func/packages/vercel/test/fixtures/serverless-prerender/.vercel/output/_functions/pages/_image.astro.mjs' + '../.vercel/output/functions/_render.func/packages/vercel/test/fixtures/serverless-prerender/.vercel/output/_functions/pages/_image.astro.mjs', ); try { await fixture.readFile(file); @@ -34,8 +34,8 @@ describe('Serverless prerender', () => { it.skip('includeFiles work', async () => { assert.ok( await fixture.readFile( - '../.vercel/output/functions/render.func/packages/vercel/test/fixtures/serverless-prerender/dist/middleware.mjs' - ) + '../.vercel/output/functions/render.func/packages/vercel/test/fixtures/serverless-prerender/dist/middleware.mjs', + ), ); }); }); diff --git a/packages/integrations/vercel/test/streaming.test.js b/packages/integrations/vercel/test/streaming.test.js index a0172a7e6abb..1e4b0f111e05 100644 --- a/packages/integrations/vercel/test/streaming.test.js +++ b/packages/integrations/vercel/test/streaming.test.js @@ -15,7 +15,7 @@ describe('streaming', () => { it('makes it to vercel function configuration', async () => { const vcConfig = JSON.parse( - await fixture.readFile('../.vercel/output/functions/_render.func/.vc-config.json') + await fixture.readFile('../.vercel/output/functions/_render.func/.vc-config.json'), ); assert.equal(vcConfig.supportsResponseStreaming, true); }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eeefb4b7df20..96eb798f9a84 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4292,7 +4292,7 @@ importers: version: 1.0.2 drizzle-orm: specifier: ^0.31.2 - version: 0.31.4(@libsql/client@0.14.0)(@types/react@18.3.18)(react@19.0.0) + version: 0.31.4(@cloudflare/workers-types@4.20250204.0)(@libsql/client@0.14.0)(@types/react@18.3.18)(react@19.0.0) github-slugger: specifier: ^2.0.0 version: 2.0.0 @@ -4544,7 +4544,185 @@ importers: specifier: workspace:* version: link:../../../../../astro - packages/integrations/cloudflare: {} + packages/integrations/cloudflare: + dependencies: + '@astrojs/internal-helpers': + specifier: 0.4.2 + version: 0.4.2 + '@astrojs/underscore-redirects': + specifier: ^0.6.0 + version: link:../../underscore-redirects + '@cloudflare/workers-types': + specifier: ^4.20250109.0 + version: 4.20250204.0 + esbuild: + specifier: ^0.24.0 + version: 0.24.2 + estree-walker: + specifier: ^3.0.3 + version: 3.0.3 + magic-string: + specifier: ^0.30.17 + version: 0.30.17 + miniflare: + specifier: ^3.20241230.1 + version: 3.20250129.0 + tiny-glob: + specifier: ^0.2.9 + version: 0.2.9 + vite: + specifier: ^6.0.7 + version: 6.0.11(@types/node@22.13.1)(jiti@2.4.2)(lightningcss@1.29.1)(sass@1.83.4)(yaml@2.5.1) + wrangler: + specifier: ^3.101.0 + version: 3.107.3(@cloudflare/workers-types@4.20250204.0) + devDependencies: + astro: + specifier: workspace:* + version: link:../../astro + astro-scripts: + specifier: workspace:* + version: link:../../../scripts + cheerio: + specifier: 1.0.0 + version: 1.0.0 + execa: + specifier: ^8.0.1 + version: 8.0.1 + fast-glob: + specifier: ^3.3.3 + version: 3.3.3 + rollup: + specifier: ^4.30.1 + version: 4.34.2 + strip-ansi: + specifier: ^7.1.0 + version: 7.1.0 + + packages/integrations/cloudflare/test/fixtures/astro-dev-platform: + dependencies: + '@astrojs/cloudflare': + specifier: workspace:* + version: link:../../.. + astro: + specifier: workspace:* + version: link:../../../../../astro + devDependencies: + wrangler: + specifier: ^3.101.0 + version: 3.107.3(@cloudflare/workers-types@4.20250204.0) + + packages/integrations/cloudflare/test/fixtures/astro-env: + dependencies: + '@astrojs/cloudflare': + specifier: workspace:* + version: link:../../.. + astro: + specifier: workspace:* + version: link:../../../../../astro + devDependencies: + wrangler: + specifier: ^3.101.0 + version: 3.107.3(@cloudflare/workers-types@4.20250204.0) + + packages/integrations/cloudflare/test/fixtures/compile-image-service: + dependencies: + '@astrojs/cloudflare': + specifier: workspace:* + version: link:../../.. + astro: + specifier: workspace:* + version: link:../../../../../astro + + packages/integrations/cloudflare/test/fixtures/external-image-service: + dependencies: + '@astrojs/cloudflare': + specifier: workspace:* + version: link:../../.. + astro: + specifier: workspace:* + version: link:../../../../../astro + + packages/integrations/cloudflare/test/fixtures/module-loader: + dependencies: + '@astrojs/cloudflare': + specifier: workspace:* + version: link:../../.. + astro: + specifier: workspace:* + version: link:../../../../../astro + + packages/integrations/cloudflare/test/fixtures/no-output: + dependencies: + '@astrojs/cloudflare': + specifier: workspace:* + version: link:../../.. + astro: + specifier: workspace:* + version: link:../../../../../astro + + packages/integrations/cloudflare/test/fixtures/routes-json: + dependencies: + '@astrojs/cloudflare': + specifier: workspace:* + version: link:../../.. + astro: + specifier: workspace:* + version: link:../../../../../astro + + packages/integrations/cloudflare/test/fixtures/with-solid-js: + dependencies: + '@astrojs/cloudflare': + specifier: workspace:* + version: link:../../.. + '@astrojs/solid-js': + specifier: ^5.0.2 + version: link:../../../../solid + astro: + specifier: workspace:* + version: link:../../../../../astro + solid-js: + specifier: ^1.9.4 + version: 1.9.4 + + packages/integrations/cloudflare/test/fixtures/with-svelte: + dependencies: + '@astrojs/cloudflare': + specifier: workspace:* + version: link:../../.. + '@astrojs/svelte': + specifier: ^7.0.3 + version: link:../../../../svelte + astro: + specifier: workspace:* + version: link:../../../../../astro + svelte: + specifier: ^5.17.4 + version: 5.19.7 + + packages/integrations/cloudflare/test/fixtures/with-vue: + dependencies: + '@astrojs/cloudflare': + specifier: workspace:* + version: link:../../.. + '@astrojs/vue': + specifier: ^5.0.4 + version: link:../../../../vue + astro: + specifier: workspace:* + version: link:../../../../../astro + vue: + specifier: ^3.5.13 + version: 3.5.13(typescript@5.7.3) + + packages/integrations/cloudflare/test/fixtures/wrangler-preview-platform: + dependencies: + '@astrojs/cloudflare': + specifier: workspace:* + version: link:../../.. + astro: + specifier: workspace:* + version: link:../../../../../astro packages/integrations/markdoc: dependencies: @@ -6121,6 +6299,9 @@ packages: '@astrojs/compiler@2.10.3': resolution: {integrity: sha512-bL/O7YBxsFt55YHU021oL+xz+B/9HvGNId3F9xURN16aeqDK9juHGktdkCSXz+U4nqFACq6ZFvWomOzhV+zfPw==} + '@astrojs/internal-helpers@0.4.2': + resolution: {integrity: sha512-EdDWkC3JJVcpGpqJAU/5hSk2LKXyG3mNGkzGoAuyK+xoPHbaVdSuIWoN1QTnmK3N/gGfaaAfM8gO2KDCAW7S3w==} + '@astrojs/language-server@2.15.0': resolution: {integrity: sha512-wJHSjGApm5X8Rg1GvkevoatZBfvaFizY4kCPvuSYgs3jGCobuY3KstJGKC1yNLsRJlDweHruP+J54iKn9vEKoA==} hasBin: true @@ -6435,6 +6616,43 @@ packages: bundledDependencies: - is-unicode-supported + '@cloudflare/kv-asset-handler@0.3.4': + resolution: {integrity: sha512-YLPHc8yASwjNkmcDMQMY35yiWjoKAKnhUbPRszBRS0YgH+IXtsMp61j+yTcnCE3oO2DgP0U3iejLC8FTtKDC8Q==} + engines: {node: '>=16.13'} + + '@cloudflare/workerd-darwin-64@1.20250129.0': + resolution: {integrity: sha512-M+xETVnl+xy2dfDDWmp0XXr2rttl70a6bljQygl0EmYmNswFTcYbQWCaBuNBo9kabU59rLKr4a/b3QZ07NoL/g==} + engines: {node: '>=16'} + cpu: [x64] + os: [darwin] + + '@cloudflare/workerd-darwin-arm64@1.20250129.0': + resolution: {integrity: sha512-c4PQUyIMp+bCMxZkAMBzXgTHjRZxeYCujDbb3staestqgRbenzcfauXsMd6np35ng+EE1uBgHNPV4+7fC0ZBfg==} + engines: {node: '>=16'} + cpu: [arm64] + os: [darwin] + + '@cloudflare/workerd-linux-64@1.20250129.0': + resolution: {integrity: sha512-xJx8LwWFxsm5U3DETJwRuOmT5RWBqm4FmA4itYXvcEICca9pWJDB641kT4PnpypwDNmYOebhU7A+JUrCRucG0w==} + engines: {node: '>=16'} + cpu: [x64] + os: [linux] + + '@cloudflare/workerd-linux-arm64@1.20250129.0': + resolution: {integrity: sha512-dR//npbaX5p323huBVNIy5gaWubQx6CC3aiXeK0yX4aD5ar8AjxQFb2U/Sgjeo65Rkt53hJWqC7IwRpK/eOxrA==} + engines: {node: '>=16'} + cpu: [arm64] + os: [linux] + + '@cloudflare/workerd-windows-64@1.20250129.0': + resolution: {integrity: sha512-OeO+1nPj/ocAE3adFar/tRFGRkbCrBnrOYXq0FUBSpyNHpDdA9/U3PAw5CN4zvjfTnqXZfTxTFeqoruqzRzbtg==} + engines: {node: '>=16'} + cpu: [x64] + os: [win32] + + '@cloudflare/workers-types@4.20250204.0': + resolution: {integrity: sha512-mWoQbYaP+nYztx9I7q9sgaiNlT54Cypszz0RfzMxYnT5W3NXDuwGcjGB+5B5H5VB8tEC2dYnBRpa70lX94ueaQ==} + '@codspeed/core@4.0.0': resolution: {integrity: sha512-B3zwdwLG8rcV0ORfYKX1wDP6ZCWf9C6ySidSf61q2vm9v5Lj2cWwRvj7vX+w/UyFHWKjp/zSyWTEed/r3Fv4Tg==} @@ -6448,6 +6666,10 @@ packages: resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==} engines: {node: '>=0.1.90'} + '@cspotcode/source-map-support@0.8.1': + resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} + engines: {node: '>=12'} + '@csstools/cascade-layer-name-parser@2.0.4': resolution: {integrity: sha512-7DFHlPuIxviKYZrOiwVU/PiHLm3lLUR23OMuEEtfEOQTOp9hzQ2JjdY6X5H18RVuUPJqSCI+qNnD5iOLMVE0bA==} engines: {node: '>=18'} @@ -6727,102 +6949,208 @@ packages: '@emnapi/runtime@1.3.1': resolution: {integrity: sha512-kEBmG8KyqtxJZv+ygbEim+KCGtIq1fC22Ms3S4ziXmYKm8uyoLX0MHONVKwp+9opg390VaKRNt4a7A9NwmpNhw==} + '@esbuild-plugins/node-globals-polyfill@0.2.3': + resolution: {integrity: sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw==} + peerDependencies: + esbuild: '*' + + '@esbuild-plugins/node-modules-polyfill@0.2.2': + resolution: {integrity: sha512-LXV7QsWJxRuMYvKbiznh+U1ilIop3g2TeKRzUxOG5X3YITc8JyyTa90BmLwqqv0YnX4v32CSlG+vsziZp9dMvA==} + peerDependencies: + esbuild: '*' + '@esbuild/aix-ppc64@0.24.2': resolution: {integrity: sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==} engines: {node: '>=18'} cpu: [ppc64] os: [aix] + '@esbuild/android-arm64@0.17.19': + resolution: {integrity: sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + '@esbuild/android-arm64@0.24.2': resolution: {integrity: sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==} engines: {node: '>=18'} cpu: [arm64] os: [android] + '@esbuild/android-arm@0.17.19': + resolution: {integrity: sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + '@esbuild/android-arm@0.24.2': resolution: {integrity: sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==} engines: {node: '>=18'} cpu: [arm] os: [android] + '@esbuild/android-x64@0.17.19': + resolution: {integrity: sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + '@esbuild/android-x64@0.24.2': resolution: {integrity: sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==} engines: {node: '>=18'} cpu: [x64] os: [android] + '@esbuild/darwin-arm64@0.17.19': + resolution: {integrity: sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + '@esbuild/darwin-arm64@0.24.2': resolution: {integrity: sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==} engines: {node: '>=18'} cpu: [arm64] os: [darwin] + '@esbuild/darwin-x64@0.17.19': + resolution: {integrity: sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + '@esbuild/darwin-x64@0.24.2': resolution: {integrity: sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==} engines: {node: '>=18'} cpu: [x64] os: [darwin] + '@esbuild/freebsd-arm64@0.17.19': + resolution: {integrity: sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + '@esbuild/freebsd-arm64@0.24.2': resolution: {integrity: sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==} engines: {node: '>=18'} cpu: [arm64] os: [freebsd] + '@esbuild/freebsd-x64@0.17.19': + resolution: {integrity: sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + '@esbuild/freebsd-x64@0.24.2': resolution: {integrity: sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==} engines: {node: '>=18'} cpu: [x64] os: [freebsd] + '@esbuild/linux-arm64@0.17.19': + resolution: {integrity: sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + '@esbuild/linux-arm64@0.24.2': resolution: {integrity: sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==} engines: {node: '>=18'} cpu: [arm64] os: [linux] + '@esbuild/linux-arm@0.17.19': + resolution: {integrity: sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + '@esbuild/linux-arm@0.24.2': resolution: {integrity: sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==} engines: {node: '>=18'} cpu: [arm] os: [linux] + '@esbuild/linux-ia32@0.17.19': + resolution: {integrity: sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + '@esbuild/linux-ia32@0.24.2': resolution: {integrity: sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==} engines: {node: '>=18'} cpu: [ia32] os: [linux] + '@esbuild/linux-loong64@0.17.19': + resolution: {integrity: sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + '@esbuild/linux-loong64@0.24.2': resolution: {integrity: sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==} engines: {node: '>=18'} cpu: [loong64] os: [linux] + '@esbuild/linux-mips64el@0.17.19': + resolution: {integrity: sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + '@esbuild/linux-mips64el@0.24.2': resolution: {integrity: sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==} engines: {node: '>=18'} cpu: [mips64el] os: [linux] + '@esbuild/linux-ppc64@0.17.19': + resolution: {integrity: sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + '@esbuild/linux-ppc64@0.24.2': resolution: {integrity: sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==} engines: {node: '>=18'} cpu: [ppc64] os: [linux] + '@esbuild/linux-riscv64@0.17.19': + resolution: {integrity: sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + '@esbuild/linux-riscv64@0.24.2': resolution: {integrity: sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==} engines: {node: '>=18'} cpu: [riscv64] os: [linux] + '@esbuild/linux-s390x@0.17.19': + resolution: {integrity: sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + '@esbuild/linux-s390x@0.24.2': resolution: {integrity: sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==} engines: {node: '>=18'} cpu: [s390x] os: [linux] + '@esbuild/linux-x64@0.17.19': + resolution: {integrity: sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + '@esbuild/linux-x64@0.24.2': resolution: {integrity: sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==} engines: {node: '>=18'} @@ -6835,6 +7163,12 @@ packages: cpu: [arm64] os: [netbsd] + '@esbuild/netbsd-x64@0.17.19': + resolution: {integrity: sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + '@esbuild/netbsd-x64@0.24.2': resolution: {integrity: sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==} engines: {node: '>=18'} @@ -6847,30 +7181,60 @@ packages: cpu: [arm64] os: [openbsd] + '@esbuild/openbsd-x64@0.17.19': + resolution: {integrity: sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + '@esbuild/openbsd-x64@0.24.2': resolution: {integrity: sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==} engines: {node: '>=18'} cpu: [x64] os: [openbsd] + '@esbuild/sunos-x64@0.17.19': + resolution: {integrity: sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + '@esbuild/sunos-x64@0.24.2': resolution: {integrity: sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==} engines: {node: '>=18'} cpu: [x64] os: [sunos] + '@esbuild/win32-arm64@0.17.19': + resolution: {integrity: sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + '@esbuild/win32-arm64@0.24.2': resolution: {integrity: sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==} engines: {node: '>=18'} cpu: [arm64] os: [win32] + '@esbuild/win32-ia32@0.17.19': + resolution: {integrity: sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + '@esbuild/win32-ia32@0.24.2': resolution: {integrity: sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==} engines: {node: '>=18'} cpu: [ia32] os: [win32] + '@esbuild/win32-x64@0.17.19': + resolution: {integrity: sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + '@esbuild/win32-x64@0.24.2': resolution: {integrity: sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==} engines: {node: '>=18'} @@ -6911,6 +7275,10 @@ packages: resolution: {integrity: sha512-lB05FkqEdUg2AA0xEbUz0SnkXT1LcCTa438W4IWTUh4hdOnVbQyOJ81OrDXsJk/LSiJHubgGEFoR5EHq1NsH1A==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@fastify/busboy@2.1.1': + resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==} + engines: {node: '>=14'} + '@fontsource/monofett@5.1.1': resolution: {integrity: sha512-W4MZDfKwpNuEJJewGzTMn1Z1prwF7dpw6YOfIx7RwSdeiEfMevNdUp1457+NR2bUQdloQs8F7RqLnFrxL7+lbg==} @@ -7181,6 +7549,9 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + '@jridgewell/trace-mapping@0.3.9': + resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} + '@jsdevtools/rehype-toc@3.0.2': resolution: {integrity: sha512-n5JEf16Wr4mdkRMZ8wMP/wN9/sHmTjRPbouXjJH371mZ2LEGDl72t8tEsMRNFerQN/QJtivOxqK1frdGa4QK5Q==} engines: {node: '>=10'} @@ -8114,6 +8485,10 @@ packages: peerDependencies: acorn: '>=8.9.0' + acorn-walk@8.3.4: + resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==} + engines: {node: '>=0.4.0'} + acorn@8.14.0: resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} engines: {node: '>=0.4.0'} @@ -8193,6 +8568,9 @@ packages: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} + as-table@1.0.55: + resolution: {integrity: sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ==} + assertion-error@2.0.1: resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} engines: {node: '>=12'} @@ -8291,6 +8669,9 @@ packages: birpc@0.2.19: resolution: {integrity: sha512-5WeXXAvTmitV1RqJFppT5QtUiz2p1mRSYU000Jkft5ZUCLJIk4uQriYNO50HknxKwM6jd8utNc66K1qGIwwWBQ==} + blake3-wasm@2.1.5: + resolution: {integrity: sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==} + body-parser@1.20.3: resolution: {integrity: sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==} engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} @@ -8500,6 +8881,9 @@ packages: concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + confbox@0.1.8: + resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==} + consola@3.2.3: resolution: {integrity: sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==} engines: {node: ^14.18.0 || >=16.10.0} @@ -8604,6 +8988,9 @@ packages: csstype@3.1.3: resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} + data-uri-to-buffer@2.0.2: + resolution: {integrity: sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA==} + data-uri-to-buffer@4.0.1: resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==} engines: {node: '>= 12'} @@ -8939,6 +9326,11 @@ packages: peerDependencies: esbuild: '>= 0.14.0' + esbuild@0.17.19: + resolution: {integrity: sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==} + engines: {node: '>=12'} + hasBin: true + esbuild@0.24.2: resolution: {integrity: sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==} engines: {node: '>=18'} @@ -9036,6 +9428,9 @@ packages: estree-util-visit@2.0.0: resolution: {integrity: sha512-m5KgiH85xAhhW8Wta0vShLcUvOsh3LLPI2YVwcbio1l7E09NTLL1EyMZFM1OyWowoH0skScNbhOPl4kcBgzTww==} + estree-walker@0.6.1: + resolution: {integrity: sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==} + estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} @@ -9061,6 +9456,10 @@ packages: resolution: {integrity: sha512-EHlpxMCpHWSAh1dgS6bVeoLAXGnJNdR93aabr4QCGbzOM73o5XmRfM/e5FUqsw3aagP8S8XEWUWFAxnRBnAF0Q==} engines: {node: ^18.19.0 || >=20.5.0} + exit-hook@2.2.1: + resolution: {integrity: sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw==} + engines: {node: '>=6'} + expect-type@1.1.0: resolution: {integrity: sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==} engines: {node: '>=12.0.0'} @@ -9251,6 +9650,9 @@ packages: resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} engines: {node: '>= 0.4'} + get-source@2.0.12: + resolution: {integrity: sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w==} + get-stream@8.0.1: resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} engines: {node: '>=16'} @@ -9270,6 +9672,9 @@ packages: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} + glob-to-regexp@0.4.1: + resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} + glob@10.4.5: resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} hasBin: true @@ -9286,6 +9691,9 @@ packages: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} + globalyzer@0.1.0: + resolution: {integrity: sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==} + globby@11.1.0: resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} engines: {node: '>=10'} @@ -9294,6 +9702,9 @@ packages: resolution: {integrity: sha512-s3Fq41ZVh7vbbe2PN3nrW7yC7U7MFVc5c98/iTl9c2GawNMKx/J648KQRW6WKkuU8GIbbh2IXfIRQjOZnXcTnw==} engines: {node: '>=18'} + globrex@0.1.2: + resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} + gopd@1.2.0: resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} engines: {node: '>= 0.4'} @@ -9846,6 +10257,9 @@ packages: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} hasBin: true + magic-string@0.25.9: + resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==} + magic-string@0.30.17: resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==} @@ -10110,6 +10524,11 @@ packages: resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} engines: {node: '>=12'} + miniflare@3.20250129.0: + resolution: {integrity: sha512-qYlGEjMl/2kJdgNaztj4hpA64d6Dl79Lx/NL61p/v5XZRiWanBOTgkQqdPxCKZOj6KQnioqhC7lfd6jDXKSs2A==} + engines: {node: '>=16.13'} + hasBin: true + minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} @@ -10156,6 +10575,9 @@ packages: engines: {node: '>=10'} hasBin: true + mlly@1.7.4: + resolution: {integrity: sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw==} + mri@1.2.0: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} engines: {node: '>=4'} @@ -10173,6 +10595,10 @@ packages: muggle-string@0.4.1: resolution: {integrity: sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==} + mustache@4.2.0: + resolution: {integrity: sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==} + hasBin: true + mz@2.7.0: resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} @@ -10518,6 +10944,9 @@ packages: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} + pkg-types@1.3.1: + resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==} + playwright-core@1.50.1: resolution: {integrity: sha512-ra9fsNWayuYumt+NiM069M6OkcRb1FZSK8bgi66AtpFoWkg2+y0bJSNmkFrWhMbEBbVKC/EruAHH3g0zmtwGmQ==} engines: {node: '>=18'} @@ -10776,6 +11205,9 @@ packages: resolution: {integrity: sha512-4yf0QO/sllf/1zbZWYnvWw3NxCQwLXKzIj0G849LSufP15BXKM0rbD2Z3wVnkMfjdn/CB0Dpp444gYAACdsplg==} engines: {node: '>=18'} + printable-characters@1.0.42: + resolution: {integrity: sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ==} + prismjs@1.29.0: resolution: {integrity: sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==} engines: {node: '>=6'} @@ -11039,6 +11471,16 @@ packages: resolution: {integrity: sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==} hasBin: true + rollup-plugin-inject@3.0.2: + resolution: {integrity: sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w==} + deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject. + + rollup-plugin-node-polyfills@0.2.1: + resolution: {integrity: sha512-4kCrKPTJ6sK4/gLL/U5QzVT8cxJcofO0OU74tnB19F40cmuAKSzH5/siithxlofFEjwvw1YAhPmbvGNA6jEroA==} + + rollup-pluginutils@2.8.2: + resolution: {integrity: sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==} + rollup@4.34.2: resolution: {integrity: sha512-sBDUoxZEaqLu9QeNalL8v3jw6WjPku4wfZGyTU7l7m1oC+rpRihXc/n/H+4148ZkGz5Xli8CHMns//fFGKvpIQ==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} @@ -11239,10 +11681,18 @@ packages: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + source-map@0.7.4: resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==} engines: {node: '>= 8'} + sourcemap-codec@1.4.8: + resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==} + deprecated: Please use @jridgewell/sourcemap-codec instead + space-separated-tokens@2.0.2: resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==} @@ -11267,6 +11717,9 @@ packages: stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + stacktracey@2.1.8: + resolution: {integrity: sha512-Kpij9riA+UNg7TnphqjH7/CzctQ/owJGNbFkfEeve4Z4uxT5+JapVLFXcsurIfN34gnTWZNJ/f7NMG0E8JDzTw==} + statuses@2.0.1: resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==} engines: {node: '>= 0.8'} @@ -11274,6 +11727,10 @@ packages: std-env@3.8.0: resolution: {integrity: sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==} + stoppable@1.1.0: + resolution: {integrity: sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==} + engines: {node: '>=4', npm: '>=6'} + stream-replace-string@2.0.0: resolution: {integrity: sha512-TlnjJ1C0QrmxRNrON00JvaFFlNh5TTG00APw23j74ET7gkQpTASi6/L2fuiav8pzK715HXtUeClpBTw2NPSn6w==} @@ -11416,6 +11873,9 @@ packages: resolution: {integrity: sha512-wMctrWD2HZZLuIlchlkE2dfXJh7J2KDI9Dwl+2abPYg0mswQHfOAyQW3jJg1pY5VfttSINZuKcXoB3FGypVklA==} engines: {node: '>=8'} + tiny-glob@0.2.9: + resolution: {integrity: sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==} + tinybench@2.9.0: resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} @@ -11587,6 +12047,10 @@ packages: undici-types@6.20.0: resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} + undici@5.28.5: + resolution: {integrity: sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==} + engines: {node: '>=14.0'} + undici@6.21.0: resolution: {integrity: sha512-BUgJXc752Kou3oOIuU1i+yZZypyZRqNPW0vqoMPl8VaoalSfeR0D8/t4iAS3yirs79SSMTxTag+ZC86uswv+Cw==} engines: {node: '>=18.17'} @@ -11598,6 +12062,9 @@ packages: unenv@1.10.0: resolution: {integrity: sha512-wY5bskBQFL9n3Eca5XnhH6KbUo/tfvkwm9OpcdCvLaeA7piBNbavbOKJySEwQ1V0RH6HvNlSAFRTpvTqgKRQXQ==} + unenv@2.0.0-rc.1: + resolution: {integrity: sha512-PU5fb40H8X149s117aB4ytbORcCvlASdtF97tfls4BPIyj4PeVxvpSuy1jAptqYHqB0vb2w2sHvzM0XWcp2OKg==} + unicorn-magic@0.1.0: resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==} engines: {node: '>=18'} @@ -12093,6 +12560,21 @@ packages: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} + workerd@1.20250129.0: + resolution: {integrity: sha512-Rprz8rxKTF4l6q/nYYI07lBetJnR19mGipx+u/a27GZOPKMG5SLIzA2NciZlJaB2Qd5YY+4p/eHOeKqo5keVWA==} + engines: {node: '>=16'} + hasBin: true + + wrangler@3.107.3: + resolution: {integrity: sha512-N9ZMDHZ+DI5/B0yclr3bG57U/Zw7wSzGdpO2l7j6+3q8yUf+4Fk0Rvneo2t8rjLewKlvqgt9D9siFuo8MXJ55Q==} + engines: {node: '>=16.17.0'} + hasBin: true + peerDependencies: + '@cloudflare/workers-types': ^4.20250129.0 + peerDependenciesMeta: + '@cloudflare/workers-types': + optional: true + wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} @@ -12120,6 +12602,18 @@ packages: utf-8-validate: optional: true + ws@8.18.0: + resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + xml-name-validator@5.0.0: resolution: {integrity: sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==} engines: {node: '>=18'} @@ -12193,6 +12687,9 @@ packages: resolution: {integrity: sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==} engines: {node: '>=18'} + youch@3.3.4: + resolution: {integrity: sha512-UeVBXie8cA35DS6+nBkls68xaBBXCye0CNznrhszZjTbRVnJKQuNsyLKBTTL4ln1o1rh2PKtv35twV7irj5SEg==} + zimmerframe@1.1.2: resolution: {integrity: sha512-rAbqEGa8ovJy4pyBxZM70hg4pE6gDgaQ0Sl9M3enG3I0d6H4XSAM3GeNGLKnsBpuijUow064sf7ww1nutC5/3w==} @@ -12290,6 +12787,8 @@ snapshots: '@astrojs/compiler@2.10.3': {} + '@astrojs/internal-helpers@0.4.2': {} + '@astrojs/language-server@2.15.0(prettier-plugin-astro@0.14.1)(prettier@3.4.2)(typescript@5.7.3)': dependencies: '@astrojs/compiler': 2.10.3 @@ -12760,6 +13259,27 @@ snapshots: picocolors: 1.1.1 sisteransi: 1.0.5 + '@cloudflare/kv-asset-handler@0.3.4': + dependencies: + mime: 3.0.0 + + '@cloudflare/workerd-darwin-64@1.20250129.0': + optional: true + + '@cloudflare/workerd-darwin-arm64@1.20250129.0': + optional: true + + '@cloudflare/workerd-linux-64@1.20250129.0': + optional: true + + '@cloudflare/workerd-linux-arm64@1.20250129.0': + optional: true + + '@cloudflare/workerd-windows-64@1.20250129.0': + optional: true + + '@cloudflare/workers-types@4.20250204.0': {} + '@codspeed/core@4.0.0': dependencies: axios: 1.7.7 @@ -12780,6 +13300,10 @@ snapshots: '@colors/colors@1.5.0': optional: true + '@cspotcode/source-map-support@0.8.1': + dependencies: + '@jridgewell/trace-mapping': 0.3.9 + '@csstools/cascade-layer-name-parser@2.0.4(@csstools/css-parser-algorithms@3.0.4(@csstools/css-tokenizer@3.0.3))(@csstools/css-tokenizer@3.0.3)': dependencies: '@csstools/css-parser-algorithms': 3.0.4(@csstools/css-tokenizer@3.0.3) @@ -13065,78 +13589,154 @@ snapshots: tslib: 2.6.2 optional: true + '@esbuild-plugins/node-globals-polyfill@0.2.3(esbuild@0.17.19)': + dependencies: + esbuild: 0.17.19 + + '@esbuild-plugins/node-modules-polyfill@0.2.2(esbuild@0.17.19)': + dependencies: + esbuild: 0.17.19 + escape-string-regexp: 4.0.0 + rollup-plugin-node-polyfills: 0.2.1 + '@esbuild/aix-ppc64@0.24.2': optional: true + '@esbuild/android-arm64@0.17.19': + optional: true + '@esbuild/android-arm64@0.24.2': optional: true + '@esbuild/android-arm@0.17.19': + optional: true + '@esbuild/android-arm@0.24.2': optional: true + '@esbuild/android-x64@0.17.19': + optional: true + '@esbuild/android-x64@0.24.2': optional: true + '@esbuild/darwin-arm64@0.17.19': + optional: true + '@esbuild/darwin-arm64@0.24.2': optional: true + '@esbuild/darwin-x64@0.17.19': + optional: true + '@esbuild/darwin-x64@0.24.2': optional: true + '@esbuild/freebsd-arm64@0.17.19': + optional: true + '@esbuild/freebsd-arm64@0.24.2': optional: true + '@esbuild/freebsd-x64@0.17.19': + optional: true + '@esbuild/freebsd-x64@0.24.2': optional: true + '@esbuild/linux-arm64@0.17.19': + optional: true + '@esbuild/linux-arm64@0.24.2': optional: true + '@esbuild/linux-arm@0.17.19': + optional: true + '@esbuild/linux-arm@0.24.2': optional: true + '@esbuild/linux-ia32@0.17.19': + optional: true + '@esbuild/linux-ia32@0.24.2': optional: true + '@esbuild/linux-loong64@0.17.19': + optional: true + '@esbuild/linux-loong64@0.24.2': optional: true + '@esbuild/linux-mips64el@0.17.19': + optional: true + '@esbuild/linux-mips64el@0.24.2': optional: true + '@esbuild/linux-ppc64@0.17.19': + optional: true + '@esbuild/linux-ppc64@0.24.2': optional: true + '@esbuild/linux-riscv64@0.17.19': + optional: true + '@esbuild/linux-riscv64@0.24.2': optional: true + '@esbuild/linux-s390x@0.17.19': + optional: true + '@esbuild/linux-s390x@0.24.2': optional: true + '@esbuild/linux-x64@0.17.19': + optional: true + '@esbuild/linux-x64@0.24.2': optional: true '@esbuild/netbsd-arm64@0.24.2': optional: true + '@esbuild/netbsd-x64@0.17.19': + optional: true + '@esbuild/netbsd-x64@0.24.2': optional: true '@esbuild/openbsd-arm64@0.24.2': optional: true + '@esbuild/openbsd-x64@0.17.19': + optional: true + '@esbuild/openbsd-x64@0.24.2': optional: true + '@esbuild/sunos-x64@0.17.19': + optional: true + '@esbuild/sunos-x64@0.24.2': optional: true + '@esbuild/win32-arm64@0.17.19': + optional: true + '@esbuild/win32-arm64@0.24.2': optional: true + '@esbuild/win32-ia32@0.17.19': + optional: true + '@esbuild/win32-ia32@0.24.2': optional: true + '@esbuild/win32-x64@0.17.19': + optional: true + '@esbuild/win32-x64@0.24.2': optional: true @@ -13182,6 +13782,8 @@ snapshots: '@eslint/core': 0.10.0 levn: 0.4.1 + '@fastify/busboy@2.1.1': {} + '@fontsource/monofett@5.1.1': {} '@fontsource/montserrat@5.1.1': {} @@ -13379,6 +13981,11 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 + '@jridgewell/trace-mapping@0.3.9': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.0 + '@jsdevtools/rehype-toc@3.0.2': {} '@libsql/client@0.14.0': @@ -14418,6 +15025,10 @@ snapshots: dependencies: acorn: 8.14.0 + acorn-walk@8.3.4: + dependencies: + acorn: 8.14.0 + acorn@8.14.0: {} agent-base@7.1.1: @@ -14489,6 +15100,10 @@ snapshots: array-union@2.1.0: {} + as-table@1.0.55: + dependencies: + printable-characters: 1.0.42 + assertion-error@2.0.1: {} astring@1.9.0: {} @@ -14613,6 +15228,8 @@ snapshots: birpc@0.2.19: {} + blake3-wasm@2.1.5: {} + body-parser@1.20.3: dependencies: bytes: 3.1.2 @@ -14834,6 +15451,8 @@ snapshots: concat-map@0.0.1: {} + confbox@0.1.8: {} + consola@3.2.3: {} content-disposition@0.5.4: @@ -14924,6 +15543,8 @@ snapshots: csstype@3.1.3: {} + data-uri-to-buffer@2.0.2: {} + data-uri-to-buffer@4.0.1: {} data-urls@5.0.0: @@ -15032,8 +15653,9 @@ snapshots: dotenv@8.6.0: {} - drizzle-orm@0.31.4(@libsql/client@0.14.0)(@types/react@18.3.18)(react@19.0.0): + drizzle-orm@0.31.4(@cloudflare/workers-types@4.20250204.0)(@libsql/client@0.14.0)(@types/react@18.3.18)(react@19.0.0): optionalDependencies: + '@cloudflare/workers-types': 4.20250204.0 '@libsql/client': 0.14.0 '@types/react': 18.3.18 react: 19.0.0 @@ -15124,6 +15746,31 @@ snapshots: fs-extra: 10.1.0 globby: 11.1.0 + esbuild@0.17.19: + optionalDependencies: + '@esbuild/android-arm': 0.17.19 + '@esbuild/android-arm64': 0.17.19 + '@esbuild/android-x64': 0.17.19 + '@esbuild/darwin-arm64': 0.17.19 + '@esbuild/darwin-x64': 0.17.19 + '@esbuild/freebsd-arm64': 0.17.19 + '@esbuild/freebsd-x64': 0.17.19 + '@esbuild/linux-arm': 0.17.19 + '@esbuild/linux-arm64': 0.17.19 + '@esbuild/linux-ia32': 0.17.19 + '@esbuild/linux-loong64': 0.17.19 + '@esbuild/linux-mips64el': 0.17.19 + '@esbuild/linux-ppc64': 0.17.19 + '@esbuild/linux-riscv64': 0.17.19 + '@esbuild/linux-s390x': 0.17.19 + '@esbuild/linux-x64': 0.17.19 + '@esbuild/netbsd-x64': 0.17.19 + '@esbuild/openbsd-x64': 0.17.19 + '@esbuild/sunos-x64': 0.17.19 + '@esbuild/win32-arm64': 0.17.19 + '@esbuild/win32-ia32': 0.17.19 + '@esbuild/win32-x64': 0.17.19 + esbuild@0.24.2: optionalDependencies: '@esbuild/aix-ppc64': 0.24.2 @@ -15276,6 +15923,8 @@ snapshots: '@types/estree-jsx': 1.0.5 '@types/unist': 3.0.3 + estree-walker@0.6.1: {} + estree-walker@2.0.2: {} estree-walker@3.0.3: @@ -15315,6 +15964,8 @@ snapshots: strip-final-newline: 4.0.0 yoctocolors: 2.1.1 + exit-hook@2.2.1: {} + expect-type@1.1.0: {} express@4.21.2: @@ -15538,6 +16189,11 @@ snapshots: dunder-proto: 1.0.1 es-object-atoms: 1.1.1 + get-source@2.0.12: + dependencies: + data-uri-to-buffer: 2.0.2 + source-map: 0.6.1 + get-stream@8.0.1: {} get-stream@9.0.1: @@ -15555,6 +16211,8 @@ snapshots: dependencies: is-glob: 4.0.3 + glob-to-regexp@0.4.1: {} + glob@10.4.5: dependencies: foreground-child: 3.3.0 @@ -15577,6 +16235,8 @@ snapshots: globals@14.0.0: {} + globalyzer@0.1.0: {} + globby@11.1.0: dependencies: array-union: 2.1.0 @@ -15595,6 +16255,8 @@ snapshots: slash: 5.1.0 unicorn-magic: 0.1.0 + globrex@0.1.2: {} + gopd@1.2.0: {} graceful-fs@4.2.11: {} @@ -16240,6 +16902,10 @@ snapshots: lz-string@1.5.0: {} + magic-string@0.25.9: + dependencies: + sourcemap-codec: 1.4.8 + magic-string@0.30.17: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 @@ -16781,6 +17447,23 @@ snapshots: mimic-fn@4.0.0: {} + miniflare@3.20250129.0: + dependencies: + '@cspotcode/source-map-support': 0.8.1 + acorn: 8.14.0 + acorn-walk: 8.3.4 + exit-hook: 2.2.1 + glob-to-regexp: 0.4.1 + stoppable: 1.1.0 + undici: 5.28.5 + workerd: 1.20250129.0 + ws: 8.18.0 + youch: 3.3.4 + zod: 3.24.1 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + minimatch@3.1.2: dependencies: brace-expansion: 1.1.11 @@ -16817,6 +17500,13 @@ snapshots: mkdirp@3.0.1: {} + mlly@1.7.4: + dependencies: + acorn: 8.14.0 + pathe: 2.0.2 + pkg-types: 1.3.1 + ufo: 1.5.4 + mri@1.2.0: {} mrmime@2.0.0: {} @@ -16827,6 +17517,8 @@ snapshots: muggle-string@0.4.1: {} + mustache@4.2.0: {} + mz@2.7.0: dependencies: any-promise: 1.3.0 @@ -17132,6 +17824,12 @@ snapshots: dependencies: find-up: 4.1.0 + pkg-types@1.3.1: + dependencies: + confbox: 0.1.8 + mlly: 1.7.4 + pathe: 2.0.2 + playwright-core@1.50.1: {} playwright@1.50.1: @@ -17431,6 +18129,8 @@ snapshots: dependencies: parse-ms: 4.0.0 + printable-characters@1.0.42: {} + prismjs@1.29.0: {} progress@2.0.3: {} @@ -17796,6 +18496,20 @@ snapshots: dependencies: glob: 10.4.5 + rollup-plugin-inject@3.0.2: + dependencies: + estree-walker: 0.6.1 + magic-string: 0.25.9 + rollup-pluginutils: 2.8.2 + + rollup-plugin-node-polyfills@0.2.1: + dependencies: + rollup-plugin-inject: 3.0.2 + + rollup-pluginutils@2.8.2: + dependencies: + estree-walker: 0.6.1 + rollup@4.34.2: dependencies: '@types/estree': 1.0.6 @@ -18108,8 +18822,12 @@ snapshots: source-map-js@1.2.1: {} + source-map@0.6.1: {} + source-map@0.7.4: {} + sourcemap-codec@1.4.8: {} + space-separated-tokens@2.0.2: {} spawndamnit@3.0.1: @@ -18131,10 +18849,17 @@ snapshots: stackback@0.0.2: {} + stacktracey@2.1.8: + dependencies: + as-table: 1.0.55 + get-source: 2.0.12 + statuses@2.0.1: {} std-env@3.8.0: {} + stoppable@1.1.0: {} + stream-replace-string@2.0.0: {} string-width@4.2.3: @@ -18325,6 +19050,11 @@ snapshots: timestring@6.0.0: {} + tiny-glob@0.2.9: + dependencies: + globalyzer: 0.1.0 + globrex: 0.1.2 + tinybench@2.9.0: {} tinyexec@0.3.2: {} @@ -18458,6 +19188,10 @@ snapshots: undici-types@6.20.0: {} + undici@5.28.5: + dependencies: + '@fastify/busboy': 2.1.1 + undici@6.21.0: {} undici@7.3.0: {} @@ -18470,6 +19204,14 @@ snapshots: node-fetch-native: 1.6.4 pathe: 1.1.2 + unenv@2.0.0-rc.1: + dependencies: + defu: 6.1.4 + mlly: 1.7.4 + ohash: 1.1.4 + pathe: 1.1.2 + ufo: 1.5.4 + unicorn-magic@0.1.0: {} unicorn-magic@0.3.0: {} @@ -18959,6 +19701,32 @@ snapshots: word-wrap@1.2.5: {} + workerd@1.20250129.0: + optionalDependencies: + '@cloudflare/workerd-darwin-64': 1.20250129.0 + '@cloudflare/workerd-darwin-arm64': 1.20250129.0 + '@cloudflare/workerd-linux-64': 1.20250129.0 + '@cloudflare/workerd-linux-arm64': 1.20250129.0 + '@cloudflare/workerd-windows-64': 1.20250129.0 + + wrangler@3.107.3(@cloudflare/workers-types@4.20250204.0): + dependencies: + '@cloudflare/kv-asset-handler': 0.3.4 + '@esbuild-plugins/node-globals-polyfill': 0.2.3(esbuild@0.17.19) + '@esbuild-plugins/node-modules-polyfill': 0.2.2(esbuild@0.17.19) + blake3-wasm: 2.1.5 + esbuild: 0.17.19 + miniflare: 3.20250129.0 + path-to-regexp: 6.3.0 + unenv: 2.0.0-rc.1 + workerd: 1.20250129.0 + optionalDependencies: + '@cloudflare/workers-types': 4.20250204.0 + fsevents: 2.3.3 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + wrap-ansi@7.0.0: dependencies: ansi-styles: 4.3.0 @@ -18981,6 +19749,8 @@ snapshots: ws@8.16.0: {} + ws@8.18.0: {} + xml-name-validator@5.0.0: {} xml2js@0.6.2: @@ -19045,6 +19815,12 @@ snapshots: yoctocolors@2.1.1: {} + youch@3.3.4: + dependencies: + cookie: 0.7.2 + mustache: 4.2.0 + stacktracey: 2.1.8 + zimmerframe@1.1.2: {} zod-to-json-schema@3.24.1(zod@3.24.1):