New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vuedx/analyze

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vuedx/analyze

Extracts public API information from Vue component.

  • 0.3.1-insiders-1608632613.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
275
decreased by-10.71%
Maintainers
1
Weekly downloads
 
Created
Source

Analyze

A tool to statically analyze Vue single file components.

Support

This package is part of VueDX project, maintained by Rahul Kadyan. You can 💖 sponsor him for continued development of this package and other VueDX tools.

Usage

API

ConfiguredVueProject

More info

Signature:

declare class ConfiguredVueProject extends VueProject {
  constructor(
    rootDir: string,
    packageFile: string | undefined,
    packageJSON: Partial<PackageJSON>,
    configFile: string,
    config: Readonly<ProjectConfig>,
    requireModule?: NodeJS.Require,
  )
  readonly configFile: string
  kind: 'configured'
  protected refresh(): void
  setFileNames(fileNames: string[]): void
}

Members:

refresh

Signature:

protected refresh(): void;

setFileNames

Signature:

setFileNames(fileNames: string[]): void;
ParameterTypeDescription
fileNamesstring[]-


InferredVueProject

More info

Signature:

declare class InferredVueProject extends VueProject {
  kind: 'inferred'
  protected refresh(): void
}

Members:

refresh

Signature:

protected refresh(): void;


VueProject

More info

Signature:

declare abstract class VueProject {
  protected _config: Readonly<ProjectConfigNormalized>
  protected _externalComponents: ComponentRegistrationInfo[]
  protected _fileNames: string[]
  protected _globalComponents: ComponentRegistrationInfo[]
  protected _projectComponents: Map<string, ComponentRegistrationInfo[]>
  protected _version: string
  constructor(
    rootDir: string,
    packageFile: string | undefined,
    packageJSON: Partial<PackageJSON>,
    requireModule?: NodeJS.Require,
  )
  get components(): ComponentRegistrationInfo[]
  get config(): Readonly<ProjectConfigNormalized>
  get fileNames(): string[]
  get globalComponents(): ComponentRegistrationInfo[]
  protected isDirty: boolean
  abstract kind: 'inferred' | 'configured'
  protected loadGlobalComponents(): void
  markDirty(): void
  readonly packageFile: string | undefined
  packageJSON: PackageJSON
  protected abstract refresh(): void
  protected reloadIfNeeded(): void
  protected readonly requireModule: NodeJS.Require
  readonly rootDir: string
  setConfig(config: ProjectConfig): void
  setFileNames(fileNames: string[]): void
  get version(): string
  get vueFileNames(): string[]
}

Members:

loadGlobalComponents

Signature:

protected loadGlobalComponents(): void;

markDirty

Signature:

markDirty(): void;

refresh

Signature:

protected abstract refresh(): void;

reloadIfNeeded

Signature:

protected reloadIfNeeded(): void;

setConfig

Signature:

setConfig(config: ProjectConfig): void;
ParameterTypeDescription
configProjectConfig-

setFileNames

Signature:

setFileNames(fileNames: string[]): void;
ParameterTypeDescription
fileNamesstring[]-


createAnalyzer

More info

Signature:

declare function createAnalyzer(
  plugins: Plugin[],
  options?: Partial<Context['parsers']>,
): Analyzer
ParameterTypeDescription
pluginsPlugin[]-
optionsPartial<Context['parsers']>-

createFullAnalyzer

More info

Signature:

declare function createFullAnalyzer(
  plugins?: Plugin[],
  options?: Partial<Context['parsers']>,
): ReturnType<typeof createAnalyzer>
ParameterTypeDescription
pluginsPlugin[]-
optionsPartial<Context['parsers']>-

createSourceRange

More info

Signature:

declare function createSourceRange(
  context: Context | ScriptAnalyzerContext,
  node: Node,
): SourceRange
ParameterTypeDescription
contextContext | ScriptAnalyzerContext-
nodeNode-

transformToFunction

More info

Signature:

declare function transformToFunction(
  content: string,
  options?: FunctionTransformOptions,
): string
ParameterTypeDescription
contentstring-
optionsFunctionTransformOptions-

Types

Analyzer

interface Analyzer {
  analyze: (content: string, fileName?: string) => ComponentInfo
  analyzeScript: (
    content: string,
    fileName?: string,
    mode?: 'script' | 'scriptSetup',
  ) => ComponentInfo
  analyzeTemplate: (content: string, fileName?: string) => ComponentInfo
}

ComponentInfo

interface ComponentInfo {
  components: LocalComponentRegistrationInfo[]
  emits: EmitInfo[]
  errors: SyntaxError[]
  fnSetupOption?: SetupInfo
  identifierSource: Record<string, IdentifierSource>
  options?: ComponentOptionsInfo
  props: PropInfo[]
  scriptSetup?: ScriptSetupInfo
}

ComponentRegistrationInfo

interface ComponentRegistrationInfo {
  aliases: string[]
  name: string
  source: ImportSource
}

EmitInfo

interface EmitInfo extends Taggable, Addressable {
  description: string
  isDynamic: boolean
  isInferred: boolean
  name: string
  references: SourceRange[]
  type: TypeInfo[]
}

IdentifierSource

interface IdentifierSource extends Addressable {
  name: string
}

ImportSource

interface ImportSource {
  exportName?: string
  localName: string
  moduleName: string
}

ImportSourceWithLocation

interface ImportSourceWithLocation extends ImportSource, Addressable {}

LocalComponentRegistrationInfo

interface LocalComponentRegistrationInfo
  extends ComponentRegistrationInfo,
    Addressable {
  kind: 'script' | 'scriptSetup'
  source: ImportSourceWithLocation
}

Plugin

interface Plugin {
  babel?: AbstractScriptAnalyzerFn | AbstractAnalyzerHandler
  blocks?: Partial<{
    script: BlockAnalyzer<SFCScriptBlock>
    template: BlockAnalyzer<SFCTemplateBlock>
    style: BlockAnalyzer<SFCStyleBlock>
  }> &
    Record<string, BlockAnalyzer<any>>
  declaration?: ComponentDeclarationAnalyzer[]
  options?:
    | ComponentOptionsAnalyzer[]
    | Record<string, AbstractScriptAnalyzerFn<ObjectMember>>
  setup?: ComponentSetupFnAnalyzer[]
  templateExpression?: (node: File, context: Context) => void
}

PropInfo

interface PropInfo extends Taggable, Addressable {
  defaultValue: ValueInfo | null
  description: string
  name: string
  required: boolean
  type: TypeInfo[]
}

ScriptSetupInfo

interface ScriptSetupInfo {
  defineEmit?: Addressable
  defineProps?: Addressable
}

SetupInfo

interface SetupInfo extends Addressable {
  context?: {
    identifiers: Partial<{
      attrs: string
      slots: string
      emit: string
    }>
    rest?: string
  } & Addressable
  props?: {
    identifiers: string[]
    rest?: string
  } & Addressable
  return?: Addressable
}

SourceRange

interface SourceRange {
  end: SourceLocation
  source: string
  start: SourceLocation
}

SyntaxError

interface SyntaxError {
  loc: SourceLocation
  message: string
}

Keywords

FAQs

Package last updated on 22 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc