Comparing version 9.28.6 to 9.29.0
@@ -0,1 +1,8 @@ | ||
# [9.29.0](https://github.com/harttle/liquidjs/compare/v9.28.6...v9.29.0) (2021-12-11) | ||
### Features | ||
* customize globals & strictVariables when calling render, see [#432](https://github.com/harttle/liquidjs/issues/432) ([6801552](https://github.com/harttle/liquidjs/commit/6801552fe6829770cbbfdda051731c8b466ed9ec)) | ||
## [9.28.6](https://github.com/harttle/liquidjs/compare/v9.28.5...v9.28.6) (2021-12-07) | ||
@@ -2,0 +9,0 @@ |
@@ -9,3 +9,3 @@ import { FilterImpl } from '../../template/filter/filter-impl'; | ||
export declare const size: (v: string | any[]) => number; | ||
export declare function map<T1, T2>(this: FilterImpl, arr: Scope[], property: string): object[]; | ||
export declare function map(this: FilterImpl, arr: Scope[], property: string): object[]; | ||
export declare function compact<T>(this: FilterImpl, arr: T[]): any[]; | ||
@@ -12,0 +12,0 @@ export declare function concat<T1, T2>(v: T1[], arg: T2[] | T2): (T1 | T2)[]; |
@@ -5,5 +5,5 @@ import { BlockDrop } from '../../drop/block-drop'; | ||
parse(this: TagImpl, token: TagToken, remainTokens: TopLevelToken[]): void; | ||
render(this: TagImpl, ctx: Context, emitter: Emitter): IterableIterator<any>; | ||
render(this: TagImpl, ctx: Context, emitter: Emitter): Generator<any, void, unknown>; | ||
getBlockRender(this: TagImpl, ctx: Context): (superBlock: BlockDrop, emitter: Emitter) => any; | ||
}; | ||
export default _default; |
@@ -1,3 +0,2 @@ | ||
import { Drop } from '../drop/drop'; | ||
import { NormalizedFullOptions } from '../liquid-options'; | ||
import { NormalizedFullOptions, RenderOptions } from '../liquid-options'; | ||
import { Scope } from './scope'; | ||
@@ -22,4 +21,11 @@ export declare class Context { | ||
sync: boolean; | ||
/** | ||
* The normalized liquid options object | ||
*/ | ||
opts: NormalizedFullOptions; | ||
constructor(env?: object, opts?: NormalizedFullOptions, sync?: boolean); | ||
/** | ||
* Throw when accessing undefined variable? | ||
*/ | ||
strictVariables: boolean; | ||
constructor(env?: object, opts?: NormalizedFullOptions, renderOptions?: RenderOptions); | ||
getRegister(key: string): any; | ||
@@ -33,3 +39,3 @@ setRegister(key: string, value: any): any; | ||
push(ctx: object): number; | ||
pop(): import("./scope").PlainObject | Drop | undefined; | ||
pop(): Scope | undefined; | ||
bottom(): Scope; | ||
@@ -36,0 +42,0 @@ private findScope; |
@@ -12,3 +12,3 @@ export interface FS { | ||
resolve: (dir: string, file: string, ext: string) => string; | ||
/** check if file is contained in `root`, always return `true` by default */ | ||
/** check if file is contained in `root`, always return `true` by default. Warning: not setting this could expose path traversal vulnerabilities. */ | ||
contains?: (root: string, file: string) => boolean; | ||
@@ -15,0 +15,0 @@ /** defaults to "/" */ |
@@ -20,6 +20,6 @@ import { FS } from './fs'; | ||
constructor(options: LoaderOptions); | ||
lookup(file: string, type: LookupType, sync?: boolean, currentFile?: string): IterableIterator<string | Promise<boolean>>; | ||
candidates(file: string, dirs: string[], currentFile?: string, enforceRoot?: boolean): IterableIterator<string>; | ||
lookup(file: string, type: LookupType, sync?: boolean, currentFile?: string): Generator<unknown, string, string>; | ||
candidates(file: string, dirs: string[], currentFile?: string, enforceRoot?: boolean): Generator<string, void, unknown>; | ||
private dirname; | ||
private lookupError; | ||
} |
@@ -63,2 +63,16 @@ import { Template } from './template/template'; | ||
} | ||
export interface RenderOptions { | ||
/** | ||
* This call is sync or async? It's used by Liquid internal methods, you'll not need this. | ||
*/ | ||
sync?: boolean; | ||
/** | ||
* Same as `globals` on LiquidOptions, but only for current render() call | ||
*/ | ||
globals?: object; | ||
/** | ||
* Same as `strictVariables` on LiquidOptions, but only for current render() call | ||
*/ | ||
strictVariables?: boolean; | ||
} | ||
interface NormalizedOptions extends LiquidOptions { | ||
@@ -65,0 +79,0 @@ root?: string[]; |
@@ -9,3 +9,3 @@ /// <reference types="node" /> | ||
import { FilterMap } from './template/filter/filter-map'; | ||
import { LiquidOptions, NormalizedFullOptions } from './liquid-options'; | ||
import { LiquidOptions, NormalizedFullOptions, RenderOptions } from './liquid-options'; | ||
import { FilterImplOptions } from './template/filter/filter-impl-options'; | ||
@@ -23,16 +23,16 @@ export * from './util/error'; | ||
parse(html: string, filepath?: string): Template[]; | ||
_render(tpl: Template[], scope?: object, sync?: boolean): IterableIterator<any>; | ||
render(tpl: Template[], scope?: object): Promise<any>; | ||
renderSync(tpl: Template[], scope?: object): any; | ||
renderToNodeStream(tpl: Template[], scope?: object): NodeJS.ReadableStream; | ||
_parseAndRender(html: string, scope?: object, sync?: boolean): IterableIterator<any>; | ||
parseAndRender(html: string, scope?: object): Promise<any>; | ||
parseAndRenderSync(html: string, scope?: object): any; | ||
_parsePartialFile(file: string, sync?: boolean, currentFile?: string): IterableIterator<any>; | ||
_parseLayoutFile(file: string, sync?: boolean, currentFile?: string): IterableIterator<any>; | ||
_render(tpl: Template[], scope: object | undefined, renderOptions: RenderOptions): IterableIterator<any>; | ||
render(tpl: Template[], scope?: object, renderOptions?: RenderOptions): Promise<any>; | ||
renderSync(tpl: Template[], scope?: object, renderOptions?: RenderOptions): any; | ||
renderToNodeStream(tpl: Template[], scope?: object, renderOptions?: RenderOptions): NodeJS.ReadableStream; | ||
_parseAndRender(html: string, scope: object | undefined, renderOptions: RenderOptions): IterableIterator<any>; | ||
parseAndRender(html: string, scope?: object, renderOptions?: RenderOptions): Promise<any>; | ||
parseAndRenderSync(html: string, scope?: object, renderOptions?: RenderOptions): any; | ||
_parsePartialFile(file: string, sync?: boolean, currentFile?: string): Generator<unknown, Template[], string | Template[]>; | ||
_parseLayoutFile(file: string, sync?: boolean, currentFile?: string): Generator<unknown, Template[], string | Template[]>; | ||
parseFile(file: string): Promise<Template[]>; | ||
parseFileSync(file: string): Template[]; | ||
renderFile(file: string, ctx?: object): Promise<any>; | ||
renderFileSync(file: string, ctx?: object): any; | ||
renderFileToNodeStream(file: string, scope?: object): Promise<NodeJS.ReadableStream>; | ||
renderFile(file: string, ctx?: object, renderOptions?: RenderOptions): Promise<any>; | ||
renderFileSync(file: string, ctx?: object, renderOptions?: RenderOptions): any; | ||
renderFileToNodeStream(file: string, scope?: object, renderOptions?: RenderOptions): Promise<NodeJS.ReadableStream>; | ||
_evalValue(str: string, ctx: Context): IterableIterator<any>; | ||
@@ -39,0 +39,0 @@ evalValue(str: string, ctx: Context): Promise<any>; |
@@ -10,3 +10,3 @@ import { Liquid } from '../liquid'; | ||
export default class Parser { | ||
parseFile: (file: string, sync?: boolean, type?: LookupType, currentFile?: string) => IterableIterator<any>; | ||
parseFile: (file: string, sync?: boolean, type?: LookupType, currentFile?: string) => Generator<unknown, Template[], Template[] | string>; | ||
private liquid; | ||
@@ -13,0 +13,0 @@ private fs; |
@@ -7,5 +7,5 @@ import { QuotedToken } from '../tokens/quoted-token'; | ||
constructor(tokens: IterableIterator<Token>); | ||
evaluate(ctx: Context, lenient: boolean): any; | ||
evaluate(ctx: Context, lenient: boolean): Generator<unknown, unknown, unknown>; | ||
} | ||
export declare function evalToken(token: Token | undefined, ctx: Context, lenient?: boolean): any; | ||
export declare function evalQuotedToken(token: QuotedToken): string; |
@@ -10,3 +10,3 @@ import { TemplateImpl } from '../template/template-impl'; | ||
constructor(token: OutputToken, liquid: Liquid); | ||
render(ctx: Context, emitter: Emitter): IterableIterator<IterableIterator<any>>; | ||
render(ctx: Context, emitter: Emitter): Generator<unknown, void, unknown>; | ||
} |
import { Context } from '../../context/context'; | ||
export interface HashValue { | ||
[key: string]: any; | ||
} | ||
/** | ||
@@ -11,7 +14,5 @@ * Key-Value Pairs Representing Tag Arguments | ||
export declare class Hash { | ||
hash: { | ||
[key: string]: any; | ||
}; | ||
hash: HashValue; | ||
constructor(markup: string); | ||
render(ctx: Context): IterableIterator<any>; | ||
render(ctx: Context): Generator<unknown, HashValue, unknown>; | ||
} |
@@ -5,7 +5,7 @@ import { Context } from '../../context/context'; | ||
import { TagImpl } from './tag-impl'; | ||
import { Hash } from '../../template/tag/hash'; | ||
import { HashValue } from '../../template/tag/hash'; | ||
import { Emitter } from '../../emitters/emitter'; | ||
export interface TagImplOptions { | ||
parse?: (this: TagImpl, token: TagToken, remainingTokens: TopLevelToken[]) => void; | ||
render: (this: TagImpl, ctx: Context, emitter: Emitter, hash: Hash) => any; | ||
render: (this: TagImpl, ctx: Context, emitter: Emitter, hash: HashValue) => void | string | Promise<void | string> | Generator<unknown, void | string, unknown>; | ||
} |
import { Liquid } from '../../liquid'; | ||
import { TemplateImpl } from '../../template/template-impl'; | ||
import { Emitter, Context, TagToken, Template, TopLevelToken } from '../../types'; | ||
import { HashValue } from './hash'; | ||
export declare class Tag extends TemplateImpl<TagToken> implements Template { | ||
@@ -8,3 +9,3 @@ name: string; | ||
constructor(token: TagToken, tokens: TopLevelToken[], liquid: Liquid); | ||
render(ctx: Context, emitter: Emitter): IterableIterator<any>; | ||
render(ctx: Context, emitter: Emitter): Generator<unknown, unknown, HashValue | unknown>; | ||
} |
@@ -12,3 +12,3 @@ import { Expression } from '../render/expression'; | ||
constructor(str: string, liquid: Liquid); | ||
value(ctx: Context, lenient: boolean): IterableIterator<any>; | ||
value(ctx: Context, lenient: boolean): Generator<unknown, unknown, unknown>; | ||
} |
import { Token } from './token'; | ||
import { ValueToken } from './value-token'; | ||
import { IdentifierToken } from './identifier-token'; | ||
@@ -8,5 +9,5 @@ export declare class HashToken extends Token { | ||
name: IdentifierToken; | ||
value?: import("./range-token").RangeToken | import("./literal-token").LiteralToken | import("./quoted-token").QuotedToken | import("./property-access-token").PropertyAccessToken | undefined; | ||
value?: ValueToken | undefined; | ||
file?: string | undefined; | ||
constructor(input: string, begin: number, end: number, name: IdentifierToken, value?: import("./range-token").RangeToken | import("./literal-token").LiteralToken | import("./quoted-token").QuotedToken | import("./property-access-token").PropertyAccessToken | undefined, file?: string | undefined); | ||
constructor(input: string, begin: number, end: number, name: IdentifierToken, value?: ValueToken | undefined, file?: string | undefined); | ||
} |
@@ -9,5 +9,5 @@ import { Token } from './token'; | ||
'<=': number; | ||
'contains': number; | ||
'and': number; | ||
'or': number; | ||
contains: number; | ||
and: number; | ||
or: number; | ||
}; | ||
@@ -14,0 +14,0 @@ export declare class OperatorToken extends Token { |
@@ -6,5 +6,5 @@ declare type resolver = (x?: any) => any; | ||
} | ||
export declare function toThenable<T>(val: IterableIterator<any> | Thenable<T> | any): Thenable<T>; | ||
export declare function toPromise<T>(val: IterableIterator<any> | Thenable<T> | T): Promise<T>; | ||
export declare function toValue<T>(val: IterableIterator<any> | Thenable<T> | T): T; | ||
export declare function toThenable<T>(val: IteratorResult<unknown, T> | Thenable<T> | any): Thenable<T>; | ||
export declare function toPromise<T>(val: Generator<unknown, T, unknown> | Thenable<T> | T): Promise<T>; | ||
export declare function toValue<T>(val: Generator<unknown, T, unknown> | Thenable<T> | T): T; | ||
export {}; |
@@ -5,8 +5,8 @@ import { NullDrop } from '../drop/null-drop'; | ||
export declare const literalValues: { | ||
'true': boolean; | ||
'false': boolean; | ||
'nil': NullDrop; | ||
'null': NullDrop; | ||
'empty': EmptyDrop; | ||
'blank': BlankDrop; | ||
true: boolean; | ||
false: boolean; | ||
nil: NullDrop; | ||
null: NullDrop; | ||
empty: EmptyDrop; | ||
blank: BlankDrop; | ||
}; |
@@ -12,3 +12,3 @@ export declare function isString(value: any): value is string; | ||
export declare function isArray(value: any): value is any[]; | ||
export declare function forOwn<T>(object: { | ||
export declare function forOwn<T>(obj: { | ||
[key: string]: T; | ||
@@ -15,0 +15,0 @@ } | undefined, iteratee: ((val: T, key: string, obj: { |
{ | ||
"name": "liquidjs", | ||
"version": "9.28.6", | ||
"version": "9.29.0", | ||
"description": "A simple, expressive and safe Shopify / Github Pages compatible template engine in pure JavaScript.", | ||
@@ -76,4 +76,4 @@ "main": "dist/liquid.node.cjs.js", | ||
"@types/supertest": "^2.0.7", | ||
"@typescript-eslint/eslint-plugin": "^2.0.0", | ||
"@typescript-eslint/parser": "^2.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.6.0", | ||
"@typescript-eslint/parser": "^5.6.0", | ||
"all-contributors-cli": "^6.20.0", | ||
@@ -85,3 +85,3 @@ "benchmark": "^2.1.4", | ||
"cross-env": "^5.2.0", | ||
"eslint": "^6.8.0", | ||
"eslint": "^7.32.0", | ||
"eslint-config-standard": "^12.0.0", | ||
@@ -99,5 +99,5 @@ "eslint-plugin-import": "^2.15.0", | ||
"regenerator-runtime": "^0.12.1", | ||
"rollup": "^1.1.2", | ||
"rollup": "^2.61.0", | ||
"rollup-plugin-replace": "^2.1.0", | ||
"rollup-plugin-typescript2": "^0.21.1", | ||
"rollup-plugin-typescript2": "^0.31.1", | ||
"rollup-plugin-uglify": "^5.0.2", | ||
@@ -110,6 +110,6 @@ "rollup-plugin-version-injector": "^1.3.3", | ||
"ts-node": "^8.0.2", | ||
"tslib": "^1.9.3", | ||
"tslib": "^2.3.1", | ||
"typedoc": "^0.15.0", | ||
"typedoc-plugin-markdown": "^2.2.17", | ||
"typescript": "^3.3.3" | ||
"typescript": "^4.5.3" | ||
}, | ||
@@ -116,0 +116,0 @@ "release": { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
1268762
0
18171