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

forgo

Package Overview
Dependencies
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

forgo - npm Package Compare versions

Comparing version 0.0.47 to 0.0.48

3

dist/index.d.ts

@@ -0,1 +1,2 @@

import { DOMWindow } from "jsdom";
declare global {

@@ -73,3 +74,3 @@ interface ChildNode {

export declare type EnvType = {
window: Window | typeof globalThis;
window: DOMWindow;
document: HTMLDocument;

@@ -76,0 +77,0 @@ };

@@ -548,15 +548,15 @@ "use strict";

if (key !== "children" && key !== "xmlns") {
if (node.nodeType === ELEMENT_NODE_TYPE) {
const namespaceURI = node.namespaceURI;
if (namespaceURI !== MATH_NAMESPACE &&
namespaceURI !== SVG_NAMESPACE) {
node[key] = undefined;
if (node instanceof env.window.Text) {
node[key] = undefined;
}
else if (node instanceof env.window.HTMLElement) {
if (key.includes("-")) {
node.removeAttribute(key);
}
else {
node.removeAttribute(key);
node[key] = undefined;
}
}
// Not an element.
else {
node[key] = undefined;
node.removeAttribute(key);
}

@@ -571,25 +571,20 @@ }

if (key !== "children" && key !== "xmlns") {
if (node.nodeType === ELEMENT_NODE_TYPE) {
const namespaceURI = node.namespaceURI;
if (namespaceURI !== MATH_NAMESPACE &&
namespaceURI !== SVG_NAMESPACE) {
if (key.includes("-") && typeof value === "string") {
node.setAttribute(key, value);
}
else {
node[key] = value;
}
if (node instanceof env.window.Text) {
node[key] = value;
}
else if (node instanceof env.window.HTMLElement) {
if (key.includes("-") && typeof value === "string") {
node.setAttribute(key, value);
}
else {
if (typeof value === "string") {
node.setAttribute(key, value);
}
else {
node[key] = value;
}
node[key] = value;
}
}
// Not an element.
else {
node[key] = value;
if (typeof value === "string") {
node.setAttribute(key, value);
}
else {
node[key] = value;
}
}

@@ -596,0 +591,0 @@ }

{
"name": "forgo",
"version": "0.0.47",
"version": "0.0.48",
"main": "./dist",

@@ -5,0 +5,0 @@ "author": "Jeswin Kumar<jeswinpk@agilehead.com>",

@@ -512,2 +512,24 @@ # forgo

## Server-side Rendering (SSR)
You can render components to an html (string) with the forgo-ssr package. This allows you to prerender components on the server and will work with Node.JS servers like Koa, Express etc. Read more at https://github.com/forgojs/forgo-ssr
Here's an example:
```js
import render from "forgo-ssr";
// A forgo component.
function MyComponent() {
return {
render() {
return <div>Hello world</div>;
},
};
}
// Get the html (string) and serve it via koa, express etc.
const html = render(<MyComponent />);
```
## Try it out on CodeSandbox

@@ -514,0 +536,0 @@

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

import { DOMWindow } from "jsdom";
declare global {

@@ -167,3 +169,3 @@ interface ChildNode {

export type EnvType = {
window: Window | typeof globalThis;
window: DOMWindow;
document: HTMLDocument;

@@ -1030,17 +1032,13 @@ };

if (key !== "children" && key !== "xmlns") {
if (node.nodeType === ELEMENT_NODE_TYPE) {
const namespaceURI = (node as Element).namespaceURI;
if (
namespaceURI !== MATH_NAMESPACE &&
namespaceURI !== SVG_NAMESPACE
) {
if (node instanceof env.window.Text) {
(node as any)[key] = undefined;
} else if (node instanceof env.window.HTMLElement) {
if (key.includes("-")) {
(node as Element).removeAttribute(key);
} else {
(node as any)[key] = undefined;
} else {
(node as Element).removeAttribute(key);
}
} else {
(node as Element).removeAttribute(key);
}
// Not an element.
else {
(node as any)[key] = undefined;
}
}

@@ -1055,25 +1053,17 @@ }

if (key !== "children" && key !== "xmlns") {
if (node.nodeType === ELEMENT_NODE_TYPE) {
const namespaceURI = (node as Element).namespaceURI;
if (
namespaceURI !== MATH_NAMESPACE &&
namespaceURI !== SVG_NAMESPACE
) {
if (key.includes("-") && typeof value === "string") {
(node as Element).setAttribute(key, value);
} else {
(node as any)[key] = value;
}
if (node instanceof env.window.Text) {
(node as any)[key] = value;
} else if (node instanceof env.window.HTMLElement) {
if (key.includes("-") && typeof value === "string") {
(node as Element).setAttribute(key, value);
} else {
if (typeof value === "string") {
(node as Element).setAttribute(key, value);
} else {
(node as any)[key] = value;
}
(node as any)[key] = value;
}
} else {
if (typeof value === "string") {
(node as Element).setAttribute(key, value);
} else {
(node as any)[key] = value;
}
}
// Not an element.
else {
(node as any)[key] = value;
}
}

@@ -1080,0 +1070,0 @@ }

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