poops 1.5.2 → 1.5.3
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/lib/markups.js +22 -0
- package/package.json +1 -1
- package/poops.js +3 -1
package/lib/markups.js
CHANGED
|
@@ -551,6 +551,20 @@ export default class Markups {
|
|
|
551
551
|
this.lastPageEntries = pageEntries
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
+
// Watch hook for .json/.yaml changes. Data extensions are ambiguous: a
|
|
555
|
+
// .json may be a data file feeding the globals, or engine-owned markup
|
|
556
|
+
// (Shopify templates/*.json, section-group JSON). Engines that can tell
|
|
557
|
+
// claim theirs via isMarkupSource() and get the incremental path;
|
|
558
|
+
// everything else reloads data globals and full-compiles, as before.
|
|
559
|
+
async compileDataChange(file) {
|
|
560
|
+
await this.init()
|
|
561
|
+
if (this.engine && typeof this.engine.isMarkupSource === 'function' &&
|
|
562
|
+
this.engine.isMarkupSource(path.resolve(process.cwd(), file))) {
|
|
563
|
+
return this.compileIncremental(file)
|
|
564
|
+
}
|
|
565
|
+
return this.reloadDataFiles().then(() => this.compile())
|
|
566
|
+
}
|
|
567
|
+
|
|
554
568
|
// Watch-mode entry point: rebuild only the pages whose last render touched
|
|
555
569
|
// the changed file. Falls back to a full compile() whenever the result
|
|
556
570
|
// isn't provably identical to a full build — unsupported engine, no prior
|
|
@@ -593,6 +607,14 @@ export default class Markups {
|
|
|
593
607
|
if (this.isCollectionIndexOverride(rel.split(path.sep), collectionData)) return this.compile()
|
|
594
608
|
}
|
|
595
609
|
|
|
610
|
+
// A page's own dep set always contains itself, so an edited page is in
|
|
611
|
+
// `affected` (exact match, no glob needed). If it isn't, but the file IS a
|
|
612
|
+
// page source, this is a new page whose basename collides with a recorded
|
|
613
|
+
// dep — rendering only the collided pages would leave it unbuilt.
|
|
614
|
+
if (!affected.includes(abs) && this.getMarkupFiles(markupIn).some((f) => path.resolve(f) === abs)) {
|
|
615
|
+
return this.compile()
|
|
616
|
+
}
|
|
617
|
+
|
|
596
618
|
const markupStart = performance.now()
|
|
597
619
|
const newEntries = this.lastPageEntries ? [] : null
|
|
598
620
|
|
package/package.json
CHANGED
package/poops.js
CHANGED
|
@@ -156,7 +156,9 @@ function setupWatchers(config, modules) {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
if (/(\.json|\.ya?ml)$/i.test(file)) {
|
|
159
|
-
|
|
159
|
+
// Engine-owned markup with a data extension (Shopify templates/*.json)
|
|
160
|
+
// goes incremental; real data files reload globals + full compile.
|
|
161
|
+
modules.markups.compileDataChange(file).then(() => reload()).catch(err => console.error(err))
|
|
160
162
|
}
|
|
161
163
|
}
|
|
162
164
|
|