Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const notFound = () => {
// Copy index.html from not-found to 404.html
copySync(join(BROWSER_FOLDER, 'not-found', 'index.html'), join(BROWSER_FOLDER, '404.html'));
// Remove not-found from sitemap
const sitemapFile = readFileSync(join(BROWSER_FOLDER, "sitemap.xml"), {encoding: 'utf8'});
const sitemap = converter.xml2js(sitemapFile, {compact: true});
sitemap.urlset.url = sitemap.urlset.url.filter(item => {
if (item.loc._text.indexOf('/not-found') >= 0) {
return false;
}
return true;
});
writeFileSync(join(BROWSER_FOLDER, "sitemap.xml"), converter.js2xml(sitemap, {compact: true, spaces: 4}), {encoding: 'utf8'});
// Delete the not-found directory
del.sync([`${BROWSER_FOLDER}/not-found/**`]);
};
)
const config = fileXml['network-security-config'][0]
// Remove certificate pinning rules
// See https://developer.android.com/training/articles/security-config#pin-set
delete config['pin-set']
const overrides = (config['debug-overrides'] || (config['debug-overrides'] = [{}]))[0]
const trustAnchors = (overrides['trust-anchors'] || (overrides['trust-anchors'] = [{}]))[0]
const certificates = trustAnchors['certificates'] || (trustAnchors['certificates'] = [])
if (!certificates.filter((c: any) => c._attributes.src === 'user').length) {
certificates.push({ _attributes: { src: 'user' } })
}
await fs.writeFile(path, xml.js2xml(fileXml, { compact: true, spaces: 4 }))
}
obj = {
// _comment: ' ' + this.meta + ' ',
snippet: {
content: {
_cdata: input.completions[0].contents
},
tabTrigger: {
_text: input.completions[0].trigger
},
scope: {
_text: input.scope
}
}
};
}
output = xml_js_1.js2xml(obj, {
compact: true,
spaces: 4
});
return output;
};
exports.writeXml = writeXml;
elements: [{
type: 'text',
text: `${arch === 'x64' ? 'x64' : 'x86'}-windows-static`,
}],
});
globals.elements.push({
type: 'element',
name: 'VcpkgEnabled',
elements: [{
type: 'text',
text: 'true',
}],
});
fs.writeFileSync(path.resolve('build', 'krypton.vcxproj'), xml.js2xml(vcxproj, { spaces: 2 }));
execSync(`${path.resolve('node_modules', '.bin', 'node-gyp')} build --target=v${target} --arch=${arch}`, {
stdio: 'inherit',
env: {
...process.env,
...env[arch],
},
});
fs.copyFileSync(path.resolve('build', 'Release', 'krypton.node'), path.resolve('builds', `${process.platform}-${arch}-${id}.node`));
}
}
}
export const js2xml = data => xmljs.js2xml(data, { compact: true, spaces: 4 });
export const xml2js = xml => xmljs.xml2js(xml, { compact: true });
item.replace(/src\/website\/src\/releases\/(.*?)\/(.*?)\.html/i, '$2')
);
releases.forEach(release => {
urls.push({
loc: {
_text: baseUrl + release,
},
changefreq: {
_text: 'daily',
},
});
});
sitemap.urlset.url = urls;
fs.writeFileSync(sitemapPath, converter.js2xml(sitemap, { compact: true, spaces: 4 }), { encoding: 'utf8' });
}
case 'integer':
case 'unsignedInt':
case 'positiveInt':
addExtra(value, index);
if (value.attributes['value']) {
if (obj[property._name] instanceof Array) {
obj[property._name].push(toNumber(value.attributes['value']))
} else {
obj[property._name] = toNumber(value.attributes['value'])
}
}
break;
case 'xhtml':
if (value.elements && value.elements.length > 0) {
const div = convert.js2xml({elements: [XmlHelper.escapeInvalidCharacters(value)]});
if (obj[property._name] instanceof Array) {
obj[property._name].push(div);
} else {
obj[property._name] = div;
}
}
break;
case 'Element':
case 'BackboneElement':
const newValue = {};
for (let x in property._properties) {
const nextProperty = property._properties[x];
this.propertyToJS(value, newValue, nextProperty, surroundDecimalsWith);
}
return new Bluebird((resolve, reject) => {
const read = str(
convert.js2xml(result, {
spaces: 4,
}),
);
read.pipe(stream);
read.on('end', () => {
resolve(options.output);
});
read.on('error', reject);
});
}
ConvertToXml.prototype.convert = function (obj) {
if (obj.hasOwnProperty('resourceType')) {
var xmlObj = this.resourceToXML(obj);
return convert.js2xml(xmlObj);
}
};
ConvertToXml.prototype.resourceToXML = function (obj, xmlObj) {