diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-10-05 13:34:14 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-11-03 13:04:37 +0100 |
commit | 85e4dd7370eae97ae367e596aa6a10ba42fd4b7c (patch) | |
tree | 23e739edbed24a62f842c1a3ebc1d9cb706ea8b7 /hugolib/hugo_sites.go | |
parent | 3089fc0ba171be14670b19439bc2eab6b077b6c3 (diff) |
Make js.Build fully support modules
Fixes #7816
Fixes #7777
Fixes #7916
Diffstat (limited to 'hugolib/hugo_sites.go')
-rw-r--r-- | hugolib/hugo_sites.go | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go index 1a6a07b03..25ae3dd19 100644 --- a/hugolib/hugo_sites.go +++ b/hugolib/hugo_sites.go @@ -22,6 +22,8 @@ import ( "sync" "sync/atomic" + "github.com/fsnotify/fsnotify" + "github.com/gohugoio/hugo/identity" radix "github.com/armon/go-radix" @@ -85,6 +87,10 @@ type HugoSites struct { // Keeps track of bundle directories and symlinks to enable partial rebuilding. ContentChanges *contentChangeMap + // File change events with filename stored in this map will be skipped. + skipRebuildForFilenamesMu sync.Mutex + skipRebuildForFilenames map[string]bool + init *hugoSitesInit workers *para.Workers @@ -94,6 +100,14 @@ type HugoSites struct { *testCounters } +// ShouldSkipFileChangeEvent allows skipping filesystem event early before +// the build is started. +func (h *HugoSites) ShouldSkipFileChangeEvent(ev fsnotify.Event) bool { + h.skipRebuildForFilenamesMu.Lock() + defer h.skipRebuildForFilenamesMu.Unlock() + return h.skipRebuildForFilenames[ev.Name] +} + func (h *HugoSites) getContentMaps() *pageMaps { h.contentInit.Do(func() { h.content = newPageMaps(h) @@ -304,12 +318,13 @@ func newHugoSites(cfg deps.DepsCfg, sites ...*Site) (*HugoSites, error) { } h := &HugoSites{ - running: cfg.Running, - multilingual: langConfig, - multihost: cfg.Cfg.GetBool("multihost"), - Sites: sites, - workers: workers, - numWorkers: numWorkers, + running: cfg.Running, + multilingual: langConfig, + multihost: cfg.Cfg.GetBool("multihost"), + Sites: sites, + workers: workers, + numWorkers: numWorkers, + skipRebuildForFilenames: make(map[string]bool), init: &hugoSitesInit{ data: lazy.New(), layouts: lazy.New(), |