-
Notifications
You must be signed in to change notification settings - Fork 5.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
Source map support #429
Source map support #429
Conversation
dc3f52c
to
2f50682
Compare
util.assert(Number(rawSourceMap.version) === 3); | ||
mainSourceMap = rawSourceMap; | ||
} | ||
window["setMainSourceMap"] = setMainSourceMap; |
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.
You might want to reflect this in lib.deno.d.ts
when that has landed.
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.
Thanks - done. (Although it's global right now. Will fix later)
src/binding.cc
Outdated
skip_onerror = true; | ||
{ | ||
auto source = deno::v8_str(js_source.c_str()); | ||
CHECK(global->Set(context, deno::v8_str("mainSource"), source).FromJust()); |
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.
May want to reflect this in lib.deno.d.ts
when it lands into master.
Didn't review the code yet - need to catch up on sleep before I can do it with a whole mind. I did try it out:
I noticed that deno and deno_ns tests run a lot faster now, even in debug mode. |
@piscisaureus GN error fixed and source map commit removed in https://github.com/ry/deno/pull/435 I will leave this PR open for just the source map commit (which I will rebase on #435 after it lands) |
5badb98
to
7556f14
Compare
@piscisaureus I've added a triple slash directive which potentially could solve your issue.... Does it work? |
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.
It's unfortunate that the source map is so big. I think it should be fixed with some priority - maybe open an issue so another contributor can look at it?
LGTM
@@ -45,18 +47,25 @@ v8::StartupData MakeSnapshot(const char* js_filename, const char* js_source) { | |||
int main(int argc, char** argv) { | |||
const char* snapshot_out_bin = argv[1]; | |||
const char* js_fn = argv[2]; | |||
const char* source_map_fn = argv[3]; // Optional. |
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.
I still find _fn a confusing abbreviation for filename.
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.
Just following the convention here. I'll avoid it in the future.
// dependency on the Node types. | ||
// TODO(ry) Ideally this triple slash directive should be removed as we only | ||
// need CallSite and Error.prepareStackTrace but nothing else. | ||
/// <reference types="node" /> |
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.
We could also just copy those definitions into our own repo.
After all they're not really node specific - but from v8.
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 - into lib.deno.d.ts - I think that's probably the ideal solution. I'll leave this for now since it's easy.
mainSource: string; // TODO(ry) This shouldn't be global. | ||
// TODO(ry) These shouldn't be global. | ||
mainSource: string; | ||
setMainSourceMap(sm: string): void; |
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.
string | RawSourcemap?
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.
Fixed.
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.
Actually fixing this caused some unknown error. I'm backing out of that and landing as originally approved. Will fix in follow up.
declare const window: Window; | ||
|
||
// TODO(ry) These shouldn't be global. | ||
declare let mainSource: string; |
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 duplicative with the Window interface above. Do we really need both?
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.
I think we don't need either - but I'm not sure the right solution now. I will fix it later.
This change increases size: out/debug/obj/libdeno/from_snapshot.o 19M -> 34M out/release/deno 32M -> 47M
dfd3206
to
81f96f6
Compare
No description provided.