From f5eed08215a5a04324a6f6d3e2495b0186ca5db6 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Fri, 14 Jan 2022 08:06:39 -0800 Subject: [PATCH] fix: create a bazel-out node_modules tree using copy_file in the external repo when exports_directories_only is True (#3241) --- docs/Built-ins.md | 8 +- examples/BUILD.bazel | 5 + internal/npm_install/generate_build_file.ts | 112 ++--- internal/npm_install/index.js | 106 ++-- internal/npm_install/npm_install.bzl | 32 +- .../@angular/core/BUILD.bazel.golden | 35 +- .../@gregmagolan/test-a/BUILD.bazel.golden | 29 +- .../test-a/bin/BUILD.bazel.golden | 2 +- .../@gregmagolan/test-a/index.bzl.golden | 4 +- .../@gregmagolan/test-b/BUILD.bazel.golden | 29 +- .../BUILD.bazel.golden | 469 ++++++++++++++---- .../ajv/BUILD.bazel.golden | 37 +- .../jasmine/BUILD.bazel.golden | 51 +- .../jasmine/bin/BUILD.bazel.golden | 2 +- .../jasmine/index.bzl.golden | 4 +- .../rxjs/BUILD.bazel.golden | 31 +- .../unidiff/BUILD.bazel.golden | 31 +- .../zone.js/BUILD.bazel.golden | 29 +- .../@angular/core/BUILD.bazel.golden | 35 +- .../@gregmagolan/test-a/BUILD.bazel.golden | 29 +- .../test-a/bin/BUILD.bazel.golden | 2 +- .../@gregmagolan/test-a/index.bzl.golden | 4 +- .../@gregmagolan/test-b/BUILD.bazel.golden | 29 +- .../golden_multi_linked/BUILD.bazel.golden | 469 ++++++++++++++---- .../ajv/BUILD.bazel.golden | 37 +- .../jasmine/BUILD.bazel.golden | 51 +- .../jasmine/bin/BUILD.bazel.golden | 2 +- .../jasmine/index.bzl.golden | 4 +- .../rxjs/BUILD.bazel.golden | 31 +- .../unidiff/BUILD.bazel.golden | 31 +- .../zone.js/BUILD.bazel.golden | 29 +- 31 files changed, 926 insertions(+), 843 deletions(-) diff --git a/docs/Built-ins.md b/docs/Built-ins.md index 8cb5846fca..843903689c 100755 --- a/docs/Built-ins.md +++ b/docs/Built-ins.md @@ -591,7 +591,7 @@ label and the value corresponds to the path within that directory to the entry p nodejs_binary( name = "prettier", data = ["@npm//prettier"], - entry_point = { "@npm//prettier:directory": "bin-prettier.js" }, + entry_point = { "@npm//:node_modules/prettier": "bin-prettier.js" }, ) ``` @@ -599,7 +599,7 @@ For labels that are passed to `$(rootpath)`, `$(execpath)`, or `$(location)` you the directory label that gets passed to the expander & path part to follows it, e.g. ``` -$(rootpath @npm///prettier:directory)/bin-prettier.js +$(rootpath @npm///:node_modules/prettier)/bin-prettier.js ``` Defaults to `True` @@ -1256,7 +1256,7 @@ label and the value corresponds to the path within that directory to the entry p nodejs_binary( name = "prettier", data = ["@npm//prettier"], - entry_point = { "@npm//prettier:directory": "bin-prettier.js" }, + entry_point = { "@npm//:node_modules/prettier": "bin-prettier.js" }, ) ``` @@ -1264,7 +1264,7 @@ For labels that are passed to `$(rootpath)`, `$(execpath)`, or `$(location)` you the directory label that gets passed to the expander & path part to follows it, e.g. ``` -$(rootpath @npm///prettier:directory)/bin-prettier.js +$(rootpath @npm///:node_modules/prettier)/bin-prettier.js ``` Defaults to `True` diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel index 3174cd47b8..4c8930a76c 100644 --- a/examples/BUILD.bazel +++ b/examples/BUILD.bazel @@ -117,6 +117,11 @@ example_integration_test( "//packages/typescript:npm_package": "@bazel/typescript", }, owners = ["@mrmeku"], + tags = [ + # ERROR: C:/users/b/_bazel_b/sbb5tpjc/external/npm/BUILD.bazel:5053:10: Copying directory external/npm/_/node_modules/jest-snapshot failed: (Exit 4): cmd.exe failed: error executing command cmd.exe /C bazel-out\x64_windows-fastbuild\bin\external\npm\node_modules\jest-snapshot--603629912-cmd.bat + # Insufficient memory + "no-bazelci-windows", + ], ) example_integration_test( diff --git a/internal/npm_install/generate_build_file.ts b/internal/npm_install/generate_build_file.ts index ac95849438..5aeaf152bc 100644 --- a/internal/npm_install/generate_build_file.ts +++ b/internal/npm_install/generate_build_file.ts @@ -144,7 +144,7 @@ export async function main() { // find all packages (including packages in nested node_modules) const pkgs: Dep[] = []; - await findPackagesAndPush(pkgs, 'node_modules', deps); + await findPackagesAndPush(pkgs, nodeModulesFolder(), deps); // Sort the files to ensure the order pkgs.sort(compareDep); @@ -162,6 +162,12 @@ export async function main() { await writeFile('.bazelignore', `node_modules\n${config.workspace_rerooted_path}`); } +function nodeModulesFolder(): string { + return config.exports_directories_only ? + `${config.workspace_rerooted_package_json_dir}/node_modules` : + 'node_modules'; +} + /** * Generates all build files */ @@ -206,7 +212,7 @@ function flattenDependencies(pkgs: Dep[]) { async function generateRootBuildFile(pkgs: Dep[]) { let buildFile = config.exports_directories_only ? printRootExportsDirectories(pkgs) : - printRoot(pkgs); + printRootExportsAllFiles(pkgs); // Add the manual build file contents if they exists try { @@ -219,15 +225,27 @@ async function generateRootBuildFile(pkgs: Dep[]) { await writeFile('BUILD.bazel', buildFile); } + function printRootExportsDirectories(pkgs: Dep[]) { let filegroupsStarlark = ''; - pkgs.forEach(pkg => filegroupsStarlark += `filegroup( - name = "${pkg._dir.replace("/", "_")}__source_directory", - srcs = ["node_modules/${pkg._dir}"], - visibility = ["@${config.workspace}//:__subpackages__"], + pkgs.forEach(pkg => { + filegroupsStarlark += ` +copy_file( + name = "node_modules/${pkg._dir}", + src = "${config.workspace_rerooted_package_json_dir}/node_modules/${pkg._dir}", + is_directory = True, + out = "node_modules/${pkg._dir}", + visibility = ["//visibility:public"], ) - -`); +js_library( + name = "${pkg._dir.replace("/", "_")}__contents", + package_name = "${pkg._dir}", + package_path = "${config.package_path}", + strip_prefix = "node_modules/${pkg._dir}", + srcs = [":node_modules/${pkg._dir}"], + visibility = ["//:__subpackages__"], +) +`}); let depsStarlark = ''; if (pkgs.length) { @@ -240,7 +258,11 @@ if (pkgs.length) { const result = generateBuildFileHeader() + `load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") +# To support remote-execution, we must create a tree artifacts from the source directories. +# We make the output node_modules/pkg_dir so that we get a free node_modules +# tree in bazel-out and runfiles for this external repository. ${filegroupsStarlark} # The node_modules directory in one catch-all js_library @@ -251,7 +273,7 @@ js_library( return result } -function printRoot(pkgs: Dep[]) { +function printRootExportsAllFiles(pkgs: Dep[]) { let pkgFilesStarlark = ''; if (pkgs.length) { let list = ''; @@ -312,8 +334,10 @@ async function generatePackageBuildFiles(pkg: Dep) { if (pkg._files.includes('BUILD')) buildFilePath = 'BUILD'; if (pkg._files.includes('BUILD.bazel')) buildFilePath = 'BUILD.bazel'; + const nodeModules = nodeModulesFolder(); + // Recreate the pkg dir inside the node_modules folder - const nodeModulesPkgDir = `node_modules/${pkg._dir}`; + const nodeModulesPkgDir = `${nodeModules}/${pkg._dir}`; // Check if the current package dep dir is a symlink (which happens when we // install a node_module with link:) const isPkgDirASymlink = await fs.lstat(nodeModulesPkgDir) @@ -334,10 +358,10 @@ async function generatePackageBuildFiles(pkg: Dep) { // The following won't be used in a symlink build file case let buildFile = config.exports_directories_only ? printPackageExportsDirectories(pkg) : - printPackage(pkg); + printPackageLegacy(pkg); if (buildFilePath) { buildFile = buildFile + '\n' + - await fs.readFile(path.join('node_modules', pkg._dir, buildFilePath), 'utf-8'); + await fs.readFile(path.join(nodeModules, pkg._dir, buildFilePath), 'utf-8'); } else { buildFilePath = 'BUILD.bazel'; } @@ -377,7 +401,7 @@ async function generatePackageBuildFiles(pkg: Dep) { if (basenameUc === '_BUILD' || basenameUc === '_BUILD.BAZEL') { destFile = path.posix.join(path.dirname(destFile), basename.substr(1)); } - const src = path.posix.join('node_modules', pkg._dir, file); + const src = path.posix.join(nodeModules, pkg._dir, file); await prev; await mkdirp(path.dirname(destFile)); await fs.copyFile(src, destFile); @@ -452,6 +476,7 @@ load("@build_bazel_rules_nodejs//internal/copy_repository:copy_repository.bzl", // Copy all files for this workspace to a folder under _workspaces // to restore the Bazel files which have be renamed from the npm package const workspaceSourcePath = path.posix.join('_workspaces', workspace); + const nodeModules = nodeModulesFolder(); await mkdirp(workspaceSourcePath); await Promise.all(pkg._files.map(async (file) => { if (/^node_modules[/\\]/.test(file)) { @@ -471,7 +496,7 @@ load("@build_bazel_rules_nodejs//internal/copy_repository:copy_repository.bzl", if (basenameUc === '_BUILD' || basenameUc === '_BUILD.BAZEL') { destFile = path.posix.join(path.dirname(destFile), basename.substr(1)); } - const src = path.posix.join('node_modules', pkg._dir, file); + const src = path.posix.join(nodeModules, pkg._dir, file); const dest = path.posix.join(workspaceSourcePath, destFile); await mkdirp(path.dirname(dest)); await fs.copyFile(src, dest); @@ -517,7 +542,7 @@ async function generateScopeBuildFiles(scope: string, pkgs: Dep[]) { let buildFile = config.exports_directories_only ? printScopeExportsDirectories(scope, deps) : - printScope(scope, deps); + printScopeLegacy(scope, deps); await writeFile(path.posix.join(scope, 'BUILD.bazel'), buildFile); } @@ -676,7 +701,7 @@ async function findPackagesAndPush(pkgs: Dep[], p: string, dependencies: Set = new Se const pkg = (await isFile(packageJson)) ? JSON.parse(stripBom(await fs.readFile(packageJson, {encoding: 'utf8'}))) : {version: '0.0.0'}; - + // Trim the leading node_modules from the path and // assign to _dir for future use - pkg._dir = p.substring('node_modules/'.length); + pkg._dir = p.substring(nodeModulesFolder().length + 1); // Stash the package directory name for future use pkg._name = pkg._dir.split('/').pop(); @@ -1049,22 +1074,13 @@ function printPackageExportsDirectories(pkg: Dep) { // Flattened list of direct and transitive dependencies hoisted to root by the package manager const deps = [pkg].concat(pkg._dependencies.filter(dep => dep !== pkg && !dep._isNested)); const depsStarlark = - deps.map(dep => `"//${dep._dir}:${dep._name}__contents",`).join('\n '); + deps.map(dep => `"//:${dep._dir.replace("/", "_")}__contents",`).join('\n '); return `load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") # Generated targets for npm package "${pkg._dir}" ${printJson(pkg)} -# To support remote-execution, we must create a tree artifact from the source directory -copy_file( - name = "directory", - src = "@${config.workspace}//:${pkg._dir.replace("/", "_")}__source_directory", - is_directory = True, - out = "tree", -) - # The primary target for this package for use in rule deps js_library( name = "${pkg._name}", @@ -1072,41 +1088,13 @@ js_library( ${depsStarlark} ], ) - -# Target is used as dep for main targets to prevent circular dependencies errors -js_library( - name = "contents", - package_name = "${pkg._dir}", - package_path = "${config.package_path}", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) - -# For ts_library backward compat which uses @npm//typescript:__files -alias( - name = "${pkg._name}__files", - actual = "directory", -) - -# For ts_library backward compat which uses @npm//typescript:__files -alias( - name = "${pkg._name}__contents", - actual = "contents", -) - -# For ts_library backward compat which uses @npm//typescript:typescript__typings -alias( - name = "${pkg._name}__typings", - actual = "contents", -) `; } /** * Given a pkg, return the skylark `js_library` targets for the package. */ -function printPackage(pkg: Dep) { +function printPackageLegacy(pkg: Dep) { function starlarkFiles(attr: string, files: string[], comment: string = '') { return ` ${comment ? comment + '\n ' : ''}${attr} = [ @@ -1316,7 +1304,7 @@ export function printPackageBin(pkg: Dep) { for (const [name, path] of executables.entries()) { const entryPoint = config.exports_directories_only ? - `{ "@${config.workspace}//${pkg._dir}:directory": "${path}" }` : + `{ "@${config.workspace}//:node_modules/${pkg._dir}": "${path}" }` : `"@${config.workspace}//:node_modules/${pkg._dir}/${path}"`; result += `# Wire up the \`bin\` entry \`${name}\` nodejs_binary( @@ -1346,7 +1334,7 @@ export function printIndexBzl(pkg: Dep) { for (const [name, path] of executables.entries()) { const entryPoint = config.exports_directories_only ? - `{ "@${config.workspace}//${pkg._dir}:directory": "${path}" }` : + `{ "@${config.workspace}//:node_modules/${pkg._dir}": "${path}" }` : `"@${config.workspace}//:node_modules/${pkg._dir}/${path}"`; result = `${result} @@ -1391,7 +1379,7 @@ type Dep = { /** * Given a scope, return the skylark `js_library` target for the scope. */ -function printScope(scope: string, deps: Dep[]) { +function printScopeLegacy(scope: string, deps: Dep[]) { let pkgFilesStarlark = ''; if (deps.length) { const list = deps.map(dep => `"//${dep._dir}:${dep._name}__files",`).join('\n '); diff --git a/internal/npm_install/index.js b/internal/npm_install/index.js index 50c9a99724..8f2fddd611 100644 --- a/internal/npm_install/index.js +++ b/internal/npm_install/index.js @@ -73,7 +73,7 @@ async function main() { config.limited_visibility = `@${config.workspace}//:__subpackages__`; const deps = await getDirectDependencySet(config.package_json); const pkgs = []; - await findPackagesAndPush(pkgs, 'node_modules', deps); + await findPackagesAndPush(pkgs, nodeModulesFolder(), deps); pkgs.sort(compareDep); flattenDependencies(pkgs); await generateBazelWorkspaces(pkgs); @@ -81,6 +81,11 @@ async function main() { await writeFile('.bazelignore', `node_modules\n${config.workspace_rerooted_path}`); } exports.main = main; +function nodeModulesFolder() { + return config.exports_directories_only ? + `${config.workspace_rerooted_package_json_dir}/node_modules` : + 'node_modules'; +} async function generateBuildFiles(pkgs) { const notNestedPkgs = pkgs.filter(pkg => !pkg._isNested); await generateRootBuildFile(notNestedPkgs); @@ -111,7 +116,7 @@ function flattenDependencies(pkgs) { async function generateRootBuildFile(pkgs) { let buildFile = config.exports_directories_only ? printRootExportsDirectories(pkgs) : - printRoot(pkgs); + printRootExportsAllFiles(pkgs); try { const manualContents = await fs_1.promises.readFile(`manual_build_file_contents`, { encoding: 'utf8' }); buildFile += '\n\n'; @@ -123,13 +128,25 @@ async function generateRootBuildFile(pkgs) { } function printRootExportsDirectories(pkgs) { let filegroupsStarlark = ''; - pkgs.forEach(pkg => filegroupsStarlark += `filegroup( - name = "${pkg._dir.replace("/", "_")}__source_directory", - srcs = ["node_modules/${pkg._dir}"], - visibility = ["@${config.workspace}//:__subpackages__"], + pkgs.forEach(pkg => { + filegroupsStarlark += ` +copy_file( + name = "node_modules/${pkg._dir}", + src = "${config.workspace_rerooted_package_json_dir}/node_modules/${pkg._dir}", + is_directory = True, + out = "node_modules/${pkg._dir}", + visibility = ["//visibility:public"], ) - -`); +js_library( + name = "${pkg._dir.replace("/", "_")}__contents", + package_name = "${pkg._dir}", + package_path = "${config.package_path}", + strip_prefix = "node_modules/${pkg._dir}", + srcs = [":node_modules/${pkg._dir}"], + visibility = ["//:__subpackages__"], +) +`; + }); let depsStarlark = ''; if (pkgs.length) { const list = pkgs.map(pkg => `"//${pkg._dir}:${pkg._name}",`).join('\n '); @@ -139,7 +156,11 @@ function printRootExportsDirectories(pkgs) { ],`; } const result = generateBuildFileHeader() + `load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") +# To support remote-execution, we must create a tree artifacts from the source directories. +# We make the output node_modules/pkg_dir so that we get a free node_modules +# tree in bazel-out and runfiles for this external repository. ${filegroupsStarlark} # The node_modules directory in one catch-all js_library @@ -148,7 +169,7 @@ js_library( )`; return result; } -function printRoot(pkgs) { +function printRootExportsAllFiles(pkgs) { let pkgFilesStarlark = ''; if (pkgs.length) { let list = ''; @@ -200,7 +221,8 @@ async function generatePackageBuildFiles(pkg) { buildFilePath = 'BUILD'; if (pkg._files.includes('BUILD.bazel')) buildFilePath = 'BUILD.bazel'; - const nodeModulesPkgDir = `node_modules/${pkg._dir}`; + const nodeModules = nodeModulesFolder(); + const nodeModulesPkgDir = `${nodeModules}/${pkg._dir}`; const isPkgDirASymlink = await fs_1.promises.lstat(nodeModulesPkgDir) .then(stat => stat.isSymbolicLink()) .catch(constant(false)); @@ -210,10 +232,10 @@ async function generatePackageBuildFiles(pkg) { } let buildFile = config.exports_directories_only ? printPackageExportsDirectories(pkg) : - printPackage(pkg); + printPackageLegacy(pkg); if (buildFilePath) { buildFile = buildFile + '\n' + - await fs_1.promises.readFile(path.join('node_modules', pkg._dir, buildFilePath), 'utf-8'); + await fs_1.promises.readFile(path.join(nodeModules, pkg._dir, buildFilePath), 'utf-8'); } else { buildFilePath = 'BUILD.bazel'; @@ -238,7 +260,7 @@ async function generatePackageBuildFiles(pkg) { if (basenameUc === '_BUILD' || basenameUc === '_BUILD.BAZEL') { destFile = path.posix.join(path.dirname(destFile), basename.substr(1)); } - const src = path.posix.join('node_modules', pkg._dir, file); + const src = path.posix.join(nodeModules, pkg._dir, file); await prev; await mkdirp(path.dirname(destFile)); await fs_1.promises.copyFile(src, destFile); @@ -292,6 +314,7 @@ load("@build_bazel_rules_nodejs//internal/copy_repository:copy_repository.bzl", process.exit(1); } const workspaceSourcePath = path.posix.join('_workspaces', workspace); + const nodeModules = nodeModulesFolder(); await mkdirp(workspaceSourcePath); await Promise.all(pkg._files.map(async (file) => { if (/^node_modules[/\\]/.test(file)) { @@ -306,7 +329,7 @@ load("@build_bazel_rules_nodejs//internal/copy_repository:copy_repository.bzl", if (basenameUc === '_BUILD' || basenameUc === '_BUILD.BAZEL') { destFile = path.posix.join(path.dirname(destFile), basename.substr(1)); } - const src = path.posix.join('node_modules', pkg._dir, file); + const src = path.posix.join(nodeModules, pkg._dir, file); const dest = path.posix.join(workspaceSourcePath, destFile); await mkdirp(path.dirname(dest)); await fs_1.promises.copyFile(src, dest); @@ -335,7 +358,7 @@ async function generateScopeBuildFiles(scope, pkgs) { deps = [...pkgs, ...new Set(deps)]; let buildFile = config.exports_directories_only ? printScopeExportsDirectories(scope, deps) : - printScope(scope, deps); + printScopeLegacy(scope, deps); await writeFile(path.posix.join(scope, 'BUILD.bazel'), buildFile); } async function isFile(p) { @@ -431,7 +454,7 @@ async function findPackagesAndPush(pkgs, p, dependencies) { })); } async function findScopes() { - const p = 'node_modules'; + const p = nodeModulesFolder(); if (!await isDirectory(p)) { return []; } @@ -441,7 +464,7 @@ async function findScopes() { return; f = path.posix.join(p, f); if (await isDirectory(f)) { - return f.substring('node_modules/'.length); + return f.substring(p.length + 1); } }))) .filter((f) => typeof f === 'string'); @@ -452,7 +475,7 @@ async function parsePackage(p, dependencies = new Set()) { const pkg = (await isFile(packageJson)) ? JSON.parse(stripBom(await fs_1.promises.readFile(packageJson, { encoding: 'utf8' }))) : { version: '0.0.0' }; - pkg._dir = p.substring('node_modules/'.length); + pkg._dir = p.substring(nodeModulesFolder().length + 1); pkg._name = pkg._dir.split('/').pop(); pkg._moduleName = pkg.name || `${pkg._dir}/${pkg._name}`; pkg._isNested = /\/node_modules\//.test(pkg._dir); @@ -627,21 +650,12 @@ function findFile(pkg, m) { } function printPackageExportsDirectories(pkg) { const deps = [pkg].concat(pkg._dependencies.filter(dep => dep !== pkg && !dep._isNested)); - const depsStarlark = deps.map(dep => `"//${dep._dir}:${dep._name}__contents",`).join('\n '); + const depsStarlark = deps.map(dep => `"//:${dep._dir.replace("/", "_")}__contents",`).join('\n '); return `load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") # Generated targets for npm package "${pkg._dir}" ${printJson(pkg)} -# To support remote-execution, we must create a tree artifact from the source directory -copy_file( - name = "directory", - src = "@${config.workspace}//:${pkg._dir.replace("/", "_")}__source_directory", - is_directory = True, - out = "tree", -) - # The primary target for this package for use in rule deps js_library( name = "${pkg._name}", @@ -649,37 +663,9 @@ js_library( ${depsStarlark} ], ) - -# Target is used as dep for main targets to prevent circular dependencies errors -js_library( - name = "contents", - package_name = "${pkg._dir}", - package_path = "${config.package_path}", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) - -# For ts_library backward compat which uses @npm//typescript:__files -alias( - name = "${pkg._name}__files", - actual = "directory", -) - -# For ts_library backward compat which uses @npm//typescript:__files -alias( - name = "${pkg._name}__contents", - actual = "contents", -) - -# For ts_library backward compat which uses @npm//typescript:typescript__typings -alias( - name = "${pkg._name}__typings", - actual = "contents", -) `; } -function printPackage(pkg) { +function printPackageLegacy(pkg) { function starlarkFiles(attr, files, comment = '') { return ` ${comment ? comment + '\n ' : ''}${attr} = [ @@ -835,7 +821,7 @@ function printPackageBin(pkg) { } for (const [name, path] of executables.entries()) { const entryPoint = config.exports_directories_only ? - `{ "@${config.workspace}//${pkg._dir}:directory": "${path}" }` : + `{ "@${config.workspace}//:node_modules/${pkg._dir}": "${path}" }` : `"@${config.workspace}//:node_modules/${pkg._dir}/${path}"`; result += `# Wire up the \`bin\` entry \`${name}\` nodejs_binary( @@ -863,7 +849,7 @@ function printIndexBzl(pkg) { } for (const [name, path] of executables.entries()) { const entryPoint = config.exports_directories_only ? - `{ "@${config.workspace}//${pkg._dir}:directory": "${path}" }` : + `{ "@${config.workspace}//:node_modules/${pkg._dir}": "${path}" }` : `"@${config.workspace}//:node_modules/${pkg._dir}/${path}"`; result = `${result} @@ -892,7 +878,7 @@ def ${name.replace(/-/g, '_')}_test(**kwargs): return result; } exports.printIndexBzl = printIndexBzl; -function printScope(scope, deps) { +function printScopeLegacy(scope, deps) { let pkgFilesStarlark = ''; if (deps.length) { const list = deps.map(dep => `"//${dep._dir}:${dep._name}__files",`).join('\n '); diff --git a/internal/npm_install/npm_install.bzl b/internal/npm_install/npm_install.bzl index 4a9a827d2d..9bb2126d67 100644 --- a/internal/npm_install/npm_install.bzl +++ b/internal/npm_install/npm_install.bzl @@ -72,7 +72,7 @@ label and the value corresponds to the path within that directory to the entry p nodejs_binary( name = "prettier", data = ["@npm//prettier"], - entry_point = { "@npm//prettier:directory": "bin-prettier.js" }, + entry_point = { "@npm//:node_modules/prettier": "bin-prettier.js" }, ) ``` @@ -80,7 +80,7 @@ For labels that are passed to `$(rootpath)`, `$(execpath)`, or `$(location)` you the directory label that gets passed to the expander & path part to follows it, e.g. ``` -$(rootpath @npm///prettier:directory)/bin-prettier.js +$(rootpath @npm///:node_modules/prettier)/bin-prettier.js ``` """, ), @@ -448,10 +448,11 @@ def _create_build_files(repository_ctx, rule_type, node, lock_file, generate_loc fail("link target must be label of form '@wksp//path/to:target', '@//path/to:target' or '//path/to:target'") validated_links[k] = v + package_json_dir = paths.dirname(paths.normalize(paths.join(repository_ctx.attr.package_json.package, repository_ctx.attr.package_json.name))) package_path = repository_ctx.attr.package_path if not package_path: # By default the package_path is the directory of the package.json file - package_path = paths.dirname(paths.join(repository_ctx.attr.package_json.package, repository_ctx.attr.package_json.name)) + package_path = package_json_dir elif package_path == "/": # User specified root path package_path = "" @@ -469,6 +470,7 @@ def _create_build_files(repository_ctx, rule_type, node, lock_file, generate_loc strict_visibility = repository_ctx.attr.strict_visibility, workspace = repository_ctx.attr.name, workspace_rerooted_path = _WORKSPACE_REROOTED_PATH, + workspace_rerooted_package_json_dir = paths.normalize(paths.join(_WORKSPACE_REROOTED_PATH, package_json_dir)), ), ) repository_ctx.file("generate_config.json", generate_config_json) @@ -517,11 +519,7 @@ def _user_workspace_root(repository_ctx): # Returns the path to a file within the re-rooted user workspace # under _WORKSPACE_REROOTED_PATH in this repo rule's external workspace def _rerooted_workspace_path(repository_ctx, f): - segments = [_WORKSPACE_REROOTED_PATH] - if f.package: - segments.append(f.package) - segments.append(f.name) - return "/".join(segments) + return paths.normalize(paths.join(_WORKSPACE_REROOTED_PATH, f.package, f.name)) # Returns the path to the package.json directory within the re-rooted user workspace # under _WORKSPACE_REROOTED_PATH in this repo rule's external workspace @@ -630,12 +628,28 @@ def _add_node_repositories_info_deps(repository_ctx, yarn = None): def _symlink_node_modules(repository_ctx): package_json_dir = repository_ctx.path(repository_ctx.attr.package_json).dirname - if repository_ctx.attr.symlink_node_modules: + if repository_ctx.attr.exports_directories_only: + if repository_ctx.attr.symlink_node_modules: + # Create a directory symlink in the rerooted workspace path within the external + # repository, _WORKSPACE_REROOTED_PATH/package/json/dir/node_modules that points to the + # the newly created node_modules folder in the user's workspace (which is in the same + # directory as the package.json file there) + repository_ctx.symlink( + repository_ctx.path(str(package_json_dir) + "/node_modules"), + repository_ctx.path(_rerooted_workspace_package_json_dir(repository_ctx) + "/node_modules"), + ) + elif repository_ctx.attr.symlink_node_modules: + # Create a directory symlink at the root external repository that points to the the + # newly created node_modules folder in the user's workspace (which is in the same + # directory as the package.json file there) repository_ctx.symlink( repository_ctx.path(str(package_json_dir) + "/node_modules"), repository_ctx.path("node_modules"), ) else: + # Create a directory symlink at the root external repository that points to the the + # newly created node_modules folder in the rerooted workspace path within the external + # repository, _WORKSPACE_REROOTED_PATH/package/json/dir/node_modules. repository_ctx.symlink( repository_ctx.path(_rerooted_workspace_package_json_dir(repository_ctx) + "/node_modules"), repository_ctx.path("node_modules"), diff --git a/internal/npm_install/test/golden_directory_artifacts/@angular/core/BUILD.bazel.golden b/internal/npm_install/test/golden_directory_artifacts/@angular/core/BUILD.bazel.golden index bde8d13901..2e34282f75 100644 --- a/internal/npm_install/test/golden_directory_artifacts/@angular/core/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_directory_artifacts/@angular/core/BUILD.bazel.golden @@ -1,39 +1,12 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_directory_artifacts_goldens//:@angular_core__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "core", deps = [ - "//@angular/core:core__contents", - "//tslib:tslib__contents", - "//rxjs:rxjs__contents", - "//zone.js:zone.js__contents", + "//:@angular_core__contents", + "//:tslib__contents", + "//:rxjs__contents", + "//:zone.js__contents", ], ) -js_library( - name = "contents", - package_name = "@angular/core", - package_path = "", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "core__files", - actual = "directory", -) -alias( - name = "core__contents", - actual = "contents", -) -alias( - name = "core__typings", - actual = "contents", -) diff --git a/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-a/BUILD.bazel.golden b/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-a/BUILD.bazel.golden index 2ff4b10b1b..aeed84b0d7 100644 --- a/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-a/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-a/BUILD.bazel.golden @@ -1,37 +1,10 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_directory_artifacts_goldens//:@gregmagolan_test-a__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "test-a", deps = [ - "//@gregmagolan/test-a:test-a__contents", + "//:@gregmagolan_test-a__contents", ], ) -js_library( - name = "contents", - package_name = "@gregmagolan/test-a", - package_path = "", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "test-a__files", - actual = "directory", -) -alias( - name = "test-a__contents", - actual = "contents", -) -alias( - name = "test-a__typings", - actual = "contents", -) exports_files(["index.bzl"]) diff --git a/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-a/bin/BUILD.bazel.golden b/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-a/bin/BUILD.bazel.golden index 276f47f227..1de86e18ce 100644 --- a/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-a/bin/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-a/bin/BUILD.bazel.golden @@ -3,6 +3,6 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") nodejs_binary( name = "test", - entry_point = { "@fine_grained_directory_artifacts_goldens//@gregmagolan/test-a:directory": "@bin/test.js" }, + entry_point = { "@fine_grained_directory_artifacts_goldens//:node_modules/@gregmagolan/test-a": "@bin/test.js" }, data = ["//@gregmagolan/test-a:test-a"], ) diff --git a/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-a/index.bzl.golden b/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-a/index.bzl.golden index 8fbec357e1..43a37b2c2a 100644 --- a/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-a/index.bzl.golden +++ b/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-a/index.bzl.golden @@ -5,13 +5,13 @@ def test(**kwargs): npm_package_bin(tool = "@fine_grained_directory_artifacts_goldens//@gregmagolan/test-a/bin:test", output_dir = output_dir, **kwargs) else: nodejs_binary( - entry_point = { "@fine_grained_directory_artifacts_goldens//@gregmagolan/test-a:directory": "@bin/test.js" }, + entry_point = { "@fine_grained_directory_artifacts_goldens//:node_modules/@gregmagolan/test-a": "@bin/test.js" }, data = ["@fine_grained_directory_artifacts_goldens//@gregmagolan/test-a:test-a"] + kwargs.pop("data", []), **kwargs ) def test_test(**kwargs): nodejs_test( - entry_point = { "@fine_grained_directory_artifacts_goldens//@gregmagolan/test-a:directory": "@bin/test.js" }, + entry_point = { "@fine_grained_directory_artifacts_goldens//:node_modules/@gregmagolan/test-a": "@bin/test.js" }, data = ["@fine_grained_directory_artifacts_goldens//@gregmagolan/test-a:test-a"] + kwargs.pop("data", []), **kwargs ) diff --git a/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-b/BUILD.bazel.golden b/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-b/BUILD.bazel.golden index 41c4101e5b..db0c8a4754 100644 --- a/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-b/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_directory_artifacts/@gregmagolan/test-b/BUILD.bazel.golden @@ -1,36 +1,9 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_directory_artifacts_goldens//:@gregmagolan_test-b__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "test-b", deps = [ - "//@gregmagolan/test-b:test-b__contents", + "//:@gregmagolan_test-b__contents", ], ) -js_library( - name = "contents", - package_name = "@gregmagolan/test-b", - package_path = "", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "test-b__files", - actual = "directory", -) -alias( - name = "test-b__contents", - actual = "contents", -) -alias( - name = "test-b__typings", - actual = "contents", -) diff --git a/internal/npm_install/test/golden_directory_artifacts/BUILD.bazel.golden b/internal/npm_install/test/golden_directory_artifacts/BUILD.bazel.golden index a55598e5f2..1357473bd0 100644 --- a/internal/npm_install/test/golden_directory_artifacts/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_directory_artifacts/BUILD.bazel.golden @@ -1,135 +1,396 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -filegroup( - name = "@angular_core__source_directory", - srcs = ["node_modules/@angular/core"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") +copy_file( + name = "node_modules/@angular/core", + src = "_/tools/fine_grained_goldens/node_modules/@angular/core", + is_directory = True, + out = "node_modules/@angular/core", + visibility = ["//visibility:public"], ) -filegroup( - name = "@gregmagolan_test-a__source_directory", - srcs = ["node_modules/@gregmagolan/test-a"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +js_library( + name = "@angular_core__contents", + package_name = "@angular/core", + package_path = "", + strip_prefix = "node_modules/@angular/core", + srcs = [":node_modules/@angular/core"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "@gregmagolan_test-b__source_directory", - srcs = ["node_modules/@gregmagolan/test-b"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +copy_file( + name = "node_modules/@gregmagolan/test-a", + src = "_/tools/fine_grained_goldens/node_modules/@gregmagolan/test-a", + is_directory = True, + out = "node_modules/@gregmagolan/test-a", + visibility = ["//visibility:public"], ) -filegroup( - name = "ajv__source_directory", - srcs = ["node_modules/ajv"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +js_library( + name = "@gregmagolan_test-a__contents", + package_name = "@gregmagolan/test-a", + package_path = "", + strip_prefix = "node_modules/@gregmagolan/test-a", + srcs = [":node_modules/@gregmagolan/test-a"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "balanced-match__source_directory", - srcs = ["node_modules/balanced-match"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +copy_file( + name = "node_modules/@gregmagolan/test-b", + src = "_/tools/fine_grained_goldens/node_modules/@gregmagolan/test-b", + is_directory = True, + out = "node_modules/@gregmagolan/test-b", + visibility = ["//visibility:public"], ) -filegroup( - name = "brace-expansion__source_directory", - srcs = ["node_modules/brace-expansion"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +js_library( + name = "@gregmagolan_test-b__contents", + package_name = "@gregmagolan/test-b", + package_path = "", + strip_prefix = "node_modules/@gregmagolan/test-b", + srcs = [":node_modules/@gregmagolan/test-b"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "co__source_directory", - srcs = ["node_modules/co"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +copy_file( + name = "node_modules/ajv", + src = "_/tools/fine_grained_goldens/node_modules/ajv", + is_directory = True, + out = "node_modules/ajv", + visibility = ["//visibility:public"], ) -filegroup( - name = "concat-map__source_directory", - srcs = ["node_modules/concat-map"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +js_library( + name = "ajv__contents", + package_name = "ajv", + package_path = "", + strip_prefix = "node_modules/ajv", + srcs = [":node_modules/ajv"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "diff__source_directory", - srcs = ["node_modules/diff"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +copy_file( + name = "node_modules/balanced-match", + src = "_/tools/fine_grained_goldens/node_modules/balanced-match", + is_directory = True, + out = "node_modules/balanced-match", + visibility = ["//visibility:public"], ) -filegroup( - name = "fast-deep-equal__source_directory", - srcs = ["node_modules/fast-deep-equal"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +js_library( + name = "balanced-match__contents", + package_name = "balanced-match", + package_path = "", + strip_prefix = "node_modules/balanced-match", + srcs = [":node_modules/balanced-match"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "fast-json-stable-stringify__source_directory", - srcs = ["node_modules/fast-json-stable-stringify"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +copy_file( + name = "node_modules/brace-expansion", + src = "_/tools/fine_grained_goldens/node_modules/brace-expansion", + is_directory = True, + out = "node_modules/brace-expansion", + visibility = ["//visibility:public"], ) -filegroup( - name = "fs.realpath__source_directory", - srcs = ["node_modules/fs.realpath"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +js_library( + name = "brace-expansion__contents", + package_name = "brace-expansion", + package_path = "", + strip_prefix = "node_modules/brace-expansion", + srcs = [":node_modules/brace-expansion"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "glob__source_directory", - srcs = ["node_modules/glob"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +copy_file( + name = "node_modules/co", + src = "_/tools/fine_grained_goldens/node_modules/co", + is_directory = True, + out = "node_modules/co", + visibility = ["//visibility:public"], ) -filegroup( - name = "inflight__source_directory", - srcs = ["node_modules/inflight"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +js_library( + name = "co__contents", + package_name = "co", + package_path = "", + strip_prefix = "node_modules/co", + srcs = [":node_modules/co"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "inherits__source_directory", - srcs = ["node_modules/inherits"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +copy_file( + name = "node_modules/concat-map", + src = "_/tools/fine_grained_goldens/node_modules/concat-map", + is_directory = True, + out = "node_modules/concat-map", + visibility = ["//visibility:public"], ) -filegroup( - name = "jasmine__source_directory", - srcs = ["node_modules/jasmine"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +js_library( + name = "concat-map__contents", + package_name = "concat-map", + package_path = "", + strip_prefix = "node_modules/concat-map", + srcs = [":node_modules/concat-map"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "jasmine-core__source_directory", - srcs = ["node_modules/jasmine-core"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +copy_file( + name = "node_modules/diff", + src = "_/tools/fine_grained_goldens/node_modules/diff", + is_directory = True, + out = "node_modules/diff", + visibility = ["//visibility:public"], ) -filegroup( - name = "json-schema-traverse__source_directory", - srcs = ["node_modules/json-schema-traverse"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +js_library( + name = "diff__contents", + package_name = "diff", + package_path = "", + strip_prefix = "node_modules/diff", + srcs = [":node_modules/diff"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "minimatch__source_directory", - srcs = ["node_modules/minimatch"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +copy_file( + name = "node_modules/fast-deep-equal", + src = "_/tools/fine_grained_goldens/node_modules/fast-deep-equal", + is_directory = True, + out = "node_modules/fast-deep-equal", + visibility = ["//visibility:public"], ) -filegroup( - name = "once__source_directory", - srcs = ["node_modules/once"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +js_library( + name = "fast-deep-equal__contents", + package_name = "fast-deep-equal", + package_path = "", + strip_prefix = "node_modules/fast-deep-equal", + srcs = [":node_modules/fast-deep-equal"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "path-is-absolute__source_directory", - srcs = ["node_modules/path-is-absolute"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +copy_file( + name = "node_modules/fast-json-stable-stringify", + src = "_/tools/fine_grained_goldens/node_modules/fast-json-stable-stringify", + is_directory = True, + out = "node_modules/fast-json-stable-stringify", + visibility = ["//visibility:public"], ) -filegroup( - name = "rxjs__source_directory", - srcs = ["node_modules/rxjs"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +js_library( + name = "fast-json-stable-stringify__contents", + package_name = "fast-json-stable-stringify", + package_path = "", + strip_prefix = "node_modules/fast-json-stable-stringify", + srcs = [":node_modules/fast-json-stable-stringify"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "tslib__source_directory", - srcs = ["node_modules/tslib"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +copy_file( + name = "node_modules/fs.realpath", + src = "_/tools/fine_grained_goldens/node_modules/fs.realpath", + is_directory = True, + out = "node_modules/fs.realpath", + visibility = ["//visibility:public"], ) -filegroup( - name = "unidiff__source_directory", - srcs = ["node_modules/unidiff"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +js_library( + name = "fs.realpath__contents", + package_name = "fs.realpath", + package_path = "", + strip_prefix = "node_modules/fs.realpath", + srcs = [":node_modules/fs.realpath"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "wrappy__source_directory", - srcs = ["node_modules/wrappy"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +copy_file( + name = "node_modules/glob", + src = "_/tools/fine_grained_goldens/node_modules/glob", + is_directory = True, + out = "node_modules/glob", + visibility = ["//visibility:public"], ) -filegroup( - name = "zone.js__source_directory", - srcs = ["node_modules/zone.js"], - visibility = ["@fine_grained_directory_artifacts_goldens//:__subpackages__"], +js_library( + name = "glob__contents", + package_name = "glob", + package_path = "", + strip_prefix = "node_modules/glob", + srcs = [":node_modules/glob"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/inflight", + src = "_/tools/fine_grained_goldens/node_modules/inflight", + is_directory = True, + out = "node_modules/inflight", + visibility = ["//visibility:public"], +) +js_library( + name = "inflight__contents", + package_name = "inflight", + package_path = "", + strip_prefix = "node_modules/inflight", + srcs = [":node_modules/inflight"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/inherits", + src = "_/tools/fine_grained_goldens/node_modules/inherits", + is_directory = True, + out = "node_modules/inherits", + visibility = ["//visibility:public"], +) +js_library( + name = "inherits__contents", + package_name = "inherits", + package_path = "", + strip_prefix = "node_modules/inherits", + srcs = [":node_modules/inherits"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/jasmine", + src = "_/tools/fine_grained_goldens/node_modules/jasmine", + is_directory = True, + out = "node_modules/jasmine", + visibility = ["//visibility:public"], +) +js_library( + name = "jasmine__contents", + package_name = "jasmine", + package_path = "", + strip_prefix = "node_modules/jasmine", + srcs = [":node_modules/jasmine"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/jasmine-core", + src = "_/tools/fine_grained_goldens/node_modules/jasmine-core", + is_directory = True, + out = "node_modules/jasmine-core", + visibility = ["//visibility:public"], +) +js_library( + name = "jasmine-core__contents", + package_name = "jasmine-core", + package_path = "", + strip_prefix = "node_modules/jasmine-core", + srcs = [":node_modules/jasmine-core"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/json-schema-traverse", + src = "_/tools/fine_grained_goldens/node_modules/json-schema-traverse", + is_directory = True, + out = "node_modules/json-schema-traverse", + visibility = ["//visibility:public"], +) +js_library( + name = "json-schema-traverse__contents", + package_name = "json-schema-traverse", + package_path = "", + strip_prefix = "node_modules/json-schema-traverse", + srcs = [":node_modules/json-schema-traverse"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/minimatch", + src = "_/tools/fine_grained_goldens/node_modules/minimatch", + is_directory = True, + out = "node_modules/minimatch", + visibility = ["//visibility:public"], +) +js_library( + name = "minimatch__contents", + package_name = "minimatch", + package_path = "", + strip_prefix = "node_modules/minimatch", + srcs = [":node_modules/minimatch"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/once", + src = "_/tools/fine_grained_goldens/node_modules/once", + is_directory = True, + out = "node_modules/once", + visibility = ["//visibility:public"], +) +js_library( + name = "once__contents", + package_name = "once", + package_path = "", + strip_prefix = "node_modules/once", + srcs = [":node_modules/once"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/path-is-absolute", + src = "_/tools/fine_grained_goldens/node_modules/path-is-absolute", + is_directory = True, + out = "node_modules/path-is-absolute", + visibility = ["//visibility:public"], +) +js_library( + name = "path-is-absolute__contents", + package_name = "path-is-absolute", + package_path = "", + strip_prefix = "node_modules/path-is-absolute", + srcs = [":node_modules/path-is-absolute"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/rxjs", + src = "_/tools/fine_grained_goldens/node_modules/rxjs", + is_directory = True, + out = "node_modules/rxjs", + visibility = ["//visibility:public"], +) +js_library( + name = "rxjs__contents", + package_name = "rxjs", + package_path = "", + strip_prefix = "node_modules/rxjs", + srcs = [":node_modules/rxjs"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/tslib", + src = "_/tools/fine_grained_goldens/node_modules/tslib", + is_directory = True, + out = "node_modules/tslib", + visibility = ["//visibility:public"], +) +js_library( + name = "tslib__contents", + package_name = "tslib", + package_path = "", + strip_prefix = "node_modules/tslib", + srcs = [":node_modules/tslib"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/unidiff", + src = "_/tools/fine_grained_goldens/node_modules/unidiff", + is_directory = True, + out = "node_modules/unidiff", + visibility = ["//visibility:public"], +) +js_library( + name = "unidiff__contents", + package_name = "unidiff", + package_path = "", + strip_prefix = "node_modules/unidiff", + srcs = [":node_modules/unidiff"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/wrappy", + src = "_/tools/fine_grained_goldens/node_modules/wrappy", + is_directory = True, + out = "node_modules/wrappy", + visibility = ["//visibility:public"], +) +js_library( + name = "wrappy__contents", + package_name = "wrappy", + package_path = "", + strip_prefix = "node_modules/wrappy", + srcs = [":node_modules/wrappy"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/zone.js", + src = "_/tools/fine_grained_goldens/node_modules/zone.js", + is_directory = True, + out = "node_modules/zone.js", + visibility = ["//visibility:public"], +) +js_library( + name = "zone.js__contents", + package_name = "zone.js", + package_path = "", + strip_prefix = "node_modules/zone.js", + srcs = [":node_modules/zone.js"], + visibility = ["//:__subpackages__"], ) js_library( name = "node_modules", diff --git a/internal/npm_install/test/golden_directory_artifacts/ajv/BUILD.bazel.golden b/internal/npm_install/test/golden_directory_artifacts/ajv/BUILD.bazel.golden index 675bde484e..6f225b11a1 100644 --- a/internal/npm_install/test/golden_directory_artifacts/ajv/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_directory_artifacts/ajv/BUILD.bazel.golden @@ -1,40 +1,13 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_directory_artifacts_goldens//:ajv__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "ajv", deps = [ - "//ajv:ajv__contents", - "//co:co__contents", - "//fast-deep-equal:fast-deep-equal__contents", - "//fast-json-stable-stringify:fast-json-stable-stringify__contents", - "//json-schema-traverse:json-schema-traverse__contents", + "//:ajv__contents", + "//:co__contents", + "//:fast-deep-equal__contents", + "//:fast-json-stable-stringify__contents", + "//:json-schema-traverse__contents", ], ) -js_library( - name = "contents", - package_name = "ajv", - package_path = "", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "ajv__files", - actual = "directory", -) -alias( - name = "ajv__contents", - actual = "contents", -) -alias( - name = "ajv__typings", - actual = "contents", -) diff --git a/internal/npm_install/test/golden_directory_artifacts/jasmine/BUILD.bazel.golden b/internal/npm_install/test/golden_directory_artifacts/jasmine/BUILD.bazel.golden index 0b269c1fd5..a1dfd24dab 100644 --- a/internal/npm_install/test/golden_directory_artifacts/jasmine/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_directory_artifacts/jasmine/BUILD.bazel.golden @@ -1,48 +1,21 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_directory_artifacts_goldens//:jasmine__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "jasmine", deps = [ - "//jasmine:jasmine__contents", - "//glob:glob__contents", - "//fs.realpath:fs.realpath__contents", - "//inflight:inflight__contents", - "//once:once__contents", - "//wrappy:wrappy__contents", - "//inherits:inherits__contents", - "//minimatch:minimatch__contents", - "//brace-expansion:brace-expansion__contents", - "//balanced-match:balanced-match__contents", - "//concat-map:concat-map__contents", - "//path-is-absolute:path-is-absolute__contents", + "//:jasmine__contents", + "//:glob__contents", + "//:fs.realpath__contents", + "//:inflight__contents", + "//:once__contents", + "//:wrappy__contents", + "//:inherits__contents", + "//:minimatch__contents", + "//:brace-expansion__contents", + "//:balanced-match__contents", + "//:concat-map__contents", + "//:path-is-absolute__contents", ], ) -js_library( - name = "contents", - package_name = "jasmine", - package_path = "", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "jasmine__files", - actual = "directory", -) -alias( - name = "jasmine__contents", - actual = "contents", -) -alias( - name = "jasmine__typings", - actual = "contents", -) exports_files(["index.bzl"]) diff --git a/internal/npm_install/test/golden_directory_artifacts/jasmine/bin/BUILD.bazel.golden b/internal/npm_install/test/golden_directory_artifacts/jasmine/bin/BUILD.bazel.golden index 66b2eaf774..5838043f2e 100644 --- a/internal/npm_install/test/golden_directory_artifacts/jasmine/bin/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_directory_artifacts/jasmine/bin/BUILD.bazel.golden @@ -3,6 +3,6 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") nodejs_binary( name = "jasmine", - entry_point = { "@fine_grained_directory_artifacts_goldens//jasmine:directory": "bin/jasmine.js" }, + entry_point = { "@fine_grained_directory_artifacts_goldens//:node_modules/jasmine": "bin/jasmine.js" }, data = ["//jasmine:jasmine"], ) diff --git a/internal/npm_install/test/golden_directory_artifacts/jasmine/index.bzl.golden b/internal/npm_install/test/golden_directory_artifacts/jasmine/index.bzl.golden index 8be4d4fe52..06565b507d 100644 --- a/internal/npm_install/test/golden_directory_artifacts/jasmine/index.bzl.golden +++ b/internal/npm_install/test/golden_directory_artifacts/jasmine/index.bzl.golden @@ -5,13 +5,13 @@ def jasmine(**kwargs): npm_package_bin(tool = "@fine_grained_directory_artifacts_goldens//jasmine/bin:jasmine", output_dir = output_dir, **kwargs) else: nodejs_binary( - entry_point = { "@fine_grained_directory_artifacts_goldens//jasmine:directory": "bin/jasmine.js" }, + entry_point = { "@fine_grained_directory_artifacts_goldens//:node_modules/jasmine": "bin/jasmine.js" }, data = ["@fine_grained_directory_artifacts_goldens//jasmine:jasmine"] + kwargs.pop("data", []), **kwargs ) def jasmine_test(**kwargs): nodejs_test( - entry_point = { "@fine_grained_directory_artifacts_goldens//jasmine:directory": "bin/jasmine.js" }, + entry_point = { "@fine_grained_directory_artifacts_goldens//:node_modules/jasmine": "bin/jasmine.js" }, data = ["@fine_grained_directory_artifacts_goldens//jasmine:jasmine"] + kwargs.pop("data", []), **kwargs ) diff --git a/internal/npm_install/test/golden_directory_artifacts/rxjs/BUILD.bazel.golden b/internal/npm_install/test/golden_directory_artifacts/rxjs/BUILD.bazel.golden index 06908efdf6..599b33063d 100644 --- a/internal/npm_install/test/golden_directory_artifacts/rxjs/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_directory_artifacts/rxjs/BUILD.bazel.golden @@ -1,37 +1,10 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_directory_artifacts_goldens//:rxjs__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "rxjs", deps = [ - "//rxjs:rxjs__contents", - "//tslib:tslib__contents", + "//:rxjs__contents", + "//:tslib__contents", ], ) -js_library( - name = "contents", - package_name = "rxjs", - package_path = "", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "rxjs__files", - actual = "directory", -) -alias( - name = "rxjs__contents", - actual = "contents", -) -alias( - name = "rxjs__typings", - actual = "contents", -) diff --git a/internal/npm_install/test/golden_directory_artifacts/unidiff/BUILD.bazel.golden b/internal/npm_install/test/golden_directory_artifacts/unidiff/BUILD.bazel.golden index 11a64124b1..70f2ce7e7c 100644 --- a/internal/npm_install/test/golden_directory_artifacts/unidiff/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_directory_artifacts/unidiff/BUILD.bazel.golden @@ -1,37 +1,10 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_directory_artifacts_goldens//:unidiff__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "unidiff", deps = [ - "//unidiff:unidiff__contents", - "//diff:diff__contents", + "//:unidiff__contents", + "//:diff__contents", ], ) -js_library( - name = "contents", - package_name = "unidiff", - package_path = "", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "unidiff__files", - actual = "directory", -) -alias( - name = "unidiff__contents", - actual = "contents", -) -alias( - name = "unidiff__typings", - actual = "contents", -) diff --git a/internal/npm_install/test/golden_directory_artifacts/zone.js/BUILD.bazel.golden b/internal/npm_install/test/golden_directory_artifacts/zone.js/BUILD.bazel.golden index 7443e1ca4b..92fc7c4988 100644 --- a/internal/npm_install/test/golden_directory_artifacts/zone.js/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_directory_artifacts/zone.js/BUILD.bazel.golden @@ -1,36 +1,9 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_directory_artifacts_goldens//:zone.js__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "zone.js", deps = [ - "//zone.js:zone.js__contents", + "//:zone.js__contents", ], ) -js_library( - name = "contents", - package_name = "zone.js", - package_path = "", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "zone.js__files", - actual = "directory", -) -alias( - name = "zone.js__contents", - actual = "contents", -) -alias( - name = "zone.js__typings", - actual = "contents", -) diff --git a/internal/npm_install/test/golden_multi_linked/@angular/core/BUILD.bazel.golden b/internal/npm_install/test/golden_multi_linked/@angular/core/BUILD.bazel.golden index baa345a5ea..2e34282f75 100644 --- a/internal/npm_install/test/golden_multi_linked/@angular/core/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_multi_linked/@angular/core/BUILD.bazel.golden @@ -1,39 +1,12 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_goldens_multi_linked//:@angular_core__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "core", deps = [ - "//@angular/core:core__contents", - "//tslib:tslib__contents", - "//rxjs:rxjs__contents", - "//zone.js:zone.js__contents", + "//:@angular_core__contents", + "//:tslib__contents", + "//:rxjs__contents", + "//:zone.js__contents", ], ) -js_library( - name = "contents", - package_name = "@angular/core", - package_path = "tools/fine_grained_goldens", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "core__files", - actual = "directory", -) -alias( - name = "core__contents", - actual = "contents", -) -alias( - name = "core__typings", - actual = "contents", -) diff --git a/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-a/BUILD.bazel.golden b/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-a/BUILD.bazel.golden index 24b39e5cb0..aeed84b0d7 100644 --- a/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-a/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-a/BUILD.bazel.golden @@ -1,37 +1,10 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_goldens_multi_linked//:@gregmagolan_test-a__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "test-a", deps = [ - "//@gregmagolan/test-a:test-a__contents", + "//:@gregmagolan_test-a__contents", ], ) -js_library( - name = "contents", - package_name = "@gregmagolan/test-a", - package_path = "tools/fine_grained_goldens", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "test-a__files", - actual = "directory", -) -alias( - name = "test-a__contents", - actual = "contents", -) -alias( - name = "test-a__typings", - actual = "contents", -) exports_files(["index.bzl"]) diff --git a/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-a/bin/BUILD.bazel.golden b/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-a/bin/BUILD.bazel.golden index 288f7daa73..aa8aeb5669 100644 --- a/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-a/bin/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-a/bin/BUILD.bazel.golden @@ -3,6 +3,6 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") nodejs_binary( name = "test", - entry_point = { "@fine_grained_goldens_multi_linked//@gregmagolan/test-a:directory": "@bin/test.js" }, + entry_point = { "@fine_grained_goldens_multi_linked//:node_modules/@gregmagolan/test-a": "@bin/test.js" }, data = ["//@gregmagolan/test-a:test-a"], ) diff --git a/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-a/index.bzl.golden b/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-a/index.bzl.golden index d191e585cc..469287fb1b 100644 --- a/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-a/index.bzl.golden +++ b/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-a/index.bzl.golden @@ -5,13 +5,13 @@ def test(**kwargs): npm_package_bin(tool = "@fine_grained_goldens_multi_linked//@gregmagolan/test-a/bin:test", output_dir = output_dir, **kwargs) else: nodejs_binary( - entry_point = { "@fine_grained_goldens_multi_linked//@gregmagolan/test-a:directory": "@bin/test.js" }, + entry_point = { "@fine_grained_goldens_multi_linked//:node_modules/@gregmagolan/test-a": "@bin/test.js" }, data = ["@fine_grained_goldens_multi_linked//@gregmagolan/test-a:test-a"] + kwargs.pop("data", []), **kwargs ) def test_test(**kwargs): nodejs_test( - entry_point = { "@fine_grained_goldens_multi_linked//@gregmagolan/test-a:directory": "@bin/test.js" }, + entry_point = { "@fine_grained_goldens_multi_linked//:node_modules/@gregmagolan/test-a": "@bin/test.js" }, data = ["@fine_grained_goldens_multi_linked//@gregmagolan/test-a:test-a"] + kwargs.pop("data", []), **kwargs ) diff --git a/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-b/BUILD.bazel.golden b/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-b/BUILD.bazel.golden index 011763de3d..db0c8a4754 100644 --- a/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-b/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_multi_linked/@gregmagolan/test-b/BUILD.bazel.golden @@ -1,36 +1,9 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_goldens_multi_linked//:@gregmagolan_test-b__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "test-b", deps = [ - "//@gregmagolan/test-b:test-b__contents", + "//:@gregmagolan_test-b__contents", ], ) -js_library( - name = "contents", - package_name = "@gregmagolan/test-b", - package_path = "tools/fine_grained_goldens", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "test-b__files", - actual = "directory", -) -alias( - name = "test-b__contents", - actual = "contents", -) -alias( - name = "test-b__typings", - actual = "contents", -) diff --git a/internal/npm_install/test/golden_multi_linked/BUILD.bazel.golden b/internal/npm_install/test/golden_multi_linked/BUILD.bazel.golden index 5b1de04aa3..9a8a7341ce 100644 --- a/internal/npm_install/test/golden_multi_linked/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_multi_linked/BUILD.bazel.golden @@ -1,135 +1,396 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -filegroup( - name = "@angular_core__source_directory", - srcs = ["node_modules/@angular/core"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") +copy_file( + name = "node_modules/@angular/core", + src = "_/tools/fine_grained_goldens/node_modules/@angular/core", + is_directory = True, + out = "node_modules/@angular/core", + visibility = ["//visibility:public"], ) -filegroup( - name = "@gregmagolan_test-a__source_directory", - srcs = ["node_modules/@gregmagolan/test-a"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +js_library( + name = "@angular_core__contents", + package_name = "@angular/core", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/@angular/core", + srcs = [":node_modules/@angular/core"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "@gregmagolan_test-b__source_directory", - srcs = ["node_modules/@gregmagolan/test-b"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +copy_file( + name = "node_modules/@gregmagolan/test-a", + src = "_/tools/fine_grained_goldens/node_modules/@gregmagolan/test-a", + is_directory = True, + out = "node_modules/@gregmagolan/test-a", + visibility = ["//visibility:public"], ) -filegroup( - name = "ajv__source_directory", - srcs = ["node_modules/ajv"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +js_library( + name = "@gregmagolan_test-a__contents", + package_name = "@gregmagolan/test-a", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/@gregmagolan/test-a", + srcs = [":node_modules/@gregmagolan/test-a"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "balanced-match__source_directory", - srcs = ["node_modules/balanced-match"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +copy_file( + name = "node_modules/@gregmagolan/test-b", + src = "_/tools/fine_grained_goldens/node_modules/@gregmagolan/test-b", + is_directory = True, + out = "node_modules/@gregmagolan/test-b", + visibility = ["//visibility:public"], ) -filegroup( - name = "brace-expansion__source_directory", - srcs = ["node_modules/brace-expansion"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +js_library( + name = "@gregmagolan_test-b__contents", + package_name = "@gregmagolan/test-b", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/@gregmagolan/test-b", + srcs = [":node_modules/@gregmagolan/test-b"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "co__source_directory", - srcs = ["node_modules/co"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +copy_file( + name = "node_modules/ajv", + src = "_/tools/fine_grained_goldens/node_modules/ajv", + is_directory = True, + out = "node_modules/ajv", + visibility = ["//visibility:public"], ) -filegroup( - name = "concat-map__source_directory", - srcs = ["node_modules/concat-map"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +js_library( + name = "ajv__contents", + package_name = "ajv", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/ajv", + srcs = [":node_modules/ajv"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "diff__source_directory", - srcs = ["node_modules/diff"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +copy_file( + name = "node_modules/balanced-match", + src = "_/tools/fine_grained_goldens/node_modules/balanced-match", + is_directory = True, + out = "node_modules/balanced-match", + visibility = ["//visibility:public"], ) -filegroup( - name = "fast-deep-equal__source_directory", - srcs = ["node_modules/fast-deep-equal"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +js_library( + name = "balanced-match__contents", + package_name = "balanced-match", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/balanced-match", + srcs = [":node_modules/balanced-match"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "fast-json-stable-stringify__source_directory", - srcs = ["node_modules/fast-json-stable-stringify"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +copy_file( + name = "node_modules/brace-expansion", + src = "_/tools/fine_grained_goldens/node_modules/brace-expansion", + is_directory = True, + out = "node_modules/brace-expansion", + visibility = ["//visibility:public"], ) -filegroup( - name = "fs.realpath__source_directory", - srcs = ["node_modules/fs.realpath"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +js_library( + name = "brace-expansion__contents", + package_name = "brace-expansion", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/brace-expansion", + srcs = [":node_modules/brace-expansion"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "glob__source_directory", - srcs = ["node_modules/glob"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +copy_file( + name = "node_modules/co", + src = "_/tools/fine_grained_goldens/node_modules/co", + is_directory = True, + out = "node_modules/co", + visibility = ["//visibility:public"], ) -filegroup( - name = "inflight__source_directory", - srcs = ["node_modules/inflight"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +js_library( + name = "co__contents", + package_name = "co", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/co", + srcs = [":node_modules/co"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "inherits__source_directory", - srcs = ["node_modules/inherits"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +copy_file( + name = "node_modules/concat-map", + src = "_/tools/fine_grained_goldens/node_modules/concat-map", + is_directory = True, + out = "node_modules/concat-map", + visibility = ["//visibility:public"], ) -filegroup( - name = "jasmine__source_directory", - srcs = ["node_modules/jasmine"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +js_library( + name = "concat-map__contents", + package_name = "concat-map", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/concat-map", + srcs = [":node_modules/concat-map"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "jasmine-core__source_directory", - srcs = ["node_modules/jasmine-core"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +copy_file( + name = "node_modules/diff", + src = "_/tools/fine_grained_goldens/node_modules/diff", + is_directory = True, + out = "node_modules/diff", + visibility = ["//visibility:public"], ) -filegroup( - name = "json-schema-traverse__source_directory", - srcs = ["node_modules/json-schema-traverse"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +js_library( + name = "diff__contents", + package_name = "diff", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/diff", + srcs = [":node_modules/diff"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "minimatch__source_directory", - srcs = ["node_modules/minimatch"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +copy_file( + name = "node_modules/fast-deep-equal", + src = "_/tools/fine_grained_goldens/node_modules/fast-deep-equal", + is_directory = True, + out = "node_modules/fast-deep-equal", + visibility = ["//visibility:public"], ) -filegroup( - name = "once__source_directory", - srcs = ["node_modules/once"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +js_library( + name = "fast-deep-equal__contents", + package_name = "fast-deep-equal", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/fast-deep-equal", + srcs = [":node_modules/fast-deep-equal"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "path-is-absolute__source_directory", - srcs = ["node_modules/path-is-absolute"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +copy_file( + name = "node_modules/fast-json-stable-stringify", + src = "_/tools/fine_grained_goldens/node_modules/fast-json-stable-stringify", + is_directory = True, + out = "node_modules/fast-json-stable-stringify", + visibility = ["//visibility:public"], ) -filegroup( - name = "rxjs__source_directory", - srcs = ["node_modules/rxjs"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +js_library( + name = "fast-json-stable-stringify__contents", + package_name = "fast-json-stable-stringify", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/fast-json-stable-stringify", + srcs = [":node_modules/fast-json-stable-stringify"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "tslib__source_directory", - srcs = ["node_modules/tslib"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +copy_file( + name = "node_modules/fs.realpath", + src = "_/tools/fine_grained_goldens/node_modules/fs.realpath", + is_directory = True, + out = "node_modules/fs.realpath", + visibility = ["//visibility:public"], ) -filegroup( - name = "unidiff__source_directory", - srcs = ["node_modules/unidiff"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +js_library( + name = "fs.realpath__contents", + package_name = "fs.realpath", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/fs.realpath", + srcs = [":node_modules/fs.realpath"], + visibility = ["//:__subpackages__"], ) -filegroup( - name = "wrappy__source_directory", - srcs = ["node_modules/wrappy"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +copy_file( + name = "node_modules/glob", + src = "_/tools/fine_grained_goldens/node_modules/glob", + is_directory = True, + out = "node_modules/glob", + visibility = ["//visibility:public"], ) -filegroup( - name = "zone.js__source_directory", - srcs = ["node_modules/zone.js"], - visibility = ["@fine_grained_goldens_multi_linked//:__subpackages__"], +js_library( + name = "glob__contents", + package_name = "glob", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/glob", + srcs = [":node_modules/glob"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/inflight", + src = "_/tools/fine_grained_goldens/node_modules/inflight", + is_directory = True, + out = "node_modules/inflight", + visibility = ["//visibility:public"], +) +js_library( + name = "inflight__contents", + package_name = "inflight", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/inflight", + srcs = [":node_modules/inflight"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/inherits", + src = "_/tools/fine_grained_goldens/node_modules/inherits", + is_directory = True, + out = "node_modules/inherits", + visibility = ["//visibility:public"], +) +js_library( + name = "inherits__contents", + package_name = "inherits", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/inherits", + srcs = [":node_modules/inherits"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/jasmine", + src = "_/tools/fine_grained_goldens/node_modules/jasmine", + is_directory = True, + out = "node_modules/jasmine", + visibility = ["//visibility:public"], +) +js_library( + name = "jasmine__contents", + package_name = "jasmine", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/jasmine", + srcs = [":node_modules/jasmine"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/jasmine-core", + src = "_/tools/fine_grained_goldens/node_modules/jasmine-core", + is_directory = True, + out = "node_modules/jasmine-core", + visibility = ["//visibility:public"], +) +js_library( + name = "jasmine-core__contents", + package_name = "jasmine-core", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/jasmine-core", + srcs = [":node_modules/jasmine-core"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/json-schema-traverse", + src = "_/tools/fine_grained_goldens/node_modules/json-schema-traverse", + is_directory = True, + out = "node_modules/json-schema-traverse", + visibility = ["//visibility:public"], +) +js_library( + name = "json-schema-traverse__contents", + package_name = "json-schema-traverse", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/json-schema-traverse", + srcs = [":node_modules/json-schema-traverse"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/minimatch", + src = "_/tools/fine_grained_goldens/node_modules/minimatch", + is_directory = True, + out = "node_modules/minimatch", + visibility = ["//visibility:public"], +) +js_library( + name = "minimatch__contents", + package_name = "minimatch", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/minimatch", + srcs = [":node_modules/minimatch"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/once", + src = "_/tools/fine_grained_goldens/node_modules/once", + is_directory = True, + out = "node_modules/once", + visibility = ["//visibility:public"], +) +js_library( + name = "once__contents", + package_name = "once", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/once", + srcs = [":node_modules/once"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/path-is-absolute", + src = "_/tools/fine_grained_goldens/node_modules/path-is-absolute", + is_directory = True, + out = "node_modules/path-is-absolute", + visibility = ["//visibility:public"], +) +js_library( + name = "path-is-absolute__contents", + package_name = "path-is-absolute", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/path-is-absolute", + srcs = [":node_modules/path-is-absolute"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/rxjs", + src = "_/tools/fine_grained_goldens/node_modules/rxjs", + is_directory = True, + out = "node_modules/rxjs", + visibility = ["//visibility:public"], +) +js_library( + name = "rxjs__contents", + package_name = "rxjs", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/rxjs", + srcs = [":node_modules/rxjs"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/tslib", + src = "_/tools/fine_grained_goldens/node_modules/tslib", + is_directory = True, + out = "node_modules/tslib", + visibility = ["//visibility:public"], +) +js_library( + name = "tslib__contents", + package_name = "tslib", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/tslib", + srcs = [":node_modules/tslib"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/unidiff", + src = "_/tools/fine_grained_goldens/node_modules/unidiff", + is_directory = True, + out = "node_modules/unidiff", + visibility = ["//visibility:public"], +) +js_library( + name = "unidiff__contents", + package_name = "unidiff", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/unidiff", + srcs = [":node_modules/unidiff"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/wrappy", + src = "_/tools/fine_grained_goldens/node_modules/wrappy", + is_directory = True, + out = "node_modules/wrappy", + visibility = ["//visibility:public"], +) +js_library( + name = "wrappy__contents", + package_name = "wrappy", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/wrappy", + srcs = [":node_modules/wrappy"], + visibility = ["//:__subpackages__"], +) +copy_file( + name = "node_modules/zone.js", + src = "_/tools/fine_grained_goldens/node_modules/zone.js", + is_directory = True, + out = "node_modules/zone.js", + visibility = ["//visibility:public"], +) +js_library( + name = "zone.js__contents", + package_name = "zone.js", + package_path = "tools/fine_grained_goldens", + strip_prefix = "node_modules/zone.js", + srcs = [":node_modules/zone.js"], + visibility = ["//:__subpackages__"], ) js_library( name = "node_modules", diff --git a/internal/npm_install/test/golden_multi_linked/ajv/BUILD.bazel.golden b/internal/npm_install/test/golden_multi_linked/ajv/BUILD.bazel.golden index 5450942862..6f225b11a1 100644 --- a/internal/npm_install/test/golden_multi_linked/ajv/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_multi_linked/ajv/BUILD.bazel.golden @@ -1,40 +1,13 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_goldens_multi_linked//:ajv__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "ajv", deps = [ - "//ajv:ajv__contents", - "//co:co__contents", - "//fast-deep-equal:fast-deep-equal__contents", - "//fast-json-stable-stringify:fast-json-stable-stringify__contents", - "//json-schema-traverse:json-schema-traverse__contents", + "//:ajv__contents", + "//:co__contents", + "//:fast-deep-equal__contents", + "//:fast-json-stable-stringify__contents", + "//:json-schema-traverse__contents", ], ) -js_library( - name = "contents", - package_name = "ajv", - package_path = "tools/fine_grained_goldens", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "ajv__files", - actual = "directory", -) -alias( - name = "ajv__contents", - actual = "contents", -) -alias( - name = "ajv__typings", - actual = "contents", -) diff --git a/internal/npm_install/test/golden_multi_linked/jasmine/BUILD.bazel.golden b/internal/npm_install/test/golden_multi_linked/jasmine/BUILD.bazel.golden index 7b64b7414e..a1dfd24dab 100644 --- a/internal/npm_install/test/golden_multi_linked/jasmine/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_multi_linked/jasmine/BUILD.bazel.golden @@ -1,48 +1,21 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_goldens_multi_linked//:jasmine__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "jasmine", deps = [ - "//jasmine:jasmine__contents", - "//glob:glob__contents", - "//fs.realpath:fs.realpath__contents", - "//inflight:inflight__contents", - "//once:once__contents", - "//wrappy:wrappy__contents", - "//inherits:inherits__contents", - "//minimatch:minimatch__contents", - "//brace-expansion:brace-expansion__contents", - "//balanced-match:balanced-match__contents", - "//concat-map:concat-map__contents", - "//path-is-absolute:path-is-absolute__contents", + "//:jasmine__contents", + "//:glob__contents", + "//:fs.realpath__contents", + "//:inflight__contents", + "//:once__contents", + "//:wrappy__contents", + "//:inherits__contents", + "//:minimatch__contents", + "//:brace-expansion__contents", + "//:balanced-match__contents", + "//:concat-map__contents", + "//:path-is-absolute__contents", ], ) -js_library( - name = "contents", - package_name = "jasmine", - package_path = "tools/fine_grained_goldens", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "jasmine__files", - actual = "directory", -) -alias( - name = "jasmine__contents", - actual = "contents", -) -alias( - name = "jasmine__typings", - actual = "contents", -) exports_files(["index.bzl"]) diff --git a/internal/npm_install/test/golden_multi_linked/jasmine/bin/BUILD.bazel.golden b/internal/npm_install/test/golden_multi_linked/jasmine/bin/BUILD.bazel.golden index 25f40dbafb..4e638be2d8 100644 --- a/internal/npm_install/test/golden_multi_linked/jasmine/bin/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_multi_linked/jasmine/bin/BUILD.bazel.golden @@ -3,6 +3,6 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") nodejs_binary( name = "jasmine", - entry_point = { "@fine_grained_goldens_multi_linked//jasmine:directory": "bin/jasmine.js" }, + entry_point = { "@fine_grained_goldens_multi_linked//:node_modules/jasmine": "bin/jasmine.js" }, data = ["//jasmine:jasmine"], ) diff --git a/internal/npm_install/test/golden_multi_linked/jasmine/index.bzl.golden b/internal/npm_install/test/golden_multi_linked/jasmine/index.bzl.golden index 243ac59c64..2a20aeb341 100644 --- a/internal/npm_install/test/golden_multi_linked/jasmine/index.bzl.golden +++ b/internal/npm_install/test/golden_multi_linked/jasmine/index.bzl.golden @@ -5,13 +5,13 @@ def jasmine(**kwargs): npm_package_bin(tool = "@fine_grained_goldens_multi_linked//jasmine/bin:jasmine", output_dir = output_dir, **kwargs) else: nodejs_binary( - entry_point = { "@fine_grained_goldens_multi_linked//jasmine:directory": "bin/jasmine.js" }, + entry_point = { "@fine_grained_goldens_multi_linked//:node_modules/jasmine": "bin/jasmine.js" }, data = ["@fine_grained_goldens_multi_linked//jasmine:jasmine"] + kwargs.pop("data", []), **kwargs ) def jasmine_test(**kwargs): nodejs_test( - entry_point = { "@fine_grained_goldens_multi_linked//jasmine:directory": "bin/jasmine.js" }, + entry_point = { "@fine_grained_goldens_multi_linked//:node_modules/jasmine": "bin/jasmine.js" }, data = ["@fine_grained_goldens_multi_linked//jasmine:jasmine"] + kwargs.pop("data", []), **kwargs ) diff --git a/internal/npm_install/test/golden_multi_linked/rxjs/BUILD.bazel.golden b/internal/npm_install/test/golden_multi_linked/rxjs/BUILD.bazel.golden index a35e0c15c2..599b33063d 100644 --- a/internal/npm_install/test/golden_multi_linked/rxjs/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_multi_linked/rxjs/BUILD.bazel.golden @@ -1,37 +1,10 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_goldens_multi_linked//:rxjs__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "rxjs", deps = [ - "//rxjs:rxjs__contents", - "//tslib:tslib__contents", + "//:rxjs__contents", + "//:tslib__contents", ], ) -js_library( - name = "contents", - package_name = "rxjs", - package_path = "tools/fine_grained_goldens", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "rxjs__files", - actual = "directory", -) -alias( - name = "rxjs__contents", - actual = "contents", -) -alias( - name = "rxjs__typings", - actual = "contents", -) diff --git a/internal/npm_install/test/golden_multi_linked/unidiff/BUILD.bazel.golden b/internal/npm_install/test/golden_multi_linked/unidiff/BUILD.bazel.golden index 3af6a6cb7d..70f2ce7e7c 100644 --- a/internal/npm_install/test/golden_multi_linked/unidiff/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_multi_linked/unidiff/BUILD.bazel.golden @@ -1,37 +1,10 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_goldens_multi_linked//:unidiff__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "unidiff", deps = [ - "//unidiff:unidiff__contents", - "//diff:diff__contents", + "//:unidiff__contents", + "//:diff__contents", ], ) -js_library( - name = "contents", - package_name = "unidiff", - package_path = "tools/fine_grained_goldens", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "unidiff__files", - actual = "directory", -) -alias( - name = "unidiff__contents", - actual = "contents", -) -alias( - name = "unidiff__typings", - actual = "contents", -) diff --git a/internal/npm_install/test/golden_multi_linked/zone.js/BUILD.bazel.golden b/internal/npm_install/test/golden_multi_linked/zone.js/BUILD.bazel.golden index f14d2067ba..92fc7c4988 100644 --- a/internal/npm_install/test/golden_multi_linked/zone.js/BUILD.bazel.golden +++ b/internal/npm_install/test/golden_multi_linked/zone.js/BUILD.bazel.golden @@ -1,36 +1,9 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_nodejs//:index.bzl", "js_library") -load("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") -copy_file( - name = "directory", - src = "@fine_grained_goldens_multi_linked//:zone.js__source_directory", - is_directory = True, - out = "tree", -) js_library( name = "zone.js", deps = [ - "//zone.js:zone.js__contents", + "//:zone.js__contents", ], ) -js_library( - name = "contents", - package_name = "zone.js", - package_path = "tools/fine_grained_goldens", - strip_prefix = "tree", - srcs = [":directory"], - visibility = ["//:__subpackages__"], -) -alias( - name = "zone.js__files", - actual = "directory", -) -alias( - name = "zone.js__contents", - actual = "contents", -) -alias( - name = "zone.js__typings", - actual = "contents", -)