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

To help you get started, we’ve selected a few babylon 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 forivall / tacoscript / packages / tacoscript / src / transpose / api.js View on Github external
export default new Api({
  config,
  prefix: "tacoscript-transpose",
  loader: {
    pluginProp: "transpose",
    generatorPluginProp: "tacotruck", // TODO: should be moved to read the generator's name
    rcFileName: ".tacorc",
    ignoreFileName: ".tacoignore",
    packageKey: "tacoscript",
    pluginModulePrefix: "tacoscript",
    presetModulePrefix: "tacoscript"
  },
  parser: {
    name: babylonpkg.name,
    version: babylonpkg.version,
    parse: babylon.parse
  },
  parserOpts: function(opts) {
    return {
      sourceType:    opts.sourceType,
      filename:      opts.filename,
      features:      {}
    };
  },
  // TODO: allow multiple generators, with a default
  generator: tacotruck,
  generatorOpts: function(opts) {
    return {
      ...opts.generate,
      filename: opts.filename,
      plugins: opts.generatorPlugins
github acornjs / acorn / test / bench / common.js View on Github external
'Babylon'() {
    const { parse } = req('babylon');
    return {
      version: isWorker ? '' : require('babylon/package.json').version,
      parse
    };
  },
};
github fkling / astexplorer / registry / tools / babylon / v6.js View on Github external
settings: settings => settings.plugins || defaultOptions.plugins,
      values: plugins => defaultOptions.plugins.reduce(
        (obj, name) => ((obj[name] = plugins.indexOf(name) > -1), obj),
        {}
      ),
    },
  ],
};

export default {
  ...defaultParserInterface,
  ...base,

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

  load() {
    return Promise.resolve({parse});
  },

  parse(babylon, code, options) {
    return babylon.parse(code, {...defaultOptions, ...options});
  },

  getNodeName(node) {
    switch (typeof node.type) {
      case 'string':
        return node.type;
      case 'object':
github fkling / astexplorer / registry / tools / babylon / v5.js View on Github external
}
        plugins = {...plugins};
        delete plugins[name];
        return plugins;
      },
    },
  ],
};

export default {
  ...defaultParserInterface,
  ...base,

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

  load() {
    return Promise.resolve({parse});
  },

  parse(babylon, code, parserSettings) {
    return babylon.parse(
      code,
      {...defaultOptions, ...parserSettings}
    );
  },

  getNodeName(node) {
    switch (typeof node.type) {