summaryrefslogtreecommitdiffstats
path: root/resources/resource_spec.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-10-05 13:34:14 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-11-03 13:04:37 +0100
commit85e4dd7370eae97ae367e596aa6a10ba42fd4b7c (patch)
tree23e739edbed24a62f842c1a3ebc1d9cb706ea8b7 /resources/resource_spec.go
parent3089fc0ba171be14670b19439bc2eab6b077b6c3 (diff)
Make js.Build fully support modules
Fixes #7816 Fixes #7777 Fixes #7916
Diffstat (limited to 'resources/resource_spec.go')
-rw-r--r--resources/resource_spec.go34
1 files changed, 23 insertions, 11 deletions
diff --git a/resources/resource_spec.go b/resources/resource_spec.go
index 17225e3f5..0ca60fe31 100644
--- a/resources/resource_spec.go
+++ b/resources/resource_spec.go
@@ -23,6 +23,8 @@ import (
"strings"
"sync"
+ "github.com/gohugoio/hugo/resources/jsconfig"
+
"github.com/gohugoio/hugo/common/herrors"
"github.com/gohugoio/hugo/config"
@@ -76,17 +78,20 @@ func NewSpec(
}
rs := &Spec{
- PathSpec: s,
- Logger: logger,
- ErrorSender: errorHandler,
- imaging: imaging,
- incr: incr,
- MediaTypes: mimeTypes,
- OutputFormats: outputFormats,
- Permalinks: permalinks,
- BuildConfig: config.DecodeBuild(s.Cfg),
- FileCaches: fileCaches,
- PostProcessResources: make(map[string]postpub.PostPublishedResource),
+ PathSpec: s,
+ Logger: logger,
+ ErrorSender: errorHandler,
+ imaging: imaging,
+ incr: incr,
+ MediaTypes: mimeTypes,
+ OutputFormats: outputFormats,
+ Permalinks: permalinks,
+ BuildConfig: config.DecodeBuild(s.Cfg),
+ FileCaches: fileCaches,
+ PostBuildAssets: &PostBuildAssets{
+ PostProcessResources: make(map[string]postpub.PostPublishedResource),
+ JSConfigBuilder: jsconfig.NewBuilder(),
+ },
imageCache: newImageCache(
fileCaches.ImageCache(),
@@ -121,8 +126,15 @@ type Spec struct {
ResourceCache *ResourceCache
FileCaches filecache.Caches
+ // Assets used after the build is done.
+ // This is shared between all sites.
+ *PostBuildAssets
+}
+
+type PostBuildAssets struct {
postProcessMu sync.RWMutex
PostProcessResources map[string]postpub.PostPublishedResource
+ JSConfigBuilder *jsconfig.Builder
}
func (r *Spec) New(fd ResourceSourceDescriptor) (resource.Resource, error) {