-
Notifications
You must be signed in to change notification settings - Fork 149
Way to change a service name/reference #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It's out of scope for what ng-annotate is intended to do, frankly. Plugins are not really designed for that use-case either - you need to do your processing either before or after ng-annotate runs. I would probably have checked-in modified versions of the libraries in my repo or created a separate tool that matches |
On a second thought, perhaps this use-case should be possible to implement using plugins after all. There are some similarities to #42. ng-annotate should mark all nodes corresponding to a parameter-injected function. Plugins should be able to register a function that runs between judgeSuspects and alter (see ng-annotate-main.js). Your plugin could then update references there. Re-opening. |
So can this be done in the following way?
|
Not currently, because the fragments array is not necessarily populated. Instead I'll change ng-annotate to mark all relevant nodes instead. Similarly, I may be able to mark all definition nodes. |
The function of interest is, in this case, If we return the full node and delegate the target evaluation when building fragments, we can discriminate there against definitions and references, thus making one single pass. EDIT: I am making some progress, I may be able to push a PR in a few, or maybe tomorrow. |
The `--rename` option takes a string as input, treating every couple, separated by a space, as a find-replace option. For example, `--rename "$theService $myService "theFactory myFactory"`will replace `$theService` with `$myService` and `theFactory` with `myFactory` in both the declaration and in any annotation that will be added by ng-annotate. The actual use of the provider won't be changed. Also, a couple of JS grammar fixes here and there. Closes olov#44
The `--rename` option takes a string as input, treating every couple, separated by a space, as a find-replace option. For example, `--rename "$theService $myService "theFactory myFactory"`will replace `$theService` with `$myService` and `theFactory` with `myFactory` in both the declaration and in any annotation that will be added by ng-annotate. The actual use of the provider won't be changed. Closes olov#44
The `--rename` option takes a string as input, treating every couple, separated by a space, as a find-replace option. For example, `--rename "$theService $myService "theFactory myFactory"`will replace `$theService` with `$myService` and `theFactory` with `myFactory` in both the declaration and in any annotation that will be added by ng-annotate. The actual use of the provider won't be changed. Closes olov#44
landed in 0.10 |
Is there a way to change a given service name/reference through the examined source? Since AngularJS doesn't support namespacing when injecting instances and functions, I need to pre-process some libraries that conflict with each other.
Can plugins be used to achieve this?
The text was updated successfully, but these errors were encountered: