wip: compileScriptSetup

This commit is contained in:
Evan You
2020-07-06 15:56:24 -04:00
parent 1ad3f975ed
commit 1359cc3a28
8 changed files with 252 additions and 14 deletions

View File

@@ -22,10 +22,15 @@ import {
parseJS,
walkJS
} from '../utils'
import { isGloballyWhitelisted, makeMap } from '@vue/shared'
import {
isGloballyWhitelisted,
makeMap,
babelParserDefautPlugins
} from '@vue/shared'
import { createCompilerError, ErrorCodes } from '../errors'
import { Node, Function, Identifier, ObjectProperty } from '@babel/types'
import { validateBrowserExpression } from '../validateExpression'
import { ParserPlugin } from '@babel/parser'
const isLiteralWhitelisted = /*#__PURE__*/ makeMap('true,false,null,this')
@@ -127,12 +132,7 @@ export function processExpression(
ast = parseJS(source, {
plugins: [
...context.expressionPlugins,
// by default we enable proposals slated for ES2020.
// full list at https://babeljs.io/docs/en/next/babel-parser#plugins
// this will need to be updated as the spec moves forward.
'bigInt',
'optionalChaining',
'nullishCoalescingOperator'
...(babelParserDefautPlugins as ParserPlugin[])
]
}).program
} catch (e) {