Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function (source) {
this.cacheable()
const _this = this
const config = this.vux || utils.getLoaderConfig(this, 'vux')
if (!config.plugins || !config.plugins.length) {
return source
}
config.plugins.forEach(function (plugin) {
// style-parser
if (plugin.name === 'style-parser') {
if (plugin.fn) {
source = plugin.fn.call(_this, source)
}
}
})
if (config.options.vuxDev) {
if (/App\.vue$/.test(this.resourcePath)) {
module.exports = function (source) {
if (this.cacheable) this.cacheable();
var callback = this.async();
// Only act on bulma sass imports
if(!bulmaPattern.test(this.resourcePath)) {
return callback(null, source);
}
var config = loaderUtils.getLoaderConfig(this, 'bulmaLoader');
var themeName = config.theme;
if (!themeName) {
return callback(new Error('No `theme` specified in the bulma-loader options! See: https://github.com/stipsan/bulma-loader#usage'))
}
var themePath = path.resolve(themeName);
var themeExists = fs.existsSync(themePath);
if (!themeExists) {
return callback(new Error(`The path ${themePath} does not exist!`))
}
this.addDependency(themePath);
fs.readFile(themePath, "utf-8", function(err, theme) {
const isVuxComponent = this.resourcePath.replace(/\\/g, '/').indexOf('/vux/src/components') > -1
if (config.plugins.length) {
config.plugins.forEach(function (plugin) {
// script-parser
if (plugin.name === 'script-parser') {
if (plugin.fn) {
source = plugin.fn.call(_this, source)
}
}
})
}
if (config.options.useVuxUI && /}\s+from(.*?)('|")vux/.test(source)) {
const maps = this.vuxMaps || utils.getLoaderConfig(this, 'vuxMaps')
const parser = require('./libs/import-parser')
source = parser(source, function (opts) {
let str = ''
opts.components.forEach(function (component) {
let file = `vux/${maps[component.originalName]}`
if (config.options.vuxDev) {
if (/App\.vue/.test(_this.resourcePath)) {
file = file.replace(/vux\/src/g, '.')
} else {
let relative = '..'
// component file import other functions
if (isVuxComponent && !/components/.test(file)) {
relative = '../..'
}
if (/demos/.test(_this.resourcePath)) {
module.exports = function (source) {
this.cacheable()
const _this = this
const config = this.vux || utils.getLoaderConfig(this, 'vux')
if (!config.plugins || !config.plugins.length) {
return source
}
config.plugins.forEach(function (plugin) {
// style-parser
if (plugin.name === 'after-less-parser') {
if (plugin.fn) {
source = plugin.fn.call(_this, source)
}
}
})
return source
}
module.exports = function (content) {
this.cacheable && this.cacheable();
/** @type {SVGSpriteLoaderConfig} */
var config;
var query = loaderUtils.parseQuery(this.query);
if ('config' in query) {
config = extend({}, defaultConfig, loaderUtils.getLoaderConfig(this, query.config));
} else {
config = extend({}, defaultConfig, query);
}
var resourcePath = this.resourcePath;
var basename = path.basename(resourcePath);
var isRasterImage = utils.isRasterImage(resourcePath);
this.addDependency(resourcePath);
if (isRasterImage)
content = procs.rasterImageToSVG(resourcePath);
var doc = new SVGDoc(content);
// Calculate sprite symbol id
// x-icon
if (config.options.useVuxUI && source.indexOf(' -1) {
source = parseXIcon(source, config)
}
// v-no-ssr
if (config.options.ssr) {
source = removeTagCode(source, 'v-no-ssr')
source = reserveTagCode(source, 'v-ssr')
} else {
source = removeTagCode(source, 'v-ssr')
source = reserveTagCode(source, 'v-no-ssr')
}
const locales = this.vuxLocales || utils.getLoaderConfig(this, 'vuxLocales')
/**
* ======== i18n ========
*/
let dynamic = false
let locale = 'zh-CN'
let vuxFunctionName = '$t'
let functionName = '$t'
let staticTranslations = {}
let langs = ['en', 'zh-CN']
let staticReplace
// 如果不设置, dynamic 为false, local 为 zh-CN
const i18nPluginsMatch = config.plugins.filter(function (one) {
return one.name === 'i18n'
})
module.exports = function (source) {
//console.log(source);
console.log(loaderUtils.getLoaderConfig(this,"myLoader"));
return source;
};
function init(loader) {
var loaderConfig = loaderUtils.getLoaderConfig(loader, 'web3Loader');
web3 = require('./lib/web3')(loaderConfig.provider);
config = mergeConfig(loaderConfig);
isDebug = loader.debug;
}
module.exports = function (source) {
this.cacheable()
const _this = this
const config = this.vux || utils.getLoaderConfig(this, 'vux')
if (!config.plugins || !config.plugins.length) {
return source
}
let i18nPlugin
const i18nPluginsMatch = config.plugins.filter(function (one) {
return one.name === 'i18n'
})
if (i18nPluginsMatch.length) {
i18nPlugin = i18nPluginsMatch[0]
}
let isVuxVueFile = this.resourcePath.replace(/\\/g, '/').indexOf('vux/src/components') > -1
if (config.options.vuxDev && this.resourcePath.replace(/\\/g, '/').indexOf('src/components') > -1) {
isVuxVueFile = true
}
module.exports = function (source) {
this.cacheable && this.cacheable();
var config = loaderUtils.getLoaderConfig(this, 'solcLoader');
var optimize = 1;
if (config.hasOwnProperty('optimize')) {
switch (config.optimize) {
case '0':
optimize = '0';
break;
case 'false':
optimize = '0';
break;
default:
optimize = (config.optimize) ? '1': '0';
}
}
var loaderContex = this;
var sourceParsedPath = path.parse(loaderContex.resource);