mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Regression introduced by the CSS watching code (specifically, f230eba62)
by the sourceIsWatched check. We need to be able to tell the difference
between "source handler didn't do anything because there was an error"
and "source handler didn't do anything because it's web-specific and
this is an os arch".
A simple fix would have been to interpret compileStep.error as
"sourceIsWatched = true", but I didn't think of that until after doing
it the slightly more complicated but more precise way :)
Also, ensure that if the runner rebuilds the client and there's an
error, it properly kills the app process (and the watchers and the
keepalive interval, etc).
52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
var path = Npm.require('path');
|
|
|
|
var doHTMLScanning = function (compileStep, htmlScanner) {
|
|
// XXX the way we deal with encodings here is sloppy .. should get
|
|
// religion on that
|
|
var contents = compileStep.read().toString('utf8');
|
|
try {
|
|
var results = htmlScanner.scan(contents, compileStep.inputPath);
|
|
} catch (e) {
|
|
if (e instanceof htmlScanner.ParseError) {
|
|
compileStep.error({
|
|
message: e.message,
|
|
sourcePath: compileStep.inputPath,
|
|
line: e.line
|
|
});
|
|
return;
|
|
} else
|
|
throw e;
|
|
}
|
|
|
|
if (results.head)
|
|
compileStep.appendDocument({ section: "head", data: results.head });
|
|
|
|
if (results.body)
|
|
compileStep.appendDocument({ section: "body", data: results.body });
|
|
|
|
if (results.js) {
|
|
var path_part = path.dirname(compileStep.inputPath);
|
|
if (path_part === '.')
|
|
path_part = '';
|
|
if (path_part.length && path_part !== path.sep)
|
|
path_part = path_part + path.sep;
|
|
var ext = path.extname(compileStep.inputPath);
|
|
var basename = path.basename(compileStep.inputPath, ext);
|
|
|
|
// XXX generate a source map
|
|
|
|
compileStep.addJavaScript({
|
|
path: path.join(path_part, "template." + basename + ".js"),
|
|
sourcePath: compileStep.inputPath,
|
|
data: results.js
|
|
});
|
|
}
|
|
};
|
|
|
|
Plugin.registerSourceHandler(
|
|
"html", {isTemplate: true, archMatching: 'web'},
|
|
function (compileStep) {
|
|
doHTMLScanning(compileStep, html_scanner);
|
|
}
|
|
);
|