question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

False detection of potential dependency

See original GitHub issue

Type of Issue

[x] Bug Report
[ ] Feature Request

Description

The source analyser will detect internal, dependant package via this logic:

https://github.com/ng-packagr/ng-packagr/blob/c2efc42591ea8f2581cb7c8d3ea16a6b9cfa526e/src/lib/ng-package/entry-point/analyse-sources.transform.ts#L62-L71

This matching logic is very simple, assuming every module resolved that starts with the current package name is a secondary, internal package. This is not always the case.

There are several scenarios that can fail this.

For example, I have a package @scope/A and an internal package @scope/A/B

@scope/A does import from @scope/B thus it will get picked up by the logic above, at some point.
However, if I reference an internal part in @scope/B, like @scope/B/internal/path it will get caught and since it’s not actually a library it will throw an exception

ERROR: Entry point @scope/B/internal/path which is required by @scope/A doesn't exists.

Now, we might say that referencing @scope/B/internal/path might not be valid and we better reference it in a relative way, which is OK i guess.

However, i’m not physically referencing it, in my scenario i’m just augmenting a type in @scope/B which is located at @scope/B/internal/path.

declare module '@scope/B/internal/path' {
  interface MyAugmentedInterface {
    str: string;
  }
}

This one goes through the resolution pipeline, although type only, and so throws an exception.

In general the logic to detected internal packages is very inclusive and I didn’t find an option that allows setting excluded paths or some way of modifiying the behaviour.

I don’t want to augment via relative paths because the output structure might not fit the source file structure. So the location of the augmented .d.ts in the output dist should not be relative but absolute. When absolute it will work in development as well as packaged

Regardless, personally I think that this method of detecting child packages is very “generous”. Maybe some conventions should be in place. For example, the directory of the child path must have a package.json with at least the “name” property of the package included. This looks like a reasonable convention to me.

Version Information

ng-packagr:            12.0.0
@angular/compiler:     12.0.0
rollup:                2.48.0
typescript:            4.2.4

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
alan-agius4commented, Jun 9, 2021

@JoMen6 & @dschwank, I have a fix for your case https://github.com/ng-packagr/ng-packagr/pull/2003 which will be released later on today.

1reaction
JoMen6commented, Jun 10, 2021

@alan-agius4 It works, thank you very much 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

False Discovery Rate - Mailman School of Public Health
Controlling for the false discovery rate (FDR) is a way to identify as many significant features as possible while incurring a relatively low ......
Read more >
Considering dependence among genes and markers for false ...
Results: In this article, we propose to consider both the mean as well as the variance of false discovery number for multiple comparison...
Read more >
Detecting and avoiding likely false‐positive findings – a ...
A much less obvious form of multiple testing happens when researchers fit complex models to explain variation in a dependent variable by a ......
Read more >
[1905.00357] Web Test Dependency Detection - arXiv
Our approach employs string analysis to extract an approximated set of dependencies from the test code. It then filters potential false ...
Read more >
Urine Drug Screening: Minimizing False-Positives and False ...
False -Positives: In addition to false-negatives, pharmacists need to consider the potential for false-positive UDS results and be aware of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found