@astrojs/vercel
Advanced tools
Comparing version 0.0.0-monorepos-20221010034923 to 0.0.0-node-standalone-20221011210529
# @astrojs/vercel | ||
## 0.0.0-monorepos-20221010034923 | ||
## 0.0.0-node-standalone-20221011210529 | ||
### Minor Changes | ||
- [#5056](https://github.com/withastro/astro/pull/5056) [`69e32cbba`](https://github.com/withastro/astro/commit/69e32cbba2ee8537a002755c34598dab834898c9) Thanks [@matthewp](https://github.com/matthewp)! - # New build configuration | ||
The ability to customize SSR build configuration more granular 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 if 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: '...', | ||
}, | ||
}); | ||
}, | ||
}, | ||
}; | ||
} | ||
``` | ||
## 2.1.1 | ||
### Patch Changes | ||
- [#5033](https://github.com/withastro/astro/pull/5033) [`131c6c42b`](https://github.com/withastro/astro/commit/131c6c42b340d5aa2a6fed5c1bcd257d9b9de759) Thanks [@JuanM04](https://github.com/JuanM04)! - - Upgraded @vercel/nft to 0.22.1 | ||
- [#5033](https://github.com/withastro/astro/pull/5033) [`c1f991408`](https://github.com/withastro/astro/commit/c1f991408b817217dbd4035dcc4ac0a2fecd08b8) Thanks [@JuanM04](https://github.com/JuanM04)! - - Upgraded @vercel/nft to 0.22.1 | ||
- Fix monorepos (#5020) | ||
@@ -9,0 +53,0 @@ |
@@ -15,7 +15,17 @@ import { getVercelOutput, writeJson } from "../lib/fs.js"; | ||
let serverEntry; | ||
let needsBuildConfig = false; | ||
return { | ||
name: PACKAGE_NAME, | ||
hooks: { | ||
"astro:config:setup": ({ config }) => { | ||
config.outDir = getVercelOutput(config.root); | ||
"astro:config:setup": ({ config, updateConfig }) => { | ||
needsBuildConfig = !config.build.client; | ||
const outDir = getVercelOutput(config.root); | ||
updateConfig({ | ||
outDir, | ||
build: { | ||
serverEntry: "entry.mjs", | ||
client: new URL("./static/", outDir), | ||
server: new URL("./functions/render.func/", config.outDir) | ||
} | ||
}); | ||
}, | ||
@@ -25,3 +35,12 @@ "astro:config:done": ({ setAdapter, config }) => { | ||
_config = config; | ||
serverEntry = config.build.serverEntry; | ||
functionFolder = config.build.server; | ||
}, | ||
"astro:build:start": ({ buildConfig }) => { | ||
if (needsBuildConfig) { | ||
buildConfig.client = new URL("./static/", _config.outDir); | ||
serverEntry = buildConfig.serverEntry = "entry.mjs"; | ||
functionFolder = buildConfig.server = new URL("./functions/render.func/", _config.outDir); | ||
} | ||
}, | ||
"astro:build:setup": ({ vite, target }) => { | ||
@@ -46,7 +65,2 @@ var _a; | ||
}, | ||
"astro:build:start": async ({ buildConfig }) => { | ||
buildConfig.serverEntry = serverEntry = "entry.mjs"; | ||
buildConfig.client = new URL("./static/", _config.outDir); | ||
buildConfig.server = functionFolder = new URL("./functions/render.func/", _config.outDir); | ||
}, | ||
"astro:build:done": async ({ routes }) => { | ||
@@ -53,0 +67,0 @@ await writeJson(new URL(`./.vc-config.json`, functionFolder), { |
@@ -17,7 +17,17 @@ import { getVercelOutput, removeDir, writeJson } from "../lib/fs.js"; | ||
let serverEntry; | ||
let needsBuildConfig = false; | ||
return { | ||
name: PACKAGE_NAME, | ||
hooks: { | ||
"astro:config:setup": ({ config }) => { | ||
config.outDir = getVercelOutput(config.root); | ||
"astro:config:setup": ({ config, updateConfig }) => { | ||
needsBuildConfig = !config.build.client; | ||
const outDir = getVercelOutput(config.root); | ||
updateConfig({ | ||
outDir, | ||
build: { | ||
serverEntry: "entry.js", | ||
client: new URL("./static/", outDir), | ||
server: new URL("./dist/", config.root) | ||
} | ||
}); | ||
}, | ||
@@ -27,2 +37,5 @@ "astro:config:done": ({ setAdapter, config }) => { | ||
_config = config; | ||
buildTempFolder = config.build.server; | ||
functionFolder = new URL("./functions/render.func/", config.outDir); | ||
serverEntry = config.build.serverEntry; | ||
if (config.output === "static") { | ||
@@ -35,7 +48,8 @@ throw new Error(` | ||
}, | ||
"astro:build:start": async ({ buildConfig }) => { | ||
buildConfig.serverEntry = serverEntry = "entry.js"; | ||
buildConfig.client = new URL("./static/", _config.outDir); | ||
buildConfig.server = buildTempFolder = new URL("./dist/", _config.root); | ||
functionFolder = new URL("./functions/render.func/", _config.outDir); | ||
"astro:build:start": ({ buildConfig }) => { | ||
if (needsBuildConfig) { | ||
buildConfig.client = new URL("./static/", _config.outDir); | ||
buildTempFolder = buildConfig.server = new URL("./dist/", _config.root); | ||
serverEntry = buildConfig.serverEntry = "entry.js"; | ||
} | ||
}, | ||
@@ -42,0 +56,0 @@ "astro:build:done": async ({ routes }) => { |
{ | ||
"name": "@astrojs/vercel", | ||
"description": "Deploy your site to Vercel", | ||
"version": "0.0.0-monorepos-20221010034923", | ||
"version": "0.0.0-node-standalone-20221011210529", | ||
"type": "module", | ||
@@ -45,3 +45,3 @@ "author": "withastro", | ||
"devDependencies": { | ||
"astro": "1.4.6", | ||
"astro": "0.0.0-node-standalone-20221011210529", | ||
"astro-scripts": "0.0.8", | ||
@@ -48,0 +48,0 @@ "chai": "^4.3.6", |
@@ -20,2 +20,3 @@ import type { AstroAdapter, AstroConfig, AstroIntegration } from 'astro'; | ||
let serverEntry: string; | ||
let needsBuildConfig = false; | ||
@@ -25,4 +26,13 @@ return { | ||
hooks: { | ||
'astro:config:setup': ({ config }) => { | ||
config.outDir = getVercelOutput(config.root); | ||
'astro:config:setup': ({ config, updateConfig }) => { | ||
needsBuildConfig = !config.build.client; | ||
const outDir = getVercelOutput(config.root); | ||
updateConfig({ | ||
outDir, | ||
build: { | ||
serverEntry: 'entry.mjs', | ||
client: new URL('./static/', outDir), | ||
server: new URL('./functions/render.func/', config.outDir), | ||
} | ||
}); | ||
}, | ||
@@ -32,3 +42,12 @@ 'astro:config:done': ({ setAdapter, config }) => { | ||
_config = config; | ||
serverEntry = config.build.serverEntry; | ||
functionFolder = config.build.server; | ||
}, | ||
'astro:build:start': ({ buildConfig }) => { | ||
if(needsBuildConfig) { | ||
buildConfig.client = new URL('./static/', _config.outDir); | ||
serverEntry = buildConfig.serverEntry = 'entry.mjs'; | ||
functionFolder = buildConfig.server = new URL('./functions/render.func/', _config.outDir); | ||
} | ||
}, | ||
'astro:build:setup': ({ vite, target }) => { | ||
@@ -55,7 +74,2 @@ if (target === 'server') { | ||
}, | ||
'astro:build:start': async ({ buildConfig }) => { | ||
buildConfig.serverEntry = serverEntry = 'entry.mjs'; | ||
buildConfig.client = new URL('./static/', _config.outDir); | ||
buildConfig.server = functionFolder = new URL('./functions/render.func/', _config.outDir); | ||
}, | ||
'astro:build:done': async ({ routes }) => { | ||
@@ -62,0 +76,0 @@ // Edge function config |
@@ -22,2 +22,3 @@ import type { AstroAdapter, AstroConfig, AstroIntegration } from 'astro'; | ||
let serverEntry: string; | ||
let needsBuildConfig = false; | ||
@@ -27,4 +28,13 @@ return { | ||
hooks: { | ||
'astro:config:setup': ({ config }) => { | ||
config.outDir = getVercelOutput(config.root); | ||
'astro:config:setup': ({ config, updateConfig }) => { | ||
needsBuildConfig = !config.build.client; | ||
const outDir = getVercelOutput(config.root); | ||
updateConfig({ | ||
outDir, | ||
build: { | ||
serverEntry: 'entry.js', | ||
client: new URL('./static/', outDir), | ||
server: new URL('./dist/', config.root), | ||
} | ||
}); | ||
}, | ||
@@ -34,2 +44,5 @@ 'astro:config:done': ({ setAdapter, config }) => { | ||
_config = config; | ||
buildTempFolder = config.build.server; | ||
functionFolder = new URL('./functions/render.func/', config.outDir); | ||
serverEntry = config.build.serverEntry; | ||
@@ -43,7 +56,8 @@ if (config.output === 'static') { | ||
}, | ||
'astro:build:start': async ({ buildConfig }) => { | ||
buildConfig.serverEntry = serverEntry = 'entry.js'; | ||
buildConfig.client = new URL('./static/', _config.outDir); | ||
buildConfig.server = buildTempFolder = new URL('./dist/', _config.root); | ||
functionFolder = new URL('./functions/render.func/', _config.outDir); | ||
'astro:build:start': ({ buildConfig }) => { | ||
if(needsBuildConfig) { | ||
buildConfig.client = new URL('./static/', _config.outDir); | ||
buildTempFolder = buildConfig.server = new URL('./dist/', _config.root); | ||
serverEntry = buildConfig.serverEntry = 'entry.js'; | ||
} | ||
}, | ||
@@ -50,0 +64,0 @@ 'astro:build:done': async ({ routes }) => { |
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
60616
1087