Comparing version 7.0.0 to 7.1.0
# Changelog | ||
## 7.1.0 | ||
- bumped types dependency for node | ||
- bumped all dev dependencies - includes some prettier changes | ||
- package-lock updated to version 2 | ||
## 7.0.0 | ||
@@ -4,0 +10,0 @@ |
@@ -20,3 +20,3 @@ #!/usr/bin/env node | ||
else { | ||
return fs_1.createReadStream(argv._[0], { encoding: 'utf8' }); | ||
return (0, fs_1.createReadStream)(argv._[0], { encoding: 'utf8' }); | ||
} | ||
@@ -40,3 +40,3 @@ }; | ||
if (argv._ && argv._.length) { | ||
return fs_1.createReadStream(argv._[0]); | ||
return (0, fs_1.createReadStream)(argv._[0]); | ||
} | ||
@@ -88,3 +88,3 @@ else { | ||
if (argv['--gzip']) { | ||
oStream = oStream.pipe(zlib_1.createGzip()); | ||
oStream = oStream.pipe((0, zlib_1.createGzip)()); | ||
} | ||
@@ -94,3 +94,3 @@ oStream.pipe(process.stdout); | ||
else if (argv['--validate']) { | ||
xmllint_1.xmlLint(getStream()) | ||
(0, xmllint_1.xmlLint)(getStream()) | ||
.then(() => console.log('valid')) | ||
@@ -120,6 +120,6 @@ .catch(([error, stderr]) => { | ||
if (argv['--gzip']) { | ||
ws = sm.pipe(zlib_1.createGzip()).pipe(fs_1.createWriteStream(path)); | ||
ws = sm.pipe((0, zlib_1.createGzip)()).pipe((0, fs_1.createWriteStream)(path)); | ||
} | ||
else { | ||
ws = sm.pipe(fs_1.createWriteStream(path)); | ||
ws = sm.pipe((0, fs_1.createWriteStream)(path)); | ||
} | ||
@@ -129,5 +129,5 @@ return [new url_1.URL(path, baseURL).toString(), sm, ws]; | ||
}); | ||
let oStream = utils_1.lineSeparatedURLsToSitemapOptions(pickStreamOrArg(argv)).pipe(sms); | ||
let oStream = (0, utils_1.lineSeparatedURLsToSitemapOptions)(pickStreamOrArg(argv)).pipe(sms); | ||
if (argv['--gzip']) { | ||
oStream = oStream.pipe(zlib_1.createGzip()); | ||
oStream = oStream.pipe((0, zlib_1.createGzip)()); | ||
} | ||
@@ -139,9 +139,9 @@ oStream.pipe(process.stdout); | ||
if (argv['--prepend']) { | ||
fs_1.createReadStream(argv['--prepend']) | ||
(0, fs_1.createReadStream)(argv['--prepend']) | ||
.pipe(new sitemap_parser_1.XMLToSitemapItemStream()) | ||
.pipe(sms); | ||
} | ||
const oStream = utils_1.lineSeparatedURLsToSitemapOptions(pickStreamOrArg(argv)).pipe(sms); | ||
const oStream = (0, utils_1.lineSeparatedURLsToSitemapOptions)(pickStreamOrArg(argv)).pipe(sms); | ||
if (argv['--gzip']) { | ||
oStream.pipe(zlib_1.createGzip()).pipe(process.stdout); | ||
oStream.pipe((0, zlib_1.createGzip)()).pipe(process.stdout); | ||
} | ||
@@ -148,0 +148,0 @@ else { |
@@ -32,17 +32,17 @@ "use strict"; | ||
if (this.xslUrl) { | ||
stylesheet = sitemap_stream_1.stylesheetInclude(this.xslUrl); | ||
stylesheet = (0, sitemap_stream_1.stylesheetInclude)(this.xslUrl); | ||
} | ||
this.push(xmlDec + stylesheet + sitemapIndexTagStart); | ||
} | ||
this.push(sitemap_xml_1.otag(IndexTagNames.sitemap)); | ||
this.push((0, sitemap_xml_1.otag)(IndexTagNames.sitemap)); | ||
if (typeof item === 'string') { | ||
this.push(sitemap_xml_1.element(IndexTagNames.loc, item)); | ||
this.push((0, sitemap_xml_1.element)(IndexTagNames.loc, item)); | ||
} | ||
else { | ||
this.push(sitemap_xml_1.element(IndexTagNames.loc, item.url)); | ||
this.push((0, sitemap_xml_1.element)(IndexTagNames.loc, item.url)); | ||
if (item.lastmod) { | ||
this.push(sitemap_xml_1.element(IndexTagNames.lastmod, new Date(item.lastmod).toISOString())); | ||
this.push((0, sitemap_xml_1.element)(IndexTagNames.lastmod, new Date(item.lastmod).toISOString())); | ||
} | ||
} | ||
this.push(sitemap_xml_1.ctag(IndexTagNames.sitemap)); | ||
this.push((0, sitemap_xml_1.ctag)(IndexTagNames.sitemap)); | ||
callback(); | ||
@@ -64,7 +64,4 @@ } | ||
this.getSitemapStream = opts.getSitemapStream; | ||
[ | ||
this.idxItem, | ||
this.currentSitemap, | ||
this.currentSitemapPipeline, | ||
] = this.getSitemapStream(0); | ||
[this.idxItem, this.currentSitemap, this.currentSitemapPipeline] = | ||
this.getSitemapStream(0); | ||
this.limit = (_a = opts.limit) !== null && _a !== void 0 ? _a : 45000; | ||
@@ -84,3 +81,3 @@ } | ||
const onFinish = () => { | ||
const [idxItem, currentSitemap, currentSitemapPipeline,] = this.getSitemapStream(this.i / this.limit); | ||
const [idxItem, currentSitemap, currentSitemapPipeline] = this.getSitemapStream(this.i / this.limit); | ||
this.currentSitemap = currentSitemap; | ||
@@ -87,0 +84,0 @@ this.currentSitemapPipeline = currentSitemapPipeline; |
@@ -43,28 +43,28 @@ "use strict"; | ||
_transform(item, encoding, callback) { | ||
this.push(sitemap_xml_1.otag(types_1.TagNames.url)); | ||
this.push(sitemap_xml_1.element(types_1.TagNames.loc, item.url)); | ||
this.push((0, sitemap_xml_1.otag)(types_1.TagNames.url)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames.loc, item.url)); | ||
if (item.lastmod) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames.lastmod, item.lastmod)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames.lastmod, item.lastmod)); | ||
} | ||
if (item.changefreq) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames.changefreq, item.changefreq)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames.changefreq, item.changefreq)); | ||
} | ||
if (item.priority !== undefined) { | ||
if (item.priority !== undefined && item.priority !== null) { | ||
if (item.fullPrecisionPriority) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames.priority, item.priority.toString())); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames.priority, item.priority.toString())); | ||
} | ||
else { | ||
this.push(sitemap_xml_1.element(types_1.TagNames.priority, item.priority.toFixed(1))); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames.priority, item.priority.toFixed(1))); | ||
} | ||
} | ||
item.video.forEach((video) => { | ||
this.push(sitemap_xml_1.otag(types_1.TagNames['video:video'])); | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:thumbnail_loc'], video.thumbnail_loc)); | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:title'], video.title)); | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:description'], video.description)); | ||
this.push((0, sitemap_xml_1.otag)(types_1.TagNames['video:video'])); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:thumbnail_loc'], video.thumbnail_loc)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:title'], video.title)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:description'], video.description)); | ||
if (video.content_loc) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:content_loc'], video.content_loc)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:content_loc'], video.content_loc)); | ||
} | ||
if (video.player_loc) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:player_loc'], attrBuilder(video, [ | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:player_loc'], attrBuilder(video, [ | ||
'player_loc:autoplay', | ||
@@ -75,33 +75,33 @@ 'player_loc:allow_embed', | ||
if (video.duration) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:duration'], video.duration.toString())); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:duration'], video.duration.toString())); | ||
} | ||
if (video.expiration_date) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:expiration_date'], video.expiration_date)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:expiration_date'], video.expiration_date)); | ||
} | ||
if (video.rating !== undefined) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:rating'], video.rating.toString())); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:rating'], video.rating.toString())); | ||
} | ||
if (video.view_count !== undefined) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:view_count'], video.view_count.toString())); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:view_count'], video.view_count.toString())); | ||
} | ||
if (video.publication_date) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:publication_date'], video.publication_date)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:publication_date'], video.publication_date)); | ||
} | ||
for (const tag of video.tag) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:tag'], tag)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:tag'], tag)); | ||
} | ||
if (video.category) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:category'], video.category)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:category'], video.category)); | ||
} | ||
if (video.family_friendly) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:family_friendly'], video.family_friendly)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:family_friendly'], video.family_friendly)); | ||
} | ||
if (video.restriction) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:restriction'], attrBuilder(video, 'restriction:relationship'), video.restriction)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:restriction'], attrBuilder(video, 'restriction:relationship'), video.restriction)); | ||
} | ||
if (video.gallery_loc) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:gallery_loc'], { title: video['gallery_loc:title'] }, video.gallery_loc)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:gallery_loc'], { title: video['gallery_loc:title'] }, video.gallery_loc)); | ||
} | ||
if (video.price) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:price'], attrBuilder(video, [ | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:price'], attrBuilder(video, [ | ||
'price:resolution', | ||
@@ -113,20 +113,20 @@ 'price:currency', | ||
if (video.requires_subscription) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:requires_subscription'], video.requires_subscription)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:requires_subscription'], video.requires_subscription)); | ||
} | ||
if (video.uploader) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:uploader'], attrBuilder(video, 'uploader:info'), video.uploader)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:uploader'], attrBuilder(video, 'uploader:info'), video.uploader)); | ||
} | ||
if (video.platform) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:platform'], attrBuilder(video, 'platform:relationship'), video.platform)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:platform'], attrBuilder(video, 'platform:relationship'), video.platform)); | ||
} | ||
if (video.live) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:live'], video.live)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:live'], video.live)); | ||
} | ||
if (video.id) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['video:id'], { type: 'url' }, video.id)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['video:id'], { type: 'url' }, video.id)); | ||
} | ||
this.push(sitemap_xml_1.ctag(types_1.TagNames['video:video'])); | ||
this.push((0, sitemap_xml_1.ctag)(types_1.TagNames['video:video'])); | ||
}); | ||
item.links.forEach((link) => { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['xhtml:link'], { | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['xhtml:link'], { | ||
rel: 'alternate', | ||
@@ -138,6 +138,6 @@ hreflang: link.lang || link.hreflang, | ||
if (item.expires) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames.expires, new Date(item.expires).toISOString())); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames.expires, new Date(item.expires).toISOString())); | ||
} | ||
if (item.androidLink) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['xhtml:link'], { | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['xhtml:link'], { | ||
rel: 'alternate', | ||
@@ -148,3 +148,3 @@ href: item.androidLink, | ||
if (item.ampLink) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['xhtml:link'], { | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['xhtml:link'], { | ||
rel: 'amphtml', | ||
@@ -155,42 +155,42 @@ href: item.ampLink, | ||
if (item.news) { | ||
this.push(sitemap_xml_1.otag(types_1.TagNames['news:news'])); | ||
this.push(sitemap_xml_1.otag(types_1.TagNames['news:publication'])); | ||
this.push(sitemap_xml_1.element(types_1.TagNames['news:name'], item.news.publication.name)); | ||
this.push(sitemap_xml_1.element(types_1.TagNames['news:language'], item.news.publication.language)); | ||
this.push(sitemap_xml_1.ctag(types_1.TagNames['news:publication'])); | ||
this.push((0, sitemap_xml_1.otag)(types_1.TagNames['news:news'])); | ||
this.push((0, sitemap_xml_1.otag)(types_1.TagNames['news:publication'])); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['news:name'], item.news.publication.name)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['news:language'], item.news.publication.language)); | ||
this.push((0, sitemap_xml_1.ctag)(types_1.TagNames['news:publication'])); | ||
if (item.news.access) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['news:access'], item.news.access)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['news:access'], item.news.access)); | ||
} | ||
if (item.news.genres) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['news:genres'], item.news.genres)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['news:genres'], item.news.genres)); | ||
} | ||
this.push(sitemap_xml_1.element(types_1.TagNames['news:publication_date'], item.news.publication_date)); | ||
this.push(sitemap_xml_1.element(types_1.TagNames['news:title'], item.news.title)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['news:publication_date'], item.news.publication_date)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['news:title'], item.news.title)); | ||
if (item.news.keywords) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['news:keywords'], item.news.keywords)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['news:keywords'], item.news.keywords)); | ||
} | ||
if (item.news.stock_tickers) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['news:stock_tickers'], item.news.stock_tickers)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['news:stock_tickers'], item.news.stock_tickers)); | ||
} | ||
this.push(sitemap_xml_1.ctag(types_1.TagNames['news:news'])); | ||
this.push((0, sitemap_xml_1.ctag)(types_1.TagNames['news:news'])); | ||
} | ||
// Image handling | ||
item.img.forEach((image) => { | ||
this.push(sitemap_xml_1.otag(types_1.TagNames['image:image'])); | ||
this.push(sitemap_xml_1.element(types_1.TagNames['image:loc'], image.url)); | ||
this.push((0, sitemap_xml_1.otag)(types_1.TagNames['image:image'])); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['image:loc'], image.url)); | ||
if (image.caption) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['image:caption'], image.caption)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['image:caption'], image.caption)); | ||
} | ||
if (image.geoLocation) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['image:geo_location'], image.geoLocation)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['image:geo_location'], image.geoLocation)); | ||
} | ||
if (image.title) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['image:title'], image.title)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['image:title'], image.title)); | ||
} | ||
if (image.license) { | ||
this.push(sitemap_xml_1.element(types_1.TagNames['image:license'], image.license)); | ||
this.push((0, sitemap_xml_1.element)(types_1.TagNames['image:license'], image.license)); | ||
} | ||
this.push(sitemap_xml_1.ctag(types_1.TagNames['image:image'])); | ||
this.push((0, sitemap_xml_1.ctag)(types_1.TagNames['image:image'])); | ||
}); | ||
this.push(sitemap_xml_1.ctag(types_1.TagNames.url)); | ||
this.push((0, sitemap_xml_1.ctag)(types_1.TagNames.url)); | ||
callback(); | ||
@@ -197,0 +197,0 @@ } |
@@ -123,3 +123,3 @@ "use strict"; | ||
case types_1.TagNames.changefreq: | ||
if (types_1.isValidChangeFreq(text)) { | ||
if ((0, types_1.isValidChangeFreq)(text)) { | ||
currentItem.changefreq = text; | ||
@@ -150,3 +150,3 @@ } | ||
case types_1.TagNames['video:requires_subscription']: | ||
if (types_1.isValidYesNo(text)) { | ||
if ((0, types_1.isValidYesNo)(text)) { | ||
currentVideo.requires_subscription = text; | ||
@@ -171,3 +171,3 @@ } | ||
case types_1.TagNames['video:family_friendly']: | ||
if (types_1.isValidYesNo(text)) { | ||
if ((0, types_1.isValidYesNo)(text)) { | ||
currentVideo.family_friendly = text; | ||
@@ -192,3 +192,3 @@ } | ||
case types_1.TagNames['video:live']: | ||
if (types_1.isValidYesNo(text)) { | ||
if ((0, types_1.isValidYesNo)(text)) { | ||
currentVideo.live = text; | ||
@@ -332,3 +332,3 @@ } | ||
case types_1.TagNames['video:restriction']: | ||
if (attr.name === 'relationship' && types_1.isAllowDeny(attr.value)) { | ||
if (attr.name === 'relationship' && (0, types_1.isAllowDeny)(attr.value)) { | ||
currentVideo['restriction:relationship'] = attr.value; | ||
@@ -341,3 +341,3 @@ } | ||
case types_1.TagNames['video:price']: | ||
if (attr.name === 'type' && types_1.isPriceType(attr.value)) { | ||
if (attr.name === 'type' && (0, types_1.isPriceType)(attr.value)) { | ||
currentVideo['price:type'] = attr.value; | ||
@@ -348,3 +348,3 @@ } | ||
} | ||
else if (attr.name === 'resolution' && types_1.isResolution(attr.value)) { | ||
else if (attr.name === 'resolution' && (0, types_1.isResolution)(attr.value)) { | ||
currentVideo['price:resolution'] = attr.value; | ||
@@ -360,3 +360,3 @@ } | ||
} | ||
else if (attr.name === 'allow_embed' && types_1.isValidYesNo(attr.value)) { | ||
else if (attr.name === 'allow_embed' && (0, types_1.isValidYesNo)(attr.value)) { | ||
currentVideo['player_loc:allow_embed'] = attr.value; | ||
@@ -369,3 +369,3 @@ } | ||
case types_1.TagNames['video:platform']: | ||
if (attr.name === 'relationship' && types_1.isAllowDeny(attr.value)) { | ||
if (attr.name === 'relationship' && (0, types_1.isAllowDeny)(attr.value)) { | ||
currentVideo['platform:relationship'] = attr.value; | ||
@@ -372,0 +372,0 @@ } |
@@ -11,3 +11,3 @@ "use strict"; | ||
const url_1 = require("url"); | ||
const pipeline = util_1.promisify(stream_1.pipeline); | ||
const pipeline = (0, util_1.promisify)(stream_1.pipeline); | ||
/** | ||
@@ -38,15 +38,15 @@ * | ||
const path = `./sitemap-${i}.xml`; | ||
const writePath = path_1.resolve(destinationDir, path + (gzip ? '.gz' : '')); | ||
const writePath = (0, path_1.resolve)(destinationDir, path + (gzip ? '.gz' : '')); | ||
if (!publicBasePath.endsWith('/')) { | ||
publicBasePath += '/'; | ||
} | ||
const publicPath = path_1.normalize(publicBasePath + path); | ||
const publicPath = (0, path_1.normalize)(publicBasePath + path); | ||
let pipeline; | ||
if (gzip) { | ||
pipeline = sitemapStream | ||
.pipe(zlib_1.createGzip()) // compress the output of the sitemap | ||
.pipe(fs_1.createWriteStream(writePath)); // write it to sitemap-NUMBER.xml | ||
.pipe((0, zlib_1.createGzip)()) // compress the output of the sitemap | ||
.pipe((0, fs_1.createWriteStream)(writePath)); // write it to sitemap-NUMBER.xml | ||
} | ||
else { | ||
pipeline = sitemapStream.pipe(fs_1.createWriteStream(writePath)); // write it to sitemap-NUMBER.xml | ||
pipeline = sitemapStream.pipe((0, fs_1.createWriteStream)(writePath)); // write it to sitemap-NUMBER.xml | ||
} | ||
@@ -62,3 +62,3 @@ return [ | ||
if (typeof sourceData === 'string') { | ||
src = index_1.lineSeparatedURLsToSitemapOptions(fs_1.createReadStream(sourceData)); | ||
src = (0, index_1.lineSeparatedURLsToSitemapOptions)((0, fs_1.createReadStream)(sourceData)); | ||
} | ||
@@ -74,8 +74,8 @@ else if (sourceData instanceof stream_1.Readable) { | ||
} | ||
const writePath = path_1.resolve(destinationDir, `./sitemap-index.xml${gzip ? '.gz' : ''}`); | ||
const writePath = (0, path_1.resolve)(destinationDir, `./sitemap-index.xml${gzip ? '.gz' : ''}`); | ||
if (gzip) { | ||
return pipeline(src, sitemapAndIndexStream, zlib_1.createGzip(), fs_1.createWriteStream(writePath)); | ||
return pipeline(src, sitemapAndIndexStream, (0, zlib_1.createGzip)(), (0, fs_1.createWriteStream)(writePath)); | ||
} | ||
else { | ||
return pipeline(src, sitemapAndIndexStream, fs_1.createWriteStream(writePath)); | ||
return pipeline(src, sitemapAndIndexStream, (0, fs_1.createWriteStream)(writePath)); | ||
} | ||
@@ -82,0 +82,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.streamToPromise = exports.SitemapStream = exports.closetag = exports.stylesheetInclude = void 0; | ||
const url_1 = require("url"); | ||
const stream_1 = require("stream"); | ||
@@ -12,4 +11,2 @@ const types_1 = require("./types"); | ||
const stylesheetInclude = (url) => { | ||
// Throws if url is invalid | ||
new url_1.URL(url); | ||
return `<?xml-stylesheet type="text/xsl" href="${url}"?>`; | ||
@@ -22,3 +19,3 @@ }; | ||
if (xslURL) { | ||
ns += exports.stylesheetInclude(xslURL); | ||
ns += (0, exports.stylesheetInclude)(xslURL); | ||
} | ||
@@ -79,3 +76,3 @@ ns += urlsetTagStart; | ||
} | ||
this.smiStream.write(utils_1.validateSMIOptions(utils_1.normalizeURL(item, this.hostname, this.lastmodDateOnly), this.level, this.errorHandler)); | ||
this.smiStream.write((0, utils_1.validateSMIOptions)((0, utils_1.normalizeURL)(item, this.hostname, this.lastmodDateOnly), this.level, this.errorHandler)); | ||
callback(); | ||
@@ -82,0 +79,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.element = exports.ctag = exports.otag = exports.text = void 0; | ||
const invalidXMLUnicodeRegex = | ||
// eslint-disable-next-line no-control-regex | ||
const invalidXMLUnicodeRegex = /[\u0001-\u0008\u000B\u000C\u000E-\u001F\u007F-\u0084\u0086-\u009F\uD800-\uDFFF\uFDD0-\uFDDF\u{1FFFE}-\u{1FFFF}\u{2FFFE}-\u{2FFFF}\u{3FFFE}-\u{3FFFF}\u{4FFFE}-\u{4FFFF}\u{5FFFE}-\u{5FFFF}\u{6FFFE}-\u{6FFFF}\u{7FFFE}-\u{7FFFF}\u{8FFFE}-\u{8FFFF}\u{9FFFE}-\u{9FFFF}\u{AFFFE}-\u{AFFFF}\u{BFFFE}-\u{BFFFF}\u{CFFFE}-\u{CFFFF}\u{DFFFE}-\u{DFFFF}\u{EFFFE}-\u{EFFFF}\u{FFFFE}-\u{FFFFF}\u{10FFFE}-\u{10FFFF}]/gu; | ||
/[\u0001-\u0008\u000B\u000C\u000E-\u001F\u007F-\u0084\u0086-\u009F\uD800-\uDFFF\uFDD0-\uFDDF\u{1FFFE}-\u{1FFFF}\u{2FFFE}-\u{2FFFF}\u{3FFFE}-\u{3FFFF}\u{4FFFE}-\u{4FFFF}\u{5FFFE}-\u{5FFFF}\u{6FFFE}-\u{6FFFF}\u{7FFFE}-\u{7FFFF}\u{8FFFE}-\u{8FFFF}\u{9FFFE}-\u{9FFFF}\u{AFFFE}-\u{AFFFF}\u{BFFFE}-\u{BFFFF}\u{CFFFE}-\u{CFFFF}\u{DFFFE}-\u{DFFFF}\u{EFFFE}-\u{EFFFF}\u{FFFFE}-\u{FFFFF}\u{10FFFE}-\u{10FFFF}]/gu; | ||
const amp = /&/g; | ||
@@ -7,0 +8,0 @@ const lt = /</g; |
@@ -387,2 +387,8 @@ /// <reference types="node" /> | ||
} | ||
export declare enum IndexTagNames { | ||
sitemap = "sitemap", | ||
sitemapindex = "sitemapindex", | ||
loc = "loc", | ||
lastmod = "lastmod" | ||
} | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TagNames = exports.ErrorLevel = exports.isAllowDeny = exports.EnumAllowDeny = exports.isValidYesNo = exports.EnumYesNo = exports.isValidChangeFreq = exports.CHANGEFREQ = exports.isResolution = exports.isPriceType = exports.validators = exports.EnumChangefreq = void 0; | ||
exports.IndexTagNames = exports.TagNames = exports.ErrorLevel = exports.isAllowDeny = exports.EnumAllowDeny = exports.isValidYesNo = exports.EnumYesNo = exports.isValidChangeFreq = exports.CHANGEFREQ = exports.isResolution = exports.isPriceType = exports.validators = exports.EnumChangefreq = void 0; | ||
/** | ||
@@ -137,1 +137,8 @@ * How frequently the page is likely to change. This value provides general | ||
})(TagNames = exports.TagNames || (exports.TagNames = {})); | ||
var IndexTagNames; | ||
(function (IndexTagNames) { | ||
IndexTagNames["sitemap"] = "sitemap"; | ||
IndexTagNames["sitemapindex"] = "sitemapindex"; | ||
IndexTagNames["loc"] = "loc"; | ||
IndexTagNames["lastmod"] = "lastmod"; | ||
})(IndexTagNames = exports.IndexTagNames || (exports.IndexTagNames = {})); |
/// <reference types="node" /> | ||
import { Readable, ReadableOptions } from 'stream'; | ||
import { Readable, ReadableOptions, TransformOptions } from 'stream'; | ||
import { SitemapItem, ErrorLevel, SitemapItemLoose, ErrorHandler } from './types'; | ||
@@ -15,3 +15,3 @@ /** | ||
*/ | ||
export declare function mergeStreams(streams: Readable[]): Readable; | ||
export declare function mergeStreams(streams: Readable[], options?: TransformOptions): Readable; | ||
export interface ReadlineStreamOptions extends ReadableOptions { | ||
@@ -18,0 +18,0 @@ input: Readable; |
@@ -57,3 +57,3 @@ "use strict"; | ||
if (changefreq) { | ||
if (!types_1.isValidChangeFreq(changefreq)) { | ||
if (!(0, types_1.isValidChangeFreq)(changefreq)) { | ||
errorHandler(new errors_1.ChangeFreqInvalidError(url, changefreq), level); | ||
@@ -117,3 +117,3 @@ } | ||
if (vid.family_friendly !== undefined && | ||
!types_1.isValidYesNo(vid.family_friendly)) { | ||
!(0, types_1.isValidYesNo)(vid.family_friendly)) { | ||
errorHandler(new errors_1.InvalidVideoFamilyFriendly(url, vid.family_friendly), level); | ||
@@ -126,3 +126,3 @@ } | ||
if (!vid['restriction:relationship'] || | ||
!types_1.isAllowDeny(vid['restriction:relationship'])) { | ||
!(0, types_1.isAllowDeny)(vid['restriction:relationship'])) { | ||
errorHandler(new errors_1.InvalidVideoRestrictionRelationship(url, vid['restriction:relationship']), level); | ||
@@ -133,7 +133,7 @@ } | ||
if ((vid.price === '' && vid['price:type'] === undefined) || | ||
(vid['price:type'] !== undefined && !types_1.isPriceType(vid['price:type']))) { | ||
(vid['price:type'] !== undefined && !(0, types_1.isPriceType)(vid['price:type']))) { | ||
errorHandler(new errors_1.InvalidVideoPriceType(url, vid['price:type'], vid.price), level); | ||
} | ||
if (vid['price:resolution'] !== undefined && | ||
!types_1.isResolution(vid['price:resolution'])) { | ||
!(0, types_1.isResolution)(vid['price:resolution'])) { | ||
errorHandler(new errors_1.InvalidVideoResolution(url, vid['price:resolution']), level); | ||
@@ -155,4 +155,4 @@ } | ||
*/ | ||
function mergeStreams(streams) { | ||
let pass = new stream_1.PassThrough(); | ||
function mergeStreams(streams, options) { | ||
let pass = new stream_1.PassThrough(options); | ||
let waiting = streams.length; | ||
@@ -176,3 +176,3 @@ for (const stream of streams) { | ||
super(options); | ||
this._source = readline_1.createInterface({ | ||
this._source = (0, readline_1.createInterface)({ | ||
input: options.input, | ||
@@ -341,3 +341,3 @@ terminal: false, | ||
if (smiLoose.lastmodfile) { | ||
const { mtime } = fs_1.statSync(smiLoose.lastmodfile); | ||
const { mtime } = (0, fs_1.statSync)(smiLoose.lastmodfile); | ||
smi.lastmod = new Date(mtime).toISOString(); | ||
@@ -344,0 +344,0 @@ // The date of last modification (YYYY-MM-DD) |
@@ -15,3 +15,3 @@ "use strict"; | ||
'--schema', | ||
path_1.resolve(__dirname, '..', '..', 'schema', 'all.xsd'), | ||
(0, path_1.resolve)(__dirname, '..', '..', 'schema', 'all.xsd'), | ||
'--noout', | ||
@@ -24,3 +24,3 @@ '-', | ||
return new Promise((resolve, reject) => { | ||
child_process_1.execFile('which', ['xmllint'], (error, stdout, stderr) => { | ||
(0, child_process_1.execFile)('which', ['xmllint'], (error, stdout, stderr) => { | ||
if (error) { | ||
@@ -30,3 +30,3 @@ reject([new errors_1.XMLLintUnavailable()]); | ||
} | ||
const xmllint = child_process_1.execFile('xmllint', args, (error, stdout, stderr) => { | ||
const xmllint = (0, child_process_1.execFile)('xmllint', args, (error, stdout, stderr) => { | ||
if (error) { | ||
@@ -33,0 +33,0 @@ reject([error, stderr]); |
{ | ||
"name": "sitemap", | ||
"version": "7.0.0", | ||
"version": "7.1.0", | ||
"description": "Sitemap-generating lib/cli", | ||
@@ -28,2 +28,3 @@ "keywords": [ | ||
"build": "tsc", | ||
"prepare": "husky install", | ||
"prepublishOnly": "rm -rf dist && npm run test", | ||
@@ -37,7 +38,2 @@ "test": "eslint lib/* ./cli.ts && tsc && jest ./tests/sitemap*", | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged && npm run test" | ||
} | ||
}, | ||
"lint-staged": { | ||
@@ -156,3 +152,3 @@ "package.json": [ | ||
"dependencies": { | ||
"@types/node": "^15.0.1", | ||
"@types/node": "^17.0.5", | ||
"@types/sax": "^1.2.1", | ||
@@ -170,15 +166,17 @@ "arg": "^5.0.0", | ||
"@babel/preset-typescript": "^7.13.0", | ||
"@types/jest": "^26.0.23", | ||
"@typescript-eslint/eslint-plugin": "^4.22.0", | ||
"@typescript-eslint/parser": "^4.22.0", | ||
"@types/jest": "^27.4.0", | ||
"@types/memorystream": "^0.3.0", | ||
"@typescript-eslint/eslint-plugin": "^5.8.1", | ||
"@typescript-eslint/parser": "^5.8.1", | ||
"babel-eslint": "^10.1.0", | ||
"babel-polyfill": "^6.26.0", | ||
"eslint": "^7.25.0", | ||
"eslint": "^8.5.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-jest": "^24.3.6", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"eslint-plugin-jest": "^25.3.3", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"express": "^4.17.1", | ||
"husky": "^4.3.8", | ||
"jest": "^26.6.3", | ||
"lint-staged": "^10.5.4", | ||
"husky": "^7.0.0", | ||
"jest": "^27.4.5", | ||
"lint-staged": "^12.1.4", | ||
"memorystream": "^0.3.1", | ||
"prettier": "^2.2.1", | ||
@@ -185,0 +183,0 @@ "sort-package-json": "^1.49.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
158398
2766
29
32
+ Added@types/node@17.0.45(transitive)
- Removed@types/node@15.14.9(transitive)
Updated@types/node@^17.0.5