Importer-Exporter.deploy.js 60 KB

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