MCPcopy Create free account
hub / github.com/totaljs/framework / compile_file

Function compile_file

index.js:6655–6680  ·  view source on GitHub ↗
(res)

Source from the content-addressed store, hash-verified

6653F.onCompileScript = null;
6654
6655function compile_file(res) {
6656 fsFileRead(res.options.filename, function(err, buffer) {
6657
6658 var req = res.req;
6659 var uri = req.uri;
6660
6661 if (err) {
6662 F.error(err, res.options.filename, uri);
6663 F.temporary.notfound[req.$key] = true;
6664 delete F.temporary.processing[req.$key];
6665 res.$file();
6666 return;
6667 }
6668
6669 var file = F.path.temp((F.id ? 'i-' + F.id + '_' : '') + createTemporaryKey(uri.pathname));
6670 F.path.verify('temp');
6671 Fs.writeFileSync(file, compile_content(req.extension, framework_internal.parseBlock(F.routes.blocks[uri.pathname], buffer.toString(ENCODING)), res.options.filename), ENCODING);
6672 var stats = Fs.statSync(file);
6673 var tmp = [file, stats.size, stats.mtime.toUTCString()];
6674 compile_gzip(tmp, function(tmp) {
6675 F.temporary.path[req.$key] = tmp;
6676 delete F.temporary.processing[req.$key];
6677 res.$file();
6678 });
6679 });
6680}
6681
6682function compile_merge(res, repeated) {
6683

Callers 2

index.jsFile · 0.85
compile_checkFunction · 0.85

Calls 4

fsFileReadFunction · 0.85
createTemporaryKeyFunction · 0.85
compile_contentFunction · 0.85
compile_gzipFunction · 0.85

Tested by

no test coverage detected