fix(nitro): update dot-prop import

This commit is contained in:
Pooya Parsa 2022-01-21 13:37:51 +01:00
parent 83c518de69
commit e0cf2d7b5d

View File

@ -6,7 +6,7 @@ import defu from 'defu'
import { mergeHooks } from 'hookable' import { mergeHooks } from 'hookable'
import consola from 'consola' import consola from 'consola'
import chalk from 'chalk' import chalk from 'chalk'
import dotProp from 'dot-prop' import { getProperty } from 'dot-prop'
import type { NitroPreset, NitroInput } from '../context' import type { NitroPreset, NitroInput } from '../context'
export function hl (str: string) { export function hl (str: string) {
@ -20,7 +20,7 @@ export function prettyPath (p: string, highlight = true) {
export function compileTemplate (contents: string) { export function compileTemplate (contents: string) {
return (params: Record<string, any>) => contents.replace(/{{ ?([\w.]+) ?}}/g, (_, match) => { return (params: Record<string, any>) => contents.replace(/{{ ?([\w.]+) ?}}/g, (_, match) => {
const val = dotProp.get(params, match) const val = getProperty(params, match)
if (!val) { if (!val) {
consola.warn(`cannot resolve template param '${match}' in ${contents.slice(0, 20)}`) consola.warn(`cannot resolve template param '${match}' in ${contents.slice(0, 20)}`)
} }