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

multi-sitemap

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multi-sitemap - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0-1

16

dist/__tests__/SitemapProcessor-test.js

@@ -48,3 +48,7 @@ "use strict";

writer = new SitemapWriterMock_1.default();
processor = new SitemapProcessor_1.default({ writer: writer, maxEntriesPerFile: 2 });
processor = new SitemapProcessor_1.default({
maxEntriesPerFile: 2,
publicDirectoryUrl: '/sitemap',
writer: writer
});
addStaticResult = processor.addStatic({

@@ -73,7 +77,7 @@ name: 'pages',

index: [
{ url: './pages' },
{ url: './products-1' },
{ url: './products-2' },
{ url: './products-3' },
{ url: './products-4' }
{ url: '/sitemap/pages' },
{ url: '/sitemap/products-1' },
{ url: '/sitemap/products-2' },
{ url: '/sitemap/products-3' },
{ url: '/sitemap/products-4' }
],

@@ -80,0 +84,0 @@ pages: ['/', '/about'],

import { ISitemapReader, ISitemapWriter, SitemapEntryConfig } from './types';
export default class SitemapProcessor {
private maxEntriesPerFile;
private publicDirectoryUrl;
private sitemaps;
private writer;
private sitemaps;
private maxEntriesPerFile;
constructor({writer, maxEntriesPerFile}: {
constructor({maxEntriesPerFile, publicDirectoryUrl, writer}: {
maxEntriesPerFile?: number;
publicDirectoryUrl: string;
writer: ISitemapWriter;
maxEntriesPerFile?: number;
});

@@ -10,0 +12,0 @@ addDynamic({name, reader}: {

@@ -40,6 +40,7 @@ "use strict";

function SitemapProcessor(_a) {
var writer = _a.writer, _b = _a.maxEntriesPerFile, maxEntriesPerFile = _b === void 0 ? 50000 : _b;
var _b = _a.maxEntriesPerFile, maxEntriesPerFile = _b === void 0 ? 50000 : _b, publicDirectoryUrl = _a.publicDirectoryUrl, writer = _a.writer;
this.sitemaps = [];
this.maxEntriesPerFile = maxEntriesPerFile;
this.publicDirectoryUrl = publicDirectoryUrl;
this.writer = writer;
this.maxEntriesPerFile = maxEntriesPerFile;
}

@@ -128,2 +129,3 @@ SitemapProcessor.prototype.addDynamic = function (_a) {

return __awaiter(this, void 0, void 0, function () {
var _this = this;
var stream, entries;

@@ -135,3 +137,5 @@ return __generator(this, function (_a) {

stream = _a.sent();
entries = this.sitemaps.map(function (url) { return ({ url: "./" + url }); });
entries = this.sitemaps.map(function (name) { return ({
url: _this.publicDirectoryUrl + "/" + name
}); });
return [4 /*yield*/, stream.add(entries)];

@@ -138,0 +142,0 @@ case 2:

{
"name": "multi-sitemap",
"version": "0.2.0",
"version": "0.3.0-1",
"description": "Painless creation of large dynamic sitemaps that consist of multiple files.",

@@ -5,0 +5,0 @@ "author": "Jan Amann <jan@amann.me>",

@@ -18,4 +18,6 @@ # multi-sitemap

(async () => {
const writer = new SitemapWriterXml({directory: './static/sitemap'});
const processor = new SitemapProcessor({writer});
const processor = new SitemapProcessor({
publicDirectoryUrl: '/sitemap',
writer: new SitemapWriterXml({directory: './static/sitemap'});
});

@@ -22,0 +24,0 @@ await processor.addStatic({

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