@bookshop/hugo-engine 3.5.1 → 3.6.0-beta.0

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.
Files changed (19) hide show
  1. package/.nyc_output/processinfo/{0576b405-4d6f-416a-a012-1cd6714d2de3.json → 1431bee8-ccd0-4960-baf6-ada559b83a2a.json} +1 -1
  2. package/.nyc_output/processinfo/{1186c40f-ab1b-4fc3-8c8f-905478755bdd.json → 29274b6a-50dc-45fe-b64c-01e87d36afd7.json} +1 -1
  3. package/.nyc_output/processinfo/{9afa86b4-7892-4e9a-b022-45b2ba35af2a.json → afbfa0bc-7bfc-4af9-804e-4279bb321fd7.json} +1 -1
  4. package/.nyc_output/processinfo/{e261f702-c88f-4b27-aebb-f0ddcd3d512e.json → d79aa8b6-f561-45d4-adf3-f3418730227c.json} +1 -1
  5. package/.nyc_output/processinfo/e59a4cba-f1f7-4145-8de9-d7ee7cfa5830.json +1 -0
  6. package/.nyc_output/processinfo/index.json +1 -1
  7. package/bookshop-hugo-templates/helpers/component.html +11 -2
  8. package/bookshop-hugo-templates/helpers/flat_component_key.html +9 -0
  9. package/full-hugo-renderer/hugo_renderer.wasm +0 -0
  10. package/full-hugo-renderer/hugo_renderer.wasm.gz +0 -0
  11. package/lib/engine.js +9 -2
  12. package/lib/engine__test__.js +9 -2
  13. package/package.json +2 -2
  14. package/.nyc_output/processinfo/2fdbc94b-8ef1-4abe-8419-3b1f5ae13538.json +0 -1
  15. /package/.nyc_output/{0576b405-4d6f-416a-a012-1cd6714d2de3.json → 1431bee8-ccd0-4960-baf6-ada559b83a2a.json} +0 -0
  16. /package/.nyc_output/{1186c40f-ab1b-4fc3-8c8f-905478755bdd.json → 29274b6a-50dc-45fe-b64c-01e87d36afd7.json} +0 -0
  17. /package/.nyc_output/{2fdbc94b-8ef1-4abe-8419-3b1f5ae13538.json → afbfa0bc-7bfc-4af9-804e-4279bb321fd7.json} +0 -0
  18. /package/.nyc_output/{9afa86b4-7892-4e9a-b022-45b2ba35af2a.json → d79aa8b6-f561-45d4-adf3-f3418730227c.json} +0 -0
  19. /package/.nyc_output/{e261f702-c88f-4b27-aebb-f0ddcd3d512e.json → e59a4cba-f1f7-4145-8de9-d7ee7cfa5830.json} +0 -0
