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.5-next-1649654649.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.7K
increased by15.53%
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

AsyncDocumentStore

More info

Signature:

declare class AsyncDocumentStore<T> extends DocumentStore<T> {
  constructor(resolve: (uri: string) => T | Promise<T | null> | null, normalize?: (uri: string) => string);
  get(uri: string): T | null;
  get(uri: string): Promise<T | null>;
}

Members:

get

Signature:

get(uri: string): T | null;
ParameterTypeDescription
uristring-

get

Signature:

get(uri: string): Promise<T | null>;
ParameterTypeDescription
uristring-


DocumentStore

More info

Signature:

declare class DocumentStore<T> {
  constructor(resolve: (uri: string) => T | null, normalize?: (uri: string) => string);
  all(): string[];
  delete(uri: string): boolean;
  dispose(): void;
  get(uri: string): T | null;
  protected getNormalizedUri(uri: string): string;
  has(uri: string): boolean;
  protected map: Map<string, T>;
  normalize: (uri: string) => string;
  protected resolve: (uri: string) => T | null;
  protected reverseUriMap: Map<string, string>;
  set(uri: string, document: T): void;
}

Members:

all

Signature:

all(): string[];

delete

Signature:

delete(uri: string): boolean;
ParameterTypeDescription
uristring-

dispose

Signature:

dispose(): void;

get

Signature:

get(uri: string): T | null;
ParameterTypeDescription
uristring-

getNormalizedUri

Signature:

protected getNormalizedUri(uri: string): string;
ParameterTypeDescription
uristring-

has

Signature:

has(uri: string): boolean;
ParameterTypeDescription
uristring-

set

Signature:

set(uri: string, document: T): void;
ParameterTypeDescription
uristring-
documentT-


RenderFunctionTextDocument

More info

Signature:

declare class RenderFunctionTextDocument extends TransformedBlockTextDocument {
  constructor(container: VueTextDocument, selector: Selector, transformed: TextDocument, source: TextDocument);
  get ast(): CodegenResult['ast'] | undefined;
  get contextCompletionsTriggerOffset(): number;
  static create(options: CreateVirtualTextDocumentOptions): RenderFunctionTextDocument;
  findExpression(offset: number, length: number): undefined | {
        offset: number;
        length: number;
    };
  protected generate(): string;
  getAllGeneratedOffsetsAt(offset: number): undefined | Array<{
        length: number;
        offset: number;
    }>;
  getGeneratedOffsetAt(offset: number): undefined | {
        length: number;
        offset: number;
    };
  protected getKnownComponents(): Record<string, ComponentImport>;
  getOriginalOffsetAt(offset: number): undefined | {
        offset: number;
        length: number;
    };
  isInGeneratedRange(offset: number): boolean;
  isInTemplateIdentifierRange(offset: number): boolean;
  get parserErrors(): CodegenResult['errors'];
  get tagCompletionsTriggerOffset(): number;
  toDisplayMappings(): string;
  protected tryGenerate(): string;
}

Members:

create

Signature:

static create(options: CreateVirtualTextDocumentOptions): RenderFunctionTextDocument;
ParameterTypeDescription
optionsCreateVirtualTextDocumentOptions-

findExpression

Signature:

findExpression(offset: number, length: number): undefined | {
        offset: number;
        length: number;
    };
ParameterTypeDescription
offsetnumber-
lengthnumber-

generate

Signature:

protected generate(): string;

getAllGeneratedOffsetsAt

Signature:

getAllGeneratedOffsetsAt(offset: number): undefined | Array<{
        length: number;
        offset: number;
    }>;
ParameterTypeDescription
offsetnumber-

getGeneratedOffsetAt

Signature:

getGeneratedOffsetAt(offset: number): undefined | {
        length: number;
        offset: number;
    };
ParameterTypeDescription
offsetnumber-

getKnownComponents

Signature:

protected getKnownComponents(): Record<string, ComponentImport>;

getOriginalOffsetAt

Signature:

getOriginalOffsetAt(offset: number): undefined | {
        offset: number;
        length: number;
    };
ParameterTypeDescription
offsetnumber-

isInGeneratedRange

Signature:

isInGeneratedRange(offset: number): boolean;
ParameterTypeDescription
offsetnumber-

isInTemplateIdentifierRange

Signature:

isInTemplateIdentifierRange(offset: number): boolean;
ParameterTypeDescription
offsetnumber-

toDisplayMappings

Signature:

toDisplayMappings(): string;

tryGenerate

Signature:

protected tryGenerate(): string;


TransformedBlockTextDocument

More info

Signature:

