-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Expose timing information in debug mode #14553
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
port
env.DEBUG from v3
- Loading branch information
commit 8accc9c048f2765f8a485a6f0467414560af1066
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| export const DEBUG = typeof process !== 'undefined' ? resolveDebug(process.env.DEBUG) : false | ||
|
|
||
| function resolveDebug(debug: typeof process.env.DEBUG) { | ||
| if (debug === undefined) { | ||
| return false | ||
| } | ||
|
|
||
| // Environment variables are strings, so convert to boolean | ||
| if (debug === 'true' || debug === '1') { | ||
| return true | ||
| } | ||
|
|
||
| if (debug === 'false' || debug === '0') { | ||
| return false | ||
| } | ||
|
|
||
| // Keep the debug convention into account: | ||
| // DEBUG=* -> This enables all debug modes | ||
| // DEBUG=projectA,projectB,projectC -> This enables debug for projectA, projectB and projectC | ||
| // DEBUG=projectA:* -> This enables all debug modes for projectA (if you have sub-types) | ||
| // DEBUG=projectA,-projectB -> This enables debug for projectA and explicitly disables it for projectB | ||
|
|
||
| if (debug === '*') { | ||
| return true | ||
| } | ||
|
|
||
| let debuggers = debug.split(',').map((d) => d.split(':')[0]) | ||
|
|
||
| // Ignoring tailwindcss | ||
| if (debuggers.includes('-tailwindcss')) { | ||
| return false | ||
| } | ||
|
|
||
| // Including tailwindcss | ||
| if (debuggers.includes('tailwindcss')) { | ||
| return true | ||
| } | ||
|
|
||
| return false | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are your thoughts of moving this into the node specific library instead? This way we don't need to be too defensive with accessing
process.envand we can use a proper export for the three clients instead of having to rely on private bundled imports:Could also be maybe a
tailwindcss-sharedprivate package that we only use for this. It just seems strange that this file is in thetailwindcsspackage but not part of the releasedtailwindcssnpm package at all