Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getPath(input, lazy, bundle) {
const extension = path.extname(input);
let output = '';
// for .css files force the request to the css loader (https://github.com/aurelia/webpack-plugin/issues/11#issuecomment-212578861)
if (extension == ".css")
output += `!!css!`;
if (lazy || bundle)
output += `bundle?`;
if (lazy)
output += `lazy`;
if (lazy && bundle)
output += `&`;
if (bundle)
output += `name=${bundle}`;
if (lazy || bundle)
output += `!`;
return `${output}${input}`
}
ignore: [
...ignoredDirectories.map((directory) => `**/${directory}/**`),
...ignoredFileExtensions.map((extension) => `**/*.${extension}`),
],
}, (error, files) => {
if (error) {
reject(error);
} else {
resolve(files);
}
});
});
const extensions = new Set();
for (const file of files) {
const extension = upath.extname(file);
if (extension) {
// Get rid of the leading . character.
extensions.add(extension.replace(/^\./, ''));
}
}
return [...extensions];
}
function handler(options) {
var invokedCmd = options.invokedCmd
var bucket = options.bucket
var buffer = fs.readFileSync(invokedCmd.file)
var fileExt = upath.extname(invokedCmd.file)
var originalname = upath.defaultExt(invokedCmd.title || 'media', fileExt)
var media_object = { originalname: originalname, buffer: buffer }
bucket.addMedia({
media: media_object,
folder: invokedCmd.folder,
}).then(function(res) {
print.success('Success')
console.log(res)
process.exit()
}).catch(function(err) {
print.error('Error')
console.log(err)
process.exit(1)
})
}
static check (filename, callback) {
const extension = path.extname(filename).toLowerCase()
const allowedExtensions = ['.styl']
return callback(null, allowedExtensions.indexOf(extension) > -1)
}
function listPotentialSourceFiles(compiledFile) {
const compiledExtension = Path.extname(compiledFile);
const targetExtensions = sourceExtension[compiledExtension] || [];
return targetExtensions.map(extension =>
compiledFile.replace(compiledExtension, extension)
);
}
readdir(targetDir, [(file, stats) =>
path.extname(file) !== extension && !stats.isDirectory()
], (error, files) => error ? reject(error) : resolve(files)));
function isDataFile (filename) {
const ext = path.extname(filename)
const filenameWithoutExt = path.basename(filename, ext)
return filenameWithoutExt === 'data' && ext === '.xml'
}
check: (filename, callback) => {
const extension = path.extname(filename).toLowerCase()
const allowedExtensions = ['.json', '.yml', '.yaml']
return callback(null, allowedExtensions.indexOf(extension) > -1)
},
check: (filename, callback) => {
const extension = path.extname(filename).toLowerCase()
const allowedExtensions = ['.yml', '.yaml']
return callback(null, allowedExtensions.indexOf(extension) > -1)
},
static check (filename, callback) {
const extension = path.extname(filename).toLowerCase()
const allowedExtensions = ['.css']
return callback(null, allowedExtensions.indexOf(extension) > -1)
}