summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--packages/integrations/cloudflare/src/index.ts10
-rw-r--r--packages/integrations/deno/src/index.ts6
-rw-r--r--packages/integrations/netlify/src/integration-edge-functions.ts8
-rw-r--r--packages/integrations/netlify/src/integration-functions.ts6
-rw-r--r--packages/integrations/node/src/index.ts2
-rw-r--r--packages/webapi/mod.d.ts2
17 files changed, 79 insertions, 75 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',
});
});
diff --git a/packages/integrations/cloudflare/src/index.ts b/packages/integrations/cloudflare/src/index.ts
index 7070af17f..29341453c 100644
--- a/packages/integrations/cloudflare/src/index.ts
+++ b/packages/integrations/cloudflare/src/index.ts
@@ -22,9 +22,13 @@ export default function createIntegration(): AstroIntegration {
setAdapter(getAdapter());
_config = config;
- if(config.output === 'static') {
- console.warn(`[@astrojs/cloudflare] \`output: "server"\` is required to use this adapter.`);
- console.warn(`[@astrojs/cloudflare] Otherwise, this adapter is not required to deploy a static site to Cloudflare.`);
+ if (config.output === 'static') {
+ console.warn(
+ `[@astrojs/cloudflare] \`output: "server"\` is required to use this adapter.`
+ );
+ console.warn(
+ `[@astrojs/cloudflare] Otherwise, this adapter is not required to deploy a static site to Cloudflare.`
+ );
}
},
'astro:build:start': ({ buildConfig }) => {
diff --git a/packages/integrations/deno/src/index.ts b/packages/integrations/deno/src/index.ts
index 73ccf01e0..839c6fb39 100644
--- a/packages/integrations/deno/src/index.ts
+++ b/packages/integrations/deno/src/index.ts
@@ -32,9 +32,11 @@ export default function createIntegration(args?: Options): AstroIntegration {
'astro:config:done': ({ setAdapter, config }) => {
setAdapter(getAdapter(args));
- if(config.output === 'static') {
+ if (config.output === 'static') {
console.warn(`[@astrojs/deno] \`output: "server"\` is required to use this adapter.`);
- console.warn(`[@astrojs/deno] Otherwise, this adapter is not required to deploy a static site to Deno.`);
+ console.warn(
+ `[@astrojs/deno] Otherwise, this adapter is not required to deploy a static site to Deno.`
+ );
}
},
'astro:build:start': ({ buildConfig }) => {
diff --git a/packages/integrations/netlify/src/integration-edge-functions.ts b/packages/integrations/netlify/src/integration-edge-functions.ts
index 0556317d7..72ab6fb19 100644
--- a/packages/integrations/netlify/src/integration-edge-functions.ts
+++ b/packages/integrations/netlify/src/integration-edge-functions.ts
@@ -136,10 +136,12 @@ export function netlifyEdgeFunctions({ dist }: NetlifyEdgeFunctionsOptions = {})
setAdapter(getAdapter());
_config = config;
- if(config.output === 'static') {
+ if (config.output === 'static') {
console.warn(`[@astrojs/netlify] \`output: "server"\` is required to use this adapter.`);
- console.warn(`[@astrojs/netlify] Otherwise, this adapter is not required to deploy a static site to Netlify.`);
- }
+ console.warn(
+ `[@astrojs/netlify] Otherwise, this adapter is not required to deploy a static site to Netlify.`
+ );
+ }
},
'astro:build:start': async ({ buildConfig }) => {
_buildConfig = buildConfig;
diff --git a/packages/integrations/netlify/src/integration-functions.ts b/packages/integrations/netlify/src/integration-functions.ts
index d0b327f87..d78fb1f32 100644
--- a/packages/integrations/netlify/src/integration-functions.ts
+++ b/packages/integrations/netlify/src/integration-functions.ts
@@ -36,9 +36,11 @@ function netlifyFunctions({
setAdapter(getAdapter({ binaryMediaTypes }));
_config = config;
- if(config.output === 'static') {
+ if (config.output === 'static') {
console.warn(`[@astrojs/netlify] \`output: "server"\` is required to use this adapter.`);
- console.warn(`[@astrojs/netlify] Otherwise, this adapter is not required to deploy a static site to Netlify.`);
+ console.warn(
+ `[@astrojs/netlify] Otherwise, this adapter is not required to deploy a static site to Netlify.`
+ );
}
},
'astro:build:start': async ({ buildConfig }) => {
diff --git a/packages/integrations/node/src/index.ts b/packages/integrations/node/src/index.ts
index 8ff6fc423..cc8141f14 100644
--- a/packages/integrations/node/src/index.ts
+++ b/packages/integrations/node/src/index.ts
@@ -15,7 +15,7 @@ export default function createIntegration(): AstroIntegration {
'astro:config:done': ({ setAdapter, config }) => {
setAdapter(getAdapter());
- if(config.output === 'static') {
+ if (config.output === 'static') {
console.warn(`[@astrojs/Node] \`output: "server"\` is required to use this adapter.`);
}
},
diff --git a/packages/webapi/mod.d.ts b/packages/webapi/mod.d.ts
index 3750dcb3a..7150edbe7 100644
--- a/packages/webapi/mod.d.ts
+++ b/packages/webapi/mod.d.ts
@@ -1,5 +1,5 @@
export { pathToPosix } from './lib/utils';
-export { AbortController, AbortSignal, alert, atob, Blob, btoa, ByteLengthQueuingStrategy, cancelAnimationFrame, cancelIdleCallback, CanvasRenderingContext2D, CharacterData, clearTimeout, Comment, CountQueuingStrategy, CSSStyleSheet, CustomElementRegistry, CustomEvent, Document, DocumentFragment, DOMException, Element, Event, EventTarget, fetch, File, FormData, Headers, HTMLBodyElement, HTMLCanvasElement, HTMLDivElement, HTMLDocument, HTMLElement, HTMLHeadElement, HTMLHtmlElement, HTMLImageElement, HTMLSpanElement, HTMLStyleElement, HTMLTemplateElement, HTMLUnknownElement, Image, ImageData, IntersectionObserver, MediaQueryList, MutationObserver, Node, NodeFilter, NodeIterator, OffscreenCanvas, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, Request, requestAnimationFrame, requestIdleCallback, ResizeObserver, Response, setTimeout, ShadowRoot, structuredClone, StyleSheet, Text, TransformStream, TreeWalker, URLPattern, Window, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter, } from './mod.js';
+export { AbortController, AbortSignal, alert, atob, Blob, btoa, ByteLengthQueuingStrategy, cancelAnimationFrame, cancelIdleCallback, CanvasRenderingContext2D, CharacterData, clearTimeout, Comment, CountQueuingStrategy, CSSStyleSheet, CustomElementRegistry, CustomEvent, Document, DocumentFragment, DOMException, Element, Event, EventTarget, fetch, File, FormData, Headers, HTMLBodyElement, HTMLCanvasElement, HTMLDivElement, HTMLDocument, HTMLElement, HTMLHeadElement, HTMLHtmlElement, HTMLImageElement, HTMLSpanElement, HTMLStyleElement, HTMLTemplateElement, HTMLUnknownElement, Image, ImageData, IntersectionObserver, MediaQueryList, MutationObserver, Node, NodeFilter, NodeIterator, OffscreenCanvas, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, Request, requestAnimationFrame, requestIdleCallback, ResizeObserver, Response, setTimeout, ShadowRoot, structuredClone, StyleSheet, Text, TransformStream, TreeWalker, URLPattern, Window, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter } from './mod.js';
export declare const polyfill: {
(target: any, options?: PolyfillOptions): any;
internals(target: any, name: string): any;