From 85e4dd7370eae97ae367e596aa6a10ba42fd4b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 5 Oct 2020 13:34:14 +0200 Subject: Make js.Build fully support modules Fixes #7816 Fixes #7777 Fixes #7916 --- hugofs/fileinfo.go | 5 +++++ hugofs/rootmapping_fs.go | 1 + 2 files changed, 6 insertions(+) (limited to 'hugofs') diff --git a/hugofs/fileinfo.go b/hugofs/fileinfo.go index 79d89a88b..5bfb1ff32 100644 --- a/hugofs/fileinfo.go +++ b/hugofs/fileinfo.go @@ -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) } diff --git a/hugofs/rootmapping_fs.go b/hugofs/rootmapping_fs.go index 2c4f0df52..a38560d0a 100644 --- a/hugofs/rootmapping_fs.go +++ b/hugofs/rootmapping_fs.go @@ -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 -- cgit v1.2.3