Skip to content

chore: setIsSelfAccepting param to isSelfAccepting#10960

Closed
patak-cat wants to merge 1 commit intomainfrom
chore/refactor-set-is-self-accepting
Closed

chore: setIsSelfAccepting param to isSelfAccepting#10960
patak-cat wants to merge 1 commit intomainfrom
chore/refactor-set-is-self-accepting

Conversation

@patak-cat
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
Contributor

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
Contributor

@aleclarson aleclarson Nov 16, 2022

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
Contributor

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-cat patak-cat 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.

2 participants