How to use meriyah - 9 common examples

To help you get started, we’ve selected a few meriyah 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 ES-Community / nsecure / src / ast / index.js View on Github external
function searchRuntimeDependencies(str, module = false) {
    const identifiers = new Map();
    const dependencies = new Set();
    let isSuspect = false;

    if (str.charAt(0) === "#") {
        // eslint-disable-next-line
        str = str.slice(str.indexOf("\n"));
    }
    const { body } = meriyah.parseScript(str, { next: true, module });

    walk(body, {
        enter(node) {
            // console.log(JSON.stringify(node, null, 2));
            // console.log("-------------------------");
            try {
                if (!module && (helpers.isRequireStatment(node) || helpers.isRequireResolve(node))) {
                    const arg = node.arguments[0];
                    if (arg.type === "Identifier") {
                        if (identifiers.has(arg.name)) {
                            dependencies.add(identifiers.get(arg.name));
                        }
                        else {
                            isSuspect = true;
                        }
                    }
github fuse-box / fuse-box / src / analysis / _benchmark.ts View on Github external
function parsemeriyah(str) {
  return meriyah.parseModule(str);
}
github qiuwenwu / mm_node / node_modules / abstract-syntax-tree / src / parse.js View on Github external
module.exports = function parse (source, options) {
  return meriyah.parseModule(source, options)
}
github buxlabs / abstract-syntax-tree / src / parse.js View on Github external
module.exports = function parse (source, options) {
  return meriyah.parseModule(source, options)
}
github fuse-box / fuse-box / src / transform / fastTransform / fastTransform.ts View on Github external
export function parseAst(contents: string, options?: { loc: boolean }) {
  let opts = { jsx: true, next: false, module: true, ...(options || {}) };

  return meriyah.parse(contents, opts);
}
github fkling / astexplorer / website / src / parsers / js / meriyah.js View on Github external
import React from 'react';
import defaultParserInterface from './utils/defaultESTreeParserInterface';
import pkg from 'meriyah/package.json';

const ID = pkg.name;

export default {
  ...defaultParserInterface,

  id: ID,
  displayName: ID,
  version: pkg.version,
  homepage: pkg.homepage,

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

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

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

  getDefaultOptions() {
github fkling / astexplorer / website / src / parsers / js / meriyah.js View on Github external
renderSettings(parserSettings, onChange) {
    return (
      <div>
        <p>
          <a rel="noopener noreferrer" href="{pkg.homepage}">
            Option descriptions
          </a>
        </p>
        {defaultParserInterface.renderSettings.call(
          this,
          parserSettings,
          onChange,
        )}
      </div>
    );
  },
};
github fkling / astexplorer / website / src / parsers / js / meriyah.js View on Github external
import React from 'react';
import defaultParserInterface from './utils/defaultESTreeParserInterface';
import pkg from 'meriyah/package.json';

const ID = pkg.name;

export default {
  ...defaultParserInterface,

  id: ID,
  displayName: ID,
  version: pkg.version,
  homepage: pkg.homepage,

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

  parse(parser, code, options) {
    return parser.parse(code, options);
  },
github fkling / astexplorer / website / src / parsers / js / meriyah.js View on Github external
import React from 'react';
import defaultParserInterface from './utils/defaultESTreeParserInterface';
import pkg from 'meriyah/package.json';

const ID = pkg.name;

export default {
  ...defaultParserInterface,

  id: ID,
  displayName: ID,
  version: pkg.version,
  homepage: pkg.homepage,

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

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

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

meriyah

A 100% compliant, self-hosted javascript parser with high focus on both performance and stability

ISC
Latest version published 21 days ago

Package Health Score

84 / 100
Full package analysis