Importer-Exporter.deploy.js 64 KB

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