1
0
Fork 0
easejs/tools/mkexterns

32 lines
875 B
Plaintext
Raw Normal View History

#!/bin/bash
#
# Because this project consists of a bunch of CommonJS modules, the constructors
# have restricted scope. This means that they cannot be used as types in other
# modules. Therefore, to permit this, we must generate an extern file containing
# basic definitions of each.
# #
# all CamelCase modules are likely to be ctors
modules=$( ls lib/ \
| sed 's/lib\/\|\.js//' \
| grep -vP '^[a-z]'
)
# simple definition for now (we'll worry about members later)
for module in $modules; do
echo "/** @constructor */"
echo "function $module() {};"
echo
done
# finally, there's some additional useful metadata that we use to make our lives
# easier, better documented and more consistent
cat <<ETC
/** @typedef {{abstractMethods: Object}} */
var __class_meta;
/** @typedef {{public: Object, protected: Object, private: Object}} */
var __visobj;
ETC