Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if(props.srcURL) info.srcUrl = props.srcURL
if(props.pageURL) info.pageUrl = props.pageURL
info.menuItemId = menuItemId
const item = {
label: properties.title,
click(){
ipcMain.emit('chrome-context-menus-clicked',null, extensionId, webContents.id, info)}
}
if(menuItemId) item.menuItemId = menuItemId
if(properties.checked !== void 0) item.checked = properties.checked
if(properties.enabled !== void 0) item.enabled = properties.enabled
if(properties.documentUrlPatterns !== void 0){
const url = props.pageURL || props.frameURL
// console.log('documentUrlPatterns',url,properties.documentUrlPatterns)
if(url && !nm.some(url, properties.documentUrlPatterns.map(x=>x=='' ? "**" : x.replace(/\*/,'**')))){
item.hide = true
}
}
if(properties.targetUrlPatterns !== void 0){
const url = props.linkURL
// console.log('targetUrlPatterns',url,properties.targetUrlPatterns.map(x=>x=='' ? "**" : x.replace(/\*/,'**')))
if(url && !nm.some(url, properties.targetUrlPatterns.map(x=>x=='' ? "**" : x.replace(/\*/,'**')))){
item.hide = true
}
}
if(!item.hide){
const addItem = properties.type == "separator" ? {type: 'separator'} : item
let parent
if(properties.parentId && (parent = menuList.find(m=>m.menuItemId == properties.parentId))){
if(properties.icons && extensionInfos[extensionId] && extensionInfos[extensionId].base_path) addItem.icon = path.join(extensionInfos[extensionId].base_path,Object.values(properties.icons)[0].replace(/\.svg$/,'.png'))
if(parent.submenu === void 0){
ipcMain.emit('chrome-context-menus-clicked',null, extensionId, webContents.id, info)}
}
if(menuItemId) item.menuItemId = menuItemId
if(properties.checked !== void 0) item.checked = properties.checked
if(properties.enabled !== void 0) item.enabled = properties.enabled
if(properties.documentUrlPatterns !== void 0){
const url = props.pageURL || props.frameURL
// console.log('documentUrlPatterns',url,properties.documentUrlPatterns)
if(url && !nm.some(url, properties.documentUrlPatterns.map(x=>x=='' ? "**" : x.replace(/\*/,'**')))){
item.hide = true
}
}
if(properties.targetUrlPatterns !== void 0){
const url = props.linkURL
// console.log('targetUrlPatterns',url,properties.targetUrlPatterns.map(x=>x=='' ? "**" : x.replace(/\*/,'**')))
if(url && !nm.some(url, properties.targetUrlPatterns.map(x=>x=='' ? "**" : x.replace(/\*/,'**')))){
item.hide = true
}
}
if(!item.hide){
const addItem = properties.type == "separator" ? {type: 'separator'} : item
let parent
if(properties.parentId && (parent = menuList.find(m=>m.menuItemId == properties.parentId))){
if(properties.icons && extensionInfos[extensionId] && extensionInfos[extensionId].base_path) addItem.icon = path.join(extensionInfos[extensionId].base_path,Object.values(properties.icons)[0].replace(/\.svg$/,'.png'))
if(parent.submenu === void 0){
parent.submenu = [addItem]
}
else{
parent.submenu.push(addItem)
}
}
else{
if (exclude.some(item => nanomatch.isMatch(file.filePath, item))) {
// Excluded
if (exclude.some(item => nanomatch.isMatch(file.filePath, item))) {
// Excluded
if (exclude.some(item => nanomatch.isMatch(file.filePath, item))) {
// Excluded
if (exclude.some(item => nanomatch.isMatch(file.filePath, item))) {
// Excluded
module.exports = function (snapdragon) {
var compilers = snapdragon.compiler.compilers;
var opts = snapdragon.options;
// register nanomatch compilers
snapdragon.use(nanomatch.compilers);
// get references to some specific nanomatch compilers before they
// are overridden by the extglob and/or custom compilers
var escape = compilers.escape;
var qmark = compilers.qmark;
var slash = compilers.slash;
var star = compilers.star;
var text = compilers.text;
var plus = compilers.plus;
var dot = compilers.dot;
// register extglob compilers or escape exglobs if disabled
if (opts.extglob === false || opts.noext === true) {
snapdragon.compiler.use(escapeExtglobs);
} else {
snapdragon.use(extglob.compilers);
module.exports = function(snapdragon) {
var compilers = snapdragon.compiler.compilers;
var opts = snapdragon.options;
// register nanomatch compilers
snapdragon.use(nanomatch.compilers);
// get references to some specific nanomatch compilers before they
// are overridden by the extglob and/or custom compilers
var escape = compilers.escape;
var qmark = compilers.qmark;
var slash = compilers.slash;
var star = compilers.star;
var text = compilers.text;
var plus = compilers.plus;
var dot = compilers.dot;
// register extglob compilers or escape exglobs if disabled
if (opts.extglob === false || opts.noext === true) {
snapdragon.compiler.use(escapeExtglobs);
} else {
snapdragon.use(extglob.compilers);
impl: (interpreter: Interpreter, pathArg: BrsString, patternIn: BrsString) => {
let volume = getVolumeByPath(interpreter, pathArg.value);
if (volume == null) {
// TODO: replace with RoList when that's implemented
return new RoArray([]);
}
let localPath = path.join(interpreter.options.root, getPath(pathArg.value));
try {
let knownFiles = fs.readdirSync(localPath, "utf8");
let matchedFiles = nanomatch.match(knownFiles, patternIn.value, {
nocase: true,
nodupes: true,
noglobstar: true,
nonegate: true,
});
matchedFiles = (matchedFiles || []).map((match: string) => new BrsString(match));
// TODO: replace with RoList when that's implemented
return new RoArray(matchedFiles);
} catch (err) {
// TODO: replace with RoList when that's implemented
return new RoArray([]);
}
},
});
module.exports = function (snapdragon) {
var parsers = snapdragon.parser.parsers;
// register nanomatch parsers
snapdragon.use(nanomatch.parsers);
// get references to some specific nanomatch parsers before they
// are overridden by the extglob and/or parsers
var escape = parsers.escape;
var slash = parsers.slash;
var qmark = parsers.qmark;
var plus = parsers.plus;
var star = parsers.star;
var dot = parsers.dot;
// register extglob parsers
snapdragon.use(extglob.parsers);
// custom micromatch parsers
snapdragon.parser
.use(function () {