@stati/core 1.20.3 → 1.21.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/core/build.d.ts.map +1 -1
- package/dist/core/build.js +43 -43
- package/dist/core/dev.d.ts.map +1 -1
- package/dist/core/dev.js +16 -11
- package/dist/core/preview.js +1 -1
- package/dist/core/utils/bundle-matching.utils.d.ts +2 -0
- package/dist/core/utils/bundle-matching.utils.d.ts.map +1 -1
- package/dist/core/utils/index.d.ts +1 -1
- package/dist/core/utils/index.d.ts.map +1 -1
- package/dist/core/utils/index.js +1 -1
- package/dist/core/utils/logger.utils.d.ts.map +1 -1
- package/dist/core/utils/logger.utils.js +1 -0
- package/dist/core/utils/typescript.utils.d.ts +4 -0
- package/dist/core/utils/typescript.utils.d.ts.map +1 -1
- package/dist/core/utils/typescript.utils.js +41 -3
- package/dist/seo/generator.d.ts.map +1 -1
- package/dist/seo/generator.js +1 -0
- package/dist/seo/utils/escape-and-validation.utils.d.ts.map +1 -1
- package/dist/seo/utils/escape-and-validation.utils.js +1 -16
- package/dist/types/logging.d.ts +31 -12
- package/dist/types/logging.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/core/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/core/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/core/build.ts"],"names":[],"mappings":"AAuDA,OAAO,KAAK,EAEV,UAAU,EACV,MAAM,EAQP,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,YAAY;IAC3B,iDAAiD;IACjD,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,iDAAiD;IACjD,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,uCAAuC;IACvC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,8BAA8B;IAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,iCAAiC;IACjC,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,wDAAwD;IACxD,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAkGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,KAAK,CAAC,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAW5E"}
|
package/dist/core/build.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ensureDir, writeFile, remove, pathExists, stat, readdir, copyFile, resolveOutDir, resolveStaticDir, resolveCacheDir, enableInventoryTracking, disableInventoryTracking, clearInventory, writeTailwindClassInventory, getInventorySize, isTailwindUsed, loadPreviousInventory, compileTypeScript, autoInjectBundles, getBundlePathsForPage, } from './utils/index.js';
|
|
1
|
+
import { ensureDir, writeFile, remove, pathExists, stat, readdir, copyFile, resolveOutDir, resolveStaticDir, resolveCacheDir, enableInventoryTracking, disableInventoryTracking, clearInventory, writeTailwindClassInventory, getInventorySize, isTailwindUsed, loadPreviousInventory, compileTypeScript, autoInjectBundles, getBundlePathsForPage, formatBytes, } from './utils/index.js';
|
|
2
2
|
import { join, dirname, relative, posix } from 'node:path';
|
|
3
3
|
import { performance } from 'node:perf_hooks';
|
|
4
4
|
import { loadConfig } from '../config/loader.js';
|
|
@@ -50,8 +50,9 @@ async function getDirectorySize(dirPath) {
|
|
|
50
50
|
*/
|
|
51
51
|
async function copyStaticAssetsWithLogging(sourceDir, destDir, logger, basePath = '') {
|
|
52
52
|
let filesCopied = 0;
|
|
53
|
+
let totalBytes = 0;
|
|
53
54
|
if (!(await pathExists(sourceDir))) {
|
|
54
|
-
return 0;
|
|
55
|
+
return { count: 0, totalBytes: 0 };
|
|
55
56
|
}
|
|
56
57
|
const items = await readdir(sourceDir, { withFileTypes: true });
|
|
57
58
|
for (const item of items) {
|
|
@@ -61,22 +62,26 @@ async function copyStaticAssetsWithLogging(sourceDir, destDir, logger, basePath
|
|
|
61
62
|
if (item.isDirectory()) {
|
|
62
63
|
// Recursively copy directories
|
|
63
64
|
await ensureDir(destPath);
|
|
64
|
-
|
|
65
|
+
const result = await copyStaticAssetsWithLogging(sourcePath, destPath, logger);
|
|
66
|
+
filesCopied += result.count;
|
|
67
|
+
totalBytes += result.totalBytes;
|
|
65
68
|
}
|
|
66
69
|
else {
|
|
67
70
|
// Copy individual files
|
|
68
71
|
await ensureDir(dirname(destPath));
|
|
69
72
|
await copyFile(sourcePath, destPath);
|
|
73
|
+
const fileStats = await stat(sourcePath);
|
|
70
74
|
if (logger.file) {
|
|
71
|
-
logger.file('copy', relativePath);
|
|
75
|
+
logger.file('copy', relativePath, fileStats.size);
|
|
72
76
|
}
|
|
73
77
|
else {
|
|
74
|
-
logger.processing(
|
|
78
|
+
logger.processing(`• ${relativePath}`);
|
|
75
79
|
}
|
|
76
80
|
filesCopied++;
|
|
81
|
+
totalBytes += fileStats.size;
|
|
77
82
|
}
|
|
78
83
|
}
|
|
79
|
-
return filesCopied;
|
|
84
|
+
return { count: filesCopied, totalBytes };
|
|
80
85
|
}
|
|
81
86
|
/**
|
|
82
87
|
* Default console logger implementation.
|
|
@@ -86,6 +91,7 @@ const defaultLogger = {
|
|
|
86
91
|
success: (message) => console.log(message),
|
|
87
92
|
warning: (message) => console.warn(message),
|
|
88
93
|
error: (message) => console.error(message),
|
|
94
|
+
status: (message) => console.log(message),
|
|
89
95
|
building: (message) => console.log(message),
|
|
90
96
|
processing: (message) => console.log(message),
|
|
91
97
|
stats: (message) => console.log(message),
|
|
@@ -169,7 +175,7 @@ async function setupCacheAndManifest(cacheDir) {
|
|
|
169
175
|
async function loadContentAndBuildNavigation(config, options, logger) {
|
|
170
176
|
// Load all content
|
|
171
177
|
const pages = await loadContent(config, options.includeDrafts);
|
|
172
|
-
logger.
|
|
178
|
+
logger.status(`Found ${pages.length} pages`);
|
|
173
179
|
// Build navigation from pages
|
|
174
180
|
if (logger.step) {
|
|
175
181
|
console.log(); // Add spacing before navigation step
|
|
@@ -203,26 +209,19 @@ async function processPagesWithCache(pages, manifest, config, outDir, md, eta, n
|
|
|
203
209
|
await config.hooks.beforeAll(buildContext);
|
|
204
210
|
endHookBeforeAll();
|
|
205
211
|
}
|
|
206
|
-
// Render each page with
|
|
212
|
+
// Render each page with progress tracking and ISG
|
|
207
213
|
if (logger.step) {
|
|
208
214
|
logger.step(2, 3, 'Rendering pages');
|
|
215
|
+
console.log(); // Add spacing after step header
|
|
209
216
|
}
|
|
210
|
-
// Initialize
|
|
211
|
-
if (logger.
|
|
212
|
-
logger.
|
|
217
|
+
// Initialize progress tracking
|
|
218
|
+
if (logger.startProgress) {
|
|
219
|
+
logger.startProgress(pages.length);
|
|
213
220
|
}
|
|
214
221
|
for (let i = 0; i < pages.length; i++) {
|
|
215
222
|
const page = pages[i];
|
|
216
223
|
if (!page)
|
|
217
224
|
continue; // Safety check
|
|
218
|
-
const pageId = `page-${i}`;
|
|
219
|
-
// Add page to rendering tree
|
|
220
|
-
if (logger.addTreeNode) {
|
|
221
|
-
logger.addTreeNode('root', pageId, page.url, 'running', { url: page.url });
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
logger.processing(`Checking ${page.url}`);
|
|
225
|
-
}
|
|
226
225
|
// Determine output path
|
|
227
226
|
let outputPath;
|
|
228
227
|
if (page.url === '/') {
|
|
@@ -243,11 +242,8 @@ async function processPagesWithCache(pages, manifest, config, outDir, md, eta, n
|
|
|
243
242
|
if (!shouldRebuild) {
|
|
244
243
|
// Cache hit - skip rendering
|
|
245
244
|
cacheHits++;
|
|
246
|
-
if (logger.
|
|
247
|
-
logger.
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
logger.processing(`📋 Cached ${page.url}`);
|
|
245
|
+
if (logger.updateProgress) {
|
|
246
|
+
logger.updateProgress('cached', page.url);
|
|
251
247
|
}
|
|
252
248
|
// Record page timing for cached pages (0ms render time)
|
|
253
249
|
recorder.recordPageTiming(page.url, 0, true);
|
|
@@ -313,11 +309,8 @@ async function processPagesWithCache(pages, manifest, config, outDir, md, eta, n
|
|
|
313
309
|
const renderTime = Math.round(performance.now() - startTime);
|
|
314
310
|
// Record page timing for rendered pages (includes template count)
|
|
315
311
|
recorder.recordPageTiming(page.url, renderTime, false, renderResult.templatesLoaded);
|
|
316
|
-
if (logger.
|
|
317
|
-
logger.
|
|
318
|
-
timing: renderTime,
|
|
319
|
-
url: page.url,
|
|
320
|
-
});
|
|
312
|
+
if (logger.updateProgress) {
|
|
313
|
+
logger.updateProgress('rendered', page.url, renderTime);
|
|
321
314
|
}
|
|
322
315
|
// Ensure directory exists and write file
|
|
323
316
|
await ensureDir(dirname(outputPath));
|
|
@@ -341,11 +334,11 @@ async function processPagesWithCache(pages, manifest, config, outDir, md, eta, n
|
|
|
341
334
|
recorder.addToPhase('hookAfterRenderTotalMs', performance.now() - hookStart);
|
|
342
335
|
}
|
|
343
336
|
}
|
|
344
|
-
// Display final
|
|
345
|
-
if (logger.
|
|
346
|
-
logger.
|
|
347
|
-
if (logger.
|
|
348
|
-
logger.
|
|
337
|
+
// Display final progress summary
|
|
338
|
+
if (logger.endProgress) {
|
|
339
|
+
logger.endProgress();
|
|
340
|
+
if (logger.showRenderingSummary) {
|
|
341
|
+
logger.showRenderingSummary();
|
|
349
342
|
}
|
|
350
343
|
}
|
|
351
344
|
return { cacheHits, cacheMisses, searchablePages };
|
|
@@ -363,8 +356,14 @@ async function copyStaticAssets(config, outDir, logger) {
|
|
|
363
356
|
logger.step(3, 3, 'Copying static assets');
|
|
364
357
|
}
|
|
365
358
|
logger.info(`Copying static assets from ${config.staticDir}`);
|
|
366
|
-
const assetsCount = await copyStaticAssetsWithLogging(staticDir, outDir, logger);
|
|
367
|
-
|
|
359
|
+
const { count: assetsCount, totalBytes } = await copyStaticAssetsWithLogging(staticDir, outDir, logger);
|
|
360
|
+
if (assetsCount > 0) {
|
|
361
|
+
const totalSizeStr = formatBytes(totalBytes);
|
|
362
|
+
logger.success(`Copied ${assetsCount} static assets (${totalSizeStr})`);
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
logger.info(`Copied 0 static assets`);
|
|
366
|
+
}
|
|
368
367
|
return assetsCount;
|
|
369
368
|
}
|
|
370
369
|
/**
|
|
@@ -412,7 +411,7 @@ async function buildInternal(options = {}) {
|
|
|
412
411
|
cliVersion: options.cliVersion,
|
|
413
412
|
coreVersion: options.coreVersion,
|
|
414
413
|
});
|
|
415
|
-
logger.
|
|
414
|
+
logger.status('Started building your site...');
|
|
416
415
|
// Load configuration (instrumented)
|
|
417
416
|
const endConfigSpan = recorder.startSpan('configLoadMs');
|
|
418
417
|
const { config, outDir, cacheDir } = await loadAndValidateConfig(options);
|
|
@@ -422,7 +421,7 @@ async function buildInternal(options = {}) {
|
|
|
422
421
|
let cacheMisses = 0;
|
|
423
422
|
// Clean output directory and cache if requested
|
|
424
423
|
if (options.clean) {
|
|
425
|
-
logger.
|
|
424
|
+
logger.status('Cleaning output directory and ISG cache...');
|
|
426
425
|
await remove(outDir);
|
|
427
426
|
await remove(cacheDir);
|
|
428
427
|
}
|
|
@@ -438,14 +437,14 @@ async function buildInternal(options = {}) {
|
|
|
438
437
|
// Write the initial inventory file immediately so Tailwind can scan it
|
|
439
438
|
// This is critical for dev server where Tailwind starts watching before template rendering
|
|
440
439
|
await writeTailwindClassInventory(cacheDir);
|
|
441
|
-
logger.
|
|
440
|
+
logger.status(`Loaded ${loadedCount} classes from previous build for Tailwind scanner`);
|
|
442
441
|
}
|
|
443
442
|
else {
|
|
444
443
|
// No previous inventory found - write an empty placeholder file
|
|
445
444
|
// This ensures Tailwind has a file to scan even on first build
|
|
446
445
|
// It will be populated with actual classes after template rendering
|
|
447
446
|
await writeTailwindClassInventory(cacheDir);
|
|
448
|
-
logger.
|
|
447
|
+
logger.status(`Created inventory file for Tailwind scanner (will be populated after rendering)`);
|
|
449
448
|
}
|
|
450
449
|
}
|
|
451
450
|
// Load cache manifest for ISG (after potential clean operation)
|
|
@@ -516,7 +515,7 @@ async function buildInternal(options = {}) {
|
|
|
516
515
|
if (inventorySize > 0) {
|
|
517
516
|
await writeTailwindClassInventory(cacheDir);
|
|
518
517
|
logger.info('');
|
|
519
|
-
logger.
|
|
518
|
+
logger.status(`Generated Tailwind class inventory (${inventorySize} classes tracked)`);
|
|
520
519
|
}
|
|
521
520
|
// Disable inventory tracking after build
|
|
522
521
|
disableInventoryTracking();
|
|
@@ -551,7 +550,7 @@ async function buildInternal(options = {}) {
|
|
|
551
550
|
logger.success(`Generated sitemap index with ${sitemapResult.sitemaps.length} sitemaps (${sitemapResult.entryCount} entries)`);
|
|
552
551
|
}
|
|
553
552
|
else {
|
|
554
|
-
logger.success(`Generated sitemap with ${sitemapResult.entryCount} entries`);
|
|
553
|
+
logger.success(`Generated sitemap.xml with ${sitemapResult.entryCount} entries (${(sitemapResult.sizeInBytes / 1024).toFixed(2)} KB)`);
|
|
555
554
|
}
|
|
556
555
|
}
|
|
557
556
|
// Generate robots.txt if enabled (only in production mode)
|
|
@@ -562,7 +561,8 @@ async function buildInternal(options = {}) {
|
|
|
562
561
|
logger.info('Generating robots.txt...');
|
|
563
562
|
const robotsContent = generateRobotsTxtFromConfig(config.robots, config.site.baseUrl);
|
|
564
563
|
await writeFile(join(outDir, 'robots.txt'), robotsContent);
|
|
565
|
-
|
|
564
|
+
const robotsSizeBytes = Buffer.byteLength(robotsContent, 'utf8');
|
|
565
|
+
logger.success(`Generated robots.txt (${robotsSizeBytes} bytes)`);
|
|
566
566
|
}
|
|
567
567
|
// Generate RSS feeds if enabled (only in production mode)
|
|
568
568
|
if (config.rss?.enabled && currentEnv === 'production') {
|
package/dist/core/dev.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/core/dev.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAe,MAAM,EAAE,MAAM,mBAAmB,CAAC;AA6B7D,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;CACb;
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/core/dev.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAe,MAAM,EAAE,MAAM,mBAAmB,CAAC;AA6B7D,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;CACb;AAwXD,wBAAsB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC,CAoexF"}
|
package/dist/core/dev.js
CHANGED
|
@@ -38,7 +38,7 @@ async function loadDevConfig(configPath, logger) {
|
|
|
38
38
|
async function performInitialBuild(configPath, logger, onError) {
|
|
39
39
|
try {
|
|
40
40
|
// Clear cache to ensure fresh build on dev server start
|
|
41
|
-
logger.
|
|
41
|
+
logger.status('Clearing cache for fresh development build...');
|
|
42
42
|
await invalidate();
|
|
43
43
|
await build({
|
|
44
44
|
logger,
|
|
@@ -93,6 +93,7 @@ async function performIncrementalRebuild(changedPath, eventType, configPath, sta
|
|
|
93
93
|
success: () => { }, // Suppress success messages
|
|
94
94
|
error: logger.error || (() => { }),
|
|
95
95
|
warning: logger.warning || (() => { }),
|
|
96
|
+
status: () => { }, // Suppress status messages
|
|
96
97
|
building: () => { }, // Suppress building messages
|
|
97
98
|
processing: () => { }, // Suppress processing messages
|
|
98
99
|
stats: () => { }, // Suppress stats messages
|
|
@@ -150,14 +151,14 @@ async function performIncrementalRebuild(changedPath, eventType, configPath, sta
|
|
|
150
151
|
else {
|
|
151
152
|
action = 'rebuilt';
|
|
152
153
|
}
|
|
153
|
-
logger.info?.(
|
|
154
|
+
logger.info?.(`▸ ${relativePath} ${action}`);
|
|
154
155
|
}
|
|
155
156
|
logger.info?.(` Done in ${duration}ms`);
|
|
156
157
|
}
|
|
157
158
|
catch (error) {
|
|
158
159
|
const buildError = error instanceof Error ? error : new Error(String(error));
|
|
159
160
|
const duration = Date.now() - startTime;
|
|
160
|
-
logger.error?.(
|
|
161
|
+
logger.error?.(`× Rebuild failed after ${duration}ms: ${buildError.message}`);
|
|
161
162
|
// Store the error for display in browser
|
|
162
163
|
if (onError) {
|
|
163
164
|
onError(buildError);
|
|
@@ -286,7 +287,7 @@ async function handleMarkdownChange(_markdownPath, configPath, logger) {
|
|
|
286
287
|
// Compare navigation hashes
|
|
287
288
|
if (newNavigationHash !== cacheManifest.navigationHash) {
|
|
288
289
|
// Navigation structure changed - clear cache and force full rebuild
|
|
289
|
-
logger.
|
|
290
|
+
logger.status('Navigation structure changed, performing full rebuild...');
|
|
290
291
|
// Force rebuild bypasses ISG cache entirely
|
|
291
292
|
await build({
|
|
292
293
|
logger,
|
|
@@ -386,7 +387,7 @@ export async function createDevServer(options = {}) {
|
|
|
386
387
|
ws.onmessage = function(event) {
|
|
387
388
|
const data = JSON.parse(event.data);
|
|
388
389
|
if (data.type === 'reload') {
|
|
389
|
-
console.log('
|
|
390
|
+
console.log('▸ Reloading page due to file changes...');
|
|
390
391
|
window.location.reload();
|
|
391
392
|
}
|
|
392
393
|
};
|
|
@@ -540,7 +541,11 @@ export async function createDevServer(options = {}) {
|
|
|
540
541
|
if (requestPath === '/__ws') {
|
|
541
542
|
return; // Let WebSocket server handle this
|
|
542
543
|
}
|
|
543
|
-
|
|
544
|
+
// Only log page requests, not static assets (files with extensions)
|
|
545
|
+
const hasFileExtension = requestPath.includes('.') && !requestPath.endsWith('.html');
|
|
546
|
+
if (!hasFileExtension) {
|
|
547
|
+
logger.processing?.(`${req.method} ${requestPath}`);
|
|
548
|
+
}
|
|
544
549
|
try {
|
|
545
550
|
const { content, mimeType, statusCode } = await serveFile(requestPath);
|
|
546
551
|
res.writeHead(statusCode, {
|
|
@@ -595,7 +600,7 @@ export async function createDevServer(options = {}) {
|
|
|
595
600
|
outDir: config.outDir || DEFAULT_OUT_DIR,
|
|
596
601
|
logger,
|
|
597
602
|
onRebuild: (_results, compileTimeMs) => {
|
|
598
|
-
logger.info?.(
|
|
603
|
+
logger.info?.(`▸ TypeScript recompiled in ${compileTimeMs}ms`);
|
|
599
604
|
// Broadcast reload to WebSocket clients
|
|
600
605
|
if (wsServer) {
|
|
601
606
|
wsServer.clients.forEach((client) => {
|
|
@@ -615,7 +620,7 @@ export async function createDevServer(options = {}) {
|
|
|
615
620
|
console.log();
|
|
616
621
|
logger.error?.(`TypeScript setup failed: ${tsError.message}`);
|
|
617
622
|
logger.warning?.('──────────────────────────────────────────────────────────────');
|
|
618
|
-
logger.warning?.('
|
|
623
|
+
logger.warning?.('! TypeScript hot reload is DISABLED for this session.');
|
|
619
624
|
logger.warning?.(" Dev server will continue, but TypeScript changes won't auto-reload.");
|
|
620
625
|
logger.warning?.(' Fix your TypeScript configuration and restart the dev server.');
|
|
621
626
|
logger.warning?.('──────────────────────────────────────────────────────────────');
|
|
@@ -638,7 +643,7 @@ export async function createDevServer(options = {}) {
|
|
|
638
643
|
});
|
|
639
644
|
cssWatcher.on('change', (path) => {
|
|
640
645
|
const relativePath = path.replace(process.cwd(), '').replace(/\\/g, '/').replace(/^\//, '');
|
|
641
|
-
logger.info?.(
|
|
646
|
+
logger.info?.(`▸ ${relativePath} updated`);
|
|
642
647
|
// Just notify clients to reload - no rebuild needed since CSS was already compiled
|
|
643
648
|
if (wsServer) {
|
|
644
649
|
wsServer.clients.forEach((client) => {
|
|
@@ -660,9 +665,9 @@ export async function createDevServer(options = {}) {
|
|
|
660
665
|
});
|
|
661
666
|
logger.success?.(`Dev server running at ${url}`);
|
|
662
667
|
logger.info?.(`\nServing:`);
|
|
663
|
-
logger.info?.(`
|
|
668
|
+
logger.info?.(` • ${outDir}`);
|
|
664
669
|
logger.info?.('Watching:');
|
|
665
|
-
watchPaths.forEach((path) => logger.info?.(`
|
|
670
|
+
watchPaths.forEach((path) => logger.info?.(` • ${path}`));
|
|
666
671
|
logger.info?.('');
|
|
667
672
|
// Open browser if requested
|
|
668
673
|
if (open) {
|
package/dist/core/preview.js
CHANGED
|
@@ -141,7 +141,7 @@ export async function createPreviewServer(options = {}) {
|
|
|
141
141
|
});
|
|
142
142
|
logger.success?.(`Preview server running at ${url}`);
|
|
143
143
|
logger.info?.(`\nServing:`);
|
|
144
|
-
logger.info?.(`
|
|
144
|
+
logger.info?.(` • ${outDir}`);
|
|
145
145
|
// Open browser if requested
|
|
146
146
|
if (open) {
|
|
147
147
|
try {
|
|
@@ -42,6 +42,8 @@ export interface CompiledBundleInfo {
|
|
|
42
42
|
filename: string;
|
|
43
43
|
/** The full path to the bundle (e.g., '/_assets/core-a1b2c3d4.js') */
|
|
44
44
|
path: string;
|
|
45
|
+
/** The size of the compiled bundle in bytes */
|
|
46
|
+
sizeInBytes?: number;
|
|
45
47
|
}
|
|
46
48
|
/**
|
|
47
49
|
* Determines which bundles should be included on a specific page.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-matching.utils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/bundle-matching.utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1D;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,UAAU,EAAE,MAAM,EAAE;CAOjC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,IAAI,CAqBvE;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,wCAAwC;IACxC,MAAM,EAAE,YAAY,CAAC;IACrB,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"bundle-matching.utils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/bundle-matching.utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1D;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,UAAU,EAAE,MAAM,EAAE;CAOjC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,IAAI,CAqBvE;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,wCAAwC;IACxC,MAAM,EAAE,YAAY,CAAC;IACrB,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,YAAY,EAAE,GACtB,YAAY,EAAE,CAyBhB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,kBAAkB,EAAE,GACpC,MAAM,EAAE,CAaV"}
|
|
@@ -22,7 +22,7 @@ export { globToRegex, matchesGlob } from './glob-patterns.utils.js';
|
|
|
22
22
|
export { matchBundlesForPage, getBundlePathsForPage, validateUniqueBundleNames, DuplicateBundleNameError, } from './bundle-matching.utils.js';
|
|
23
23
|
export type { CompiledBundleInfo } from './bundle-matching.utils.js';
|
|
24
24
|
export { createFallbackLogger } from './logger.utils.js';
|
|
25
|
-
export { compileTypeScript, createTypeScriptWatcher, compileStatiConfig, cleanupCompiledConfig, autoInjectBundles, } from './typescript.utils.js';
|
|
25
|
+
export { compileTypeScript, createTypeScriptWatcher, compileStatiConfig, cleanupCompiledConfig, autoInjectBundles, formatBytes, } from './typescript.utils.js';
|
|
26
26
|
export type { CompileOptions, WatchOptions } from './typescript.utils.js';
|
|
27
27
|
export { findHeadClosePosition, injectBeforeHeadClose } from './html.utils.js';
|
|
28
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","source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AAM,0BAA0B,CAAC;AACjF,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGpE,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,QAAQ,EACR,SAAS,EACT,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAI,GACL,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,EAC3B,cAAc,EACd,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,+BAA+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validateUniqueBundleNames,
|
|
|
35
35
|
// Logger utilities
|
|
36
36
|
export { createFallbackLogger } from './logger.utils.js';
|
|
37
37
|
// TypeScript compilation utilities
|
|
38
|
-
export { compileTypeScript, createTypeScriptWatcher, compileStatiConfig, cleanupCompiledConfig, autoInjectBundles, } from './typescript.utils.js';
|
|
38
|
+
export { compileTypeScript, createTypeScriptWatcher, compileStatiConfig, cleanupCompiledConfig, autoInjectBundles, formatBytes, } from './typescript.utils.js';
|
|
39
39
|
// HTML manipulation utilities
|
|
40
40
|
export { findHeadClosePosition, injectBeforeHeadClose } from './html.utils.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.utils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/logger.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"logger.utils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/logger.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAa7C"}
|
|
@@ -11,6 +11,7 @@ export function createFallbackLogger() {
|
|
|
11
11
|
success: (msg) => console.log(msg),
|
|
12
12
|
error: (msg) => console.error(msg),
|
|
13
13
|
warning: (msg) => console.warn(msg),
|
|
14
|
+
status: (msg) => console.log(msg),
|
|
14
15
|
building: (msg) => console.log(msg),
|
|
15
16
|
processing: (msg) => console.log(msg),
|
|
16
17
|
stats: (msg) => console.log(msg),
|
|
@@ -8,6 +8,10 @@ import * as esbuild from 'esbuild';
|
|
|
8
8
|
import { type CompiledBundleInfo } from './bundle-matching.utils.js';
|
|
9
9
|
import type { TypeScriptConfig } from '../../types/config.js';
|
|
10
10
|
import type { Logger } from '../../types/logging.js';
|
|
11
|
+
/**
|
|
12
|
+
* Formats bytes into a human-readable string.
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatBytes(bytes: number): string;
|
|
11
15
|
/**
|
|
12
16
|
* Options for TypeScript compilation.
|
|
13
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.utils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/typescript.utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAInC,OAAO,EAA6B,KAAK,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,KAAK,EAAE,gBAAgB,EAAgB,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAQrD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,MAAM,EAAE,gBAAgB,CAAC;IACzB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,IAAI,EAAE,aAAa,GAAG,YAAY,CAAC;IACnC,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,MAAM,EAAE,gBAAgB,CAAC;IACzB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,0FAA0F;IAC1F,SAAS,EAAE,CAAC,OAAO,EAAE,kBAAkB,EAAE,EAAE,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3E;
|
|
1
|
+
{"version":3,"file":"typescript.utils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/typescript.utils.ts"],"names":[],"mappings":"AA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AaG;AACH,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAgB5E;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM/E;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAqC7D;AAiBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,CA8B7E"}
|
|
@@ -10,6 +10,20 @@ import * as fs from 'node:fs/promises';
|
|
|
10
10
|
import { pathExists } from './fs.utils.js';
|
|
11
11
|
import { validateUniqueBundleNames } from './bundle-matching.utils.js';
|
|
12
12
|
import { DEFAULT_TS_SRC_DIR, DEFAULT_TS_OUT_DIR, DEFAULT_BUNDLES, DEFAULT_OUT_DIR, } from '../../constants.js';
|
|
13
|
+
/**
|
|
14
|
+
* Formats bytes into a human-readable string.
|
|
15
|
+
*/
|
|
16
|
+
export function formatBytes(bytes) {
|
|
17
|
+
if (bytes < 1024) {
|
|
18
|
+
return `${bytes} B`;
|
|
19
|
+
}
|
|
20
|
+
else if (bytes < 1024 * 1024) {
|
|
21
|
+
return `${(bytes / 1024).toFixed(2)} KB`;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
13
27
|
/**
|
|
14
28
|
* Resolves TypeScript config with defaults based on mode.
|
|
15
29
|
* @internal
|
|
@@ -60,13 +74,19 @@ async function compileSingleBundle(bundleConfig, resolvedConfig, projectRoot, gl
|
|
|
60
74
|
const outputs = Object.keys(result.metafile?.outputs ?? {});
|
|
61
75
|
const bundleFile = outputs.find((f) => f.endsWith('.js'));
|
|
62
76
|
const bundleFilename = bundleFile ? path.basename(bundleFile) : `${bundleConfig.bundleName}.js`;
|
|
77
|
+
// Get the bundle size from metafile
|
|
78
|
+
const bundleSize = bundleFile ? result.metafile?.outputs[bundleFile]?.bytes : undefined;
|
|
63
79
|
// Construct the path relative to site root
|
|
64
80
|
const bundlePath = path.posix.join('/', resolvedConfig.outDir, bundleFilename);
|
|
65
|
-
|
|
81
|
+
const bundleInfo = {
|
|
66
82
|
config: bundleConfig,
|
|
67
83
|
filename: bundleFilename,
|
|
68
84
|
path: bundlePath,
|
|
69
85
|
};
|
|
86
|
+
if (bundleSize !== undefined) {
|
|
87
|
+
bundleInfo.sizeInBytes = bundleSize;
|
|
88
|
+
}
|
|
89
|
+
return bundleInfo;
|
|
70
90
|
}
|
|
71
91
|
catch (error) {
|
|
72
92
|
if (error instanceof Error) {
|
|
@@ -118,8 +138,16 @@ export async function compileTypeScript(options) {
|
|
|
118
138
|
// Filter out null results (skipped bundles) and collect successful ones
|
|
119
139
|
const successfulResults = results.filter((r) => r !== null);
|
|
120
140
|
if (successfulResults.length > 0) {
|
|
121
|
-
|
|
122
|
-
|
|
141
|
+
// Log each bundle on its own line
|
|
142
|
+
for (const r of successfulResults) {
|
|
143
|
+
if (logger.file) {
|
|
144
|
+
logger.file('compiled', r.filename, r.sizeInBytes);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// Calculate and display total
|
|
148
|
+
const totalBytes = successfulResults.reduce((sum, r) => sum + (r.sizeInBytes ?? 0), 0);
|
|
149
|
+
const totalSuffix = totalBytes > 0 ? ` (${formatBytes(totalBytes)} total)` : '';
|
|
150
|
+
logger.success(`Compiled ${successfulResults.length} TypeScript bundle${successfulResults.length > 1 ? 's' : ''}${totalSuffix}`);
|
|
123
151
|
}
|
|
124
152
|
else if (resolved.bundles.length > 0) {
|
|
125
153
|
logger.warning('No TypeScript bundles were compiled (all entry points missing).');
|
|
@@ -161,6 +189,10 @@ export async function createTypeScriptWatcher(options) {
|
|
|
161
189
|
logger.warning(`TypeScript entry point not found: ${entryPath} (bundle: ${bundleConfig.bundleName})`);
|
|
162
190
|
continue;
|
|
163
191
|
}
|
|
192
|
+
// Track whether this is the initial build triggered by context.watch()
|
|
193
|
+
// We skip notifications for the initial build since files were just compiled
|
|
194
|
+
// by compileTypeScript() during the initial build phase
|
|
195
|
+
let isInitialBuild = true;
|
|
164
196
|
const context = await esbuild.context({
|
|
165
197
|
entryPoints: [entryPath],
|
|
166
198
|
bundle: true,
|
|
@@ -202,6 +234,12 @@ export async function createTypeScriptWatcher(options) {
|
|
|
202
234
|
path: bundlePath,
|
|
203
235
|
};
|
|
204
236
|
latestResults.set(bundleConfig.bundleName, bundleResult);
|
|
237
|
+
// Skip notifications for the initial build triggered by context.watch()
|
|
238
|
+
// since files were already compiled during performInitialBuild()
|
|
239
|
+
if (isInitialBuild) {
|
|
240
|
+
isInitialBuild = false;
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
205
243
|
logger.info(`TypeScript '${bundleConfig.bundleName}' recompiled.`);
|
|
206
244
|
// Notify with all current results and compile time
|
|
207
245
|
onRebuild(Array.from(latestResults.values()), compileTime);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/seo/generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAS7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAsH3D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,EAAE,CAyE/D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,EAAE,CAuDjE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE;IACP,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,EACD,IAAI,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,GAChC,MAAM,
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/seo/generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAS7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAsH3D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,EAAE,CAyE/D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,EAAE,CAuDjE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE;IACP,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,EACD,IAAI,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,GAChC,MAAM,CA8CR"}
|
package/dist/seo/generator.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escape-and-validation.utils.d.ts","sourceRoot":"","sources":["../../../src/seo/utils/escape-and-validation.utils.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"escape-and-validation.utils.d.ts","sourceRoot":"","sources":["../../../src/seo/utils/escape-and-validation.utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,wBAAwB,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAUrD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA4B/C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAU,EACjB,QAAQ,GAAE,MAAW,GACpB,OAAO,CA0CT;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,CAiD9D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAwE3F;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,UAAU,CAAC,CAuCnE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SEO utility functions for HTML escaping, validation, and tag detection
|
|
3
3
|
*/
|
|
4
|
-
import { URL } from 'node:url';
|
|
5
4
|
import { SEOTagType as SEOTagTypeEnum } from '../../types/seo.js';
|
|
5
|
+
import { isValidUrl } from './url.utils.js';
|
|
6
6
|
/**
|
|
7
7
|
* HTML escape cache for performance optimization.
|
|
8
8
|
* Stores up to 1000 frequently used strings to avoid repeated escaping.
|
|
@@ -171,21 +171,6 @@ export function generateRobotsContent(seo) {
|
|
|
171
171
|
}
|
|
172
172
|
return directives.length > 0 ? directives.join(', ') : '';
|
|
173
173
|
}
|
|
174
|
-
/**
|
|
175
|
-
* Validate URL format (http or https only).
|
|
176
|
-
*
|
|
177
|
-
* @param url - The URL to validate
|
|
178
|
-
* @returns True if the URL is valid
|
|
179
|
-
*/
|
|
180
|
-
function isValidUrl(url) {
|
|
181
|
-
try {
|
|
182
|
-
const parsed = new URL(url);
|
|
183
|
-
return parsed.protocol === 'http:' || parsed.protocol === 'https:';
|
|
184
|
-
}
|
|
185
|
-
catch {
|
|
186
|
-
return false;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
174
|
/**
|
|
190
175
|
* Validate SEO metadata before processing.
|
|
191
176
|
* Checks for common issues like invalid URLs, improper lengths, and malformed data.
|
package/dist/types/logging.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* file operations, statistics display, and advanced tree-based rendering visualization.
|
|
8
8
|
*
|
|
9
9
|
* Core Methods (Required):
|
|
10
|
-
* - Basic logging: info, success, warning, error
|
|
10
|
+
* - Basic logging: info, success, warning, error, status
|
|
11
11
|
* - Build progress: building, processing, stats
|
|
12
12
|
*
|
|
13
13
|
* Enhanced Methods (Optional):
|
|
@@ -19,13 +19,14 @@
|
|
|
19
19
|
* @example Basic Logger Implementation
|
|
20
20
|
* ```typescript
|
|
21
21
|
* const basicLogger: Logger = {
|
|
22
|
-
* info: (msg) => console.log('\x1b[38;2;
|
|
23
|
-
* success: (msg) => console.log('\x1b[38;2;
|
|
24
|
-
* warning: (msg) => console.warn('\x1b[38;2;
|
|
25
|
-
* error: (msg) => console.error('\x1b[38;2;
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
22
|
+
* info: (msg) => console.log('\x1b[38;2;56;189;248m• ' + msg + '\x1b[0m'),
|
|
23
|
+
* success: (msg) => console.log('\x1b[38;2;34;197;94m✓ ' + msg + '\x1b[0m'),
|
|
24
|
+
* warning: (msg) => console.warn('\x1b[38;2;245;158;11m! ' + msg + '\x1b[0m'),
|
|
25
|
+
* error: (msg) => console.error('\x1b[38;2;239;68;68m× ' + msg + '\x1b[0m'),
|
|
26
|
+
* status: (msg) => console.log('\x1b[38;2;56;189;248m▸ ' + msg + '\x1b[0m'),
|
|
27
|
+
* building: (msg) => console.log('\x1b[38;2;56;189;248m' + msg + '\x1b[0m'),
|
|
28
|
+
* processing: (msg) => console.log('\x1b[38;2;148;163;184m ' + msg + '\x1b[0m'),
|
|
29
|
+
* stats: (msg) => console.log('\x1b[38;2;186;230;253m• ' + msg + '\x1b[0m')
|
|
29
30
|
* };
|
|
30
31
|
* ```
|
|
31
32
|
*
|
|
@@ -36,9 +37,9 @@
|
|
|
36
37
|
* header: (msg) => console.log(boxedMessage(msg)),
|
|
37
38
|
* step: (step, total, msg) => console.log(`[${step}/${total}] ${msg}`),
|
|
38
39
|
* progress: (current, total, msg) => console.log(progressBar(current, total) + ' ' + msg),
|
|
39
|
-
* file: (op, path) => console.log(`
|
|
40
|
-
* url: (label, url) => console.log(`
|
|
41
|
-
* timing: (op, duration) => console.log(`
|
|
40
|
+
* file: (op, path) => console.log(` + ${op} ${path}`),
|
|
41
|
+
* url: (label, url) => console.log(` ${label}: ${url}`),
|
|
42
|
+
* timing: (op, duration) => console.log(` ${op} completed in ${duration}ms`),
|
|
42
43
|
* divider: (title) => console.log('─'.repeat(50) + ' ' + title),
|
|
43
44
|
* statsTable: (stats) => displayStatsTable(stats),
|
|
44
45
|
* startRenderingTree: (label) => initTree(label),
|
|
@@ -58,6 +59,8 @@ export interface Logger {
|
|
|
58
59
|
warning: (message: string) => void;
|
|
59
60
|
/** Log error messages */
|
|
60
61
|
error: (message: string) => void;
|
|
62
|
+
/** Log status/meta messages with status indicator */
|
|
63
|
+
status: (message: string) => void;
|
|
61
64
|
/** Log build progress messages */
|
|
62
65
|
building: (message: string) => void;
|
|
63
66
|
/** Log file processing messages */
|
|
@@ -71,7 +74,7 @@ export interface Logger {
|
|
|
71
74
|
/** Display progress with a bar (optional) */
|
|
72
75
|
progress?: (current: number, total: number, message: string) => void;
|
|
73
76
|
/** Log file operations (optional) */
|
|
74
|
-
file?: (operation: string, path: string) => void;
|
|
77
|
+
file?: (operation: string, path: string, sizeInBytes?: number) => void;
|
|
75
78
|
/** Log URLs with proper styling (optional) */
|
|
76
79
|
url?: (label: string, url: string) => void;
|
|
77
80
|
/** Log timing information (optional) */
|
|
@@ -109,5 +112,21 @@ export interface Logger {
|
|
|
109
112
|
showRenderingTree?: () => void;
|
|
110
113
|
/** Clear the rendering tree (optional) */
|
|
111
114
|
clearRenderingTree?: () => void;
|
|
115
|
+
/** Initialize progress tracking for page rendering (optional) */
|
|
116
|
+
startProgress?: (totalPages: number) => void;
|
|
117
|
+
/**
|
|
118
|
+
* Update progress during page rendering (optional)
|
|
119
|
+
* @param status - 'cached' | 'rendered' | 'error'
|
|
120
|
+
* @param url - The URL of the page being processed
|
|
121
|
+
* @param timing - Render time in milliseconds (for rendered pages)
|
|
122
|
+
*/
|
|
123
|
+
updateProgress?: (status: 'cached' | 'rendered' | 'error', url: string, timing?: number) => void;
|
|
124
|
+
/** End progress tracking and prepare for summary (optional) */
|
|
125
|
+
endProgress?: () => void;
|
|
126
|
+
/**
|
|
127
|
+
* Display a summary of the rendering process (optional)
|
|
128
|
+
* Shows cached/rendered counts, slowest pages, and cache hit rate
|
|
129
|
+
*/
|
|
130
|
+
showRenderingSummary?: () => void;
|
|
112
131
|
}
|
|
113
132
|
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/types/logging.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH
|
|
1
|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