Repository: cordova-js
Updated Branches:
  refs/heads/master d46dc722c -> 65fd0f61c


CB-13163: fix using relative paths in calls to require.


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/65fd0f61
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/65fd0f61
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/65fd0f61

Branch: refs/heads/master
Commit: 65fd0f61cca4d979e653ab5cf2dbc32b50416ba9
Parents: d46dc72
Author: filmaj <maj....@gmail.com>
Authored: Wed Aug 9 20:08:51 2017 -0700
Committer: filmaj <maj....@gmail.com>
Committed: Wed Aug 9 20:08:51 2017 -0700

----------------------------------------------------------------------
 src/scripts/require.js |  2 +-
 test/test.require.js   | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/65fd0f61/src/scripts/require.js
----------------------------------------------------------------------
diff --git a/src/scripts/require.js b/src/scripts/require.js
index 93d01c4..8bf5848 100644
--- a/src/scripts/require.js
+++ b/src/scripts/require.js
@@ -31,7 +31,7 @@ var require,
         requireStack = [],
     // Map of module ID -> index into requireStack of modules currently being 
built.
         inProgressModules = {},
-        SEPARATOR = ".";
+        SEPARATOR = "/";
 
 
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/65fd0f61/test/test.require.js
----------------------------------------------------------------------
diff --git a/test/test.require.js b/test/test.require.js
index c7e2285..1f1724f 100644
--- a/test/test.require.js
+++ b/test/test.require.js
@@ -145,5 +145,15 @@ describe("require + define", function () {
             define("a", factory);
             require("a");
         });
+
+        it("can handle multiple defined modules that use relative require 
paths", function () {
+            define("plugin/ios/foo", function (require, exports, module) {
+                module.exports = require("./bar") * 2;
+            });
+            define("plugin/ios/bar", function (require, exports, module) {
+                module.exports = 2;
+            });
+            expect(require("plugin/ios/foo")).toEqual(4);
+        });
     });
 });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to