It basically comes down to:

  • Ensure the module has no dependencies on other node modules
  • Ensure the module just exports a basic javascript object which can be iterated for serialisation
  • Iterate through the module's exported object and JSON-ify and data and toString-ify any function definiton