From cc5f732c13275022520478e2b4e83f0022e0e719 Mon Sep 17 00:00:00 2001 From: kazuya kawaguchi Date: Thu, 23 Feb 2017 21:02:56 +0900 Subject: [PATCH] fix deprecation warning (close #666) --- lib/loader.js | 4 ++-- lib/selector.js | 2 +- lib/style-rewriter.js | 2 +- lib/template-compiler.js | 2 +- lib/template-loader.js | 2 +- package.json | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/loader.js b/lib/loader.js index dc91df600..7778a3858 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -54,7 +54,7 @@ module.exports = function (content) { var isProduction = this.minimize || process.env.NODE_ENV === 'production' var loaderContext = this - var query = loaderUtils.parseQuery(this.query) + var query = loaderUtils.getOptions(this) || {} var rawRequest = getRawRequest(this) var options = this.options.__vueOptions__ = Object.assign({}, this.options.vue, this.vue, query) @@ -141,7 +141,7 @@ module.exports = function (content) { return loader.replace(/((?:^|!)css(?:-loader)?)(\?[^!]*)?/, function (m, $1, $2) { // $1: !css-loader // $2: ?a=b - var query = loaderUtils.parseQuery($2) + var query = loaderUtils.getOptions($2 || {}) || {} Object.assign(query, OPTIONS, option, DEFAULT_OPTIONS) if (index !== -1) { // Note: diff --git a/lib/selector.js b/lib/selector.js index 552260783..7779b8d2f 100644 --- a/lib/selector.js +++ b/lib/selector.js @@ -4,7 +4,7 @@ var loaderUtils = require('loader-utils') module.exports = function (content) { this.cacheable() - var query = loaderUtils.parseQuery(this.query) + var query = loaderUtils.getOptions(this) || {} var filename = path.basename(this.resourcePath) var parts = parse(content, filename, this.sourceMap) var part = parts[query.type] diff --git a/lib/style-rewriter.js b/lib/style-rewriter.js index ece7e0bec..964ff85c7 100644 --- a/lib/style-rewriter.js +++ b/lib/style-rewriter.js @@ -42,7 +42,7 @@ module.exports = function (css, map) { this.cacheable() var cb = this.async() - var query = loaderUtils.parseQuery(this.query) + var query = loaderUtils.getOptions(this) || {} var vueOptions = this.options.__vueOptions__ if (!vueOptions) { diff --git a/lib/template-compiler.js b/lib/template-compiler.js index 19dd928ed..b694b71fc 100644 --- a/lib/template-compiler.js +++ b/lib/template-compiler.js @@ -50,7 +50,7 @@ module.exports = function (html) { this.cacheable() var isServer = this.target === 'node' var isProduction = this.minimize || process.env.NODE_ENV === 'production' - var options = loaderUtils.parseQuery(this.query) + var options = loaderUtils.getOptions(this) || {} if (options.transformToRequire) { transformToRequire = Object.assign( {}, diff --git a/lib/template-loader.js b/lib/template-loader.js index 02207f68b..e0690c84f 100644 --- a/lib/template-loader.js +++ b/lib/template-loader.js @@ -5,7 +5,7 @@ var extname = require('path').extname module.exports = function (content) { this.cacheable && this.cacheable() var callback = this.async() - var opt = loaderUtils.parseQuery(this.query) + var opt = loaderUtils.getOptions(this) || {} // this is never documented and should be deprecated // but we'll keep it so we don't break stuff diff --git a/package.json b/package.json index 156154641..b5b018428 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "consolidate": "^0.14.0", "hash-sum": "^1.0.2", "js-beautify": "^1.6.3", - "loader-utils": "^0.2.10", + "loader-utils": "^1.0.2", "lru-cache": "^4.0.1", "postcss": "^5.0.10", "postcss-load-config": "^1.1.0",