Commit graph

6872 commits

Author SHA1 Message Date
Paul Gottschling
e03f82eef2
Pass minification errors to the user
Previously, *minifyTransformation.Transform suppressed the
error returned by t.m.Minify. This meant that when minification
returned an error, the error would not reach the user. Instead,
minification would silently fail. For example, if a JavaScript
file included a call to the Date constructor with:

new Date(2020, 04, 02)

The package that the minification library uses to parse JS files,
github.com/tdewolff/parse would return an error, since "04" would
be parsed as a legacy octal. However, the JS file would remain
un-minified with no error.

Fixing this is not as simple as replacing "_" with an "err" in
*minifyTransformation.Transform, however (though this is
necessary). If we only returned this error from Transform,
then hugolib.TestResourceMinifyDisabled would fail. Instead of
being a no-op, as TestResourceMinifyDisabled expects, using the
"minify" template function with a "disableXML=true" config
setting instead returns the error, "minifier does not exist for
mimetype."

The "minifier does not exist" error is returned because of the
way minifiers.New works. If the user's config disables
minification for a particular MIME type, minifiers.New does
not add it to the resulting Client's *minify.M. However, this
also means that when the "minify" template function is executed,
 a *resourceAdapter's transformations still add a minification.
When it comes time to call the minify.Minifier for a specific
MIME type via *M.MinifyMimetype, the github.com/tdewolff/minify
library throws the "does not exist" error for the missing MIME
type.

The solution was to change minifiers.New so, instead of skipping
a minifier for each disabled MIME type, it adds  a NoOpMinifier,
which simply copies the source to the destination without
minification. This means that when the "minify" template
function is used for a particular resource, and that resource's
MIME type has minification disabled, minification is genuinely
skipped, and does not result in an error.

In order to add this, I've fixed a possibly unwanted interaction
between minifiers.TestConfigureMinify and
hugolib.TestResourceMinifyDisabled. The latter disables
minification and expects minification to be a no-op. The former
disables minification and expects it to result in an error. The
only reason hugolib.TestResourceMinifyDisabled passes in the
original code is that the "does not exist" error is suppressed.
However, we shouldn't suppress minification errors, since they
can leave users perplexed. I've changed the test assertion in
minifiers.TestConfigureMinify to expect no errors and a no-op
if minification is disabled for a particular MIME type.

Fixes #8954
2021-09-22 20:54:40 +02:00
Paul Gottschling
a864ffe9ac Clarify "precision" in currency format functions
The documentation of the FormatAccounting and FormatCurrency
functions could be clearer in terms of how the precision param
works. This commit makes it more explicit that adding a precision
of < 2 will not format the return values to include fewer decimals.

Resolves #8858
2021-09-22 20:00:30 +02:00
dependabot[bot]
b49da33280 build(deps): bump github.com/evanw/esbuild from 0.12.24 to 0.12.29
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.12.24 to 0.12.29.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.12.24...v0.12.29)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-22 20:00:05 +02:00
Emmanuel T Odeke
7c21eca74f
resources: Use default math/rand.Source for concurrency safety
The source from NewSource is documented not to be safe for
concurrency, and instead use the eefault source which is documented
as safe.

Fixes #8981
2021-09-19 12:18:30 +02:00
Bjørn Erik Pedersen
13ad8408fc
commands: Make the error handling for the mod commands more lenient
So it at least is possible to do a `hugo mod clean --all` if the cache is in a funky state.
2021-09-17 17:16:34 +02:00
Bjørn Erik Pedersen
1cabf61ddf
modules: Add some help text to the 'unknown revision' error
I had a head scratching moment with this myself, so it's safe to say that others will.

See #6825
2021-09-17 09:34:35 +02:00
Joe Mooring
268e3069f3 deps: Update github.com/yuin/goldmark v1.4.0 => v1.4.1
Fixes #8855
2021-09-12 21:55:37 +02:00
hugoreleaser
3efc2e2af8 releaser: Prepare repository for 0.89.0-DEV
[ci skip]
2021-09-04 10:33:09 +00:00
hugoreleaser
5bc547389a releaser: Add release notes to /docs for release of 0.88.1
[ci skip]
2021-09-04 09:39:19 +00:00
hugoreleaser
bb3254385a releaser: Bump versions for release of 0.88.1
[ci skip]
2021-09-04 09:39:19 +00:00
hugoreleaser
9b1d6d7e30 releaser: Add release notes for 0.88.1
[ci skip]
2021-09-04 09:39:19 +00:00
Bjørn Erik Pedersen
e1ead4dbca
Bump down again to Go 1.16.7 for the release builds
Note that this commit has nothing to do with "Hugo not working with Go 1.17", but this is the simplest fix of some build related issues in Hugo 0.88.0.

