summaryrefslogtreecommitdiff
path: root/packages/astro
diff options
context:
space:
mode:
Diffstat (limited to 'packages/astro')
-rw-r--r--packages/astro/src/@types/astro.ts60
-rw-r--r--packages/astro/src/cli/index.ts7
-rw-r--r--packages/astro/src/core/build/index.ts8
-rw-r--r--packages/astro/src/core/build/static-build.ts20
-rw-r--r--packages/astro/src/core/config.ts2
-rw-r--r--packages/astro/src/integrations/index.ts4
-rw-r--r--packages/astro/test/config-mode.test.js11
-rw-r--r--packages/astro/test/ssr-partytown.test.js2
-rw-r--r--packages/astro/test/ssr-request.test.js2
-rw-r--r--packages/astro/test/ssr-response.test.js2
-rw-r--r--packages/astro/test/streaming.test.js2
11 files changed, 57 insertions, 63 deletions
diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts
index 32166e5f0..d4ee10dd4 100644
--- a/packages/astro/src/@types/astro.ts
+++ b/packages/astro/src/@types/astro.ts
@@ -426,7 +426,7 @@ export interface AstroUserConfig {
/**
* @docs
* @name adapter
- * @typeraw {AstroIntegration}
+ * @typeraw {AstroIntegration}
* @see output
* @description
*
@@ -442,31 +442,31 @@ export interface AstroUserConfig {
* }
* ```
*/
- adapter?: AstroIntegration;
-
- /**
- * @docs
- * @name output
- * @type {('static' | 'server')}
- * @default `'static'`
- * @see adapter
- * @description
- *
- * Specifies the output target for builds.
- *
- * - 'static' - Building a static site to be deploy to any static host.
- * - 'server' - Building an app to be deployed to a host supporting SSR (server-side rendering).
- *
- * ```js
- * import { defineConfig } from 'astro/config';
- *
- * export default defineConfig({
- * output: 'static'
- * })
- * ```
- */
- output?: 'static' | 'server';
-
+ adapter?: AstroIntegration;
+
+ /**
+ * @docs
+ * @name output
+ * @type {('static' | 'server')}
+ * @default `'static'`
+ * @see adapter
+ * @description
+ *
+ * Specifies the output target for builds.
+ *
+ * - 'static' - Building a static site to be deploy to any static host.
+ * - 'server' - Building an app to be deployed to a host supporting SSR (server-side rendering).
+ *
+ * ```js
+ * import { defineConfig } from 'astro/config';
+ *
+ * export default defineConfig({
+ * output: 'static'
+ * })
+ * ```
+ */
+ output?: 'static' | 'server';
+
/**
* @docs
* @kind heading
@@ -703,7 +703,7 @@ export interface AstroUserConfig {
* ```
*/
vite?: ViteUserConfig;
-
+
/**
* @docs
* @kind heading
@@ -714,15 +714,15 @@ export interface AstroUserConfig {
* in the latest version, so that you can continue to upgrade and take advantage of new Astro releases.
*/
legacy?: {
- /**
+ /**
* @docs
* @name legacy.astroFlavoredMarkdown
* @type {boolean}
* @default `false`
* @since 1.0.0-rc
* @description
- * Enable Astro's pre-v1.0 support for components and JSX expressions in `.md` Markdown files.
- * In Astro `1.0.0-rc`, this original behavior was removed as the default, in favor of our new [MDX integration](/en/guides/integrations-guide/mdx/).
+ * Enable Astro's pre-v1.0 support for components and JSX expressions in `.md` Markdown files.
+ * In Astro `1.0.0-rc`, this original behavior was removed as the default, in favor of our new [MDX integration](/en/guides/integrations-guide/mdx/).
*/
astroFlavoredMarkdown?: boolean;
};
diff --git a/packages/astro/src/cli/index.ts b/packages/astro/src/cli/index.ts
index a9e3ebe8e..d1e85301f 100644
--- a/packages/astro/src/cli/index.ts
+++ b/packages/astro/src/cli/index.ts
@@ -132,7 +132,12 @@ async function runCommand(cmd: string, flags: yargs.Arguments) {
}
}
- let { astroConfig, userConfig, userConfigPath } = await openConfig({ cwd: root, flags, cmd, logging });
+ let { astroConfig, userConfig, userConfigPath } = await openConfig({
+ cwd: root,
+ flags,
+ cmd,
+ logging,
+ });
telemetry.record(event.eventCliSession(cmd, userConfig, flags));
// Common CLI Commands:
diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts
index 41b18556a..782f6652e 100644
--- a/packages/astro/src/core/build/index.ts
+++ b/packages/astro/src/core/build/index.ts
@@ -1,11 +1,5 @@
import type { AstroTelemetry } from '@astrojs/telemetry';
-import type {
- AstroAdapter,
- AstroConfig,
- BuildConfig,
- ManifestData,
- RuntimeMode,
-} from '../../@types/astro';
+import type { AstroConfig, BuildConfig, ManifestData, RuntimeMode } from '../../@types/astro';
import type { LogOptions } from '../logger/core';
import fs from 'fs';
diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts
index 931285eee..64430da6e 100644
--- a/packages/astro/src/core/build/static-build.ts
+++ b/packages/astro/src/core/build/static-build.ts
@@ -6,7 +6,7 @@ import { fileURLToPath } from 'url';
import * as vite from 'vite';
import { BuildInternals, createBuildInternals } from '../../core/build/internal.js';
import { prependForwardSlash } from '../../core/path.js';
-import { emptyDir, removeDir, isModeServerWithNoAdapter } from '../../core/util.js';
+import { emptyDir, isModeServerWithNoAdapter, removeDir } from '../../core/util.js';
import { runHookBuildSetup } from '../../integrations/index.js';
import { rollupPluginAstroBuildCSS } from '../../vite-plugin-build-css/index.js';
import type { ViteConfigWithSSR } from '../create-vite';
@@ -25,7 +25,7 @@ export async function staticBuild(opts: StaticBuildOptions) {
const { allPages, astroConfig } = opts;
// Verify this app is buildable.
- if(isModeServerWithNoAdapter(opts.astroConfig)) {
+ if (isModeServerWithNoAdapter(opts.astroConfig)) {
throw new Error(`Cannot use \`output: 'server'\` without an adapter.
Install and configure the appropriate server adapter for your final deployment.
Example:
@@ -36,7 +36,7 @@ Example:
output: 'server',
adapter: netlify(),
}
-`)
+`);
}
// The pages to be built for rendering purposes.
@@ -71,11 +71,7 @@ Example:
// Build your project (SSR application code, assets, client JS, etc.)
timer.ssr = performance.now();
- info(
- opts.logging,
- 'build',
- `Building ${astroConfig.output} entrypoints...`
- );
+ info(opts.logging, 'build', `Building ${astroConfig.output} entrypoints...`);
const ssrResult = (await ssrBuild(opts, internals, pageInput)) as RollupOutput;
info(opts.logging, 'build', dim(`Completed in ${getTimeStat(timer.ssr, performance.now())}.`));
@@ -156,7 +152,8 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
}),
...(viteConfig.plugins || []),
// SSR needs to be last
- opts.astroConfig.output === 'server' && vitePluginSSR(internals, opts.astroConfig._ctx.adapter!),
+ opts.astroConfig.output === 'server' &&
+ vitePluginSSR(internals, opts.astroConfig._ctx.adapter!),
vitePluginAnalyzer(opts.astroConfig, internals),
],
publicDir: ssr ? false : viteConfig.publicDir,
@@ -287,9 +284,8 @@ async function copyFiles(fromFolder: URL, toFolder: URL) {
async function ssrMoveAssets(opts: StaticBuildOptions) {
info(opts.logging, 'build', 'Rearranging server assets...');
- const serverRoot = opts.astroConfig.output === 'static'
- ? opts.buildConfig.client
- : opts.buildConfig.server;
+ const serverRoot =
+ opts.astroConfig.output === 'static' ? opts.buildConfig.client : opts.buildConfig.server;
const clientRoot = opts.buildConfig.client;
const serverAssets = new URL('./assets/', serverRoot);
const clientAssets = new URL('./assets/', clientRoot);
diff --git a/packages/astro/src/core/config.ts b/packages/astro/src/core/config.ts
index 86cf10a54..d5525cbf8 100644
--- a/packages/astro/src/core/config.ts
+++ b/packages/astro/src/core/config.ts
@@ -13,9 +13,9 @@ import { BUNDLED_THEMES } from 'shiki';
import { fileURLToPath, pathToFileURL } from 'url';
import { mergeConfig as mergeViteConfig } from 'vite';
import { z } from 'zod';
+import { LogOptions } from './logger/core.js';
import { appendForwardSlash, prependForwardSlash, trimSlashes } from './path.js';
import { arraify, isObject } from './util.js';
-import { LogOptions, warn } from './logger/core.js';
load.use([loadTypeScript]);
diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts
index a005b62b6..89abcf12a 100644
--- a/packages/astro/src/integrations/index.ts
+++ b/packages/astro/src/integrations/index.ts
@@ -21,7 +21,7 @@ export async function runHookConfigSetup({
}): Promise<AstroConfig> {
// An adapter is an integration, so if one is provided push it.
if (_config.adapter) {
- _config.integrations.push(_config.adapter);
+ _config.integrations.push(_config.adapter);
}
let updatedConfig: AstroConfig = { ..._config };
@@ -89,7 +89,7 @@ export async function runHookConfigDone({ config }: { config: AstroConfig }) {
}
}
-export async function runHookServerSetup({
+export async function runHookServerSetup({
config,
server,
}: {
diff --git a/packages/astro/test/config-mode.test.js b/packages/astro/test/config-mode.test.js
index 5c623fdce..aeb09ad2f 100644
--- a/packages/astro/test/config-mode.test.js
+++ b/packages/astro/test/config-mode.test.js
@@ -38,9 +38,8 @@ describe('AstroConfig - config.mode', () => {
fixture = await loadFixture({
// This is just a random fixture to test, doesn't matter.
root: './fixtures/astro-basic/',
- output: 'server'
+ output: 'server',
});
-
});
it('Throws during the build', async () => {
@@ -48,7 +47,7 @@ describe('AstroConfig - config.mode', () => {
try {
await fixture.build();
built = true;
- } catch(err) {
+ } catch (err) {
expect(err).to.be.an.instanceOf(Error);
expect(err.message).to.match(/without an adapter/);
}
@@ -67,7 +66,7 @@ describe('AstroConfig - config.mode', () => {
fixture = await loadFixture({
// This is just a random fixture to test, doesn't matter.
root: './fixtures/astro-basic/',
- output: 'static'
+ output: 'static',
});
await fixture.build();
});
@@ -76,7 +75,7 @@ describe('AstroConfig - config.mode', () => {
let html;
try {
html = await fixture.readFile('/index.html');
- } catch(err) {
+ } catch (err) {
expect(false).to.equal(true, 'Couldnt find the file, which mean it did not build.');
}
expect(html.length).to.be.greaterThan(0);
@@ -92,7 +91,7 @@ describe('AstroConfig - config.mode', () => {
// This is just a random fixture to test, doesn't matter.
root: './fixtures/astro-basic/',
adapter: testAdapter(),
- output: 'server'
+ output: 'server',
});
await fixture.build();
});
diff --git a/packages/astro/test/ssr-partytown.test.js b/packages/astro/test/ssr-partytown.test.js
index 4978ead32..4be8456aa 100644
--- a/packages/astro/test/ssr-partytown.test.js
+++ b/packages/astro/test/ssr-partytown.test.js
@@ -11,7 +11,7 @@ describe('Using the Partytown integration in SSR', () => {
fixture = await loadFixture({
root: './fixtures/ssr-partytown/',
adapter: testAdapter(),
- output: 'server'
+ output: 'server',
});
await fixture.build();
});
diff --git a/packages/astro/test/ssr-request.test.js b/packages/astro/test/ssr-request.test.js
index b8e030041..629753371 100644
--- a/packages/astro/test/ssr-request.test.js
+++ b/packages/astro/test/ssr-request.test.js
@@ -11,7 +11,7 @@ describe('Using Astro.request in SSR', () => {
fixture = await loadFixture({
root: './fixtures/ssr-request/',
adapter: testAdapter(),
- output: 'server'
+ output: 'server',
});
await fixture.build();
});
diff --git a/packages/astro/test/ssr-response.test.js b/packages/astro/test/ssr-response.test.js
index 2e3277e89..f5e311636 100644
--- a/packages/astro/test/ssr-response.test.js
+++ b/packages/astro/test/ssr-response.test.js
@@ -11,7 +11,7 @@ describe('Using Astro.response in SSR', () => {
fixture = await loadFixture({
root: './fixtures/ssr-response/',
adapter: testAdapter(),
- output: 'server'
+ output: 'server',
});
await fixture.build();
});
diff --git a/packages/astro/test/streaming.test.js b/packages/astro/test/streaming.test.js
index 2ca8ee549..bc50c0318 100644
--- a/packages/astro/test/streaming.test.js
+++ b/packages/astro/test/streaming.test.js
@@ -13,7 +13,7 @@ describe('Streaming', () => {
fixture = await loadFixture({
root: './fixtures/streaming/',
adapter: testAdapter(),
- output: 'server'
+ output: 'server',
});
});