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

Detect CommonJS (.cjs) files #1511

Merged
merged 2 commits into from May 12, 2020
Merged

Conversation

AndrewKvalheim
Copy link
Contributor

In Node.js, JavaScript file names can end in .cjs.

Node.js treats `.cjs` files as CommonJS modules.

Details: https://nodejs.org/api/esm.html#esm_enabling
@pyrmont pyrmont self-assigned this May 6, 2020
@pyrmont pyrmont added the needs-review The PR needs to be reviewed label May 6, 2020
Copy link
Contributor

@pyrmont pyrmont left a comment

Choose a reason for hiding this comment

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

Not sure why the lexer spec didn't have a file glob test for *.mjs files but I took the opportunity to add one for that and one for the new *.cjs glob. Thanks for the PR!

@pyrmont pyrmont merged commit 8e26a63 into rouge-ruby:master May 12, 2020
@pyrmont pyrmont removed the needs-review The PR needs to be reviewed label May 12, 2020
@pyrmont
Copy link
Contributor

pyrmont commented May 12, 2020

@AndrewKvalheim Thanks again for the submission. This will be part of the next version of Rouge: v3.19.0. That's scheduled to go out later today/tonight (depending on your time zone)!

mattt pushed a commit to NSHipster/rouge that referenced this pull request May 21, 2020
This commit adds the `*.cljs` fille glob to the JavaScript lexer.
Node.js treats files ending in the `.cjs` extension as CommonJS modules.

Co-authored-by: Michael Camilleri <mike@inqk.net>
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.

None yet

2 participants