Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for (let line of lines) console.error(line);
process.exit(1);
}
console.log("Biggest cycle: " + max_cycle_len + " (out of " + cycles + " cycles reported by Flow)");
if (max_cycle_len > MAX_CYCLE_LEN) {
console.error("Error: You increased cycle length from the previous high of " + MAX_CYCLE_LEN);
console.error("This is never OK.");
console.error("Run the following command to see the cycle: " + cmd);
process.exit(1);
}
});
// NB: This doesn't prevent cycles using "import type" because those are
// erased in the lib folder but madge doesn't work with flow type imports.
madge("./lib/").then(res => {
let deps = res.obj();
let idx_deps = res.depends("intrinsics/index");
if (idx_deps.length !== 1 || idx_deps[0] !== "construct_realm") {
console.error("Invalid Dependency: Intrinsics index depends on " + idx_deps[0]);
process.exit(1);
}
for (let dep in deps) {
// Nothing in intrinsics/ecma262 depends on anything but intrinsics/index except Error and global.
if (
dep.startsWith("intrinsics/ecma262") &&
dep !== "intrinsics/ecma262/Error" &&
dep !== "intrinsics/ecma262/global"
) {
let ext_deps = res
.depends(dep)
}
}
const madgeOptions = {
format,
exclude: config.ignore,
mainRequireModule: config.entry,
};
extend(madgeOptions, config);
if (isString(madgeOptions.extensions)) {
madgeOptions.extensions = madgeOptions.extensions.split(',');
}
try {
const madgeResult = madge(config.root, madgeOptions);
const tree = madgeResult.tree;
const circular = madgeResult.circular();
const names = keys(tree);
each(names, (name) => {
addNode(name);
});
forIn(tree, (deps, name) => {
each(deps, (dep) => {
dep = dep.replace(/\.\.\//g, '').replace(/\.\//g, '').replace('node_modules/', '');
addNode(dep);
edges.push({
source: dep,
target: name,
});
});