Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function* getRootDependencies(manifest, options = Object.create(null)) {
const { maxDepth = 4, exclude } = options;
const { dependencies, customResolvers } = mergeDependencies(manifest, void 0);
const parent = new Dependency(manifest.name, manifest.version);
parent.hasCustomResolver = customResolvers.size > 0;
parent.hasDependencies = dependencies.size > 0;
const configRef = { exclude, maxDepth, parent };
const iterators = [
...iter.filter(customResolvers.entries(), ([, valueStr]) => valueStr.startsWith("git+"))
.map(([depName, valueStr]) => searchDeepDependencies(depName, valueStr.slice(4), configRef)),
...iter.map(dependencies.entries(), ([name, ver]) => searchDeepDependencies(`${name}@${ver}`, void 0, configRef))
];
for await (const dep of combineAsyncIterators(...iterators)) {
yield dep;
}
yield parent;
// Add root dependencies to the exclude Map (because the parent is not handled by searchDeepDependencies)
// if we skip this the code will fail to re-link properly dependencies in the following steps
const depsName = await Promise.all(iter.map(dependencies.entries(), getCleanDependencyName));
for (const [, fullRange] of depsName) {
if (exclude.has(fullRange)) {
exclude.get(fullRange).add(parent.fullName);
}
}
}
const configRef = { exclude, maxDepth, parent };
const iterators = [
...iter.filter(customResolvers.entries(), ([, valueStr]) => valueStr.startsWith("git+"))
.map(([depName, valueStr]) => searchDeepDependencies(depName, valueStr.slice(4), configRef)),
...iter.map(dependencies.entries(), ([name, ver]) => searchDeepDependencies(`${name}@${ver}`, void 0, configRef))
];
for await (const dep of combineAsyncIterators(...iterators)) {
yield dep;
}
yield parent;
// Add root dependencies to the exclude Map (because the parent is not handled by searchDeepDependencies)
// if we skip this the code will fail to re-link properly dependencies in the following steps
const depsName = await Promise.all(iter.map(dependencies.entries(), getCleanDependencyName));
for (const [, fullRange] of depsName) {
if (exclude.has(fullRange)) {
exclude.get(fullRange).add(parent.fullName);
}
}
}
async function* getRootDependencies(manifest, options = Object.create(null)) {
const { maxDepth = 4, exclude } = options;
const { dependencies, customResolvers } = mergeDependencies(manifest, void 0);
const parent = new Dependency(manifest.name, manifest.version);
parent.hasCustomResolver = customResolvers.size > 0;
parent.hasDependencies = dependencies.size > 0;
const configRef = { exclude, maxDepth, parent };
const iterators = [
...iter.filter(customResolvers.entries(), ([, valueStr]) => valueStr.startsWith("git+"))
.map(([depName, valueStr]) => searchDeepDependencies(depName, valueStr.slice(4), configRef)),
...iter.map(dependencies.entries(), ([name, ver]) => searchDeepDependencies(`${name}@${ver}`, void 0, configRef))
];
for await (const dep of combineAsyncIterators(...iterators)) {
yield dep;
}
yield parent;
// Add root dependencies to the exclude Map (because the parent is not handled by searchDeepDependencies)
// if we skip this the code will fail to re-link properly dependencies in the following steps
const depsName = await Promise.all(iter.map(dependencies.entries(), getCleanDependencyName));
for (const [, fullRange] of depsName) {
if (exclude.has(fullRange)) {
exclude.get(fullRange).add(parent.fullName);
}
}
const current = new Dependency(name, version, parent);
if (isGit) {
current.isGit(gitURL);
}
current.isDeprecated = deprecated === true;
current.hasCustomResolver = customResolvers.size > 0;
current.hasDependencies = dependencies.size > 0;
if (currDepth !== maxDepth) {
const config = {
exclude, currDepth: currDepth + 1, parent: current, maxDepth
};
const gitDependencies = iter.filter(customResolvers.entries(), ([, valueStr]) => valueStr.startsWith("git+"));
for (const [depName, valueStr] of gitDependencies) {
yield* searchDeepDependencies(depName, valueStr.slice(4), config);
}
const depsNames = await Promise.all(iter.map(dependencies.entries(), getCleanDependencyName));
for (const [fullName, cleanName] of depsNames) {
if (exclude.has(cleanName)) {
exclude.get(cleanName).add(current.fullName);
}
else {
exclude.set(cleanName, new Set());
yield* searchDeepDependencies(fullName, void 0, config);
}
}
}
}
current.isDeprecated = deprecated === true;
current.hasCustomResolver = customResolvers.size > 0;
current.hasDependencies = dependencies.size > 0;
if (currDepth !== maxDepth) {
const config = {
exclude, currDepth: currDepth + 1, parent: current, maxDepth
};
const gitDependencies = iter.filter(customResolvers.entries(), ([, valueStr]) => valueStr.startsWith("git+"));
for (const [depName, valueStr] of gitDependencies) {
yield* searchDeepDependencies(depName, valueStr.slice(4), config);
}
const depsNames = await Promise.all(iter.map(dependencies.entries(), getCleanDependencyName));
for (const [fullName, cleanName] of depsNames) {
if (exclude.has(cleanName)) {
exclude.get(cleanName).add(current.fullName);
}
else {
exclude.set(cleanName, new Set());
yield* searchDeepDependencies(fullName, void 0, config);
}
}
}
yield current;
}
sensorProps.forEach(prop => {
let isSettingsProp = contains(['timeDelay', 'debug', 'path', 'verbose', 'deepstreamServer', 'sensorType'], prop)
if (!isSettingsProp) {
log(chalk.cyan(`\t- ${prop}`))
}
})
});
function nextCycleItem(cycleIterator) {
return take(1, cycleIterator)[0]
}