Nuxt/packages/nitro/src/utils.ts
2020-11-02 00:17:44 +01:00

12 lines
311 B
TypeScript

import { relative } from 'path'
import jiti from 'jiti'
export const hl = str => '`' + str + '`'
export const prettyPath = (p, highlight = true) => {
p = relative(process.cwd(), p)
return highlight ? hl(p) : p
}
export const tryImport = (dir, path) => { try { return jiti(dir)(path) } catch (_err) { } }