|
1 | 1 | const vueCompiler = require('vue-template-compiler') |
2 | 2 | const babel = require('babel-core') |
3 | | -const vueNextCompiler = require('vue-template-es2015-compiler') |
4 | | -var assign = require('object-assign') |
5 | | -var sourceMap = require('source-map') |
| 3 | +const sourceMap = require('source-map') |
6 | 4 | const path = require('path') |
7 | 5 | const compileTemplate = require('./template-compiler') |
8 | | -var convert = require('convert-source-map') |
9 | | -const splitRE = /\r?\n/g; |
| 6 | +const convert = require('convert-source-map') |
| 7 | + |
| 8 | +const splitRE = /\r?\n/g |
10 | 9 |
|
11 | 10 | function generateSourceMap (script, output, filePath, content, inputMap) { |
12 | 11 | var hashedFilename = path.basename(filePath) |
@@ -66,29 +65,28 @@ module.exports = { |
66 | 65 | plugins: ['transform-runtime'] |
67 | 66 | }) |
68 | 67 |
|
69 | | - const script = result.code; |
70 | | - const template = parts.template; |
| 68 | + const script = result.code |
71 | 69 |
|
72 | | - const inputMap = result.map; |
73 | | - const map = generateSourceMap(script, '', path, src, inputMap); |
| 70 | + const inputMap = result.map |
| 71 | + const map = generateSourceMap(script, '', path, src, inputMap) |
74 | 72 | let output = ';(function(){\n' + script + '\n})()\n' + |
75 | 73 | 'if (module.exports.__esModule) module.exports = module.exports.default\n' + |
76 | 74 | 'var __vue__options__ = (typeof module.exports === "function"' + |
77 | 75 | '? module.exports.options' + |
78 | | - ': module.exports)\n'; |
79 | | - var beforeLines |
80 | | - if (map) { |
81 | | - beforeLines = output.split(splitRE).length |
82 | | - } |
83 | | - output += '__vue__options__.render = ' + renderFunctions.render + '\n' + |
| 76 | + ': module.exports)\n' |
| 77 | + var beforeLines |
| 78 | + if (map) { |
| 79 | + beforeLines = output.split(splitRE).length |
| 80 | + } |
| 81 | + output += '__vue__options__.render = ' + renderFunctions.render + '\n' + |
84 | 82 | '__vue__options__.staticRenderFns = ' + renderFunctions.staticRenderFns + '\n' |
85 | | - if (map) { |
86 | | - addTemplateMapping(script, parts, output, map, beforeLines) |
87 | | - } |
| 83 | + if (map) { |
| 84 | + addTemplateMapping(script, parts, output, map, beforeLines) |
| 85 | + } |
88 | 86 |
|
89 | | - if (map) { |
90 | | - output += '\n' + convert.fromJSON(map.toString()).toComment() |
91 | | - } |
| 87 | + if (map) { |
| 88 | + output += '\n' + convert.fromJSON(map.toString()).toComment() |
| 89 | + } |
92 | 90 |
|
93 | 91 | return { |
94 | 92 | code: output, |
|
0 commit comments