{"id":18153426,"url":"https://github.com/thinknathan/tstl-simple-inline-func","last_synced_at":"2025-04-30T16:08:32.994Z","repository":{"id":211046658,"uuid":"728063314","full_name":"thinknathan/tstl-simple-inline-func","owner":"thinknathan","description":"TypeScriptToLua plugin that performs inline expansion to simple functions","archived":false,"fork":false,"pushed_at":"2025-03-01T20:11:06.000Z","size":533,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T16:08:23.217Z","etag":null,"topics":["function-inlining","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}},"created_at":"2023-12-06T06:34:49.000Z","updated_at":"2025-02-01T04:34:50.000Z","dependencies_parsed_at":"2023-12-12T02:28:38.009Z","dependency_job_id":"19c8ba4f-77a5-497f-91d9-be5340be311b","html_url":"https://github.com/thinknathan/tstl-simple-inline-func","commit_stats":null,"previous_names":["thinknathan/tstl-simple-inline-func"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinknathan%2Ftstl-simple-inline-func","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinknathan%2Ftstl-simple-inline-func/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinknathan%2Ftstl-simple-inline-func/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinknathan%2Ftstl-simple-inline-func/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinknathan","download_url":"https://codeload.github.com/thinknathan/tstl-simple-inline-func/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251739652,"owners_count":21635892,"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":["function-inlining","lua","tstl","tstl-extension","tstl-plugin","typescript"],"created_at":"2024-11-02T03:07:00.005Z","updated_at":"2025-04-30T16:08:32.966Z","avatar_url":"https://github.com/thinknathan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tstl-simple-inline-func\n\n[![CI](https://github.com/thinknathan/tstl-simple-inline-func/actions/workflows/ci.yml/badge.svg)](https://github.com/thinknathan/tstl-simple-inline-func/actions/workflows/ci.yml) ![GitHub License](https://img.shields.io/github/license/thinknathan/tstl-simple-inline-func)\n\nTypeScriptToLua plugin that performs [inline expansion](https://en.wikipedia.org/wiki/Inline_expansion) to functions that you annotate.\n\nThis plugin is intended to handle functions that do NOT take parameters. If you need to handle parameters, try [TSTL-extensions by @Cheatoid](https://github.com/Cheatoid/TSTL-extensions) instead.\n\nInline expansion may or may not provide any performance benefit depending on your Lua runtime. Always measure with real world code.\n\n:exclamation: Use this and any code transformation plugin with caution. Mistakes are possible.\n\n## Usage\n\nAdd a comment containing `@inlineStart` before the function you want to inline, and `@inlineEnd` directly afterwards.\n\nExample:\n\n```ts\n/** @inlineStart */\nconst FOO = () =\u003e {\n\tconst BAR = 1 + 2 + 3;\n};\n/** @inlineEnd */\n\nFOO();\n```\n\nBecomes:\n\n```lua\n-- @inlineStart@inlineEnd\nlocal BAR = 1 + 2 + 3\n```\n\n### Subsequent comments\n\nKeep in mind, TSTL may choose to strip comments. If you have multiple inline functions next to each other, you may have to combine comments.\n\nThis example may NOT work because the first `@inlineEnd` may get stripped:\n\n```ts\n/** @inlineStart */\nconst FOO = () =\u003e {\n\t...\n};\n/** @inlineEnd */\n/** @inlineStart */\nconst BAR = () =\u003e {\n\t...\n};\n/** @inlineEnd */\n```\n\nThis example may work because we've combined the middle comments:\n\n```ts\n/** @inlineStart */\nconst FOO = () =\u003e {\n\t...\n};\n/** @inlineEnd @inlineStart */\nconst BAR = () =\u003e {\n\t...\n};\n/** @inlineEnd */\n```\n\n### Removing return\n\nTo strip the `return` keyword from your function, add a comment with `@removeReturn` somewhere after `@inlineStart`.\n\nExample:\n\n```ts\n/** @inlineStart @removeReturn */\nconst FOO = () =\u003e {\n\treturn 7;\n};\n/** @inlineEnd */\n\nconst BAR = FOO();\n```\n\nBecomes:\n\n```lua\n-- @inlineStart@inlineEnd\nlocal BAR =  7\n```\n\n## Installation\n\nRequires TSTL \u003e= 1.22.0\n\n`removeComments` in `tsconfig` cannot be `true`\n\n1. Install this plugin\n\n```bash\nyarn add tstl-simple-inline-func -D\n# or\nnpm install tstl-simple-inline-func --save-dev\n```\n\n2. Add `tstl-simple-inline-func` to `tstl.luaPlugins` in `tsconfig.json`\n\n```diff\n{\n\t\"tstl\": {\n\t\t\"luaPlugins\": [\n+\t\t\t{ \"name\": \"tstl-simple-inline-func\" }\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-simple-inline-func","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinknathan%2Ftstl-simple-inline-func","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinknathan%2Ftstl-simple-inline-func/lists"}