move deps into node_modules and make better use

of npm
This commit is contained in:
Fabian Jakobs 2011-11-02 13:15:04 +01:00
commit 2ecef49e39
9 changed files with 35 additions and 198 deletions

15
.gitignore vendored
View file

@ -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

18
.gitmodules vendored
View file

@ -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

View file

@ -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({

View file

@ -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"
}
};
</script>

View file

@ -38,4 +38,4 @@
require("../../../support/paths");
var test = require("asyncjs").test;
test.walkTestCases(__dirname + "/..").exec()
test.walkTestCases(__dirname + "/..").exec();

View file

@ -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/"

View file

@ -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);

View file

@ -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.<ext>")
// -> a.<ext>
//
// require("a")
// -> a
// -> a.<ext>
// -> a/index.<ext>
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;
}

View file

@ -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) {