init
This commit is contained in:
		
							
								
								
									
										21
									
								
								node_modules/@volar/language-core/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								node_modules/@volar/language-core/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
MIT License
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2021-present Johnson Chu
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
in the Software without restriction, including without limitation the rights
 | 
			
		||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
furnished to do so, subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
SOFTWARE.
 | 
			
		||||
							
								
								
									
										5
									
								
								node_modules/@volar/language-core/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								node_modules/@volar/language-core/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
export * from './lib/virtualFiles';
 | 
			
		||||
export * from './lib/languageContext';
 | 
			
		||||
export * from './lib/sourceMaps';
 | 
			
		||||
export * from './lib/types';
 | 
			
		||||
//# sourceMappingURL=index.d.ts.map
 | 
			
		||||
							
								
								
									
										21
									
								
								node_modules/@volar/language-core/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								node_modules/@volar/language-core/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    var desc = Object.getOwnPropertyDescriptor(m, k);
 | 
			
		||||
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
 | 
			
		||||
      desc = { enumerable: true, get: function() { return m[k]; } };
 | 
			
		||||
    }
 | 
			
		||||
    Object.defineProperty(o, k2, desc);
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
 | 
			
		||||
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
__exportStar(require("./lib/virtualFiles"), exports);
 | 
			
		||||
__exportStar(require("./lib/languageContext"), exports);
 | 
			
		||||
__exportStar(require("./lib/sourceMaps"), exports);
 | 
			
		||||
__exportStar(require("./lib/types"), exports);
 | 
			
		||||
//# sourceMappingURL=index.js.map
 | 
			
		||||
							
								
								
									
										9
									
								
								node_modules/@volar/language-core/lib/languageContext.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								node_modules/@volar/language-core/lib/languageContext.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
import { createVirtualFiles } from './virtualFiles';
 | 
			
		||||
import { Language, TypeScriptLanguageHost } from './types';
 | 
			
		||||
export interface LanguageContext {
 | 
			
		||||
    rawHost: TypeScriptLanguageHost;
 | 
			
		||||
    host: TypeScriptLanguageHost;
 | 
			
		||||
    virtualFiles: ReturnType<typeof createVirtualFiles>;
 | 
			
		||||
}
 | 
			
		||||
export declare function createLanguageContext(rawHost: TypeScriptLanguageHost, languages: Language<any>[]): LanguageContext;
 | 
			
		||||
//# sourceMappingURL=languageContext.d.ts.map
 | 
			
		||||
							
								
								
									
										67
									
								
								node_modules/@volar/language-core/lib/languageContext.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								node_modules/@volar/language-core/lib/languageContext.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,67 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.createLanguageContext = void 0;
 | 
			
		||||
const virtualFiles_1 = require("./virtualFiles");
 | 
			
		||||
