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

Fix deno node:process execPath compatibility #1160

Merged
merged 5 commits into from
Oct 16, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/arguments/file-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import {fileURLToPath} from 'node:url';
export const safeNormalizeFileUrl = (file, name) => {
const fileString = normalizeFileUrl(file);

if (typeof fileString !== 'string') {
const isString = typeof fileString === 'string'
// 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
|| (fileString && Object.getPrototypeOf(fileString) === String.prototype);

if (!isString) {
throw new TypeError(`${name} must be a string or a file URL: ${fileString}.`);
}

Expand Down