amber-in-browser.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /* Amber package loading
  2. usage example:
  3. TODO
  4. */
  5. var require;
  6. require = function (require) {
  7. var scripts = document.getElementsByTagName("script");
  8. var src = scripts[ scripts.length - 1 ].src;
  9. var home = resolveViaDOM(src).replace(/\/[^\/]+$/, "");
  10. function resolveViaDOM(url) {
  11. var a = document.createElement("a");
  12. a.href = url;
  13. return a.href;
  14. }
  15. var config = {
  16. baseUrl: home,
  17. paths: {
  18. 'amber_set': '.',
  19. 'amber_vm': '.',
  20. 'amber_vm/boot': '../boot',
  21. 'amber_vm/parser': '../parser',
  22. 'amber': '..',
  23. 'jquery': 'jQuery/jquery-1.8.2.min',
  24. 'jquery-ui': 'jQuery/jquery-ui-1.8.16.custom.min'
  25. },
  26. map: {
  27. '*': {
  28. 'css': 'require-css-0.0.6/css'
  29. }
  30. },
  31. shim: {
  32. 'jquery-ui': {
  33. deps: [ 'jquery' ]
  34. },
  35. 'jQuery/jquery.textarea': {
  36. deps: [ 'jquery', 'jquery-ui' ]
  37. },
  38. 'CodeMirror/smalltalk': {
  39. deps: [ 'CodeMirror/codemirror' ]
  40. },
  41. 'CodeMirror/addon/hint/show-hint': {
  42. deps: [ 'CodeMirror/codemirror' ]
  43. },
  44. 'ensure-console': {
  45. exports: 'console'
  46. },
  47. 'amber/Kernel-Objects.deploy': {
  48. deps: []
  49. },
  50. 'amber/Kernel-Classes.deploy': {
  51. deps: [ 'amber/Kernel-Objects.deploy' ]
  52. },
  53. 'amber/Kernel-Methods.deploy': {
  54. deps: [ 'amber/Kernel-Objects.deploy' ]
  55. },
  56. 'amber/Kernel-Collections.deploy': {
  57. deps: [ 'amber/Kernel-Objects.deploy' ]
  58. },
  59. 'amber/Kernel-Exceptions.deploy': {
  60. deps: [ 'amber/Kernel-Objects.deploy' ]
  61. },
  62. 'amber/Kernel-Transcript.deploy': {
  63. deps: [ 'amber/Kernel-Objects.deploy' ]
  64. },
  65. 'amber/Kernel-Announcements.deploy': {
  66. deps: [ 'amber/Kernel-Objects.deploy' ]
  67. },
  68. 'amber/Canvas.deploy': {
  69. deps: [ 'amber/Kernel-Objects.deploy' ]
  70. },
  71. 'amber/Kernel-Objects': {
  72. deps: []
  73. },
  74. 'amber/Kernel-Classes': {
  75. deps: [ 'amber/Kernel-Objects' ]
  76. },
  77. 'amber/Kernel-Methods': {
  78. deps: [ 'amber/Kernel-Objects' ]
  79. },
  80. 'amber/Kernel-Collections': {
  81. deps: [ 'amber/Kernel-Objects' ]
  82. },
  83. 'amber/Kernel-Exceptions': {
  84. deps: [ 'amber/Kernel-Objects' ]
  85. },
  86. 'amber/Kernel-Transcript': {
  87. deps: [ 'amber/Kernel-Objects' ]
  88. },
  89. 'amber/Kernel-Announcements': {
  90. deps: [ 'amber/Kernel-Objects' ]
  91. },
  92. 'amber/Canvas': {
  93. deps: [ 'amber/Kernel-Objects' ]
  94. },
  95. 'amber/SUnit': {
  96. deps: [ 'amber/Kernel-Objects' ]
  97. },
  98. 'amber/Importer-Exporter': {
  99. deps: [ 'amber/Kernel-Objects' ]
  100. },
  101. 'amber/Compiler-Exceptions': {
  102. deps: [ 'amber/Kernel-Exceptions', 'amber/Compiler-AST' ]
  103. },
  104. 'amber/Compiler-Core': {
  105. deps: [ 'amber/Kernel-Objects' ]
  106. },
  107. 'amber/Compiler-AST': {
  108. deps: [ 'amber/Compiler-Core' ]
  109. },
  110. 'amber/Compiler-Semantic': {
  111. deps: [ 'amber/Compiler-Core' ]
  112. },
  113. 'amber/Compiler-IR': {
  114. deps: [ 'amber/Compiler-Core' ]
  115. },
  116. 'amber/Compiler-Inlining': {
  117. deps: [ 'amber/Compiler-IR' ]
  118. },
  119. 'amber/Compiler-Interpreter': {
  120. deps: [ 'amber/Compiler-Core' ]
  121. },
  122. 'amber/IDE': {
  123. deps: [ 'amber/Canvas', 'amber/Kernel-Exceptions' ]
  124. },
  125. 'amber/Examples': {
  126. deps: [ 'amber/Canvas' ]
  127. },
  128. 'amber/Benchfib': {
  129. deps: [ 'amber/Kernel-Objects' ]
  130. },
  131. 'amber/Kernel-Tests': {
  132. deps: [ 'amber/SUnit' ]
  133. },
  134. 'amber/Compiler-Tests': {
  135. deps: [ 'amber/SUnit' ]
  136. },
  137. 'amber/SUnit-Tests': {
  138. deps: [ 'amber/SUnit' ]
  139. }
  140. }
  141. };
  142. if (require) {
  143. require.config(config);
  144. return require;
  145. } else {
  146. return config;
  147. }
  148. }(require);