{"id":25069,"library":"chokibasic","title":"chokibasic","description":"A minimal build-and-watch utility wrapping chokidar, esbuild, sass, csso, and pxpros for simple static websites. Version 1.1.11 (2025) provides debounced file watchers, SCSS compilation + minification, JS bundling + minification, PHP template rendering via pxpros, sitemap generation, and dist export with .gitignore support. Unlike full-featured bundlers (Vite, Webpack), chokibasic is intentionally low-config and suited for small projects. ESM-only, ships TypeScript definitions, and has no runtime dependencies on the framework level (deps are bundled).","status":"active","version":"1.1.11","language":"javascript","source_language":"en","source_url":"https://github.com/ZmotriN/chokibasic","tags":["javascript","chokidar","watch","sass","esbuild","csso","typescript"],"install":[{"cmd":"npm install chokibasic","lang":"bash","label":"npm"},{"cmd":"yarn add chokibasic","lang":"bash","label":"yarn"},{"cmd":"pnpm add chokibasic","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"File watching engine used by createWatchers","package":"chokidar","optional":false},{"reason":"SCSS compilation in buildCSS","package":"sass","optional":false},{"reason":"CSS minification after sass compilation","package":"csso","optional":false},{"reason":"JS bundling and minification in buildJS","package":"esbuild","optional":false},{"reason":"PHP template rendering and sitemap generation (buildPHP, buildSitemap)","package":"pxpros","optional":false}],"imports":[{"note":"Package is ESM-only; using require() with destructuring will fail. Use dynamic import or set type: module.","wrong":"const createWatchers = require('chokibasic').createWatchers","symbol":"createWatchers","correct":"import { createWatchers } from 'chokibasic'"},{"note":"Named exports only; no default export exists.","wrong":"const chokibasic = require('chokibasic'); chokibasic.buildCSS(...)","symbol":"buildCSS","correct":"import { buildCSS } from 'chokibasic'"},{"note":"Default import is undefined; must use named import.","wrong":"import buildJS from 'chokibasic'","symbol":"buildJS","correct":"import { buildJS } from 'chokibasic'"}],"quickstart":{"code":"import { createWatchers, buildCSS, buildJS } from 'chokibasic';\n\nconst watcher = createWatchers([\n  {\n    name: 'css',\n    patterns: ['src/styles/**/*.scss'],\n    callback: async (events) => {\n      console.log('CSS changed:', events);\n      await buildCSS('src/styles/main.scss', 'dist/app.min.css');\n    }\n  },\n  {\n    name: 'js',\n    patterns: ['src/scripts/**/*.js'],\n    ignored: ['**/*.min.js'],\n    callback: async (events) => {\n      console.log('JS changed:', events);\n      await buildJS('src/scripts/main.js', 'dist/app.min.js');\n    }\n  }\n], { debug: true });\n\nprocess.on('SIGINT', async () => {\n  await watcher.close();\n  process.exit(0);\n});","lang":"typescript","description":"Sets up file watchers for SCSS and JS with automatic rebuild on change, plus graceful shutdown."},"warnings":[{"fix":"If you need 'add' or 'unlink' events, you must extend the watcher manually or fork the package.","message":"createWatchers only watches 'change' events; 'add' and 'unlink' listeners are commented out in source.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pass { sourceMap: true, style: 'expanded' } in options to get sourcemaps and expanded output.","message":"Default options for buildCSS include `style: 'compressed'` and no sourcemaps, which may hide debugging information.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Override platform and target in options, e.g., { platform: 'node', target: ['node14'] }.","message":"buildJS defaults to `platform: 'browser'` and `target: ['es2020']` — not suitable for Node.js or older browsers.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use ESM imports (import { ... } from 'chokibasic') or switch to dynamic import() inside CommonJS.","message":"The `require()` usage shown in older documentation is incompatible with the current ESM-only distribution.","severity":"deprecated","affected_versions":">=1.1.0"},{"fix":"Ensure pxpros is installed and configured (e.g., via a pxpros.config.js) before calling these functions.","message":"buildPHP and buildSitemap require pxpros to be installed and configured separately; no default configuration is provided.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Test with your .gitignore; consider using a dedicated tool like 'fdir' for more robust copying.","message":"exportDist reads .gitignore from project root, but only respects basic patterns; complex negation rules may not work.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use import statements or set type: module in package.json and use import syntax.","message":"v1.1.0 switched from CommonJS to ESM, breaking all require() usage.","severity":"breaking","affected_versions":">=1.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use dynamic import: const { createWatchers } = await import('chokibasic'); or convert your project to ESM.","cause":"The package uses ES modules (exports .mjs or type: module) and cannot be require()'d in CommonJS.","error":"ERR_REQUIRE_ESM: require() of ES Module /path/to/node_modules/chokibasic/index.mjs not supported."},{"fix":"Use named import: import { createWatchers } from 'chokibasic';","cause":"Default import returns undefined because the package only exports named exports.","error":"TypeError: chokibasic.createWatchers is not a function"},{"fix":"Run: npm install pxpros","cause":"pxpros is an optional peer dependency; it must be installed separately for buildPHP and buildSitemap to work.","error":"Error: Cannot find module 'pxpros'"},{"fix":"Add \"type\": \"module\" to your package.json, or use .mjs extension for your entry file.","cause":"The package is ESM-only, but the consuming environment (e.g., Node.js without type: module) expects CommonJS.","error":"SyntaxError: Unexpected token 'export'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}