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

liquidjs

Package Overview
Dependencies
Maintainers
1
Versions
208
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

liquidjs - npm Package Compare versions

Comparing version 9.43.0 to 10.0.0

dist/cache/index.d.ts

32

CHANGELOG.md

@@ -0,1 +1,33 @@

# [10.0.0](https://github.com/harttle/liquidjs/compare/v9.43.0...v10.0.0) (2022-11-27)
### chore
* rename filters to snake style, [#487](https://github.com/harttle/liquidjs/issues/487) ([ff112a4](https://github.com/harttle/liquidjs/commit/ff112a4750f91475e9eccdb301d7a468e895f6ca))
### Code Refactoring
* `_evalToken` renamed to `evalToken` ([4e1a30a](https://github.com/harttle/liquidjs/commit/4e1a30a20c579408c87f2d28b9b6ec8e1dda65cc))
* change `ownPropertyOnly` default value to `true` ([7eb6216](https://github.com/harttle/liquidjs/commit/7eb621601c2b05d6e379e5ce42219f2b1f556208))
* delay creation of `operatorsTrie` and hide this implementation ([bb58d3e](https://github.com/harttle/liquidjs/commit/bb58d3e549dc5a5e067895ec4a0b3257b434f225))
* remove `toThenable` export ([ffefd91](https://github.com/harttle/liquidjs/commit/ffefd91fbc0195c589c8c34ae80f2017acfe557c))
* remove use of internal `Context` class in `evalValue` argument ([b115077](https://github.com/harttle/liquidjs/commit/b115077e122a7b90e7972d58174d68aea8edd7bf))
### Performance Improvements
* target Node.js 14 for cjs bundle (main entry) ([1f6ce7c](https://github.com/harttle/liquidjs/commit/1f6ce7c8224123cea318d1aa6c12aa091d6e0518))
### BREAKING CHANGES
* `evalToken` now returns a generator (LiquidJS async), which is different from `evalToken` in previous LiquidJS versions.
* main entry need Node.js>=14 to run, you can build LiquidJS by your own by using ESM entry.
* `ownPropertyOnly` default value changed to `true`
* `<liquidjs>.toThenable` is removed, use `<liquidjs>.toPromise` instead
* `evalValue` won't support `Context` as second argument anymore.
* use `operators` instead of `operatorsTrie` as Tokenizer constructor argument, #500
* keys in `<liquidjs>.filters` are now in snake case (instead of camel case), identical to that in Liquid template.
# [9.43.0](https://github.com/harttle/liquidjs/compare/v9.42.1...v9.43.0) (2022-11-27)

@@ -2,0 +34,0 @@

3

dist/context/block-mode.d.ts

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

declare enum BlockMode {
export declare enum BlockMode {
OUTPUT = 0,
STORE = 1
}
export default BlockMode;
import { Drop } from '../drop/drop';
export interface PlainObject {
[key: string]: any;
interface ScopeObject extends Record<string, any> {
toLiquid?: () => any;
}
export declare type Scope = PlainObject | Drop;
export declare type Scope = ScopeObject | Drop;
export {};

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

import { EmptyDrop } from '../drop/empty-drop';
import { EmptyDrop } from '../drop';
export declare class BlankDrop extends EmptyDrop {
equals(value: any): boolean;
}

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

import { Emitter } from '../types';
import { Emitter } from './emitter';
export declare class KeepingTypeEmitter implements Emitter {

@@ -3,0 +3,0 @@ buffer: any;

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

import { LiquidCache } from './cache/cache';
import { LiquidCache } from './cache';
import { FS } from './fs/fs';
import { Operators } from './render/operator';
import { Trie } from './util/operator-trie';
import { Operators } from './render';
declare type OutputEscape = (value: any) => string;

@@ -93,3 +92,2 @@ declare type OutputEscapeOption = 'escape' | 'json' | OutputEscape;

outputEscape?: OutputEscape;
operatorsTrie?: Trie;
}

@@ -124,3 +122,2 @@ export interface NormalizedFullOptions extends NormalizedOptions {

operators: Operators;
operatorsTrie: Trie;
}

@@ -127,0 +124,0 @@ export declare const defaultOptions: NormalizedFullOptions;

/// <reference types="node" />
import { Context } from './context/context';
import { Template } from './template/template';
import { Render } from './render/render';
import Parser from './parser/parser';
import { TagImplOptions } from './template/tag/tag-impl-options';
import { TagMap } from './template/tag/tag-map';
import { FilterMap } from './template/filter/filter-map';
import { TagClass, TagImplOptions, FilterImplOptions, Template } from './template';
import { Render } from './render';
import { Parser } from './parser';
import { LiquidOptions, NormalizedFullOptions, RenderOptions } from './liquid-options';
import { FilterImplOptions } from './template/filter/filter-impl-options';
export * from './util/error';
export * from './types';
export declare const version = "[VI]{version}[/VI]";
export declare class Liquid {

@@ -18,4 +10,4 @@ readonly options: NormalizedFullOptions;

readonly parser: Parser;
readonly filters: FilterMap;
readonly tags: TagMap;
readonly filters: Record<string, FilterImplOptions>;
readonly tags: Record<string, TagClass>;
constructor(opts?: LiquidOptions);

@@ -37,9 +29,9 @@ parse(html: string, filepath?: string): Template[];

renderFileToNodeStream(file: string, scope?: object, renderOptions?: RenderOptions): Promise<NodeJS.ReadableStream>;
_evalValue(str: string, scopeOrContext?: object | Context): IterableIterator<any>;
evalValue(str: string, scopeOrContext?: object | Context): Promise<any>;
evalValueSync(str: string, scopeOrContext?: object | Context): any;
_evalValue(str: string, scope?: object): IterableIterator<any>;
evalValue(str: string, scope?: object): Promise<any>;
evalValueSync(str: string, scope?: object): any;
registerFilter(name: string, filter: FilterImplOptions): void;
registerTag(name: string, tag: TagImplOptions): void;
registerTag(name: string, tag: TagClass | TagImplOptions): void;
plugin(plugin: (this: Liquid, L: typeof Liquid) => void): void;
express(): (this: any, filePath: string, ctx: object, callback: (err: Error | null, rendered: string) => void) => void;
}

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

import { Trie } from '../util/operator-trie';
import { Trie } from '../util';
export declare function matchOperator(str: string, begin: number, trie: Trie, end?: number): number;

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

import { Token } from '../tokens/token';
import { Template } from '../template/template';
import { TopLevelToken } from '../tokens/toplevel-token';
import { Token, TopLevelToken } from '../tokens';
import { Template } from '../template';
declare type ParseToken<T extends Token> = ((token: T, remainTokens: T[]) => Template);

@@ -5,0 +4,0 @@ export declare class ParseStream<T extends Token = TopLevelToken> {

@@ -1,10 +0,7 @@

import { Liquid } from '../liquid';
import { ParseStream } from './parse-stream';
import { Tag } from '../template/tag/tag';
import { Output } from '../template/output';
import { HTML } from '../template/html';
import { Template } from '../template/template';
import { TopLevelToken } from '../tokens/toplevel-token';
import { LookupType } from '../fs/loader';
export default class Parser {
import { TopLevelToken } from '../tokens';
import { Template, Output, HTML } from '../template';
import { LookupType } from '../fs';
import type { Liquid } from '../liquid';
export declare class Parser {
parseFile: (file: string, sync?: boolean, type?: LookupType, currentFile?: string) => Generator<unknown, Template[], Template[] | string>;

@@ -18,3 +15,3 @@ private liquid;

parseTokens(tokens: TopLevelToken[]): Template[];
parseToken(token: TopLevelToken, remainTokens: TopLevelToken[]): Tag | Output | HTML;
parseToken(token: TopLevelToken, remainTokens: TopLevelToken[]): import("../template").Tag | Output | HTML;
parseStream(tokens: TopLevelToken[]): ParseStream<TopLevelToken>;

@@ -21,0 +18,0 @@ private _parseFileCached;

@@ -1,27 +0,14 @@

import { IdentifierToken } from '../tokens/identifier-token';
import { OperatorToken } from '../tokens/operator-token';
import { TopLevelToken } from '../tokens/toplevel-token';
import { TagToken, HTMLToken, HashToken, QuotedToken, LiquidTagToken, OutputToken, ValueToken, Token, RangeToken, FilterToken, TopLevelToken, OperatorToken, IdentifierToken } from '../tokens';
import { TokenizationError } from '../util';
import { Operators, Expression } from '../render';
import { NormalizedFullOptions } from '../liquid-options';
import { FilterArg } from './filter-arg';
import { FilterToken } from '../tokens/filter-token';
import { HashToken } from '../tokens/hash-token';
import { QuotedToken } from '../tokens/quoted-token';
import { HTMLToken } from '../tokens/html-token';
import { TagToken } from '../tokens/tag-token';
import { Token } from '../tokens/token';
import { RangeToken } from '../tokens/range-token';
import { ValueToken } from '../tokens/value-token';
import { OutputToken } from '../tokens/output-token';
import { TokenizationError } from '../util/error';
import { NormalizedFullOptions } from '../liquid-options';
import { Trie } from '../util/operator-trie';
import { Expression } from '../render/expression';
import { LiquidTagToken } from '../tokens/liquid-tag-token';
export declare class Tokenizer {
input: string;
private trie;
file: string;
file?: string | undefined;
p: number;
N: number;
private rawBeginAt;
constructor(input: string, trie?: Trie, file?: string);
private opTrie;
constructor(input: string, operators?: Operators, file?: string | undefined);
readExpression(): Expression;

@@ -28,0 +15,0 @@ readExpressionTokens(): IterableIterator<Token>;

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

import { Token } from '../tokens/token';
import { Token } from '../tokens';
import { NormalizedFullOptions } from '../liquid-options';
export declare function whiteSpaceCtrl(tokens: Token[], options: NormalizedFullOptions): void;

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

import { QuotedToken } from '../tokens/quoted-token';
import { Token } from '../tokens/token';
import { Context } from '../context/context';
import { Token, QuotedToken } from '../tokens';
import { Context } from '../context';
export declare class Expression {

@@ -9,7 +8,3 @@ private postfix;

}
/**
* @deprecated use `_evalToken` instead
*/
export declare function evalToken(token: Token | undefined, ctx: Context, lenient?: boolean): Generator<never, any, unknown>;
export declare function _evalToken(token: Token | undefined, ctx: Context, lenient?: boolean): IterableIterator<unknown>;
export declare function evalToken(token: Token | undefined, ctx: Context, lenient?: boolean): IterableIterator<unknown>;
export declare function evalQuotedToken(token: QuotedToken): string;

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

import { Context } from '../context/context';
export interface Operators {
[key: string]: (lhs: any, rhs: any, ctx: Context) => boolean;
}
import { Context } from '../context';
export declare type OperatorHandler = (lhs: any, rhs: any, ctx: Context) => boolean;
export declare type Operators = Record<string, OperatorHandler>;
export declare const defaultOperators: Operators;
/// <reference types="node" />
import { Context } from '../context/context';
import { Template } from '../template/template';
import { Emitter } from '../emitters/emitter';
import { Context } from '../context';
import { Template } from '../template';
import { Emitter } from '../emitters';
export declare class Render {

@@ -6,0 +6,0 @@ renderTemplatesToNodeStream(templates: Template[], ctx: Context): NodeJS.ReadableStream;

@@ -1,6 +0,5 @@

import { TemplateImpl } from '../template/template-impl';
import { Template } from '../template/template';
import { HTMLToken } from '../tokens/html-token';
import { Context } from '../context/context';
import { Emitter } from '../emitters/emitter';
import { TemplateImpl, Template } from '../template';
import { HTMLToken } from '../tokens';
import { Context } from '../context';
import { Emitter } from '../emitters';
export declare class HTML extends TemplateImpl<HTMLToken> implements Template {

@@ -7,0 +6,0 @@ private str;

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

import { TemplateImpl } from '../template/template-impl';
import { Template } from '../template/template';
import { Value } from './value';
import { Template, TemplateImpl } from '../template';
import { Context } from '../context/context';

@@ -8,5 +8,5 @@ import { Emitter } from '../emitters/emitter';

export declare class Output extends TemplateImpl<OutputToken> implements Template {
private value;
value: Value;
constructor(token: OutputToken, liquid: Liquid);
render(ctx: Context, emitter: Emitter): IterableIterator<unknown>;
}

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

import { Expression } from '../render/expression';
import { Filter } from './filter/filter';
import { Context } from '../context/context';
import { Liquid } from '../liquid';
import { Filter } from './filter';
import { Expression } from '../render';
import type { Liquid } from '../liquid';
import type { Context } from '../context';
export declare class Value {

@@ -13,2 +13,3 @@ readonly filters: Filter[];

value(ctx: Context, lenient: boolean): Generator<unknown, unknown, unknown>;
private getFilter;
}
import { Token } from './token';
import { TokenKind } from '../parser/token-kind';
import { TokenKind } from '../parser';
export declare abstract class DelimitedToken extends Token {

@@ -4,0 +4,0 @@ trimLeft: boolean;

import { DelimitedToken } from './delimited-token';
import { NormalizedFullOptions } from '../liquid-options';
import type { NormalizedFullOptions } from '../liquid-options';
export declare class TagToken extends DelimitedToken {

@@ -4,0 +4,0 @@ name: string;

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

import { TokenKind } from '../parser/token-kind';
import { TokenKind } from '../parser';
export declare abstract class Token {

@@ -3,0 +3,0 @@ kind: TokenKind;

export declare function toPromise<T>(val: Generator<unknown, T, unknown> | Promise<T> | T): Promise<T>;
export declare function toValueSync<T>(val: Generator<unknown, T, unknown> | T): T;
export declare const toThenable: typeof toPromise;

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

export declare function toEnumerable(val: any): any[];
export declare function toEnumerable<T = unknown>(val: any): T[];
export declare function toArray(val: any): any[];

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

import { NullDrop } from '../drop/null-drop';
import { EmptyDrop } from '../drop/empty-drop';
import { BlankDrop } from '../drop/blank-drop';
import { BlankDrop, EmptyDrop, NullDrop } from '../drop';
export declare const literalValues: {

@@ -5,0 +3,0 @@ true: boolean;

@@ -1,5 +0,12 @@

import { Operators } from '../render/operator';
import { Operators, OperatorHandler } from '../render/operator';
interface TrieLeafNode {
handler: OperatorHandler;
end: true;
needBoundary?: true;
}
export interface Trie {
[key: string]: any;
[key: string]: Trie | TrieLeafNode;
}
export declare type TrieNode = Trie | TrieLeafNode;
export declare function createTrie(operators: Operators): Trie;
export {};
import { LiquidDate } from './liquid-date';
export default function (d: LiquidDate, formatStr: string): string;
export declare function strftime(d: LiquidDate, formatStr: string): string;

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

import { OperatorToken } from '../tokens/operator-token';
import { DelimitedToken } from '../tokens/delimited-token';
import { IdentifierToken } from '../tokens/identifier-token';
import { TagToken } from '../tokens/tag-token';
import { HTMLToken } from '../tokens/html-token';
import { OutputToken } from '../tokens/output-token';
import { PropertyAccessToken } from '../tokens/property-access-token';
import { LiteralToken } from '../tokens/literal-token';
import { QuotedToken } from '../tokens/quoted-token';
import { NumberToken } from '../tokens/number-token';
import { RangeToken } from '../tokens/range-token';
import { RangeToken, NumberToken, QuotedToken, LiteralToken, PropertyAccessToken, OutputToken, HTMLToken, TagToken, IdentifierToken, DelimitedToken, OperatorToken } from '../tokens';
export declare function isDelimitedToken(val: any): val is DelimitedToken;

@@ -13,0 +3,0 @@ export declare function isOperatorToken(val: any): val is OperatorToken;

@@ -17,9 +17,5 @@ export declare const toString: () => string;

export declare function isIterable(value: any): value is Iterable<any>;
export declare function forOwn<T>(obj: {
export declare function forOwn<T>(obj: Record<string, T> | undefined, iteratee: ((val: T, key: string, obj: {
[key: string]: T;
} | undefined, iteratee: ((val: T, key: string, obj: {
[key: string]: T;
}) => boolean | void)): {
[key: string]: T;
};
}) => boolean | void)): Record<string, T>;
export declare function last<T>(arr: T[]): T;

@@ -33,3 +29,2 @@ export declare function last(arr: string): string;

export declare function identify<T>(val: T): T;
export declare function snakeCase(str: string): string;
export declare function changeCase(str: string): string;

@@ -36,0 +31,0 @@ export declare function ellipsis(str: string, N: number): string;

{
"name": "liquidjs",
"version": "9.43.0",
"version": "10.0.0",
"description": "A simple, expressive and safe Shopify / Github Pages compatible template engine in pure JavaScript.",

@@ -12,3 +12,6 @@ "main": "dist/liquid.node.cjs.js",

},
"types": "dist/liquid.d.ts",
"types": "dist/index.d.ts",
"engines": {
"node": ">=14"
},
"scripts": {

@@ -45,5 +48,2 @@ "lint": "eslint \"**/*.mjs\" \"**/*.ts\" .",

],
"engines": {
"node": ">=4.8.7"
},
"keywords": [

@@ -50,0 +50,0 @@ "liquid",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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