Sha256: ecb34e4cd08509b8cbdd657b20ec24d46006d5d0cb3211d6a58ab5d2d0b5cf3a

Contents?: true

Size: 1.15 KB

Versions: 15

Compression:

Stored size: 1.15 KB

Contents

/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

'use strict';

const babylon = require('@babel/parser');

// These are the options that were the default of the Babel5 parse function
// see https://github.com/babel/babel/blob/5.x/packages/babel/src/api/node.js#L81
const options = {
  sourceType: 'module',
  allowHashBang: true,
  ecmaVersion: Infinity,
  allowImportExportEverywhere: true,
  allowReturnOutsideFunction: true,
  startLine: 1,
  tokens: true,
  plugins: [
    'estree',
    'jsx',
    'asyncGenerators',
    'classProperties',
    'doExpressions',
    'exportExtensions',
    'functionBind',
    'functionSent',
    'objectRestSpread',
    'dynamicImport',
    'nullishCoalescingOperator',
    'optionalChaining',
    ['decorators', {decoratorsBeforeExport: false}],
  ],
};

/**
 * Wrapper to set default options. Doesn't accept custom options because in that
 * case babylon should be used instead.
 */
module.exports = function() {
  return {
    parse(code) {
      return babylon.parse(code, options);
    },
  };
};

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
immosquare-cleaner-0.1.52 node_modules/jscodeshift/parser/babel5Compat.js
immosquare-cleaner-0.1.51 node_modules/jscodeshift/parser/babel5Compat.js
immosquare-cleaner-0.1.50 node_modules/jscodeshift/parser/babel5Compat.js
immosquare-cleaner-0.1.49 node_modules/jscodeshift/parser/babel5Compat.js
immosquare-cleaner-0.1.48 node_modules/jscodeshift/parser/babel5Compat.js
immosquare-cleaner-0.1.47 node_modules/jscodeshift/parser/babel5Compat.js
immosquare-cleaner-0.1.46 node_modules/jscodeshift/parser/babel5Compat.js
immosquare-cleaner-0.1.45 node_modules/jscodeshift/parser/babel5Compat.js
immosquare-cleaner-0.1.44 node_modules/jscodeshift/parser/babel5Compat.js
immosquare-cleaner-0.1.43 node_modules/jscodeshift/parser/babel5Compat.js
immosquare-cleaner-0.1.42 node_modules/jscodeshift/parser/babel5Compat.js
immosquare-cleaner-0.1.41 node_modules/jscodeshift/parser/babel5Compat.js
immosquare-cleaner-0.1.40 node_modules/jscodeshift/parser/babel5Compat.js
immosquare-cleaner-0.1.39 node_modules/jscodeshift/parser/babel5Compat.js
immosquare-cleaner-0.1.38 node_modules/jscodeshift/parser/babel5Compat.js