Browse Source

amber_core => amber/core

Herby Vojčík 5 years ago
parent
commit
eb854ab145

+ 3 - 0
CHANGELOG

@@ -11,6 +11,9 @@
 * `aJsObject selector: foo withMoreArguments: bar` fails if `aJsObject.selector` is not a function
   * only the single-arg `aJsObject selector: foo` sets the value `aJsObject selector = foo`
   * so far even more-than-one-arg ones did set the value denoted by first keyword
+* Namespace change: amber_core => amber/core.
+  * Backward compatibility mapping added, so old code should load and save with new implicit deps.
+  * You must edit explicir deps (aka `imports:`) as well as Gruntfile, deploy, testing and devel .js files yourself.
 
 Commits: https://lolg.it/amber/amber/commits/0.23.0
 

+ 3 - 3
Gruntfile.js

@@ -56,7 +56,7 @@ module.exports = function (grunt) {
             tests: {
                 output_dir: 'lang/src',
                 src: ['lang/src/Kernel-Tests.st', 'lang/src/Compiler-Tests.st', 'lang/src/Platform-DOM-Tests.st', 'lang/src/SUnit-Tests.st'],
-                libraries: ['amber_core/SUnit'],
+                libraries: ['amber/core/SUnit'],
                 jsGlobals: ['navigator']
             },
             cli: {
@@ -80,7 +80,7 @@ module.exports = function (grunt) {
                     mainConfigFile: "config.js",
                     rawText: {
                         "__app__": "(" + function () {
-                            define(["amber/devel", "amber_core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
+                            define(["amber/devel", "amber/core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
                                 amber.initialize().then(function () {
                                     amber.globals.AmberCli._main();
                                 });
@@ -105,7 +105,7 @@ module.exports = function (grunt) {
                     mainConfigFile: "config.js",
                     rawText: {
                         "__app__": "(" + function () {
-                            define(["amber/devel", "amber_core/Platform-Node", "amber_devkit/NodeTestRunner"], function (amber) {
+                            define(["amber/devel", "amber/core/Platform-Node", "amber_devkit/NodeTestRunner"], function (amber) {
                                 amber.initialize().then(function () {
                                     amber.globals.NodeTestRunner._main();
                                 });

+ 5 - 5
grunt-init-project/root/Gruntfile.js

@@ -46,7 +46,7 @@ module.exports = function (grunt) {
                     'src/{%= name %}-Tests.st' // list all tests in dependency order
                 ],
                 amd_namespace: '{%= namespace %}',
-                libraries: ['amber_core/SUnit', 'amber/web/Web', 'silk/Silk']
+                libraries: ['amber/core/SUnit', 'amber/web/Web', 'silk/Silk']
             }
         },
 
@@ -61,7 +61,7 @@ module.exports = function (grunt) {
                     mainConfigFile: "config.js",
                     rawText: {
                         "app": '(' + polyfillThenPromiseApp + '());',
-                        "__app__": 'define(["deploy", "amber_core/Platform-Browser"],function(x){return x});'
+                        "__app__": 'define(["deploy", "amber/core/Platform-Browser"],function(x){return x});'
                     },
                     pragmas: {
                         excludeIdeData: true,
@@ -78,10 +78,10 @@ module.exports = function (grunt) {
                     mainConfigFile: "config.js",
                     rawText: {
                         "app": '(' + polyfillThenPromiseApp + '());',
-                        "__app__": 'define(["devel", "amber_core/Platform-Browser"],function(x){return x});'
+                        "__app__": 'define(["devel", "amber/core/Platform-Browser"],function(x){return x});'
                     },
                     include: ['config', 'node_modules/requirejs/require', 'app', '__app__'],
-                    exclude: ['devel', 'amber_core/Platform-Browser'],
+                    exclude: ['devel', 'amber/core/Platform-Browser'],
                     out: "the.js"
                 }
             },
@@ -91,7 +91,7 @@ module.exports = function (grunt) {
                     rawText: {
                         "jquery": "/* do not load in node test runner */",
                         "__app__": "(" + function () {
-                            define(["testing", "amber_core/Platform-Node", "amber_devkit/NodeTestRunner"], function (amber) {
+                            define(["testing", "amber/core/Platform-Node", "amber_devkit/NodeTestRunner"], function (amber) {
                                 amber.initialize().then(function () {
                                     amber.globals.NodeTestRunner._main();
                                 });

+ 1 - 1
grunt-init-project/root/testing.js

@@ -1,6 +1,6 @@
 define([
     './deploy',
-    'amber_core/SUnit',
+    'amber/core/SUnit',
     // --- packages used only during automated testing begin here ---
     '{%= namespace %}/{%= name %}-Tests'
     // --- packages used only during automated testing end here ---

+ 3 - 3
index.html

@@ -35,12 +35,12 @@
 
         require(["require", "amber/es6-promise"], function (require, promiseLib) {
             promiseLib.polyfill();
-            require(["amber/boot", "amber/deploy", "amber_core/Platform-Browser"], function (_, amber) {
+            require(["amber/boot", "amber/deploy", "amber/core/Platform-Browser"], function (_, amber) {
                 messageBox.appendChild(initializingKernel);
-                amber.initialize({'transport.defaultAmdNamespace': "amber_core"})
+                amber.initialize({'transport.defaultAmdNamespace': "amber/core"})
                     .then(function () {
                         messageBox.appendChild(loadingIdeSupport);
-                        return amber.loadPackages(["amber/lang", "amber/legacy/IDE", "amber_core/SUnit"]);
+                        return amber.loadPackages(["amber/lang", "amber/legacy/IDE", "amber/core/SUnit"]);
                     })
                     .then(function () {
                         startLegacy.addEventListener('click', function () {

+ 5 - 0
lang/API-CHANGES.txt

@@ -1,3 +1,8 @@
+0.23.0:
+
+* Namespace change: amber_core => amber/core.
+
+
 0.22.4:
 
 * Remove class IndexableCollection, trait TKeyValueCollection.

+ 1 - 1
lang/base/boot.js

@@ -69,7 +69,7 @@ define([
     function AMDBrik (brikz, st) {
         st.amdRequire = require;
         st.defaultTransportType = st.defaultTransportType || "amd";
-        st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
+        st.defaultAmdNamespace = st.defaultAmdNamespace || "amber/core";
     }
 
     /* Defines asReceiver to be present at load time */

+ 11 - 11
lang/base/deploy.js

@@ -2,17 +2,17 @@ define([
     './helpers',
     './boot', // pre-fetch, dep of ./helpers
     // --- packages of the core Amber begin here ---
-    'amber_core/Kernel-Helpers',
-    'amber_core/Kernel-Objects',
-    'amber_core/Kernel-Classes',
-    'amber_core/Kernel-Methods',
-    'amber_core/Kernel-Collections',
-    'amber_core/Kernel-Dag',
-    'amber_core/Kernel-Infrastructure',
-    'amber_core/Kernel-Promises',
-    'amber_core/Kernel-Exceptions',
-    'amber_core/Kernel-Announcements',
-    'amber_core/Platform-Services',
+    'amber/core/Kernel-Helpers',
+    'amber/core/Kernel-Objects',
+    'amber/core/Kernel-Classes',
+    'amber/core/Kernel-Methods',
+    'amber/core/Kernel-Collections',
+    'amber/core/Kernel-Dag',
+    'amber/core/Kernel-Infrastructure',
+    'amber/core/Kernel-Promises',
+    'amber/core/Kernel-Exceptions',
+    'amber/core/Kernel-Announcements',
+    'amber/core/Platform-Services',
     // --- packages of the core Amber end here ---
 ], function (amber) {
     return amber;

+ 6 - 6
lang/base/devel.js

@@ -7,12 +7,12 @@ define([
     './boot', // pre-fetch, class loader
     './deploy', // pre-fetch, dep of ./lang
     // --- packages of the development only Amber begin here ---
-    'amber_core/Platform-DOM',
-    'amber_core/SUnit',
-    'amber_core/Compiler-Tests',
-    'amber_core/Kernel-Tests',
-    'amber_core/Platform-DOM-Tests',
-    'amber_core/SUnit-Tests'
+    'amber/core/Platform-DOM',
+    'amber/core/SUnit',
+    'amber/core/Compiler-Tests',
+    'amber/core/Kernel-Tests',
+    'amber/core/Platform-DOM-Tests',
+    'amber/core/SUnit-Tests'
     // --- packages of the development only Amber end here ---
 ], function (amber) {
     return amber;

+ 7 - 7
lang/base/lang.js

@@ -4,13 +4,13 @@ define([
     './helpers', // pre-fetch, dep of ./deploy
     './parser',
     // --- packages for the Amber reflection begin here ---
-    'amber_core/Platform-ImportExport',
-    'amber_core/Compiler-Core',
-    'amber_core/Compiler-AST',
-    'amber_core/Compiler-Semantic',
-    'amber_core/Compiler-IR',
-    'amber_core/Compiler-Inlining',
-    'amber_core/Compiler-Interpreter'
+    'amber/core/Platform-ImportExport',
+    'amber/core/Compiler-Core',
+    'amber/core/Compiler-AST',
+    'amber/core/Compiler-Semantic',
+    'amber/core/Compiler-IR',
+    'amber/core/Compiler-Inlining',
+    'amber/core/Compiler-Interpreter'
     // --- packages for the Amber reflection end here ---
 ], function (amber) {
     return amber;

+ 6 - 1
lang/local.amd.json

@@ -1,6 +1,11 @@
 {
   "paths": {
     "amber": "base",
-    "amber_core": "src"
+    "amber/core": "src"
+  },
+  "map": {
+    "*": {
+      "amber_core": "amber/core"
+    }
   }
 }

+ 7 - 4
sdk/lib/amberc.js

@@ -35,7 +35,7 @@ var createDefaultConfiguration = function () {
         load: [],
         stFiles: [],
         jsGlobals: [],
-        amdNamespace: 'amber_core',
+        amdNamespace: 'amber/core',
         compile: [],
         compiled: [],
         outputDir: undefined,
@@ -53,7 +53,7 @@ AmberCompiler.prototype.main = function (configuration, finished_callback) {
     console.time('Compile Time');
 
     if (configuration.amdNamespace.length === 0) {
-        configuration.amdNamespace = 'amber_core';
+        configuration.amdNamespace = 'amber/core';
     }
 
     console.ambercLog = console.log;
@@ -89,7 +89,10 @@ AmberCompiler.prototype.main = function (configuration, finished_callback) {
     if (!rjsConfig.paths.amber) {
         rjsConfig.paths.amber = path.join(this.amber_dir, 'base');
     }
-    if (!rjsConfig.paths.amber_core) rjsConfig.paths.amber_core = path.join(this.amber_dir, 'src');
+    if (!rjsConfig.paths["amber/core"]) rjsConfig.paths["amber/core"] = path.join(this.amber_dir, 'src');
+    if (!rjsConfig.map) rjsConfig.map = {};
+    if (!rjsConfig.map["*"]) rjsConfig.map["*"] = {};
+    rjsConfig.map["*"]["amber_core"] = "amber/core";
     rjsConfig.paths['text'] = require.resolve('requirejs-text').replace(/\.js$/, "");
     rjsConfig.paths['amber/without-imports'] = path.join(__dirname, 'without-imports');
     rjsConfig.nodeRequire = require;
@@ -199,7 +202,7 @@ function collect_st_files(configuration) {
  */
 function create_compiler(configuration) {
     var include_files = configuration.load;
-    return new Promise(configuration.requirejs.bind(null, ["amber/lang", "amber_core/Platform-Node"]))
+    return new Promise(configuration.requirejs.bind(null, ["amber/lang", "amber/core/Platform-Node"]))
         .then(function (boot) {
             configuration.core = boot.api;
             configuration.globals = boot.globals;