@vue/typescript-plugin
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -1,3 +0,1 @@ | ||
/// <reference types="node" /> | ||
import type * as net from 'net'; | ||
import type * as ts from 'typescript'; | ||
@@ -17,2 +15,2 @@ import type { NamedPipeServer } from './utils'; | ||
export declare function getElementAttrs(...args: Parameters<typeof import('./requests/componentInfos.js')['getElementAttrs']>): Promise<string[] | null | undefined>; | ||
export declare function connectForFile(fileName: string): Promise<readonly [net.Socket, NamedPipeServer] | undefined>; | ||
export declare function searchNamedPipeServerForFile(fileName: string): Promise<NamedPipeServer | undefined>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.connectForFile = exports.getElementAttrs = exports.getComponentNames = exports.getTemplateContextProps = exports.getComponentEvents = exports.getComponentProps = exports.getQuickInfoAtPosition = exports.getPropertiesAtLocation = exports.collectExtractProps = void 0; | ||
exports.searchNamedPipeServerForFile = exports.getElementAttrs = exports.getComponentNames = exports.getTemplateContextProps = exports.getComponentEvents = exports.getComponentProps = exports.getQuickInfoAtPosition = exports.getPropertiesAtLocation = exports.collectExtractProps = void 0; | ||
const fs = require("fs"); | ||
@@ -65,13 +65,15 @@ const path = require("path"); | ||
async function sendRequest(request) { | ||
const connected = await connectForFile(request.args[0]); | ||
if (!connected) { | ||
const server = await searchNamedPipeServerForFile(request.args[0]); | ||
if (!server) { | ||
console.warn('[Vue Named Pipe Client] No server found for', request.args[0]); | ||
return; | ||
} | ||
const [client] = connected; | ||
const result = await sendRequestWorker(request, client); | ||
client.end(); | ||
return result; | ||
const client = await (0, utils_1.connect)(server.path); | ||
if (!client) { | ||
console.warn('[Vue Named Pipe Client] Failed to connect to', server.path); | ||
return; | ||
} | ||
return await sendRequestWorker(request, client); | ||
} | ||
async function connectForFile(fileName) { | ||
async function searchNamedPipeServerForFile(fileName) { | ||
if (!fs.existsSync(utils_1.pipeTable)) { | ||
@@ -91,3 +93,3 @@ return; | ||
if (response) { | ||
return [client, server]; | ||
return server; | ||
} | ||
@@ -100,3 +102,3 @@ } | ||
if (client) { | ||
return [client, server]; | ||
return server; | ||
} | ||
@@ -106,6 +108,11 @@ } | ||
} | ||
exports.connectForFile = connectForFile; | ||
exports.searchNamedPipeServerForFile = searchNamedPipeServerForFile; | ||
function sendRequestWorker(request, client) { | ||
return new Promise(resolve => { | ||
client.once('data', data => { | ||
let dataChunks = []; | ||
client.on('data', chunk => { | ||
dataChunks.push(chunk); | ||
}); | ||
client.on('end', () => { | ||
const data = Buffer.concat(dataChunks); | ||
const text = data.toString(); | ||
@@ -112,0 +119,0 @@ resolve(JSON.parse(text)); |
@@ -65,2 +65,3 @@ "use strict"; | ||
} | ||
connection.end(); | ||
}); | ||
@@ -67,0 +68,0 @@ connection.on('error', err => console.error('[Vue Named Pipe Server]', err.message)); |
{ | ||
"name": "@vue/typescript-plugin", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"license": "MIT", | ||
@@ -16,3 +16,3 @@ "files": [ | ||
"@volar/typescript": "~2.1.0", | ||
"@vue/language-core": "2.0.3", | ||
"@vue/language-core": "2.0.4", | ||
"@vue/shared": "^3.4.0" | ||
@@ -23,3 +23,3 @@ }, | ||
}, | ||
"gitHead": "fc1e288c8c0c82e6730781006d84a2676b5266ff" | ||
"gitHead": "241300968fd3084c7c09139d05691a51a7800fdc" | ||
} |
43776
925
+ Added@vue/language-core@2.0.4(transitive)
- Removed@vue/language-core@2.0.3(transitive)
Updated@vue/language-core@2.0.4