-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
Fix deno node:process execPath compatibility #1160
Conversation
Co-authored-by: ehmicky <[email protected]>
Looks good to me! Thanks a lot @w3cj for making this PR and adding information in the PR comment and the code comment. 🙏 Should we merge and release @sindresorhus? |
Go ahead 👍 |
I have a few additional thoughts. First, what Deno is doing here is quite hacky (in their own words). Using an object like this where a string is expected is probably going to create quite many issues: not just that one solved in this PR, but probably with other projects. That being said, I do understand why they might need to do that (that's because I am wondering whether it would be slightly safer to convert those to a string instead? export const safeNormalizeFileUrl = (file, name) => {
const fileString = normalizeFileUrl(normalizeDenoExecPath(file));
// ...
}
// In Deno node:process execPath is a special object, not just a string:
// https://github.com/denoland/deno/blob/f460188e583f00144000aa0d8ade08218d47c3c1/ext/node/polyfills/process.ts#L344
const normalizeDenoExecPath = file => isDenoExecPath(file)
? file.toString()
: file
const isDenoExecPath = file => typeof file !== 'string'
&& file
&& Object.getPrototypeOf(file) === String.prototype; Then, the following syntax needs to be taken into account too: execa(...).pipe(process.execPath, ...) Right now, it relies on the following check, which would not work with Deno: execa/lib/pipe/pipe-arguments.js Lines 59 to 67 in d3a146e
Adding some Finally, we should add automated tests for the following cases:
When Ideally, we would run the automated tests with Deno, but I don't think Deno compatibility is one of our goals right now since that's quite a big requirement for a project like Execa. But that PR is ok though since it is a rather simple fix. If you need help with the automated tests, please let me know. What do you think @w3cj? |
Yeah that seems reasonable. I wasn't quite sure what else in the code base would be effected. I should have some time to work on this later today. |
Updated |
That's perfect, thanks @w3cj! |
Released in |
| datasource | package | from | to | | ---------- | ------- | ----- | ----- | | npm | execa | 9.4.0 | 9.4.1 | ## [v9.4.1](https://github.com/sindresorhus/execa/releases/tag/v9.4.1) #### Bug fixes - Fix using `process.execPath` with Deno. Thanks [@w3cj](https://github.com/w3cj)! ([#1160](sindresorhus/execa#1160))
| datasource | package | from | to | | ---------- | ------- | ----- | ----- | | npm | execa | 9.4.0 | 9.4.1 | ## [v9.4.1](https://github.com/sindresorhus/execa/releases/tag/v9.4.1) ##### Bug fixes - Fix using `process.execPath` with Deno. Thanks [@w3cj](https://github.com/w3cj)! ([#1160](sindresorhus/execa#1160))
| datasource | package | from | to | | ---------- | ------- | ----- | ----- | | npm | execa | 9.4.0 | 9.4.1 | ## [v9.4.1](https://github.com/sindresorhus/execa/releases/tag/v9.4.1) ##### Bug fixes - Fix using `process.execPath` with Deno. Thanks [@w3cj](https://github.com/w3cj)! ([#1160](sindresorhus/execa#1160))
| datasource | package | from | to | | ---------- | ------- | ----- | ----- | | npm | execa | 9.4.0 | 9.4.1 | ## [v9.4.1](https://github.com/sindresorhus/execa/releases/tag/v9.4.1) ##### Bug fixes - Fix using `process.execPath` with Deno. Thanks [@w3cj](https://github.com/w3cj)! ([#1160](sindresorhus/execa#1160))
| datasource | package | from | to | | ---------- | ------- | ----- | ----- | | npm | execa | 9.4.0 | 9.4.1 | ## [v9.4.1](https://github.com/sindresorhus/execa/releases/tag/v9.4.1) ##### Bug fixes - Fix using `process.execPath` with Deno. Thanks [@w3cj](https://github.com/w3cj)! ([#1160](sindresorhus/execa#1160))
| datasource | package | from | to | | ---------- | ------- | ----- | ----- | | npm | execa | 9.4.0 | 9.4.1 | ## [v9.4.1](https://github.com/sindresorhus/execa/releases/tag/v9.4.1) ##### Bug fixes - Fix using `process.execPath` with Deno. Thanks [@w3cj](https://github.com/w3cj)! ([#1160](sindresorhus/execa#1160))
| datasource | package | from | to | | ---------- | ------- | ----- | ----- | | npm | execa | 9.4.0 | 9.4.1 | ## [v9.4.1](https://github.com/sindresorhus/execa/releases/tag/v9.4.1) ##### Bug fixes - Fix using `process.execPath` with Deno. Thanks [@w3cj](https://github.com/w3cj)! ([#1160](sindresorhus/execa#1160))
| datasource | package | from | to | | ---------- | ------- | ----- | ----- | | npm | execa | 9.4.0 | 9.4.1 | ## [v9.4.1](https://github.com/sindresorhus/execa/releases/tag/v9.4.1) ##### Bug fixes - Fix using `process.execPath` with Deno. Thanks [@w3cj](https://github.com/w3cj)! ([#1160](sindresorhus/execa#1160))
| datasource | package | from | to | | ---------- | ------- | ----- | ----- | | npm | execa | 9.4.0 | 9.5.0 | ## [v9.5.0](sindresorhus/execa@v9.4.1...4d1e55a) ## [v9.4.1](https://github.com/sindresorhus/execa/releases/tag/v9.4.1) ##### Bug fixes - Fix using `process.execPath` with Deno. Thanks [@w3cj](https://github.com/w3cj)! ([#1160](sindresorhus/execa#1160))
| datasource | package | from | to | | ---------- | ------- | ----- | ----- | | npm | execa | 9.4.0 | 9.5.0 | ## [v9.5.0](sindresorhus/execa@v9.4.1...4d1e55a) ## [v9.4.1](https://github.com/sindresorhus/execa/releases/tag/v9.4.1) ##### Bug fixes - Fix using `process.execPath` with Deno. Thanks [@w3cj](https://github.com/w3cj)! ([#1160](sindresorhus/execa#1160))
| datasource | package | from | to | | ---------- | ------- | ----- | ----- | | npm | execa | 9.4.0 | 9.5.1 | ## [v9.5.1](sindresorhus/execa@v9.5.0...c8cff27) ## [v9.5.0](sindresorhus/execa@v9.4.1...4d1e55a) ## [v9.4.1](https://github.com/sindresorhus/execa/releases/tag/v9.4.1) ##### Bug fixes - Fix using `process.execPath` with Deno. Thanks [@w3cj](https://github.com/w3cj)! ([#1160](sindresorhus/execa#1160))
| datasource | package | from | to | | ---------- | ------- | ----- | ----- | | npm | execa | 9.4.0 | 9.5.1 | ## [v9.5.1](sindresorhus/execa@v9.5.0...c8cff27) ## [v9.5.0](sindresorhus/execa@v9.4.1...4d1e55a) ## [v9.4.1](https://github.com/sindresorhus/execa/releases/tag/v9.4.1) ##### Bug fixes - Fix using `process.execPath` with Deno. Thanks [@w3cj](https://github.com/w3cj)! ([#1160](sindresorhus/execa#1160))
execa
from Deno the following error occurs:nodePath
defaults toexecPath
fromnode:process
execPath
in the Deno process pollyfill is a special object, not just a string: https://github.com/denoland/deno/blob/main/ext/node/polyfills/process.ts#L344lib/arguments/file-url.js
fails, because execPath is not a stringNote: This issue currently occurs in the Nuxt CLI when trying to run with Deno: denoland/deno#25779
Simple reproduction (run this with Deno v2):