amber4browser.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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': '../js',
  19. 'jquery': 'jQuery/jquery-1.8.2.min',
  20. 'jquery-ui': 'jQuery/jquery-ui-1.8.16.custom.min'
  21. },
  22. map: {
  23. '*': {
  24. 'css': 'require-css-0.0.6/css'
  25. }
  26. },
  27. shim: {
  28. 'jquery-ui': {
  29. deps: [ 'jquery' ]
  30. },
  31. 'jQuery/jquery.textarea': {
  32. deps: [ 'jquery', 'jquery-ui' ]
  33. },
  34. 'CodeMirror/smalltalk': {
  35. deps: [ 'CodeMirror/codemirror' ]
  36. },
  37. 'CodeMirror/addon/hint/show-hint': {
  38. deps: [ 'CodeMirror/codemirror' ]
  39. },
  40. 'ensure-console': {
  41. exports: 'console'
  42. },
  43. 'amber/Kernel-Objects.deploy': {
  44. deps: []
  45. },
  46. 'amber/Kernel-Classes.deploy': {
  47. deps: [ 'amber/Kernel-Objects.deploy' ]
  48. },
  49. 'amber/Kernel-Methods.deploy': {
  50. deps: [ 'amber/Kernel-Objects.deploy' ]
  51. },
  52. 'amber/Kernel-Collections.deploy': {
  53. deps: [ 'amber/Kernel-Objects.deploy' ]
  54. },
  55. 'amber/Kernel-Exceptions.deploy': {
  56. deps: [ 'amber/Kernel-Objects.deploy' ]
  57. },
  58. 'amber/Kernel-Transcript.deploy': {
  59. deps: [ 'amber/Kernel-Objects.deploy' ]
  60. },
  61. 'amber/Kernel-Announcements.deploy': {
  62. deps: [ 'amber/Kernel-Objects.deploy' ]
  63. },
  64. 'amber/Canvas.deploy': {
  65. deps: [ 'amber/Kernel-Objects.deploy' ]
  66. },
  67. 'amber/Kernel-Objects': {
  68. deps: []
  69. },
  70. 'amber/Kernel-Classes': {
  71. deps: [ 'amber/Kernel-Objects' ]
  72. },
  73. 'amber/Kernel-Methods': {
  74. deps: [ 'amber/Kernel-Objects' ]
  75. },
  76. 'amber/Kernel-Collections': {
  77. deps: [ 'amber/Kernel-Objects' ]
  78. },
  79. 'amber/Kernel-Exceptions': {
  80. deps: [ 'amber/Kernel-Objects' ]
  81. },
  82. 'amber/Kernel-Transcript': {
  83. deps: [ 'amber/Kernel-Objects' ]
  84. },
  85. 'amber/Kernel-Announcements': {
  86. deps: [ 'amber/Kernel-Objects' ]
  87. },
  88. 'amber/Canvas': {
  89. deps: [ 'amber/Kernel-Objects' ]
  90. },
  91. 'amber/SUnit': {
  92. deps: [ 'amber/Kernel-Objects' ]
  93. },
  94. 'amber/Importer-Exporter': {
  95. deps: [ 'amber/Kernel-Objects' ]
  96. },
  97. 'amber/Compiler-Exceptions': {
  98. deps: [ 'amber/Kernel-Exceptions' ]
  99. },
  100. 'amber/Compiler-Core': {
  101. deps: [ 'amber/Kernel-Objects' ]
  102. },
  103. 'amber/Compiler-AST': {
  104. deps: [ 'amber/Compiler-Core' ]
  105. },
  106. 'amber/Compiler-Semantic': {
  107. deps: [ 'amber/Compiler-Core' ]
  108. },
  109. 'amber/Compiler-IR': {
  110. deps: [ 'amber/Compiler-Core' ]
  111. },
  112. 'amber/Compiler-Inlining': {
  113. deps: [ 'amber/Compiler-IR' ]
  114. },
  115. 'amber/Compiler-Interpreter': {
  116. deps: [ 'amber/Compiler-Core' ]
  117. },
  118. 'amber/parser': {
  119. deps: []
  120. },
  121. 'amber/IDE': {
  122. deps: [ 'amber/Canvas', 'amber/Kernel-Exceptions' ]
  123. },
  124. 'amber/Examples': {
  125. deps: [ 'amber/Canvas' ]
  126. },
  127. 'amber/Benchfib': {
  128. deps: [ 'amber/Kernel-Objects' ]
  129. },
  130. 'amber/Kernel-Tests': {
  131. deps: [ 'amber/SUnit' ]
  132. },
  133. 'amber/Compiler-Tests': {
  134. deps: [ 'amber/SUnit' ]
  135. },
  136. 'amber/SUnit-Tests': {
  137. deps: [ 'amber/SUnit' ]
  138. }
  139. }
  140. };
  141. if (require) {
  142. require.config(config);
  143. return require;
  144. } else {
  145. return config;
  146. }
  147. }(require);