pathUtils.d.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. import { ParsedUrlQuery } from 'querystring';
  2. import { Context } from '../server';
  3. export declare const resolveFrom: (root: string, id: string) => string;
  4. export declare const queryRE: RegExp;
  5. export declare const hashRE: RegExp;
  6. export declare const cleanUrl: (url: string) => string;
  7. export declare const parseWithQuery: (id: string) => {
  8. path: string;
  9. query: ParsedUrlQuery;
  10. };
  11. export declare const bareImportRE: RegExp;
  12. export declare const isExternalUrl: (url: string) => boolean;
  13. export declare const isDataUrl: (url: string) => boolean;
  14. /**
  15. * Check if a file is a static asset that vite can process.
  16. */
  17. export declare const isStaticAsset: (file: string) => boolean;
  18. /**
  19. * Check if a request is an import from js instead of a native resource request
  20. * i.e. differentiate
  21. * `import('/style.css')`
  22. * from
  23. * `<link rel="stylesheet" href="/style.css">`
  24. *
  25. * The ?import query is injected by serverPluginModuleRewrite.
  26. */
  27. export declare const isImportRequest: (ctx: Context) => boolean;
  28. export declare function parseNodeModuleId(id: string): {
  29. scope: string;
  30. name: string;
  31. inPkgPath: string;
  32. };
  33. export declare function removeUnRelatedHmrQuery(url: string): string;