How to use the babel-helper-mark-eval-scopes.markEvalScopes function in babel-helper-mark-eval-scopes

To help you get started, we’ve selected a few babel-helper-mark-eval-scopes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Tencent / omi / packages / cax-omip / scripts / taro-transformer-wx / lib / src / plugins / remove-dead-code.js View on Github external
exit(path, { opts: { 
                // set defaults
                optimizeRawSize = false, keepFnName = false, keepClassName = false, keepFnArgs = false, tdz = false } = {} } = {}) {
                    (traverse.clearCache || traverse.cache.clear)();
                    path.scope.crawl();
                    markEvalScopes(path);
                    // We need to run this plugin in isolation.
                    path.traverse(main, {
                        functionToBindings: new Map(),
                        optimizeRawSize,
                        keepFnName,
                        keepClassName,
                        keepFnArgs,
                        tdz
                    });
                }
            }
github babel / minify / packages / babel-plugin-minify-dead-code-elimination / src / index.js View on Github external
path,
          {
            opts: {
              // set defaults
              optimizeRawSize = false,
              keepFnName = false,
              keepClassName = false,
              keepFnArgs = false,
              tdz = false
            } = {}
          } = {}
        ) {
          (traverse.clearCache || traverse.cache.clear)();
          path.scope.crawl();

          markEvalScopes(path);

          // We need to run this plugin in isolation.
          path.traverse(main, {
            functionToBindings: new Map(),
            optimizeRawSize,
            keepFnName,
            keepClassName,
            keepFnArgs,
            tdz
          });
        }
      }
github babel / minify / packages / babel-plugin-minify-mangle-names / src / index.js View on Github external
collect() {
      const mangler = this;
      const { scopeTracker } = mangler;

      scopeTracker.addScope(this.program.scope);

      /**
       * Same usage as in DCE, whichever runs first
       */
      if (!isEvalScopesMarked(mangler.program)) {
        markEvalScopes(mangler.program);
      }

      /**
       * The visitors to be used in traversal.
       *
       * Note: BFS traversal supports only the `enter` handlers, `exit`
       * handlers are simply dropped without Errors
       *
       * Collects items defined in the ScopeTracker
       */
      const collectVisitor = {
        Scopable({ scope }) {
          scopeTracker.addScope(scope);

          // Collect bindings defined in the scope
          Object.keys(scope.bindings).forEach(name => {

babel-helper-mark-eval-scopes

Mark scopes for deopt which contain a direct eval call

MIT
Latest version published 7 years ago

Package Health Score

78 / 100
Full package analysis