declare class TransformedBlockTextDocument extends VirtualTextDocument {
  protected constructor(container: VueTextDocument, selector: Selector, transformed: TextDocument, source: TextDocument | VirtualTextDocument, _transform: (document: TransformedBlockTextDocument) => BlockTransformResult);
  static create(options: CreateTransformedBlockTextDocumentOptions): TransformedBlockTextDocument;
  protected refresh(): void;
  transform(): BlockTransformResult;
  tryGetGeneratedOffset(offset: number): number | undefined;
  tryGetSourceOffset(offset: number): number | undefined;
}

Members:

create

Signature:

static create(options: CreateTransformedBlockTextDocumentOptions): TransformedBlockTextDocument;
ParameterTypeDescription
optionsCreateTransformedBlockTextDocumentOptions-

refresh

Signature:

protected refresh(): void;

transform

Signature:

transform(): BlockTransformResult;

tryGetGeneratedOffset

Signature:

tryGetGeneratedOffset(offset: number): number | undefined;
ParameterTypeDescription
offsetnumber-

tryGetSourceOffset

Signature:

tryGetSourceOffset(offset: number): number | undefined;
ParameterTypeDescription
offsetnumber-


VirtualTextDocument

More info

Signature:

declare class VirtualTextDocument extends ProxyTextDocument {
  protected constructor(container: VueTextDocument, selector: Selector, doc: TextDocument);
  readonly container: VueTextDocument;
  static create(options: CreateVirtualTextDocumentOptions): VirtualTextDocument;
  protected isDirty: boolean;
  markDirty(): void;
  protected refresh(): void;
  readonly selector: Selector;
}

Members:

create

Signature:

static create(options: CreateVirtualTextDocumentOptions): VirtualTextDocument;
ParameterTypeDescription
optionsCreateVirtualTextDocumentOptions-

markDirty

Signature:

markDirty(): void;

refresh

Signature:

protected refresh(): void;


VueTextDocument

More info

Signature:

declare class VueTextDocument extends ProxyTextDocument {
  constructor(doc: TextDocument, options?: VueTextDocumentOptions, parseOptions?: SFCParseOptions);
  all(): VirtualTextDocument[];
  blockAt(position: Position | number): SFCBlock | null | undefined;
  static create(uri: string, languageId: string, version: number, content: string, options?: VueTextDocumentOptions, parseOptions?: SFCParseOptions): VueTextDocument;
  protected createBlockDocument(selector: BlockSelector): VirtualTextDocument | undefined;
  protected createInternalModuleDocument(): TransformedBlockTextDocument;
  protected createModuleDocument(): TransformedBlockTextDocument;
  protected createRenderDocument(): RenderFunctionTextDocument;
  protected createTemplateASTDocument(): TransformedBlockTextDocument;
  get descriptor(): SFCDescriptor;
  documentAt(position: Position | number): VirtualTextDocument | undefined;
  getBlock(selector: BlockSelector): SFCBlock | null | undefined;
  getBlockSelector(block: SFCBlock): BlockSelector | undefined;
  getDocument(selector: typeof RENDER_SELECTOR): RenderFunctionTextDocument;
  getDocument(selector: SelectorLike): VirtualTextDocument;
  getDocument(selector: string): VirtualTextDocument | undefined;
  getDocumentFileName(selectorLike: SelectorLike): string;
  protected getDocumentId(selector: Selector): string;
  protected getDocumentLanguage(selector: Selector): string;
  markDirty(): void;
  readonly options: VueTextDocumentOptions;
  protected parse(): void;
  static update(document: VueTextDocument, changes: TextDocumentContentChangeEvent[], version: number): VueTextDocument;
}

Members:

all

Signature:

all(): VirtualTextDocument[];

blockAt

Signature:

blockAt(position: Position | number): SFCBlock | null | undefined;
ParameterTypeDescription
positionPosition | number-

create

Signature:

static create(uri: string, languageId: string, version: number, content: string, options?: VueTextDocumentOptions, parseOptions?: SFCParseOptions): VueTextDocument;
ParameterTypeDescription
uristring-
languageIdstring-
versionnumber-
contentstring-
optionsVueTextDocumentOptions-
parseOptionsSFCParseOptions-

createBlockDocument

Signature:

protected createBlockDocument(selector: BlockSelector): VirtualTextDocument | undefined;
ParameterTypeDescription
selectorBlockSelector-

createInternalModuleDocument

Signature:

protected createInternalModuleDocument(): TransformedBlockTextDocument;

createModuleDocument

Signature:

protected createModuleDocument(): TransformedBlockTextDocument;

