Export defineConfig helper (#2803)
* feat: add astro/config entrypoint * chore: update examples to use `defineConfig` util * chore: prettier fix * chore: add changeset
This commit is contained in:
parent
2d95541b52
commit
2b76ee8d75
29 changed files with 101 additions and 205 deletions
15
.changeset/quick-islands-call.md
Normal file
15
.changeset/quick-islands-call.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Add an `astro/config` entrypoint with a `defineConfig` utility.
|
||||
|
||||
Config files can now be easily benefit from Intellisense using the following approach:
|
||||
|
||||
```js
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
export default defineConfig({
|
||||
renderers: []
|
||||
})
|
||||
```
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Enable the Preact renderer to support Preact JSX components.
|
||||
renderers: ['@astrojs/renderer-preact'],
|
||||
});
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// Enable the Preact renderer to support Preact JSX components.
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
renderers: ['@astrojs/renderer-preact'],
|
||||
buildOptions: {
|
||||
site: 'https://example.com/',
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Comment out "renderers: []" to enable Astro's default component support.
|
||||
renderers: [],
|
||||
});
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
renderers: [
|
||||
// Enable the Preact renderer to support Preact JSX components.
|
||||
'@astrojs/renderer-preact',
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// Comment out "renderers: []" to enable Astro's default component support.
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
renderers: [],
|
||||
});
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// No renderers are needed for AlpineJS support, just use Astro components!
|
||||
renderers: [],
|
||||
});
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Enable the lit renderer to support LitHTML components and templates.
|
||||
renderers: ['@astrojs/renderer-lit'],
|
||||
});
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Enable many renderers to support all different kinds of components.
|
||||
renderers: ['@astrojs/renderer-preact', '@astrojs/renderer-react', '@astrojs/renderer-svelte', '@astrojs/renderer-vue', '@astrojs/renderer-solid'],
|
||||
});
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Enable the Preact renderer to support Preact JSX components.
|
||||
renderers: ['@astrojs/renderer-preact'],
|
||||
});
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Enable the React renderer to support React JSX components.
|
||||
renderers: ['@astrojs/renderer-react'],
|
||||
});
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Enable the Solid renderer to support Solid JSX components.
|
||||
renderers: ['@astrojs/renderer-solid'],
|
||||
});
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Enable the Svelte renderer to support Svelte components.
|
||||
renderers: ['@astrojs/renderer-svelte'],
|
||||
});
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Enable the Vue renderer to support Vue components.
|
||||
renderers: ['@astrojs/renderer-vue'],
|
||||
});
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Comment out "renderers: []" to enable Astro's default component support.
|
||||
renderers: [],
|
||||
});
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Comment out "renderers: []" to enable Astro's default component support.
|
||||
renderers: [],
|
||||
});
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Enable the Preact renderer to support Preact JSX components.
|
||||
renderers: ['@astrojs/renderer-preact'],
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// @ts-check
|
||||
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
export default defineConfig({
|
||||
renderers: ['@astrojs/renderer-svelte'],
|
||||
vite: {
|
||||
server: {
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Set "renderers" to "[]" to disable all default, builtin component support.
|
||||
renderers: [],
|
||||
});
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Comment out "renderers: []" to enable Astro's default component support.
|
||||
buildOptions: {
|
||||
site: 'http://example.com/blog',
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
import { defineConfig } from 'astro/config';
|
||||
import astroRemark from '@astrojs/markdown-remark';
|
||||
import addClasses from './add-classes.mjs';
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Enable Custom Markdown options, plugins, etc.
|
||||
renderers: [],
|
||||
markdownOptions: {
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
import { defineConfig } from 'astro/config';
|
||||
import astroRemark from '@astrojs/markdown-remark';
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Enable Custom Markdown options, plugins, etc.
|
||||
renderers: [],
|
||||
markdownOptions: {
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
renderers: ['@astrojs/renderer-preact', '@astrojs/renderer-react', '@astrojs/renderer-svelte', '@astrojs/renderer-vue'],
|
||||
});
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Enable many renderers to support all different kinds of components.
|
||||
renderers: ['@astrojs/renderer-preact', '@astrojs/renderer-react', '@astrojs/renderer-svelte', '@astrojs/renderer-vue', '@astrojs/renderer-solid'],
|
||||
});
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
// Enable the Preact renderer to support Preact JSX components.
|
||||
renderers: ['@astrojs/renderer-preact'],
|
||||
});
|
||||
|
|
|
@ -1,15 +1,8 @@
|
|||
import { defineConfig } from 'astro/config';
|
||||
import { VitePWA } from 'vite-plugin-pwa';
|
||||
|
||||
// Full Astro Configuration API Documentation:
|
||||
// https://docs.astro.build/reference/configuration-reference
|
||||
|
||||
// @type-check enabled!
|
||||
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
|
||||
// helpful tooltips, and warnings if your exported object is invalid.
|
||||
// You can disable this by removing "@ts-check" and `@type` comments below.
|
||||
|
||||
// @ts-check
|
||||
export default /** @type {import('astro').AstroUserConfig} */ ({
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
renderers: [],
|
||||
vite: {
|
||||
plugins: [VitePWA()],
|
||||
|
|
7
packages/astro/config.d.ts
vendored
Normal file
7
packages/astro/config.d.ts
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
type AstroUserConfig = import('./dist/types/@types/astro').AstroUserConfig;
|
||||
|
||||
/**
|
||||
* See the full Astro Configuration API Documentation
|
||||
* https://astro.build/config
|
||||
*/
|
||||
export function defineConfig(config: AstroUserConfig): AstroUserConfig;
|
3
packages/astro/config.mjs
Normal file
3
packages/astro/config.mjs
Normal file
|
@ -0,0 +1,3 @@
|
|||
export function defineConfig(config) {
|
||||
return config;
|
||||
}
|
|
@ -16,6 +16,7 @@
|
|||
"exports": {
|
||||
".": "./astro.js",
|
||||
"./env": "./env.d.ts",
|
||||
"./config": "./config.mjs",
|
||||
"./internal": "./internal.js",
|
||||
"./app/node": "./dist/core/app/node.js",
|
||||
"./client/*": "./dist/runtime/client/*",
|
||||
|
@ -45,6 +46,8 @@
|
|||
"components",
|
||||
"dist",
|
||||
"astro.js",
|
||||
"config.d.ts",
|
||||
"config.mjs",
|
||||
"env.d.ts",
|
||||
"README.md",
|
||||
"vendor"
|
||||
|
|
Loading…
Reference in a new issue