@formfeed/engine 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,6 +29,12 @@ export interface VariableRef {
29
29
  path: string[];
30
30
  range: Range;
31
31
  kind: 'read' | 'loop-var' | 'assigned';
32
+ /**
33
+ * For a variable bound in the template (loop variable, macro argument, `set`): the data path it
34
+ * stands for where it is used, `null` when that is not a data path. Resolved per scope, so two loops
35
+ * that reuse a name each check against their own list.
36
+ */
37
+ source?: string[] | null;
32
38
  }
33
39
  export interface FilterRef {
34
40
  name: string;
@@ -29,6 +29,12 @@ export interface VariableRef {
29
29
  path: string[];
30
30
  range: Range;
31
31
  kind: 'read' | 'loop-var' | 'assigned';
32
+ /**
33
+ * For a variable bound in the template (loop variable, macro argument, `set`): the data path it
34
+ * stands for where it is used, `null` when that is not a data path. Resolved per scope, so two loops
35
+ * that reuse a name each check against their own list.
36
+ */
37
+ source?: string[] | null;
32
38
  }
33
39
  export interface FilterRef {
34
40
  name: string;
@@ -0,0 +1,2 @@
1
+ /** The reason a helper cannot work yet, or `undefined` when it can. */
2
+ export declare function unavailableHelper(name: string): string | undefined;
@@ -0,0 +1,2 @@
1
+ /** The reason a helper cannot work yet, or `undefined` when it can. */
2
+ export declare function unavailableHelper(name: string): string | undefined;
@@ -16,9 +16,17 @@ declare module 'nunjucks/browser/nunjucks.js' {
16
16
 
17
17
  export interface NunjucksCompiler {
18
18
  _emit(code: string): void;
19
+ _emitLine(code: string): void;
20
+ _compileExpression(node: unknown, frame: unknown): void;
19
21
  compile(node: unknown, frame: unknown): void;
20
22
  }
21
23
 
24
+ export interface NunjucksSetNode {
25
+ targets: NunjucksNode[];
26
+ value: NunjucksNode | null;
27
+ body: NunjucksNode | null;
28
+ }
29
+
22
30
  export interface NunjucksModule {
23
31
  Environment: typeof N.Environment;
24
32
  Template: typeof N.Template;
@@ -26,11 +34,12 @@ declare module 'nunjucks/browser/nunjucks.js' {
26
34
  runtime: typeof N.runtime & {
27
35
  memberLookup: (obj: unknown, val: unknown, ...rest: unknown[]) => unknown;
28
36
  };
29
- /** The code generator; patched for `not` precedence (engines/jinja2.ts). */
37
+ /** The code generator; patched for `not` precedence and namespace attributes (engines/jinja2.ts). */
30
38
  compiler: {
31
39
  Compiler: {
32
40
  prototype: {
33
41
  compileNot(this: NunjucksCompiler, node: { target: unknown }, frame: unknown): void;
42
+ compileSet(this: NunjucksCompiler, node: NunjucksSetNode, frame: unknown): void;
34
43
  };
35
44
  };
36
45
  };
@@ -16,9 +16,17 @@ declare module 'nunjucks/browser/nunjucks.js' {
16
16
 
17
17
  export interface NunjucksCompiler {
18
18
  _emit(code: string): void;
19
+ _emitLine(code: string): void;
20
+ _compileExpression(node: unknown, frame: unknown): void;
19
21
  compile(node: unknown, frame: unknown): void;
20
22
  }
21
23
 
24
+ export interface NunjucksSetNode {
25
+ targets: NunjucksNode[];
26
+ value: NunjucksNode | null;
27
+ body: NunjucksNode | null;
28
+ }
29
+
22
30
  export interface NunjucksModule {
23
31
  Environment: typeof N.Environment;
24
32
  Template: typeof N.Template;
@@ -26,11 +34,12 @@ declare module 'nunjucks/browser/nunjucks.js' {
26
34
  runtime: typeof N.runtime & {
27
35
  memberLookup: (obj: unknown, val: unknown, ...rest: unknown[]) => unknown;
28
36
  };
29
- /** The code generator; patched for `not` precedence (engines/jinja2.ts). */
37
+ /** The code generator; patched for `not` precedence and namespace attributes (engines/jinja2.ts). */
30
38
  compiler: {
31
39
  Compiler: {
32
40
  prototype: {
33
41
  compileNot(this: NunjucksCompiler, node: { target: unknown }, frame: unknown): void;
42
+ compileSet(this: NunjucksCompiler, node: NunjucksSetNode, frame: unknown): void;
34
43
  };
35
44
  };
36
45
  };