Updates #8952
Updates #8955
2021-09-04 11:22:51 +02:00
hugoreleaser
5b59b9c171 releaser: Prepare repository for 0.89.0-DEV
[ci skip]
2021-09-02 09:57:36 +00:00
hugoreleaser
acc5eb5b51 releaser: Add release notes to /docs for release of 0.88.0
[ci skip]
2021-09-02 09:27:27 +00:00
hugoreleaser
6cacfa329c releaser: Bump versions for release of 0.88.0
[ci skip]
2021-09-02 09:27:27 +00:00
Bjørn Erik Pedersen
4d03cd780e
Release 0.88.0 2021-09-02 11:11:08 +02:00
Bjørn Erik Pedersen
8b14fdbf89
Update 0.88.0-relnotes.md
[ci skip]
2021-09-02 11:10:40 +02:00
hugoreleaser
fc21b63b46 releaser: Add release notes for 0.88.0
Rename to *-ready.md to continue.
[ci skip]
2021-09-02 08:09:25 +00:00
Bjørn Erik Pedersen
6631c9c7e0
Run go mod tidy 2021-09-01 10:48:13 +02:00
Bjørn Erik Pedersen
cf73cc2ece js: Fix import order for ./foo when both ./foo.js and ./foo/index.js exists
This is in line with how both Node and ESBuild's native import resolver does it.

The ambiguous situations above were discovered trying to build AlpineJS v3.

Note that the above was never an issue if you used `./foo.js` and similar to import the component.

Fixes #8945
2021-09-01 10:47:41 +02:00
Bjørn Erik Pedersen
7d1f806ecb commands: Don't fail on template errors on go mod graph etc.
Fixes #8942
2021-08-31 22:16:12 +02:00
dependabot[bot]
04b5959961 build(deps): bump github.com/getkin/kin-openapi from 0.74.0 to 0.75.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.74.0 to 0.75.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.74.0...v0.75.0)

