diff options
-rw-r--r-- | examples/subpath/astro.config.mjs | 2 | ||||
-rw-r--r-- | examples/subpath/src/components/Time.jsx | 6 | ||||
-rw-r--r-- | examples/subpath/src/styles/main.scss | 2 | ||||
-rw-r--r-- | packages/astro/src/core/build/index.ts | 2 | ||||
-rw-r--r-- | packages/astro/src/core/dev/index.ts | 6 | ||||
-rw-r--r-- | packages/astro/src/core/dev/template/4xx.ts | 13 | ||||
-rw-r--r-- | packages/astro/src/core/preview/index.ts | 2 |
7 files changed, 18 insertions, 15 deletions
diff --git a/examples/subpath/astro.config.mjs b/examples/subpath/astro.config.mjs index 989f60121..7a7a3ed2d 100644 --- a/examples/subpath/astro.config.mjs +++ b/examples/subpath/astro.config.mjs @@ -10,7 +10,7 @@ export default /** @type {import('astro').AstroUserConfig} */ ({ // Comment out "renderers: []" to enable Astro's default component support. buildOptions: { - site: 'http://example.com/blog' + site: 'http://example.com/blog', }, renderers: ['@astrojs/renderer-react'], }); diff --git a/examples/subpath/src/components/Time.jsx b/examples/subpath/src/components/Time.jsx index 8172b77dd..8b5837c85 100644 --- a/examples/subpath/src/components/Time.jsx +++ b/examples/subpath/src/components/Time.jsx @@ -1,7 +1,7 @@ import React from 'react'; -export default function() { +export default function () { const date = new Date(); const format = new Intl.DateTimeFormat('en-US'); - return <time>{format.format(date)}</time> -}
\ No newline at end of file + return <time>{format.format(date)}</time>; +} diff --git a/examples/subpath/src/styles/main.scss b/examples/subpath/src/styles/main.scss index 573fc4396..a54a15f01 100644 --- a/examples/subpath/src/styles/main.scss +++ b/examples/subpath/src/styles/main.scss @@ -2,4 +2,4 @@ body { #app { color: tomato; } -}
\ No newline at end of file +} diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index b3a514e88..d7adb4745 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -184,7 +184,7 @@ class AstroBuilder { publicDir: viteConfig.publicDir, root: viteConfig.root, server: viteConfig.server, - base: this.config.buildOptions.site ? new URL(this.config.buildOptions.site).pathname : '/' + base: this.config.buildOptions.site ? new URL(this.config.buildOptions.site).pathname : '/', }); debug(logging, 'build', timerMessage('Vite build finished', timer.buildStart)); diff --git a/packages/astro/src/core/dev/index.ts b/packages/astro/src/core/dev/index.ts index 5c81f4101..66e891dce 100644 --- a/packages/astro/src/core/dev/index.ts +++ b/packages/astro/src/core/dev/index.ts @@ -234,7 +234,7 @@ export class AstroDevServer { server: { middlewareMode: 'ssr', host: this.hostname, - } + }, }, this.config.vite || {} ), @@ -278,7 +278,7 @@ export class AstroDevServer { let filePath: URL | undefined; try { let routePathname = pathname.startsWith(this.pathname) ? pathname.substr(this.pathname.length) || '/' : undefined; - if(!routePathname) { + if (!routePathname) { next(); return; } @@ -363,7 +363,7 @@ export class AstroDevServer { } // if not found, fall back to default template else { - if(pathname === '/' && !pathname.startsWith(this.pathname)) { + if (pathname === '/' && !pathname.startsWith(this.pathname)) { html = subpathNotUsedTemplate(this.pathname, pathname); } else { html = notFoundTemplate({ statusCode, title: 'Not found', tabTitle: '404: Not Found', pathname }); diff --git a/packages/astro/src/core/dev/template/4xx.ts b/packages/astro/src/core/dev/template/4xx.ts index b24e87098..e321a881a 100644 --- a/packages/astro/src/core/dev/template/4xx.ts +++ b/packages/astro/src/core/dev/template/4xx.ts @@ -47,9 +47,12 @@ export default function template({ title, pathname, statusCode = 404, tabTitle, <main class="center"> <svg class="astro" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M163.008 18.929c1.944 2.413 2.935 5.67 4.917 12.181l43.309 142.27a180.277 180.277 0 00-51.778-17.53l-28.198-95.29a3.67 3.67 0 00-7.042.01l-27.857 95.232a180.225 180.225 0 00-52.01 17.557l43.52-142.281c1.99-6.502 2.983-9.752 4.927-12.16a15.999 15.999 0 016.484-4.798c2.872-1.154 6.271-1.154 13.07-1.154h31.085c6.807 0 10.211 0 13.086 1.157a16.004 16.004 0 016.487 4.806z" fill="white"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M168.19 180.151c-7.139 6.105-21.39 10.268-37.804 10.268-20.147 0-37.033-6.272-41.513-14.707-1.602 4.835-1.961 10.367-1.961 13.902 0 0-1.056 17.355 11.015 29.426 0-6.268 5.081-11.349 11.349-11.349 10.743 0 10.731 9.373 10.721 16.977v.679c0 11.542 7.054 21.436 17.086 25.606a23.27 23.27 0 01-2.339-10.2c0-11.008 6.463-15.107 13.974-19.87 5.976-3.79 12.616-8.001 17.192-16.449a31.024 31.024 0 003.743-14.82c0-3.299-.513-6.479-1.463-9.463z" fill="#ff5d01"></path></svg> <h1>${statusCode ? `<span class="statusCode">${statusCode}: </span> ` : ''}<span class="statusMessage">${title}</span></h1> - ${body || ` + ${ + body || + ` <pre>Path: ${encode(pathname)}</pre> - `} + ` + } </main> </body> </html>`; @@ -64,6 +67,6 @@ export function subpathNotUsedTemplate(base: string, pathname: string) { body: ` <p>In your <code>buildOptions.site</code> you have your base path set to <a href="${base}">${base}</a>. Do you want to go there instead?</p> <p>Come to our <a href="https://astro.build/chat">Discord</a> if you need help.</p> - ` - }); -}
\ No newline at end of file + `, + }); +} diff --git a/packages/astro/src/core/preview/index.ts b/packages/astro/src/core/preview/index.ts index 28f568827..3e19c8c55 100644 --- a/packages/astro/src/core/preview/index.ts +++ b/packages/astro/src/core/preview/index.ts @@ -27,7 +27,7 @@ export default async function preview(config: AstroConfig, { logging }: PreviewO // Create the preview server, send static files out of the `dist/` directory. const server = http.createServer((req, res) => { - if(!req.url!.startsWith(base)) { + if (!req.url!.startsWith(base)) { res.statusCode = 404; res.end(subpathNotUsedTemplate(base, req.url!)); return; |