get-next-pathname-info.d.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. export interface NextPathnameInfo {
  2. /**
  3. * The base path in case the pathname included it.
  4. */
  5. basePath?: string;
  6. /**
  7. * The buildId for when the parsed URL is a data URL. Parsing it can be
  8. * disabled with the `parseData` option.
  9. */
  10. buildId?: string;
  11. /**
  12. * If there was a locale in the pathname, this will hold its value.
  13. */
  14. locale?: string;
  15. /**
  16. * The processed pathname without a base path, locale, or data URL elements
  17. * when parsing it is enabled.
  18. */
  19. pathname: string;
  20. /**
  21. * A boolean telling if the pathname had a trailingSlash. This can be only
  22. * true if trailingSlash is enabled.
  23. */
  24. trailingSlash?: boolean;
  25. }
  26. interface Options {
  27. /**
  28. * When passed to true, this function will also parse Nextjs data URLs.
  29. */
  30. parseData?: boolean;
  31. /**
  32. * A partial of the Next.js configuration to parse the URL.
  33. */
  34. nextConfig?: {
  35. basePath?: string;
  36. i18n?: {
  37. locales?: string[];
  38. } | null;
  39. trailingSlash?: boolean;
  40. };
  41. }
  42. export declare function getNextPathnameInfo(pathname: string, options: Options): NextPathnameInfo;
  43. export {};