@bookshop/hugo-engine 3.6.4 → 3.7.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 (20) hide show
  1. package/.nyc_output/processinfo/4cfc833e-a7a5-4b39-8898-5205d5f50aa4.json +1 -0
  2. package/.nyc_output/processinfo/5cd8fa18-60cf-43ac-8ed5-ece5a5c89276.json +1 -0
  3. package/.nyc_output/processinfo/b15f245b-a738-4773-aef0-9e5c6129f1fc.json +1 -0
  4. package/.nyc_output/processinfo/e5aa5254-91d5-40d4-b180-1ab5a8432edc.json +1 -0
  5. package/.nyc_output/processinfo/f239fc67-b62d-4250-9d6d-4dd418797460.json +1 -0
  6. package/.nyc_output/processinfo/index.json +1 -1
  7. package/full-hugo-renderer/hugo_renderer.wasm +0 -0
  8. package/full-hugo-renderer/hugo_renderer.wasm.gz +0 -0
  9. package/full-hugo-renderer/wasm_exec.js +29 -105
  10. package/package.json +3 -3
  11. package/.nyc_output/processinfo/4e27ec32-531e-430f-99f8-46c68e32bfe9.json +0 -1
  12. package/.nyc_output/processinfo/4f3ff5dc-ec7c-4f15-a43d-bf447b7b6f53.json +0 -1
  13. package/.nyc_output/processinfo/776a4f66-410c-44c8-923b-4d89e13cd196.json +0 -1
  14. package/.nyc_output/processinfo/8137131a-b80f-48f9-aa70-57700ccb799f.json +0 -1
  15. package/.nyc_output/processinfo/abf98bfc-9b33-4a87-8e98-92034ba4c946.json +0 -1
  16. /package/.nyc_output/{4e27ec32-531e-430f-99f8-46c68e32bfe9.json → 4cfc833e-a7a5-4b39-8898-5205d5f50aa4.json} +0 -0
  17. /package/.nyc_output/{4f3ff5dc-ec7c-4f15-a43d-bf447b7b6f53.json → 5cd8fa18-60cf-43ac-8ed5-ece5a5c89276.json} +0 -0
  18. /package/.nyc_output/{776a4f66-410c-44c8-923b-4d89e13cd196.json → b15f245b-a738-4773-aef0-9e5c6129f1fc.json} +0 -0
  19. /package/.nyc_output/{8137131a-b80f-48f9-aa70-57700ccb799f.json → e5aa5254-91d5-40d4-b180-1ab5a8432edc.json} +0 -0
  20. /package/.nyc_output/{abf98bfc-9b33-4a87-8e98-92034ba4c946.json → f239fc67-b62d-4250-9d6d-4dd418797460.json} +0 -0
