Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sitemap

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sitemap - npm Package Compare versions

Comparing version 5.0.1 to 5.1.0

176

CHANGELOG.md

@@ -1,4 +0,16 @@

# 5.0.1
# Changelog
Fix for issue #254. ```
## 5.1.0
Fix for #255. Baidu does not like timestamp in its sitemap.xml, this adds an option to truncate lastmod
```js
new SitemapStream({ lastmodDateOnly: true });
```
## 5.0.1
Fix for issue #254.
```sh
warning: failed to load external entity "./schema/all.xsd"

@@ -9,13 +21,20 @@ Schemas parser error : Failed to locate the main schema resource at './schema/all.xsd'.

# 5.0.0
## Streams
## 5.0.0
### Streams
This release is heavily focused on converting the core methods of this library to use streams. Why? Overall its made the API ~20% faster and uses only 10% or less of the memory. Some tradeoffs had to be made as in their nature streams are operate on individual segments of data as opposed to the whole. For instance, the streaming interface does not support removal of sitemap items as it does not hold on to a sitemap item after its converted to XML. It should however be possible to create your own transform that filters out entries should you desire it. The existing synchronous interfaces will remain for this release at least. Do not be surprised if they go away in a future breaking release.
## Sitemap Index
### Sitemap Index
This library interface has been overhauled to use streams internally. Although it would have been preferable to convert this to a stream as well, I could not think of an interface that wouldn't actually end up more complex or confusing. It may be altered in the near future to accept a stream in addition to a simple list.
## Misc
### Misc
- runnable examples, some pulled straight from README have been added to the examples directory.
- createSitemapsIndex was renamed createSitemapsAndIndex to more accurately reflect its function. It now returns a promise that resolves to true or throws with an error.
- You can now add to existing sitemap.xml files via the cli using `npx sitemap --prepend existingSitemap.xml < listOfNewURLs.json.txt`
## Breaking Changes
### Breaking Changes
- Dropped support for mobile sitemap - Google appears to have deleted their dtd and all references to it, strongly implying that they do not want you to use it. As its absence now breaks the validator, it has been dropped.

@@ -30,7 +49,8 @@ - normalizeURL(url, XMLRoot, hostname) -> normalizeURL(url, hostname)

- SitemapIndex as a class has been dropped. The class did all its work on construction and there was no reason to hold on to it once you created it.
- The options for the cli have been overhauled
- `--json` is now inferred
- The options for the cli have been overhauled
- `--json` is now inferred
- `--line-separated` has been flipped to `--single-line-json` to by default output options immediately compatible with feeding back into sitemap
# 4.1.1
## 4.1.1
Add a pretty print option to `toString(false)`

@@ -47,11 +67,13 @@ pass true pretty print

# 4.0.2
## 4.0.2
Fix npx script error - needs the shebang
# 4.0.1
## 4.0.1
Validation functions which depend on xmllint will now warn if you do not have xmllint installed.
# 4.0.0
## 4.0.0
This release is geared around overhauling the public api for this library. Many
This release is geared around overhauling the public api for this library. Many
options have been introduced over the years and this has lead to some inconsistencies

@@ -61,57 +83,73 @@ that make the library hard to use. Most have been cleaned up but a couple notable

- A new experimental CLI
- stream in a list of urls stream out xml
- validate your generated sitemap
- Sitemap video item now supports id element
- Several schema errors have been cleaned up.
- Docs have been updated and streamlined.
## breaking changes
- lastmod option parses all ISO8601 date-only strings as being in UTC rather than local time
- lastmodISO is deprecated as it is equivalent to lastmod
- lastmodfile now includes the file's time as well
- lastmodrealtime is no longer necessary
- The default export of sitemap lib is now just createSitemap
- Sitemap constructor now uses a object for its constructor
```
const { Sitemap } = require('sitemap');
const siteMap = new Sitemap({
urls = [],
hostname: 'https://example.com', // optional
cacheTime = 0,
xslUrl,
xmlNs,
level = 'warn'
})
```
- Sitemap no longer accepts a single string for its url
- Drop support for node 6
- Remove callback on toXML - This had no performance benefit
- Direct modification of urls property on Sitemap has been dropped. Use add/remove/contains
- When a Sitemap item is generated with invalid options it no longer throws by default
- instead it console warns.
- if you'd like to pre-verify your data the `validateSMIOptions` function is
now available
- To get the previous behavior pass level `createSitemap({...otheropts, level: 'throw' }) // ErrorLevel.THROW for TS users`
# 3.2.2
- revert https everywhere added in 3.2.0. xmlns is not url.
- adds alias for lastmod in the form of lastmodiso
- fixes bug in lastmod option for buildSitemapIndex where option would be overwritten if a lastmod option was provided with a single url
- fixes #201, fixes #203
# 3.2.1
- no really fixes ts errors for real this time
- fixes #193 in PR #198
# 3.2.0
- fixes #192, fixes #193 typescript errors
- correct types on player:loc and restriction:relationship types
- use https urls in xmlns
# 3.1.0
- fixes #187, #188 typescript errors
- adds support for full precision priority #176
# 3.0.0
- Converted project to typescript
- properly encode URLs #179
- updated core dependency
## breaking changes
This will likely not break anyone's code but we're bumping to be safe
- root domain URLs are now suffixed with / (eg. https://www.ya.ru -> https://www.ya.ru/) This is a side-effect of properly encoding passed in URLs
- A new experimental CLI
- stream in a list of urls stream out xml
- validate your generated sitemap
- Sitemap video item now supports id element
- Several schema errors have been cleaned up.
- Docs have been updated and streamlined.
### breaking changes
- lastmod option parses all ISO8601 date-only strings as being in UTC rather than local time
- lastmodISO is deprecated as it is equivalent to lastmod
- lastmodfile now includes the file's time as well
- lastmodrealtime is no longer necessary
- The default export of sitemap lib is now just createSitemap
- Sitemap constructor now uses a object for its constructor
```js
const { Sitemap } = require('sitemap');
const siteMap = new Sitemap({
urls = [],
hostname: 'https://example.com', // optional
cacheTime = 0,
xslUrl,
xmlNs,
level = 'warn'
})
```
- Sitemap no longer accepts a single string for its url
- Drop support for node 6
- Remove callback on toXML - This had no performance benefit
- Direct modification of urls property on Sitemap has been dropped. Use add/remove/contains
- When a Sitemap item is generated with invalid options it no longer throws by default
- instead it console warns.
- if you'd like to pre-verify your data the `validateSMIOptions` function is
now available
- To get the previous behavior pass level `createSitemap({...otheropts, level: 'throw' }) // ErrorLevel.THROW for TS users`
## 3.2.2
- revert https everywhere added in 3.2.0. xmlns is not url.
- adds alias for lastmod in the form of lastmodiso
- fixes bug in lastmod option for buildSitemapIndex where option would be overwritten if a lastmod option was provided with a single url
- fixes #201, fixes #203
## 3.2.1
- no really fixes ts errors for real this time
- fixes #193 in PR #198
## 3.2.0
- fixes #192, fixes #193 typescript errors
- correct types on player:loc and restriction:relationship types
- use https urls in xmlns
## 3.1.0
- fixes #187, #188 typescript errors
- adds support for full precision priority #176
## 3.0.0
- Converted project to typescript
- properly encode URLs #179
- updated core dependency
### breaking changes
This will likely not break anyone's code but we're bumping to be safe
- root domain URLs are now suffixed with / (eg. `https://www.ya.ru` -> `https://www.ya.ru/`) This is a side-effect of properly encoding passed in URLs

@@ -18,3 +18,3 @@ #!/usr/bin/env node

'--single-line-json': Boolean,
'--prepend': String
'--prepend': String,
};

