@bookshop/hugo-engine 3.0.0-beta.4 → 3.0.0-beta.7
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/{2313c713-821d-483b-bcac-72a8b3d5b815.json → 160cf99c-a0f4-404e-acf3-806eef41ccfe.json} +0 -0
- package/.nyc_output/{25e784de-86d5-4928-a6c1-a7bc208ae447.json → 36549ad5-2c6a-4873-bae4-20c698f8cb27.json} +0 -0
- package/.nyc_output/{3cdddaac-1eef-449c-bb40-28d3cae7ae96.json → 8b940770-32d6-44e8-b57c-e1906a22986a.json} +0 -0
- package/.nyc_output/{bb4bf3d2-cb70-4f42-86b6-15185d34d9d2.json → ac329b9a-3111-451a-88f3-ecd744bcde17.json} +0 -0
- package/.nyc_output/{c4904345-bd70-4d8f-b07b-e7a1bc5c65ed.json → c9a80bb2-ca96-446b-9388-ac9501c84ac8.json} +0 -0
- package/.nyc_output/processinfo/{2313c713-821d-483b-bcac-72a8b3d5b815.json → 160cf99c-a0f4-404e-acf3-806eef41ccfe.json} +1 -1
- package/.nyc_output/processinfo/{25e784de-86d5-4928-a6c1-a7bc208ae447.json → 36549ad5-2c6a-4873-bae4-20c698f8cb27.json} +1 -1
- package/.nyc_output/processinfo/{3cdddaac-1eef-449c-bb40-28d3cae7ae96.json → 8b940770-32d6-44e8-b57c-e1906a22986a.json} +1 -1
- package/.nyc_output/processinfo/{bb4bf3d2-cb70-4f42-86b6-15185d34d9d2.json → ac329b9a-3111-451a-88f3-ecd744bcde17.json} +1 -1
- package/.nyc_output/processinfo/c9a80bb2-ca96-446b-9388-ac9501c84ac8.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/hugo-renderer/build.sh +1 -1
- package/hugo-renderer/hugo_renderer.wasm +0 -0
- package/hugo-renderer/tpl/bookshop_library/bookshop_components.go +11 -4
- package/lib/engine.js +6 -3
- package/package.json +2 -2
- package/.nyc_output/processinfo/c4904345-bd70-4d8f-b07b-e7a1bc5c65ed.json +0 -1
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"parent":"
|
|
1
|
+
{"parent":"c9a80bb2-ca96-446b-9388-ac9501c84ac8","pid":62085,"argv":["/Users/liambigelow/.nvm/versions/node/v14.16.0/bin/node","/Users/liambigelow/Projects/CC/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/Users/liambigelow/Projects/CC/bookshop/javascript-modules/engines/hugo-engine","time":1649211456668,"ppid":62042,"coverageFilename":"/Users/liambigelow/Projects/CC/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/160cf99c-a0f4-404e-acf3-806eef41ccfe.json","externalId":"","uuid":"160cf99c-a0f4-404e-acf3-806eef41ccfe","files":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"parent":"
|
|
1
|
+
{"parent":"c9a80bb2-ca96-446b-9388-ac9501c84ac8","pid":62087,"argv":["/Users/liambigelow/.nvm/versions/node/v14.16.0/bin/node","/Users/liambigelow/Projects/CC/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/Users/liambigelow/Projects/CC/bookshop/javascript-modules/engines/hugo-engine","time":1649211456675,"ppid":62042,"coverageFilename":"/Users/liambigelow/Projects/CC/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/36549ad5-2c6a-4873-bae4-20c698f8cb27.json","externalId":"","uuid":"36549ad5-2c6a-4873-bae4-20c698f8cb27","files":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"parent":"
|
|
1
|
+
{"parent":"c9a80bb2-ca96-446b-9388-ac9501c84ac8","pid":62086,"argv":["/Users/liambigelow/.nvm/versions/node/v14.16.0/bin/node","/Users/liambigelow/Projects/CC/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/Users/liambigelow/Projects/CC/bookshop/javascript-modules/engines/hugo-engine","time":1649211456671,"ppid":62042,"coverageFilename":"/Users/liambigelow/Projects/CC/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/8b940770-32d6-44e8-b57c-e1906a22986a.json","externalId":"","uuid":"8b940770-32d6-44e8-b57c-e1906a22986a","files":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"parent":"
|
|
1
|
+
{"parent":"c9a80bb2-ca96-446b-9388-ac9501c84ac8","pid":62088,"argv":["/Users/liambigelow/.nvm/versions/node/v14.16.0/bin/node","/Users/liambigelow/Projects/CC/bookshop/javascript-modules/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/Users/liambigelow/Projects/CC/bookshop/javascript-modules/engines/hugo-engine","time":1649211456680,"ppid":62042,"coverageFilename":"/Users/liambigelow/Projects/CC/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/ac329b9a-3111-451a-88f3-ecd744bcde17.json","externalId":"","uuid":"ac329b9a-3111-451a-88f3-ecd744bcde17","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":null,"pid":62042,"argv":["/Users/liambigelow/.nvm/versions/node/v14.16.0/bin/node","/Users/liambigelow/Projects/CC/bookshop/javascript-modules/node_modules/ava/cli.js","-v"],"execArgv":[],"cwd":"/Users/liambigelow/Projects/CC/bookshop/javascript-modules/engines/hugo-engine","time":1649211456128,"ppid":62017,"coverageFilename":"/Users/liambigelow/Projects/CC/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/c9a80bb2-ca96-446b-9388-ac9501c84ac8.json","externalId":"","uuid":"c9a80bb2-ca96-446b-9388-ac9501c84ac8","files":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"processes":{"
|
|
1
|
+
{"processes":{"160cf99c-a0f4-404e-acf3-806eef41ccfe":{"parent":"c9a80bb2-ca96-446b-9388-ac9501c84ac8","children":[]},"36549ad5-2c6a-4873-bae4-20c698f8cb27":{"parent":"c9a80bb2-ca96-446b-9388-ac9501c84ac8","children":[]},"8b940770-32d6-44e8-b57c-e1906a22986a":{"parent":"c9a80bb2-ca96-446b-9388-ac9501c84ac8","children":[]},"ac329b9a-3111-451a-88f3-ecd744bcde17":{"parent":"c9a80bb2-ca96-446b-9388-ac9501c84ac8","children":[]},"c9a80bb2-ca96-446b-9388-ac9501c84ac8":{"parent":null,"children":["160cf99c-a0f4-404e-acf3-806eef41ccfe","36549ad5-2c6a-4873-bae4-20c698f8cb27","8b940770-32d6-44e8-b57c-e1906a22986a","ac329b9a-3111-451a-88f3-ecd744bcde17"]}},"files":{},"externalIds":{}}
|
package/hugo-renderer/build.sh
CHANGED
|
@@ -8,7 +8,7 @@ if [ -f $OUTPUTFILENAME ]; then
|
|
|
8
8
|
exit 1
|
|
9
9
|
fi
|
|
10
10
|
|
|
11
|
-
# Build temp module
|
|
11
|
+
# Build temp module (For Windows use `$Env:GOOS = "js"; $Env:GOARCH = "wasm"` )
|
|
12
12
|
GOOS=js GOARCH=wasm go build -tags nodeploy -o $TMPFILENAME
|
|
13
13
|
printf "Built Hugo WASM via $TMPFILENAME : "
|
|
14
14
|
ls -lh $TMPFILENAME | awk '{print $5}'
|
|
Binary file
|
|
@@ -5,6 +5,7 @@ import (
|
|
|
5
5
|
"encoding/json"
|
|
6
6
|
"fmt"
|
|
7
7
|
"html/template"
|
|
8
|
+
"strings"
|
|
8
9
|
|
|
9
10
|
"hugo-renderer/deps"
|
|
10
11
|
"hugo-renderer/tpl/internal"
|
|
@@ -76,6 +77,12 @@ func RetrieveBookshopPartial(bookshop_key string) (*template.Template, bool) {
|
|
|
76
77
|
return nil, false
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
func bookshopKey(full_key string) string {
|
|
81
|
+
split := strings.Split(full_key, "/")
|
|
82
|
+
base := split[len(split)-1]
|
|
83
|
+
return fmt.Sprintf("components/%s/%s.hugo.html", full_key, base)
|
|
84
|
+
}
|
|
85
|
+
|
|
79
86
|
// UnwrapBookshopPartial takes the dict or slice that the {{ partial "bookshop" ... }}
|
|
80
87
|
// was given, and pulls out the component / partial name that should be rendered.
|
|
81
88
|
// TODO(bookshop): Ideally our templating support gets better,
|
|
@@ -83,24 +90,24 @@ func RetrieveBookshopPartial(bookshop_key string) (*template.Template, bool) {
|
|
|
83
90
|
func UnwrapBookshopComponent(context interface{}) (string, interface{}) {
|
|
84
91
|
if componentData, ok := context.(map[string]interface{}); ok {
|
|
85
92
|
if component, ok := componentData["_bookshop_name"]; ok {
|
|
86
|
-
key :=
|
|
93
|
+
key := bookshopKey(component.(string))
|
|
87
94
|
return key, context
|
|
88
95
|
}
|
|
89
96
|
return "err_no_bookshop_name_key", context
|
|
90
97
|
}
|
|
91
98
|
if componentData, ok := context.([]interface{}); ok {
|
|
92
99
|
if component, ok := componentData[0].(string); ok {
|
|
93
|
-
key :=
|
|
100
|
+
key := bookshopKey(component)
|
|
94
101
|
return key, componentData[1]
|
|
95
102
|
}
|
|
96
103
|
return "err_slice_zero_not_string", context
|
|
97
104
|
}
|
|
98
105
|
if componentData, ok := context.([]string); ok {
|
|
99
|
-
key :=
|
|
106
|
+
key := bookshopKey(componentData[0])
|
|
100
107
|
return key, componentData[1]
|
|
101
108
|
}
|
|
102
109
|
if componentName, ok := context.(string); ok {
|
|
103
|
-
key :=
|
|
110
|
+
key := bookshopKey(componentName)
|
|
104
111
|
return key, nil
|
|
105
112
|
}
|
|
106
113
|
return "err_not_map_slice_or_string", context
|
package/lib/engine.js
CHANGED
|
@@ -147,10 +147,12 @@ export class Engine {
|
|
|
147
147
|
console.warn(`[hugo-engine] No component found for ${name}`);
|
|
148
148
|
return "";
|
|
149
149
|
}
|
|
150
|
-
logger?.log?.(`Going to render ${name}
|
|
150
|
+
logger?.log?.(`Going to render ${name}, with source:`);
|
|
151
|
+
logger?.log?.(source);
|
|
151
152
|
// TODO: this template already exists on the other side of the wasm bounary
|
|
152
153
|
source = translateTextTemplate(source, {});
|
|
153
|
-
logger?.log?.(`Rewritten the template for ${name}
|
|
154
|
+
logger?.log?.(`Rewritten the template for ${name} to:`);
|
|
155
|
+
logger?.log?.(source);
|
|
154
156
|
if (!globals || typeof globals !== "object") globals = {};
|
|
155
157
|
props = { ...globals, ...props };
|
|
156
158
|
|
|
@@ -161,8 +163,9 @@ export class Engine {
|
|
|
161
163
|
logger?.log?.(`Failed to render ${output}`);
|
|
162
164
|
console.error(output);
|
|
163
165
|
} else {
|
|
164
|
-
logger?.log?.(`Rendered ${name}`);
|
|
165
166
|
target.innerHTML = output;
|
|
167
|
+
logger?.log?.(`Rendered ${name} as:`);
|
|
168
|
+
logger?.log?.(target.innerHTML);
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
171
|
|
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.0.0-beta.
|
|
4
|
+
"version": "3.0.0-beta.7",
|
|
5
5
|
"description": "Bookshop frontend Hugo renderer",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"nyc": "^15.1.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@bookshop/helpers": "3.0.0-beta.
|
|
32
|
+
"@bookshop/helpers": "3.0.0-beta.7",
|
|
33
33
|
"esbuild": "^0.13.10",
|
|
34
34
|
"liquidjs": "9.28.0"
|
|
35
35
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"parent":null,"pid":86887,"argv":["/Users/liambigelow/.nvm/versions/node/v14.16.0/bin/node","/Users/liambigelow/Projects/CC/bookshop/javascript-modules/node_modules/ava/cli.js","-v"],"execArgv":[],"cwd":"/Users/liambigelow/Projects/CC/bookshop/javascript-modules/engines/hugo-engine","time":1648784399998,"ppid":86886,"coverageFilename":"/Users/liambigelow/Projects/CC/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/c4904345-bd70-4d8f-b07b-e7a1bc5c65ed.json","externalId":"","uuid":"c4904345-bd70-4d8f-b07b-e7a1bc5c65ed","files":[]}
|