<commit_before>import MagicString from 'magic-string';
import TraverseState from './utils/TraverseState.js';
import buildDeclarationForNames from './utils/buildDeclarationForNames.js';
import getFirstStatementInBlock from './utils/getFirstStatementInBlock.js';
import getBindingIdentifiersFromLHS from './utils/getBindingIdentifiersFromLHS.js';
import getParenthesesRanges from './utils/getParenthesesRanges.js';
import traverse from 'babel-traverse';
import type NodePath from 'babel-traverse/src/path/index.js';
import type { Node, Token, SourceMap } from './types.js';
import { parse } from 'babylon';

const BABYLON_PLUGINS = [
  'classProperties'
];

export default function addVariableDeclarations(
  source: string,
  editor: MagicString=new MagicString(source),
  ast: Node=parse(source, { plugins: BABYLON_PLUGINS })<commit_msg>Ensure all the babel supported syntax is enabled.<commit_after>import MagicString from 'magic-string';
import TraverseState from './utils/TraverseState.js';
import buildDeclarationForNames from './utils/buildDeclarationForNames.js';
import getFirstStatementInBlock from './utils/getFirstStatementInBlock.js';
import getBindingIdentifiersFromLHS from './utils/getBindingIdentifiersFromLHS.js';
import getParenthesesRanges from './utils/getParenthesesRanges.js';
import traverse from 'babel-traverse';
import type NodePath from 'babel-traverse/src/path/index.js';
import type { Node, Token, SourceMap } from './types.js';
import { parse } from 'babylon';

const BABYLON_PLUGINS = [
  'flow',
  'jsx',
  'asyncFunctions',
  'asyncGenerators',
  'classConstructorCall',
  'classProperties',
  'decorators',
  'doExpressions',
  'exponentiationOperator',
  'exportExtensions',
  'functionBind',
  'functionSent',
  'objectRestSpread',
  'trailingFunctionCommas'
];

export default function addVariableDeclarations(
  source: string,
  editor: MagicString=new MagicString(source),
  ast: Node=parse(source, { plugins: BABYLON_PLUGINS })
{'fraction_non_alphanumeric': 0.1128622267412303, 'fraction_numerical': 0.0, 'mean_word_length': 6.454545454545454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3162363', 'n_tokens_mistral': 595, 'n_tokens_neox': 578, 'n_words': 140}