From ba845f52186128bffbf8fc89cd24907e5a1e327d Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 9 Nov 2018 04:02:12 +0900 Subject: Clean up --- webpack/loaders/replace.js | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 webpack/loaders/replace.js (limited to 'webpack/loaders') diff --git a/webpack/loaders/replace.js b/webpack/loaders/replace.js deleted file mode 100644 index 9f4825e18c..0000000000 --- a/webpack/loaders/replace.js +++ /dev/null @@ -1,30 +0,0 @@ -import { getOptions } from 'loader-utils'; - -function trim(text, g) { - return text.substring(1, text.length - (g ? 2 : 0)); -} - -export default function(src) { - const fn = options => { - const search = options.search; - const g = search.endsWith('g'); - const file = this.resourcePath.replace(/\\/g, '/'); - const replace = options.i18n ? global[options.replace].bind(null, { - src: file, - lang: options.lang - }) : global[options.replace]; - if (typeof search != 'string' || search.length == 0) console.error('invalid search'); - if (typeof replace != 'function') console.error('invalid replacer:', replace, this.request); - src = src.replace(new RegExp(trim(search, g), g ? 'g' : ''), replace); - }; - - this.cacheable(); - const options = getOptions(this); - if (options.qs) { - options.qs.forEach(q => fn(q)); - } else { - fn(options); - } - this.callback(null, src); - return src; -} -- cgit v1.2.3-freya