Convert template spec to object literal

This allows for metadata to be associated with the template and a
simplification of the template init logic.

This is a breaking change for runtime as it breaks the version check. In exhcange we are able to move some of the init logic into the runtime, reducing precompiled code overhead and also do runtime checks before execution for templates compiled with 2.0 and higher.