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

@decido/vite-plugin

v4.1.0

Published

> Módulo interno optimizado de alto desempeño perteneciente al ecosistema arquitectónico de Decido OS.

Downloads

163

Readme

🚀 @decido/vite-plugin

Módulo interno optimizado de alto desempeño perteneciente al ecosistema arquitectónico de Decido OS.

@decido/vite-plugin es un componente de infraestructura de nivel industrial diseñado para enlazar de forma transparente y reactiva las aplicaciones y micro-frontends del ecosistema Decido OS con sus respectivos archivos físicos de configuración (decido.config.*).

Mediante el uso de módulos virtuales de Rollup/Vite, el plugin aísla la carga física del disco, proporcionando tipado estático fluido y recarga en caliente en tiempo real (HMR) sin forzar el anidamiento físico de dependencias.


📐 1. Arquitectura y Flujo de Resolución (Mermaid)

El siguiente diagrama detalla cómo interactúa el plugin con el ciclo de vida de compilación y desarrollo en Vite:

flowchart TD
    A[Vite App Host] -->|import config from 'virtual:decido-config'| B{Plugin resolveId}
    B -->|Búsqueda Priorizada| C{¿Existe decido.config.*?}
    
    C -->|Sí: .ts, .mts, .cts, .js, .mjs, .cjs| D[Retornar Ruta Absoluta del Disco]
    C -->|No| E[Retornar resolvedVirtualModuleId]
    
    D -->|Vite Compila y Observa| F[HMR Nativo Físico Activo]
    E -->|Vite Invoca hook load| G[Inyectar export default vacío]
    
    %% Flujo HMR en Caliente
    H[configureServer Watcher] -->|Detecta add/unlink de decido.config.*| I[Invalidar Módulos en Grafo de Vite]
    I --> J[Propagar WS full-reload al Cliente]
    J -->|Re-evaluar Importación| B

📦 2. Instalación y Setup

Para aprovisionar este módulo en cualquier paquete o micro-frontend de nuestro monorepo:

# Agregar de forma declarativa mediante el gestor del monorepo
pnpm add @decido/vite-plugin --filter @decido/tu-app

🔧 3. Configuración y Consumo

A. Registrar el Plugin en Vite

Integra el plugin en tu archivo de configuración de Vite de forma sencilla:

// vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import tailwindcss from '@tailwindcss/vite';
import { decido } from '@decido/vite-plugin';

export default defineConfig({
  plugins: [
    decido(),
    tailwindcss(),
    react()
  ]
});

B. Declarar el Archivo de Configuración

Crea tu archivo de configuración en la raíz de tu proyecto usando cualquiera de los formatos compatibles (ej. decido.config.ts o decido.config.js):

// decido.config.ts
export default {
  theme: 'aura-dark',
  apiGateway: {
    profile: 'spatial-copilot',
    timeout: 5000
  },
  telemetry: {
    circularBufferSize: 1000,
    rateLimit: 50
  }
};

C. Consumir la Configuración en el Código

Importa la configuración directamente usando el identificador virtual:

// src/services/gateway.ts
import decidoConfig from 'virtual:decido-config';

export function initializeGateway() {
  const gatewayUrl = decidoConfig.apiGateway?.url ?? 'https://api.decido.os';
  console.log(`Iniciando AI Gateway en: ${gatewayUrl}`);
}

🔐 4. Integración de Tipos (TypeScript)

Para evitar alertas en el compilador de TypeScript al importar desde un módulo virtual, este paquete expone definiciones de tipo nativas. Solo debes referenciar los tipos en tu archivo de variables de entorno global:

// vite-env.d.ts o client.d.ts de tu proyecto
/// <reference types="@decido/vite-plugin/client" />

Esto habilitará el autocompletado y tipado estático nativo para 'virtual:decido-config'.


🛡️ 5. Pruebas Unitarias y Robustez (100% Cobertura)

Este plugin ha sido auditado e instrumentalizado rigurosamente bajo el estándar Decido Unit Test Shield, logrando un impecable 100% de cobertura absoluta en sentencias, ramas, funciones y líneas, libre de place-holders o efectos colaterales.

Para ejecutar la suite de pruebas unitarias y reportar cobertura localmente en esta carpeta:

# Instalar dependencias del subpaquete
pnpm install

# Ejecutar vitest y generar reporte de cobertura
pnpm test:coverage

Tabla de Resultados Obtenidos

 ✓ tests/index.test.ts (16 tests) 188ms
   ✓ vite-plugin-decido (16 passed)
 
 % Coverage report from v8:
 ---------------------------------------------
 | % Stmts | % Branch | % Funcs | % Lines |
 ---------------------------------------------
 |     100 |      100 |     100 |     100 |
 ---------------------------------------------

🔐 Licencia y Privacidad

El código de este componente se encuentra auditado y restringido (Sin Sourcemaps).
Propiedad Intelectual Protegida - Framework Decido OS.
Distribuido bajo licencia UNLICENSED.