Possibility to read in config at debug instance creation instead of at first (version) require/ import?
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 20/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript
- Lĩnh vực
- tooling
Hướng nghiên cứu
Start by reading the NodeJS implementation and tracing when configuration is read during require/import versus debugger creation. Compare the two examples in the issue, then define the intended behavior for independently loaded debug versions and programmatic environment changes before determining what tests are needed.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I love debug's simplicity, but it bugs me that it is so tightly coupled to environment variables (NodeJS impl)
I would like to integrate it in Metalsmith along with an abstraction of env.
Basically, as soon as a package where debug is used, is require'd, or perhaps with some NPM-derivatives, if multiple packages use the same version, debug reads its defaults from the environment.
const pkgContainingDebug = require('pkg-with-debug') // debug config set according to DEBUG_COLORS= (not defined)
process.env.DEBUG_COLORS = false
const localDebug = require('debug') // debug config takes into account dynamically set process.env.DEBUG_COLORS
const localDebugger= localDebug('app') // nothing happens here config-wise
localDebugger('Hello world')
pkgContainingDebug() // different config from localDebugger
This makes it impossible (in my case for metalsmith) to provide a user with a programmatic way of setting debug values, unless the current package + all its dependencies use the same debug dependency (other typical use case: expressjs)
If the env reading was done at debugger creation instead of require, this would provide a window to decouple the tight coupling of debug configuration and env vars across debug dependencies
const pkgContainingDebug = require('pkg-with-debug') // debug config not initialized unless dependency instantiates it at inclusion
const localDebug = require('debug') // does nothing yet
process.env.DEBUG_COLORS = false
const localDebugger= localDebug('app') // reads in env
localDebugger('Hello world')
pkgContainingDebug() // same config as localDebugger if the dependency's debugger only happens when the dep is first run
Hope this makes sense.
I haven't had the time to dive into the codebase for this yet
- Ngôn ngữ chính
- JavaScript
- Star
- 11.5k
- Fork
- 992
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của debug-js/debug
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
Debug as JSON Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
console.group and groupCollapsed Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 28/100
Tất cả issue của debug-js/debug
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Daemon passes --experimental-wasm-jspi unconditionally on Node >= 24; Node 26 rejects the flag Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Automattic/studio#4908 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
sugarlabs/musicblocks#8847 ·