1
0
Fork 0

tools/gen-index: Generate getters

LoVullo dropped support for IE<9, so getters can now be used to
lazy-load modules.

This also means that, during the transition from LoVullo's internal
rating-fw repo to liza, and broken require paths (program/, mainly)
will not cause problems unless the module containing those requires is
explicitly requested.

* tools/gen-index.js: Generate getters.
master
Mike Gerwitz 2017-02-07 15:36:28 -05:00
parent a65f568714
commit e3b6ee05fa
1 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ for module in "$destpath"/!(index).js; do
echo ,
fi
echo -n " '$modname': require( './$modname' )"
echo -n " get '$modname'() { return require( './$modname' ); }"
done
# include index.js for any sub-directories (namespace)
@ -52,7 +52,7 @@ for dir in $( find "$destpath" -maxdepth 1 -mindepth 1 -type d ); do
echo ,
fi
echo -n " '$ns': require( './$ns' )"
echo -n " get '$ns'() { return require('./$ns'); }"
done
echo -e "\n};"