
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@vuedx/vue-virtual-textdocument
Advanced tools
An implementation of virtual filesystem for accessing blocks in a .vue
file as independent files.
npm add @vuedx/vue-virtual-textdocument
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:
Signature:
static create(fileName: string, content: string, options?: Omit<CompileOptions, 'cache' | 'fileName'>, version?: number): VueSFCDocument;
Parameter | Type | Description |
---|---|---|
fileName | string | - |
content | string | - |
options | Omit<CompileOptions, 'cache' | 'fileName'> | - |
version | number | - |
Signature:
findGeneratedTextSpan(spanInOriginalText: TextSpan): TextSpan | null;
Parameter | Type | Description |
---|---|---|
spanInOriginalText | TextSpan | - |
Signature:
findMapping(positionType: 'original' | 'generated', position: Position, searchBias?: SourceMapBiasType): Mapping | null;
Parameter | Type | Description |
---|---|---|
positionType | 'original' | 'generated' | - |
position | Position | - |
searchBias | SourceMapBiasType | - |
Signature:
findOriginalTextSpan(spanInGeneratedText: TextSpan): TextSpan | null;
Parameter | Type | Description |
---|---|---|
spanInGeneratedText | TextSpan | - |
Signature:
generatedOffsetAt(offset: number): number | null;
Parameter | Type | Description |
---|---|---|
offset | number | - |
Signature:
generatedPositionFor(position: Position): Position | null;
Parameter | Type | Description |
---|---|---|
position | Position | - |
Signature:
getBlockAt(offset: number): SFCBlock | null;
Parameter | Type | Description |
---|---|---|
offset | number | - |
Signature:
getLineAndCharacterOfPosition(position: number): Position;
Parameter | Type | Description |
---|---|---|
position | number | - |
Signature:
getSourceFile(fileName?: string): {
fileName: string;
readonly text: string;
lineMap: unknown;
getLineAndCharacterOfPosition: (position: number) => Position;
};
Parameter | Type | Description |
---|---|---|
fileName | string | - |
Signature:
getText(range?: Range): string;
Parameter | Type | Description |
---|---|---|
range | Range | - |
Signature:
offsetAt(position: Position): number;
Parameter | Type | Description |
---|---|---|
position | Position | - |
Signature:
originalOffsetAt(offset: number): number | null;
Parameter | Type | Description |
---|---|---|
offset | number | - |
Signature:
originalPositionFor(position: Position): Position | null;
Parameter | Type | Description |
---|---|---|
position | Position | - |
Signature:
positionAt(offset: number): Position;
Parameter | Type | Description |
---|---|---|
offset | number | - |
Signature:
update(changes: TextDocumentContentChangeEvent[], version: number): void;
Parameter | Type | Description |
---|---|---|
changes | TextDocumentContentChangeEvent[] | - |
version | number | - |
export interface TextSpan {
length: number;
start: number;
}
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.
FAQs
A virtual filesystem to access blocks in SFC as files
The npm package @vuedx/vue-virtual-textdocument receives a total of 4,419 weekly downloads. As such, @vuedx/vue-virtual-textdocument popularity was classified as popular.
We found that @vuedx/vue-virtual-textdocument demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.