babel-helper-references-import
Helper for rewriting imports from a particular library.
Last updated 2 years ago by cameron-martin .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install babel-helper-references-import 
SYNC missed versions from official npm registry.

babel-helper-references-import

Build Status Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. dependencies Status Join the chat at https://gitter.im/cameron-martin/babel-helper-references-import

Checks whether an Identifier or MemberExpression references a specific import from a specific package.

Like referencesImport, but works with ES2015, CommonJS and AMD syntax.

API

This package contains a single named export:

referencesImport(path: NodePath, packageName: string, importName: string): boolean;

  • path is a path to the node that you want to test whether it references an import from a package.
  • packageName is the name of the package.
  • importName is the name of the import. It can take a special value, *, to indicate that you want to test that the whole namespace is imported, for example when testing that foo references import * as foo from 'package'; or const foo = require('package');

TODO

  • Dynamic imports
  • Consider when errors should be thrown rather than just not matching.
  • Make the build not fail. This relies on my PR being merged.

Current Tags

  • 0.0.2                                ...           latest (2 years ago)

1 Versions

  • 0.0.2                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 4
Dependencies (4)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |