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
Remove huge JavaScript parsers from Prettier core to reduce package size #13912
Comments
I prefer separate Node.js version and standalone version first, because all parsers( BTW, the package name should be - @prettier/plugin-parser-typescript
+ @prettier/plugin-typescript |
What is standard version?
The name |
standalone , sorry. |
Printer is not required to be a plugin, and printer can be included if we publish plugins separately. |
For the file structure, I prefer
Except for the js plugins, they can even still stay in |
Make our codebase monorepo may also break "install-from-github" feature, I don't think |
With the structure you showed, users will have to use |
No, we'll add them to |
Okay, if we provide packages in the style of Jest, no problem. |
Just a personal opinion: if we go ahead with #6286 in the future, this will have the same impact. |
#13818 (comment)
Overview
Prettier package includes too many JavaScript parsers. And it makes the size of the npm package much larger than it needs to be.
So, I propose the change to keep only the limited parsers that are really needed in the core, and provide and maintain the rest as external parser plugins.
How
Only
babel
,babel-flow
, andbabel-ts
remain in the Prettier core. Other parserstypescript
,acorn
,espree
,meriyah
, andflow
are provided as external plugins(with names like@prettier/plugin-parser-typescript
for example).This will also make it easier to introduce new parsers. For example, we could provide a hermes and SWC as a JavaScript parser for Prettier.
1. monorepo
With this change we will have to publish multiple packages(I thinks parsers packages version should be synchronized with the core).
Also we need to share common postprocess and test cases for JS parsers.
So I think we can introduce monorepo by Yarn workspace like below:
(There may be other things that should be in the internal package that I forgot.)
This is a difficult change to revert and should be discussed thoroughly.
2. multiple repositories
Just maintain and develop each parser as a separate repository
e.g.
github.com/prettier/plugin-parser-typescript
,github.com/prettier/plugin-parser-meriyah
, etcWhat do you think?
The text was updated successfully, but these errors were encountered: