Skip to content

Commit acfe939

Browse files
authored
perf(deps): replace debug with obug (#21107)
1 parent 0a86262 commit acfe939

File tree

8 files changed

+685
-694
lines changed

8 files changed

+685
-694
lines changed

.github/renovate.json5

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636

3737
// breaking changes
3838
"kill-port", // `kill-port:^2.0.0 has perf issues (#8392)
39+
40+
// v1 is a drop-in replacement for debug, while v2 introduces breaking changes
41+
"obug",
3942
],
4043
"github-actions": {
4144
"managerFilePatterns": [

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"@types/babel__preset-env": "^7.10.0",
4747
"@types/convert-source-map": "^2.0.3",
4848
"@types/cross-spawn": "^6.0.6",
49-
"@types/debug": "^4.1.12",
5049
"@types/estree": "^1.0.8",
5150
"@types/etag": "^1.8.4",
5251
"@types/less": "^3.0.8",
@@ -65,7 +64,7 @@
6564
"picocolors": "^1.1.1",
6665
"playwright-chromium": "^1.56.1",
6766
"prettier": "3.6.2",
68-
"rolldown": "^1.0.0-beta.50",
67+
"rolldown": "^1.0.0-beta.51",
6968
"rollup": "^4.43.0",
7069
"simple-git-hooks": "^2.13.1",
7170
"tsx": "^4.20.6",

packages/vite/LICENSE.md

Lines changed: 22 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -534,33 +534,6 @@ Repository: https://github.com/mathiasbynens/cssesc
534534
535535
---------------------------------------
536536

537-
## debug
538-
License: MIT
539-
By: Josh Junon, TJ Holowaychuk, Nathan Rajlich, Andrew Rhyne
540-
Repository: https://github.com/debug-js/debug
541-
542-
> (The MIT License)
543-
>
544-
> Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
545-
> Copyright (c) 2018-2021 Josh Junon
546-
>
547-
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software
548-
> and associated documentation files (the 'Software'), to deal in the Software without restriction,
549-
> including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
550-
> and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
551-
> subject to the following conditions:
552-
>
553-
> The above copyright notice and this permission notice shall be included in all copies or substantial
554-
> portions of the Software.
555-
>
556-
> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
557-
> LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
558-
> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
559-
> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
560-
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
561-
562-
---------------------------------------
563-
564537
## dotenv
565538
License: BSD-2-Clause
566539
Repository: https://github.com/motdotla/dotenv
@@ -1322,13 +1295,14 @@ Repository: https://github.com/lukeed/mrmime
13221295
13231296
---------------------------------------
13241297

1325-
## ms
1298+
## normalize-path
13261299
License: MIT
1327-
Repository: https://github.com/vercel/ms
1300+
By: Jon Schlinkert, Blaine Bublitz
1301+
Repository: https://github.com/jonschlinkert/normalize-path
13281302

13291303
> The MIT License (MIT)
13301304
>
1331-
> Copyright (c) 2020 Vercel, Inc.
1305+
> Copyright (c) 2014-2018, Jon Schlinkert.
13321306
>
13331307
> Permission is hereby granted, free of charge, to any person obtaining a copy
13341308
> of this software and associated documentation files (the "Software"), to deal
@@ -1337,27 +1311,27 @@ Repository: https://github.com/vercel/ms
13371311
> copies of the Software, and to permit persons to whom the Software is
13381312
> furnished to do so, subject to the following conditions:
13391313
>
1340-
> The above copyright notice and this permission notice shall be included in all
1341-
> copies or substantial portions of the Software.
1314+
> The above copyright notice and this permission notice shall be included in
1315+
> all copies or substantial portions of the Software.
13421316
>
13431317
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13441318
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13451319
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13461320
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13471321
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1348-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1349-
> SOFTWARE.
1322+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1323+
> THE SOFTWARE.
13501324
13511325
---------------------------------------
13521326

1353-
## normalize-path
1327+
## object-assign
13541328
License: MIT
1355-
By: Jon Schlinkert, Blaine Bublitz
1356-
Repository: https://github.com/jonschlinkert/normalize-path
1329+
By: Sindre Sorhus
1330+
Repository: https://github.com/sindresorhus/object-assign
13571331

13581332
> The MIT License (MIT)
13591333
>
1360-
> Copyright (c) 2014-2018, Jon Schlinkert.
1334+
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
13611335
>
13621336
> Permission is hereby granted, free of charge, to any person obtaining a copy
13631337
> of this software and associated documentation files (the "Software"), to deal
@@ -1379,14 +1353,16 @@ Repository: https://github.com/jonschlinkert/normalize-path
13791353
13801354
---------------------------------------
13811355

1382-
## object-assign
1356+
## obug
13831357
License: MIT
1384-
By: Sindre Sorhus
1385-
Repository: https://github.com/sindresorhus/object-assign
1358+
By: Kevin Deng
1359+
Repository: https://github.com/sxzz/obug
13861360

13871361
> The MIT License (MIT)
13881362
>
1389-
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
1363+
> Copyright © 2025-PRESENT Kevin Deng (https://github.com/sxzz)
1364+
> Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
1365+
> Copyright (c) 2018-2021 Josh Junon
13901366
>
13911367
> Permission is hereby granted, free of charge, to any person obtaining a copy
13921368
> of this software and associated documentation files (the "Software"), to deal
@@ -1395,16 +1371,16 @@ Repository: https://github.com/sindresorhus/object-assign
13951371
> copies of the Software, and to permit persons to whom the Software is
13961372
> furnished to do so, subject to the following conditions:
13971373
>
1398-
> The above copyright notice and this permission notice shall be included in
1399-
> all copies or substantial portions of the Software.
1374+
> The above copyright notice and this permission notice shall be included in all
1375+
> copies or substantial portions of the Software.
14001376
>
14011377
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14021378
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14031379
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14041380
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14051381
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1406-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1407-
> THE SOFTWARE.
1382+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1383+
> SOFTWARE.
14081384
14091385
---------------------------------------
14101386

packages/vite/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
"convert-source-map": "^2.0.0",
113113
"cors": "^2.8.5",
114114
"cross-spawn": "^7.0.6",
115-
"debug": "^4.4.3",
115+
"obug": "^1.0.2",
116116
"dotenv": "^17.2.3",
117117
"dotenv-expand": "^12.0.3",
118118
"es-module-lexer": "^1.7.0",
@@ -137,8 +137,8 @@
137137
"postcss-modules": "^6.0.1",
138138
"premove": "^4.0.0",
139139
"resolve.exports": "^2.0.3",
140-
"rolldown": "^1.0.0-beta.50",
141-
"rolldown-plugin-dts": "^0.17.8",
140+
"rolldown": "^1.0.0-beta.51",
141+
"rolldown-plugin-dts": "^0.18.0",
142142
"rollup-plugin-license": "^3.6.0",
143143
"sass": "^1.94.0",
144144
"sass-embedded": "^1.93.3",

packages/vite/rolldown.config.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ const nodeConfig = defineConfig({
7575
index: path.resolve(__dirname, 'src/node/index.ts'),
7676
cli: path.resolve(__dirname, 'src/node/cli.ts'),
7777
},
78-
resolve: {
79-
alias: {
80-
// we can always use node version (the default entry point has browser support)
81-
debug: 'debug/src/node.js',
82-
},
83-
},
8478
external: [
8579
/^vite\//,
8680
'fsevents',

packages/vite/src/node/utils.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import fsp from 'node:fs/promises'
1414
import remapping from '@jridgewell/remapping'
1515
import type { DecodedSourceMap, RawSourceMap } from '@jridgewell/remapping'
1616
import colors from 'picocolors'
17-
import debug from 'debug'
17+
import type { Debugger } from 'obug'
18+
import debug from 'obug'
1819
import type MagicString from 'magic-string'
1920
import type { Equal } from '@type-challenges/utils'
2021

@@ -183,13 +184,11 @@ export type ViteDebugScope = `vite:${string}`
183184
export function createDebugger(
184185
namespace: ViteDebugScope,
185186
options: DebuggerOptions = {},
186-
): debug.Debugger['log'] | undefined {
187+
): Debugger['log'] | undefined {
187188
const log = debug(namespace)
188189
const { onlyWhenFocused, depth } = options
189190

190-
// @ts-expect-error - The log function is bound to inspectOpts, but the type is not reflected
191191
if (depth && log.inspectOpts && log.inspectOpts.depth == null) {
192-
// @ts-expect-error - The log function is bound to inspectOpts, but the type is not reflected
193192
log.inspectOpts.depth = options.depth
194193
}
195194

0 commit comments

Comments
 (0)