Importer-Exporter.deploy.js 61 KB

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