浏览代码

Merge branch '0.13' into up

Herbert Vojčík 10 年之前
父节点
当前提交
805b58ab0f

+ 16 - 0
codemirror.amd.json

@@ -0,0 +1,16 @@
+{
+    "paths": {
+        "amber_lib/codemirror": "."
+    },
+    "shim": {
+        "amber_lib/codemirror/lib/codemirror": {
+            "deps": [ "css!amber_lib/codemirror/lib/codemirror" ]
+        },
+        "amber_lib/codemirror/mode/smalltalk/smalltalk": {
+            "deps": [ "../../lib/codemirror" ]
+        },
+        "amber_lib/codemirror/addon/hint/show-hint": {
+            "deps": [ "../../lib/codemirror" ]
+        }
+    }
+}

+ 77 - 0
config.js

@@ -0,0 +1,77 @@
+/* DO NOT EDIT! This file is generated. */
+
+var require;
+if (!require) require = {config: function (x) {require = x;}};
+require.config({
+  "paths": {
+    "amber": "support",
+    "amber_vm": "support/deprecated-vm-files",
+    "amber_vm/_st": "support/deprecated-vm-files/as-receiver",
+    "amber_css": "support/resources",
+    "amber_core": "src",
+    "amber_cli": "external/amber-cli/src",
+    "helios": "support/helios/src",
+    "helios/set": "support/helios/set",
+    "helios/resources": "support/helios/resources",
+    "helios/index": "support/helios/index",
+    "amber_lib/codemirror": "bower_components/codemirror",
+    "amber_lib/es5-shim": "bower_components/es5-shim",
+    "amber_lib/jquery-tabby": "bower_components/jquery-tabby",
+    "jquery-ui": [
+      "bower_components/jquery-ui/jquery-ui.min",
+      "bower_components/jquery-ui/ui/minified/jquery-ui.min",
+      "bower_components/jquery-ui/jquery-ui.min",
+      "bower_components/jquery-ui/ui/minified/jquery-ui.min"
+    ],
+    "jquery": [
+      "bower_components/jquery/dist/jquery.min",
+      "bower_components/jquery/jquery.min"
+    ],
+    "require-css": "bower_components/require-css",
+    "bootstrap2.3.2": "bower_components/bootstrap2.3.2/bootstrap",
+    "amber_lib/showdown": "bower_components/showdown"
+  },
+  "shim": {
+    "ensure-console": {
+      "exports": "console"
+    },
+    "amber_lib/codemirror/lib/codemirror": {
+      "deps": [
+        "css!amber_lib/codemirror/lib/codemirror"
+      ]
+    },
+    "amber_lib/codemirror/mode/smalltalk/smalltalk": {
+      "deps": [
+        "../../lib/codemirror"
+      ]
+    },
+    "amber_lib/codemirror/addon/hint/show-hint": {
+      "deps": [
+        "../../lib/codemirror"
+      ]
+    },
+    "amber_lib/jquery-tabby/jquery.textarea": {
+      "deps": [
+        "jquery",
+        "jquery"
+      ]
+    },
+    "jquery-ui": {
+      "deps": [
+        "jquery",
+        "jquery"
+      ]
+    },
+    "bootstrap2.3.2/js/bootstrap": {
+      "deps": [
+        "jquery",
+        "css!bootstrap2.3.2/css/bootstrap"
+      ]
+    }
+  },
+  "map": {
+    "*": {
+      "css": "require-css/css"
+    }
+  }
+});

+ 5 - 0
es5-shim.amd.json

@@ -0,0 +1,5 @@
+{
+    "paths": {
+        "amber_lib/es5-shim": "."
+    }
+}

+ 5 - 0
external/amber-cli/local.amd.json

@@ -0,0 +1,5 @@
+{
+    "paths": {
+        "amber_cli": "src"
+    }
+}

+ 2 - 0
external/amber-dev/lib/config.js

@@ -15,6 +15,8 @@ exports.writeConfig = function (searchDir, fileForConfig) {
         if (err) throw err;
         var text = "/* DO NOT EDIT! This file is generated. */\n" +
             "\n" +
+            "var require;\n" +
+            "if (!require) require = {config: function (x) {require = x;}};\n" +
             "require.config(" + JSON.stringify(result, null, 2) + ");";
         fs.writeFile(path.join(searchDir, fileForConfig), text, function (err) {
             if (err) throw err;

+ 2 - 2
external/amber-dev/package.json

@@ -1,6 +1,6 @@
 {
   "name": "amber-dev",
-  "version": "0.1.2",
+  "version": "0.1.4",
   "description": "Development goodies for Amber Smalltalk",
   "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1"
@@ -17,6 +17,6 @@
   "dependencies": {
     "amdefine": "0.0.8",
     "es6-promise": "~0.1.1",
-    "amd-config-builder": "~0.1.2"
+    "amd-config-builder": "~0.1.3"
   }
 }

+ 2 - 6
internal/index.html

@@ -5,17 +5,13 @@
     <title>Amber Smalltalk</title>
     <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
     <meta name="author" content="Nicolas Petton"/>
-    <script type='text/javascript' src='../support/amber.js'></script>
+    <script type='text/javascript' src='../config.js'></script>
     <script type='text/javascript' src='../support/requirejs/require.min.js'></script>
 </head>
 
 <body>
 <script type='text/javascript'>
-    require.config({
-        paths: {
-            'amber_cli': '../external/amber-cli/src'
-        }
-    });
+    require.config({baseUrl: '..'});
     require(
         ["amber/devel", "helios/all", "amber_cli/AmberCli"],
         function (smalltalk) {

+ 10 - 0
jquery-tabby.amd.json

@@ -0,0 +1,10 @@
+{
+    "paths": {
+        "amber_lib/jquery-tabby": "."
+    },
+    "shim": {
+        "amber_lib/jquery-tabby/jquery.textarea": {
+            "deps": [ "jquery" ]
+        }
+    }
+}

+ 10 - 0
jquery-ui.amd.json

@@ -0,0 +1,10 @@
+{
+    "paths": {
+        "jquery-ui": ["jquery-ui.min", "ui/minified/jquery-ui.min"]
+    },
+    "shim": {
+        "jquery-ui": {
+            "deps": [ "jquery" ]
+        }
+    }
+}

+ 5 - 0
jquery.amd.json

@@ -0,0 +1,5 @@
+{
+    "paths": {
+        "jquery": ["dist/jquery.min", "jquery.min"]
+    }
+}

+ 14 - 0
local.amd.json

@@ -0,0 +1,14 @@
+{
+    "paths": {
+        "amber": "support",
+        "amber_vm": "support/deprecated-vm-files",
+        "amber_vm/_st": "support/deprecated-vm-files/as-receiver",
+        "amber_css": "support/resources",
+        "amber_core": "src"
+    },
+    "shim": {
+        "ensure-console": {
+            "exports": "console"
+        }
+    }
+}

+ 10 - 0
require-css.amd.json

@@ -0,0 +1,10 @@
+{
+    "paths": {
+        "require-css": "."
+    },
+    "map": {
+        "*": {
+            "css": "require-css/css"
+        }
+    }
+}

+ 0 - 114
support/amber.js

@@ -1,114 +0,0 @@
-/* Amber package loading.
-  Load this script as well as require.js (works in any order;
-    either defines 'require', thus passing config, if loaded prior require.js;
-    or calls require.config, if loaded post require.js).
-  Usage example:
-    require(['amber/devel'], function(amber) {
-        amber.initialize({"transport.defaultAmdNamespace": "com_example_myproject"});
-
-        amber.globals.Browser._open(); // for legacy IDE
-        amber.popupHelios(); // for Helios IDE
-    });
-  For detailed explanation of amber loading, see:
-  https://github.com/amber-smalltalk/amber/wiki/How-to-load-amber
- */
-
-var require;
-
-require = function (require) {
-    function uniquelyMapped(symbolicPath) {
-        if (require && typeof define !== "undefined" && define.amd) {
-            var mappedPath = require.toUrl(symbolicPath),
-                basePath = require.toUrl('') + symbolicPath;
-            if (resolveViaDOM(mappedPath) !== resolveViaDOM(basePath)) {
-                return mappedPath;
-            }
-        }
-    }
-    function myTag() {
-        // To be able to use its path and attributes
-        // to map other parts of Amber, this code must find its path.
-        // It first looks if require is already present && 'amber' path mapped.
-        // It not, it looks for id 'amber-path-mapper'.
-        // When loading amber.js asynchronously, you must include this id,
-        // or the code can not reliably find its <script>.
-        // If neither 'amber' mapping, nor script#amber-path-mapper is present,
-        // (the id is not necessary for inline <script> tag in HTML),
-        // it uses the "find the last <script> tag present in the moment" method.
-        var result = uniquelyMapped('amber/amber');
-        if (result) {
-            return {src: result, hasAttribute: function () { return false; }};
-        }
-        var me = document.getElementById("amber-path-mapper");
-        if (me && me.tagName.toLowerCase() === "script") {
-            return me;
-        }
-        var scripts = document.getElementsByTagName("script");
-        return scripts[scripts.length - 1];
-    }
-    var me = myTag();
-    var src = me.src;
-    // strip the last two elements from the URL
-    // e.g. http://app.com/amber/support/amber.js -> http://app.com/amber
-    var amber_home = resolveViaDOM(src).replace(/\/[^\/]+\/[^\/]+$/, "");
-    // In case of nonstandard deployment, you can specify libraries placement directly ...
-    var library_home = uniquelyMapped('amber_lib') || me.hasAttribute('data-libs') && me.getAttribute('data-libs');
-
-    // ... otherwise, this heuristics is used:
-    if (!library_home) {
-        // At the present moment, bower tries to have flat hierarchy,
-        // which leads to two possible scenarios:
-        // 1. amber itself was deployed via bower,
-        //    its libraries are at the same bower dir
-        //    where amber itself is placed
-        // 2. amber was deployed in different fashion,
-        //    its libraries are included by bower locally, inside amber
-        // The detection is done by looking for '/bower_components/' in amber path.
-        var match = amber_home.match(/^(.*\/bower_components)\//);
-        library_home = match ? match[1] : amber_home + '/bower_components';
-    }
-
-    function resolveViaDOM(url) {
-        var a = document.createElement("a");
-        a.href = url;
-        return a.href;
-    }
-
-    var config = {
-        paths: {
-            'amber': amber_home + '/support',
-            'amber_vm': amber_home + '/support/deprecated-vm-files',
-            'amber_vm/_st': amber_home + '/support/deprecated-vm-files/as-receiver',
-            'amber_css': amber_home + '/support/resources', // deprecated
-            'amber_lib': library_home,
-            'amber_core': amber_home + '/src',
-            'helios': amber_home + '/support/helios/src',
-            'helios/set': amber_home + '/support/helios/set',
-            'helios/resources': amber_home + '/support/helios/resources',
-            'helios/index': amber_home + '/support/helios/index',
-            'jquery': [ library_home + '/jquery/dist/jquery.min', library_home + '/jquery/jquery.min' ]
-        },
-        map: {
-            '*': {
-                'css': 'amber_lib/require-css/css'
-            }
-        },
-        shim: {
-            'ensure-console': {
-                exports: 'console'
-            }
-        }
-    };
-
-    // This is to allow both alternatives of loading:
-    // before require.js as well as after require.js
-    // See http://requirejs.org/docs/api.html#config for details
-    // of usage of 'require' global to allow to pre-define configuration
-    // before require.js is loaded.
-    if (require) {
-        require.config(config);
-        return require;
-    } else {
-        return config;
-    }
-}(require);

+ 0 - 12
support/codemirror-inner.js

@@ -1,12 +0,0 @@
-// Loading this in nested file so that require.config
-// with shim dependencies is in effect.
-// See http://stackoverflow.com/questions/21647956/how-to-config-requirejs-shim-dependencies-just-in-time/
-
-define([
-    'amber_lib/codemirror/lib/codemirror',
-    'amber_lib/codemirror/mode/smalltalk/smalltalk',
-    'amber_lib/codemirror/addon/hint/show-hint',
-    'css!amber_lib/codemirror/theme/ambiance',
-    'css!amber_lib/codemirror/lib/codemirror',
-    'css!amber_lib/codemirror/addon/hint/show-hint'
-]);

+ 8 - 15
support/codemirror.js

@@ -1,15 +1,8 @@
-require.config({
-	shim: {
-		'amber_lib/codemirror/lib/codemirror': {
-			deps: [ 'css!amber_lib/codemirror/lib/codemirror' ]
-		},
-		'amber_lib/codemirror/mode/smalltalk/smalltalk': {
-			deps: [ '../../lib/codemirror' ]
-		},
-		'amber_lib/codemirror/addon/hint/show-hint': {
-			deps: [ '../../lib/codemirror' ]
-		}
-	}
-});
-
-define(['./codemirror-inner']);
+define([
+    'amber_lib/codemirror/lib/codemirror',
+    'amber_lib/codemirror/mode/smalltalk/smalltalk',
+    'amber_lib/codemirror/addon/hint/show-hint',
+    'css!amber_lib/codemirror/theme/ambiance',
+    'css!amber_lib/codemirror/lib/codemirror',
+    'css!amber_lib/codemirror/addon/hint/show-hint'
+]);

+ 0 - 11
support/devel-inner.js

@@ -1,11 +0,0 @@
-// Loading this in nested file so that require.config
-// with shim dependencies is in effect.
-// See http://stackoverflow.com/questions/21647956/how-to-config-requirejs-shim-dependencies-just-in-time/
-
-define([
-	'jquery-ui',
-    'amber_lib/jquery-tabby/jquery.textarea',
-    'amber_core/IDE',
-    'amber_core/Examples',
-    'amber_core/Benchfib'
-]);

+ 5 - 18
support/devel.js

@@ -1,25 +1,12 @@
-require.config({
-	paths: {
-		'jquery-ui': [
-			require.toUrl('amber_lib/jquery-ui/jquery-ui.min'),
-			require.toUrl('amber_lib/jquery-ui/ui/minified/jquery-ui.min')
-		]
-	},
-	shim: {
-		'jquery-ui': {
-			deps: [ 'jquery' ]
-		},
-		'amber_lib/jquery-tabby/jquery.textarea': {
-			deps: [ 'jquery' ]
-		}
-	}
-});
-
 define([
 	'./helpers', // pre-fetch, dep of ./deploy
 	'./deploy', // pre-fetch, dep of ./lang
 	'./lang',
 	'./codemirror',
-	'./devel-inner',
+    'jquery-ui',
+    'amber_lib/jquery-tabby/jquery.textarea',
+    'amber_core/IDE',
+    'amber_core/Examples',
+    'amber_core/Benchfib',
 	'css!amber/resources/amber'
 ], function (smalltalk) { return smalltalk; });

+ 10 - 0
support/helios/bootstrap2.3.2.amd.json

@@ -0,0 +1,10 @@
+{
+    "paths": {
+        "bootstrap2.3.2": "bootstrap"
+    },
+    "shim": {
+        "bootstrap2.3.2/js/bootstrap": {
+            "deps": [ "jquery", "css!bootstrap2.3.2/css/bootstrap" ]
+        }
+    }
+}

+ 11 - 11
support/helios/index.html

@@ -10,20 +10,20 @@
     <div id="helper">Loading Helios...</div>
 
     <div id="includes">
-      <script type='text/javascript' src='../amber.js'></script>
       <script type='text/javascript' src='../requirejs/require.min.js'></script>
       <script type='text/javascript'>
-          require(
-                  ["helios/set"],
-                  function (smalltalk) {
-                      window.onbeforeunload = function() {
-                          return 'Do you want to close Amber? All uncommitted changes will be lost.';
-                      };
+        var base = decodeURIComponent(window.location.search.slice(1));
+        if (base) require.config({baseUrl: base});
+        require(["require", "config"], function (require) {
+          require(["helios/set"], function (smalltalk) {
+            window.onbeforeunload = function() {
+              return 'Do you want to close Amber? All uncommitted changes will be lost.';
+            };
 
-                      smalltalk.initialize({'transport.defaultAmdNamespace': "amber_core"});
-					  smalltalk.globals.HLManager._setup();
-                  }
-          );
+            smalltalk.initialize({'transport.defaultAmdNamespace': "amber_core"});
+            smalltalk.globals.HLManager._setup();
+          });
+        });
       </script>
     </div>
   </body>

+ 7 - 2
support/helios/index.js

@@ -1,10 +1,15 @@
 define(["require"], function (require) {
     return  {
+        pageUrl: function () {
+            var a = document.createElement("a");
+            a.href = require.toUrl("..");
+            return require.toUrl('./index.html') + "?" + encodeURIComponent(a.href);
+        },
         popup: function () {
-            window.open(require.toUrl('./index.html'), "Helios", "menubar=no, width=1000, height=600");
+            window.open(this.pageUrl(), "Helios", "menubar=no, width=1000, height=600");
         },
         go: function () {
-            window.location.href = require.toUrl('./index.html');
+            window.location.href = this.pageUrl();
         }
     };
 });

+ 10 - 0
support/helios/jquery-tabby.amd.json

@@ -0,0 +1,10 @@
+{
+    "paths": {
+        "amber_lib/jquery-tabby": "."
+    },
+    "shim": {
+        "amber_lib/jquery-tabby/jquery.textarea": {
+            "deps": [ "jquery" ]
+        }
+    }
+}

+ 10 - 0
support/helios/jquery-ui.amd.json

@@ -0,0 +1,10 @@
+{
+    "paths": {
+        "jquery-ui": ["jquery-ui.min", "ui/minified/jquery-ui.min"]
+    },
+    "shim": {
+        "jquery-ui": {
+            "deps": [ "jquery" ]
+        }
+    }
+}

+ 8 - 0
support/helios/local.amd.json

@@ -0,0 +1,8 @@
+{
+    "paths": {
+        "helios": "src",
+        "helios/set": "set",
+        "helios/resources": "resources",
+        "helios/index": "index"
+    }
+}

+ 10 - 25
support/helios/set.js

@@ -1,32 +1,17 @@
-require.config({
-	paths: {
-		'bootstrap2.3.2': require.toUrl('amber_lib') + '/bootstrap2.3.2/bootstrap',
-		'jquery-ui': [
-			require.toUrl('amber_lib/jquery-ui/jquery-ui.min'),
-			require.toUrl('amber_lib/jquery-ui/ui/minified/jquery-ui.min')
-		]
-	},
-	shim: {
-		'jquery-ui': {
-			deps: [ 'jquery' ]
-		},
-		'bootstrap2.3.2/js/bootstrap': {
-			deps: [ 'jquery', 'css!bootstrap2.3.2/css/bootstrap' ]
-		},
-		'amber_lib/jquery-tabby/jquery.textarea': {
-			deps: [ 'jquery' ]
-		}
-	}
-});
-
 define([
 	'amber/helpers', // pre-fetch, dep of amber/deploy
 	'amber/deploy', // pre-fetch, dep of amber/lang
 	'amber/lang',
 	'amber/codemirror',
-	'amber/devel-inner', // pre-fetch, dep of ./all-inner
-	'./resources/set-inner',
-	'css!./resources/helios',
+    'jquery-ui',
+    'amber_lib/jquery-tabby/jquery.textarea',
+    'amber_core/IDE',
+    'amber_core/Examples',
+    'amber_core/Benchfib',
+    'bootstrap2.3.2/js/bootstrap',
+    'amber_lib/showdown/compressed/showdown',
+    './all',
+    'css!./resources/helios',
 	'css!./resources/helios-niflheim',
-	'css!./resources/niflheim'
+    'css!./resources/niflheim'
 ], function (smalltalk) { return smalltalk; });

+ 5 - 0
support/helios/showdown.amd.json

@@ -0,0 +1,5 @@
+{
+    "paths": {
+        "amber_lib/showdown": "."
+    }
+}