coralite-scripts 0.37.1 → 0.38.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.
Files changed (2) hide show
  1. package/libs/server.js +11 -1
  2. package/package.json +2 -2
package/libs/server.js CHANGED
@@ -481,6 +481,7 @@ async function server (config, options) {
481
481
  let compileTimeout = null
482
482
  let isCompiling = false
483
483
  const pendingChanges = new Set()
484
+ const structuralChanges = new Set()
484
485
  const configPathStr = join(process.cwd(), 'coralite.config.js')
485
486
 
486
487
 
@@ -496,7 +497,6 @@ async function server (config, options) {
496
497
  }
497
498
 
498
499
  pageCache.clear()
499
- coralite.clearCache()
500
500
 
501
501
  isCompiling = true
502
502
  let dash = colours.gray(' ─ ')
@@ -504,6 +504,10 @@ async function server (config, options) {
504
504
  // Process all pending changes
505
505
  const changes = Array.from(pendingChanges)
506
506
  pendingChanges.clear()
507
+ const isStructural = structuralChanges.size > 0
508
+ structuralChanges.clear()
509
+
510
+ await coralite.clearCache(isStructural)
507
511
 
508
512
  // Group changes by type
509
513
  const pagesChanges = changes.filter(p => p.startsWith(pagesPath))
@@ -580,6 +584,9 @@ async function server (config, options) {
580
584
  .on('unlink', async (path) => {
581
585
  try {
582
586
  if (path.startsWith(componentPath)) {
587
+ structuralChanges.add(path)
588
+ pendingChanges.add(path)
589
+ debounceCompile()
583
590
  await coralite.components.deleteItem(path)
584
591
  } else if (path.startsWith(pagesPath)) {
585
592
  await coralite.pages.deleteItem(path)
@@ -597,6 +604,9 @@ async function server (config, options) {
597
604
  try {
598
605
  if (path.startsWith(componentPath)) {
599
606
  // set component item
607
+ structuralChanges.add(path)
608
+ pendingChanges.add(path)
609
+ debounceCompile()
600
610
  coralite.components.setItem(path)
601
611
  } else if (path.endsWith('.scss') || path.endsWith('.sass') || path === configPathStr || Array.from(pluginPaths).some(pluginPath => path === pluginPath)) {
602
612
  // Add to pending changes and trigger debounced compilation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coralite-scripts",
3
- "version": "0.37.1",
3
+ "version": "0.38.0",
4
4
  "description": "Configuration and scripts for Create Coralite.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -61,7 +61,7 @@
61
61
  "portfinder": "^1.0.38",
62
62
  "postcss": "^8.5.6",
63
63
  "sass": "^1.91.0",
64
- "coralite": "0.37.1"
64
+ "coralite": "0.38.0"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "premove dist && pnpm build-types",