@@ -0,0 +1 @@
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":[]}
@@ -0,0 +1 @@
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":[]}
@@ -0,0 +1 @@
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":[]}
@@ -0,0 +1 @@
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":[]}
@@ -0,0 +1 @@
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":[]}
@@ -1 +1 @@
1
- {"processes":{"4e27ec32-531e-430f-99f8-46c68e32bfe9":{"parent":"776a4f66-410c-44c8-923b-4d89e13cd196","children":[]},"4f3ff5dc-ec7c-4f15-a43d-bf447b7b6f53":{"parent":"776a4f66-410c-44c8-923b-4d89e13cd196","children":[]},"776a4f66-410c-44c8-923b-4d89e13cd196":{"parent":null,"children":["4e27ec32-531e-430f-99f8-46c68e32bfe9","4f3ff5dc-ec7c-4f15-a43d-bf447b7b6f53","8137131a-b80f-48f9-aa70-57700ccb799f","abf98bfc-9b33-4a87-8e98-92034ba4c946"]},"8137131a-b80f-48f9-aa70-57700ccb799f":{"parent":"776a4f66-410c-44c8-923b-4d89e13cd196","children":[]},"abf98bfc-9b33-4a87-8e98-92034ba4c946":{"parent":"776a4f66-410c-44c8-923b-4d89e13cd196","children":[]}},"files":{},"externalIds":{}}
1
+ {"processes":{"4cfc833e-a7a5-4b39-8898-5205d5f50aa4":{"parent":"5cd8fa18-60cf-43ac-8ed5-ece5a5c89276","children":[]},"5cd8fa18-60cf-43ac-8ed5-ece5a5c89276":{"parent":null,"children":["4cfc833e-a7a5-4b39-8898-5205d5f50aa4","b15f245b-a738-4773-aef0-9e5c6129f1fc","e5aa5254-91d5-40d4-b180-1ab5a8432edc","f239fc67-b62d-4250-9d6d-4dd418797460"]},"b15f245b-a738-4773-aef0-9e5c6129f1fc":{"parent":"5cd8fa18-60cf-43ac-8ed5-ece5a5c89276","children":[]},"e5aa5254-91d5-40d4-b180-1ab5a8432edc":{"parent":"5cd8fa18-60cf-43ac-8ed5-ece5a5c89276","children":[]},"f239fc67-b62d-4250-9d6d-4dd418797460":{"parent":"5cd8fa18-60cf-43ac-8ed5-ece5a5c89276","children":[]}},"files":{},"externalIds":{}}
@@ -2,47 +2,18 @@
2
2
  // Use of this source code is governed by a BSD-style
3
3
  // license that can be found in the LICENSE file.
4
4
 
