Comparing version 6.1.4 to 6.1.5
# Changelog | ||
## 6.1.5 | ||
- performance improvement for streamToPromise #307 | ||
## 6.1.4 | ||
@@ -4,0 +8,0 @@ |
@@ -11,3 +11,3 @@ "use strict"; | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
} | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -14,0 +14,0 @@ /*! |
"use strict"; | ||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
@@ -3,0 +4,0 @@ /*! |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.ObjectStreamToJSON = exports.parseSitemap = exports.XMLToSitemapItemStream = void 0; | ||
/* eslint-disable @typescript-eslint/camelcase */ | ||
const sax_1 = __importDefault(require("sax")); | ||
@@ -58,3 +57,3 @@ const stream_1 = require("stream"); | ||
xmlns: true, | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -395,3 +394,3 @@ strictEntities: true, | ||
// TODO fix this | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -398,0 +397,0 @@ this.saxStream.write(data, encoding); |
@@ -94,6 +94,6 @@ "use strict"; | ||
if (!drain) { | ||
drain = chunk; | ||
drain = [chunk]; | ||
} | ||
else { | ||
drain = Buffer.concat([drain, chunk]); | ||
drain.push(chunk); | ||
} | ||
@@ -104,5 +104,5 @@ next(); | ||
.on('error', reject) | ||
.on('finish', () => resolve(drain)); | ||
.on('finish', () => resolve(Buffer.concat(drain))); | ||
}); | ||
} | ||
exports.streamToPromise = streamToPromise; |
@@ -32,3 +32,2 @@ "use strict"; | ||
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})?$/, | ||
@@ -35,0 +34,0 @@ }; |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.keys(subject).forEach((key) => { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -204,2 +204,3 @@ const val = subject[key]; | ||
objectMode: true, | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
transform: (line, encoding, cb) => { | ||
@@ -308,6 +309,4 @@ if (isJSON || (isJSON === undefined && line[0] === '{')) { | ||
...video, | ||
/* eslint-disable-next-line @typescript-eslint/camelcase */ | ||
family_friendly: boolToYESNO(video.family_friendly), | ||
live: boolToYESNO(video.live), | ||
/* eslint-disable-next-line @typescript-eslint/camelcase */ | ||
requires_subscription: boolToYESNO(video.requires_subscription), | ||
@@ -329,7 +328,5 @@ tag: [], | ||
if (typeof video.view_count === 'string') { | ||
/* eslint-disable-next-line @typescript-eslint/camelcase */ | ||
nv.view_count = parseInt(video.view_count, 10); | ||
} | ||
else if (typeof video.view_count === 'number') { | ||
/* eslint-disable-next-line @typescript-eslint/camelcase */ | ||
nv.view_count = video.view_count; | ||
@@ -336,0 +333,0 @@ } |
{ | ||
"name": "sitemap", | ||
"version": "6.1.4", | ||
"version": "6.1.5", | ||
"description": "Sitemap-generating lib/cli", | ||
@@ -97,5 +97,15 @@ "keywords": [ | ||
], | ||
"@typescript-eslint/camelcase": "off", | ||
"@typescript-eslint/explicit-member-accessibility": "off", | ||
"@typescript-eslint/interface-name-prefix": "off", | ||
"@typescript-eslint/naming-convention": [ | ||
"error", | ||
{ | ||
"selector": "default", | ||
"format": null | ||
}, | ||
{ | ||
"selector": "interface", | ||
"prefix": [], | ||
"format": null | ||
} | ||
], | ||
"@typescript-eslint/no-parameter-properties": "off", | ||
@@ -143,3 +153,3 @@ "@typescript-eslint/no-unused-vars": [ | ||
"dependencies": { | ||
"@types/node": "^14.0.1", | ||
"@types/node": "^14.0.5", | ||
"@types/sax": "^1.2.1", | ||
@@ -150,18 +160,18 @@ "arg": "^4.1.3", | ||
"devDependencies": { | ||
"@babel/core": "^7.9.6", | ||
"@babel/core": "^7.10.0", | ||
"@babel/plugin-proposal-class-properties": "^7.8.3", | ||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", | ||
"@babel/plugin-proposal-optional-chaining": "^7.9.0", | ||
"@babel/plugin-transform-typescript": "^7.9.6", | ||
"@babel/preset-env": "^7.9.6", | ||
"@babel/plugin-proposal-optional-chaining": "^7.10.0", | ||
"@babel/plugin-transform-typescript": "^7.10.0", | ||
"@babel/preset-env": "^7.10.0", | ||
"@babel/preset-typescript": "^7.9.0", | ||
"@types/jest": "^25.2.1", | ||
"@typescript-eslint/eslint-plugin": "^2.33.0", | ||
"@typescript-eslint/parser": "^2.33.0", | ||
"@types/jest": "^25.2.3", | ||
"@typescript-eslint/eslint-plugin": "^3.0.1", | ||
"@typescript-eslint/parser": "^3.0.1", | ||
"babel-eslint": "^10.1.0", | ||
"babel-polyfill": "^6.26.0", | ||
"concurrently": "^5.2.0", | ||
"eslint": "^7.0.0", | ||
"eslint": "^7.1.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-jest": "^23.11.0", | ||
"eslint-plugin-jest": "^23.13.2", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
@@ -171,5 +181,5 @@ "express": "^4.17.1", | ||
"jest": "^26.0.1", | ||
"lint-staged": "^10.2.2", | ||
"lint-staged": "^10.2.6", | ||
"prettier": "^2.0.5", | ||
"sort-package-json": "^1.42.2", | ||
"sort-package-json": "^1.42.3", | ||
"source-map": "~0.7.3", | ||
@@ -179,6 +189,6 @@ "stats-lite": "^2.2.0", | ||
"through2-map": "^3.0.0", | ||
"typescript": "^3.9.2" | ||
"typescript": "^3.9.3" | ||
}, | ||
"engines": { | ||
"node": ">=10.0.0", | ||
"node": ">=10.3.0", | ||
"npm": ">=5.6.0" | ||
@@ -185,0 +195,0 @@ }, |
@@ -30,4 +30,3 @@ # 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) | ||
If you are just looking to take a giant list of URLs and turn it into some sitemaps, | ||
try out our CLI. The cli can also parse, update and validate existing sitemaps. | ||
If you are just looking to take a giant list of URLs and turn it into some sitemaps, try out our CLI. The cli can also parse, update and validate existing sitemaps. | ||
@@ -38,2 +37,23 @@ ```sh | ||
For programmatic one time generation of a sitemap try: | ||
```js | ||
const { SitemapStream, streamToPromise } = require( 'sitemap' ) | ||
// An array with your links | ||
const links = [{ url: '/page-1/', changefreq: 'daily', priority: 0.3 }] | ||
// Create a stream to write to | ||
const stream = new SitemapStream( { hostname: 'https://...' } ) | ||
// Loop over your links and add them to your stream | ||
links.forEach( link => stream.write( link ) ) | ||
// End the stream | ||
stream.end() | ||
// Return a promise that resolves with your XML string | ||
return streamToPromise( stream ).then( data => data.toString() ) | ||
``` | ||
## Serve a sitemap from a server and periodically update it | ||
@@ -117,2 +137,3 @@ | ||
// when reading from a file | ||
lineSeparatedURLsToSitemapOptions( | ||
@@ -124,2 +145,10 @@ createReadStream('./your-data.json.txt') | ||
.pipe(createWriteStream(resolve('./sitemap-index.xml.gz'))); | ||
// or reading straight from an in-memory array | ||
sms | ||
.pipe(createGzip()) | ||
.pipe(createWriteStream(resolve('./sitemap-index.xml.gz'))); | ||
const arrayOfSitemapItems = [{ url: '/page-1/', changefreq: 'daily'}, ...] | ||
arrayOfSitemapItems.forEach(item => sms.write(item)) | ||
``` | ||
@@ -126,0 +155,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
144996
30
247
2640
Updated@types/node@^14.0.5