Support "imports" in abbreviated modules
In abbreviated modules (those without a "config" attribute), you can use "require", but it doesn't behave in the same way. For consistency we should use "imports" everywhere.
This commit is contained in:
parent
e55c0bcaaa
commit
62585a363f
|
@ -46,25 +46,21 @@ rec {
|
||||||
unifyModuleSyntax = m:
|
unifyModuleSyntax = m:
|
||||||
let
|
let
|
||||||
delayedModule = delayProperties m;
|
delayedModule = delayProperties m;
|
||||||
getImports =
|
|
||||||
if m ? config || m ? options then
|
|
||||||
m.imports or []
|
|
||||||
else
|
|
||||||
toList (rmProperties (delayedModule.require or []));
|
|
||||||
|
|
||||||
|
getImports =
|
||||||
|
toList (rmProperties (delayedModule.require or []));
|
||||||
getImportedPaths = filter isPath getImports;
|
getImportedPaths = filter isPath getImports;
|
||||||
getImportedSets = filter (x: !isPath x) getImports;
|
getImportedSets = filter (x: !isPath x) getImports;
|
||||||
|
|
||||||
getConfig =
|
getConfig =
|
||||||
removeAttrs delayedModule ["require" "key"];
|
removeAttrs delayedModule ["require" "key" "imports"];
|
||||||
|
|
||||||
in
|
in
|
||||||
if isModule m then
|
if isModule m then
|
||||||
{ key = "<unknown location>"; } // m
|
{ key = "<unknown location>"; } // m
|
||||||
else
|
else
|
||||||
{
|
{ key = "<unknown location>";
|
||||||
key = "<unknown location>";
|
imports = (m.imports or []) ++ getImportedPaths;
|
||||||
imports = getImportedPaths;
|
|
||||||
config = getConfig;
|
config = getConfig;
|
||||||
} // (
|
} // (
|
||||||
if getImportedSets != [] then
|
if getImportedSets != [] then
|
||||||
|
|
Loading…
Reference in New Issue