workflow: improve template explorer
This commit is contained in:
@@ -22,7 +22,8 @@ import { SourceMapGenerator, RawSourceMap } from 'source-map'
|
||||
import {
|
||||
advancePositionWithMutation,
|
||||
assert,
|
||||
isSimpleIdentifier
|
||||
isSimpleIdentifier,
|
||||
loadDep
|
||||
} from './utils'
|
||||
import { isString, isArray } from '@vue/shared'
|
||||
import { TO_STRING, CREATE_VNODE, COMMENT } from './runtimeConstants'
|
||||
@@ -97,7 +98,7 @@ function createCodegenContext(
|
||||
map:
|
||||
__BROWSER__ || !sourceMap
|
||||
? undefined
|
||||
: new (require('source-map')).SourceMapGenerator(),
|
||||
: new (loadDep('source-map')).SourceMapGenerator(),
|
||||
|
||||
helper(name) {
|
||||
return prefixIdentifiers ? name : `_${name}`
|
||||
|
||||
@@ -41,7 +41,9 @@ export const transformIf = createStructuralDirectiveTransform(
|
||||
(!dir.exp || !(dir.exp as SimpleExpressionNode).content.trim())
|
||||
) {
|
||||
const loc = dir.exp ? dir.exp.loc : node.loc
|
||||
context.onError(createCompilerError(ErrorCodes.X_IF_NO_EXPRESSION, loc))
|
||||
context.onError(
|
||||
createCompilerError(ErrorCodes.X_IF_NO_EXPRESSION, dir.loc)
|
||||
)
|
||||
dir.exp = createSimpleExpression(`true`, false, loc)
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import { PropsExpression } from './transforms/transformElement'
|
||||
let _parse: typeof parse
|
||||
let _walk: typeof walk
|
||||
|
||||
function loadDep(name: string) {
|
||||
export function loadDep(name: string) {
|
||||
if (typeof process !== 'undefined' && isFunction(require)) {
|
||||
return require(name)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user