Skip to content

Commit 4bbe849

Browse files
authored
Merge pull request meteor#9107 from GeoffreyBooth/coffeescript-2
CoffeeScript 2.0.2
2 parents 9e65d8b + 904ba95 commit 4bbe849

9 files changed

Lines changed: 46 additions & 25 deletions

File tree

packages/non-core/coffeescript-compiler/.npm/package/npm-shrinkwrap.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/non-core/coffeescript-compiler/coffeescript-compiler.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ export class CoffeeScriptCompiler {
2222
// prevents CoffeeScript projects from using the modules package and
2323
// putting require or import statements within backticks; it just
2424
// won't happen automatically because of Babel.
25-
runtime: false
25+
runtime: false,
26+
// CoffeeScript 2 supports for JSX, which Meteor supports only for React,
27+
// per packages/ecmascript/plugin.js.
28+
react: true
2629
});
2730
}
2831

packages/non-core/coffeescript-compiler/package.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
1+
// The NPM `coffeescript` module requires Node 6+; but instead of checking for
2+
// a Node runtime version, detect support for async functions, which were
3+
// added in Node 7.6.
4+
try {
5+
new Function('async () => {}')();
6+
} catch (exception) {
7+
throw new Error('Your runtime does not support this version of CoffeeScript. Please upgrade to Meteor 1.6 or later, or use a 1.x version of CoffeeScript.');
8+
}
9+
10+
111
Package.describe({
212
name: 'coffeescript-compiler',
313
summary: 'Compiler for CoffeeScript code, supporting the coffeescript package',
414
// This version of NPM `coffeescript` module, with _1, _2 etc.
515
// If you change this, make sure to also update ../coffeescript/package.js to match.
6-
version: '1.12.7_3'
16+
version: '2.0.2_1'
717
});
818

919
Npm.depends({
10-
'coffeescript': '1.12.7',
20+
'coffeescript': '2.0.2',
1121
'source-map': '0.5.7'
1222
});
1323

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
COFFEESCRIPT_EXPORTED = 123
22
COFFEESCRIPT_EXPORTED_ONE_MORE = 234
33

4-
# Having backticks in the code is required to trigger Babel processing
5-
# the file and re-wrapping the list of defined variables.
64
`COFFEESCRIPT_EXPORTED_WITH_BACKTICKS = 345`
75

8-
# Defining a class which extends a new class forces CoffeeScript
9-
# to define an "extend" function, which then in turn forces Babel
10-
# to re-wrap the list of defined variables so that each is defined
11-
# in its own line.
12-
136
class TestClass
147

158
class ClassExtending extends TestClass

packages/non-core/coffeescript-test-helper/package.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Package.describe({
22
summary: "Used by the coffeescript package's tests",
3-
version: "1.0.10-beta.30"
3+
version: "1.1.0"
44
});
55

66
Package.onUse(function (api) {
7-
api.use('coffeescript@1.12.7-2-beta.30', ['client', 'server']);
7+
api.use('coffeescript@2.0.2_1', ['client', 'server']);
88
api.export('COFFEESCRIPT_EXPORTED');
99
api.export('COFFEESCRIPT_EXPORTED_ONE_MORE');
1010
api.export('COFFEESCRIPT_EXPORTED_WITH_BACKTICKS');

packages/non-core/coffeescript/package.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ Package.describe({
66
// so bumping the version of this package will be how they get newer versions
77
// of `coffeescript-compiler`. If you change this, make sure to also update
88
// ../coffeescript-compiler/package.js to match.
9-
version: '1.12.7_3'
9+
version: '2.0.2_1'
1010
});
1111

1212
Package.registerBuildPlugin({
1313
name: 'compile-coffeescript',
14-
use: ['caching-compiler@1.1.9', 'ecmascript@0.8.3', 'coffeescript-compiler@=1.12.7_3'],
14+
use: ['caching-compiler@1.1.9', 'ecmascript@0.8.3', 'coffeescript-compiler@=2.0.2_1'],
1515
sources: ['compile-coffeescript.js']
1616
});
1717

packages/non-core/coffeescript/tests/coffeescript_tests.coffee

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,17 @@ Tinytest.add "coffeescript - import local module via native import statement", (
2828
import { testingForNativeImportedModule123456789 } from "./coffeescript_module.coffee";
2929
Tinytest.add "coffeescript - import local module exported by a CoffeeScript native export statement, via native import statement", (test) ->
3030
test.isTrue testingForNativeImportedModule123456789?
31+
32+
33+
# CoffeeScript 2 is active, with its conforming-to-ES2015 breaking changes
34+
Tinytest.add "coffeescript - ES2015 conformity", (test) ->
35+
f = (a = 1) -> a
36+
test.isTrue f(null) is null # `f(null)` would be 1 in CoffeeScript 1.x
37+
38+
# JSX
39+
Tinytest.add "coffeescript - JSX", (test) ->
40+
# Mock React
41+
React =
42+
createElement: (tag, attributes, body) ->
43+
"<#{tag}>#{body}</#{tag}>"
44+
test.isTrue <div>Hello from JSX!</div> is '<div>Hello from JSX!</div>'

tools/tests/command-line.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ selftest.define("argument parsing", function () {
367367
});
368368
s.cd("app-with-extra-packages", function () {
369369
run = s.run("test",
370-
"--extra-packages", "practicalmeteor:mocha, extra-package-1, extra-package-2@=0.0.2",
371-
"--driver-package", "practicalmeteor:mocha");
370+
"--extra-packages", "tmeasday:acceptance-test-driver, extra-package-1, extra-package-2@=0.0.2",
371+
"--driver-package", "tmeasday:acceptance-test-driver");
372372
run.waitSecs(60);
373373
run.match("extra-package-1: foobar");
374374
run.match("extra-package-2: barfoo");

tools/tests/test-modes.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,24 @@ selftest.define("'meteor test --port' accepts/rejects proper values", function (
77

88
s.createApp("myapp", "standard-app");
99
s.cd("myapp");
10+
s.set("")
1011

11-
var runAddPackage = s.run("add", "practicalmeteor:mocha");
12+
var runAddPackage = s.run("add", "tmeasday:acceptance-test-driver");
1213
runAddPackage.waitSecs(30);
13-
runAddPackage.match(/practicalmeteor:mocha\b.*?added/)
14+
runAddPackage.match(/tmeasday:acceptance-test-driver\b.*?added/)
1415
runAddPackage.expectExit(0);
1516

16-
run = s.run("test", "--port", "3700", "--driver-package", "practicalmeteor:mocha");
17+
run = s.run("test", "--port", "3700", "--driver-package", "tmeasday:acceptance-test-driver");
1718
run.waitSecs(120);
1819
run.match('App running at: http://localhost:3700/');
1920
run.stop();
2021

21-
run = s.run("test", "--port", "127.0.0.1:3700", "--driver-package", "practicalmeteor:mocha");
22+
run = s.run("test", "--port", "127.0.0.1:3700", "--driver-package", "tmeasday:acceptance-test-driver");
2223
run.waitSecs(120);
2324
run.match('App running at: http://127.0.0.1:3700/');
2425
run.stop();
25-
26-
run = s.run("test", "--port", "[::]:3700", "--driver-package", "practicalmeteor:mocha");
26+
27+
run = s.run("test", "--port", "[::]:3700", "--driver-package", "tmeasday:acceptance-test-driver");
2728
run.waitSecs(120);
2829
run.match('App running at: http://[::]:3700/');
2930
run.stop();

0 commit comments

Comments
 (0)