{"id":18153447,"url":"https://github.com/thinknathan/tstl-const-propagation","last_synced_at":"2026-03-17T18:36:26.841Z","repository":{"id":211012827,"uuid":"727983546","full_name":"thinknathan/tstl-const-propagation","owner":"thinknathan","description":"TypeScriptToLua plugin that performs constant propagation and constant folding","archived":false,"fork":false,"pushed_at":"2026-02-01T17:52:55.000Z","size":483,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-02T02:01:18.052Z","etag":null,"topics":["constant-folding","constant-propagation","lua","tstl","tstl-extension","tstl-plugin","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thinknathan.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-12-06T01:26:57.000Z","updated_at":"2026-02-01T17:52:52.000Z","dependencies_parsed_at":"2024-02-19T06:25:44.144Z","dependency_job_id":"db9c91c7-9396-4eb6-a1ec-cec9abe6c7b4","html_url":"https://github.com/thinknathan/tstl-const-propagation","commit_stats":null,"previous_names":["thinknathan/tstl-const-propagation"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/thinknathan/tstl-const-propagation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinknathan%2Ftstl-const-propagation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinknathan%2Ftstl-const-propagation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinknathan%2Ftstl-const-propagation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinknathan%2Ftstl-const-propagation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinknathan","download_url":"https://codeload.github.com/thinknathan/tstl-const-propagation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinknathan%2Ftstl-const-propagation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30628418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: 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":["constant-folding","constant-propagation","lua","tstl","tstl-extension","tstl-plugin","typescript"],"created_at":"2024-11-02T03:07:05.067Z","updated_at":"2026-03-17T18:36:26.816Z","avatar_url":"https://github.com/thinknathan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tstl-const-propagation\n\n[![CI](https://github.com/thinknathan/tstl-const-propagation/actions/workflows/ci.yml/badge.svg)](https://github.com/thinknathan/tstl-const-propagation/actions/workflows/ci.yml) ![GitHub License](https://img.shields.io/github/license/thinknathan/tstl-const-propagation)\n\nTypeScriptToLua plugin that performs [constant propagation](https://en.wikipedia.org/wiki/Constant_folding#Constant_propagation).\n\nAs of v2.0.0, [constant folding](https://en.wikipedia.org/wiki/Constant_folding) is also performed.\n\nThe variable label must be written in SNAKE_CASE to be eligible.\n\n## Limitations\n\n- Only applies to local variables that are declared in a single statement on their own line: multi-line declarations and variables that are declared and written in separate statements are not eligible\n- Only operates on one file at a time: cannot copy variables between separate files\n- Only applies to values that are string literals or numeric literals\n- Only intended for use with actual constants (values that do not change at runtime)\n\nRedundancy warning: Your target Lua runtime may already perform constant propagation and constant folding.\n\n:exclamation: Use this and any code transformation plugin with caution. Mistakes are possible.\n\n## Example\n\n```ts\nconst FOO = 60;\nbar(FOO);\nconst result = FOO + 40;\n```\n\nBecomes:\n\n```lua\nbar(60)\nlocal result = 100\n```\n\n## Installation\n\nRequires TSTL \u003e= 1.22.0\n\n1. Install this plugin\n\n```bash\nyarn add tstl-const-propagation -D\n# or\nnpm install tstl-const-propagation --save-dev\n```\n\n2. Add `tstl-const-propagation` to `tstl.luaPlugins` in `tsconfig.json`\n\n```diff\n{\n\t\"tstl\": {\n\t\t\"luaPlugins\": [\n+\t\t\t{ \"name\": \"tstl-const-propagation\" }\n\t\t],\n\t}\n}\n```\n\n## License\n\nCC0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinknathan%2Ftstl-const-propagation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinknathan%2Ftstl-const-propagation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinknathan%2Ftstl-const-propagation/lists"}