@@ -37,4 +37,2 @@ const argv = arg(argSpec);

else if (argv['--help']) {
// TODO stream a full JSON configuration in
// TODO allow user to append entry to existing xml
console.log(`

@@ -55,3 +53,3 @@ Turn a list of urls into a sitemap xml.

.pipe(new sitemap_parser_1.XMLToISitemapOptions())
.pipe(new sitemap_parser_1.ObjectStreamToJSON({ lineSeparated: !argv["--single-line-json"] }))
.pipe(new sitemap_parser_1.ObjectStreamToJSON({ lineSeparated: !argv['--single-line-json'] }))
.pipe(process.stdout);

@@ -82,3 +80,3 @@ }

if (argv['--prepend']) {
fs_1.createReadStream(argv["--prepend"])
fs_1.createReadStream(argv['--prepend'])
.pipe(new sitemap_parser_1.XMLToISitemapOptions())

@@ -91,2 +89,1 @@ .pipe(sms);

}
//# sourceMappingURL=cli.js.map

@@ -13,5 +13,5 @@ /*!

export * from './lib/types';
export { lineSeparatedURLsToSitemapOptions, mergeStreams, validateSMIOptions } from './lib/utils';
export { lineSeparatedURLsToSitemapOptions, mergeStreams, validateSMIOptions, } from './lib/utils';
export { xmlLint } from './lib/xmllint';
export { parseSitemap, XMLToISitemapOptions, ObjectStreamToJSON } from './lib/sitemap-parser';
export { parseSitemap, XMLToISitemapOptions, ObjectStreamToJSON, } from './lib/sitemap-parser';
export default createSitemap;

@@ -29,2 +29,1 @@ "use strict";

exports.default = sitemap_1.createSitemap;
//# sourceMappingURL=index.js.map

@@ -65,3 +65,4 @@ "use strict";

constructor(message) {
super(message || 'must include thumbnail_loc, title and description fields for videos');
super(message ||
'must include thumbnail_loc, title and description fields for videos');
this.name = 'InvalidVideoFormat';

@@ -99,3 +100,9 @@ Error.captureStackTrace(this, InvalidVideoFormat);

constructor(key, val, validator) {
super('"' + val + '" tested against: ' + validator + ' is not a valid value for attr: "' + key + '"');
super('"' +
val +
'" tested against: ' +
validator +
' is not a valid value for attr: "' +
key +
'"');
this.name = 'InvalidAttrValue';

@@ -118,3 +125,4 @@ Error.captureStackTrace(this, InvalidAttrValue);

constructor(message) {
super(message || 'must include publication, publication name, publication language, title, and publication_date for news');
super(message ||
'must include publication, publication name, publication language, title, and publication_date for news');
this.name = 'InvalidNewsFormat';

@@ -127,3 +135,4 @@ Error.captureStackTrace(this, InvalidNewsFormat);

constructor(message) {
super(message || 'News access must be either Registration, Subscription or not be present');
super(message ||
'News access must be either Registration, Subscription or not be present');
this.name = 'InvalidNewsAccessValue';

@@ -142,2 +151,1 @@ Error.captureStackTrace(this, InvalidNewsAccessValue);

exports.XMLLintUnavailable = XMLLintUnavailable;
//# sourceMappingURL=errors.js.map
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -74,54 +65,48 @@ const util_1 = require("util");

*/
function createSitemapsAndIndex({ urls, targetFolder, hostname, sitemapName = 'sitemap', sitemapSize = 50000, gzip = true, }) {
return __awaiter(this, void 0, void 0, function* () {
let sitemapId = 0;
const sitemapPaths = [];
try {
const stats = yield statPromise(targetFolder);
if (!stats.isDirectory()) {
throw new errors_1.UndefinedTargetFolder();
}
}
catch (e) {
async function createSitemapsAndIndex({ urls, targetFolder, hostname, sitemapName = 'sitemap', sitemapSize = 50000, gzip = true, }) {
let sitemapId = 0;
const sitemapPaths = [];
try {
const stats = await statPromise(targetFolder);
if (!stats.isDirectory()) {
throw new errors_1.UndefinedTargetFolder();
}
const chunks = utils_1.chunk(urls, sitemapSize);
const smPromises = chunks.map((chunk) => {
return new Promise((resolve, reject) => {
const extension = '.xml' + (gzip ? '.gz' : '');
const filename = sitemapName + '-' + sitemapId++ + extension;
sitemapPaths.push(filename);
const ws = fs_1.createWriteStream(targetFolder + '/' + filename);
const sms = new sitemap_stream_1.SitemapStream({ hostname });
let pipe;
if (gzip) {
pipe = sms.pipe(zlib_1.createGzip()).pipe(ws);
}
else {
pipe = sms.pipe(ws);
}
chunk.forEach(smi => sms.write(smi));
sms.end();
pipe.on('finish', () => resolve(true));
pipe.on('error', (e) => reject(e));
});
}
catch (e) {
throw new errors_1.UndefinedTargetFolder();
}
const chunks = utils_1.chunk(urls, sitemapSize);
const smPromises = chunks.map((chunk) => {
return new Promise((resolve, reject) => {
const extension = '.xml' + (gzip ? '.gz' : '');
const filename = sitemapName + '-' + sitemapId++ + extension;
sitemapPaths.push(filename);
const ws = fs_1.createWriteStream(targetFolder + '/' + filename);
const sms = new sitemap_stream_1.SitemapStream({ hostname });
let pipe;
if (gzip) {
pipe = sms.pipe(zlib_1.createGzip()).pipe(ws);
}
else {
pipe = sms.pipe(ws);
}
chunk.forEach(smi => sms.write(smi));
sms.end();
pipe.on('finish', () => resolve(true));
pipe.on('error', e => reject(e));
});
const indexPromise = new Promise((resolve, reject) => {
const indexWS = fs_1.createWriteStream(targetFolder + "/" + sitemapName + "-index.xml");
indexWS.once('open', (fd) => {
indexWS.write(buildSitemapIndex({
urls: sitemapPaths.map((smPath) => hostname + '/' + smPath)
}));
indexWS.end();
});
indexWS.on('finish', () => resolve(true));
indexWS.on('error', (e) => reject(e));
});
const indexPromise = new Promise((resolve, reject) => {
const indexWS = fs_1.createWriteStream(targetFolder + '/' + sitemapName + '-index.xml');
indexWS.once('open', (fd) => {
indexWS.write(buildSitemapIndex({
urls: sitemapPaths.map((smPath) => hostname + '/' + smPath),
}));
indexWS.end();
});
return Promise.all([
indexPromise,
...smPromises
]).then(() => true);
indexWS.on('finish', () => resolve(true));
indexWS.on('error', e => reject(e));
});
return Promise.all([indexPromise, ...smPromises]).then(() => true);
}
exports.createSitemapsAndIndex = createSitemapsAndIndex;
//# sourceMappingURL=sitemap-index.js.map

@@ -9,13 +9,13 @@ import { XMLElement } from 'xmlbuilder';

root: XMLElement;
loc: SitemapItemOptions["url"];
lastmod: SitemapItemOptions["lastmod"];
changefreq: SitemapItemOptions["changefreq"];
priority: SitemapItemOptions["priority"];
news?: SitemapItemOptions["news"];
img?: SitemapItemOptions["img"];
links?: SitemapItemOptions["links"];
expires?: SitemapItemOptions["expires"];
androidLink?: SitemapItemOptions["androidLink"];
video?: SitemapItemOptions["video"];
ampLink?: SitemapItemOptions["ampLink"];
loc: SitemapItemOptions['url'];
lastmod: SitemapItemOptions['lastmod'];
changefreq: SitemapItemOptions['changefreq'];
priority: SitemapItemOptions['priority'];
news?: SitemapItemOptions['news'];
img?: SitemapItemOptions['img'];
links?: SitemapItemOptions['links'];
expires?: SitemapItemOptions['expires'];
androidLink?: SitemapItemOptions['androidLink'];
video?: SitemapItemOptions['video'];
ampLink?: SitemapItemOptions['ampLink'];
url: XMLElement;

@@ -22,0 +22,0 @@ constructor(conf: SitemapItemOptions, root?: XMLElement, level?: ErrorLevel);

@@ -83,3 +83,5 @@ "use strict";

if (video.player_loc) {
videoxml.element('video:player_loc', attrBuilder(video, 'player_loc:autoplay')).text(video.player_loc);
videoxml
.element('video:player_loc', attrBuilder(video, 'player_loc:autoplay'))
.text(video.player_loc);
}

@@ -111,12 +113,24 @@ if (video.duration) {

if (video.restriction) {
videoxml.element('video:restriction', attrBuilder(video, 'restriction:relationship')).text(video.restriction);
videoxml
.element('video:restriction', attrBuilder(video, 'restriction:relationship'))
.text(video.restriction);
}
if (video.gallery_loc) {
videoxml.element('video:gallery_loc', { title: video['gallery_loc:title'] }).text(video.gallery_loc);
videoxml
.element('video:gallery_loc', { title: video['gallery_loc:title'] })
.text(video.gallery_loc);
}
if (video.price) {
videoxml.element('video:price', attrBuilder(video, ['price:resolution', 'price:currency', 'price:type'])).text(video.price);
videoxml
.element('video:price', attrBuilder(video, [
'price:resolution',
'price:currency',
'price:type',
]))
.text(video.price);
}
if (video.requires_subscription) {
videoxml.element('video:requires_subscription').text(video.requires_subscription);
videoxml
.element('video:requires_subscription')
.text(video.requires_subscription);
}

@@ -127,3 +141,5 @@ if (video.uploader) {

if (video.platform) {
videoxml.element('video:platform', attrBuilder(video, 'platform:relationship')).text(video.platform);
videoxml
.element('video:platform', attrBuilder(video, 'platform:relationship'))
.text(video.platform);
}

@@ -147,3 +163,16 @@ if (video.live) {

// xml property
const props = ['loc', 'lastmod', 'changefreq', 'priority', 'img', 'video', 'links', 'expires', 'androidLink', 'mobile', 'news', 'ampLink'];
const props = [
'loc',
'lastmod',
'changefreq',
'priority',
'img',
'video',
'links',
'expires',
'androidLink',
'mobile',
'news',
'ampLink',
];
// property array size (for loop)

@@ -181,7 +210,9 @@ let ps = 0;

this.links.forEach((link) => {
this.url.element({ 'xhtml:link': {
this.url.element({
'xhtml:link': {
'@rel': 'alternate',
'@hreflang': link.lang,
'@href': link.url
} });
'@href': link.url,
},
});
});

@@ -193,3 +224,6 @@ }

else if (this.androidLink && p === 'androidLink') {
this.url.element('xhtml:link', { rel: 'alternate', href: this.androidLink });
this.url.element('xhtml:link', {
rel: 'alternate',
href: this.androidLink,
});
}

@@ -215,3 +249,5 @@ else if (this.priority !== undefined && p === 'priority') {

if (this.news.publication.language) {
publication.element('news:language').text(this.news.publication.language);
publication
.element('news:language')
.text(this.news.publication.language);
}

@@ -225,3 +261,5 @@ }

}
newsitem.element('news:publication_date').text(this.news.publication_date);
newsitem
.element('news:publication_date')
.text(this.news.publication_date);
newsitem.element('news:title').text(this.news.title);

@@ -238,4 +276,4 @@ if (this.news.keywords) {

loc: {
'#raw': this.loc
}
'#raw': this.loc,
},
});

@@ -264,2 +302,1 @@ }

exports.SitemapItem = SitemapItem;
//# sourceMappingURL=sitemap-item.js.map
/// <reference types="node" />
import { SAXStream } from 'sax';
import { Readable, Transform, TransformOptions, TransformCallback } from 'stream';
import { SitemapItemOptions, ErrorLevel } from "./types";
import { SitemapItemOptions, ErrorLevel } from './types';
import { ISitemapOptions } from './sitemap';

@@ -6,0 +6,0 @@ export interface ISitemapStreamParseOpts extends TransformOptions, Pick<ISitemapOptions, 'level'> {

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -23,3 +14,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

links: [],
url: ''
url: '',
};

@@ -31,20 +22,20 @@ }

// eslint-disable-next-line @typescript-eslint/camelcase
thumbnail_loc: "",
title: "",
description: ""
thumbnail_loc: '',
title: '',
description: '',
};
}
const imageTemplate = {
url: ''
url: '',
};
const linkTemplate = {
lang: '',
url: ''
url: '',
};
function newsTemplate() {
return {
publication: { name: "", language: "" },
publication: { name: '', language: '' },
// eslint-disable-next-line @typescript-eslint/camelcase
publication_date: "",
title: ""
publication_date: '',
title: '',
};

@@ -66,3 +57,3 @@ }

strictEntities: true,
trim: true
trim: true,
});

@@ -73,4 +64,4 @@ this.level = opts.level || types_1.ErrorLevel.WARN;

let currentVideo = videoTemplate();
let currentImage = Object.assign({}, imageTemplate);
let currentLink = Object.assign({}, linkTemplate);
let currentImage = { ...imageTemplate };
let currentLink = { ...linkTemplate };
let dontpushCurrentLink = false;

@@ -85,53 +76,54 @@ this.saxStream.on('opentagstart', (tag) => {

switch (tag.name) {
case "url":
case "loc":
case "urlset":
case "lastmod":
case "changefreq":
case "priority":
case "video:thumbnail_loc":
case "video:video":
case "video:title":
case "video:description":
case "video:tag":
case "video:duration":
case "video:player_loc":
case "image:image":
case "image:loc":
case "image:geo_location":
case "image:license":
case "image:title":
case "image:caption":
case "video:requires_subscription":
case "video:publication_date":
case "video:id":
case "video:restriction":
case "video:family_friendly":
case "video:view_count":
case "video:uploader":
case "video:expiration_date":
case "video:platform":
case "video:price":
case "video:rating":
case "video:category":
case "video:live":
case "video:gallery_loc":
case "news:news":
case "news:publication":
case "news:name":
case "news:access":
case "news:genres":
case "news:publication_date":
case "news:title":
case "news:keywords":
case "news:stock_tickers":
case "news:language":
case "mobile:mobile":
case 'url':
case 'loc':
case 'urlset':
case 'lastmod':
case 'changefreq':
case 'priority':
case 'video:thumbnail_loc':
case 'video:video':
case 'video:title':
case 'video:description':
case 'video:tag':
case 'video:duration':
case 'video:player_loc':
case 'image:image':
case 'image:loc':
case 'image:geo_location':
case 'image:license':
case 'image:title':
case 'image:caption':
case 'video:requires_subscription':
case 'video:publication_date':
case 'video:id':
case 'video:restriction':
case 'video:family_friendly':
case 'video:view_count':
case 'video:uploader':
case 'video:expiration_date':
case 'video:platform':
case 'video:price':
case 'video:rating':
case 'video:category':
case 'video:live':
case 'video:gallery_loc':
case 'news:news':
case 'news:publication':
case 'news:name':
case 'news:access':
case 'news:genres':
case 'news:publication_date':
case 'news:title':
case 'news:keywords':
case 'news:stock_tickers':
case 'news:language':
case 'mobile:mobile':
break;
case 'xhtml:link':
if (typeof tag.attributes.rel === "string" ||
typeof tag.attributes.href === "string") {
if (typeof tag.attributes.rel === 'string' ||
typeof tag.attributes.href === 'string') {
break;
}
if (tag.attributes.rel.value === 'alternate' && tag.attributes.hreflang) {
if (tag.attributes.rel.value === 'alternate' &&
tag.attributes.hreflang) {
currentLink.url = tag.attributes.href.value;

@@ -161,3 +153,3 @@ if (typeof tag.attributes.hreflang === 'string')

switch (currentTag) {
case "mobile:mobile":
case 'mobile:mobile':
break;

@@ -176,74 +168,74 @@ case 'loc':

break;
case "video:thumbnail_loc":
case 'video:thumbnail_loc':
// eslint-disable-next-line @typescript-eslint/camelcase
currentVideo.thumbnail_loc = text;
break;
case "video:tag":
case 'video:tag':
currentVideo.tag.push(text);
break;
case "video:duration":
case 'video:duration':
currentVideo.duration = parseInt(text, 10);
break;
case "video:player_loc":
case 'video:player_loc':
// eslint-disable-next-line @typescript-eslint/camelcase
currentVideo.player_loc = text;
break;
case "video:requires_subscription":
case 'video:requires_subscription':
// eslint-disable-next-line @typescript-eslint/camelcase
currentVideo.requires_subscription = text;
break;
case "video:publication_date":
case 'video:publication_date':
// eslint-disable-next-line @typescript-eslint/camelcase
currentVideo.publication_date = text;
break;
case "video:id":
case 'video:id':
currentVideo.id = text;
break;
case "video:restriction":
case 'video:restriction':
currentVideo.restriction = text;
break;
case "video:view_count":
case 'video:view_count':
// eslint-disable-next-line @typescript-eslint/camelcase
currentVideo.view_count = text;
break;
case "video:uploader":
case 'video:uploader':
currentVideo.uploader = text;
break;
case "video:family_friendly":
case 'video:family_friendly':
// eslint-disable-next-line @typescript-eslint/camelcase
currentVideo.family_friendly = text;
break;
case "video:expiration_date":
case 'video:expiration_date':
// eslint-disable-next-line @typescript-eslint/camelcase
currentVideo.expiration_date = text;
break;
case "video:platform":
case 'video:platform':
currentVideo.platform = text;
break;
case "video:price":
case 'video:price':
currentVideo.price = text;
break;
case "video:rating":
case 'video:rating':
currentVideo.rating = parseFloat(text);
break;
case "video:category":
case 'video:category':
currentVideo.category = text;
break;
case "video:live":
case 'video:live':
currentVideo.live = text;
break;
case "video:gallery_loc":
case 'video:gallery_loc':
// eslint-disable-next-line @typescript-eslint/camelcase
currentVideo.gallery_loc = text;
break;
case "image:loc":
case 'image:loc':
currentImage.url = text;
break;
case "image:geo_location":
case 'image:geo_location':
currentImage.geoLocation = text;
break;
case "image:license":
case 'image:license':
currentImage.license = text;
break;
case "news:access":
case 'news:access':
if (!currentItem.news) {

@@ -254,3 +246,3 @@ currentItem.news = newsTemplate();

break;
case "news:genres":
case 'news:genres':
if (!currentItem.news) {

@@ -261,3 +253,3 @@ currentItem.news = newsTemplate();

break;
case "news:publication_date":
case 'news:publication_date':
if (!currentItem.news) {

@@ -269,3 +261,3 @@ currentItem.news = newsTemplate();

break;
case "news:keywords":
case 'news:keywords':
if (!currentItem.news) {

@@ -276,3 +268,3 @@ currentItem.news = newsTemplate();

break;
case "news:stock_tickers":
case 'news:stock_tickers':
if (!currentItem.news) {

@@ -284,3 +276,3 @@ currentItem.news = newsTemplate();

break;
case "news:language":
case 'news:language':
if (!currentItem.news) {

@@ -291,9 +283,9 @@ currentItem.news = newsTemplate();

break;
case "video:title":
case 'video:title':
currentVideo.title += text;
break;
case "video:description":
case 'video:description':
currentVideo.description += text;
break;
case "news:name":
case 'news:name':
if (!currentItem.news) {

@@ -304,3 +296,3 @@ currentItem.news = newsTemplate();

break;
case "news:title":
case 'news:title':
if (!currentItem.news) {

@@ -311,3 +303,3 @@ currentItem.news = newsTemplate();

break;
case "image:caption":
case 'image:caption':
if (!currentImage.caption) {

@@ -320,3 +312,3 @@ currentImage.caption = text;

break;
case "image:title":
case 'image:title':
if (!currentImage.title) {

@@ -336,9 +328,9 @@ currentImage.title = text;

switch (currentTag) {
case "video:title":
case 'video:title':
currentVideo.title += text;
break;
case "video:description":
case 'video:description':
currentVideo.description += text;
break;
case "news:name":
case 'news:name':
if (!currentItem.news) {

@@ -349,3 +341,3 @@ currentItem.news = newsTemplate();

break;
case "news:title":
case 'news:title':
if (!currentItem.news) {

@@ -356,3 +348,3 @@ currentItem.news = newsTemplate();

break;
case "image:caption":
case 'image:caption':
if (!currentImage.caption) {

@@ -365,3 +357,3 @@ currentImage.caption = text;

break;
case "image:title":
case 'image:title':
if (!currentImage.title) {

@@ -381,23 +373,23 @@ currentImage.title = text;

switch (currentTag) {
case "urlset":
case "xhtml:link":
case "video:id":
case 'urlset':
case 'xhtml:link':
case 'video:id':
break;
case "video:restriction":
case 'video:restriction':
if (attr.name === 'relationship') {
currentVideo["restriction:relationship"] = attr.value;
currentVideo['restriction:relationship'] = attr.value;
}
else {
console.log("unhandled attr", currentTag, attr.name);
console.log('unhandled attr', currentTag, attr.name);
}
break;
case "video:price":
case 'video:price':
if (attr.name === 'type') {
currentVideo["price:type"] = attr.value;
currentVideo['price:type'] = attr.value;
}
else if (attr.name === 'currency') {
currentVideo["price:currency"] = attr.value;
currentVideo['price:currency'] = attr.value;
}
else if (attr.name === 'resolution') {
currentVideo["price:resolution"] = attr.value;
currentVideo['price:resolution'] = attr.value;
}

@@ -408,5 +400,5 @@ else {

break;
case "video:player_loc":
case 'video:player_loc':
if (attr.name === 'autoplay') {
currentVideo["player_loc:autoplay"] = attr.value;
currentVideo['player_loc:autoplay'] = attr.value;
}

@@ -417,5 +409,5 @@ else {

break;
case "video:platform":
case 'video:platform':
if (attr.name === 'relationship') {
currentVideo["platform:relationship"] = attr.value;
currentVideo['platform:relationship'] = attr.value;
}

@@ -426,5 +418,5 @@ else {

break;
case "video:gallery_loc":
case 'video:gallery_loc':
if (attr.name === 'title') {
currentVideo["gallery_loc:title"] = attr.value;
currentVideo['gallery_loc:title'] = attr.value;
}

@@ -445,15 +437,15 @@ else {

break;
case "video:video":
case 'video:video':
currentItem.video.push(currentVideo);
currentVideo = videoTemplate();
break;
case "image:image":
case 'image:image':
currentItem.img.push(currentImage);
currentImage = Object.assign({}, imageTemplate);
currentImage = { ...imageTemplate };
break;
case "xhtml:link":
case 'xhtml:link':
if (!dontpushCurrentLink) {
currentItem.links.push(currentLink);
}
currentLink = Object.assign({}, linkTemplate);
currentLink = { ...linkTemplate };
break;

@@ -488,17 +480,15 @@ default:

*/
function parseSitemap(xml) {
return __awaiter(this, void 0, void 0, function* () {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
const urls = [];
return new Promise((resolve, reject) => {
xml
.pipe(new XMLToISitemapOptions())
.on("data", (smi) => urls.push(smi))
.on("end", () => {
resolve({ urls });
})
.on("error", (error) => {
reject(error);
});
async function parseSitemap(xml) {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
const urls = [];
return new Promise((resolve, reject) => {
xml
.pipe(new XMLToISitemapOptions())
.on('data', (smi) => urls.push(smi))
.on('end', () => {
resolve({ urls });
})
.on('error', (error) => {
reject(error);
});

@@ -509,3 +499,3 @@ });

const defaultObjectStreamOpts = {
lineSeparated: false
lineSeparated: false,
};

@@ -550,2 +540,1 @@ /**

exports.ObjectStreamToJSON = ObjectStreamToJSON;
//# sourceMappingURL=sitemap-parser.js.map

@@ -7,3 +7,3 @@ /// <reference types="node" />

export declare const closetag = "</urlset>";
export interface ISitemapStreamOpts extends TransformOptions, Pick<ISitemapOptions, 'hostname' | 'level'> {
export interface ISitemapStreamOpts extends TransformOptions, Pick<ISitemapOptions, 'hostname' | 'level' | 'lastmodDateOnly'> {
}

@@ -14,2 +14,3 @@ export declare class SitemapStream extends Transform {

hasHeadOutput: boolean;
lastmodDateOnly: boolean;
constructor(opts?: ISitemapStreamOpts);

@@ -16,0 +17,0 @@ _transform(item: ISitemapItemOptionsLoose, encoding: string, callback: TransformCallback): void;

@@ -17,2 +17,3 @@ "use strict";

this.level = opts.level || types_1.ErrorLevel.WARN;
this.lastmodDateOnly = opts.lastmodDateOnly || false;
}

@@ -24,3 +25,3 @@ _transform(item, encoding, callback) {

}
this.push(sitemap_item_1.SitemapItem.justItem(sitemap_1.Sitemap.normalizeURL(item, this.hostname), this.level));
this.push(sitemap_item_1.SitemapItem.justItem(sitemap_1.Sitemap.normalizeURL(item, this.hostname, this.lastmodDateOnly), this.level));
callback();

@@ -51,9 +52,8 @@ }

next();
}
},
}))
.on("error", reject)
.on("finish", () => resolve(drain));
.on('error', reject)
.on('finish', () => resolve(drain));
});
}
exports.streamToPromise = streamToPromise;
//# sourceMappingURL=sitemap-stream.js.map

@@ -17,2 +17,3 @@ /// <reference types="node" />

level?: ErrorLevel;
lastmodDateOnly?: boolean;
}

@@ -29,2 +30,3 @@ export declare class Sitemap {

xslUrl?: string;
private lastmodDateOnly;
/**

@@ -40,4 +42,5 @@ * Sitemap constructor

* @param {ErrorLevel} [level=ErrorLevel.WARN] level optional
* @param {boolean=false} lastmodDateOnly print only the date - for baidu quirk
*/
constructor({ urls, hostname, cacheTime, xslUrl, xmlNs, level }?: ISitemapOptions);
constructor({ urls, hostname, cacheTime, xslUrl, xmlNs, level, lastmodDateOnly, }?: ISitemapOptions);
/**

@@ -87,5 +90,6 @@ * Empty cache and bipass it until set again

* @param {string} hostname
* @param {boolean=} lastmodDateOnly print only the date - for baidu quirk
* @returns SitemapItemOptions a strict sitemap item option
*/
static normalizeURL(elem: string | ISitemapItemOptionsLoose, hostname?: string): SitemapItemOptions;
static normalizeURL(elem: string | ISitemapItemOptionsLoose, hostname?: string, lastmodDateOnly?: boolean): SitemapItemOptions;
/**

@@ -95,5 +99,6 @@ * Normalize multiple urls

* @param {string=} hostname
* @param {boolean=} lastmodDateOnly print only the date - for baidu quirk
* @returns a Map of url to SitemapItemOption
*/
static normalizeURLs(urls: (string | ISitemapItemOptionsLoose)[], hostname?: string): Map<string, SitemapItemOptions>;
static normalizeURLs(urls: (string | ISitemapItemOptionsLoose)[], hostname?: string, lastmodDateOnly?: boolean): Map<string, SitemapItemOptions>;
/**

@@ -128,2 +133,2 @@ * Converts the urls stored in an instance of Sitemap to a valid sitemap xml document

*/
export declare function createSitemap({ urls, hostname, cacheTime, xslUrl, xmlNs, level }: ISitemapOptions): Sitemap;
export declare function createSitemap({ urls, hostname, cacheTime, xslUrl, xmlNs, level, }: ISitemapOptions): Sitemap;

@@ -37,4 +37,5 @@ "use strict";

* @param {ErrorLevel} [level=ErrorLevel.WARN] level optional
* @param {boolean=false} lastmodDateOnly print only the date - for baidu quirk
*/
constructor({ urls = [], hostname, cacheTime = 0, xslUrl, xmlNs, level = types_1.ErrorLevel.WARN } = {}) {
constructor({ urls = [], hostname, cacheTime = 0, xslUrl, xmlNs, level = types_1.ErrorLevel.WARN, lastmodDateOnly = false, } = {}) {
// This limit is defined by Google. See:

@@ -45,2 +46,3 @@ // https://sitemaps.org/protocol.php#index

this.cacheSetTimestamp = 0;
this.lastmodDateOnly = false;
// Base domain

@@ -52,2 +54,3 @@ this.hostname = hostname;

this.xslUrl = xslUrl;
this.lastmodDateOnly = lastmodDateOnly;
this.root = xmlbuilder_1.create('urlset', { encoding: 'UTF-8' });

@@ -63,3 +66,3 @@ if (xmlNs) {

urls = Array.from(urls);
this.urls = Sitemap.normalizeURLs(urls, this.hostname);
this.urls = Sitemap.normalizeURLs(urls, this.hostname, lastmodDateOnly);
for (const [, url] of this.urls) {

@@ -81,4 +84,5 @@ utils_1.validateSMIOptions(url, level);

const currTimestamp = Date.now();
return !!(this.cacheTime && this.cache &&
(this.cacheSetTimestamp + this.cacheTime) >= currTimestamp);
return !!(this.cacheTime &&
this.cache &&
this.cacheSetTimestamp + this.cacheTime >= currTimestamp);
}

@@ -97,3 +101,3 @@ /**

_normalizeURL(url) {
return Sitemap.normalizeURL(url, this.hostname);
return Sitemap.normalizeURL(url, this.hostname, this.lastmodDateOnly);
}

@@ -137,5 +141,6 @@ /**

* @param {string} hostname
* @param {boolean=} lastmodDateOnly print only the date - for baidu quirk
* @returns SitemapItemOptions a strict sitemap item option
*/
static normalizeURL(elem, hostname) {
static normalizeURL(elem, hostname, lastmodDateOnly = false) {
// SitemapItem

@@ -147,3 +152,3 @@ // create object with url property

links: [],
url: ''
url: '',
};

@@ -158,3 +163,3 @@ let smiLoose;

}
smi.url = (new url_1.URL(smiLoose.url, hostname)).toString();
smi.url = new url_1.URL(smiLoose.url, hostname).toString();
let img = [];

@@ -170,6 +175,9 @@ if (smiLoose.img) {

}
img = smiLoose.img.map((el) => typeof el === 'string' ? { url: el } : el);
img = smiLoose.img.map((el) => (typeof el === 'string' ? { url: el } : el));
}
// prepend hostname to all image urls
smi.img = img.map((el) => (Object.assign(Object.assign({}, el), { url: (new url_1.URL(el.url, hostname)).toString() })));
smi.img = img.map((el) => ({
...el,
url: new url_1.URL(el.url, hostname).toString(),
}));
let links = [];

@@ -180,3 +188,3 @@ if (smiLoose.links) {

smi.links = links.map((link) => {
return Object.assign(Object.assign({}, link), { url: (new url_1.URL(link.url, hostname)).toString() });
return { ...link, url: new url_1.URL(link.url, hostname).toString() };
});

@@ -189,7 +197,12 @@ if (smiLoose.video) {

smi.video = smiLoose.video.map((video) => {
const nv = Object.assign(Object.assign({}, video), {
const nv = {
...video,
/* eslint-disable-next-line @typescript-eslint/camelcase */
family_friendly: boolToYESNO(video.family_friendly), live: boolToYESNO(video.live),
family_friendly: boolToYESNO(video.family_friendly),
live: boolToYESNO(video.live),
/* eslint-disable-next-line @typescript-eslint/camelcase */
requires_subscription: boolToYESNO(video.requires_subscription), tag: [], rating: undefined });
requires_subscription: boolToYESNO(video.requires_subscription),
tag: [],
rating: undefined,
};
if (video.tag !== undefined) {

@@ -216,14 +229,17 @@ nv.tag = !Array.isArray(video.tag) ? [video.tag] : video.tag;

const { mtime } = fs_1.statSync(smiLoose.lastmodfile);
smi.lastmod = (new Date(mtime)).toISOString();
smi.lastmod = new Date(mtime).toISOString();
// The date of last modification (YYYY-MM-DD)
}
else if (smiLoose.lastmodISO) {
smi.lastmod = (new Date(smiLoose.lastmodISO)).toISOString();
smi.lastmod = new Date(smiLoose.lastmodISO).toISOString();
}
else if (smiLoose.lastmod) {
smi.lastmod = (new Date(smiLoose.lastmod)).toISOString();
smi.lastmod = new Date(smiLoose.lastmod).toISOString();
}
if (lastmodDateOnly && smi.lastmod) {
smi.lastmod = smi.lastmod.slice(0, 10);
}
delete smiLoose.lastmodfile;
delete smiLoose.lastmodISO;
smi = Object.assign(Object.assign({}, smiLoose), smi);
smi = { ...smiLoose, ...smi };
return smi;

@@ -235,8 +251,9 @@ }

* @param {string=} hostname
* @param {boolean=} lastmodDateOnly print only the date - for baidu quirk
* @returns a Map of url to SitemapItemOption
*/
static normalizeURLs(urls, hostname) {
static normalizeURLs(urls, hostname, lastmodDateOnly = false) {
const urlMap = new Map();
urls.forEach((elem) => {
const smio = Sitemap.normalizeURL(elem, hostname);
const smio = Sitemap.normalizeURL(elem, hostname, lastmodDateOnly);
urlMap.set(smio.url, smio);

@@ -279,3 +296,3 @@ });

for (const [, smi] of this.urls) {
(new sitemap_item_1.SitemapItem(smi, this.root)).buildXML();
new sitemap_item_1.SitemapItem(smi, this.root).buildXML();
}

@@ -310,3 +327,3 @@ let opts;

*/
function createSitemap({ urls, hostname, cacheTime, xslUrl, xmlNs, level }) {
function createSitemap({ urls, hostname, cacheTime, xslUrl, xmlNs, level, }) {
return new Sitemap({

@@ -318,6 +335,5 @@ urls,

xmlNs,
level
level,
});
}
exports.createSitemap = createSitemap;
//# sourceMappingURL=sitemap.js.map

@@ -22,3 +22,3 @@ "use strict";

EnumChangefreq.YEARLY,
EnumChangefreq.NEVER
EnumChangefreq.NEVER,
];

@@ -48,2 +48,1 @@ var EnumYesNo;

})(ErrorLevel = exports.ErrorLevel || (exports.ErrorLevel = {}));
//# sourceMappingURL=types.js.map

@@ -19,7 +19,8 @@ "use strict";

'restriction:relationship': allowDeny,
'restriction': /^([A-Z]{2}( +[A-Z]{2})*)?$/,
'platform': /^((web|mobile|tv)( (web|mobile|tv))*)?$/,
'language': /^zh-cn|zh-tw|([a-z]{2,3})$/,
'genres': /^(PressRelease|Satire|Blog|OpEd|Opinion|UserGenerated)(, *(PressRelease|Satire|Blog|OpEd|Opinion|UserGenerated))*$/,
'stock_tickers': /^(\w+:\w+(, *\w+:\w+){0,4})?$/,
restriction: /^([A-Z]{2}( +[A-Z]{2})*)?$/,
platform: /^((web|mobile|tv)( (web|mobile|tv))*)?$/,
language: /^zh-cn|zh-tw|([a-z]{2,3})$/,
genres: /^(PressRelease|Satire|Blog|OpEd|Opinion|UserGenerated)(, *(PressRelease|Satire|Blog|OpEd|Opinion|UserGenerated))*$/,
// eslint-disable-next-line @typescript-eslint/camelcase
stock_tickers: /^(\w+:\w+(, *\w+:\w+){0,4})?$/,
};

@@ -123,3 +124,6 @@ function validate(subject, name, url, level) {

}
if (typeof (vid) !== 'object' || !vid.thumbnail_loc || !vid.title || !vid.description) {
if (typeof vid !== 'object' ||
!vid.thumbnail_loc ||
!vid.title ||
!vid.description) {
// has to be an object and include required categories https://support.google.com/webmasters/answer/80471?hl=en&ref_topic=4581190

@@ -174,6 +178,6 @@ if (level === types_1.ErrorLevel.THROW) {

terminal: false,
crlfDelay: Infinity
crlfDelay: Infinity,
});
// Every time there's data, push it into the internal buffer.
this._source.on('line', (chunk) => {
this._source.on('line', chunk => {
// If push() returns false, then stop reading from source.

@@ -206,3 +210,3 @@ if (!this.push(chunk))

transform: (line, encoding, cb) => {
if (isJSON || (isJSON === undefined && line[0] === "{")) {
if (isJSON || (isJSON === undefined && line[0] === '{')) {
cb(null, JSON.parse(line));

@@ -213,3 +217,3 @@ }

}
}
},
}));

@@ -245,2 +249,1 @@ }

exports.chunk = chunk;
//# sourceMappingURL=utils.js.map

@@ -12,3 +12,8 @@ "use strict";

function xmlLint(xml) {
const args = ['--schema', path_1.resolve(__dirname, '..', '..', 'schema', 'all.xsd'), '--noout', '-'];
const args = [
'--schema',
path_1.resolve(__dirname, '..', '..', 'schema', 'all.xsd'),
'--noout',
'-',
];
if (typeof xml === 'string') {

@@ -31,3 +36,3 @@ args[args.length - 1] = xml;

xmllint.stdout.unpipe();
if ((typeof xml !== 'string') && xml && xmllint.stdin) {
if (typeof xml !== 'string' && xml && xmllint.stdin) {
xml.pipe(xmllint.stdin);

@@ -40,2 +45,1 @@ }

exports.xmlLint = xmlLint;
//# sourceMappingURL=xmllint.js.map
{
"name": "sitemap",
"version": "5.0.1",
"version": "5.1.0",
"description": "Sitemap-generating lib/cli",

@@ -55,3 +55,5 @@ "keywords": [

"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],

@@ -88,6 +90,2 @@ "parser": "@typescript-eslint/parser",

],
"@typescript-eslint/indent": [
"error",
2
],
"@typescript-eslint/no-parameter-properties": "off",

@@ -125,3 +123,3 @@ "@typescript-eslint/no-unused-vars": [

"dependencies": {
"@types/node": "^12.11.5",
"@types/node": "^12.12.3",
"@types/sax": "^1.2.0",

@@ -138,13 +136,16 @@ "arg": "^4.1.1",

"@babel/preset-typescript": "^7.6.0",
"@types/jest": "^24.0.19",
"@typescript-eslint/eslint-plugin": "^2.5.0",
"@typescript-eslint/parser": "^2.5.0",
"@types/jest": "^24.0.21",
"@typescript-eslint/eslint-plugin": "^2.6.0",
"@typescript-eslint/parser": "^2.6.0",
"babel-eslint": "^10.0.3",
"babel-polyfill": "^6.26.0",
"concurrently": "^4.1.2",
"eslint": "^6.5.1",
"eslint-plugin-jest": "^22.20.0",
"concurrently": "^5.0.0",
"eslint": "^6.6.0",
"eslint-config-prettier": "^6.5.0",
"eslint-plugin-jest": "^22.21.0",
"eslint-plugin-prettier": "^3.1.1",
"express": "^4.17.1",
"husky": "^3.0.9",
"jest": "^24.9.0",
"prettier": "^1.18.2",
"sort-package-json": "^1.22.1",

@@ -151,0 +152,0 @@ "source-map": "~0.7.3",

@@ -300,3 +300,4 @@ # sitemap.js [![Build Status](https://travis-ci.org/ekalinin/sitemap.js.svg?branch=master)](https://travis-ci.org/ekalinin/sitemap.js)

cacheTime: 0, // default
level: 'warn' // default warns if it encounters bad data
level: 'warn', // default warns if it encounters bad data
lastmodDateOnly: false // relevant for baidu
})

@@ -381,6 +382,6 @@ sm.toString() // returns the xml as a string

```js
Sitemap.normalizeURL('/', 'http://example.com')
Sitemap.normalizeURL('/', 'http://example.com', false)
```
Static function that returns the stricter form of a options passed to SitemapItem
Static function that returns the stricter form of a options passed to SitemapItem. The third argument is whether to use date-only varient of lastmod. For baidu.

@@ -390,3 +391,3 @@ #### normalizeURLs

```js
Sitemap.normalizeURLs(['http://example.com', {url: 'http://example.com'}])
Sitemap.normalizeURLs(['http://example.com', {url: '/'}], 'http://example.com', false)
```

@@ -463,3 +464,4 @@

const sms = new SitemapStream({
hostname: 'https://example.com' // optional only necessary if your paths are relative
hostname: 'https://example.com', // optional only necessary if your paths are relative
lastmodDateOnly: false // defaults to false, flip to true for baidu
})

@@ -466,0 +468,0 @@ const readable = // a readable stream of objects

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc