diff --git a/.gitignore b/.gitignore index 8ea8b795..ac2d10f1 100644 --- a/.gitignore +++ b/.gitignore @@ -13,11 +13,14 @@ # A handy place to put stuff that git should ignore: /ignore/ -support/async/ -support/node-htmlparser/ -support/node-o3-xml/ -support/requirejs/ +node_modules/htmlparser/ +node_modules/amd-loader/ +node_modules/asyncjs/ +node_modules/jsdom/ +node_modules/libxml/ +node_modules/mime/ +node_modules/uglify-js/ +node_modules/.bin/ + -/node_modules -support/node-o3-xml-v4/ .git-ref \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index b6fb7d15..5f39dc89 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,12 @@ -[submodule "node_modules/cockpit"] - path = node_modules/cockpit - url = git://github.com/ajaxorg/cockpit.git -[submodule "node_modules/pilot"] - path = node_modules/pilot - url = git://github.com/ajaxorg/pilot.git -[submodule "node_modules/dryice"] - path = node_modules/dryice - url = git://github.com/ajaxorg/dryice.git [submodule "doc/wiki"] path = doc/wiki url = git://github.com/ajaxorg/ace.wiki.git +[submodule "node_modules/dryice"] + path = node_modules/dryice + url = git://github.com/ajaxorg/dryice.git +[submodule "node_modules/pilot"] + path = node_modules/pilot + url = git://github.com/ajaxorg/pilot.git +[submodule "node_modules/cockpit"] + path = node_modules/cockpit + url = git://github.com/ajaxorg/cockpit.git \ No newline at end of file diff --git a/Makefile.dryice.js b/Makefile.dryice.js index a705fcf4..4dbc8fec 100755 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -82,14 +82,14 @@ if (!target) { console.log("using targetDir '", targetDir, "'"); -var copy = require('./support/dryice/lib/dryice').copy; +var copy = require('dryice').copy; var aceHome = __dirname; console.log('# ace ---------'); var aceProject = [ - aceHome + '/support/pilot/lib', + aceHome + '/node_modules/pilot/lib', aceHome + '/lib', aceHome ]; @@ -274,7 +274,7 @@ console.log('# ace worker ---------'); console.log("worker for " + mode + " mode"); var worker = copy.createDataObject(); var workerProject = copy.createCommonJsProject([ - aceHome + '/support/pilot/lib', + aceHome + '/node_modules/pilot/lib', aceHome + '/lib' ]); copy({ diff --git a/kitchen-sink.html b/kitchen-sink.html index 9c7a90d7..dc4e4849 100644 --- a/kitchen-sink.html +++ b/kitchen-sink.html @@ -191,8 +191,8 @@ paths: { demo: "..", ace: "../../lib/ace", - cockpit: "../../support/cockpit/lib/cockpit", - pilot: "../../support/pilot/lib/pilot" + cockpit: "../../node_modules/cockpit/lib/cockpit", + pilot: "../../node_modules/pilot/lib/pilot" } }; diff --git a/lib/ace/test/all.js b/lib/ace/test/all.js index 9b07a28e..f3a74725 100644 --- a/lib/ace/test/all.js +++ b/lib/ace/test/all.js @@ -38,4 +38,4 @@ require("../../../support/paths"); var test = require("asyncjs").test; -test.walkTestCases(__dirname + "/..").exec() \ No newline at end of file +test.walkTestCases(__dirname + "/..").exec(); \ No newline at end of file diff --git a/package.json b/package.json index 997f9dd9..ef75c5fe 100644 --- a/package.json +++ b/package.json @@ -10,23 +10,19 @@ "type" : "git", "url" : "http://github.com/ajaxorg/ace.git" }, - "overlay": { - "teleport": { - "directories": { - "lib": "lib/ace", - "dependencies": { - "cockpit": ">=0.1.1", - "pilot": ">=0.1.1" - } - } - } - }, "dependencies": { - "asyncjs": ">=0.0.2", - "jsdom": ">=0.1.23", - "htmlparser": ">=1.7.2", "mime": ">=1.2.1" }, + "devDependencies": { + "asyncjs": "0.0.x", + "uglify-js": "1.1.x", + "jsdom": "0.1.x", + "htmlparser": "1.7.x", + "mime": "1.2.x", + "amd-loader": "0.0.x", + "libxml": "0.0.x" + }, + "licenses": [{ "type": "MPL", "url": "http://www.mozilla.org/MPL/" diff --git a/support/paths.js b/support/paths.js deleted file mode 100644 index db8a150d..00000000 --- a/support/paths.js +++ /dev/null @@ -1,7 +0,0 @@ -require("./requireJS-node"); -require.paths.unshift(__dirname + "/../lib"); -require.paths.unshift(__dirname + "/pilot/lib"); -require.paths.unshift(__dirname + "/dryice/lib"); -require.paths.unshift(__dirname + "/async/lib"); -require.paths.unshift(__dirname + "/jsdom/lib"); -require.paths.unshift(__dirname); diff --git a/support/requireJS-node.js b/support/requireJS-node.js deleted file mode 100644 index b01fd6a0..00000000 --- a/support/requireJS-node.js +++ /dev/null @@ -1,155 +0,0 @@ -var path = require("path"); -var fs = require("fs"); -var currentModule -var defaultCompile = module.constructor.prototype._compile; - -module.constructor.prototype._compile = function(content, filename){ - currentModule = this; - try{ - return defaultCompile.call(this, content, filename); - } - finally { - currentModule = null; - } -}; - -var requireModule = module; - -global.define = function (id, injects, factory) { - - // infere the module - var module = currentModule; - if (!module) { - module = requireModule; - while (module.parent) - module = module.parent; - } - - // parse arguments - if (!factory) { - // two or less arguments - factory = injects; - if (factory) { - // two args - if (typeof id === "string") { - if (id !== module.id) { - throw new Error("Can not assign module to a different id than the current file"); - } - // default injects - injects = []; - } - else{ - // anonymous, deps included - injects = id; - } - } - else { - // only one arg, just the factory - factory = id; - injects = []; - } - } - - var req = function(relativeId, callback) { - if (Array.isArray(relativeId)) { - // async require - return callback.apply(this, relativeId.map(req)) - } - - var chunks = relativeId.split("!"); - if (chunks.length >= 2) { - var prefix = chunks[0]; - relativeId = chunks.slice(1).join("!") - } - - if (relativeId.charAt(0) === '.') { - var rootPath = path.dirname(path.dirname(requireModule.filename)) + "/", - absolutePath = path.dirname(module.filename) + "/" + relativeId; - - relativeId = "../" + absolutePath.match(new RegExp(rootPath + "(.*)"))[1]; - } - - if (prefix == "ace/requirejs/text") { - return fs.readFileSync(findModulePath(relativeId)) - } else - return require(relativeId); - }; - - injects.unshift("require", "exports", "module"); - - id = module.id; - if (typeof factory !== "function") { - // we can just provide a plain object - return module.exports = factory; - } - var returned = factory.apply(module.exports, injects.map(function (injection) { - switch (injection) { - // check for CommonJS injection variables - case "require": return req; - case "exports": return module.exports; - case "module": return module; - default: - // a module dependency - return req(injection); - } - })); - - if(returned) { - // since AMD encapsulates a function/callback, it can allow the factory to return the exports. - module.exports = returned; - } -}; - -// slighly modified version of -// https://github.com/ry/node/blob/1dad95a3a960c645ffec28f9ec023dad6a17c0d4/src/node.js#L159 -// -// given a module name, and a list of paths to test, returns the first -// matching file in the following precedence. -// -// require("a.") -// -> a. -// -// require("a") -// -> a -// -> a. -// -> a/index. -function findModulePath(request) { - var fs = require('fs'), - exts = ["js"], - paths = ['.'].concat(require.paths) - - paths = request.charAt(0) === '/' ? [''] : paths; - - // check if the file exists and is not a directory - var tryFile = function(requestPath) { - try { - var stats = fs.statSync(requestPath); - if (stats && !stats.isDirectory()) { - return requestPath; - } - } catch (e) {} - return false; - }; - - // given a path check a the file exists with any of the set extensions - var tryExtensions = function(p, extension) { - for (var i = 0, EL = exts.length; i < EL; i++) { - f = tryFile(p + exts[i]); - if (f) { return f; } - } - return false; - }; - - // For each path - for (var i = 0, PL = paths.length; i < PL; i++) { - var p = paths[i], - // try to join the request to the path - f = tryFile(path.join(p, request)) || - // try it with each of the extensions - tryExtensions(path.join(p, request)) || - // try it with each of the extensions at "index" - tryExtensions(path.join(p, request, 'index')); - if (f) { return f; } - } - return false; -} \ No newline at end of file diff --git a/tool/tmtheme.js b/tool/tmtheme.js index 01ca1dc0..edb6f4eb 100644 --- a/tool/tmtheme.js +++ b/tool/tmtheme.js @@ -1,4 +1,4 @@ -var xml = require("../support/node-o3-xml-v4/lib/o3-xml"); +var xml = require("libxml"); var fs = require("fs"); function plistToJson(el) {