{"_id":"@dieison-depra/nojs-cli-bun","name":"@dieison-depra/nojs-cli-bun","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@dieison-depra/nojs-cli-bun","version":"1.0.0","description":"Official CLI for No.JS — scaffold projects, optimize HTML, run dev server, validate templates, and manage plugins","main":"src/cli.js","bin":{"nojs":"bin/nojs.js"},"type":"module","scripts":{"test":"bun test","test:watch":"bun test --watch","test:coverage":"bun test --coverage","lint":"biome lint .","lint:fix":"biome lint --write .","format":"biome format --write .","check":"biome check --write .","knip":"knip","prepublishOnly":"bun test"},"keywords":["nojs","cli","scaffold","prebuild","seo","resource-hints","speculation-rules","sitemap","html-optimization","dev-server","validation","plugins"],"author":{"name":"Erick Xavier"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/dieison-depra/nojs-cli-bun.git"},"homepage":"https://github.com/dieison-depra/nojs-cli-bun#readme","bugs":{"url":"https://github.com/dieison-depra/nojs-cli-bun/issues"},"engines":{"bun":">=1.3.11"},"dependencies":{"linkedom":"^0.18.9"},"devDependencies":{"@biomejs/biome":"^2.4.7","bun-types":"^1.3.11","knip":"^5.87.0"},"_id":"@dieison-depra/nojs-cli-bun@1.0.0","gitHead":"42a2784c74f92c2c1c845ce2fbb29f398a818938","_nodeVersion":"22.9.0","_npmVersion":"10.8.3","dist":{"integrity":"sha512-zPxkAiX7funxCKOJy/tIwuq/FA6KAHWZViPCRwe/mwEs57G2HDxAQ04YJ4YVb5D0TtcEyILSvZDocBrAcOHG9g==","shasum":"49c9f5e674abe38dd3799612afa5587d4efb6dff","tarball":"https://registry.npmjs.org/@dieison-depra/nojs-cli-bun/-/nojs-cli-bun-1.0.0.tgz","fileCount":45,"unpackedSize":111384,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCwlR4AbjkJ5cgtbxgMoJNOQUCynK/9lM1XmxldNAxt1QIgKXGccmzZuPyaSeodjiYHtlDPKWwzoq4qsOdjYOjCEm8="}]},"_npmUser":{"name":"dieison-depra","email":"dieison.depra@gmail.com"},"directories":{},"maintainers":[{"name":"dieison-depra","email":"dieison.depra@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nojs-cli-bun_1.0.0_1774498508415_0.20381957062023703"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-26T04:15:08.297Z","1.0.0":"2026-03-26T04:15:08.565Z","modified":"2026-03-26T04:15:08.790Z"},"maintainers":[{"name":"dieison-depra","email":"dieison.depra@gmail.com"}],"description":"Official CLI for No.JS — scaffold projects, optimize HTML, run dev server, validate templates, and manage plugins","homepage":"https://github.com/dieison-depra/nojs-cli-bun#readme","keywords":["nojs","cli","scaffold","prebuild","seo","resource-hints","speculation-rules","sitemap","html-optimization","dev-server","validation","plugins"],"repository":{"type":"git","url":"git+https://github.com/dieison-depra/nojs-cli-bun.git"},"author":{"name":"Erick Xavier"},"bugs":{"url":"https://github.com/dieison-depra/nojs-cli-bun/issues"},"license":"MIT","readme":"# NoJS CLI — Bun Edition\n\n**Bun-native CLI for the [No.JS](https://github.com/ErickXavier/no-js) framework**\n\nScaffold projects, optimize HTML for production, run a dev server with live reload, validate templates, and manage plugins — all from the command line.\n\n> **This is a Bun fork of [ErickXavier/NoJS-CLI](https://github.com/ErickXavier/NoJS-CLI).**\n> The original project targets Node.js ≥ 18. This fork replaces the entire runtime with\n> [Bun](https://bun.sh) — the dev server uses `Bun.serve()`, the test suite runs on `bun:test`,\n> spawning uses `Bun.spawnSync`, and all tooling (`biome`, `knip`) is Bun-first.\n> This fork maintains its own feature roadmap and may periodically synchronise with upstream.\n>\n> **Recommended pairing:** use this CLI alongside [`@dieison-depra/nojs-bun`](https://github.com/dieison-depra/nojs-bun),\n> the Bun-native port of the No.JS framework itself.\n\nThe CLI is the companion toolchain for No.JS projects. It provides everything you need to go from a blank folder to a production-ready application:\n\n- **Scaffold** a new project with an interactive wizard (`init`)\n- **Optimize** your HTML output with 26 built-in prebuild plugins (`prebuild`)\n- **Develop** locally with a fast file server and live reload (`dev`)\n- **Validate** your templates for common No.JS mistakes before shipping (`validate`)\n- **Manage** community and official plugins (`plugin`)\n\n---\n\n## Install\n\n```bash\nbun install -g @dieison-depra/nojs-cli-bun\n```\n\nRequires **Bun >= 1.3.11**.\n\n---\n\n## Quick Start\n\n```bash\n# Create a new project\nnojs init my-app\ncd my-app\n\n# Start the dev server\nnojs dev\n\n# Validate your templates\nnojs validate *.html\n\n# Optimize for production\nnojs prebuild\n```\n\n---\n\n## Commands\n\n| Command | Alias | Description |\n|---------|-------|-------------|\n| `nojs init [path]` | `i` | Scaffold a new No.JS project with optional routing, i18n, and API base |\n| `nojs prebuild [dir]` | `b` | Build-time HTML optimization — 26 plugins for performance, SEO, security, and accessibility |\n| `nojs dev [path]` | `d` | Local dev server with live reload (SSE), SPA fallback, colored request logging |\n| `nojs validate [files]` | `v` | Validate No.JS templates against 10 rules (CI-friendly JSON output) |\n| `nojs plugin <action>` | `p` | Manage plugins — `search`, `install`, `update`, `remove`, `list` |\n| `nojs help` | | Show help |\n| `nojs version` | | Show version |\n\n---\n\n## Init\n\nInteractive wizard that generates a ready-to-go No.JS project:\n\n```bash\nnojs init ./my-app\n```\n\nNon-interactive mode:\n\n```bash\nnojs init ./my-app --routing --i18n --locales en,pt --api https://api.example.com --yes\n```\n\nGenerates `index.html`, route pages (`.tpl`), i18n locale files, and a `nojs.config.json`.\n\n---\n\n## Dev Server\n\n```bash\nnojs dev              # serve current directory\nnojs dev ./docs/      # serve a specific path\nnojs dev --port 8080  # custom port\nnojs dev --open       # open browser on start\nnojs dev --quiet      # suppress request logging\nnojs dev --no-reload  # disable live reload\n```\n\nFeatures: live reload via SSE, SPA fallback (serves `index.html` for unmatched routes), MIME type detection, path traversal protection.\n\n---\n\n## Prebuild\n\nThe `prebuild` command runs a configurable pipeline of **26 built-in plugins** that apply build-time transformations to your HTML files. Plugins are opt-in — enable only what you need in `nojs-prebuild.config.js`.\n\n```bash\nnojs prebuild            # process current directory\nnojs prebuild ./dist/    # process a specific path\n```\n\n### Performance\n| Plugin | What it does |\n|--------|-------------|\n| `inject-resource-hints` | Preload/prefetch hints for fetch directives and route templates |\n| `inject-modulepreload` | `modulepreload` hints for ES module scripts |\n| `inject-speculation-rules` | Speculation Rules API for near-instant SPA navigation |\n| `optimize-images` | Lazy loading, LCP priority, and fetchpriority hints |\n| `inject-view-transitions` | `@view-transition` CSS for smooth same-origin navigation |\n| `inline-critical-css` | Inline above-fold CSS, async-load full sheet *(requires `beasties`)* |\n| `generate-responsive-images` | AVIF/WebP srcset generation *(requires `sharp`)* |\n| `precompress-assets` | `.br` and `.gz` companion files via Bun zlib |\n| `optimize-fonts` | Google Fonts preconnect + `font-display:swap` |\n| `minify-html` | Whitespace collapse and comment removal |\n| `inline-svg` | Replace `<img src=\"*.svg\">` with inline `<svg>` |\n\n### SEO & Metadata\n| Plugin | What it does |\n|--------|-------------|\n| `inject-head-attrs` | Inject title, description, and canonical from No.JS page directives |\n| `inject-og-twitter` | Open Graph and Twitter Card meta tags |\n| `inject-canonical-url` | `<link rel=\"canonical\">` from `siteUrl` config + file path |\n| `generate-sitemap` | `sitemap.xml` from No.JS route definitions |\n| `inject-jsonld` | WebPage/WebSite JSON-LD structured data |\n| `audit-meta-tags` | Auto-inject charset/viewport, warn on missing title/description/lang |\n\n### No.JS Runtime\n| Plugin | What it does |\n|--------|-------------|\n| `inline-animation-css` | Inline only the keyframes used by `animate=` directives |\n| `inject-visibility-css` | Hide `if=/show=/hide=` elements until the runtime processes them |\n| `inject-template-hints` | Preload stylesheets and inline skeleton CSS for loading templates |\n\n### Security\n| Plugin | What it does |\n|--------|-------------|\n| `inject-csp-hashes` | SHA-384 CSP `<meta>` tag for inline scripts and styles |\n| `inject-sri-hashes` | `integrity` + `crossorigin` for external scripts and stylesheets |\n| `enforce-script-loading` | Add `defer`/`async` to third-party scripts |\n\n### Quality & Accessibility\n| Plugin | What it does |\n|--------|-------------|\n| `audit-accessibility` | WCAG quick-checks: alt text, link names, labels, headings, lang |\n| `purge-unused-css` | Remove CSS rules with no matching selectors in the HTML |\n| `generate-pwa-manifest` | `manifest.webmanifest` + manifest link tag |\n\n---\n\n## Configuration\n\nCreate `nojs-prebuild.config.js` in your project root:\n\n```js\n// nojs-prebuild.config.js\nexport default {\n  plugins: {\n    'inject-resource-hints': true,\n    'inject-head-attrs': true,\n    'inject-og-twitter': true,\n    'generate-sitemap': { siteUrl: 'https://example.com' },\n    'inject-canonical-url': { siteUrl: 'https://example.com' },\n    'minify-html': true,\n    'optimize-images': true,\n    'inject-view-transitions': true,\n  },\n};\n```\n\n---\n\n## Validate\n\n```bash\nnojs validate *.html\nnojs validate src/ --format json   # JSON output for CI\n```\n\nRules: missing `as` on fetch, `each` without `in`, `foreach` without `from`, `model` on non-form elements, `bind-html` warning, routes without `route-view`, empty event handlers, loops without `key`, duplicate store names, `validate` outside `<form>`.\n\n---\n\n## Plugin Manager\n\nHybrid plugin manager — CDN for official plugins, npm for community packages:\n\n```bash\nnojs plugin search analytics\nnojs plugin install @nojs/analytics\nnojs plugin list\nnojs plugin update @nojs/analytics\nnojs plugin remove @nojs/analytics\n```\n\nCDN plugins get SRI integrity hashes (sha384) computed automatically.\n\n---\n\n## Writing Your Own Plugin\n\nPlugins are plain ES modules:\n\n```js\n// my-plugin.js\nexport default {\n  name: 'my-plugin',\n  description: 'Does something useful.',\n\n  async process(html, { filePath, config, allFiles }) {\n    // transform html string and return it\n    return html;\n  },\n\n  // optional — called once after all files are processed\n  async finalize({ outputDir, config, processedFiles }) {},\n};\n```\n\nSee [docs/prebuild/creating-plugins.md](docs/prebuild/creating-plugins.md) for the full plugin development guide.\n\n---\n\n## Documentation\n\n| Guide | Description |\n|-------|-------------|\n| [Getting Started](docs/getting-started.md) | Installation, first project, basic workflow |\n| [Commands Reference](docs/commands/index.md) | All CLI commands in detail |\n| [Prebuild Plugins](docs/prebuild/plugins.md) | Full reference for all 26 built-in plugins |\n| [Creating Plugins](docs/prebuild/creating-plugins.md) | How to write and distribute custom plugins |\n| [Configuration](docs/configuration.md) | Config file reference |\n| [Dependency Analysis](docs/dependency-analysis.md) | Security risk and replaceability review |\n\n---\n\n## Architecture\n\n```\nbin/nojs.js                     ← executable entry point\nsrc/\n  cli.js                        ← command dispatcher\n  commands/                     ← thin command wrappers\n  init/generator.js             ← project scaffold\n  dev/server.js                 ← HTTP server + SSE live reload\n  validate/rules.js             ← template validation rules\n  plugin/manager.js             ← plugin install/remove\n  prebuild/\n    runner.js                   ← plugin pipeline orchestrator\n    config.js                   ← config loader\n    html.js                     ← HTML file utilities\n    plugins/                    ← 26 built-in plugins\n__tests__/                      ← bun:test unit tests\n```\n\n**Zero production dependencies** (except `linkedom` for HTML parsing). Everything else uses Bun built-ins.\n\n---\n\n## Ecosystem\n\n### Bun Edition (this fork)\n\n| Tool | Description |\n|------|-------------|\n| [`@dieison-depra/nojs-bun`](https://github.com/dieison-depra/nojs-bun) | No.JS framework — Bun-native port ⭐ recommended pairing |\n| **`@dieison-depra/nojs-cli-bun`** | This package — Bun-native CLI |\n\n### Original (Node.js)\n\n| Tool | Description |\n|------|-------------|\n| [No.JS](https://github.com/ErickXavier/no-js) | The HTML-first reactive framework (original) |\n| [NoJS-CLI](https://github.com/ErickXavier/NoJS-CLI) | Original Node.js CLI (upstream of this fork) |\n| [NoJS-LSP](https://github.com/ErickXavier/nojs-lsp) | VS Code extension — autocomplete, hover docs, diagnostics |\n| [NoJS-MCP](https://github.com/ErickXavier/nojs-mcp) | MCP server — AI tools for building No.JS apps |\n\n---\n\n## Contributing\n\nContributions are welcome! Please read the [Contributing Guide](CONTRIBUTING.md) and our [Code of Conduct](CODE_OF_CONDUCT.md) before submitting a PR.\n\n- [Changelog](CHANGELOG.md)\n- [Security Policy](SECURITY.md)\n\n## License\n\n[MIT](LICENSE) © Erick Xavier\n\n---\n\n<p align=\"center\">\n  <strong>NoJS CLI — Bun Edition</strong> — The Bun-native command-line companion for No.JS<br>\n  Fork of <a href=\"https://github.com/ErickXavier/NoJS-CLI\">ErickXavier/NoJS-CLI</a> · <code>MIT License</code>\n</p>\n","readmeFilename":"README.md","_rev":"1-a843cd84b97d8a6c6f616c172322a99a"}