summaryrefslogtreecommitdiffstats
path: root/hugofs
AgeCommit message (Collapse)Author
2022-09-26Fix /static performance regression from Hugo 0.103.0Bjørn Erik Pedersen
In `v0.103.0` we added support for `resources.PostProcess` for all file types, not just HTML. We had benchmarks that said we were fine in that department, but those did not consider the static file syncing. This fixes that by: * Making sure that the /static syncer always gets its own file system without any checks for the post process token. * For dynamic files (e.g. rendered HTML files) we add an additional check to make sure that we skip binary files (e.g. images) Fixes #10328
2022-09-23Consolidate the glob case logicBjørn Erik Pedersen
Looking at the code as a whole, we ended up with a little to much "buttons". It turns out that doing case insensitive matching (lower both pattern and strings to match) performs just fine. Or at least, it gives the penalty to the people who uses mixed case filenames. ``` GetGlob/Default_cache-10 10.6ns ± 2% 10.6ns ± 1% ~ (p=0.657 n=4+4) GetGlob/Filenames_cache,_lowercase_searchs-10 10.6ns ± 2% 10.6ns ± 0% ~ (p=1.000 n=4+4) GetGlob/Filenames_cache,_mixed_case_searchs-10 29.7ns ± 1% 29.6ns ± 1% ~ (p=0.886 n=4+4) GetGlob/GetGlob-10 13.7ns ± 1% 13.7ns ± 0% ~ (p=0.429 n=4+4) name old alloc/op new alloc/op delta GetGlob/Default_cache-10 0.00B 0.00B ~ (all equal) GetGlob/Filenames_cache,_lowercase_searchs-10 0.00B 0.00B ~ (all equal) GetGlob/Filenames_cache,_mixed_case_searchs-10 5.00B ± 0% 5.00B ± 0% ~ (all equal) GetGlob/GetGlob-10 0.00B 0.00B ~ (all equal) name old allocs/op new allocs/op delta GetGlob/Default_cache-10 0.00 0.00 ~ (all equal) GetGlob/Filenames_cache,_lowercase_searchs-10 0.00 0.00 ~ (all equal) GetGlob/Filenames_cache,_mixed_case_searchs-10 1.00 ± 0% 1.00 ± 0% ~ (all equal) GetGlob/GetGlob-10 ```
2022-09-23hugofs: Fix glob case-sensitivity bugsatotake
On Linux, `hugofs.Glob` does not hit any directories which includes uppercase letters. (This does not happen on macOS.) Since `resources.GetMatch/Match` uses `Glob`, ``` {{ resources.GetMatch "Foo/bar.css" }} ``` this does not match `assets/Foo/bar.css` . On the other hand, you can get it with ``` {{ resources.Get "Foo/bar.css" }} ```
2022-09-14Support PostProcess for all file typesBjørn Erik Pedersen
Not just HTML. Fixes #10269
2022-05-15postcss: Fix import error handlingBjørn Erik Pedersen
Note that we will now fail if `inlineImports` is enabled and we cannot resolve an import. You can work around this by either: * Use url imports or imports with media queries. * Set `skipInlineImportsNotFound=true` in the options Also get the argument order in the different NewFileError* funcs in line. Fixes #9895
2022-05-08Add `clock` cli flagsatotake
Close #8787
2022-05-06Improve error messages, esp. when the server is runningBjørn Erik Pedersen
* Add file context to minifier errors when publishing * Misc fixes (see issues) * Allow custom server error template in layouts/server/error.html To get to this, this commit also cleans up and simplifies the code surrounding errors and files. This also removes the usage of `github.com/pkg/errors`, mostly because of https://github.com/pkg/errors/issues/223 -- but also because most of this is now built-in to Go. Fixes #9852 Fixes #9857 Fixes #9863
2022-04-18Revert "Revert "Fix PostProcess regression for hugo server""Bjørn Erik Pedersen
This reverts commit 6c35a1a9eacf2aa86a11ecd31c4022ce330b2f16. Updates #9794
2022-04-17Revert "Fix PostProcess regression for hugo server"Bjørn Erik Pedersen
This reverts commit 4deb5c60661bdb1d686664f0207f45517a086f29.
2022-04-16Fix PostProcess regression for hugo serverBjørn Erik Pedersen
Fixes #9788
2022-04-10Replace all usage of CopyOnWriteFs with OverlayFsBjørn Erik Pedersen
Fixes #9761
2022-04-08Rework the Destination filesystem to make --renderStaticToDisk workBjørn Erik Pedersen
See #9626
2022-04-08Revert "Revert "Allow rendering static files to disk and dynamic to memory ↵Bjørn Erik Pedersen
in server mode"" This reverts commit 64b7b7a89753a39661219b2fcb92d7f185a03f63.
2022-03-20Make sure file mounts higher up winsBjørn Erik Pedersen
Fixes #9693
2022-03-17all: gofmt -w -r 'interface{} -> any' .Bjørn Erik Pedersen
Updates #9687
2022-03-11Revert "Allow rendering static files to disk and dynamic to memory in server ↵Bjørn Erik Pedersen
mode" This reverts commit 7d8011ed63d587b87a7c182748914fe146590093. Updates #9647
2022-03-08Allow rendering static files to disk and dynamic to memory in server modeSatowTakeshi
Updates #9625
2022-03-04tpl/os: Revert readDir in theme behaviourBjørn Erik Pedersen
Fixes #9599
2022-01-26Fix duplicate mount sourcesBjørn Erik Pedersen
Fixes #9426
2022-01-04Misc depreation updatesBjørn Erik Pedersen
* Deprecate .Page.Path when backed by a file * site.Permalinks * --ignoreVendor (use --ignoreVendorPaths) Closes #9348 Closes #9349
2021-11-16Fix content dir resolution when main project is a Hugo ModuleBjørn Erik Pedersen
Fixes #9177
2021-10-20hugofs: Add includeFiles and excludeFiles to mount configurationBjørn Erik Pedersen
Fixes #9042
2021-10-18Fix the "page picker" logic in --navigateToChangedBjørn Erik Pedersen
Fixes #9051
2021-10-16Reimplement archetypesBjørn Erik Pedersen
The old implementation had some issues, mostly related to the context (e.g. name, file paths) passed to the template. This new implementation is using the exact same code path for evaluating the pages as in a regular build. This also makes it more robust and easier to reason about in a multilingual setup. Now, if you are explicit about the target path, Hugo will now always pick the correct mount and language: ```bash hugo new content/en/posts/my-first-post.md ``` Fixes #9032 Fixes #7589 Fixes #9043 Fixes #9046 Fixes #9047
2021-07-15hugofs: Make FileMeta a structBjørn Erik Pedersen
This commit started out investigating a `concurrent map read write` issue, ending by replacing the map with a struct. This is easier to reason about, and it's more effective: ``` name old time/op new time/op delta SiteNew/Regular_Deep_content_tree-16 71.5ms ± 3% 69.4ms ± 5% ~ (p=0.200 n=4+4) name old alloc/op new alloc/op delta SiteNew/Regular_Deep_content_tree-16 29.7MB ± 0% 27.9MB ± 0% -5.82% (p=0.029 n=4+4) name old allocs/op new allocs/op delta SiteNew/Regular_Deep_content_tree-16 313k ± 0% 303k ± 0% -3.35% (p=0.029 n=4+4) ``` See #8749
2021-06-14Misc config loading fixesBjørn Erik Pedersen
The main motivation behind this is simplicity and correctnes, but the new small config library is also faster: ``` BenchmarkDefaultConfigProvider/Viper-16 252418 4546 ns/op 2720 B/op 30 allocs/op BenchmarkDefaultConfigProvider/Custom-16 450756 2651 ns/op 1008 B/op 6 allocs/op ``` Fixes #8633 Fixes #8618 Fixes #8630 Updates #8591 Closes #6680 Closes #5192
2021-06-05hugofs: Set modTime at creation timeBjørn Erik Pedersen
As `ModTime()` should return the same value on each invocation. See #6161
2021-06-04Fix invalid timestamp of the "public" folderAnthony Fok
Special thanks to both Richard Mortimer (@oldelvet) and Joshua M. Clulow (@jclulow) for their analysis and suggested fix: * https://github.com/gohugoio/hugo/issues/6161#issuecomment-574336088 * https://github.com/gohugoio/hugo/issues/6161#issuecomment-596805273 Fixes #6161
2021-02-16modules: Add config option modules.vendorClosestBjørn Erik Pedersen
Fixes #8235 Fixes #8242
2021-01-19build(deps): bump github.com/spf13/afero from 1.4.1 to 1.5.1Robert-André Mauchin
Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
2020-12-30Add Dart Sass supportBjørn Erik Pedersen
But note that the Dart Sass Embedded Protocol is still in beta (beta 5), a main release scheduled for Q1 2021. Fixes #7380 Fixes #8102
2020-12-16all: Fix minor typosPhil Davis
2020-12-03all: Format code with gofumptBjørn Erik Pedersen
See https://github.com/mvdan/gofumpt
2020-11-03Make js.Build fully support modulesBjørn Erik Pedersen
Fixes #7816 Fixes #7777 Fixes #7916
2020-10-22Allow getJSON errors to be ignoredBjørn Erik Pedersen
This change is mostly motivated to get a more stable CI build (we're building the Hugo site there, with Instagram and Twitter shortcodes sometimes failing). Fixes #7866
2020-10-06Allow cascade to be a slice with a _target discriminatorBjørn Erik Pedersen
Fixes #7782
2020-09-13Add "hugo mod npm pack"Bjørn Erik Pedersen
This commit also introduces a convention where these common JS config files, including `package.hugo.json`, gets mounted into: ``` assets/_jsconfig ´`` These files mapped to their real filename will be added to the environment when running PostCSS, Babel etc., so you can do `process.env.HUGO_FILE_TAILWIND_CONFIG_JS` to resolve the real filename. But do note that `assets` is a composite/union filesystem, so if your config file is not meant to be overridden, name them something specific. This commit also adds adds `workDir/node_modules` to `NODE_PATH` and `HUGO_WORKDIR` to the env when running the JS tools above. Fixes #7644 Fixes #7656 Fixes #7675
2020-06-11hugofs: Use os.PathError in RootMappingFs.doLstatRaphael Krupinski
2020-03-19Pass directory name to filters in LstatIfPossible in the same way as ReaddirEvan Anderson
2020-03-09Fix handling of HTML files without front matterBjørn Erik Pedersen
This means that any HTML file inside /content will be treated as a regular file. If you want it processes with shortcodes and a layout, add front matter. The defintion of an HTML file here is: * File with extension .htm or .html * With first non-whitespace character "<" that isn't a HTML comment. This is in line with the documentation. Fixes #7030 Fixes #7028 See #6789
2020-02-19modules: Improve "hugo mod clean"Bjørn Erik Pedersen
* Only clean project modules * Optional glob pattern of module paths to clean Closes #6907
2020-02-19commands: Add "hugo mod verify"Bjørn Erik Pedersen
See #6907
2020-02-18Introduce a tree map for all contentBjørn Erik Pedersen
This commit introduces a new data structure to store pages and their resources. This data structure is backed by radix trees. This simplies tree operations, makes all pages a bundle, and paves the way for #6310. It also solves a set of annoying issues (see list below). Not a motivation behind this, but this commit also makes Hugo in general a little bit faster and more memory effective (see benchmarks). Especially for partial rebuilds on content edits, but also when taxonomies is in use. ``` name old time/op new time/op delta SiteNew/Bundle_with_image/Edit-16 1.32ms ± 8% 1.00ms ± 9% -24.42% (p=0.029 n=4+4) SiteNew/Bundle_with_JSON_file/Edit-16 1.28ms ± 0% 0.94ms ± 0% -26.26% (p=0.029 n=4+4) SiteNew/Tags_and_categories/Edit-16 33.9ms ± 2% 21.8ms ± 1% -35.67% (p=0.029 n=4+4) SiteNew/Canonify_URLs/Edit-16 40.6ms ± 1% 37.7ms ± 3% -7.20% (p=0.029 n=4+4) SiteNew/Deep_content_tree/Edit-16 56.7ms ± 0% 51.7ms ± 1% -8.82% (p=0.029 n=4+4) SiteNew/Many_HTML_templates/Edit-16 19.9ms ± 2% 18.3ms ± 3% -7.64% (p=0.029 n=4+4) SiteNew/Page_collections/Edit-16 37.9ms ± 4% 34.0ms ± 2% -10.28% (p=0.029 n=4+4) SiteNew/Bundle_with_image-16 10.7ms ± 0% 10.6ms ± 0% -1.15% (p=0.029 n=4+4) SiteNew/Bundle_with_JSON_file-16 10.8ms ± 0% 10.7ms ± 0% -1.05% (p=0.029 n=4+4) SiteNew/Tags_and_categories-16 43.2ms ± 1% 39.6ms ± 1% -8.35% (p=0.029 n=4+4) SiteNew/Canonify_URLs-16 47.6ms ± 1% 47.3ms ± 0% ~ (p=0.057 n=4+4) SiteNew/Deep_content_tree-16 73.0ms ± 1% 74.2ms ± 1% ~ (p=0.114 n=4+4) SiteNew/Many_HTML_templates-16 37.9ms ± 0% 38.1ms ± 1% ~ (p=0.114 n=4+4) SiteNew/Page_collections-16 53.6ms ± 1% 54.7ms ± 1% +2.09% (p=0.029 n=4+4) name old alloc/op new alloc/op delta SiteNew/Bundle_with_image/Edit-16 486kB ± 0% 430kB ± 0% -11.47% (p=0.029 n=4+4) SiteNew/Bundle_with_JSON_file/Edit-16 265kB ± 0% 209kB ± 0% -21.06% (p=0.029 n=4+4) SiteNew/Tags_and_categories/Edit-16 13.6MB ± 0% 8.8MB ± 0% -34.93% (p=0.029 n=4+4) SiteNew/Canonify_URLs/Edit-16 66.5MB ± 0% 63.9MB ± 0% -3.95% (p=0.029 n=4+4) SiteNew/Deep_content_tree/Edit-16 28.8MB ± 0% 25.8MB ± 0% -10.55% (p=0.029 n=4+4) SiteNew/Many_HTML_templates/Edit-16 6.16MB ± 0% 5.56MB ± 0% -9.86% (p=0.029 n=4+4) SiteNew/Page_collections/Edit-16 16.9MB ± 0% 16.0MB ± 0% -5.19% (p=0.029 n=4+4) SiteNew/Bundle_with_image-16 2.28MB ± 0% 2.29MB ± 0% +0.35% (p=0.029 n=4+4) SiteNew/Bundle_with_JSON_file-16 2.07MB ± 0% 2.07MB ± 0% ~ (p=0.114 n=4+4) SiteNew/Tags_and_categories-16 14.3MB ± 0% 13.2MB ± 0% -7.30% (p=0.029 n=4+4) SiteNew/Canonify_URLs-16 69.1MB ± 0% 69.0MB ± 0% ~ (p=0.343 n=4+4) SiteNew/Deep_content_tree-16 31.3MB ± 0% 31.8MB ± 0% +1.49% (p=0.029 n=4+4) SiteNew/Many_HTML_templates-16 10.8MB ± 0% 10.9MB ± 0% +1.11% (p=0.029 n=4+4) SiteNew/Page_collections-16 21.4MB ± 0% 21.6MB ± 0% +1.15% (p=0.029 n=4+4) name old allocs/op new allocs/op delta SiteNew/Bundle_with_image/Edit-16 4.74k ± 0% 3.86k ± 0% -18.57% (p=0.029 n=4+4) SiteNew/Bundle_with_JSON_file/Edit-16 4.73k ± 0% 3.85k ± 0% -18.58% (p=0.029 n=4+4) SiteNew/Tags_and_categories/Edit-16 301k ± 0% 198k ± 0% -34.14% (p=0.029 n=4+4) SiteNew/Canonify_URLs/Edit-16 389k ± 0% 373k ± 0% -4.07% (p=0.029 n=4+4) SiteNew/Deep_content_tree/Edit-16 338k ± 0% 262k ± 0% -22.63% (p=0.029 n=4+4) SiteNew/Many_HTML_templates/Edit-16 102k ± 0% 88k ± 0% -13.81% (p=0.029 n=4+4) SiteNew/Page_collections/Edit-16 176k ± 0% 152k ± 0% -13.32% (p=0.029 n=4+4) SiteNew/Bundle_with_image-16 26.8k ± 0% 26.8k ± 0% +0.05% (p=0.029 n=4+4) SiteNew/Bundle_with_JSON_file-16 26.8k ± 0% 26.8k ± 0% +0.05% (p=0.029 n=4+4) SiteNew/Tags_and_categories-16 273k ± 0% 245k ± 0% -10.36% (p=0.029 n=4+4) SiteNew/Canonify_URLs-16 396k ± 0% 398k ± 0% +0.39% (p=0.029 n=4+4) SiteNew/Deep_content_tree-16 317k ± 0% 325k ± 0% +2.53% (p=0.029 n=4+4) SiteNew/Many_HTML_templates-16 146k ± 0% 147k ± 0% +0.98% (p=0.029 n=4+4) SiteNew/Page_collections-16 210k ± 0% 215k ± 0% +2.44% (p=0.029 n=4+4) ``` Fixes #6312 Fixes #6087 Fixes #6738 Fixes #6412 Fixes #6743 Fixes #6875 Fixes #6034 Fixes #6902 Fixes #6173 Fixes #6590
2020-02-09hugofs: Fix mount with hole regressionBjørn Erik Pedersen
Fixes #6854
2020-02-09Fix bundle resource ordering regressionBjørn Erik Pedersen
Introduced in Hugo 0.64.0 Fixes #6851
2020-02-04Fix module mount in sub folderBjørn Erik Pedersen
This addresses a specific issue, but is a also a major simplification of the filesystem file mounts. Fixes #6730
2020-01-23Fix 0.62.1 server rebuild slowdown regressionBjørn Erik Pedersen
Fixes #6784
2020-01-01Support files in content mountsBjørn Erik Pedersen
This commit is a general improvement of handling if single file mounts. Fixes #6684 Fixes #6696
2019-10-31hugofs: Fix crash in multilingual content fsBjørn Erik Pedersen
Fixes #6463
2019-10-09hugofs: Add FileMeta.StringBjørn Erik Pedersen
To make the page listing easier to compare.