How to use the espree/package.json.version function in espree

To help you get started, we’ve selected a few espree 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 fkling / astexplorer / website / src / parsers / js / espree.js View on Github external
import React from 'react';
import defaultParserInterface from './utils/defaultESTreeParserInterface';
import pkg from 'espree/package.json';

const ID = 'espree';

export default {
  ...defaultParserInterface,

  id: ID,
  displayName: ID,
  version: pkg.version,
  homepage: pkg.homepage,
  locationProps: new Set(['range', 'loc', 'start', 'end']),

  loadParser(callback) {
    require(['espree'], callback);
  },

  parse(espree, code, options) {
    return espree.parse(code, options);
  },

  nodeToRange(node) {
    if (typeof node.start === 'number') {
      return [node.start, node.end];
    }
  },

espree

An Esprima-compatible JavaScript parser built on Acorn

BSD-2-Clause
Latest version published 10 days ago

Package Health Score

91 / 100
Full package analysis