@stati/core 1.12.1 → 1.12.2

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.
@@ -164,8 +164,8 @@ async function loadContentAndBuildNavigation(config, options, logger) {
164
164
  const pages = await loadContent(config, options.includeDrafts);
165
165
  logger.info(`📄 Found ${pages.length} pages`);
166
166
  // Build navigation from pages
167
- console.log(); // Add spacing before navigation step
168
167
  if (logger.step) {
168
+ console.log(); // Add spacing before navigation step
169
169
  logger.step(1, 3, 'Building navigation');
170
170
  }
171
171
  const navigation = buildNavigation(pages);
@@ -316,8 +316,8 @@ async function copyStaticAssets(config, outDir, logger) {
316
316
  if (!(await pathExists(staticDir))) {
317
317
  return 0;
318
318
  }
319
- console.log(); // Add spacing before asset copying
320
319
  if (logger.step) {
320
+ console.log(); // Add spacing before asset copying
321
321
  logger.step(3, 3, 'Copying static assets');
322
322
  }
323
323
  logger.info(`Copying static assets from ${config.staticDir}`);
@@ -390,12 +390,16 @@ async function buildInternal(options = {}) {
390
390
  // Load cache manifest for ISG (after potential clean operation)
391
391
  const { manifest } = await setupCacheAndManifest(cacheDir);
392
392
  // Load content and build navigation
393
- console.log(); // Add spacing before content loading
393
+ if (logger.step) {
394
+ console.log(); // Add spacing before content loading
395
+ }
394
396
  const { pages, navigation, md, eta, navigationHash } = await loadContentAndBuildNavigation(config, options, logger);
395
397
  // Store navigation hash in manifest for change detection in dev server
396
398
  manifest.navigationHash = navigationHash;
397
399
  // Process pages with ISG caching logic
398
- console.log(); // Add spacing before page processing
400
+ if (logger.step) {
401
+ console.log(); // Add spacing before page processing
402
+ }
399
403
  const buildTime = new Date();
400
404
  const pageProcessingResult = await processPagesWithCache(pages, manifest, config, outDir, md, eta, navigation, buildTime, options, logger);
401
405
  cacheHits = pageProcessingResult.cacheHits;
@@ -419,7 +423,9 @@ async function buildInternal(options = {}) {
419
423
  const currentEnv = getEnv();
420
424
  // Generate sitemap if enabled (only in production mode)
421
425
  if (config.sitemap?.enabled && currentEnv === 'production') {
422
- console.log(); // Add spacing before sitemap generation
426
+ if (logger.step) {
427
+ console.log(); // Add spacing before sitemap generation
428
+ }
423
429
  logger.info('Generating sitemap...');
424
430
  const sitemapResult = generateSitemap(pages, config, config.sitemap);
425
431
  await writeFile(join(outDir, 'sitemap.xml'), sitemapResult.xml);
@@ -436,7 +442,9 @@ async function buildInternal(options = {}) {
436
442
  }
437
443
  // Generate robots.txt if enabled (only in production mode)
438
444
  if (config.robots?.enabled && currentEnv === 'production') {
439
- console.log(); // Add spacing before robots.txt generation
445
+ if (logger.step) {
446
+ console.log(); // Add spacing before robots.txt generation
447
+ }
440
448
  logger.info('Generating robots.txt...');
441
449
  const robotsContent = generateRobotsTxtFromConfig(config.robots, config.site.baseUrl);
442
450
  await writeFile(join(outDir, 'robots.txt'), robotsContent);
@@ -444,7 +452,9 @@ async function buildInternal(options = {}) {
444
452
  }
445
453
  // Generate RSS feeds if enabled (only in production mode)
446
454
  if (config.rss?.enabled && currentEnv === 'production') {
447
- console.log(); // Add spacing before RSS generation
455
+ if (logger.step) {
456
+ console.log(); // Add spacing before RSS generation
457
+ }
448
458
  logger.info('Generating RSS feeds...');
449
459
  try {
450
460
  // Validate RSS configuration before generating
package/dist/core/dev.js CHANGED
@@ -293,6 +293,7 @@ export async function createDevServer(options = {}) {
293
293
  };
294
294
  let watcher = null;
295
295
  const isBuildingRef = { value: false };
296
+ let isStopping = false;
296
297
  /**
297
298
  * Gets MIME type for a file based on its extension
298
299
  */
@@ -328,15 +329,12 @@ export async function createDevServer(options = {}) {
328
329
  ws.onmessage = function(event) {
329
330
  const data = JSON.parse(event.data);
330
331
  if (data.type === 'reload') {
331
- console.log('Reloading page due to file changes...');
332
+ console.log('Reloading page due to file changes...');
332
333
  window.location.reload();
333
334
  }
334
335
  };
335
- ws.onopen = function() {
336
- console.log('Connected to Stati dev server');
337
- };
338
336
  ws.onclose = function() {
339
- console.log('Lost connection to Stati dev server');
337
+ // Suppress disconnection logs - not informative for users
340
338
  // Try to reconnect after a delay
341
339
  setTimeout(() => window.location.reload(), 1000);
342
340
  };
@@ -501,10 +499,10 @@ export async function createDevServer(options = {}) {
501
499
  path: '/__ws',
502
500
  });
503
501
  wsServer.on('connection', (ws) => {
504
- logger.info?.('Browser connected for live reload');
502
+ // Suppress connection logs - not informative for users
505
503
  const websocket = ws;
506
504
  websocket.on('close', () => {
507
- logger.info?.('Browser disconnected from live reload');
505
+ // Suppress disconnection logs - not informative for users
508
506
  });
509
507
  });
510
508
  }
@@ -539,10 +537,11 @@ export async function createDevServer(options = {}) {
539
537
  void performIncrementalRebuild(path, configPath, logger, wsServer, isBuildingRef, setLastBuildError);
540
538
  });
541
539
  logger.success?.(`Dev server running at ${url}`);
542
- logger.info?.(`\nServing from:`);
540
+ logger.info?.(`\nServing:`);
543
541
  logger.info?.(` 📁 ${outDir}`);
544
542
  logger.info?.('Watching:');
545
543
  watchPaths.forEach((path) => logger.info?.(` 📁 ${path}`));
544
+ logger.info?.('');
546
545
  // Open browser if requested
547
546
  if (open) {
548
547
  try {
@@ -555,6 +554,9 @@ export async function createDevServer(options = {}) {
555
554
  }
556
555
  },
557
556
  async stop() {
557
+ if (isStopping)
558
+ return;
559
+ isStopping = true;
558
560
  if (watcher) {
559
561
  await watcher.close();
560
562
  watcher = null;
@@ -569,7 +571,7 @@ export async function createDevServer(options = {}) {
569
571
  });
570
572
  httpServer = null;
571
573
  }
572
- logger.info?.('🛑 Dev server stopped');
574
+ logger.info?.('Dev server stopped');
573
575
  },
574
576
  };
575
577
  return devServer;
@@ -132,7 +132,7 @@ export async function createPreviewServer(options = {}) {
132
132
  });
133
133
  });
134
134
  logger.success?.(`Preview server running at ${url}`);
135
- logger.info?.(`\nServing from:`);
135
+ logger.info?.(`\nServing:`);
136
136
  logger.info?.(` 📁 ${outDir}`);
137
137
  // Open browser if requested
138
138
  if (open) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stati/core",
3
- "version": "1.12.1",
3
+ "version": "1.12.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",