@bookshop/hugo-engine 3.7.0 → 3.8.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/.nyc_output/processinfo/290d41a5-d1b8-4756-b4d6-c59a0caf93bd.json +1 -0
- package/.nyc_output/processinfo/6c969e10-a8fd-4f52-a14f-9f6835f261f4.json +1 -0
- package/.nyc_output/processinfo/7dda525f-6b92-4c58-8bae-a852bd1f6075.json +1 -0
- package/.nyc_output/processinfo/a85a395c-56a3-46a2-b1bb-015aca6c3a60.json +1 -0
- package/.nyc_output/processinfo/db2df211-95ee-400f-a27a-0cb714927a4c.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/full-hugo-renderer/hugo_renderer.wasm +0 -0
- package/full-hugo-renderer/hugo_renderer.wasm.gz +0 -0
- package/lib/engine.js +10 -3
- package/lib/engine__test__.js +10 -3
- package/package.json +2 -2
- package/.nyc_output/processinfo/4cfc833e-a7a5-4b39-8898-5205d5f50aa4.json +0 -1
- package/.nyc_output/processinfo/5cd8fa18-60cf-43ac-8ed5-ece5a5c89276.json +0 -1
- package/.nyc_output/processinfo/b15f245b-a738-4773-aef0-9e5c6129f1fc.json +0 -1
- package/.nyc_output/processinfo/e5aa5254-91d5-40d4-b180-1ab5a8432edc.json +0 -1
- package/.nyc_output/processinfo/f239fc67-b62d-4250-9d6d-4dd418797460.json +0 -1
- /package/.nyc_output/{4cfc833e-a7a5-4b39-8898-5205d5f50aa4.json → 290d41a5-d1b8-4756-b4d6-c59a0caf93bd.json} +0 -0
- /package/.nyc_output/{5cd8fa18-60cf-43ac-8ed5-ece5a5c89276.json → 6c969e10-a8fd-4f52-a14f-9f6835f261f4.json} +0 -0
- /package/.nyc_output/{b15f245b-a738-4773-aef0-9e5c6129f1fc.json → 7dda525f-6b92-4c58-8bae-a852bd1f6075.json} +0 -0
- /package/.nyc_output/{e5aa5254-91d5-40d4-b180-1ab5a8432edc.json → a85a395c-56a3-46a2-b1bb-015aca6c3a60.json} +0 -0
- /package/.nyc_output/{f239fc67-b62d-4250-9d6d-4dd418797460.json → db2df211-95ee-400f-a27a-0cb714927a4c.json} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":"a85a395c-56a3-46a2-b1bb-015aca6c3a60","pid":6378,"argv":["/opt/hostedtoolcache/node/18.18.0/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1696480170882,"ppid":6342,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/290d41a5-d1b8-4756-b4d6-c59a0caf93bd.json","externalId":"","uuid":"290d41a5-d1b8-4756-b4d6-c59a0caf93bd","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":"a85a395c-56a3-46a2-b1bb-015aca6c3a60","pid":6358,"argv":["/opt/hostedtoolcache/node/18.18.0/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1696480170513,"ppid":6342,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/6c969e10-a8fd-4f52-a14f-9f6835f261f4.json","externalId":"","uuid":"6c969e10-a8fd-4f52-a14f-9f6835f261f4","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":"a85a395c-56a3-46a2-b1bb-015aca6c3a60","pid":6390,"argv":["/opt/hostedtoolcache/node/18.18.0/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1696480170963,"ppid":6342,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/7dda525f-6b92-4c58-8bae-a852bd1f6075.json","externalId":"","uuid":"7dda525f-6b92-4c58-8bae-a852bd1f6075","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":null,"pid":6342,"argv":["/opt/hostedtoolcache/node/18.18.0/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/cli.js","-v"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1696480170053,"ppid":6331,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/a85a395c-56a3-46a2-b1bb-015aca6c3a60.json","externalId":"","uuid":"a85a395c-56a3-46a2-b1bb-015aca6c3a60","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":"a85a395c-56a3-46a2-b1bb-015aca6c3a60","pid":6357,"argv":["/opt/hostedtoolcache/node/18.18.0/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1696480170507,"ppid":6342,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/db2df211-95ee-400f-a27a-0cb714927a4c.json","externalId":"","uuid":"db2df211-95ee-400f-a27a-0cb714927a4c","files":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"processes":{"
|
|
1
|
+
{"processes":{"290d41a5-d1b8-4756-b4d6-c59a0caf93bd":{"parent":"a85a395c-56a3-46a2-b1bb-015aca6c3a60","children":[]},"6c969e10-a8fd-4f52-a14f-9f6835f261f4":{"parent":"a85a395c-56a3-46a2-b1bb-015aca6c3a60","children":[]},"7dda525f-6b92-4c58-8bae-a852bd1f6075":{"parent":"a85a395c-56a3-46a2-b1bb-015aca6c3a60","children":[]},"a85a395c-56a3-46a2-b1bb-015aca6c3a60":{"parent":null,"children":["290d41a5-d1b8-4756-b4d6-c59a0caf93bd","6c969e10-a8fd-4f52-a14f-9f6835f261f4","7dda525f-6b92-4c58-8bae-a852bd1f6075","db2df211-95ee-400f-a27a-0cb714927a4c"]},"db2df211-95ee-400f-a27a-0cb714927a4c":{"parent":"a85a395c-56a3-46a2-b1bb-015aca6c3a60","children":[]}},"files":{},"externalIds":{}}
|
|
Binary file
|
|
Binary file
|
package/lib/engine.js
CHANGED
|
@@ -41,6 +41,7 @@ export class Engine {
|
|
|
41
41
|
this.key = 'hugo';
|
|
42
42
|
this.name = options.name;
|
|
43
43
|
this.files = options.files;
|
|
44
|
+
this.extraFiles = options.extraFiles;
|
|
44
45
|
this.origin = (typeof document === 'undefined' ? '' : document.currentScript?.src) || `/bookshop.js`;
|
|
45
46
|
this.synthetic = options.synthetic ?? false;
|
|
46
47
|
|
|
@@ -71,7 +72,7 @@ export class Engine {
|
|
|
71
72
|
if (compressedHugoWasm?.constructor === Uint8Array) {
|
|
72
73
|
await this.initializeInlineHugo();
|
|
73
74
|
} else {
|
|
74
|
-
await this.initializeLocalCompressedHugo();
|
|
75
|
+
await this.initializeLocalCompressedHugo(true);
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
// TODO: Tidy
|
|
@@ -82,6 +83,7 @@ export class Engine {
|
|
|
82
83
|
|
|
83
84
|
const componentSuccess = window["writeHugoFiles"](JSON.stringify(mappedFiles));
|
|
84
85
|
const templateSuccess = window["writeHugoFiles"](JSON.stringify(templates));
|
|
86
|
+
const extraSuccess = window["writeHugoFiles"](JSON.stringify(this.extraFiles));
|
|
85
87
|
|
|
86
88
|
// BIG OL' TODO: Writing these files ahead of render() seems to be load-bearing,
|
|
87
89
|
// which doesn't yet make sense to me.
|
|
@@ -98,7 +100,7 @@ export class Engine {
|
|
|
98
100
|
}));
|
|
99
101
|
}
|
|
100
102
|
|
|
101
|
-
async initializeLocalCompressedHugo() {
|
|
103
|
+
async initializeLocalCompressedHugo(usePrefetch) {
|
|
102
104
|
try {
|
|
103
105
|
|
|
104
106
|
let prefetched = {};
|
|
@@ -112,7 +114,7 @@ export class Engine {
|
|
|
112
114
|
const compressedWasmPath = (new URL(compressedWasmOrigin)).pathname;
|
|
113
115
|
|
|
114
116
|
let compressedBuffer;
|
|
115
|
-
if (prefetched[compressedWasmPath]) {
|
|
117
|
+
if (usePrefetch && prefetched[compressedWasmPath]) {
|
|
116
118
|
compressedBuffer = await prefetched[compressedWasmPath]?.arrayBuffer();
|
|
117
119
|
this.loadedFrom = "prefetch";
|
|
118
120
|
} else {
|
|
@@ -132,6 +134,11 @@ export class Engine {
|
|
|
132
134
|
} catch (e) {
|
|
133
135
|
console.error("Couldn't load the local compressed Hugo WASM");
|
|
134
136
|
console.error(e);
|
|
137
|
+
|
|
138
|
+
// If our prefetch fails, fall back to loading the wasm ourselves
|
|
139
|
+
if (usePrefetch) {
|
|
140
|
+
await this.initializeLocalCompressedHugo(false);
|
|
141
|
+
}
|
|
135
142
|
}
|
|
136
143
|
}
|
|
137
144
|
|
package/lib/engine__test__.js
CHANGED
|
@@ -41,6 +41,7 @@ export class Engine {
|
|
|
41
41
|
this.key = 'hugo';
|
|
42
42
|
this.name = options.name;
|
|
43
43
|
this.files = options.files;
|
|
44
|
+
this.extraFiles = options.extraFiles;
|
|
44
45
|
this.origin = (typeof document === 'undefined' ? '' : document.currentScript?.src) || `/bookshop.js`;
|
|
45
46
|
this.synthetic = options.synthetic ?? false;
|
|
46
47
|
|
|
@@ -71,7 +72,7 @@ export class Engine {
|
|
|
71
72
|
if (compressedHugoWasm?.constructor === Uint8Array) {
|
|
72
73
|
await this.initializeInlineHugo();
|
|
73
74
|
} else {
|
|
74
|
-
await this.initializeLocalCompressedHugo();
|
|
75
|
+
await this.initializeLocalCompressedHugo(true);
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
// TODO: Tidy
|
|
@@ -82,6 +83,7 @@ export class Engine {
|
|
|
82
83
|
|
|
83
84
|
const componentSuccess = window["writeHugoFiles"](JSON.stringify(mappedFiles));
|
|
84
85
|
const templateSuccess = window["writeHugoFiles"](JSON.stringify(templates));
|
|
86
|
+
const extraSuccess = window["writeHugoFiles"](JSON.stringify(this.extraFiles));
|
|
85
87
|
|
|
86
88
|
// BIG OL' TODO: Writing these files ahead of render() seems to be load-bearing,
|
|
87
89
|
// which doesn't yet make sense to me.
|
|
@@ -98,7 +100,7 @@ export class Engine {
|
|
|
98
100
|
}));
|
|
99
101
|
}
|
|
100
102
|
|
|
101
|
-
async initializeLocalCompressedHugo() {
|
|
103
|
+
async initializeLocalCompressedHugo(usePrefetch) {
|
|
102
104
|
try {
|
|
103
105
|
|
|
104
106
|
let prefetched = {};
|
|
@@ -112,7 +114,7 @@ export class Engine {
|
|
|
112
114
|
const compressedWasmPath = (new URL(compressedWasmOrigin)).pathname;
|
|
113
115
|
|
|
114
116
|
let compressedBuffer;
|
|
115
|
-
if (prefetched[compressedWasmPath]) {
|
|
117
|
+
if (usePrefetch && prefetched[compressedWasmPath]) {
|
|
116
118
|
compressedBuffer = await prefetched[compressedWasmPath]?.arrayBuffer();
|
|
117
119
|
this.loadedFrom = "prefetch";
|
|
118
120
|
} else {
|
|
@@ -132,6 +134,11 @@ export class Engine {
|
|
|
132
134
|
} catch (e) {
|
|
133
135
|
console.error("Couldn't load the local compressed Hugo WASM");
|
|
134
136
|
console.error(e);
|
|
137
|
+
|
|
138
|
+
// If our prefetch fails, fall back to loading the wasm ourselves
|
|
139
|
+
if (usePrefetch) {
|
|
140
|
+
await this.initializeLocalCompressedHugo(false);
|
|
141
|
+
}
|
|
135
142
|
}
|
|
136
143
|
}
|
|
137
144
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bookshop/hugo-engine",
|
|
3
3
|
"packageManager": "yarn@3.0.0",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.8.1",
|
|
5
5
|
"description": "Bookshop frontend Hugo renderer",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"nyc": "^15.1.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@bookshop/helpers": "3.
|
|
34
|
+
"@bookshop/helpers": "3.8.1",
|
|
35
35
|
"esbuild": "^0.19.3",
|
|
36
36
|
"fflate": "^0.7.3",
|
|
37
37
|
"liquidjs": "9.28.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"parent":"5cd8fa18-60cf-43ac-8ed5-ece5a5c89276","pid":5747,"argv":["/opt/hostedtoolcache/node/18.17.1/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1695336946389,"ppid":5736,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/4cfc833e-a7a5-4b39-8898-5205d5f50aa4.json","externalId":"","uuid":"4cfc833e-a7a5-4b39-8898-5205d5f50aa4","files":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"parent":null,"pid":5736,"argv":["/opt/hostedtoolcache/node/18.17.1/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/cli.js","-v"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1695336945812,"ppid":5725,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/5cd8fa18-60cf-43ac-8ed5-ece5a5c89276.json","externalId":"","uuid":"5cd8fa18-60cf-43ac-8ed5-ece5a5c89276","files":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"parent":"5cd8fa18-60cf-43ac-8ed5-ece5a5c89276","pid":5748,"argv":["/opt/hostedtoolcache/node/18.17.1/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1695336946431,"ppid":5736,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/b15f245b-a738-4773-aef0-9e5c6129f1fc.json","externalId":"","uuid":"b15f245b-a738-4773-aef0-9e5c6129f1fc","files":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"parent":"5cd8fa18-60cf-43ac-8ed5-ece5a5c89276","pid":5776,"argv":["/opt/hostedtoolcache/node/18.17.1/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1695336946914,"ppid":5736,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/e5aa5254-91d5-40d4-b180-1ab5a8432edc.json","externalId":"","uuid":"e5aa5254-91d5-40d4-b180-1ab5a8432edc","files":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"parent":"5cd8fa18-60cf-43ac-8ed5-ece5a5c89276","pid":5769,"argv":["/opt/hostedtoolcache/node/18.17.1/x64/bin/node","/home/runner/work/bookshop/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine","time":1695336946857,"ppid":5736,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/f239fc67-b62d-4250-9d6d-4dd418797460.json","externalId":"","uuid":"f239fc67-b62d-4250-9d6d-4dd418797460","files":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|