Skip to content

Commit

Permalink
refactor: Remove @vue/component-compiler-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
HcySunYang committed Jan 9, 2019
1 parent 1921c2a commit c58fe71
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 27 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"@babel/parser": "^7.1.0",
"@babel/traverse": "^7.1.0",
"@babel/types": "^7.1.3",
"@vue/component-compiler-utils": "^2.2.0",
"cac": "^5.0.13",
"carlo": "^0.9.10",
"chokidar": "^2.0.4",
Expand Down
11 changes: 3 additions & 8 deletions src/parser/sfcToAST.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { parse as vueSFCParse } from '@vue/component-compiler-utils'
import * as vueTemplateCompiler from 'vue-template-compiler'
import { parseComponent, compile } from 'vue-template-compiler'
import { parse as babelParse, ParserPlugin } from '@babel/parser'
import * as bt from '@babel/types'

Expand All @@ -13,11 +12,7 @@ export default function(
source: string,
babelParserPlugins?: ParserPlugin[]
): AstResult {
const sfc = vueSFCParse({
source: source,
compiler: vueTemplateCompiler,
needMap: false
})
const sfc = parseComponent(source)
const res: AstResult = {}
if (sfc.script && sfc.script.content) {
res.sourceType = sfc.script.lang || 'js'
Expand All @@ -32,7 +27,7 @@ export default function(
})
}
if (sfc.template && sfc.template.content) {
res.templateAst = vueTemplateCompiler.compile(sfc.template.content, {
res.templateAst = compile(sfc.template.content, {
comments: true
}).ast
}
Expand Down
Empty file added src/parser/vueSFCParser.ts
Empty file.
18 changes: 0 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -628,20 +628,6 @@
source-map "^0.5.6"
vue-template-es2015-compiler "^1.6.0"

"@vue/component-compiler-utils@^2.2.0":
version "2.3.0"
resolved "https://registry.npmjs.org/@vue/component-compiler-utils/-/component-compiler-utils-2.3.0.tgz#4f580f1b28fc7685859d87ea0e92a1c0271c93da"
dependencies:
consolidate "^0.15.1"
hash-sum "^1.0.2"
lru-cache "^4.1.2"
merge-source-map "^1.1.0"
postcss "^6.0.20"
postcss-selector-parser "^3.1.1"
prettier "1.13.7"
source-map "^0.5.6"
vue-template-es2015-compiler "^1.6.0"

JSONStream@^1.0.4:
version "1.3.5"
resolved "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0"
Expand Down Expand Up @@ -5871,10 +5857,6 @@ prettier-tslint@^0.4.0:
tslint "^5.9.1"
yargs "^11.0.0"

prettier@1.13.7:
version "1.13.7"
resolved "https://registry.npmjs.org/prettier/-/prettier-1.13.7.tgz#850f3b8af784a49a6ea2d2eaa7ed1428a34b7281"

prettier@^1.13.0, prettier@^1.14.3:
version "1.14.3"
resolved "https://registry.npmjs.org/prettier/-/prettier-1.14.3.tgz#90238dd4c0684b7edce5f83b0fb7328e48bd0895"
Expand Down

0 comments on commit c58fe71

Please sign in to comment.