1
0

Importer-Exporter.deploy.js 60 KB

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