Skip to content

Commit 4d2f625

Browse files
committed
Bump loader-utils and use getOptions
1 parent e8f422e commit 4d2f625

File tree

7 files changed

+3056
-410
lines changed

7 files changed

+3056
-410
lines changed

lib/loader.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ module.exports = function (content) {
5555
// var isServer = this.options.target === 'node'
5656
// var isServer = false
5757
var loaderContext = this
58-
var query = loaderUtils.parseQuery(this.query)
59-
var params = loaderUtils.parseQuery(this.resourceQuery)
60-
var options = this.options.__vueOptions__ = Object.assign({}, this.options.vue, this.vue, query)
58+
var params = loaderUtils.getOptions(this)
59+
var options = this.options.__vueOptions__ = Object.assign({}, this.options.vue, this.vue, params)
6160
var filePath = this.resourcePath
6261
var fileName = path.basename(filePath)
6362
var moduleId = 'data-v-' + genId(path.relative(process.cwd(), filePath))
@@ -129,7 +128,7 @@ module.exports = function (content) {
129128
return loader.replace(/((?:^|!)css(?:-loader)?)(\?[^!]*)?/, function (m, $1, $2) {
130129
// $1: !css-loader
131130
// $2: ?a=b
132-
var query = loaderUtils.parseQuery($2)
131+
var query = loaderUtils.getOptions($2)
133132
Object.assign(query, OPTIONS, option, DEFAULT_OPTIONS)
134133
if (index !== -1) {
135134
// Note:
@@ -154,7 +153,7 @@ module.exports = function (content) {
154153
var lang = part.lang
155154
var loader = loaders[defaultLang[type]]
156155
var rewriter = type === 'styles' ? styleRewriter + (scoped ? '&scoped=true!' : '!') : ''
157-
var injectString = (type === 'script' && query.inject) ? 'inject!' : ''
156+
var injectString = (type === 'script' && params.inject) ? 'inject!' : ''
158157
if (loader !== undefined) {
159158
if (Array.isArray(loader)) {
160159
loader = stringifyLoaders(loader)
@@ -344,7 +343,7 @@ module.exports = function (content) {
344343
' __register_static_styles__(__vue_options__._scopeId, __vue_styles__)\n' +
345344
'}\n'
346345

347-
if (!query.inject) {
346+
if (!params.inject) {
348347
output += exports
349348
// hot reload
350349
// if (

lib/selector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var loaderUtils = require('loader-utils')
44

55
module.exports = function (content) {
66
this.cacheable()
7-
var query = loaderUtils.parseQuery(this.query)
7+
var query = loaderUtils.getOptions(this)
88
var filename = path.basename(this.resourcePath)
99
var parts = parse(content, filename, this.sourceMap)
1010
var part = parts[query.type]

lib/style-rewriter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = function (css, map) {
4141
this.cacheable()
4242
var cb = this.async()
4343

44-
loaderUtils.parseQuery(this.query)
44+
loaderUtils.getOptions(this)
4545
var options = this.options.__vueOptions__
4646
var postcssOptions = options.postcss
4747

lib/template-compiler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ var beautify = require('js-beautify').js_beautify
5454
module.exports = function (html) {
5555
this.cacheable()
5656
var isProduction = this.minimize || process.env.NODE_ENV === 'production'
57-
var query = loaderUtils.parseQuery(this.query)
57+
var query = loaderUtils.getOptions(this)
5858
// var isServer = this.options.target === 'node'
5959
// var isServer = false
6060
var vueOptions = this.options.__vueOptions__

lib/template-loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var extname = require('path').extname
55
module.exports = function (content) {
66
this.cacheable && this.cacheable()
77
var callback = this.async()
8-
var opt = loaderUtils.parseQuery(this.query)
8+
var opt = loaderUtils.getOptions(this)
99
var vue = this.options.__vueOptions__
1010
if (vue && vue.template) {
1111
for (var key in vue.template) {

0 commit comments

Comments
 (0)