Giter Site home page Giter Site logo

Comments (7)

 avatar commented on July 21, 2024

What do you we think would be needed to make this happen? I'd like to see this land, so I'd be willing to open a PR.

from babel-plugin-angularjs-annotate.

thekip avatar thekip commented on July 21, 2024

This is a really good proposal. I currently have a hybrid application with AngularJs + Angular7, and ngAnnotate is one of the things which block me to use AngularCLI.

I would be really happy if I can find all places where implicit annotation applied, and replace it to manual annotation, and remove ngAnnotate at all.

Your proposal can help with that because I can manually one by one check all places with 'ngInject', and fix them and then push to GIT.

By the way, if it's hard to implement, may be you can point me where I can put a console.log to see all files with implicit annotations?

from babel-plugin-angularjs-annotate.

schmod avatar schmod commented on July 21, 2024

The project isn't really set up to do codemods at the moment (and I'd kind of discourage folks from doing this, because it provides little safety in the event of a forgotten annotation), but it's certainly something I can look at once I have time to dust this off and get the other bugs fixed.

from babel-plugin-angularjs-annotate.

schmod avatar schmod commented on July 21, 2024

Actually, re-reading @thekip's comment, it sounds like you just want to run ngAnnotate once and check the results in as your new source?

from babel-plugin-angularjs-annotate.

thekip avatar thekip commented on July 21, 2024

I'm actually want to run ngAnnotate in a kind of "dry run" mode, just to point me places where I don't have explicit annotations.

I have explicit markers via 'ngInject' (which I can find just by string in IDE) and also I have places where code annotated implictly by "euristic" detection. I want to find all this 'euristic' places, mark them explicitly and then one by one convert to manual annotations / decorators / port to new angular / whatever.

For me even list in console with filename and line numbers will be enough. So the question where can I hack this ngAnnotate and add console.log statement to display this files.

from babel-plugin-angularjs-annotate.

schmod avatar schmod commented on July 21, 2024

In ng-annotate-main.js, look for anything that calls insertBefore or insertAfter

I'm planning to eventually add something like a "dry-run" mode with the explicitOnly mode -- we'll only annotate functions that you've explicitly marked for injection, but warn or fail with an error if it looks like you forgot one.

(In my experience, it isn't really safe to run this once and forget it if you're actively developing a codebase -- the manual injection syntax is ridiculously error-prone when humans are writing it)

from babel-plugin-angularjs-annotate.

thekip avatar thekip commented on July 21, 2024

Finally I got that. In my case almost 99% occurrences was in block.unshiftContainer("body", [expr]); in addInjectArrayBeforePath() function.

I also had to add file name information in visitor to context, to be able to console.log it further.

      Program: {
        enter(path, file) {
          file.opts.explicitOnly = file.opts.explicitOnly || false;

          ctx.suspects = [];
          ctx.blocked = [];
          ctx.fragments = [];
+         ctx.filename = file.filename;
          ctx.srcForRange = function(node) {
            return file.file.code.slice(node.start, node.end);
          };
        },
        exit() {
          judgeSuspects(ctx);
        }
      }

from babel-plugin-angularjs-annotate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.