2018-11-08 04:24:13 -05:00
|
|
|
// Copyright 2018 The Hugo Authors. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
package filecache_test
|
2018-11-08 04:24:13 -05:00
|
|
|
|
|
|
|
import (
|
2019-10-21 03:37:46 -04:00
|
|
|
"errors"
|
2018-11-08 04:24:13 -05:00
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"path/filepath"
|
|
|
|
"strings"
|
|
|
|
"sync"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
"github.com/gohugoio/hugo/cache/filecache"
|
2018-11-08 04:24:13 -05:00
|
|
|
"github.com/gohugoio/hugo/common/hugio"
|
|
|
|
"github.com/gohugoio/hugo/config"
|
2023-01-04 12:24:36 -05:00
|
|
|
"github.com/gohugoio/hugo/config/testconfig"
|
2018-11-23 03:16:42 -05:00
|
|
|
"github.com/gohugoio/hugo/helpers"
|
|
|
|
|
2018-11-08 04:24:13 -05:00
|
|
|
"github.com/gohugoio/hugo/hugofs"
|
|
|
|
"github.com/spf13/afero"
|
|
|
|
|
2019-08-10 15:05:17 -04:00
|
|
|
qt "github.com/frankban/quicktest"
|
2018-11-08 04:24:13 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestFileCache(t *testing.T) {
|
|
|
|
t.Parallel()
|
2019-08-10 15:05:17 -04:00
|
|
|
c := qt.New(t)
|
2018-11-08 04:24:13 -05:00
|
|
|
|
2023-02-18 17:43:26 -05:00
|
|
|
tempWorkingDir := t.TempDir()
|
|
|
|
tempCacheDir := t.TempDir()
|
2018-12-04 04:52:04 -05:00
|
|
|
|
|
|
|
osfs := afero.NewOsFs()
|
|
|
|
|
|
|
|
for _, test := range []struct {
|
|
|
|
cacheDir string
|
|
|
|
workingDir string
|
|
|
|
}{
|
2018-12-04 12:19:37 -05:00
|
|
|
// Run with same dirs twice to make sure that works.
|
|
|
|
{tempCacheDir, tempWorkingDir},
|
2018-12-04 04:52:04 -05:00
|
|
|
{tempCacheDir, tempWorkingDir},
|
|
|
|
} {
|
2018-11-08 04:24:13 -05:00
|
|
|
|
|
|
|
configStr := `
|
2018-12-04 04:52:04 -05:00
|
|
|
workingDir = "WORKING_DIR"
|
2018-11-14 05:53:45 -05:00
|
|
|
resourceDir = "resources"
|
2018-11-08 04:24:13 -05:00
|
|
|
cacheDir = "CACHEDIR"
|
2018-11-23 03:16:42 -05:00
|
|
|
contentDir = "content"
|
|
|
|
dataDir = "data"
|
|
|
|
i18nDir = "i18n"
|
|
|
|
layoutDir = "layouts"
|
|
|
|
assetDir = "assets"
|
|
|
|
archeTypedir = "archetypes"
|
|
|
|
|
2018-11-08 04:24:13 -05:00
|
|
|
[caches]
|
|
|
|
[caches.getJSON]
|
2018-11-14 04:51:41 -05:00
|
|
|
maxAge = "10h"
|
2018-11-08 04:24:13 -05:00
|
|
|
dir = ":cacheDir/c"
|
|
|
|
|
|
|
|
`
|
2018-12-04 04:52:04 -05:00
|
|
|
|
|
|
|
winPathSep := "\\\\"
|
|
|
|
|
|
|
|
replacer := strings.NewReplacer("CACHEDIR", test.cacheDir, "WORKING_DIR", test.workingDir)
|
|
|
|
|
|
|
|
configStr = replacer.Replace(configStr)
|
|
|
|
configStr = strings.Replace(configStr, "\\", winPathSep, -1)
|
2018-11-08 04:24:13 -05:00
|
|
|
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
p := newPathsSpec(t, osfs, configStr)
|
2018-11-08 04:24:13 -05:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
caches, err := filecache.NewCaches(p)
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(err, qt.IsNil)
|
2018-11-08 04:24:13 -05:00
|
|
|
|
2018-12-04 04:52:04 -05:00
|
|
|
cache := caches.Get("GetJSON")
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(cache, qt.Not(qt.IsNil))
|
2018-11-08 04:24:13 -05:00
|
|
|
|
2018-12-04 04:52:04 -05:00
|
|
|
bfs, ok := cache.Fs.(*afero.BasePathFs)
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(ok, qt.Equals, true)
|
2018-11-08 04:24:13 -05:00
|
|
|
filename, err := bfs.RealPath("key")
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(err, qt.IsNil)
|
2018-11-08 04:24:13 -05:00
|
|
|
|
2018-12-04 04:52:04 -05:00
|
|
|
cache = caches.Get("Images")
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(cache, qt.Not(qt.IsNil))
|
2018-12-04 04:52:04 -05:00
|
|
|
bfs, ok = cache.Fs.(*afero.BasePathFs)
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(ok, qt.Equals, true)
|
2018-11-14 05:53:45 -05:00
|
|
|
filename, _ = bfs.RealPath("key")
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(filename, qt.Equals, filepath.FromSlash("_gen/images/key"))
|
2018-11-14 05:53:45 -05:00
|
|
|
|
2018-11-08 04:24:13 -05:00
|
|
|
rf := func(s string) func() (io.ReadCloser, error) {
|
|
|
|
return func() (io.ReadCloser, error) {
|
|
|
|
return struct {
|
|
|
|
io.ReadSeeker
|
|
|
|
io.Closer
|
|
|
|
}{
|
|
|
|
strings.NewReader(s),
|
2023-02-18 17:43:26 -05:00
|
|
|
io.NopCloser(nil),
|
2018-11-08 04:24:13 -05:00
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bf := func() ([]byte, error) {
|
|
|
|
return []byte("bcd"), nil
|
|
|
|
}
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
for _, ca := range []*filecache.Cache{caches.ImageCache(), caches.AssetsCache(), caches.GetJSONCache(), caches.GetCSVCache()} {
|
2018-12-04 04:52:04 -05:00
|
|
|
for i := 0; i < 2; i++ {
|
2019-08-10 15:05:17 -04:00
|
|
|
info, r, err := ca.GetOrCreate("a", rf("abc"))
|
|
|
|
c.Assert(err, qt.IsNil)
|
|
|
|
c.Assert(r, qt.Not(qt.IsNil))
|
|
|
|
c.Assert(info.Name, qt.Equals, "a")
|
2023-02-18 17:43:26 -05:00
|
|
|
b, _ := io.ReadAll(r)
|
2018-12-04 04:52:04 -05:00
|
|
|
r.Close()
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(string(b), qt.Equals, "abc")
|
2018-12-04 04:52:04 -05:00
|
|
|
|
2019-08-10 15:05:17 -04:00
|
|
|
info, b, err = ca.GetOrCreateBytes("b", bf)
|
|
|
|
c.Assert(err, qt.IsNil)
|
|
|
|
c.Assert(r, qt.Not(qt.IsNil))
|
|
|
|
c.Assert(info.Name, qt.Equals, "b")
|
|
|
|
c.Assert(string(b), qt.Equals, "bcd")
|
2018-12-04 04:52:04 -05:00
|
|
|
|
2019-08-10 15:05:17 -04:00
|
|
|
_, b, err = ca.GetOrCreateBytes("a", bf)
|
|
|
|
c.Assert(err, qt.IsNil)
|
|
|
|
c.Assert(string(b), qt.Equals, "abc")
|
2018-12-04 04:52:04 -05:00
|
|
|
|
2019-08-10 15:05:17 -04:00
|
|
|
_, r, err = ca.GetOrCreate("a", rf("bcd"))
|
|
|
|
c.Assert(err, qt.IsNil)
|
2023-02-18 17:43:26 -05:00
|
|
|
b, _ = io.ReadAll(r)
|
2018-12-04 04:52:04 -05:00
|
|
|
r.Close()
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(string(b), qt.Equals, "abc")
|
2018-12-04 04:52:04 -05:00
|
|
|
}
|
2018-11-08 04:24:13 -05:00
|
|
|
}
|
|
|
|
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(caches.Get("getJSON"), qt.Not(qt.IsNil))
|
2018-11-08 04:24:13 -05:00
|
|
|
|
|
|
|
info, w, err := caches.ImageCache().WriteCloser("mykey")
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(err, qt.IsNil)
|
|
|
|
c.Assert(info.Name, qt.Equals, "mykey")
|
2018-11-08 04:24:13 -05:00
|
|
|
io.WriteString(w, "Hugo is great!")
|
|
|
|
w.Close()
|
2023-01-04 12:24:36 -05:00
|
|
|
c.Assert(caches.ImageCache().GetString("mykey"), qt.Equals, "Hugo is great!")
|
2018-11-08 04:24:13 -05:00
|
|
|
|
|
|
|
info, r, err := caches.ImageCache().Get("mykey")
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(err, qt.IsNil)
|
|
|
|
c.Assert(r, qt.Not(qt.IsNil))
|
|
|
|
c.Assert(info.Name, qt.Equals, "mykey")
|
2023-02-18 17:43:26 -05:00
|
|
|
b, _ := io.ReadAll(r)
|
2018-11-08 04:24:13 -05:00
|
|
|
r.Close()
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(string(b), qt.Equals, "Hugo is great!")
|
2018-11-08 04:24:13 -05:00
|
|
|
|
|
|
|
info, b, err = caches.ImageCache().GetBytes("mykey")
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(err, qt.IsNil)
|
|
|
|
c.Assert(info.Name, qt.Equals, "mykey")
|
|
|
|
c.Assert(string(b), qt.Equals, "Hugo is great!")
|
2018-11-08 04:24:13 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestFileCacheConcurrent(t *testing.T) {
|
|
|
|
t.Parallel()
|
|
|
|
|
2019-08-10 15:05:17 -04:00
|
|
|
c := qt.New(t)
|
2018-11-08 04:24:13 -05:00
|
|
|
|
|
|
|
configStr := `
|
2018-11-14 05:53:45 -05:00
|
|
|
resourceDir = "myresources"
|
2018-11-23 03:16:42 -05:00
|
|
|
contentDir = "content"
|
|
|
|
dataDir = "data"
|
|
|
|
i18nDir = "i18n"
|
|
|
|
layoutDir = "layouts"
|
|
|
|
assetDir = "assets"
|
|
|
|
archeTypedir = "archetypes"
|
|
|
|
|
2018-11-08 04:24:13 -05:00
|
|
|
[caches]
|
|
|
|
[caches.getjson]
|
2018-11-14 04:51:41 -05:00
|
|
|
maxAge = "1s"
|
2018-11-08 04:24:13 -05:00
|
|
|
dir = "/cache/c"
|
|
|
|
|
|
|
|
`
|
|
|
|
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
p := newPathsSpec(t, afero.NewMemMapFs(), configStr)
|
2018-11-08 04:24:13 -05:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
caches, err := filecache.NewCaches(p)
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(err, qt.IsNil)
|
2018-11-08 04:24:13 -05:00
|
|
|
|
|
|
|
const cacheName = "getjson"
|
|
|
|
|
|
|
|
filenameData := func(i int) (string, string) {
|
|
|
|
data := fmt.Sprintf("data: %d", i)
|
|
|
|
filename := fmt.Sprintf("file%d", i)
|
|
|
|
return filename, data
|
|
|
|
}
|
|
|
|
|
|
|
|
var wg sync.WaitGroup
|
|
|
|
|
|
|
|
for i := 0; i < 50; i++ {
|
|
|
|
wg.Add(1)
|
|
|
|
go func(i int) {
|
|
|
|
defer wg.Done()
|
|
|
|
for j := 0; j < 20; j++ {
|
2019-08-10 15:05:17 -04:00
|
|
|
ca := caches.Get(cacheName)
|
|
|
|
c.Assert(ca, qt.Not(qt.IsNil))
|
2018-11-08 04:24:13 -05:00
|
|
|
filename, data := filenameData(i)
|
2019-08-10 15:05:17 -04:00
|
|
|
_, r, err := ca.GetOrCreate(filename, func() (io.ReadCloser, error) {
|
2018-11-08 04:24:13 -05:00
|
|
|
return hugio.ToReadCloser(strings.NewReader(data)), nil
|
|
|
|
})
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(err, qt.IsNil)
|
2023-02-18 17:43:26 -05:00
|
|
|
b, _ := io.ReadAll(r)
|
2018-11-08 04:24:13 -05:00
|
|
|
r.Close()
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(string(b), qt.Equals, data)
|
2018-11-08 04:24:13 -05:00
|
|
|
// Trigger some expiration.
|
|
|
|
time.Sleep(50 * time.Millisecond)
|
|
|
|
}
|
|
|
|
}(i)
|
|
|
|
|
|
|
|
}
|
|
|
|
wg.Wait()
|
|
|
|
}
|
2018-11-14 06:06:46 -05:00
|
|
|
|
2019-10-21 03:37:46 -04:00
|
|
|
func TestFileCacheReadOrCreateErrorInRead(t *testing.T) {
|
|
|
|
t.Parallel()
|
|
|
|
c := qt.New(t)
|
|
|
|
|
|
|
|
var result string
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
rf := func(failLevel int) func(info filecache.ItemInfo, r io.ReadSeeker) error {
|
|
|
|
return func(info filecache.ItemInfo, r io.ReadSeeker) error {
|
2019-10-21 03:37:46 -04:00
|
|
|
if failLevel > 0 {
|
|
|
|
if failLevel > 1 {
|
2023-01-04 12:24:36 -05:00
|
|
|
return filecache.ErrFatal
|
2019-10-21 03:37:46 -04:00
|
|
|
}
|
|
|
|
return errors.New("fail")
|
|
|
|
}
|
|
|
|
|
2023-02-18 17:43:26 -05:00
|
|
|
b, _ := io.ReadAll(r)
|
2019-10-21 03:37:46 -04:00
|
|
|
result = string(b)
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
bf := func(s string) func(info filecache.ItemInfo, w io.WriteCloser) error {
|
|
|
|
return func(info filecache.ItemInfo, w io.WriteCloser) error {
|
2019-10-21 03:37:46 -04:00
|
|
|
defer w.Close()
|
|
|
|
result = s
|
|
|
|
_, err := w.Write([]byte(s))
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
cache := filecache.NewCache(afero.NewMemMapFs(), 100*time.Hour, "")
|
2019-10-21 03:37:46 -04:00
|
|
|
|
|
|
|
const id = "a32"
|
|
|
|
|
|
|
|
_, err := cache.ReadOrCreate(id, rf(0), bf("v1"))
|
|
|
|
c.Assert(err, qt.IsNil)
|
|
|
|
c.Assert(result, qt.Equals, "v1")
|
|
|
|
_, err = cache.ReadOrCreate(id, rf(0), bf("v2"))
|
|
|
|
c.Assert(err, qt.IsNil)
|
|
|
|
c.Assert(result, qt.Equals, "v1")
|
|
|
|
_, err = cache.ReadOrCreate(id, rf(1), bf("v3"))
|
|
|
|
c.Assert(err, qt.IsNil)
|
|
|
|
c.Assert(result, qt.Equals, "v3")
|
|
|
|
_, err = cache.ReadOrCreate(id, rf(2), bf("v3"))
|
2023-01-04 12:24:36 -05:00
|
|
|
c.Assert(err, qt.Equals, filecache.ErrFatal)
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func newPathsSpec(t *testing.T, fs afero.Fs, configStr string) *helpers.PathSpec {
|
2019-08-10 15:05:17 -04:00
|
|
|
c := qt.New(t)
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
cfg, err := config.FromConfigString(configStr, "toml")
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(err, qt.IsNil)
|
2023-01-04 12:24:36 -05:00
|
|
|
acfg := testconfig.GetTestConfig(fs, cfg)
|
|
|
|
p, err := helpers.NewPathSpec(hugofs.NewFrom(fs, acfg.BaseConfig()), acfg, nil)
|
2019-08-10 15:05:17 -04:00
|
|
|
c.Assert(err, qt.IsNil)
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
return p
|
|
|
|
}
|