Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
const {
AppServerModuleNgFactory,
LAZY_MODULE_MAP
} = require("./dist/server/main");
// Path is relative to dist/ directory where it runs
const BROWSER_FOLDER = join(process.cwd(), "browser");
const OUTPUT_FOLDER = join(process.cwd(), argv.directory);
const SRC_FOLDER = join(process.cwd(), '../', 'src');
// Load the index.html file containing referances to your application bundle.
const index = readFileSync(join("browser", "index.html"), "utf8");
// Load the sitemap to know the list of urls to render
const sitemapFile = readFileSync(join(process.cwd(), "browser", "sitemap.xml"), {encoding: 'utf8'});
const sitemap = converter.xml2js(sitemapFile, {compact: true});
// Build an array of routes and paths, only render the current version docs
const urls = sitemap.urlset.url
.filter(item => {
// Filter out the docs from other versions
if (item.loc._text.indexOf('/documentation/') > -1 && item.loc._text.indexOf('/documentation/' + environment.version) === -1) {
return false;
}
return true;
})
.map(item => {
const url = parse(item.loc._text);
const route = url.pathname.replace("clarity/", "");
const fullPath = join(BROWSER_FOLDER, route);
// Make sure the directory structure is there
var readXml = function (input, options) {
var data, output;
// Validate XML
try {
data = xml_js_1.xml2js(input, {
spaces: 4,
compact: true
});
}
catch (error) {
throw error;
}
var inputScope = (typeof data.snippet.scope['_text'] !== 'undefined') ? data.snippet.scope['_text'] : null;
var scope = options.scope ? options.scope : inputScope;
// Minimum requirements
if (typeof data.snippet.content._cdata === 'undefined') {
return console.warn('This doesn\'t seem to be a valid Sublime Text snippet file. Aborting.');
}
// Get scope, convert if necessary
output = {};
if (scope !== null) {
export async function readXml(
zip: JSZip,
filepath: string
): Promise {
const file = await getCaseInsensitveFile(zip, filepath);
if (file == null) {
return null;
}
const text = await file.async("text");
// @ts-ignore Due to the way it's config object interface works, xml2js is
// bascially impossible to type. For example, you can specify what key to use
// for `elements`. We choose `children` but the types assume the default
// `elements`.
return xml2js(text, { compact: false, elementsKey: "children" });
}
async getInfo() {
try {
const message = soap.getInfo(this.sessionId);
const result = await this._makeRequest(soap.action.getInfo, message);
// const patchedBody = patchBody(result.body);
// parse xml to json object
const parseOptions = {
compact: true, ignoreDeclaration: true, ignoreAttributes: true, spaces: 2,
};
const rawJson = parseXml.xml2js(result.body, parseOptions);
const entries = rawJson['v:Envelope']['v:Body']['m:GetInfoResponse'];
const info = {};
Object.keys(entries).forEach((property) => {
if (Object.prototype.hasOwnProperty.call(entries, property)) {
info[property] = entries[property]._text;
}
});
return Promise.resolve(info);
} catch (error) {
return Promise.reject(error);
}
}
async parseNxml(url) {
const {data: nxml} = await this.axios.get(url, {
headers: {
Referer: this.referer
}
});
const xml = nxml.replace(/^.*?\('/, '').replace(/'\);$/, '');
const root = xml2js(xml);
const parseObject = (parsed, object) => {
if(!parsed.elements) return;
parsed.elements.forEach(v => {
let result = undefined;
switch(v.name) {
case 'object':
result = parseObject(v, {});
break;
case 'number':
result = parseFloat(v.attributes.value);
break;
buildcop.findFailures = (xml: string): TestFailure[] => {
const obj = xmljs.xml2js(xml);
const failures: TestFailure[] = [];
for (const suites of obj.elements) {
if (suites.name !== 'testsuites') {
continue;
}
for (const suite of suites.elements) {
if (suite.name !== 'testsuite') {
continue;
}
const testsuiteName = suite.attributes.name;
for (const testcase of suite.elements) {
if (testcase.name !== 'testcase') {
continue;
}
if (testcase.elements === undefined) {
continue;
}, function(error, response, indexers) {
if (!error && indexers) {
indexers = xmlJs.xml2js(indexers)
if (indexers && indexers.elements && indexers.elements[0] && indexers.elements[0].elements) {
indexers = indexers.elements[0].elements
cb(null, indexers)
} else {
cb(new Error('No Indexers'))
}
} else {
cb(error || new Error('No Indexers'))
}
})
}
async function getJSONResponse(url) {
const results = await fetch(url, {
headers: { 'X-Requested-With': 'XMLHttpRequest' },
});
const data = await results.text();
const json = convert.xml2js(data, {
compact: true,
ignoreDeclaration: true,
ignoreDoctype: true,
ignoreInstruction: true,
ignoreComment: true,
ignoreCdata: true,
});
return json.GoodreadsResponse;
}
map(xmlRss => {
const xml: ElementCompact = xml2js(xmlRss, { compact: true });
return xml.rss.channel.item.map(
(item: ElementCompact) =>
new NewsItemOSRS(
item.title._text,
item.pubDate._text,
item.link._text,
item.description._text,
{
link: item.enclosure._attributes.url,
type: item.enclosure._attributes.type,
},
[item.category._text]
)
);
}),
tap(news => this.storageService.setValue(StorageKey.CacheOsrsNews, news))
export default async function modifyManifest(path: string) {
const fileXml = xml.xml2js(
await fs.readFile(path, 'utf-8'),
{ compact: true, alwaysArray: true },
)
const manifest = fileXml['manifest'][0]
const application = manifest['application'][0]
application._attributes['android:debuggable'] = 'true'
let nscName = 'network_security_config'
const nscReference: string = application._attributes['android:networkSecurityConfig']
if (nscReference && nscReference.startsWith('@xml/')) {
nscName = nscReference.slice(5)
} else {
application._attributes['android:networkSecurityConfig'] = `@xml/${nscName}`
}