Code Monkey home page Code Monkey logo

Comments (7)

bolinfest avatar bolinfest commented on May 14, 2024

facebook/regenerator#112 is also contributing to this problem.

from ast-types.

benjamn avatar benjamn commented on May 14, 2024

The ast-types part of the problem is easy to fix by removing the deprecated function and not using depd anymore.

With Regenerator, the risk is that minified code might rename GeneratorFunction and thereby break regeneratorRuntime.isGeneratorFunction.

I wonder if we could just throw if GeneratorFunction.name is wrong, so people have to deal with the minification issue using uglifyjs --reserved-names GeneratorFunction or something like that.

from ast-types.

benjamn avatar benjamn commented on May 14, 2024

@bolinfest with ast-types v0.6.0 and regenerator v0.7.0 I believe I've removed all the CSP violations that might be causing you problems, but please let me know if you observe otherwise!

from ast-types.

bolinfest avatar bolinfest commented on May 14, 2024

@benjamn Thanks for the quick work! Could you also bump the recast dependency in regenerator to 0.9.2 and then publish the new regenerator to npm?

from ast-types.

bolinfest avatar bolinfest commented on May 14, 2024

Also, yes, with local changes, things seem to be working, though I had an issue with the embedded runtime. Specifically, the way this is passed in to the anonymous function and is assigned to global and then defining regeneratorRuntime on it doesn't seem to work out in Atom. I haven't dug into it, so I'm not sure why.

As a workaround, I changed the anonymous function like so:

var regeneratorRuntime = (function(
  // existing body of the anonymous function...

  // but this return statement at the end is new.
  return runtime;
}).apply(this, [this, function GeneratorFunction(){}]);

Since I prepend this to the top of my file, regeneratorRuntime is assuredly defined in the global environment. While I was there, I also got rid of the Function-used-as-eval() at the end of the file, as that was another source of pain for the CSP restriction.

from ast-types.

benjamn avatar benjamn commented on May 14, 2024

New Regenerator (0.7.1) is on NPM. The global variable is gone now, so I think your workaround is no longer necessary?

from ast-types.

bolinfest avatar bolinfest commented on May 14, 2024

@benjamn Thanks! Everything seems to be working in Atom now. My only problem is running regenerator as part of the prepublish step, but I'll file a separate issue for that.

from ast-types.

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.