"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "resources/resource_transformers/js/options.go" between
hugo-0.85.0.tar.gz and hugo-0.86.0.tar.gz

About: Hugo is a static site generator that takes a source directory of Markdown files and templates and uses these as input to create a complete website (written in Go).

options.go  (hugo-0.85.0):options.go  (hugo-0.86.0)
skipping to change at line 146 skipping to change at line 146
} }
func loaderFromFilename(filename string) api.Loader { func loaderFromFilename(filename string) api.Loader {
l, found := extensionToLoaderMap[filepath.Ext(filename)] l, found := extensionToLoaderMap[filepath.Ext(filename)]
if found { if found {
return l return l
} }
return api.LoaderJS return api.LoaderJS
} }
func resolveComponentInAssets(fs afero.Fs, impPath string) hugofs.FileMeta { func resolveComponentInAssets(fs afero.Fs, impPath string) *hugofs.FileMeta {
findFirst := func(base string) hugofs.FileMeta { findFirst := func(base string) *hugofs.FileMeta {
// This is the most common sub-set of ESBuild's default extension s. // This is the most common sub-set of ESBuild's default extension s.
// We assume that imports of JSON, CSS etc. will be using their f ull // We assume that imports of JSON, CSS etc. will be using their f ull
// name with extension. // name with extension.
for _, ext := range []string{".js", ".ts", ".tsx", ".jsx"} { for _, ext := range []string{".js", ".ts", ".tsx", ".jsx"} {
if fi, err := fs.Stat(base + ext); err == nil { if fi, err := fs.Stat(base + ext); err == nil {
return fi.(hugofs.FileMetaInfo).Meta() return fi.(hugofs.FileMetaInfo).Meta()
} }
} }
// Not found. // Not found.
return nil return nil
} }
var m hugofs.FileMeta var m *hugofs.FileMeta
// First the path as is. // First the path as is.
fi, err := fs.Stat(impPath) fi, err := fs.Stat(impPath)
if err == nil { if err == nil {
if fi.IsDir() { if fi.IsDir() {
m = findFirst(filepath.Join(impPath, "index")) m = findFirst(filepath.Join(impPath, "index"))
} else { } else {
m = fi.(hugofs.FileMetaInfo).Meta() m = fi.(hugofs.FileMetaInfo).Meta()
} }
skipping to change at line 220 skipping to change at line 220
} }
m := resolveComponentInAssets(fs.Fs, impPath) m := resolveComponentInAssets(fs.Fs, impPath)
if m != nil { if m != nil {
// Store the source root so we can create a jsconfig.json // Store the source root so we can create a jsconfig.json
// to help intellisense when the build is done. // to help intellisense when the build is done.
// This should be a small number of elements, and when // This should be a small number of elements, and when
// in server mode, we may get stale entries on renames et c., // in server mode, we may get stale entries on renames et c.,
// but that shouldn't matter too much. // but that shouldn't matter too much.
c.rs.JSConfigBuilder.AddSourceRoot(m.SourceRoot()) c.rs.JSConfigBuilder.AddSourceRoot(m.SourceRoot)
return api.OnResolveResult{Path: m.Filename(), Namespace: return api.OnResolveResult{Path: m.Filename, Namespace: n
nsImportHugo}, nil sImportHugo}, nil
} }
// Fall back to ESBuild's resolve. // Fall back to ESBuild's resolve.
return api.OnResolveResult{}, nil return api.OnResolveResult{}, nil
} }
importResolver := api.Plugin{ importResolver := api.Plugin{
Name: "hugo-import-resolver", Name: "hugo-import-resolver",
Setup: func(build api.PluginBuild) { Setup: func(build api.PluginBuild) {
build.OnResolve(api.OnResolveOptions{Filter: `.*`}, build.OnResolve(api.OnResolveOptions{Filter: `.*`},
 End of changes. 3 change blocks. 
6 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)