mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
Make js.Build fully support modules
Fixes #7816 Fixes #7777 Fixes #7916
This commit is contained in:
@@ -37,6 +37,7 @@ import (
|
||||
const (
|
||||
metaKeyFilename = "filename"
|
||||
|
||||
metaKeySourceRoot = "sourceRoot"
|
||||
metaKeyBaseDir = "baseDir" // Abs base directory of source file.
|
||||
metaKeyMountRoot = "mountRoot"
|
||||
metaKeyModule = "module"
|
||||
@@ -128,6 +129,10 @@ func (f FileMeta) PathFile() string {
|
||||
return strings.TrimPrefix(strings.TrimPrefix(f.Filename(), base), filepathSeparator)
|
||||
}
|
||||
|
||||
func (f FileMeta) SourceRoot() string {
|
||||
return f.stringV(metaKeySourceRoot)
|
||||
}
|
||||
|
||||
func (f FileMeta) MountRoot() string {
|
||||
return f.stringV(metaKeyMountRoot)
|
||||
}
|
||||
|
@@ -60,6 +60,7 @@ func NewRootMappingFs(fs afero.Fs, rms ...RootMapping) (*RootMappingFs, error) {
|
||||
rm.Meta = make(FileMeta)
|
||||
}
|
||||
|
||||
rm.Meta[metaKeySourceRoot] = rm.To
|
||||
rm.Meta[metaKeyBaseDir] = rm.ToBasedir
|
||||
rm.Meta[metaKeyMountRoot] = rm.path
|
||||
rm.Meta[metaKeyModule] = rm.Module
|
||||
|
Reference in New Issue
Block a user