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

chore: setIsSelfAccepting param to isSelfAccepting #10960

Closed
wants to merge 1 commit into from

Conversation

patak-dev
Copy link
Member

Description

See #8898 (comment) for context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Comment on lines +368 to +373
{
isSelfAccepting:
canSkipImportAnalysis(url) || forceSkipImportAnalysis
? false
: undefined
}
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer to avoid an extra object allocation for now.

Btw, I handled this change in #7477. Maybe we can close this PR in favor of that, since it's not an urgent change?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think the extra allocation has any perf implications given everything else that is run when we create a new ModuleNode.
But seeing the errors in CI, the ModuleNode is a public API, and the setIsSelfAccepted param is documented at least in the code. So this is a small breaking change. I think forcing everybody to set false when creating a node is too disruptive. I'll close this PR, but I think we should leave setIsSelfAccepted untouched in your PR too. I don't think it is worth the disruption, I thought before that it would be something internal to core only.

Copy link
Member

Choose a reason for hiding this comment

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

It may be a public API, but it's also undocumented. If anything, we should add private to the constructor and see if anyone complains in the next alpha. 🤞 If someone opens an issue about it, we can discuss the use case, but I'm guessing that ensureEntryFromResolved, ensureEntryFromUrl, and createFileOnlyEntry cover them all.

Copy link
Member

Choose a reason for hiding this comment

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

Ah I just realized that setIsSelfAccepted isn't only a constructor argument. You might be right that it's just too dangerous to change the default.

@patak-dev patak-dev closed this Nov 16, 2022
@antfu antfu deleted the chore/refactor-set-is-self-accepting branch March 8, 2023 10:52
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.

None yet

2 participants