mikser-io 6.0.5 → 6.0.6
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/package.json +1 -1
- package/src/plugins/layouts.js +8 -4
package/package.json
CHANGED
package/src/plugins/layouts.js
CHANGED
|
@@ -20,6 +20,8 @@ export default ({
|
|
|
20
20
|
onSync,
|
|
21
21
|
matchEntity,
|
|
22
22
|
changeExtension,
|
|
23
|
+
findEntity,
|
|
24
|
+
findEntities,
|
|
23
25
|
constants: { ACTION, OPERATION, TASKS },
|
|
24
26
|
}) => {
|
|
25
27
|
const collection = 'layouts'
|
|
@@ -206,9 +208,10 @@ export default ({
|
|
|
206
208
|
break
|
|
207
209
|
}
|
|
208
210
|
}
|
|
209
|
-
if (!entity.layout && runtime.config.layouts?.autoLayouts && entity.
|
|
210
|
-
const
|
|
211
|
-
const
|
|
211
|
+
if (!entity.layout && runtime.config.layouts?.autoLayouts && entity.id) {
|
|
212
|
+
const lookupBase = entity.id.replace(`/${entity.collection}/`,'')
|
|
213
|
+
const dir = path.dirname(lookupBase)
|
|
214
|
+
const base = path.basename(lookupBase)
|
|
212
215
|
const chunks = base.split('.')
|
|
213
216
|
const candidates = []
|
|
214
217
|
|
|
@@ -256,6 +259,7 @@ export default ({
|
|
|
256
259
|
})
|
|
257
260
|
|
|
258
261
|
onBeforeRender(async (signal) => {
|
|
262
|
+
const logger = useLogger()
|
|
259
263
|
const tasks = []
|
|
260
264
|
const entities = Array.from(getSitemapEntities())
|
|
261
265
|
.filter(entity => entity.layout)
|
|
@@ -274,7 +278,7 @@ export default ({
|
|
|
274
278
|
try {
|
|
275
279
|
var { load, plugins = [] } = await import(`${path.join(runtime.options.layoutsFolder, entity.layout.name)}.js?stamp=${Date.now()}`)
|
|
276
280
|
if (load) {
|
|
277
|
-
data = await load(entity, signal)
|
|
281
|
+
data = await load({ entity, findEntity, findEntities, runtime, signal })
|
|
278
282
|
}
|
|
279
283
|
} catch (err) {
|
|
280
284
|
if (err.code != 'ERR_MODULE_NOT_FOUND') throw err
|