Browse Source

use abstract "amber/Platform"

and each load / build must somehow map it to
either amber_core/Platform-Browser or amber_core/Platform-Node
Herbert Vojčík 8 years ago
parent
commit
884f142861
4 changed files with 10 additions and 13 deletions
  1. 1 1
      config-node.js
  2. 4 9
      external/amber-dev/lib/amberc.js
  3. 4 2
      internal/index.html
  4. 1 1
      support/deploy.js

+ 1 - 1
config-node.js

@@ -2,6 +2,6 @@
 // when building an app to run in node.js.
 // Free to edit. You can break tests (cli test runner uses
 // this to build itself - it is a node executable).
-define("amber_core/Platform-Browser", ["amber_core/Platform-Node"], {});
+define("amber/Platform", ["amber_core/Platform-Node"], {});
 define("amber/browser-compatibility", {});
 define("jquery", {});

+ 4 - 9
external/amber-dev/lib/amberc.js

@@ -24,15 +24,7 @@ function AmberCompiler(amber_dir) {
 
     this.amber_dir = amber_dir;
     // Important: in next list, boot MUST be first
-    this.kernel_libraries = ['amber/boot',
-        'amber_core/Kernel-Objects', 'amber_core/Kernel-Classes', 'amber_core/Kernel-Methods',
-        'amber_core/Kernel-Collections', 'amber_core/Kernel-Infrastructure',
-        'amber_core/Kernel-Exceptions', 'amber_core/Kernel-Announcements',
-        'amber_core/Platform-Services', 'amber_core/Platform-Node'];
-    this.compiler_libraries = this.kernel_libraries.concat(['amber/parser',
-        'amber_core/Platform-ImportExport', 'amber_core/Compiler-Exceptions',
-        'amber_core/Compiler-Core', 'amber_core/Compiler-AST', 'amber_core/Compiler-Exceptions',
-        'amber_core/Compiler-IR', 'amber_core/Compiler-Inlining', 'amber_core/Compiler-Semantic']);
+    this.compiler_libraries = ['amber/lang'];
 }
 
 
@@ -102,6 +94,9 @@ AmberCompiler.prototype.main = function (configuration, finished_callback) {
     if (!rjsConfig.paths.amber_core) rjsConfig.paths.amber_core = path.join(this.amber_dir, 'src');
     rjsConfig.paths['text'] = require.resolve('requirejs-text').replace(/\.js$/, "");
     rjsConfig.paths['amber/without-imports'] = path.join(__dirname, 'without-imports');
+    rjsConfig.map = rjsConfig.map || {};
+    rjsConfig.map["*"] = rjsConfig.map["*"] || {};
+    rjsConfig.map["*"]["amber/Platform"] = "amber_core/Platform-Node";
     rjsConfig.nodeRequire = require;
     rjsConfig.context = "amberc";
     configuration.requirejs = requirejs.config(rjsConfig);

+ 4 - 2
internal/index.html

@@ -6,7 +6,10 @@
     <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
     <meta name="author" content="Nicolas Petton"/>
     <script>
-        var require = {baseUrl: ".."};
+        var require = {
+            baseUrl: "..",
+            map: {"*": {"amber/Platform": "amber_core/Platform-Browser"}}
+        };
     </script>
     <script type='text/javascript' src='../node_modules/requirejs/require.js'></script>
     <script type='text/javascript' src='../config.js'></script>
@@ -14,7 +17,6 @@
 
 <body>
 <script type='text/javascript'>
-//    require.config({baseUrl: '..'});
     require(
         ["amber/devel", "amber/legacy/IDE", "amber/web/Web", "amber/legacy/Benchfib", "helios/all", "amber_cli/AmberCli"],
         function (amber) {

+ 1 - 1
support/deploy.js

@@ -9,6 +9,6 @@ define([
     'amber_core/Kernel-Exceptions',
     'amber_core/Kernel-Announcements',
     'amber_core/Platform-Services',
-    'amber_core/Platform-Browser'
+    'amber/Platform'
     // --- packages of the core Amber end here ---
 ], function (amber) { return amber; });