bbdb68a6de
Esta commit conteudo a estrutura atomica completa:
- types: Result<T,E>, AsyncState<T>, Paginated<T>, SortConfig<T>
- utils: date, str, num, cn, debounce, throttle, storage, arr, obj
- validators: Zod schemas — email, password, uuid, url, phone, CPF/CNPJ, sanitizedStr, safeParse
- hooks: useToggle, useAsync, useDebounce, useLocalStorage, useMedia, useInterval, useOnClickOutside, useClipboard, useFetch
- components: Button, Input, Alert, Card, Spinner (atomic design pattern)
- build: tsup v8 ESM+CJS + DTS + sourcemaps — 0 erros
- tests: 57 testes 100% usuarios
- docker: multi-stage Dockerfile (node 20-alpine)
- config: vitest, tsup, tsconfig strict, .npmignore
Filosofia atomica:/utils ← /types ← /validators ← /hooks ← /components
Build: npm run build | Test: npm test | Publish: npm publish
🤖 Generated with Pulse (openclaw + nova-self-improver)
💛 You can help the author become a full-time open-source maintainer by sponsoring him on GitHub.
bundle-require
Use Case
Projects like Vite need to load config files provided by the user, but you can't do it with just require() because it's not necessarily a CommonJS module, it could also be a .mjs or even be written in TypeScript, and that's where the bundle-require package comes in, it loads the config file regardless what module format it is.
How it works
- Bundle your file with esbuild,
node_modulesare excluded because it's problematic to try to bundle it__filename,__dirnameandimport.meta.urlare replaced with source file's value instead of the one from the temporary output file
- Output file in
esmformat if possible (for.ts,.jsinput files) - Load output file with
import()if possible - Return the loaded module and its dependencies (imported files)
Install
npm i bundle-require esbuild
esbuild is a peer dependency.
Usage
import { bundleRequire } from 'bundle-require'
const { mod } = await bundleRequire({
filepath: './project/vite.config.ts',
})
API
https://www.jsdocs.io/package/bundle-require
Projects Using bundle-require
Projects that use bundle-require:
- VuePress: 📝 Minimalistic Vue-powered static site generator.
Sponsors
License
MIT © EGOIST