import { ImportDeclaration, JSXAttrValue, JSXExpression, JSXOpeningElement, TsType } from "@swc/core";

//#region src/types.d.ts
/**
 * Import entity to model an import statement.
 */
type Import = {
  alias: string;
  module: string;
  name: string;
};
type Nodes = {
  ImportDeclaration: ImportDeclaration;
  JSXAttrValue: JSXAttrValue;
  JSXExpression: JSXExpression;
  JSXOpeningElement: JSXOpeningElement;
  TsType: TsType;
};
/**
 * Package entity to model `package.json` metadata.
 */
type Package = {
  dependencies?: Record<string, string>;
  description: string;
  devDependencies?: Record<string, string>;
  name: string;
  optionalDependencies?: Record<string, string>;
  peerDependencies?: Record<string, string>;
  version: string;
};
type Primitive = bigint | boolean | null | number | string | undefined;
//#endregion
//#region src/entities/item/createLocation.d.ts
type Location = {
  column: number;
  file: string;
  line: number;
  link: string;
  module: string;
};
//#endregion
//#region src/entities/item/createItem.d.ts
type Item = {
  createdAt: string;
  input: {
    data: Record<string, unknown>;
    metadata: {
      withSpreading: boolean;
    };
  };
  location: Location;
  module: Package["name"];
  name: string;
  type: string;
  version: Package["version"];
};
type ItemDTO = {
  offset: number;
} & Partial<Pick<Item, "input">> & Pick<Item, "module" | "name" | "type">;
//#endregion
//#region src/modules/plugin/createPlugin.d.ts
declare const createPlugin: (input: Plugin) => Plugin;
type Plugin = (context: {
  imports: Map<Import["alias"], Import>;
}, helpers: {
  getJSXAttributeValue: (node: Nodes["JSXAttrValue"] | undefined) => Primitive;
}) => { [Key in keyof Nodes]?: (node: Nodes[Key]) => ItemDTO | undefined };
//#endregion
//#region src/modules/scanner/scan.d.ts
type ScanOptions = {
  /**
   * A list of folders to ignore.
   */
  excludeFolders?: string[];
  /**
   * A list of files to include (following glob matcher).
   */
  includeFiles?: string[];
};
//#endregion
//#region src/createInstance.d.ts
type Options = Partial<{
  /**
   * Only analyze components imported from the specificied module list.
   */
  includeModules: string[];
  /**
   * A list of plugins to enable.
   */
  plugins: Plugin[];
  /**
   * Attempt to resolve installed versions of modules. If false or not possible, the specified version from the package.json will be used.
   * @default false
   */
  resolveInstalledVersions: boolean;
} & Pick<ScanOptions, "excludeFolders" | "includeFiles">>;
declare const createInstance: (path: string, options: Options) => {
  getItems(): Promise<Item[]>;
};
//#endregion
export { type Plugin, createInstance, createPlugin };