chore: change all internal virtual store naming to package store (#1616)
diff --git a/BUILD.bazel b/BUILD.bazel index 42859da..7ae96ef 100644 --- a/BUILD.bazel +++ b/BUILD.bazel
@@ -9,7 +9,7 @@ load("//js:defs.bzl", "js_library") # Link all packages from the /WORKSPACE npm_translate_lock(name = "npm") and also packages from -# manual /WORKSPACE npm_import rules to bazel-bin/node_modules as well as the virtual store +# manual /WORKSPACE npm_import rules to bazel-bin/node_modules as well as the package store # bazel-bin/node_modules/.aspect_rules_js since /pnpm-lock.yaml is the root of the pnpm workspace npm_link_all_packages( name = "node_modules",
diff --git a/MODULE.bazel b/MODULE.bazel index 0c09ef0..9fdb617 100644 --- a/MODULE.bazel +++ b/MODULE.bazel
@@ -225,7 +225,7 @@ bins = {"acorn": "./bin/acorn"}, integrity = "sha512-ULr0LDaEqQrMFGyQ3bhJkLsbtrQ8QibAseGZeaSUiT/6zb9IvIkomWHJIvgvwad+hinRAgsI51JcWk2yvwyL+w==", package = "acorn", - # Root package where to link the virtual store + # Root package where to link the package store root_package = "", version = "8.4.0", )
diff --git a/WORKSPACE b/WORKSPACE index 31c5d54..d6bc729 100644 --- a/WORKSPACE +++ b/WORKSPACE
@@ -183,7 +183,7 @@ bins = {"acorn": "./bin/acorn"}, integrity = "sha512-ULr0LDaEqQrMFGyQ3bhJkLsbtrQ8QibAseGZeaSUiT/6zb9IvIkomWHJIvgvwad+hinRAgsI51JcWk2yvwyL+w==", package = "acorn", - # Root package where to link the virtual store + # Root package where to link the package store root_package = "", version = "8.4.0", )
diff --git a/docs/README.md b/docs/README.md index 28916e5..f704e9f 100644 --- a/docs/README.md +++ b/docs/README.md
@@ -52,7 +52,7 @@ ### Fetch third-party packages from npm rules_js accesses npm packages using [pnpm]. -pnpm's "virtual store" of packages aligns with Bazel's "external repositories", +pnpm's ["symlinked node_modules structure"](https://pnpm.io/symlinked-node-modules-structure) of packages aligns with Bazel's "external repositories", and the pnpm "linker" which creates the `node_modules` tree has semantics we can reproduce with Bazel actions. If your code works with pnpm, then you should expect it works under Bazel as well. @@ -132,9 +132,9 @@ You'll see something like this: ```bash -# the virtual store +# the package store bazel-bin/node_modules/.aspect_rules_js -# symlink into the virtual store +# symlink into the package store bazel-bin/node_modules/some_pkg # If you used pnpm workspaces: bazel-bin/packages/some_pkg/node_modules/some_dep
diff --git a/docs/js_run_devserver.md b/docs/js_run_devserver.md index 1d1e951..b403296 100644 --- a/docs/js_run_devserver.md +++ b/docs/js_run_devserver.md
@@ -77,8 +77,8 @@ The custom sandbox is populated with the default outputs of all targets in `data` as well as transitive sources & npm links. -As an optimization, virtual store files are explicitly excluded from the sandbox since the npm -links will point to the virtual store in the execroot and Node.js will follow those links as it +As an optimization, package store files are explicitly excluded from the sandbox since the npm +links will point to the package store in the execroot and Node.js will follow those links as it does within the execroot. As a result, rules_js npm package link targets such as `//:node_modules/next` are handled efficiently. Since these targets are symlinks in the output tree, they are recreated as symlinks in the custom sandbox and do not incur a full copy of the
diff --git a/docs/npm_import.md b/docs/npm_import.md index 7617c7e..2aa3d5e 100644 --- a/docs/npm_import.md +++ b/docs/npm_import.md
@@ -140,7 +140,7 @@ | <a id="npm_import-deps"></a>deps | A dict other npm packages this one depends on where the key is the package name and value is the version | <code>{}</code> | | <a id="npm_import-extra_build_content"></a>extra_build_content | Additional content to append on the generated BUILD file at the root of the created repository, either as a string or a list of lines similar to <https://github.com/bazelbuild/bazel-skylib/blob/main/docs/write_file_doc.md>. | <code>""</code> | | <a id="npm_import-transitive_closure"></a>transitive_closure | A dict all npm packages this one depends on directly or transitively where the key is the package name and value is a list of version(s) depended on in the closure. | <code>{}</code> | -| <a id="npm_import-root_package"></a>root_package | The root package where the node_modules virtual store is linked to. Typically this is the package that the pnpm-lock.yaml file is located when using <code>npm_translate_lock</code>. | <code>""</code> | +| <a id="npm_import-root_package"></a>root_package | The root package where the node_modules package store is linked to. Typically this is the package that the pnpm-lock.yaml file is located when using <code>npm_translate_lock</code>. | <code>""</code> | | <a id="npm_import-link_workspace"></a>link_workspace | The workspace name where links will be created for this package.<br><br>This is typically set in rule sets and libraries that are to be consumed as external repositories so links are created in the external repository and not the user workspace.<br><br>Can be left unspecified if the link workspace is the user workspace. | <code>""</code> | | <a id="npm_import-link_packages"></a>link_packages | Dict of paths where links may be created at for this package to a list of link aliases to link as in each package. If aliases are an empty list this indicates to link as the package name.<br><br>Defaults to {} which indicates that links may be created in any package as specified by the <code>direct</code> attribute of the generated npm_link_package. | <code>{}</code> | | <a id="npm_import-lifecycle_hooks"></a>lifecycle_hooks | List of lifecycle hook <code>package.json</code> scripts to run for this package if they exist. | <code>[]</code> |
diff --git a/docs/npm_link_package.md b/docs/npm_link_package.md index 3f331bc..c71ee23 100644 --- a/docs/npm_link_package.md +++ b/docs/npm_link_package.md
@@ -13,10 +13,10 @@ "Links an npm package to node_modules if link is True. -When called at the root_package, a virtual store target is generated named `link__{bazelified_name}__store`. +When called at the root_package, a package store target is generated named `link__{bazelified_name}__store`. When linking, a `{name}` target is generated which consists of the `node_modules/<package>` symlink and transitively -its virtual store link and the virtual store links of the transitive closure of deps. +its package store link and the package store links of the transitive closure of deps. When linking, `{name}/dir` filegroup is also generated that refers to a directory artifact can be used to access the package directory for creating entry points or accessing files in the package. @@ -27,8 +27,8 @@ | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| <a id="npm_link_package-name"></a>name | The name of the link target to create if <code>link</code> is True. For first-party deps linked across a workspace, the name must match in all packages being linked as it is used to derive the virtual store link target name. | none | -| <a id="npm_link_package-root_package"></a>root_package | the root package where the node_modules virtual store is linked to | <code>""</code> | +| <a id="npm_link_package-name"></a>name | The name of the link target to create if <code>link</code> is True. For first-party deps linked across a workspace, the name must match in all packages being linked as it is used to derive the package store link target name. | none | +| <a id="npm_link_package-root_package"></a>root_package | the root package where the node_modules package store is linked to | <code>""</code> | | <a id="npm_link_package-link"></a>link | whether or not to link in this package If false, only the npm_package_store target will be created _if_ this is called in the <code>root_package</code>. | <code>True</code> | | <a id="npm_link_package-src"></a>src | the npm_package target to link; may only to be specified when linking in the root package | <code>None</code> | | <a id="npm_link_package-deps"></a>deps | list of npm_package_store; may only to be specified when linking in the root package | <code>{}</code> |
diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 49955af..735efd0 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md
@@ -103,7 +103,7 @@ > a list of Bazel packages in which to hoist the package to the top-level of the node_modules tree To make plugins work, you should have the Bazel package containing the pnpm workspace root (the folder containing `pnpm-lock.yaml`) in this list. -This ensures that the tool in the pnpm virtual store `node_modules/.aspect_rules_js` will be able to locate the plugins. +This ensures that the tool in the package store (`node_modules/.aspect_rules_js`) will be able to locate the plugins. If your lockfile is in the root of the Bazel workspace, this value should be an empty string: `""`. If the lockfile is in `some/subpkg/pnpm-lock.yaml` then `"some/subpkg"` should appear in the list.
diff --git a/e2e/gyp_no_install_script/snapshots/bzlmod/segfault-handler_defs.bzl b/e2e/gyp_no_install_script/snapshots/bzlmod/segfault-handler_defs.bzl index d00c16a..3db1ae1 100644 --- a/e2e/gyp_no_install_script/snapshots/bzlmod/segfault-handler_defs.bzl +++ b/e2e/gyp_no_install_script/snapshots/bzlmod/segfault-handler_defs.bzl
@@ -153,7 +153,7 @@ tags = ["manual"], ) - # virtual store target with transitive closure of all npm package dependencies + # package store target with transitive closure of all npm package dependencies _npm_package_store( name = store_target_name, src = None if True else "@@aspect_rules_js~~npm~npm__segfault-handler__1.3.0//:pkg",
diff --git a/e2e/gyp_no_install_script/snapshots/wksp/segfault-handler_defs.bzl b/e2e/gyp_no_install_script/snapshots/wksp/segfault-handler_defs.bzl index b57e452..dea5328 100644 --- a/e2e/gyp_no_install_script/snapshots/wksp/segfault-handler_defs.bzl +++ b/e2e/gyp_no_install_script/snapshots/wksp/segfault-handler_defs.bzl
@@ -153,7 +153,7 @@ tags = ["manual"], ) - # virtual store target with transitive closure of all npm package dependencies + # package store target with transitive closure of all npm package dependencies _npm_package_store( name = store_target_name, src = None if True else "@@npm__segfault-handler__1.3.0//:pkg",
diff --git a/js/private/js_run_devserver.bzl b/js/private/js_run_devserver.bzl index df73c7b..8d02caa 100644 --- a/js/private/js_run_devserver.bzl +++ b/js/private/js_run_devserver.bzl
@@ -50,12 +50,12 @@ )] # The .to_list() calls here are intentional and cannot be avoided; they should be small sets of - # files as they only include direct npm links (node_modules/foo) and the virtual store tree + # files as they only include direct npm links (node_modules/foo) and the package store tree # artifacts those symlinks point to (node_modules/.aspect_rules_js/foo@1.2.3/node_modules/foo) data_files = [] for f in depset(transitive = transitive_runfiles + [dep.files for dep in ctx.attr.data]).to_list(): if "/.aspect_rules_js/" in f.path: - # Special handling for virtual store deps; we only include 1st party deps since copying + # Special handling for package store deps; we only include 1st party deps since copying # all 3rd party node_modules over is expensive for typical graphs path_segments = f.path.split("/") package_name_segment = path_segments.index(".aspect_rules_js") + 1 @@ -196,8 +196,8 @@ The custom sandbox is populated with the default outputs of all targets in `data` as well as transitive sources & npm links. - As an optimization, virtual store files are explicitly excluded from the sandbox since the npm - links will point to the virtual store in the execroot and Node.js will follow those links as it + As an optimization, package store files are explicitly excluded from the sandbox since the npm + links will point to the package store in the execroot and Node.js will follow those links as it does within the execroot. As a result, rules_js npm package link targets such as `//:node_modules/next` are handled efficiently. Since these targets are symlinks in the output tree, they are recreated as symlinks in the custom sandbox and do not incur a full copy of the
diff --git a/js/private/js_run_devserver.mjs b/js/private/js_run_devserver.mjs index 687f918..c611b1e 100644 --- a/js/private/js_run_devserver.mjs +++ b/js/private/js_run_devserver.mjs
@@ -52,7 +52,7 @@ return false } -// Determines if a file path is a 1p dep in the virtual store. +// Determines if a file path is a 1p dep in the package store. // See js/private/test/js_run_devserver/js_run_devserver.spec.mjs for examples. export function is1pVirtualStoreDep(p) { // unscoped1p: https://regex101.com/r/hBR08J/1 @@ -258,12 +258,12 @@ if (virtualStore1pFiles.length > 0 && process.env.JS_BINARY__LOG_DEBUG) { console.error( - `Syncing ${virtualStore1pFiles.length} first party virtual store dep(s)` + `Syncing ${virtualStore1pFiles.length} first party package store dep(s)` ) } - // Sync first-party virtual store files first since correctly syncing direct 1p node_modules - // symlinks depends on checking if the virtual store synced files exist. + // Sync first-party package store files first since correctly syncing direct 1p node_modules + // symlinks depends on checking if the package store synced files exist. let totalSynced = ( await Promise.all( virtualStore1pFiles.map(async (file) => {
diff --git a/js/private/test/js_run_devserver/js_run_devserver.spec.mjs b/js/private/test/js_run_devserver/js_run_devserver.spec.mjs index 71c1036..5b06a0e 100644 --- a/js/private/test/js_run_devserver/js_run_devserver.spec.mjs +++ b/js/private/test/js_run_devserver/js_run_devserver.spec.mjs
@@ -30,7 +30,7 @@ ] for (const p of is1pVirtualStoreDep_true) { if (!is1pVirtualStoreDep(p)) { - console.error(`ERROR: expected ${p} to be a 1p virtual store dep`) + console.error(`ERROR: expected ${p} to be a 1p package store dep`) process.exit(1) } } @@ -48,7 +48,7 @@ ] for (const p of is1pVirtualStoreDep_false) { if (is1pVirtualStoreDep(p)) { - console.error(`ERROR: expected ${p} to not be a 1p virtual store dep`) + console.error(`ERROR: expected ${p} to not be a 1p package store dep`) process.exit(1) } }
diff --git a/js/private/test/node-patches/realpath.js b/js/private/test/node-patches/realpath.js index c52c620..39b8d9a 100644 --- a/js/private/test/node-patches/realpath.js +++ b/js/private/test/node-patches/realpath.js
@@ -513,11 +513,11 @@ { sandbox: { node_modules: {}, - virtual_store: { pkg: {} }, + package_store: { pkg: {} }, }, execroot: { node_modules: {}, - virtual_store: { + package_store: { pkg: { file: 'contents', }, @@ -527,9 +527,9 @@ async (fixturesDir) => { fixturesDir = fs.realpathSync(fixturesDir) - // create symlink from execroot/node_modules/pkg to execroot/virtual_store/pkg + // create symlink from execroot/node_modules/pkg to execroot/package_store/pkg fs.symlinkSync( - path.join(fixturesDir, 'execroot', 'virtual_store', 'pkg'), + path.join(fixturesDir, 'execroot', 'package_store', 'pkg'), path.join(fixturesDir, 'execroot', 'node_modules', 'pkg') ) @@ -538,20 +538,20 @@ path.join( fixturesDir, 'execroot', - 'virtual_store', + 'package_store', 'pkg', 'file' ), path.join( fixturesDir, 'sandbox', - 'virtual_store', + 'package_store', 'pkg', 'file' ) ) fs.symlinkSync( - path.join(fixturesDir, 'sandbox', 'virtual_store', 'pkg'), + path.join(fixturesDir, 'sandbox', 'package_store', 'pkg'), path.join(fixturesDir, 'sandbox', 'node_modules', 'pkg') ) @@ -569,7 +569,7 @@ const filePath = path.join( fixturesDir, 'sandbox', - 'virtual_store', + 'package_store', 'pkg', 'file' ) @@ -613,7 +613,7 @@ const filePath2 = path.join( fixturesDir, 'sandbox', - 'virtual_store', + 'package_store', 'pkg' )
diff --git a/npm/private/npm_import.bzl b/npm/private/npm_import.bzl index fb71144..53826bc 100644 --- a/npm/private/npm_import.bzl +++ b/npm/private/npm_import.bzl
@@ -64,7 +64,7 @@ deps = {deps} ref_deps = {ref_deps} - store_target_name = "{virtual_store_root}/{{}}/{virtual_store_name}".format(link_root_name) + store_target_name = "{package_store_root}/{{}}/{package_store_name}".format(link_root_name) # reference target used to avoid circular deps _npm_package_store( @@ -86,7 +86,7 @@ tags = ["manual"], ) - # virtual store target with transitive closure of all npm package dependencies + # package store target with transitive closure of all npm package dependencies _npm_package_store( name = store_target_name, src = None if {transitive_closure_pattern} else "{npm_package_target}", @@ -203,7 +203,7 @@ fail(msg) link_root_name = name[:-len("/{{}}".format(link_alias))] - store_target_name = "{virtual_store_root}/{{}}/{virtual_store_name}".format(link_root_name) + store_target_name = "{package_store_root}/{{}}/{package_store_name}".format(link_root_name) # terminal package store target to link _npm_link_package_store( @@ -275,7 +275,7 @@ _BIN_MACRO_TMPL = """ def _{bin_name}_internal(name, link_root_name, **kwargs): - store_target_name = "{virtual_store_root}/{{}}/{virtual_store_name}".format(link_root_name) + store_target_name = "{package_store_root}/{{}}/{package_store_name}".format(link_root_name) _directory_path( name = "%s__entry_point" % name, directory = "@{link_workspace}//{root_package}:{{}}/dir".format(store_target_name), @@ -297,7 +297,7 @@ ) def _{bin_name}_test_internal(name, link_root_name, **kwargs): - store_target_name = "{virtual_store_root}/{{}}/{virtual_store_name}".format(link_root_name) + store_target_name = "{package_store_root}/{{}}/{package_store_name}".format(link_root_name) _directory_path( name = "%s__entry_point" % name, directory = "@{link_workspace}//{root_package}:{{}}/dir".format(store_target_name), @@ -312,7 +312,7 @@ ) def _{bin_name}_binary_internal(name, link_root_name, **kwargs): - store_target_name = "{virtual_store_root}/{{}}/{virtual_store_name}".format(link_root_name) + store_target_name = "{package_store_root}/{{}}/{package_store_name}".format(link_root_name) _directory_path( name = "%s__entry_point" % name, directory = "@{link_workspace}//{root_package}:{{}}/dir".format(store_target_name), @@ -537,7 +537,7 @@ rctx_files["BUILD.bazel"].append("\n" + rctx.attr.extra_build_content) if bins: - virtual_store_name = utils.virtual_store_name(rctx.attr.package, rctx.attr.version) + package_store_name = utils.package_store_name(rctx.attr.package, rctx.attr.version) package_name_no_scope = rctx.attr.package.rsplit("/", 1)[-1] for link_package in rctx.attr.link_packages.keys(): @@ -557,8 +557,8 @@ package = rctx.attr.package, root_package = rctx.attr.root_package, version = rctx.attr.version, - virtual_store_name = virtual_store_name, - virtual_store_root = utils.virtual_store_root, + package_store_name = package_store_name, + package_store_root = utils.package_store_root, ), ) @@ -635,13 +635,13 @@ for (dep_name, dep_version) in rctx.attr.deps.items(): store_package, store_version = utils.parse_pnpm_package_key(dep_name, dep_version) if dep_version.startswith("link:") or dep_version.startswith("file:"): - dep_store_target = """"//{root_package}:{virtual_store_root}/{{}}/{virtual_store_name}".format(link_root_name)""" + dep_store_target = """"//{root_package}:{package_store_root}/{{}}/{package_store_name}".format(link_root_name)""" else: - dep_store_target = """":{virtual_store_root}/{{}}/{virtual_store_name}/ref".format(link_root_name)""" + dep_store_target = """":{package_store_root}/{{}}/{package_store_name}/ref".format(link_root_name)""" dep_store_target = dep_store_target.format( root_package = rctx.attr.root_package, - virtual_store_name = utils.virtual_store_name(store_package, store_version), - virtual_store_root = utils.virtual_store_root, + package_store_name = utils.package_store_name(store_package, store_version), + package_store_root = utils.package_store_root, ) ref_deps[dep_store_target] = ref_deps[dep_store_target] + [dep_name] if dep_store_target in ref_deps else [dep_name] @@ -654,26 +654,26 @@ for dep_version in dep_versions: store_package, store_version = utils.parse_pnpm_package_key(dep_name, dep_version) if dep_version.startswith("link:") or dep_version.startswith("file:"): - dep_store_target = """"//{root_package}:{virtual_store_root}/{{}}/{virtual_store_name}".format(link_root_name)""" + dep_store_target = """"//{root_package}:{package_store_root}/{{}}/{package_store_name}".format(link_root_name)""" lc_dep_store_target = dep_store_target else: - dep_store_target = """":{virtual_store_root}/{{}}/{virtual_store_name}/pkg".format(link_root_name)""" + dep_store_target = """":{package_store_root}/{{}}/{package_store_name}/pkg".format(link_root_name)""" lc_dep_store_target = dep_store_target if dep_name == rctx.attr.package and dep_version == rctx.attr.version: # special case for lifecycle transitive closure deps; do not depend on # the __pkg of this package as that will be the output directory # of the lifecycle action - lc_dep_store_target = """":{virtual_store_root}/{{}}/{virtual_store_name}/pkg_pre_lc_lite".format(link_root_name)""" + lc_dep_store_target = """":{package_store_root}/{{}}/{package_store_name}/pkg_pre_lc_lite".format(link_root_name)""" dep_store_target = dep_store_target.format( root_package = rctx.attr.root_package, - virtual_store_name = utils.virtual_store_name(store_package, store_version), - virtual_store_root = utils.virtual_store_root, + package_store_name = utils.package_store_name(store_package, store_version), + package_store_root = utils.package_store_root, ) lc_dep_store_target = lc_dep_store_target.format( root_package = rctx.attr.root_package, - virtual_store_name = utils.virtual_store_name(store_package, store_version), - virtual_store_root = utils.virtual_store_root, + package_store_name = utils.package_store_name(store_package, store_version), + package_store_root = utils.package_store_root, ) lc_deps[lc_dep_store_target] = lc_deps[lc_dep_store_target] + [dep_name] if lc_dep_store_target in lc_deps else [dep_name] @@ -682,21 +682,21 @@ for (dep_name, dep_version) in rctx.attr.deps.items(): store_package, store_version = utils.parse_pnpm_package_key(dep_name, dep_version) if dep_version.startswith("link:") or dep_version.startswith("file:"): - dep_store_target = """"//{root_package}:{virtual_store_root}/{{}}/{virtual_store_name}".format(link_root_name)""" + dep_store_target = """"//{root_package}:{package_store_root}/{{}}/{package_store_name}".format(link_root_name)""" else: - dep_store_target = """":{virtual_store_root}/{{}}/{virtual_store_name}".format(link_root_name)""" + dep_store_target = """":{package_store_root}/{{}}/{package_store_name}".format(link_root_name)""" dep_store_target = dep_store_target.format( root_package = rctx.attr.root_package, - virtual_store_name = utils.virtual_store_name(store_package, store_version), - virtual_store_root = utils.virtual_store_root, + package_store_name = utils.package_store_name(store_package, store_version), + package_store_root = utils.package_store_root, ) lc_deps[dep_store_target] = lc_deps[dep_store_target] + [dep_name] if dep_store_target in lc_deps else [dep_name] deps[dep_store_target] = deps[dep_store_target] + [dep_name] if dep_store_target in deps else [dep_name] - virtual_store_name = utils.virtual_store_name(rctx.attr.package, rctx.attr.version) + package_store_name = utils.package_store_name(rctx.attr.package, rctx.attr.version) - # "node_modules/{virtual_store_root}/{virtual_store_name}/node_modules/{package}" - lifecycle_output_dir = paths.join("node_modules", utils.virtual_store_root, virtual_store_name, "node_modules", rctx.attr.package) + # "node_modules/{package_store_root}/{package_store_name}/node_modules/{package}" + lifecycle_output_dir = paths.join("node_modules", utils.package_store_root, package_store_name, "node_modules", rctx.attr.package) # strip _links post-fix to get the repository name of the npm sources npm_import_sources_repo_name = rctx.name[:-len(utils.links_repo_suffix)] @@ -736,7 +736,7 @@ maybe_bins = (""" bins = %s,""" % starlark_codegen_utils.to_dict_attr(rctx.attr.bins, 3)) if len(rctx.attr.bins) > 0 else "" - virtual_store_name = utils.virtual_store_name(rctx.attr.package, rctx.attr.version) + package_store_name = utils.package_store_name(rctx.attr.package, rctx.attr.version) public_visibility = ("//visibility:public" in rctx.attr.package_visibility) @@ -760,8 +760,8 @@ root_package = rctx.attr.root_package, transitive_closure_pattern = str(transitive_closure_pattern), version = rctx.attr.version, - virtual_store_name = virtual_store_name, - virtual_store_root = utils.virtual_store_root, + package_store_name = package_store_name, + package_store_root = utils.package_store_root, maybe_bins = maybe_bins, dev = rctx.attr.dev, use_default_shell_env = rctx.attr.lifecycle_hooks_use_default_shell_env, @@ -999,7 +999,7 @@ transitive_closure: A dict all npm packages this one depends on directly or transitively where the key is the package name and value is a list of version(s) depended on in the closure. - root_package: The root package where the node_modules virtual store is linked to. + root_package: The root package where the node_modules package store is linked to. Typically this is the package that the pnpm-lock.yaml file is located when using `npm_translate_lock`. link_workspace: The workspace name where links will be created for this package.
diff --git a/npm/private/npm_link_package.bzl b/npm/private/npm_link_package.bzl index dfe4f31..94edd4f 100644 --- a/npm/private/npm_link_package.bzl +++ b/npm/private/npm_link_package.bzl
@@ -16,10 +16,10 @@ **kwargs): """"Links an npm package to node_modules if link is True. - When called at the root_package, a virtual store target is generated named `link__{bazelified_name}__store`. + When called at the root_package, a package store target is generated named `link__{bazelified_name}__store`. When linking, a `{name}` target is generated which consists of the `node_modules/<package>` symlink and transitively - its virtual store link and the virtual store links of the transitive closure of deps. + its package store link and the package store links of the transitive closure of deps. When linking, `{name}/dir` filegroup is also generated that refers to a directory artifact can be used to access the package directory for creating entry points or accessing files in the package. @@ -27,8 +27,8 @@ Args: name: The name of the link target to create if `link` is True. For first-party deps linked across a workspace, the name must match in all packages - being linked as it is used to derive the virtual store link target name. - root_package: the root package where the node_modules virtual store is linked to + being linked as it is used to derive the package store link target name. + root_package: the root package where the node_modules package store is linked to link: whether or not to link in this package If false, only the npm_package_store target will be created _if_ this is called in the `root_package`. src: the npm_package target to link; may only to be specified when linking in the root package @@ -61,9 +61,9 @@ msg = "src may only be specified when linking in the root package '{}'".format(root_package) fail(msg) - store_target_name = "{virtual_store_root}/{name}".format( + store_target_name = "{package_store_root}/{name}".format( name = name, - virtual_store_root = utils.virtual_store_root, + package_store_root = utils.package_store_root, ) tags = kwargs.pop("tags", []) @@ -71,7 +71,7 @@ tags.append("manual") if is_root: - # link the virtual store when linking at the root + # link the package store when linking at the root npm_package_store( name = store_target_name, src = src,
diff --git a/npm/private/npm_link_package_store.bzl b/npm/private/npm_link_package_store.bzl index f4c69bc..70fa03d 100644 --- a/npm/private/npm_link_package_store.bzl +++ b/npm/private/npm_link_package_store.bzl
@@ -8,7 +8,7 @@ _DOC = """Links an npm package that is backed by an npm_package_store into a node_modules tree as a direct dependency. This is used in conjunction with the npm_package_store rule that outputs an npm package into the -node_modules/.aspect_rules_js virtual store in a pnpm style symlinked node_modules structure. +node_modules/.aspect_rules_js package store in a pnpm style symlinked node_modules structure. The term "package" is defined at <https://nodejs.org/docs/latest-v16.x/api/packages.html> @@ -63,24 +63,24 @@ def _npm_link_package_store_impl(ctx): store_info = ctx.attr.src[NpmPackageStoreInfo] - virtual_store_directory = store_info.virtual_store_directory - if not virtual_store_directory: - fail("src must be a npm_link_package that provides a virtual_store_directory") + package_store_directory = store_info.package_store_directory + if not package_store_directory: + fail("src must be a npm_link_package that provides a package_store_directory") - if virtual_store_directory.owner.workspace_name != ctx.label.workspace_name: - msg = "expected virtual_store_directory to be in the same workspace as the link target '{}' but found '{}'".format( + if package_store_directory.owner.workspace_name != ctx.label.workspace_name: + msg = "expected package_store_directory to be in the same workspace as the link target '{}' but found '{}'".format( ctx.label.workspace_name, - virtual_store_directory.owner.workspace_name, + package_store_directory.owner.workspace_name, ) fail(msg) package = ctx.attr.package if ctx.attr.package else store_info.package - # symlink the package's path in the virtual store to the root of the node_modules + # symlink the package's path in the package store to the root of the node_modules # "node_modules/{package}" so it is available as a direct dependency root_symlink_path = paths.join("node_modules", package) - files = [utils.make_symlink(ctx, root_symlink_path, virtual_store_directory)] + files = [utils.make_symlink(ctx, root_symlink_path, package_store_directory)] for bin_name, bin_path in ctx.attr.bins.items(): bin_file = ctx.actions.declare_file(paths.join("node_modules", ".bin", bin_name))
diff --git a/npm/private/npm_package_store.bzl b/npm/private/npm_package_store.bzl index 5d33cff..5823613 100644 --- a/npm/private/npm_package_store.bzl +++ b/npm/private/npm_package_store.bzl
@@ -158,31 +158,31 @@ if not version: fail("No package version specified to link to. Package version must either be specified explicitly via 'version' attribute or come from the 'src' 'NpmPackageInfo', typically a 'npm_package' target") - virtual_store_name = utils.virtual_store_name(package, version) + package_store_name = utils.package_store_name(package, version) src = None - virtual_store_directory = None + package_store_directory = None files = [] direct_ref_deps = {} npm_package_store_deps = [] if ctx.attr.src: - # output the package as a TreeArtifact to its virtual store location - # "node_modules/{virtual_store_root}/{virtual_store_name}/node_modules/{package}" - virtual_store_directory_path = paths.join("node_modules", utils.virtual_store_root, virtual_store_name, "node_modules", package) + # output the package as a TreeArtifact to its package store location + # "node_modules/{package_store_root}/{package_store_name}/node_modules/{package}" + package_store_directory_path = paths.join("node_modules", utils.package_store_root, package_store_name, "node_modules", package) if ctx.label.workspace_name: - expected_short_path = paths.join("..", ctx.label.workspace_name, ctx.label.package, virtual_store_directory_path) + expected_short_path = paths.join("..", ctx.label.workspace_name, ctx.label.package, package_store_directory_path) else: - expected_short_path = paths.join(ctx.label.package, virtual_store_directory_path) + expected_short_path = paths.join(ctx.label.package, package_store_directory_path) src = ctx.attr.src[NpmPackageInfo].src if src.short_path == expected_short_path: # the input is already the desired output; this is the pattern for # packages with lifecycle hooks - virtual_store_directory = src + package_store_directory = src else: - virtual_store_directory = ctx.actions.declare_directory(virtual_store_directory_path) + package_store_directory = ctx.actions.declare_directory(package_store_directory_path) if utils.is_tarball_extension(src.extension): # npm packages are always published with one top-level directory inside the tarball, tho the name is not predictable # we can use the --strip-components 1 argument with tar to strip one directory level @@ -195,13 +195,13 @@ args.add("--file") args.add(src.path) args.add("--directory") - args.add(virtual_store_directory.path) + args.add(package_store_directory.path) bsdtar = ctx.toolchains["@aspect_bazel_lib//lib:tar_toolchain_type"] ctx.actions.run( executable = bsdtar.tarinfo.binary, inputs = depset(direct = [src], transitive = [bsdtar.default.files]), - outputs = [virtual_store_directory], + outputs = [package_store_directory], arguments = [args], mnemonic = "NpmPackageExtract", progress_message = "Extracting npm package {}@{}".format(package, version), @@ -210,7 +210,7 @@ copy_directory_bin_action( ctx, src = src, - dst = virtual_store_directory, + dst = package_store_directory, copy_directory_bin = ctx.toolchains["@aspect_bazel_lib//lib:copy_directory_toolchain_type"].copy_directory_info.bin, # Hardlinking source files in external repositories as was done under the hood # prior to https://github.com/aspect-build/rules_js/pull/1533 may lead to flaky build @@ -219,22 +219,22 @@ verbose = ctx.attr.verbose, ) - linked_virtual_store_directories = [] + linked_package_store_directories = [] for dep, _dep_aliases in ctx.attr.deps.items(): - # symlink the package's direct deps to its virtual store location + # symlink the package's direct deps to its package store location if dep[NpmPackageStoreInfo].root_package != ctx.label.package: msg = """npm_package_store in %s package cannot depend on npm_package_store in %s package. deps of npm_package_store must be in the same package.""" % (ctx.label.package, dep[NpmPackageStoreInfo].root_package) fail(msg) dep_package = dep[NpmPackageStoreInfo].package dep_aliases = _dep_aliases.split(",") if _dep_aliases else [dep_package] - dep_virtual_store_directory = dep[NpmPackageStoreInfo].virtual_store_directory - if dep_virtual_store_directory: - linked_virtual_store_directories.append(dep_virtual_store_directory) + dep_package_store_directory = dep[NpmPackageStoreInfo].package_store_directory + if dep_package_store_directory: + linked_package_store_directories.append(dep_package_store_directory) for dep_alias in dep_aliases: - # "node_modules/{virtual_store_root}/{virtual_store_name}/node_modules/{package}" - dep_symlink_path = paths.join("node_modules", utils.virtual_store_root, virtual_store_name, "node_modules", dep_alias) - files.append(utils.make_symlink(ctx, dep_symlink_path, dep_virtual_store_directory)) + # "node_modules/{package_store_root}/{package_store_name}/node_modules/{package}" + dep_symlink_path = paths.join("node_modules", utils.package_store_root, package_store_name, "node_modules", dep_alias) + files.append(utils.make_symlink(ctx, dep_symlink_path, dep_package_store_directory)) else: # this is a ref npm_link_package, a downstream terminal npm_link_package # for this npm dependency will create the dep symlinks for this dep; @@ -244,14 +244,14 @@ for store in ctx.attr.src[NpmPackageInfo].npm_package_store_deps.to_list(): dep_package = store.package - dep_virtual_store_directory = store.virtual_store_directory + dep_package_store_directory = store.package_store_directory # only link npm package store deps from NpmPackageInfo if they have _not_ already been linked directly # from deps; fixes https://github.com/aspect-build/rules_js/issues/1110. - if dep_virtual_store_directory not in linked_virtual_store_directories: - # "node_modules/{virtual_store_root}/{virtual_store_name}/node_modules/{package}" - dep_symlink_path = paths.join("node_modules", utils.virtual_store_root, virtual_store_name, "node_modules", dep_package) - files.append(utils.make_symlink(ctx, dep_symlink_path, dep_virtual_store_directory)) + if dep_package_store_directory not in linked_package_store_directories: + # "node_modules/{package_store_root}/{package_store_name}/node_modules/{package}" + dep_symlink_path = paths.join("node_modules", utils.package_store_root, package_store_name, "node_modules", dep_package) + files.append(utils.make_symlink(ctx, dep_symlink_path, dep_package_store_directory)) npm_package_store_deps.append(store) else: # if ctx.attr.src is _not_ set then this is a terminal 3p package with ctx.attr.deps is @@ -262,38 +262,38 @@ dep_package = dep[NpmPackageStoreInfo].package dep_aliases = _dep_aliases.split(",") if _dep_aliases else [dep_package] - # create a map of deps that have virtual store directories - if dep[NpmPackageStoreInfo].virtual_store_directory: - deps_map[utils.virtual_store_name(dep[NpmPackageStoreInfo].package, dep[NpmPackageStoreInfo].version)] = dep + # create a map of deps that have package store directories + if dep[NpmPackageStoreInfo].package_store_directory: + deps_map[utils.package_store_name(dep[NpmPackageStoreInfo].package, dep[NpmPackageStoreInfo].version)] = dep else: # this is a ref npm_link_package, a downstream terminal npm_link_package for this npm # depedency will create the dep symlinks for this dep; this pattern is used to break # for lifecycle hooks on 3rd party deps; it is not recommended for 1st party deps direct_ref_deps[dep] = dep_aliases for dep in ctx.attr.deps: - dep_virtual_store_name = utils.virtual_store_name(dep[NpmPackageStoreInfo].package, dep[NpmPackageStoreInfo].version) + dep_package_store_name = utils.package_store_name(dep[NpmPackageStoreInfo].package, dep[NpmPackageStoreInfo].version) dep_ref_deps = dep[NpmPackageStoreInfo].ref_deps - if virtual_store_name == dep_virtual_store_name: + if package_store_name == dep_package_store_name: # provide the node_modules directory for this package if found in the transitive_closure - virtual_store_directory = dep[NpmPackageStoreInfo].virtual_store_directory + package_store_directory = dep[NpmPackageStoreInfo].package_store_directory for dep_ref_dep, dep_ref_dep_aliases in dep_ref_deps.items(): - dep_ref_dep_virtual_store_name = utils.virtual_store_name(dep_ref_dep[NpmPackageStoreInfo].package, dep_ref_dep[NpmPackageStoreInfo].version) - if not dep_ref_dep_virtual_store_name in deps_map: + dep_ref_dep_package_store_name = utils.package_store_name(dep_ref_dep[NpmPackageStoreInfo].package, dep_ref_dep[NpmPackageStoreInfo].version) + if not dep_ref_dep_package_store_name in deps_map: # This can happen in lifecycle npm package targets. We have no choice but to # ignore reference back to self in dyadic circular deps in this case since a # transitive dep on this npm package is impossible in an action that is - # outputting the virtual store tree artifact that circular dep would point to. + # outputting the package store tree artifact that circular dep would point to. continue - actual_dep = deps_map[dep_ref_dep_virtual_store_name] - dep_ref_def_virtual_store_directory = actual_dep[NpmPackageStoreInfo].virtual_store_directory - if dep_ref_def_virtual_store_directory: + actual_dep = deps_map[dep_ref_dep_package_store_name] + dep_ref_def_package_store_directory = actual_dep[NpmPackageStoreInfo].package_store_directory + if dep_ref_def_package_store_directory: for dep_ref_dep_alias in dep_ref_dep_aliases: - # "node_modules/{virtual_store_root}/{virtual_store_name}/node_modules/{package}" - dep_ref_dep_symlink_path = paths.join("node_modules", utils.virtual_store_root, dep_virtual_store_name, "node_modules", dep_ref_dep_alias) - files.append(utils.make_symlink(ctx, dep_ref_dep_symlink_path, dep_ref_def_virtual_store_directory)) + # "node_modules/{package_store_root}/{package_store_name}/node_modules/{package}" + dep_ref_dep_symlink_path = paths.join("node_modules", utils.package_store_root, dep_package_store_name, "node_modules", dep_ref_dep_alias) + files.append(utils.make_symlink(ctx, dep_ref_dep_symlink_path, dep_ref_def_package_store_directory)) - if virtual_store_directory: - files.append(virtual_store_directory) + if package_store_directory: + files.append(package_store_directory) npm_package_store_deps.extend([ target[NpmPackageStoreInfo] @@ -329,17 +329,17 @@ package = package, version = version, ref_deps = direct_ref_deps, - virtual_store_directory = virtual_store_directory, + package_store_directory = package_store_directory, files = files_depset, transitive_files = transitive_files_depset, dev = ctx.attr.dev, ), ] - if virtual_store_directory: + if package_store_directory: # Provide an output group that provides a single file which is the # package directory for use in $(execpath) and $(rootpath). # Output group name must match utils.package_directory_output_group - providers.append(OutputGroupInfo(package_directory = depset([virtual_store_directory]))) + providers.append(OutputGroupInfo(package_directory = depset([package_store_directory]))) return providers
diff --git a/npm/private/npm_package_store_info.bzl b/npm/private/npm_package_store_info.bzl index 9102748..0e59611 100644 --- a/npm/private/npm_package_store_info.bzl +++ b/npm/private/npm_package_store_info.bzl
@@ -1,7 +1,7 @@ "NpmPackageStoreInfo provider" NpmPackageStoreInfo = provider( - doc = """Provides information about an npm package within the virtual store of a pnpm-style + doc = """Provides information about an npm package within the package store of a pnpm-style symlinked node_modules tree. See https://pnpm.io/symlinked-node-modules-structure for more information about @@ -11,7 +11,7 @@ "package": "name of this npm package", "version": "version of this npm package", "ref_deps": "dictionary of dependency npm_package_store ref targets", - "virtual_store_directory": "the TreeArtifact of this npm package's virtual store location", + "package_store_directory": "the TreeArtifact of this npm package's package store location", "files": "depset of files that are part of the npm package", "transitive_files": "depset of the files that are part of the npm package and its transitive deps", "dev": "whether or not this npm package is a dev dependency",
diff --git a/npm/private/npm_translate_lock_generate.bzl b/npm/private/npm_translate_lock_generate.bzl index e1b3fa9..a5b0a2c 100644 --- a/npm/private/npm_translate_lock_generate.bzl +++ b/npm/private/npm_translate_lock_generate.bzl
@@ -30,7 +30,7 @@ """ if is_root: _npm_package_store( - name = "{virtual_store_root}/{{}}/{virtual_store_name}".format(name), + name = "{package_store_root}/{{}}/{package_store_name}".format(name), src = "{npm_package_target}", package = "{package}", version = "0.0.0", @@ -46,7 +46,7 @@ # terminal target for direct dependencies _npm_link_package_store( name = "{{}}/{name}".format(name), - src = "//{root_package}:{virtual_store_root}/{{}}/{virtual_store_name}".format(name), + src = "//{root_package}:{package_store_root}/{{}}/{package_store_name}".format(name), visibility = {link_visibility}, tags = ["manual"], ) @@ -141,10 +141,10 @@ transitive_deps = {} for raw_package, raw_version in deps.items(): store_package, store_version = utils.parse_pnpm_package_key(raw_package, raw_version) - dep_store_target = """"//{root_package}:{virtual_store_root}/{{}}/{virtual_store_name}".format(name)""".format( + dep_store_target = """"//{root_package}:{package_store_root}/{{}}/{package_store_name}".format(name)""".format( root_package = root_package, - virtual_store_name = utils.virtual_store_name(store_package, store_version), - virtual_store_root = utils.virtual_store_root, + package_store_name = utils.package_store_name(store_package, store_version), + package_store_root = utils.package_store_root, ) if dep_store_target not in transitive_deps: transitive_deps[dep_store_target] = [raw_package] @@ -192,10 +192,10 @@ raw_deps = importers.get(dep_importer).get("deps") for raw_package, raw_version in raw_deps.items(): store_package, store_version = utils.parse_pnpm_package_key(raw_package, raw_version) - dep_store_target = """"//{root_package}:{virtual_store_root}/{{}}/{virtual_store_name}".format(name)""".format( + dep_store_target = """"//{root_package}:{package_store_root}/{{}}/{package_store_name}".format(name)""".format( root_package = root_package, - virtual_store_name = utils.virtual_store_name(store_package, store_version), - virtual_store_root = utils.virtual_store_root, + package_store_name = utils.package_store_name(store_package, store_version), + package_store_root = utils.package_store_root, ) if dep_store_target not in transitive_deps: transitive_deps[dep_store_target] = [raw_package] @@ -451,8 +451,8 @@ deps = starlark_codegen_utils.to_dict_attr(fp_deps, 3, quote_key = False), npm_package_target = fp_target, package = fp_package, - virtual_store_name = utils.virtual_store_name(fp_package, "0.0.0"), - virtual_store_root = utils.virtual_store_root, + package_store_name = utils.package_store_name(fp_package, "0.0.0"), + package_store_root = utils.package_store_root, )) package_visibility, _ = helpers.gather_values_from_matching_names(True, rctx.attr.package_visibility, "*", fp_package) @@ -467,8 +467,8 @@ name = fp_package, package_directory_output_group = utils.package_directory_output_group, root_package = root_package, - virtual_store_name = utils.virtual_store_name(fp_package, "0.0.0"), - virtual_store_root = utils.virtual_store_root, + package_store_name = utils.package_store_name(fp_package, "0.0.0"), + package_store_root = utils.package_store_root, )) npm_link_targets_bzl.append(_FP_DIRECT_TARGET_TMPL.format(
diff --git a/npm/private/test/BUILD.bazel b/npm/private/test/BUILD.bazel index 2037efc..73c3ac5 100644 --- a/npm/private/test/BUILD.bazel +++ b/npm/private/test/BUILD.bazel
@@ -88,7 +88,7 @@ data = [ # Test that node_modules/.bin binaries work in both the root package # and in subpackages. The relative paths in the two are different since the - # actual node entry is in the virtual store which is in the root package. + # actual node entry is in the package store which is in the root package. "//:node_modules/typescript", ":node_modules/typescript", # This eager toolchain fetching could be cleaed up in the future
diff --git a/npm/private/test/snapshots/bzlmod/chalk_links_defs.bzl b/npm/private/test/snapshots/bzlmod/chalk_links_defs.bzl index 44a7030..07d922d 100644 --- a/npm/private/test/snapshots/bzlmod/chalk_links_defs.bzl +++ b/npm/private/test/snapshots/bzlmod/chalk_links_defs.bzl
@@ -46,7 +46,7 @@ tags = ["manual"], ) - # virtual store target with transitive closure of all npm package dependencies + # package store target with transitive closure of all npm package dependencies _npm_package_store( name = store_target_name, src = None if True else "@chalk_501//:pkg",
diff --git a/npm/private/test/snapshots/bzlmod/fsevents_links_defs.bzl b/npm/private/test/snapshots/bzlmod/fsevents_links_defs.bzl index 21e8d29..43a4992 100644 --- a/npm/private/test/snapshots/bzlmod/fsevents_links_defs.bzl +++ b/npm/private/test/snapshots/bzlmod/fsevents_links_defs.bzl
@@ -50,7 +50,7 @@ tags = ["manual"], ) - # virtual store target with transitive closure of all npm package dependencies + # package store target with transitive closure of all npm package dependencies _npm_package_store( name = store_target_name, src = None if True else "@@_main~npm~npm__fsevents__2.3.2//:pkg",
diff --git a/npm/private/test/snapshots/bzlmod/rollup_links_defs.bzl b/npm/private/test/snapshots/bzlmod/rollup_links_defs.bzl index 315e1c3..022b5ef 100644 --- a/npm/private/test/snapshots/bzlmod/rollup_links_defs.bzl +++ b/npm/private/test/snapshots/bzlmod/rollup_links_defs.bzl
@@ -49,7 +49,7 @@ tags = ["manual"], ) - # virtual store target with transitive closure of all npm package dependencies + # package store target with transitive closure of all npm package dependencies _npm_package_store( name = store_target_name, src = None if True else "@@_main~npm~npm__rollup__2.70.2//:pkg",
diff --git a/npm/private/test/snapshots/bzlmod/unused_links_defs.bzl b/npm/private/test/snapshots/bzlmod/unused_links_defs.bzl index d370c63..dd8d8b6 100644 --- a/npm/private/test/snapshots/bzlmod/unused_links_defs.bzl +++ b/npm/private/test/snapshots/bzlmod/unused_links_defs.bzl
@@ -53,7 +53,7 @@ tags = ["manual"], ) - # virtual store target with transitive closure of all npm package dependencies + # package store target with transitive closure of all npm package dependencies _npm_package_store( name = store_target_name, src = None if True else "@@_main~npm~npm__unused__0.2.2//:pkg",
diff --git a/npm/private/test/snapshots/wksp/chalk_links_defs.bzl b/npm/private/test/snapshots/wksp/chalk_links_defs.bzl index 44a7030..07d922d 100644 --- a/npm/private/test/snapshots/wksp/chalk_links_defs.bzl +++ b/npm/private/test/snapshots/wksp/chalk_links_defs.bzl
@@ -46,7 +46,7 @@ tags = ["manual"], ) - # virtual store target with transitive closure of all npm package dependencies + # package store target with transitive closure of all npm package dependencies _npm_package_store( name = store_target_name, src = None if True else "@chalk_501//:pkg",
diff --git a/npm/private/test/snapshots/wksp/fsevents_links_defs.bzl b/npm/private/test/snapshots/wksp/fsevents_links_defs.bzl index 04daeb6..6aebab9 100644 --- a/npm/private/test/snapshots/wksp/fsevents_links_defs.bzl +++ b/npm/private/test/snapshots/wksp/fsevents_links_defs.bzl
@@ -50,7 +50,7 @@ tags = ["manual"], ) - # virtual store target with transitive closure of all npm package dependencies + # package store target with transitive closure of all npm package dependencies _npm_package_store( name = store_target_name, src = None if True else "@@npm__fsevents__2.3.2//:pkg",
diff --git a/npm/private/test/snapshots/wksp/rollup_links_defs.bzl b/npm/private/test/snapshots/wksp/rollup_links_defs.bzl index 0cb9ccc..411ec3d 100644 --- a/npm/private/test/snapshots/wksp/rollup_links_defs.bzl +++ b/npm/private/test/snapshots/wksp/rollup_links_defs.bzl
@@ -49,7 +49,7 @@ tags = ["manual"], ) - # virtual store target with transitive closure of all npm package dependencies + # package store target with transitive closure of all npm package dependencies _npm_package_store( name = store_target_name, src = None if True else "@@npm__rollup__2.70.2//:pkg",
diff --git a/npm/private/test/snapshots/wksp/unused_links_defs.bzl b/npm/private/test/snapshots/wksp/unused_links_defs.bzl index 17aa025..630fb48 100644 --- a/npm/private/test/snapshots/wksp/unused_links_defs.bzl +++ b/npm/private/test/snapshots/wksp/unused_links_defs.bzl
@@ -53,7 +53,7 @@ tags = ["manual"], ) - # virtual store target with transitive closure of all npm package dependencies + # package store target with transitive closure of all npm package dependencies _npm_package_store( name = store_target_name, src = None if True else "@@npm__unused__0.2.2//:pkg",
diff --git a/npm/private/test/utils_tests.bzl b/npm/private/test/utils_tests.bzl index d3ccbbd..766aef3 100644 --- a/npm/private/test/utils_tests.bzl +++ b/npm/private/test/utils_tests.bzl
@@ -53,9 +53,9 @@ asserts.equals(env, "@scope/y@2.1.1", utils.friendly_name("@scope/y", "2.1.1")) return unittest.end(env) -def test_virtual_store_name(ctx): +def test_package_store_name(ctx): env = unittest.begin(ctx) - asserts.equals(env, "@scope+y@2.1.1", utils.virtual_store_name("@scope/y", "2.1.1")) + asserts.equals(env, "@scope+y@2.1.1", utils.package_store_name("@scope/y", "2.1.1")) return unittest.end(env) # buildifier: disable=function-docstring @@ -152,7 +152,7 @@ t1_test = unittest.make(test_bazel_name) t2_test = unittest.make(test_pnpm_name) t3_test = unittest.make(test_friendly_name) -t4_test = unittest.make(test_virtual_store_name) +t4_test = unittest.make(test_package_store_name) t5_test = unittest.make(test_version_supported) t6_test = unittest.make(test_parse_package_name) t7_test = unittest.make(test_npm_registry_download_url)
diff --git a/npm/private/utils.bzl b/npm/private/utils.bzl index 1bdf9de..b944946 100644 --- a/npm/private/utils.bzl +++ b/npm/private/utils.bzl
@@ -241,10 +241,10 @@ "Make a name@version developer-friendly name for a package name and version" return "%s@%s" % (name, version) -def _virtual_store_name(name, version): - "Make a virtual store name for a given package and version" +def _package_store_name(name, version): + "Make a package store name for a given package and version" if version.startswith("@"): - # Special case where the package name should _not_ be included in the virtual store name. + # Special case where the package name should _not_ be included in the package store name. # See https://github.com/aspect-build/rules_js/issues/423 for more context. return version.replace("/", "+") else: @@ -440,11 +440,11 @@ parse_pnpm_lock_yaml = _parse_pnpm_lock_yaml, parse_pnpm_lock_json = _parse_pnpm_lock_json, friendly_name = _friendly_name, - virtual_store_name = _virtual_store_name, + package_store_name = _package_store_name, strip_peer_dep_or_patched_version = _strip_peer_dep_or_patched_version, make_symlink = _make_symlink, - # Symlinked node_modules structure virtual store path under node_modules - virtual_store_root = ".aspect_rules_js", + # Symlinked node_modules structure package store path under node_modules + package_store_root = ".aspect_rules_js", # Suffix for npm_import links repository links_repo_suffix = "__links", # Output group name for the package directory of a linked package