[ci] format

This commit is contained in:
FredKSchott 2022-04-02 18:30:48 +00:00 committed by GitHub Actions
parent 17c02925c5
commit bae719505d
9 changed files with 75 additions and 79 deletions

View file

@ -10,5 +10,5 @@ export default defineConfig({
// Learn more about this configuration here:
// https://docs.astro.build/en/guides/markdown-content/#syntax-highlighting
},
}
},
});

View file

@ -274,18 +274,18 @@ export interface AstroUserConfig {
* @kind heading
* @name Server Options
* @description
*
*
* Customize the Astro dev server, used by both `astro dev` and `astro serve`.
*
* ```js
*
* ```js
* {
* server: {port: 1234, host: true}
* }
* ```
*
*
* 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
@ -365,7 +365,7 @@ export interface AstroUserConfig {
* - `shiki` - use the [Shiki](https://github.com/shikijs/shiki) highlighter
* - `prism` - use the [Prism](https://prismjs.com/) highlighter
* - `false` - do not apply syntax highlighting.
*
*
* ```js
* {
* markdown: {
@ -383,17 +383,17 @@ export interface AstroUserConfig {
* @type {Plugin[]}
* @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.
*
* ```js
* {
*
* **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
* {
* markdown: {
* // Example: The default set of remark plugins used by Astro
* remarkPlugins: ['remark-code-titles', ['rehype-autolink-headings', { behavior: 'prepend' }]],
* },
* };
* ```
* };
* ```
*/
remarkPlugins?: Plugin[];
/**
@ -402,17 +402,17 @@ export interface AstroUserConfig {
* @type {Plugin[]}
* @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.
*
* ```js
* {
*
* **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
* {
* 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. */

View file

@ -184,7 +184,7 @@ async function clientBuild(opts: StaticBuildOptions, internals: BuildInternals,
// TODO: use vite.mergeConfig() here?
info(opts.logging, null, `\n${bgGreen(black(' building client '))}`);
const viteBuildConfig = {
logLevel: 'info',
mode: 'production',

View file

@ -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()
@ -108,16 +108,17 @@ export const AstroConfigSchema = z.object({
.default({}),
server: z.preprocess(
// preprocess
// NOTE: Uses the "error" command here because this is overwritten by the
// NOTE: Uses the "error" command here because this is overwritten by the
// 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({

View file

@ -82,7 +82,7 @@ export default function markdown({ config }: AstroPluginOptions): Plugin {
// Return the file's JS representation, including all Markdown
// frontmatter and a deferred `import() of the compiled markdown content.
if (id.startsWith(VIRTUAL_MODULE_ID)) {
const sitePathname = config.site ? appendForwardSlash(new URL(config.base, config.site).pathname) : '/';
const sitePathname = config.site ? appendForwardSlash(new URL(config.base, config.site).pathname) : '/';
const fileId = id.substring(VIRTUAL_MODULE_ID.length);
const fileUrl = fileId.includes('/pages/') ? fileId.replace(/^.*\/pages\//, sitePathname).replace(/(\/index)?\.md$/, '') : undefined;
const source = await fs.promises.readFile(fileId, 'utf8');

View file

@ -7,7 +7,7 @@ describe('Astro.*', () => {
before(async () => {
fixture = await loadFixture({
root: './fixtures/astro-global/'
root: './fixtures/astro-global/',
});
await fixture.build();
});

View file

@ -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);

View file

@ -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);
});
});

View file

@ -13,8 +13,8 @@ describe('Using Astro.request in SSR', () => {
root: './fixtures/ssr-request/',
adapter: testAdapter(),
experimental: {
ssr: true
}
ssr: true,
},
});
await fixture.build();
});