Skip to content

feat: accept URL instances in nodeFileTrace() files parameter#572

Open
TooTallNate wants to merge 2 commits intomainfrom
support-url-input
Open

feat: accept URL instances in nodeFileTrace() files parameter#572
TooTallNate wants to merge 2 commits intomainfrom
support-url-input

Conversation

@TooTallNate
Copy link
Copy Markdown
Member

Summary

  • Widen the files parameter of nodeFileTrace() from string[] to (string | URL)[], allowing callers to pass URL instances (e.g. from import.meta.url) directly
  • URL instances are converted to file paths via fileURLToPath() at the entry point — all downstream code continues to work with plain strings
  • Add tests verifying URL input, string/URL equivalence, and mixed string+URL arrays

Allow passing URL instances (e.g. from import.meta.url) in addition
to strings as entry files to nodeFileTrace(). URL instances are
converted to file paths via fileURLToPath() at the boundary, so all
downstream code continues to work with plain strings.
Copilot AI review requested due to automatic review settings March 19, 2026 06:16
@TooTallNate TooTallNate requested review from a team, icyJoseph, ijjk and styfle as code owners March 19, 2026 06:16
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR expands nodeFileTrace() to accept URL instances as entry inputs (in addition to strings), converting URLs to file paths at the API boundary so downstream tracing logic continues to operate on plain string paths.

Changes:

  • Widen nodeFileTrace(files) parameter type to (string | URL)[] and convert URL via fileURLToPath().
  • Add Jest tests covering URL input, URL vs string equivalence, and mixed URL+string arrays.
  • Update package-lock.json (large set of transitive/metadata changes).

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
test/url-input.test.js Adds new tests validating URL inputs to nodeFileTrace()
src/node-file-trace.ts Accepts (string | URL)[] and normalizes URL inputs to filesystem paths
package-lock.json Large lockfile churn not directly tied to the feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread test/url-input.test.js
Address review feedback: the mixed-input test claimed to verify both
inputs but only asserted the string-based one. Add an assertion for
the URL-based input2 as well.
Copy link
Copy Markdown
Contributor

@styfle styfle left a comment

Choose a reason for hiding this comment

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

I would think the caller could do this mapping instead.

But seems fine to add here too since the input array is usually small.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants