Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@astrojs/cloudflare

Package Overview
Dependencies
Maintainers
4
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@astrojs/cloudflare - npm Package Compare versions

Comparing version 0.0.0-rc-20220722032928 to 0.0.0-rc-20220725043302

27

CHANGELOG.md
# @astrojs/cloudflare
## 0.0.0-rc-20220722032928
## 0.0.0-rc-20220725043302
### 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

@@ -8,0 +33,0 @@

@@ -20,2 +20,6 @@ import esbuild from "esbuild";

_config = config;
if (config.output === "static") {
console.warn(`[@astrojs/cloudflare] \`output: "server"\` is required to use this adapter.`);
console.warn(`[@astrojs/cloudflare] Otherwise, this adapter is not required to deploy a static site to Cloudflare.`);
}
},

@@ -22,0 +26,0 @@ "astro:build:start": ({ buildConfig }) => {

9

dist/server.js

@@ -11,10 +11,7 @@ import "./shim.js";

}
if (app.match(request)) {
let routeData = app.match(request, { matchNotFound: true });
if (routeData) {
Reflect.set(request, Symbol.for("astro.clientAddress"), request.headers.get("cf-connecting-ip"));
return app.render(request);
return app.render(request, routeData);
}
const _404Request = new Request(`${origin}/404`, request);
if (app.match(_404Request)) {
return app.render(_404Request);
}
return new Response(null, {

@@ -21,0 +18,0 @@ status: 404,

{
"name": "@astrojs/cloudflare",
"description": "Deploy your site to cloudflare pages functions",
"version": "0.0.0-rc-20220722032928",
"version": "0.0.0-rc-20220725043302",
"type": "module",

@@ -28,3 +28,3 @@ "types": "./dist/index.d.ts",

"devDependencies": {
"astro": "0.0.0-rc-20220722032928",
"astro": "0.0.0-rc-20220725043302",
"astro-scripts": "0.0.6"

@@ -31,0 +31,0 @@ },

@@ -12,2 +12,3 @@ # @astrojs/cloudflare

export default defineConfig({
output: 'server',
adapter: cloudflare()

@@ -14,0 +15,0 @@ });

@@ -24,2 +24,11 @@ import type { AstroAdapter, AstroConfig, AstroIntegration, BuildConfig } from 'astro';

_config = config;
if (config.output === 'static') {
console.warn(
`[@astrojs/cloudflare] \`output: "server"\` is required to use this adapter.`
);
console.warn(
`[@astrojs/cloudflare] Otherwise, this adapter is not required to deploy a static site to Cloudflare.`
);
}
},

@@ -26,0 +35,0 @@ 'astro:build:start': ({ buildConfig }) => {

@@ -22,3 +22,4 @@ import './shim.js';

if (app.match(request)) {
let routeData = app.match(request, { matchNotFound: true });
if (routeData) {
Reflect.set(

@@ -29,11 +30,5 @@ request,

);
return app.render(request);
return app.render(request, routeData);
}
// 404
const _404Request = new Request(`${origin}/404`, request);
if (app.match(_404Request)) {
return app.render(_404Request);
}
return new Response(null, {

@@ -40,0 +35,0 @@ status: 404,

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc