{"id":28563854,"url":"https://github.com/nikaple/swc-plugin-bigint-literal","last_synced_at":"2026-02-12T08:03:49.720Z","repository":{"id":280740102,"uuid":"943002603","full_name":"Nikaple/swc-plugin-bigint-literal","owner":"Nikaple","description":"A SWC compiler plugin that transforms BigInt literals.","archived":false,"fork":false,"pushed_at":"2025-03-07T11:14:46.000Z","size":88,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-13T19:14:55.503Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nikaple.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-03-05T02:51:05.000Z","updated_at":"2025-03-07T11:14:45.000Z","dependencies_parsed_at":"2025-03-05T04:35:09.001Z","dependency_job_id":null,"html_url":"https://github.com/Nikaple/swc-plugin-bigint-literal","commit_stats":null,"previous_names":["nikaple/swc-plugin-bigint-literal"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikaple%2Fswc-plugin-bigint-literal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikaple%2Fswc-plugin-bigint-literal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikaple%2Fswc-plugin-bigint-literal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikaple%2Fswc-plugin-bigint-literal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nikaple","download_url":"https://codeload.github.com/Nikaple/swc-plugin-bigint-literal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikaple%2Fswc-plugin-bigint-literal/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259081009,"owners_count":22802404,"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":[],"created_at":"2025-06-10T13:08:54.178Z","updated_at":"2026-02-12T08:03:49.693Z","avatar_url":"https://github.com/Nikaple.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SWC Plugin BigInt Literal\n\nA SWC compiler plugin that transforms BigInt literals in JavaScript code. It converts BigInt literals into `BigInt()` function calls and decomposes large numbers into arithmetic expressions.\n\n## Features\n\n- Supports transformation of all numeric literal formats:\n  - Decimal (e.g., `123n`)\n  - Hexadecimal (e.g., `0xffn`)\n  - Binary (e.g., `0b1111n`)\n  - Octal (e.g., `0o777n`)\n- Handles numbers both within and beyond the safe integer range\n- Preserves original number representation format\n- Supports negative numbers\n- Supports transformation within expressions\n\n## Transform Examples\n\n```javascript\n// Basic transformations\n123n          -\u003e BigInt(123)\n0xffn         -\u003e BigInt(255)\n0b1111n       -\u003e BigInt(15)\n0o777n        -\u003e BigInt(511)\n\n// Negative numbers\n-42n          -\u003e -BigInt(42)\n-0xffn        -\u003e -BigInt(255)\n\n// Expressions\n1n + 2n       -\u003e BigInt(1) + BigInt(2)\n\n// Large numbers\n9007199254740992n -\u003e BigInt(9007199254740991) + BigInt(1)\n\n// Very large numbers\n730750818665451215712927172538123444058715062272n -\u003e \n    BigInt(9007199254740991) * BigInt(9007199254740991) * BigInt(9007199254740991) + BigInt(1)\n```\n\n## How it Works\n\n1. For numbers within JavaScript's safe integer range ([-2^53 + 1, 2^53 - 1]):\n   - Directly converts to `BigInt()` calls\n   - Preserves the original number format\n\n2. For numbers beyond the safe integer range:\n   - Decomposes into arithmetic expressions using safe integers\n   - Uses base-MAX_SAFE_INTEGER representation\n   - Generates optimal expressions to minimize operations\n   - Ensures all intermediate values are within safe range\n\n## Usage\n\n1. Install the plugin:\n   ```bash\n   npm install --save-dev swc-plugin-bigint-literal\n   ```\n\n2. Configure `.swcrc`:\n   ```json\n   {\n     \"jsc\": {\n       \"experimental\": {\n         \"plugins\": [\n           [\"swc-plugin-bigint-literal\", {}]\n         ]\n       }\n     }\n   }\n   ```\n\n## Development Requirements\n\n- Rust\n- wasm32-wasip1 target\n- Node.js \u003e= 14.0.0\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikaple%2Fswc-plugin-bigint-literal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikaple%2Fswc-plugin-bigint-literal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikaple%2Fswc-plugin-bigint-literal/lists"}