Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita5ecc06

Browse files
committed
feat: removedebug as a dependency
1 parent616b2d3 commita5ecc06

25 files changed

+107
-65
lines changed

‎.changeset/dependabot-2838997856.md‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎.changeset/smart-mugs-tap.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'lint-staged':patch
3+
---
4+
5+
Remove[debug](https://github.com/debug-js/debug) as a dependency due to recent malware issue; read more athttps://github.com/debug-js/debug/issues/1005. Because of this, the`DEBUG` environment variable is no longer supported — use the`--debug` to enable debugging

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ By default tasks run in the current working directory. Use the `--cwd some/direc
156156

157157
Run in debug mode. When set, it does the following:
158158

159-
-uses[debug](https://github.com/visionmedia/debug) internally tolog additional information about staged files, commands being executed, location of binaries, etc. Debug logs, which are automatically enabled by passing the flag, can also be enabled by setting the environment variable`$DEBUG` to`lint-staged*`.
159+
- log additional information about staged files, commands being executed, location of binaries, etc.
160160
- uses[`verbose` renderer](https://listr2.kilic.dev/renderers/verbose-renderer/) for`listr2`; this causes serial, uncoloured output to the terminal, instead of the default (beautified, dynamic) output.
161161
(the[`verbose` renderer](https://listr2.kilic.dev/renderers/verbose-renderer/) can also be activated by setting the`TERM=dumb` or`NODE_ENV=test` environment variables)
162162

‎bin/lint-staged.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
import{userInfo}from'node:os'
44

55
import{Option,program}from'commander'
6-
importdebugfrom'debug'
76

7+
import{createDebug,enableDebug}from'../lib/debug.js'
88
importlintStagedfrom'../lib/index.js'
99
import{CONFIG_STDIN_ERROR,RESTORE_STASH_EXAMPLE}from'../lib/messages.js'
1010
import{readStdin}from'../lib/readStdin.js'
1111
import{getVersion}from'../lib/version.js'
1212

13-
constdebugLog=debug('lint-staged:bin')
13+
constdebugLog=createDebug('lint-staged:bin')
1414

1515
// Do not terminate main Listr process on SIGINT
1616
process.on('SIGINT',()=>{})
@@ -126,7 +126,7 @@ program
126126
constcliOptions=program.parse(process.argv).opts()
127127

128128
if(cliOptions.debug){
129-
debug.enable('lint-staged*')
129+
enableDebug()
130130
}
131131

132132
constoptions={

‎lib/chunkFiles.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
importpathfrom'node:path'
22

3-
importdebugfrom'debug'
4-
3+
import{createDebug}from'./debug.js'
54
import{normalizePath}from'./normalizePath.js'
65

7-
constdebugLog=debug('lint-staged:chunkFiles')
6+
constdebugLog=createDebug('lint-staged:chunkFiles')
87

98
/**
109
* Chunk array into sub-arrays

‎lib/debug.js‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import{formatWithOptions}from'node:util'
2+
3+
import{blackBright,SUPPORTS_COLOR}from'./colors.js'
4+
5+
constformat=(...args)=>formatWithOptions({colors:SUPPORTS_COLOR}, ...args)
6+
7+
letactiveLogger
8+
9+
exportconstenableDebug=(logger=console)=>{
10+
if(!activeLogger){
11+
activeLogger=logger
12+
}
13+
}
14+
15+
/**@param {string} name */
16+
exportconstcreateDebug=(name)=>{
17+
letprevious=process.hrtime.bigint()
18+
19+
return(...args)=>{
20+
if(!activeLogger)return
21+
22+
constnow=process.hrtime.bigint()
23+
constms=(now-previous)/1_000_000n
24+
previous=now
25+
activeLogger.debug(blackBright(name+': ')+format(...args)+blackBright(` +${ms}ms`))
26+
}
27+
}

‎lib/execGit.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
importdebugfrom'debug'
21
importspawn,{SubprocessError}from'nano-spawn'
32

4-
constdebugLog=debug('lint-staged:execGit')
3+
import{createDebug}from'./debug.js'
4+
5+
constdebugLog=createDebug('lint-staged:execGit')
56

67
/**
78
* Explicitly never recurse commands into submodules, overriding local/global configuration.

‎lib/file.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
importfsfrom'node:fs/promises'
22

3-
importdebugfrom'debug'
3+
import{createDebug}from'./debug.js'
44

5-
constdebugLog=debug('lint-staged:file')
5+
constdebugLog=createDebug('lint-staged:file')
66

77
/**
88
* Read contents of a file to buffer

‎lib/generateTasks.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
importpathfrom'node:path'
22

3-
importdebugfrom'debug'
43
importmicromatchfrom'micromatch'
54

5+
import{createDebug}from'./debug.js'
66
import{normalizePath}from'./normalizePath.js'
77

8-
constdebugLog=debug('lint-staged:generateTasks')
8+
constdebugLog=createDebug('lint-staged:generateTasks')
99

1010
/**
1111
* Generates all task commands, and filelist

‎lib/getFunctionTask.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
importdebugfrom'debug'
2-
1+
import{createDebug}from'./debug.js'
32
import{makeErr}from'./getSpawnedTask.js'
43

5-
constdebugLog=debug('lint-staged:getFunctionTasks')
4+
constdebugLog=createDebug('lint-staged:getFunctionTasks')
65

76
/**
87
*@typedef {{ title: string; task: Function }} FunctionTask

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp