Skip to content
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

Track Angular polyfills #913

Merged
merged 3 commits into from
Jan 17, 2025
Merged

Conversation

davidlj95
Copy link
Contributor

Tracks Angular polyfills build option

Bears in mind that either an array or a string can be passed as option in browser, karma and browser ESBuild builders. In the newer application builder, just an array can be passed though.

Copy link

pkg-pr-new bot commented Jan 13, 2025

Open in Stackblitz

npm i https://pkg.pr.new/knip@913

commit: 8e917ee

@davidlj95 davidlj95 force-pushed the track-angular-polyfills branch from 6753510 to 0c75e54 Compare January 13, 2025 19:00
@davidlj95 davidlj95 marked this pull request as ready for review January 13, 2025 19:29
Copy link
Collaborator

@webpro webpro left a comment

Choose a reason for hiding this comment

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

Thanks David! One note I have.

"polyfills": [
"zone.js"
],
"polyfills": "src/polyfill.js",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are polyfills potentially external? I.e. the zone.js example might be a package reference, which should then go into toDeferResolve. Knip will try to resolve the specifier and mark the external dependency as (un)used or use the internal path as an entry file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely! They may be external. Just pushed 1a78aae to take that into account. Just out of curiosity, what's the difference between toDeferResolve and toDeferResolveEntry? 🤔

Thanks :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Checked also that no other option allows for external imports. At least for the application builder https://github.com/angular/angular-cli/blob/main/packages/angular/build/src/builders/application/schema.json#L78 but from what I can't recall that's the same behaviour for previous builders too

Copy link
Collaborator

Choose a reason for hiding this comment

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

Absolutely! They may be external. Just pushed 1a78aae to take that into account. Just out of curiosity, what's the difference between toDeferResolve and toDeferResolveEntry? 🤔

Thanks :)

The fact that I had to look this up isn't great 😅

  • toDeferResolve: needs, resolving, reported as unresolved if that's the case
  • toDeferResolveEntry: needs resolving, meant as entry file, ignored if file doesn't exist
  • toEntry: doesn't need extra resolving, ignored if file doesn't exist

Will try to come up with better names/docs. Suggestions welcome :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hahah naming is hard! thanks for looking it up 😊 can't think of better ones rn :S

@davidlj95
Copy link
Contributor Author

https://github.com/webpro-nl/knip/actions/runs/12816992432/job/35739213460 failed but doesn't seem related to this change

@webpro webpro merged commit e568802 into webpro-nl:main Jan 17, 2025
22 of 23 checks passed
@webpro
Copy link
Collaborator

webpro commented Jan 17, 2025

🚀 This pull request is included in v5.42.2. See Release 5.42.2 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.

@davidlj95 davidlj95 deleted the track-angular-polyfills branch January 17, 2025 10:23
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.

2 participants