---
updated-dependencies:
- dependency-name: github.com/getkin/kin-openapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-31 12:11:39 +02:00
dependabot[bot]
c278b6e45d build(deps): bump github.com/frankban/quicktest from 1.13.0 to 1.13.1
Bumps [github.com/frankban/quicktest](https://github.com/frankban/quicktest) from 1.13.0 to 1.13.1.
- [Release notes](https://github.com/frankban/quicktest/releases)
- [Commits](https://github.com/frankban/quicktest/compare/v1.13.0...v1.13.1)

---
updated-dependencies:
- dependency-name: github.com/frankban/quicktest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-31 12:11:08 +02:00
dependabot[bot]
107c86febb build(deps): bump github.com/evanw/esbuild from 0.12.22 to 0.12.24
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.12.22 to 0.12.24.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.12.22...v0.12.24)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-31 12:10:32 +02:00
Bjørn Erik Pedersen
a0489c2dfd
Avoid failing with "module not found" for hugo mod init and similar
Fixes #8940
2021-08-31 12:08:11 +02:00
Bjørn Erik Pedersen
0fc2ce9e4b
Update to Go 1.17
Go 1.17 now lazy-loads dependencies when `go.mod` is version `go17`. This does not work for us for new projects started with `hugo mod init`.

Before this commit, starting a project with Go 1.17 with `hugo mod init` and then start adding dependencies with transitive dependenies to `config.toml` would treat the transitive dependencies as new, and you would potentially get a too recent version of those.

Note that this does not effect existing projects, where all dependencies are already recorded in `go.mod`.

Fixes #8930
2021-08-31 11:19:51 +02:00
Anthony Fok
32569285c1
Remove Pygments from snapcraft.yml
Pygments support was removed in Hugo v0.60.0
2021-08-25 10:43:32 -06:00
Bjørn Erik Pedersen
5a46eefbc6
Revert "build(deps): bump github.com/fsnotify/fsnotify from 1.4.9 to 1.5.0"
This reverts commit f70165242b.

Closes #8920
2021-08-23 18:20:29 +02:00
Helder Pereira
7a15edafe2 highlight: Add tabindex when code is not highlighted 2021-08-23 12:28:45 +02:00
dependabot[bot]
2f0945bafe build(deps): bump github.com/evanw/esbuild from 0.12.17 to 0.12.22
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.12.17 to 0.12.22.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.12.17...v0.12.22)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-22 13:58:10 +02:00
Bjørn Erik Pedersen
f4ffeea71d Fix it so disableKinds etc. does not get merged in from theme
Unless the merge strategy is set up to do so.

For `disableKinds` the current workaround is to make sure the project config has an entry, even if is empty:

```
disableKinds = []
```

Note that this issue only touches root, non-map config-values that either is not set in project config or in Hugo's defaults.

Fixes #8866
2021-08-22 13:25:20 +02:00
dependabot[bot]
7ba3f3d201 build(deps): bump golang.org/x/text from 0.3.6 to 0.3.7
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.3.6 to 0.3.7.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.3.6...v0.3.7)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-22 12:52:31 +02:00
dependabot[bot]
f70165242b build(deps): bump github.com/fsnotify/fsnotify from 1.4.9 to 1.5.0
Bumps [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) from 1.4.9 to 1.5.0.
- [Release notes](https://github.com/fsnotify/fsnotify/releases)
- [Changelog](https://github.com/fsnotify/fsnotify/blob/master/CHANGELOG.md)
- [Commits](https://github.com/fsnotify/fsnotify/compare/v1.4.9...v1.5.0)

---
updated-dependencies:
- dependency-name: github.com/fsnotify/fsnotify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-22 12:52:04 +02:00
Bjørn Erik Pedersen
bc0743ed8e Prevent minifier from removing quoutes around post-processed attributes
Fixes #8884
2021-08-22 12:47:47 +02:00
Bjørn Erik Pedersen
ffa2fe6117
Revert "commands: Avoid too many watch file handles causing the server to fail to start"
This reverts commit 3f38c785b7.
2021-08-21 16:32:20 +02:00
Helder Pereira
d966f5d08d highlight: Remove some pygments references 2021-08-21 15:50:49 +02:00
Shiming Zhang
3f38c785b7
commands: Avoid too many watch file handles causing the server to fail to start
Fixes #8904
2021-08-19 11:04:09 +02:00
dependabot[bot]
24589c0814 build(deps): bump github.com/getkin/kin-openapi from 0.68.0 to 0.74.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.68.0 to 0.74.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.68.0...v0.74.0)

---
updated-dependencies:
- dependency-name: github.com/getkin/kin-openapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-17 10:50:10 +02:00
Bjørn Erik Pedersen
efebd756eb
deps: Update github.com/spf13/cast v1.4.0 => v1.4.1
Closes #8891
2021-08-16 09:16:41 +02:00
Bjørn Erik Pedersen
58b6742cfe
Import time/tzdata on Windows
Updates #8892
2021-08-14 12:09:41 +02:00
Bjørn Erik Pedersen
32ead4b1e7
releaser: Bump to Go 1.16.7 2021-08-10 14:00:49 +02:00
Bjørn Erik Pedersen
abd969a670
Revert "tpl/time: Handle nil values in time.AsTime"
This reverts commit 3e11072892.
2021-08-10 13:21:49 +02:00
Bjørn Erik Pedersen
3e11072892
tpl/time: Handle nil values in time.AsTime
Closes #8865
2021-08-09 18:44:35 +02:00
Bjørn Erik Pedersen
9bba9a3a98
parser: Indent TOML tables
Fixes #8850
2021-08-04 11:39:16 +02:00
Salim B
d6c8cd7718 Fix lang.FormatPercent description
Successor PR for https://github.com/gohugoio/hugoDocs/pull/1504
2021-08-03 16:56:06 +02:00
hugoreleaser
dfe54d3216 releaser: Prepare repository for 0.88.0-DEV
[ci skip]
2021-08-03 12:11:56 +00:00
hugoreleaser
b0c541e496 releaser: Add release notes to /docs for release of 0.87.0
[ci skip]
2021-08-03 10:57:26 +00:00
hugoreleaser
2ed7be295c releaser: Bump versions for release of 0.87.0
[ci skip]
2021-08-03 10:57:26 +00:00
Bjørn Erik Pedersen
d9d1ef8b07
Release 0.87 2021-08-03 12:42:22 +02:00
Bjørn Erik Pedersen
ec1c1c3459
Merge branch 'b087' into release-0.87.0 2021-08-03 12:38:58 +02:00