[Pkg-javascript-commits] [node-module-deps] 123/444: include indexDeps in rows in includeIndex mode
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:47:48 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-module-deps.
commit 18573d8066f1cea0c2f0a503ea76d0ce06e5c92b
Author: James Halliday <mail at substack.net>
Date: Mon Jul 8 19:29:11 2013 -0700
include indexDeps in rows in includeIndex mode
---
index.js | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/index.js b/index.js
index fe6e1f7..3191366 100644
--- a/index.js
+++ b/index.js
@@ -83,7 +83,7 @@ module.exports = function (mains, opts) {
var order = currentOrder ++;
if (typeof id === 'object') {
- return id.stream.pipe(concat(function (src) {
+ id.stream.pipe(concat(function (src) {
var pkgfile = path.join(basedir, 'package.json');
fs.readFile(pkgfile, function (err, pkgsrc) {
var pkg = {};
@@ -95,6 +95,7 @@ module.exports = function (mains, opts) {
applyTransforms(id.file, trx, src, pkg, order);
});
}));
+ return order;
}
var c = cache && cache[parent.id];
@@ -135,6 +136,8 @@ module.exports = function (mains, opts) {
applyTransforms(file, trx, src, pkg, order);
});
});
+
+ return order;
}
function getTransform (pkg) {
@@ -200,6 +203,7 @@ module.exports = function (mains, opts) {
var p = deps.length;
var current = { id: file, filename: file, paths: [], package: pkg };
var resolved = {};
+ var indexes = {};
deps.forEach(function (id) {
if (opts.filter && !opts.filter(id)) {
@@ -208,7 +212,7 @@ module.exports = function (mains, opts) {
return;
}
- walk(id, current, function (r) {
+ indexes[id] = walk(id, current, function (r) {
resolved[id] = r;
if (--p === 0) done();
});
@@ -221,6 +225,16 @@ module.exports = function (mains, opts) {
source: src,
deps: resolved
};
+ if (opts.includeIndex) {
+ rec.indexDeps = {};
+ var offset = 0;
+ deps.forEach(function (id) {
+ if (resolved[id]) {
+ rec.indexDeps[id] = indexes[id] - offset;
+ }
+ else offset ++;
+ });
+ }
if (entries.indexOf(file) >= 0) {
rec.entry = true;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-module-deps.git
More information about the Pkg-javascript-commits
mailing list