Merge branch 'pr-766' into devel

This commit is contained in:
David Glasser
2013-03-02 21:10:10 -08:00
7 changed files with 39 additions and 24 deletions

View File

@@ -5,6 +5,9 @@
* Removed all restrictions on EJSON types in MongoDB, even user-defined ones.
* `coffeescript` package: Support literate Coffeescript files with the extension
`.litcoffee`.
* Fixed bug where an empty `fields` object was sometimes passed to a `changed`
callback of `Cursor.observeChanges`.

View File

@@ -3,7 +3,7 @@
set -e
set -u
BUNDLE_VERSION=0.2.20
BUNDLE_VERSION=0.2.21
UNAME=$(uname)
ARCH=$(uname -m)
@@ -79,7 +79,7 @@ which npm
cd "$DIR/lib/node_modules"
npm install connect@1.9.2 # not 2.x yet. sockjs doesn't work w/ new connect
npm install optimist@0.3.5
npm install coffee-script@1.4.0
npm install coffee-script@1.5.0
npm install less@1.3.3
npm install stylus@0.30.1
npm install nib@0.8.2

View File

@@ -8,7 +8,8 @@ code compiles one-to-one into the equivalent JS, and there is no
interpretation at runtime.
CoffeeScript is supported on both the client and the server. Files
ending with `.coffee` are automatically compiled to JavaScript.
ending with `.coffee` or `.litcoffee` are automatically compiled to
JavaScript.
See <http://jashkenas.github.com/coffee-script/> for more information.

2
meteor
View File

@@ -1,6 +1,6 @@
#!/bin/bash
BUNDLE_VERSION=0.2.20
BUNDLE_VERSION=0.2.21
# OS Check. Put here because here is where we download the precompiled
# bundles that are arch specific.

View File

@@ -1,4 +1,7 @@
Tinytest.add("coffeescript - presence", function(test) {
test.isTrue(Meteor.__COFFEESCRIPT_PRESENT);
});
Tinytest.add("literate coffeescript - presence", function(test) {
test.isTrue(Meteor.__LITCOFFEESCRIPT_PRESENT);
});

View File

@@ -0,0 +1,6 @@
This file is just the same as `coffeescript_tests.coffee`, first we set a
property, which we check for in `coffeescript_tests.js`, and then a trivial
testcase.
Meteor.__LITCOFFEESCRIPT_PRESENT = true
Tinytest.add "literate coffeescript - compile", (test) -> test.isTrue true

View File

@@ -4,30 +4,32 @@ Package.describe({
var coffee = require('coffee-script');
var fs = require('fs');
var path = require('path');
Package.register_extension(
"coffee", function (bundle, source_path, serve_path, where) {
serve_path = serve_path + '.js';
var coffeescript_handler = function(bundle, source_path, serve_path, where) {
serve_path = serve_path + '.js';
var contents = fs.readFileSync(source_path);
var options = {bare: true, filename: source_path};
try {
contents = coffee.compile(contents.toString('utf8'), options);
} catch (e) {
return bundle.error(e.message);
}
contents = new Buffer(contents);
bundle.add_resource({
type: "js",
path: serve_path,
data: contents,
where: where
});
var contents = fs.readFileSync(source_path);
var options = {bare: true, filename: source_path, literate: path.extname(source_path) === '.litcoffee'};
try {
contents = coffee.compile(contents.toString('utf8'), options);
} catch (e) {
return bundle.error(e.message);
}
);
contents = new Buffer(contents);
bundle.add_resource({
type: "js",
path: serve_path,
data: contents,
where: where
});
}
Package.register_extension("coffee", coffeescript_handler);
Package.register_extension("litcoffee", coffeescript_handler);
Package.on_test(function (api) {
api.add_files(['coffeescript_tests.coffee', 'coffeescript_tests.js'],
api.add_files(['coffeescript_tests.coffee', 'litcoffeescript_tests.litcoffee', 'coffeescript_tests.js'],
['client', 'server']);
});