janja 4.3.0 → 4.4.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.
package/dist/index.d.ts CHANGED
@@ -67,6 +67,17 @@ declare class SourceMap {
67
67
  getSourceLoc({ line, column }: Pos): Loc[];
68
68
  }
69
69
 
70
+ interface CompiledTemplate {
71
+ code: string;
72
+ mappings: Mapping[];
73
+ script?: Script;
74
+ sources: Map<string, string>;
75
+ fingerprint: string;
76
+ }
77
+ declare const MAX_INCLUDE_DEPTH = 100;
78
+ declare function templateCacheKey(template: string, stream?: boolean): string;
79
+ declare function optionsFingerprint(options: Required<CompilerOptions>): string;
80
+
70
81
  declare class OutScript extends SourceMap {
71
82
  private codeParts;
72
83
  private codeLength;
@@ -165,7 +176,10 @@ declare class BlockNode extends Traversal {
165
176
  constructor(val: IdExp, body: SyntaxNode[], loc: Loc, strip: Strip);
166
177
  }
167
178
 
168
- /** CSS co-located with a section/snippet (Shopify `{% stylesheet %}` analogue). */
179
+ /**
180
+ * Co-located styles with a section/snippet (Shopify `{% stylesheet %}` analogue).
181
+ * Body is usually a `<style>…</style>` block for native IDE CSS highlighting.
182
+ */
169
183
  declare class StylesheetNode extends Traversal {
170
184
  readonly body: SyntaxNode[];
171
185
  readonly loc: Loc;
@@ -174,16 +188,6 @@ declare class StylesheetNode extends Traversal {
174
188
  constructor(body: SyntaxNode[], loc: Loc, strip: Strip);
175
189
  }
176
190
 
177
- interface CompiledTemplate {
178
- code: string;
179
- mappings: Mapping[];
180
- script?: Script;
181
- sources: Map<string, string>;
182
- fingerprint: string;
183
- }
184
- declare const MAX_INCLUDE_DEPTH = 100;
185
- declare function templateCacheKey(template: string, stream?: boolean): string;
186
- declare function optionsFingerprint(options: Required<CompilerOptions>): string;
187
191
  declare class Compiler extends Context {
188
192
  options: Required<CompilerOptions>;
189
193
  private revalidate;
@@ -201,6 +205,8 @@ declare class Compiler extends Context {
201
205
  private sources;
202
206
  private cache?;
203
207
  private compiled?;
208
+ /** True when the template uses a non-literal include path. */
209
+ private hasDynamicInclude;
204
210
  /**
205
211
  * Whether the code being generated may write output to the stream. True
206
212
  * only in stream mode, for the template's own top-level output.
@@ -404,6 +410,12 @@ interface CompilerOptions extends ParserOptions {
404
410
  trimWhitespace?: boolean;
405
411
  stripComments?: boolean;
406
412
  loader?: (path: string) => Promise<string>;
413
+ /**
414
+ * Paths compiled into the partial table for every root template, so
415
+ * `{{ include expr }}` can resolve them at render time and their
416
+ * `stylesheet` bodies are collected for `{{ stylesheets }}`.
417
+ */
418
+ preloadIncludes?: string[];
407
419
  }
408
420
  interface FormatterOptions extends ParserOptions {
409
421
  trimWhitespace?: boolean;