5
- (() => {
6
- // Map multiple JavaScript environments to a single common API,
7
- // preferring web standards over Node.js API.
8
- //
9
- // Environments considered:
10
- // - Browsers
11
- // - Node.js
12
- // - Electron
13
- // - Parcel
14
- // - Webpack
15
-
16
- if (typeof global !== "undefined") {
17
- // global already exists
18
- } else if (typeof window !== "undefined") {
19
- window.global = window;
20
- } else if (typeof self !== "undefined") {
21
- self.global = self;
22
- } else {
23
- throw new Error("cannot export Go (neither global, window nor self is defined)");
24
- }
25
-
26
- if (!global.require && typeof require !== "undefined") {
27
- global.require = require;
28
- }
29
-
30
- if (!global.fs && global.require) {
31
- const fs = require("fs");
32
- if (typeof fs === "object" && fs !== null && Object.keys(fs).length !== 0) {
33
- global.fs = fs;
34
- }
35
- }
5
+ "use strict";
36
6
 
7
+ (() => {
37
8
  const enosys = () => {
38
9
  const err = new Error("not implemented");
39
10
  err.code = "ENOSYS";
40
11
  return err;
41
12
  };
42
13
 
43
- if (!global.fs) {
14
+ if (!globalThis.fs) {
44
15
  let outputBuf = "";
45
- global.fs = {
16
+ globalThis.fs = {
46
17
  constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 }, // unused
47
18
  writeSync(fd, buf) {
48
19
  outputBuf += decoder.decode(buf);
@@ -94,8 +65,8 @@
94
65
  };
95
66
  }
96
67
 
97
- if (!global.process) {
98
- global.process = {
68
+ if (!globalThis.process) {
69
+ globalThis.process = {
99
70
  getuid() { return -1; },
100
71
  getgid() { return -1; },
101
72
  geteuid() { return -1; },
@@ -109,47 +80,26 @@
109
80
  }
110
81
  }
111
82
 
112
- if (!global.crypto && global.require) {
113
- const nodeCrypto = require("crypto");
114
- global.crypto = {
115
- getRandomValues(b) {
116
- nodeCrypto.randomFillSync(b);
117
- },
118
- };
119
- }
120
- if (!global.crypto) {
121
- throw new Error("global.crypto is not available, polyfill required (getRandomValues only)");
83
+ if (!globalThis.crypto) {
84
+ throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");
122
85
  }
123
86
 
124
- if (!global.performance) {
125
- global.performance = {
126
- now() {
127
- const [sec, nsec] = process.hrtime();
128
- return sec * 1000 + nsec / 1000000;
129
- },
130
- };
87
+ if (!globalThis.performance) {
88
+ throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");
131
89
  }
132
90
 
133
- if (!global.TextEncoder && global.require) {
134
- global.TextEncoder = require("util").TextEncoder;
135
- }
136
- if (!global.TextEncoder) {
137
- throw new Error("global.TextEncoder is not available, polyfill required");
91
+ if (!globalThis.TextEncoder) {
92
+ throw new Error("globalThis.TextEncoder is not available, polyfill required");
138
93
  }
139
94
 
140
- if (!global.TextDecoder && global.require) {
141
- global.TextDecoder = require("util").TextDecoder;
142
- }
143
- if (!global.TextDecoder) {
144
- throw new Error("global.TextDecoder is not available, polyfill required");
95
+ if (!globalThis.TextDecoder) {
96
+ throw new Error("globalThis.TextDecoder is not available, polyfill required");
145
97
  }
146
98
 
147
- // End of polyfills for common API.
148
-
149
99
  const encoder = new TextEncoder("utf-8");
150
100
  const decoder = new TextDecoder("utf-8");
151
101
 
152
- global.Go = class {
102
+ globalThis.Go = class {
153
103
  constructor() {
154
104
  this.argv = ["js"];
155
105
  this.env = {};
@@ -170,6 +120,10 @@
170
120
  this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);
171
121
  }
172
122
 
123
+ const setInt32 = (addr, v) => {
124
+ this.mem.setUint32(addr + 0, v, true);
125
+ }
126
+
173
127
  const getInt64 = (addr) => {
174
128
  const low = this.mem.getUint32(addr + 0, true);
175
129
  const high = this.mem.getInt32(addr + 4, true);
@@ -263,7 +217,10 @@
263
217
 
264
218
  const timeOrigin = Date.now() - performance.now();
265
219
  this.importObject = {
266
- go: {
220
+ _gotest: {
221
+ add: (a, b) => a + b,
222
+ },
223
+ gojs: {
267
224
  // Go's SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)
268
225
  // may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported
269
226
  // function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).
@@ -326,7 +283,7 @@
326
283
  this._resume();
327
284
  }
328
285
  },
329
- getInt64(sp + 8) + 1, // setTimeout has been seen to fire up to 1 millisecond early
286
+ getInt64(sp + 8),
330
287
  ));
331
288
  this.mem.setInt32(sp + 16, id, true);
332
289
  },
@@ -506,8 +463,7 @@
506
463
  },
507
464
 
508
465
  "debug": (value) => {
509
- // Disable all logs from the WASM side
510
- // console.log(value);
466
+ console.log(value);
511
467
  },
512
468
  }
513
469
  };
@@ -525,7 +481,7 @@
525
481
  null,
526
482
  true,
527
483
  false,
528
- global,
484
+ globalThis,
529
485
  this,
530
486
  ];
531
487
  this._goRefCounts = new Array(this._values.length).fill(Infinity); // number of references that Go has to a JS value, indexed by reference id
@@ -534,7 +490,7 @@
534
490
  [null, 2],
535
491
  [true, 3],
536
492
  [false, 4],
537
- [global, 5],
493
+ [globalThis, 5],
538
494
  [this, 6],
539
495
  ]);
540
496
  this._idPool = []; // unused ids that have been garbage collected
@@ -577,9 +533,9 @@
577
533
 
578
534
  // The linker guarantees global data starts from at least wasmMinDataAddr.
579
535
  // Keep in sync with cmd/link/internal/ld/data.go:wasmMinDataAddr.
580
- const wasmMinDataAddr = 4096 + 4096;
536
+ const wasmMinDataAddr = 4096 + 8192;
581
537
  if (offset >= wasmMinDataAddr) {
582
- throw new Error("command line too long");
538
+ throw new Error("total length of command line and environment variables exceeds limit");
583
539
  }
584
540
 
585
541
  this._inst.exports.run(argc, argv);
@@ -609,36 +565,4 @@
609
565
  };
610
566
  }
611
567
  }
612
-
613
- if (
614
- typeof module !== "undefined" &&
615
- global.require &&
616
- global.require.main === module &&
617
- global.process &&
618
- global.process.versions &&
619
- !global.process.versions.electron
620
- ) {
621
- if (process.argv.length < 3) {
622
- console.error("usage: go_js_wasm_exec [wasm binary] [arguments]");
623
- process.exit(1);
624
- }
625
-
626
- const go = new Go();
627
- go.argv = process.argv.slice(2);
628
- go.env = Object.assign({ TMPDIR: require("os").tmpdir() }, process.env);
629
- go.exit = process.exit;
630
- WebAssembly.instantiate(fs.readFileSync(process.argv[2]), go.importObject).then((result) => {
631
- process.on("exit", (code) => { // Node.js exits if no event handler is pending
632
- if (code === 0 && !go.exited) {
633
- // deadlock, make Go print error and stack traces
634
- go._pendingEvent = { id: 0 };
635
- go._resume();
636
- }
637
- });
638
- return go.run(result.instance);
639
- }).catch((err) => {
640
- console.error(err);
641
- process.exit(1);
642
- });
643
- }
644
568
  })();
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.6.4",
4
+ "version": "3.7.0",
5
5
  "description": "Bookshop frontend Hugo renderer",
6
6
  "type": "module",
7
7
  "sideEffects": false,
@@ -31,8 +31,8 @@
31
31
  "nyc": "^15.1.0"
32
32
  },
