mikser-io-layouts 2.3.0 → 2.4.1
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/index.js +18 -9
- package/lib/matching.js +7 -7
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
checksumsByCollection,
|
|
22
22
|
checksum as fileChecksum, checksumOf,
|
|
23
23
|
useDatabase,
|
|
24
|
+
writeOutput, reportUnchanged,
|
|
24
25
|
} from 'mikser-io'
|
|
25
26
|
|
|
26
27
|
import { createInspect } from './lib/inspect.js'
|
|
@@ -109,9 +110,9 @@ export function layouts(userOptions = {}) {
|
|
|
109
110
|
const { relativePath } = context
|
|
110
111
|
|
|
111
112
|
// A .js file under the layouts folder is a SIDECAR (or something
|
|
112
|
-
// a sidecar imports), never a layout.
|
|
113
|
-
//
|
|
114
|
-
// `/layouts/page`
|
|
113
|
+
// a sidecar imports), never a layout. Treating one as a layout —
|
|
114
|
+
// stripping its `.js` and creating an entity — yields a phantom
|
|
115
|
+
// `/layouts/page` holding JS source as its content, beside the
|
|
115
116
|
// real `/layouts/page.liquid`.
|
|
116
117
|
//
|
|
117
118
|
// Sidecars are inputs to a layout's checksum instead (see
|
|
@@ -408,12 +409,20 @@ export function layouts(userOptions = {}) {
|
|
|
408
409
|
|
|
409
410
|
if (!skipWrite) {
|
|
410
411
|
const destinationFile = path.join(writeBase, entity.destination)
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
412
|
+
// writeOutput skips the write when the bytes already on
|
|
413
|
+
// disk are identical, and owns the mkdir/unlink.
|
|
414
|
+
// Invalidation is deliberately conservative — an entity
|
|
415
|
+
// that merely READS another re-renders, since the engine
|
|
416
|
+
// cannot know which field was read — so byte-identical
|
|
417
|
+
// output is routine, and rewriting it moves mtime for
|
|
418
|
+
// live-reload, rsync and `find -newer` alike.
|
|
419
|
+
const wrote = await writeOutput(destinationFile, output.result)
|
|
420
|
+
if (wrote) {
|
|
421
|
+
logger.debug('Layout render finished: %s', entity.destination.replace(runtime.options.workingFolder, ''))
|
|
422
|
+
} else {
|
|
423
|
+
reportUnchanged(entity)
|
|
424
|
+
logger.debug('Layout render finished, output unchanged: %s', entity.destination.replace(runtime.options.workingFolder, ''))
|
|
425
|
+
}
|
|
417
426
|
} else {
|
|
418
427
|
logger.debug('Layout render finished (save:false, bytes only): %s', entity.id)
|
|
419
428
|
}
|
package/lib/matching.js
CHANGED
|
@@ -221,14 +221,14 @@ export function createOnProcessed({
|
|
|
221
221
|
// pattern-match / auto-layout paths.
|
|
222
222
|
// Persist the primary destination.
|
|
223
223
|
//
|
|
224
|
-
//
|
|
225
|
-
//
|
|
226
|
-
//
|
|
227
|
-
//
|
|
228
|
-
//
|
|
229
|
-
// entity instead of { url }. The catalog is only
|
|
224
|
+
// The primary destination has to be persisted, not just
|
|
225
|
+
// set per render task. runtime.href() needs the TARGET's
|
|
226
|
+
// destination to build a relative URL, and it reads the
|
|
227
|
+
// catalog: a destination that only ever exists on a
|
|
228
|
+
// task makes href() fall through and return the whole
|
|
229
|
+
// entity instead of { url }. The catalog is written only
|
|
230
230
|
// through the journal, and this hook is where that
|
|
231
|
-
// happens, so it
|
|
231
|
+
// happens, so it is derived here.
|
|
232
232
|
//
|
|
233
233
|
// "Primary" means page 1 / the sole output of the FIRST
|
|
234
234
|
// matched layout — the same choice entity.layout already
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mikser-io-layouts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "SSG-flavor task-production policy for mikser-io. Multi-match layout assignment, per-layout destinations, postprocess chain attachment, layout inspection.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://github.com/almero-digital-marketing/mikser-io-layouts#readme",
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"mikser-io": "^9.
|
|
21
|
+
"mikser-io": "^9.18.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"globby": "^14.0.0",
|