@@ -1 +1 @@
1
- {"parent":"2fdbc94b-8ef1-4abe-8419-3b1f5ae13538","pid":5527,"argv":["/opt/hostedtoolcache/node/16.20.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":1683882586943,"ppid":5494,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/0576b405-4d6f-416a-a012-1cd6714d2de3.json","externalId":"","uuid":"0576b405-4d6f-416a-a012-1cd6714d2de3","files":[]}
1
+ {"parent":"e59a4cba-f1f7-4145-8de9-d7ee7cfa5830","pid":5712,"argv":["/opt/hostedtoolcache/node/16.20.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":1684198717201,"ppid":5701,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/1431bee8-ccd0-4960-baf6-ada559b83a2a.json","externalId":"","uuid":"1431bee8-ccd0-4960-baf6-ada559b83a2a","files":[]}
@@ -1 +1 @@
1
- {"parent":"2fdbc94b-8ef1-4abe-8419-3b1f5ae13538","pid":5511,"argv":["/opt/hostedtoolcache/node/16.20.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":1683882586504,"ppid":5494,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/1186c40f-ab1b-4fc3-8c8f-905478755bdd.json","externalId":"","uuid":"1186c40f-ab1b-4fc3-8c8f-905478755bdd","files":[]}
1
+ {"parent":"e59a4cba-f1f7-4145-8de9-d7ee7cfa5830","pid":5740,"argv":["/opt/hostedtoolcache/node/16.20.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":1684198717601,"ppid":5701,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/29274b6a-50dc-45fe-b64c-01e87d36afd7.json","externalId":"","uuid":"29274b6a-50dc-45fe-b64c-01e87d36afd7","files":[]}
@@ -1 +1 @@
1
- {"parent":"2fdbc94b-8ef1-4abe-8419-3b1f5ae13538","pid":5505,"argv":["/opt/hostedtoolcache/node/16.20.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":1683882586497,"ppid":5494,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/9afa86b4-7892-4e9a-b022-45b2ba35af2a.json","externalId":"","uuid":"9afa86b4-7892-4e9a-b022-45b2ba35af2a","files":[]}
1
+ {"parent":"e59a4cba-f1f7-4145-8de9-d7ee7cfa5830","pid":5718,"argv":["/opt/hostedtoolcache/node/16.20.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":1684198717210,"ppid":5701,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/afbfa0bc-7bfc-4af9-804e-4279bb321fd7.json","externalId":"","uuid":"afbfa0bc-7bfc-4af9-804e-4279bb321fd7","files":[]}
@@ -1 +1 @@
1
- {"parent":"2fdbc94b-8ef1-4abe-8419-3b1f5ae13538","pid":5534,"argv":["/opt/hostedtoolcache/node/16.20.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":1683882586987,"ppid":5494,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/e261f702-c88f-4b27-aebb-f0ddcd3d512e.json","externalId":"","uuid":"e261f702-c88f-4b27-aebb-f0ddcd3d512e","files":[]}
1
+ {"parent":"e59a4cba-f1f7-4145-8de9-d7ee7cfa5830","pid":5734,"argv":["/opt/hostedtoolcache/node/16.20.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":1684198717580,"ppid":5701,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/d79aa8b6-f561-45d4-adf3-f3418730227c.json","externalId":"","uuid":"d79aa8b6-f561-45d4-adf3-f3418730227c","files":[]}
@@ -0,0 +1 @@
1
+ {"parent":null,"pid":5701,"argv":["/opt/hostedtoolcache/node/16.20.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":1684198716760,"ppid":5690,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/e59a4cba-f1f7-4145-8de9-d7ee7cfa5830.json","externalId":"","uuid":"e59a4cba-f1f7-4145-8de9-d7ee7cfa5830","files":[]}
@@ -1 +1 @@
1
- {"processes":{"0576b405-4d6f-416a-a012-1cd6714d2de3":{"parent":"2fdbc94b-8ef1-4abe-8419-3b1f5ae13538","children":[]},"1186c40f-ab1b-4fc3-8c8f-905478755bdd":{"parent":"2fdbc94b-8ef1-4abe-8419-3b1f5ae13538","children":[]},"2fdbc94b-8ef1-4abe-8419-3b1f5ae13538":{"parent":null,"children":["0576b405-4d6f-416a-a012-1cd6714d2de3","1186c40f-ab1b-4fc3-8c8f-905478755bdd","9afa86b4-7892-4e9a-b022-45b2ba35af2a","e261f702-c88f-4b27-aebb-f0ddcd3d512e"]},"9afa86b4-7892-4e9a-b022-45b2ba35af2a":{"parent":"2fdbc94b-8ef1-4abe-8419-3b1f5ae13538","children":[]},"e261f702-c88f-4b27-aebb-f0ddcd3d512e":{"parent":"2fdbc94b-8ef1-4abe-8419-3b1f5ae13538","children":[]}},"files":{},"externalIds":{}}
1
+ {"processes":{"1431bee8-ccd0-4960-baf6-ada559b83a2a":{"parent":"e59a4cba-f1f7-4145-8de9-d7ee7cfa5830","children":[]},"29274b6a-50dc-45fe-b64c-01e87d36afd7":{"parent":"e59a4cba-f1f7-4145-8de9-d7ee7cfa5830","children":[]},"afbfa0bc-7bfc-4af9-804e-4279bb321fd7":{"parent":"e59a4cba-f1f7-4145-8de9-d7ee7cfa5830","children":[]},"d79aa8b6-f561-45d4-adf3-f3418730227c":{"parent":"e59a4cba-f1f7-4145-8de9-d7ee7cfa5830","children":[]},"e59a4cba-f1f7-4145-8de9-d7ee7cfa5830":{"parent":null,"children":["1431bee8-ccd0-4960-baf6-ada559b83a2a","29274b6a-50dc-45fe-b64c-01e87d36afd7","afbfa0bc-7bfc-4af9-804e-4279bb321fd7","d79aa8b6-f561-45d4-adf3-f3418730227c"]}},"files":{},"externalIds":{}}
@@ -12,14 +12,23 @@
12
12
  {{- $component_name := index . 0 -}}
13
13
  {{- $component_props := index . 1 -}}
14
14
  {{- $component_path := partial "_bookshop/helpers/component_key" $component_name -}}
15
+ {{- $flat_component_path := partial "_bookshop/helpers/flat_component_key" $component_name -}}
15
16
 
17
+ {{- $resolved_component := false -}}
16
18
  {{- if templates.Exists ( printf "partials/%s" $component_path ) -}}
19
+ {{- $resolved_component = $component_path -}}
20
+ {{- else if templates.Exists ( printf "partials/%s" $flat_component_path ) -}}
21
+ {{- $resolved_component = $flat_component_path -}}
22
+ {{- end -}}
23
+
24
+ {{- if $resolved_component -}}
17
25
 
18
26
  {{/* Suppress comments when live editing {{ (printf "<!--bookshop-live name(%s)-->" $component_name) | safeHTML }} */}}
19
- {{- partial $component_path $component_props -}}
27
+ {{- partial $resolved_component $component_props -}}
20
28
  {{/* Suppress comments when live editing {{ "<!--bookshop-live end-->" | safeHTML }} */}}
21
29
 
22
30
  {{- else -}}
23
31
  {{- $file_loc := slicestr $component_path 9 -}}
24
- {{- partial "_bookshop/errors/err" (printf "Component \"%s\" does not exist.\n Create this component by placing a file in your bookshop at %s" $component_name $file_loc) -}}
32
+ {{- $flat_file_loc := slicestr $flat_component_path 9 -}}
33
+ {{- partial "_bookshop/errors/err" (printf "Component \"%s\" does not exist.\n Create this component by placing a file in your bookshop at %s or %s" $component_name $file_loc $flat_file_loc) -}}
25
34
  {{- end -}}
@@ -0,0 +1,9 @@
1
+ {{/*
2
+ Converts a bare Bookshop component key to a flat Bookshop path
3
+ i.e. "a/b" --> "bookshop/components/a/b.hugo.html"
4
+
5
+ Expects a String.
6
+ */}}
7
+
8
+ {{ $component_path := (printf "bookshop/components/%s.hugo.html" .) }}
9
+ {{ return $component_path }}
package/lib/engine.js CHANGED
@@ -58,6 +58,7 @@ export class Engine {
58
58
  "layouts/partials/bookshop_bindings.html": (await import("../bookshop-hugo-templates/bookshop_bindings.html")).default,
59
59
  "layouts/partials/_bookshop/helpers/component.html": (await import("../bookshop-hugo-templates/helpers/component.html")).default,
60
60
  "layouts/partials/_bookshop/helpers/component_key.html": (await import("../bookshop-hugo-templates/helpers/component_key.html")).default,
61
+ "layouts/partials/_bookshop/helpers/flat_component_key.html": (await import("../bookshop-hugo-templates/helpers/flat_component_key.html")).default,
61
62
  "layouts/partials/_bookshop/helpers/partial.html": (await import("../bookshop-hugo-templates/helpers/partial.html")).default,
62
63
  "layouts/partials/_bookshop/helpers/partial_key.html": (await import("../bookshop-hugo-templates/helpers/partial_key.html")).default,
63
64
  "layouts/partials/_bookshop/errors/bad_bookshop_tag.html": (await import("../bookshop-hugo-templates/errors/bad_bookshop_tag.html")).default,
@@ -156,14 +157,20 @@ export class Engine {
156
157
  return `components/${name}/${base}.hugo.html`;
157
158
  }
158
159
 
160
+ getFlatComponentKey(name) {
161
+ return `components/${name}.hugo.html`;
162
+ }
163
+
159
164
  getComponent(name) {
160
165
  const key = this.getComponentKey(name);
161
- return this.files?.[key];
166
+ const flatKey = this.getFlatComponentKey(name);
167
+ return this.files?.[key] ?? this.files?.[flatKey];
162
168
  }
163
169
 
164
170
  hasComponent(name) {
165
171
  const key = this.getComponentKey(name);
166
- return !!this.files?.[key];
172
+ const flatKey = this.getFlatComponentKey(name);
173
+ return !!(this.files?.[key] ?? this.files?.[flatKey]);
167
174
  }
168
175
 
169
176
  hasShared(name) {
@@ -58,6 +58,7 @@ export class Engine {
58
58
  "layouts/partials/bookshop_bindings.html": (await import("../bookshop-hugo-templates/bookshop_bindings.html")).default,
59
59
  "layouts/partials/_bookshop/helpers/component.html": (await import("../bookshop-hugo-templates/helpers/component.html")).default,
60
60
  "layouts/partials/_bookshop/helpers/component_key.html": (await import("../bookshop-hugo-templates/helpers/component_key.html")).default,
61
+ "layouts/partials/_bookshop/helpers/flat_component_key.html": (await import("../bookshop-hugo-templates/helpers/flat_component_key.html")).default,
61
62
  "layouts/partials/_bookshop/helpers/partial.html": (await import("../bookshop-hugo-templates/helpers/partial.html")).default,
62
63
  "layouts/partials/_bookshop/helpers/partial_key.html": (await import("../bookshop-hugo-templates/helpers/partial_key.html")).default,
63
64
  "layouts/partials/_bookshop/errors/bad_bookshop_tag.html": (await import("../bookshop-hugo-templates/errors/bad_bookshop_tag.html")).default,
@@ -156,14 +157,20 @@ export class Engine {
156
157
  return `components/${name}/${base}.hugo.html`;
157
158
  }
158
159
 
160
+ getFlatComponentKey(name) {
161
+ return `components/${name}.hugo.html`;
162
+ }
163
+
159
164
  getComponent(name) {
160
165
  const key = this.getComponentKey(name);
161
- return this.files?.[key];
166
+ const flatKey = this.getFlatComponentKey(name);
167
+ return this.files?.[key] ?? this.files?.[flatKey];
162
168
  }
163
169
 
164
170
  hasComponent(name) {
165
171
  const key = this.getComponentKey(name);
166
- return !!this.files?.[key];
172
+ const flatKey = this.getFlatComponentKey(name);
173
+ return !!(this.files?.[key] ?? this.files?.[flatKey]);
167
174
  }
168
175
 
169
176
  hasShared(name) {
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.5.1",
4
+ "version": "3.6.0-beta.0",
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.5.1",
34
+ "@bookshop/helpers": "3.6.0-beta.0",
35
35
  "esbuild": "^0.13.10",
36
36
  "fflate": "^0.7.3",
37
37
  "liquidjs": "9.28.0"
@@ -1 +0,0 @@
1
- {"parent":null,"pid":5494,"argv":["/opt/hostedtoolcache/node/16.20.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":1683882585987,"ppid":5483,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/2fdbc94b-8ef1-4abe-8419-3b1f5ae13538.json","externalId":"","uuid":"2fdbc94b-8ef1-4abe-8419-3b1f5ae13538","files":[]}