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

@ekino/rendr-sitemap

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ekino/rendr-sitemap - npm Package Compare versions

Comparing version 0.0.13 to 0.0.14

6

dist/_bundles/rendr-core.d.ts

@@ -0,3 +1,3 @@

/// <reference types="node" />
/// <reference types="express" />
/// <reference types="node" />
declare module "types" {

@@ -10,5 +10,9 @@ export type Options = {

import { PageReference, StreamCreator, PageReferenceGenerator } from "@ekino/rendr-core";
import { PageBuilder } from "@ekino/rendr-loader";
import { Writable } from "stream";
import Express from "express";
import { Options } from "types";
import { ServerResponse } from "http";
export function sendSitemap(res: ServerResponse, generator: PageReferenceGenerator): Promise<void>;
export function createSitemapPageBuilder(generator: PageReferenceGenerator): PageBuilder;
export function createSitemapRequestHandler(generator: PageReferenceGenerator): Express.RequestHandler;

@@ -15,0 +19,0 @@ export function createSitemapWritable(createStream: StreamCreator, options: Options): Writable;

43

dist/_bundles/rendr-core.js

@@ -37,5 +37,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
define("types", ["require", "exports"], function (require, exports) {

@@ -45,10 +42,7 @@ "use strict";

});
define("sitemap", ["require", "exports", "@ekino/rendr-core", "stream", "util"], function (require, exports, rendr_core_1, stream_1, util_1) {
define("sitemap", ["require", "exports", "@ekino/rendr-core", "stream"], function (require, exports, rendr_core_1, stream_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
util_1 = __importDefault(util_1);
var pipeline = util_1.default.promisify(stream_1.pipeline);
function createSitemapRequestHandler(generator) {
var _this = this;
return function (req, res, next) { return __awaiter(_this, void 0, void 0, function () {
function sendSitemap(res, generator) {
return __awaiter(this, void 0, void 0, function () {
var iter, sitemapWritable;

@@ -58,3 +52,4 @@ return __generator(this, function (_a) {

case 0:
res.set("X-Rendr-Content-Type", "application/xml");
res.setHeader("Content-Type", "application/xml");
res.setHeader("X-Rendr-Content-Type", "render/sitemap");
iter = rendr_core_1.transformGenerator(generator(), toSitemapEntry);

@@ -70,4 +65,32 @@ sitemapWritable = createSitemapWritable(function (name) { return res; }, {

});
});
}
exports.sendSitemap = sendSitemap;
function createSitemapPageBuilder(generator) {
var _this = this;
return function (ctx, page) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, sendSitemap(ctx.res, generator)];
case 1:
_a.sent();
return [2];
}
});
}); };
}
exports.createSitemapPageBuilder = createSitemapPageBuilder;
function createSitemapRequestHandler(generator) {
var _this = this;
return function (req, res, next) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, sendSitemap(res, generator)];
case 1:
_a.sent();
return [2];
}
});
}); };
}
exports.createSitemapRequestHandler = createSitemapRequestHandler;

