aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-08-07 10:40:54 +0200
committerBjørn Erik Pedersen <[email protected]>2024-08-09 17:18:37 +0200
commit33c0938cd50dd3409f8e94878b97d789cc328f23 (patch)
treefc4cc45265b86746aa37bc3ab4445724d22a98f2 /hugolib
parent0c3a1c7288032401327a9c4d7044e297bf3f7da6 (diff)
downloadhugo-33c0938cd50dd3409f8e94878b97d789cc328f23.tar.gz
hugo-33c0938cd50dd3409f8e94878b97d789cc328f23.zip
Add build time math rendering
While very useful on its own (and combined with the passthrough render hooks), this also serves as a proof of concept of using WASI (WebAssembly System Interface) modules in Hugo. This will be marked _experimental_ in the documentation. Not because it will be removed or changed in a dramatic way, but we need to think a little more how to best set up/configure similar services, define where these WASM files gets stored, maybe we can allow user provided WASM files plugins via Hugo Modules mounts etc. See these issues for more context: * https://github.com/gohugoio/hugo/issues/12736 * https://github.com/gohugoio/hugo/issues/12737 See #11927
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/site_new.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/hugolib/site_new.go b/hugolib/site_new.go
index cb6630cb3..19a7e42d7 100644
--- a/hugolib/site_new.go
+++ b/hugolib/site_new.go
@@ -19,6 +19,7 @@ import (
"fmt"
"html/template"
"os"
+ "path/filepath"
"sort"
"time"
@@ -34,6 +35,7 @@ import (
"github.com/gohugoio/hugo/hugolib/doctree"
"github.com/gohugoio/hugo/hugolib/pagesfromdata"
"github.com/gohugoio/hugo/identity"
+ "github.com/gohugoio/hugo/internal/warpc"
"github.com/gohugoio/hugo/langs"
"github.com/gohugoio/hugo/langs/i18n"
"github.com/gohugoio/hugo/lazy"
@@ -157,6 +159,15 @@ func NewHugoSites(cfg deps.DepsCfg) (*HugoSites, error) {
MemCache: memCache,
TemplateProvider: tplimpl.DefaultTemplateProvider,
TranslationProvider: i18n.NewTranslationProvider(),
+ WasmDispatchers: warpc.AllDispatchers(
+ warpc.Options{
+ CompilationCacheDir: filepath.Join(conf.Dirs().CacheDir, "_warpc"),
+
+ // Katex is relatively slow.
+ PoolSize: 8,
+ Infof: logger.InfoCommand("wasm").Logf,
+ },
+ ),
}
if err := firstSiteDeps.Init(); err != nil {