Moving the realpath resolution to a function that uses it, so it doesn't fail on lib/sync import#220
Merged
ljharb merged 1 commit intobrowserify:masterfrom Apr 17, 2020
Merged
Conversation
…Sync`, do not crash
alexandrerousselledecath
approved these changes
Apr 16, 2020
0gust1
approved these changes
Apr 16, 2020
Member
|
In resolve v2, preserveSymlinks will be on by default. In general, if you mock out a node core module, and you don't do it correctly, then lots of things could break. The solution is to fix cypress, not to alter this module. That said, it's certainly possible to use #218 should help with this as well. |
ljharb
requested changes
Apr 17, 2020
ljharb
approved these changes
Apr 17, 2020
Member
ljharb
left a comment
There was a problem hiding this comment.
i updated the commit to avoid the crash without making resolve brittle.
Again, if fs exists but fs.realpath/fs.realpathSync doesn't, your fs implementation is broken. It's not the responsibility of the ecosystem to absorb the effects of your incomplete mock.
zciluk
approved these changes
Apr 17, 2020
Contributor
Author
|
Makes sense! Thanks for taking your time to look into this. |
ljharb
added a commit
that referenced
this pull request
Apr 17, 2020
ljharb
added a commit
that referenced
this pull request
Apr 17, 2020
v1.16.1 - [patch] when a non-node `fs` is broken and lacks `realpath`/`realpathSync`, do not crash (#220)
ljharb
added a commit
that referenced
this pull request
Oct 21, 2020
Changes since v2.0.0-next.1: - [Breaking] remove `core`/`isCore` in favor of `is-core-module` package - [Fix] drop the "require" condition, since that causes an "experimental" warning to be printed (#209) Including all changes in v1.15.1 - v1.18.1: v1.18.1 - [Fix] `core`: remove console warning on require, since the main entry point requires it - [Refactor] avoid using extensions in require paths - [meta] update auto-generated `core.json` - [meta] add `eclint` and `.editorconfig` - [Dev Deps] update `eslint` - [Dev Deps] add `aud` in `posttest` v1.18.0 - [New] extract `isCore` implementation to `is-core-module` - [New] add new core modules that will be in node v15 - [readme] soft-deprecate `resolve.isCore` - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` v1.17.0 - [New] `sync`/`async`: add `realpath`/`realpathSync` options (#218) - [Dev Deps] update `tape` v1.16.1 - [patch] when a non-node `fs` is broken and lacks `realpath`/`realpathSync`, do not crash (#220) v1.16.0 - [New] `core`: `fs/promises` is a core module again in node 14+ (f6473e2) - [patch] `sync`/`async`: use native `realpath` if available to unwrap symlinks (#217) v1.15.1 - [Fix] correct behavior when requiring `.` with same name (#212) - [Dev Deps] update `@ljharb/eslint-config` - [Tests] allow node 5 on windows to fail due to npm registry bug
ljharb
added a commit
to ljharb/resolve
that referenced
this pull request
Feb 11, 2021
Changes since v2.0.0-next.2: - [New] add `readPackage` and `readPackageSync` (browserify#236) - [Fix] throw an error for an invalid explicit `main` with a missing `./index.js` file (browserify#234) - [meta] create SECURITY.md - [Deps] update `is-core-module` - [Dev Deps] update `eslint`, `@ljharb/eslitn-config`, `array.prototype.map`, `aud`, `tape` Including all changes in v1.15.1 - v1.19.0: v1.19.0 - [New] `sync`/`async`: add 'includeCoreModules' option (browserify#233) - [readme] Add possible error types (browserify#232) - [Deps] update `is-core-module` - [Dev Deps] update `aud`, `eslint` - [meta] add Automatic Rebase and Require Allow Edits workflows - [Tests] comment out node 15 in appveyor; it’s not available yet - [Tests] add node 15 to appveyor, fix "latest npm" logic - [Tests] migrate tests to Github Actions v1.18.1 - [Fix] `core`: remove console warning on require, since the main entry point requires it - [Refactor] avoid using extensions in require paths - [meta] update auto-generated `core.json` - [meta] add `eclint` and `.editorconfig` - [Dev Deps] update `eslint` - [Dev Deps] add `aud` in `posttest` v1.18.0 - [New] extract `isCore` implementation to `is-core-module` - [New] add new core modules that will be in node v15 - [readme] soft-deprecate `resolve.isCore` - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` v1.17.0 - [New] `sync`/`async`: add `realpath`/`realpathSync` options (browserify#218) - [Dev Deps] update `tape` v1.16.1 - [patch] when a non-node `fs` is broken and lacks `realpath`/`realpathSync`, do not crash (browserify#220) v1.16.0 - [New] `core`: `fs/promises` is a core module again in node 14+ (f6473e2) - [patch] `sync`/`async`: use native `realpath` if available to unwrap symlinks (browserify#217) v1.15.1 - [Fix] correct behavior when requiring `.` with same name (browserify#212) - [Dev Deps] update `@ljharb/eslint-config` - [Tests] allow node 5 on windows to fail due to npm registry bug
ljharb
added a commit
that referenced
this pull request
Feb 11, 2021
Changes since v2.0.0-next.2: - [New] add `readPackage` and `readPackageSync` (#236) - [Fix] throw an error for an invalid explicit `main` with a missing `./index.js` file (#234) - [meta] create SECURITY.md - [meta] do not publish github action workflow files - [Deps] update `is-core-module` - [Dev Deps] update `eslint`, `@ljharb/eslitn-config`, `array.prototype.map`, `aud`, `tape` Including all changes in v1.15.1 - v1.19.0: v1.19.0 - [New] `sync`/`async`: add 'includeCoreModules' option (#233) - [readme] Add possible error types (#232) - [Deps] update `is-core-module` - [Dev Deps] update `aud`, `eslint` - [meta] add Automatic Rebase and Require Allow Edits workflows - [Tests] comment out node 15 in appveyor; it’s not available yet - [Tests] add node 15 to appveyor, fix "latest npm" logic - [Tests] migrate tests to Github Actions v1.18.1 - [Fix] `core`: remove console warning on require, since the main entry point requires it - [Refactor] avoid using extensions in require paths - [meta] update auto-generated `core.json` - [meta] add `eclint` and `.editorconfig` - [Dev Deps] update `eslint` - [Dev Deps] add `aud` in `posttest` v1.18.0 - [New] extract `isCore` implementation to `is-core-module` - [New] add new core modules that will be in node v15 - [readme] soft-deprecate `resolve.isCore` - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` v1.17.0 - [New] `sync`/`async`: add `realpath`/`realpathSync` options (#218) - [Dev Deps] update `tape` v1.16.1 - [patch] when a non-node `fs` is broken and lacks `realpath`/`realpathSync`, do not crash (#220) v1.16.0 - [New] `core`: `fs/promises` is a core module again in node 14+ (f6473e2) - [patch] `sync`/`async`: use native `realpath` if available to unwrap symlinks (#217) v1.15.1 - [Fix] correct behavior when requiring `.` with same name (#212) - [Dev Deps] update `@ljharb/eslint-config` - [Tests] allow node 5 on windows to fail due to npm registry bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
535ec22#diff-688ede0ee2da1fa3d89f2fc485f39273R8
This change caused some issues for the users of Cypress Cucumber Preprocessor - badeball/cypress-cucumber-preprocessor#362
putting "resolve": "1.15.1"in package.json resolutions helps.
I'm guessing we never, directly or indirectly, call the
maybeUnwrapSymlinkfunction so having realpath not being defined was never a problem for us.I'd appreciate a tweak here. I'm also guessing we might not the only ones that will bump into this problem in the future.