@bookshop/hugo-engine 3.18.4 → 3.18.5-rc2
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.
|
Binary file
|
package/lib/engine.js
CHANGED
|
@@ -35,7 +35,7 @@ const ensureUnifiedLayoutInstalled = () => {
|
|
|
35
35
|
|
|
36
36
|
window.__bookshop_unified_layout_installed = true;
|
|
37
37
|
verboseLog('[hugo-engine] Installing unified static layout');
|
|
38
|
-
return { "layouts/
|
|
38
|
+
return { "layouts/all.html": UNIFIED_LAYOUT };
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -154,8 +154,8 @@ export class Engine {
|
|
|
154
154
|
// in the Hugo builder, but I don't know why that wouldn't affect eval()... 🤷♂️
|
|
155
155
|
// For now, the load-bearing stubs will live in this Hugo initialization.
|
|
156
156
|
window.writeHugoFiles(JSON.stringify({
|
|
157
|
-
"layouts/
|
|
158
|
-
"content/_index.md": "{
|
|
157
|
+
"layouts/all.html": "Uninitialized Layout",
|
|
158
|
+
"content/_index.md": "{ \"initialized\": false }\n"
|
|
159
159
|
}));
|
|
160
160
|
}
|
|
161
161
|
|
|
@@ -345,12 +345,14 @@ export class Engine {
|
|
|
345
345
|
}
|
|
346
346
|
|
|
347
347
|
async render(target, name, props, globals, logger) {
|
|
348
|
+
const uuid = crypto.randomUUID();
|
|
349
|
+
|
|
348
350
|
while (!window.buildHugo) {
|
|
349
351
|
logger?.log?.(`Waiting for the Hugo WASM to be available...`);
|
|
350
352
|
await sleep(100);
|
|
351
353
|
};
|
|
352
354
|
|
|
353
|
-
|
|
355
|
+
const writeFiles = {};
|
|
354
356
|
let componentType = null;
|
|
355
357
|
|
|
356
358
|
if (this.hasComponent(name)) {
|
|
@@ -373,7 +375,7 @@ export class Engine {
|
|
|
373
375
|
|
|
374
376
|
// If we have assigned a root scope we need to pass that in as the context
|
|
375
377
|
if (props["."]) props = props["."];
|
|
376
|
-
writeFiles[
|
|
378
|
+
writeFiles[`content/${uuid}.md`] = JSON.stringify({
|
|
377
379
|
bookshop_name: name,
|
|
378
380
|
bookshop_type: componentType,
|
|
379
381
|
component: props
|
|
@@ -386,11 +388,11 @@ export class Engine {
|
|
|
386
388
|
return;
|
|
387
389
|
}
|
|
388
390
|
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
]));
|
|
391
|
+
const outputFileName = `public/${uuid}/index.html`;
|
|
392
|
+
const output = window.readHugoFiles(JSON.stringify([outputFileName]));
|
|
392
393
|
|
|
393
|
-
target.innerHTML = output[
|
|
394
|
+
target.innerHTML = output[outputFileName];
|
|
395
|
+
window.removeHugoFiles([outputFileName, `content/${uuid}.md`])
|
|
394
396
|
}
|
|
395
397
|
|
|
396
398
|
async renderBatch(components, logger) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bookshop/hugo-engine",
|
|
3
|
-
"version": "3.18.
|
|
3
|
+
"version": "3.18.5-rc2",
|
|
4
4
|
"description": "Bookshop frontend Hugo renderer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"esbuild": "^0.19.3",
|
|
32
32
|
"fflate": "^0.7.3",
|
|
33
33
|
"liquidjs": "10.17.0",
|
|
34
|
-
"@bookshop/helpers": "3.18.
|
|
34
|
+
"@bookshop/helpers": "3.18.5-rc2"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=14.16"
|