@astrojs/deno
Advanced tools
Comparing version 0.1.10 to 0.2.0
# @astrojs/node | ||
## 0.2.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', | ||
}); | ||
``` | ||
* [#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 | ||
<div>Your address { Astro.clientAddress }</div> | ||
``` | ||
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.1.10 | ||
@@ -4,0 +41,0 @@ |
@@ -23,4 +23,10 @@ import esbuild from "esbuild"; | ||
hooks: { | ||
"astro:config:done": ({ setAdapter }) => { | ||
"astro:config:done": ({ setAdapter, config }) => { | ||
setAdapter(getAdapter(args)); | ||
if (config.output === "static") { | ||
console.warn(`[@astrojs/deno] \`output: "server"\` is required to use this adapter.`); | ||
console.warn( | ||
`[@astrojs/deno] Otherwise, this adapter is not required to deploy a static site to Deno.` | ||
); | ||
} | ||
}, | ||
@@ -27,0 +33,0 @@ "astro:build:start": ({ buildConfig }) => { |
@@ -12,4 +12,7 @@ import { App } from "astro/app"; | ||
const app = new App(manifest); | ||
const handler = async (request) => { | ||
const handler = async (request, connInfo) => { | ||
var _a; | ||
if (app.match(request)) { | ||
let ip = (_a = connInfo == null ? void 0 : connInfo.remoteAddr) == null ? void 0 : _a.hostname; | ||
Reflect.set(request, Symbol.for("astro.clientAddress"), ip); | ||
return await app.render(request); | ||
@@ -16,0 +19,0 @@ } |
{ | ||
"name": "@astrojs/deno", | ||
"description": "Deploy your site to a Deno server", | ||
"version": "0.1.10", | ||
"version": "0.2.0", | ||
"type": "module", | ||
@@ -28,3 +28,3 @@ "types": "./dist/index.d.ts", | ||
"devDependencies": { | ||
"astro": "1.0.0-beta.69", | ||
"astro": "1.0.0-rc.1", | ||
"astro-scripts": "0.0.6" | ||
@@ -31,0 +31,0 @@ }, |
@@ -40,2 +40,3 @@ # @astrojs/deno 🦖 | ||
// ... | ||
output: 'server', | ||
adapter: deno() | ||
@@ -73,2 +74,3 @@ }); | ||
export default defineConfig({ | ||
output: 'server', | ||
adapter: deno({ | ||
@@ -90,2 +92,3 @@ //options go here | ||
export default defineConfig({ | ||
output: 'server', | ||
adapter: deno({ | ||
@@ -121,2 +124,3 @@ start: false | ||
export default defineConfig({ | ||
output: 'server', | ||
adapter: deno({ | ||
@@ -123,0 +127,0 @@ port: 8081, |
@@ -32,4 +32,11 @@ import type { AstroAdapter, AstroIntegration } from 'astro'; | ||
hooks: { | ||
'astro:config:done': ({ setAdapter }) => { | ||
'astro:config:done': ({ setAdapter, config }) => { | ||
setAdapter(getAdapter(args)); | ||
if (config.output === 'static') { | ||
console.warn(`[@astrojs/deno] \`output: "server"\` is required to use this adapter.`); | ||
console.warn( | ||
`[@astrojs/deno] Otherwise, this adapter is not required to deploy a static site to Deno.` | ||
); | ||
} | ||
}, | ||
@@ -36,0 +43,0 @@ 'astro:build:start': ({ buildConfig }) => { |
@@ -25,4 +25,6 @@ // Normal Imports | ||
const app = new App(manifest); | ||
const handler = async (request: Request) => { | ||
const handler = async (request: Request, connInfo: any) => { | ||
if (app.match(request)) { | ||
let ip = connInfo?.remoteAddr?.hostname; | ||
Reflect.set(request, Symbol.for('astro.clientAddress'), ip); | ||
return await app.render(request); | ||
@@ -29,0 +31,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31994
465
149