Socket
Socket
Sign inDemoInstall

@paperbits/common

Package Overview
Dependencies
Maintainers
2
Versions
691
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paperbits/common - npm Package Compare versions

Comparing version 0.1.576 to 0.1.577

1

geocoding/googleGeocodingService.ts

@@ -19,2 +19,3 @@ import { Loader, LoaderOptions } from "@googlemaps/js-api-loader";

this.initPromise = this.loadGoogleApi();
return this.initPromise;
}

@@ -21,0 +22,0 @@

3

html.ts

@@ -133,3 +133,4 @@ import * as Arrays from "./arrays";

Language = "lang",
Direction = "dir"
Direction = "dir",
Charset = "charset"
}

@@ -136,0 +137,0 @@

{
"name": "@paperbits/common",
"version": "0.1.576",
"version": "0.1.577",
"description": "Paperbits common components.",

@@ -5,0 +5,0 @@ "author": "Paperbits",

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

import * as Utils from "@paperbits/common";
import { MimeTypes } from "@paperbits/common";
import { Attributes } from "@paperbits/common/html";
import { ISettingsProvider } from "../configuration";
import { HtmlDocumentProvider } from "./htmlDocumentProvider";

@@ -11,11 +13,20 @@ import { HtmlPage } from "./htmlPage";

export class HtmlPagePublisher {
private subresourceIntegrityEnabled: boolean;
constructor(
private readonly htmlDocumentProvider: HtmlDocumentProvider,
private readonly htmlPagePublisherPlugins: HtmlPagePublisherPlugin[],
private readonly htmlPageOptimizer: HtmlPageOptimizer
private readonly htmlPageOptimizer: HtmlPageOptimizer,
private readonly settingsProvider: ISettingsProvider
) { }
private initialize = Utils.debounce(this.loadSettings.bind(this));
private async loadSettings(): Promise<void> {
this.subresourceIntegrityEnabled = !!await this.settingsProvider.getSetting<boolean>("features/subresourceIntegrity");
}
private scaffoldPageDocument(document: Document): void {
const charsetMetaElement: HTMLMetaElement = document.createElement("meta");
charsetMetaElement.setAttribute("charset", "utf-8");
charsetMetaElement.setAttribute(Attributes.Charset, "utf-8");
document.head.appendChild(charsetMetaElement);

@@ -40,3 +51,3 @@

if (stylesheetLink.integrity) {
if (this.subresourceIntegrityEnabled && stylesheetLink.integrity) {
element.setAttribute(Attributes.Integrity, stylesheetLink.integrity);

@@ -55,3 +66,3 @@ }

if (scriptLink.integrity) {
if (this.subresourceIntegrityEnabled && scriptLink.integrity) {
element.setAttribute(Attributes.Integrity, scriptLink.integrity);

@@ -74,2 +85,4 @@ }

try {
await this.initialize();
const document = this.htmlDocumentProvider.createDocument();

@@ -76,0 +89,0 @@ this.scaffoldPageDocument(document);

@@ -394,2 +394,7 @@ import * as h2p from "html2plaintext";

return value.length > length ? `${value.substring(0, length)}...` : value;
}
export function debounce(func: () => Promise<void>): () => Promise<void> {
let promise: Promise<void>;
return () => promise ? promise : promise = func();
}
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