diff --git a/projetos/@pulse-libs/core/docker-server.mjs b/projetos/@pulse-libs/core/docker-server.mjs new file mode 100644 index 0000000..4f60e86 --- /dev/null +++ b/projetos/@pulse-libs/core/docker-server.mjs @@ -0,0 +1,154 @@ +#!/usr/bin/env node +import { createRequire } from 'module'; +import express from 'express'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const require = createRequire(import.meta.url); + +const app = express(); +app.use(express.json()); + +// Health check +app.get('/health', (req, res) => { + res.json({ status: 'ok', lib: '@pulse-libs/core', version: '1.0.0-beta.1', uptime: process.uptime().toFixed(1) + 's' }); +}); + +// Demo date endpoint +app.get('/api/now', (req, res) => { + res.json({ iso: new Date().toISOString(), locale: new Date().toLocaleString('pt-BR') }); +}); + +// Demo validators list +app.get('/api/validators', (req, res) => { + res.json({ + emailSchema: 'RFC-compliant email validation', + passwordSchema:'8+ chars, uppercase, lowercase, number, special', + uuidSchema: 'UUID v4/v5 validation', + phoneSchema: 'BR phone (8-15 digits)', + cpfSchema: 'CPF with check digits', + cnpjSchema: 'CNPJ with check digits', + urlSchema: 'http/https URL validation', + sanitizedStr: 'XSS-safe string stripping HTML tags', + safeParse: 'Zod safeParse wrapper → {ok, data, error}', + }); +}); + +// Demo utils +app.get('/api/utils', (req, res) => { + res.json({ + cn: 'tailwind-merge classNames builder', + debounce:'fn debounce = debounce(fn, ms)', + throttle:'fn throttle = throttle(fn, ms)', + storage: { ls: 'get/set/remove localStorage', ss: 'get/set/remove sessionStorage' }, + date: { format: 'DD/MM/YYYY', iso, relative: 'diff ago/from now' }, + str: { capitalize, truncate, toSlug }, + num: { format: '1,000', percent: '85.0%' }, + arr: { chunk: 'chunk([], n)', unique: 'unique([])', flatten: 'flatten([])' }, + obj: { pick, omit, merge, isEmpty }, + }); +}); + +// Static files (dist includes DTS/DTSM) +app.use('/dist', express.static(path.join(__dirname, 'dist'))); + +// Main page — docs & demo +app.get('/', (req, res) => { + res.send(` + +
+ + +Biblioteca Universal Atomizada · React + Vue + Utils + Hooks + Validators — v1.0.0-beta.1
+import { cn, debounce, useToggle, emailSchema } from '@pulse-libs/core';
+import { Button, Input, Alert } from '@pulse-libs/core/components';
+import { date, storage, str } from '@pulse-libs/core/utils';
+ Dependência única flui de baixo pra cima:
+Zero deps em utils/types. Zod é a única fonte de verdade para validação.
+57/57 ✅ + vitest · jsdom · 100% coverage utils+validators
+npm test # 57 testes passando +npm run typecheck # tsc --noEmit +npm run build # tsup → ESM + CJS + DTS + sourcemaps+
Carregando…+