fix(core): update
This commit is contained in:
parent
87cdc5bb5f
commit
17d8cd6585
11
package-lock.json
generated
11
package-lock.json
generated
@ -1566,7 +1566,6 @@
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartjson/-/smartjson-4.0.5.tgz",
|
||||
"integrity": "sha512-i4kBjZSbs1t8swcAPEdPkDJHci2higzvMIkNUKTgXWrcxUFMuOis/B5huUnnIqg/Td8R+mAdf/B/CMfgjABTlg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/buffer-json": "^2.0.0",
|
||||
"@types/fast-json-stable-stringify": "^2.0.0",
|
||||
@ -2033,7 +2032,6 @@
|
||||
"version": "2.0.13",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fwebrequest/-/webrequest-2.0.13.tgz",
|
||||
"integrity": "sha512-FNRthRBrBmc3Eu+NRkVrPudbmWMphph/Y15feHo7tUj7Y4MhP0uSy2/95vM3b5LcXQldOEH3GA9SB7VYJ1+VPw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/smartdelay": "^2.0.10",
|
||||
"@pushrocks/smartenv": "^4.0.15",
|
||||
@ -2156,8 +2154,7 @@
|
||||
"@types/buffer-json": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fbuffer-json/-/buffer-json-2.0.0.tgz",
|
||||
"integrity": "sha512-nFKOrY93Tvv5Tobws+YbkGlPOJsn1nVpZah3BlSyQ4EniFm97KLvSr54tZ5xQp8mlf/XxbYwskNCYQB9EdrPlQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-nFKOrY93Tvv5Tobws+YbkGlPOJsn1nVpZah3BlSyQ4EniFm97KLvSr54tZ5xQp8mlf/XxbYwskNCYQB9EdrPlQ=="
|
||||
},
|
||||
"@types/chai": {
|
||||
"version": "4.2.14",
|
||||
@ -3218,8 +3215,7 @@
|
||||
"buffer-json": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/buffer-json/-/buffer-json-2.0.0.tgz",
|
||||
"integrity": "sha512-+jjPFVqyfF1esi9fvfUs3NqM0pH1ziZ36VP4hmA/y/Ssfo/5w5xHKfTw9BwQjoJ1w/oVtpLomqwUHKdefGyuHw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-+jjPFVqyfF1esi9fvfUs3NqM0pH1ziZ36VP4hmA/y/Ssfo/5w5xHKfTw9BwQjoJ1w/oVtpLomqwUHKdefGyuHw=="
|
||||
},
|
||||
"buffer-xor": {
|
||||
"version": "1.0.3",
|
||||
@ -7526,8 +7522,7 @@
|
||||
"node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://verdaccio.lossless.one/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
|
||||
},
|
||||
"node-forge": {
|
||||
"version": "0.7.6",
|
||||
|
@ -25,6 +25,7 @@
|
||||
"@pushrocks/smartfeed": "^1.0.5",
|
||||
"@pushrocks/smartxml": "^1.0.6",
|
||||
"@pushrocks/smartyaml": "^2.0.5",
|
||||
"@pushrocks/webrequest": "^2.0.13",
|
||||
"@tsclass/tsclass": "^3.0.25"
|
||||
},
|
||||
"browserslist": [
|
||||
|
@ -13,4 +13,9 @@ tap.test('should create a sitemap from feed', async () => {
|
||||
console.log(sitemapString);
|
||||
});
|
||||
|
||||
tap.test('should parse a sitemap', async () => {
|
||||
const result = await testSmartsitemap.parseSitemapUrl('https://www.theverge.com/sitemaps');
|
||||
console.log(result.sitemapindex.sitemap);
|
||||
})
|
||||
|
||||
tap.start();
|
||||
|
@ -59,4 +59,23 @@ export class SmartSitemap {
|
||||
}
|
||||
return sitemapWebsite.exportSitemapXml();
|
||||
}
|
||||
|
||||
/**
|
||||
* parses a sitemap url
|
||||
*/
|
||||
public async parseSitemapUrl(urlArg: string) {
|
||||
const sitemapXml = await (await (new plugins.webrequest.WebRequest()).request(urlArg, {
|
||||
method: 'GET'
|
||||
})).text();
|
||||
|
||||
const parsedSitemap = await this.parseSitemap(sitemapXml);
|
||||
return parsedSitemap;
|
||||
}
|
||||
|
||||
/**
|
||||
* parses a sitemap
|
||||
*/
|
||||
public async parseSitemap(sitemapXmlArg: string) {
|
||||
return (new plugins.smartxml.SmartXml()).parseXmlToObject(sitemapXmlArg);
|
||||
}
|
||||
}
|
||||
|
@ -3,12 +3,14 @@ import * as smartcache from '@pushrocks/smartcache';
|
||||
import * as smartfeed from '@pushrocks/smartfeed';
|
||||
import * as smartxml from '@pushrocks/smartxml';
|
||||
import * as smartyaml from '@pushrocks/smartyaml';
|
||||
import * as webrequest from '@pushrocks/webrequest';
|
||||
|
||||
export {
|
||||
smartcache,
|
||||
smartfeed,
|
||||
smartxml,
|
||||
smartyaml
|
||||
smartyaml,
|
||||
webrequest
|
||||
};
|
||||
|
||||
// tsclass
|
||||
|
Loading…
Reference in New Issue
Block a user