Skip to content

feat: add isNub runtime detection#197

Open
colinhacks wants to merge 2 commits into
unjs:mainfrom
colinhacks:add-nub-detection
Open

feat: add isNub runtime detection#197
colinhacks wants to merge 2 commits into
unjs:mainfrom
colinhacks:add-nub-detection

Conversation

@colinhacks

@colinhacks colinhacks commented Jul 7, 2026

Copy link
Copy Markdown

Adds isNub to detect Nub, a CLI that augments Node.js through Node's own extension surfaces — not a separate runtime. Under Nub, process.versions.node is set, so detection is additive: isNub is true while isNode stays true and runtime stays "node". It's a layer on Node, not a sibling of Bun/Deno, so it's deliberately not in runtimeChecks or RuntimeName.

The signal is process.versions.nub, Nub's self-identification marker (process.versions.<runtime> convention, cf. .bun, .electron) — mirroring isNode = !!process?.versions?.node. Absent under Nub's --node/NODE_COMPAT passthrough.

Summary by CodeRabbit

  • New Features

    • Added a new runtime flag, isNub, to detect Nub environments.
    • Exported isNub from the main package entry point.
  • Documentation

    • Updated runtime detection docs/README to include isNub.
    • Clarified that Nub detection is additive, so isNode and runtime remain unchanged.
  • Tests

    • Extended the default environment test to verify isNub is false by default.

Copilot AI review requested due to automatic review settings July 7, 2026 23:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e330dca2-faea-4dee-b4ed-1481b8cee344

📥 Commits

Reviewing files that changed from the base of the PR and between e7e0577 and ad3f3c7.

📒 Files selected for processing (1)
  • README.md
✅ Files skipped from review due to trivial changes (1)
  • README.md

📝 Walkthrough

Walkthrough

Adds an isNub runtime flag based on process?.versions?.nub, re-exports it from the package entry point, updates runtime documentation, and extends the default export test to include isNub: false.

Changes

isNub detection flag

Layer / File(s) Summary
isNub implementation and export
src/runtimes.ts, src/index.ts
Adds exported constant isNub checking process?.versions?.nub and re-exports it from the package entry point.
Tests and documentation
test/index.test.ts, AGENTS.md, README.md
Extends the default-environment test to check isNub: false, and documents the additive isNub flag in AGENTS.md and README.md.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: pi0

Related PRs: None identified.

Suggested labels: None identified.

Poem

A tiny flag joins runtime lore,
Nub is seen, while Node stays true,
Docs and tests now speak it too.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding isNub runtime detection.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Around line 20-27: The README has two consecutive `> [!NOTE]` blockquotes
separated by a blank line, which markdownlint flags as ambiguous. In the README
section containing the `isNode` and `isNub` notes, remove the empty line between
the two note blocks so they read as separate adjacent blockquotes without extra
separation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4a22bfad-e009-4f3b-8444-abeca2dded4f

📥 Commits

Reviewing files that changed from the base of the PR and between 7b6b8b1 and e7e0577.

📒 Files selected for processing (5)
  • AGENTS.md
  • README.md
  • src/index.ts
  • src/runtimes.ts
  • test/index.test.ts

Comment thread README.md
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.23%. Comparing base (5558f03) to head (ad3f3c7).
⚠️ Report is 70 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #197       +/-   ##
===========================================
+ Coverage   82.08%   95.23%   +13.15%     
===========================================
  Files          10        5        -5     
  Lines         374       63      -311     
  Branches       33       21       -12     
===========================================
- Hits          307       60      -247     
+ Misses         61        2       -59     
+ Partials        6        1        -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants