-
Notifications
You must be signed in to change notification settings - Fork 2
Render process serialization protocol
In the client server, the pre-rendering engine runs in a separate process. In order to avoid that process having to re-compile all of the client files before using them, the server process streams the content of the client to the subprocess via it's stdin. This document outlines the format of that stream.
There are two main pieces of data that need to be passed into the renderer. The conf, and the compiled contents of the client, hereafter called the cache.
Each section of the input should be separated by ten equal signs and a newline (==========\n). After the separator can either be a pathname or ===conf===, followed by a newline. If ===conf=== is present, the content from there to the next separator is assumed to be a JSON serialized conf object. If a pathname is provided, the content before the next seperator is assumed to be the file content of that pathname.
For example:
/path/to/file.js
console.log('hello subprocess');
==========
/and/another.css
#some-id{
background-color:#f00;
}
==========
===conf===
{
"prop1": true,
"prop2": "string"
}