amberc.js 19 KB

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