Break out require and define from mantle into own module

Template code does not need it.

Change-Id: Iba33105a97b25d1343431a4a1f7572ccae8d1124