function createLanguageContext(rawHost, languages) {
 | 
			
		||||
    let host = rawHost;
 | 
			
		||||
    let lastRootFiles = new Map();
 | 
			
		||||
    let lastProjectVersion;
 | 
			
		||||
    const virtualFiles = (0, virtualFiles_1.createVirtualFiles)(languages);
 | 
			
		||||
    for (const language of languages.reverse()) {
 | 
			
		||||
        if (language.resolveHost) {
 | 
			
		||||
            const pastHost = host;
 | 
			
		||||
            let proxyHost = language.resolveHost(host);
 | 
			
		||||
            if (proxyHost === pastHost) {
 | 
			
		||||
                console.warn(`[volar] language.resolveHost() should not return the same host instance.`);
 | 
			
		||||
                proxyHost = { ...proxyHost };
 | 
			
		||||
            }
 | 
			
		||||
            host = new Proxy(proxyHost, {
 | 
			
		||||
                get(target, p) {
 | 
			
		||||
                    if (p in target) {
 | 
			
		||||
                        return target[p];
 | 
			
		||||
                    }
 | 
			
		||||
                    return pastHost[p];
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return {
 | 
			
		||||
        rawHost,
 | 
			
		||||
        host,
 | 
			
		||||
        virtualFiles: new Proxy(virtualFiles, {
 | 
			
		||||
            get: (target, property) => {
 | 
			
		||||
                syncVirtualFiles();
 | 
			
		||||
                return target[property];
 | 
			
		||||
            },
 | 
			
		||||
        }),
 | 
			
		||||
    };
 | 
			
		||||
    function syncVirtualFiles() {
 | 
			
		||||
        const newProjectVersion = host.getProjectVersion();
 | 
			
		||||
        const shouldUpdate = newProjectVersion !== lastProjectVersion;
 | 
			
		||||
        if (!shouldUpdate)
 | 
			
		||||
            return;
 | 
			
		||||
        const nowRootFiles = new Map();
 | 
			
		||||
        const remainRootFiles = new Set(lastRootFiles.keys());
 | 
			
		||||
        for (const rootFileName of host.getScriptFileNames()) {
 | 
			
		||||
            nowRootFiles.set(rootFileName, host.getScriptSnapshot(rootFileName));
 | 
			
		||||
        }
 | 
			
		||||
        for (const [fileName, snapshot] of nowRootFiles) {
 | 
			
		||||
            remainRootFiles.delete(fileName);
 | 
			
		||||
            if (lastRootFiles.get(fileName) !== nowRootFiles.get(fileName)) {
 | 
			
		||||
                if (snapshot) {
 | 
			
		||||
                    virtualFiles.updateSource(fileName, snapshot, host.getLanguageId?.(fileName));
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    virtualFiles.deleteSource(fileName);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        for (const fileName of remainRootFiles) {
 | 
			
		||||
            virtualFiles.deleteSource(fileName);
 | 
			
		||||
        }
 | 
			
		||||
        lastRootFiles = nowRootFiles;
 | 
			
		||||
        lastProjectVersion = newProjectVersion;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.createLanguageContext = createLanguageContext;
 | 
			
		||||
//# sourceMappingURL=languageContext.js.map
 | 
			
		||||
							
								
								
									
										6
									
								
								node_modules/@volar/language-core/lib/sourceMaps.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								node_modules/@volar/language-core/lib/sourceMaps.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
import * as SourceMaps from '@volar/source-map';
 | 
			
		||||
import { MirrorBehaviorCapabilities } from './types';
 | 
			
		||||
export declare class MirrorMap extends SourceMaps.SourceMap<[MirrorBehaviorCapabilities, MirrorBehaviorCapabilities]> {
 | 
			
		||||
    findMirrorOffsets(start: number): Generator<readonly [number, MirrorBehaviorCapabilities], void, unknown>;
 | 
			
		||||
}
 | 
			
		||||
//# sourceMappingURL=sourceMaps.d.ts.map
 | 
			
		||||
							
								
								
									
										16
									
								
								node_modules/@volar/language-core/lib/sourceMaps.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								node_modules/@volar/language-core/lib/sourceMaps.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.MirrorMap = void 0;
 | 
			
		||||
const SourceMaps = require("@volar/source-map");
 | 
			
		||||
class MirrorMap extends SourceMaps.SourceMap {
 | 
			
		||||
    *findMirrorOffsets(start) {
 | 
			
		||||
        for (const mapped of this.toGeneratedOffsets(start)) {
 | 
			
		||||
            yield [mapped[0], mapped[1].data[1]];
 | 
			
		||||
        }
 | 
			
		||||
        for (const mapped of this.toSourceOffsets(start)) {
 | 
			
		||||
            yield [mapped[0], mapped[1].data[0]];
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.MirrorMap = MirrorMap;
 | 
			
		||||
//# sourceMappingURL=sourceMaps.js.map
 | 
			
		||||
							
								
								
									
										76
									
								
								node_modules/@volar/language-core/lib/types.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								node_modules/@volar/language-core/lib/types.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,76 @@
 | 
			
		||||
import { Mapping, Stack } from '@volar/source-map';
 | 
			
		||||
import type * as ts from 'typescript/lib/tsserverlibrary';
 | 
			
		||||
export interface FileCapabilities {
 | 
			
		||||
    diagnostic?: boolean;
 | 
			
		||||
    foldingRange?: boolean;
 | 
			
		||||
    documentFormatting?: boolean;
 | 
			
		||||
    documentSymbol?: boolean;
 | 
			
		||||
    codeAction?: boolean;
 | 
			
		||||
    inlayHint?: boolean;
 | 
			
		||||
}
 | 
			
		||||
export interface FileRangeCapabilities {
 | 
			
		||||
    hover?: boolean;
 | 
			
		||||
    references?: boolean;
 | 
			
		||||
    definition?: boolean;
 | 
			
		||||
    rename?: boolean | {
 | 
			
		||||
        normalize?(newName: string): string;
 | 
			
		||||
        apply?(newName: string): string;
 | 
			
		||||
    };
 | 
			
		||||
    completion?: boolean | {
 | 
			
		||||
        additional?: boolean;
 | 
			
		||||
        autoImportOnly?: boolean;
 | 
			
		||||
    };
 | 
			
		||||
    diagnostic?: boolean | {
 | 
			
		||||
        shouldReport(): boolean;
 | 
			
		||||
    };
 | 
			
		||||
    semanticTokens?: boolean;
 | 
			
		||||
    referencesCodeLens?: boolean;
 | 
			
		||||
    displayWithLink?: boolean;
 | 
			
		||||
}
 | 
			
		||||
export interface MirrorBehaviorCapabilities {
 | 
			
		||||
    references?: boolean;
 | 
			
		||||
    definition?: boolean;
 | 
			
		||||
    rename?: boolean;
 | 
			
		||||
}
 | 
			
		||||
export declare namespace FileCapabilities {
 | 
			
		||||
    const full: FileCapabilities;
 | 
			
		||||
}
 | 
			
		||||
export declare namespace FileRangeCapabilities {
 | 
			
		||||
    const full: FileRangeCapabilities;
 | 
			
		||||
}
 | 
			
		||||
export declare namespace MirrorBehaviorCapabilities {
 | 
			
		||||
    const full: MirrorBehaviorCapabilities;
 | 
			
		||||
}
 | 
			
		||||
export declare enum FileKind {
 | 
			
		||||
    TextFile = 0,
 | 
			
		||||
    TypeScriptHostFile = 1
 | 
			
		||||
}
 | 
			
		||||
export interface VirtualFile {
 | 
			
		||||
    fileName: string;
 | 
			
		||||
    snapshot: ts.IScriptSnapshot;
 | 
			
		||||
    kind: FileKind;
 | 
			
		||||
    capabilities: FileCapabilities;
 | 
			
		||||
    mappings: Mapping<FileRangeCapabilities>[];
 | 
			
		||||
    codegenStacks: Stack[];
 | 
			
		||||
    mirrorBehaviorMappings?: Mapping<[MirrorBehaviorCapabilities, MirrorBehaviorCapabilities]>[];
 | 
			
		||||
    embeddedFiles: VirtualFile[];
 | 
			
		||||
}
 | 
			
		||||
export interface Language<T extends VirtualFile = VirtualFile> {
 | 
			
		||||
    resolveHost?(host: TypeScriptLanguageHost): TypeScriptLanguageHost;
 | 
			
		||||
    createVirtualFile(fileName: string, snapshot: ts.IScriptSnapshot, languageId: string | undefined): T | undefined;
 | 
			
		||||
    updateVirtualFile(virtualFile: T, snapshot: ts.IScriptSnapshot): void;
 | 
			
		||||
    deleteVirtualFile?(virtualFile: T): void;
 | 
			
		||||
}
 | 
			
		||||
interface LanguageHost {
 | 
			
		||||
    workspacePath: string;
 | 
			
		||||
    rootPath: string;
 | 
			
		||||
    getProjectVersion(): string;
 | 
			
		||||
    getScriptFileNames(): string[];
 | 
			
		||||
    getScriptSnapshot(fileName: string): ts.IScriptSnapshot | undefined;
 | 
			
		||||
    getLanguageId?(fileName: string): string | undefined;
 | 
			
		||||
}
 | 
			
		||||
export interface TypeScriptLanguageHost extends LanguageHost, Pick<ts.LanguageServiceHost, 'getCancellationToken' | 'getLocalizedDiagnosticMessages' | 'getCompilationSettings' | 'getProjectReferences'> {
 | 
			
		||||
    resolveModuleName?(path: string, impliedNodeFormat?: ts.ResolutionMode): string;
 | 
			
		||||
}
 | 
			
		||||
export {};
 | 
			
		||||
//# sourceMappingURL=types.d.ts.map
 | 
			
		||||
							
								
								
									
										40
									
								
								node_modules/@volar/language-core/lib/types.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								node_modules/@volar/language-core/lib/types.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.FileKind = exports.MirrorBehaviorCapabilities = exports.FileRangeCapabilities = exports.FileCapabilities = void 0;
 | 
			
		||||
var FileCapabilities;
 | 
			
		||||
(function (FileCapabilities) {
 | 
			
		||||
    FileCapabilities.full = {
 | 
			
		||||
        diagnostic: true,
 | 
			
		||||
        foldingRange: true,
 | 
			
		||||
        documentFormatting: true,
 | 
			
		||||
        documentSymbol: true,
 | 
			
		||||
        codeAction: true,
 | 
			
		||||
        inlayHint: true,
 | 
			
		||||
    };
 | 
			
		||||
})(FileCapabilities || (exports.FileCapabilities = FileCapabilities = {}));
 | 
			
		||||
var FileRangeCapabilities;
 | 
			
		||||
(function (FileRangeCapabilities) {
 | 
			
		||||
    FileRangeCapabilities.full = {
 | 
			
		||||
        hover: true,
 | 
			
		||||
        references: true,
 | 
			
		||||
        definition: true,
 | 
			
		||||
        rename: true,
 | 
			
		||||
        completion: true,
 | 
			
		||||
        diagnostic: true,
 | 
			
		||||
        semanticTokens: true,
 | 
			
		||||
    };
 | 
			
		||||
})(FileRangeCapabilities || (exports.FileRangeCapabilities = FileRangeCapabilities = {}));
 | 
			
		||||
var MirrorBehaviorCapabilities;
 | 
			
		||||
(function (MirrorBehaviorCapabilities) {
 | 
			
		||||
    MirrorBehaviorCapabilities.full = {
 | 
			
		||||
        references: true,
 | 
			
		||||
        definition: true,
 | 
			
		||||
        rename: true,
 | 
			
		||||
    };
 | 
			
		||||
})(MirrorBehaviorCapabilities || (exports.MirrorBehaviorCapabilities = MirrorBehaviorCapabilities = {}));
 | 
			
		||||
var FileKind;
 | 
			
		||||
(function (FileKind) {
 | 
			
		||||
    FileKind[FileKind["TextFile"] = 0] = "TextFile";
 | 
			
		||||
    FileKind[FileKind["TypeScriptHostFile"] = 1] = "TypeScriptHostFile";
 | 
			
		||||
})(FileKind || (exports.FileKind = FileKind = {}));
 | 
			
		||||
//# sourceMappingURL=types.js.map
 | 
			
		||||
							
								
								
									
										26
									
								
								node_modules/@volar/language-core/lib/virtualFiles.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								node_modules/@volar/language-core/lib/virtualFiles.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
import { SourceMap } from '@volar/source-map';
 | 
			
		||||
import type * as ts from 'typescript/lib/tsserverlibrary';
 | 
			
		||||
import { MirrorMap } from './sourceMaps';
 | 
			
		||||
import type { FileRangeCapabilities, Language, VirtualFile } from './types';
 | 
			
		||||
export type VirtualFiles = ReturnType<typeof createVirtualFiles>;
 | 
			
		||||
export interface Source {
 | 
			
		||||
    fileName: string;
 | 
			
		||||
    languageId: string | undefined;
 | 
			
		||||
    snapshot: ts.IScriptSnapshot;
 | 
			
		||||
    root: VirtualFile;
 | 
			
		||||
    language: Language;
 | 
			
		||||
}
 | 
			
		||||
export declare function createVirtualFiles(languages: Language[]): {
 | 
			
		||||
    allSources(): Source[];
 | 
			
		||||
    updateSource(fileName: string, snapshot: ts.IScriptSnapshot, languageId: string | undefined): VirtualFile | undefined;
 | 
			
		||||
    deleteSource(fileName: string): void;
 | 
			
		||||
    getSource(fileName: string): Source | undefined;
 | 
			
		||||
    hasSource: (fileName: string) => boolean;
 | 
			
		||||
    getMirrorMap: (file: VirtualFile) => MirrorMap | undefined;
 | 
			
		||||
    getMaps: (virtualFile: VirtualFile) => Map<string, [ts.IScriptSnapshot, SourceMap<FileRangeCapabilities>]>;
 | 
			
		||||
    hasVirtualFile(fileName: string): boolean;
 | 
			
		||||
    getVirtualFile(fileName: string): readonly [VirtualFile, Source] | readonly [undefined, undefined];
 | 
			
		||||
};
 | 
			
		||||
export declare function updateVirtualFileMaps(virtualFile: VirtualFile, getSourceSnapshot: (source: string | undefined) => [string, ts.IScriptSnapshot] | undefined, map?: Map<string, [ts.IScriptSnapshot, SourceMap<FileRangeCapabilities>]>): Map<string, [ts.IScriptSnapshot, SourceMap<FileRangeCapabilities>]>;
 | 
			
		||||
export declare function forEachEmbeddedFile(file: VirtualFile, cb: (embedded: VirtualFile) => void): void;
 | 
			
		||||
//# sourceMappingURL=virtualFiles.d.ts.map
 | 
			
		||||
							
								
								
									
										129
									
								
								node_modules/@volar/language-core/lib/virtualFiles.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										129
									
								
								node_modules/@volar/language-core/lib/virtualFiles.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,129 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.forEachEmbeddedFile = exports.updateVirtualFileMaps = exports.createVirtualFiles = void 0;
 | 
			
		||||
const source_map_1 = require("@volar/source-map");
 | 
			
		||||
const sourceMaps_1 = require("./sourceMaps");
 | 
			
		||||
function createVirtualFiles(languages) {
 | 
			
		||||
    const sourceFiles = new Map();
 | 
			
		||||
    const virtualFiles = new Map();
 | 
			
		||||
    const virtualFileMaps = new WeakMap();
 | 
			
		||||
    const virtualFileToMirrorMap = new WeakMap();
 | 
			
		||||
    return {
 | 
			
		||||
        allSources() {
 | 
			
		||||
            return Array.from(sourceFiles.values());
 | 
			
		||||
        },
 | 
			
		||||
        updateSource(fileName, snapshot, languageId) {
 | 
			
		||||
            const key = normalizePath(fileName);
 | 
			
		||||
            const value = sourceFiles.get(key);
 | 
			
		||||
            if (value) {
 | 
			
		||||
                if (value.languageId !== languageId) {
 | 
			
		||||
                    // languageId changed
 | 
			
		||||
                    this.deleteSource(fileName);
 | 
			
		||||
                    return this.updateSource(fileName, snapshot, languageId);
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    value.snapshot = snapshot;
 | 
			
		||||
                    deleteVirtualFiles(value);
 | 
			
		||||
                    value.language.updateVirtualFile(value.root, snapshot);
 | 
			
		||||
                    updateVirtualFiles(value);
 | 
			
		||||
                    return value.root; // updated
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            for (const language of languages) {
 | 
			
		||||
                const virtualFile = language.createVirtualFile(fileName, snapshot, languageId);
 | 
			
		||||
                if (virtualFile) {
 | 
			
		||||
                    const source = { fileName, languageId, snapshot, root: virtualFile, language };
 | 
			
		||||
                    sourceFiles.set(key, source);
 | 
			
		||||
                    updateVirtualFiles(source);
 | 
			
		||||
                    return virtualFile; // created
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        deleteSource(fileName) {
 | 
			
		||||
            const key = normalizePath(fileName);
 | 
			
		||||
            const value = sourceFiles.get(key);
 | 
			
		||||
            if (value) {
 | 
			
		||||
                value.language.deleteVirtualFile?.(value.root);
 | 
			
		||||
                sourceFiles.delete(key); // deleted
 | 
			
		||||
                deleteVirtualFiles(value);
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        getSource(fileName) {
 | 
			
		||||
            const key = normalizePath(fileName);
 | 
			
		||||
            return sourceFiles.get(key);
 | 
			
		||||
        },
 | 
			
		||||
        hasSource: (fileName) => sourceFiles.has(normalizePath(fileName)),
 | 
			
		||||
        getMirrorMap: getMirrorMap,
 | 
			
		||||
        getMaps: getMapsByVirtualFile,
 | 
			
		||||
        hasVirtualFile(fileName) {
 | 
			
		||||
            return !!virtualFiles.get(normalizePath(fileName));
 | 
			
		||||
        },
 | 
			
		||||
        getVirtualFile(fileName) {
 | 
			
		||||
            const sourceAndVirtual = virtualFiles.get(normalizePath(fileName));
 | 
			
		||||
            if (sourceAndVirtual) {
 | 
			
		||||
                return [sourceAndVirtual.virtualFile, sourceAndVirtual.source];
 | 
			
		||||
            }
 | 
			
		||||
            return [undefined, undefined];
 | 
			
		||||
        },
 | 
			
		||||
    };
 | 
			
		||||
    function deleteVirtualFiles(source) {
 | 
			
		||||
        forEachEmbeddedFile(source.root, file => {
 | 
			
		||||
            virtualFiles.delete(normalizePath(file.fileName));
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    function updateVirtualFiles(source) {
 | 
			
		||||
        forEachEmbeddedFile(source.root, file => {
 | 
			
		||||
            virtualFiles.set(normalizePath(file.fileName), { virtualFile: file, source });
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    function getMapsByVirtualFile(virtualFile) {
 | 
			
		||||
        if (!virtualFileMaps.has(virtualFile.snapshot)) {
 | 
			
		||||
            virtualFileMaps.set(virtualFile.snapshot, new Map());
 | 
			
		||||
        }
 | 
			
		||||
        updateVirtualFileMaps(virtualFile, sourceFileName => {
 | 
			
		||||
            if (sourceFileName) {
 | 
			
		||||
                const source = sourceFiles.get(normalizePath(sourceFileName));
 | 
			
		||||
                return [sourceFileName, source.snapshot];
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                const source = virtualFiles.get(normalizePath(virtualFile.fileName)).source;
 | 
			
		||||
                return [source.fileName, source.snapshot];
 | 
			
		||||
            }
 | 
			
		||||
        }, virtualFileMaps.get(virtualFile.snapshot));
 | 
			
		||||
        return virtualFileMaps.get(virtualFile.snapshot);
 | 
			
		||||
    }
 | 
			
		||||
    function getMirrorMap(file) {
 | 
			
		||||
        if (!virtualFileToMirrorMap.has(file.snapshot)) {
 | 
			
		||||
            virtualFileToMirrorMap.set(file.snapshot, file.mirrorBehaviorMappings ? new sourceMaps_1.MirrorMap(file.mirrorBehaviorMappings) : undefined);
 | 
			
		||||
        }
 | 
			
		||||
        return virtualFileToMirrorMap.get(file.snapshot);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.createVirtualFiles = createVirtualFiles;
 | 
			
		||||
function updateVirtualFileMaps(virtualFile, getSourceSnapshot, map = new Map()) {
 | 
			
		||||
    const sources = new Set();
 | 
			
		||||
    for (const mapping of virtualFile.mappings) {
 | 
			
		||||
        if (sources.has(mapping.source))
 | 
			
		||||
            continue;
 | 
			
		||||
        sources.add(mapping.source);
 | 
			
		||||
        const source = getSourceSnapshot(mapping.source);
 | 
			
		||||
        if (!source)
 | 
			
		||||
            continue;
 | 
			
		||||
        if (!map.has(source[0]) || map.get(source[0])[0] !== source[1]) {
 | 
			
		||||
            map.set(source[0], [source[1], new source_map_1.SourceMap(virtualFile.mappings.filter(mapping2 => mapping2.source === mapping.source))]);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return map;
 | 
			
		||||
}
 | 
			
		||||
exports.updateVirtualFileMaps = updateVirtualFileMaps;
 | 
			
		||||
function forEachEmbeddedFile(file, cb) {
 | 
			
		||||
    cb(file);
 | 
			
		||||
    for (const embeddedFile of file.embeddedFiles) {
 | 
			
		||||
        forEachEmbeddedFile(embeddedFile, cb);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.forEachEmbeddedFile = forEachEmbeddedFile;
 | 
			
		||||
function normalizePath(fileName) {
 | 
			
		||||
    return fileName.replace(/\\/g, '/').toLowerCase();
 | 
			
		||||
}
 | 
			
		||||
//# sourceMappingURL=virtualFiles.js.map
 | 
			
		||||
							
								
								
									
										18
									
								
								node_modules/@volar/language-core/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								node_modules/@volar/language-core/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
{
 | 
			
		||||
	"name": "@volar/language-core",
 | 
			
		||||
	"version": "1.11.1",
 | 
			
		||||
	"license": "MIT",
 | 
			
		||||
	"files": [
 | 
			
		||||
		"**/*.js",
 | 
			
		||||
		"**/*.d.ts"
 | 
			
		||||
	],
 | 
			
		||||
	"repository": {
 | 
			
		||||
		"type": "git",
 | 
			
		||||
		"url": "https://github.com/volarjs/volar.js.git",
 | 
			
		||||
		"directory": "packages/language-core"
 | 
			
		||||
	},
 | 
			
		||||
	"dependencies": {
 | 
			
		||||
		"@volar/source-map": "1.11.1"
 | 
			
		||||
	},
 | 
			
		||||
	"gitHead": "188f49ee79bd2ea8e8fc32b80003c85f79868f9d"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										21
									
								
								node_modules/@volar/source-map/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								node_modules/@volar/source-map/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
MIT License
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2021-present Johnson Chu
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
in the Software without restriction, including without limitation the rights
 | 
			
		||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
furnished to do so, subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
SOFTWARE.
 | 
			
		||||
							
								
								
									
										28
									
								
								node_modules/@volar/source-map/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								node_modules/@volar/source-map/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
import { Segment, StackNode } from 'muggle-string';
 | 
			
		||||
export * from 'muggle-string';
 | 
			
		||||
export interface Mapping<T = any> {
 | 
			
		||||
    source?: string;
 | 
			
		||||
    sourceRange: [number, number];
 | 
			
		||||
    generatedRange: [number, number];
 | 
			
		||||
    data: T;
 | 
			
		||||
}
 | 
			
		||||
export interface Stack {
 | 
			
		||||
    source: string;
 | 
			
		||||
    range: [number, number];
 | 
			
		||||
}
 | 
			
		||||
export declare class SourceMap<Data = any> {
 | 
			
		||||
    readonly mappings: Mapping<Data>[];
 | 
			
		||||
    private _memo;
 | 
			
		||||
    private get memo();
 | 
			
		||||
    constructor(mappings: Mapping<Data>[]);
 | 
			
		||||
    toSourceOffset(start: number, baseOnRight?: boolean): readonly [number, Mapping<Data>] | undefined;
 | 
			
		||||
    toGeneratedOffset(start: number, baseOnRight?: boolean): readonly [number, Mapping<Data>] | undefined;
 | 
			
		||||
    toSourceOffsets(start: number, baseOnRight?: boolean): Generator<readonly [number, Mapping<Data>], void, unknown>;
 | 
			
		||||
    toGeneratedOffsets(start: number, baseOnRight?: boolean): Generator<readonly [number, Mapping<Data>], void, unknown>;
 | 
			
		||||
    matching(startOffset: number, from: 'sourceRange' | 'generatedRange', to: 'sourceRange' | 'generatedRange', baseOnRight: boolean): Generator<readonly [number, Mapping<Data>], void, unknown>;
 | 
			
		||||
    matchOffset(start: number, mappedFromRange: [number, number], mappedToRange: [number, number], baseOnRight: boolean): number | undefined;
 | 
			
		||||
    private binarySearchMemo;
 | 
			
		||||
}
 | 
			
		||||
export declare function buildMappings<T>(chunks: Segment<T>[]): Mapping<T>[];
 | 
			
		||||
export declare function buildStacks<T>(chunks: Segment<T>[], stacks: StackNode[]): Stack[];
 | 
			
		||||
//# sourceMappingURL=index.d.ts.map
 | 
			
		||||
							
								
								
									
										182
									
								
								node_modules/@volar/source-map/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										182
									
								
								node_modules/@volar/source-map/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,182 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    var desc = Object.getOwnPropertyDescriptor(m, k);
 | 
			
		||||
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
 | 
			
		||||
      desc = { enumerable: true, get: function() { return m[k]; } };
 | 
			
		||||
    }
 | 
			
		||||
    Object.defineProperty(o, k2, desc);
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
 | 
			
		||||
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.buildStacks = exports.buildMappings = exports.SourceMap = void 0;
 | 
			
		||||
__exportStar(require("muggle-string"), exports);
 | 
			
		||||
class SourceMap {
 | 
			
		||||
    get memo() {
 | 
			
		||||
        if (!this._memo) {
 | 
			
		||||
            const self = this;
 | 
			
		||||
            this._memo = {
 | 
			
		||||
                sourceRange: createMemo('sourceRange'),
 | 
			
		||||
                generatedRange: createMemo('generatedRange'),
 | 
			
		||||
            };
 | 
			
		||||
            function createMemo(key) {
 | 
			
		||||
                const offsets = new Set();
 | 
			
		||||
                for (const mapping of self.mappings) {
 | 
			
		||||
                    offsets.add(mapping[key][0]);
 | 
			
		||||
                    offsets.add(mapping[key][1]);
 | 
			
		||||
                }
 | 
			
		||||
                const arr = [...offsets].sort((a, b) => a - b).map(offset => ({ offset, mappings: new Set() }));
 | 
			
		||||
                for (const mapping of self.mappings) {
 | 
			
		||||
                    const startIndex = binarySearch(mapping[key][0]);
 | 
			
		||||
                    const endIndex = binarySearch(mapping[key][1]);
 | 
			
		||||
                    for (let i = startIndex; i <= endIndex; i++) {
 | 
			
		||||
                        arr[i].mappings.add(mapping);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                return arr;
 | 
			
		||||
                function binarySearch(start) {
 | 
			
		||||
                    let low = 0;
 | 
			
		||||
                    let high = arr.length - 1;
 | 
			
		||||
                    while (low <= high) {
 | 
			
		||||
                        const mid = Math.floor((low + high) / 2);
 | 
			
		||||
                        const midValue = arr[mid];
 | 
			
		||||
                        if (midValue.offset < start) {
 | 
			
		||||
                            low = mid + 1;
 | 
			
		||||
                        }
 | 
			
		||||
                        else if (midValue.offset > start) {
 | 
			
		||||
                            high = mid - 1;
 | 
			
		||||
                        }
 | 
			
		||||
                        else {
 | 
			
		||||
                            return mid;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return this._memo;
 | 
			
		||||
    }
 | 
			
		||||
    constructor(mappings) {
 | 
			
		||||
        this.mappings = mappings;
 | 
			
		||||
    }
 | 
			
		||||
    toSourceOffset(start, baseOnRight = false) {
 | 
			
		||||
        for (const mapped of this.matching(start, 'generatedRange', 'sourceRange', baseOnRight)) {
 | 
			
		||||
            return mapped;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    toGeneratedOffset(start, baseOnRight = false) {
 | 
			
		||||
        for (const mapped of this.matching(start, 'sourceRange', 'generatedRange', baseOnRight)) {
 | 
			
		||||
            return mapped;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    toSourceOffsets(start, baseOnRight = false) {
 | 
			
		||||
        return this.matching(start, 'generatedRange', 'sourceRange', baseOnRight);
 | 
			
		||||
    }
 | 
			
		||||
    toGeneratedOffsets(start, baseOnRight = false) {
 | 
			
		||||
        return this.matching(start, 'sourceRange', 'generatedRange', baseOnRight);
 | 
			
		||||
    }
 | 
			
		||||
    *matching(startOffset, from, to, baseOnRight) {
 | 
			
		||||
        const memo = this.memo[from];
 | 
			
		||||
        if (memo.length === 0)
 | 
			
		||||
            return;
 | 
			
		||||
        const { low: start, high: end, } = this.binarySearchMemo(memo, startOffset);
 | 
			
		||||
        const skip = new Set();
 | 
			
		||||
        for (let i = start; i <= end; i++) {
 | 
			
		||||
            for (const mapping of memo[i].mappings) {
 | 
			
		||||
                if (skip.has(mapping)) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                skip.add(mapping);
 | 
			
		||||
                const mapped = this.matchOffset(startOffset, mapping[from], mapping[to], baseOnRight);
 | 
			
		||||
                if (mapped !== undefined) {
 | 
			
		||||
                    yield [mapped, mapping];
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    matchOffset(start, mappedFromRange, mappedToRange, baseOnRight) {
 | 
			
		||||
        if (start >= mappedFromRange[0] && start <= mappedFromRange[1]) {
 | 
			
		||||
            let offset = mappedToRange[0] + start - mappedFromRange[0];
 | 
			
		||||
            if (baseOnRight) {
 | 
			
		||||
                offset += (mappedToRange[1] - mappedToRange[0]) - (mappedFromRange[1] - mappedFromRange[0]);
 | 
			
		||||
            }
 | 
			
		||||
            if (offset >= mappedToRange[0] && offset <= mappedToRange[1]) {
 | 
			
		||||
                return offset;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    binarySearchMemo(array, start) {
 | 
			
		||||
        let low = 0;
 | 
			
		||||
        let high = array.length - 1;
 | 
			
		||||
        while (low <= high) {
 | 
			
		||||
            const mid = Math.floor((low + high) / 2);
 | 
			
		||||
            const midValue = array[mid];
 | 
			
		||||
            if (midValue.offset < start) {
 | 
			
		||||
                low = mid + 1;
 | 
			
		||||
            }
 | 
			
		||||
            else if (midValue.offset > start) {
 | 
			
		||||
                high = mid - 1;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                low = mid;
 | 
			
		||||
                high = mid;
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return {
 | 
			
		||||
            low: Math.max(Math.min(low, high, array.length - 1), 0),
 | 
			
		||||
            high: Math.min(Math.max(low, high, 0), array.length - 1),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.SourceMap = SourceMap;
 | 
			
		||||
function buildMappings(chunks) {
 | 
			
		||||
    let length = 0;
 | 
			
		||||
    const mappings = [];
 | 
			
		||||
    for (const segment of chunks) {
 | 
			
		||||
        if (typeof segment === 'string') {
 | 
			
		||||
            length += segment.length;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            mappings.push({
 | 
			
		||||
                generatedRange: [length, length + segment[0].length],
 | 
			
		||||
                source: segment[1],
 | 
			
		||||
                sourceRange: typeof segment[2] === 'number' ? [segment[2], segment[2] + segment[0].length] : segment[2],
 | 
			
		||||
                // @ts-ignore
 | 
			
		||||
                data: segment[3],
 | 
			
		||||
            });
 | 
			
		||||
            length += segment[0].length;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return mappings;
 | 
			
		||||
}
 | 
			
		||||
exports.buildMappings = buildMappings;
 | 
			
		||||
function buildStacks(chunks, stacks) {
 | 
			
		||||
    let offset = 0;
 | 
			
		||||
    let index = 0;
 | 
			
		||||
    const result = [];
 | 
			
		||||
    for (const stack of stacks) {
 | 
			
		||||
        const start = offset;
 | 
			
		||||
        for (let i = 0; i < stack.length; i++) {
 | 
			
		||||
            const segment = chunks[index + i];
 | 
			
		||||
            if (typeof segment === 'string') {
 | 
			
		||||
                offset += segment.length;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                offset += segment[0].length;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        index += stack.length;
 | 
			
		||||
        result.push({
 | 
			
		||||
            range: [start, offset],
 | 
			
		||||
            source: stack.stack,
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
exports.buildStacks = buildStacks;
 | 
			
		||||
//# sourceMappingURL=index.js.map
 | 
			
		||||
							
								
								
									
										18
									
								
								node_modules/@volar/source-map/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								node_modules/@volar/source-map/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
{
 | 
			
		||||
	"name": "@volar/source-map",
 | 
			
		||||
	"version": "1.11.1",
 | 
			
		||||
	"license": "MIT",
 | 
			
		||||
	"files": [
 | 
			
		||||
		"**/*.js",
 | 
			
		||||
		"**/*.d.ts"
 | 
			
		||||
	],
 | 
			
		||||
	"repository": {
 | 
			
		||||
		"type": "git",
 | 
			
		||||
		"url": "https://github.com/volarjs/volar.js.git",
 | 
			
		||||
		"directory": "packages/source-map"
 | 
			
		||||
	},
 | 
			
		||||
	"dependencies": {
 | 
			
		||||
		"muggle-string": "^0.3.1"
 | 
			
		||||
	},
 | 
			
		||||
	"gitHead": "188f49ee79bd2ea8e8fc32b80003c85f79868f9d"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										21
									
								
								node_modules/@volar/typescript/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								node_modules/@volar/typescript/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
MIT License
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2021-present Johnson Chu
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
in the Software without restriction, including without limitation the rights
 | 
			
		||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
furnished to do so, subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
SOFTWARE.
 | 
			
		||||
							
								
								
									
										7
									
								
								node_modules/@volar/typescript/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								node_modules/@volar/typescript/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
export * from './lib/documentRegistry';
 | 
			
		||||
export * from './lib/languageService';
 | 
			
		||||
export * from './lib/languageServiceHost';
 | 
			
		||||
export * from './lib/sys';
 | 
			
		||||
export * from './lib/getProgram';
 | 
			
		||||
export * from './lib/serverPlugin';
 | 
			
		||||
//# sourceMappingURL=index.d.ts.map
 | 
			
		||||
							
								
								
									
										23
									
								
								node_modules/@volar/typescript/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								node_modules/@volar/typescript/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    var desc = Object.getOwnPropertyDescriptor(m, k);
 | 
			
		||||
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
 | 
			
		||||
      desc = { enumerable: true, get: function() { return m[k]; } };
 | 
			
		||||
    }
 | 
			
		||||
    Object.defineProperty(o, k2, desc);
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
 | 
			
		||||
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
__exportStar(require("./lib/documentRegistry"), exports);
 | 
			
		||||
__exportStar(require("./lib/languageService"), exports);
 | 
			
		||||
__exportStar(require("./lib/languageServiceHost"), exports);
 | 
			
		||||
__exportStar(require("./lib/sys"), exports);
 | 
			
		||||
__exportStar(require("./lib/getProgram"), exports);
 | 
			
		||||
__exportStar(require("./lib/serverPlugin"), exports);
 | 
			
		||||
//# sourceMappingURL=index.js.map
 | 
			
		||||
							
								
								
									
										3
									
								
								node_modules/@volar/typescript/lib/documentRegistry.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								node_modules/@volar/typescript/lib/documentRegistry.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
import type * as ts from 'typescript/lib/tsserverlibrary';
 | 
			
		||||
export declare function getDocumentRegistry(ts: typeof import('typescript/lib/tsserverlibrary'), useCaseSensitiveFileNames: boolean, currentDirectory: string): ts.DocumentRegistry;
 | 
			
		||||
//# sourceMappingURL=documentRegistry.d.ts.map
 | 
			
		||||
							
								
								
									
										14
									
								
								node_modules/@volar/typescript/lib/documentRegistry.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								node_modules/@volar/typescript/lib/documentRegistry.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.getDocumentRegistry = void 0;
 | 
			
		||||
const documentRegistries = [];
 | 
			
		||||
function getDocumentRegistry(ts, useCaseSensitiveFileNames, currentDirectory) {
 | 
			
		||||
    let documentRegistry = documentRegistries.find(item => item[0] === useCaseSensitiveFileNames && item[1] === currentDirectory)?.[2];
 | 
			
		||||
    if (!documentRegistry) {
 | 
			
		||||
        documentRegistry = ts.createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory);
 | 
			
		||||
        documentRegistries.push([useCaseSensitiveFileNames, currentDirectory, documentRegistry]);
 | 
			
		||||
    }
 | 
			
		||||
    return documentRegistry;
 | 
			
		||||
}
 | 
			
		||||
exports.getDocumentRegistry = getDocumentRegistry;
 | 
			
		||||
//# sourceMappingURL=documentRegistry.js.map
 | 
			
		||||
							
								
								
									
										4
									
								
								node_modules/@volar/typescript/lib/getProgram.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								node_modules/@volar/typescript/lib/getProgram.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
import type * as ts from 'typescript/lib/tsserverlibrary';
 | 
			
		||||
import type * as embedded from '@volar/language-core';
 | 
			
		||||
export declare function getProgram(ts: typeof import('typescript/lib/tsserverlibrary'), core: embedded.LanguageContext, ls: ts.LanguageService, sys: ts.System): ts.Program;
 | 
			
		||||
//# sourceMappingURL=getProgram.d.ts.map
 | 
			
		||||
							
								
								
									
										147
									
								
								node_modules/@volar/typescript/lib/getProgram.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										147
									
								
								node_modules/@volar/typescript/lib/getProgram.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,147 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.getProgram = void 0;
 | 
			
		||||
function getProgram(ts, core, ls, sys) {
 | 
			
		||||
    const proxy = {
 | 
			
		||||
        getRootFileNames,
 | 
			
		||||
        emit,
 | 
			
		||||
        getSyntacticDiagnostics,
 | 
			
		||||
        getSemanticDiagnostics,
 | 
			
		||||
        getGlobalDiagnostics,
 | 
			
		||||
        // @ts-expect-error
 | 
			
		||||
        getBindAndCheckDiagnostics,
 | 
			
		||||
    };
 | 
			
		||||
    return new Proxy({}, {
 | 
			
		||||
        get: (target, property) => {
 | 
			
		||||
            if (property in proxy) {
 | 
			
		||||
                return proxy[property];
 | 
			
		||||
            }
 | 
			
		||||
            const program = getProgram();
 | 
			
		||||
            if (property in program) {
 | 
			
		||||
                return program[property];
 | 
			
		||||
            }
 | 
			
		||||
            return target[property];
 | 
			
		||||
        },
 | 
			
		||||
        // #17
 | 
			
		||||
        // notice: https://github.com/vuejs/language-tools/issues/2403
 | 
			
		||||
        set: (target, property, newValue) => {
 | 
			
		||||
            const program = getProgram();
 | 
			
		||||
            target[property] = program[property] = newValue;
 | 
			
		||||
            return true;
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
    function getProgram() {
 | 
			
		||||
        return ls.getProgram();
 | 
			
		||||
    }
 | 
			
		||||
    function getRootFileNames() {
 | 
			
		||||
        return getProgram().getRootFileNames().filter(fileName => sys.fileExists?.(fileName));
 | 
			
		||||
    }
 | 
			
		||||
    // for vue-tsc --noEmit --watch
 | 
			
		||||
    function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
 | 
			
		||||
        return getSourceFileDiagnosticsWorker(sourceFile, cancellationToken, 'getBindAndCheckDiagnostics');
 | 
			
		||||
    }
 | 
			
		||||
    // for vue-tsc --noEmit
 | 
			
		||||
    function getSyntacticDiagnostics(sourceFile, cancellationToken) {
 | 
			
		||||
        return getSourceFileDiagnosticsWorker(sourceFile, cancellationToken, 'getSyntacticDiagnostics');
 | 
			
		||||
    }
 | 
			
		||||
    function getSemanticDiagnostics(sourceFile, cancellationToken) {
 | 
			
		||||
        return getSourceFileDiagnosticsWorker(sourceFile, cancellationToken, 'getSemanticDiagnostics');
 | 
			
		||||
    }
 | 
			
		||||
    function getSourceFileDiagnosticsWorker(sourceFile, cancellationToken, api) {
 | 
			
		||||
        if (sourceFile) {
 | 
			
		||||
            const [virtualFile, source] = core.virtualFiles.getVirtualFile(sourceFile.fileName);
 | 
			
		||||
            if (virtualFile && source) {
 | 
			
		||||
                if (!virtualFile.capabilities.diagnostic)
 | 
			
		||||
                    return [];
 | 
			
		||||
                const errors = transformDiagnostics(ls.getProgram()?.[api](sourceFile, cancellationToken) ?? []);
 | 
			
		||||
                return errors;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return transformDiagnostics(getProgram()[api](sourceFile, cancellationToken) ?? []);
 | 
			
		||||
    }
 | 
			
		||||
    function getGlobalDiagnostics(cancellationToken) {
 | 
			
		||||
        return transformDiagnostics(getProgram().getGlobalDiagnostics(cancellationToken) ?? []);
 | 
			
		||||
    }
 | 
			
		||||
    function emit(targetSourceFile, _writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
 | 
			
		||||
        const scriptResult = getProgram().emit(targetSourceFile, (sys.writeFile ?? ts.sys.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
 | 
			
		||||
        return {
 | 
			
		||||
            emitSkipped: scriptResult.emitSkipped,
 | 
			
		||||
            emittedFiles: scriptResult.emittedFiles,
 | 
			
		||||
            diagnostics: transformDiagnostics(scriptResult.diagnostics),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
    // transform
 | 
			
		||||
    function transformDiagnostics(diagnostics) {
 | 
			
		||||
        const result = [];
 | 
			
		||||
        for (const diagnostic of diagnostics) {
 | 
			
		||||
            if (diagnostic.file !== undefined
 | 
			
		||||
                && diagnostic.start !== undefined
 | 
			
		||||
                && diagnostic.length !== undefined) {
 | 
			
		||||
                const [virtualFile, source] = core.virtualFiles.getVirtualFile(diagnostic.file.fileName);
 | 
			
		||||
                if (virtualFile && source) {
 | 
			
		||||
                    if (sys.fileExists?.(source.fileName) === false)
 | 
			
		||||
                        continue;
 | 
			
		||||
                    for (const [_, [sourceSnapshot, map]] of core.virtualFiles.getMaps(virtualFile)) {
 | 
			
		||||
                        if (sourceSnapshot !== source.snapshot)
 | 
			
		||||
                            continue;
 | 
			
		||||
                        for (const start of map.toSourceOffsets(diagnostic.start)) {
 | 
			
		||||
                            const reportStart = typeof start[1].data.diagnostic === 'object' ? start[1].data.diagnostic.shouldReport() : !!start[1].data.diagnostic;
 | 
			
		||||
                            if (!reportStart)
 | 
			
		||||
                                continue;
 | 
			
		||||
                            for (const end of map.toSourceOffsets(diagnostic.start + diagnostic.length, true)) {
 | 
			
		||||
                                const reportEnd = typeof end[1].data.diagnostic === 'object' ? end[1].data.diagnostic.shouldReport() : !!end[1].data.diagnostic;
 | 
			
		||||
                                if (!reportEnd)
 | 
			
		||||
                                    continue;
 | 
			
		||||
                                onMapping(diagnostic, source.fileName, start[0], end[0], source.snapshot.getText(0, source.snapshot.getLength()));
 | 
			
		||||
                                break;
 | 
			
		||||
                            }
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    if (sys.fileExists?.(diagnostic.file.fileName) === false)
 | 
			
		||||
                        continue;
 | 
			
		||||
                    onMapping(diagnostic, diagnostic.file.fileName, diagnostic.start, diagnostic.start + diagnostic.length, diagnostic.file.text);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else if (diagnostic.file === undefined) {
 | 
			
		||||
                result.push(diagnostic);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
        function onMapping(diagnostic, fileName, start, end, docText) {
 | 
			
		||||
            let file = fileName === diagnostic.file?.fileName
 | 
			
		||||
                ? diagnostic.file
 | 
			
		||||
                : undefined;
 | 
			
		||||
            if (!file) {
 | 
			
		||||
                if (docText === undefined) {
 | 
			
		||||
                    const snapshot = core.host.getScriptSnapshot(fileName);
 | 
			
		||||
                    if (snapshot) {
 | 
			
		||||
                        docText = snapshot.getText(0, snapshot.getLength());
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    file = ts.createSourceFile(fileName, docText, ts.ScriptTarget.Latest, undefined, ts.ScriptKind.Deferred);
 | 
			
		||||
                    // fix https://github.com/vuejs/language-tools/issues/2622 for TS 5.0
 | 
			
		||||
                    file.originalFileName = fileName;
 | 
			
		||||
                    file.path = fileName.toLowerCase();
 | 
			
		||||
                    file.resolvedPath = fileName.toLowerCase();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            const newDiagnostic = {
 | 
			
		||||
                ...diagnostic,
 | 
			
		||||
                file,
 | 
			
		||||
                start: start,
 | 
			
		||||
                length: end - start,
 | 
			
		||||
            };
 | 
			
		||||
            const relatedInformation = diagnostic.relatedInformation;
 | 
			
		||||
            if (relatedInformation) {
 | 
			
		||||
                newDiagnostic.relatedInformation = transformDiagnostics(relatedInformation);
 | 
			
		||||
            }
 | 
			
		||||
            result.push(newDiagnostic);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.getProgram = getProgram;
 | 
			
		||||
//# sourceMappingURL=getProgram.js.map
 | 
			
		||||
							
								
								
									
										4
									
								
								node_modules/@volar/typescript/lib/languageService.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								node_modules/@volar/typescript/lib/languageService.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
import { VirtualFiles } from '@volar/language-core';
 | 
			
		||||
import type * as ts from 'typescript/lib/tsserverlibrary';
 | 
			
		||||
export declare function decorateLanguageService(virtualFiles: VirtualFiles, languageService: ts.LanguageService, isTsPlugin: boolean): void;
 | 
			
		||||
//# sourceMappingURL=languageService.d.ts.map
 | 
			
		||||
							
								
								
									
										303
									
								
								node_modules/@volar/typescript/lib/languageService.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										303
									
								
								node_modules/@volar/typescript/lib/languageService.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,303 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.decorateLanguageService = void 0;
 | 
			
		||||
const language_core_1 = require("@volar/language-core");
 | 
			
		||||
function decorateLanguageService(virtualFiles, languageService, isTsPlugin) {
 | 
			
		||||
    const _organizeImports = languageService.organizeImports.bind(languageService);
 | 
			
		||||
    const _getDefinitionAtPosition = languageService.getDefinitionAtPosition.bind(languageService);
 | 
			
		||||
    const _getDefinitionAndBoundSpan = languageService.getDefinitionAndBoundSpan.bind(languageService);
 | 
			
		||||
    const _getTypeDefinitionAtPosition = languageService.getTypeDefinitionAtPosition.bind(languageService);
 | 
			
		||||
    const _getImplementationAtPosition = languageService.getImplementationAtPosition.bind(languageService);
 | 
			
		||||
    const _getFileReferences = languageService.getFileReferences.bind(languageService);
 | 
			
		||||
    const _findRenameLocations = languageService.findRenameLocations.bind(languageService);
 | 
			
		||||
    const _getReferencesAtPosition = languageService.getReferencesAtPosition.bind(languageService);
 | 
			
		||||
    const _findReferences = languageService.findReferences.bind(languageService);
 | 
			
		||||
    languageService.organizeImports = organizeImports;
 | 
			
		||||
    languageService.getDefinitionAtPosition = getDefinitionAtPosition;
 | 
			
		||||
    languageService.getDefinitionAndBoundSpan = getDefinitionAndBoundSpan;
 | 
			
		||||
    languageService.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
 | 
			
		||||
    languageService.getImplementationAtPosition = getImplementationAtPosition;
 | 
			
		||||
    languageService.findRenameLocations = findRenameLocations;
 | 
			
		||||
    languageService.getReferencesAtPosition = getReferencesAtPosition;
 | 
			
		||||
    languageService.getFileReferences = getFileReferences;
 | 
			
		||||
    languageService.findReferences = findReferences;
 | 
			
		||||
    // apis
 | 
			
		||||
    function organizeImports(args, formatOptions, preferences) {
 | 
			
		||||
        let edits = [];
 | 
			
		||||
        const file = virtualFiles.getSource(args.fileName)?.root;
 | 
			
		||||
        if (file) {
 | 
			
		||||
            (0, language_core_1.forEachEmbeddedFile)(file, embeddedFile => {
 | 
			
		||||
                if (embeddedFile.kind === language_core_1.FileKind.TypeScriptHostFile && embeddedFile.capabilities.codeAction) {
 | 
			
		||||
                    edits = edits.concat(_organizeImports({
 | 
			
		||||
                        ...args,
 | 
			
		||||
                        fileName: embeddedFile.fileName,
 | 
			
		||||
                    }, formatOptions, preferences));
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            return _organizeImports(args, formatOptions, preferences);
 | 
			
		||||
        }
 | 
			
		||||
        return edits.map(transformFileTextChanges).filter(notEmpty);
 | 
			
		||||
    }
 | 
			
		||||
    function getReferencesAtPosition(fileName, position) {
 | 
			
		||||
        return findLocations(fileName, position, 'references');
 | 
			
		||||
    }
 | 
			
		||||
    function getFileReferences(fileName) {
 | 
			
		||||
        return findLocations(fileName, -1, 'fileReferences');
 | 
			
		||||
    }
 | 
			
		||||
    function getDefinitionAtPosition(fileName, position) {
 | 
			
		||||
        return findLocations(fileName, position, 'definition');
 | 
			
		||||
    }
 | 
			
		||||
    function getTypeDefinitionAtPosition(fileName, position) {
 | 
			
		||||
        return findLocations(fileName, position, 'typeDefinition');
 | 
			
		||||
    }
 | 
			
		||||
    function getImplementationAtPosition(fileName, position) {
 | 
			
		||||
        return findLocations(fileName, position, 'implementation');
 | 
			
		||||
    }
 | 
			
		||||
    function findRenameLocations(fileName, position, findInStrings, findInComments, preferences) {
 | 
			
		||||
        return findLocations(fileName, position, 'rename', findInStrings, findInComments, preferences);
 | 
			
		||||
    }
 | 
			
		||||
    function findLocations(fileName, position, mode, findInStrings = false, findInComments = false, preferences) {
 | 
			
		||||
        const loopChecker = new Set();
 | 
			
		||||
        let symbols = [];
 | 
			
		||||
        withMirrors(fileName, position);
 | 
			
		||||
        return symbols.map(s => transformDocumentSpanLike(s, mode === 'definition')).filter(notEmpty);
 | 
			
		||||
        function withMirrors(fileName, position) {
 | 
			
		||||
            if (loopChecker.has(fileName + ':' + position))
 | 
			
		||||
                return;
 | 
			
		||||
            loopChecker.add(fileName + ':' + position);
 | 
			
		||||
            const _symbols = mode === 'definition' ? _getDefinitionAtPosition(fileName, position)
 | 
			
		||||
                : mode === 'typeDefinition' ? _getTypeDefinitionAtPosition(fileName, position)
 | 
			
		||||
                    : mode === 'references' ? _getReferencesAtPosition(fileName, position)
 | 
			
		||||
                        : mode === 'fileReferences' ? _getFileReferences(fileName)
 | 
			
		||||
                            : mode === 'implementation' ? _getImplementationAtPosition(fileName, position)
 | 
			
		||||
                                : mode === 'rename' && preferences ? _findRenameLocations(fileName, position, findInStrings, findInComments, preferences)
 | 
			
		||||
                                    : undefined;
 | 
			
		||||
            if (!_symbols)
 | 
			
		||||
                return;
 | 
			
		||||
            symbols = symbols.concat(_symbols);
 | 
			
		||||
            for (const ref of _symbols) {
 | 
			
		||||
                loopChecker.add(ref.fileName + ':' + ref.textSpan.start);
 | 
			
		||||
                const [virtualFile] = getVirtualFile(ref.fileName);
 | 
			
		||||
                if (!virtualFile)
 | 
			
		||||
                    continue;
 | 
			
		||||
                const mirrorMap = virtualFiles.getMirrorMap(virtualFile);
 | 
			
		||||
                if (!mirrorMap)
 | 
			
		||||
                    continue;
 | 
			
		||||
                for (const [mirrorOffset, data] of mirrorMap.findMirrorOffsets(ref.textSpan.start)) {
 | 
			
		||||
                    if ((mode === 'definition' || mode === 'typeDefinition' || mode === 'implementation') && !data.definition)
 | 
			
		||||
                        continue;
 | 
			
		||||
                    if ((mode === 'references') && !data.references)
 | 
			
		||||
                        continue;
 | 
			
		||||
                    if ((mode === 'rename') && !data.rename)
 | 
			
		||||
                        continue;
 | 
			
		||||
                    if (loopChecker.has(ref.fileName + ':' + mirrorOffset))
 | 
			
		||||
                        continue;
 | 
			
		||||
                    withMirrors(ref.fileName, mirrorOffset);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    function getDefinitionAndBoundSpan(fileName, position) {
 | 
			
		||||
        const loopChecker = new Set();
 | 
			
		||||
        let textSpan;
 | 
			
		||||
        let symbols = [];
 | 
			
		||||
        withMirrors(fileName, position);
 | 
			
		||||
        if (!textSpan)
 | 
			
		||||
            return;
 | 
			
		||||
        return {
 | 
			
		||||
            textSpan: textSpan,
 | 
			
		||||
            definitions: symbols?.map(s => transformDocumentSpanLike(s, true)).filter(notEmpty),
 | 
			
		||||
        };
 | 
			
		||||
        function withMirrors(fileName, position) {
 | 
			
		||||
            if (loopChecker.has(fileName + ':' + position))
 | 
			
		||||
                return;
 | 
			
		||||
            loopChecker.add(fileName + ':' + position);
 | 
			
		||||
            const _symbols = _getDefinitionAndBoundSpan(fileName, position);
 | 
			
		||||
            if (!_symbols)
 | 
			
		||||
                return;
 | 
			
		||||
            if (!textSpan) {
 | 
			
		||||
                textSpan = _symbols.textSpan;
 | 
			
		||||
            }
 | 
			
		||||
            if (!_symbols.definitions)
 | 
			
		||||
                return;
 | 
			
		||||
            symbols = symbols.concat(_symbols.definitions);
 | 
			
		||||
            for (const ref of _symbols.definitions) {
 | 
			
		||||
                loopChecker.add(ref.fileName + ':' + ref.textSpan.start);
 | 
			
		||||
                const [virtualFile] = getVirtualFile(ref.fileName);
 | 
			
		||||
                if (!virtualFile)
 | 
			
		||||
                    continue;
 | 
			
		||||
                const mirrorMap = virtualFiles.getMirrorMap(virtualFile);
 | 
			
		||||
                if (!mirrorMap)
 | 
			
		||||
                    continue;
 | 
			
		||||
                for (const [mirrorOffset, data] of mirrorMap.findMirrorOffsets(ref.textSpan.start)) {
 | 
			
		||||
                    if (!data.definition)
 | 
			
		||||
                        continue;
 | 
			
		||||
                    if (loopChecker.has(ref.fileName + ':' + mirrorOffset))
 | 
			
		||||
                        continue;
 | 
			
		||||
                    withMirrors(ref.fileName, mirrorOffset);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    function findReferences(fileName, position) {
 | 
			
		||||
        const loopChecker = new Set();
 | 
			
		||||
        let symbols = [];
 | 
			
		||||
        withMirrors(fileName, position);
 | 
			
		||||
        return symbols.map(s => transformReferencedSymbol(s)).filter(notEmpty);
 | 
			
		||||
        function withMirrors(fileName, position) {
 | 
			
		||||
            if (loopChecker.has(fileName + ':' + position))
 | 
			
		||||
                return;
 | 
			
		||||
            loopChecker.add(fileName + ':' + position);
 | 
			
		||||
            const _symbols = _findReferences(fileName, position);
 | 
			
		||||
            if (!_symbols)
 | 
			
		||||
                return;
 | 
			
		||||
            symbols = symbols.concat(_symbols);
 | 
			
		||||
            for (const symbol of _symbols) {
 | 
			
		||||
                for (const ref of symbol.references) {
 | 
			
		||||
                    loopChecker.add(ref.fileName + ':' + ref.textSpan.start);
 | 
			
		||||
                    const [virtualFile] = getVirtualFile(ref.fileName);
 | 
			
		||||
                    if (!virtualFile)
 | 
			
		||||
                        continue;
 | 
			
		||||
                    const mirrorMap = virtualFiles.getMirrorMap(virtualFile);
 | 
			
		||||
                    if (!mirrorMap)
 | 
			
		||||
                        continue;
 | 
			
		||||
                    for (const [mirrorOffset, data] of mirrorMap.findMirrorOffsets(ref.textSpan.start)) {
 | 
			
		||||
                        if (!data.references)
 | 
			
		||||
                            continue;
 | 
			
		||||
                        if (loopChecker.has(ref.fileName + ':' + mirrorOffset))
 | 
			
		||||
                            continue;
 | 
			
		||||
                        withMirrors(ref.fileName, mirrorOffset);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    // transforms
 | 
			
		||||
    function transformFileTextChanges(changes) {
 | 
			
		||||
        const [_, source] = getVirtualFile(changes.fileName);
 | 
			
		||||
        if (source) {
 | 
			
		||||
            return {
 | 
			
		||||
                ...changes,
 | 
			
		||||
                fileName: source.fileName,
 | 
			
		||||
                textChanges: changes.textChanges.map(c => {
 | 
			
		||||
                    const span = transformSpan(changes.fileName, c.span);
 | 
			
		||||
                    if (span) {
 | 
			
		||||
                        return {
 | 
			
		||||
                            ...c,
 | 
			
		||||
                            span: span.textSpan,
 | 
			
		||||
                        };
 | 
			
		||||
                    }
 | 
			
		||||
                }).filter(notEmpty),
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            return changes;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    function transformReferencedSymbol(symbol) {
 | 
			
		||||
        const definition = transformDocumentSpanLike(symbol.definition, false);
 | 
			
		||||
        const references = symbol.references.map(r => transformDocumentSpanLike(r, false)).filter(notEmpty);
 | 
			
		||||
        if (definition) {
 | 
			
		||||
            return {
 | 
			
		||||
                definition,
 | 
			
		||||
                references,
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
        else if (references.length) { // TODO: remove patching
 | 
			
		||||
            return {
 | 
			
		||||
                definition: {
 | 
			
		||||
                    ...symbol.definition,
 | 
			
		||||
                    fileName: references[0].fileName,
 | 
			
		||||
                    textSpan: references[0].textSpan,
 | 
			
		||||
                },
 | 
			
		||||
                references,
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    function transformDocumentSpanLike(documentSpan, isDefinition) {
 | 
			
		||||
        let textSpan = transformSpan(documentSpan.fileName, documentSpan.textSpan);
 | 
			
		||||
        if (isDefinition && !textSpan) {
 | 
			
		||||
            const [virtualFile, source] = getVirtualFile(documentSpan.fileName);
 | 
			
		||||
            if (virtualFile && source) {
 | 
			
		||||
                textSpan = {
 | 
			
		||||
                    fileName: source.fileName,
 | 
			
		||||
                    textSpan: { start: 0, length: 0 },
 | 
			
		||||
                };
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (!textSpan)
 | 
			
		||||
            return;
 | 
			
		||||
        const contextSpan = transformSpan(documentSpan.fileName, documentSpan.contextSpan);
 | 
			
		||||
        const originalTextSpan = transformSpan(documentSpan.originalFileName, documentSpan.originalTextSpan);
 | 
			
		||||
        const originalContextSpan = transformSpan(documentSpan.originalFileName, documentSpan.originalContextSpan);
 | 
			
		||||
        return {
 | 
			
		||||
            ...documentSpan,
 | 
			
		||||
            fileName: textSpan.fileName,
 | 
			
		||||
            textSpan: textSpan.textSpan,
 | 
			
		||||
            contextSpan: contextSpan?.textSpan,
 | 
			
		||||
            originalFileName: originalTextSpan?.fileName,
 | 
			
		||||
            originalTextSpan: originalTextSpan?.textSpan,
 | 
			
		||||
            originalContextSpan: originalContextSpan?.textSpan,
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
    function transformSpan(fileName, textSpan) {
 | 
			
		||||
        if (!fileName)
 | 
			
		||||
            return;
 | 
			
		||||
        if (!textSpan)
 | 
			
		||||
            return;
 | 
			
		||||
        const [virtualFile, source] = getVirtualFile(fileName);
 | 
			
		||||
        if (virtualFile && source) {
 | 
			
		||||
            if (isTsPlugin) {
 | 
			
		||||
                textSpan = {
 | 
			
		||||
                    start: textSpan.start - source.snapshot.getLength(),
 | 
			
		||||
                    length: textSpan.length,
 | 
			
		||||
                };
 | 
			
		||||
            }
 | 
			
		||||
            for (const [_, [sourceSnapshot, map]] of virtualFiles.getMaps(virtualFile)) {
 | 
			
		||||
                if (source.snapshot !== sourceSnapshot)
 | 
			
		||||
                    continue;
 | 
			
		||||
                const sourceLoc = map.toSourceOffset(textSpan.start);
 | 
			
		||||
                if (sourceLoc) {
 | 
			
		||||
                    return {
 | 
			
		||||
                        fileName: source.fileName,
 | 
			
		||||
                        textSpan: {
 | 
			
		||||
                            start: sourceLoc[0],
 | 
			
		||||
                            length: textSpan.length,
 | 
			
		||||
                        },
 | 
			
		||||
                    };
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            return {
 | 
			
		||||
                fileName,
 | 
			
		||||
                textSpan,
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    function getVirtualFile(fileName) {
 | 
			
		||||
        if (isTsPlugin) {
 | 
			
		||||
            let result;
 | 
			
		||||
            const source = virtualFiles.getSource(fileName);
 | 
			
		||||
            if (source) {
 | 
			
		||||
                (0, language_core_1.forEachEmbeddedFile)(source.root, file => {
 | 
			
		||||
                    const ext = file.fileName.replace(fileName, '');
 | 
			
		||||
                    if (file.kind === language_core_1.FileKind.TypeScriptHostFile && (ext === '.d.ts' || ext.match(/^\.(js|ts)x?$/))) {
 | 
			
		||||
                        result = file;
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
            return [result, source];
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            return virtualFiles.getVirtualFile(fileName);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.decorateLanguageService = decorateLanguageService;
 | 
			
		||||
function notEmpty(value) {
 | 
			
		||||
    return value !== null && value !== undefined;
 | 
			
		||||
}
 | 
			
		||||
//# sourceMappingURL=languageService.js.map
 | 
			
		||||
							
								
								
									
										6
									
								
								node_modules/@volar/typescript/lib/languageServiceHost.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								node_modules/@volar/typescript/lib/languageServiceHost.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
import type { LanguageContext } from '@volar/language-core';
 | 
			
		||||
import type * as ts from 'typescript/lib/tsserverlibrary';
 | 
			
		||||
export declare function createLanguageServiceHost(ctx: LanguageContext, ts: typeof import('typescript/lib/tsserverlibrary'), sys: ts.System & {
 | 
			
		||||
    version?: number;
 | 
			
		||||
}): ts.LanguageServiceHost;
 | 
			
		||||
//# sourceMappingURL=languageServiceHost.d.ts.map
 | 
			
		||||
							
								
								
									
										296
									
								
								node_modules/@volar/typescript/lib/languageServiceHost.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										296
									
								
								node_modules/@volar/typescript/lib/languageServiceHost.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,296 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.createLanguageServiceHost = void 0;
 | 
			
		||||
const path = require("path-browserify");
 | 
			
		||||
const utilities_1 = require("./typescript/utilities");
 | 
			
		||||
const fileVersions = new Map();
 | 
			
		||||
function createLanguageServiceHost(ctx, ts, sys) {
 | 
			
		||||
    let lastProjectVersion;
 | 
			
		||||
    let tsProjectVersion = 0;
 | 
			
		||||
    let tsFileNames = [];
 | 
			
		||||
    let tsDirectories = new Set();
 | 
			
		||||
    const _tsHost = {
 | 
			
		||||
        ...sys,
 | 
			
		||||
        getCurrentDirectory: () => ctx.host.workspacePath,
 | 
			
		||||
        getCompilationSettings: () => ctx.host.getCompilationSettings(),
 | 
			
		||||
        getCancellationToken: ctx.host.getCancellationToken ? () => ctx.host.getCancellationToken() : undefined,
 | 
			
		||||
        getLocalizedDiagnosticMessages: ctx.host.getLocalizedDiagnosticMessages ? () => ctx.host.getLocalizedDiagnosticMessages() : undefined,
 | 
			
		||||
        getProjectReferences: ctx.host.getProjectReferences ? () => ctx.host.getProjectReferences() : undefined,
 | 
			
		||||
        getDefaultLibFileName: (options) => {
 | 
			
		||||
            try {
 | 
			
		||||
                return ts.getDefaultLibFilePath(options);
 | 
			
		||||
            }
 | 
			
		||||
            catch {
 | 
			
		||||
                // web
 | 
			
		||||
                return `/node_modules/typescript/lib/${ts.getDefaultLibFileName(options)}`;
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
 | 
			
		||||
        getNewLine: () => sys.newLine,
 | 
			
		||||
        readFile: fileName => {
 | 
			
		||||
            const snapshot = getScriptSnapshot(fileName);
 | 
			
		||||
            if (snapshot) {
 | 
			
		||||
                return snapshot.getText(0, snapshot.getLength());
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        readDirectory,
 | 
			
		||||
        getDirectories,
 | 
			
		||||
        directoryExists,
 | 
			
		||||
        fileExists,
 | 
			
		||||
        getProjectVersion: () => {
 | 
			
		||||
            return tsProjectVersion + ':' + sys.version;
 | 
			
		||||
        },
 | 
			
		||||
        getTypeRootsVersion: () => {
 | 
			
		||||
            return sys.version ?? -1; // TODO: only update for /node_modules changes?
 | 
			
		||||
        },
 | 
			
		||||
        getScriptFileNames: () => tsFileNames,
 | 
			
		||||
        getScriptVersion,
 | 
			
		||||
        getScriptSnapshot,
 | 
			
		||||
        getScriptKind(fileName) {
 | 
			
		||||
            if (ts) {
 | 
			
		||||
                if (ctx.virtualFiles.hasSource(fileName))
 | 
			
		||||
                    return ts.ScriptKind.Deferred;
 | 
			
		||||
                switch (path.extname(fileName)) {
 | 
			
		||||
                    case '.js': return ts.ScriptKind.JS;
 | 
			
		||||
                    case '.cjs': return ts.ScriptKind.JS;
 | 
			
		||||
                    case '.mjs': return ts.ScriptKind.JS;
 | 
			
		||||
                    case '.jsx': return ts.ScriptKind.JSX;
 | 
			
		||||
                    case '.ts': return ts.ScriptKind.TS;
 | 
			
		||||
                    case '.cts': return ts.ScriptKind.TS;
 | 
			
		||||
                    case '.mts': return ts.ScriptKind.TS;
 | 
			
		||||
                    case '.tsx': return ts.ScriptKind.TSX;
 | 
			
		||||
                    case '.json': return ts.ScriptKind.JSON;
 | 
			
		||||
                    default: return ts.ScriptKind.Unknown;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return 0;
 | 
			
		||||
        },
 | 
			
		||||
    };
 | 
			
		||||
    const fsFileSnapshots = new Map();
 | 
			
		||||
    if (ctx.host.resolveModuleName) {
 | 
			
		||||
        // TODO: can this share between monorepo packages?
 | 
			
		||||
        const moduleCache = ts.createModuleResolutionCache(_tsHost.getCurrentDirectory(), _tsHost.useCaseSensitiveFileNames ? s => s : s => s.toLowerCase(), _tsHost.getCompilationSettings());
 | 
			
		||||
        let lastSysVersion = sys.version;
 | 
			
		||||
        _tsHost.resolveModuleNameLiterals = (moduleLiterals, containingFile, redirectedReference, options, sourceFile) => {
 | 
			
		||||
            if (lastSysVersion !== sys.version) {
 | 
			
		||||
                lastSysVersion = sys.version;
 | 
			
		||||
                moduleCache.clear();
 | 
			
		||||
            }
 | 
			
		||||
            return moduleLiterals.map((moduleLiteral) => {
 | 
			
		||||
                let moduleName = moduleLiteral.text;
 | 
			
		||||
                moduleName = ctx.host.resolveModuleName(moduleName, sourceFile.impliedNodeFormat);
 | 
			
		||||
                return ts.resolveModuleName(moduleName, containingFile, options, _tsHost, moduleCache, redirectedReference, sourceFile.impliedNodeFormat);
 | 
			
		||||
            });
 | 
			
		||||
        };
 | 
			
		||||
        _tsHost.resolveModuleNames = (moduleNames, containingFile, _reusedNames, redirectedReference, options, sourceFile) => {
 | 
			
		||||
            if (lastSysVersion !== sys.version) {
 | 
			
		||||
                lastSysVersion = sys.version;
 | 
			
		||||
                moduleCache.clear();
 | 
			
		||||
            }
 | 
			
		||||
            return moduleNames.map((moduleName) => {
 | 
			
		||||
                moduleName = ctx.host.resolveModuleName(moduleName, sourceFile?.impliedNodeFormat);
 | 
			
		||||
                return ts.resolveModuleName(moduleName, containingFile, options, _tsHost, moduleCache, redirectedReference, sourceFile?.impliedNodeFormat).resolvedModule;
 | 
			
		||||
            });
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
    let oldTsVirtualFileSnapshots = new Set();
 | 
			
		||||
    let oldOtherVirtualFileSnapshots = new Set();
 | 
			
		||||
    return new Proxy(_tsHost, {
 | 
			
		||||
        get: (target, property) => {
 | 
			
		||||
            sync();
 | 
			
		||||
            return target[property];
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
    function sync() {
 | 
			
		||||
        const newProjectVersion = ctx.host.getProjectVersion();
 | 
			
		||||
        const shouldUpdate = newProjectVersion !== lastProjectVersion;
 | 
			
		||||
        if (!shouldUpdate)
 | 
			
		||||
            return;
 | 
			
		||||
        lastProjectVersion = newProjectVersion;
 | 
			
		||||
        const newTsVirtualFileSnapshots = new Set();
 | 
			
		||||
        const newOtherVirtualFileSnapshots = new Set();
 | 
			
		||||
        for (const { root } of ctx.virtualFiles.allSources()) {
 | 
			
		||||
            forEachEmbeddedFile(root, embedded => {
 | 
			
		||||
                if (embedded.kind === 1) {
 | 
			
		||||
                    newTsVirtualFileSnapshots.add(embedded.snapshot);
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    newOtherVirtualFileSnapshots.add(embedded.snapshot);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        if (!setEquals(oldTsVirtualFileSnapshots, newTsVirtualFileSnapshots)) {
 | 
			
		||||
            tsProjectVersion++;
 | 
			
		||||
        }
 | 
			
		||||
        else if (setEquals(oldOtherVirtualFileSnapshots, newOtherVirtualFileSnapshots)) {
 | 
			
		||||
            // no any meta language files update, it mean project version was update by source files this time
 | 
			
		||||
            tsProjectVersion++;
 | 
			
		||||
        }
 | 
			
		||||
        oldTsVirtualFileSnapshots = newTsVirtualFileSnapshots;
 | 
			
		||||
        oldOtherVirtualFileSnapshots = newOtherVirtualFileSnapshots;
 | 
			
		||||
        const tsFileNamesSet = new Set();
 | 
			
		||||
        for (const { root } of ctx.virtualFiles.allSources()) {
 | 
			
		||||
            forEachEmbeddedFile(root, embedded => {
 | 
			
		||||
                if (embedded.kind === 1) {
 | 
			
		||||
                    tsFileNamesSet.add(embedded.fileName); // virtual .ts
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        for (const fileName of ctx.host.getScriptFileNames()) {
 | 
			
		||||
            if (!ctx.virtualFiles.hasSource(fileName)) {
 | 
			
		||||
                tsFileNamesSet.add(fileName); // .ts
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        tsFileNames = [...tsFileNamesSet];
 | 
			
		||||
        // Update tsDirectories for `directoryExists()`
 | 
			
		||||
        tsDirectories.clear();
 | 
			
		||||
        for (const fileName of tsFileNames) {
 | 
			
		||||
            tsDirectories.add(path.dirname(normalizePath(fileName)));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    function readDirectory(dirName, extensions, excludes, includes, depth) {
 | 
			
		||||
        let matches = (0, utilities_1.matchFiles)(dirName, extensions, excludes, includes, sys?.useCaseSensitiveFileNames ?? false, ctx.host.workspacePath, depth, (dirPath) => {
 | 
			
		||||
            const files = [];
 | 
			
		||||
            for (const fileName of tsFileNames) {
 | 
			
		||||
                if (fileName.toLowerCase().startsWith(dirPath.toLowerCase())) {
 | 
			
		||||
                    const baseName = fileName.substring(dirPath.length);
 | 
			
		||||
                    if (baseName.indexOf('/') === -1) {
 | 
			
		||||
                        files.push(baseName);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return {
 | 
			
		||||
                files,
 | 
			
		||||
                directories: getVirtualFileDirectories(dirPath),
 | 
			
		||||
            };
 | 
			
		||||
        }, sys?.realpath ? (path => sys.realpath(path)) : (path => path));
 | 
			
		||||
        matches = matches.map(match => {
 | 
			
		||||
            const [_, source] = ctx.virtualFiles.getVirtualFile(match);
 | 
			
		||||
            if (source) {
 | 
			
		||||
                return source.fileName;
 | 
			
		||||
            }
 | 
			
		||||
            return match;
 | 
			
		||||
        });
 | 
			
		||||
        return [...new Set([
 | 
			
		||||
                ...matches,
 | 
			
		||||
                ...sys.readDirectory(dirName, extensions, excludes, includes, depth),
 | 
			
		||||
            ])];
 | 
			
		||||
    }
 | 
			
		||||
    function getDirectories(dirName) {
 | 
			
		||||
        return [...new Set([
 | 
			
		||||
                ...getVirtualFileDirectories(dirName),
 | 
			
		||||
                ...sys.getDirectories(dirName),
 | 
			
		||||
            ])];
 | 
			
		||||
    }
 | 
			
		||||
    function getVirtualFileDirectories(dirName) {
 | 
			
		||||
        const names = new Set();
 | 
			
		||||
        for (const fileName of tsFileNames) {
 | 
			
		||||
            if (fileName.toLowerCase().startsWith(dirName.toLowerCase())) {
 | 
			
		||||
                const path = fileName.substring(dirName.length);
 | 
			
		||||
                if (path.indexOf('/') >= 0) {
 | 
			
		||||
                    names.add(path.split('/')[0]);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return [...names];
 | 
			
		||||
    }
 | 
			
		||||
    function getScriptSnapshot(fileName) {
 | 
			
		||||
        // virtual files
 | 
			
		||||
        const [virtualFile] = ctx.virtualFiles.getVirtualFile(fileName);
 | 
			
		||||
        if (virtualFile) {
 | 
			
		||||
            return virtualFile.snapshot;
 | 
			
		||||
        }
 | 
			
		||||
        // root files / opened files
 | 
			
		||||
        const tsScript = ctx.host.getScriptSnapshot(fileName);
 | 
			
		||||
        if (tsScript) {
 | 
			
		||||
            return tsScript;
 | 
			
		||||
        }
 | 
			
		||||
        // fs files
 | 
			
		||||
        const cache = fsFileSnapshots.get(fileName);
 | 
			
		||||
        const modifiedTime = sys.getModifiedTime?.(fileName)?.valueOf();
 | 
			
		||||
        if (!cache || cache[0] !== modifiedTime) {
 | 
			
		||||
            if (sys.fileExists(fileName)) {
 | 
			
		||||
                const text = sys.readFile(fileName);
 | 
			
		||||
                const snapshot = text !== undefined ? ts.ScriptSnapshot.fromString(text) : undefined;
 | 
			
		||||
                fsFileSnapshots.set(fileName, [modifiedTime, snapshot]);
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                fsFileSnapshots.set(fileName, [modifiedTime, undefined]);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return fsFileSnapshots.get(fileName)?.[1];
 | 
			
		||||
    }
 | 
			
		||||
    function getScriptVersion(fileName) {
 | 
			
		||||
        // virtual files / root files / opened files
 | 
			
		||||
        const [virtualFile] = ctx.virtualFiles.getVirtualFile(fileName);
 | 
			
		||||
        const snapshot = virtualFile?.snapshot ?? ctx.host.getScriptSnapshot(fileName);
 | 
			
		||||
        if (snapshot) {
 | 
			
		||||
            if (!fileVersions.has(fileName)) {
 | 
			
		||||
                fileVersions.set(fileName, { lastVersion: 0, snapshotVersions: new WeakMap() });
 | 
			
		||||
            }
 | 
			
		||||
            const version = fileVersions.get(fileName);
 | 
			
		||||
            if (!version.snapshotVersions.has(snapshot)) {
 | 
			
		||||
                version.snapshotVersions.set(snapshot, version.lastVersion++);
 | 
			
		||||
            }
 | 
			
		||||
            return version.snapshotVersions.get(snapshot).toString();
 | 
			
		||||
        }
 | 
			
		||||
        // fs files
 | 
			
		||||
        return sys.getModifiedTime?.(fileName)?.valueOf().toString() ?? '';
 | 
			
		||||
    }
 | 
			
		||||
    function directoryExists(dirName) {
 | 
			
		||||
        return tsDirectories.has(normalizePath(dirName)) || sys.directoryExists(dirName);
 | 
			
		||||
    }
 | 
			
		||||
    function fileExists(fileName) {
 | 
			
		||||
        // fill external virtual files
 | 
			
		||||
        const ext = fileName.substring(fileName.lastIndexOf('.'));
 | 
			
		||||
        if (ext === '.js'
 | 
			
		||||
            || ext === '.ts'
 | 
			
		||||
            || ext === '.jsx'
 | 
			
		||||
            || ext === '.tsx') {
 | 
			
		||||
            /**
 | 
			
		||||
             * If try to access a external .vue file that outside of the project,
 | 
			
		||||
             * the file will not process by language service host,
 | 
			
		||||
             * so virtual file will not be created.
 | 
			
		||||
             *
 | 
			
		||||
             * We try to create virtual file here.
 | 
			
		||||
             */
 | 
			
		||||
            const sourceFileName = fileName.substring(0, fileName.lastIndexOf('.'));
 | 
			
		||||
            if (!ctx.virtualFiles.hasSource(sourceFileName)) {
 | 
			
		||||
                const scriptSnapshot = getScriptSnapshot(sourceFileName);
 | 
			
		||||
                if (scriptSnapshot) {
 | 
			
		||||
                    ctx.virtualFiles.updateSource(sourceFileName, scriptSnapshot, ctx.host.getLanguageId?.(sourceFileName));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        // virtual files
 | 
			
		||||
        if (ctx.virtualFiles.hasVirtualFile(fileName)) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        // root files
 | 
			
		||||
        if (ctx.host.getScriptSnapshot(fileName)) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        // fs files
 | 
			
		||||
        return !!sys.fileExists(fileName);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.createLanguageServiceHost = createLanguageServiceHost;
 | 
			
		||||
function setEquals(a, b) {
 | 
			
		||||
    if (a.size !== b.size)
 | 
			
		||||
        return false;
 | 
			
		||||
    for (const item of a) {
 | 
			
		||||
        if (!b.has(item))
 | 
			
		||||
            return false;
 | 
			
		||||
    }
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
function forEachEmbeddedFile(file, cb) {
 | 
			
		||||
    cb(file);
 | 
			
		||||
    for (const embeddedFile of file.embeddedFiles) {
 | 
			
		||||
        forEachEmbeddedFile(embeddedFile, cb);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
function normalizePath(fileName) {
 | 
			
		||||
    return fileName.replace(/\\/g, '/').toLowerCase();
 | 
			
		||||
}
 | 
			
		||||
//# sourceMappingURL=languageServiceHost.js.map
 | 
			
		||||
							
								
								
									
										9
									
								
								node_modules/@volar/typescript/lib/serverPlugin.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								node_modules/@volar/typescript/lib/serverPlugin.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
import { VirtualFiles } from '@volar/language-core';
 | 
			
		||||
import type * as ts from 'typescript/lib/tsserverlibrary';
 | 
			
		||||
export declare function decorateLanguageServiceHost(virtualFiles: VirtualFiles, languageServiceHost: ts.LanguageServiceHost, ts: typeof import('typescript/lib/tsserverlibrary'), exts: string[]): void;
 | 
			
		||||
export declare function searchExternalFiles(ts: typeof import('typescript/lib/tsserverlibrary'), project: ts.server.Project, exts: string[]): string[];
 | 
			
		||||
/**
 | 
			
		||||
 * @deprecated use `searchExternalFiles` instead
 | 
			
		||||
 */
 | 
			
		||||
export declare const getExternalFiles: typeof searchExternalFiles;
 | 
			
		||||
//# sourceMappingURL=serverPlugin.d.ts.map
 | 
			
		||||
							
								
								
									
										178
									
								
								node_modules/@volar/typescript/lib/serverPlugin.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										178
									
								
								node_modules/@volar/typescript/lib/serverPlugin.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,178 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.getExternalFiles = exports.searchExternalFiles = exports.decorateLanguageServiceHost = void 0;
 | 
			
		||||
const language_core_1 = require("@volar/language-core");
 | 
			
		||||
function decorateLanguageServiceHost(virtualFiles, languageServiceHost, ts, exts) {
 | 
			
		||||
    let extraProjectVersion = 0;
 | 
			
		||||
    const scripts = new Map();
 | 
			
		||||
    const readDirectory = languageServiceHost.readDirectory?.bind(languageServiceHost);
 | 
			
		||||
    const resolveModuleNameLiterals = languageServiceHost.resolveModuleNameLiterals?.bind(languageServiceHost);
 | 
			
		||||
    const resolveModuleNames = languageServiceHost.resolveModuleNames?.bind(languageServiceHost);
 | 
			
		||||
    const getProjectVersion = languageServiceHost.getProjectVersion?.bind(languageServiceHost);
 | 
			
		||||
    const getScriptSnapshot = languageServiceHost.getScriptSnapshot.bind(languageServiceHost);
 | 
			
		||||
    const getScriptKind = languageServiceHost.getScriptKind?.bind(languageServiceHost);
 | 
			
		||||
    // path completion
 | 
			
		||||
    if (readDirectory) {
 | 
			
		||||
        languageServiceHost.readDirectory = (path, extensions, exclude, include, depth) => {
 | 
			
		||||
            if (extensions) {
 | 
			
		||||
                for (const ext of exts) {
 | 
			
		||||
                    if (!extensions.includes(ext)) {
 | 
			
		||||
                        extensions = [...extensions, ...ext];
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return readDirectory(path, extensions, exclude, include, depth);
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
    if (resolveModuleNameLiterals) {
 | 
			
		||||
        languageServiceHost.resolveModuleNameLiterals = (moduleNames, containingFile, redirectedReference, options, ...rest) => {
 | 
			
		||||
            const resolvedModules = resolveModuleNameLiterals(moduleNames, containingFile, redirectedReference, options, ...rest);
 | 
			
		||||
            return moduleNames.map((name, i) => {
 | 
			
		||||
                if (exts.some(ext => name.text.endsWith(ext))) {
 | 
			
		||||
                    const resolved = resolveModuleName(name.text, containingFile, options, redirectedReference);
 | 
			
		||||
                    if (resolved.resolvedModule) {
 | 
			
		||||
                        return resolved;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                return resolvedModules[i];
 | 
			
		||||
            });
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
    else if (resolveModuleNames) {
 | 
			
		||||
        languageServiceHost.resolveModuleNames = (moduleNames, containingFile, reusedNames, redirectedReference, options, containingSourceFile) => {
 | 
			
		||||
            const resolvedModules = resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, options, containingSourceFile);
 | 
			
		||||
            return moduleNames.map((name, i) => {
 | 
			
		||||
                if (exts.some(ext => name.endsWith(ext))) {
 | 
			
		||||
                    const resolved = resolveModuleName(name, containingFile, options, redirectedReference);
 | 
			
		||||
                    if (resolved.resolvedModule) {
 | 
			
		||||
                        return resolved.resolvedModule;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                return resolvedModules[i];
 | 
			
		||||
            });
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
    if (getProjectVersion) {
 | 
			
		||||
        languageServiceHost.getProjectVersion = () => {
 | 
			
		||||
            return getProjectVersion() + ':' + extraProjectVersion;
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
    languageServiceHost.getScriptSnapshot = (fileName) => {
 | 
			
		||||
        if (exts.some(ext => fileName.endsWith(ext))) {
 | 
			
		||||
            updateScript(fileName);
 | 
			
		||||
            return scripts.get(fileName)?.snapshot;
 | 
			
		||||
        }
 | 
			
		||||
        return getScriptSnapshot(fileName);
 | 
			
		||||
    };
 | 
			
		||||
    if (getScriptKind) {
 | 
			
		||||
        languageServiceHost.getScriptKind = (fileName) => {
 | 
			
		||||
            if (exts.some(ext => fileName.endsWith(ext))) {
 | 
			
		||||
                updateScript(fileName);
 | 
			
		||||
                const script = scripts.get(fileName);
 | 
			
		||||
                if (script) {
 | 
			
		||||
                    if (script.extension.endsWith('.js')) {
 | 
			
		||||
                        return ts.ScriptKind.JS;
 | 
			
		||||
                    }
 | 
			
		||||
                    if (script.extension.endsWith('.jsx')) {
 | 
			
		||||
                        return ts.ScriptKind.JSX;
 | 
			
		||||
                    }
 | 
			
		||||
                    if (script.extension.endsWith('.ts')) {
 | 
			
		||||
                        return ts.ScriptKind.TS;
 | 
			
		||||
                    }
 | 
			
		||||
                    if (script.extension.endsWith('.tsx')) {
 | 
			
		||||
                        return ts.ScriptKind.TSX;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                return ts.ScriptKind.Deferred;
 | 
			
		||||
            }
 | 
			
		||||
            return getScriptKind(fileName);
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
    function resolveModuleName(name, containingFile, options, redirectedReference) {
 | 
			
		||||
        const resolved = ts.resolveModuleName(name, containingFile, options, {
 | 
			
		||||
            readFile(fileName) {
 | 
			
		||||
                return languageServiceHost.readFile(fileName);
 | 
			
		||||
            },
 | 
			
		||||
            fileExists(fileName) {
 | 
			
		||||
                if (exts.some(ext => fileName.endsWith(ext + '.d.ts'))) {
 | 
			
		||||
                    return fileExists(fileName.slice(0, -'.d.ts'.length));
 | 
			
		||||
                }
 | 
			
		||||
                return languageServiceHost.fileExists(fileName);
 | 
			
		||||
            },
 | 
			
		||||
        }, undefined, redirectedReference);
 | 
			
		||||
        if (resolved.resolvedModule) {
 | 
			
		||||
            resolved.resolvedModule.resolvedFileName = resolved.resolvedModule.resolvedFileName.slice(0, -'.d.ts'.length);
 | 
			
		||||
            const script = updateScript(resolved.resolvedModule.resolvedFileName);
 | 
			
		||||
            if (script) {
 | 
			
		||||
                resolved.resolvedModule.extension = script.extension;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return resolved;
 | 
			
		||||
    }
 | 
			
		||||
    // fix https://github.com/vuejs/language-tools/issues/3332
 | 
			
		||||
    function fileExists(fileName) {
 | 
			
		||||
        if (languageServiceHost.fileExists(fileName)) {
 | 
			
		||||
            const fileSize = ts.sys.getFileSize?.(fileName) ?? languageServiceHost.readFile(fileName)?.length ?? 0;
 | 
			
		||||
            return fileSize < 4 * 1024 * 1024;
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    function updateScript(fileName) {
 | 
			
		||||
        const version = languageServiceHost.getScriptVersion(fileName);
 | 
			
		||||
        if (version !== scripts.get(fileName)?.version) {
 | 
			
		||||
            const text = languageServiceHost.readFile(fileName);
 | 
			
		||||
            let snapshot;
 | 
			
		||||
            let extension = '.ts';
 | 
			
		||||
            if (text !== undefined) {
 | 
			
		||||
                extraProjectVersion++;
 | 
			
		||||
                const virtualFile = virtualFiles.updateSource(fileName, ts.ScriptSnapshot.fromString(text), undefined);
 | 
			
		||||
                if (virtualFile) {
 | 
			
		||||
                    let patchedText = text.split('\n').map(line => ' '.repeat(line.length)).join('\n');
 | 
			
		||||
                    (0, language_core_1.forEachEmbeddedFile)(virtualFile, file => {
 | 
			
		||||
                        const ext = file.fileName.substring(fileName.length);
 | 
			
		||||
                        if (file.kind === language_core_1.FileKind.TypeScriptHostFile && (ext === '.d.ts' || ext.match(/^\.(js|ts)x?$/))) {
 | 
			
		||||
                            extension = ext;
 | 
			
		||||
                            patchedText += file.snapshot.getText(0, file.snapshot.getLength());
 | 
			
		||||
                        }
 | 
			
		||||
                    });
 | 
			
		||||
                    snapshot = ts.ScriptSnapshot.fromString(patchedText);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else if (virtualFiles.hasSource(fileName)) {
 | 
			
		||||
                extraProjectVersion++;
 | 
			
		||||
                virtualFiles.deleteSource(fileName);
 | 
			
		||||
            }
 | 
			
		||||
            scripts.set(fileName, {
 | 
			
		||||
                version,
 | 
			
		||||
                snapshot,
 | 
			
		||||
                extension,
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        return scripts.get(fileName);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.decorateLanguageServiceHost = decorateLanguageServiceHost;
 | 
			
		||||
function searchExternalFiles(ts, project, exts) {
 | 
			
		||||
    if (project.projectKind !== ts.server.ProjectKind.Configured) {
 | 
			
		||||
        return [];
 | 
			
		||||
    }
 | 
			
		||||
    const configFile = project.getProjectName();
 | 
			
		||||
    const config = ts.readJsonConfigFile(configFile, project.readFile.bind(project));
 | 
			
		||||
    const parseHost = {
 | 
			
		||||
        useCaseSensitiveFileNames: project.useCaseSensitiveFileNames(),
 | 
			
		||||
        fileExists: project.fileExists.bind(project),
 | 
			
		||||
        readFile: project.readFile.bind(project),
 | 
			
		||||
        readDirectory: (...args) => {
 | 
			
		||||
            args[1] = exts;
 | 
			
		||||
            return project.readDirectory(...args);
 | 
			
		||||
        },
 | 
			
		||||
    };
 | 
			
		||||
    const parsed = ts.parseJsonSourceFileConfigFileContent(config, parseHost, project.getCurrentDirectory());
 | 
			
		||||
    return parsed.fileNames;
 | 
			
		||||
}
 | 
			
		||||
exports.searchExternalFiles = searchExternalFiles;
 | 
			
		||||
/**
 | 
			
		||||
 * @deprecated use `searchExternalFiles` instead
 | 
			
		||||
 */
 | 
			
		||||
exports.getExternalFiles = searchExternalFiles;
 | 
			
		||||
//# sourceMappingURL=serverPlugin.js.map
 | 
			
		||||
							
								
								
									
										7
									
								
								node_modules/@volar/typescript/lib/sys.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								node_modules/@volar/typescript/lib/sys.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
import type { ServiceEnvironment, Disposable } from '@volar/language-service';
 | 
			
		||||
import type * as ts from 'typescript/lib/tsserverlibrary';
 | 
			
		||||
export declare function createSys(ts: typeof import('typescript/lib/tsserverlibrary'), env: ServiceEnvironment): ts.System & {
 | 
			
		||||
    version: number;
 | 
			
		||||
    sync(): Promise<number>;
 | 
			
		||||
} & Disposable;
 | 
			
		||||
//# sourceMappingURL=sys.d.ts.map
 | 
			
		||||
							
								
								
									
										341
									
								
								node_modules/@volar/typescript/lib/sys.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										341
									
								
								node_modules/@volar/typescript/lib/sys.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,341 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.createSys = void 0;
 | 
			
		||||
const path = require("path-browserify");
 | 
			
		||||
const utilities_1 = require("./typescript/utilities");
 | 
			
		||||
let currentCwd = '';
 | 
			
		||||
function createSys(ts, env) {
 | 
			
		||||
    let version = 0;
 | 
			
		||||
    const rootPath = env.uriToFileName(env.workspaceUri.toString());
 | 
			
		||||
    const sys = ts.sys;
 | 
			
		||||
    const root = {
 | 
			
		||||
        dirs: new Map(),
 | 
			
		||||
        files: new Map(),
 | 
			
		||||
        requestedRead: false,
 | 
			
		||||
    };
 | 
			
		||||
    const promises = new Set();
 | 
			
		||||
    const fileWatcher = env.onDidChangeWatchedFiles?.(({ changes }) => {
 | 
			
		||||
        for (const change of changes) {
 | 
			
		||||
            const fileName = env.uriToFileName(change.uri);
 | 
			
		||||
            const dirName = path.dirname(fileName);
 | 
			
		||||
            const baseName = path.basename(fileName);
 | 
			
		||||
            const dir = getDir(dirName);
 | 
			
		||||
            if (dir.files.has(baseName)) { // is requested file
 | 
			
		||||
                version++;
 | 
			
		||||
                if (change.type === 1 || change.type === 2) {
 | 
			
		||||
                    dir.files.set(baseName, {
 | 
			
		||||
                        stat: {
 | 
			
		||||
                            type: 1,
 | 
			
		||||
                            ctime: Date.now(),
 | 
			
		||||
                            mtime: Date.now(),
 | 
			
		||||
                            size: -1,
 | 
			
		||||
                        },
 | 
			
		||||
                        requestedStat: false,
 | 
			
		||||
                    });
 | 
			
		||||
                }
 | 
			
		||||
                else if (change.type === 3) {
 | 
			
		||||
                    dir.files.set(baseName, {
 | 
			
		||||
                        stat: undefined,
 | 
			
		||||
                        text: undefined,
 | 
			
		||||
                        requestedStat: true,
 | 
			
		||||
                        requestedText: true,
 | 
			
		||||
                    });
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    return {
 | 
			
		||||
        get version() {
 | 
			
		||||
            return version;
 | 
			
		||||
        },
 | 
			
		||||
        dispose() {
 | 
			
		||||
            fileWatcher?.dispose();
 | 
			
		||||
        },
 | 
			
		||||
        args: sys?.args ?? [],
 | 
			
		||||
        newLine: sys?.newLine ?? '\n',
 | 
			
		||||
        useCaseSensitiveFileNames: sys?.useCaseSensitiveFileNames ?? false,
 | 
			
		||||
        realpath: sys?.realpath,
 | 
			
		||||
        write: sys?.write ?? (() => { }),
 | 
			
		||||
        writeFile: sys?.writeFile ?? (() => { }),
 | 
			
		||||
        createDirectory: sys?.createDirectory ?? (() => { }),
 | 
			
		||||
        exit: sys?.exit ?? (() => { }),
 | 
			
		||||
        getExecutingFilePath: sys?.getExecutingFilePath ?? (() => rootPath + '/__fake__.js'),
 | 
			
		||||
        getCurrentDirectory: () => rootPath,
 | 
			
		||||
        getModifiedTime,
 | 
			
		||||
        readFile,
 | 
			
		||||
        readDirectory,
 | 
			
		||||
        getDirectories,
 | 
			
		||||
        resolvePath,
 | 
			
		||||
        fileExists,
 | 
			
		||||
        directoryExists,
 | 
			
		||||
        async sync() {
 | 
			
		||||
            while (promises.size) {
 | 
			
		||||
                await Promise.all(promises);
 | 
			
		||||
            }
 | 
			
		||||
            return version;
 | 
			
		||||
        },
 | 
			
		||||
    };
 | 
			
		||||
    function resolvePath(fsPath) {
 | 
			
		||||
        if (sys) {
 | 
			
		||||
            if (currentCwd !== rootPath) {
 | 
			
		||||
                currentCwd = rootPath;
 | 
			
		||||
                // https://github.com/vuejs/language-tools/issues/2039
 | 
			
		||||
                // https://github.com/vuejs/language-tools/issues/2234
 | 
			
		||||
                if (sys.directoryExists(rootPath)) {
 | 
			
		||||
                    // https://github.com/vuejs/language-tools/issues/2480
 | 
			
		||||
                    try {
 | 
			
		||||
                        // @ts-expect-error
 | 
			
		||||
                        process.chdir(rootPath);
 | 
			
		||||
                    }
 | 
			
		||||
                    catch { }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return sys.resolvePath(fsPath).replace(/\\/g, '/');
 | 
			
		||||
        }
 | 
			
		||||
        return path.resolve(fsPath).replace(/\\/g, '/');
 | 
			
		||||
    }
 | 
			
		||||
    function readFile(fileName, encoding) {
 | 
			
		||||
        fileName = resolvePath(fileName);
 | 
			
		||||
        const dirPath = path.dirname(fileName);
 | 
			
		||||
        const dir = getDir(dirPath);
 | 
			
		||||
        const name = path.basename(fileName);
 | 
			
		||||
        readFileWorker(fileName, encoding, dir);
 | 
			
		||||
        return dir.files.get(name)?.text;
 | 
			
		||||
    }
 | 
			
		||||
    function directoryExists(dirName) {
 | 
			
		||||
        dirName = resolvePath(dirName);
 | 
			
		||||
        const dir = getDir(dirName);
 | 
			
		||||
        if (dir.exists === undefined) {
 | 
			
		||||
            dir.exists = false;
 | 
			
		||||
            const result = env.fs?.stat(env.fileNameToUri(dirName));
 | 
			
		||||
            if (typeof result === 'object' && 'then' in result) {
 | 
			
		||||
                const promise = result;
 | 
			
		||||
                promises.add(promise);
 | 
			
		||||
                result.then(result => {
 | 
			
		||||
                    promises.delete(promise);
 | 
			
		||||
                    dir.exists = result?.type === 2;
 | 
			
		||||
                    if (dir.exists) {
 | 
			
		||||
                        version++;
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                dir.exists = result?.type === 2;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return dir.exists;
 | 
			
		||||
    }
 | 
			
		||||
    function getModifiedTime(fileName) {
 | 
			
		||||
        fileName = resolvePath(fileName);
 | 
			
		||||
        const file = getFile(fileName);
 | 
			
		||||
        if (!file.requestedStat) {
 | 
			
		||||
            file.requestedStat = true;
 | 
			
		||||
            handleStat(fileName, file);
 | 
			
		||||
        }
 | 
			
		||||
        return file.stat ? new Date(file.stat.mtime) : new Date(0);
 | 
			
		||||
    }
 | 
			
		||||
    function fileExists(fileName) {
 | 
			
		||||
        fileName = resolvePath(fileName);
 | 
			
		||||
        const file = getFile(fileName);
 | 
			
		||||
        const exists = () => file.text !== undefined || file.stat?.type === 1;
 | 
			
		||||
        if (exists()) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        if (!file.requestedStat) {
 | 
			
		||||
            file.requestedStat = true;
 | 
			
		||||
            handleStat(fileName, file);
 | 
			
		||||
        }
 | 
			
		||||
        return exists();
 | 
			
		||||
    }
 | 
			
		||||
    function handleStat(fileName, file) {
 | 
			
		||||
        const result = env.fs?.stat(env.fileNameToUri(fileName));
 | 
			
		||||
        if (typeof result === 'object' && 'then' in result) {
 | 
			
		||||
            const promise = result;
 | 
			
		||||
            promises.add(promise);
 | 
			
		||||
            result.then(result => {
 | 
			
		||||
                promises.delete(promise);
 | 
			
		||||
                if (file.stat?.type !== result?.type || file.stat?.mtime !== result?.mtime) {
 | 
			
		||||
                    version++;
 | 
			
		||||
                }
 | 
			
		||||
                file.stat = result;
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            file.stat = result;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    function getFile(fileName) {
 | 
			
		||||
        fileName = resolvePath(fileName);
 | 
			
		||||
        const dirPath = path.dirname(fileName);
 | 
			
		||||
        const baseName = path.basename(fileName);
 | 
			
		||||
        const dir = getDir(dirPath);
 | 
			
		||||
        let file = dir.files.get(baseName);
 | 
			
		||||
        if (!file) {
 | 
			
		||||
            dir.files.set(baseName, file = {});
 | 
			
		||||
        }
 | 
			
		||||
        return file;
 | 
			
		||||
    }
 | 
			
		||||
    // for import path completion
 | 
			
		||||
    function getDirectories(dirName) {
 | 
			
		||||
        dirName = resolvePath(dirName);
 | 
			
		||||
        readDirectoryWorker(dirName);
 | 
			
		||||
        const dir = getDir(dirName);
 | 
			
		||||
        return [...dir.dirs.entries()].filter(([_, dir]) => dir.exists).map(([name]) => name);
 | 
			
		||||
    }
 | 
			
		||||
    function readDirectory(dirName, extensions, excludes, includes, depth) {
 | 
			
		||||
        dirName = resolvePath(dirName);
 | 
			
		||||
        const matches = (0, utilities_1.matchFiles)(dirName, extensions, excludes, includes, sys?.useCaseSensitiveFileNames ?? false, rootPath, depth, (dirPath) => {
 | 
			
		||||
            dirPath = resolvePath(dirPath);
 | 
			
		||||
            readDirectoryWorker(dirPath);
 | 
			
		||||
            const dir = getDir(dirPath);
 | 
			
		||||
            return {
 | 
			
		||||
                files: [...dir.files.entries()].filter(([_, file]) => file.stat?.type === 1).map(([name]) => name),
 | 
			
		||||
                directories: [...dir.dirs.entries()].filter(([_, dir]) => dir.exists).map(([name]) => name),
 | 
			
		||||
            };
 | 
			
		||||
        }, sys?.realpath ? (path => sys.realpath(path)) : (path => path));
 | 
			
		||||
        return [...new Set(matches)];
 | 
			
		||||
    }
 | 
			
		||||
    function readFileWorker(fileName, encoding, dir) {
 | 
			
		||||
        const name = path.basename(fileName);
 | 
			
		||||
        let file = dir.files.get(name);
 | 
			
		||||
        if (!file) {
 | 
			
		||||
            dir.files.set(name, file = {});
 | 
			
		||||
        }
 | 
			
		||||
        if (file.requestedText) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        file.requestedText = true;
 | 
			
		||||
        const uri = env.fileNameToUri(fileName);
 | 
			
		||||
        const result = env.fs?.readFile(uri, encoding);
 | 
			
		||||
        if (typeof result === 'object' && 'then' in result) {
 | 
			
		||||
            const promise = result;
 | 
			
		||||
            promises.add(promise);
 | 
			
		||||
            result.then(result => {
 | 
			
		||||
                promises.delete(promise);
 | 
			
		||||
                if (result !== undefined) {
 | 
			
		||||
                    file.text = result;
 | 
			
		||||
                    if (file.stat) {
 | 
			
		||||
                        file.stat.mtime++;
 | 
			
		||||
                    }
 | 
			
		||||
                    version++;
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        else if (result !== undefined) {
 | 
			
		||||
            file.text = result;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    function readDirectoryWorker(dirName) {
 | 
			
		||||
        const dir = getDir(dirName);
 | 
			
		||||
        if (dir.requestedRead) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        dir.requestedRead = true;
 | 
			
		||||
        const result = env.fs?.readDirectory(env.fileNameToUri(dirName || '.'));
 | 
			
		||||
        if (typeof result === 'object' && 'then' in result) {
 | 
			
		||||
            const promise = result;
 | 
			
		||||
            promises.add(promise);
 | 
			
		||||
            result.then((result) => {
 | 
			
		||||
                promises.delete(promise);
 | 
			
		||||
                if (onReadDirectoryResult(dirName, dir, result)) {
 | 
			
		||||
                    version++;
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            onReadDirectoryResult(dirName, dir, result ?? []);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    function onReadDirectoryResult(dirName, dir, result) {
 | 
			
		||||
        // See https://github.com/microsoft/TypeScript/blob/e1a9290051a3b0cbdfbadc3adbcc155a4641522a/src/compiler/sys.ts#L1853-L1857
 | 
			
		||||
        result = result.filter(([name]) => name !== '.' && name !== '..');
 | 
			
		||||
        let updated = false;
 | 
			
		||||
        for (const [name, _fileType] of result) {
 | 
			
		||||
            let fileType = _fileType;
 | 
			
		||||
            if (fileType === 64) {
 | 
			
		||||
                const stat = env.fs?.stat(env.fileNameToUri(dirName + '/' + name));
 | 
			
		||||
                if (typeof stat === 'object' && 'then' in stat) {
 | 
			
		||||
                    const promise = stat;
 | 
			
		||||
                    promises.add(promise);
 | 
			
		||||
                    stat.then((stat) => {
 | 
			
		||||
                        promises.delete(promise);
 | 
			
		||||
                        if (stat?.type === 1) {
 | 
			
		||||
                            let file = dir.files.get(name);
 | 
			
		||||
                            if (!file) {
 | 
			
		||||
                                dir.files.set(name, file = {});
 | 
			
		||||
                            }
 | 
			
		||||
                            if (stat.type !== file.stat?.type || stat.mtime !== file.stat?.mtime) {
 | 
			
		||||
                                version++;
 | 
			
		||||
                            }
 | 
			
		||||
                            file.stat = stat;
 | 
			
		||||
                            file.requestedStat = true;
 | 
			
		||||
                        }
 | 
			
		||||
                        else if (stat?.type === 2) {
 | 
			
		||||
                            const childDir = getDirFromDir(dir, name);
 | 
			
		||||
                            if (!childDir.exists) {
 | 
			
		||||
                                childDir.exists = true;
 | 
			
		||||
                                version++;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    });
 | 
			
		||||
                }
 | 
			
		||||
                else if (stat) {
 | 
			
		||||
                    fileType = stat.type;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if (fileType === 1) {
 | 
			
		||||
                let file = dir.files.get(name);
 | 
			
		||||
                if (!file) {
 | 
			
		||||
                    dir.files.set(name, file = {});
 | 
			
		||||
                }
 | 
			
		||||
                if (!file.stat) {
 | 
			
		||||
                    file.stat = {
 | 
			
		||||
                        type: 1,
 | 
			
		||||
                        mtime: 0,
 | 
			
		||||
                        ctime: 0,
 | 
			
		||||
                        size: 0,
 | 
			
		||||
                    };
 | 
			
		||||
                    updated = true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else if (fileType === 2) {
 | 
			
		||||
                const childDir = getDirFromDir(dir, name);
 | 
			
		||||
                if (!childDir.exists) {
 | 
			
		||||
                    childDir.exists = true;
 | 
			
		||||
                    updated = true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return updated;
 | 
			
		||||
    }
 | 
			
		||||
    function getDir(dirName) {
 | 
			
		||||
        const dirNames = [];
 | 
			
		||||
        let currentDirPath = dirName;
 | 
			
		||||
        let currentDirName = path.basename(currentDirPath);
 | 
			
		||||
        let lastDirPath;
 | 
			
		||||
        while (lastDirPath !== currentDirPath) {
 | 
			
		||||
            lastDirPath = currentDirPath;
 | 
			
		||||
            dirNames.push(currentDirName);
 | 
			
		||||
            currentDirPath = path.dirname(currentDirPath);
 | 
			
		||||
            currentDirName = path.basename(currentDirPath);
 | 
			
		||||
        }
 | 
			
		||||
        let currentDir = root;
 | 
			
		||||
        for (let i = dirNames.length - 1; i >= 0; i--) {
 | 
			
		||||
            const nextDirName = dirNames[i];
 | 
			
		||||
            currentDir = getDirFromDir(currentDir, nextDirName);
 | 
			
		||||
        }
 | 
			
		||||
        return currentDir;
 | 
			
		||||
    }
 | 
			
		||||
    function getDirFromDir(dir, name) {
 | 
			
		||||
        let target = dir.dirs.get(name);
 | 
			
		||||
        if (!target) {
 | 
			
		||||
            dir.dirs.set(name, target = {
 | 
			
		||||
                dirs: new Map(),
 | 
			
		||||
                files: new Map(),
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        return target;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.createSys = createSys;
 | 
			
		||||
//# sourceMappingURL=sys.js.map
 | 
			
		||||
							
								
								
									
										84
									
								
								node_modules/@volar/typescript/lib/typescript/core.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								node_modules/@volar/typescript/lib/typescript/core.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,84 @@
 | 
			
		||||
import { Comparer, Comparison, SortedReadonlyArray } from "./corePublic";
 | 
			
		||||
/**
 | 
			
		||||
 * Iterates through `array` by index and performs the callback on each element of array until the callback
 | 
			
		||||
 * returns a falsey value, then returns false.
 | 
			
		||||
 * If no such value is found, the callback is applied to each element of array and `true` is returned.
 | 
			
		||||
 */
 | 
			
		||||
export declare function every<T>(array: readonly T[] | undefined, callback: (element: T, index: number) => boolean): boolean;
 | 
			
		||||
/** Works like Array.prototype.findIndex, returning `-1` if no element satisfying the predicate is found. */
 | 
			
		||||
export declare function findIndex<T>(array: readonly T[] | undefined, predicate: (element: T, index: number) => boolean, startIndex?: number): number;
 | 
			
		||||
export declare function indexOfAnyCharCode(text: string, charCodes: readonly number[], start?: number): number;
 | 
			
		||||
export declare function map<T, U>(array: readonly T[], f: (x: T, i: number) => U): U[];
 | 
			
		||||
export declare function map<T, U>(array: readonly T[] | undefined, f: (x: T, i: number) => U): U[] | undefined;
 | 
			
		||||
/**
 | 
			
		||||
 * Flattens an array containing a mix of array or non-array elements.
 | 
			
		||||
 *
 | 
			
		||||
 * @param array The array to flatten.
 | 
			
		||||
 */
 | 
			
		||||
export declare function flatten<T>(array: T[][] | readonly (T | readonly T[] | undefined)[]): T[];
 | 
			
		||||
/**
 | 
			
		||||
 * Maps an array. If the mapped value is an array, it is spread into the result.
 | 
			
		||||
 *
 | 
			
		||||
 * @param array The array to map.
 | 
			
		||||
 * @param mapfn The callback used to map the result into one or more values.
 | 
			
		||||
 */
 | 
			
		||||
export declare function flatMap<T, U>(array: readonly T[] | undefined, mapfn: (x: T, i: number) => U | readonly U[] | undefined): readonly U[];
 | 
			
		||||
export declare function some<T>(array: readonly T[] | undefined): array is readonly T[];
 | 
			
		||||
export declare function some<T>(array: readonly T[] | undefined, predicate: (value: T) => boolean): boolean;
 | 
			
		||||
/**
 | 
			
		||||
 * Returns a new sorted array.
 | 
			
		||||
 */
 | 
			
		||||
export declare function sort<T>(array: readonly T[], comparer?: Comparer<T>): SortedReadonlyArray<T>;
 | 
			
		||||
/**
 | 
			
		||||
 * Returns the last element of an array if non-empty, `undefined` otherwise.
 | 
			
		||||
 */
 | 
			
		||||
export declare function lastOrUndefined<T>(array: readonly T[] | undefined): T | undefined;
 | 
			
		||||
export declare function last<T>(array: readonly T[]): T;
 | 
			
		||||
/**
 | 
			
		||||
 * Compare the equality of two strings using a case-sensitive ordinal comparison.
 | 
			
		||||
 *
 | 
			
		||||
 * Case-sensitive comparisons compare both strings one code-point at a time using the integer
 | 
			
		||||
 * value of each code-point after applying `toUpperCase` to each string. We always map both
 | 
			
		||||
 * strings to their upper-case form as some unicode characters do not properly round-trip to
 | 
			
		||||
 * lowercase (such as `ẞ` (German sharp capital s)).
 | 
			
		||||
 */
 | 
			
		||||
export declare function equateStringsCaseInsensitive(a: string, b: string): boolean;
 | 
			
		||||
/**
 | 
			
		||||
 * Compare the equality of two strings using a case-sensitive ordinal comparison.
 | 
			
		||||
 *
 | 
			
		||||
 * Case-sensitive comparisons compare both strings one code-point at a time using the
 | 
			
		||||
 * integer value of each code-point.
 | 
			
		||||
 */
 | 
			
		||||
export declare function equateStringsCaseSensitive(a: string, b: string): boolean;
 | 
			
		||||
/**
 | 
			
		||||
 * Compare two strings using a case-insensitive ordinal comparison.
 | 
			
		||||
 *
 | 
			
		||||
 * Ordinal comparisons are based on the difference between the unicode code points of both
 | 
			
		||||
 * strings. Characters with multiple unicode representations are considered unequal. Ordinal
 | 
			
		||||
 * comparisons provide predictable ordering, but place "a" after "B".
 | 
			
		||||
 *
 | 
			
		||||
 * Case-insensitive comparisons compare both strings one code-point at a time using the integer
 | 
			
		||||
 * value of each code-point after applying `toUpperCase` to each string. We always map both
 | 
			
		||||
 * strings to their upper-case form as some unicode characters do not properly round-trip to
 | 
			
		||||
 * lowercase (such as `ẞ` (German sharp capital s)).
 | 
			
		||||
 */
 | 
			
		||||
declare function compareStringsCaseInsensitive(a: string, b: string): Comparison;
 | 
			
		||||
/**
 | 
			
		||||
 * Compare two strings using a case-sensitive ordinal comparison.
 | 
			
		||||
 *
 | 
			
		||||
 * Ordinal comparisons are based on the difference between the unicode code points of both
 | 
			
		||||
 * strings. Characters with multiple unicode representations are considered unequal. Ordinal
 | 
			
		||||
 * comparisons provide predictable ordering, but place "a" after "B".
 | 
			
		||||
 *
 | 
			
		||||
 * Case-sensitive comparisons compare both strings one code-point at a time using the integer
 | 
			
		||||
 * value of each code-point.
 | 
			
		||||
 */
 | 
			
		||||
export declare function compareStringsCaseSensitive(a: string | undefined, b: string | undefined): Comparison;
 | 
			
		||||
export declare function getStringComparer(ignoreCase?: boolean): typeof compareStringsCaseInsensitive;
 | 
			
		||||
export declare function endsWith(str: string, suffix: string): boolean;
 | 
			
		||||
export declare function stringContains(str: string, substring: string): boolean;
 | 
			
		||||
type GetCanonicalFileName = (fileName: string) => string;
 | 
			
		||||
export declare function createGetCanonicalFileName(useCaseSensitiveFileNames: boolean): GetCanonicalFileName;
 | 
			
		||||
export declare function startsWith(str: string, prefix: string): boolean;
 | 
			
		||||
export {};
 | 
			
		||||
//# sourceMappingURL=core.d.ts.map
 | 
			
		||||
							
								
								
									
										320
									
								
								node_modules/@volar/typescript/lib/typescript/core.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										320
									
								
								node_modules/@volar/typescript/lib/typescript/core.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,320 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.startsWith = exports.createGetCanonicalFileName = exports.stringContains = exports.endsWith = exports.getStringComparer = exports.compareStringsCaseSensitive = exports.equateStringsCaseSensitive = exports.equateStringsCaseInsensitive = exports.last = exports.lastOrUndefined = exports.sort = exports.some = exports.flatMap = exports.flatten = exports.map = exports.indexOfAnyCharCode = exports.findIndex = exports.every = void 0;
 | 
			
		||||
const emptyArray = [];
 | 
			
		||||
/**
 | 
			
		||||
 * Iterates through `array` by index and performs the callback on each element of array until the callback
 | 
			
		||||
 * returns a falsey value, then returns false.
 | 
			
		||||
 * If no such value is found, the callback is applied to each element of array and `true` is returned.
 | 
			
		||||
 */
 | 
			
		||||
function every(array, callback) {
 | 
			
		||||
    if (array) {
 | 
			
		||||
        for (let i = 0; i < array.length; i++) {
 | 
			
		||||
            if (!callback(array[i], i)) {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
exports.every = every;
 | 
			
		||||
/** Works like Array.prototype.findIndex, returning `-1` if no element satisfying the predicate is found. */
 | 
			
		||||
function findIndex(array, predicate, startIndex) {
 | 
			
		||||
    if (array === undefined)
 | 
			
		||||
        return -1;
 | 
			
		||||
    for (let i = startIndex ?? 0; i < array.length; i++) {
 | 
			
		||||
        if (predicate(array[i], i)) {
 | 
			
		||||
            return i;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return -1;
 | 
			
		||||
}
 | 
			
		||||
exports.findIndex = findIndex;
 | 
			
		||||
function contains(array, value, equalityComparer = equateValues) {
 | 
			
		||||
    if (array) {
 | 
			
		||||
        for (const v of array) {
 | 
			
		||||
            if (equalityComparer(v, value)) {
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
function indexOfAnyCharCode(text, charCodes, start) {
 | 
			
		||||
    for (let i = start || 0; i < text.length; i++) {
 | 
			
		||||
        if (contains(charCodes, text.charCodeAt(i))) {
 | 
			
		||||
            return i;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return -1;
 | 
			
		||||
}
 | 
			
		||||
exports.indexOfAnyCharCode = indexOfAnyCharCode;
 | 
			
		||||
function map(array, f) {
 | 
			
		||||
    let result;
 | 
			
		||||
    if (array) {
 | 
			
		||||
        result = [];
 | 
			
		||||
        for (let i = 0; i < array.length; i++) {
 | 
			
		||||
            result.push(f(array[i], i));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
exports.map = map;
 | 
			
		||||
/**
 | 
			
		||||
 * Flattens an array containing a mix of array or non-array elements.
 | 
			
		||||
 *
 | 
			
		||||
 * @param array The array to flatten.
 | 
			
		||||
 */
 | 
			
		||||
function flatten(array) {
 | 
			
		||||
    const result = [];
 | 
			
		||||
    for (const v of array) {
 | 
			
		||||
        if (v) {
 | 
			
		||||
            if (isArray(v)) {
 | 
			
		||||
                addRange(result, v);
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                result.push(v);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
exports.flatten = flatten;
 | 
			
		||||
/**
 | 
			
		||||
 * Maps an array. If the mapped value is an array, it is spread into the result.
 | 
			
		||||
 *
 | 
			
		||||
 * @param array The array to map.
 | 
			
		||||
 * @param mapfn The callback used to map the result into one or more values.
 | 
			
		||||
 */
 | 
			
		||||
function flatMap(array, mapfn) {
 | 
			
		||||
    let result;
 | 
			
		||||
    if (array) {
 | 
			
		||||
        for (let i = 0; i < array.length; i++) {
 | 
			
		||||
            const v = mapfn(array[i], i);
 | 
			
		||||
            if (v) {
 | 
			
		||||
                if (isArray(v)) {
 | 
			
		||||
                    result = addRange(result, v);
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    result = append(result, v);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return result || emptyArray;
 | 
			
		||||
}
 | 
			
		||||
exports.flatMap = flatMap;
 | 
			
		||||
function some(array, predicate) {
 | 
			
		||||
    if (array) {
 | 
			
		||||
        if (predicate) {
 | 
			
		||||
            for (const v of array) {
 | 
			
		||||
                if (predicate(v)) {
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            return array.length > 0;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
exports.some = some;
 | 
			
		||||
// function append<T>(to: T[] | undefined, value: T): T[];
 | 
			
		||||
// function append<T>(to: T[] | undefined, value: T | undefined): T[] | undefined;
 | 
			
		||||
// function append<T>(to: Push<T>, value: T | undefined): void;
 | 
			
		||||
function append(to, value) {
 | 
			
		||||
    if (value === undefined)
 | 
			
		||||
        return to;
 | 
			
		||||
    if (to === undefined)
 | 
			
		||||
        return [value];
 | 
			
		||||
    to.push(value);
 | 
			
		||||
    return to;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Gets the actual offset into an array for a relative offset. Negative offsets indicate a
 | 
			
		||||
 * position offset from the end of the array.
 | 
			
		||||
 */
 | 
			
		||||
function toOffset(array, offset) {
 | 
			
		||||
    return offset < 0 ? array.length + offset : offset;
 | 
			
		||||
}
 | 
			
		||||
function addRange(to, from, start, end) {
 | 
			
		||||
    if (from === undefined || from.length === 0)
 | 
			
		||||
        return to;
 | 
			
		||||
    if (to === undefined)
 | 
			
		||||
        return from.slice(start, end);
 | 
			
		||||
    start = start === undefined ? 0 : toOffset(from, start);
 | 
			
		||||
    end = end === undefined ? from.length : toOffset(from, end);
 | 
			
		||||
    for (let i = start; i < end && i < from.length; i++) {
 | 
			
		||||
        if (from[i] !== undefined) {
 | 
			
		||||
            to.push(from[i]);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return to;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Returns a new sorted array.
 | 
			
		||||
 */
 | 
			
		||||
function sort(array, comparer) {
 | 
			
		||||
    return (array.length === 0 ? array : array.slice().sort(comparer));
 | 
			
		||||
}
 | 
			
		||||
exports.sort = sort;
 | 
			
		||||
/**
 | 
			
		||||
 * Returns the last element of an array if non-empty, `undefined` otherwise.
 | 
			
		||||
 */
 | 
			
		||||
function lastOrUndefined(array) {
 | 
			
		||||
    return array === undefined || array.length === 0 ? undefined : array[array.length - 1];
 | 
			
		||||
}
 | 
			
		||||
exports.lastOrUndefined = lastOrUndefined;
 | 
			
		||||
function last(array) {
 | 
			
		||||
    // Debug.assert(array.length !== 0);
 | 
			
		||||
    return array[array.length - 1];
 | 
			
		||||
}
 | 
			
		||||
exports.last = last;
 | 
			
		||||
/**
 | 
			
		||||
 * Tests whether a value is an array.
 | 
			
		||||
 */
 | 
			
		||||
function isArray(value) {
 | 
			
		||||
    return Array.isArray ? Array.isArray(value) : value instanceof Array;
 | 
			
		||||
}
 | 
			
		||||
/** Returns its argument. */
 | 
			
		||||
function identity(x) {
 | 
			
		||||
    return x;
 | 
			
		||||
}
 | 
			
		||||
/** Returns lower case string */
 | 
			
		||||
function toLowerCase(x) {
 | 
			
		||||
    return x.toLowerCase();
 | 
			
		||||
}
 | 
			
		||||
// We convert the file names to lower case as key for file name on case insensitive file system
 | 
			
		||||
// While doing so we need to handle special characters (eg \u0130) to ensure that we dont convert
 | 
			
		||||
// it to lower case, fileName with its lowercase form can exist along side it.
 | 
			
		||||
// Handle special characters and make those case sensitive instead
 | 
			
		||||
//
 | 
			
		||||
// |-#--|-Unicode--|-Char code-|-Desc-------------------------------------------------------------------|
 | 
			
		||||
// | 1. | i        | 105       | Ascii i                                                                |
 | 
			
		||||
// | 2. | I        | 73        | Ascii I                                                                |
 | 
			
		||||
// |-------- Special characters ------------------------------------------------------------------------|
 | 
			
		||||
// | 3. | \u0130   | 304       | Upper case I with dot above                                            |
 | 
			
		||||
// | 4. | i,\u0307 | 105,775   | i, followed by 775: Lower case of (3rd item)                           |
 | 
			
		||||
// | 5. | I,\u0307 | 73,775    | I, followed by 775: Upper case of (4th item), lower case is (4th item) |
 | 
			
		||||
// | 6. | \u0131   | 305       | Lower case i without dot, upper case is I (2nd item)                   |
 | 
			
		||||
// | 7. | \u00DF   | 223       | Lower case sharp s                                                     |
 | 
			
		||||
//
 | 
			
		||||
// Because item 3 is special where in its lowercase character has its own
 | 
			
		||||
// upper case form we cant convert its case.
 | 
			
		||||
// Rest special characters are either already in lower case format or
 | 
			
		||||
// they have corresponding upper case character so they dont need special handling
 | 
			
		||||
//
 | 
			
		||||
// But to avoid having to do string building for most common cases, also ignore
 | 
			
		||||
// a-z, 0-9, \u0131, \u00DF, \, /, ., : and space
 | 
			
		||||
const fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;
 | 
			
		||||
/**
 | 
			
		||||
 * Case insensitive file systems have descripencies in how they handle some characters (eg. turkish Upper case I with dot on top - \u0130)
 | 
			
		||||
 * This function is used in places where we want to make file name as a key on these systems
 | 
			
		||||
 * It is possible on mac to be able to refer to file name with I with dot on top as a fileName with its lower case form
 | 
			
		||||
 * But on windows we cannot. Windows can have fileName with I with dot on top next to its lower case and they can not each be referred with the lowercase forms
 | 
			
		||||
 * Technically we would want this function to be platform sepcific as well but
 | 
			
		||||
 * our api has till now only taken caseSensitive as the only input and just for some characters we dont want to update API and ensure all customers use those api
 | 
			
		||||
 * We could use upper case and we would still need to deal with the descripencies but
 | 
			
		||||
 * we want to continue using lower case since in most cases filenames are lowercasewe and wont need any case changes and avoid having to store another string for the key
 | 
			
		||||
 * So for this function purpose, we go ahead and assume character I with dot on top it as case sensitive since its very unlikely to use lower case form of that special character
 | 
			
		||||
 */
 | 
			
		||||
function toFileNameLowerCase(x) {
 | 
			
		||||
    return fileNameLowerCaseRegExp.test(x) ?
 | 
			
		||||
        x.replace(fileNameLowerCaseRegExp, toLowerCase) :
 | 
			
		||||
        x;
 | 
			
		||||
}
 | 
			
		||||
function equateValues(a, b) {
 | 
			
		||||
    return a === b;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Compare the equality of two strings using a case-sensitive ordinal comparison.
 | 
			
		||||
 *
 | 
			
		||||
 * Case-sensitive comparisons compare both strings one code-point at a time using the integer
 | 
			
		||||
 * value of each code-point after applying `toUpperCase` to each string. We always map both
 | 
			
		||||
 * strings to their upper-case form as some unicode characters do not properly round-trip to
 | 
			
		||||
 * lowercase (such as `ẞ` (German sharp capital s)).
 | 
			
		||||
 */
 | 
			
		||||
function equateStringsCaseInsensitive(a, b) {
 | 
			
		||||
    return a === b
 | 
			
		||||
        || a !== undefined
 | 
			
		||||
            && b !== undefined
 | 
			
		||||
            && a.toUpperCase() === b.toUpperCase();
 | 
			
		||||
}
 | 
			
		||||
exports.equateStringsCaseInsensitive = equateStringsCaseInsensitive;
 | 
			
		||||
/**
 | 
			
		||||
 * Compare the equality of two strings using a case-sensitive ordinal comparison.
 | 
			
		||||
 *
 | 
			
		||||
 * Case-sensitive comparisons compare both strings one code-point at a time using the
 | 
			
		||||
 * integer value of each code-point.
 | 
			
		||||
 */
 | 
			
		||||
function equateStringsCaseSensitive(a, b) {
 | 
			
		||||
    return equateValues(a, b);
 | 
			
		||||
}
 | 
			
		||||
exports.equateStringsCaseSensitive = equateStringsCaseSensitive;
 | 
			
		||||
function compareComparableValues(a, b) {
 | 
			
		||||
    return a === b ? 0 /* Comparison.EqualTo */ :
 | 
			
		||||
        a === undefined ? -1 /* Comparison.LessThan */ :
 | 
			
		||||
            b === undefined ? 1 /* Comparison.GreaterThan */ :
 | 
			
		||||
                a < b ? -1 /* Comparison.LessThan */ :
 | 
			
		||||
                    1 /* Comparison.GreaterThan */;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Compare two strings using a case-insensitive ordinal comparison.
 | 
			
		||||
 *
 | 
			
		||||
 * Ordinal comparisons are based on the difference between the unicode code points of both
 | 
			
		||||
 * strings. Characters with multiple unicode representations are considered unequal. Ordinal
 | 
			
		||||
 * comparisons provide predictable ordering, but place "a" after "B".
 | 
			
		||||
 *
 | 
			
		||||
 * Case-insensitive comparisons compare both strings one code-point at a time using the integer
 | 
			
		||||
 * value of each code-point after applying `toUpperCase` to each string. We always map both
 | 
			
		||||
 * strings to their upper-case form as some unicode characters do not properly round-trip to
 | 
			
		||||
 * lowercase (such as `ẞ` (German sharp capital s)).
 | 
			
		||||
 */
 | 
			
		||||
function compareStringsCaseInsensitive(a, b) {
 | 
			
		||||
    if (a === b)
 | 
			
		||||
        return 0 /* Comparison.EqualTo */;
 | 
			
		||||
    if (a === undefined)
 | 
			
		||||
        return -1 /* Comparison.LessThan */;
 | 
			
		||||
    if (b === undefined)
 | 
			
		||||
        return 1 /* Comparison.GreaterThan */;
 | 
			
		||||
    a = a.toUpperCase();
 | 
			
		||||
    b = b.toUpperCase();
 | 
			
		||||
    return a < b ? -1 /* Comparison.LessThan */ : a > b ? 1 /* Comparison.GreaterThan */ : 0 /* Comparison.EqualTo */;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Compare two strings using a case-sensitive ordinal comparison.
 | 
			
		||||
 *
 | 
			
		||||
 * Ordinal comparisons are based on the difference between the unicode code points of both
 | 
			
		||||
 * strings. Characters with multiple unicode representations are considered unequal. Ordinal
 | 
			
		||||
 * comparisons provide predictable ordering, but place "a" after "B".
 | 
			
		||||
 *
 | 
			
		||||
 * Case-sensitive comparisons compare both strings one code-point at a time using the integer
 | 
			
		||||
 * value of each code-point.
 | 
			
		||||
 */
 | 
			
		||||
function compareStringsCaseSensitive(a, b) {
 | 
			
		||||
    return compareComparableValues(a, b);
 | 
			
		||||
}
 | 
			
		||||
exports.compareStringsCaseSensitive = compareStringsCaseSensitive;
 | 
			
		||||
function getStringComparer(ignoreCase) {
 | 
			
		||||
    return ignoreCase ? compareStringsCaseInsensitive : compareStringsCaseSensitive;
 | 
			
		||||
}
 | 
			
		||||
exports.getStringComparer = getStringComparer;
 | 
			
		||||
function endsWith(str, suffix) {
 | 
			
		||||
    const expectedPos = str.length - suffix.length;
 | 
			
		||||
    return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
 | 
			
		||||
}
 | 
			
		||||
exports.endsWith = endsWith;
 | 
			
		||||
function stringContains(str, substring) {
 | 
			
		||||
    return str.indexOf(substring) !== -1;
 | 
			
		||||
}
 | 
			
		||||
exports.stringContains = stringContains;
 | 
			
		||||
function createGetCanonicalFileName(useCaseSensitiveFileNames) {
 | 
			
		||||
    return useCaseSensitiveFileNames ? identity : toFileNameLowerCase;
 | 
			
		||||
}
 | 
			
		||||
exports.createGetCanonicalFileName = createGetCanonicalFileName;
 | 
			
		||||
function startsWith(str, prefix) {
 | 
			
		||||
    return str.lastIndexOf(prefix, 0) === 0;
 | 
			
		||||
}
 | 
			
		||||
exports.startsWith = startsWith;
 | 
			
		||||
//# sourceMappingURL=core.js.map
 | 
			
		||||
							
								
								
									
										92
									
								
								node_modules/@volar/typescript/lib/typescript/corePublic.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								node_modules/@volar/typescript/lib/typescript/corePublic.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,92 @@
 | 
			
		||||
export declare const versionMajorMinor = "4.9";
 | 
			
		||||
/** The version of the TypeScript compiler release */
 | 
			
		||||
export declare const version: string;
 | 
			
		||||
/**
 | 
			
		||||
 * Type of objects whose values are all of the same type.
 | 
			
		||||
 * The `in` and `for-in` operators can *not* be safely used,
 | 
			
		||||
 * since `Object.prototype` may be modified by outside code.
 | 
			
		||||
 */
 | 
			
		||||
export interface MapLike<T> {
 | 
			
		||||
    [index: string]: T;
 | 
			
		||||
}
 | 
			
		||||
export interface SortedReadonlyArray<T> extends ReadonlyArray<T> {
 | 
			
		||||
    " __sortedArrayBrand": any;
 | 
			
		||||
}
 | 
			
		||||
export interface SortedArray<T> extends Array<T> {
 | 
			
		||||
    " __sortedArrayBrand": any;
 | 
			
		||||
}
 | 
			
		||||
/** Common read methods for ES6 Map/Set. */
 | 
			
		||||
export interface ReadonlyCollection<K> {
 | 
			
		||||
    readonly size: number;
 | 
			
		||||
    has(key: K): boolean;
 | 
			
		||||
    keys(): Iterator<K>;
 | 
			
		||||
}
 | 
			
		||||
/** Common write methods for ES6 Map/Set. */
 | 
			
		||||
export interface Collection<K> extends ReadonlyCollection<K> {
 | 
			
		||||
    delete(key: K): boolean;
 | 
			
		||||
    clear(): void;
 | 
			
		||||
}
 | 
			
		||||
/** ES6 Map interface, only read methods included. */
 | 
			
		||||
export interface ReadonlyESMap<K, V> extends ReadonlyCollection<K> {
 | 
			
		||||
    get(key: K): V | undefined;
 | 
			
		||||
    values(): Iterator<V>;
 | 
			
		||||
    entries(): Iterator<[K, V]>;
 | 
			
		||||
    forEach(action: (value: V, key: K) => void): void;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * ES6 Map interface, only read methods included.
 | 
			
		||||
 */
 | 
			
		||||
export interface ReadonlyMap<T> extends ReadonlyESMap<string, T> {
 | 
			
		||||
}
 | 
			
		||||
/** ES6 Map interface. */
 | 
			
		||||
export interface ESMap<K, V> extends ReadonlyESMap<K, V>, Collection<K> {
 | 
			
		||||
    set(key: K, value: V): this;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * ES6 Map interface.
 | 
			
		||||
 */
 | 
			
		||||
export interface Map<T> extends ESMap<string, T> {
 | 
			
		||||
}
 | 
			
		||||
export interface MapConstructor {
 | 
			
		||||
    new <K, V>(iterable?: readonly (readonly [K, V])[] | ReadonlyESMap<K, V>): ESMap<K, V>;
 | 
			
		||||
}
 | 
			
		||||
/** ES6 Set interface, only read methods included. */
 | 
			
		||||
export interface ReadonlySet<T> extends ReadonlyCollection<T> {
 | 
			
		||||
    has(value: T): boolean;
 | 
			
		||||
    values(): Iterator<T>;
 | 
			
		||||
    entries(): Iterator<[T, T]>;
 | 
			
		||||
    forEach(action: (value: T, key: T) => void): void;
 | 
			
		||||
}
 | 
			
		||||
/** ES6 Set interface. */
 | 
			
		||||
export interface Set<T> extends ReadonlySet<T>, Collection<T> {
 | 
			
		||||
    add(value: T): this;
 | 
			
		||||
    delete(value: T): boolean;
 | 
			
		||||
}
 | 
			
		||||
export interface SetConstructor {
 | 
			
		||||
    new <T>(iterable?: readonly T[] | ReadonlySet<T>): Set<T>;
 | 
			
		||||
}
 | 
			
		||||
/** ES6 Iterator type. */
 | 
			
		||||
export interface Iterator<T> {
 | 
			
		||||
    next(): {
 | 
			
		||||
        value: T;
 | 
			
		||||
        done?: false;
 | 
			
		||||
    } | {
 | 
			
		||||
        value: void;
 | 
			
		||||
        done: true;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
/** Array that is only intended to be pushed to, never read. */
 | 
			
		||||
export interface Push<T> {
 | 
			
		||||
    push(...values: T[]): void;
 | 
			
		||||
    readonly length: number;
 | 
			
		||||
}
 | 
			
		||||
export type EqualityComparer<T> = (a: T, b: T) => boolean;
 | 
			
		||||
export type Comparer<T> = (a: T, b: T) => Comparison;
 | 
			
		||||
export declare const enum Comparison {
 | 
			
		||||
    LessThan = -1,
 | 
			
		||||
    EqualTo = 0,
 | 
			
		||||
    GreaterThan = 1
 | 
			
		||||
}
 | 
			
		||||
export declare const Map: MapConstructor;
 | 
			
		||||
export declare const Set: SetConstructor;
 | 
			
		||||
//# sourceMappingURL=corePublic.d.ts.map
 | 
			
		||||
							
								
								
									
										52
									
								
								node_modules/@volar/typescript/lib/typescript/corePublic.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								node_modules/@volar/typescript/lib/typescript/corePublic.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,52 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.Set = exports.Map = exports.version = exports.versionMajorMinor = void 0;
 | 
			
		||||
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
 | 
			
		||||
// If changing the text in this section, be sure to test `configurePrerelease` too.
 | 
			
		||||
exports.versionMajorMinor = "4.9";
 | 
			
		||||
// The following is baselined as a literal template type without intervention
 | 
			
		||||
/** The version of the TypeScript compiler release */
 | 
			
		||||
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
 | 
			
		||||
exports.version = `${exports.versionMajorMinor}.0-dev`;
 | 
			
		||||
/* @internal */
 | 
			
		||||
var NativeCollections;
 | 
			
		||||
(function (NativeCollections) {
 | 
			
		||||
    const globals = typeof globalThis !== "undefined" ? globalThis :
 | 
			
		||||
        // @ts-expect-error node global
 | 
			
		||||
        typeof global !== "undefined" ? global :
 | 
			
		||||
            typeof self !== "undefined" ? self :
 | 
			
		||||
                undefined;
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the native Map implementation if it is available and compatible (i.e. supports iteration).
 | 
			
		||||
     */
 | 
			
		||||
    function tryGetNativeMap() {
 | 
			
		||||
        // Internet Explorer's Map doesn't support iteration, so don't use it.
 | 
			
		||||
        const gMap = globals?.Map;
 | 
			
		||||
        // eslint-disable-next-line local/no-in-operator
 | 
			
		||||
        const constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
 | 
			
		||||
        if (!constructor) {
 | 
			
		||||
            throw new Error("No compatible Map implementation found.");
 | 
			
		||||
        }
 | 
			
		||||
        return constructor;
 | 
			
		||||
    }
 | 
			
		||||
    NativeCollections.tryGetNativeMap = tryGetNativeMap;
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the native Set implementation if it is available and compatible (i.e. supports iteration).
 | 
			
		||||
     */
 | 
			
		||||
    function tryGetNativeSet() {
 | 
			
		||||
        // Internet Explorer's Set doesn't support iteration, so don't use it.
 | 
			
		||||
        const gSet = globals?.Set;
 | 
			
		||||
        // eslint-disable-next-line local/no-in-operator
 | 
			
		||||
        const constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
 | 
			
		||||
        if (!constructor) {
 | 
			
		||||
            throw new Error("No compatible Set implementation found.");
 | 
			
		||||
        }
 | 
			
		||||
        return constructor;
 | 
			
		||||
    }
 | 
			
		||||
    NativeCollections.tryGetNativeSet = tryGetNativeSet;
 | 
			
		||||
})(NativeCollections || (NativeCollections = {}));
 | 
			
		||||
/* @internal */
 | 
			
		||||
exports.Map = NativeCollections.tryGetNativeMap();
 | 
			
		||||
/* @internal */
 | 
			
		||||
exports.Set = NativeCollections.tryGetNativeSet();
 | 
			
		||||
//# sourceMappingURL=corePublic.js.map
 | 
			
		||||
							
								
								
									
										113
									
								
								node_modules/@volar/typescript/lib/typescript/path.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										113
									
								
								node_modules/@volar/typescript/lib/typescript/path.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,113 @@
 | 
			
		||||
import { Path } from "./types";
 | 
			
		||||
/**
 | 
			
		||||
 * Internally, we represent paths as strings with '/' as the directory separator.
 | 
			
		||||
 * When we make system calls (eg: LanguageServiceHost.getDirectory()),
 | 
			
		||||
 * we expect the host to correctly handle paths in our specified format.
 | 
			
		||||
 */
 | 
			
		||||
export declare const directorySeparator = "/";
 | 
			
		||||
/**
 | 
			
		||||
 * Determines whether a path is an absolute disk path (e.g. starts with `/`, or a dos path
 | 
			
		||||
 * like `c:`, `c:\` or `c:/`).
 | 
			
		||||
 */
 | 
			
		||||
export declare function isRootedDiskPath(path: string): boolean;
 | 
			
		||||
export declare function hasExtension(fileName: string): boolean;
 | 
			
		||||
export declare function fileExtensionIsOneOf(path: string, extensions: readonly string[]): boolean;
 | 
			
		||||
/**
 | 
			
		||||
 * Returns the path except for its basename. Semantics align with NodeJS's `path.dirname`
 | 
			
		||||
 * except that we support URLs as well.
 | 
			
		||||
 *
 | 
			
		||||
 * ```ts
 | 
			
		||||
 * // POSIX
 | 
			
		||||
 * getDirectoryPath("/path/to/file.ext") === "/path/to"
 | 
			
		||||
 * getDirectoryPath("/path/to/") === "/path"
 | 
			
		||||
 * getDirectoryPath("/") === "/"
 | 
			
		||||
 * // DOS
 | 
			
		||||
 * getDirectoryPath("c:/path/to/file.ext") === "c:/path/to"
 | 
			
		||||
 * getDirectoryPath("c:/path/to/") === "c:/path"
 | 
			
		||||
 * getDirectoryPath("c:/") === "c:/"
 | 
			
		||||
 * getDirectoryPath("c:") === "c:"
 | 
			
		||||
 * // URL
 | 
			
		||||
 * getDirectoryPath("http://typescriptlang.org/path/to/file.ext") === "http://typescriptlang.org/path/to"
 | 
			
		||||
 * getDirectoryPath("http://typescriptlang.org/path/to") === "http://typescriptlang.org/path"
 | 
			
		||||
 * getDirectoryPath("http://typescriptlang.org/") === "http://typescriptlang.org/"
 | 
			
		||||
 * getDirectoryPath("http://typescriptlang.org") === "http://typescriptlang.org"
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
export declare function getDirectoryPath(path: Path): Path;
 | 
			
		||||
/**
 | 
			
		||||
 * Returns the path except for its basename. Semantics align with NodeJS's `path.dirname`
 | 
			
		||||
 * except that we support URLs as well.
 | 
			
		||||
 *
 | 
			
		||||
 * ```ts
 | 
			
		||||
 * // POSIX
 | 
			
		||||
 * getDirectoryPath("/path/to/file.ext") === "/path/to"
 | 
			
		||||
 * getDirectoryPath("/path/to/") === "/path"
 | 
			
		||||
 * getDirectoryPath("/") === "/"
 | 
			
		||||
 * // DOS
 | 
			
		||||
 * getDirectoryPath("c:/path/to/file.ext") === "c:/path/to"
 | 
			
		||||
 * getDirectoryPath("c:/path/to/") === "c:/path"
 | 
			
		||||
 * getDirectoryPath("c:/") === "c:/"
 | 
			
		||||
 * getDirectoryPath("c:") === "c:"
 | 
			
		||||
 * // URL
 | 
			
		||||
 * getDirectoryPath("http://typescriptlang.org/path/to/file.ext") === "http://typescriptlang.org/path/to"
 | 
			
		||||
 * getDirectoryPath("http://typescriptlang.org/path/to") === "http://typescriptlang.org/path"
 | 
			
		||||
 * getDirectoryPath("http://typescriptlang.org/") === "http://typescriptlang.org/"
 | 
			
		||||
 * getDirectoryPath("http://typescriptlang.org") === "http://typescriptlang.org"
 | 
			
		||||
 * getDirectoryPath("file://server/path/to/file.ext") === "file://server/path/to"
 | 
			
		||||
 * getDirectoryPath("file://server/path/to") === "file://server/path"
 | 
			
		||||
 * getDirectoryPath("file://server/") === "file://server/"
 | 
			
		||||
 * getDirectoryPath("file://server") === "file://server"
 | 
			
		||||
 * getDirectoryPath("file:///path/to/file.ext") === "file:///path/to"
 | 
			
		||||
 * getDirectoryPath("file:///path/to") === "file:///path"
 | 
			
		||||
 * getDirectoryPath("file:///") === "file:///"
 | 
			
		||||
 * getDirectoryPath("file://") === "file://"
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
export declare function getDirectoryPath(path: string): string;
 | 
			
		||||
/**
 | 
			
		||||
 * Combines paths. If a path is absolute, it replaces any previous path. Relative paths are not simplified.
 | 
			
		||||
 *
 | 
			
		||||
 * ```ts
 | 
			
		||||
 * // Non-rooted
 | 
			
		||||
 * combinePaths("path", "to", "file.ext") === "path/to/file.ext"
 | 
			
		||||
 * combinePaths("path", "dir", "..", "to", "file.ext") === "path/dir/../to/file.ext"
 | 
			
		||||
 * // POSIX
 | 
			
		||||
 * combinePaths("/path", "to", "file.ext") === "/path/to/file.ext"
 | 
			
		||||
 * combinePaths("/path", "/to", "file.ext") === "/to/file.ext"
 | 
			
		||||
 * // DOS
 | 
			
		||||
 * combinePaths("c:/path", "to", "file.ext") === "c:/path/to/file.ext"
 | 
			
		||||
 * combinePaths("c:/path", "c:/to", "file.ext") === "c:/to/file.ext"
 | 
			
		||||
 * // URL
 | 
			
		||||
 * combinePaths("file:///path", "to", "file.ext") === "file:///path/to/file.ext"
 | 
			
		||||
 * combinePaths("file:///path", "file:///to", "file.ext") === "file:///to/file.ext"
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
export declare function combinePaths(path: string, ...paths: (string | undefined)[]): string;
 | 
			
		||||
/**
 | 
			
		||||
 * Parse a path into an array containing a root component (at index 0) and zero or more path
 | 
			
		||||
 * components (at indices > 0). The result is normalized.
 | 
			
		||||
 * If the path is relative, the root component is `""`.
 | 
			
		||||
 * If the path is absolute, the root component includes the first path separator (`/`).
 | 
			
		||||
 *
 | 
			
		||||
 * ```ts
 | 
			
		||||
 * getNormalizedPathComponents("to/dir/../file.ext", "/path/") === ["/", "path", "to", "file.ext"]
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
export declare function getNormalizedPathComponents(path: string, currentDirectory: string | undefined): string[];
 | 
			
		||||
export declare function normalizePath(path: string): string;
 | 
			
		||||
/**
 | 
			
		||||
 * Removes a trailing directory separator from a path, if it does not already have one.
 | 
			
		||||
 *
 | 
			
		||||
 * ```ts
 | 
			
		||||
 * removeTrailingDirectorySeparator("/path/to/file.ext") === "/path/to/file.ext"
 | 
			
		||||
 * removeTrailingDirectorySeparator("/path/to/file.ext/") === "/path/to/file.ext"
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
export declare function removeTrailingDirectorySeparator(path: Path): Path;
 | 
			
		||||
export declare function removeTrailingDirectorySeparator(path: string): string;
 | 
			
		||||
/**
 | 
			
		||||
 * Determines whether a `parent` path contains a `child` path using the provide case sensitivity.
 | 
			
		||||
 */
 | 
			
		||||
export declare function containsPath(parent: string, child: string, ignoreCase?: boolean): boolean;
 | 
			
		||||
export declare function containsPath(parent: string, child: string, currentDirectory: string, ignoreCase?: boolean): boolean;
 | 
			
		||||
//# sourceMappingURL=path.d.ts.map
 | 
			
		||||
							
								
								
									
										417
									
								
								node_modules/@volar/typescript/lib/typescript/path.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										417
									
								
								node_modules/@volar/typescript/lib/typescript/path.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,417 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.containsPath = exports.removeTrailingDirectorySeparator = exports.normalizePath = exports.getNormalizedPathComponents = exports.combinePaths = exports.getDirectoryPath = exports.fileExtensionIsOneOf = exports.hasExtension = exports.isRootedDiskPath = exports.directorySeparator = void 0;
 | 
			
		||||
const core_1 = require("./core");
 | 
			
		||||
/**
 | 
			
		||||
 * Internally, we represent paths as strings with '/' as the directory separator.
 | 
			
		||||
 * When we make system calls (eg: LanguageServiceHost.getDirectory()),
 | 
			
		||||
 * we expect the host to correctly handle paths in our specified format.
 | 
			
		||||
 */
 | 
			
		||||
exports.directorySeparator = "/";
 | 
			
		||||
const altDirectorySeparator = "\\";
 | 
			
		||||
const urlSchemeSeparator = "://";
 | 
			
		||||
const backslashRegExp = /\\/g;
 | 
			
		||||
//// Path Tests
 | 
			
		||||
/**
 | 
			
		||||
 * Determines whether a charCode corresponds to `/` or `\`.
 | 
			
		||||
 */
 | 
			
		||||
function isAnyDirectorySeparator(charCode) {
 | 
			
		||||
    return charCode === 47 /* CharacterCodes.slash */ || charCode === 92 /* CharacterCodes.backslash */;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Determines whether a path is an absolute disk path (e.g. starts with `/`, or a dos path
 | 
			
		||||
 * like `c:`, `c:\` or `c:/`).
 | 
			
		||||
 */
 | 
			
		||||
function isRootedDiskPath(path) {
 | 
			
		||||
    return getEncodedRootLength(path) > 0;
 | 
			
		||||
}
 | 
			
		||||
exports.isRootedDiskPath = isRootedDiskPath;
 | 
			
		||||
function hasExtension(fileName) {
 | 
			
		||||
    return (0, core_1.stringContains)(getBaseFileName(fileName), ".");
 | 
			
		||||
}
 | 
			
		||||
exports.hasExtension = hasExtension;
 | 
			
		||||
function fileExtensionIs(path, extension) {
 | 
			
		||||
    return path.length > extension.length && (0, core_1.endsWith)(path, extension);
 | 
			
		||||
}
 | 
			
		||||
function fileExtensionIsOneOf(path, extensions) {
 | 
			
		||||
    for (const extension of extensions) {
 | 
			
		||||
        if (fileExtensionIs(path, extension)) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
exports.fileExtensionIsOneOf = fileExtensionIsOneOf;
 | 
			
		||||
/**
 | 
			
		||||
 * Determines whether a path has a trailing separator (`/` or `\\`).
 | 
			
		||||
 */
 | 
			
		||||
function hasTrailingDirectorySeparator(path) {
 | 
			
		||||
    return path.length > 0 && isAnyDirectorySeparator(path.charCodeAt(path.length - 1));
 | 
			
		||||
}
 | 
			
		||||
//// Path Parsing
 | 
			
		||||
function isVolumeCharacter(charCode) {
 | 
			
		||||
    return (charCode >= 97 /* CharacterCodes.a */ && charCode <= 122 /* CharacterCodes.z */) ||
 | 
			
		||||
        (charCode >= 65 /* CharacterCodes.A */ && charCode <= 90 /* CharacterCodes.Z */);
 | 
			
		||||
}
 | 
			
		||||
function getFileUrlVolumeSeparatorEnd(url, start) {
 | 
			
		||||
    const ch0 = url.charCodeAt(start);
 | 
			
		||||
    if (ch0 === 58 /* CharacterCodes.colon */)
 | 
			
		||||
        return start + 1;
 | 
			
		||||
    if (ch0 === 37 /* CharacterCodes.percent */ && url.charCodeAt(start + 1) === 51 /* CharacterCodes._3 */) {
 | 
			
		||||
        const ch2 = url.charCodeAt(start + 2);
 | 
			
		||||
        if (ch2 === 97 /* CharacterCodes.a */ || ch2 === 65 /* CharacterCodes.A */)
 | 
			
		||||
            return start + 3;
 | 
			
		||||
    }
 | 
			
		||||
    return -1;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Returns length of the root part of a path or URL (i.e. length of "/", "x:/", "//server/share/, file:///user/files").
 | 
			
		||||
 * If the root is part of a URL, the twos-complement of the root length is returned.
 | 
			
		||||
 */
 | 
			
		||||
function getEncodedRootLength(path) {
 | 
			
		||||
    if (!path)
 | 
			
		||||
        return 0;
 | 
			
		||||
    const ch0 = path.charCodeAt(0);
 | 
			
		||||
    // POSIX or UNC
 | 
			
		||||
    if (ch0 === 47 /* CharacterCodes.slash */ || ch0 === 92 /* CharacterCodes.backslash */) {
 | 
			
		||||
        if (path.charCodeAt(1) !== ch0)
 | 
			
		||||
            return 1; // POSIX: "/" (or non-normalized "\")
 | 
			
		||||
        const p1 = path.indexOf(ch0 === 47 /* CharacterCodes.slash */ ? exports.directorySeparator : altDirectorySeparator, 2);
 | 
			
		||||
        if (p1 < 0)
 | 
			
		||||
            return path.length; // UNC: "//server" or "\\server"
 | 
			
		||||
        return p1 + 1; // UNC: "//server/" or "\\server\"
 | 
			
		||||
    }
 | 
			
		||||
    // DOS
 | 
			
		||||
    if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* CharacterCodes.colon */) {
 | 
			
		||||
        const ch2 = path.charCodeAt(2);
 | 
			
		||||
        if (ch2 === 47 /* CharacterCodes.slash */ || ch2 === 92 /* CharacterCodes.backslash */)
 | 
			
		||||
            return 3; // DOS: "c:/" or "c:\"
 | 
			
		||||
        if (path.length === 2)
 | 
			
		||||
            return 2; // DOS: "c:" (but not "c:d")
 | 
			
		||||
    }
 | 
			
		||||
    // URL
 | 
			
		||||
    const schemeEnd = path.indexOf(urlSchemeSeparator);
 | 
			
		||||
    if (schemeEnd !== -1) {
 | 
			
		||||
        const authorityStart = schemeEnd + urlSchemeSeparator.length;
 | 
			
		||||
        const authorityEnd = path.indexOf(exports.directorySeparator, authorityStart);
 | 
			
		||||
        if (authorityEnd !== -1) { // URL: "file:///", "file://server/", "file://server/path"
 | 
			
		||||
            // For local "file" URLs, include the leading DOS volume (if present).
 | 
			
		||||
            // Per https://www.ietf.org/rfc/rfc1738.txt, a host of "" or "localhost" is a
 | 
			
		||||
            // special case interpreted as "the machine from which the URL is being interpreted".
 | 
			
		||||
            const scheme = path.slice(0, schemeEnd);
 | 
			
		||||
            const authority = path.slice(authorityStart, authorityEnd);
 | 
			
		||||
            if (scheme === "file" && (authority === "" || authority === "localhost") &&
 | 
			
		||||
                isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) {
 | 
			
		||||
                const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2);
 | 
			
		||||
                if (volumeSeparatorEnd !== -1) {
 | 
			
		||||
                    if (path.charCodeAt(volumeSeparatorEnd) === 47 /* CharacterCodes.slash */) {
 | 
			
		||||
                        // URL: "file:///c:/", "file://localhost/c:/", "file:///c%3a/", "file://localhost/c%3a/"
 | 
			
		||||
                        return ~(volumeSeparatorEnd + 1);
 | 
			
		||||
                    }
 | 
			
		||||
                    if (volumeSeparatorEnd === path.length) {
 | 
			
		||||
                        // URL: "file:///c:", "file://localhost/c:", "file:///c$3a", "file://localhost/c%3a"
 | 
			
		||||
                        // but not "file:///c:d" or "file:///c%3ad"
 | 
			
		||||
                        return ~volumeSeparatorEnd;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return ~(authorityEnd + 1); // URL: "file://server/", "http://server/"
 | 
			
		||||
        }
 | 
			
		||||
        return ~path.length; // URL: "file://server", "http://server"
 | 
			
		||||
    }
 | 
			
		||||
    // relative
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Returns length of the root part of a path or URL (i.e. length of "/", "x:/", "//server/share/, file:///user/files").
 | 
			
		||||
 *
 | 
			
		||||
 * For example:
 | 
			
		||||
 * ```ts
 | 
			
		||||
 * getRootLength("a") === 0                   // ""
 | 
			
		||||
 * getRootLength("/") === 1                   // "/"
 | 
			
		||||
 * getRootLength("c:") === 2                  // "c:"
 | 
			
		||||
 * getRootLength("c:d") === 0                 // ""
 | 
			
		||||
 * getRootLength("c:/") === 3                 // "c:/"
 | 
			
		||||
 * getRootLength("c:\\") === 3                // "c:\\"
 | 
			
		||||
 * getRootLength("//server") === 7            // "//server"
 | 
			
		||||
 * getRootLength("//server/share") === 8      // "//server/"
 | 
			
		||||
 * getRootLength("\\\\server") === 7          // "\\\\server"
 | 
			
		||||
 * getRootLength("\\\\server\\share") === 8   // "\\\\server\\"
 | 
			
		||||
 * getRootLength("file:///path") === 8        // "file:///"
 | 
			
		||||
 * getRootLength("file:///c:") === 10         // "file:///c:"
 | 
			
		||||
 * getRootLength("file:///c:d") === 8         // "file:///"
 | 
			
		||||
 * getRootLength("file:///c:/path") === 11    // "file:///c:/"
 | 
			
		||||
 * getRootLength("file://server") === 13      // "file://server"
 | 
			
		||||
 * getRootLength("file://server/path") === 14 // "file://server/"
 | 
			
		||||
 * getRootLength("http://server") === 13      // "http://server"
 | 
			
		||||
 * getRootLength("http://server/path") === 14 // "http://server/"
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
function getRootLength(path) {
 | 
			
		||||
    const rootLength = getEncodedRootLength(path);
 | 
			
		||||
    return rootLength < 0 ? ~rootLength : rootLength;
 | 
			
		||||
}
 | 
			
		||||
function getDirectoryPath(path) {
 | 
			
		||||
    path = normalizeSlashes(path);
 | 
			
		||||
    // If the path provided is itself the root, then return it.
 | 
			
		||||
    const rootLength = getRootLength(path);
 | 
			
		||||
    if (rootLength === path.length)
 | 
			
		||||
        return path;
 | 
			
		||||
    // return the leading portion of the path up to the last (non-terminal) directory separator
 | 
			
		||||
    // but not including any trailing directory separator.
 | 
			
		||||
    path = removeTrailingDirectorySeparator(path);
 | 
			
		||||
    return path.slice(0, Math.max(rootLength, path.lastIndexOf(exports.directorySeparator)));
 | 
			
		||||
}
 | 
			
		||||
exports.getDirectoryPath = getDirectoryPath;
 | 
			
		||||
function getBaseFileName(path, extensions, ignoreCase) {
 | 
			
		||||
    path = normalizeSlashes(path);
 | 
			
		||||
    // if the path provided is itself the root, then it has not file name.
 | 
			
		||||
    const rootLength = getRootLength(path);
 | 
			
		||||
    if (rootLength === path.length)
 | 
			
		||||
        return "";
 | 
			
		||||
    // return the trailing portion of the path starting after the last (non-terminal) directory
 | 
			
		||||
    // separator but not including any trailing directory separator.
 | 
			
		||||
    path = removeTrailingDirectorySeparator(path);
 | 
			
		||||
    const name = path.slice(Math.max(getRootLength(path), path.lastIndexOf(exports.directorySeparator) + 1));
 | 
			
		||||
    const extension = extensions !== undefined && ignoreCase !== undefined ? getAnyExtensionFromPath(name, extensions, ignoreCase) : undefined;
 | 
			
		||||
    return extension ? name.slice(0, name.length - extension.length) : name;
 | 
			
		||||
}
 | 
			
		||||
function tryGetExtensionFromPath(path, extension, stringEqualityComparer) {
 | 
			
		||||
    if (!(0, core_1.startsWith)(extension, "."))
 | 
			
		||||
        extension = "." + extension;
 | 
			
		||||
    if (path.length >= extension.length && path.charCodeAt(path.length - extension.length) === 46 /* CharacterCodes.dot */) {
 | 
			
		||||
        const pathExtension = path.slice(path.length - extension.length);
 | 
			
		||||
        if (stringEqualityComparer(pathExtension, extension)) {
 | 
			
		||||
            return pathExtension;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
function getAnyExtensionFromPathWorker(path, extensions, stringEqualityComparer) {
 | 
			
		||||
    if (typeof extensions === "string") {
 | 
			
		||||
        return tryGetExtensionFromPath(path, extensions, stringEqualityComparer) || "";
 | 
			
		||||
    }
 | 
			
		||||
    for (const extension of extensions) {
 | 
			
		||||
        const result = tryGetExtensionFromPath(path, extension, stringEqualityComparer);
 | 
			
		||||
        if (result)
 | 
			
		||||
            return result;
 | 
			
		||||
    }
 | 
			
		||||
    return "";
 | 
			
		||||
}
 | 
			
		||||
function getAnyExtensionFromPath(path, extensions, ignoreCase) {
 | 
			
		||||
    // Retrieves any string from the final "." onwards from a base file name.
 | 
			
		||||
    // Unlike extensionFromPath, which throws an exception on unrecognized extensions.
 | 
			
		||||
    if (extensions) {
 | 
			
		||||
        return getAnyExtensionFromPathWorker(removeTrailingDirectorySeparator(path), extensions, ignoreCase ? core_1.equateStringsCaseInsensitive : core_1.equateStringsCaseSensitive);
 | 
			
		||||
    }
 | 
			
		||||
    const baseFileName = getBaseFileName(path);
 | 
			
		||||
    const extensionIndex = baseFileName.lastIndexOf(".");
 | 
			
		||||
    if (extensionIndex >= 0) {
 | 
			
		||||
        return baseFileName.substring(extensionIndex);
 | 
			
		||||
    }
 | 
			
		||||
    return "";
 | 
			
		||||
}
 | 
			
		||||
function pathComponents(path, rootLength) {
 | 
			
		||||
    const root = path.substring(0, rootLength);
 | 
			
		||||
    const rest = path.substring(rootLength).split(exports.directorySeparator);
 | 
			
		||||
    if (rest.length && !(0, core_1.lastOrUndefined)(rest))
 | 
			
		||||
        rest.pop();
 | 
			
		||||
    return [root, ...rest];
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Parse a path into an array containing a root component (at index 0) and zero or more path
 | 
			
		||||
 * components (at indices > 0). The result is not normalized.
 | 
			
		||||
 * If the path is relative, the root component is `""`.
 | 
			
		||||
 * If the path is absolute, the root component includes the first path separator (`/`).
 | 
			
		||||
 *
 | 
			
		||||
 * ```ts
 | 
			
		||||
 * // POSIX
 | 
			
		||||
 * getPathComponents("/path/to/file.ext") === ["/", "path", "to", "file.ext"]
 | 
			
		||||
 * getPathComponents("/path/to/") === ["/", "path", "to"]
 | 
			
		||||
 * getPathComponents("/") === ["/"]
 | 
			
		||||
 * // DOS
 | 
			
		||||
 * getPathComponents("c:/path/to/file.ext") === ["c:/", "path", "to", "file.ext"]
 | 
			
		||||
 * getPathComponents("c:/path/to/") === ["c:/", "path", "to"]
 | 
			
		||||
 * getPathComponents("c:/") === ["c:/"]
 | 
			
		||||
 * getPathComponents("c:") === ["c:"]
 | 
			
		||||
 * // URL
 | 
			
		||||
 * getPathComponents("http://typescriptlang.org/path/to/file.ext") === ["http://typescriptlang.org/", "path", "to", "file.ext"]
 | 
			
		||||
 * getPathComponents("http://typescriptlang.org/path/to/") === ["http://typescriptlang.org/", "path", "to"]
 | 
			
		||||
 * getPathComponents("http://typescriptlang.org/") === ["http://typescriptlang.org/"]
 | 
			
		||||
 * getPathComponents("http://typescriptlang.org") === ["http://typescriptlang.org"]
 | 
			
		||||
 * getPathComponents("file://server/path/to/file.ext") === ["file://server/", "path", "to", "file.ext"]
 | 
			
		||||
 * getPathComponents("file://server/path/to/") === ["file://server/", "path", "to"]
 | 
			
		||||
 * getPathComponents("file://server/") === ["file://server/"]
 | 
			
		||||
 * getPathComponents("file://server") === ["file://server"]
 | 
			
		||||
 * getPathComponents("file:///path/to/file.ext") === ["file:///", "path", "to", "file.ext"]
 | 
			
		||||
 * getPathComponents("file:///path/to/") === ["file:///", "path", "to"]
 | 
			
		||||
 * getPathComponents("file:///") === ["file:///"]
 | 
			
		||||
 * getPathComponents("file://") === ["file://"]
 | 
			
		||||
 */
 | 
			
		||||
function getPathComponents(path, currentDirectory = "") {
 | 
			
		||||
    path = combinePaths(currentDirectory, path);
 | 
			
		||||
    return pathComponents(path, getRootLength(path));
 | 
			
		||||
}
 | 
			
		||||
//// Path Formatting
 | 
			
		||||
/**
 | 
			
		||||
 * Formats a parsed path consisting of a root component (at index 0) and zero or more path
 | 
			
		||||
 * segments (at indices > 0).
 | 
			
		||||
 *
 | 
			
		||||
 * ```ts
 | 
			
		||||
 * getPathFromPathComponents(["/", "path", "to", "file.ext"]) === "/path/to/file.ext"
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
function getPathFromPathComponents(pathComponents) {
 | 
			
		||||
    if (pathComponents.length === 0)
 | 
			
		||||
        return "";
 | 
			
		||||
    const root = pathComponents[0] && ensureTrailingDirectorySeparator(pathComponents[0]);
 | 
			
		||||
    return root + pathComponents.slice(1).join(exports.directorySeparator);
 | 
			
		||||
}
 | 
			
		||||
//// Path Normalization
 | 
			
		||||
/**
 | 
			
		||||
 * Normalize path separators, converting `\` into `/`.
 | 
			
		||||
 */
 | 
			
		||||
function normalizeSlashes(path) {
 | 
			
		||||
    return path.indexOf("\\") !== -1
 | 
			
		||||
        ? path.replace(backslashRegExp, exports.directorySeparator)
 | 
			
		||||
        : path;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Reduce an array of path components to a more simplified path by navigating any
 | 
			
		||||
 * `"."` or `".."` entries in the path.
 | 
			
		||||
 */
 | 
			
		||||
function reducePathComponents(components) {
 | 
			
		||||
    if (!(0, core_1.some)(components))
 | 
			
		||||
        return [];
 | 
			
		||||
    const reduced = [components[0]];
 | 
			
		||||
    for (let i = 1; i < components.length; i++) {
 | 
			
		||||
        const component = components[i];
 | 
			
		||||
        if (!component)
 | 
			
		||||
            continue;
 | 
			
		||||
        if (component === ".")
 | 
			
		||||
            continue;
 | 
			
		||||
        if (component === "..") {
 | 
			
		||||
            if (reduced.length > 1) {
 | 
			
		||||
                if (reduced[reduced.length - 1] !== "..") {
 | 
			
		||||
                    reduced.pop();
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else if (reduced[0])
 | 
			
		||||
                continue;
 | 
			
		||||
        }
 | 
			
		||||
        reduced.push(component);
 | 
			
		||||
    }
 | 
			
		||||
    return reduced;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Combines paths. If a path is absolute, it replaces any previous path. Relative paths are not simplified.
 | 
			
		||||
 *
 | 
			
		||||
 * ```ts
 | 
			
		||||
 * // Non-rooted
 | 
			
		||||
 * combinePaths("path", "to", "file.ext") === "path/to/file.ext"
 | 
			
		||||
 * combinePaths("path", "dir", "..", "to", "file.ext") === "path/dir/../to/file.ext"
 | 
			
		||||
 * // POSIX
 | 
			
		||||
 * combinePaths("/path", "to", "file.ext") === "/path/to/file.ext"
 | 
			
		||||
 * combinePaths("/path", "/to", "file.ext") === "/to/file.ext"
 | 
			
		||||
 * // DOS
 | 
			
		||||
 * combinePaths("c:/path", "to", "file.ext") === "c:/path/to/file.ext"
 | 
			
		||||
 * combinePaths("c:/path", "c:/to", "file.ext") === "c:/to/file.ext"
 | 
			
		||||
 * // URL
 | 
			
		||||
 * combinePaths("file:///path", "to", "file.ext") === "file:///path/to/file.ext"
 | 
			
		||||
 * combinePaths("file:///path", "file:///to", "file.ext") === "file:///to/file.ext"
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
function combinePaths(path, ...paths) {
 | 
			
		||||
    if (path)
 | 
			
		||||
        path = normalizeSlashes(path);
 | 
			
		||||
    for (let relativePath of paths) {
 | 
			
		||||
        if (!relativePath)
 | 
			
		||||
            continue;
 | 
			
		||||
        relativePath = normalizeSlashes(relativePath);
 | 
			
		||||
        if (!path || getRootLength(relativePath) !== 0) {
 | 
			
		||||
            path = relativePath;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            path = ensureTrailingDirectorySeparator(path) + relativePath;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return path;
 | 
			
		||||
}
 | 
			
		||||
exports.combinePaths = combinePaths;
 | 
			
		||||
/**
 | 
			
		||||
 * Parse a path into an array containing a root component (at index 0) and zero or more path
 | 
			
		||||
 * components (at indices > 0). The result is normalized.
 | 
			
		||||
 * If the path is relative, the root component is `""`.
 | 
			
		||||
 * If the path is absolute, the root component includes the first path separator (`/`).
 | 
			
		||||
 *
 | 
			
		||||
 * ```ts
 | 
			
		||||
 * getNormalizedPathComponents("to/dir/../file.ext", "/path/") === ["/", "path", "to", "file.ext"]
 | 
			
		||||
 * ```
 | 
			
		||||
 */
 | 
			
		||||
function getNormalizedPathComponents(path, currentDirectory) {
 | 
			
		||||
    return reducePathComponents(getPathComponents(path, currentDirectory));
 | 
			
		||||
}
 | 
			
		||||
exports.getNormalizedPathComponents = getNormalizedPathComponents;
 | 
			
		||||
function normalizePath(path) {
 | 
			
		||||
    path = normalizeSlashes(path);
 | 
			
		||||
    // Most paths don't require normalization
 | 
			
		||||
    if (!relativePathSegmentRegExp.test(path)) {
 | 
			
		||||
        return path;
 | 
			
		||||
    }
 | 
			
		||||
    // Some paths only require cleanup of `/./` or leading `./`
 | 
			
		||||
    const simplified = path.replace(/\/\.\//g, "/").replace(/^\.\//, "");
 | 
			
		||||
    if (simplified !== path) {
 | 
			
		||||
        path = simplified;
 | 
			
		||||
        if (!relativePathSegmentRegExp.test(path)) {
 | 
			
		||||
            return path;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    // Other paths require full normalization
 | 
			
		||||
    const normalized = getPathFromPathComponents(reducePathComponents(getPathComponents(path)));
 | 
			
		||||
    return normalized && hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(normalized) : normalized;
 | 
			
		||||
}
 | 
			
		||||
exports.normalizePath = normalizePath;
 | 
			
		||||
function removeTrailingDirectorySeparator(path) {
 | 
			
		||||
    if (hasTrailingDirectorySeparator(path)) {
 | 
			
		||||
        return path.substr(0, path.length - 1);
 | 
			
		||||
    }
 | 
			
		||||
    return path;
 | 
			
		||||
}
 | 
			
		||||
exports.removeTrailingDirectorySeparator = removeTrailingDirectorySeparator;
 | 
			
		||||
function ensureTrailingDirectorySeparator(path) {
 | 
			
		||||
    if (!hasTrailingDirectorySeparator(path)) {
 | 
			
		||||
        return path + exports.directorySeparator;
 | 
			
		||||
    }
 | 
			
		||||
    return path;
 | 
			
		||||
}
 | 
			
		||||
//// Path Comparisons
 | 
			
		||||
// check path for these segments: '', '.'. '..'
 | 
			
		||||
const relativePathSegmentRegExp = /(?:\/\/)|(?:^|\/)\.\.?(?:$|\/)/;
 | 
			
		||||
function containsPath(parent, child, currentDirectory, ignoreCase) {
 | 
			
		||||
    if (typeof currentDirectory === "string") {
 | 
			
		||||
        parent = combinePaths(currentDirectory, parent);
 | 
			
		||||
        child = combinePaths(currentDirectory, child);
 | 
			
		||||
    }
 | 
			
		||||
    else if (typeof currentDirectory === "boolean") {
 | 
			
		||||
        ignoreCase = currentDirectory;
 | 
			
		||||
    }
 | 
			
		||||
    if (parent === undefined || child === undefined)
 | 
			
		||||
        return false;
 | 
			
		||||
    if (parent === child)
 | 
			
		||||
        return true;
 | 
			
		||||
    const parentComponents = reducePathComponents(getPathComponents(parent));
 | 
			
		||||
    const childComponents = reducePathComponents(getPathComponents(child));
 | 
			
		||||
    if (childComponents.length < parentComponents.length) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    const componentEqualityComparer = ignoreCase ? core_1.equateStringsCaseInsensitive : core_1.equateStringsCaseSensitive;
 | 
			
		||||
    for (let i = 0; i < parentComponents.length; i++) {
 | 
			
		||||
        const equalityComparer = i === 0 ? core_1.equateStringsCaseInsensitive : componentEqualityComparer;
 | 
			
		||||
        if (!equalityComparer(parentComponents[i], childComponents[i])) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
exports.containsPath = containsPath;
 | 
			
		||||
//# sourceMappingURL=path.js.map
 | 
			
		||||
							
								
								
									
										130
									
								
								node_modules/@volar/typescript/lib/typescript/types.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										130
									
								
								node_modules/@volar/typescript/lib/typescript/types.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,130 @@
 | 
			
		||||
export type Path = string & {
 | 
			
		||||
    __pathBrand: any;
 | 
			
		||||
};
 | 
			
		||||
export declare const enum CharacterCodes {
 | 
			
		||||
    nullCharacter = 0,
 | 
			
		||||
    maxAsciiCharacter = 127,
 | 
			
		||||
    lineFeed = 10,
 | 
			
		||||
    carriageReturn = 13,
 | 
			
		||||
    lineSeparator = 8232,
 | 
			
		||||
    paragraphSeparator = 8233,
 | 
			
		||||
    nextLine = 133,
 | 
			
		||||
    space = 32,
 | 
			
		||||
    nonBreakingSpace = 160,
 | 
			
		||||
    enQuad = 8192,
 | 
			
		||||
    emQuad = 8193,
 | 
			
		||||
    enSpace = 8194,
 | 
			
		||||
    emSpace = 8195,
 | 
			
		||||
    threePerEmSpace = 8196,
 | 
			
		||||
    fourPerEmSpace = 8197,
 | 
			
		||||
    sixPerEmSpace = 8198,
 | 
			
		||||
    figureSpace = 8199,
 | 
			
		||||
    punctuationSpace = 8200,
 | 
			
		||||
    thinSpace = 8201,
 | 
			
		||||
    hairSpace = 8202,
 | 
			
		||||
    zeroWidthSpace = 8203,
 | 
			
		||||
    narrowNoBreakSpace = 8239,
 | 
			
		||||
    ideographicSpace = 12288,
 | 
			
		||||
    mathematicalSpace = 8287,
 | 
			
		||||
    ogham = 5760,
 | 
			
		||||
    _ = 95,
 | 
			
		||||
    $ = 36,
 | 
			
		||||
    _0 = 48,
 | 
			
		||||
    _1 = 49,
 | 
			
		||||
    _2 = 50,
 | 
			
		||||
    _3 = 51,
 | 
			
		||||
    _4 = 52,
 | 
			
		||||
    _5 = 53,
 | 
			
		||||
    _6 = 54,
 | 
			
		||||
    _7 = 55,
 | 
			
		||||
    _8 = 56,
 | 
			
		||||
    _9 = 57,
 | 
			
		||||
    a = 97,
 | 
			
		||||
    b = 98,
 | 
			
		||||
    c = 99,
 | 
			
		||||
    d = 100,
 | 
			
		||||
    e = 101,
 | 
			
		||||
    f = 102,
 | 
			
		||||
    g = 103,
 | 
			
		||||
    h = 104,
 | 
			
		||||
    i = 105,
 | 
			
		||||
    j = 106,
 | 
			
		||||
    k = 107,
 | 
			
		||||
    l = 108,
 | 
			
		||||
    m = 109,
 | 
			
		||||
    n = 110,
 | 
			
		||||
    o = 111,
 | 
			
		||||
    p = 112,
 | 
			
		||||
    q = 113,
 | 
			
		||||
    r = 114,
 | 
			
		||||
    s = 115,
 | 
			
		||||
    t = 116,
 | 
			
		||||
    u = 117,
 | 
			
		||||
    v = 118,
 | 
			
		||||
    w = 119,
 | 
			
		||||
    x = 120,
 | 
			
		||||
    y = 121,
 | 
			
		||||
    z = 122,
 | 
			
		||||
    A = 65,
 | 
			
		||||
    B = 66,
 | 
			
		||||
    C = 67,
 | 
			
		||||
    D = 68,
 | 
			
		||||
    E = 69,
 | 
			
		||||
    F = 70,
 | 
			
		||||
    G = 71,
 | 
			
		||||
    H = 72,
 | 
			
		||||
    I = 73,
 | 
			
		||||
    J = 74,
 | 
			
		||||
    K = 75,
 | 
			
		||||
    L = 76,
 | 
			
		||||
    M = 77,
 | 
			
		||||
    N = 78,
 | 
			
		||||
    O = 79,
 | 
			
		||||
    P = 80,
 | 
			
		||||
    Q = 81,
 | 
			
		||||
    R = 82,
 | 
			
		||||
    S = 83,
 | 
			
		||||
    T = 84,
 | 
			
		||||
    U = 85,
 | 
			
		||||
    V = 86,
 | 
			
		||||
    W = 87,
 | 
			
		||||
    X = 88,
 | 
			
		||||
    Y = 89,
 | 
			
		||||
    Z = 90,
 | 
			
		||||
    ampersand = 38,
 | 
			
		||||
    asterisk = 42,
 | 
			
		||||
    at = 64,
 | 
			
		||||
    backslash = 92,
 | 
			
		||||
    backtick = 96,
 | 
			
		||||
    bar = 124,
 | 
			
		||||
    caret = 94,
 | 
			
		||||
    closeBrace = 125,
 | 
			
		||||
    closeBracket = 93,
 | 
			
		||||
    closeParen = 41,
 | 
			
		||||
    colon = 58,
 | 
			
		||||
    comma = 44,
 | 
			
		||||
    dot = 46,
 | 
			
		||||
    doubleQuote = 34,
 | 
			
		||||
    equals = 61,
 | 
			
		||||
    exclamation = 33,
 | 
			
		||||
    greaterThan = 62,
 | 
			
		||||
    hash = 35,
 | 
			
		||||
    lessThan = 60,
 | 
			
		||||
    minus = 45,
 | 
			
		||||
    openBrace = 123,
 | 
			
		||||
    openBracket = 91,
 | 
			
		||||
    openParen = 40,
 | 
			
		||||
    percent = 37,
 | 
			
		||||
    plus = 43,
 | 
			
		||||
    question = 63,
 | 
			
		||||
    semicolon = 59,
 | 
			
		||||
    singleQuote = 39,
 | 
			
		||||
    slash = 47,
 | 
			
		||||
    tilde = 126,
 | 
			
		||||
    backspace = 8,
 | 
			
		||||
    formFeed = 12,
 | 
			
		||||
    byteOrderMark = 65279,
 | 
			
		||||
    tab = 9,
 | 
			
		||||
    verticalTab = 11
 | 
			
		||||
}
 | 
			
		||||
//# sourceMappingURL=types.d.ts.map
 | 
			
		||||
							
								
								
									
										3
									
								
								node_modules/@volar/typescript/lib/typescript/types.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								node_modules/@volar/typescript/lib/typescript/types.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
//# sourceMappingURL=types.js.map
 | 
			
		||||
							
								
								
									
										8
									
								
								node_modules/@volar/typescript/lib/typescript/utilities.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								node_modules/@volar/typescript/lib/typescript/utilities.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
interface FileSystemEntries {
 | 
			
		||||
    readonly files: readonly string[];
 | 
			
		||||
    readonly directories: readonly string[];
 | 
			
		||||
}
 | 
			
		||||
/** @param path directory of the tsconfig.json */
 | 
			
		||||
export declare function matchFiles(path: string, extensions: readonly string[] | undefined, excludes: readonly string[] | undefined, includes: readonly string[] | undefined, useCaseSensitiveFileNames: boolean, currentDirectory: string, depth: number | undefined, getFileSystemEntries: (path: string) => FileSystemEntries, realpath: (path: string) => string): string[];
 | 
			
		||||
export {};
 | 
			
		||||
//# sourceMappingURL=utilities.d.ts.map
 | 
			
		||||
							
								
								
									
										250
									
								
								node_modules/@volar/typescript/lib/typescript/utilities.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										250
									
								
								node_modules/@volar/typescript/lib/typescript/utilities.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,250 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.matchFiles = void 0;
 | 
			
		||||
const core_1 = require("./core");
 | 
			
		||||
const path_1 = require("./path");
 | 
			
		||||
// KLUDGE: Don't assume one 'node_modules' links to another. More likely a single directory inside the node_modules is the symlink.
 | 
			
		||||
// ALso, don't assume that an `@foo` directory is linked. More likely the contents of that are linked.
 | 
			
		||||
// Reserved characters, forces escaping of any non-word (or digit), non-whitespace character.
 | 
			
		||||
// It may be inefficient (we could just match (/[-[\]{}()*+?.,\\^$|#\s]/g), but this is future
 | 
			
		||||
// proof.
 | 
			
		||||
const reservedCharacterPattern = /[^\w\s\/]/g;
 | 
			
		||||
const wildcardCharCodes = [42 /* CharacterCodes.asterisk */, 63 /* CharacterCodes.question */];
 | 
			
		||||
const commonPackageFolders = ["node_modules", "bower_components", "jspm_packages"];
 | 
			
		||||
const implicitExcludePathRegexPattern = `(?!(${commonPackageFolders.join("|")})(/|$))`;
 | 
			
		||||
const filesMatcher = {
 | 
			
		||||
    /**
 | 
			
		||||
     * Matches any single directory segment unless it is the last segment and a .min.js file
 | 
			
		||||
     * Breakdown:
 | 
			
		||||
     *  [^./]                   # matches everything up to the first . character (excluding directory separators)
 | 
			
		||||
     *  (\\.(?!min\\.js$))?     # matches . characters but not if they are part of the .min.js file extension
 | 
			
		||||
     */
 | 
			
		||||
    singleAsteriskRegexFragment: "([^./]|(\\.(?!min\\.js$))?)*",
 | 
			
		||||
    /**
 | 
			
		||||
     * Regex for the ** wildcard. Matches any number of subdirectories. When used for including
 | 
			
		||||
     * files or directories, does not match subdirectories that start with a . character
 | 
			
		||||
     */
 | 
			
		||||
    doubleAsteriskRegexFragment: `(/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`,
 | 
			
		||||
    replaceWildcardCharacter: match => replaceWildcardCharacter(match, filesMatcher.singleAsteriskRegexFragment)
 | 
			
		||||
};
 | 
			
		||||
const directoriesMatcher = {
 | 
			
		||||
    singleAsteriskRegexFragment: "[^/]*",
 | 
			
		||||
    /**
 | 
			
		||||
     * Regex for the ** wildcard. Matches any number of subdirectories. When used for including
 | 
			
		||||
     * files or directories, does not match subdirectories that start with a . character
 | 
			
		||||
     */
 | 
			
		||||
    doubleAsteriskRegexFragment: `(/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`,
 | 
			
		||||
    replaceWildcardCharacter: match => replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment)
 | 
			
		||||
};
 | 
			
		||||
const excludeMatcher = {
 | 
			
		||||
    singleAsteriskRegexFragment: "[^/]*",
 | 
			
		||||
    doubleAsteriskRegexFragment: "(/.+?)?",
 | 
			
		||||
    replaceWildcardCharacter: match => replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment)
 | 
			
		||||
};
 | 
			
		||||
const wildcardMatchers = {
 | 
			
		||||
    files: filesMatcher,
 | 
			
		||||
    directories: directoriesMatcher,
 | 
			
		||||
    exclude: excludeMatcher
 | 
			
		||||
};
 | 
			
		||||
function getRegularExpressionForWildcard(specs, basePath, usage) {
 | 
			
		||||
    const patterns = getRegularExpressionsForWildcards(specs, basePath, usage);
 | 
			
		||||
    if (!patterns || !patterns.length) {
 | 
			
		||||
        return undefined;
 | 
			
		||||
    }
 | 
			
		||||
    const pattern = patterns.map(pattern => `(${pattern})`).join("|");
 | 
			
		||||
    // If excluding, match "foo/bar/baz...", but if including, only allow "foo".
 | 
			
		||||
    const terminator = usage === "exclude" ? "($|/)" : "$";
 | 
			
		||||
    return `^(${pattern})${terminator}`;
 | 
			
		||||
}
 | 
			
		||||
function getRegularExpressionsForWildcards(specs, basePath, usage) {
 | 
			
		||||
    if (specs === undefined || specs.length === 0) {
 | 
			
		||||
        return undefined;
 | 
			
		||||
    }
 | 
			
		||||
    return (0, core_1.flatMap)(specs, spec => spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]));
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * An "includes" path "foo" is implicitly a glob "foo/** /*" (without the space) if its last component has no extension,
 | 
			
		||||
 * and does not contain any glob characters itself.
 | 
			
		||||
 */
 | 
			
		||||
function isImplicitGlob(lastPathComponent) {
 | 
			
		||||
    return !/[.*?]/.test(lastPathComponent);
 | 
			
		||||
}
 | 
			
		||||
function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter }) {
 | 
			
		||||
    let subpattern = "";
 | 
			
		||||
    let hasWrittenComponent = false;
 | 
			
		||||
    const components = (0, path_1.getNormalizedPathComponents)(spec, basePath);
 | 
			
		||||
    const lastComponent = (0, core_1.last)(components);
 | 
			
		||||
    if (usage !== "exclude" && lastComponent === "**") {
 | 
			
		||||
        return undefined;
 | 
			
		||||
    }
 | 
			
		||||
    // getNormalizedPathComponents includes the separator for the root component.
 | 
			
		||||
    // We need to remove to create our regex correctly.
 | 
			
		||||
    components[0] = (0, path_1.removeTrailingDirectorySeparator)(components[0]);
 | 
			
		||||
    if (isImplicitGlob(lastComponent)) {
 | 
			
		||||
        components.push("**", "*");
 | 
			
		||||
    }
 | 
			
		||||
    let optionalCount = 0;
 | 
			
		||||
    for (let component of components) {
 | 
			
		||||
        if (component === "**") {
 | 
			
		||||
            subpattern += doubleAsteriskRegexFragment;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            if (usage === "directories") {
 | 
			
		||||
                subpattern += "(";
 | 
			
		||||
                optionalCount++;
 | 
			
		||||
            }
 | 
			
		||||
            if (hasWrittenComponent) {
 | 
			
		||||
                subpattern += path_1.directorySeparator;
 | 
			
		||||
            }
 | 
			
		||||
            if (usage !== "exclude") {
 | 
			
		||||
                let componentPattern = "";
 | 
			
		||||
                // The * and ? wildcards should not match directories or files that start with . if they
 | 
			
		||||
                // appear first in a component. Dotted directories and files can be included explicitly
 | 
			
		||||
                // like so: **/.*/.*
 | 
			
		||||
                if (component.charCodeAt(0) === 42 /* CharacterCodes.asterisk */) {
 | 
			
		||||
                    componentPattern += "([^./]" + singleAsteriskRegexFragment + ")?";
 | 
			
		||||
                    component = component.substr(1);
 | 
			
		||||
                }
 | 
			
		||||
                else if (component.charCodeAt(0) === 63 /* CharacterCodes.question */) {
 | 
			
		||||
                    componentPattern += "[^./]";
 | 
			
		||||
                    component = component.substr(1);
 | 
			
		||||
                }
 | 
			
		||||
                componentPattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);
 | 
			
		||||
                // Patterns should not include subfolders like node_modules unless they are
 | 
			
		||||
                // explicitly included as part of the path.
 | 
			
		||||
                //
 | 
			
		||||
                // As an optimization, if the component pattern is the same as the component,
 | 
			
		||||
                // then there definitely were no wildcard characters and we do not need to
 | 
			
		||||
                // add the exclusion pattern.
 | 
			
		||||
                if (componentPattern !== component) {
 | 
			
		||||
                    subpattern += implicitExcludePathRegexPattern;
 | 
			
		||||
                }
 | 
			
		||||
                subpattern += componentPattern;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        hasWrittenComponent = true;
 | 
			
		||||
    }
 | 
			
		||||
    while (optionalCount > 0) {
 | 
			
		||||
        subpattern += ")?";
 | 
			
		||||
        optionalCount--;
 | 
			
		||||
    }
 | 
			
		||||
    return subpattern;
 | 
			
		||||
}
 | 
			
		||||
function replaceWildcardCharacter(match, singleAsteriskRegexFragment) {
 | 
			
		||||
    return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match;
 | 
			
		||||
}
 | 
			
		||||
/** @param path directory of the tsconfig.json */
 | 
			
		||||
function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory) {
 | 
			
		||||
    path = (0, path_1.normalizePath)(path);
 | 
			
		||||
    currentDirectory = (0, path_1.normalizePath)(currentDirectory);
 | 
			
		||||
    const absolutePath = (0, path_1.combinePaths)(currentDirectory, path);
 | 
			
		||||
    return {
 | 
			
		||||
        includeFilePatterns: (0, core_1.map)(getRegularExpressionsForWildcards(includes, absolutePath, "files"), pattern => `^${pattern}$`),
 | 
			
		||||
        includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"),
 | 
			
		||||
        includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"),
 | 
			
		||||
        excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"),
 | 
			
		||||
        basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames)
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
function getRegexFromPattern(pattern, useCaseSensitiveFileNames) {
 | 
			
		||||
    return new RegExp(pattern, useCaseSensitiveFileNames ? "" : "i");
 | 
			
		||||
}
 | 
			
		||||
/** @param path directory of the tsconfig.json */
 | 
			
		||||
function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath) {
 | 
			
		||||
    path = (0, path_1.normalizePath)(path);
 | 
			
		||||
    currentDirectory = (0, path_1.normalizePath)(currentDirectory);
 | 
			
		||||
    const patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
 | 
			
		||||
    const includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map(pattern => getRegexFromPattern(pattern, useCaseSensitiveFileNames));
 | 
			
		||||
    const includeDirectoryRegex = patterns.includeDirectoryPattern && getRegexFromPattern(patterns.includeDirectoryPattern, useCaseSensitiveFileNames);
 | 
			
		||||
    const excludeRegex = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, useCaseSensitiveFileNames);
 | 
			
		||||
    // Associate an array of results with each include regex. This keeps results in order of the "include" order.
 | 
			
		||||
    // If there are no "includes", then just put everything in results[0].
 | 
			
		||||
    const results = includeFileRegexes ? includeFileRegexes.map(() => []) : [[]];
 | 
			
		||||
    const visited = new Map();
 | 
			
		||||
    const toCanonical = (0, core_1.createGetCanonicalFileName)(useCaseSensitiveFileNames);
 | 
			
		||||
    for (const basePath of patterns.basePaths) {
 | 
			
		||||
        visitDirectory(basePath, (0, path_1.combinePaths)(currentDirectory, basePath), depth);
 | 
			
		||||
    }
 | 
			
		||||
    return (0, core_1.flatten)(results);
 | 
			
		||||
    function visitDirectory(path, absolutePath, depth) {
 | 
			
		||||
        const canonicalPath = toCanonical(realpath(absolutePath));
 | 
			
		||||
        if (visited.has(canonicalPath))
 | 
			
		||||
            return;
 | 
			
		||||
        visited.set(canonicalPath, true);
 | 
			
		||||
        const { files, directories } = getFileSystemEntries(path);
 | 
			
		||||
        for (const current of (0, core_1.sort)(files, core_1.compareStringsCaseSensitive)) {
 | 
			
		||||
            const name = (0, path_1.combinePaths)(path, current);
 | 
			
		||||
            const absoluteName = (0, path_1.combinePaths)(absolutePath, current);
 | 
			
		||||
            if (extensions && !(0, path_1.fileExtensionIsOneOf)(name, extensions))
 | 
			
		||||
                continue;
 | 
			
		||||
            if (excludeRegex && excludeRegex.test(absoluteName))
 | 
			
		||||
                continue;
 | 
			
		||||
            if (!includeFileRegexes) {
 | 
			
		||||
                results[0].push(name);
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                const includeIndex = (0, core_1.findIndex)(includeFileRegexes, re => re.test(absoluteName));
 | 
			
		||||
                if (includeIndex !== -1) {
 | 
			
		||||
                    results[includeIndex].push(name);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (depth !== undefined) {
 | 
			
		||||
            depth--;
 | 
			
		||||
            if (depth === 0) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        for (const current of (0, core_1.sort)(directories, core_1.compareStringsCaseSensitive)) {
 | 
			
		||||
            const name = (0, path_1.combinePaths)(path, current);
 | 
			
		||||
            const absoluteName = (0, path_1.combinePaths)(absolutePath, current);
 | 
			
		||||
            if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
 | 
			
		||||
                (!excludeRegex || !excludeRegex.test(absoluteName))) {
 | 
			
		||||
                visitDirectory(name, absoluteName, depth);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.matchFiles = matchFiles;
 | 
			
		||||
/**
 | 
			
		||||
 * Computes the unique non-wildcard base paths amongst the provided include patterns.
 | 
			
		||||
 */
 | 
			
		||||
function getBasePaths(path, includes, useCaseSensitiveFileNames) {
 | 
			
		||||
    // Storage for our results in the form of literal paths (e.g. the paths as written by the user).
 | 
			
		||||
    const basePaths = [path];
 | 
			
		||||
    if (includes) {
 | 
			
		||||
        // Storage for literal base paths amongst the include patterns.
 | 
			
		||||
        const includeBasePaths = [];
 | 
			
		||||
        for (const include of includes) {
 | 
			
		||||
            // We also need to check the relative paths by converting them to absolute and normalizing
 | 
			
		||||
            // in case they escape the base path (e.g "..\somedirectory")
 | 
			
		||||
            const absolute = (0, path_1.isRootedDiskPath)(include) ? include : (0, path_1.normalizePath)((0, path_1.combinePaths)(path, include));
 | 
			
		||||
            // Append the literal and canonical candidate base paths.
 | 
			
		||||
            includeBasePaths.push(getIncludeBasePath(absolute));
 | 
			
		||||
        }
 | 
			
		||||
        // Sort the offsets array using either the literal or canonical path representations.
 | 
			
		||||
        includeBasePaths.sort((0, core_1.getStringComparer)(!useCaseSensitiveFileNames));
 | 
			
		||||
        // Iterate over each include base path and include unique base paths that are not a
 | 
			
		||||
        // subpath of an existing base path
 | 
			
		||||
        for (const includeBasePath of includeBasePaths) {
 | 
			
		||||
            if ((0, core_1.every)(basePaths, basePath => !(0, path_1.containsPath)(basePath, includeBasePath, path, !useCaseSensitiveFileNames))) {
 | 
			
		||||
                basePaths.push(includeBasePath);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return basePaths;
 | 
			
		||||
}
 | 
			
		||||
function getIncludeBasePath(absolute) {
 | 
			
		||||
    const wildcardOffset = (0, core_1.indexOfAnyCharCode)(absolute, wildcardCharCodes);
 | 
			
		||||
    if (wildcardOffset < 0) {
 | 
			
		||||
        // No "*" or "?" in the path
 | 
			
		||||
        return !(0, path_1.hasExtension)(absolute)
 | 
			
		||||
            ? absolute
 | 
			
		||||
            : (0, path_1.removeTrailingDirectorySeparator)((0, path_1.getDirectoryPath)(absolute));
 | 
			
		||||
    }
 | 
			
		||||
    return absolute.substring(0, absolute.lastIndexOf(path_1.directorySeparator, wildcardOffset));
 | 
			
		||||
}
 | 
			
		||||
//# sourceMappingURL=utilities.js.map
 | 
			
		||||
							
								
								
									
										23
									
								
								node_modules/@volar/typescript/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								node_modules/@volar/typescript/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
{
 | 
			
		||||
	"name": "@volar/typescript",
 | 
			
		||||
	"version": "1.11.1",
 | 
			
		||||
	"license": "MIT",
 | 
			
		||||
	"files": [
 | 
			
		||||
		"**/*.js",
 | 
			
		||||
		"**/*.d.ts"
 | 
			
		||||
	],
 | 
			
		||||
	"repository": {
 | 
			
		||||
		"type": "git",
 | 
			
		||||
		"url": "https://github.com/volarjs/volar.js.git",
 | 
			
		||||
		"directory": "packages/typescript"
 | 
			
		||||
	},
 | 
			
		||||
	"dependencies": {
 | 
			
		||||
		"@volar/language-core": "1.11.1",
 | 
			
		||||
		"path-browserify": "^1.0.1"
 | 
			
		||||
	},
 | 
			
		||||
	"devDependencies": {
 | 
			
		||||
		"@types/path-browserify": "latest",
 | 
			
		||||
		"@volar/language-service": "1.11.1"
 | 
			
		||||
	},
 | 
			
		||||
	"gitHead": "188f49ee79bd2ea8e8fc32b80003c85f79868f9d"
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user