-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix: make $inspect logs come from the callsite
#17001
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
Conversation
🦋 Changeset detectedLatest commit: e6242e6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
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.
A couple of maybe silly comments but this looks very noice.
packages/svelte/src/compiler/phases/3-transform/client/visitors/CallExpression.js
Outdated
Show resolved
Hide resolved
packages/svelte/src/compiler/phases/3-transform/server/visitors/CallExpression.js
Outdated
Show resolved
Hide resolved
|
I like it very much!! I can already sense my frustrations melting away. |
|
I also like the update at error thing. That would be very useful imo! Although people might complain and want a way to 'quieten' it. |
|
Perhaps the stack trace thing is the default but if you use |
|
Yeah, I think that makes sense and is a nice switch to give users control. |
Closes #16998. This is the least invasive version of the solution — by (effectively) doing this...
...we make the log come from the
$inspect(...)callsite rather than the module containing theinspecthelper — instead of this......we get this:
We could go further. If we updated the
inspectfunction thusly...untrack(() => { - inspector(initial ? 'init' : 'update', ...snap); + inspector(...snap); + if (!initial) console.log(get_stack('UpdatedAt')); });...then we would get this result:
(The label has to end with the string
Erroror it doesn't get formatted/sourcemapped correctly, henceUpdatedAtError.)You could certainly make a case for that being the default. I also wonder if we should get rid of the
inittag during SSR, or replace it with$inspector something.Thoughts?
Before submitting the PR, please make sure you do the following
feat:,fix:,chore:, ordocs:.packages/svelte/src, add a changeset (npx changeset).Tests and linting
pnpm testand lint the project withpnpm lint