@stati/core 1.0.0 → 1.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.
- package/README.md +217 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +24 -2
- package/dist/core/build.d.ts +9 -2
- package/dist/core/build.d.ts.map +1 -1
- package/dist/core/build.js +200 -46
- package/dist/core/dev.d.ts +21 -0
- package/dist/core/dev.d.ts.map +1 -0
- package/dist/core/dev.js +371 -0
- package/dist/core/invalidate.d.ts +67 -1
- package/dist/core/invalidate.d.ts.map +1 -1
- package/dist/core/invalidate.js +321 -4
- package/dist/core/isg/build-lock.d.ts +116 -0
- package/dist/core/isg/build-lock.d.ts.map +1 -0
- package/dist/core/isg/build-lock.js +243 -0
- package/dist/core/isg/builder.d.ts +51 -0
- package/dist/core/isg/builder.d.ts.map +1 -0
- package/dist/core/isg/builder.js +321 -0
- package/dist/core/isg/deps.d.ts +63 -0
- package/dist/core/isg/deps.d.ts.map +1 -0
- package/dist/core/isg/deps.js +332 -0
- package/dist/core/isg/hash.d.ts +48 -0
- package/dist/core/isg/hash.d.ts.map +1 -0
- package/dist/core/isg/hash.js +82 -0
- package/dist/core/isg/manifest.d.ts +47 -0
- package/dist/core/isg/manifest.d.ts.map +1 -0
- package/dist/core/isg/manifest.js +233 -0
- package/dist/core/isg/ttl.d.ts +101 -0
- package/dist/core/isg/ttl.d.ts.map +1 -0
- package/dist/core/isg/ttl.js +222 -0
- package/dist/core/isg/validation.d.ts +71 -0
- package/dist/core/isg/validation.d.ts.map +1 -0
- package/dist/core/isg/validation.js +226 -0
- package/dist/core/templates.d.ts.map +1 -1
- package/dist/core/templates.js +23 -5
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/types.d.ts +172 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -3
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error codes for ISG validation failures.
|
|
3
|
+
* These provide structured error identification for better debugging.
|
|
4
|
+
*/
|
|
5
|
+
export var ISGValidationError;
|
|
6
|
+
(function (ISGValidationError) {
|
|
7
|
+
ISGValidationError["INVALID_TTL"] = "ISG_INVALID_TTL";
|
|
8
|
+
ISGValidationError["INVALID_MAX_AGE_CAP"] = "ISG_INVALID_MAX_AGE_CAP";
|
|
9
|
+
ISGValidationError["INVALID_AGING_RULE"] = "ISG_INVALID_AGING_RULE";
|
|
10
|
+
ISGValidationError["DUPLICATE_AGING_RULE"] = "ISG_DUPLICATE_AGING_RULE";
|
|
11
|
+
ISGValidationError["UNSORTED_AGING_RULES"] = "ISG_UNSORTED_AGING_RULES";
|
|
12
|
+
ISGValidationError["AGING_RULE_EXCEEDS_CAP"] = "ISG_AGING_RULE_EXCEEDS_CAP";
|
|
13
|
+
})(ISGValidationError || (ISGValidationError = {}));
|
|
14
|
+
/**
|
|
15
|
+
* Represents a validation error with context and actionable message.
|
|
16
|
+
*/
|
|
17
|
+
export class ISGConfigurationError extends Error {
|
|
18
|
+
code;
|
|
19
|
+
field;
|
|
20
|
+
value;
|
|
21
|
+
constructor(code, field, value, message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.code = code;
|
|
24
|
+
this.field = field;
|
|
25
|
+
this.value = value;
|
|
26
|
+
this.name = 'ISGConfigurationError';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Validates ISG configuration and provides actionable error messages.
|
|
31
|
+
* Throws ISGConfigurationError for invalid configurations.
|
|
32
|
+
*
|
|
33
|
+
* @param config - ISG configuration to validate
|
|
34
|
+
* @throws {ISGConfigurationError} When configuration is invalid
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* try {
|
|
39
|
+
* validateISGConfig(userConfig.isg);
|
|
40
|
+
* } catch (error) {
|
|
41
|
+
* if (error instanceof ISGConfigurationError) {
|
|
42
|
+
* console.error(`${error.code}: ${error.message}`);
|
|
43
|
+
* console.error(`Field: ${error.field}, Value: ${error.value}`);
|
|
44
|
+
* }
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export function validateISGConfig(config) {
|
|
49
|
+
if (!config) {
|
|
50
|
+
return; // Config is optional
|
|
51
|
+
}
|
|
52
|
+
// Validate TTL seconds
|
|
53
|
+
if (config.ttlSeconds !== undefined) {
|
|
54
|
+
validateTTLSeconds(config.ttlSeconds);
|
|
55
|
+
}
|
|
56
|
+
// Validate max age cap
|
|
57
|
+
if (config.maxAgeCapDays !== undefined) {
|
|
58
|
+
validateMaxAgeCapDays(config.maxAgeCapDays);
|
|
59
|
+
}
|
|
60
|
+
// Validate aging rules
|
|
61
|
+
if (config.aging && Array.isArray(config.aging)) {
|
|
62
|
+
validateAgingRules(config.aging, config.maxAgeCapDays);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Validates TTL seconds value.
|
|
67
|
+
*/
|
|
68
|
+
function validateTTLSeconds(ttlSeconds) {
|
|
69
|
+
if (typeof ttlSeconds !== 'number' || !Number.isInteger(ttlSeconds)) {
|
|
70
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_TTL, 'ttlSeconds', ttlSeconds, 'ttlSeconds must be a positive integer representing seconds. Example: 3600 (1 hour)');
|
|
71
|
+
}
|
|
72
|
+
if (ttlSeconds < 0) {
|
|
73
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_TTL, 'ttlSeconds', ttlSeconds, 'ttlSeconds cannot be negative. Use 0 for immediate expiration or a positive value.');
|
|
74
|
+
}
|
|
75
|
+
if (ttlSeconds > 365 * 24 * 3600) {
|
|
76
|
+
// More than 1 year
|
|
77
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_TTL, 'ttlSeconds', ttlSeconds, 'ttlSeconds is unusually large (>1 year). Consider using maxAgeCapDays for long-term caching.');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Validates max age cap days value.
|
|
82
|
+
*/
|
|
83
|
+
function validateMaxAgeCapDays(maxAgeCapDays) {
|
|
84
|
+
if (typeof maxAgeCapDays !== 'number' || !Number.isInteger(maxAgeCapDays)) {
|
|
85
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_MAX_AGE_CAP, 'maxAgeCapDays', maxAgeCapDays, 'maxAgeCapDays must be a positive integer representing days. Example: 365 (1 year)');
|
|
86
|
+
}
|
|
87
|
+
if (maxAgeCapDays <= 0) {
|
|
88
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_MAX_AGE_CAP, 'maxAgeCapDays', maxAgeCapDays, 'maxAgeCapDays must be positive. Use a value like 30, 90, or 365 days.');
|
|
89
|
+
}
|
|
90
|
+
if (maxAgeCapDays > 3650) {
|
|
91
|
+
// More than 10 years
|
|
92
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_MAX_AGE_CAP, 'maxAgeCapDays', maxAgeCapDays, 'maxAgeCapDays is unusually large (>10 years). Consider if this is intended.');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Validates aging rules array.
|
|
97
|
+
*/
|
|
98
|
+
function validateAgingRules(aging, maxAgeCapDays) {
|
|
99
|
+
const seenUntilDays = new Set();
|
|
100
|
+
for (let i = 0; i < aging.length; i++) {
|
|
101
|
+
const rule = aging[i];
|
|
102
|
+
// Skip invalid entries
|
|
103
|
+
if (!rule) {
|
|
104
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_AGING_RULE, `aging[${i}]`, rule, `Aging rule at index ${i} is null or undefined.`);
|
|
105
|
+
}
|
|
106
|
+
// Validate individual rule
|
|
107
|
+
validateAgingRule(rule, i);
|
|
108
|
+
// Check for duplicates
|
|
109
|
+
if (seenUntilDays.has(rule.untilDays)) {
|
|
110
|
+
throw new ISGConfigurationError(ISGValidationError.DUPLICATE_AGING_RULE, `aging[${i}].untilDays`, rule.untilDays, `Duplicate aging rule for ${rule.untilDays} days. Each untilDays value must be unique.`);
|
|
111
|
+
}
|
|
112
|
+
seenUntilDays.add(rule.untilDays);
|
|
113
|
+
// Check if rule exceeds max age cap
|
|
114
|
+
if (maxAgeCapDays !== undefined && rule.untilDays > maxAgeCapDays) {
|
|
115
|
+
throw new ISGConfigurationError(ISGValidationError.AGING_RULE_EXCEEDS_CAP, `aging[${i}].untilDays`, rule.untilDays, `Aging rule for ${rule.untilDays} days exceeds maxAgeCapDays (${maxAgeCapDays}). Rule will never be used.`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Check if rules are sorted by untilDays (ascending)
|
|
119
|
+
const sortedRules = [...aging].sort((a, b) => a.untilDays - b.untilDays);
|
|
120
|
+
for (let i = 0; i < aging.length; i++) {
|
|
121
|
+
if (aging[i]?.untilDays !== sortedRules[i]?.untilDays) {
|
|
122
|
+
throw new ISGConfigurationError(ISGValidationError.UNSORTED_AGING_RULES, 'aging', aging.map((r) => r.untilDays), 'Aging rules must be sorted by untilDays in ascending order. Sort rules from shortest to longest duration.');
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Validates a single aging rule.
|
|
128
|
+
*/
|
|
129
|
+
function validateAgingRule(rule, index) {
|
|
130
|
+
if (!rule || typeof rule !== 'object') {
|
|
131
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_AGING_RULE, `aging[${index}]`, rule, 'Aging rule must be an object with untilDays and ttlSeconds properties.');
|
|
132
|
+
}
|
|
133
|
+
// Validate untilDays
|
|
134
|
+
if (typeof rule.untilDays !== 'number' ||
|
|
135
|
+
!Number.isInteger(rule.untilDays) ||
|
|
136
|
+
rule.untilDays <= 0) {
|
|
137
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_AGING_RULE, `aging[${index}].untilDays`, rule.untilDays, 'untilDays must be a positive integer representing days. Example: 7, 30, 90');
|
|
138
|
+
}
|
|
139
|
+
// Validate ttlSeconds
|
|
140
|
+
if (typeof rule.ttlSeconds !== 'number' ||
|
|
141
|
+
!Number.isInteger(rule.ttlSeconds) ||
|
|
142
|
+
rule.ttlSeconds < 0) {
|
|
143
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_AGING_RULE, `aging[${index}].ttlSeconds`, rule.ttlSeconds, 'ttlSeconds must be a non-negative integer representing seconds. Example: 3600 (1 hour)');
|
|
144
|
+
}
|
|
145
|
+
// Warn about unusually long TTL in aging rules
|
|
146
|
+
if (rule.ttlSeconds > 30 * 24 * 3600) {
|
|
147
|
+
// More than 30 days
|
|
148
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_AGING_RULE, `aging[${index}].ttlSeconds`, rule.ttlSeconds, `ttlSeconds in aging rule is unusually large (>30 days). Consider if this is intended for content up to ${rule.untilDays} days old.`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Validates front-matter ISG overrides for a single page.
|
|
153
|
+
* Provides helpful error messages for invalid page-level configuration.
|
|
154
|
+
*
|
|
155
|
+
* @param frontMatter - Page front-matter object
|
|
156
|
+
* @param sourcePath - Path to source file for error context
|
|
157
|
+
* @throws {ISGConfigurationError} When front-matter overrides are invalid
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* try {
|
|
162
|
+
* validatePageISGOverrides(page.frontMatter, page.sourcePath);
|
|
163
|
+
* } catch (error) {
|
|
164
|
+
* console.error(`Error in ${page.sourcePath}: ${error.message}`);
|
|
165
|
+
* }
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
export function validatePageISGOverrides(frontMatter, sourcePath) {
|
|
169
|
+
// Validate page-level ttlSeconds override
|
|
170
|
+
if (frontMatter.ttlSeconds !== undefined) {
|
|
171
|
+
if (typeof frontMatter.ttlSeconds !== 'number' ||
|
|
172
|
+
!Number.isInteger(frontMatter.ttlSeconds) ||
|
|
173
|
+
frontMatter.ttlSeconds < 0) {
|
|
174
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_TTL, 'ttlSeconds', frontMatter.ttlSeconds, `Invalid ttlSeconds in front-matter of ${sourcePath}. Must be a non-negative integer.`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// Validate page-level maxAgeCapDays override
|
|
178
|
+
if (frontMatter.maxAgeCapDays !== undefined) {
|
|
179
|
+
if (typeof frontMatter.maxAgeCapDays !== 'number' ||
|
|
180
|
+
!Number.isInteger(frontMatter.maxAgeCapDays) ||
|
|
181
|
+
frontMatter.maxAgeCapDays <= 0) {
|
|
182
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_MAX_AGE_CAP, 'maxAgeCapDays', frontMatter.maxAgeCapDays, `Invalid maxAgeCapDays in front-matter of ${sourcePath}. Must be a positive integer.`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// Validate tags array
|
|
186
|
+
if (frontMatter.tags !== undefined) {
|
|
187
|
+
if (!Array.isArray(frontMatter.tags)) {
|
|
188
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_AGING_RULE, // Reusing closest error code
|
|
189
|
+
'tags', frontMatter.tags, `Invalid tags in front-matter of ${sourcePath}. Must be an array of strings.`);
|
|
190
|
+
}
|
|
191
|
+
// Check that all tags are strings
|
|
192
|
+
frontMatter.tags.forEach((tag, index) => {
|
|
193
|
+
if (typeof tag !== 'string') {
|
|
194
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_AGING_RULE, `tags[${index}]`, tag, `Invalid tag at index ${index} in front-matter of ${sourcePath}. All tags must be strings.`);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Safely extracts numeric value from front-matter with validation.
|
|
201
|
+
* Used for TTL and max age cap overrides.
|
|
202
|
+
*
|
|
203
|
+
* @param value - Value from front-matter
|
|
204
|
+
* @param fieldName - Name of the field for error messages
|
|
205
|
+
* @param sourcePath - Source file path for error context
|
|
206
|
+
* @returns Validated number or undefined if not set
|
|
207
|
+
*/
|
|
208
|
+
export function extractNumericOverride(value, fieldName, sourcePath) {
|
|
209
|
+
if (value === undefined || value === null) {
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
212
|
+
if (typeof value === 'number') {
|
|
213
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
214
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_TTL, fieldName, value, `Invalid ${fieldName} in ${sourcePath}: must be a non-negative finite number.`);
|
|
215
|
+
}
|
|
216
|
+
return Math.floor(value); // Ensure integer
|
|
217
|
+
}
|
|
218
|
+
if (typeof value === 'string') {
|
|
219
|
+
const parsed = parseInt(value, 10);
|
|
220
|
+
if (Number.isNaN(parsed) || parsed < 0) {
|
|
221
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_TTL, fieldName, value, `Invalid ${fieldName} in ${sourcePath}: "${value}" is not a valid non-negative number.`);
|
|
222
|
+
}
|
|
223
|
+
return parsed;
|
|
224
|
+
}
|
|
225
|
+
throw new ISGConfigurationError(ISGValidationError.INVALID_TTL, fieldName, value, `Invalid ${fieldName} in ${sourcePath}: must be a number or numeric string.`);
|
|
226
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/core/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/core/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAM1B,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAkB,MAAM,aAAa,CAAC;AAgRnF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,WAAW,GAAG,GAAG,CAS7D;AAED,wBAAsB,UAAU,CAC9B,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,EACnB,GAAG,EAAE,GAAG,EACR,UAAU,CAAC,EAAE,OAAO,EAAE,EACtB,QAAQ,CAAC,EAAE,SAAS,EAAE,GACrB,OAAO,CAAC,MAAM,CAAC,CAkEjB"}
|
package/dist/core/templates.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Eta } from 'eta';
|
|
2
2
|
import { join, dirname, relative, basename } from 'path';
|
|
3
|
+
import { posix } from 'path';
|
|
3
4
|
import fse from 'fs-extra';
|
|
4
5
|
const { pathExists } = fse;
|
|
5
6
|
import glob from 'fast-glob';
|
|
@@ -216,7 +217,7 @@ async function discoverLayout(pagePath, config, explicitLayout, isIndexPage) {
|
|
|
216
217
|
if (await pathExists(indexLayoutPath)) {
|
|
217
218
|
// Return relative path with forward slashes for Eta
|
|
218
219
|
const relativePath = dir ? `${dir}/index.eta` : 'index.eta';
|
|
219
|
-
return
|
|
220
|
+
return posix.normalize(relativePath);
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
223
|
// Then check for layout.eta as fallback
|
|
@@ -224,7 +225,7 @@ async function discoverLayout(pagePath, config, explicitLayout, isIndexPage) {
|
|
|
224
225
|
if (await pathExists(layoutPath)) {
|
|
225
226
|
// Return relative path with forward slashes for Eta
|
|
226
227
|
const relativePath = dir ? `${dir}/layout.eta` : 'layout.eta';
|
|
227
|
-
return
|
|
228
|
+
return posix.normalize(relativePath);
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
231
|
return null;
|
|
@@ -241,7 +242,7 @@ export async function renderPage(page, body, config, eta, navigation, allPages)
|
|
|
241
242
|
// Discover partials for this page's directory hierarchy
|
|
242
243
|
const srcDir = join(process.cwd(), config.srcDir);
|
|
243
244
|
const relativePath = relative(srcDir, page.sourcePath);
|
|
244
|
-
const
|
|
245
|
+
const partialPaths = await discoverPartials(relativePath, config);
|
|
245
246
|
// Build collection data if this is an index page and all pages are provided
|
|
246
247
|
let collectionData;
|
|
247
248
|
const isIndexPage = allPages && isCollectionIndexPage(page, allPages);
|
|
@@ -251,20 +252,37 @@ export async function renderPage(page, body, config, eta, navigation, allPages)
|
|
|
251
252
|
// Discover the appropriate layout using hierarchical layout.eta convention
|
|
252
253
|
// Pass isIndexPage flag to enable index.eta lookup for aggregation pages
|
|
253
254
|
const layoutPath = await discoverLayout(relativePath, config, page.frontMatter.layout, isIndexPage);
|
|
254
|
-
|
|
255
|
+
// Create base context for partial rendering
|
|
256
|
+
const baseContext = {
|
|
255
257
|
site: config.site,
|
|
256
258
|
page: {
|
|
257
259
|
...page.frontMatter,
|
|
258
260
|
path: page.url,
|
|
261
|
+
url: page.url, // Add url property for compatibility
|
|
259
262
|
content: body,
|
|
260
263
|
},
|
|
261
264
|
content: body,
|
|
262
265
|
navigation: navigation || [],
|
|
263
|
-
partials, // Add discovered partials to template context
|
|
264
266
|
collection: collectionData, // Add collection data for index pages
|
|
265
267
|
// Add custom filters to context
|
|
266
268
|
...(config.eta?.filters || {}),
|
|
267
269
|
};
|
|
270
|
+
// Render partials and store their content
|
|
271
|
+
const renderedPartials = {};
|
|
272
|
+
for (const [partialName, partialPath] of Object.entries(partialPaths)) {
|
|
273
|
+
try {
|
|
274
|
+
const renderedContent = await eta.renderAsync(partialPath, baseContext);
|
|
275
|
+
renderedPartials[partialName] = renderedContent;
|
|
276
|
+
}
|
|
277
|
+
catch (error) {
|
|
278
|
+
console.warn(`Warning: Failed to render partial ${partialName} at ${partialPath}:`, error);
|
|
279
|
+
renderedPartials[partialName] = `<!-- Error rendering partial: ${partialName} -->`;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
const context = {
|
|
283
|
+
...baseContext,
|
|
284
|
+
partials: renderedPartials, // Add rendered partials to template context
|
|
285
|
+
};
|
|
268
286
|
try {
|
|
269
287
|
if (!layoutPath) {
|
|
270
288
|
console.warn('No layout template found, using fallback');
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
*/
|
|
22
22
|
export type { StatiConfig, PageModel, FrontMatter, BuildContext, PageContext, BuildHooks, NavNode, ISGConfig, AgingRule, BuildStats, } from './types.js';
|
|
23
23
|
export type { BuildOptions } from './core/build.js';
|
|
24
|
+
export type { DevServerOptions } from './core/dev.js';
|
|
25
|
+
export type { InvalidationResult } from './core/invalidate.js';
|
|
24
26
|
export { build } from './core/build.js';
|
|
27
|
+
export { createDevServer } from './core/dev.js';
|
|
25
28
|
export { loadConfig } from './config/loader.js';
|
|
26
29
|
export { invalidate } from './core/invalidate.js';
|
|
27
30
|
import type { StatiConfig } from './types.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,YAAY,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,OAAO,EACP,SAAS,EACT,SAAS,EACT,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,YAAY,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,OAAO,EACP,SAAS,EACT,SAAS,EACT,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAE7D"}
|
package/dist/index.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -44,6 +44,60 @@ export interface ISGConfig {
|
|
|
44
44
|
/** Array of aging rules for progressive cache extension */
|
|
45
45
|
aging?: AgingRule[];
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Cache entry for a single page in the ISG cache manifest.
|
|
49
|
+
* Contains all information needed to determine if a page needs rebuilding.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const entry: CacheEntry = {
|
|
54
|
+
* path: '/blog/my-post/index.html',
|
|
55
|
+
* inputsHash: 'sha256-abc123...',
|
|
56
|
+
* deps: ['/site/_layouts/post.eta', '/site/_partials/header.eta'],
|
|
57
|
+
* tags: ['blog', 'tutorial'],
|
|
58
|
+
* publishedAt: '2024-01-01T00:00:00.000Z',
|
|
59
|
+
* renderedAt: '2024-01-15T10:30:00.000Z',
|
|
60
|
+
* ttlSeconds: 21600,
|
|
61
|
+
* maxAgeCapDays: 365
|
|
62
|
+
* };
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export interface CacheEntry {
|
|
66
|
+
/** Output path of the rendered page */
|
|
67
|
+
path: string;
|
|
68
|
+
/** Hash of page content and all dependencies */
|
|
69
|
+
inputsHash: string;
|
|
70
|
+
/** Array of file paths this page depends on (templates, partials) */
|
|
71
|
+
deps: string[];
|
|
72
|
+
/** Tags for invalidation and organization */
|
|
73
|
+
tags: string[];
|
|
74
|
+
/** ISO date when content was originally published */
|
|
75
|
+
publishedAt?: string;
|
|
76
|
+
/** ISO date when page was last rendered */
|
|
77
|
+
renderedAt: string;
|
|
78
|
+
/** Effective TTL for this page in seconds */
|
|
79
|
+
ttlSeconds: number;
|
|
80
|
+
/** Maximum age cap for this page in days */
|
|
81
|
+
maxAgeCapDays?: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* ISG cache manifest containing all cached page entries.
|
|
85
|
+
* Persisted as JSON in .stati/cache/manifest.json
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* const manifest: CacheManifest = {
|
|
90
|
+
* entries: {
|
|
91
|
+
* '/blog/post-1': { ... },
|
|
92
|
+
* '/about': { ... }
|
|
93
|
+
* }
|
|
94
|
+
* };
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export interface CacheManifest {
|
|
98
|
+
/** Map of page URLs to their cache entries */
|
|
99
|
+
entries: Record<string, CacheEntry>;
|
|
100
|
+
}
|
|
47
101
|
/**
|
|
48
102
|
* Site-wide configuration settings.
|
|
49
103
|
* Contains global metadata and URL configuration for the static site.
|
|
@@ -108,6 +162,15 @@ export interface StatiConfig {
|
|
|
108
162
|
};
|
|
109
163
|
/** Incremental Static Generation configuration */
|
|
110
164
|
isg?: ISGConfig;
|
|
165
|
+
/** Development server configuration */
|
|
166
|
+
dev?: {
|
|
167
|
+
/** Port for development server (default: 3000) */
|
|
168
|
+
port?: number;
|
|
169
|
+
/** Host for development server (default: 'localhost') */
|
|
170
|
+
host?: string;
|
|
171
|
+
/** Whether to open browser automatically (default: false) */
|
|
172
|
+
open?: boolean;
|
|
173
|
+
};
|
|
111
174
|
/** Build lifecycle hooks */
|
|
112
175
|
hooks?: BuildHooks;
|
|
113
176
|
}
|
|
@@ -259,6 +322,115 @@ export interface PageModel {
|
|
|
259
322
|
/** Publication date (parsed from front matter or file stats) */
|
|
260
323
|
publishedAt?: Date;
|
|
261
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* Logger interface for customizing build output and visualization.
|
|
327
|
+
* Provides comprehensive logging capabilities including basic log levels, build progress tracking,
|
|
328
|
+
* file operations, statistics display, and advanced tree-based rendering visualization.
|
|
329
|
+
*
|
|
330
|
+
* Core Methods (Required):
|
|
331
|
+
* - Basic logging: info, success, warning, error
|
|
332
|
+
* - Build progress: building, processing, stats
|
|
333
|
+
*
|
|
334
|
+
* Enhanced Methods (Optional):
|
|
335
|
+
* - Visual formatting: header, step, progress, divider
|
|
336
|
+
* - File operations: file, url, timing
|
|
337
|
+
* - Statistics: statsTable, navigationTree
|
|
338
|
+
* - Tree visualization: startRenderingTree, addTreeNode, updateTreeNode, showRenderingTree, clearRenderingTree
|
|
339
|
+
*
|
|
340
|
+
* @example Basic Logger Implementation
|
|
341
|
+
* ```typescript
|
|
342
|
+
* const basicLogger: Logger = {
|
|
343
|
+
* info: (msg) => console.log('\x1b[38;2;37;99;235mℹ️ ' + msg + '\x1b[0m'),
|
|
344
|
+
* success: (msg) => console.log('\x1b[38;2;22;163;74m✅ ' + msg + '\x1b[0m'),
|
|
345
|
+
* warning: (msg) => console.warn('\x1b[38;2;217;119;6m⚠️ ' + msg + '\x1b[0m'),
|
|
346
|
+
* error: (msg) => console.error('\x1b[38;2;220;38;38m❌ ' + msg + '\x1b[0m'),
|
|
347
|
+
* building: (msg) => console.log('\x1b[38;2;79;70;229m' + msg + '\x1b[0m'),
|
|
348
|
+
* processing: (msg) => console.log('\x1b[38;2;107;114;128m ' + msg + '\x1b[0m'),
|
|
349
|
+
* stats: (msg) => console.log('\x1b[38;2;8;145;178m📊 ' + msg + '\x1b[0m')
|
|
350
|
+
* };
|
|
351
|
+
* ```
|
|
352
|
+
*
|
|
353
|
+
* @example Enhanced Logger with Tree Visualization
|
|
354
|
+
* ```typescript
|
|
355
|
+
* const enhancedLogger: Logger = {
|
|
356
|
+
* // ... basic methods ...
|
|
357
|
+
* header: (msg) => console.log(boxedMessage(msg)),
|
|
358
|
+
* step: (step, total, msg) => console.log(`[${step}/${total}] ${msg}`),
|
|
359
|
+
* progress: (current, total, msg) => console.log(progressBar(current, total) + ' ' + msg),
|
|
360
|
+
* file: (op, path) => console.log(` 📄 ${op} ${path}`),
|
|
361
|
+
* url: (label, url) => console.log(` 🔗 ${label}: ${url}`),
|
|
362
|
+
* timing: (op, duration) => console.log(` ⏱️ ${op} completed in ${duration}ms`),
|
|
363
|
+
* divider: (title) => console.log('─'.repeat(50) + ' ' + title),
|
|
364
|
+
* statsTable: (stats) => displayStatsTable(stats),
|
|
365
|
+
* startRenderingTree: (label) => initTree(label),
|
|
366
|
+
* addTreeNode: (parentId, id, label, status, metadata) => addNode(parentId, id, label, status, metadata),
|
|
367
|
+
* updateTreeNode: (id, status, metadata) => updateNode(id, status, metadata),
|
|
368
|
+
* showRenderingTree: () => renderTree(),
|
|
369
|
+
* clearRenderingTree: () => clearTree()
|
|
370
|
+
* };
|
|
371
|
+
* ```
|
|
372
|
+
*/
|
|
373
|
+
export interface Logger {
|
|
374
|
+
/** Log informational messages */
|
|
375
|
+
info: (message: string) => void;
|
|
376
|
+
/** Log success messages */
|
|
377
|
+
success: (message: string) => void;
|
|
378
|
+
/** Log warning messages */
|
|
379
|
+
warning: (message: string) => void;
|
|
380
|
+
/** Log error messages */
|
|
381
|
+
error: (message: string) => void;
|
|
382
|
+
/** Log build progress messages */
|
|
383
|
+
building: (message: string) => void;
|
|
384
|
+
/** Log file processing messages */
|
|
385
|
+
processing: (message: string) => void;
|
|
386
|
+
/** Log statistics and metrics */
|
|
387
|
+
stats: (message: string) => void;
|
|
388
|
+
/** Display a header message in a box (optional) */
|
|
389
|
+
header?: (message: string) => void;
|
|
390
|
+
/** Display a step indicator (optional) */
|
|
391
|
+
step?: (step: number, total: number, message: string) => void;
|
|
392
|
+
/** Display progress with a bar (optional) */
|
|
393
|
+
progress?: (current: number, total: number, message: string) => void;
|
|
394
|
+
/** Log file operations (optional) */
|
|
395
|
+
file?: (operation: string, path: string) => void;
|
|
396
|
+
/** Log URLs with proper styling (optional) */
|
|
397
|
+
url?: (label: string, url: string) => void;
|
|
398
|
+
/** Log timing information (optional) */
|
|
399
|
+
timing?: (operation: string, duration: number) => void;
|
|
400
|
+
/** Display a section divider (optional) */
|
|
401
|
+
divider?: (title?: string) => void;
|
|
402
|
+
/** Display build statistics as a table (optional) */
|
|
403
|
+
statsTable?: (stats: {
|
|
404
|
+
totalPages: number;
|
|
405
|
+
assetsCount: number;
|
|
406
|
+
buildTimeMs: number;
|
|
407
|
+
outputSizeBytes: number;
|
|
408
|
+
cacheHits?: number;
|
|
409
|
+
cacheMisses?: number;
|
|
410
|
+
}) => void;
|
|
411
|
+
/** Display navigation tree structure (optional) */
|
|
412
|
+
navigationTree?: (navigation: NavNode[]) => void;
|
|
413
|
+
/** Initialize a rendering tree for build process visualization (optional) */
|
|
414
|
+
startRenderingTree?: (label: string) => void;
|
|
415
|
+
/** Add a step to the rendering tree (optional) */
|
|
416
|
+
addTreeNode?: (parentId: string, id: string, label: string, status?: 'pending' | 'running' | 'cached' | 'completed' | 'error', metadata?: {
|
|
417
|
+
timing?: number;
|
|
418
|
+
cacheHit?: boolean;
|
|
419
|
+
url?: string;
|
|
420
|
+
operation?: string;
|
|
421
|
+
}) => void;
|
|
422
|
+
/** Update a node in the rendering tree (optional) */
|
|
423
|
+
updateTreeNode?: (id: string, status: 'pending' | 'running' | 'cached' | 'completed' | 'error', metadata?: {
|
|
424
|
+
timing?: number;
|
|
425
|
+
cacheHit?: boolean;
|
|
426
|
+
url?: string;
|
|
427
|
+
operation?: string;
|
|
428
|
+
}) => void;
|
|
429
|
+
/** Render and display the current tree (optional) */
|
|
430
|
+
showRenderingTree?: () => void;
|
|
431
|
+
/** Clear the rendering tree (optional) */
|
|
432
|
+
clearRenderingTree?: () => void;
|
|
433
|
+
}
|
|
262
434
|
/**
|
|
263
435
|
* Statistics collected during the build process.
|
|
264
436
|
* Provides useful metrics about the site generation.
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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H,MAAM,WAAW,OAAO;IACtB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,WAAW;IAC1B,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,mCAAmC;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stati/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -27,14 +27,18 @@
|
|
|
27
27
|
"test": "vitest run"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
+
"chokidar": "^3.6.0",
|
|
30
31
|
"eta": "^3.5.0",
|
|
31
32
|
"fast-glob": "^3.3.3",
|
|
32
33
|
"fs-extra": "^11.2.0",
|
|
33
34
|
"gray-matter": "^4.0.3",
|
|
34
|
-
"markdown-it": "^14.1.0"
|
|
35
|
+
"markdown-it": "^14.1.0",
|
|
36
|
+
"open": "^10.1.0",
|
|
37
|
+
"ws": "^8.18.0"
|
|
35
38
|
},
|
|
36
39
|
"devDependencies": {
|
|
37
40
|
"@types/fs-extra": "^11.0.4",
|
|
38
|
-
"@types/markdown-it": "^14.1.2"
|
|
41
|
+
"@types/markdown-it": "^14.1.2",
|
|
42
|
+
"@types/ws": "^8.5.12"
|
|
39
43
|
}
|
|
40
44
|
}
|