rewrite serialize scripts as module with process() sub