Nuxt/packages/nitro/src/utils.ts

12 lines
311 B
TypeScript
Raw Normal View History

2020-11-01 23:17:44 +00:00
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) { } }