[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:
|
||||
// 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`.
|
||||
*
|
||||
* ```js
|
||||
* ```js
|
||||
* {
|
||||
* 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.
|
||||
*
|
||||
* ```js
|
||||
* ```js
|
||||
* {
|
||||
* // Example: Use the function syntax to customize based on command
|
||||
* server: (command) => ({port: command === 'dev' ? 3000 : 4000})
|
||||
|
@ -324,7 +324,7 @@ export interface AstroUserConfig {
|
|||
* @kind heading
|
||||
* @name Markdown Options
|
||||
*/
|
||||
markdown?: {
|
||||
markdown?: {
|
||||
/**
|
||||
* @docs
|
||||
* @name markdown.drafts
|
||||
|
@ -353,7 +353,7 @@ export interface AstroUserConfig {
|
|||
* @description
|
||||
* 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
|
||||
|
@ -384,16 +384,16 @@ export interface AstroUserConfig {
|
|||
* @description
|
||||
* 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: {
|
||||
* // Example: The default set of remark plugins used by Astro
|
||||
* remarkPlugins: ['remark-code-titles', ['rehype-autolink-headings', { behavior: 'prepend' }]],
|
||||
* },
|
||||
* };
|
||||
* ```
|
||||
* };
|
||||
* ```
|
||||
*/
|
||||
remarkPlugins?: Plugin[];
|
||||
/**
|
||||
|
@ -403,16 +403,16 @@ export interface AstroUserConfig {
|
|||
* @description
|
||||
* 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: {
|
||||
* // 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[];
|
||||
};
|
||||
|
@ -424,29 +424,28 @@ export interface AstroUserConfig {
|
|||
* @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.
|
||||
*/
|
||||
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[]>;
|
||||
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
|
||||
|
@ -482,7 +481,7 @@ export interface AstroUserConfig {
|
|||
*/
|
||||
vite?: vite.UserConfig & { ssr?: vite.SSROptions };
|
||||
|
||||
experimental?: {
|
||||
experimental?: {
|
||||
/**
|
||||
* Enable experimental support for 3rd-party integrations.
|
||||
* Default: false
|
||||
|
@ -496,9 +495,6 @@ export interface AstroUserConfig {
|
|||
ssr?: boolean;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// Legacy options to be removed
|
||||
|
||||
/** @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 postcssrc from 'postcss-load-config';
|
||||
import { arraify, isObject } from './util.js';
|
||||
import { appendForwardSlash, trimSlashes } from './path.js'
|
||||
import { appendForwardSlash, trimSlashes } from './path.js';
|
||||
|
||||
load.use([loadTypeScript]);
|
||||
|
||||
|
@ -54,7 +54,7 @@ export const LegacyAstroConfigKeys = new Set([
|
|||
'markdownOptions',
|
||||
'buildOptions',
|
||||
'devOptions',
|
||||
'experimentalIntegrations'
|
||||
'experimentalIntegrations',
|
||||
]);
|
||||
|
||||
export const AstroConfigSchema = z.object({
|
||||
|
@ -85,9 +85,9 @@ export const AstroConfigSchema = z.object({
|
|||
.optional()
|
||||
.transform((val) => (val ? appendForwardSlash(val) : val))
|
||||
.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
|
||||
.string()
|
||||
.optional()
|
||||
|
@ -112,12 +112,13 @@ export const AstroConfigSchema = z.object({
|
|||
// individualized schema parser with the correct command.
|
||||
(val) => (typeof val === 'function' ? val({ command: 'error' }) : val),
|
||||
// validate
|
||||
z.object({
|
||||
host: z.union([z.string(), z.boolean()]).optional().default(false),
|
||||
port: z.number().optional().default(3000),
|
||||
})
|
||||
.optional()
|
||||
.default({}),
|
||||
z
|
||||
.object({
|
||||
host: z.union([z.string(), z.boolean()]).optional().default(false),
|
||||
port: z.number().optional().default(3000),
|
||||
})
|
||||
.optional()
|
||||
.default({})
|
||||
),
|
||||
integrations: z.preprocess(
|
||||
// preprocess
|
||||
|
@ -207,7 +208,7 @@ export async function validateConfig(userConfig: any, root: string, cmd: string)
|
|||
}
|
||||
}
|
||||
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 */
|
||||
|
||||
|
@ -234,12 +235,13 @@ export async function validateConfig(userConfig: any, root: string, cmd: string)
|
|||
// preprocess
|
||||
(val) => (typeof val === 'function' ? val({ command: cmd === 'dev' ? 'dev' : 'preview' }) : val),
|
||||
// validate
|
||||
z.object({
|
||||
host: z.union([z.string(), z.boolean()]).optional().default(false),
|
||||
port: z.number().optional().default(3000),
|
||||
})
|
||||
.optional()
|
||||
.default({}),
|
||||
z
|
||||
.object({
|
||||
host: z.union([z.string(), z.boolean()]).optional().default(false),
|
||||
port: z.number().optional().default(3000),
|
||||
})
|
||||
.optional()
|
||||
.default({})
|
||||
),
|
||||
style: z
|
||||
.object({
|
||||
|
|
|
@ -7,7 +7,7 @@ describe('Astro.*', () => {
|
|||
|
||||
before(async () => {
|
||||
fixture = await loadFixture({
|
||||
root: './fixtures/astro-global/'
|
||||
root: './fixtures/astro-global/',
|
||||
});
|
||||
await fixture.build();
|
||||
});
|
||||
|
|
|
@ -64,9 +64,7 @@ describe('astro cli', () => {
|
|||
});
|
||||
});
|
||||
|
||||
const hostToExposeFlags = [
|
||||
['', ''],
|
||||
];
|
||||
const hostToExposeFlags = [['', '']];
|
||||
hostToExposeFlags.forEach(([flag, flagValue]) => {
|
||||
it(`astro ${cmd} ${flag} ${flagValue} - host to expose`, async () => {
|
||||
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.');
|
||||
});
|
||||
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/',
|
||||
adapter: testAdapter(),
|
||||
experimental: {
|
||||
ssr: true
|
||||
}
|
||||
ssr: true,
|
||||
},
|
||||
});
|
||||
await fixture.build();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue