mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Conflicts: meteor packages/absolute-url/.gitignore packages/accounts-base/package.js packages/accounts-oauth/package.js packages/audit-argument-checks/.gitignore packages/coffeescript/.gitignore packages/coffeescript/package.js packages/localstorage-polyfill/.gitignore packages/oauth1/package.js packages/oauth2/package.js packages/random/random.js scripts/generate-dev-bundle.sh tools/packages.js tools/run.js tools/server/server.js
35 lines
892 B
JavaScript
35 lines
892 B
JavaScript
var fs = Npm.require('fs');
|
|
var path = Npm.require('path');
|
|
var coffee = Npm.require('coffee-script');
|
|
|
|
var handler = function (compileStep) {
|
|
var source = compileStep.read().toString('utf8');
|
|
var options = {
|
|
bare: true,
|
|
filename: compileStep.inputPath,
|
|
literate: path.extname(compileStep.inputPath) === '.litcoffee'
|
|
};
|
|
|
|
try {
|
|
var output = coffee.compile(source, options);
|
|
} catch (e) {
|
|
// XXX better error handling, once the Plugin interface support it
|
|
throw new Error(
|
|
compileStep.inputPath + ':' +
|
|
(e.location ? (e.location.first_line + ': ') : ' ') +
|
|
e.message
|
|
);
|
|
}
|
|
|
|
compileStep.addJavaScript({
|
|
path: compileStep.inputPath + ".js",
|
|
sourcePath: compileStep.inputPath,
|
|
data: output,
|
|
lineForLine: false
|
|
});
|
|
};
|
|
|
|
Plugin.registerSourceHandler("coffee", handler);
|
|
Plugin.registerSourceHandler("litcoffee", handler);
|
|
|