{"id":27423631,"url":"https://github.com/danielhaim1/packr","last_synced_at":"2026-02-24T15:36:57.623Z","repository":{"id":286285995,"uuid":"957186039","full_name":"danielhaim1/packr","owner":"danielhaim1","description":"Fast asset pipeline built in Rust for processing JavaScript and SCSS","archived":false,"fork":false,"pushed_at":"2025-10-31T19:32:43.000Z","size":342,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-31T21:17:44.670Z","etag":null,"topics":["asset-compilation","asset-pipeline","build-pipeline","build-tools","fast-pipeline","front-end-tools","frontend-optimization","javascript-processing","js-minification","rust","rust-assets","rust-js-compiler","rust-scss-compiler","rust-web-tools","scss-minification","scss-processing","static-assets","web-assets","web-optimization","web-performance"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielhaim1.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-29T18:56:01.000Z","updated_at":"2025-10-31T19:32:46.000Z","dependencies_parsed_at":"2025-04-05T13:45:20.266Z","dependency_job_id":"7b015388-54e0-4ecb-95ed-9c7211e626b7","html_url":"https://github.com/danielhaim1/packr","commit_stats":null,"previous_names":["danielhaim1/packr"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/danielhaim1/packr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielhaim1%2Fpackr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielhaim1%2Fpackr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielhaim1%2Fpackr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielhaim1%2Fpackr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielhaim1","download_url":"https://codeload.github.com/danielhaim1/packr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielhaim1%2Fpackr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29788271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T10:45:18.109Z","status":"ssl_error","status_checked_at":"2026-02-24T10:45:09.911Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asset-compilation","asset-pipeline","build-pipeline","build-tools","fast-pipeline","front-end-tools","frontend-optimization","javascript-processing","js-minification","rust","rust-assets","rust-js-compiler","rust-scss-compiler","rust-web-tools","scss-minification","scss-processing","static-assets","web-assets","web-optimization","web-performance"],"created_at":"2025-04-14T10:46:17.469Z","updated_at":"2026-02-24T15:36:57.617Z","avatar_url":"https://github.com/danielhaim1.png","language":"Rust","readme":"# Packr\n[![npm downloads](https://img.shields.io/npm/dm/@danielhaim/packr.svg)](https://www.npmjs.com/package/@danielhaim/packr)\n[![GitHub issues](https://img.shields.io/github/issues/danielhaim1/packr.svg)](https://github.com/danielhaim1/packr/issues)\n[![Node.js version](https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg)](https://nodejs.org)\n[![Rust version](https://img.shields.io/badge/rust-%3E%3D1.70-orange.svg)](https://www.rust-lang.org)\n[![License](https://img.shields.io/github/license/danielhaim1/packr.svg)](https://github.com/danielhaim1/packr/blob/main/LICENSE)\n\nA fast asset pipeline built in Rust for processing JavaScript and SCSS.\n\n---\n\n## Requirements\n\n- Node.js \u003e= 18  \n- Rust \u003e= 1.70  \n- npm \u003e= 9\n\n---\n\n## Installation\n\n```bash\n# Install from npm\nnpm install @danielhaim/packr\n\n# Or install globally\nnpm install -g @danielhaim/packr\n```\n\n---\n\n## Usage\n\nPackr can be used via the JavaScript API, a `packr.json` config file, or the CLI.\n\n### JavaScript API\n\n```js\nconst packr = require('@danielhaim/packr');\n\npackr({\n  scss_input: 'src/scss/app.scss',\n  scss_output: 'dist/app.css',\n  js_input: 'src/js/app.js',\n  js_output: 'dist/app.js',\n  minify: true,\n  watch: false\n});\n```\n\n### Configuration File\n\nCreate a `packr.json` in your project root:\n\n```json\n{\n  \"scss_input\": \"src/scss/app.scss\",\n  \"scss_output\": \"dist/app.css\",\n  \"js_input\": \"src/js/app.js\",\n  \"js_output\": \"dist/app.js\",\n  \"css_destination\": \"public/css\",\n  \"js_destination\": \"public/js\",\n  \"minify\": true,\n  \"target\": \"es2020\",\n  \"verbose\": true,\n  \"sourcemap\": true,\n  \"format\": \"iife\",\n  \"watch\": true\n}\n```\n\nThen run:\n\n```js\nconst packr = require('@danielhaim/packr');\npackr(); // Loads from .packr.json\n```\n\n### CLI\n\n```bash\n# Default config (packr.json or .packr.json)\npackr\n\n# Use a specific config file\npackr --config custom/packr.json\n\n# Enable watch mode\npackr --watch\n```\n\n---\n\n## Configuration Options\n\n| Option            | Type      | Default     | Description                                    |\n|------------------|-----------|-------------|------------------------------------------------|\n| `scss_input`     | `string`  | _required_  | Path to SCSS input file                        |\n| `scss_output`    | `string`  | _required_  | Path to SCSS output file                       |\n| `js_input`       | `string`  | _required_  | Path to JavaScript input file                  |\n| `js_output`      | `string`  | _required_  | Path to JavaScript output file                 |\n| `css_destination`| `string`  | —           | Optional alternate output path for CSS         |\n| `js_destination` | `string`  | —           | Optional alternate output path for JS          |\n| `minify`         | `boolean` | `true`      | Minify the output                              |\n| `target`         | `string`  | `'es2020'`  | JavaScript target version                      |\n| `watch`          | `boolean` | `false`     | Watch files for changes                        |\n| `verbose`        | `boolean` | `false`     | Enable extra console output                    |\n| `sourcemap`      | `boolean` | `false`     | Include source maps in the output              |\n| `format`         | `string`  | `'iife'`    | Output format: `iife`, `cjs`, or `esm`         |\n| `eslint`         | `boolean` | `false`     | Enable ESLint checking                         |\n| `eslint_config`  | `string`  | —           | Path to custom ESLint config file              |\n\n## Environment Configuration\n\nPackr supports configuration through environment variables, which can be set in environment files in your project root. This allows for flexible configuration across different environments.\n\n### Environment Files\n\nPackr loads environment variables from the following files in order of precedence (highest to lowest):\n\n1. `.env` (base configuration)\n2. `.env-{NODE_ENV}` (e.g., `.env-production`, `.env-staging`)\n3. `.env-local` (only in development mode)\n\n### Security Best Practices\n\nWhen working with environment files and sensitive data:\n\n1. **File Security**\n   - Never commit `.env` files to version control\n   - Use `.env.example` as a template (included in repo)\n   - Set restrictive permissions: `chmod 600 .env*`\n   - Keep environment files outside of public directories\n\n2. **Sensitive Data**\n   - Use strong, unique values for API keys and secrets\n   - Avoid using test/example values in production\n   - Never log sensitive values in production\n   - Rotate secrets regularly\n\n3. **Production Checks**\n   - Required variables are validated\n   - File permissions are verified\n   - Sensitive variables are masked in logs\n   - Example/test values are rejected\n\n4. **Development Safety**\n   - Use `.env-local` for development-only values\n   - Keep production secrets separate from development\n   - Document required variables in `.env.example`\n\n### Available Environment Variables\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `PACKR_SCSS_INPUT` | Path to SCSS input file | - |\n| `PACKR_SCSS_OUTPUT` | Path to output compiled CSS | - |\n| `PACKR_JS_INPUT` | Path to JavaScript input file | - |\n| `PACKR_JS_OUTPUT` | Path to output bundled JS | - |\n| `PACKR_CSS_DESTINATION` | Output directory for CSS | - |\n| `PACKR_JS_DESTINATION` | Output directory for JS | - |\n| `PACKR_MINIFY` | Minify output | `true` |\n| `PACKR_TARGET` | JavaScript target | `es2020` |\n| `PACKR_VERBOSE` | Enable verbose logging | `false` |\n| `PACKR_SOURCEMAP` | Generate source maps | `false` |\n| `PACKR_FORMAT` | JavaScript output format (iife, cjs, esm) | `iife` |\n| `PACKR_ESLINT` | Enable ESLint | `false` |\n| `PACKR_ESLINT_CONFIG` | Path to ESLint config | - |\n| `PACKR_MINIFY_JS` | JavaScript-specific minification | `true` |\n| `PACKR_MINIFY_CSS` | CSS-specific minification | `true` |\n| `PACKR_UGLIFY_MANGLE` | Enable name mangling | `true` |\n| `PACKR_UGLIFY_KEEP_FNAMES` | Preserve function names | `false` |\n| `PACKR_UGLIFY_KEEP_CLASSNAMES` | Preserve class names | `false` |\n| `PACKR_UGLIFY_RESERVED` | Comma-separated list of names to preserve | - |\n\n### Example .env File\n\n```\nPACKR_SCSS_INPUT=src/scss/app.scss\nPACKR_SCSS_OUTPUT=dist/app.css\nPACKR_JS_INPUT=src/js/app.js\nPACKR_JS_OUTPUT=dist/app.js\nPACKR_CSS_DESTINATION=public/css\nPACKR_JS_DESTINATION=public/js\nPACKR_MINIFY=true\nPACKR_TARGET=es2020\nPACKR_VERBOSE=false\nPACKR_SOURCEMAP=false\nPACKR_FORMAT=iife\nPACKR_ESLINT=false\n```\n\nEnvironment variables take precedence over configuration file options, allowing you to override settings for specific environments without changing your configuration files.\n\n### Minification Options\n\nPackr provides granular control over minification and uglification:\n\n#### Basic Minification\n- `PACKR_MINIFY`: Global switch for all minification (default: `true`)\n- `PACKR_MINIFY_JS`: JavaScript-specific minification (default: `true`)\n- `PACKR_MINIFY_CSS`: CSS-specific minification (default: `true`)\n\n#### JavaScript Uglification\n- `PACKR_UGLIFY_MANGLE`: Enable name mangling (default: `true`)\n- `PACKR_UGLIFY_KEEP_FNAMES`: Preserve function names (default: `false`)\n- `PACKR_UGLIFY_KEEP_CLASSNAMES`: Preserve class names (default: `false`)\n- `PACKR_UGLIFY_RESERVED`: Comma-separated list of names to preserve (e.g., `jQuery,$`)\n\nExample configuration in `.packr.json`:\n```json\n{\n  \"minify\": true,\n  \"minify_js\": true,\n  \"minify_css\": true,\n  \"uglify\": {\n    \"mangle\": true,\n    \"keep_fnames\": false,\n    \"keep_classnames\": false,\n    \"reserved\": [\"jQuery\", \"$\"]\n  }\n}\n```\n\nThe minification process:\n1. **JavaScript**:\n   - Removes whitespace and comments\n   - Shortens variable names (mangling)\n   - Optimizes code structure\n   - Preserves specified names\n\n2. **CSS**:\n   - Removes whitespace and comments\n   - Combines identical selectors\n   - Optimizes property values\n   - Removes unused rules\n\n---\n\n## Testing\n\nPackr includes a comprehensive test suite that covers various build scenarios:\n\n### Test Cases\n\n1. **Default Configuration**\n   - Tests default Packr settings with IIFE format and sourcemaps\n   - Verifies basic SCSS and JavaScript compilation\n\n2. **Custom Config File**\n   - Tests custom configuration with different paths and settings\n   - Validates alternate destination paths for CSS and JS\n\n3. **ESM Format**\n   - Tests Packr with ESM (ECMAScript Modules) output format\n   - Ensures proper module bundling\n\n4. **No Sourcemaps**\n   - Tests builds with sourcemaps disabled\n   - Verifies clean output without map files\n\n5. **Minification**\n   - Tests minification of both SCSS and JavaScript\n   - Validates `.min` file generation\n\n6. **ESLint Integration**\n   - Tests JavaScript linting with ESLint\n   - Provides detailed warning summaries with line numbers\n   - Supports custom ESLint configurations\n\n### Running Tests\n\n```bash\n# Run all tests\nnode __tests__/test.js\n\n# Run specific test\nnode __tests__/test.js --test \"Default Packr Configuration\"\nnode __tests__/test.js --test \"Custom Config File\"\nnode __tests__/test.js --test \"ESM Format\"\nnode __tests__/test.js --test \"No Sourcemaps\"\nnode __tests__/test.js --test \"Minification\"\nnode __tests__/test.js --test \"ESLint\"\n```\n\n### ESLint Integration\n\nPackr includes built-in ESLint support for JavaScript files:\n\n```json\n{\n  \"eslint\": true,\n  \"eslintConfig\": \".eslintrc.json\"\n}\n```\n\nESLint warnings are displayed in a detailed format:\n```\nFile: src/js/app.js\nWarnings:\n  Line 8, Column 5: no-var - Unexpected var, use let or const instead.\n  Line 15, Column 9: prefer-const - 'y' is never reassigned. Use 'const' instead.\n  Line 16, Column 13: semi - Missing semicolon.\n  Line 38, Column 5: no-var - Unexpected var, use let or const instead.\n```\n\n---\n\n## Performance\n\nPackr uses Rust for fast and efficient asset builds:\n\n- **SCSS**: Compiled with the Rust-based [`grass`](https://github.com/connorskees/grass)\n- **JavaScript**: Bundled using [`esbuild`](https://github.com/evanw/esbuild)\n- **CSS Optimization**: Handled by [`lightningcss`](https://github.com/parcel-bundler/lightningcss)\n- **Memory + Speed**: Lightweight, with fast cold and incremental builds\n\n---\n\n## Roadmap\n\n### Core Features\n- [ ] PostCSS integration\n- [ ] SortCSS integration\n- [ ] TypeScript support\n- [ ] CSS Modules support\n- [ ] Source map improvements\n- [ ] Incremental builds\n- [ ] Tree-shaking / dead code elimination\n- [ ] Asset hashing / versioning\n- [ ] Multi-entry compilation support\n\n### Tooling \u0026 Plugins\n- [ ] Improve environment-based config support (`.env`, NODE_ENV, etc.)\n\n### Developer Experience\n- [ ] Watch mode with hot reload hooks\n- [ ] Verbose and colorized logging\n- [ ] Build profiling (timing per task)\n- [ ] Interactive CLI or TUI dashboard\n\n### Output \u0026 Format Options\n- [ ] Custom JS output formats (CommonJS, ESM, IIFE)\n- [ ] Configurable output directory structure\n\n---\n\n## Contributing\n\nSee the [Contributing Guide](CONTRIBUTING.md) for details on submitting issues or PRs.\n\n---\n\n## Security\n\nIf you find a security issue, please report it privately via a GitHub discussion. Avoid using the issue tracker.\n\n---\n\n## License\n\nPackr is licensed under the [Apache License 2.0](LICENSE).\n\n---\n\n## Credits\n\nPackr is built with:\n\n- [esbuild](https://github.com/evanw/esbuild) – JavaScript bundler\n- [grass](https://github.com/connorskees/grass) – SCSS compiler in Rust\n- [lightningcss](https://github.com/parcel-bundler/lightningcss) – CSS optimizer","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielhaim1%2Fpackr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielhaim1%2Fpackr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielhaim1%2Fpackr/lists"}