2
0

amber4browser.js 4.4 KB

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