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

@ewizardjs/blocks-renderer

Package Overview
Dependencies
Maintainers
7
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ewizardjs/blocks-renderer - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

dist/modules/server/index.d.ts

4

dist/interfaces/index.d.ts

@@ -35,1 +35,5 @@ import { PuppeteerNode } from 'puppeteer-core';

}
export interface IStaticServer {
port: string | number;
stop(): void;
}

@@ -10,2 +10,6 @@ import { ScreenshotOptions, Page, WaitForOptions, BrowserLaunchArgumentOptions, BrowserContext, Browser } from 'puppeteer-core';

createPage(url: string, requirePuppeteerCb: requirePuppeteerCb, waitForOptions: WaitForOptions, rendererOptions?: BrowserLaunchArgumentOptions, browserUrl?: string): Promise<void>;
hostContent(url: string): Promise<{
pageUrl: string;
server: import("../../interfaces").IStaticServer;
}>;
exposeClone(): Promise<void>;

@@ -12,0 +16,0 @@ addScriptsToPage(scripts: string[]): Promise<void>;

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

const fs_extra_1 = require("fs-extra");
const server_1 = require("../server");
class FacadePuppeteer {

@@ -16,10 +17,32 @@ constructor() { }

async createPage(url, requirePuppeteerCb, waitForOptions, rendererOptions = {}, browserUrl) {
const { pageUrl, server } = await this.hostContent(url);
const puppeteer = await requirePuppeteerCb();
const { browser, closeBrowser } = await browser_1.createBrowser(puppeteer, rendererOptions, browserUrl);
this.browser = browser;
this.closeBrowser = closeBrowser;
this.closeBrowser = async () => {
await closeBrowser();
server && server.stop();
};
this.page = await this.browser.newPage();
await this.exposeClone();
await this.page.goto(url, waitForOptions);
console.log("Block renderer");
console.log("this.page.gotoageUrl", pageUrl);
await this.page.goto(pageUrl, waitForOptions);
}
async hostContent(url) {
const { pathname, protocol } = new URL(url);
console.log("Host content\n");
console.log("URL: ", url);
console.log("Conetnt pathname: " + pathname);
console.log("Conetnt protocol: " + protocol);
if (protocol === 'file:') {
const server = await server_1.createServer(pathname.replace('/index.html', ''));
const pageUrl = `http://localhost:${server.port}`;
console.log("Static server: ", server);
console.log("pageUrl: ", pageUrl);
return { pageUrl, server };
}
console.log("pageUrl: ", url);
return { pageUrl: url, server: undefined };
}
async exposeClone() {

@@ -26,0 +49,0 @@ try {

6

package.json
{
"name": "@ewizardjs/blocks-renderer",
"version": "1.0.1",
"version": "1.1.0",
"description": "",

@@ -35,5 +35,7 @@ "main": "dist/index.js",

"clone": "^2.1.2",
"find-free-port": "^2.0.0",
"fs-extra": "^9.0.0",
"qs": "^6.10.3"
"qs": "^6.10.3",
"static-server": "^2.2.1"
}
}

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