amberc.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. /**
  2. * This is a "compiler" for Amber code.
  3. * Put the following code into compiler.js:
  4. * var amberc = require('amberc');
  5. * var compiler = new amberc.Compiler('path/to/amber', ['/optional/path/to/compiler.jar]);
  6. * compiler.main();
  7. *
  8. * Execute 'node compiler.js' without arguments or with -h / --help for help.
  9. */
  10. /**
  11. * Map the async filter function onto array and evaluate callback, once all have finished.
  12. * Taken from: http://howtonode.org/control-flow-part-iii
  13. */
  14. function async_map(array, filter, callback) {
  15. if (0 === array.length) {
  16. callback(null, null);
  17. return;
  18. }
  19. var counter = array.length;
  20. var new_array = [];
  21. array.forEach(function (item, index) {
  22. filter(item, function (err, result) {
  23. if (err) { callback(err); return; }
  24. new_array[index] = result;
  25. counter--;
  26. if (counter === 0) {
  27. callback(null, new_array);
  28. }
  29. });
  30. });
  31. }
  32. /**
  33. * Always evaluates the callback parameter.
  34. * Used by Combo blocks to always call the next function,
  35. * even if all of the other functions did not run.
  36. */
  37. function always_resolve(callback) {
  38. callback();
  39. }
  40. /**
  41. * Combine several async functions and evaluate callback once all of them have finished.
  42. * Taken from: http://howtonode.org/control-flow
  43. */
  44. function Combo(callback) {
  45. this.callback = callback;
  46. this.items = 0;
  47. this.results = [];
  48. }
  49. Combo.prototype = {
  50. add: function () {
  51. var self = this,
  52. id = this.items;
  53. this.items++;
  54. return function () {
  55. self.check(id, arguments);
  56. };
  57. },
  58. check: function (id, arguments) {
  59. this.results[id] = Array.prototype.slice.call(arguments);
  60. this.items--;
  61. if (this.items == 0) {
  62. this.callback.apply(this, this.results);
  63. }
  64. }
  65. };
  66. var path = require('path'),
  67. util = require('util'),
  68. fs = require('fs'),
  69. exec = require('child_process').exec;
  70. /**
  71. * AmberC constructor function.
  72. * amber_dir: points to the location of an amber installation
  73. * closure_jar: location of compiler.jar (can be left undefined)
  74. */
  75. function AmberC(amber_dir, closure_jar) {
  76. this.amber_dir = amber_dir;
  77. this.closure_jar = closure_jar || '';
  78. this.kernel_libraries = ['@boot', 'Kernel-Objects', 'Kernel-Classes', 'Kernel-Methods',
  79. 'Kernel-Collections', 'Kernel-Infrastructure', 'Kernel-Exceptions', 'Kernel-Transcript',
  80. 'Kernel-Announcements'];
  81. this.compiler_libraries = this.kernel_libraries.concat(['@parser', 'Importer-Exporter', 'Compiler-Exceptions',
  82. 'Compiler-Core', 'Compiler-AST', 'Compiler-IR', 'Compiler-Inlining', 'Compiler-Semantic']);
  83. }
  84. /**
  85. * Default values.
  86. */
  87. var createDefaults = function(amber_dir, finished_callback){
  88. if (undefined === amber_dir) {
  89. throw new Error('createDefaults() function needs a valid amber_dir parameter');
  90. }
  91. return {
  92. 'load': [],
  93. 'init': path.join(amber_dir, 'support', 'init.js'),
  94. 'main': undefined,
  95. 'mainfile': undefined,
  96. 'stFiles': [],
  97. 'jsFiles': [],
  98. 'jsGlobals': [],
  99. 'closure': false,
  100. 'closure_parts': false,
  101. 'closure_full': false,
  102. 'closure_options': ' --language_in=ECMASCRIPT5 ',
  103. 'suffix': '',
  104. 'loadsuffix': '',
  105. 'suffix_used': '',
  106. 'deploy': false,
  107. 'libraries': [],
  108. 'compile': [],
  109. 'compiled': [],
  110. 'program': undefined,
  111. 'output_dir': undefined,
  112. 'verbose': false,
  113. 'finished_callback': finished_callback
  114. };
  115. };
  116. /**
  117. * Main function for executing the compiler.
  118. * If check_configuration_ok() returns successfully the configuration is set on the current compiler
  119. * instance and check_for_closure_compiler() gets called.
  120. * The last step is to call collect_files().
  121. */
  122. AmberC.prototype.main = function(configuration, finished_callback) {
  123. console.time('Compile Time');
  124. if (undefined !== finished_callback) {
  125. configuration.finished_callback = finished_callback;
  126. }
  127. if (configuration.closure || configuration.closure_parts || configuration.closure_full) {
  128. configuration.deploy = true;
  129. }
  130. console.ambercLog = console.log;
  131. if (false === configuration.verbose) {
  132. console.log = function() {};
  133. }
  134. if (this.check_configuration_ok(configuration)) {
  135. this.defaults = configuration;
  136. this.defaults.smalltalk = {}; // the evaluated compiler will be stored in this variable (see create_compiler)
  137. var self = this;
  138. this.check_for_closure_compiler(function(){
  139. self.collect_files(self.defaults.stFiles, self.defaults.jsFiles)
  140. });
  141. }
  142. };
  143. /**
  144. * Check if the passed in configuration object has sufficient/nonconflicting values
  145. */
  146. AmberC.prototype.check_configuration_ok = function(configuration) {
  147. if (undefined === configuration) {
  148. throw new Error('AmberC.check_configuration_ok(): missing configuration object');
  149. }
  150. if (undefined === configuration.init) {
  151. throw new Error('AmberC.check_configuration_ok(): init value missing in configuration object');
  152. }
  153. if (0 === configuration.jsFiles.length && 0 === configuration.stFiles.lenght) {
  154. throw new Error('AmberC.check_configuration_ok(): no files to compile/link specified in configuration object');
  155. }
  156. return true;
  157. };
  158. /**
  159. * Checks if the java executable exists and afterwards,
  160. * if compiler.jar exists at the path stored in this.closure_jar.
  161. * All closure related entries are set to false upon failure.
  162. *
  163. * callback gets called in any case.
  164. */
  165. AmberC.prototype.check_for_closure_compiler = function(callback) {
  166. var defaults = this.defaults;
  167. var self = this;
  168. if (defaults.closure) {
  169. exec('which java', function(error, stdout, stderr) {
  170. // stdout contains path to java executable
  171. if (null !== error) {
  172. console.warn('java is not installed but is needed for running the Closure compiler (-O, -A or -o flags).');
  173. defaults.closure = false;
  174. defaults.closure_parts = false;
  175. defaults.closure_full = false;
  176. callback();
  177. return;
  178. }
  179. fs.exists(self.closure_jar, function(exists) {
  180. if (!exists) {
  181. console.warn('Can not find Closure compiler at: ' + self.closure_jar);
  182. defaults.closure = false;
  183. defaults.closure_parts = false;
  184. defaults.closure_full = false;
  185. } else {
  186. console.warn('Closure compiler found at: ' + self.closure_jar);
  187. }
  188. callback();
  189. return;
  190. });
  191. });
  192. } else {
  193. callback();
  194. }
  195. };
  196. /**
  197. * Check if the file given as parameter exists in the local directory or in $AMBER/js/.
  198. * '.js' is appended first.
  199. *
  200. * @param filename name of a file without '.js' prefix
  201. * @param callback gets called on success with path to .js file as parameter
  202. */
  203. AmberC.prototype.resolve_js = function(filename, callback) {
  204. var special = filename[0] == "@";
  205. if (special) { filename = filename.slice(1); }
  206. var baseName = path.basename(filename, '.js');
  207. var jsFile = baseName + this.defaults.loadsuffix + '.js';
  208. var amberJsFile = path.join(this.amber_dir, special?'support':'js', jsFile);
  209. console.log('Resolving: ' + jsFile);
  210. fs.exists(jsFile, function(exists) {
  211. if (exists) {
  212. callback(jsFile);
  213. } else {
  214. fs.exists(amberJsFile, function(exists) {
  215. if (exists) {
  216. callback(amberJsFile);
  217. } else {
  218. throw(new Error('JavaScript file not found: ' + jsFile));
  219. }
  220. });
  221. }
  222. });
  223. };
  224. /**
  225. * Collect libraries and Smalltalk files looking
  226. * both locally and in $AMBER/js and $AMBER/st.
  227. * Followed by resolve_libraries().
  228. */
  229. AmberC.prototype.collect_files = function(stFiles, jsFiles) {
  230. var self = this;
  231. var collected_files = new Combo(function() {
  232. self.resolve_libraries();
  233. });
  234. if (0 !== stFiles.length) {
  235. self.collect_st_files(stFiles, collected_files.add());
  236. }
  237. if (0 !== jsFiles.length) {
  238. self.collect_js_files(jsFiles, collected_files.add());
  239. }
  240. };
  241. /**
  242. * Resolve st files given by stFiles and add them to defaults.compile.
  243. * Respective categories get added to defaults.compile_categories.
  244. * callback is evaluated afterwards.
  245. */
  246. AmberC.prototype.collect_st_files = function(stFiles, callback) {
  247. var defaults = this.defaults;
  248. var self = this;
  249. var collected_st_files = new Combo(function() {
  250. Array.prototype.slice.call(arguments).forEach(function(data) {
  251. var stFile = data[0];
  252. defaults.compile.push(stFile);
  253. });
  254. callback();
  255. });
  256. stFiles.forEach(function(stFile) {
  257. var _callback = collected_st_files.add();
  258. console.log('Checking: ' + stFile);
  259. var amberStFile = path.join(self.amber_dir, 'st', stFile);
  260. fs.exists(stFile, function(exists) {
  261. if (exists) {
  262. _callback(stFile);
  263. } else {
  264. console.log('Checking: ' + amberStFile);
  265. fs.exists(amberStFile, function(exists) {
  266. if (exists) {
  267. _callback(amberStFile);
  268. } else {
  269. throw(new Error('Smalltalk file not found: ' + amberStFile));
  270. }
  271. });
  272. }
  273. });
  274. });
  275. };
  276. /**
  277. * Resolve js files given by jsFiles and add them to defaults.libraries.
  278. * callback is evaluated afterwards.
  279. */
  280. AmberC.prototype.collect_js_files = function(jsFiles, callback) {
  281. var self = this;
  282. var collected_js_files = new Combo(function() {
  283. Array.prototype.slice.call(arguments).forEach(function(file) {
  284. self.defaults.libraries.push(file[0]);
  285. });
  286. callback();
  287. });
  288. jsFiles.forEach(function(jsFile) {
  289. self.resolve_js(jsFile, collected_js_files.add());
  290. });
  291. };
  292. /**
  293. * Resolve kernel and compiler files.
  294. * Followed by resolve_init().
  295. */
  296. AmberC.prototype.resolve_libraries = function() {
  297. // Resolve libraries listed in this.kernel_libraries
  298. var self = this;
  299. var all_resolved = new Combo(function(resolved_kernel_files, resolved_compiler_files) {
  300. self.resolve_init(resolved_compiler_files[0]);
  301. });
  302. this.resolve_kernel(all_resolved.add());
  303. this.resolve_compiler(all_resolved.add());
  304. };
  305. /**
  306. * Resolve .js files needed by kernel
  307. * callback is evaluated afterwards.
  308. */
  309. AmberC.prototype.resolve_kernel = function(callback) {
  310. var self = this;
  311. var kernel_files = this.kernel_libraries.concat(this.defaults.load);
  312. var kernel_resolved = new Combo(function() {
  313. var foundLibraries = [];
  314. Array.prototype.slice.call(arguments).forEach(function(file) {
  315. if (undefined !== file[0]) {
  316. foundLibraries.push(file[0]);
  317. }
  318. });
  319. // boot.js and Kernel files need to be used first
  320. // otherwise the global smalltalk object is undefined
  321. self.defaults.libraries = foundLibraries.concat(self.defaults.libraries);
  322. callback(null);
  323. });
  324. kernel_files.forEach(function(file) {
  325. self.resolve_js(file, kernel_resolved.add());
  326. });
  327. always_resolve(kernel_resolved.add());
  328. };
  329. /**
  330. * Resolve .js files needed by compiler.
  331. * callback is evaluated afterwards with resolved files as argument.
  332. */
  333. AmberC.prototype.resolve_compiler = function(callback) {
  334. // Resolve compiler libraries
  335. var compiler_files = this.compiler_libraries.concat(this.defaults.load);
  336. var compiler_resolved = new Combo(function() {
  337. var compilerFiles = [];
  338. Array.prototype.slice.call(arguments).forEach(function(file) {
  339. if (undefined !== file[0]) {
  340. compilerFiles.push(file[0]);
  341. }
  342. });
  343. callback(compilerFiles);
  344. });
  345. var self = this
  346. compiler_files.forEach(function(file) {
  347. self.resolve_js(file, compiler_resolved.add());
  348. });
  349. always_resolve(compiler_resolved.add());
  350. };
  351. /**
  352. * Resolves default.init and adds it to compilerFiles.
  353. * Followed by create_compiler().
  354. */
  355. AmberC.prototype.resolve_init = function(compilerFiles) {
  356. // check and add init.js
  357. var initFile = this.defaults.init;
  358. if ('.js' !== path.extname(initFile)) {
  359. initFile = this.resolve_js(initFile);
  360. this.defaults.init = initFile;
  361. }
  362. compilerFiles.push(initFile);
  363. this.create_compiler(compilerFiles);
  364. };
  365. /**
  366. * Read all .js files needed by compiler and eval() them.
  367. * The finished Compiler gets stored in defaults.smalltalk.
  368. * Followed by compile().
  369. */
  370. AmberC.prototype.create_compiler = function(compilerFilesArray) {
  371. var self = this;
  372. var compiler_files = new Combo(function() {
  373. var content = '(function() {';
  374. Array.prototype.slice.call(arguments).forEach(function(data) {
  375. // data is an array where index 0 is the error code and index 1 contains the data
  376. content += data[1];
  377. });
  378. content = content + 'return global_smalltalk;})();';
  379. self.defaults.smalltalk = eval(content);
  380. console.log('Compiler loaded');
  381. self.defaults.smalltalk.ErrorHandler._setCurrent_(self.defaults.smalltalk.RethrowErrorHandler._new());
  382. if(0 != self.defaults.jsGlobals.length) {
  383. var jsGlobalVariables = self.defaults.smalltalk.globalJsVariables;
  384. jsGlobalVariables.push.apply(jsGlobalVariables, self.defaults.jsGlobals);
  385. }
  386. self.compile();
  387. });
  388. compilerFilesArray.forEach(function(file) {
  389. console.log('Loading file: ' + file);
  390. fs.readFile(file, compiler_files.add());
  391. });
  392. };
  393. /**
  394. * Compile all given .st files by importing them.
  395. * Followed by category_export().
  396. */
  397. AmberC.prototype.compile = function() {
  398. console.log('Compiling collected .st files')
  399. // import .st files
  400. var self = this;
  401. var imports = new Combo(function() {
  402. Array.prototype.slice.call(arguments).forEach(function(code) {
  403. if (undefined !== code[0]) {
  404. // get element 0 of code since all return values are stored inside an array by Combo
  405. self.defaults.smalltalk.Importer._new()._import_(code[0]._stream());
  406. }
  407. });
  408. self.category_export();
  409. });
  410. this.defaults.compile.forEach(function(stFile) {
  411. var callback = imports.add();
  412. if (/\.st/.test(stFile)) {
  413. console.ambercLog('Importing: ' + stFile);
  414. fs.readFile(stFile, 'utf8', function(err, data) {
  415. if (!err)
  416. callback(data);
  417. else
  418. throw new Error('Could not import: ' + stFile);
  419. });
  420. }
  421. });
  422. always_resolve(imports.add());
  423. };
  424. /**
  425. * Export compiled categories to JavaScript files.
  426. * Followed by verify().
  427. */
  428. AmberC.prototype.category_export = function() {
  429. var defaults = this.defaults;
  430. var self = this;
  431. // export categories as .js
  432. async_map(defaults.compile, function(stFile, callback) {
  433. var category = path.basename(stFile, '.st');
  434. var jsFilePath = defaults.output_dir;
  435. if (undefined === jsFilePath) {
  436. jsFilePath = path.dirname(stFile);
  437. }
  438. var jsFile = category + defaults.suffix_used + '.js';
  439. jsFile = path.join(jsFilePath, jsFile);
  440. defaults.compiled.push(jsFile);
  441. var jsFileDeploy = category + defaults.suffix_used + '.deploy.js';
  442. jsFileDeploy = path.join(jsFilePath, jsFileDeploy);
  443. console.log('Exporting ' + (defaults.deploy ? '(debug + deploy)' : '(debug)')
  444. + ' category ' + category + ' as ' + jsFile
  445. + (defaults.deploy ? ' and ' + jsFileDeploy : ''));
  446. var smalltalk = defaults.smalltalk;
  447. var pluggableExporter = smalltalk.PluggableExporter;
  448. var packageObject = smalltalk.Package._named_(category);
  449. fs.writeFile(jsFile, smalltalk.String._streamContents_(function (stream) {
  450. pluggableExporter._forRecipe_(smalltalk.Exporter._default()._recipe())._exportPackage_on_(packageObject, stream); }), function(err) {
  451. if (defaults.deploy) {
  452. fs.writeFile(jsFileDeploy, smalltalk.String._streamContents_(function (stream) {
  453. pluggableExporter._forRecipe_(smalltalk.StrippedExporter._default()._recipe())._exportPackage_on_(packageObject, stream); }), callback);
  454. } else {
  455. callback(null, null);
  456. }
  457. });
  458. }, function(err, result){
  459. self.verify();
  460. });
  461. };
  462. /**
  463. * Verify if all .st files have been compiled.
  464. * Followed by compose_js_files() and optimize().
  465. */
  466. AmberC.prototype.verify = function() {
  467. console.log('Verifying if all .st files were compiled');
  468. var self = this;
  469. // copy array
  470. var compiledFiles = this.defaults.compiled.slice(0);
  471. // append deploy files if necessary
  472. if (true === this.defaults.deploy) {
  473. this.defaults.compiled.forEach(function(file) {
  474. compiledFiles.push(file.replace(/\.js/g, '.deploy.js'));
  475. });
  476. }
  477. async_map(compiledFiles,
  478. function(file, callback) {
  479. fs.exists(file, function(exists) {
  480. if (exists)
  481. callback(null, null);
  482. else
  483. throw(new Error('Compilation failed of: ' + file));
  484. });
  485. }, function(err, result) {
  486. self.compose_js_files();
  487. });
  488. };
  489. /**
  490. * Synchronous function.
  491. * Concatenates compiled JavaScript files into one file in the correct order.
  492. * The name of the produced file is given by defaults.program (set by the last commandline option).
  493. */
  494. AmberC.prototype.compose_js_files = function() {
  495. var defaults = this.defaults;
  496. var self = this;
  497. var programFile = defaults.program;
  498. if (undefined === programFile) {
  499. self.optimize();
  500. return;
  501. }
  502. if (undefined !== defaults.output_dir) {
  503. programFile = path.join(defaults.output_dir, programFile);
  504. }
  505. var program_files = [];
  506. if (0 !== defaults.libraries.length) {
  507. console.log('Collecting libraries: ' + defaults.libraries);
  508. program_files.push.apply(program_files, defaults.libraries);
  509. }
  510. if (0 !== defaults.compiled.length) {
  511. var compiledFiles = defaults.compiled.slice(0);
  512. if (true === defaults.deploy) {
  513. compiledFiles = compiledFiles.map(function(file) {
  514. return file.replace(/\.js$/g, '.deploy.js');
  515. });
  516. }
  517. console.log('Collecting compiled files: ' + compiledFiles);
  518. program_files.push.apply(program_files, compiledFiles);
  519. }
  520. if (undefined !== defaults.init) {
  521. console.log('Adding initializer ' + defaults.init);
  522. program_files.push(defaults.init);
  523. }
  524. console.ambercLog('Writing program file: %s.js', programFile);
  525. var fileStream = fs.createWriteStream(programFile + defaults.suffix_used + '.js');
  526. fileStream.on('error', function(error) {
  527. fileStream.end();
  528. console.ambercLog(error);
  529. });
  530. fileStream.on('close', function(){
  531. self.optimize();
  532. });
  533. program_files.forEach(function(file) {
  534. if(fs.existsSync(file)) {
  535. console.log('Adding : ' + file);
  536. fileStream.write(fs.readFileSync(file));
  537. } else {
  538. fileStream.end();
  539. throw(new Error('Can not find file ' + file));
  540. }
  541. });
  542. if (undefined !== defaults.main) {
  543. console.log('Adding call to: %s>>main', defaults.main);
  544. fileStream.write('smalltalk.' + defaults.main + '._main()');
  545. }
  546. if (undefined !== defaults.mainfile && fs.existsSync(defaults.mainfile)) {
  547. console.log('Adding main file: ' + defaults.mainfile);
  548. fileStream.write(fs.readFileSync(defaults.mainfile));
  549. }
  550. console.log('Done.');
  551. fileStream.end();
  552. };
  553. /**
  554. * Optimize created JavaScript files with Google Closure compiler depending
  555. * on the flags: defaults.closure_parts, defaults.closure_full.
  556. */
  557. AmberC.prototype.optimize = function() {
  558. var defaults = this.defaults;
  559. var self = this;
  560. var optimization_done = new Combo(function() {
  561. console.log = console.ambercLog;
  562. console.timeEnd('Compile Time');
  563. if (undefined !== defaults.finished_callback) {
  564. defaults.finished_callback();
  565. }
  566. });
  567. if (defaults.closure_parts) {
  568. console.log('Compiling all js files using Google closure compiler.');
  569. defaults.compiled.forEach(function(file) {
  570. var deployFile = file.replace(/\.js$/g, '.deploy.js');
  571. console.log('Compiling ' + deployFile + ' file using Google closure compiler.');
  572. var minifiedName = deployFile.replace(/\.js$/g, '.min.js');
  573. self.closure_compile(deployFile, minifiedName, optimization_done.add());
  574. });
  575. }
  576. if (defaults.closure_full && (undefined !== defaults.program)) {
  577. var programFile = defaults.program;
  578. if (undefined !== defaults.output_dir) {
  579. programFile = path.join(defaults.output_dir, programFile);
  580. }
  581. console.log('Compiling ' + programFile + '.js file using Google closure compiler.');
  582. self.closure_compile(programFile + '.js', programFile + '.min.js', optimization_done.add());
  583. }
  584. always_resolve(optimization_done.add());
  585. };
  586. /**
  587. * Compile sourceFile into minifiedFile with Google Closure compiler.
  588. * callback gets executed once finished.
  589. */
  590. AmberC.prototype.closure_compile = function(sourceFile, minifiedFile, callback) {
  591. // exec is asynchronous
  592. var self = this;
  593. exec(
  594. 'java -jar ' +
  595. self.closure_jar + ' ' +
  596. self.defaults.closure_options +
  597. ' --js '+ sourceFile +
  598. ' --js_output_file '+ minifiedFile,
  599. function (error, stdout, stderr) {
  600. if (error) {
  601. console.log(stderr);
  602. } else {
  603. console.log(stdout);
  604. console.log('Minified: '+ minifiedFile);
  605. }
  606. callback();
  607. }
  608. );
  609. };
  610. module.exports.Compiler = AmberC;
  611. module.exports.createDefaults = createDefaults;
  612. module.exports.Combo = Combo;
  613. module.exports.map = async_map;