{"id":22245317,"url":"https://github.com/codefend/rollup-plugin-codefend","last_synced_at":"2025-07-28T02:32:50.401Z","repository":{"id":65205835,"uuid":"587258322","full_name":"Codefend/rollup-plugin-codefend","owner":"Codefend","description":"Rollup plugin for code obfuscation using Codefend, providing protection for your code regardless of the programming language or framework.","archived":false,"fork":false,"pushed_at":"2024-11-01T11:28:23.000Z","size":1362,"stargazers_count":4,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-09T11:20:45.837Z","etag":null,"topics":["codefend","obfuscation","rollup","rollup-plugin","uglify"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Codefend.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2023-01-10T10:32:18.000Z","updated_at":"2024-10-31T03:41:11.000Z","dependencies_parsed_at":"2024-08-18T11:09:03.717Z","dependency_job_id":null,"html_url":"https://github.com/Codefend/rollup-plugin-codefend","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codefend%2Frollup-plugin-codefend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codefend%2Frollup-plugin-codefend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codefend%2Frollup-plugin-codefend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codefend%2Frollup-plugin-codefend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Codefend","download_url":"https://codeload.github.com/Codefend/rollup-plugin-codefend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227857496,"owners_count":17830210,"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","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":["codefend","obfuscation","rollup","rollup-plugin","uglify"],"created_at":"2024-12-03T05:13:18.022Z","updated_at":"2024-12-03T05:13:20.637Z","avatar_url":"https://github.com/Codefend.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n \u003cimg src=\"./public/img/logo.png\"\u003e\n\u003c/p\u003e\n\n# rollup-plugin-codefend\n\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Codefend/rollup-plugin-codefend/ci.yaml?branch=main)\n![NPM](https://img.shields.io/npm/dt/rollup-plugin-codefend)\n![Bundlephobia](https://img.shields.io/bundlephobia/min/rollup-plugin-codefend)\n![Node version](https://img.shields.io/node/v/rollup-plugin-codefend)\n![NPM](https://img.shields.io/npm/l/rollup-plugin-codefend)\n\nRollup plugin for code obfuscation based on [Codefend](https://www.npmjs.com/package/codefend)\n\n## Installation\n\n```bash\nnpm install -D rollup-plugin-codefend\n```\n\n## Usage\n\n### `Step 1`: Configuration\n\nAdd to your `rollup.config.js`:\n\n#### Default options\n\n```js\nimport { codefend } from \"rollup-plugin-codefend\";\n\nexport default {\n  input:...,\n  output: ...,\n  plugins: [codefend()],\n};\n```\n\n#### Custom options\n\n```js\nimport { codefend } from \"rollup-plugin-codefend\";\n\nexport default {\n  input: ...,\n  output: ...,\n  plugins: [\n    codefend({\n      transformation:{\n            // the prefix to use for each obfuscated variable\n            prefix: \"Ox\",\n\n            // control how a specific variable should be obfuscated\n            static: [\n              {\n                from: \"predefined_secret\",\n                to: \"123456\",\n              },\n            ],\n\n            //will skip obfuscation for the following words\n            ignore: [\"node_modules\"],\n\n            /* By using everyday words such as books or lorem ipsum in the pool,\n            you can subtly obfuscate your code,\n            concealing its true nature without making it apparent that obfuscation is occurring.*/\n            pool: [\"QueenOfHeart\"],\n      },\n      debug: {\n            // to display detailed stats about the words that have been obfuscated\n            stats: true,\n      },\n    }),\n  ],\n};\n```\n\nFor a more detailed explanation, refer to the [configuration](https://codefend.github.io/docs/references/configuration) section of the `codefend` docs.\n\n### `Step 2`: Naming convention\n\nIn your code, `add prefixes to the words that you want Codefend to encrypt.`\n\n`Make sure to read the `[`Philosophy`](https://github.com/Codefend/core#philosophy)` behind Codefend obfuscation First to understand why Codefend can work with any code written in any language.`\n\n```js\n//node js example\n//as a starting point:  prefix the words that should be encrypted with l_\n\nclass l_Calculator {\n  l_sum(l_a, l_b) {\n    const l_results = l_a + l_b;\n    console.log(\"node_modules\");\n    console.log(\"predefined_secret\");\n    return l_results;\n  }\n}\n\n//\u003e\u003e\u003e\u003e\u003e\u003e==== Will Become ======\u003c\u003c\u003c\u003c\u003c\u003c\n\nclass QueenOfHeart /* 'QueenOfHeart' defined in pool*/ {\n  /* Ox1, Ox2... prefix transformation*/\n  Ox1(Ox2, Ox3) {\n    const Ox4 = Ox2 + Ox3;\n    console.log(\"node_modules\"); // has not been obfuscated\n    console.log(\"123456\"); // has transformed from \"predefined_secret\" to \"123456\"\n    return Ox4;\n  }\n}\n```\n\n```html\n\u003c!-- Html example, can work also with Angular,React,Vue,Svelte... in the same way --\u003e\n\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cstyle\u003e\n      .l_red {\n        color: red;\n      }\n    \u003c/style\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cdiv class=\"l_red\"\u003el_secret\u003c/div\u003e\n    \u003cdiv class=\"l_red\"\u003eHello World\u003c/div\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n\n\u003c!-- Will Become --\u003e\n\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cstyle\u003e\n      .Ox1 {\n        color: red;\n      }\n    \u003c/style\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cdiv class=\"Ox1\"\u003eOx0\u003c/div\u003e\n    \u003cdiv class=\"Ox1\"\u003eHello World\u003c/div\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Examples\n\n1. ### [`Node js`](./examples/nodejs/)\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## License\n\n[MIT](./LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodefend%2Frollup-plugin-codefend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodefend%2Frollup-plugin-codefend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodefend%2Frollup-plugin-codefend/lists"}