absolute-path-to-page.d.ts 699 B

12345678910111213141516
  1. /**
  2. * Given the absolute path to the pages folder, an absolute file path for a
  3. * page and the page extensions, this function will return the page path
  4. * relative to the pages folder. It doesn't consider index tail. Example:
  5. * - `/Users/rick/my-project/pages/foo/bar/baz.js` -> `/foo/bar/baz`
  6. *
  7. * @param filepath Absolute path to the page.
  8. * @param opts.pagesDir Absolute path to the pages folder.
  9. * @param opts.extensions Extensions allowed for the page.
  10. * @param opts.keepIndex When true the trailing `index` kept in the path.
  11. */
  12. export declare function absolutePathToPage(pagePath: string, options: {
  13. extensions: string[];
  14. keepIndex?: boolean;
  15. pagesDir: string;
  16. }): string;