Rattail
raw JSON →Rattail is a Vite+ oriented and AI Agent friendly front-end toolchain, currently at version 2.0.6. It provides presets for linting, formatting, pre-commit hooks, and git hooks, a CLI toolchain for publishing, logs, commit lint, and API generation, 140+ utility functions covering common, string, number, array, object, and math scenarios, an axios-based progressive request tool with Vue composition API support (Axle), a chainable validation rule factory (Ruler Factory), and type-safe enum utilities. It ships with TypeScript types, is tree-shakable, and has 90%+ test coverage. Rivals like Vite plugins and utility libraries often focus on one area, while Rattail bundles all these into a single Vite+ ecosystem package. Release cadence appears active with multiple minor versions.
Common errors
error Cannot find module 'rattail' or 'ERR_REQUIRE_ESM' ↓
error Uncaught SyntaxError: The requested module 'rattail' does not provide an export named 'createAxle' ↓
error Module not found: Error: Can't resolve 'rattail/utils' ↓
error Could not resolve dependency: peer @voidzero-dev/vite-plus-core@>=0.1.16 from rattail@2.0.6 ↓
Warnings
breaking In v2.0.0, the package was overhauled to be ESM-only and subpath exports were introduced. Previous v1.x CJS imports no longer work. ↓
breaking In v2.0.0, 'Axle' was moved to 'rattail/axle' subpath. Direct import from 'rattail' will not work. ↓
breaking In v2.0.0, many utility functions were moved to 'rattail/utils'. Direct imports from 'rattail' are deprecated and may be removed. ↓
gotcha The package requires pnpm >= 10.0.0. Using npm or yarn may cause peer dependency issues. ↓
gotcha Peer dependencies @voidzero-dev/vite-plus-core and vite-plus are required. If not installed, imports may fail at runtime. ↓
Install
npm install rattail yarn add rattail pnpm add rattail Imports
- rattail wrong
const rattail = require('rattail')correctimport rattail from 'rattail' - defineRattailConfig wrong
import defineRattailConfig from 'rattail'correctimport { defineRattailConfig } from 'rattail' - Axle (request tool) wrong
import { Axle } from 'rattail'correctimport { createAxle } from 'rattail/axle' - RulerFactory wrong
import { RulerFactory } from 'rattail'correctimport { RulerFactory } from 'rattail/ruler' - enum utilities (createEnum) wrong
import { createEnum } from 'rattail'correctimport { createEnum } from 'rattail/enum' - utility functions (isString, etc.) wrong
import { isString } from 'rattail'correctimport { isString } from 'rattail/utils'
Quickstart
// Install: pnpm add rattail @voidzero-dev/vite-plus-core vite-plus
// vite.config.ts
import { defineRattailConfig } from 'rattail';
export default defineRattailConfig({
// base Vite+ config
});
// Use a utility function
import { isString } from 'rattail/utils';
console.log(isString('hello')); // true
// Use Axle request tool
import { createAxle } from 'rattail/axle';
const axle = createAxle({ baseURL: 'https://api.example.com' });
async function fetchData() {
const res = await axle.get('/data');
return res.data;
}
// Use Ruler Factory for validation
import { RulerFactory } from 'rattail/ruler';
const rules = new RulerFactory()
.required('Name is required')
.minLength(2, 'Name too short')
.build();
// Use createEnum
import { createEnum } from 'rattail/enum';
const Status = createEnum({
Pending: 0,
Active: 1,
Inactive: 2,
});