This repository was archived by the owner on Aug 16, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change 1
- const compiler = require ( 'vue-template-compiler/build.js ' )
1
+ const compiler = require ( 'vue-template-compiler' )
2
2
const { struct } = require ( 'superstruct' )
3
3
const LRU = require ( 'lru-cache' )
4
4
const hash = require ( 'hash-sum' )
@@ -13,39 +13,35 @@ const emptyRE = /^(?:\/\/)?\s*$/
13
13
const Config = struct (
14
14
{
15
15
needMap : 'boolean?' ,
16
- bustCache : 'boolean?'
16
+ needCSSMap : 'boolean?'
17
17
} ,
18
18
{
19
19
needMap : true ,
20
- bustCache : false
20
+ needCSSMap : false
21
21
}
22
22
)
23
23
24
- module . exports = function ( content , filename , config ) {
24
+ module . exports = function parse ( content , filename , config ) {
25
25
assertType ( { content, filename } , 'string' )
26
26
config = Config ( config )
27
27
28
28
const cacheKey = hash ( filename + content )
29
- const filenameWithHash = config . bustCache
30
- ? filename + '?' + cacheKey
31
- : filename // source-map cache busting for hot-reloadded modules
32
-
33
29
if ( cache . has ( cacheKey ) ) return cache . get ( cacheKey )
34
30
35
31
const output = compiler . parseComponent ( content , { pad : 'line' } )
36
32
if ( config . needMap ) {
37
33
if ( output . script && ! output . script . src ) {
38
34
output . script . map = generateSourceMap (
39
- filenameWithHash ,
35
+ filename ,
40
36
content ,
41
37
output . script . content
42
38
)
43
39
}
44
- if ( output . styles ) {
40
+ if ( config . needCSSMap && output . styles ) {
45
41
output . styles . forEach ( style => {
46
42
if ( ! style . src ) {
47
43
style . map = generateSourceMap (
48
- filenameWithHash ,
44
+ filename ,
49
45
content ,
50
46
style . content
51
47
)
You can’t perform that action at this time.
0 commit comments