summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Matt Kane <ematipico@users.noreply.github.com> 2025-01-29 11:55:16 +0000
committerGravatar astrobot-houston <fred+astrobot@astro.build> 2025-01-29 11:55:16 +0000
commit18a2699f5320f4c3c01d8fe502f7b66c78014f94 (patch)
tree28973d86a8a6070f20cb2ba609bb540a1a8a7db4
parent536175528dbbe75aa978d615ba2517b64bad7879 (diff)
downloadastro-18a2699f5320f4c3c01d8fe502f7b66c78014f94.tar.gz
astro-18a2699f5320f4c3c01d8fe502f7b66c78014f94.tar.zst
astro-18a2699f5320f4c3c01d8fe502f7b66c78014f94.zip
[ci] format
-rw-r--r--examples/with-tailwindcss/src/styles/global.css2
-rw-r--r--packages/astro/src/core/constants.ts1
-rw-r--r--packages/astro/src/template/4xx.ts5
-rw-r--r--packages/astro/src/types/public/config.ts2
-rw-r--r--packages/astro/src/vite-plugin-astro-server/base.ts2
-rw-r--r--packages/astro/test/serializeManifest.test.js9
-rw-r--r--packages/astro/test/ssr-trailing-slash.js12
-rw-r--r--packages/astro/test/units/test-utils.js2
-rw-r--r--packages/internal-helpers/src/path.ts4
-rw-r--r--packages/markdown/remark/src/frontmatter.ts5
10 files changed, 22 insertions, 22 deletions
diff --git a/examples/with-tailwindcss/src/styles/global.css b/examples/with-tailwindcss/src/styles/global.css
index a461c505f..d4b507858 100644
--- a/examples/with-tailwindcss/src/styles/global.css
+++ b/examples/with-tailwindcss/src/styles/global.css
@@ -1 +1 @@
-@import "tailwindcss"; \ No newline at end of file
+@import 'tailwindcss';
diff --git a/packages/astro/src/core/constants.ts b/packages/astro/src/core/constants.ts
index 92e99f8d1..dc09a1f69 100644
--- a/packages/astro/src/core/constants.ts
+++ b/packages/astro/src/core/constants.ts
@@ -100,4 +100,3 @@ export const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
// The folder name where to find the middleware
export const MIDDLEWARE_PATH_SEGMENT_NAME = 'middleware';
-
diff --git a/packages/astro/src/template/4xx.ts b/packages/astro/src/template/4xx.ts
index 3b6eff210..4df016405 100644
--- a/packages/astro/src/template/4xx.ts
+++ b/packages/astro/src/template/4xx.ts
@@ -130,7 +130,10 @@ export function subpathNotUsedTemplate(base: string, pathname: string) {
});
}
-export function trailingSlashMismatchTemplate(pathname: string, trailingSlash: 'always' | 'never' | 'ignore') {
+export function trailingSlashMismatchTemplate(
+ pathname: string,
+ trailingSlash: 'always' | 'never' | 'ignore',
+) {
const corrected =
trailingSlash === 'always'
? appendForwardSlash(pathname)
diff --git a/packages/astro/src/types/public/config.ts b/packages/astro/src/types/public/config.ts
index 0b73f8f9e..228a6141f 100644
--- a/packages/astro/src/types/public/config.ts
+++ b/packages/astro/src/types/public/config.ts
@@ -242,7 +242,7 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
* - `'never'` - Only match URLs that do not include a trailing slash (e.g: "/about"). In production, requests for on-demand rendered URLs with a trailing slash will be redirected to the correct URL for your convenience. However, in development, they will display a warning page reminding you that you have `never` configured.
*
* When redirects occur in production for GET requests, the redirect will be a 301 (permanent) redirect. For all other request methods, it will be a 308 (permanent, and preserve the request method) redirect.
- *
+ *
* Trailing slashes on prerendered pages are handled by the hosting platform, and may not respect your chosen configuration.
* See your hosting platform's documentation for more information.
*
diff --git a/packages/astro/src/vite-plugin-astro-server/base.ts b/packages/astro/src/vite-plugin-astro-server/base.ts
index d6e5ddf3a..8820f611b 100644
--- a/packages/astro/src/vite-plugin-astro-server/base.ts
+++ b/packages/astro/src/vite-plugin-astro-server/base.ts
@@ -3,11 +3,11 @@ import type { AstroSettings } from '../types/astro.js';
import * as fs from 'node:fs';
import path from 'node:path';
+import { appendForwardSlash } from '@astrojs/internal-helpers/path';
import { bold } from 'kleur/colors';
import type { Logger } from '../core/logger/core.js';
import { notFoundTemplate, subpathNotUsedTemplate } from '../template/4xx.js';
import { writeHtmlResponse } from './response.js';
-import { appendForwardSlash } from '@astrojs/internal-helpers/path';
export function baseMiddleware(
settings: AstroSettings,
diff --git a/packages/astro/test/serializeManifest.test.js b/packages/astro/test/serializeManifest.test.js
index 996205820..a47a63499 100644
--- a/packages/astro/test/serializeManifest.test.js
+++ b/packages/astro/test/serializeManifest.test.js
@@ -3,8 +3,8 @@ import { after, before, describe, it } from 'node:test';
import * as cheerio from 'cheerio';
import { ServerOnlyModule } from '../dist/core/errors/errors-data.js';
import { AstroError } from '../dist/core/errors/index.js';
+import testAdapter from './test-adapter.js';
import { loadFixture } from './test-utils.js';
-import testAdapter from "./test-adapter.js";
describe('astro:manifest/client', () => {
/** @type {import('./test-utils').Fixture} */
@@ -110,14 +110,13 @@ describe('astro:manifest/client', () => {
);
});
});
-
});
describe('astro:manifest/server', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
let devServer;
- let app
+ let app;
describe('when build', () => {
before(async () => {
@@ -132,7 +131,6 @@ describe('astro:manifest/server', () => {
assert.equal(error.name, ServerOnlyModule.name);
});
});
-
describe('when the experimental flag is not enabled in dev', async () => {
before(async () => {
@@ -211,12 +209,11 @@ describe('astro:manifest/server', () => {
adapter: testAdapter(),
output: 'server',
});
-
+
await fixture.build();
app = await fixture.loadTestAdapterApp();
});
-
it('should return the expected properties', async () => {
const request = new Request('http://example.com/server');
const response = await app.render(request);
diff --git a/packages/astro/test/ssr-trailing-slash.js b/packages/astro/test/ssr-trailing-slash.js
index 0ea97842f..b34430a8e 100644
--- a/packages/astro/test/ssr-trailing-slash.js
+++ b/packages/astro/test/ssr-trailing-slash.js
@@ -85,14 +85,14 @@ describe('Redirecting trailing slashes in SSR', () => {
assert.equal(response.headers.get('Location'), '/dot.in.directory/path/');
});
- it("Does not redirect internal paths", async () => {
+ it('Does not redirect internal paths', async () => {
const app = await fixture.loadTestAdapterApp();
for (const path of [
'/_astro/something',
'/_image?url=http://example.com/foo.jpg',
'/_server-islands/foo',
- '/_actions/foo'
+ '/_actions/foo',
]) {
const request = new Request(`http://example.com${path}`);
const response = await app.render(request);
@@ -100,14 +100,13 @@ describe('Redirecting trailing slashes in SSR', () => {
}
});
- it("Redirects POST requests", async () => {
+ it('Redirects POST requests', async () => {
const app = await fixture.loadTestAdapterApp();
const request = new Request('http://example.com/another', { method: 'POST' });
const response = await app.render(request);
assert.equal(response.status, 308);
assert.equal(response.headers.get('Location'), '/another/');
});
-
});
describe('trailingSlash: never', () => {
@@ -189,7 +188,7 @@ describe('Redirecting trailing slashes in SSR', () => {
'/_astro/something/',
'/_image/?url=http://example.com/foo.jpg',
'/_server-islands/foo/',
- '/_actions/foo/'
+ '/_actions/foo/',
]) {
const request = new Request(`http://example.com${path}/`);
const response = await app.render(request);
@@ -204,7 +203,6 @@ describe('Redirecting trailing slashes in SSR', () => {
assert.equal(response.status, 308);
assert.equal(response.headers.get('Location'), '/another');
});
-
});
describe('trailingSlash: ignore', () => {
@@ -218,7 +216,7 @@ describe('Redirecting trailing slashes in SSR', () => {
await fixture.build();
});
- it("Redirects to collapse multiple trailing slashes", async () => {
+ it('Redirects to collapse multiple trailing slashes', async () => {
const app = await fixture.loadTestAdapterApp();
const request = new Request('http://example.com/another///');
const response = await app.render(request);
diff --git a/packages/astro/test/units/test-utils.js b/packages/astro/test/units/test-utils.js
index 601042413..9d4804a1a 100644
--- a/packages/astro/test/units/test-utils.js
+++ b/packages/astro/test/units/test-utils.js
@@ -78,7 +78,7 @@ export function toPromise(res) {
if (ArrayBuffer.isView(data) && !Buffer.isBuffer(data)) {
data = Buffer.from(data.buffer);
}
- if(typeof data === 'string') {
+ if (typeof data === 'string') {
data = Buffer.from(data);
}
return write.call(this, data, encoding);
diff --git a/packages/internal-helpers/src/path.ts b/packages/internal-helpers/src/path.ts
index 6078a0d9a..158cb58c7 100644
--- a/packages/internal-helpers/src/path.ts
+++ b/packages/internal-helpers/src/path.ts
@@ -22,8 +22,8 @@ export function collapseDuplicateSlashes(path: string) {
export const MANY_TRAILING_SLASHES = /\/{2,}/g;
export function collapseDuplicateTrailingSlashes(path: string, trailingSlash: boolean) {
- if(!path) {
- return path
+ if (!path) {
+ return path;
}
return path.replace(MANY_TRAILING_SLASHES, trailingSlash ? '/' : '') || '/';
}
diff --git a/packages/markdown/remark/src/frontmatter.ts b/packages/markdown/remark/src/frontmatter.ts
index e641effca..16c103f73 100644
--- a/packages/markdown/remark/src/frontmatter.ts
+++ b/packages/markdown/remark/src/frontmatter.ts
@@ -71,7 +71,10 @@ export function parseFrontmatter(
);
break;
case 'empty-with-lines':
- content = code.replace(`${delims}${rawFrontmatter}${delims}`, rawFrontmatter.replace(/[^\r\n]/g, ''));
+ content = code.replace(
+ `${delims}${rawFrontmatter}${delims}`,
+ rawFrontmatter.replace(/[^\r\n]/g, ''),
+ );
break;
}