{"id":15135902,"url":"https://github.com/jetbrains/babel-plugin-angular-annotate","last_synced_at":"2025-09-29T04:32:46.651Z","repository":{"id":65982521,"uuid":"80008216","full_name":"JetBrains/babel-plugin-angular-annotate","owner":"JetBrains","description":"Make angular dependency annotation minification proof","archived":false,"fork":true,"pushed_at":"2019-08-07T23:02:53.000Z","size":147,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-04-13T12:06:50.240Z","etag":null,"topics":["angular","babel-plugin","jetbrains-ui"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"marcioj/babel-plugin-angular-annotate","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JetBrains.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-01-25T11:26:14.000Z","updated_at":"2021-11-21T02:47:52.000Z","dependencies_parsed_at":"2023-02-19T18:45:34.826Z","dependency_job_id":null,"html_url":"https://github.com/JetBrains/babel-plugin-angular-annotate","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JetBrains%2Fbabel-plugin-angular-annotate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JetBrains%2Fbabel-plugin-angular-annotate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JetBrains%2Fbabel-plugin-angular-annotate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JetBrains%2Fbabel-plugin-angular-annotate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JetBrains","download_url":"https://codeload.github.com/JetBrains/babel-plugin-angular-annotate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234594019,"owners_count":18857416,"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":["angular","babel-plugin","jetbrains-ui"],"created_at":"2024-09-26T06:01:36.128Z","updated_at":"2025-09-29T04:32:41.264Z","avatar_url":"https://github.com/JetBrains.png","language":"JavaScript","readme":"# babel-plugin-angular-annotate\n\n\u003e  Make angular dependency annotation minification proof\n\n[![Build Status][travis_badge]][travis]\n\n## Compatibility\n\nThe version 2.x uses babel 6.x plugin API, for babel 5.x versions use the babel-plugin-angular-annotate 1.x\n\n## Installation\n\n```sh\nnpm install babel-plugin-angular-annotate\n```\n\n## Usage\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```js\n{\n  \"plugins\": [\n    [\"angular-annotate\", [configurations...]]\n  ]\n}\n```\n\n### Via CLI\n\n```sh\n$ babel --plugins angular-annotate script.js\n```\n\n### Via Node API\n\n```javascript\nrequire(\"babel-core\").transform(\"code\", {\n  plugins: [\n    [\"angular-annotate\", [configurations...]]\n  ]\n});\n```\n\n## Known issues\n\n- Some injections wont work properly when using this plugin in conjuction with `babel-preset-es2015`. To get it working you need to use `\"passPerPreset\": true` in your `.babelrc`.\n\n## Configuration\n\n`angular-annotate` accepts a json like injection configuration starting with an array containing two items in this format: `[method call, args]`.\n\n`method call` is expressed as a string with the service name and method call. For instance `\"$injector.invoke\"`.\nYou can also nest calls. For instance: `\"$httpProvider.interceptors.push\"`.\n\n`args` is where you map each param with the corresponding injection strategy. The two possible are: `\"$injectFunction\"` and `\"$injectObject\"`.\nAny other value will be ignored.\n\n`$injectFunction` will transform:\n\n```js\nfunction (a, b, c) {\n}\n```\n\nto\n\n```js\n['a', 'b', 'c', function (a, b, c) {\n}]\n```\n\nFor instance to create a rule for `$injector.invoke` you can apply the following configuration: `[\"$injector.invoke\", [\"$injectFunction\"]]`.\n\nSo the following will be transformed:\n\nBefore:\n\n```js\n$injector.invoke(function($state) {\n  $state.go('somewhere');\n});\n```\n\nAfter:\n\n```js\n$injector.invoke(['$state', function($state) {\n  $state.go('somewhere');\n}]);\n```\n\n`$injectObject` will apply `$injectFunction` for each object value. This is mainly used in the `resolve` property from some services. For example:\n\nThe `$routeProvider.when` configuration can be expressed with the following:\n\n```json\n[\"$routeProvider.when\", [\"_\", {\n  \"controller\": \"$injectFunction\",\n  \"resolve\": \"$injectObject\"\n}]];\n```\n\nBefore:\n\n\n```js\n$routeProvider.when('/foo', {\n  controller: function($scope) {\n    $scope.message = 'foo';\n  },\n  templateUrl: 'foo.html',\n  resolve: {\n    store: function (foo) {\n    }\n  }\n});\n```\n\nAfter:\n\n```js\n$routeProvider.when('/foo', {\n  controller: ['$scope', function($scope) {\n    $scope.message = 'foo';\n  }],\n  templateUrl: 'foo.html',\n  resolve: {\n    store: ['foo', function (foo) {\n    }]\n  }\n});\n```\n\nNote that since we don't want to do anything in the routeName we use a `\"_\"` to ignore it.\n\n\n### Presets\n\nSince configuring each service injection can be tedius, this libray includes some presets like: `\"angular\", \"ngMaterial\", \"ngRoute\" and \"ui.router\"`.\nSo you can simple include the following in .babelrc:\n\n```json\n{\n  \"plugins\": [\n    [\"angular-annotate\", [\"angular\", \"ngMaterial\", \"ui.router\"]]\n  ]\n}\n```\n\nCheck the [main file](./src/index.js) to see what injections are currently handled.\n\n## Running Tests\n\n`npm test`\n\n## Contributing\n\n1. Fork it\n1. Create your feature branch (`git checkout -b my-new-feature`)\n1. Commit your changes (`git commit -am 'Add some feature'`)\n1. Push to the branch (`git push origin my-new-feature`)\n1. Create new Pull Request\n\n[travis]: https://travis-ci.org/marcioj/babel-plugin-angular-annotate\n[travis_badge]: https://api.travis-ci.org/marcioj/babel-plugin-angular-annotate.svg?branch=master\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetbrains%2Fbabel-plugin-angular-annotate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjetbrains%2Fbabel-plugin-angular-annotate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetbrains%2Fbabel-plugin-angular-annotate/lists"}