Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// get loader string for pre-processors
getLoaderString(type, part, index, scoped);
if (options.afterWxSelector) {
loaderString += // 微信端在selector 拼接差异化代码后做replace
stringifyLoaders(options.afterWxSelector) + '!' ;
}
loaderString +=
// select the corresponding part from the vue file
getSelectorString(type, index || 0) +
// the url to the actual vue file, including remaining requests
rawRequest;
return loaderUtils.stringifyRequest(
loaderContext,
loaderString
)
}
module.exports.pitch = function (remainingRequest) {
if (this.cacheable) this.cacheable()
var isServer = this.target === 'node'
var isProduction = this.minimize || process.env.NODE_ENV === 'production'
var addStylesClientPath = loaderUtils.stringifyRequest(this, '!' + path.join(__dirname, 'lib/addStylesClient.js'))
var addStylesServerPath = loaderUtils.stringifyRequest(this, '!' + path.join(__dirname, 'lib/addStylesServer.js'))
var request = loaderUtils.stringifyRequest(this, '!!' + remainingRequest)
var id = JSON.stringify(hash(request))
var shared = [
'// style-loader: Adds some css to the DOM by adding a <style> tag',
'',
'// load the styles',
'var content = require(' + request + ');',
// content list format is [id, css, media, sourceMap]
"if(typeof content === 'string') content = [[module.id, content, '']];",
'if(content.locals) module.exports = content.locals;'
]
if (!isServer) {
</style>
hasJS = true;
}
const qs = new QueryString({
type,
stylePath: hasStyle ? stylePath : null,
jsPath: hasJS ? jsPath : null,
});
const componentReq = stringifyRequest(this, `!!${__filename}?${qs}!${tplPath}`);
tplRegisters += `require(${componentReq})(__tpls__, Rax);`;
}
}
// prepare requirements
const vdomHelperReq = createRequireDefault(stringifyRequest(this, paths.vdomHelper));
const styleReq = stylePath && stylePath !== 'undefined'
? createRequire(stringifyRequest(this, `${stylesheetLoaderPath}?disableLog=true!${stylePath}`))
: '{}';
const globalStyleReq = globalStylePath
? createRequire(stringifyRequest(this, `${stylesheetLoaderPath}?disableLog=true!${globalStylePath}`))
: '{}';
const renderFnScopeVariables = withScope(
renderFn,
prerveredVars,
'data'
);
return `;(function(globalStyle, pageStyle, __vdom_helpers__){
${vdomHelperVars}
module.exports = function renderFactory(__parent_tpls__, Rax) {
function install (install, content, imports) {
if (imports.length) {
let newContent = '/* vuetify-loader */\n'
newContent += `import ${install} from ${loaderUtils.stringifyRequest(this, '!' + runtimePaths[install])}\n`
newContent += imports.map(i => i[1]).join('\n') + '\n'
newContent += `${install}(component, {${imports.map(i => i[0]).join(',')}})\n`
// Insert our modification before the HMR code
const hotReload = content.indexOf('/* hot reload */')
if (hotReload > -1) {
content = content.slice(0, hotReload) + newContent + '\n\n' + content.slice(hotReload)
} else {
content += '\n\n' + newContent
}
}
return content
}
acc[key.replace('?', '')] = query[key]
return acc
}, {})
// compile and generate sourcemaps
const {code, map} = compile(
source,
{
...opts,
file: this.resourcePath
}
)
// generate the output code
// convert webpack's absolute path to a script-friendly string for hotReload
const escapedPath = stringifyRequest(this, this.resourcePath)
const output = `${code}${opts.hot ? hotReload(escapedPath) : ''}`
// cache this module
if (this.cacheable) this.cacheable()
// return code and sourcemap
this.callback(null, output, map)
}
const path = stringify(publicPath) || '__webpack_public_path__';
const data = `{
id: ${stringify(symbol.useId)},
viewBox: ${stringify(symbol.viewBox)},
url: ${path} + ${stringify(spritePlaceholder)},
toString: function () {
return this.url;
}
}`;
runtime = generateExport(data, esModule);
} else {
const spriteModuleAbsPath = isAbsolute(spriteModule) ? spriteModule : join(context, spriteModule);
const symbolModuleAbsPath = isAbsolute(symbolModule) ? symbolModule : join(context, symbolModule);
const spriteModuleImport = stringifyRequest(loaderContext, spriteModuleAbsPath);
const symbolModuleImport = stringifyRequest(loaderContext, symbolModuleAbsPath);
runtime = [
generateImport('SpriteSymbol', symbolModuleImport, esModule),
generateImport('sprite', spriteModuleImport, esModule),
`var symbol = new SpriteSymbol(${stringifySymbol(symbol)})`,
'var result = sprite.add(symbol)',
generateExport(runtimeCompat ? '"#" + symbol.id' : 'symbol', esModule)
].join(';\n');
}
return runtime;
}
${requires.map(style =>
`require(${loaderUtils.stringifyRequest(loaderContext, style)});`
).join("\n")}
return `module.exports.wasmBooted = import(${jsRequest}).then(wasmModule => {
const keys = Object.keys(wasmModule);
for (let key of keys) module.exports[key] = wasmModule[key];
})`;
} else {
const jsRequest = loaderUtils.stringifyRequest(self, suffixlessPath + '.js');
let contents = '';
if (wasmBindgen.nodejs) {
contents += `module.exports = require(${jsRequest});\n`;
} else {
contents += `export * from ${jsRequest};\n`;
}
if (wasmBindgen.wasm2es6js) {
const wasmImport = suffixlessPath + '_bg';
const wasmRequest = loaderUtils.stringifyRequest(self, wasmImport);
if (wasmBindgen.nodejs) {
contents += `module.exports.wasmBooted = require(${wasmRequest}).booted\n`;
} else {
contents += `export {booted as wasmBooted} from ${wasmRequest};\n`;
}
}
return contents;
}
};
" if(dispose) {",
" dispose();",
" }",
" });",
"}"
].join("\n");
return [
"var refs = 0;",
"var dispose;",
"var content = require(" + loaderUtils.stringifyRequest(this, "!!" + request) + ");",
"if(typeof content === 'string') content = [[module.id, content, '']];",
"if(content.locals) exports.locals = content.locals;",
"exports.use = exports.ref = function() {",
" if(!(refs++)) {",
" dispose = require(" + loaderUtils.stringifyRequest(this, "!" + path.join(__dirname, "lib", "addStyles.js")) + ")(content, " + JSON.stringify(options) + ");",
" }",
" return exports;",
"};",
"exports.unuse = exports.unref = function() {",
" if(refs > 0 && !(--refs)) {",
" dispose();",
" dispose = null;",
" }",
"};",
options.hmr ? hmrCode : ""
].join("\n");
};
module.exports.pitch = function (request) {
if (this.cacheable) this.cacheable();
var options = loaderUtils.getOptions(this) || {};
validateOptions(require('./options.json'), options, 'Style Loader (Useable)');
return [
"var refs = 0;",
"var dispose;",
"var content = require(" + loaderUtils.stringifyRequest(this, "!!" + request) + ");",
"if(typeof content === 'string') content = [[module.id, content, '']];",
"if(content.locals) exports.locals = content.locals;",
"exports.use = exports.ref = function() {",
" if(!(refs++)) {",
" dispose = require(" + loaderUtils.stringifyRequest(this, "!" + path.join(__dirname, "lib", "addStyles.js")) + ")(content, " + JSON.stringify(options) + ");",
" }",
" return exports;",
"};",
"exports.unuse = exports.unref = function() {",
" if(refs > 0 && !(--refs)) {",
" dispose();",
" dispose = null;",
" }",
"};",
"if(module.hot) {",
" var lastRefs = module.hot.data && module.hot.data.refs || 0;",