@@ -46,7 +46,7 @@ WARNING: `update_pnpm_lock` attribute in `npm_translate_lock(name = "{rctx_name}
4646 # labels only needed when updating the pnpm lock file
4747 _init_update_labels (priv , rctx , attr , label_store )
4848
49- _init_link_workspace (priv , rctx , attr , label_store )
49+ _init_link_workspace (priv , attr )
5050
5151 # parse the pnpm lock file incase since we need the importers list for additional init
5252 # TODO(windows): utils.exists is not yet support on Windows
@@ -134,7 +134,7 @@ def _init_pnpm_labels(priv, rctx, attr, label_store):
134134
135135################################################################################
136136def _init_update_labels (priv , _ , attr , label_store ):
137- pnpm_lock_label = label_store . label ( " pnpm_lock" )
137+ pnpm_lock_label = attr . pnpm_lock
138138 pnpm_lock_label_str = "//{}:{}" .format (pnpm_lock_label .package , pnpm_lock_label .name )
139139 action_cache_path = paths .join (
140140 priv ["external_repository_action_cache" ],
@@ -170,7 +170,7 @@ def _init_patched_dependencies_labels(priv, _, attr, label_store):
170170 # Read patches from pnpm-lock.yaml `patchedDependencies`
171171 patches = []
172172 for patch_info in priv ["patched_dependencies" ].values ():
173- patches .append ("//%s:%s" % (label_store . label ( " pnpm_lock" ) .package , patch_info .get ("path" )))
173+ patches .append ("//%s:%s" % (attr . pnpm_lock .package , patch_info .get ("path" )))
174174
175175 # Convert patch label strings to labels
176176 patches = [attr .pnpm_lock .relative (p ) for p in patches ]
@@ -186,9 +186,9 @@ def _init_importer_labels(priv, label_store):
186186 label_store .add_sibling ("lock" , "package_json_{}" .format (i ), paths .join (p , PACKAGE_JSON_FILENAME ))
187187
188188################################################################################
189- def _init_link_workspace (priv , _ , attr , label_store ):
189+ def _init_link_workspace (priv , attr ):
190190 # initialize link_workspace either from pnpm_lock label or from override
191- priv ["link_workspace" ] = attr .link_workspace if attr .link_workspace else label_store . label ( " pnpm_lock" ) .repo_name
191+ priv ["link_workspace" ] = attr .link_workspace if attr .link_workspace else attr . pnpm_lock .repo_name
192192
193193################################################################################
194194def _init_external_repository_action_cache (priv , attr ):
@@ -197,7 +197,7 @@ def _init_external_repository_action_cache(priv, attr):
197197
198198################################################################################
199199def _init_root_package (priv , rctx , attr , label_store ):
200- pnpm_lock_label = label_store . label ( " pnpm_lock" )
200+ pnpm_lock_label = attr . pnpm_lock
201201
202202 # use the directory of the pnpm_lock file as the root_package unless overridden by the root_package attribute
203203 if attr .root_package == DEFAULT_ROOT_PACKAGE :
@@ -284,7 +284,7 @@ def _copy_update_input_files(priv, rctx, attr, label_store):
284284################################################################################
285285# we can derive input files that should be specified but are not and copy these over; we warn the user when we do this
286286def _copy_unspecified_input_files (priv , rctx , attr , label_store ):
287- pnpm_lock_label = label_store . label ( " pnpm_lock" )
287+ pnpm_lock_label = attr . pnpm_lock
288288
289289 # pnpm-workspace.yaml
290290 pnpm_workspace_key = "pnpm_workspace"
@@ -480,7 +480,7 @@ WARNING: Cannot determine home directory in order to load home `.npmrc` file in
480480 _load_npmrc (priv , rctx , home_npmrc_path )
481481
482482################################################################################
483- def _load_lockfile (priv , rctx , _ , label_store ):
483+ def _load_lockfile (priv , rctx , attr , label_store ):
484484 importers = {}
485485 packages = {}
486486 patched_dependencies = {}
@@ -489,7 +489,7 @@ def _load_lockfile(priv, rctx, _, label_store):
489489
490490 yq_args = [
491491 str (label_store .path ("host_yq" )),
492- str ( label_store . path ( " pnpm_lock" )) ,
492+ attr . pnpm_lock ,
493493 "-o=json" ,
494494 ]
495495 result = rctx .execute (yq_args )
0 commit comments