mirror of https://gitee.com/bigwinds/arangodb
fixed package module loading and directory.lib entry
This commit is contained in:
parent
dfd20cd4e2
commit
7abef532f4
|
@ -384,10 +384,21 @@ function stop_color_print () {
|
|||
|
||||
if (internal.exists(mainfile)) {
|
||||
var content = internal.read(mainfile);
|
||||
var paths;
|
||||
|
||||
if (typeof desc.directories !== "undefined" && typeof desc.directories.lib !== "undefined") {
|
||||
var full = m + internal.normalizeModuleName("", desc.directories.lib);
|
||||
|
||||
paths = [ full ];
|
||||
}
|
||||
else {
|
||||
paths = [ m ];
|
||||
}
|
||||
|
||||
return { name: main,
|
||||
description: desc,
|
||||
packagePath: m,
|
||||
packageLib: paths,
|
||||
path: 'file://' + mainfile,
|
||||
content: content };
|
||||
}
|
||||
|
@ -570,7 +581,7 @@ function stop_color_print () {
|
|||
pkg = new Package(path,
|
||||
description.description,
|
||||
parent,
|
||||
[description.packagePath]);
|
||||
description.packageLib);
|
||||
|
||||
module = this.createModule(description, 'package', pkg);
|
||||
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
exports.version = "D 1.0.0";
|
||||
exports.fs = require("fs");
|
||||
exports.y = require("./y");
|
|
@ -0,0 +1 @@
|
|||
exports.y = "Y 1.0.0";
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"name": "TestD",
|
||||
"description": "D",
|
||||
"main": "index",
|
||||
"main": "./lib/index",
|
||||
"directories": {
|
||||
"lib": "lib"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue