New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@popeindustries/lit-html-server

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@popeindustries/lit-html-server - npm Package Compare versions

Comparing version 1.0.0-rc.5 to 1.0.0-rc.6

example/index.js

85

index.js

@@ -8,17 +8,2 @@ 'use strict';

/**
* An empty string Buffer
*/
const emptyStringBuffer = Buffer.from('');
/**
* A value for strings that signals a Part to clear its content
*/
const nothingString = '__nothing-lit-html-server-string__';
/**
* A prefix value for strings that should not be escaped
*/
const unsafePrefixString = '__unsafe-lit-html-server-string__';
/**
* Determine if "promise" is a Promise instance

@@ -80,2 +65,17 @@ *

/**
* An empty string Buffer
*/
const emptyStringBuffer = Buffer.from('');
/**
* A value for strings that signals a Part to clear its content
*/
const nothingString = '__nothing-lit-html-server-string__';
/**
* A prefix value for strings that should not be escaped
*/
const unsafePrefixString = '__unsafe-lit-html-server-string__';
// https://github.com/facebook/react/packages/react-dom/src/server/escapeTextForBrowser.js

@@ -591,2 +591,12 @@

/**
* Determine whether "result" is a TemplateResult
*
* @param { TemplateResult } result
* @returns { boolean }
*/
function isTemplateResult(result) {
return result instanceof TemplateResult;
}
/**
* Retrieve TemplateResult instance.

@@ -613,12 +623,2 @@ * Uses an object pool to recycle instances.

/**
* Determine whether "result" is a TemplateResult
*
* @param { TemplateResult } result
* @returns { boolean }
*/
function isTemplateResult(result) {
return result instanceof TemplateResult;
}
/**
* A class for consuming the combined static and dynamic parts of a lit-html Template.

@@ -763,3 +763,3 @@ * TemplateResults

return chunk.reduce((buffer, chunk) => reduce(buffer, chunks, chunk), buffer);
} else if (isPromise(chunk)) {
} else if (isPromise(chunk) || isAsyncIterator(chunk)) {
chunks.push(buffer, chunk);

@@ -839,5 +839,7 @@ return emptyStringBuffer;

function flushBuffer() {
if (highWaterMark > 0 && buffer.length > 0) {
renderer.push(Buffer.concat(buffer, bufferLength));
if (buffer.length > 0) {
const keepPushing = renderer.push(Buffer.concat(buffer, bufferLength));
bufferLength = buffer.length = 0;
return keepPushing;
}

@@ -865,20 +867,8 @@ }

if (Buffer.isBuffer(chunk)) {
let shouldPush = true;
// Buffer data if highWaterMark set
if (highWaterMark > 0) {
buffer.push(chunk);
bufferLength += chunk.length;
// Flush buffered data if over highWaterMark
if (bufferLength > highWaterMark) {
flushBuffer();
} else {
shouldPush = false;
}
}
if (shouldPush) {
buffer.push(chunk);
bufferLength += chunk.length;
// Flush buffered data if over highWaterMark
if (bufferLength > highWaterMark) {
// Pause if backpressure triggered
if (!renderer.push(chunk)) {
breakLoop = true;
}
breakLoop = !flushBuffer();
}

@@ -917,5 +907,4 @@ } else if (isPromise(chunk)) {

} else if (Array.isArray(chunk)) {
// An existing TemplateResult will have already set this to "false",
// so only remove existing Array if there is no active TemplateResult
if (popStack === true) {
// First remove existing Array if at top of stack (not added by pending TemplateResult)
if (stack[0] === chunk) {
popStack = false;

@@ -922,0 +911,0 @@ stack.shift();

{
"name": "@popeindustries/lit-html-server",
"version": "1.0.0-rc.5",
"version": "1.0.0-rc.6",
"description": "Render lit-html templates on the server",

@@ -5,0 +5,0 @@ "keywords": [

@@ -34,5 +34,7 @@ /**

function flushBuffer() {
if (highWaterMark > 0 && buffer.length > 0) {
renderer.push(Buffer.concat(buffer, bufferLength));
if (buffer.length > 0) {
const keepPushing = renderer.push(Buffer.concat(buffer, bufferLength));
bufferLength = buffer.length = 0;
return keepPushing;
}

@@ -60,20 +62,8 @@ }

if (Buffer.isBuffer(chunk)) {
let shouldPush = true;
// Buffer data if highWaterMark set
if (highWaterMark > 0) {
buffer.push(chunk);
bufferLength += chunk.length;
// Flush buffered data if over highWaterMark
if (bufferLength > highWaterMark) {
flushBuffer();
} else {
shouldPush = false;
}
}
if (shouldPush) {
buffer.push(chunk);
bufferLength += chunk.length;
// Flush buffered data if over highWaterMark
if (bufferLength > highWaterMark) {
// Pause if backpressure triggered
if (!renderer.push(chunk)) {
breakLoop = true;
}
breakLoop = !flushBuffer();
}

@@ -112,5 +102,4 @@ } else if (isPromise(chunk)) {

} else if (Array.isArray(chunk)) {
// An existing TemplateResult will have already set this to "false",
// so only remove existing Array if there is no active TemplateResult
if (popStack === true) {
// First remove existing Array if at top of stack (not added by pending TemplateResult)
if (stack[0] === chunk) {
popStack = false;

@@ -117,0 +106,0 @@ stack.shift();

@@ -0,4 +1,4 @@

import { isAsyncIterator, isPromise } from './is.js';
import { AttributePart } from './parts.js';
import { emptyStringBuffer } from './string.js';
import { isPromise } from './is.js';

@@ -9,2 +9,12 @@ const pool = [];

/**
* Determine whether "result" is a TemplateResult
*
* @param { TemplateResult } result
* @returns { boolean }
*/
export function isTemplateResult(result) {
return result instanceof TemplateResult;
}
/**
* Retrieve TemplateResult instance.

@@ -31,12 +41,2 @@ * Uses an object pool to recycle instances.

/**
* Determine whether "result" is a TemplateResult
*
* @param { TemplateResult } result
* @returns { boolean }
*/
export function isTemplateResult(result) {
return result instanceof TemplateResult;
}
/**
* A class for consuming the combined static and dynamic parts of a lit-html Template.

@@ -181,3 +181,3 @@ * TemplateResults

return chunk.reduce((buffer, chunk) => reduce(buffer, chunks, chunk), buffer);
} else if (isPromise(chunk)) {
} else if (isPromise(chunk) || isAsyncIterator(chunk)) {
chunks.push(buffer, chunk);

@@ -184,0 +184,0 @@ return emptyStringBuffer;

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