Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor: replaceonce package with internal implementation#6591

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Phillip9587 wants to merge1 commit intoexpressjs:master
base:master
Choose a base branch
Loading
fromPhillip9587:replace-once

Conversation

@Phillip9587
Copy link
Member

This PR removes the externalonce package and replaces it with a modern, internal utility function. The goal is to reduce unnecessary dependencies and simplify the codebase without altering runtime behavior.

  • Removes two dependencies from the dependency tree:once andwrappy
  • Updates server startup logic (e.g.,app.listen) to use the new localonce function

No functional changes expected — behavior remains consistent with the previous implementation.

🔎 Originally introduced inexpressjs/express#3216

@Phillip9587Phillip9587 marked this pull request as ready for reviewJune 25, 2025 20:32
Copy link

CopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the external "once" package and "wrappy" from the dependency tree and replaces it with an internal utility function to simplify the codebase.

  • Removed external dependency "once" from package.json
  • Introduced an internal "once" implementation in lib/utils.js
  • Updated lib/application.js to reference the new internal implementation

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

FileDescription
package.jsonRemoved the "once" package dependency
lib/utils.jsAdded a new internal implementation of "once"
lib/application.jsUpdated the import to use the internal "once" function

Copy link
Member

@bjohansebasbjohansebas left a comment
edited
Loading

Choose a reason for hiding this comment

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

This has already been tried before, see#6555

@Phillip9587
Copy link
MemberAuthor

@bjohansebas I'm sorry I missed the earlier PR. I didn't get a chance to review it before it was closed. I thought we had a policy about leaving PRs open long enough to allow contributors to comment - maybe we can revisit that if needed.

I'd like to respond to a few points raised in#6555:

Removing this dep doesn't achieve anything because it is also used in other libraries that ship with express. We would need to duplicate this code into all of them.

I double-checked all 3 orgs, and as far as I can tell,express is the only package in our ecosystem depending ononce. I also rannpm ls once across a few bigger company projects, andexpress is the only dependency bringing it in.

Thanks for the PR! The change is valid, and the implementation looks fine. That said, I'd stick with the current use of once.
It was added intentionally in#3216 as a minimal, well-scoped alternative to ee-first. I prefer to keep small, purpose-built dependencies like this when they clearly express intent and don’t add meaningful overhead.
Inlining this logic doesn’t materially improve clarity or reduce maintenance cost, so I'd opt to keep it as is.

Totally understand that reasoning. However,once is only usedonce in the entire repo, and pulling in two external dependencies (once andwrappy) for such a small utility seems unnecessary - especially when the equivalent logic can be clearly expressed inline in modern JavaScript. If this logic were shared across multiple packages or reused in multiple places, I’d agree there’s more justification. But in this case, I believe simplifying it locally is a reasonable tradeoff.

Please don’t close this PR just yet.
I'd really appreciate it if we could keep the discussion open a bit longer to gather more feedback. Let’s keep the conversation respectful and focused on what’s best for the project long-term.

Thanks!

@Phillip9587Phillip9587 requested a review fromctcpipJune 25, 2025 21:20
@ctcpip
Copy link
Member

ctcpip commentedJun 25, 2025
edited
Loading

my position on this is unchanged. please see these particular comments:

pulling in two external dependencies (once and wrappy) for such a small utility seems unnecessary

pulling in dependencies is not a bad thing, andeliminating dependencies is not necessarily a good thing

note also that theonce library has a test suite, and this PR does not add any unit test coverage. (tests are generally required for PRs). that's not me saying to add tests now -- because I don't think we should land this change anyway. I'm only pointing out that tests are missing

in any case, as I said in the comment linked above, I think that further discussion is better suited for an actualdiscussion

@ctcpipctcpip marked this pull request as draftJune 25, 2025 21:39
ctcpip

This comment was marked as duplicate.

@bjohansebas
Copy link
Member

I still believe we shouldn't remove this dependency. I know my position isn't reflected in the PR, but I did share it on Slack, where I agreed with Jordan and, in general, with the other members who are opposed to removing this dependency to add it directly here.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@ctcpipctcpipctcpip requested changes

@bjohansebasbjohansebasbjohansebas requested changes

@wesleytoddwesleytoddAwaiting requested review from wesleytodd

@UlisesGasconUlisesGasconAwaiting requested review from UlisesGascon

@jonchurchjonchurchAwaiting requested review from jonchurch

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@Phillip9587@ctcpip@bjohansebas

[8]ページ先頭

©2009-2025 Movatter.jp