Importer-Exporter.deploy.js 60 KB

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