Skip to content

Commit e256fe8

Browse files
authored
perf(fmt): reduce Yuku plugin bundle size (#165)
1 parent d30c190 commit e256fe8

8 files changed

Lines changed: 851 additions & 58 deletions

File tree

packages/rstack/THIRD_PARTY_NOTICES.md

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2929
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3030
SOFTWARE.
3131

32-
## @prettier/plugin-yuku
32+
## Prettier yuku parser adapter
3333

34-
This package includes bundled code from
35-
[@prettier/plugin-yuku](https://github.com/prettier/prettier/tree/main/packages/plugin-yuku).
34+
The local Yuku parser adapter includes portions derived from
35+
[@prettier/plugin-yuku](https://github.com/prettier/prettier/tree/main/packages/plugin-yuku)
36+
and Prettier's JavaScript parser postprocessing. The adapter reuses the public
37+
ESTree printer, formatter options, and parser utilities from the installed
38+
`prettier` package.
3639

3740
License: MIT
3841

@@ -56,38 +59,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5659
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
5760
SOFTWARE.
5861

59-
The bundled plugin also contains MIT-licensed code from:
60-
61-
- emoji-regex 10.6.0, copyright Mathias Bynens
62-
- escape-string-regexp 5.0.0, copyright Sindre Sorhus
63-
- get-east-asian-width 1.6.0, copyright Sindre Sorhus
64-
- index-to-position 1.2.0, copyright Sindre Sorhus
65-
- is-es5-identifier-name 1.0.1, copyright fisker Cheung
66-
- jest-docblock 30.4.0, copyright Meta Platforms, Inc. and Jest contributors
67-
- narrow-emojis 0.0.3, copyright fisker Cheung
68-
- Prettier 3.10.0-dev, copyright James Long and contributors
69-
- to-fast-properties 4.0.0, copyright Petka Antonov, Benjamin Gruenbaum,
70-
John-David Dalton, and Sindre Sorhus
71-
- trim-newlines 5.0.0, copyright Sindre Sorhus
72-
73-
Permission is hereby granted, free of charge, to any person obtaining a copy of
74-
this software and associated documentation files (the "Software"), to deal in
75-
the Software without restriction, including without limitation the rights to
76-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
77-
of the Software, and to permit persons to whom the Software is furnished to do
78-
so, subject to the following conditions:
79-
80-
The above copyright notices and this permission notice shall be included in all
81-
copies or substantial portions of the Software.
82-
83-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
84-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
85-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
86-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
87-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
88-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
89-
SOFTWARE.
90-
9162
## fast-ignore
9263

9364
This package includes bundled code from [fast-ignore](https://github.com/fabiospampinato/fast-ignore).

packages/rstack/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
"yuku-parser": "catalog:"
6363
},
6464
"devDependencies": {
65-
"@prettier/plugin-yuku": "catalog:",
6665
"@rspress/core": "catalog:",
6766
"@rstackjs/load-config": "catalog:",
6867
"@rstackjs/test-utils": "catalog:",

packages/rstack/src/fmt/prettierPlugins.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as yukuPlugin from '@prettier/plugin-yuku';
21
import type { Options as PrettierOptions, Plugin } from 'prettier';
32
import type { ResolvedFmtOptions } from './types.ts';
3+
import { yukuPlugin } from './yukuPlugin.ts';
44

55
type PrettierPlugins = NonNullable<PrettierOptions['plugins']>;
66

0 commit comments

Comments
 (0)