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

ssg-api

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssg-api - npm Package Compare versions

Comparing version 1.7.0 to 1.7.1

2

dist/src/util/file/HtmlSsgFile.d.ts

@@ -52,2 +52,4 @@ /// <reference types="node" />

serialize(): string;
private updateLinkTags;
private updateMetaTags;
set dom(newDom: JSDOM);

@@ -54,0 +56,0 @@ get contents(): string;

@@ -40,6 +40,32 @@ import { SsgFile } from './SsgFile.js';

serialize() {
this.updateMetaTags();
this.updateLinkTags();
return this.dom.serialize();
}
updateLinkTags() {
const document = this.document;
this.meta.generator = this.meta.generator || 'ssg-api';
for (const metaName in this.meta) {
const newContent = this.meta[metaName];
const links = this.links;
for (const linkRel in links) {
const link = links[linkRel];
if (link) {
const rel = link.type;
let linkElem = document.querySelector(`link[rel="${rel}"]`);
if (!linkElem) {
linkElem = document.createElement('link');
linkElem.setAttribute('rel', rel);
document.head.append(linkElem);
}
linkElem.setAttribute('href', link.url);
if (link.text) {
linkElem.setAttribute('title', link.text);
}
}
}
}
updateMetaTags() {
const document = this.document;
const meta = this.meta;
meta.generator = meta.generator || 'ssg-api';
for (const metaName in meta) {
const newContent = meta[metaName];
const contents = newContent ? Array.isArray(newContent) ? newContent : [newContent] : [];

@@ -56,3 +82,2 @@ for (const content of contents) {

}
return this.dom.serialize();
}

@@ -59,0 +84,0 @@ set dom(newDom) {

2

package.json

@@ -5,3 +5,3 @@ {

"author": "Jérôme Beau <javarome@gmail.com> (https://javarome.com)",
"version": "1.7.0",
"version": "1.7.1",
"description": "Static Site Generation TypeScript API",

@@ -8,0 +8,0 @@ "exports": "./dist/src/index.js",

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