Commit graph

18 commits

Author SHA1 Message Date
Joe Mooring
503dcf6252 internal/warpc: Enable KaTeX mhchem extension 2025-02-14 10:04:15 +01:00
Bjørn Erik Pedersen
d25f7ec172 js/esbuild: Add drop option
Fixes #13362
2025-02-13 13:26:46 +01:00
Bjørn Erik Pedersen
020253904f js/esbuild: Don't try to resolve packages in /assets marked as external
Fixes #13183
2024-12-22 21:29:18 +01:00
Bjørn Erik Pedersen
5c80cb0d20
js/esbuild: Add missing es2024 target 2024-12-17 14:35:13 +01:00
Bjørn Erik Pedersen
a5e5be234c Fix panic on server rebuilds when using both base templates and template.Defer
Fixes #12963
2024-12-16 18:03:04 +01:00
Bjørn Erik Pedersen
565c30eac9 js: Fix js.Batch for multihost setups
Note that this is an unreleased feature.

Fixes #13151
2024-12-16 11:52:18 +01:00
Bjørn Erik Pedersen
744b8566ec Fix a rebuild on resource rename case 2024-12-16 08:33:10 +01:00
Bjørn Erik Pedersen
7de5317aef js/esbuild: Add runners after scripts 2024-12-16 08:33:10 +01:00
Bjørn Erik Pedersen
4cbd4ef991 js/esbuild: Batch: Avoid nil Instances slice
Ranging over a nil slice in Go works great, but is a hassle onced passed to JS.
2024-12-16 08:33:10 +01:00
Bjørn Erik Pedersen
a834bb9f7e js/esbuild: Build groups in order of their ID
We already do this for scripts e.g. inside a group.

This makes sure that group A's entry points gets added before B's, which can be an important property, see https://github.com/evanw/esbuild/issues/399#issuecomment-1458680887
2024-12-13 13:29:35 +01:00
Bjørn Erik Pedersen
ec1933f79d js/esbuild: Add platform option
Closes #13136
2024-12-12 22:53:15 +01:00
Bjørn Erik Pedersen
e293e7ca6d Add js.Batch
Fixes #12626
Closes #7499
Closes #9978
Closes #12879
Closes #13113
Fixes #13116
2024-12-12 21:43:17 +01:00
Bjørn Erik Pedersen
28f621d4a7 internal/warpc: Improve the JS plugin API
* Move the error handling into commons and make sure the error returned also returns message errors
* Make the protocol version an int so it can be more easily compared
2024-09-12 13:51:37 +02:00
Bjørn Erik Pedersen
2192cf7ec1
internal/warpc: Add license headers 2024-08-12 15:50:29 +02:00
Bjørn Erik Pedersen
e1e1baa1bd Improve Katex error handling and fix handling of large expressions
* Make throwOnError=true the new default
* Handle JS errors as part of the RPC request/response flow
* Return a new Result type with .Err on it

This enables constructs on the form:

```handlebars
{{ with transform.ToMath "c = \\foo{a^2 + b^2}" }}
	{{ with .Err }}
	 	{{ warnf "error: %s" . }}
	{{ else }}
		{{ . }}
	{{ end }}
{{ end }}
```

Note that the new `Result` type behaves like `template.HTML` (or a string if needed) when printed, but it will panic if in a error state.

Closes #12748
2024-08-12 13:50:18 +02:00
Bjørn Erik Pedersen
e42263529c
Add katex option ThrowOnError
As an internal option for now. Katex misbehaves in error situations without a value set.
2024-08-11 20:57:15 +02:00
Bjørn Erik Pedersen
891aa00fe1 Add some more KaTeX options
And fix the options handling.

Closes #12745
Fixes #12746
2024-08-11 19:03:27 +02:00
Bjørn Erik Pedersen
33c0938cd5 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
2024-08-09 17:18:37 +02:00