[ci] format
This commit is contained in:
parent
17c02925c5
commit
bae719505d
9 changed files with 75 additions and 79 deletions
|
@ -10,5 +10,5 @@ export default defineConfig({
|
||||||
// Learn more about this configuration here:
|
// Learn more about this configuration here:
|
||||||
// https://docs.astro.build/en/guides/markdown-content/#syntax-highlighting
|
// https://docs.astro.build/en/guides/markdown-content/#syntax-highlighting
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -277,7 +277,7 @@ export interface AstroUserConfig {
|
||||||
*
|
*
|
||||||
* Customize the Astro dev server, used by both `astro dev` and `astro serve`.
|
* Customize the Astro dev server, used by both `astro dev` and `astro serve`.
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* {
|
* {
|
||||||
* server: {port: 1234, host: true}
|
* server: {port: 1234, host: true}
|
||||||
* }
|
* }
|
||||||
|
@ -285,7 +285,7 @@ export interface AstroUserConfig {
|
||||||
*
|
*
|
||||||
* To set different configuration based on the command run ("dev", "preview") a function can also be passed to this configuration option.
|
* To set different configuration based on the command run ("dev", "preview") a function can also be passed to this configuration option.
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* {
|
* {
|
||||||
* // Example: Use the function syntax to customize based on command
|
* // Example: Use the function syntax to customize based on command
|
||||||
* server: (command) => ({port: command === 'dev' ? 3000 : 4000})
|
* server: (command) => ({port: command === 'dev' ? 3000 : 4000})
|
||||||
|
@ -324,7 +324,7 @@ export interface AstroUserConfig {
|
||||||
* @kind heading
|
* @kind heading
|
||||||
* @name Markdown Options
|
* @name Markdown Options
|
||||||
*/
|
*/
|
||||||
markdown?: {
|
markdown?: {
|
||||||
/**
|
/**
|
||||||
* @docs
|
* @docs
|
||||||
* @name markdown.drafts
|
* @name markdown.drafts
|
||||||
|
@ -353,7 +353,7 @@ export interface AstroUserConfig {
|
||||||
* @description
|
* @description
|
||||||
* Shiki configuration options. See [the markdown configuration docs](https://docs.astro.build/en/guides/markdown-content/#shiki-configuration) for usage.
|
* Shiki configuration options. See [the markdown configuration docs](https://docs.astro.build/en/guides/markdown-content/#shiki-configuration) for usage.
|
||||||
*/
|
*/
|
||||||
shikiConfig?: ShikiConfig;
|
shikiConfig?: ShikiConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @docs
|
* @docs
|
||||||
|
@ -384,16 +384,16 @@ export interface AstroUserConfig {
|
||||||
* @description
|
* @description
|
||||||
* Pass a custom [Remark](https://github.com/remarkjs/remark) plugin to customize how your Markdown is built.
|
* Pass a custom [Remark](https://github.com/remarkjs/remark) plugin to customize how your Markdown is built.
|
||||||
*
|
*
|
||||||
* **Note:** Enabling custom `remarkPlugins` or `rehypePlugins` removes Astro's built-in support for [GitHub-flavored Markdown](https://github.github.com/gfm/) support, [Footnotes](https://github.com/remarkjs/remark-footnotes) syntax, [Smartypants](https://github.com/silvenon/remark-smartypants). You must explicitly add these plugins to your `astro.config.mjs` file, if desired.
|
* **Note:** Enabling custom `remarkPlugins` or `rehypePlugins` removes Astro's built-in support for [GitHub-flavored Markdown](https://github.github.com/gfm/) support, [Footnotes](https://github.com/remarkjs/remark-footnotes) syntax, [Smartypants](https://github.com/silvenon/remark-smartypants). You must explicitly add these plugins to your `astro.config.mjs` file, if desired.
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* {
|
* {
|
||||||
* markdown: {
|
* markdown: {
|
||||||
* // Example: The default set of remark plugins used by Astro
|
* // Example: The default set of remark plugins used by Astro
|
||||||
* remarkPlugins: ['remark-code-titles', ['rehype-autolink-headings', { behavior: 'prepend' }]],
|
* remarkPlugins: ['remark-code-titles', ['rehype-autolink-headings', { behavior: 'prepend' }]],
|
||||||
* },
|
* },
|
||||||
* };
|
* };
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
remarkPlugins?: Plugin[];
|
remarkPlugins?: Plugin[];
|
||||||
/**
|
/**
|
||||||
|
@ -403,16 +403,16 @@ export interface AstroUserConfig {
|
||||||
* @description
|
* @description
|
||||||
* Pass a custom [Rehype](https://github.com/remarkjs/remark-rehype) plugin to customize how your Markdown is built.
|
* Pass a custom [Rehype](https://github.com/remarkjs/remark-rehype) plugin to customize how your Markdown is built.
|
||||||
*
|
*
|
||||||
* **Note:** Enabling custom `remarkPlugins` or `rehypePlugins` removes Astro's built-in support for [GitHub-flavored Markdown](https://github.github.com/gfm/) support, [Footnotes](https://github.com/remarkjs/remark-footnotes) syntax, [Smartypants](https://github.com/silvenon/remark-smartypants). You must explicitly add these plugins to your `astro.config.mjs` file, if desired.
|
* **Note:** Enabling custom `remarkPlugins` or `rehypePlugins` removes Astro's built-in support for [GitHub-flavored Markdown](https://github.github.com/gfm/) support, [Footnotes](https://github.com/remarkjs/remark-footnotes) syntax, [Smartypants](https://github.com/silvenon/remark-smartypants). You must explicitly add these plugins to your `astro.config.mjs` file, if desired.
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* {
|
* {
|
||||||
* markdown: {
|
* markdown: {
|
||||||
* // Example: The default set of rehype plugins used by Astro
|
* // Example: The default set of rehype plugins used by Astro
|
||||||
* rehypePlugins: [['rehype-toc', { headings: ['h2', 'h3'] }], [addClasses, { 'h1,h2,h3': 'title' }], 'rehype-slug'],
|
* rehypePlugins: [['rehype-toc', { headings: ['h2', 'h3'] }], [addClasses, { 'h1,h2,h3': 'title' }], 'rehype-slug'],
|
||||||
* },
|
* },
|
||||||
* };
|
* };
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
rehypePlugins?: Plugin[];
|
rehypePlugins?: Plugin[];
|
||||||
};
|
};
|
||||||
|
@ -424,29 +424,28 @@ export interface AstroUserConfig {
|
||||||
* @description
|
* @description
|
||||||
* Add an adapter to build for SSR (server-side rendering). An adapter makes it easy to connect a deployed Astro app to a hosting provider or runtime environment.
|
* Add an adapter to build for SSR (server-side rendering). An adapter makes it easy to connect a deployed Astro app to a hosting provider or runtime environment.
|
||||||
*/
|
*/
|
||||||
adapter?: AstroIntegration;
|
adapter?: AstroIntegration;
|
||||||
|
|
||||||
/**
|
|
||||||
* @docs
|
|
||||||
* @kind heading
|
|
||||||
* @name Integrations
|
|
||||||
* @description
|
|
||||||
*
|
|
||||||
* Extend Astro with custom integrations. Integrations are your one-stop-shop for adding framework support (like Solid.js), new features (like sitemaps), and new libraries (like Partytown and Turbolinks).
|
|
||||||
*
|
|
||||||
* Read our [Integrations Guide](/en/guides/integrations-guide/) for help getting started with Astro Integrations.
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* import react from '@astrojs/react';
|
|
||||||
* import tailwind from '@astrojs/tailwind';
|
|
||||||
* {
|
|
||||||
* // Example: Add React + Tailwind support to Astro
|
|
||||||
* integrations: [react(), tailwind()]
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
integrations?: Array<AstroIntegration | AstroIntegration[]>;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @docs
|
||||||
|
* @kind heading
|
||||||
|
* @name Integrations
|
||||||
|
* @description
|
||||||
|
*
|
||||||
|
* Extend Astro with custom integrations. Integrations are your one-stop-shop for adding framework support (like Solid.js), new features (like sitemaps), and new libraries (like Partytown and Turbolinks).
|
||||||
|
*
|
||||||
|
* Read our [Integrations Guide](/en/guides/integrations-guide/) for help getting started with Astro Integrations.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import react from '@astrojs/react';
|
||||||
|
* import tailwind from '@astrojs/tailwind';
|
||||||
|
* {
|
||||||
|
* // Example: Add React + Tailwind support to Astro
|
||||||
|
* integrations: [react(), tailwind()]
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
integrations?: Array<AstroIntegration | AstroIntegration[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @docs
|
* @docs
|
||||||
|
@ -482,7 +481,7 @@ export interface AstroUserConfig {
|
||||||
*/
|
*/
|
||||||
vite?: vite.UserConfig & { ssr?: vite.SSROptions };
|
vite?: vite.UserConfig & { ssr?: vite.SSROptions };
|
||||||
|
|
||||||
experimental?: {
|
experimental?: {
|
||||||
/**
|
/**
|
||||||
* Enable experimental support for 3rd-party integrations.
|
* Enable experimental support for 3rd-party integrations.
|
||||||
* Default: false
|
* Default: false
|
||||||
|
@ -496,9 +495,6 @@ export interface AstroUserConfig {
|
||||||
ssr?: boolean;
|
ssr?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Legacy options to be removed
|
// Legacy options to be removed
|
||||||
|
|
||||||
/** @deprecated - Use "integrations" instead. Run Astro to learn more about migrating. */
|
/** @deprecated - Use "integrations" instead. Run Astro to learn more about migrating. */
|
||||||
|
|
|
@ -11,7 +11,7 @@ import load from '@proload/core';
|
||||||
import loadTypeScript from '@proload/plugin-tsm';
|
import loadTypeScript from '@proload/plugin-tsm';
|
||||||
import postcssrc from 'postcss-load-config';
|
import postcssrc from 'postcss-load-config';
|
||||||
import { arraify, isObject } from './util.js';
|
import { arraify, isObject } from './util.js';
|
||||||
import { appendForwardSlash, trimSlashes } from './path.js'
|
import { appendForwardSlash, trimSlashes } from './path.js';
|
||||||
|
|
||||||
load.use([loadTypeScript]);
|
load.use([loadTypeScript]);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ export const LegacyAstroConfigKeys = new Set([
|
||||||
'markdownOptions',
|
'markdownOptions',
|
||||||
'buildOptions',
|
'buildOptions',
|
||||||
'devOptions',
|
'devOptions',
|
||||||
'experimentalIntegrations'
|
'experimentalIntegrations',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const AstroConfigSchema = z.object({
|
export const AstroConfigSchema = z.object({
|
||||||
|
@ -85,9 +85,9 @@ export const AstroConfigSchema = z.object({
|
||||||
.optional()
|
.optional()
|
||||||
.transform((val) => (val ? appendForwardSlash(val) : val))
|
.transform((val) => (val ? appendForwardSlash(val) : val))
|
||||||
.refine((val) => !val || new URL(val).pathname.length <= 1, {
|
.refine((val) => !val || new URL(val).pathname.length <= 1, {
|
||||||
message: '"site" must be a valid URL origin (ex: "https://example.com") but cannot contain a URL path (ex: "https://example.com/blog"). Use "base" to configure your deployed URL path',
|
message:
|
||||||
|
'"site" must be a valid URL origin (ex: "https://example.com") but cannot contain a URL path (ex: "https://example.com/blog"). Use "base" to configure your deployed URL path',
|
||||||
}),
|
}),
|
||||||
base: z
|
base: z
|
||||||
.string()
|
.string()
|
||||||
.optional()
|
.optional()
|
||||||
|
@ -112,12 +112,13 @@ export const AstroConfigSchema = z.object({
|
||||||
// individualized schema parser with the correct command.
|
// individualized schema parser with the correct command.
|
||||||
(val) => (typeof val === 'function' ? val({ command: 'error' }) : val),
|
(val) => (typeof val === 'function' ? val({ command: 'error' }) : val),
|
||||||
// validate
|
// validate
|
||||||
z.object({
|
z
|
||||||
host: z.union([z.string(), z.boolean()]).optional().default(false),
|
.object({
|
||||||
port: z.number().optional().default(3000),
|
host: z.union([z.string(), z.boolean()]).optional().default(false),
|
||||||
})
|
port: z.number().optional().default(3000),
|
||||||
.optional()
|
})
|
||||||
.default({}),
|
.optional()
|
||||||
|
.default({})
|
||||||
),
|
),
|
||||||
integrations: z.preprocess(
|
integrations: z.preprocess(
|
||||||
// preprocess
|
// preprocess
|
||||||
|
@ -207,7 +208,7 @@ export async function validateConfig(userConfig: any, root: string, cmd: string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldConfig) {
|
if (oldConfig) {
|
||||||
throw new Error(`Legacy configuration detected. Please update your configuration to the new format!\nSee https://astro.build/config for more information.`)
|
throw new Error(`Legacy configuration detected. Please update your configuration to the new format!\nSee https://astro.build/config for more information.`);
|
||||||
}
|
}
|
||||||
/* eslint-enable no-console */
|
/* eslint-enable no-console */
|
||||||
|
|
||||||
|
@ -234,12 +235,13 @@ export async function validateConfig(userConfig: any, root: string, cmd: string)
|
||||||
// preprocess
|
// preprocess
|
||||||
(val) => (typeof val === 'function' ? val({ command: cmd === 'dev' ? 'dev' : 'preview' }) : val),
|
(val) => (typeof val === 'function' ? val({ command: cmd === 'dev' ? 'dev' : 'preview' }) : val),
|
||||||
// validate
|
// validate
|
||||||
z.object({
|
z
|
||||||
host: z.union([z.string(), z.boolean()]).optional().default(false),
|
.object({
|
||||||
port: z.number().optional().default(3000),
|
host: z.union([z.string(), z.boolean()]).optional().default(false),
|
||||||
})
|
port: z.number().optional().default(3000),
|
||||||
.optional()
|
})
|
||||||
.default({}),
|
.optional()
|
||||||
|
.default({})
|
||||||
),
|
),
|
||||||
style: z
|
style: z
|
||||||
.object({
|
.object({
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe('Astro.*', () => {
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
fixture = await loadFixture({
|
fixture = await loadFixture({
|
||||||
root: './fixtures/astro-global/'
|
root: './fixtures/astro-global/',
|
||||||
});
|
});
|
||||||
await fixture.build();
|
await fixture.build();
|
||||||
});
|
});
|
||||||
|
|
|
@ -64,9 +64,7 @@ describe('astro cli', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const hostToExposeFlags = [
|
const hostToExposeFlags = [['', '']];
|
||||||
['', ''],
|
|
||||||
];
|
|
||||||
hostToExposeFlags.forEach(([flag, flagValue]) => {
|
hostToExposeFlags.forEach(([flag, flagValue]) => {
|
||||||
it(`astro ${cmd} ${flag} ${flagValue} - host to expose`, async () => {
|
it(`astro ${cmd} ${flag} ${flagValue} - host to expose`, async () => {
|
||||||
const { local, network } = await cliServerLogSetupWithFixture([flag, flagValue], cmd);
|
const { local, network } = await cliServerLogSetupWithFixture([flag, flagValue], cmd);
|
||||||
|
|
|
@ -61,6 +61,6 @@ describe('Config Validation', () => {
|
||||||
expect(configError.message).to.include('Astro integrations are still experimental.');
|
expect(configError.message).to.include('Astro integrations are still experimental.');
|
||||||
});
|
});
|
||||||
it('allows third-party "integration" values with the --experimental-integrations flag', async () => {
|
it('allows third-party "integration" values with the --experimental-integrations flag', async () => {
|
||||||
await validateConfig({ integrations: [{ name: '@my-plugin/a' }], experimental: { integrations: true }}, process.cwd()).catch((err) => err);
|
await validateConfig({ integrations: [{ name: '@my-plugin/a' }], experimental: { integrations: true } }, process.cwd()).catch((err) => err);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,8 +13,8 @@ describe('Using Astro.request in SSR', () => {
|
||||||
root: './fixtures/ssr-request/',
|
root: './fixtures/ssr-request/',
|
||||||
adapter: testAdapter(),
|
adapter: testAdapter(),
|
||||||
experimental: {
|
experimental: {
|
||||||
ssr: true
|
ssr: true,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
await fixture.build();
|
await fixture.build();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue