Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vuedx/vue-virtual-textdocument

Package Overview
Dependencies
Maintainers
1
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vuedx/vue-virtual-textdocument

A virtual filesystem to access blocks in SFC as files

  • 0.7.7-next-1667540051.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
993
decreased by-15.63%
Maintainers
1
Weekly downloads
 
Created
Source

Vue Virtual TextDocument

An implementation of virtual filesystem for accessing blocks in a .vue file as independent files.

npm add @vuedx/vue-virtual-textdocument

API

VueSFCDocument

More info

Signature:

export declare class VueSFCDocument implements TextDocument {
  get blocks(): SFCBlock[];
  static create(fileName: string, content: string, options?: Omit<CompileOptions, 'cache' | 'fileName'>, version?: number): VueSFCDocument;
  get descriptor(): SFCDescriptor;
  get errors(): Array<CompilerError | SyntaxError>;
  get fileName(): string;
  findGeneratedTextSpan(spanInOriginalText: TextSpan): TextSpan | null;
  findMapping(positionType: 'original' | 'generated', position: Position, searchBias?: SourceMapBiasType): Mapping | null;
  findOriginalTextSpan(spanInGeneratedText: TextSpan): TextSpan | null;
  get generated(): TextDocument;
  readonly generatedFileName: string;
  generatedOffsetAt(offset: number): number | null;
  generatedPositionFor(position: Position): Position | null;
  getBlockAt(offset: number): SFCBlock | null;
  getLineAndCharacterOfPosition(position: number): Position;
  getSourceFile(fileName?: string): {
        fileName: string;
        readonly text: string;
        lineMap: unknown;
        getLineAndCharacterOfPosition: (position: number) => Position;
    };
  getText(range?: Range): string;
  get languageId(): string;
  get lineCount(): number;
  lineMap: unknown | undefined;
  get map(): string;
  offsetAt(position: Position): number;
  readonly options: Required<CompileOptions>;
  get original(): TextDocument;
  readonly originalFileName: string;
  originalOffsetAt(offset: number): number | null;
  originalPositionFor(position: Position): Position | null;
  positionAt(offset: number): Position;
  get snapshot(): VueToTsxSnapshot;
  get templateAST(): RootNode | undefined;
  get text(): string;
  update(changes: TextDocumentContentChangeEvent[], version: number): void;
  get uri(): string;
  get version(): number;
}

Members:

create

Signature:

static create(fileName: string, content: string, options?: Omit<CompileOptions, 'cache' | 'fileName'>, version?: number): VueSFCDocument;
ParameterTypeDescription
fileNamestring-
contentstring-
optionsOmit<CompileOptions, 'cache' | 'fileName'>-
versionnumber-

findGeneratedTextSpan

Signature:

findGeneratedTextSpan(spanInOriginalText: TextSpan): TextSpan | null;
ParameterTypeDescription
spanInOriginalTextTextSpan-

findMapping

Signature:

findMapping(positionType: 'original' | 'generated', position: Position, searchBias?: SourceMapBiasType): Mapping | null;
ParameterTypeDescription
positionType'original' | 'generated'-
positionPosition-
searchBiasSourceMapBiasType-

findOriginalTextSpan

Signature:

findOriginalTextSpan(spanInGeneratedText: TextSpan): TextSpan | null;
ParameterTypeDescription
spanInGeneratedTextTextSpan-

generatedOffsetAt

Signature:

generatedOffsetAt(offset: number): number | null;
ParameterTypeDescription
offsetnumber-

generatedPositionFor

Signature:

generatedPositionFor(position: Position): Position | null;
ParameterTypeDescription
positionPosition-

getBlockAt

Signature:

getBlockAt(offset: number): SFCBlock | null;
ParameterTypeDescription
offsetnumber-

getLineAndCharacterOfPosition

Signature:

getLineAndCharacterOfPosition(position: number): Position;
ParameterTypeDescription
positionnumber-

getSourceFile

Signature:

getSourceFile(fileName?: string): {
        fileName: string;
        readonly text: string;
        lineMap: unknown;
        getLineAndCharacterOfPosition: (position: number) => Position;
    };
ParameterTypeDescription
fileNamestring-

getText

Signature:

getText(range?: Range): string;
ParameterTypeDescription
rangeRange-

offsetAt

Signature:

offsetAt(position: Position): number;
ParameterTypeDescription
positionPosition-

originalOffsetAt

Signature:

originalOffsetAt(offset: number): number | null;
ParameterTypeDescription
offsetnumber-

originalPositionFor

Signature:

originalPositionFor(position: Position): Position | null;
ParameterTypeDescription
positionPosition-

positionAt

Signature:

positionAt(offset: number): Position;
ParameterTypeDescription
offsetnumber-

update

Signature:

update(changes: TextDocumentContentChangeEvent[], version: number): void;
ParameterTypeDescription
changesTextDocumentContentChangeEvent[]-
versionnumber-


Types

TextSpan

export interface TextSpan {
  length: number;
  start: number;
}

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.

Keywords

FAQs

Package last updated on 04 Nov 2022

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