mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 09:57:29 -07:00
✌️
This commit is contained in:
parent
7ab8b30b46
commit
439d3659e4
3 changed files with 33 additions and 32 deletions
|
@ -209,7 +209,7 @@
|
||||||
"vue-cropperjs": "2.2.0",
|
"vue-cropperjs": "2.2.0",
|
||||||
"vue-js-modal": "1.3.13",
|
"vue-js-modal": "1.3.13",
|
||||||
"vue-json-tree-view": "2.1.4",
|
"vue-json-tree-view": "2.1.4",
|
||||||
"vue-loader": "15.0.5",
|
"vue-loader": "15.0.11",
|
||||||
"vue-router": "3.0.1",
|
"vue-router": "3.0.1",
|
||||||
"vue-template-compiler": "2.5.16",
|
"vue-template-compiler": "2.5.16",
|
||||||
"vuedraggable": "2.16.0",
|
"vuedraggable": "2.16.0",
|
||||||
|
|
|
@ -146,27 +146,20 @@ module.exports = {
|
||||||
}, {
|
}, {
|
||||||
loader: 'replace',
|
loader: 'replace',
|
||||||
query: {
|
query: {
|
||||||
search: /%base64:(.+?)%/g.toString(),
|
qs: [{
|
||||||
replace: 'base64replacement'
|
search: /%base64:(.+?)%/g.toString(),
|
||||||
}
|
replace: 'base64replacement'
|
||||||
}, {
|
}, {
|
||||||
loader: 'replace',
|
search: i18nPattern.toString(),
|
||||||
query: {
|
replace: 'i18nReplacement',
|
||||||
search: i18nPattern.toString(),
|
i18n: true
|
||||||
replace: 'i18nReplacement',
|
}, {
|
||||||
i18n: true
|
search: faPattern.toString(),
|
||||||
}
|
replace: 'faReplacement'
|
||||||
}, {
|
}, {
|
||||||
loader: 'replace',
|
search: /^<template>([\s\S]+?)\r?\n<\/template>/.toString(),
|
||||||
query: {
|
replace: 'collapseSpacesReplacement'
|
||||||
search: faPattern.toString(),
|
}]
|
||||||
replace: 'faReplacement'
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
loader: 'replace',
|
|
||||||
query: {
|
|
||||||
search: /^<template>([\s\S]+?)\r?\n<\/template>/.toString(),
|
|
||||||
replace: 'collapseSpacesReplacement'
|
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
}, {
|
}, {
|
||||||
|
|
|
@ -5,18 +5,26 @@ function trim(text, g) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function(src) {
|
export default function(src) {
|
||||||
|
const fn = options => {
|
||||||
|
const search = options.search;
|
||||||
|
const g = search[search.length - 1] == '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();
|
this.cacheable();
|
||||||
const options = getOptions(this);
|
const options = getOptions(this);
|
||||||
const search = options.search;
|
if (options.qs) {
|
||||||
const g = search[search.length - 1] == 'g';
|
options.qs.forEach(q => fn(q));
|
||||||
const file = this.resourcePath.replace(/\\/g, '/');
|
} else {
|
||||||
const replace = options.i18n ? global[options.replace].bind(null, {
|
fn(options);
|
||||||
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.callback(null, src);
|
this.callback(null, src);
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue