Skip to content

chore[notask]: remove unused npm: aliases across addon packages#2108

Merged
gianni-cor merged 8 commits into
tetherto:mainfrom
donriddo:chore/remove-npm-aliases
May 20, 2026
Merged

chore[notask]: remove unused npm: aliases across addon packages#2108
gianni-cor merged 8 commits into
tetherto:mainfrom
donriddo:chore/remove-npm-aliases

Conversation

@donriddo

@donriddo donriddo commented May 18, 2026

Copy link
Copy Markdown
Contributor

🎯 What problem does this PR solve?

  • Multiple packages had npm: aliases declaring bare shims or Node.js-compatible modules that were either never imported in their Bare context, or only used by Node.js scripts where native builtins apply anyway.
  • registry-server (Node.js engine >=20) had bare shims in production dependencies, which is incorrect for a Node.js server.

📝 How does it solve it?

  • Removes unused npm: aliases across 8 packages: llm-llamacpp, tts-onnx, tts-ggml, bci-whispercpp, transcription-whispercpp, transcription-parakeet, langdetect-text-cld2, registry-server.
  • tts-onnx and tts-ggml unit tests used require('process') via the alias; updated to require('bare-process') directly, which was already an explicit devDependency in both packages.

Two aliases were intentionally kept:

  • util (kept in tts-onnx, tts-ggml, transcription-parakeet, transcription-whispercpp): sinon and its dependency debug both do require('util') internally. Bare has no built-in util module, so the alias mapping it to bare-utils is required for unit tests to load in Bare.
  • module (kept in langdetect-text-cld2): index.js does import { createRequire } from 'module'. Bare has no built-in module, so removing this alias would require touching production source.

os, process, tty, and util were aliased to bare shims but never imported
anywhere in the package source, tests, or examples.
@donriddo donriddo requested review from a team as code owners May 18, 2026 22:40
donriddo added 2 commits May 19, 2026 00:18
Removes unused or unnecessary npm: module aliases from tts-onnx,
tts-ggml, bci-whispercpp, transcription-whispercpp,
transcription-parakeet, langdetect-text-cld2, and registry-server.

Most aliases (fs, os, tty, util, stream, worker_threads, path, module,
buffer, crypto, http, https, readline) were never imported in any Bare
context. registry-server is a Node.js server (engines: node >=20) so
bare shims in dependencies were incorrect entirely.

tts-onnx and tts-ggml unit tests used require('process') via the alias;
updated to require('bare-process') directly, which is already an
explicit devDependency in both packages.
Restore "util": "npm:bare-utils" in tts-onnx, tts-ggml,
transcription-parakeet, and transcription-whispercpp — sinon requires
'util' internally and these packages run their unit tests under
brittle-bare.

Restore "module": "npm:bare-module" in langdetect-text-cld2 — index.js
uses `import { createRequire } from 'module'` which requires the alias
in Bare.
@donriddo donriddo changed the title chore[notask]: remove unused npm: aliases from llm-llamacpp chore[notask]: remove unused npm: aliases across addon packages May 19, 2026
donriddo added 3 commits May 19, 2026 11:52
… directly

Remove sinon from tts-onnx, tts-ggml, transcription-parakeet, and
transcription-whispercpp — replace every sinon.stub / sinon.spy call
with direct property assignment (instance stubs) and a small
module-level spy helper that wraps the prototype method with a counter.
This eliminates the only remaining reason those four packages kept
"util": "npm:bare-utils" in devDependencies, which is now removed along
with sinon itself.

Change langdetect-text-cld2/index.js to import createRequire from
'bare-module' instead of 'module', and declare bare-module explicitly in
dependencies. This removes the last "module": "npm:bare-module" alias.

All unit tests pass across all five packages after the changes.
Remove dead _origValidateModelFiles captures that triggered no-unused-vars
lint errors, drop stale ?.restore?.() guard calls from integration tests
that became no-ops once sinon stubs were replaced with plain prototype
assignments, add bare-process to transcription-whispercpp devDependencies
explicitly, and tighten the reload-spy assertion to t.is for clarity.
langdetect-text-cld2: add engines restriction (bare>=1.0.0), bump to
0.4.0, add CHANGELOG entry, and update README to remove stale Node.js
compatibility claims. The import of createRequire from bare-module makes
this package explicitly Bare-only; prior docs implied Node.js support.

tts-onnx, tts-ggml: capture MockedBinding.prototype.runJob once at
module level so spyRunJob() always wraps the pristine original rather
than stacking on previous wrappers. Eliminates cross-test prototype
contamination when a test throws before restore() is called.
@donriddo donriddo added verified Authorize secrets / label-gate in PR workflows verify labels May 19, 2026
@gianni-cor

Copy link
Copy Markdown
Contributor

/review

@github-actions

github-actions Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Tier-based Approval Status

**PR Tier:** TIER1

**Current Status:** ✅ APPROVED

**Requirements:**
- 1 Team Member approval ✅ (1/1)
- 1 Team Lead OR Management approval ✅ (2/1)

**Bypass rule:** Triggered (2+ Team Lead approvals (Tier 1 exception)). This PR is approved regardless of tier.

---
*This comment is automatically updated when reviews change.*

@gianni-cor

Copy link
Copy Markdown
Contributor

/review

@gianni-cor

Copy link
Copy Markdown
Contributor

/review

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

Labels

verified Authorize secrets / label-gate in PR workflows verify

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants