Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default async function (source) {
// use cache if possible
this.cacheable();
const options = loaderUtils.getOptions(this);
const {variablesFiles = [], importStatements = []} = options;
// validate options according to schema
validateOptions(VALIDATE_OPTIONS_SCHEMA, options, 'vue-style-variables-loader');
// use current hash of webpack compilation
// console.log(convertor.cacheVersion++);
// console.log(this.request);
// convertor.cacheVersion = this._compilation.hash;
for (const file of variablesFiles) {
await convertor.read(file);
this.addDependency(file);
}
return convertor.convert(source, importStatements);
};
options.limit ||
(me.options && me.options.url && me.options.url.dataUrlLimit);
if (limit) {
limit = parseInt(limit, 10);
}
// var mimetype = options.mimetype || options.minetype || mime.lookup(this.resourcePath)
if (!limit || distStates.size < limit) {
me.addDependency(wasmFooterPath);
var jsModule = transpile2Js(source);
var wasmModule = transpile2Wasm(source, new Buffer(distFile));
return innerCallback(
null,
createCompatibleModuleInBundle(jsModule, wasmModule)
);
} else {
validateOptions(
schema4file,
options,
"AssemblyScript-TypeScript File Loader"
);
const url = loaderUtils.interpolateName(me, options.name, {
me,
content: distFile
});
var filePath = me.resourcePath;
let outputPath = url;
if (options.outputPath) {
if (typeof options.outputPath === "function") {
outputPath = options.outputPath(url);
} else {
outputPath = path.posix.join(options.outputPath, url);
export default function loader(source) {
var innerCallback = this.async();
const options = loaderUtils.getOptions(this) || {};
validateOptions(schema, options, "AssemblyScript-TypeScript Buffer Loader");
if (this.cacheable) {
this.cacheable();
}
var me = this;
var targetPath = this._compiler.outputPath;
var buildTempPath = path.join(this._compiler.context, "/temp/assembly/");
targetPath = path.join(
buildTempPath,
path.parse(this.resourcePath).name + ".wasm"
);
mkDirsSync(buildTempPath);
let params = [
path.relative(process.cwd(), this.resourcePath),
"-o",
path.relative(process.cwd(), targetPath)
// ,
constructor(options = {}) {
validateOptions(require('../options.json'), options, 'ExtraWatchWebpackPlugin'); // eslint-disable-line
this.options = { ...ExtraWatchWebpackPlugin.defaults, ...options };
}
export default function(content){
const options = getOptions(this) || {};
validateOptions(schema, options, 'now-loader');
const callback = this.async();
const context = options.context || this.rootContext || (this.options && this.options.context);
let apiKey = options.apiKey;
if(!apiKey) {
const apiKeyPath = path.join(process.env.HOME, '.now/auth.json');
this.addDependency(apiKeyPath);
const { credentials } = JSON.parse(fs.readFileSync(apiKeyPath, 'utf8'));
apiKey = credentials.find(({provider}) => provider === 'sh').token;
}
const name = interpolateName(this, options.name, {
context,
content,
regExp: options.regExp,
});
export default function getConfig(): RemaxOptions {
const configPath: string = path.join(process.cwd(), './remax.config');
let options = {};
if (fs.existsSync(configPath + '.js')) {
options = readJavascriptConfig(configPath + '.js');
}
validateOptions(schema as any, options, {
name: 'remax',
});
return {
...defaultOptions,
...options,
};
}
function getLoaderConfig(context) {
const options = loaderUtils.getOptions(context) || {}
validateOptions(schema, options, 'HTML Loader')
return options
}
function convertPlaceholder(html, links, config) {
constructor(options) {
validateOptions(OPTIONS_SCHEMA, options, PLUGIN_NAME)
let {base, dir, name} = parsePath(options.templatePath)
let {
alwaysWriteToDisk,
head: {appendScripts = []},
hot,
minify,
templatePath,
} = options
this._alwaysWriteToDisk = alwaysWriteToDisk || true
this._head.appendScripts = appendScripts
this._hot = hot
this._minify = minify
this._template = {
...this._template,
constructor(options: Options = {}) {
validateOptions(schema, options || {}, "HTML Render Webpack Plugin");
const pluginName = "HtmlRenderPlugin";
const {
extraGlobals = {},
skipAssets = false,
mapStatsToParams = defaultMapStats,
renderEntry = "main",
getRouteFromRequest,
transformFilePath = defaultTransform,
transformExpressPath = defaultTransform,
renderConcurrency = "serial"
} = options;
const routes: Route[] = (options.routes || [""]).map(route =>
typeof route === "string" ? ({ route } as Route) : route