-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
chore: use debug
package for debug logging
#3167
base: v2
Are you sure you want to change the base?
Conversation
CI will fail here because this change is missing a changeset. |
@@ -49,6 +49,7 @@ | |||
}, | |||
"devDependencies": { | |||
"@rollup/plugin-commonjs": "^25.0.7", | |||
"@types/debug": "^4.1.12", |
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.
This seems to imply that sandbox
needs a dep on debug
; I think that's true given we vendor the vfs into this package?
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.
Yes. The DTS build of @typescript/sandbox
would fail unless @types/debug
is installed, because @typescript/vfs
is vendored.
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.
Right but I mean that this package should also depend on "debug" too so the code doesn't crash.
Co-authored-by: Jake Bailey <[email protected]>
Checking out the vendored code, it does now import from debug. I'm not 100% certain if that's desirable, though; I believe this code is intended to be loaded in the browser directly so this code may break there now that it's not dependency free. What confuses me though is why @orta do you recall the restrictions here? |
Azure Static Web Apps: Your stage site is ready! Visit it here: https://victorious-plant-05c166c10-3167.centralus.5.azurestaticapps.net |
I just didn't think that debug was important enough of a dependency to add it to the playground's web bundle - given how little I was using of it, could replicate the check for the substring in this package to copy the behavior they are looking for? |
The debug module does a lot of stuff, especially on web; I'm not sure it would be exactly trivial to copy that bit. But, I think maybe we could just change the original code to check (sorry for this reversal, I just looked at the output and noticed that this would break someone) |
Yeah, I think that's the right call |
Previously,
!!process.env.DEBUG
was used to check whether to debug in@typescript/vfs
and@typescript/twoslash
. However, most of the packages are using thedebug
package to debug. When we setDEBUG=vite:hmr
,@typescript/vfs
will output lots of things, which immediately fill the terminal and prevent us from watching logs from Vite.Also, the
debug
package has been installed as a dependency in@typescript/vfs
, but seems unused:TypeScript-Website/packages/typescript-vfs/package.json
Line 44 in c341935
And the README also said it's using the
debug
package:TypeScript-Website/README.md
Line 33 in c341935