Here is an example for a program which supports `#include` to include files:

The nice version:

``` javascript
function preprocessFile(filename) {
  var node = preprocessFileAsNode(filename);
  return node.toStringWithSourceMap();
}

function preprocessFileAsNode(filename) {
  var content = fs.readFileSync(filename);
  var lines = content.split("\n");
  var node = new SourceNode();
  lines.forEach(function(line, idx) {
    if(line.indexOf("#include ") === 0) {
      node.add(preprocessFileAsNode(line.substr("#include ".length)));
    } else {
      node.add(new SourceNode(idx, 0, filename, line + "\n", content));
    }
  });
  return node;
}
```

The ugly version without changes in SourceNode:

``` javascript
function preprocessFile(filename) {
  var contents = {};
  var node = preprocessFileAsNode(filename, contents);
  var result = node.toStringWithSourceMap();
  for(var file: contents) {
    result.map.setSourceContent(file, contents[file]);
  }
  return result;
}

function preprocessFileAsNode(filename, contents) {
  var content = fs.readFileSync(filename);
  contents[filename] = content;
  var lines = content.split("\n");
  var node = new SourceNode();
  lines.forEach(function(line, idx) {
    if(line.indexOf("#include ") === 0) {
      node.add(preprocessFileAsNode(line.substr("#include ".length), contents));
    } else {
      node.add(new SourceNode(idx, 0, filename, line + "\n"));
    }
  });
  return node;
}
```