Skip to content
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 --info flag to display file info (compiled code/source map) #1647

Merged
merged 4 commits into from
Feb 2, 2019

Conversation

kevinkassimo
Copy link
Contributor

@kevinkassimo kevinkassimo commented Feb 1, 2019

$ ./target/debug/deno -I https://deno.land/thumb.ts
local: /Users/kevinqian/.deno/deps/https/deno.land/thumb.ts
type: TypeScript
compiled: /Users/kevinqian/.deno/gen/5532f1efea8d099e8204df3327c55b50367a8a7a.js
map: /Users/kevinqian/.deno/gen/5532f1efea8d099e8204df3327c55b50367a8a7a.js.map

src/flags.rs Outdated
@@ -147,6 +151,7 @@ pub fn set_flags(
opts.optflag("", "v8-options", "Print V8 command line options.");
opts.optflag("", "types", "Print runtime TypeScript declarations.");
opts.optflag("", "prefetch", "Prefetch the dependencies.");
opts.optflag("I", "info", "Show source file related info");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't add a short string version - only --info

src/main.rs Outdated
}
let out = maybe_out.unwrap();

println!("local filename: {}", &(out.filename));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try to make these labels (text before colon) into single words without qualifiers

filename:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other ones looks okay to me, but “filename” sounds confusing here since it also works for remote resources (which shows the location of their their local cached version)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just "local:" ? I think filename works...

we can change it later if it's confusing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ry I would go with local

src/main.rs Outdated
let out = maybe_out.unwrap();

println!("local filename: {}", &(out.filename));
println!("media type: {}", msg::enum_name_media_type(out.media_type));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type:

src/main.rs Outdated
println!("media type: {}", msg::enum_name_media_type(out.media_type));
if out.maybe_output_code_filename.is_some() {
println!(
"compiled javascript: {}",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javascript:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about compiled:?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

src/main.rs Outdated
}
if out.maybe_source_map_filename.is_some() {
println!(
"source map: {}",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map:

src/main.rs Outdated
"source map: {}",
out.maybe_source_map_filename.as_ref().unwrap()
);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add // TODO print deps.

src/main.rs Outdated
@@ -60,6 +60,30 @@ fn print_err_and_exit(err: js_errors::JSError) {
std::process::exit(1);
}

fn display_file_info(filename: String, dir: &deno_dir::DenoDir) {
Copy link
Member

@ry ry Feb 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print_file_info

consider making this a method of DenoDir

tools/file_info_test.py Outdated Show resolved Hide resolved
@@ -0,0 +1,2 @@
args: --info https://127.0.0.1:4545/tests/003_relative_import.ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this test file supports comments, I would add something like

# The output assumes 003_relative_import.ts has already been run earlier and its output is cached to $DENO_DIR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It errored out last time I tried. Let me see if there is a way I can allow comments in .test files

Copy link
Contributor Author

@kevinkassimo kevinkassimo Feb 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added support for comments in ".test" files

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - this is a nice feature!

@ry ry merged commit 3650bae into denoland:master Feb 2, 2019
@kevinkassimo kevinkassimo deleted the flags/info branch December 27, 2019 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants