Skip to content

fix: include package.json in npm_sources #1919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jrandolf
Copy link

Fixed: #1918

Copy link

aspect-workflows bot commented Sep 16, 2024

Test

All tests were cache hits

213 tests (100.0%) were fully cached saving 31s.


Test

e2e/bzlmod

All tests were cache hits

5 tests (100.0%) were fully cached saving 502ms.


Test

e2e/gyp_no_install_script

All tests were cache hits

2 tests (100.0%) were fully cached saving 183ms.


Test

e2e/js_image_oci

All tests were cache hits

1 test (100.0%) was fully cached saving 8s.


Test

e2e/npm_link_package

All tests were cache hits

3 tests (100.0%) were fully cached saving 448ms.


Test

e2e/npm_link_package-esm

All tests were cache hits

3 tests (100.0%) were fully cached saving 533ms.


Test

e2e/npm_translate_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 30ms.


Test

e2e/npm_translate_lock_empty

All tests were cache hits

1 test (100.0%) was fully cached saving 30ms.


Test

e2e/npm_translate_lock_multi

All tests were cache hits

2 tests (100.0%) were fully cached saving 268ms.


Test

e2e/npm_translate_lock_partial_clone

All tests were cache hits

1 test (100.0%) was fully cached saving 31ms.


Test

e2e/npm_translate_lock_replace_packages

All tests were cache hits

3 tests (100.0%) were fully cached saving 603ms.


Test

e2e/npm_translate_lock_subdir_patch

All tests were cache hits

1 test (100.0%) was fully cached saving 98ms.


Test

e2e/npm_translate_package_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 31ms.


Test

e2e/npm_translate_yarn_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 31ms.


Test

e2e/package_json_module

All tests were cache hits

1 test (100.0%) was fully cached saving 253ms.


Test

e2e/pnpm_lockfiles

All tests were cache hits

42 tests (100.0%) were fully cached saving 3s.


Test

e2e/pnpm_workspace

All tests were cache hits

10 tests (100.0%) were fully cached saving 2s.


Test

e2e/pnpm_workspace_rerooted

All tests were cache hits

12 tests (100.0%) were fully cached saving 2s.


Test

e2e/repo_mapping

All tests were cache hits

3 tests (100.0%) were fully cached saving 404ms.


Test

e2e/rules_foo

All tests were cache hits

2 tests (100.0%) were fully cached saving 187ms.


Test

e2e/runfiles

All tests were cache hits

1 test (100.0%) was fully cached saving 173ms.


Test

e2e/vendored_node

All tests were cache hits

1 test (100.0%) was fully cached saving 99ms.


Buildifier      Format

@jbedard
Copy link
Member

jbedard commented Sep 16, 2024

Can you write a test demonstrating the issue and confirming the change fixes it?

I think we'll want to find a solution not involving .to_list() but lets start with a test...

@jrandolf
Copy link
Author

jrandolf commented Sep 16, 2024

@jbedard Sorry, it's a little time-consuming to write a test for this one; I don't have capacity at the moment.

More specifically, the issue occurs when you try to use a linked js_library as a ts_library dependency. Because package.json is excluded (due to #1850), the ts_library will not resolve imports properly because there is no package.json to look for (which usually contains export declarations).

@@ -402,6 +402,12 @@ deps of npm_package_store must be in the same package.""" % (ctx.label.package,
for npm_package_store_info in npm_package_store_infos:
transitive_files_depsets.append(npm_package_store_info.files)

for jsinfo in js_infos:
for source in jsinfo.sources.to_list():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't use to_list() like this and will need a better solution if a fix like this is required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: No longer able to reference js_library's after https://github.com/aspect-build/rules_js/pull/1850
2 participants