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

Recognize .mjs as JavaScript files #792

Merged
merged 1 commit into from
Dec 7, 2018
Merged

Conversation

mathiasbynens
Copy link
Contributor

This is a quick and dirty fix for #736.

@@ -71,6 +71,7 @@ export class AnalysisContext {
readonly parsers = new Map<string, Parser<ParsedDocument>>([
['html', new HtmlParser()],
['js', new JavaScriptParser()],
['mjs', new JavaScriptParser()],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course, you could create a single const jsParser = new JavaScriptParser(); and then use the the same instance for both js and mjs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can also skip all the import/export scanning for .mjs files.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, we want to add more contextual inference for treating a file as a script vs module, and .mjs would be a strong signal.

No objection to landing this as is though.

@mathiasbynens
Copy link
Contributor Author

CI failure seems unrelated.

@mathiasbynens
Copy link
Contributor Author

What's blocking this? @bicknellr @justinfagnani @rictic @aomarks @usergenic

Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

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

This LGTM, but we will need to wait for the tools team final review as well.

Copy link
Contributor

@keanulee keanulee left a comment

Choose a reason for hiding this comment

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

I think we should merge this. @rictic @aomarks @usergenic thoughts?

@@ -71,6 +71,7 @@ export class AnalysisContext {
readonly parsers = new Map<string, Parser<ParsedDocument>>([
['html', new HtmlParser()],
['js', new JavaScriptParser()],
['mjs', new JavaScriptParser()],
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, we want to add more contextual inference for treating a file as a script vs module, and .mjs would be a strong signal.

No objection to landing this as is though.

@rictic rictic merged commit bb9df40 into Polymer:master Dec 7, 2018
@mathiasbynens mathiasbynens deleted the patch-1 branch December 7, 2018 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants