import-adjutor
Parse ecmascript modules and collect names of export vars, functions, etc.
Last updated 2 months ago by iamthes .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install import-adjutor 
SYNC missed versions from official npm registry.

import-adjutor

Parse ecmascript modules and collect names of export vars, functions, etc.
Ex- esm-exports

Usage

echo json | import-adjutor

Where json is (JSON.stringified object):

{
    command: string;
    args: object;
}

Output structure (JSON.stringified):

API

insertImport

command: 'insertImport';
args:
    declaration: Declaration;
    sourceFileContent: string;
    manipulationSettings?: Partial<ManipulationSettings>;
    sorted: boolean = false;
type Declaration = {
    name: string;
    specifier: string;
    isDefault?: boolean;
};
interface ManipulationSettings extends SupportedFormatCodeSettingsOnly {
    /** Indentation text */
    indentationText: IndentationText;
    /** New line kind */
    newLineKind: NewLineKind;
    /** Quote type used for string literals. */
    quoteKind: QuoteKind;
    /**
     * Whether to enable renaming shorthand property assignments, binding elements,
     * and import & export specifiers without changing behaviour.
     * @remarks Defaults to true.
     * This setting is only available when using TypeScript 3.4+.
     */
    usePrefixAndSuffixTextForRename: boolean;
    /** Whether to use trailing commas when inserting or removing nodes. */
    useTrailingCommas: boolean;
}

Output:

string

exportsNodeModules

command: 'exportsNodeModules';
args:
    directory: string;
    project?: Project;
    folderExcludePatterns?: string[];
    fileExcludePatterns?: string[];

Output:

Array <{
    name: string;
    module?: string;
    filepath?: string;
    isDefault?: boolean;
}>,

exportsFromDirectory

command: 'exportsFromDirectory';
args:
    directory: string;
    project?: Project;
    folderExcludePatterns?: string[];
    fileExcludePatterns?: string[];

If directory will contains tsconfig.json or jsonconfig.json then source files will be added according to include, exclude patterns. folderExcludePatterns, fileExcludePatterns will be ignored.

Output:

Array <{
    name: string;
    module?: string;
    filepath?: string;
    isDefault?: boolean;
}>,

Resources

Current Tags

  • 2.1.2                                ...           latest (a month ago)

10 Versions

  • 2.1.2                                ...           a month ago
  • 2.1.1                                ...           2 months ago
  • 2.1.0                                ...           2 months ago
  • 2.0.0                                ...           2 months ago
  • 1.2.0                                ...           2 months ago
  • 1.1.2                                ...           2 months ago
  • 1.1.1                                ...           2 months ago
  • 1.1.0                                ...           2 months ago
  • 1.0.1                                ...           2 months ago
  • 1.0.0                                ...           2 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 8
Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |