mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
Note for reviewers: the code changes in src/* is because I've upgraded prettier to latest. the @prettier/plugin-oxc it self only improve performance and doesnt affect format rules ## Summary Integrates `@prettier/plugin-oxc` to improve Prettier performance by ~20%. The oxc plugin provides a faster parser written in Rust, significantly speeding up formatting operations across the codebase. ## Changes - Added `@prettier/plugin-oxc` as dev dependency - Updated `.prettierrc` to use oxc plugin alongside existing sort-imports plugin - Added `scripts/benchmark-prettier.js` to measure performance improvements - Updated `knip.config.ts` to ignore the oxc plugin - Updated `eslint.config.ts` to ignore the benchmark script ## Benchmark Results Ran 3 benchmarks comparing formatting performance on the entire codebase: **Without oxc:** - Median: 32.76s - Average: 32.89s - Min: 32.49s - Max: 33.43s **With oxc:** - Median: 26.13s - Average: 26.35s - Min: 25.24s - Max: 27.69s **Improvement: 20.26% faster (6.64s saved)** ## Testing The benchmark script can be run with: ```bash node scripts/benchmark-prettier.js ``` This will: 1. Test formatting performance without oxc plugin 2. Test formatting performance with oxc plugin 3. Display comparison results 4. Restore original configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6088-feat-Add-prettier-plugin-oxc-for-faster-formatting-28e6d73d365081aabb24d3af98c11bb0) by [Unito](https://www.unito.io) --------- Co-authored-by: DrJKL <DrJKL0424@gmail.com> Co-authored-by: GitHub Action <action@github.com>
76 lines
2.1 KiB
TypeScript
76 lines
2.1 KiB
TypeScript
import type { KnipConfig } from 'knip'
|
|
|
|
const config: KnipConfig = {
|
|
workspaces: {
|
|
'.': {
|
|
entry: [
|
|
'{build,scripts}/**/*.{js,ts}',
|
|
'src/assets/css/style.css',
|
|
'src/main.ts',
|
|
'src/scripts/ui/menu/index.ts',
|
|
'src/types/index.ts'
|
|
],
|
|
project: ['**/*.{js,ts,vue}', '*.{js,ts,mts}']
|
|
},
|
|
'apps/desktop-ui': {
|
|
entry: ['src/main.ts', 'src/i18n.ts'],
|
|
project: ['src/**/*.{js,ts,vue}', '*.{js,ts,mts}']
|
|
},
|
|
'packages/tailwind-utils': {
|
|
project: ['src/**/*.{js,ts}']
|
|
},
|
|
'packages/design-system': {
|
|
entry: ['src/**/*.ts'],
|
|
project: ['src/**/*.{js,ts}', '*.{js,ts,mts}']
|
|
},
|
|
'packages/registry-types': {
|
|
project: ['src/**/*.{js,ts}']
|
|
}
|
|
},
|
|
ignoreBinaries: ['python3'],
|
|
ignoreDependencies: [
|
|
// Weird importmap things
|
|
'@iconify/json',
|
|
'@primeuix/forms',
|
|
'@primeuix/styled',
|
|
'@primeuix/utils',
|
|
'@primevue/icons'
|
|
],
|
|
ignore: [
|
|
// Auto generated manager types
|
|
'src/workbench/extensions/manager/types/generatedManagerTypes.ts',
|
|
'packages/registry-types/src/comfyRegistryTypes.ts',
|
|
// Used by a custom node (that should move off of this)
|
|
'src/scripts/ui/components/splitButton.ts',
|
|
// Service worker - registered at runtime via navigator.serviceWorker.register()
|
|
'public/auth-sw.js'
|
|
],
|
|
compilers: {
|
|
// https://github.com/webpro-nl/knip/issues/1008#issuecomment-3207756199
|
|
css: (text: string) =>
|
|
[...text.replaceAll('plugin', 'import').matchAll(/(?<=@)import[^;]+/g)]
|
|
.map((match) => match[0].replace(/url\(['"]?([^'"()]+)['"]?\)/, '$1'))
|
|
.join('\n')
|
|
},
|
|
vite: {
|
|
config: ['vite?(.*).config.mts']
|
|
},
|
|
vitest: {
|
|
config: ['vitest?(.*).config.ts'],
|
|
entry: [
|
|
'**/*.{bench,test,test-d,spec}.?(c|m)[jt]s?(x)',
|
|
'**/__mocks__/**/*.[jt]s?(x)'
|
|
]
|
|
},
|
|
playwright: {
|
|
config: ['playwright?(.*).config.ts'],
|
|
entry: ['**/*.@(spec|test).?(c|m)[jt]s?(x)', 'browser_tests/**/*.ts']
|
|
},
|
|
tags: [
|
|
'-knipIgnoreUnusedButUsedByCustomNodes',
|
|
'-knipIgnoreUnusedButUsedByVueNodesBranch'
|
|
]
|
|
}
|
|
|
|
export default config
|