-
Notifications
You must be signed in to change notification settings - Fork 177
fix: guard parent access in addTsEsmHook for ESM-to-CJS sub-dependency resolution
#1087
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| { "type": "module" } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { expect } from '@hapi/code'; | ||
| import * as _Lab from '../../test_runner/index.js'; | ||
|
|
||
| import { add } from 'esm-dep'; | ||
|
|
||
|
|
||
| const { describe, it } = exports.lab = _Lab.script(); | ||
|
|
||
| describe('Test CLI', () => { | ||
|
|
||
| it('imports from an ESM dependency', () => { | ||
|
|
||
| expect(add(1, 1)).to.equal(2); | ||
| }); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "target": "es2021", | ||
| "module": "commonjs", | ||
| "moduleResolution": "node", | ||
| "removeComments": true | ||
| } | ||
| } |
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.
Please don't add random stuff here.
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'm a bit confused here... 🤔
If you mean it literally, then I need to explain that this is needed to reproduce the scenario in which the code breaks. Those node_modules are created manually, not installed from registry.
If you speak generally, for future usage, I agree that we shouldn't touch this file or drop anything into those node_modules.
Please clarify: can this stay as is or I need to remove it? If the later, do you have a suggestion how to add tests files that can reproduce this issue?