Skip to content

Commit

Permalink
refactor: using core's path utils
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Sullivan committed May 10, 2022
1 parent 61fa9ad commit a3122e3
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/astro/src/vite-plugin-astro-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type http from 'http';
import type { AstroConfig, ManifestData } from '../@types/astro';
import type { RenderResponse, SSROptions } from '../core/render/dev/index';
import { debug, info, warn, error, LogOptions } from '../core/logger/core.js';
import { appendForwardSlash } from '../core/path.js';
import { getParamsAndProps, GetParamsAndPropsError } from '../core/render/core.js';
import { createRouteManifest, matchRoute } from '../core/routing/index.js';
import stripAnsi from 'strip-ansi';
Expand Down Expand Up @@ -164,10 +165,6 @@ async function handle500Response(
writeHtmlResponse(res, 500, transformedHtml);
}

function appendForwardSlash(path: string) {
return path.endsWith('/') ? path : path + '/';
}

function getCustom404Route(config: AstroConfig, manifest: ManifestData) {
const relPages = resolvePages(config).href.replace(config.root.href, '');
return manifest.routes.find((r) => r.component === appendForwardSlash(relPages) + '404.astro');
Expand Down

0 comments on commit a3122e3

Please sign in to comment.