Importer-Exporter.deploy.js 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593
  1. define("amber/Importer-Exporter", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st","amber/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Importer-Exporter');
  3. smalltalk.packages["Importer-Exporter"].transport = {"type":"amd","amdNamespace":"amber"};
  4. smalltalk.addClass('AmdExporter', smalltalk.Object, [], 'Importer-Exporter');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "amdNamesOfPackages:",
  8. fn: function (anArray){
  9. var self=this;
  10. var deps,depNames;
  11. return smalltalk.withContext(function($ctx1) {
  12. var $1;
  13. $1=_st(_st(anArray)._select_((function(each){
  14. return smalltalk.withContext(function($ctx2) {
  15. return _st(_st(each)._amdNamespace())._notNil();
  16. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._collect_((function(each){
  17. return smalltalk.withContext(function($ctx2) {
  18. return _st(_st(_st(each)._amdNamespace()).__comma("/")).__comma(_st(each)._name());
  19. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20. return $1;
  21. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray,deps:deps,depNames:depNames},smalltalk.AmdExporter.klass)})},
  22. messageSends: ["collect:", ",", "name", "amdNamespace", "select:", "notNil"]}),
  23. smalltalk.AmdExporter.klass);
  24. smalltalk.addMethod(
  25. smalltalk.method({
  26. selector: "exportPackageEpilogueOf:on:",
  27. fn: function (aPackage,aStream){
  28. var self=this;
  29. return smalltalk.withContext(function($ctx1) {
  30. var $1,$2;
  31. $1=aStream;
  32. _st($1)._nextPutAll_("});");
  33. $2=_st($1)._lf();
  34. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
  35. messageSends: ["nextPutAll:", "lf"]}),
  36. smalltalk.AmdExporter.klass);
  37. smalltalk.addMethod(
  38. smalltalk.method({
  39. selector: "exportPackagePrologueOf:on:",
  40. fn: function (aPackage,aStream){
  41. var self=this;
  42. return smalltalk.withContext(function($ctx1) {
  43. var $1,$2,$4,$3,$5;
  44. $1=aStream;
  45. _st($1)._nextPutAll_("define(\x22");
  46. $2=$1;
  47. $4=_st(aPackage)._amdNamespace();
  48. if(($receiver = $4) == nil || $receiver == undefined){
  49. $3="amber";
  50. } else {
  51. $3=$4;
  52. };
  53. _st($2)._nextPutAll_($3);
  54. _st($1)._nextPutAll_("/");
  55. _st($1)._nextPutAll_(_st(aPackage)._name());
  56. _st($1)._nextPutAll_("\x22, [");
  57. _st($1)._nextPutAll_(_st(_st(["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st"].__comma(self._amdNamesOfPackages_(_st(aPackage)._loadDependencies())))._collect_((function(each){
  58. return smalltalk.withContext(function($ctx2) {
  59. return _st(each)._asJavascript();
  60. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._join_(","));
  61. _st($1)._nextPutAll_("], function(smalltalk,nil,_st){");
  62. $5=_st($1)._lf();
  63. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
  64. messageSends: ["nextPutAll:", "ifNil:", "amdNamespace", "name", "join:", "collect:", "asJavascript", ",", "amdNamesOfPackages:", "loadDependencies", "lf"]}),
  65. smalltalk.AmdExporter.klass);
  66. smalltalk.addMethod(
  67. smalltalk.method({
  68. selector: "exportPackageTransportOf:on:",
  69. fn: function (aPackage,aStream){
  70. var self=this;
  71. return smalltalk.withContext(function($ctx1) {
  72. var $1,$2;
  73. $1=aStream;
  74. _st($1)._nextPutAll_("smalltalk.packages[");
  75. _st($1)._nextPutAll_(_st(_st(aPackage)._name())._asJavascript());
  76. _st($1)._nextPutAll_("].transport = ");
  77. _st($1)._nextPutAll_(_st(aPackage)._transportJson());
  78. _st($1)._nextPutAll_(";");
  79. $2=_st($1)._lf();
  80. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
  81. messageSends: ["nextPutAll:", "asJavascript", "name", "transportJson", "lf"]}),
  82. smalltalk.AmdExporter.klass);
  83. smalltalk.addClass('ChunkExporter', smalltalk.Object, [], 'Importer-Exporter');
  84. smalltalk.addMethod(
  85. smalltalk.method({
  86. selector: "chunkEscape:",
  87. fn: function (aString){
  88. var self=this;
  89. return smalltalk.withContext(function($ctx1) {
  90. var $1;
  91. $1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
  92. return $1;
  93. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},smalltalk.ChunkExporter.klass)})},
  94. messageSends: ["trimBoth", "replace:with:"]}),
  95. smalltalk.ChunkExporter.klass);
  96. smalltalk.addMethod(
  97. smalltalk.method({
  98. selector: "classNameFor:",
  99. fn: function (aClass){
  100. var self=this;
  101. return smalltalk.withContext(function($ctx1) {
  102. var $2,$3,$1;
  103. $2=_st(aClass)._isMetaclass();
  104. if(smalltalk.assert($2)){
  105. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(" class");
  106. } else {
  107. $3=_st(aClass)._isNil();
  108. if(smalltalk.assert($3)){
  109. $1="nil";
  110. } else {
  111. $1=_st(aClass)._name();
  112. };
  113. };
  114. return $1;
  115. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.ChunkExporter.klass)})},
  116. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
  117. smalltalk.ChunkExporter.klass);
  118. smalltalk.addMethod(
  119. smalltalk.method({
  120. selector: "exportCategoryEpilogueOf:on:",
  121. fn: function (category,aStream){
  122. var self=this;
  123. return smalltalk.withContext(function($ctx1) {
  124. var $1,$2;
  125. $1=aStream;
  126. _st($1)._nextPutAll_(" !");
  127. _st($1)._lf();
  128. $2=_st($1)._lf();
  129. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{category:category,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  130. messageSends: ["nextPutAll:", "lf"]}),
  131. smalltalk.ChunkExporter.klass);
  132. smalltalk.addMethod(
  133. smalltalk.method({
  134. selector: "exportCategoryPrologueOf:on:",
  135. fn: function (category,aStream){
  136. var self=this;
  137. return smalltalk.withContext(function($ctx1) {
  138. var $1,$2;
  139. $1=aStream;
  140. _st($1)._nextPutAll_("!".__comma(self._classNameFor_(_st(category)._at_("class"))));
  141. $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(_st(category)._at_("name"))).__comma("'!"));
  142. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{category:category,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  143. messageSends: ["nextPutAll:", ",", "classNameFor:", "at:"]}),
  144. smalltalk.ChunkExporter.klass);
  145. smalltalk.addMethod(
  146. smalltalk.method({
  147. selector: "exportDefinitionOf:on:",
  148. fn: function (aClass,aStream){
  149. var self=this;
  150. return smalltalk.withContext(function($ctx1) {
  151. var $1,$2,$3,$4,$5,$6,$7;
  152. $1=aStream;
  153. _st($1)._nextPutAll_(self._classNameFor_(_st(aClass)._superclass()));
  154. _st($1)._nextPutAll_(" subclass: #".__comma(self._classNameFor_(aClass)));
  155. _st($1)._lf();
  156. _st($1)._tab();
  157. $2=_st($1)._nextPutAll_("instanceVariableNames: '");
  158. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  159. return smalltalk.withContext(function($ctx2) {
  160. return _st(aStream)._nextPutAll_(each);
  161. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  162. return smalltalk.withContext(function($ctx2) {
  163. return _st(aStream)._nextPutAll_(" ");
  164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  165. $3=aStream;
  166. _st($3)._nextPutAll_("'");
  167. _st($3)._lf();
  168. _st($3)._tab();
  169. _st($3)._nextPutAll_(_st("package: '".__comma(_st(aClass)._category())).__comma("'!"));
  170. $4=_st($3)._lf();
  171. $5=_st(_st(aClass)._comment())._notEmpty();
  172. if(smalltalk.assert($5)){
  173. $6=aStream;
  174. _st($6)._nextPutAll_(_st("!".__comma(self._classNameFor_(aClass))).__comma(" commentStamp!"));
  175. _st($6)._lf();
  176. _st($6)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  177. $7=_st($6)._lf();
  178. $7;
  179. };
  180. _st(aStream)._lf();
  181. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  182. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "chunkEscape:", "comment", "notEmpty"]}),
  183. smalltalk.ChunkExporter.klass);
  184. smalltalk.addMethod(
  185. smalltalk.method({
  186. selector: "exportMetaDefinitionOf:on:",
  187. fn: function (aClass,aStream){
  188. var self=this;
  189. return smalltalk.withContext(function($ctx1) {
  190. var $1,$2,$3,$4,$5;
  191. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  192. if(! smalltalk.assert($1)){
  193. $2=aStream;
  194. _st($2)._nextPutAll_(self._classNameFor_(_st(aClass)._class()));
  195. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  196. $3;
  197. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  198. return smalltalk.withContext(function($ctx2) {
  199. return _st(aStream)._nextPutAll_(each);
  200. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  201. return smalltalk.withContext(function($ctx2) {
  202. return _st(aStream)._nextPutAll_(" ");
  203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  204. $4=aStream;
  205. _st($4)._nextPutAll_("'!");
  206. _st($4)._lf();
  207. $5=_st($4)._lf();
  208. $5;
  209. };
  210. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  211. messageSends: ["ifFalse:", "nextPutAll:", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"]}),
  212. smalltalk.ChunkExporter.klass);
  213. smalltalk.addMethod(
  214. smalltalk.method({
  215. selector: "exportMethod:on:",
  216. fn: function (aMethod,aStream){
  217. var self=this;
  218. return smalltalk.withContext(function($ctx1) {
  219. var $1,$2;
  220. $1=aStream;
  221. _st($1)._lf();
  222. _st($1)._lf();
  223. _st($1)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  224. _st($1)._lf();
  225. $2=_st($1)._nextPutAll_("!");
  226. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  227. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]}),
  228. smalltalk.ChunkExporter.klass);
  229. smalltalk.addMethod(
  230. smalltalk.method({
  231. selector: "exportPackageDefinitionOf:on:",
  232. fn: function (package_,aStream){
  233. var self=this;
  234. return smalltalk.withContext(function($ctx1) {
  235. var $1,$2;
  236. $1=aStream;
  237. _st($1)._nextPutAll_(_st("Smalltalk current createPackage: '".__comma(_st(package_)._name())).__comma("'!"));
  238. $2=_st($1)._lf();
  239. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  240. messageSends: ["nextPutAll:", ",", "name", "lf"]}),
  241. smalltalk.ChunkExporter.klass);
  242. smalltalk.addMethod(
  243. smalltalk.method({
  244. selector: "extensionCategoriesOfPackage:",
  245. fn: function (package_){
  246. var self=this;
  247. var name,map,result;
  248. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  249. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  250. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  251. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  252. return smalltalk.withContext(function($ctx1) {
  253. var $1,$2;
  254. name=_st(package_)._name();
  255. result=_st($OrderedCollection())._new();
  256. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  257. return smalltalk.withContext(function($ctx2) {
  258. return _st([each,_st(each)._class()])._do_((function(aClass){
  259. return smalltalk.withContext(function($ctx3) {
  260. map=_st($Dictionary())._new();
  261. map;
  262. _st(aClass)._protocolsDo_((function(category,methods){
  263. return smalltalk.withContext(function($ctx4) {
  264. $1=_st(category)._match_("^\x5c*".__comma(name));
  265. if(smalltalk.assert($1)){
  266. return _st(map)._at_put_(category,methods);
  267. };
  268. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})}));
  269. return _st(result)._addAll_(_st(_st(_st(map)._keys())._sorted_((function(a,b){
  270. return smalltalk.withContext(function($ctx4) {
  271. return _st(a).__lt_eq(b);
  272. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._collect_((function(category){
  273. return smalltalk.withContext(function($ctx4) {
  274. return smalltalk.HashedCollection._from_(["methods".__minus_gt(_st(map)._at_(category)),"name".__minus_gt(category),"class".__minus_gt(aClass)]);
  275. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3)})})));
  276. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  277. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  278. $2=result;
  279. return $2;
  280. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{package_:package_,name:name,map:map,result:result},smalltalk.ChunkExporter.klass)})},
  281. messageSends: ["name", "new", "do:", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "addAll:", "collect:", "->", "at:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"]}),
  282. smalltalk.ChunkExporter.klass);
  283. smalltalk.addMethod(
  284. smalltalk.method({
  285. selector: "methodsOfCategory:",
  286. fn: function (category){
  287. var self=this;
  288. return smalltalk.withContext(function($ctx1) {
  289. var $1;
  290. $1=_st(_st(category)._at_("methods"))._sorted_((function(a,b){
  291. return smalltalk.withContext(function($ctx2) {
  292. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  293. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}));
  294. return $1;
  295. }, function($ctx1) {$ctx1.fill(self,"methodsOfCategory:",{category:category},smalltalk.ChunkExporter.klass)})},
  296. messageSends: ["sorted:", "<=", "selector", "at:"]}),
  297. smalltalk.ChunkExporter.klass);
  298. smalltalk.addMethod(
  299. smalltalk.method({
  300. selector: "ownCategoriesOfClass:",
  301. fn: function (aClass){
  302. var self=this;
  303. var map;
  304. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  305. return smalltalk.withContext(function($ctx1) {
  306. var $1,$2;
  307. map=_st($Dictionary())._new();
  308. _st(aClass)._protocolsDo_((function(category,methods){
  309. return smalltalk.withContext(function($ctx2) {
  310. $1=_st(category)._match_("^\x5c*");
  311. if(! smalltalk.assert($1)){
  312. return _st(map)._at_put_(category,methods);
  313. };
  314. }, function($ctx2) {$ctx2.fillBlock({category:category,methods:methods},$ctx1)})}));
  315. $2=_st(_st(_st(map)._keys())._sorted_((function(a,b){
  316. return smalltalk.withContext(function($ctx2) {
  317. return _st(a).__lt_eq(b);
  318. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._collect_((function(category){
  319. return smalltalk.withContext(function($ctx2) {
  320. return smalltalk.HashedCollection._from_(["methods".__minus_gt(_st(map)._at_(category)),"name".__minus_gt(category),"class".__minus_gt(aClass)]);
  321. }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})}));
  322. return $2;
  323. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},smalltalk.ChunkExporter.klass)})},
  324. messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "collect:", "->", "at:", "sorted:", "<=", "keys"]}),
  325. smalltalk.ChunkExporter.klass);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "ownCategoriesOfMetaClass:",
  329. fn: function (aClass){
  330. var self=this;
  331. return smalltalk.withContext(function($ctx1) {
  332. var $1;
  333. $1=self._ownCategoriesOfClass_(_st(aClass)._class());
  334. return $1;
  335. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},smalltalk.ChunkExporter.klass)})},
  336. messageSends: ["ownCategoriesOfClass:", "class"]}),
  337. smalltalk.ChunkExporter.klass);
  338. smalltalk.addMethod(
  339. smalltalk.method({
  340. selector: "recipe",
  341. fn: function (){
  342. var self=this;
  343. var exportCategoryRecipe;
  344. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  345. return smalltalk.withContext(function($ctx1) {
  346. var $1;
  347. exportCategoryRecipe=[self.__minus_gt("exportCategoryPrologueOf:on:"),[self.__minus_gt("methodsOfCategory:"),self.__minus_gt("exportMethod:on:")],self.__minus_gt("exportCategoryEpilogueOf:on:")];
  348. $1=[self.__minus_gt("exportPackageDefinitionOf:on:"),[_st($PluggableExporter()).__minus_gt("ownClassesOfPackage:"),self.__minus_gt("exportDefinitionOf:on:"),_st([self.__minus_gt("ownCategoriesOfClass:")]).__comma(exportCategoryRecipe),self.__minus_gt("exportMetaDefinitionOf:on:"),_st([self.__minus_gt("ownCategoriesOfMetaClass:")]).__comma(exportCategoryRecipe)],_st([self.__minus_gt("extensionCategoriesOfPackage:")]).__comma(exportCategoryRecipe)];
  349. return $1;
  350. }, function($ctx1) {$ctx1.fill(self,"recipe",{exportCategoryRecipe:exportCategoryRecipe},smalltalk.ChunkExporter.klass)})},
  351. messageSends: ["->", ","]}),
  352. smalltalk.ChunkExporter.klass);
  353. smalltalk.addClass('ChunkParser', smalltalk.Object, ['stream'], 'Importer-Exporter');
  354. smalltalk.addMethod(
  355. smalltalk.method({
  356. selector: "nextChunk",
  357. fn: function (){
  358. var self=this;
  359. var char,result,chunk;
  360. return smalltalk.withContext(function($ctx1) {
  361. var $1,$2,$3;
  362. var $early={};
  363. try {
  364. result=""._writeStream();
  365. _st((function(){
  366. return smalltalk.withContext(function($ctx2) {
  367. char=_st(self["@stream"])._next();
  368. char;
  369. return _st(char)._notNil();
  370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  371. return smalltalk.withContext(function($ctx2) {
  372. $1=_st(char).__eq("!");
  373. if(smalltalk.assert($1)){
  374. $2=_st(_st(self["@stream"])._peek()).__eq("!");
  375. if(smalltalk.assert($2)){
  376. _st(self["@stream"])._next();
  377. } else {
  378. $3=_st(_st(result)._contents())._trimBoth();
  379. throw $early=[$3];
  380. };
  381. };
  382. return _st(result)._nextPut_(char);
  383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  384. return nil;
  385. }
  386. catch(e) {if(e===$early)return e[0]; throw e}
  387. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},smalltalk.ChunkParser)})},
  388. messageSends: ["writeStream", "whileTrue:", "ifTrue:", "ifTrue:ifFalse:", "next", "trimBoth", "contents", "=", "peek", "nextPut:", "notNil"]}),
  389. smalltalk.ChunkParser);
  390. smalltalk.addMethod(
  391. smalltalk.method({
  392. selector: "stream:",
  393. fn: function (aStream){
  394. var self=this;
  395. return smalltalk.withContext(function($ctx1) {
  396. self["@stream"]=aStream;
  397. return self}, function($ctx1) {$ctx1.fill(self,"stream:",{aStream:aStream},smalltalk.ChunkParser)})},
  398. messageSends: []}),
  399. smalltalk.ChunkParser);
  400. smalltalk.addMethod(
  401. smalltalk.method({
  402. selector: "on:",
  403. fn: function (aStream){
  404. var self=this;
  405. return smalltalk.withContext(function($ctx1) {
  406. var $1;
  407. $1=_st(self._new())._stream_(aStream);
  408. return $1;
  409. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},smalltalk.ChunkParser.klass)})},
  410. messageSends: ["stream:", "new"]}),
  411. smalltalk.ChunkParser.klass);
  412. smalltalk.addClass('Exporter', smalltalk.Object, [], 'Importer-Exporter');
  413. smalltalk.addMethod(
  414. smalltalk.method({
  415. selector: "amdRecipe",
  416. fn: function (){
  417. var self=this;
  418. var legacy;
  419. function $AmdExporter(){return smalltalk.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  420. return smalltalk.withContext(function($ctx1) {
  421. var $1;
  422. legacy=self._recipe();
  423. $1=_st(_st(_st(legacy)._copyFrom_to_((1),(2))).__comma([_st($AmdExporter()).__minus_gt("exportPackageTransportOf:on:")])).__comma(_st(legacy)._copyFrom_to_((3),_st(legacy)._size()));
  424. return $1;
  425. }, function($ctx1) {$ctx1.fill(self,"amdRecipe",{legacy:legacy},smalltalk.Exporter.klass)})},
  426. messageSends: ["recipe", ",", "copyFrom:to:", "size", "->"]}),
  427. smalltalk.Exporter.klass);
  428. smalltalk.addMethod(
  429. smalltalk.method({
  430. selector: "classNameFor:",
  431. fn: function (aClass){
  432. var self=this;
  433. return smalltalk.withContext(function($ctx1) {
  434. var $2,$3,$1;
  435. $2=_st(aClass)._isMetaclass();
  436. if(smalltalk.assert($2)){
  437. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
  438. } else {
  439. $3=_st(aClass)._isNil();
  440. if(smalltalk.assert($3)){
  441. $1="nil";
  442. } else {
  443. $1=_st(aClass)._name();
  444. };
  445. };
  446. return $1;
  447. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.Exporter.klass)})},
  448. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
  449. smalltalk.Exporter.klass);
  450. smalltalk.addMethod(
  451. smalltalk.method({
  452. selector: "exportDefinitionOf:on:",
  453. fn: function (aClass,aStream){
  454. var self=this;
  455. return smalltalk.withContext(function($ctx1) {
  456. var $1,$2,$3,$4,$5,$6,$7;
  457. $1=aStream;
  458. _st($1)._lf();
  459. _st($1)._nextPutAll_("smalltalk.addClass(");
  460. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  461. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  462. $2=_st($1)._nextPutAll_(", [");
  463. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  464. return smalltalk.withContext(function($ctx2) {
  465. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  466. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  467. return smalltalk.withContext(function($ctx2) {
  468. return _st(aStream)._nextPutAll_(", ");
  469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  470. $3=aStream;
  471. _st($3)._nextPutAll_("], '");
  472. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  473. $4=_st($3)._nextPutAll_(");");
  474. $5=_st(_st(aClass)._comment())._notEmpty();
  475. if(smalltalk.assert($5)){
  476. $6=aStream;
  477. _st($6)._lf();
  478. _st($6)._nextPutAll_("smalltalk.");
  479. _st($6)._nextPutAll_(self._classNameFor_(aClass));
  480. _st($6)._nextPutAll_(".comment=");
  481. _st($6)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
  482. $7=_st($6)._nextPutAll_(";");
  483. $7;
  484. };
  485. _st(aStream)._lf();
  486. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter.klass)})},
  487. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "asJavascript", "comment", "notEmpty"]}),
  488. smalltalk.Exporter.klass);
  489. smalltalk.addMethod(
  490. smalltalk.method({
  491. selector: "exportMetaDefinitionOf:on:",
  492. fn: function (aClass,aStream){
  493. var self=this;
  494. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  495. return smalltalk.withContext(function($ctx1) {
  496. var $1,$2,$3;
  497. _st(aStream)._lf();
  498. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  499. if(! smalltalk.assert($1)){
  500. $2=aStream;
  501. _st($2)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._class())));
  502. $3=_st($2)._nextPutAll_(".iVarNames = [");
  503. $3;
  504. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  505. return smalltalk.withContext(function($ctx2) {
  506. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  507. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  508. return smalltalk.withContext(function($ctx2) {
  509. return _st(aStream)._nextPutAll_(",");
  510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  511. _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
  512. };
  513. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter.klass)})},
  514. messageSends: ["lf", "ifFalse:", "nextPutAll:", ",", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "isEmpty"]}),
  515. smalltalk.Exporter.klass);
  516. smalltalk.addMethod(
  517. smalltalk.method({
  518. selector: "exportMethod:on:",
  519. fn: function (aMethod,aStream){
  520. var self=this;
  521. return smalltalk.withContext(function($ctx1) {
  522. var $1,$2,$3,$4;
  523. $1=aStream;
  524. _st($1)._nextPutAll_("smalltalk.addMethod(");
  525. _st($1)._lf();
  526. _st($1)._nextPutAll_("smalltalk.method({");
  527. _st($1)._lf();
  528. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  529. _st($1)._lf();
  530. _st($1)._nextPutAll_(_st("category: '".__comma(_st(aMethod)._category())).__comma("',"));
  531. _st($1)._lf();
  532. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  533. _st($1)._lf();
  534. _st($1)._nextPutAll_(_st("args: ".__comma(_st(_st(aMethod)._arguments())._asJavascript())).__comma(","));
  535. _st($1)._lf();
  536. _st($1)._nextPutAll_(_st("source: ".__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
  537. _st($1)._lf();
  538. _st($1)._nextPutAll_(_st("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript())).__comma(","));
  539. _st($1)._lf();
  540. $2=_st($1)._nextPutAll_("referencedClasses: ".__comma(_st(_st(aMethod)._referencedClasses())._asJavascript()));
  541. $3=aStream;
  542. _st($3)._lf();
  543. _st($3)._nextPutAll_("}),");
  544. _st($3)._lf();
  545. _st($3)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  546. _st($3)._nextPutAll_(");");
  547. _st($3)._lf();
  548. $4=_st($3)._lf();
  549. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.Exporter.klass)})},
  550. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "category", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:", "methodClass"]}),
  551. smalltalk.Exporter.klass);
  552. smalltalk.addMethod(
  553. smalltalk.method({
  554. selector: "exportPackageDefinitionOf:on:",
  555. fn: function (package_,aStream){
  556. var self=this;
  557. return smalltalk.withContext(function($ctx1) {
  558. var $1,$2;
  559. $1=aStream;
  560. _st($1)._nextPutAll_("smalltalk.addPackage(");
  561. _st($1)._nextPutAll_(_st("'".__comma(_st(package_)._name())).__comma("');"));
  562. $2=_st($1)._lf();
  563. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.Exporter.klass)})},
  564. messageSends: ["nextPutAll:", ",", "name", "lf"]}),
  565. smalltalk.Exporter.klass);
  566. smalltalk.addMethod(
  567. smalltalk.method({
  568. selector: "exportPackageEpilogueOf:on:",
  569. fn: function (aPackage,aStream){
  570. var self=this;
  571. return smalltalk.withContext(function($ctx1) {
  572. var $1,$2;
  573. $1=aStream;
  574. _st($1)._nextPutAll_("})(global_smalltalk,global_nil,global__st);");
  575. $2=_st($1)._lf();
  576. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter.klass)})},
  577. messageSends: ["nextPutAll:", "lf"]}),
  578. smalltalk.Exporter.klass);
  579. smalltalk.addMethod(
  580. smalltalk.method({
  581. selector: "exportPackagePrologueOf:on:",
  582. fn: function (aPackage,aStream){
  583. var self=this;
  584. return smalltalk.withContext(function($ctx1) {
  585. var $1,$2;
  586. $1=aStream;
  587. _st($1)._nextPutAll_("(function(smalltalk,nil,_st){");
  588. $2=_st($1)._lf();
  589. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter.klass)})},
  590. messageSends: ["nextPutAll:", "lf"]}),
  591. smalltalk.Exporter.klass);
  592. smalltalk.addMethod(
  593. smalltalk.method({
  594. selector: "extensionMethodsOfPackage:",
  595. fn: function (package_){
  596. var self=this;
  597. var name,result;
  598. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  599. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  600. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  601. return smalltalk.withContext(function($ctx1) {
  602. var $1;
  603. name=_st(package_)._name();
  604. result=_st($OrderedCollection())._new();
  605. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  606. return smalltalk.withContext(function($ctx2) {
  607. return _st([each,_st(each)._class()])._do_((function(aClass){
  608. return smalltalk.withContext(function($ctx3) {
  609. return _st(result)._addAll_(_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  610. return smalltalk.withContext(function($ctx4) {
  611. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  612. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._select_((function(method){
  613. return smalltalk.withContext(function($ctx4) {
  614. return _st(_st(method)._category())._match_("^\x5c*".__comma(name));
  615. }, function($ctx4) {$ctx4.fillBlock({method:method},$ctx3)})})));
  616. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  617. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  618. $1=result;
  619. return $1;
  620. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{package_:package_,name:name,result:result},smalltalk.Exporter.klass)})},
  621. messageSends: ["name", "new", "do:", "addAll:", "select:", "match:", ",", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "class", "sortedClasses:", "classes", "current"]}),
  622. smalltalk.Exporter.klass);
  623. smalltalk.addMethod(
  624. smalltalk.method({
  625. selector: "ownMethodsOfClass:",
  626. fn: function (aClass){
  627. var self=this;
  628. return smalltalk.withContext(function($ctx1) {
  629. var $1;
  630. $1=_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  631. return smalltalk.withContext(function($ctx2) {
  632. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  633. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._reject_((function(each){
  634. return smalltalk.withContext(function($ctx2) {
  635. return _st(_st(each)._category())._match_("^\x5c*");
  636. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  637. return $1;
  638. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},smalltalk.Exporter.klass)})},
  639. messageSends: ["reject:", "match:", "category", "sorted:", "<=", "selector", "values", "methodDictionary"]}),
  640. smalltalk.Exporter.klass);
  641. smalltalk.addMethod(
  642. smalltalk.method({
  643. selector: "ownMethodsOfMetaClass:",
  644. fn: function (aClass){
  645. var self=this;
  646. return smalltalk.withContext(function($ctx1) {
  647. var $1;
  648. $1=self._ownMethodsOfClass_(_st(aClass)._class());
  649. return $1;
  650. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},smalltalk.Exporter.klass)})},
  651. messageSends: ["ownMethodsOfClass:", "class"]}),
  652. smalltalk.Exporter.klass);
  653. smalltalk.addMethod(
  654. smalltalk.method({
  655. selector: "recipe",
  656. fn: function (){
  657. var self=this;
  658. function $AmdExporter(){return smalltalk.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  659. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  660. return smalltalk.withContext(function($ctx1) {
  661. var $1;
  662. $1=[_st($AmdExporter()).__minus_gt("exportPackagePrologueOf:on:"),self.__minus_gt("exportPackageDefinitionOf:on:"),[_st($PluggableExporter()).__minus_gt("ownClassesOfPackage:"),self.__minus_gt("exportDefinitionOf:on:"),[self.__minus_gt("ownMethodsOfClass:"),self.__minus_gt("exportMethod:on:")],self.__minus_gt("exportMetaDefinitionOf:on:"),[self.__minus_gt("ownMethodsOfMetaClass:"),self.__minus_gt("exportMethod:on:")]],[self.__minus_gt("extensionMethodsOfPackage:"),self.__minus_gt("exportMethod:on:")],_st($AmdExporter()).__minus_gt("exportPackageEpilogueOf:on:")];
  663. return $1;
  664. }, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.Exporter.klass)})},
  665. messageSends: ["->"]}),
  666. smalltalk.Exporter.klass);
  667. smalltalk.addClass('StrippedExporter', smalltalk.Exporter, [], 'Importer-Exporter');
  668. smalltalk.addMethod(
  669. smalltalk.method({
  670. selector: "exportDefinitionOf:on:",
  671. fn: function (aClass,aStream){
  672. var self=this;
  673. return smalltalk.withContext(function($ctx1) {
  674. var $1,$2,$3,$4;
  675. $1=aStream;
  676. _st($1)._lf();
  677. _st($1)._nextPutAll_("smalltalk.addClass(");
  678. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  679. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  680. $2=_st($1)._nextPutAll_(", [");
  681. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  682. return smalltalk.withContext(function($ctx2) {
  683. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  684. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  685. return smalltalk.withContext(function($ctx2) {
  686. return _st(aStream)._nextPutAll_(", ");
  687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  688. $3=aStream;
  689. _st($3)._nextPutAll_("], '");
  690. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  691. $4=_st($3)._nextPutAll_(");");
  692. _st(aStream)._lf();
  693. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.StrippedExporter.klass)})},
  694. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category"]}),
  695. smalltalk.StrippedExporter.klass);
  696. smalltalk.addMethod(
  697. smalltalk.method({
  698. selector: "exportMethod:on:",
  699. fn: function (aMethod,aStream){
  700. var self=this;
  701. return smalltalk.withContext(function($ctx1) {
  702. var $1,$2;
  703. $1=aStream;
  704. _st($1)._nextPutAll_("smalltalk.addMethod(");
  705. _st($1)._lf();
  706. _st($1)._nextPutAll_("smalltalk.method({");
  707. _st($1)._lf();
  708. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  709. _st($1)._lf();
  710. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  711. _st($1)._lf();
  712. _st($1)._nextPutAll_("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript()));
  713. _st($1)._nextPutAll_("}),");
  714. _st($1)._lf();
  715. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  716. _st($1)._nextPutAll_(");");
  717. _st($1)._lf();
  718. $2=_st($1)._lf();
  719. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.StrippedExporter.klass)})},
  720. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "compiledSource", "fn", "messageSends", "classNameFor:", "methodClass"]}),
  721. smalltalk.StrippedExporter.klass);
  722. smalltalk.addClass('Importer', smalltalk.Object, [], 'Importer-Exporter');
  723. smalltalk.addMethod(
  724. smalltalk.method({
  725. selector: "import:",
  726. fn: function (aStream){
  727. var self=this;
  728. var chunk,result,parser,lastEmpty;
  729. function $ChunkParser(){return smalltalk.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  730. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  731. return smalltalk.withContext(function($ctx1) {
  732. var $1,$2;
  733. parser=_st($ChunkParser())._on_(aStream);
  734. lastEmpty=false;
  735. _st((function(){
  736. return smalltalk.withContext(function($ctx2) {
  737. chunk=_st(parser)._nextChunk();
  738. chunk;
  739. return _st(chunk)._isNil();
  740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  741. return smalltalk.withContext(function($ctx2) {
  742. $1=_st(chunk)._isEmpty();
  743. if(smalltalk.assert($1)){
  744. lastEmpty=true;
  745. return lastEmpty;
  746. } else {
  747. result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
  748. result;
  749. $2=lastEmpty;
  750. if(smalltalk.assert($2)){
  751. lastEmpty=false;
  752. lastEmpty;
  753. return _st(result)._scanFrom_(parser);
  754. };
  755. };
  756. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  757. return self}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},smalltalk.Importer)})},
  758. messageSends: ["on:", "whileFalse:", "ifTrue:ifFalse:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "isEmpty", "nextChunk", "isNil"]}),
  759. smalltalk.Importer);
  760. smalltalk.addClass('PackageHandler', smalltalk.InterfacingObject, [], 'Importer-Exporter');
  761. smalltalk.addMethod(
  762. smalltalk.method({
  763. selector: "ajaxPutAt:data:",
  764. fn: function (aURL,aString){
  765. var self=this;
  766. return smalltalk.withContext(function($ctx1) {
  767. self._ajax_(smalltalk.HashedCollection._from_(["url".__minus_gt(aURL),"type".__minus_gt("PUT"),"data".__minus_gt(aString),"contentType".__minus_gt("text/plain;charset=UTF-8"),"error".__minus_gt((function(xhr){
  768. return smalltalk.withContext(function($ctx2) {
  769. return self._error_(_st(_st(_st("Commiting ".__comma(aURL)).__comma(" failed with reason: \x22")).__comma(_st(xhr)._responseText())).__comma("\x22"));
  770. }, function($ctx2) {$ctx2.fillBlock({xhr:xhr},$ctx1)})}))]));
  771. return self}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:",{aURL:aURL,aString:aString},smalltalk.PackageHandler)})},
  772. messageSends: ["ajax:", "->", "error:", ",", "responseText"]}),
  773. smalltalk.PackageHandler);
  774. smalltalk.addMethod(
  775. smalltalk.method({
  776. selector: "commit:",
  777. fn: function (aPackage){
  778. var self=this;
  779. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  780. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  781. return smalltalk.withContext(function($ctx1) {
  782. _st(self._commitChannels())._do_displayingProgress_((function(commitStrategyFactory){
  783. var fileContents,commitStrategy;
  784. return smalltalk.withContext(function($ctx2) {
  785. commitStrategy=_st(commitStrategyFactory)._value_(aPackage);
  786. commitStrategy;
  787. fileContents=_st($String())._streamContents_((function(stream){
  788. return smalltalk.withContext(function($ctx3) {
  789. return _st(_st($PluggableExporter())._newUsing_(_st(commitStrategy)._key()))._exportPackage_on_(aPackage,stream);
  790. }, function($ctx3) {$ctx3.fillBlock({stream:stream},$ctx2)})}));
  791. fileContents;
  792. return self._ajaxPutAt_data_(_st(commitStrategy)._value(),fileContents);
  793. }, function($ctx2) {$ctx2.fillBlock({commitStrategyFactory:commitStrategyFactory,fileContents:fileContents,commitStrategy:commitStrategy},$ctx1)})}),"Committing package ".__comma(_st(aPackage)._name()));
  794. return self}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  795. messageSends: ["do:displayingProgress:", "value:", "streamContents:", "exportPackage:on:", "newUsing:", "key", "ajaxPutAt:data:", "value", ",", "name", "commitChannels"]}),
  796. smalltalk.PackageHandler);
  797. smalltalk.PackageHandler.klass.iVarNames = ['registry'];
  798. smalltalk.addMethod(
  799. smalltalk.method({
  800. selector: "classRegisteredFor:",
  801. fn: function (aString){
  802. var self=this;
  803. return smalltalk.withContext(function($ctx1) {
  804. var $1;
  805. $1=_st(self["@registry"])._at_(aString);
  806. return $1;
  807. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},smalltalk.PackageHandler.klass)})},
  808. messageSends: ["at:"]}),
  809. smalltalk.PackageHandler.klass);
  810. smalltalk.addMethod(
  811. smalltalk.method({
  812. selector: "for:",
  813. fn: function (aString){
  814. var self=this;
  815. return smalltalk.withContext(function($ctx1) {
  816. var $1;
  817. $1=_st(self._classRegisteredFor_(aString))._new();
  818. return $1;
  819. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},smalltalk.PackageHandler.klass)})},
  820. messageSends: ["new", "classRegisteredFor:"]}),
  821. smalltalk.PackageHandler.klass);
  822. smalltalk.addMethod(
  823. smalltalk.method({
  824. selector: "initialize",
  825. fn: function (){
  826. var self=this;
  827. return smalltalk.withContext(function($ctx1) {
  828. smalltalk.PackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  829. self["@registry"]=smalltalk.HashedCollection._from_([]);
  830. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.PackageHandler.klass)})},
  831. messageSends: ["initialize"]}),
  832. smalltalk.PackageHandler.klass);
  833. smalltalk.addMethod(
  834. smalltalk.method({
  835. selector: "register:for:",
  836. fn: function (aClass,aString){
  837. var self=this;
  838. return smalltalk.withContext(function($ctx1) {
  839. _st(self["@registry"])._at_put_(aString,aClass);
  840. return self}, function($ctx1) {$ctx1.fill(self,"register:for:",{aClass:aClass,aString:aString},smalltalk.PackageHandler.klass)})},
  841. messageSends: ["at:put:"]}),
  842. smalltalk.PackageHandler.klass);
  843. smalltalk.addMethod(
  844. smalltalk.method({
  845. selector: "registerFor:",
  846. fn: function (aString){
  847. var self=this;
  848. function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
  849. return smalltalk.withContext(function($ctx1) {
  850. _st($PackageHandler())._register_for_(self,aString);
  851. return self}, function($ctx1) {$ctx1.fill(self,"registerFor:",{aString:aString},smalltalk.PackageHandler.klass)})},
  852. messageSends: ["register:for:"]}),
  853. smalltalk.PackageHandler.klass);
  854. smalltalk.addClass('AmdPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
  855. smalltalk.addMethod(
  856. smalltalk.method({
  857. selector: "commitChannels",
  858. fn: function (){
  859. var self=this;
  860. function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  861. function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
  862. function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  863. return smalltalk.withContext(function($ctx1) {
  864. var $1;
  865. $1=[(function(pkg){
  866. return smalltalk.withContext(function($ctx2) {
  867. return _st(_st($Exporter())._amdRecipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".js"));
  868. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  869. return smalltalk.withContext(function($ctx2) {
  870. return _st(_st($StrippedExporter())._amdRecipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".deploy.js"));
  871. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  872. return smalltalk.withContext(function($ctx2) {
  873. return _st(_st($ChunkExporter())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathSt()).__comma("/")).__comma(_st(pkg)._name())).__comma(".st"));
  874. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})})];
  875. return $1;
  876. }, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.AmdPackageHandler)})},
  877. messageSends: ["->", ",", "name", "commitPathJs", "amdRecipe", "commitPathSt", "recipe"]}),
  878. smalltalk.AmdPackageHandler);
  879. smalltalk.addMethod(
  880. smalltalk.method({
  881. selector: "commitPathJsFor:",
  882. fn: function (aPackage){
  883. var self=this;
  884. return smalltalk.withContext(function($ctx1) {
  885. var $1;
  886. $1=self._toUrl_(self._namespaceFor_(aPackage));
  887. return $1;
  888. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  889. messageSends: ["toUrl:", "namespaceFor:"]}),
  890. smalltalk.AmdPackageHandler);
  891. smalltalk.addMethod(
  892. smalltalk.method({
  893. selector: "commitPathStFor:",
  894. fn: function (aPackage){
  895. var self=this;
  896. return smalltalk.withContext(function($ctx1) {
  897. var $1;
  898. $1=self._toUrl_(_st(self._namespaceFor_(aPackage)).__comma("/_source"));
  899. return $1;
  900. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  901. messageSends: ["toUrl:", ",", "namespaceFor:"]}),
  902. smalltalk.AmdPackageHandler);
  903. smalltalk.addMethod(
  904. smalltalk.method({
  905. selector: "namespaceFor:",
  906. fn: function (aPackage){
  907. var self=this;
  908. return smalltalk.withContext(function($ctx1) {
  909. var $2,$3,$4,$1;
  910. $2=_st(aPackage)._amdNamespace();
  911. if(($receiver = $2) == nil || $receiver == undefined){
  912. $3=aPackage;
  913. _st($3)._amdNamespace_(_st(self._class())._defaultNamespace());
  914. $4=_st($3)._amdNamespace();
  915. $1=$4;
  916. } else {
  917. $1=$2;
  918. };
  919. return $1;
  920. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  921. messageSends: ["ifNil:", "amdNamespace:", "defaultNamespace", "class", "amdNamespace"]}),
  922. smalltalk.AmdPackageHandler);
  923. smalltalk.addMethod(
  924. smalltalk.method({
  925. selector: "toUrl:",
  926. fn: function (aString){
  927. var self=this;
  928. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  929. return smalltalk.withContext(function($ctx1) {
  930. var $1,$2;
  931. $1=_st(_st($Smalltalk())._current())._at_("_amd_require");
  932. if(($receiver = $1) == nil || $receiver == undefined){
  933. self._error_("AMD loader not present");
  934. } else {
  935. var require;
  936. require=$receiver;
  937. $2=_st(_st(require)._basicAt_("toUrl"))._value_(aString);
  938. return $2;
  939. };
  940. return self}, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},smalltalk.AmdPackageHandler)})},
  941. messageSends: ["ifNil:ifNotNil:", "error:", "value:", "basicAt:", "at:", "current"]}),
  942. smalltalk.AmdPackageHandler);
  943. smalltalk.AmdPackageHandler.klass.iVarNames = ['defaultNamespace'];
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "commitPathsFromLoader",
  947. fn: function (){
  948. var self=this;
  949. return smalltalk.withContext(function($ctx1) {
  950. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.AmdPackageHandler.klass)})},
  951. messageSends: []}),
  952. smalltalk.AmdPackageHandler.klass);
  953. smalltalk.addMethod(
  954. smalltalk.method({
  955. selector: "defaultNamespace",
  956. fn: function (){
  957. var self=this;
  958. return smalltalk.withContext(function($ctx1) {
  959. var $2,$1;
  960. $2=self["@defaultNamespace"];
  961. if(($receiver = $2) == nil || $receiver == undefined){
  962. $1=self._error_("AMD default namespace not set.");
  963. } else {
  964. $1=$2;
  965. };
  966. return $1;
  967. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},smalltalk.AmdPackageHandler.klass)})},
  968. messageSends: ["ifNil:", "error:"]}),
  969. smalltalk.AmdPackageHandler.klass);
  970. smalltalk.addMethod(
  971. smalltalk.method({
  972. selector: "defaultNamespace:",
  973. fn: function (aString){
  974. var self=this;
  975. return smalltalk.withContext(function($ctx1) {
  976. self["@defaultNamespace"]=aString;
  977. return self}, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},smalltalk.AmdPackageHandler.klass)})},
  978. messageSends: []}),
  979. smalltalk.AmdPackageHandler.klass);
  980. smalltalk.addMethod(
  981. smalltalk.method({
  982. selector: "initialize",
  983. fn: function (){
  984. var self=this;
  985. return smalltalk.withContext(function($ctx1) {
  986. smalltalk.AmdPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  987. self._registerFor_("amd");
  988. self._commitPathsFromLoader();
  989. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.AmdPackageHandler.klass)})},
  990. messageSends: ["initialize", "registerFor:", "commitPathsFromLoader"]}),
  991. smalltalk.AmdPackageHandler.klass);
  992. smalltalk.addMethod(
  993. smalltalk.method({
  994. selector: "resetCommitPaths",
  995. fn: function (){
  996. var self=this;
  997. return smalltalk.withContext(function($ctx1) {
  998. self["@defaultNamespace"]=nil;
  999. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.AmdPackageHandler.klass)})},
  1000. messageSends: []}),
  1001. smalltalk.AmdPackageHandler.klass);
  1002. smalltalk.addClass('LegacyPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
  1003. smalltalk.addMethod(
  1004. smalltalk.method({
  1005. selector: "commitChannels",
  1006. fn: function (){
  1007. var self=this;
  1008. function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  1009. function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
  1010. function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  1011. return smalltalk.withContext(function($ctx1) {
  1012. var $1;
  1013. $1=[(function(pkg){
  1014. return smalltalk.withContext(function($ctx2) {
  1015. return _st(_st($Exporter())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".js"));
  1016. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  1017. return smalltalk.withContext(function($ctx2) {
  1018. return _st(_st($StrippedExporter())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".deploy.js"));
  1019. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  1020. return smalltalk.withContext(function($ctx2) {
  1021. return _st(_st($ChunkExporter())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathSt()).__comma("/")).__comma(_st(pkg)._name())).__comma(".st"));
  1022. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})})];
  1023. return $1;
  1024. }, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.LegacyPackageHandler)})},
  1025. messageSends: ["->", ",", "name", "commitPathJs", "recipe", "commitPathSt"]}),
  1026. smalltalk.LegacyPackageHandler);
  1027. smalltalk.addMethod(
  1028. smalltalk.method({
  1029. selector: "commitPathJsFor:",
  1030. fn: function (aPackage){
  1031. var self=this;
  1032. return smalltalk.withContext(function($ctx1) {
  1033. var $1;
  1034. $1=_st(self._class())._defaultCommitPathJs();
  1035. return $1;
  1036. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  1037. messageSends: ["defaultCommitPathJs", "class"]}),
  1038. smalltalk.LegacyPackageHandler);
  1039. smalltalk.addMethod(
  1040. smalltalk.method({
  1041. selector: "commitPathStFor:",
  1042. fn: function (aPackage){
  1043. var self=this;
  1044. return smalltalk.withContext(function($ctx1) {
  1045. var $1;
  1046. $1=_st(self._class())._defaultCommitPathSt();
  1047. return $1;
  1048. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  1049. messageSends: ["defaultCommitPathSt", "class"]}),
  1050. smalltalk.LegacyPackageHandler);
  1051. smalltalk.addMethod(
  1052. smalltalk.method({
  1053. selector: "loadPackage:prefix:",
  1054. fn: function (packageName,aString){
  1055. var self=this;
  1056. var url;
  1057. return smalltalk.withContext(function($ctx1) {
  1058. var $1;
  1059. url=_st(_st(_st("/".__comma(aString)).__comma("/js/")).__comma(packageName)).__comma(".js");
  1060. self._ajax_(smalltalk.HashedCollection._from_(["url".__minus_gt(url),"type".__minus_gt("GET"),"dataType".__minus_gt("script"),"complete".__minus_gt((function(jqXHR,textStatus){
  1061. return smalltalk.withContext(function($ctx2) {
  1062. $1=_st(_st(jqXHR)._readyState()).__eq((4));
  1063. if(smalltalk.assert($1)){
  1064. return self._setupPackageNamed_prefix_(packageName,aString);
  1065. };
  1066. }, function($ctx2) {$ctx2.fillBlock({jqXHR:jqXHR,textStatus:textStatus},$ctx1)})})),"error".__minus_gt((function(){
  1067. return smalltalk.withContext(function($ctx2) {
  1068. return self._alert_("Could not load package at: ".__comma(url));
  1069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))]));
  1070. return self}, function($ctx1) {$ctx1.fill(self,"loadPackage:prefix:",{packageName:packageName,aString:aString,url:url},smalltalk.LegacyPackageHandler)})},
  1071. messageSends: [",", "ajax:", "->", "ifTrue:", "setupPackageNamed:prefix:", "=", "readyState", "alert:"]}),
  1072. smalltalk.LegacyPackageHandler);
  1073. smalltalk.addMethod(
  1074. smalltalk.method({
  1075. selector: "loadPackages:prefix:",
  1076. fn: function (aCollection,aString){
  1077. var self=this;
  1078. return smalltalk.withContext(function($ctx1) {
  1079. _st(aCollection)._do_((function(each){
  1080. return smalltalk.withContext(function($ctx2) {
  1081. return self._loadPackage_prefix_(each,aString);
  1082. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1083. return self}, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler)})},
  1084. messageSends: ["do:", "loadPackage:prefix:"]}),
  1085. smalltalk.LegacyPackageHandler);
  1086. smalltalk.addMethod(
  1087. smalltalk.method({
  1088. selector: "setupPackageNamed:prefix:",
  1089. fn: function (packageName,aString){
  1090. var self=this;
  1091. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  1092. return smalltalk.withContext(function($ctx1) {
  1093. var $1,$2;
  1094. $1=_st($Package())._named_(packageName);
  1095. _st($1)._setupClasses();
  1096. _st($1)._commitPathJs_(_st("/".__comma(aString)).__comma("/js"));
  1097. $2=_st($1)._commitPathSt_(_st("/".__comma(aString)).__comma("/st"));
  1098. return self}, function($ctx1) {$ctx1.fill(self,"setupPackageNamed:prefix:",{packageName:packageName,aString:aString},smalltalk.LegacyPackageHandler)})},
  1099. messageSends: ["setupClasses", "named:", "commitPathJs:", ",", "commitPathSt:"]}),
  1100. smalltalk.LegacyPackageHandler);
  1101. smalltalk.LegacyPackageHandler.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  1102. smalltalk.addMethod(
  1103. smalltalk.method({
  1104. selector: "commitPathsFromLoader",
  1105. fn: function (){
  1106. var self=this;
  1107. return smalltalk.withContext(function($ctx1) {
  1108. var commitPath = typeof amber !== 'undefined' && amber.commitPath;
  1109. if (!commitPath) return;
  1110. if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);
  1111. if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);
  1112. ;
  1113. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.LegacyPackageHandler.klass)})},
  1114. messageSends: []}),
  1115. smalltalk.LegacyPackageHandler.klass);
  1116. smalltalk.addMethod(
  1117. smalltalk.method({
  1118. selector: "defaultCommitPathJs",
  1119. fn: function (){
  1120. var self=this;
  1121. return smalltalk.withContext(function($ctx1) {
  1122. var $2,$1;
  1123. $2=self["@defaultCommitPathJs"];
  1124. if(($receiver = $2) == nil || $receiver == undefined){
  1125. self["@defaultCommitPathJs"]="js";
  1126. $1=self["@defaultCommitPathJs"];
  1127. } else {
  1128. $1=$2;
  1129. };
  1130. return $1;
  1131. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.LegacyPackageHandler.klass)})},
  1132. messageSends: ["ifNil:"]}),
  1133. smalltalk.LegacyPackageHandler.klass);
  1134. smalltalk.addMethod(
  1135. smalltalk.method({
  1136. selector: "defaultCommitPathJs:",
  1137. fn: function (aString){
  1138. var self=this;
  1139. return smalltalk.withContext(function($ctx1) {
  1140. self["@defaultCommitPathJs"]=aString;
  1141. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1142. messageSends: []}),
  1143. smalltalk.LegacyPackageHandler.klass);
  1144. smalltalk.addMethod(
  1145. smalltalk.method({
  1146. selector: "defaultCommitPathSt",
  1147. fn: function (){
  1148. var self=this;
  1149. return smalltalk.withContext(function($ctx1) {
  1150. var $2,$1;
  1151. $2=self["@defaultCommitPathSt"];
  1152. if(($receiver = $2) == nil || $receiver == undefined){
  1153. self["@defaultCommitPathSt"]="st";
  1154. $1=self["@defaultCommitPathSt"];
  1155. } else {
  1156. $1=$2;
  1157. };
  1158. return $1;
  1159. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.LegacyPackageHandler.klass)})},
  1160. messageSends: ["ifNil:"]}),
  1161. smalltalk.LegacyPackageHandler.klass);
  1162. smalltalk.addMethod(
  1163. smalltalk.method({
  1164. selector: "defaultCommitPathSt:",
  1165. fn: function (aString){
  1166. var self=this;
  1167. return smalltalk.withContext(function($ctx1) {
  1168. self["@defaultCommitPathSt"]=aString;
  1169. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1170. messageSends: []}),
  1171. smalltalk.LegacyPackageHandler.klass);
  1172. smalltalk.addMethod(
  1173. smalltalk.method({
  1174. selector: "initialize",
  1175. fn: function (){
  1176. var self=this;
  1177. return smalltalk.withContext(function($ctx1) {
  1178. smalltalk.LegacyPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  1179. self._registerFor_("unknown");
  1180. self._commitPathsFromLoader();
  1181. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.LegacyPackageHandler.klass)})},
  1182. messageSends: ["initialize", "registerFor:", "commitPathsFromLoader"]}),
  1183. smalltalk.LegacyPackageHandler.klass);
  1184. smalltalk.addMethod(
  1185. smalltalk.method({
  1186. selector: "loadPackages:prefix:",
  1187. fn: function (aCollection,aString){
  1188. var self=this;
  1189. return smalltalk.withContext(function($ctx1) {
  1190. var $1;
  1191. $1=_st(self._new())._loadPackages_prefix_(aCollection,aString);
  1192. return $1;
  1193. }, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1194. messageSends: ["loadPackages:prefix:", "new"]}),
  1195. smalltalk.LegacyPackageHandler.klass);
  1196. smalltalk.addMethod(
  1197. smalltalk.method({
  1198. selector: "resetCommitPaths",
  1199. fn: function (){
  1200. var self=this;
  1201. return smalltalk.withContext(function($ctx1) {
  1202. self["@defaultCommitPathJs"]=nil;
  1203. self["@defaultCommitPathSt"]=nil;
  1204. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.LegacyPackageHandler.klass)})},
  1205. messageSends: []}),
  1206. smalltalk.LegacyPackageHandler.klass);
  1207. smalltalk.addClass('PluggableExporter', smalltalk.Object, ['recipe'], 'Importer-Exporter');
  1208. smalltalk.addMethod(
  1209. smalltalk.method({
  1210. selector: "export:usingRecipe:on:",
  1211. fn: function (anObject,anArray,aStream){
  1212. var self=this;
  1213. var args;
  1214. return smalltalk.withContext(function($ctx1) {
  1215. var $1;
  1216. args=[anObject,aStream];
  1217. _st(anArray)._do_((function(each){
  1218. var val;
  1219. return smalltalk.withContext(function($ctx2) {
  1220. val=_st(each)._value();
  1221. val;
  1222. $1=_st(val).__eq_eq(each);
  1223. if(smalltalk.assert($1)){
  1224. var selection;
  1225. selection=_st(_st(_st(each)._first())._key())._perform_withArguments_(_st(_st(each)._first())._value(),[anObject]);
  1226. selection;
  1227. return _st(selection)._do_((function(eachPart){
  1228. return smalltalk.withContext(function($ctx3) {
  1229. return self._export_usingRecipe_on_(eachPart,_st(each)._allButFirst(),aStream);
  1230. }, function($ctx3) {$ctx3.fillBlock({eachPart:eachPart},$ctx2)})}));
  1231. } else {
  1232. return _st(_st(each)._key())._perform_withArguments_(val,args);
  1233. };
  1234. }, function($ctx2) {$ctx2.fillBlock({each:each,val:val},$ctx1)})}));
  1235. return self}, function($ctx1) {$ctx1.fill(self,"export:usingRecipe:on:",{anObject:anObject,anArray:anArray,aStream:aStream,args:args},smalltalk.PluggableExporter)})},
  1236. messageSends: ["do:", "value", "ifFalse:ifTrue:", "perform:withArguments:", "key", "first", "export:usingRecipe:on:", "allButFirst", "=="]}),
  1237. smalltalk.PluggableExporter);
  1238. smalltalk.addMethod(
  1239. smalltalk.method({
  1240. selector: "exportAll",
  1241. fn: function (){
  1242. var self=this;
  1243. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1244. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1245. return smalltalk.withContext(function($ctx1) {
  1246. var $1;
  1247. $1=_st($String())._streamContents_((function(stream){
  1248. return smalltalk.withContext(function($ctx2) {
  1249. return _st(_st(_st($Smalltalk())._current())._packages())._do_((function(pkg){
  1250. return smalltalk.withContext(function($ctx3) {
  1251. return self._exportPackage_on_(pkg,stream);
  1252. }, function($ctx3) {$ctx3.fillBlock({pkg:pkg},$ctx2)})}));
  1253. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  1254. return $1;
  1255. }, function($ctx1) {$ctx1.fill(self,"exportAll",{},smalltalk.PluggableExporter)})},
  1256. messageSends: ["streamContents:", "do:", "exportPackage:on:", "packages", "current"]}),
  1257. smalltalk.PluggableExporter);
  1258. smalltalk.addMethod(
  1259. smalltalk.method({
  1260. selector: "exportPackage:on:",
  1261. fn: function (aPackage,aStream){
  1262. var self=this;
  1263. return smalltalk.withContext(function($ctx1) {
  1264. self._export_usingRecipe_on_(aPackage,self._recipe(),aStream);
  1265. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},smalltalk.PluggableExporter)})},
  1266. messageSends: ["export:usingRecipe:on:", "recipe"]}),
  1267. smalltalk.PluggableExporter);
  1268. smalltalk.addMethod(
  1269. smalltalk.method({
  1270. selector: "recipe",
  1271. fn: function (){
  1272. var self=this;
  1273. return smalltalk.withContext(function($ctx1) {
  1274. var $1;
  1275. $1=self["@recipe"];
  1276. return $1;
  1277. }, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.PluggableExporter)})},
  1278. messageSends: []}),
  1279. smalltalk.PluggableExporter);
  1280. smalltalk.addMethod(
  1281. smalltalk.method({
  1282. selector: "recipe:",
  1283. fn: function (anArray){
  1284. var self=this;
  1285. return smalltalk.withContext(function($ctx1) {
  1286. self["@recipe"]=anArray;
  1287. return self}, function($ctx1) {$ctx1.fill(self,"recipe:",{anArray:anArray},smalltalk.PluggableExporter)})},
  1288. messageSends: []}),
  1289. smalltalk.PluggableExporter);
  1290. smalltalk.addMethod(
  1291. smalltalk.method({
  1292. selector: "newUsing:",
  1293. fn: function (recipe){
  1294. var self=this;
  1295. return smalltalk.withContext(function($ctx1) {
  1296. var $2,$3,$1;
  1297. $2=self._new();
  1298. _st($2)._recipe_(recipe);
  1299. $3=_st($2)._yourself();
  1300. $1=$3;
  1301. return $1;
  1302. }, function($ctx1) {$ctx1.fill(self,"newUsing:",{recipe:recipe},smalltalk.PluggableExporter.klass)})},
  1303. messageSends: ["recipe:", "new", "yourself"]}),
  1304. smalltalk.PluggableExporter.klass);
  1305. smalltalk.addMethod(
  1306. smalltalk.method({
  1307. selector: "ownClassesOfPackage:",
  1308. fn: function (package_){
  1309. var self=this;
  1310. return smalltalk.withContext(function($ctx1) {
  1311. var $1;
  1312. $1=_st(_st(package_)._sortedClasses())._asSet();
  1313. return $1;
  1314. }, function($ctx1) {$ctx1.fill(self,"ownClassesOfPackage:",{package_:package_},smalltalk.PluggableExporter.klass)})},
  1315. messageSends: ["asSet", "sortedClasses"]}),
  1316. smalltalk.PluggableExporter.klass);
  1317. smalltalk.addMethod(
  1318. smalltalk.method({
  1319. selector: "amdNamespace",
  1320. fn: function (){
  1321. var self=this;
  1322. return smalltalk.withContext(function($ctx1) {
  1323. return (self.transport && self.transport.amdNamespace) || nil;
  1324. return self}, function($ctx1) {$ctx1.fill(self,"amdNamespace",{},smalltalk.Package)})},
  1325. messageSends: []}),
  1326. smalltalk.Package);
  1327. smalltalk.addMethod(
  1328. smalltalk.method({
  1329. selector: "amdNamespace:",
  1330. fn: function (aString){
  1331. var self=this;
  1332. return smalltalk.withContext(function($ctx1) {
  1333. if (!self.transport) { self.transport = { type: 'amd' }; }
  1334. if (self.transport.type !== 'amd') { throw new Error('Package '+self._name()+' has transport type '+self.transport.type+', not "amd".'); }
  1335. self.transport.amdNamespace = aString;;
  1336. return self}, function($ctx1) {$ctx1.fill(self,"amdNamespace:",{aString:aString},smalltalk.Package)})},
  1337. messageSends: []}),
  1338. smalltalk.Package);
  1339. smalltalk.addMethod(
  1340. smalltalk.method({
  1341. selector: "commit",
  1342. fn: function (){
  1343. var self=this;
  1344. return smalltalk.withContext(function($ctx1) {
  1345. var $1;
  1346. $1=_st(self._transport())._commit_(self);
  1347. return $1;
  1348. }, function($ctx1) {$ctx1.fill(self,"commit",{},smalltalk.Package)})},
  1349. messageSends: ["commit:", "transport"]}),
  1350. smalltalk.Package);
  1351. smalltalk.addMethod(
  1352. smalltalk.method({
  1353. selector: "commitPathJs",
  1354. fn: function (){
  1355. var self=this;
  1356. return smalltalk.withContext(function($ctx1) {
  1357. var $3,$2,$1;
  1358. $3=self["@extension"];
  1359. if(($receiver = $3) == nil || $receiver == undefined){
  1360. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1361. $2=self["@extension"];
  1362. } else {
  1363. $2=$3;
  1364. };
  1365. $1=_st($2)._at_ifAbsent_("commitPathJs",(function(){
  1366. return smalltalk.withContext(function($ctx2) {
  1367. return _st(self._transport())._commitPathJsFor_(self);
  1368. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1369. return $1;
  1370. }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
  1371. messageSends: ["at:ifAbsent:", "commitPathJsFor:", "transport", "ifNil:"]}),
  1372. smalltalk.Package);
  1373. smalltalk.addMethod(
  1374. smalltalk.method({
  1375. selector: "commitPathJs:",
  1376. fn: function (aString){
  1377. var self=this;
  1378. return smalltalk.withContext(function($ctx1) {
  1379. var $3,$2,$1;
  1380. $3=self["@extension"];
  1381. if(($receiver = $3) == nil || $receiver == undefined){
  1382. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1383. $2=self["@extension"];
  1384. } else {
  1385. $2=$3;
  1386. };
  1387. $1=_st($2)._at_put_("commitPathJs",aString);
  1388. return $1;
  1389. }, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
  1390. messageSends: ["at:put:", "ifNil:"]}),
  1391. smalltalk.Package);
  1392. smalltalk.addMethod(
  1393. smalltalk.method({
  1394. selector: "commitPathSt",
  1395. fn: function (){
  1396. var self=this;
  1397. return smalltalk.withContext(function($ctx1) {
  1398. var $3,$2,$1;
  1399. $3=self["@extension"];
  1400. if(($receiver = $3) == nil || $receiver == undefined){
  1401. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1402. $2=self["@extension"];
  1403. } else {
  1404. $2=$3;
  1405. };
  1406. $1=_st($2)._at_ifAbsent_("commitPathSt",(function(){
  1407. return smalltalk.withContext(function($ctx2) {
  1408. return _st(self._transport())._commitPathStFor_(self);
  1409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1410. return $1;
  1411. }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
  1412. messageSends: ["at:ifAbsent:", "commitPathStFor:", "transport", "ifNil:"]}),
  1413. smalltalk.Package);
  1414. smalltalk.addMethod(
  1415. smalltalk.method({
  1416. selector: "commitPathSt:",
  1417. fn: function (aString){
  1418. var self=this;
  1419. return smalltalk.withContext(function($ctx1) {
  1420. var $3,$2,$1;
  1421. $3=self["@extension"];
  1422. if(($receiver = $3) == nil || $receiver == undefined){
  1423. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1424. $2=self["@extension"];
  1425. } else {
  1426. $2=$3;
  1427. };
  1428. $1=_st($2)._at_put_("commitPathSt",aString);
  1429. return $1;
  1430. }, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
  1431. messageSends: ["at:put:", "ifNil:"]}),
  1432. smalltalk.Package);
  1433. smalltalk.addMethod(
  1434. smalltalk.method({
  1435. selector: "loadDependencies",
  1436. fn: function (){
  1437. var self=this;
  1438. var root;
  1439. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1440. return smalltalk.withContext(function($ctx1) {
  1441. var $1,$2,$3;
  1442. root=_st($Object())._package();
  1443. $1=self.__eq_eq(root);
  1444. if(smalltalk.assert($1)){
  1445. $2=[];
  1446. return $2;
  1447. } else {
  1448. $3=[root];
  1449. return $3;
  1450. };
  1451. return self}, function($ctx1) {$ctx1.fill(self,"loadDependencies",{root:root},smalltalk.Package)})},
  1452. messageSends: ["package", "ifTrue:ifFalse:", "=="]}),
  1453. smalltalk.Package);
  1454. smalltalk.addMethod(
  1455. smalltalk.method({
  1456. selector: "transport",
  1457. fn: function (){
  1458. var self=this;
  1459. function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
  1460. return smalltalk.withContext(function($ctx1) {
  1461. var $1;
  1462. $1=_st($PackageHandler())._for_(self._transportType());
  1463. return $1;
  1464. }, function($ctx1) {$ctx1.fill(self,"transport",{},smalltalk.Package)})},
  1465. messageSends: ["for:", "transportType"]}),
  1466. smalltalk.Package);
  1467. smalltalk.addMethod(
  1468. smalltalk.method({
  1469. selector: "transportJson",
  1470. fn: function (){
  1471. var self=this;
  1472. return smalltalk.withContext(function($ctx1) {
  1473. return JSON.stringify(self.transport || null);;
  1474. return self}, function($ctx1) {$ctx1.fill(self,"transportJson",{},smalltalk.Package)})},
  1475. messageSends: []}),
  1476. smalltalk.Package);
  1477. smalltalk.addMethod(
  1478. smalltalk.method({
  1479. selector: "transportType",
  1480. fn: function (){
  1481. var self=this;
  1482. return smalltalk.withContext(function($ctx1) {
  1483. return (self.transport && self.transport.type) || 'unknown';;
  1484. return self}, function($ctx1) {$ctx1.fill(self,"transportType",{},smalltalk.Package)})},
  1485. messageSends: []}),
  1486. smalltalk.Package);
  1487. });