@@ -74,0 +97,0 @@ function createSitemapWritable(createStream, options) {

/// <reference types="node" />
import { PageReference, StreamCreator, PageReferenceGenerator } from "@ekino/rendr-core";
import { PageBuilder } from "@ekino/rendr-loader";
import { Writable } from "stream";
import Express from "express";
import { Options } from "./types";
import { ServerResponse } from "http";
export declare function sendSitemap(res: ServerResponse, generator: PageReferenceGenerator): Promise<void>;
export declare function createSitemapPageBuilder(generator: PageReferenceGenerator): PageBuilder;
export declare function createSitemapRequestHandler(generator: PageReferenceGenerator): Express.RequestHandler;

@@ -7,0 +11,0 @@ export declare function createSitemapWritable(createStream: StreamCreator, options: Options): Writable;

@@ -38,8 +38,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import { transformGenerator, pipeIteratorToWritable } from "@ekino/rendr-core";
import { pipeline as StreamPipeline, Writable } from "stream";
import util from "util";
var pipeline = util.promisify(StreamPipeline);
export function createSitemapRequestHandler(generator) {
var _this = this;
return function (req, res, next) { return __awaiter(_this, void 0, void 0, function () {
import { Writable } from "stream";
export function sendSitemap(res, generator) {
return __awaiter(this, void 0, void 0, function () {
var iter, sitemapWritable;

@@ -49,3 +46,4 @@ return __generator(this, function (_a) {

case 0:
res.set("X-Rendr-Content-Type", "application/xml");
res.setHeader("Content-Type", "application/xml");
res.setHeader("X-Rendr-Content-Type", "render/sitemap");
iter = transformGenerator(generator(), toSitemapEntry);

@@ -61,4 +59,30 @@ sitemapWritable = createSitemapWritable(function (name) { return res; }, {

});
});
}
export function createSitemapPageBuilder(generator) {
var _this = this;
return function (ctx, page) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, sendSitemap(ctx.res, generator)];
case 1:
_a.sent();
return [2];
}
});
}); };
}
export function createSitemapRequestHandler(generator) {
var _this = this;
return function (req, res, next) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, sendSitemap(res, generator)];
case 1:
_a.sent();
return [2];
}
});
}); };
}
export function createSitemapWritable(createStream, options) {

@@ -65,0 +89,0 @@ var MAX_ENTRY_SITEMAP = 50000;

/// <reference types="node" />
import { PageReference, StreamCreator, PageReferenceGenerator } from "@ekino/rendr-core";
import { PageBuilder } from "@ekino/rendr-loader";
import { Writable } from "stream";
import Express from "express";
import { Options } from "./types";
import { ServerResponse } from "http";
export declare function sendSitemap(res: ServerResponse, generator: PageReferenceGenerator): Promise<void>;
export declare function createSitemapPageBuilder(generator: PageReferenceGenerator): PageBuilder;
export declare function createSitemapRequestHandler(generator: PageReferenceGenerator): Express.RequestHandler;

@@ -7,0 +11,0 @@ export declare function createSitemapWritable(createStream: StreamCreator, options: Options): Writable;

@@ -38,13 +38,7 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var rendr_core_1 = require("@ekino/rendr-core");
var stream_1 = require("stream");
var util_1 = __importDefault(require("util"));
var pipeline = util_1.default.promisify(stream_1.pipeline);
function createSitemapRequestHandler(generator) {
var _this = this;
return function (req, res, next) { return __awaiter(_this, void 0, void 0, function () {
function sendSitemap(res, generator) {
return __awaiter(this, void 0, void 0, function () {
var iter, sitemapWritable;

@@ -54,3 +48,4 @@ return __generator(this, function (_a) {

case 0:
res.set("X-Rendr-Content-Type", "application/xml");
res.setHeader("Content-Type", "application/xml");
res.setHeader("X-Rendr-Content-Type", "render/sitemap");
iter = rendr_core_1.transformGenerator(generator(), toSitemapEntry);

@@ -66,4 +61,32 @@ sitemapWritable = createSitemapWritable(function (name) { return res; }, {

});
});
}
exports.sendSitemap = sendSitemap;
function createSitemapPageBuilder(generator) {
var _this = this;
return function (ctx, page) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, sendSitemap(ctx.res, generator)];
case 1:
_a.sent();
return [2];
}
});
}); };
}
exports.createSitemapPageBuilder = createSitemapPageBuilder;
function createSitemapRequestHandler(generator) {
var _this = this;
return function (req, res, next) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, sendSitemap(res, generator)];
case 1:
_a.sent();
return [2];
}
});
}); };
}
exports.createSitemapRequestHandler = createSitemapRequestHandler;

@@ -70,0 +93,0 @@ function createSitemapWritable(createStream, options) {

{
"name": "@ekino/rendr-sitemap",
"license": "MIT",
"version": "0.0.13",
"version": "0.0.14",
"main": "dist/lib/index.js",

@@ -19,7 +19,7 @@ "typing": "dist/lib/index.d.ts",

"dependencies": {
"@ekino/rendr-core": "0.0.13",
"@ekino/rendr-loader": "0.0.13",
"@ekino/rendr-core": "0.0.14",
"@ekino/rendr-loader": "0.0.14",
"express": "^4.16.4"
},
"gitHead": "e9fcc0a6671174e9a2c54ac38bf3f8833143d568"
"gitHead": "fe3d847f373979f93acd4eaf800110310f68aeab"
}

@@ -8,11 +8,35 @@ import {

} from "@ekino/rendr-core";
import { pipeline as StreamPipeline, Writable, Readable } from "stream";
import { PageBuilder } from "@ekino/rendr-loader";
import { Writable } from "stream";
import Express from "express";
import util from "util";
import { Options } from "./types";
import { ServerResponse } from "http";
const pipeline = util.promisify(StreamPipeline);
export async function sendSitemap(
res: ServerResponse,
generator: PageReferenceGenerator
) {
res.setHeader("Content-Type", "application/xml");
res.setHeader("X-Rendr-Content-Type", "render/sitemap");
const iter = transformGenerator(generator(), toSitemapEntry);
const sitemapWritable = createSitemapWritable((name: string) => res, {
basePathIndex: ""
});
await pipeIteratorToWritable(iter, sitemapWritable);
}
export function createSitemapPageBuilder(
generator: PageReferenceGenerator
): PageBuilder {
return async (ctx, page) => {
// we don't care about the page, we just return binary to the output content
await sendSitemap(ctx.res, generator);
};
}
/**

@@ -30,11 +54,3 @@ * This function can be used to expose on sitemap with less than 50K items.

return async (req, res, next) => {
res.set("X-Rendr-Content-Type", "application/xml");
const iter = transformGenerator(generator(), toSitemapEntry);
const sitemapWritable = createSitemapWritable((name: string) => res, {
basePathIndex: ""
});
await pipeIteratorToWritable(iter, sitemapWritable);
await sendSitemap(res, generator);
};

@@ -41,0 +57,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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