Socket
Socket
Sign inDemoInstall

sitemap

Package Overview
Dependencies
Maintainers
2
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 6.1.7 to 6.2.0

dist/lib/sitemap-simple.d.ts

6

CHANGELOG.md
# Changelog
## 6.2.0
- Add simplified interface for creating sitemaps and index
- fix bug where sitemap and index stream would not properly wait to emit finish event until all sitemaps had been written
- bump deps
## 6.1.7

@@ -4,0 +10,0 @@

1

dist/index.d.ts

@@ -14,1 +14,2 @@ /*!

export { parseSitemap, XMLToSitemapItemStream, XMLToSitemapItemStreamOptions, ObjectStreamToJSON, ObjectStreamToJSONOptions, } from './lib/sitemap-parser';
export { simpleSitemapAndIndex } from './lib/sitemap-simple';

@@ -42,1 +42,3 @@ "use strict";

Object.defineProperty(exports, "ObjectStreamToJSON", { enumerable: true, get: function () { return sitemap_parser_1.ObjectStreamToJSON; } });
var sitemap_simple_1 = require("./lib/sitemap-simple");
Object.defineProperty(exports, "simpleSitemapAndIndex", { enumerable: true, get: function () { return sitemap_simple_1.simpleSitemapAndIndex; } });

16

dist/lib/sitemap-index-stream.js

@@ -136,8 +136,9 @@ "use strict";

else if (this.i % this.limit === 0) {
this.currentSitemap.end();
const [idxItem, currentSitemap] = this.getSitemapStream(this.i / this.limit);
this.currentSitemap = currentSitemap;
this._writeSMI(item);
// push to index stream
super._transform(idxItem, encoding, callback);
this.currentSitemap.end(() => {
const [idxItem, currentSitemap] = this.getSitemapStream(this.i / this.limit);
this.currentSitemap = currentSitemap;
this._writeSMI(item);
// push to index stream
super._transform(idxItem, encoding, callback);
});
}

@@ -150,6 +151,5 @@ else {

_flush(cb) {
this.currentSitemap.end();
super._flush(cb);
this.currentSitemap.end(() => super._flush(cb));
}
}
exports.SitemapAndIndexStream = SitemapAndIndexStream;
{
"name": "sitemap",
"version": "6.1.7",
"version": "6.2.0",
"description": "Sitemap-generating lib/cli",

@@ -152,3 +152,3 @@ "keywords": [

"dependencies": {
"@types/node": "^14.0.14",
"@types/node": "^14.0.18",
"@types/sax": "^1.2.1",

@@ -166,11 +166,11 @@ "arg": "^4.1.3",

"@babel/preset-typescript": "^7.10.4",
"@types/jest": "^26.0.3",
"@typescript-eslint/eslint-plugin": "^3.5.0",
"@typescript-eslint/parser": "^3.5.0",
"@types/jest": "^26.0.4",
"@typescript-eslint/eslint-plugin": "^3.6.0",
"@typescript-eslint/parser": "^3.6.0",
"babel-eslint": "^10.1.0",
"babel-polyfill": "^6.26.0",
"concurrently": "^5.2.0",
"eslint": "^7.3.1",
"eslint": "^7.4.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jest": "^23.17.1",
"eslint-plugin-jest": "^23.18.0",
"eslint-plugin-prettier": "^3.1.4",

@@ -187,3 +187,3 @@ "express": "^4.17.1",

"through2-map": "^3.0.0",
"typescript": "^3.9.5"
"typescript": "^3.9.6"
},

@@ -190,0 +190,0 @@ "engines": {

@@ -114,2 +114,29 @@ # sitemap ![MIT License](https://img.shields.io/npm/l/sitemap)[![Build Status](https://travis-ci.org/ekalinin/sitemap.js.svg?branch=master)](https://travis-ci.org/ekalinin/sitemap.js)![Monthly Downloads](https://img.shields.io/npm/dm/sitemap)

const {
simpleSitemapAndIndex,
lineSeparatedURLsToSitemapOptions
} = require('sitemap')
// writes sitemaps and index out to the destination you provide
simpleSitemapAndIndex({
hostname: 'https://example.com',
destinationDir: './',
sourceData: lineSeparatedURLsToSitemapOptions(
createReadStream('./your-data.json.txt')
),
// or
sourceData: [{ url: '/page-1/', changefreq: 'daily'}, ...],
// or
sourceData: './your-data.json.txt',
}).then(() => {
// Do follow up actions
})
```
Want to customize that?
```js
const { createReadStream, createWriteStream } = require('fs');
const { resolve } = require('path');
const { createGzip } = require('zlib')
const {
SitemapAndIndexStream,

@@ -121,3 +148,3 @@ SitemapStream,

const sms = new SitemapAndIndexStream({
limit: 10000, // defaults to 45k
limit: 50000, // defaults to 45k
// SitemapAndIndexStream will call this user provided function every time

@@ -124,0 +151,0 @@ // it needs to create a new sitemap file. You merely need to return a stream

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