diff options
| author | Shipwreckt <me@shipwreckt.co.uk> | 2025-10-31 20:02:14 +0000 |
|---|---|---|
| committer | Shipwreckt <me@shipwreckt.co.uk> | 2025-10-31 20:02:14 +0000 |
| commit | 7a52ddeba2a68388b544f529d2d92104420f77b0 (patch) | |
| tree | 15ddd47457a2cb4a96060747437d36474e4f6b4e /node_modules/liquidjs/dist/template/analysis.d.ts | |
| parent | 53d6ae2b5568437afa5e4995580a3fb679b7b91b (diff) | |
Changed from static to 11ty!
Diffstat (limited to 'node_modules/liquidjs/dist/template/analysis.d.ts')
| -rw-r--r-- | node_modules/liquidjs/dist/template/analysis.d.ts | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/node_modules/liquidjs/dist/template/analysis.d.ts b/node_modules/liquidjs/dist/template/analysis.d.ts new file mode 100644 index 0000000..4a0d647 --- /dev/null +++ b/node_modules/liquidjs/dist/template/analysis.d.ts @@ -0,0 +1,85 @@ +import { Template } from '.';
+/**
+ * Row, column and file name where a variable was found.
+ */
+export interface VariableLocation {
+ row: number;
+ col: number;
+ file?: string;
+}
+/**
+ * A variable's segments as an array, possibly with nested arrays of segments.
+ */
+export type SegmentArray = Array<string | number | SegmentArray>;
+/**
+ * A variable's segments and location, which can be coerced to a string.
+ */
+export declare class Variable {
+ readonly segments: Array<string | number | Variable>;
+ readonly location: VariableLocation;
+ constructor(segments: Array<string | number | Variable>, location: VariableLocation);
+ toString(): string;
+ /** Return this variable's segments as an array, possibly with nested arrays for nested paths. */
+ toArray(): SegmentArray;
+}
+/**
+ * Property names and array indexes that make up a path to a variable.
+ */
+export type VariableSegments = Array<string | number | Variable>;
+/**
+ * A mapping of variable names to an array of locations at which the variable was found.
+ */
+export type Variables = {
+ [key: string]: Variable[];
+};
+/**
+ * Group variables by the string representation of their root segment.
+ */
+export declare class VariableMap {
+ private map;
+ constructor();
+ get(key: Variable): Variable[];
+ has(key: Variable): boolean;
+ push(variable: Variable): void;
+ asObject(): Variables;
+}
+/**
+ * The result of calling `analyze()` or `analyzeSync()`.
+ */
+export interface StaticAnalysis {
+ /**
+ * All variables, whether they are in scope or not. Including references to names
+ * such as `forloop` from the `for` tag.
+ */
+ variables: Variables;
+ /**
+ * Variables that are not in scope. These could be a "global" variables that are
+ * expected to be provided by the application developer, or possible mistakes
+ * from the template author.
+ *
+ * If a variable is referenced before and after assignment, you should expect
+ * that variable to be included in `globals`, `variables` and `locals`, each with
+ * a different location.
+ */
+ globals: Variables;
+ /**
+ * Template variables that are added to the template local scope using tags like
+ * `assign`, `capture` or `increment`.
+ */
+ locals: Variables;
+}
+export interface StaticAnalysisOptions {
+ /**
+ * When `true` (the default), try to load partial templates and analyze them too.
+ */
+ partials?: boolean;
+}
+export declare const defaultStaticAnalysisOptions: StaticAnalysisOptions;
+/**
+ * Statically analyze a template and report variable usage.
+ */
+export declare function analyze(template: Template[], options?: StaticAnalysisOptions): Promise<StaticAnalysis>;
+/**
+ * Statically analyze a template and report variable usage.
+ */
+export declare function analyzeSync(template: Template[], options?: StaticAnalysisOptions): StaticAnalysis;
|
