npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rtl-first/direction-injector

v0.1.1

Published

Automatically inject dir="rtl" and lang="ar" into any web project's root element

Readme

@rtl-first/direction-injector

Automatically inject dir="rtl" and lang into any web project's root element.

Part of the rtl-first framework — build for the world from day one.

What it does

One command. It detects your framework, finds the right file, and adds RTL direction attributes.

npx @rtl-first/direction-injector ./my-project

Before:

<html>

After:

<html dir="rtl" lang="ar">

It also detects UI libraries (Radix UI, MUI, Chakra, Ant Design) and tells you exactly how to configure their RTL providers.

Supported Frameworks

| Framework | Root File | Detection | |-----------|-----------|-----------| | Next.js (App Router) | app/layout.tsx | ✅ | | Next.js (Pages Router) | pages/_document.tsx | ✅ | | Nuxt 3 | nuxt.config.ts | ✅ | | Remix | app/root.tsx | ✅ | | SvelteKit | src/app.html | ✅ | | Angular | src/index.html | ✅ | | Vite (React/Vue/Svelte) | index.html | ✅ | | Create React App | public/index.html | ✅ | | Static HTML | index.html | ✅ |

UI Library Detection

| Library | What it tells you | |---------|------------------| | Radix UI | Add <DirectionProvider> wrapper | | Material UI | Use createTheme({ direction: "rtl" }) | | Chakra UI | Set direction in extendTheme | | Ant Design | Wrap with <ConfigProvider direction="rtl"> |

Usage

# Inject RTL (Arabic)
npx @rtl-first/direction-injector ./my-project

# Preview changes without modifying files
npx @rtl-first/direction-injector ./my-project --dry-run

# Use Hebrew instead of Arabic
npx @rtl-first/direction-injector ./my-project --lang he

# Only detect framework (no injection)
npx @rtl-first/direction-injector ./my-project --detect-only

# JSON output (for CI/scripts)
npx @rtl-first/direction-injector ./my-project --json

Programmatic API

const { run } = require('@rtl-first/direction-injector');

const result = run('./my-project', {
  lang: 'ar',
  dryRun: true
});

console.log(result.detection.framework); // 'next-app-router'
console.log(result.injection.changes);   // ['Added dir="rtl" to <html>']

Features

  • Zero dependencies — just Node.js
  • Idempotent — safe to run multiple times
  • Dry run — preview changes before applying
  • JSON output — integrate with CI pipelines
  • Framework-aware — modifies the correct file for each framework
  • UI library hints — tells you about DirectionProvider needs

Part of rtl-first

This is one of seven tools in the rtl-first framework:

| Tool | Purpose | |------|---------| | @rtl-first/audit | Scan any repo for RTL readiness | | @rtl-first/codemod | Convert CSS physical → logical properties | | @rtl-first/translation-kit | Find missing translation keys | | @rtl-first/contributor-agent | Generate ready-made PRs | | @rtl-first/direction-injector | ← You are here | | @rtl-first/locale-scaffolder | Scaffold ar.json + i18n config | | @rtl-first/patch-generator | Generate rebaseable RTL patches |

License

MIT