mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-14 03:54:46 +00:00
14 lines
383 B
TypeScript
14 lines
383 B
TypeScript
import { locations } from '../config';
|
|
import { create_manifest_data } from '../core';
|
|
|
|
export function find_page(pathname: string, cwd = locations.routes()) {
|
|
const { pages } = create_manifest_data(cwd);
|
|
|
|
for (let i = 0; i < pages.length; i += 1) {
|
|
const page = pages[i];
|
|
|
|
if (page.pattern.test(pathname)) {
|
|
return page.parts[page.parts.length - 1].component.file;
|
|
}
|
|
}
|
|
} |