-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add NODE_DEV_PATH_STACKTRACE env var to show tiddler filepath instead for single tiddler files #8889
base: master
Are you sure you want to change the base?
Conversation
… of tiddler title (may need some tweaking)
Confirmed: Arlen22 has already signed the Contributor License Agreement (see contributing.md) |
✅ Deploy Preview for tiddlywiki-previews ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Someone needs to check if it changes anything about how the browser handles paths and make sure that the It should affect the server edition. If you run the server edition with the env var set, stack traces should include the physical module path as well. I've never seen a good way to use this in the browser, but it would be crazy useful if there was some kind of way to click on a link in your browser and it would take you back to that line in your code editor. Can someone please figure out whether we can do this with boot.js? I don't know why it has to have a source url set. Perhaps moving the sourceUrl to the rendering tiddler would be a good idea. |
In the browser every module gets a sourceURL info set by TW core. I think it's used to by the debug-tab to show the "file structure" on the left. The code can be found at: Line 633 in 4478f44
|
I am not sure, if we add package-lock.json to a PR. IMO it should be removed. It will be rebuilt by the node build system anyway. |
@Arlen22 -- Where do you set |
Oops, thanks.
It's just whatever we want to make it. I'm sure you or others here can suggest more appropriate names than that. It definitely shouldn't be found on nodejs.org. When you enable the flag, it adds the 'filepath' field to tiddlers loaded from the file system, so that if they happen to be a module or other runnable code, the filepath can be used in the sourceUrl instead of the tiddler name. This works because the other line I changed was in $tw.modules.execute, which checks for the filepath field. If it sees the filepath field it will use that instead of the title. This happens whether the flag is enabled or not, so anyone can use it to customize the filepath that is set in sourceUrl. If you're using the
We could also call it |
Yes. I believe so. The only exception is the boot folder, since those are rendered right into the HTML file. As such they do not get eval'ed by that line of code. The sourceUrl for those is set in the last line of the source file itself. That affects both node and browser stack traces, but if someone is desperate they can just remove that line since they're probably working on the file anyway. |
Single tiddler files (like javascript files) will use the filepath on disk instead of the tiddler name, allowing the stack trace to be properly clickable (assuming your code editor supports that).
This doesn't work for files in the boot folder because they have
//# sourceURL=$:/boot/...
, but it does work for files in core.Other than being extremely useful, I don't know what the ramifications of this are.