@stati/core 1.29.2 → 2.0.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/README.md +10 -13
- package/dist/config/loader.d.ts +9 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +77 -1
- package/dist/core/build.d.ts.map +1 -1
- package/dist/core/build.js +39 -29
- package/dist/core/content.d.ts.map +1 -1
- package/dist/core/content.js +9 -7
- package/dist/core/dev.d.ts.map +1 -1
- package/dist/core/dev.js +156 -197
- package/dist/core/eta-plugin.d.ts +60 -0
- package/dist/core/eta-plugin.d.ts.map +1 -0
- package/dist/core/eta-plugin.js +143 -0
- package/dist/core/isg/builder.d.ts +37 -19
- package/dist/core/isg/builder.d.ts.map +1 -1
- package/dist/core/isg/builder.js +70 -153
- package/dist/core/isg/deps.d.ts +8 -70
- package/dist/core/isg/deps.d.ts.map +1 -1
- package/dist/core/isg/deps.js +10 -401
- package/dist/core/isg/hash.d.ts.map +1 -1
- package/dist/core/isg/hash.js +2 -1
- package/dist/core/isg/index.d.ts +2 -2
- package/dist/core/isg/index.d.ts.map +1 -1
- package/dist/core/isg/index.js +3 -3
- package/dist/core/isg/manifest.d.ts.map +1 -1
- package/dist/core/isg/manifest.js +6 -1
- package/dist/core/markdown.d.ts +1 -1
- package/dist/core/markdown.d.ts.map +1 -1
- package/dist/core/markdown.js +3 -2
- package/dist/core/template-index.d.ts +209 -0
- package/dist/core/template-index.d.ts.map +1 -0
- package/dist/core/template-index.js +484 -0
- package/dist/core/template-render.d.ts +137 -0
- package/dist/core/template-render.d.ts.map +1 -0
- package/dist/core/template-render.js +444 -0
- package/dist/core/templates.d.ts +29 -11
- package/dist/core/templates.d.ts.map +1 -1
- package/dist/core/templates.js +115 -196
- package/dist/core/utils/context-validation.utils.d.ts +10 -6
- package/dist/core/utils/context-validation.utils.d.ts.map +1 -1
- package/dist/core/utils/context-validation.utils.js +39 -16
- package/dist/core/utils/date.utils.d.ts +1 -1
- package/dist/core/utils/date.utils.js +1 -1
- package/dist/core/utils/dev-css-watcher.utils.d.ts.map +1 -1
- package/dist/core/utils/dev-css-watcher.utils.js +3 -2
- package/dist/core/utils/error-overlay.utils.d.ts.map +1 -1
- package/dist/core/utils/error-overlay.utils.js +7 -45
- package/dist/core/utils/front-matter.utils.d.ts +50 -0
- package/dist/core/utils/front-matter.utils.d.ts.map +1 -0
- package/dist/core/utils/front-matter.utils.js +157 -0
- package/dist/core/utils/index.d.ts +4 -5
- package/dist/core/utils/index.d.ts.map +1 -1
- package/dist/core/utils/index.js +5 -7
- package/dist/core/utils/paths.utils.d.ts +3 -3
- package/dist/core/utils/paths.utils.js +6 -6
- package/dist/core/utils/tailwind-inventory.utils.d.ts +2 -2
- package/dist/core/utils/tailwind-inventory.utils.d.ts.map +1 -1
- package/dist/core/utils/tailwind-inventory.utils.js +15 -6
- package/dist/core/utils/template-discovery.utils.d.ts +3 -14
- package/dist/core/utils/template-discovery.utils.d.ts.map +1 -1
- package/dist/core/utils/template-discovery.utils.js +2 -62
- package/dist/core/utils/template-errors.utils.d.ts +14 -1
- package/dist/core/utils/template-errors.utils.d.ts.map +1 -1
- package/dist/core/utils/template-errors.utils.js +45 -4
- package/dist/core/utils/theme.utils.d.ts +17 -0
- package/dist/core/utils/theme.utils.d.ts.map +1 -0
- package/dist/core/utils/theme.utils.js +59 -0
- package/dist/images/index.d.ts +1 -2
- package/dist/images/index.d.ts.map +1 -1
- package/dist/images/index.js +0 -1
- package/dist/images/markdown-rule.d.ts +1 -2
- package/dist/images/markdown-rule.d.ts.map +1 -1
- package/dist/images/og.d.ts +2 -15
- package/dist/images/og.d.ts.map +1 -1
- package/dist/images/og.js +4 -47
- package/dist/images/runtime.d.ts +24 -5
- package/dist/images/runtime.d.ts.map +1 -1
- package/dist/images/runtime.js +14 -12
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/metrics/noop.d.ts.map +1 -1
- package/dist/metrics/noop.js +4 -1
- package/dist/metrics/recorder.d.ts.map +1 -1
- package/dist/metrics/recorder.js +11 -8
- package/dist/metrics/types.d.ts +31 -5
- package/dist/metrics/types.d.ts.map +1 -1
- package/dist/metrics/utils/html-report.utils.d.ts +2 -1
- package/dist/metrics/utils/html-report.utils.d.ts.map +1 -1
- package/dist/metrics/utils/html-report.utils.js +1115 -1136
- package/dist/types/config.d.ts +18 -6
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/content.d.ts +83 -16
- package/dist/types/content.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/isg.d.ts +48 -2
- package/dist/types/isg.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/core/utils/callable-partials.utils.d.ts +0 -60
- package/dist/core/utils/callable-partials.utils.d.ts.map +0 -1
- package/dist/core/utils/callable-partials.utils.js +0 -127
- package/dist/core/utils/partial-validation.utils.d.ts +0 -9
- package/dist/core/utils/partial-validation.utils.d.ts.map +0 -1
- package/dist/core/utils/partial-validation.utils.js +0 -107
package/dist/types/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type MarkdownIt from 'markdown-it';
|
|
1
|
+
import type { MarkdownIt } from 'markdown-it';
|
|
2
2
|
import type { SitemapConfig } from './sitemap.js';
|
|
3
3
|
import type { AuthorConfig } from './content.js';
|
|
4
4
|
import type { SearchConfig } from './search.js';
|
|
@@ -28,6 +28,18 @@ export interface SiteConfig {
|
|
|
28
28
|
/** Default site description for meta tags (used as fallback when page has no description) */
|
|
29
29
|
readonly description?: string;
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Site functions that templates call as `stati.helpers.name()`.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const helpers: StatiHelpers = {
|
|
37
|
+
* formatDate: (date: string | Date, locale = 'en-US') =>
|
|
38
|
+
* new Date(date).toLocaleDateString(locale),
|
|
39
|
+
* };
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export type StatiHelpers = Record<string, (...args: any[]) => unknown>;
|
|
31
43
|
/**
|
|
32
44
|
* Main configuration interface for Stati static site generator.
|
|
33
45
|
* Defines all options for site generation, including directories, templates, and features.
|
|
@@ -66,11 +78,11 @@ export interface StatiConfig {
|
|
|
66
78
|
/** Enable TOC extraction and heading anchor generation (default: true) */
|
|
67
79
|
toc?: boolean;
|
|
68
80
|
};
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Functions templates call as `stati.helpers.name()`, such as a date formatter. Each one is
|
|
83
|
+
* called with the arguments the template passes, and with `stati.helpers` as `this`.
|
|
84
|
+
*/
|
|
85
|
+
helpers?: StatiHelpers;
|
|
74
86
|
/** Incremental Static Generation configuration */
|
|
75
87
|
isg?: import('./isg.js').ISGConfig;
|
|
76
88
|
/** Collection listings: which fields rebuild them, and pages generated from data */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;GAEG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,UAAU;IACzB,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,MAA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CAAC;IACnB,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,eAAe,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
package/dist/types/content.d.ts
CHANGED
|
@@ -448,8 +448,53 @@ export interface CollectionData {
|
|
|
448
448
|
};
|
|
449
449
|
}
|
|
450
450
|
/**
|
|
451
|
-
*
|
|
452
|
-
*
|
|
451
|
+
* `stati.include(name, props?, body?)`: renders a template where it is called and returns its
|
|
452
|
+
* HTML. Templates it renders render synchronously, so they cannot use `await`.
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* ```eta
|
|
456
|
+
* <%~ stati.include('partials/header') %>
|
|
457
|
+
* <%~ stati.include('partials/card', { title: post.frontMatter.title }) %>
|
|
458
|
+
* <%~ stati.include('partials/callout', { tone: 'warning' }, stati.include('partials/draft-notice')) %>
|
|
459
|
+
* ```
|
|
460
|
+
*/
|
|
461
|
+
export interface TemplateIncludeFunction {
|
|
462
|
+
/**
|
|
463
|
+
* @param name - The template's path without `.eta`: `partials/header` is looked up from the
|
|
464
|
+
* page's folder up to the source directory, `/partials/header` is read from the source
|
|
465
|
+
* directory only, and `./icon` or `../icons/arrow` are relative to the calling template
|
|
466
|
+
* @param props - Values the template reads as `stati.props`
|
|
467
|
+
* @param body - HTML the template prints as `stati.body`
|
|
468
|
+
* @returns The rendered HTML
|
|
469
|
+
*/
|
|
470
|
+
(name: string, props?: Record<string, unknown> | null, body?: string | null): string;
|
|
471
|
+
/** Whether `name` resolves to a template for this page, with the same lookup as the call */
|
|
472
|
+
has(name: string): boolean;
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* `stati.layout(name, props?)`: wraps the calling template's output in another template once it
|
|
476
|
+
* has rendered. The wrapping template prints that output as `stati.body`.
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* ```eta
|
|
480
|
+
* <% stati.layout('base', { bodyClass: 'post' }) %>
|
|
481
|
+
* ```
|
|
482
|
+
*/
|
|
483
|
+
export interface TemplateLayoutFunction {
|
|
484
|
+
/**
|
|
485
|
+
* @param name - The wrapping template's path without `.eta`, resolved like
|
|
486
|
+
* {@link TemplateIncludeFunction} names
|
|
487
|
+
* @param props - Values the wrapping template reads as `stati.props`
|
|
488
|
+
* @returns An empty string, so the call can be printed
|
|
489
|
+
*/
|
|
490
|
+
(name: string, props?: Record<string, unknown> | null): string;
|
|
491
|
+
/** Whether `name` resolves to a template for this page; the same check as `stati.include.has` */
|
|
492
|
+
has(name: string): boolean;
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Template rendering context, available to every template Stati renders as `stati`.
|
|
496
|
+
* The root holds only Stati's own API; functions from the config's `helpers` are under
|
|
497
|
+
* `stati.helpers`.
|
|
453
498
|
*/
|
|
454
499
|
export interface TemplateContext {
|
|
455
500
|
/** Site configuration and metadata */
|
|
@@ -462,8 +507,23 @@ export interface TemplateContext {
|
|
|
462
507
|
navNode?: import('./navigation.js').NavNode;
|
|
463
508
|
[key: string]: unknown;
|
|
464
509
|
};
|
|
465
|
-
/**
|
|
510
|
+
/** The page's rendered Markdown */
|
|
466
511
|
content: string;
|
|
512
|
+
/**
|
|
513
|
+
* The HTML this template wraps: the output of the template it wraps in a template named by
|
|
514
|
+
* `stati.layout()`, or the `body` argument (or `undefined`) in a template rendered by
|
|
515
|
+
* `stati.include()`. Absent in the page's own layout and in the Open Graph template, which
|
|
516
|
+
* print `stati.content` instead.
|
|
517
|
+
*/
|
|
518
|
+
body?: string | undefined;
|
|
519
|
+
/** Props of the `stati.include()` or `stati.layout()` call that rendered this template */
|
|
520
|
+
props: Record<string, unknown> | undefined;
|
|
521
|
+
/** Renders another template here and returns its HTML */
|
|
522
|
+
include: TemplateIncludeFunction;
|
|
523
|
+
/** Wraps this template's output in another template */
|
|
524
|
+
layout: TemplateLayoutFunction;
|
|
525
|
+
/** The functions registered in the config's `helpers` */
|
|
526
|
+
helpers: import('./config.js').StatiHelpers;
|
|
467
527
|
/** Navigation helpers and tree */
|
|
468
528
|
nav: {
|
|
469
529
|
/** The full navigation tree */
|
|
@@ -485,41 +545,48 @@ export interface TemplateContext {
|
|
|
485
545
|
/** Gets the current page's navigation node */
|
|
486
546
|
getCurrentNode: () => import('./navigation.js').NavNode | undefined;
|
|
487
547
|
};
|
|
488
|
-
/** Discovered partials from underscore folders in hierarchy */
|
|
489
|
-
partials: Record<string, string>;
|
|
490
548
|
/**
|
|
491
549
|
* Collection data: the page's own collection on index pages, the collection the page belongs
|
|
492
550
|
* to on other pages, or the one named by the `collection` front matter field
|
|
493
551
|
*/
|
|
494
|
-
collection?: CollectionData;
|
|
552
|
+
collection?: CollectionData | undefined;
|
|
495
553
|
/** This page's position in a paginated listing (pages with `paginate`) */
|
|
496
|
-
pagination?: PaginationData;
|
|
554
|
+
pagination?: PaginationData | undefined;
|
|
497
555
|
/** Key, label and items of a page expanded from a `[param].md` template */
|
|
498
|
-
generated?: GeneratedPageData;
|
|
499
|
-
/** Converts text to the URL slug Stati uses for generated page keys and heading anchors */
|
|
500
|
-
slugify?: (text: string) => string;
|
|
556
|
+
generated?: GeneratedPageData | undefined;
|
|
501
557
|
/** TypeScript bundle assets (available when typescript.enabled is true) */
|
|
502
|
-
assets?: StatiAssets;
|
|
558
|
+
assets?: StatiAssets | undefined;
|
|
559
|
+
/** The Stati version that rendered the page */
|
|
560
|
+
generator: {
|
|
561
|
+
version: string;
|
|
562
|
+
};
|
|
563
|
+
/** Converts text to the URL slug Stati uses for generated page keys and heading anchors */
|
|
564
|
+
slugify: (text: string) => string;
|
|
565
|
+
/**
|
|
566
|
+
* Builds a space-separated attribute value from strings, numbers, arrays and objects whose
|
|
567
|
+
* truthy keys are kept, like `classnames`
|
|
568
|
+
*/
|
|
569
|
+
propValue: (...args: unknown[]) => string;
|
|
503
570
|
/**
|
|
504
571
|
* Renders an image with intrinsic dimensions and lazy loading, plus `srcset` variants when
|
|
505
572
|
* `images.responsive` is on. Synchronous; print it with `<%~ %>`. Relative paths resolve
|
|
506
573
|
* next to the page's Markdown file, root-relative ones from the static directory.
|
|
507
574
|
*/
|
|
508
|
-
image
|
|
575
|
+
image: (src: string, options?: {
|
|
509
576
|
alt?: string;
|
|
510
577
|
sizes?: string;
|
|
511
578
|
priority?: boolean;
|
|
512
579
|
class?: string;
|
|
513
580
|
title?: string;
|
|
514
581
|
}) => string;
|
|
582
|
+
/** The page's SEO tags; `tags` limits them to some tag types */
|
|
583
|
+
generateSEO: (tags?: string[]) => string;
|
|
515
584
|
/** Size of the Open Graph image, set only while an Open Graph template renders */
|
|
516
585
|
og?: {
|
|
517
586
|
width: number;
|
|
518
587
|
height: number;
|
|
519
|
-
};
|
|
588
|
+
} | undefined;
|
|
520
589
|
/** The page's generated Open Graph image, when `images.og` produced one */
|
|
521
|
-
ogImage?: import('./images.js').GeneratedOgImage;
|
|
522
|
-
/** Additional properties that may be added dynamically (e.g., custom filters, helpers) */
|
|
523
|
-
[key: string]: unknown;
|
|
590
|
+
ogImage?: import('./images.js').GeneratedOgImage | undefined;
|
|
524
591
|
}
|
|
525
592
|
//# sourceMappingURL=content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/types/content.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,QAAQ;IACvB,qDAAqD;IACrD,EAAE,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,IAAI,EAAE,MA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M,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAC3F,MAAM,CAAC;IACZ,gEAAgE;IAChE,WAAW,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC;IACzC,kFAAkF;IAClF,EAAE,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACnD,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,aAAa,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAC9D"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Centralized exports for all type definitions
|
|
3
3
|
* This file provides a single entry point for importing types
|
|
4
4
|
*/
|
|
5
|
-
export type { AgingRule, ISGConfig, CacheEntry, CacheManifest } from './isg.js';
|
|
6
|
-
export type { SiteConfig, StatiConfig, BuildContext, PageContext, BuildHooks, BuildStats, SEOConfig, RobotsTxtConfig, TypeScriptConfig, BundleConfig, CollectionsConfig, GeneratedPageEntry, } from './config.js';
|
|
7
|
-
export type {
|
|
5
|
+
export type { AgingRule, ISGConfig, CacheEntry, CacheManifest, TemplateLookup } from './isg.js';
|
|
6
|
+
export type { SiteConfig, StatiConfig, StatiHelpers, BuildContext, PageContext, BuildHooks, BuildStats, SEOConfig, RobotsTxtConfig, TypeScriptConfig, BundleConfig, CollectionsConfig, GeneratedPageEntry, } from './config.js';
|
|
7
|
+
export type { MarkdownIt } from 'markdown-it';
|
|
8
|
+
export type { FrontMatter, PageModel, CollectionData, PaginationData, GeneratedPageData, PaginateOptions, GenerateOptions, TemplateContext, TemplateIncludeFunction, TemplateLayoutFunction, SEOMetadata, SitemapMetadata, RobotsConfig, OpenGraphConfig, OpenGraphImage, OpenGraphArticle, TwitterCardConfig, AuthorConfig, StatiAssets, TocEntry, } from './content.js';
|
|
8
9
|
export type { SEOContext, SEOValidationResult } from './seo.js';
|
|
9
10
|
export { SEOTagType } from './seo.js';
|
|
10
11
|
export type { ChangeFrequency, SitemapEntry, SitemapConfig, SitemapGenerationResult, } from './sitemap.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGhG,YAAY,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAGrB,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,YAAY,EACV,WAAW,EACX,SAAS,EACT,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,sBAAsB,EACtB,WAAW,EACX,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,QAAQ,GACT,MAAM,cAAc,CAAC;AAGtB,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC,YAAY,EACV,eAAe,EACf,YAAY,EACZ,aAAa,EACb,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAGtB,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG9E,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlG,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG/C,YAAY,EACV,YAAY,EACZ,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,EACd,MAAM,EACN,UAAU,EACV,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAGrB,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/types/isg.d.ts
CHANGED
|
@@ -46,6 +46,36 @@ export interface ISGConfig {
|
|
|
46
46
|
/** Array of aging rules for progressive cache extension */
|
|
47
47
|
aging?: AgingRule[];
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* A template name that a page's render looked up, recorded so the cache can tell when the
|
|
51
|
+
* name would resolve to a different file.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* // stati.include('partials/header') on a page in site/blog/
|
|
56
|
+
* const lookup: TemplateLookup = { name: 'partials/header', from: 'blog', file: 'partials/header.eta' };
|
|
57
|
+
* // stati.include.has('/partials/promo') when site/partials/promo.eta does not exist
|
|
58
|
+
* const miss: TemplateLookup = { name: '/partials/promo', file: null };
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export interface TemplateLookup {
|
|
62
|
+
/**
|
|
63
|
+
* A name looked up from `from` towards the source directory, such as `partials/header`, or,
|
|
64
|
+
* for names with one possible file (`/`, `./` and `../` names), that file's path from the
|
|
65
|
+
* source directory with a leading `/`, such as `/partials/header`. Never ends in `.eta`.
|
|
66
|
+
*/
|
|
67
|
+
readonly name: string;
|
|
68
|
+
/**
|
|
69
|
+
* The folder the name was looked up from, relative to the source directory, with `/`
|
|
70
|
+
* separators; `''` is the source directory itself. Absent for paths.
|
|
71
|
+
*/
|
|
72
|
+
readonly from?: string;
|
|
73
|
+
/**
|
|
74
|
+
* The template file the name resolved to, relative to the source directory, or `null` when
|
|
75
|
+
* no file matched
|
|
76
|
+
*/
|
|
77
|
+
readonly file: string | null;
|
|
78
|
+
}
|
|
49
79
|
/**
|
|
50
80
|
* Cache entry for a single page in the ISG cache manifest.
|
|
51
81
|
* Contains all information needed to determine if a page needs rebuilding.
|
|
@@ -55,7 +85,9 @@ export interface ISGConfig {
|
|
|
55
85
|
* const entry: CacheEntry = {
|
|
56
86
|
* path: '/blog/my-post/index.html',
|
|
57
87
|
* inputsHash: 'sha256-abc123...',
|
|
58
|
-
* deps: ['/site/
|
|
88
|
+
* deps: ['/project/site/blog/layout.eta', '/project/site/base.eta'],
|
|
89
|
+
* templateLookups: [{ name: 'partials/header', from: 'blog', file: 'partials/header.eta' }],
|
|
90
|
+
* templatesRecorded: true,
|
|
59
91
|
* tags: ['blog', 'tutorial'],
|
|
60
92
|
* publishedAt: '2024-01-01T00:00:00.000Z',
|
|
61
93
|
* renderedAt: '2024-01-15T10:30:00.000Z',
|
|
@@ -69,8 +101,22 @@ export interface CacheEntry {
|
|
|
69
101
|
readonly path: string;
|
|
70
102
|
/** Hash of page content, template dependencies, and rendering asset inputs */
|
|
71
103
|
readonly inputsHash: string;
|
|
72
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Every template file the last render used (the layout, its parents, the templates it
|
|
106
|
+
* included and the Open Graph template), as absolute POSIX paths, the page's layout first
|
|
107
|
+
*/
|
|
73
108
|
readonly deps: readonly string[];
|
|
109
|
+
/**
|
|
110
|
+
* Template names the last render looked up and what each resolved to, including names that
|
|
111
|
+
* matched no file. The page rebuilds when one of them would now resolve differently, for
|
|
112
|
+
* example after a section adds a template at the same path.
|
|
113
|
+
*/
|
|
114
|
+
templateLookups?: readonly TemplateLookup[];
|
|
115
|
+
/**
|
|
116
|
+
* Whether `deps` and `templateLookups` were recorded while the page rendered. A page whose
|
|
117
|
+
* entry lacks it rebuilds once to record them.
|
|
118
|
+
*/
|
|
119
|
+
templatesRecorded?: boolean;
|
|
74
120
|
/** Tags for invalidation and organization */
|
|
75
121
|
readonly tags: readonly string[];
|
|
76
122
|
/** ISO date when content was originally published */
|
package/dist/types/isg.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isg.d.ts","sourceRoot":"","sources":["../../src/types/isg.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,SAAS;IACxB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,SAAS;IACxB,qCAAqC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;CACrB;AAED
|
|
1
|
+
{"version":3,"file":"isg.d.ts","sourceRoot":"","sources":["../../src/types/isg.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,SAAS;IACxB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,SAAS;IACxB,qCAAqC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4CAA4C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B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACpC,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stati/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"chokidar": "^5.0.0",
|
|
45
45
|
"esbuild": "^0.28.2",
|
|
46
|
-
"eta": "
|
|
47
|
-
"fast-glob": "^3.3.3",
|
|
46
|
+
"eta": "4.6.0",
|
|
48
47
|
"fs-extra": "^11.4.1",
|
|
49
|
-
"
|
|
50
|
-
"markdown-it": "^
|
|
48
|
+
"js-yaml": "^4.3.2",
|
|
49
|
+
"markdown-it": "^15.0.3",
|
|
51
50
|
"open": "^11.0.4",
|
|
51
|
+
"tinyglobby": "^0.2.17",
|
|
52
52
|
"ws": "^8.22.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/fs-extra": "^11.0.4",
|
|
56
|
-
"@types/
|
|
56
|
+
"@types/js-yaml": "^4.0.9",
|
|
57
57
|
"@types/ws": "^8.5.12"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Eta } from 'eta';
|
|
2
|
-
/**
|
|
3
|
-
* Type definition for a callable partial function.
|
|
4
|
-
* Can be called with optional props or used directly as a value.
|
|
5
|
-
*/
|
|
6
|
-
export type CallablePartial = {
|
|
7
|
-
(props?: Record<string, unknown>): string;
|
|
8
|
-
toString(): string;
|
|
9
|
-
valueOf(): string;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Creates a callable partial that can be used both as a value and as a function.
|
|
13
|
-
* This enables both syntaxes:
|
|
14
|
-
* - Direct usage: <%~ stati.partials.header %>
|
|
15
|
-
* - With props: <%~ stati.partials.hero({ title: 'Hello' }) %>
|
|
16
|
-
*
|
|
17
|
-
* @param eta - The Eta template engine instance
|
|
18
|
-
* @param partialPath - Absolute path to the partial template file
|
|
19
|
-
* @param baseContext - The base template context (without props)
|
|
20
|
-
* @param renderedContent - Pre-rendered content for the no-props case
|
|
21
|
-
* @returns A callable partial function
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```typescript
|
|
25
|
-
* const callable = makeCallablePartial(eta, '/path/to/partial.eta', baseContext, '<div>Header</div>');
|
|
26
|
-
*
|
|
27
|
-
* // Use without props (returns pre-rendered content)
|
|
28
|
-
* const html1 = callable.toString(); // '<div>Header</div>'
|
|
29
|
-
*
|
|
30
|
-
* // Use with props (re-renders with merged context)
|
|
31
|
-
* const html2 = callable({ title: 'Custom Title' }); // Renders with custom props
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare function makeCallablePartial(eta: Eta, partialPath: string, baseContext: Record<string, unknown>, renderedContent: string): CallablePartial;
|
|
35
|
-
/**
|
|
36
|
-
* Wraps all partials in a record with callable partial wrappers.
|
|
37
|
-
* This allows partials to be used both as values and as functions.
|
|
38
|
-
*
|
|
39
|
-
* @param eta - The Eta template engine instance
|
|
40
|
-
* @param partials - Record mapping partial names to their rendered content
|
|
41
|
-
* @param partialPaths - Record mapping partial names to their absolute file paths
|
|
42
|
-
* @param baseContext - The base template context (without props)
|
|
43
|
-
* @returns Record of callable partials
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```typescript
|
|
47
|
-
* const callablePartials = wrapPartialsAsCallable(
|
|
48
|
-
* eta,
|
|
49
|
-
* { header: '<div>Header</div>', footer: '<div>Footer</div>' },
|
|
50
|
-
* { header: '/path/to/header.eta', footer: '/path/to/footer.eta' },
|
|
51
|
-
* baseContext
|
|
52
|
-
* );
|
|
53
|
-
*
|
|
54
|
-
* // Both syntaxes work
|
|
55
|
-
* callablePartials.header.toString(); // Direct usage
|
|
56
|
-
* callablePartials.header({ title: 'Custom' }); // With props
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
export declare function wrapPartialsAsCallable(eta: Eta, partials: Record<string, string>, partialPaths: Record<string, string>, baseContext: Record<string, unknown>): Record<string, CallablePartial>;
|
|
60
|
-
//# sourceMappingURL=callable-partials.utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"callable-partials.utils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/callable-partials.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAK1B;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;IAC1C,QAAQ,IAAI,MAAM,CAAC;IACnB,OAAO,IAAI,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,eAAe,EAAE,MAAM,GACtB,eAAe,CA0DjB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CA+BjC"}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { isDevelopment } from '../../env.js';
|
|
2
|
-
import { createValidatingContextProxy } from './context-validation.utils.js';
|
|
3
|
-
import { createValidatingPartialsProxy } from './partial-validation.utils.js';
|
|
4
|
-
/**
|
|
5
|
-
* Creates a callable partial that can be used both as a value and as a function.
|
|
6
|
-
* This enables both syntaxes:
|
|
7
|
-
* - Direct usage: <%~ stati.partials.header %>
|
|
8
|
-
* - With props: <%~ stati.partials.hero({ title: 'Hello' }) %>
|
|
9
|
-
*
|
|
10
|
-
* @param eta - The Eta template engine instance
|
|
11
|
-
* @param partialPath - Absolute path to the partial template file
|
|
12
|
-
* @param baseContext - The base template context (without props)
|
|
13
|
-
* @param renderedContent - Pre-rendered content for the no-props case
|
|
14
|
-
* @returns A callable partial function
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const callable = makeCallablePartial(eta, '/path/to/partial.eta', baseContext, '<div>Header</div>');
|
|
19
|
-
*
|
|
20
|
-
* // Use without props (returns pre-rendered content)
|
|
21
|
-
* const html1 = callable.toString(); // '<div>Header</div>'
|
|
22
|
-
*
|
|
23
|
-
* // Use with props (re-renders with merged context)
|
|
24
|
-
* const html2 = callable({ title: 'Custom Title' }); // Renders with custom props
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export function makeCallablePartial(eta, partialPath, baseContext, renderedContent) {
|
|
28
|
-
/**
|
|
29
|
-
* The main callable function.
|
|
30
|
-
* When called with props, re-renders the partial with merged context.
|
|
31
|
-
* When called without props, returns the pre-rendered content.
|
|
32
|
-
*/
|
|
33
|
-
const callable = (props) => {
|
|
34
|
-
if (!props || Object.keys(props).length === 0) {
|
|
35
|
-
// No props provided - return pre-rendered content
|
|
36
|
-
return renderedContent;
|
|
37
|
-
}
|
|
38
|
-
// Props provided - re-render with merged context
|
|
39
|
-
try {
|
|
40
|
-
const mergedContext = createValidatingContextProxy({
|
|
41
|
-
...baseContext,
|
|
42
|
-
props, // Make props available as stati.props
|
|
43
|
-
});
|
|
44
|
-
// Render the partial with the merged context using renderAsync
|
|
45
|
-
// This is a synchronous call despite the name when used with already-loaded templates
|
|
46
|
-
const result = eta.render(partialPath, mergedContext);
|
|
47
|
-
return result || '';
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
// In development, let the error reach the calling template so it ends up
|
|
51
|
-
// in the error overlay instead of a hidden HTML comment
|
|
52
|
-
if (isDevelopment()) {
|
|
53
|
-
throw error;
|
|
54
|
-
}
|
|
55
|
-
console.error(`Error rendering callable partial ${partialPath} with props:`, error);
|
|
56
|
-
return `<!-- Error rendering partial with props: ${error instanceof Error ? error.message : String(error)} -->`;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
// Create a Proxy to handle different usage patterns
|
|
60
|
-
const proxy = new Proxy(callable, {
|
|
61
|
-
/**
|
|
62
|
-
* Handle function calls: stati.partials.header({ props })
|
|
63
|
-
*/
|
|
64
|
-
apply(target, thisArg, args) {
|
|
65
|
-
return target.apply(thisArg, args);
|
|
66
|
-
},
|
|
67
|
-
/**
|
|
68
|
-
* Handle toString(): When used in template interpolation without parentheses
|
|
69
|
-
* Example: <%~ stati.partials.header %>
|
|
70
|
-
*/
|
|
71
|
-
get(target, prop) {
|
|
72
|
-
if (prop === 'toString' || prop === 'valueOf') {
|
|
73
|
-
return () => renderedContent;
|
|
74
|
-
}
|
|
75
|
-
// Allow other function properties to pass through
|
|
76
|
-
return Reflect.get(target, prop);
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
return proxy;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Wraps all partials in a record with callable partial wrappers.
|
|
83
|
-
* This allows partials to be used both as values and as functions.
|
|
84
|
-
*
|
|
85
|
-
* @param eta - The Eta template engine instance
|
|
86
|
-
* @param partials - Record mapping partial names to their rendered content
|
|
87
|
-
* @param partialPaths - Record mapping partial names to their absolute file paths
|
|
88
|
-
* @param baseContext - The base template context (without props)
|
|
89
|
-
* @returns Record of callable partials
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* ```typescript
|
|
93
|
-
* const callablePartials = wrapPartialsAsCallable(
|
|
94
|
-
* eta,
|
|
95
|
-
* { header: '<div>Header</div>', footer: '<div>Footer</div>' },
|
|
96
|
-
* { header: '/path/to/header.eta', footer: '/path/to/footer.eta' },
|
|
97
|
-
* baseContext
|
|
98
|
-
* );
|
|
99
|
-
*
|
|
100
|
-
* // Both syntaxes work
|
|
101
|
-
* callablePartials.header.toString(); // Direct usage
|
|
102
|
-
* callablePartials.header({ title: 'Custom' }); // With props
|
|
103
|
-
* ```
|
|
104
|
-
*/
|
|
105
|
-
export function wrapPartialsAsCallable(eta, partials, partialPaths, baseContext) {
|
|
106
|
-
const callablePartials = {};
|
|
107
|
-
// Create a context that will have partials updated to the callable versions
|
|
108
|
-
// This enables nested callable partial calls. The getter runs when a partial is
|
|
109
|
-
// rendered with props, after all callables exist, and wraps them in the same
|
|
110
|
-
// validating proxy that layouts and pre-rendered partials get.
|
|
111
|
-
const contextWithCallablePartials = {
|
|
112
|
-
...baseContext,
|
|
113
|
-
get partials() {
|
|
114
|
-
return createValidatingPartialsProxy(callablePartials);
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
for (const [name, renderedContent] of Object.entries(partials)) {
|
|
118
|
-
const partialPath = partialPaths[name];
|
|
119
|
-
if (!partialPath) {
|
|
120
|
-
console.warn(`No path found for partial "${name}", skipping callable wrapper`);
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
// Pass the context that has dynamic access to all callable partials
|
|
124
|
-
callablePartials[name] = makeCallablePartial(eta, partialPath, contextWithCallablePartials, renderedContent);
|
|
125
|
-
}
|
|
126
|
-
return callablePartials;
|
|
127
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type CallablePartial } from './callable-partials.utils.js';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a development-mode Proxy for the partials object that throws errors
|
|
4
|
-
* when accessing non-existent partials instead of returning undefined.
|
|
5
|
-
*
|
|
6
|
-
* Supports both string partials and CallablePartial.
|
|
7
|
-
*/
|
|
8
|
-
export declare function createValidatingPartialsProxy<T extends string | CallablePartial>(partials: Record<string, T>): Record<string, T>;
|
|
9
|
-
//# sourceMappingURL=partial-validation.utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"partial-validation.utils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/partial-validation.utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAqDpE;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,CAAC,SAAS,MAAM,GAAG,eAAe,EAC9E,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAC1B,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CA4DnB"}
|