All Projects → egoist → konan

egoist / konan

Licence: MIT license
find all require/import calls by walking the AST

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to konan

tradeship
Automatically imports missing JavaScript dependencies and removes unused ones.
Stars: ✭ 42 (-12.5%)
Mutual labels:  require, import
requireg
Resolve and require local & global modules in node.js like a boss
Stars: ✭ 45 (-6.25%)
Mutual labels:  require, import
lint-deps
Lint for unused or missing dependencies in your node.js projects. Customize with plugins or configuration.
Stars: ✭ 48 (+0%)
Mutual labels:  require, import
unimport
A linter, formatter for finding and removing unused import statements.
Stars: ✭ 119 (+147.92%)
Mutual labels:  ast, import
Ts Transform Import Path Rewrite
TS AST transformer to rewrite import path
Stars: ✭ 104 (+116.67%)
Mutual labels:  ast, import
Unimport
A linter, formatter for finding and removing unused import statements.
Stars: ✭ 96 (+100%)
Mutual labels:  ast, import
parse-function
(!! moved to tunnckoCore/opensource multi-package repository !!) 🔱 Parse a function into an object using espree, acorn or babylon parsers. Extensible through Smart Plugins.
Stars: ✭ 37 (-22.92%)
Mutual labels:  ast, babylon
Babylon
PSA: moved into babel/babel as @babel/parser -->
Stars: ✭ 1,692 (+3425%)
Mutual labels:  ast, babylon
gogoAST
The simplest tool to parse/transform/generate code on ast
Stars: ✭ 29 (-39.58%)
Mutual labels:  ast, babylon
great-migration
Copy objects from Rackspace to S3
Stars: ✭ 15 (-68.75%)
Mutual labels:  import
ctxexp-parser
In the dynamic execution of JS language environment (wechat applet) to execute JS class calling function.
Stars: ✭ 17 (-64.58%)
Mutual labels:  ast
babel-plugin-detective
Babel plugin that scans the AST for require calls and import statements
Stars: ✭ 26 (-45.83%)
Mutual labels:  ast
abstract-syntax-tree
A library for working with abstract syntax trees.
Stars: ✭ 77 (+60.42%)
Mutual labels:  ast
import-cli-simple
This the meta package for Pacemaker Community, a Symfony based CLI application that provides import functionality for products, categories, attributes, and attribute-sets. The default format is CSV, adapters for XML are also available. The application can be declaratively extended by additional operations, which can be used to reassemble and exe…
Stars: ✭ 69 (+43.75%)
Mutual labels:  import
clickhouse-ast-parser
AST parser and visitor for ClickHouse SQL
Stars: ✭ 60 (+25%)
Mutual labels:  ast
human-parser-generator
A straightforward recursive descent Parser Generator with a focus on "human" code generation and ease of use.
Stars: ✭ 27 (-43.75%)
Mutual labels:  ast
ts-transform-react-jsx-source
TypeScript AST Transformer that adds source file and line number to JSX elements
Stars: ✭ 12 (-75%)
Mutual labels:  ast
ts-transform-react-constant-elements
A TypeScript AST Transformer that can speed up reconciliation and reduce garbage collection pressure by hoisting React elements to the highest possible scope.
Stars: ✭ 44 (-8.33%)
Mutual labels:  ast
ast-grep
🔍 Like grep, but more powerful than you can possibly imagine
Stars: ✭ 14 (-70.83%)
Mutual labels:  ast
tacoscript
🌮 The bidirectional alt-JS language
Stars: ✭ 46 (-4.17%)
Mutual labels:  babylon

konan

NPM version NPM downloads Node.js CI donate

Like detective but also supports ES6 import and more.

Install

yarn add konan
# or hey old school
npm install --save konan

Supported syntax

  • require call
  • import/export ES6 modules
  • import() Dynamic import
  • You can use all language features supported by babel parser, including jsx syntax by default

Usage

const konan = require('konan')

konan(`
import React, {Component} from 'react'
const vue = require('vue/dist/vue')
import('./my-async-module').then()
require(path.resolve('./'))
`)
/*
result =>
{
  strings: ['react', 'vue/dist/vue', './my-async-module'],
  expressions: ['path.resolve(\'./\')']
}
*/

API

konan(input, [options])

input

Type: string object
Required: true

Source content as string or AST tree.

options

dynamicImport

Type: boolean
Default: true

You can disable detecting dynamic import()-ed modules.

parse

Type: object
Default: {sourceType: 'module', plugins: ['jsx', 'typescript', 'dynamicImport']}

babel parser parse options.

FAQ

What does konan stand for?

It stands for Meitantei Konan (名探偵コナン), the main character in Detective Conan.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

konan © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).

egoistian.com · GitHub @egoist · Twitter @_egoistlily

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].