33
33
  "dependencies": {
34
- "@bookshop/helpers": "3.6.4",
35
- "esbuild": "^0.13.10",
34
+ "@bookshop/helpers": "3.7.0",
35
+ "esbuild": "^0.19.3",
36
36
  "fflate": "^0.7.3",
37
37
  "liquidjs": "9.28.0"
38
38
  },
@@ -1 +0,0 @@
1
- {"parent":"776a4f66-410c-44c8-923b-4d89e13cd196","pid":5702,"argv":["/opt/hostedtoolcache/node/16.20.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":1689718015737,"ppid":5691,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/4e27ec32-531e-430f-99f8-46c68e32bfe9.json","externalId":"","uuid":"4e27ec32-531e-430f-99f8-46c68e32bfe9","files":[]}
@@ -1 +0,0 @@
1
- {"parent":"776a4f66-410c-44c8-923b-4d89e13cd196","pid":5724,"argv":["/opt/hostedtoolcache/node/16.20.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":1689718016214,"ppid":5691,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/4f3ff5dc-ec7c-4f15-a43d-bf447b7b6f53.json","externalId":"","uuid":"4f3ff5dc-ec7c-4f15-a43d-bf447b7b6f53","files":[]}
@@ -1 +0,0 @@
1
- {"parent":null,"pid":5691,"argv":["/opt/hostedtoolcache/node/16.20.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":1689718015153,"ppid":5680,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/776a4f66-410c-44c8-923b-4d89e13cd196.json","externalId":"","uuid":"776a4f66-410c-44c8-923b-4d89e13cd196","files":[]}
@@ -1 +0,0 @@
1
- {"parent":"776a4f66-410c-44c8-923b-4d89e13cd196","pid":5708,"argv":["/opt/hostedtoolcache/node/16.20.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":1689718015744,"ppid":5691,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/8137131a-b80f-48f9-aa70-57700ccb799f.json","externalId":"","uuid":"8137131a-b80f-48f9-aa70-57700ccb799f","files":[]}
@@ -1 +0,0 @@
1
- {"parent":"776a4f66-410c-44c8-923b-4d89e13cd196","pid":5730,"argv":["/opt/hostedtoolcache/node/16.20.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":1689718016233,"ppid":5691,"coverageFilename":"/home/runner/work/bookshop/bookshop/javascript-modules/engines/hugo-engine/.nyc_output/abf98bfc-9b33-4a87-8e98-92034ba4c946.json","externalId":"","uuid":"abf98bfc-9b33-4a87-8e98-92034ba4c946","files":[]}