-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore: modularize server code #12596
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
Conversation
|
One thing that I've been wanting to do for a long time, but which #12530 really brought to a head, is to modularize certain parts of the codebase a lot more. It's just no good to have modules with multiple thousands of lines of code — it's impossible to create a good mental map of the codebase, and it leads to a messy and disorganized structure. It's much easier to repeatedly toggle between two side-by-side modules than it is to repeatedly scroll up and down a thousand lines, past reams of stuff that's irrelevant to my current task, when dealing with two interconnected functions.
There are other benefits:
Cmd-P if
in VSCode, it's much easier to find the compiler code if I can doCmd-P serIfB
to find anIfBlock.js
inside aserver
directory. Right now I tend to doCmd-Shift-F
and search forIfBlock(
which is much slower (have to use keyboard and mouse together to avoid painful keyboard-only navigation, and can't use fuzzy matching)I'm starting with server transform visitors, because that's probably the least disruptive place to get the hang of this, but it's far from the only part of the codebase that needs this treatment.
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint