{"id":19505908,"url":"https://github.com/morlay/typescript-plugin-iife-enum","last_synced_at":"2025-10-26T11:15:28.079Z","repository":{"id":57383896,"uuid":"99297948","full_name":"morlay/typescript-plugin-iife-enum","owner":"morlay","description":null,"archived":false,"fork":false,"pushed_at":"2017-09-04T06:33:13.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-09T08:05:01.427Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/morlay.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}},"created_at":"2017-08-04T03:13:30.000Z","updated_at":"2017-08-04T03:14:50.000Z","dependencies_parsed_at":"2022-09-14T00:52:39.911Z","dependency_job_id":null,"html_url":"https://github.com/morlay/typescript-plugin-iife-enum","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/morlay/typescript-plugin-iife-enum","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Ftypescript-plugin-iife-enum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Ftypescript-plugin-iife-enum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Ftypescript-plugin-iife-enum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Ftypescript-plugin-iife-enum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morlay","download_url":"https://codeload.github.com/morlay/typescript-plugin-iife-enum/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morlay%2Ftypescript-plugin-iife-enum/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264419471,"owners_count":23605198,"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":"2024-11-10T22:34:51.142Z","updated_at":"2025-10-26T11:15:27.996Z","avatar_url":"https://github.com/morlay.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## typescript-plugin-iife-enum\n\nA TypeScript transform to wrapper enum in IIFE.\n\n### Purpose\n\nFor now TypeScript will transform enum from\n\n```ts\nenum Test {\n    Key = 1\n}\n```\nto\n\n```ts\nvar Test;\n(function (Test) {\n    Test[Test[\"Key\"] = 1] = \"Key\";\n})(Test || (Test = {}));\n```\n\nThis result is not friendly for uglyify.\n\nSo just wrapper IIFE for enum\n\n```\nconst Test = (() =\u003e {\n    enum Test {\n        Key = 1\n    }\n  \n    return Test\n})\n```\n\n## Usage \n\n```ts\n// 1. import default from the plugin module\nimport { createIIFEEnumTransformer } from 'typescript-plugin-iife-enum');\n\n// 2. add getCustomTransformer method to the loader config\nvar config = {\n    ...\n    module: {\n        rules: [\n            {\n                test: /\\.tsx?$/,\n                loader: 'ts-loader',\n                options: {\n                    ... // other loader's options\n                    getCustomTransformers: () =\u003e ({ before: [createIIFEEnumTransformer()] })\n                }\n            }\n        ]\n    }\n    ...\n};\n```\n\n## Know Issue\n\nTypeScript will drop leading comments of call expression, \ncan use babel with [plugin](https://github.com/morlay/babel-plugin-annotate-pure-call-in-variable-declarator) to annotate `#__PURE__```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorlay%2Ftypescript-plugin-iife-enum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorlay%2Ftypescript-plugin-iife-enum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorlay%2Ftypescript-plugin-iife-enum/lists"}