createRenderDocument

Signature:

protected createRenderDocument(): RenderFunctionTextDocument;

createTemplateASTDocument

Signature:

protected createTemplateASTDocument(): TransformedBlockTextDocument;

documentAt

Signature:

documentAt(position: Position | number): VirtualTextDocument | undefined;
ParameterTypeDescription
positionPosition | number-

getBlock

Signature:

getBlock(selector: BlockSelector): SFCBlock | null | undefined;
ParameterTypeDescription
selectorBlockSelector-

getBlockSelector

Signature:

getBlockSelector(block: SFCBlock): BlockSelector | undefined;
ParameterTypeDescription
blockSFCBlock-

getDocument

Signature:

getDocument(selector: typeof RENDER_SELECTOR): RenderFunctionTextDocument;
ParameterTypeDescription
selectortypeof RENDER_SELECTOR-

getDocument

Signature:

getDocument(selector: SelectorLike): VirtualTextDocument;
ParameterTypeDescription
selectorSelectorLike-

getDocument

Signature:

getDocument(selector: string): VirtualTextDocument | undefined;
ParameterTypeDescription
selectorstring-

getDocumentFileName

Signature:

getDocumentFileName(selectorLike: SelectorLike): string;
ParameterTypeDescription
selectorLikeSelectorLike-

getDocumentId

Signature:

protected getDocumentId(selector: Selector): string;
ParameterTypeDescription
selectorSelector-

getDocumentLanguage

Signature:

protected getDocumentLanguage(selector: Selector): string;
ParameterTypeDescription
selectorSelector-

markDirty

Signature:

markDirty(): void;

parse

Signature:

protected parse(): void;

update

Signature:

static update(document: VueTextDocument, changes: TextDocumentContentChangeEvent[], version: number): VueTextDocument;
ParameterTypeDescription
documentVueTextDocument-
changesTextDocumentContentChangeEvent[]-
versionnumber-


asFsPath

More info

Signature:

declare function asFsPath(uri: string): string;
ParameterTypeDescription
uristring-

asFsUri

More info

Signature:

declare function asFsUri(fileName: string): string;
ParameterTypeDescription
fileNamestring-

asUri

More info

Signature:

declare function asUri(fileNameOrUri: string): string;
ParameterTypeDescription
fileNameOrUristring-

basename

More info

Signature:

declare function basename(fileName: string): string;
ParameterTypeDescription
fileNamestring-

binarySearch

More info

Signature:

declare function binarySearch<T>(array: T[], isMatch: (a: T) => number, returnMin?: boolean): T | undefined;
ParameterTypeDescription
arrayT[]-
isMatch(a: T) => number-
returnMinboolean-

getBlockLanguage

More info

Signature:

declare function getBlockLanguage(block?: SFCBlock | null): string;
ParameterTypeDescription
blockSFCBlock | null-

getContainingFile

More info

Signature:

declare function getContainingFile(fileName: string): string;
ParameterTypeDescription
fileNamestring-

getLanguageExtension

More info

Signature:

declare function getLanguageExtension(lang: string): string;
ParameterTypeDescription
langstring-

getLanguageIdFromExtension

More info

Signature:

declare function getLanguageIdFromExtension(ext: string): string;
ParameterTypeDescription
extstring-

isOffsetInBlock

More info

Signature:

declare function isOffsetInBlock(offset: number, block?: SFCBlock | null): boolean;
ParameterTypeDescription
offsetnumber-
blockSFCBlock | null-

isVirtualFile

More info

Signature:

declare function isVirtualFile(fileName: string): boolean;
ParameterTypeDescription
fileNamestring-

isVirtualFileOfType

More info

Signature:

declare function isVirtualFileOfType(fileName: string, type: '_render' | '_module' | '_internal' | 'script' | 'scriptSetup'): boolean;
ParameterTypeDescription
fileNamestring-
type'_render' | '_module' | '_internal' | 'script' | 'scriptSetup'-

isVueFile

More info

Signature:

declare function isVueFile(fileName: string): boolean;
ParameterTypeDescription
fileNamestring-

parseVirtualFileName

More info

Signature:

declare function parseVirtualFileName(fileName: string): {
    uri: string;
    selector: Selector;
} | null;
ParameterTypeDescription
fileNamestring-

relativeVirtualImportPath

More info

Signature:

declare function relativeVirtualImportPath(fileName: string): string;
ParameterTypeDescription
fileNamestring-

replaceSlashes

More info

Signature:

declare function replaceSlashes(fileName: string): string;
ParameterTypeDescription
fileNamestring-

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 11 Apr 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