UNPKG

@sanpjs/core

Version:

@sanpjs/core

24 lines (23 loc) 1.09 kB
import { IConfig } from '../types'; export default class Resolver { config: IConfig; pagesDir: string; projectRoot: string; sanpDir: string; constructor(projectRoot: string, config: IConfig); resolve(id: string, opts?: any, optionalDir?: string): string; relative(filePath: string): string; resolveEntry(filePath: string, isModule?: boolean): string; resolvePage(filePath: string): string; resolveComponent(filePath: string): string; resolveSanp(filePath: string, isMove?: boolean): string; resolveLayout(filePath?: string): string; /** * 发生文件移动时,处理文件内组件引用路径变更 * @param {string} importPath 文件内引用路径,例如:"../../components/header" * @param {string} oriPath 源文件路径,相对于root。例如:'pages' * @param {string} targetPath 目标文件路径,相对于root。例如:'.sanp/app/demo' * @returns {string} 移动后的相对路径 */ relativeImport(importPath: string, oriPath: string, targetPath: string): string | undefined; }