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

@bonniernews/local-esi

Package Overview
Dependencies
Maintainers
26
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bonniernews/local-esi - npm Package Compare versions

Comparing version 2.5.0 to 3.0.0-beta.0

CHANGELOG.md

11

index.js

@@ -1,9 +0,8 @@

"use strict";
import { pipeline, Readable } from "stream";
import HTMLStream from "@bonniernews/atlas-html-stream";
const { pipeline, Readable } = require("stream");
const ESI = require("./lib/ESI");
const HTMLStream = require("@bonniernews/atlas-html-stream");
const HTMLWriter = require("./lib/HTMLWriter");
import ESI from "./lib/ESI.js";
import HTMLWriter from "./lib/HTMLWriter.js";
module.exports = {
export {
ESI,

@@ -10,0 +9,0 @@ HTMLWriter,

@@ -1,8 +0,6 @@

"use strict";
import ESIEvaluator from "./ESIEvaluator.js";
import ListenerContext from "./ListenerContext.js";
import ESIBase from "./ESIBase.js";
const ESIEvaluator = require("./ESIEvaluator");
const ListenerContext = require("./ListenerContext");
const ESIBase = require("./ESIBase");
module.exports = class ESI extends ESIBase {
export default class ESI extends ESIBase {
constructor(options) {

@@ -13,2 +11,2 @@ const evaluator = new ESIEvaluator(new ListenerContext(options));

}
};
}

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

"use strict";
import { Transform } from "stream";
const { Transform } = require("stream");
module.exports = class ESIBase extends Transform {
export default class ESIBase extends Transform {
constructor(evaluator) {

@@ -20,2 +18,2 @@ super({ objectMode: true });

}
};
}
/* eslint-disable no-use-before-define */
"use strict";
import { pipeline, Readable } from "stream";
import HTMLStream from "@bonniernews/atlas-html-stream";
const { assign, test, replace } = require("./evaluateExpression");
const { pipeline, Readable } = require("stream");
const ESIBase = require("./ESIBase");
const HTMLStream = require("@bonniernews/atlas-html-stream");
import { assign, test, replace } from "./evaluateExpression.js";
import ESIBase from "./ESIBase.js";

@@ -279,3 +278,3 @@ class ESITag {

class ESIEvaluator {
export default class ESIEvaluator {
constructor(context) {

@@ -385,3 +384,1 @@ this.context = context;

}
module.exports = ESIEvaluator;

@@ -1,13 +0,5 @@

"use strict";
import evaluate from "./expression/evaluate.js";
import { parse, split } from "./expression/parser.js";
const evaluate = require("./expression/evaluate");
const { parse, split } = require("./expression/parser");
module.exports = {
assign,
test,
replace,
};
function assign(value, context) {
export function assign(value, context) {
if (value === "true" || value === "false") return value;

@@ -17,7 +9,7 @@ return evaluate(parse(value), context);

function test(expression, context) {
export function test(expression, context) {
return evaluate(parse(expression), context);
}
function replace(text, context) {
export function replace(text, context) {
if (!text) return;

@@ -24,0 +16,0 @@

/* eslint-disable camelcase */
"use strict";
const crypto = require("crypto");
const ent = require("ent");
import crypto from "crypto";
import ent from "ent";

@@ -208,5 +207,5 @@ class Evaluator {

module.exports = function evaluate(ast, context) {
export default function evaluate(ast, context) {
return new Evaluator(context).execute(ast.type, ast);
};
}

@@ -213,0 +212,0 @@ function castRight(left, right) {

/* eslint-disable prefer-template */
"use strict";
import {
ARRAY,
BINARY,
BLOCK,
BOOLEAN,
ENDMARK,
FUNCTION,
IDENTIFIER,
IDENTIFIER_CHARS,
LITERAL,
LOGICAL,
MEMBER,
NUMBER,
OBJECT,
UNARY,
WHITESPACE,
} from "./types.js";

@@ -21,20 +37,2 @@ const oneCharacterSymbols = "=()<>|*+-&{}/%,]:";

const {
ARRAY,
BINARY,
BLOCK,
BOOLEAN,
ENDMARK,
FUNCTION,
IDENTIFIER,
IDENTIFIER_CHARS,
LITERAL,
LOGICAL,
MEMBER,
NUMBER,
OBJECT,
UNARY,
WHITESPACE,
} = require("./types");
class EsiSyntaxError extends SyntaxError {

@@ -212,3 +210,3 @@ constructor(message, source, column) {

class Lexer {
export class Lexer {
constructor(str, columnOffset, line) {

@@ -462,3 +460,1 @@ this.str = str;

}
module.exports = { Lexer };
/* eslint-disable prefer-template */
"use strict";
const { Lexer } = require("./lexer");
const {
import { Lexer } from "./lexer.js";
import {
ARRAY,

@@ -20,9 +18,4 @@ BINARY,

WHITESPACE,
} = require("./types");
} from "./types.js";
module.exports = {
parse,
split,
};
class AST {

@@ -380,3 +373,3 @@ constructor() {

function parse(input, columnOffset) {
export function parse(input, columnOffset) {
if (!input) return;

@@ -394,3 +387,3 @@ input = input.trim();

function split(input) {
export function split(input) {
const lines = input.split("\n");

@@ -397,0 +390,0 @@

@@ -1,20 +0,16 @@

"use strict";
module.exports = {
ARRAY: "ArrayExpression",
BINARY: "BinaryExpression",
BLOCK: "BlockStatement",
BOOLEAN: "Boolean",
ENDMARK: "EOL",
EXPRESSION: "Expression",
FUNCTION: "CallExpression",
IDENTIFIER: "Identifier",
LITERAL: "Literal",
LOGICAL: "LogicalExpression",
MEMBER: "MemberExpression",
NUMBER: "Number",
OBJECT: "ObjectExpression",
UNARY: "UnaryExpression",
WHITESPACE: "Space",
IDENTIFIER_CHARS: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_",
};
export const ARRAY = "ArrayExpression";
export const BINARY = "BinaryExpression";
export const BLOCK = "BlockStatement";
export const BOOLEAN = "Boolean";
export const ENDMARK = "EOL";
export const EXPRESSION = "Expression";
export const FUNCTION = "CallExpression";
export const IDENTIFIER = "Identifier";
export const LITERAL = "Literal";
export const LOGICAL = "LogicalExpression";
export const MEMBER = "MemberExpression";
export const NUMBER = "Number";
export const OBJECT = "ObjectExpression";
export const UNARY = "UnaryExpression";
export const WHITESPACE = "Space";
export const IDENTIFIER_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";

@@ -1,7 +0,6 @@

"use strict";
import { Transform } from "stream";
const { chunkToMarkup } = require("./markup");
const { Transform } = require("stream");
import { chunkToMarkup } from "./markup.js";
module.exports = class HTMLWriter extends Transform {
export default class HTMLWriter extends Transform {
constructor() {

@@ -19,2 +18,2 @@ super({ writableObjectMode: true });

}
};
}

@@ -1,9 +0,8 @@

"use strict";
import { EventEmitter } from "events";
import request from "got";
const { chunkToMarkup } = require("./markup");
const { EventEmitter } = require("events");
const { replace } = require("./evaluateExpression");
const request = require("got");
import { chunkToMarkup } from "./markup.js";
import { replace } from "./evaluateExpression.js";
module.exports = class ListenerContext {
export default class ListenerContext {
constructor(options = {}, emitter) {

@@ -118,3 +117,3 @@ this.options = options;

}
};
}

@@ -121,0 +120,0 @@ function buildHeaderVariables(headers) {

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

"use strict";
import { selfClosingElements, voidElements } from "./voidElements.js";
const { selfClosingElements, voidElements } = require("./voidElements");
module.exports = {
chunkToMarkup,
opentag,
closetag,
export {
voidElements,

@@ -13,3 +8,3 @@ selfClosingElements,

function chunkToMarkup({ name, data, text }) {
export function chunkToMarkup({ name, data, text }) {
let markup = "";

@@ -23,3 +18,3 @@ if (text) markup += text;

function opentag(tagname, attribs) {
export function opentag(tagname, attribs) {
if (selfClosingElements.includes(tagname)) {

@@ -34,3 +29,3 @@ return `<${tagname}${attributesToString(attribs)}/>`;

function closetag(tagname) {
export function closetag(tagname) {
if (selfClosingElements.includes(tagname) || voidElements.includes(tagname)) {

@@ -37,0 +32,0 @@ return "";

@@ -1,9 +0,7 @@

"use strict";
const voidElements = [ "area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr" ];
const selfClosingElements = [ "esi:include", "esi:eval", "esi:assign", "esi:debug", "esi:break" ];
module.exports = {
export {
voidElements,
selfClosingElements,
};
{
"name": "@bonniernews/local-esi",
"version": "2.5.0",
"version": "3.0.0-beta.0",
"description": "Local Edge Side Includes parser",
"main": "index.js",
"type": "module",
"scripts": {
"test": "mocha",
"posttest": "eslint . --cache"
"posttest": "eslint . --cache",
"prepack": "./node_modules/.bin/rollup index.js --format cjs --file index.cjs && ./node_modules/.bin/rollup ./lib/voidElements.js --format cjs --file ./lib/voidElements.cjs"
},

@@ -25,7 +27,18 @@ "keywords": [

"eslint": "^8.23.1",
"eslint-config-exp": "^0.1.1",
"eslint-config-exp": "^0.6.2",
"got": "^11.8.5",
"mocha": "^10.0.0",
"nock": "^13.2.9"
"mocha": "10.2.0",
"nock": "^13.2.9",
"rollup": "^3.25.3"
},
"exports": {
".": {
"import": "./index.js",
"require": "./index.cjs"
},
"./lib/voidElements": {
"import": "./lib/voidElements.js",
"require": "./lib/voidElements.cjs"
}
},
"engines": {

@@ -32,0 +45,0 @@ "node": ">=14"

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