Skip to content

Commit 8d29136

Browse files
author
Ben Newman
committedAug 14, 2015
Export some ECMAScript utilities on the server.
1 parent d49ea7c commit 8d29136

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
 

‎packages/ecmascript/ecmascript.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
ECMAScript = {
2+
compileForShell(command) {
3+
const babelOptions = Babel.getDefaultOptions();
4+
babelOptions.sourceMap = false;
5+
babelOptions.ast = false;
6+
babelOptions.externalHelpers = true;
7+
return Babel.compile(command, babelOptions).code;
8+
}
9+
};

‎packages/ecmascript/package.js

+5
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ Package.registerBuildPlugin({
1313

1414
Package.onUse(function (api) {
1515
api.use('isobuild:compiler-plugin@1.0.0');
16+
api.use('babel-compiler');
17+
1618
api.imply('babel-runtime');
1719
api.imply('promise');
1820
api.imply('ecmascript-collections');
21+
22+
api.addFiles("ecmascript.js", "server");
23+
api.export("ECMAScript");
1924
});
2025

2126
Package.onTest(function (api) {

0 commit comments

Comments
 (0)