UNPKG

1.63 kBTypeScriptView Raw
1import { NormalizedFullOptions, RenderOptions } from '../liquid-options';
2import { Scope } from './scope';
3declare type PropertyKey = string | number;
4export declare class Context {
5 /**
6 * insert a Context-level empty scope,
7 * for tags like `{% capture %}` `{% assign %}` to operate
8 */
9 private scopes;
10 private registers;
11 /**
12 * user passed in scope
13 * `{% increment %}`, `{% decrement %}` changes this scope,
14 * whereas `{% capture %}`, `{% assign %}` only hide this scope
15 */
16 environments: Scope;
17 /**
18 * global scope used as fallback for missing variables
19 */
20 globals: Scope;
21 sync: boolean;
22 /**
23 * The normalized liquid options object
24 */
25 opts: NormalizedFullOptions;
26 /**
27 * Throw when accessing undefined variable?
28 */
29 strictVariables: boolean;
30 constructor(env?: object, opts?: NormalizedFullOptions, renderOptions?: RenderOptions);
31 getRegister(key: string): any;
32 setRegister(key: string, value: any): any;
33 saveRegister(...keys: string[]): [string, any][];
34 restoreRegister(keyValues: [string, any][]): void;
35 getAll(): Scope;
36 get(paths: PropertyKey[]): object;
37 getFromScope(scope: object, paths: PropertyKey[] | string): object;
38 push(ctx: object): number;
39 pop(): Scope | undefined;
40 bottom(): Scope;
41 private findScope;
42}
43export declare function readProperty(obj: Scope, key: PropertyKey, ownPropertyOnly: boolean): any;
44export declare function readJSProperty(obj: Scope, key: PropertyKey, ownPropertyOnly: boolean): any;
45export {};