function hideBazelFiles(pkg) {
        const hasHideBazelFiles = isDirectory('node_modules/@bazel/hide-bazel-files');
        pkg._files = pkg._files.map(file => {
            const basename = path.basename(file);
            const basenameUc = basename.toUpperCase();
            if (basenameUc === 'BUILD' || basenameUc === 'BUILD.BAZEL') {
                // If bazel files are detected and there is no @bazel/hide-bazel-files npm
                // package then error out and suggest adding the package. It is possible to
                // have bazel BUILD files with the package installed as it's postinstall
                // step, which hides bazel BUILD files, only runs when the @bazel/hide-bazel-files
                // is installed and not when new packages are added (via `yarn add`
                // for example) after the initial install. In this case, however, the repo rule
                // will re-run as the package.json && lock file has changed so we just
                // hide the added BUILD files during the repo rule run here since @bazel/hide-bazel-files
                // was not run.
                if (!hasHideBazelFiles && ERROR_ON_BAZEL_FILES) {
                    console.error(`npm package '${pkg._dir}' from @${WORKSPACE} ${RULE_TYPE} rule
has a Bazel BUILD file '${file}'. Use the @bazel/hide-bazel-files utility to hide these files.
See https://github.com/bazelbuild/rules_nodejs/blob/master/packages/hide-bazel-files/README.md
for installation instructions.`);
                    process.exit(1);
                }
                else {
                    // All Bazel files in the npm distribution should be renamed by
                    // adding a `_` prefix so that file targets don't cross package boundaries.
                    const newFile = path.posix.join(path.dirname(file), `_${basename}`);
                    const srcPath = path.posix.join('node_modules', pkg._dir, file);
                    const dstPath = path.posix.join('node_modules', pkg._dir, newFile);
                    fs.renameSync(srcPath, dstPath);
                    return newFile;
                }
            }
            return file;
        });
    }
/**
     * Handles Bazel files in npm distributions.
     */
Handles Bazel files in npm distributions.
Handles Bazel files in npm distributions .
function hideBazelFiles(pkg) {
        const hasHideBazelFiles = isDirectory('node_modules/@bazel/hide-bazel-files');
        pkg._files = pkg._files.map(file => {
            const basename = path.basename(file);
            const basenameUc = basename.toUpperCase();
            if (basenameUc === 'BUILD' || basenameUc === 'BUILD.BAZEL') {
                if (!hasHideBazelFiles && ERROR_ON_BAZEL_FILES) {
                    console.error(`npm package '${pkg._dir}' from @${WORKSPACE} ${RULE_TYPE} rule
has a Bazel BUILD file '${file}'. Use the @bazel/hide-bazel-files utility to hide these files.
See https://github.com/bazelbuild/rules_nodejs/blob/master/packages/hide-bazel-files/README.md
for installation instructions.`);
                    process.exit(1);
                }
                else {
                    const newFile = path.posix.join(path.dirname(file), `_${basename}`);
                    const srcPath = path.posix.join('node_modules', pkg._dir, file);
                    const dstPath = path.posix.join('node_modules', pkg._dir, newFile);
                    fs.renameSync(srcPath, dstPath);
                    return newFile;
                }
            }
            return file;
        });
    }
function hideBazelFiles ( pkg ) { const hasHideBazelFiles = isDirectory ( 'node_modules/@bazel/hide-bazel-files' ) ; pkg . _files = pkg . _files . map ( file => { const basename = path . basename ( file ) ; const basenameUc = basename . toUpperCase ( ) ; if ( basenameUc === 'BUILD' || basenameUc === 'BUILD.BAZEL' ) { if ( ! hasHideBazelFiles && ERROR_ON_BAZEL_FILES ) { console . error ( ` ${ pkg . _dir } ${ WORKSPACE } ${ RULE_TYPE } ${ file } ` ) ; process . exit ( 1 ) ; } else { const newFile = path . posix . join ( path . dirname ( file ) , ` ${ basename } ` ) ; const srcPath = path . posix . join ( 'node_modules' , pkg . _dir , file ) ; const dstPath = path . posix . join ( 'node_modules' , pkg . _dir , newFile ) ; fs . renameSync ( srcPath , dstPath ) ; return newFile ; } } return file ; } ) ; }
Handles Bazel files in npm distributions.
Handles Bazel files in npm distributions .
// If bazel files are detected and there is no @bazel/hide-bazel-files npm // package then error out and suggest adding the package. It is possible to // have bazel BUILD files with the package installed as it's postinstall // step, which hides bazel BUILD files, only runs when the @bazel/hide-bazel-files // is installed and not when new packages are added (via `yarn add` // for example) after the initial install. In this case, however, the repo rule // will re-run as the package.json && lock file has changed so we just // hide the added BUILD files during the repo rule run here since @bazel/hide-bazel-files // was not run. // All Bazel files in the npm distribution should be renamed by // adding a `_` prefix so that file targets don't cross package boundaries.