mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
Make js.Build fully support modules
Fixes #7816 Fixes #7777 Fixes #7916
This commit is contained in:
@@ -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(),
|
||||
|
Reference in New Issue
Block a user