2
0

AmberCli.deploy.js 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000
  1. smalltalk.addPackage('AmberCli');
  2. smalltalk.addClass('AmberCli', smalltalk.Object, [], 'AmberCli');
  3. smalltalk.addMethod(
  4. smalltalk.method({
  5. selector: "commandLineSwitches",
  6. fn: function (){
  7. var self=this;
  8. var switches;
  9. return smalltalk.withContext(function($ctx1) {
  10. var $1;
  11. switches=_st(_st(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  12. return smalltalk.withContext(function($ctx2) {
  13. return _st(each)._selector();
  14. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  15. switches=_st(switches)._select_((function(each){
  16. return smalltalk.withContext(function($ctx2) {
  17. return _st(each)._match_("^[^:]*:$");
  18. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  19. switches=_st(switches)._collect_((function(each){
  20. return smalltalk.withContext(function($ctx2) {
  21. return _st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  22. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  23. $1=switches;
  24. return $1;
  25. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.AmberCli.klass)})},
  26. messageSends: ["collect:", "selector", "methodsInProtocol:", "class", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]}),
  27. smalltalk.AmberCli.klass);
  28. smalltalk.addMethod(
  29. smalltalk.method({
  30. selector: "handleArguments:",
  31. fn: function (args){
  32. var self=this;
  33. var selector;
  34. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  35. return smalltalk.withContext(function($ctx1) {
  36. selector=self._selectorForCommandLineSwitch_(_st(args)._first());
  37. _st(args)._remove_(_st(args)._first());
  38. self._perform_withArguments_(selector,_st($Array())._with_(args));
  39. return self}, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},smalltalk.AmberCli.klass)})},
  40. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]}),
  41. smalltalk.AmberCli.klass);
  42. smalltalk.addMethod(
  43. smalltalk.method({
  44. selector: "help:",
  45. fn: function (args){
  46. var self=this;
  47. return smalltalk.withContext(function($ctx1) {
  48. _st(console)._log_("Available Commands:");
  49. _st(self._commandLineSwitches())._do_((function(each){
  50. return smalltalk.withContext(function($ctx2) {
  51. return _st(console)._log_(each);
  52. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  53. return self}, function($ctx1) {$ctx1.fill(self,"help:",{args:args},smalltalk.AmberCli.klass)})},
  54. messageSends: ["log:", "do:", "commandLineSwitches"]}),
  55. smalltalk.AmberCli.klass);
  56. smalltalk.addMethod(
  57. smalltalk.method({
  58. selector: "main",
  59. fn: function (){
  60. var self=this;
  61. var args,nodeMinorVersion;
  62. return smalltalk.withContext(function($ctx1) {
  63. var $1,$2,$3;
  64. nodeMinorVersion=_st(_st(_st(_st(process)._version())._tokenize_("."))._second())._asNumber();
  65. $1=_st(nodeMinorVersion).__lt((8));
  66. if(smalltalk.assert($1)){
  67. _st(console)._log_("You are currently using Node.js ".__comma(_st(process)._version()));
  68. _st(console)._log_("Required is at least Node.js v0.8.x or greater.");
  69. return (-1);
  70. };
  71. args=_st(process)._argv();
  72. _st(args)._removeFrom_to_((1),(3));
  73. $2=_st(args)._isEmpty();
  74. if(smalltalk.assert($2)){
  75. self._help_(nil);
  76. } else {
  77. $3=self._handleArguments_(args);
  78. return $3;
  79. };
  80. return self}, function($ctx1) {$ctx1.fill(self,"main",{args:args,nodeMinorVersion:nodeMinorVersion},smalltalk.AmberCli.klass)})},
  81. messageSends: ["asNumber", "second", "tokenize:", "version", "ifTrue:", "log:", ",", "<", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "help:", "handleArguments:", "isEmpty"]}),
  82. smalltalk.AmberCli.klass);
  83. smalltalk.addMethod(
  84. smalltalk.method({
  85. selector: "repl:",
  86. fn: function (args){
  87. var self=this;
  88. function $Repl(){return smalltalk.Repl||(typeof Repl=="undefined"?nil:Repl)}
  89. return smalltalk.withContext(function($ctx1) {
  90. var $1;
  91. $1=_st(_st($Repl())._new())._createInterface();
  92. return $1;
  93. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},smalltalk.AmberCli.klass)})},
  94. messageSends: ["createInterface", "new"]}),
  95. smalltalk.AmberCli.klass);
  96. smalltalk.addMethod(
  97. smalltalk.method({
  98. selector: "selectorForCommandLineSwitch:",
  99. fn: function (aSwitch){
  100. var self=this;
  101. var command,selector;
  102. return smalltalk.withContext(function($ctx1) {
  103. var $1,$2;
  104. $1=_st(self._commandLineSwitches())._includes_(aSwitch);
  105. if(smalltalk.assert($1)){
  106. selector=_st(_st(aSwitch)._replace_with_("-[a-z]",(function(each){
  107. return smalltalk.withContext(function($ctx2) {
  108. return _st(_st(each)._second())._asUppercase();
  109. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__comma(":");
  110. selector;
  111. } else {
  112. selector="help:";
  113. selector;
  114. };
  115. $2=selector;
  116. return $2;
  117. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},smalltalk.AmberCli.klass)})},
  118. messageSends: ["ifTrue:ifFalse:", ",", "replace:with:", "asUppercase", "second", "includes:", "commandLineSwitches"]}),
  119. smalltalk.AmberCli.klass);
  120. smalltalk.addMethod(
  121. smalltalk.method({
  122. selector: "serve:",
  123. fn: function (args){
  124. var self=this;
  125. function $FileServer(){return smalltalk.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  126. return smalltalk.withContext(function($ctx1) {
  127. var $1;
  128. $1=_st(_st($FileServer())._createServerWithArguments_(args))._start();
  129. return $1;
  130. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},smalltalk.AmberCli.klass)})},
  131. messageSends: ["start", "createServerWithArguments:"]}),
  132. smalltalk.AmberCli.klass);
  133. smalltalk.addClass('FileServer', smalltalk.Object, ['path', 'http', 'fs', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  134. smalltalk.addMethod(
  135. smalltalk.method({
  136. selector: "base64Decode:",
  137. fn: function (aString){
  138. var self=this;
  139. return smalltalk.withContext(function($ctx1) {
  140. return (new Buffer(aString, 'base64').toString());
  141. return self}, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},smalltalk.FileServer)})},
  142. messageSends: []}),
  143. smalltalk.FileServer);
  144. smalltalk.addMethod(
  145. smalltalk.method({
  146. selector: "basePath",
  147. fn: function (){
  148. var self=this;
  149. return smalltalk.withContext(function($ctx1) {
  150. var $2,$1;
  151. $2=self["@basePath"];
  152. if(($receiver = $2) == nil || $receiver == undefined){
  153. $1="./";
  154. } else {
  155. $1=$2;
  156. };
  157. return $1;
  158. }, function($ctx1) {$ctx1.fill(self,"basePath",{},smalltalk.FileServer)})},
  159. messageSends: ["ifNil:"]}),
  160. smalltalk.FileServer);
  161. smalltalk.addMethod(
  162. smalltalk.method({
  163. selector: "basePath:",
  164. fn: function (aString){
  165. var self=this;
  166. return smalltalk.withContext(function($ctx1) {
  167. self["@basePath"]=aString;
  168. return self}, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},smalltalk.FileServer)})},
  169. messageSends: []}),
  170. smalltalk.FileServer);
  171. smalltalk.addMethod(
  172. smalltalk.method({
  173. selector: "checkDirectoryLayout",
  174. fn: function (){
  175. var self=this;
  176. return smalltalk.withContext(function($ctx1) {
  177. var $1,$2,$3;
  178. $1=_st(self["@fs"])._existsSync_(_st(self._basePath()).__comma("index.html"));
  179. if(! smalltalk.assert($1)){
  180. _st(console)._warn_("Warning: project directory does not contain index.html");
  181. };
  182. $2=_st(self["@fs"])._existsSync_(_st(self._basePath()).__comma("st"));
  183. if(! smalltalk.assert($2)){
  184. _st(console)._warn_("Warning: project directory is missing an \x22st\x22 directory");
  185. };
  186. $3=_st(self["@fs"])._existsSync_(_st(self._basePath()).__comma("js"));
  187. if(! smalltalk.assert($3)){
  188. _st(console)._warn_("Warning: project directory is missing a \x22js\x22 directory");
  189. };
  190. return self}, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},smalltalk.FileServer)})},
  191. messageSends: ["ifFalse:", "warn:", "existsSync:", ",", "basePath"]}),
  192. smalltalk.FileServer);
  193. smalltalk.addMethod(
  194. smalltalk.method({
  195. selector: "fallbackPage",
  196. fn: function (){
  197. var self=this;
  198. return smalltalk.withContext(function($ctx1) {
  199. var $1;
  200. $1=self["@fallbackPage"];
  201. return $1;
  202. }, function($ctx1) {$ctx1.fill(self,"fallbackPage",{},smalltalk.FileServer)})},
  203. messageSends: []}),
  204. smalltalk.FileServer);
  205. smalltalk.addMethod(
  206. smalltalk.method({
  207. selector: "fallbackPage:",
  208. fn: function (aString){
  209. var self=this;
  210. return smalltalk.withContext(function($ctx1) {
  211. self["@fallbackPage"]=aString;
  212. return self}, function($ctx1) {$ctx1.fill(self,"fallbackPage:",{aString:aString},smalltalk.FileServer)})},
  213. messageSends: []}),
  214. smalltalk.FileServer);
  215. smalltalk.addMethod(
  216. smalltalk.method({
  217. selector: "handleGETRequest:respondTo:",
  218. fn: function (aRequest,aResponse){
  219. var self=this;
  220. var uri,filename;
  221. return smalltalk.withContext(function($ctx1) {
  222. var $1;
  223. uri=_st(_st(self["@url"])._parse_(_st(aRequest)._url()))._pathname();
  224. filename=_st(self["@path"])._join_with_(self._basePath(),uri);
  225. _st(self["@fs"])._exists_do_(filename,(function(aBoolean){
  226. return smalltalk.withContext(function($ctx2) {
  227. $1=aBoolean;
  228. if(smalltalk.assert($1)){
  229. return self._respondFileNamed_to_(filename,aResponse);
  230. } else {
  231. return self._respondNotFoundTo_(aResponse);
  232. };
  233. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1)})}));
  234. return self}, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},smalltalk.FileServer)})},
  235. messageSends: ["pathname", "parse:", "url", "join:with:", "basePath", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "respondFileNamed:to:"]}),
  236. smalltalk.FileServer);
  237. smalltalk.addMethod(
  238. smalltalk.method({
  239. selector: "handleOPTIONSRequest:respondTo:",
  240. fn: function (aRequest,aResponse){
  241. var self=this;
  242. return smalltalk.withContext(function($ctx1) {
  243. _st(aResponse)._writeHead_options_((200),smalltalk.HashedCollection._from_(["Access-Control-Allow-Origin".__minus_gt("*"),"Access-Control-Allow-Methods".__minus_gt("GET, PUT, POST, DELETE, OPTIONS"),"Access-Control-Allow-Headers".__minus_gt("Content-Type, Accept"),"Content-Length".__minus_gt((0)),"Access-Control-Max-Age".__minus_gt((10))]));
  244. _st(aResponse)._end();
  245. return self}, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.FileServer)})},
  246. messageSends: ["writeHead:options:", "->", "end"]}),
  247. smalltalk.FileServer);
  248. smalltalk.addMethod(
  249. smalltalk.method({
  250. selector: "handlePUTRequest:respondTo:",
  251. fn: function (aRequest,aResponse){
  252. var self=this;
  253. var file,stream;
  254. return smalltalk.withContext(function($ctx1) {
  255. var $1,$2;
  256. $1=self._isAuthenticated_(aRequest);
  257. if(! smalltalk.assert($1)){
  258. self._respondAuthenticationRequiredTo_(aResponse);
  259. return nil;
  260. };
  261. file=".".__comma(_st(aRequest)._url());
  262. stream=_st(self["@fs"])._createWriteStream_(file);
  263. _st(stream)._on_do_("error",(function(error){
  264. return smalltalk.withContext(function($ctx2) {
  265. _st(console)._warn_("Error creating WriteStream for file ".__comma(file));
  266. _st(console)._warn_(" Did you forget to create the necessary js/ or st/ directory in your project?");
  267. _st(console)._warn_(" The exact error is: ".__comma(error));
  268. return self._respondNotCreatedTo_(aResponse);
  269. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  270. _st(stream)._on_do_("close",(function(){
  271. return smalltalk.withContext(function($ctx2) {
  272. return self._respondCreatedTo_(aResponse);
  273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  274. _st(aRequest)._setEncoding_("utf8");
  275. _st(aRequest)._on_do_("data",(function(data){
  276. return smalltalk.withContext(function($ctx2) {
  277. return _st(stream)._write_(data);
  278. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1)})}));
  279. _st(aRequest)._on_do_("end",(function(){
  280. return smalltalk.withContext(function($ctx2) {
  281. $2=_st(stream)._writable();
  282. if(smalltalk.assert($2)){
  283. return _st(stream)._end();
  284. };
  285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  286. return self}, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},smalltalk.FileServer)})},
  287. messageSends: ["ifFalse:", "respondAuthenticationRequiredTo:", "isAuthenticated:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "end", "writable"]}),
  288. smalltalk.FileServer);
  289. smalltalk.addMethod(
  290. smalltalk.method({
  291. selector: "handleRequest:respondTo:",
  292. fn: function (aRequest,aResponse){
  293. var self=this;
  294. return smalltalk.withContext(function($ctx1) {
  295. var $1,$2,$3;
  296. $1=_st(_st(aRequest)._method()).__eq("PUT");
  297. if(smalltalk.assert($1)){
  298. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  299. };
  300. $2=_st(_st(aRequest)._method()).__eq("GET");
  301. if(smalltalk.assert($2)){
  302. self._handleGETRequest_respondTo_(aRequest,aResponse);
  303. };
  304. $3=_st(_st(aRequest)._method()).__eq("OPTIONS");
  305. if(smalltalk.assert($3)){
  306. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  307. };
  308. return self}, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.FileServer)})},
  309. messageSends: ["ifTrue:", "handlePUTRequest:respondTo:", "=", "method", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]}),
  310. smalltalk.FileServer);
  311. smalltalk.addMethod(
  312. smalltalk.method({
  313. selector: "host",
  314. fn: function (){
  315. var self=this;
  316. return smalltalk.withContext(function($ctx1) {
  317. var $1;
  318. $1=self["@host"];
  319. return $1;
  320. }, function($ctx1) {$ctx1.fill(self,"host",{},smalltalk.FileServer)})},
  321. messageSends: []}),
  322. smalltalk.FileServer);
  323. smalltalk.addMethod(
  324. smalltalk.method({
  325. selector: "host:",
  326. fn: function (hostname){
  327. var self=this;
  328. return smalltalk.withContext(function($ctx1) {
  329. self["@host"]=hostname;
  330. return self}, function($ctx1) {$ctx1.fill(self,"host:",{hostname:hostname},smalltalk.FileServer)})},
  331. messageSends: []}),
  332. smalltalk.FileServer);
  333. smalltalk.addMethod(
  334. smalltalk.method({
  335. selector: "initialize",
  336. fn: function (){
  337. var self=this;
  338. return smalltalk.withContext(function($ctx1) {
  339. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  340. self["@path"]=self._require_("path");
  341. self["@http"]=self._require_("http");
  342. self["@fs"]=self._require_("fs");
  343. self["@util"]=self._require_("util");
  344. self["@url"]=self._require_("url");
  345. self["@host"]=_st(self._class())._defaultHost();
  346. self["@port"]=_st(self._class())._defaultPort();
  347. self["@username"]=nil;
  348. self["@password"]=nil;
  349. self["@fallbackPage"]=nil;
  350. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.FileServer)})},
  351. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]}),
  352. smalltalk.FileServer);
  353. smalltalk.addMethod(
  354. smalltalk.method({
  355. selector: "isAuthenticated:",
  356. fn: function (aRequest){
  357. var self=this;
  358. var header,token,auth,parts;
  359. return smalltalk.withContext(function($ctx1) {
  360. var $1,$2,$3,$4,$5;
  361. $1=_st(_st(self["@username"])._isNil())._and_((function(){
  362. return smalltalk.withContext(function($ctx2) {
  363. return _st(self["@password"])._isNil();
  364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  365. if(smalltalk.assert($1)){
  366. return true;
  367. };
  368. $2=_st(_st(aRequest)._headers())._at_("authorization");
  369. if(($receiver = $2) == nil || $receiver == undefined){
  370. header="";
  371. } else {
  372. header=$2;
  373. };
  374. $3=_st(header)._isEmpty();
  375. if(smalltalk.assert($3)){
  376. return false;
  377. } else {
  378. $4=_st(header)._tokenize_(" ");
  379. if(($receiver = $4) == nil || $receiver == undefined){
  380. token="";
  381. } else {
  382. token=$4;
  383. };
  384. token;
  385. auth=self._base64Decode_(_st(token)._at_((2)));
  386. auth;
  387. parts=_st(auth)._tokenize_(":");
  388. parts;
  389. $5=_st(_st(self["@username"]).__eq(_st(parts)._at_((1))))._and_((function(){
  390. return smalltalk.withContext(function($ctx2) {
  391. return _st(self["@password"]).__eq(_st(parts)._at_((2)));
  392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  393. if(smalltalk.assert($5)){
  394. return true;
  395. } else {
  396. return false;
  397. };
  398. };
  399. return self}, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},smalltalk.FileServer)})},
  400. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "tokenize:", "base64Decode:", "=", "isEmpty"]}),
  401. smalltalk.FileServer);
  402. smalltalk.addMethod(
  403. smalltalk.method({
  404. selector: "password:",
  405. fn: function (aPassword){
  406. var self=this;
  407. return smalltalk.withContext(function($ctx1) {
  408. self["@password"]=aPassword;
  409. return self}, function($ctx1) {$ctx1.fill(self,"password:",{aPassword:aPassword},smalltalk.FileServer)})},
  410. messageSends: []}),
  411. smalltalk.FileServer);
  412. smalltalk.addMethod(
  413. smalltalk.method({
  414. selector: "port",
  415. fn: function (){
  416. var self=this;
  417. return smalltalk.withContext(function($ctx1) {
  418. var $1;
  419. $1=self["@port"];
  420. return $1;
  421. }, function($ctx1) {$ctx1.fill(self,"port",{},smalltalk.FileServer)})},
  422. messageSends: []}),
  423. smalltalk.FileServer);
  424. smalltalk.addMethod(
  425. smalltalk.method({
  426. selector: "port:",
  427. fn: function (aNumber){
  428. var self=this;
  429. return smalltalk.withContext(function($ctx1) {
  430. self["@port"]=aNumber;
  431. return self}, function($ctx1) {$ctx1.fill(self,"port:",{aNumber:aNumber},smalltalk.FileServer)})},
  432. messageSends: []}),
  433. smalltalk.FileServer);
  434. smalltalk.addMethod(
  435. smalltalk.method({
  436. selector: "require:",
  437. fn: function (aModuleString){
  438. var self=this;
  439. return smalltalk.withContext(function($ctx1) {
  440. var $1;
  441. $1=_st(require)._value_(aModuleString);
  442. return $1;
  443. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},smalltalk.FileServer)})},
  444. messageSends: ["value:"]}),
  445. smalltalk.FileServer);
  446. smalltalk.addMethod(
  447. smalltalk.method({
  448. selector: "respondAuthenticationRequiredTo:",
  449. fn: function (aResponse){
  450. var self=this;
  451. return smalltalk.withContext(function($ctx1) {
  452. var $1,$2;
  453. $1=aResponse;
  454. _st($1)._writeHead_options_((401),smalltalk.HashedCollection._from_(["WWW-Authenticate".__minus_gt("Basic realm=\x22Secured Developer Area\x22")]));
  455. _st($1)._write_("<html><body>Authentication needed</body></html>");
  456. $2=_st($1)._end();
  457. return self}, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  458. messageSends: ["writeHead:options:", "->", "write:", "end"]}),
  459. smalltalk.FileServer);
  460. smalltalk.addMethod(
  461. smalltalk.method({
  462. selector: "respondCreatedTo:",
  463. fn: function (aResponse){
  464. var self=this;
  465. return smalltalk.withContext(function($ctx1) {
  466. var $1,$2;
  467. $1=aResponse;
  468. _st($1)._writeHead_options_((201),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain"),"Access-Control-Allow-Origin".__minus_gt("*")]));
  469. $2=_st($1)._end();
  470. return self}, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  471. messageSends: ["writeHead:options:", "->", "end"]}),
  472. smalltalk.FileServer);
  473. smalltalk.addMethod(
  474. smalltalk.method({
  475. selector: "respondFileNamed:to:",
  476. fn: function (aFilename,aResponse){
  477. var self=this;
  478. var type,filename;
  479. return smalltalk.withContext(function($ctx1) {
  480. var $1,$2,$3,$4,$5;
  481. filename=aFilename;
  482. $1=_st(_st(self["@fs"])._statSync_(aFilename))._isDirectory();
  483. if(smalltalk.assert($1)){
  484. filename=_st(filename).__comma("index.html");
  485. filename;
  486. };
  487. _st(self["@fs"])._readFile_do_(filename,(function(ex,file){
  488. return smalltalk.withContext(function($ctx2) {
  489. $2=_st(ex)._notNil();
  490. if(smalltalk.assert($2)){
  491. _st(console)._log_(_st(filename).__comma(" does not exist"));
  492. return self._respondInternalErrorTo_(aResponse);
  493. } else {
  494. type=_st(self._class())._mimeTypeFor_(filename);
  495. type;
  496. $3=_st(type).__eq("application/javascript");
  497. if(smalltalk.assert($3)){
  498. type=_st(type).__comma(";charset=utf-8");
  499. type;
  500. };
  501. $4=aResponse;
  502. _st($4)._writeHead_options_((200),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt(type)]));
  503. _st($4)._write_encoding_(file,"binary");
  504. $5=_st($4)._end();
  505. return $5;
  506. };
  507. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1)})}));
  508. return self}, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},smalltalk.FileServer)})},
  509. messageSends: ["ifTrue:", ",", "isDirectory", "statSync:", "readFile:do:", "ifTrue:ifFalse:", "log:", "respondInternalErrorTo:", "mimeTypeFor:", "class", "=", "writeHead:options:", "->", "write:encoding:", "end", "notNil"]}),
  510. smalltalk.FileServer);
  511. smalltalk.addMethod(
  512. smalltalk.method({
  513. selector: "respondInternalErrorTo:",
  514. fn: function (aResponse){
  515. var self=this;
  516. return smalltalk.withContext(function($ctx1) {
  517. var $1,$2;
  518. $1=aResponse;
  519. _st($1)._writeHead_options_((500),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain")]));
  520. _st($1)._write_("500 Internal server error");
  521. $2=_st($1)._end();
  522. return self}, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  523. messageSends: ["writeHead:options:", "->", "write:", "end"]}),
  524. smalltalk.FileServer);
  525. smalltalk.addMethod(
  526. smalltalk.method({
  527. selector: "respondNotCreatedTo:",
  528. fn: function (aResponse){
  529. var self=this;
  530. return smalltalk.withContext(function($ctx1) {
  531. var $1,$2;
  532. $1=aResponse;
  533. _st($1)._writeHead_options_((400),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain")]));
  534. _st($1)._write_("File could not be created. Did you forget to create the st/js directories on the server?");
  535. $2=_st($1)._end();
  536. return self}, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  537. messageSends: ["writeHead:options:", "->", "write:", "end"]}),
  538. smalltalk.FileServer);
  539. smalltalk.addMethod(
  540. smalltalk.method({
  541. selector: "respondNotFoundTo:",
  542. fn: function (aResponse){
  543. var self=this;
  544. return smalltalk.withContext(function($ctx1) {
  545. var $1,$2,$3,$4;
  546. $1=_st(self._fallbackPage())._isNil();
  547. if(! smalltalk.assert($1)){
  548. $2=self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  549. return $2;
  550. };
  551. $3=aResponse;
  552. _st($3)._writeHead_options_((404),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain")]));
  553. _st($3)._write_("404 Not found");
  554. $4=_st($3)._end();
  555. return self}, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  556. messageSends: ["ifFalse:", "respondFileNamed:to:", "fallbackPage", "isNil", "writeHead:options:", "->", "write:", "end"]}),
  557. smalltalk.FileServer);
  558. smalltalk.addMethod(
  559. smalltalk.method({
  560. selector: "respondOKTo:",
  561. fn: function (aResponse){
  562. var self=this;
  563. return smalltalk.withContext(function($ctx1) {
  564. var $1,$2;
  565. $1=aResponse;
  566. _st($1)._writeHead_options_((200),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain"),"Access-Control-Allow-Origin".__minus_gt("*")]));
  567. $2=_st($1)._end();
  568. return self}, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  569. messageSends: ["writeHead:options:", "->", "end"]}),
  570. smalltalk.FileServer);
  571. smalltalk.addMethod(
  572. smalltalk.method({
  573. selector: "start",
  574. fn: function (){
  575. var self=this;
  576. return smalltalk.withContext(function($ctx1) {
  577. var $1,$2;
  578. self._checkDirectoryLayout();
  579. $1=_st(self["@http"])._createServer_((function(request,response){
  580. return smalltalk.withContext(function($ctx2) {
  581. return self._handleRequest_respondTo_(request,response);
  582. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1)})}));
  583. _st($1)._on_do_("error",(function(error){
  584. return smalltalk.withContext(function($ctx2) {
  585. return _st(console)._log_("Error starting server: ".__comma(error));
  586. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  587. _st($1)._on_do_("listening",(function(){
  588. return smalltalk.withContext(function($ctx2) {
  589. return _st(console)._log_(_st(_st("Starting file server on http://".__comma(self._host())).__comma(":")).__comma(_st(self._port())._asString()));
  590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  591. $2=_st($1)._listen_host_(self._port(),self._host());
  592. return self}, function($ctx1) {$ctx1.fill(self,"start",{},smalltalk.FileServer)})},
  593. messageSends: ["checkDirectoryLayout", "on:do:", "log:", ",", "createServer:", "handleRequest:respondTo:", "asString", "port", "host", "listen:host:"]}),
  594. smalltalk.FileServer);
  595. smalltalk.addMethod(
  596. smalltalk.method({
  597. selector: "startOn:",
  598. fn: function (aPort){
  599. var self=this;
  600. return smalltalk.withContext(function($ctx1) {
  601. self._port_(aPort);
  602. self._start();
  603. return self}, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},smalltalk.FileServer)})},
  604. messageSends: ["port:", "start"]}),
  605. smalltalk.FileServer);
  606. smalltalk.addMethod(
  607. smalltalk.method({
  608. selector: "username:",
  609. fn: function (aUsername){
  610. var self=this;
  611. return smalltalk.withContext(function($ctx1) {
  612. self["@username"]=aUsername;
  613. return self}, function($ctx1) {$ctx1.fill(self,"username:",{aUsername:aUsername},smalltalk.FileServer)})},
  614. messageSends: []}),
  615. smalltalk.FileServer);
  616. smalltalk.addMethod(
  617. smalltalk.method({
  618. selector: "writeData:toFileNamed:",
  619. fn: function (data,aFilename){
  620. var self=this;
  621. return smalltalk.withContext(function($ctx1) {
  622. _st(console)._log_(aFilename);
  623. return self}, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},smalltalk.FileServer)})},
  624. messageSends: ["log:"]}),
  625. smalltalk.FileServer);
  626. smalltalk.FileServer.klass.iVarNames = ['mimeTypes'];
  627. smalltalk.addMethod(
  628. smalltalk.method({
  629. selector: "commandLineSwitches",
  630. fn: function (){
  631. var self=this;
  632. var switches;
  633. return smalltalk.withContext(function($ctx1) {
  634. var $1;
  635. switches=_st(self._methodsInProtocol_("accessing"))._collect_((function(each){
  636. return smalltalk.withContext(function($ctx2) {
  637. return _st(each)._selector();
  638. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  639. switches=_st(switches)._select_((function(each){
  640. return smalltalk.withContext(function($ctx2) {
  641. return _st(each)._match_("^[^:]*:$");
  642. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  643. switches=_st(switches)._collect_((function(each){
  644. return smalltalk.withContext(function($ctx2) {
  645. return _st(_st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  646. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  647. $1=switches;
  648. return $1;
  649. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.FileServer.klass)})},
  650. messageSends: ["collect:", "selector", "methodsInProtocol:", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]}),
  651. smalltalk.FileServer.klass);
  652. smalltalk.addMethod(
  653. smalltalk.method({
  654. selector: "createServerWithArguments:",
  655. fn: function (options){
  656. var self=this;
  657. var server,popFront,front,optionName,optionValue,switches;
  658. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  659. return smalltalk.withContext(function($ctx1) {
  660. var $1,$2,$3,$4,$5;
  661. var $early={};
  662. try {
  663. switches=self._commandLineSwitches();
  664. server=self._new();
  665. _st(options)._ifEmpty_((function(){
  666. return smalltalk.withContext(function($ctx2) {
  667. $1=server;
  668. throw $early=[$1];
  669. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  670. $2=_st(_st(options)._size())._even();
  671. if(! smalltalk.assert($2)){
  672. _st(console)._log_("Using default parameters.");
  673. _st(console)._log_("Wrong commandline options or not enough arguments for: ".__comma(options));
  674. _st(console)._log_("Use any of the following ones: ".__comma(switches));
  675. $3=server;
  676. return $3;
  677. };
  678. popFront=(function(args){
  679. return smalltalk.withContext(function($ctx2) {
  680. front=_st(args)._first();
  681. front;
  682. _st(args)._remove_(front);
  683. return front;
  684. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1)})});
  685. _st((function(){
  686. return smalltalk.withContext(function($ctx2) {
  687. return _st(options)._notEmpty();
  688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  689. return smalltalk.withContext(function($ctx2) {
  690. optionName=_st(popFront)._value_(options);
  691. optionName;
  692. optionValue=_st(popFront)._value_(options);
  693. optionValue;
  694. $4=_st(switches)._includes_(optionName);
  695. if(smalltalk.assert($4)){
  696. optionName=self._selectorForCommandLineSwitch_(optionName);
  697. optionName;
  698. return _st(server)._perform_withArguments_(optionName,_st($Array())._with_(optionValue));
  699. } else {
  700. _st(console)._log_(_st(optionName).__comma(" is not a valid commandline option"));
  701. return _st(console)._log_("Use any of the following ones: ".__comma(switches));
  702. };
  703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  704. $5=server;
  705. return $5;
  706. }
  707. catch(e) {if(e===$early)return e[0]; throw e}
  708. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},smalltalk.FileServer.klass)})},
  709. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "log:", ",", "even", "size", "first", "remove:", "whileTrue:", "value:", "ifTrue:ifFalse:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:", "includes:", "notEmpty"]}),
  710. smalltalk.FileServer.klass);
  711. smalltalk.addMethod(
  712. smalltalk.method({
  713. selector: "defaultHost",
  714. fn: function (){
  715. var self=this;
  716. return smalltalk.withContext(function($ctx1) {
  717. return "127.0.0.1";
  718. }, function($ctx1) {$ctx1.fill(self,"defaultHost",{},smalltalk.FileServer.klass)})},
  719. messageSends: []}),
  720. smalltalk.FileServer.klass);
  721. smalltalk.addMethod(
  722. smalltalk.method({
  723. selector: "defaultMimeTypes",
  724. fn: function (){
  725. var self=this;
  726. return smalltalk.withContext(function($ctx1) {
  727. var $1;
  728. $1=smalltalk.HashedCollection._from_(["%".__minus_gt("application/x-trash"),"323".__minus_gt("text/h323"),"abw".__minus_gt("application/x-abiword"),"ai".__minus_gt("application/postscript"),"aif".__minus_gt("audio/x-aiff"),"aifc".__minus_gt("audio/x-aiff"),"aiff".__minus_gt("audio/x-aiff"),"alc".__minus_gt("chemical/x-alchemy"),"art".__minus_gt("image/x-jg"),"asc".__minus_gt("text/plain"),"asf".__minus_gt("video/x-ms-asf"),"asn".__minus_gt("chemical/x-ncbi-asn1-spec"),"aso".__minus_gt("chemical/x-ncbi-asn1-binary"),"asx".__minus_gt("video/x-ms-asf"),"au".__minus_gt("audio/basic"),"avi".__minus_gt("video/x-msvideo"),"b".__minus_gt("chemical/x-molconn-Z"),"bak".__minus_gt("application/x-trash"),"bat".__minus_gt("application/x-msdos-program"),"bcpio".__minus_gt("application/x-bcpio"),"bib".__minus_gt("text/x-bibtex"),"bin".__minus_gt("application/octet-stream"),"bmp".__minus_gt("image/x-ms-bmp"),"book".__minus_gt("application/x-maker"),"bsd".__minus_gt("chemical/x-crossfire"),"c".__minus_gt("text/x-csrc"),"c++".__minus_gt("text/x-c++src"),"c3d".__minus_gt("chemical/x-chem3d"),"cac".__minus_gt("chemical/x-cache"),"cache".__minus_gt("chemical/x-cache"),"cascii".__minus_gt("chemical/x-cactvs-binary"),"cat".__minus_gt("application/vnd.ms-pki.seccat"),"cbin".__minus_gt("chemical/x-cactvs-binary"),"cc".__minus_gt("text/x-c++src"),"cdf".__minus_gt("application/x-cdf"),"cdr".__minus_gt("image/x-coreldraw"),"cdt".__minus_gt("image/x-coreldrawtemplate"),"cdx".__minus_gt("chemical/x-cdx"),"cdy".__minus_gt("application/vnd.cinderella"),"cef".__minus_gt("chemical/x-cxf"),"cer".__minus_gt("chemical/x-cerius"),"chm".__minus_gt("chemical/x-chemdraw"),"chrt".__minus_gt("application/x-kchart"),"cif".__minus_gt("chemical/x-cif"),"class".__minus_gt("application/java-vm"),"cls".__minus_gt("text/x-tex"),"cmdf".__minus_gt("chemical/x-cmdf"),"cml".__minus_gt("chemical/x-cml"),"cod".__minus_gt("application/vnd.rim.cod"),"com".__minus_gt("application/x-msdos-program"),"cpa".__minus_gt("chemical/x-compass"),"cpio".__minus_gt("application/x-cpio"),"cpp".__minus_gt("text/x-c++src"),"cpt".__minus_gt("image/x-corelphotopaint"),"crl".__minus_gt("application/x-pkcs7-crl"),"crt".__minus_gt("application/x-x509-ca-cert"),"csf".__minus_gt("chemical/x-cache-csf"),"csh".__minus_gt("text/x-csh"),"csm".__minus_gt("chemical/x-csml"),"csml".__minus_gt("chemical/x-csml"),"css".__minus_gt("text/css"),"csv".__minus_gt("text/comma-separated-values"),"ctab".__minus_gt("chemical/x-cactvs-binary"),"ctx".__minus_gt("chemical/x-ctx"),"cu".__minus_gt("application/cu-seeme"),"cub".__minus_gt("chemical/x-gaussian-cube"),"cxf".__minus_gt("chemical/x-cxf"),"cxx".__minus_gt("text/x-c++src"),"dat".__minus_gt("chemical/x-mopac-input"),"dcr".__minus_gt("application/x-director"),"deb".__minus_gt("application/x-debian-package"),"dif".__minus_gt("video/dv"),"diff".__minus_gt("text/plain"),"dir".__minus_gt("application/x-director"),"djv".__minus_gt("image/vnd.djvu"),"djvu".__minus_gt("image/vnd.djvu"),"dl".__minus_gt("video/dl"),"dll".__minus_gt("application/x-msdos-program"),"dmg".__minus_gt("application/x-apple-diskimage"),"dms".__minus_gt("application/x-dms"),"doc".__minus_gt("application/msword"),"dot".__minus_gt("application/msword"),"dv".__minus_gt("video/dv"),"dvi".__minus_gt("application/x-dvi"),"dx".__minus_gt("chemical/x-jcamp-dx"),"dxr".__minus_gt("application/x-director"),"emb".__minus_gt("chemical/x-embl-dl-nucleotide"),"embl".__minus_gt("chemical/x-embl-dl-nucleotide"),"ent".__minus_gt("chemical/x-pdb"),"eps".__minus_gt("application/postscript"),"etx".__minus_gt("text/x-setext"),"exe".__minus_gt("application/x-msdos-program"),"ez".__minus_gt("application/andrew-inset"),"fb".__minus_gt("application/x-maker"),"fbdoc".__minus_gt("application/x-maker"),"fch".__minus_gt("chemical/x-gaussian-checkpoint"),"fchk".__minus_gt("chemical/x-gaussian-checkpoint"),"fig".__minus_gt("application/x-xfig"),"flac".__minus_gt("application/x-flac"),"fli".__minus_gt("video/fli"),"fm".__minus_gt("application/x-maker"),"frame".__minus_gt("application/x-maker"),"frm".__minus_gt("application/x-maker"),"gal".__minus_gt("chemical/x-gaussian-log"),"gam".__minus_gt("chemical/x-gamess-input"),"gamin".__minus_gt("chemical/x-gamess-input"),"gau".__minus_gt("chemical/x-gaussian-input"),"gcd".__minus_gt("text/x-pcs-gcd"),"gcf".__minus_gt("application/x-graphing-calculator"),"gcg".__minus_gt("chemical/x-gcg8-sequence"),"gen".__minus_gt("chemical/x-genbank"),"gf".__minus_gt("application/x-tex-gf"),"gif".__minus_gt("image/gif"),"gjc".__minus_gt("chemical/x-gaussian-input"),"gjf".__minus_gt("chemical/x-gaussian-input"),"gl".__minus_gt("video/gl"),"gnumeric".__minus_gt("application/x-gnumeric"),"gpt".__minus_gt("chemical/x-mopac-graph"),"gsf".__minus_gt("application/x-font"),"gsm".__minus_gt("audio/x-gsm"),"gtar".__minus_gt("application/x-gtar"),"h".__minus_gt("text/x-chdr"),"h++".__minus_gt("text/x-c++hdr"),"hdf".__minus_gt("application/x-hdf"),"hh".__minus_gt("text/x-c++hdr"),"hin".__minus_gt("chemical/x-hin"),"hpp".__minus_gt("text/x-c++hdr"),"hqx".__minus_gt("application/mac-binhex40"),"hs".__minus_gt("text/x-haskell"),"hta".__minus_gt("application/hta"),"htc".__minus_gt("text/x-component"),"htm".__minus_gt("text/html"),"html".__minus_gt("text/html"),"hxx".__minus_gt("text/x-c++hdr"),"ica".__minus_gt("application/x-ica"),"ice".__minus_gt("x-conference/x-cooltalk"),"ico".__minus_gt("image/x-icon"),"ics".__minus_gt("text/calendar"),"icz".__minus_gt("text/calendar"),"ief".__minus_gt("image/ief"),"iges".__minus_gt("model/iges"),"igs".__minus_gt("model/iges"),"iii".__minus_gt("application/x-iphone"),"inp".__minus_gt("chemical/x-gamess-input"),"ins".__minus_gt("application/x-internet-signup"),"iso".__minus_gt("application/x-iso9660-image"),"isp".__minus_gt("application/x-internet-signup"),"ist".__minus_gt("chemical/x-isostar"),"istr".__minus_gt("chemical/x-isostar"),"jad".__minus_gt("text/vnd.sun.j2me.app-descriptor"),"jar".__minus_gt("application/java-archive"),"java".__minus_gt("text/x-java"),"jdx".__minus_gt("chemical/x-jcamp-dx"),"jmz".__minus_gt("application/x-jmol"),"jng".__minus_gt("image/x-jng"),"jnlp".__minus_gt("application/x-java-jnlp-file"),"jpe".__minus_gt("image/jpeg"),"jpeg".__minus_gt("image/jpeg"),"jpg".__minus_gt("image/jpeg"),"js".__minus_gt("application/javascript"),"kar".__minus_gt("audio/midi"),"key".__minus_gt("application/pgp-keys"),"kil".__minus_gt("application/x-killustrator"),"kin".__minus_gt("chemical/x-kinemage"),"kpr".__minus_gt("application/x-kpresenter"),"kpt".__minus_gt("application/x-kpresenter"),"ksp".__minus_gt("application/x-kspread"),"kwd".__minus_gt("application/x-kword"),"kwt".__minus_gt("application/x-kword"),"latex".__minus_gt("application/x-latex"),"lha".__minus_gt("application/x-lha"),"lhs".__minus_gt("text/x-literate-haskell"),"lsf".__minus_gt("video/x-la-asf"),"lsx".__minus_gt("video/x-la-asf"),"ltx".__minus_gt("text/x-tex"),"lzh".__minus_gt("application/x-lzh"),"lzx".__minus_gt("application/x-lzx"),"m3u".__minus_gt("audio/x-mpegurl"),"m4a".__minus_gt("audio/mpeg"),"maker".__minus_gt("application/x-maker"),"man".__minus_gt("application/x-troff-man"),"mcif".__minus_gt("chemical/x-mmcif"),"mcm".__minus_gt("chemical/x-macmolecule"),"mdb".__minus_gt("application/msaccess"),"me".__minus_gt("application/x-troff-me"),"mesh".__minus_gt("model/mesh"),"mid".__minus_gt("audio/midi"),"midi".__minus_gt("audio/midi"),"mif".__minus_gt("application/x-mif"),"mm".__minus_gt("application/x-freemind"),"mmd".__minus_gt("chemical/x-macromodel-input"),"mmf".__minus_gt("application/vnd.smaf"),"mml".__minus_gt("text/mathml"),"mmod".__minus_gt("chemical/x-macromodel-input"),"mng".__minus_gt("video/x-mng"),"moc".__minus_gt("text/x-moc"),"mol".__minus_gt("chemical/x-mdl-molfile"),"mol2".__minus_gt("chemical/x-mol2"),"moo".__minus_gt("chemical/x-mopac-out"),"mop".__minus_gt("chemical/x-mopac-input"),"mopcrt".__minus_gt("chemical/x-mopac-input"),"mov".__minus_gt("video/quicktime"),"movie".__minus_gt("video/x-sgi-movie"),"mp2".__minus_gt("audio/mpeg"),"mp3".__minus_gt("audio/mpeg"),"mp4".__minus_gt("video/mp4"),"mpc".__minus_gt("chemical/x-mopac-input"),"mpe".__minus_gt("video/mpeg"),"mpeg".__minus_gt("video/mpeg"),"mpega".__minus_gt("audio/mpeg"),"mpg".__minus_gt("video/mpeg"),"mpga".__minus_gt("audio/mpeg"),"ms".__minus_gt("application/x-troff-ms"),"msh".__minus_gt("model/mesh"),"msi".__minus_gt("application/x-msi"),"mvb".__minus_gt("chemical/x-mopac-vib"),"mxu".__minus_gt("video/vnd.mpegurl"),"nb".__minus_gt("application/mathematica"),"nc".__minus_gt("application/x-netcdf"),"nwc".__minus_gt("application/x-nwc"),"o".__minus_gt("application/x-object"),"oda".__minus_gt("application/oda"),"odb".__minus_gt("application/vnd.oasis.opendocument.database"),"odc".__minus_gt("application/vnd.oasis.opendocument.chart"),"odf".__minus_gt("application/vnd.oasis.opendocument.formula"),"odg".__minus_gt("application/vnd.oasis.opendocument.graphics"),"odi".__minus_gt("application/vnd.oasis.opendocument.image"),"odm".__minus_gt("application/vnd.oasis.opendocument.text-master"),"odp".__minus_gt("application/vnd.oasis.opendocument.presentation"),"ods".__minus_gt("application/vnd.oasis.opendocument.spreadsheet"),"odt".__minus_gt("application/vnd.oasis.opendocument.text"),"ogg".__minus_gt("application/ogg"),"old".__minus_gt("application/x-trash"),"oth".__minus_gt("application/vnd.oasis.opendocument.text-web"),"oza".__minus_gt("application/x-oz-application"),"p".__minus_gt("text/x-pascal"),"p7r".__minus_gt("application/x-pkcs7-certreqresp"),"pac".__minus_gt("application/x-ns-proxy-autoconfig"),"pas".__minus_gt("text/x-pascal"),"pat".__minus_gt("image/x-coreldrawpattern"),"pbm".__minus_gt("image/x-portable-bitmap"),"pcf".__minus_gt("application/x-font"),"pcf.Z".__minus_gt("application/x-font"),"pcx".__minus_gt("image/pcx"),"pdb".__minus_gt("chemical/x-pdb"),"pdf".__minus_gt("application/pdf"),"pfa".__minus_gt("application/x-font"),"pfb".__minus_gt("application/x-font"),"pgm".__minus_gt("image/x-portable-graymap"),"pgn".__minus_gt("application/x-chess-pgn"),"pgp".__minus_gt("application/pgp-signature"),"pk".__minus_gt("application/x-tex-pk"),"pl".__minus_gt("text/x-perl"),"pls".__minus_gt("audio/x-scpls"),"pm".__minus_gt("text/x-perl"),"png".__minus_gt("image/png"),"pnm".__minus_gt("image/x-portable-anymap"),"pot".__minus_gt("text/plain"),"ppm".__minus_gt("image/x-portable-pixmap"),"pps".__minus_gt("application/vnd.ms-powerpoint"),"ppt".__minus_gt("application/vnd.ms-powerpoint"),"prf".__minus_gt("application/pics-rules"),"prt".__minus_gt("chemical/x-ncbi-asn1-ascii"),"ps".__minus_gt("application/postscript"),"psd".__minus_gt("image/x-photoshop"),"psp".__minus_gt("text/x-psp"),"py".__minus_gt("text/x-python"),"pyc".__minus_gt("application/x-python-code"),"pyo".__minus_gt("application/x-python-code"),"qt".__minus_gt("video/quicktime"),"qtl".__minus_gt("application/x-quicktimeplayer"),"ra".__minus_gt("audio/x-realaudio"),"ram".__minus_gt("audio/x-pn-realaudio"),"rar".__minus_gt("application/rar"),"ras".__minus_gt("image/x-cmu-raster"),"rd".__minus_gt("chemical/x-mdl-rdfile"),"rdf".__minus_gt("application/rdf+xml"),"rgb".__minus_gt("image/x-rgb"),"rm".__minus_gt("audio/x-pn-realaudio"),"roff".__minus_gt("application/x-troff"),"ros".__minus_gt("chemical/x-rosdal"),"rpm".__minus_gt("application/x-redhat-package-manager"),"rss".__minus_gt("application/rss+xml"),"rtf".__minus_gt("text/rtf"),"rtx".__minus_gt("text/richtext"),"rxn".__minus_gt("chemical/x-mdl-rxnfile"),"sct".__minus_gt("text/scriptlet"),"sd".__minus_gt("chemical/x-mdl-sdfile"),"sd2".__minus_gt("audio/x-sd2"),"sda".__minus_gt("application/vnd.stardivision.draw"),"sdc".__minus_gt("application/vnd.stardivision.calc"),"sdd".__minus_gt("application/vnd.stardivision.impress"),"sdf".__minus_gt("chemical/x-mdl-sdfile"),"sdp".__minus_gt("application/vnd.stardivision.impress"),"sdw".__minus_gt("application/vnd.stardivision.writer"),"ser".__minus_gt("application/java-serialized-object"),"sgf".__minus_gt("application/x-go-sgf"),"sgl".__minus_gt("application/vnd.stardivision.writer-global"),"sh".__minus_gt("text/x-sh"),"shar".__minus_gt("application/x-shar"),"shtml".__minus_gt("text/html"),"sid".__minus_gt("audio/prs.sid"),"sik".__minus_gt("application/x-trash"),"silo".__minus_gt("model/mesh"),"sis".__minus_gt("application/vnd.symbian.install"),"sit".__minus_gt("application/x-stuffit"),"skd".__minus_gt("application/x-koan"),"skm".__minus_gt("application/x-koan"),"skp".__minus_gt("application/x-koan"),"skt".__minus_gt("application/x-koan"),"smf".__minus_gt("application/vnd.stardivision.math"),"smi".__minus_gt("application/smil"),"smil".__minus_gt("application/smil"),"snd".__minus_gt("audio/basic"),"spc".__minus_gt("chemical/x-galactic-spc"),"spl".__minus_gt("application/x-futuresplash"),"src".__minus_gt("application/x-wais-source"),"stc".__minus_gt("application/vnd.sun.xml.calc.template"),"std".__minus_gt("application/vnd.sun.xml.draw.template"),"sti".__minus_gt("application/vnd.sun.xml.impress.template"),"stl".__minus_gt("application/vnd.ms-pki.stl"),"stw".__minus_gt("application/vnd.sun.xml.writer.template"),"sty".__minus_gt("text/x-tex"),"sv4cpio".__minus_gt("application/x-sv4cpio"),"sv4crc".__minus_gt("application/x-sv4crc"),"svg".__minus_gt("image/svg+xml"),"svgz".__minus_gt("image/svg+xml"),"sw".__minus_gt("chemical/x-swissprot"),"swf".__minus_gt("application/x-shockwave-flash"),"swfl".__minus_gt("application/x-shockwave-flash"),"sxc".__minus_gt("application/vnd.sun.xml.calc"),"sxd".__minus_gt("application/vnd.sun.xml.draw"),"sxg".__minus_gt("application/vnd.sun.xml.writer.global"),"sxi".__minus_gt("application/vnd.sun.xml.impress"),"sxm".__minus_gt("application/vnd.sun.xml.math"),"sxw".__minus_gt("application/vnd.sun.xml.writer"),"t".__minus_gt("application/x-troff"),"tar".__minus_gt("application/x-tar"),"taz".__minus_gt("application/x-gtar"),"tcl".__minus_gt("text/x-tcl"),"tex".__minus_gt("text/x-tex"),"texi".__minus_gt("application/x-texinfo"),"texinfo".__minus_gt("application/x-texinfo"),"text".__minus_gt("text/plain"),"tgf".__minus_gt("chemical/x-mdl-tgf"),"tgz".__minus_gt("application/x-gtar"),"tif".__minus_gt("image/tiff"),"tiff".__minus_gt("image/tiff"),"tk".__minus_gt("text/x-tcl"),"tm".__minus_gt("text/texmacs"),"torrent".__minus_gt("application/x-bittorrent"),"tr".__minus_gt("application/x-troff"),"ts".__minus_gt("text/texmacs"),"tsp".__minus_gt("application/dsptype"),"tsv".__minus_gt("text/tab-separated-values"),"txt".__minus_gt("text/plain"),"udeb".__minus_gt("application/x-debian-package"),"uls".__minus_gt("text/iuls"),"ustar".__minus_gt("application/x-ustar"),"val".__minus_gt("chemical/x-ncbi-asn1-binary"),"vcd".__minus_gt("application/x-cdlink"),"vcf".__minus_gt("text/x-vcard"),"vcs".__minus_gt("text/x-vcalendar"),"vmd".__minus_gt("chemical/x-vmd"),"vms".__minus_gt("chemical/x-vamas-iso14976"),"vor".__minus_gt("application/vnd.stardivision.writer"),"vrm".__minus_gt("x-world/x-vrml"),"vrml".__minus_gt("x-world/x-vrml"),"vsd".__minus_gt("application/vnd.visio"),"wad".__minus_gt("application/x-doom"),"wav".__minus_gt("audio/x-wav"),"wax".__minus_gt("audio/x-ms-wax"),"wbmp".__minus_gt("image/vnd.wap.wbmp"),"wbxml".__minus_gt("application/vnd.wap.wbxml"),"wk".__minus_gt("application/x-123"),"wm".__minus_gt("video/x-ms-wm"),"wma".__minus_gt("audio/x-ms-wma"),"wmd".__minus_gt("application/x-ms-wmd"),"wml".__minus_gt("text/vnd.wap.wml"),"wmlc".__minus_gt("application/vnd.wap.wmlc"),"wmls".__minus_gt("text/vnd.wap.wmlscript"),"wmlsc".__minus_gt("application/vnd.wap.wmlscriptc"),"wmv".__minus_gt("video/x-ms-wmv"),"wmx".__minus_gt("video/x-ms-wmx"),"wmz".__minus_gt("application/x-ms-wmz"),"wp5".__minus_gt("application/wordperfect5.1"),"wpd".__minus_gt("application/wordperfect"),"wrl".__minus_gt("x-world/x-vrml"),"wsc".__minus_gt("text/scriptlet"),"wvx".__minus_gt("video/x-ms-wvx"),"wz".__minus_gt("application/x-wingz"),"xbm".__minus_gt("image/x-xbitmap"),"xcf".__minus_gt("application/x-xcf"),"xht".__minus_gt("application/xhtml+xml"),"xhtml".__minus_gt("application/xhtml+xml"),"xlb".__minus_gt("application/vnd.ms-excel"),"xls".__minus_gt("application/vnd.ms-excel"),"xlt".__minus_gt("application/vnd.ms-excel"),"xml".__minus_gt("application/xml"),"xpi".__minus_gt("application/x-xpinstall"),"xpm".__minus_gt("image/x-xpixmap"),"xsl".__minus_gt("application/xml"),"xtel".__minus_gt("chemical/x-xtel"),"xul".__minus_gt("application/vnd.mozilla.xul+xml"),"xwd".__minus_gt("image/x-xwindowdump"),"xyz".__minus_gt("chemical/x-xyz"),"zip".__minus_gt("application/zip"),"zmt".__minus_gt("chemical/x-mopac-input"),"~".__minus_gt("application/x-trash")]);
  729. return $1;
  730. }, function($ctx1) {$ctx1.fill(self,"defaultMimeTypes",{},smalltalk.FileServer.klass)})},
  731. messageSends: ["->"]}),
  732. smalltalk.FileServer.klass);
  733. smalltalk.addMethod(
  734. smalltalk.method({
  735. selector: "defaultPort",
  736. fn: function (){
  737. var self=this;
  738. return smalltalk.withContext(function($ctx1) {
  739. return (4000);
  740. }, function($ctx1) {$ctx1.fill(self,"defaultPort",{},smalltalk.FileServer.klass)})},
  741. messageSends: []}),
  742. smalltalk.FileServer.klass);
  743. smalltalk.addMethod(
  744. smalltalk.method({
  745. selector: "main",
  746. fn: function (){
  747. var self=this;
  748. var fileServer,args;
  749. function $FileServer(){return smalltalk.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  750. return smalltalk.withContext(function($ctx1) {
  751. var $1,$2;
  752. var $early={};
  753. try {
  754. args=_st(process)._argv();
  755. _st(args)._removeFrom_to_((1),(3));
  756. _st(args)._detect_ifNone_((function(each){
  757. return smalltalk.withContext(function($ctx2) {
  758. $1=_st(each).__eq("--help");
  759. if(smalltalk.assert($1)){
  760. return _st($FileServer())._printHelp();
  761. };
  762. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  763. return smalltalk.withContext(function($ctx2) {
  764. fileServer=_st($FileServer())._createServerWithArguments_(args);
  765. fileServer;
  766. $2=_st(fileServer)._start();
  767. throw $early=[$2];
  768. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  769. return self}
  770. catch(e) {if(e===$early)return e[0]; throw e}
  771. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},smalltalk.FileServer.klass)})},
  772. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "printHelp", "=", "createServerWithArguments:", "start"]}),
  773. smalltalk.FileServer.klass);
  774. smalltalk.addMethod(
  775. smalltalk.method({
  776. selector: "mimeTypeFor:",
  777. fn: function (aString){
  778. var self=this;
  779. return smalltalk.withContext(function($ctx1) {
  780. var $1;
  781. $1=_st(self._mimeTypes())._at_ifAbsent_(_st(aString)._replace_with_(".*[\x5c.]",""),(function(){
  782. return smalltalk.withContext(function($ctx2) {
  783. return "text/plain";
  784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  785. return $1;
  786. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},smalltalk.FileServer.klass)})},
  787. messageSends: ["at:ifAbsent:", "replace:with:", "mimeTypes"]}),
  788. smalltalk.FileServer.klass);
  789. smalltalk.addMethod(
  790. smalltalk.method({
  791. selector: "mimeTypes",
  792. fn: function (){
  793. var self=this;
  794. return smalltalk.withContext(function($ctx1) {
  795. var $2,$1;
  796. $2=self["@mimeTypes"];
  797. if(($receiver = $2) == nil || $receiver == undefined){
  798. self["@mimeTypes"]=self._defaultMimeTypes();
  799. $1=self["@mimeTypes"];
  800. } else {
  801. $1=$2;
  802. };
  803. return $1;
  804. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},smalltalk.FileServer.klass)})},
  805. messageSends: ["ifNil:", "defaultMimeTypes"]}),
  806. smalltalk.FileServer.klass);
  807. smalltalk.addMethod(
  808. smalltalk.method({
  809. selector: "printHelp",
  810. fn: function (){
  811. var self=this;
  812. return smalltalk.withContext(function($ctx1) {
  813. _st(console)._log_("Available commandline options are:");
  814. _st(console)._log_("--help");
  815. _st(self._commandLineSwitches())._do_((function(each){
  816. return smalltalk.withContext(function($ctx2) {
  817. return _st(console)._log_(_st(each).__comma(" <parameter>"));
  818. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  819. return self}, function($ctx1) {$ctx1.fill(self,"printHelp",{},smalltalk.FileServer.klass)})},
  820. messageSends: ["log:", "do:", ",", "commandLineSwitches"]}),
  821. smalltalk.FileServer.klass);
  822. smalltalk.addMethod(
  823. smalltalk.method({
  824. selector: "selectorForCommandLineSwitch:",
  825. fn: function (aSwitch){
  826. var self=this;
  827. return smalltalk.withContext(function($ctx1) {
  828. var $1;
  829. $1=_st(_st(_st(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  830. return smalltalk.withContext(function($ctx2) {
  831. return _st(_st(each)._second())._asUppercase();
  832. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__comma(":");
  833. return $1;
  834. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},smalltalk.FileServer.klass)})},
  835. messageSends: [",", "replace:with:", "asUppercase", "second"]}),
  836. smalltalk.FileServer.klass);
  837. smalltalk.addClass('Repl', smalltalk.Object, ['readline', 'interface', 'util'], 'AmberCli');
  838. smalltalk.addMethod(
  839. smalltalk.method({
  840. selector: "close",
  841. fn: function (){
  842. var self=this;
  843. return smalltalk.withContext(function($ctx1) {
  844. _st(_st(process)._stdin())._destroy();
  845. return self}, function($ctx1) {$ctx1.fill(self,"close",{},smalltalk.Repl)})},
  846. messageSends: ["destroy", "stdin"]}),
  847. smalltalk.Repl);
  848. smalltalk.addMethod(
  849. smalltalk.method({
  850. selector: "createInterface",
  851. fn: function (){
  852. var self=this;
  853. return smalltalk.withContext(function($ctx1) {
  854. self["@interface"]=_st(self["@readline"])._createInterface_stdout_(_st(process)._stdin(),_st(process)._stdout());
  855. _st(self["@interface"])._on_do_("line",(function(buffer){
  856. return smalltalk.withContext(function($ctx2) {
  857. return self._eval_(buffer);
  858. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1)})}));
  859. _st(self["@interface"])._on_do_("close",(function(){
  860. return smalltalk.withContext(function($ctx2) {
  861. return self._close();
  862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  863. self._setPrompt();
  864. _st(self["@interface"])._prompt();
  865. return self}, function($ctx1) {$ctx1.fill(self,"createInterface",{},smalltalk.Repl)})},
  866. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "eval:", "close", "setPrompt", "prompt"]}),
  867. smalltalk.Repl);
  868. smalltalk.addMethod(
  869. smalltalk.method({
  870. selector: "eval:",
  871. fn: function (buffer){
  872. var self=this;
  873. var result;
  874. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  875. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  876. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  877. return smalltalk.withContext(function($ctx1) {
  878. var $1,$2;
  879. $1=_st(buffer)._isEmpty();
  880. if(! smalltalk.assert($1)){
  881. self._try_catch_((function(){
  882. return smalltalk.withContext(function($ctx2) {
  883. result=_st(_st($Compiler())._new())._evaluateExpression_(buffer);
  884. result;
  885. return _st($Transcript())._show_(result);
  886. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(e){
  887. return smalltalk.withContext(function($ctx2) {
  888. $2=_st(e)._isSmalltalkError();
  889. if(smalltalk.assert($2)){
  890. return _st(_st($ErrorHandler())._new())._handleError_(e);
  891. } else {
  892. return _st(_st(process)._stdout())._write_(_st(e)._jsStack());
  893. };
  894. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1)})}));
  895. };
  896. _st(self["@interface"])._prompt();
  897. return self}, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer,result:result},smalltalk.Repl)})},
  898. messageSends: ["ifFalse:", "try:catch:", "evaluateExpression:", "new", "show:", "ifTrue:ifFalse:", "handleError:", "write:", "jsStack", "stdout", "isSmalltalkError", "isEmpty", "prompt"]}),
  899. smalltalk.Repl);
  900. smalltalk.addMethod(
  901. smalltalk.method({
  902. selector: "initialize",
  903. fn: function (){
  904. var self=this;
  905. return smalltalk.withContext(function($ctx1) {
  906. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  907. self["@readline"]=_st(require)._value_("readline");
  908. self["@util"]=_st(require)._value_("util");
  909. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Repl)})},
  910. messageSends: ["initialize", "value:"]}),
  911. smalltalk.Repl);
  912. smalltalk.addMethod(
  913. smalltalk.method({
  914. selector: "prompt",
  915. fn: function (){
  916. var self=this;
  917. return smalltalk.withContext(function($ctx1) {
  918. return "amber >> ";
  919. }, function($ctx1) {$ctx1.fill(self,"prompt",{},smalltalk.Repl)})},
  920. messageSends: []}),
  921. smalltalk.Repl);
  922. smalltalk.addMethod(
  923. smalltalk.method({
  924. selector: "setPrompt",
  925. fn: function (){
  926. var self=this;
  927. return smalltalk.withContext(function($ctx1) {
  928. _st(self["@interface"])._setPrompt_(self._prompt());
  929. return self}, function($ctx1) {$ctx1.fill(self,"setPrompt",{},smalltalk.Repl)})},
  930. messageSends: ["setPrompt:", "prompt"]}),
  931. smalltalk.Repl);
  932. smalltalk.addMethod(
  933. smalltalk.method({
  934. selector: "main",
  935. fn: function (){
  936. var self=this;
  937. return smalltalk.withContext(function($ctx1) {
  938. _st(self._new())._createInterface();
  939. return self}, function($ctx1) {$ctx1.fill(self,"main",{},smalltalk.Repl.klass)})},
  940. messageSends: ["createInterface", "new"]}),
  941. smalltalk.Repl.klass);