Files
BridgeSwarm/native-host/vendor/bare-discord-js
snxraven 693814f46b
CI / Build & Test (push) Failing after 52s
Add Discordjs
2026-09-04 22:10:35 -04:00
..
2026-09-04 22:10:35 -04:00
2026-09-04 22:10:35 -04:00
2026-09-04 22:10:35 -04:00
2026-09-04 22:10:35 -04:00
2026-09-04 22:10:35 -04:00
2026-09-04 22:10:35 -04:00

bare-discord-js

Run official discord.js 14.27 inside Bare with one dependency and one import.

Status

  • Targets official discord.js@^14.27.0 on Bare >=1.29.4.
  • Bootstrap remaps Node builtins through [email protected] (bare-fetch, bare-ws, bare-sqlite, …).
  • REST uses the @discordjs/rest web/fetch build; gateway uses ws over Bare TLS.

Usage

CommonJS

const { Client, GatewayIntentBits, Events } = require('bare-discord-js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once(Events.ClientReady, (readyClient) => {
  console.log(`Logged in as ${readyClient.user.tag}`);
});

ESM

import { Client, GatewayIntentBits, Events } from 'bare-discord-js';
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once(Events.ClientReady, (readyClient) => {
  console.log(`Logged in as ${readyClient.user.tag}`);
});

Use Events.ClientReady (clientReady). discord.js 14.27 still emits ready with a deprecation warning; Events.Ready is aliased to clientReady so it stays current.

Scripts

  • npm run patch:runtime-deps - applies reproducible runtime compatibility patches to installed dependencies.
  • npm run sync:imports-map - copies bare-node-runtime/imports into the shipped Node→Bare map.
  • npm run analyze - generates runtime/dependency inventories.
  • npm run verify-bootstrap-load - validates CJS/ESM bootstrap loading.
  • npm run generate-patches - writes patch manifest placeholders.
  • npm run apply-patches - validates patch manifest integrity.
  • npm run test:parity - verifies baseline API parity surface.
  • npm run test:bare - loads the library under the bare runtime.
  • npm run release:verify - checks required release artifacts.

Example Bot

  • bare examples/basic-bot.cjs - runs a minimal gateway login bot using .env (DISCORD_TOKEN=...).

Runtime Patch Config

  • Runtime dependency patch rules are versioned in patches/runtime-dependency-patches.json.
  • scripts/patch-runtime-deps.mjs applies those rules after install (postinstall) and in CI.

Project Layout

  • src/bootstrap - runtime import-map/global bootstrap.
  • src/adapters - compatibility adapters for runtime deltas.
  • scripts - analysis, patching, sync, release automation.
  • test - parity and smoke harness.
  • patches - patch metadata and fallback import mappings.

Roadmap

  1. Add real gateway/REST/voice conformance integration runs under Bare.
  2. Automate upstream v14 sync with patch rebase + report generation.