{"id":17922538,"url":"https://github.com/rreverser/pure-cjs","last_synced_at":"2025-07-25T11:34:30.183Z","repository":{"id":57158500,"uuid":"14908999","full_name":"RReverser/pure-cjs","owner":"RReverser","description":"Pure minimalistic CommonJS builder","archived":false,"fork":false,"pushed_at":"2015-05-26T16:19:37.000Z","size":551,"stargazers_count":44,"open_issues_count":5,"forks_count":7,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-07-19T11:53:39.766Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npmjs.org/package/pure-cjs","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RReverser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-03T23:37:46.000Z","updated_at":"2019-01-30T16:37:03.000Z","dependencies_parsed_at":"2022-09-07T20:33:48.430Z","dependency_job_id":null,"html_url":"https://github.com/RReverser/pure-cjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RReverser/pure-cjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RReverser%2Fpure-cjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RReverser%2Fpure-cjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RReverser%2Fpure-cjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RReverser%2Fpure-cjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RReverser","download_url":"https://codeload.github.com/RReverser/pure-cjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RReverser%2Fpure-cjs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266998138,"owners_count":24018951,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-28T20:39:33.578Z","updated_at":"2025-07-25T11:34:30.125Z","avatar_url":"https://github.com/RReverser.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pure-cjs\n\nPure CommonJS Modules builder.\n\n## Features\n\n* Minimal destination overhead (almost as small as concatenated file).\n* Resolves all the paths on build stage to static number identifiers (so saves space and execution time used for storing and resolving string paths, but should be used only for projects with static `require('./some/module')` calls and would fail on others (same restriction applicable for [r.js (Simplified CommonJS wrapper)](http://requirejs.org/docs/whyamd.html#sugar) and most projects already match this).\n* Ability to export `module.exports` from top module in [UMD](https://github.com/umdjs/umd) style (useful for building libs).\n* Allows to use [through](https://github.com/dominictarr/through)-stream(s) for pre-transformations.\n* Supports modules installed as `npm` dependencies in `node_modules` hierarchy.\n* Does not corrupt `require('systemModule')` calls, transforms only local ones.\n\n## Console usage\n\nInstallation:\n```bash\nnpm install -g pure-cjs\n```\n\nCommand-line options:\n```\n-h, --help             output usage information\n-V, --version          output the version number\n-i, --input \u003cfile\u003e     input file (required)\n-o, --output \u003cfile\u003e    output file (defaults to \u003cinput\u003e.out.js)\n-m, --map \u003cfile\u003e       file to store source map to (optional, defaults to \u003coutput\u003e.map)\n-c, --comments         preserve comments in output\n-e, --exports \u003cid\u003e     top module exports destination (optional)\n-x, --extension \u003cext\u003e  default extension for requires (defaults to \"js\")\n-d, --module-dir \u003cdir\u003e modules directory name to look in (defaults to \"node_modules\")\n-s, --external [hash]  external modules (names or JSON hashes)\n```\n\nExample:\n```bash\npure-cjs \\\n    --input src/index.js \\\n    --output dist/index.js \\\n    --map \\\n    --exports SuperLib \\\n    --external lodash \\\n    --external '{\"jquery\": {\"global\": \"$\", \"amd\": \"../vendor/jquery.js\"}}'\n```\n\n## Usage from Grunt\n\nCheck out [grunt-pure-cjs](https://github.com/RReverser/grunt-pure-cjs) to use builder as [Grunt](https://gruntjs.com/) plugin.\n\n## Usage from Gulp\n\nCheck out [gulp-pure-cjs](https://github.com/parroit/gulp-pure-cjs) to use builder as [Gulp](http://gulpjs.com/) plugin.\n\n## Usage from Node.js code\n\n```javascript\nvar cjs = require('pure-cjs');\n\ncjs.transform(options).then(function (result) {\n    // handle successful result\n}, function (err) {\n    // handle error\n});\n```\n\n### Options object\n\n* `input`: `String` | `Function()`. \u003cbr /\u003e\n  Input file.\u003cbr /\u003e\n  Example: `'superLib/topModule.js'`\n\n* `output`: `String` | `Function(input)`\u003cbr /\u003e\n  Output file.\u003cbr /\u003e\n  Default: `input =\u003e input.replace(/(\\.js)?$/, '.out.js')`\n\n* `map`: `Boolean` | `String` | `Function(input, output)`\u003cbr /\u003e\n  Source map.\u003cbr /\u003e\n  Default: `false` (don't generate source map).\n\n* `comments`: `Boolean`\u003cbr /\u003e\n  Preserve comments in output.\u003cbr /\u003e\n  Default: `false`\n\n* `external`: `{ cjsName: (true | { amd?: String, global?: String }) }`\u003cbr /\u003e\n  External dependencies (to be excluded from bundling). Example:\n  ```javascript\n  {\n    jquery: true,\n    lodash: {amd: '../vendor/lodash.js', global: '_'}\n  }\n  ```\n\n* `exports`: `String` | `Function(input, output)`\u003cbr /\u003e\n  Export top module with [UMD](https://github.com/umdjs/umd) with given global object name.\u003cbr /\u003e\n  Default: no exports.\n\n* `transform`: `Array` | `Function(input)`\u003cbr /\u003e\n  Browserify plugins ([through](https://github.com/dominictarr/through)-stream(s) to be used against input files).\n\n* `moduleDir`: `String`\u003cbr /\u003e\n  Modules directory name.\u003cbr /\u003e\n  Default: `\"node_modules\"`\n\n* `defaultExt`: `String`\u003cbr /\u003e\n  Default extension for require calls (`\"js\"`).\n\n* `dryRun`: `Boolean`\u003cbr /\u003e\n  Don't write output to disk (and don't append `//# sourceMappingURL=...` to code).\u003cbr /\u003e\n  Default: `false`\n\n### Result object\n\n* **code**: `String` \u0026mdash; generated source code.\n* **map**: `Object` \u0026mdash; source map object.\n* **options**: `Object` \u0026mdash; options object with resolved defaults and paths.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frreverser%2Fpure-cjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frreverser%2Fpure-cjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frreverser%2Fpure-cjs/lists"}