@@ -14,6 +14,10 @@ _SUPPORTS_SYMLINK_TARGET_TYPE = bazel_features.rules.symlink_action_has_target_t
1414
1515_PACKAGE_STORE_PREFIX_LEN = len ("node_modules/{}/" .format (utils .package_store_root ))
1616
17+ _EXTRACT_EXECUTION_REQUIREMENTS = {
18+ "supports-path-mapping" : "1" ,
19+ }
20+
1721_DOC = """Defines a npm package that is linked into a node_modules tree.
1822
1923The npm package is linked with a pnpm style symlinked node_modules output tree.
@@ -242,13 +246,22 @@ def _npm_package_store_impl(ctx):
242246 bsdtar = ctx .toolchains [tar_lib .toolchain_type ]
243247
244248 args = ctx .actions .args ()
245- args .add ("--extract" )
246- args .add ("--no-same-owner" )
247- args .add ("--no-same-permissions" )
248- args .add ("--strip-components" , "1" )
249- args .add ("--file" , src )
250- args .add_all ("--directory" , [package_store_directory ], expand_directories = False )
251- args .add_all (ctx .attr .exclude_package_contents , before_each = "--exclude" )
249+ args .add_all (
250+ [
251+ "--extract" ,
252+ "--no-same-owner" ,
253+ "--no-same-permissions" ,
254+ "--strip-components" ,
255+ "1" ,
256+ "--file" ,
257+ src ,
258+ "--directory" ,
259+ package_store_directory ,
260+ ],
261+ expand_directories = False ,
262+ )
263+ if ctx .attr .exclude_package_contents :
264+ args .add_all (ctx .attr .exclude_package_contents , before_each = "--exclude" )
252265
253266 ctx .actions .run (
254267 executable = bsdtar .tarinfo .binary ,
@@ -257,9 +270,7 @@ def _npm_package_store_impl(ctx):
257270 arguments = [args ],
258271 mnemonic = "NpmPackageExtract" ,
259272 progress_message = "Extracting npm package {}@{}" .format (package , version ),
260- execution_requirements = {
261- "supports-path-mapping" : "1" ,
262- },
273+ execution_requirements = _EXTRACT_EXECUTION_REQUIREMENTS ,
263274 toolchain = Label ("@tar.bzl//tar/toolchain:type" ),
264275
265276 # Always override the locale to give better hermeticity.
0 commit comments