How to use the escodegen-wallaby.attachComments function in escodegen-wallaby

To help you get started, we’ve selected a few escodegen-wallaby 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 SBoudrias / AST-query / lib / tree.js View on Github external
function Tree(source, escodegenOptions, acornOptions) {
  this.acornOptionDefaults = _.extend({}, acornOptionDefaults, acornOptions);
  this.comments = [];
  this.tokens = [];
  this.acornOptionDefaults.onComment = this.comments;
  this.acornOptionDefaults.onToken = this.tokens;
  this.tree = acorn.parse(source.toString(), this.acornOptionDefaults);
  this.tree = escodegen.attachComments(this.tree, this.comments, this.tokens);
  this.body = new Body(this.tree.body, this.acornOptionDefaults);
  this.escodegenOptions = _.extend({}, escodegenOptionDefaults, escodegenOptions);
}
github VulcanJS / vulcanjs-cli / src / generator-vulcanjs / lib / ast.js View on Github external
const generateCode = (ast) => {
  const astWithComments = escodegen.attachComments(
    ast,
    ast.comments,
    ast.tokens
  );
  return escodegen.generate(
    astWithComments,
    {
      comment: true,
      format: { index: { style: '  ' } },
    }
  );
};
github VulcanJS / vulcanjs-cli / dist / generator-vulcanjs / lib / ast.js View on Github external
var generateCode = function generateCode(ast) {
  var astWithComments = escodegen.attachComments(ast, ast.comments, ast.tokens);
  return escodegen.generate(astWithComments, {
    comment: true,
    format: { index: { style: '  ' } }
  });
};
github SBoudrias / AST-query / lib / factory / value.js View on Github external
exports.create = function (valStr) {
  this.comments = [];
  this.tokens = [];
  acornOptions.onComment = this.comments;
  acornOptions.onToken = this.tokens;
  var tree = acorn.parse('var astValFactory = ' + valStr, acornOptions);
  tree = escodegen.attachComments(tree, this.comments, this.tokens);
  return tree.body[0].declarations[0].init;
};

escodegen-wallaby

ECMAScript code generator with JSX support

BSD-2-Clause
Latest version published 5 months ago

Package Health Score

68 / 100
Full package analysis

Similar packages