Skip to content

Commit

Permalink
perf: don't set JsInfo declarations and transitive_declarations in np…
Browse files Browse the repository at this point in the history
…m_link_package_store
  • Loading branch information
gregmagolan committed Mar 29, 2024
1 parent c818a5c commit 33afa7f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
16 changes: 2 additions & 14 deletions js/private/test/js_library_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,9 @@ def _declarations_test_impl(ctx):

# transitive_declarations should have the source declarations and transitive declarations
transitive_declarations = target_under_test[JsInfo].transitive_declarations.to_list()

# the transitive count might be 3 or 4 depending on the type of symlink created.
# See utils.make_symlink()
asserts.true(env, len(transitive_declarations) == 3 or len(transitive_declarations) == 4)
asserts.true(env, len(transitive_declarations) == 2)
asserts.true(env, transitive_declarations[0].path.find("/importing.d.ts") != -1)
asserts.true(env, transitive_declarations[1].path.find("/data.json") != -1)
asserts.true(env, transitive_declarations[2].path.find("/@types/node") != -1)
if len(transitive_declarations) == 4:
asserts.true(env, transitive_declarations[3].path.find("/@types/node") != -1)

# types OutputGroupInfo should be the same as direct declarations
asserts.equals(env, declarations, target_under_test[OutputGroupInfo].types.to_list())
Expand All @@ -66,15 +60,9 @@ def _explicit_declarations_test_impl(ctx):

# transitive_declarations should have the source declarations and transitive declarations
transitive_declarations = target_under_test[JsInfo].transitive_declarations.to_list()

# the transitive count might be 3 or 4 depending on the type of symlink created.
# See utils.make_symlink()
asserts.true(env, len(transitive_declarations) == 3 or len(transitive_declarations) == 4)
asserts.true(env, len(transitive_declarations) == 2)
asserts.true(env, transitive_declarations[0].path.find("/data.json") != -1)
asserts.true(env, transitive_declarations[1].path.find("/index.js") != -1)
asserts.true(env, transitive_declarations[2].path.find("/@types/node") != -1)
if len(transitive_declarations) == 4:
asserts.true(env, transitive_declarations[3].path.find("/@types/node") != -1)

# types OutputGroupInfo should be the same as direct declarations
asserts.equals(env, declarations, target_under_test[OutputGroupInfo].types.to_list())
Expand Down
3 changes: 0 additions & 3 deletions npm/private/npm_link_package_store.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ def _npm_link_package_store_impl(ctx):
runfiles = ctx.runfiles(transitive_files = transitive_files_depset),
),
js_info(
# assume a directory contains declarations since we can't know that it doesn't
declarations = files_depset,
transitive_declarations = transitive_files_depset,
npm_linked_package_files = files_depset,
npm_linked_packages = depset([npm_linked_package_info]),
# only propagate non-dev npm dependencies to use as direct dependencies when linking downstream npm_package targets with npm_link_package
Expand Down

0 comments on commit 33afa7f

Please sign in to comment.