1
0
Fork 0

Merge branch 'feature/npm-modules' into devel

This commit is contained in:
Frank Celler 2013-02-27 14:40:22 +01:00
commit 1834f288ca
7 changed files with 20 additions and 7 deletions

View File

@ -647,7 +647,7 @@ function stop_color_print () {
else { else {
return null; return null;
} }
} }
// first check: we are talking about module within a package // first check: we are talking about module within a package
description = internal.loadPackageFile(path, this._package); description = internal.loadPackageFile(path, this._package);
@ -661,6 +661,18 @@ function stop_color_print () {
} }
} }
// check if already know a module with that name
module = GlobalPackage.module(path);
if (module) {
if (module.type !== 'package') {
return module;
}
else {
return null;
}
}
// second check: we are talking about a global module // second check: we are talking about a global module
description = internal.loadModuleFile(path); description = internal.loadModuleFile(path);
@ -668,7 +680,7 @@ function stop_color_print () {
module = this.createModule(description, 'module', GlobalPackage); module = this.createModule(description, 'module', GlobalPackage);
if (module !== null) { if (module !== null) {
this._package.defineModule(path, module); GlobalPackage.defineModule(path, module);
return module; return module;
} }
} }

View File

@ -1,5 +1,5 @@
{ {
"name": "B", "name": "TestB",
"description": "B", "description": "B",
"main": "index", "main": "index",
"version": "2.0.0" "version": "2.0.0"

View File

@ -1,5 +1,5 @@
{ {
"name": "C", "name": "TestC",
"description": "C", "description": "C",
"main": "index", "main": "index",
"version": "1.0.0" "version": "1.0.0"

View File

@ -1,5 +1,5 @@
{ {
"name": "A", "name": "TestA",
"description": "A", "description": "A",
"main": "index", "main": "index",
"version": "1.0.0" "version": "1.0.0"

View File

@ -1,5 +1,5 @@
{ {
"name": "B", "name": "TestB",
"description": "B", "description": "B",
"main": "index", "main": "index",
"version": "1.0.0" "version": "1.0.0"

View File

@ -1 +1,2 @@
exports.version = "D 1.0.0"; exports.version = "D 1.0.0";
exports.fs = require("fs");

View File

@ -1,5 +1,5 @@
{ {
"name": "D", "name": "TestD",
"description": "D", "description": "D",
"main": "index", "main": "index",
"version": "1.0.0" "version": "1.0.0"