Rocky_Mountain_Vending/.pnpm-store/v10/files/29/9d3beba86414bca856e1f6ee5c5d7a46ff66eac59e659cb97d0c9a2c4f16f01faf6f00a9e6bb2b13019cd0cc45ab45b3a14aa3b20910c97011019827e00ab8
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

29 lines
No EOL
1.4 KiB
Text

import { ensureLeadingSlash } from './ensure-leading-slash';
import { normalizePathSep } from './normalize-path-sep';
import path from '../isomorphic/path';
import { removePagePathTail } from './remove-page-path-tail';
import { normalizeMetadataRoute } from '../../../lib/metadata/get-metadata-route';
/**
* Given the absolute path to the pages folder, an absolute file path for a
* page and the page extensions, this function will return the page path
* relative to the pages folder. It doesn't consider index tail. Example:
* - `/Users/rick/my-project/pages/foo/bar/baz.js` -> `/foo/bar/baz`
*
* It also handles special metadata routes mapping. Example:
* - `/Users/rick/my-project/app/sitemap.js` -> `/sitemap/route`
*
* @param filepath Absolute path to the page.
* @param opts.dir Absolute path to the pages/app folder.
* @param opts.extensions Extensions allowed for the page.
* @param opts.keepIndex When true the trailing `index` kept in the path.
* @param opts.pagesType Whether the page is in the pages or app directory.
*/ export function absolutePathToPage(pagePath, options) {
const isAppDir = options.pagesType === 'app';
const page = removePagePathTail(normalizePathSep(ensureLeadingSlash(path.relative(options.dir, pagePath))), {
extensions: options.extensions,
keepIndex: options.keepIndex
});
return isAppDir ? normalizeMetadataRoute(page) : page;
}
//# sourceMappingURL=absolute-path-to-page.js.map