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

module: only try to enrich CJS syntax errors #35691

Closed
wants to merge 1 commit into from

Conversation

targos
Copy link
Member

@targos targos commented Oct 17, 2020

It is guaranteed that V8 throws a syntax error when import or export
is used outside of ESM.

Fixes: #35687

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

It is guaranteed that V8 throws a syntax error when `import` or `export`
is used outside of ESM.

Fixes: nodejs#35687
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/modules

@nodejs-github-bot nodejs-github-bot added the esm Issues and PRs related to the ECMAScript Modules implementation. label Oct 17, 2020
@targos targos added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 17, 2020
@targos
Copy link
Member Author

targos commented Oct 17, 2020

The output is not ideal, but that is not new:

$ ./node test/fixtures/es-modules/es-note-error-3.mjs

node:internal/process/esm_loader:74
    internalBinding('errors').triggerUncaughtException(
                              ^
null
(Use `node --trace-uncaught ...` to show where the exception was thrown)

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 17, 2020
@nodejs-github-bot

This comment has been minimized.

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

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

Nit: Commit message should start with a verb. Maybe this?

module: enrich only CJS syntax errors

@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 18, 2020
@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 19, 2020
@github-actions github-actions bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 19, 2020
@github-actions
Copy link
Contributor

Landed in 5b2c263...11f1ad9

@github-actions github-actions bot closed this Oct 19, 2020
nodejs-github-bot pushed a commit that referenced this pull request Oct 19, 2020
It is guaranteed that V8 throws a syntax error when `import` or `export`
is used outside of ESM.

Fixes: #35687

PR-URL: #35691
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
MylesBorins pushed a commit that referenced this pull request Nov 3, 2020
It is guaranteed that V8 throws a syntax error when `import` or `export`
is used outside of ESM.

Fixes: #35687

PR-URL: #35691
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Nov 3, 2020
BethGriggs pushed a commit that referenced this pull request Dec 8, 2020
It is guaranteed that V8 throws a syntax error when `import` or `export`
is used outside of ESM.

Fixes: #35687

PR-URL: #35691
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
BethGriggs pushed a commit that referenced this pull request Dec 10, 2020
It is guaranteed that V8 throws a syntax error when `import` or `export`
is used outside of ESM.

Fixes: #35687

PR-URL: #35691
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@BethGriggs BethGriggs mentioned this pull request Dec 10, 2020
BethGriggs pushed a commit that referenced this pull request Dec 15, 2020
It is guaranteed that V8 throws a syntax error when `import` or `export`
is used outside of ESM.

Fixes: #35687

PR-URL: #35691
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@targos targos deleted the fix-35687 branch April 12, 2021 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. esm Issues and PRs related to the ECMAScript Modules implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusing error message when a non-Error value is thrown during require()
9 participants