function printScope(scope, pkgs) {
        pkgs = pkgs.filter(pkg => !pkg._isNested && pkg._dir.startsWith(`${scope}/`));
        let deps = [];
        pkgs.forEach(pkg => {
            deps = deps.concat(pkg._dependencies.filter(dep => !dep._isNested && !pkgs.includes(pkg)));
        });
        // filter out duplicate deps
        deps = [...pkgs, ...new Set(deps)];
        let srcsStarlark = '';
        if (deps.length) {
            const list = deps.map(dep => `"//${dep._dir}:${dep._name}__files",`).join('\n        ');
            srcsStarlark = `
    # direct sources listed for strict deps support
    srcs = [
        ${list}
    ],`;
        }
        let depsStarlark = '';
        if (deps.length) {
            const list = deps.map(dep => `"//${dep._dir}:${dep._name}__contents",`).join('\n        ');
            depsStarlark = `
    # flattened list of direct and transitive dependencies hoisted to root by the package manager
    deps = [
        ${list}
    ],`;
        }
        return `load("@build_bazel_rules_nodejs//internal/npm_install:node_module_library.bzl", "node_module_library")

# Generated target for npm scope ${scope}
node_module_library(
    name = "${scope}",${srcsStarlark}${depsStarlark}
)

`;
    }
/**
     * Given a scope, return the skylark `node_module_library` target for the scope.
     */
Given a scope, return the skylark `node_module_library` target for the scope.
Given a scope return the skylark ` node_module_library ` target for the scope .
function printScope(scope, pkgs) {
        pkgs = pkgs.filter(pkg => !pkg._isNested && pkg._dir.startsWith(`${scope}/`));
        let deps = [];
        pkgs.forEach(pkg => {
            deps = deps.concat(pkg._dependencies.filter(dep => !dep._isNested && !pkgs.includes(pkg)));
        });
        deps = [...pkgs, ...new Set(deps)];
        let srcsStarlark = '';
        if (deps.length) {
            const list = deps.map(dep => `"//${dep._dir}:${dep._name}__files",`).join('\n        ');
            srcsStarlark = `
    # direct sources listed for strict deps support
    srcs = [
        ${list}
    ],`;
        }
        let depsStarlark = '';
        if (deps.length) {
            const list = deps.map(dep => `"//${dep._dir}:${dep._name}__contents",`).join('\n        ');
            depsStarlark = `
    # flattened list of direct and transitive dependencies hoisted to root by the package manager
    deps = [
        ${list}
    ],`;
        }
        return `load("@build_bazel_rules_nodejs//internal/npm_install:node_module_library.bzl", "node_module_library")
# Generated target for npm scope ${scope}
node_module_library(
    name = "${scope}",${srcsStarlark}${depsStarlark}
)
`;
    }
function printScope ( scope , pkgs ) { pkgs = pkgs . filter ( pkg => ! pkg . _isNested && pkg . _dir . startsWith ( ` ${ scope } ` ) ) ; let deps = [ ] ; pkgs . forEach ( pkg => { deps = deps . concat ( pkg . _dependencies . filter ( dep => ! dep . _isNested && ! pkgs . includes ( pkg ) ) ) ; } ) ; deps = [ ... pkgs , ... new Set ( deps ) ] ; let srcsStarlark = '' ; if ( deps . length ) { const list = deps . map ( dep => ` ${ dep . _dir } ${ dep . _name } ` ) . join ( '\n        ' ) ; srcsStarlark = ` ${ list } ` ; } let depsStarlark = '' ; if ( deps . length ) { const list = deps . map ( dep => ` ${ dep . _dir } ${ dep . _name } ` ) . join ( '\n        ' ) ; depsStarlark = ` ${ list } ` ; } return ` ${ scope } ${ scope } ${ srcsStarlark } ${ depsStarlark } ` ; }
Given a scope, return the skylark `node_module_library` target for the scope.
Given a scope return the skylark ` node_module_library ` target for the scope .
// filter out duplicate deps