@vue/typescript-plugin 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.d.ts +1 -3
- package/lib/client.js +19 -12
- package/lib/server.js +1 -0
- package/package.json +3 -3
package/lib/client.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type * as net from 'net';
|
|
3
1
|
import type * as ts from 'typescript';
|
|
4
2
|
import type { NamedPipeServer } from './utils';
|
|
5
3
|
export declare function collectExtractProps(...args: Parameters<typeof import('./requests/collectExtractProps.js')['collectExtractProps']>): Promise<{
|
|
@@ -14,4 +12,4 @@ export declare function getComponentEvents(...args: Parameters<typeof import('./
|
|
|
14
12
|
export declare function getTemplateContextProps(...args: Parameters<typeof import('./requests/componentInfos.js')['getTemplateContextProps']>): Promise<string[] | null | undefined>;
|
|
15
13
|
export declare function getComponentNames(...args: Parameters<typeof import('./requests/componentInfos.js')['getComponentNames']>): Promise<string[] | null | undefined>;
|
|
16
14
|
export declare function getElementAttrs(...args: Parameters<typeof import('./requests/componentInfos.js')['getElementAttrs']>): Promise<string[] | null | undefined>;
|
|
17
|
-
export declare function
|
|
15
|
+
export declare function searchNamedPipeServerForFile(fileName: string): Promise<NamedPipeServer | undefined>;
|
package/lib/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.searchNamedPipeServerForFile = exports.getElementAttrs = exports.getComponentNames = exports.getTemplateContextProps = exports.getComponentEvents = exports.getComponentProps = exports.getQuickInfoAtPosition = exports.getPropertiesAtLocation = exports.collectExtractProps = void 0;
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const utils_1 = require("./utils");
|
|
@@ -62,17 +62,19 @@ function getElementAttrs(...args) {
|
|
|
62
62
|
}
|
|
63
63
|
exports.getElementAttrs = getElementAttrs;
|
|
64
64
|
async function sendRequest(request) {
|
|
65
|
-
const
|
|
66
|
-
if (!
|
|
65
|
+
const server = await searchNamedPipeServerForFile(request.args[0]);
|
|
66
|
+
if (!server) {
|
|
67
67
|
console.warn('[Vue Named Pipe Client] No server found for', request.args[0]);
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
const client = await (0, utils_1.connect)(server.path);
|
|
71
|
+
if (!client) {
|
|
72
|
+
console.warn('[Vue Named Pipe Client] Failed to connect to', server.path);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
return await sendRequestWorker(request, client);
|
|
74
76
|
}
|
|
75
|
-
async function
|
|
77
|
+
async function searchNamedPipeServerForFile(fileName) {
|
|
76
78
|
if (!fs.existsSync(utils_1.pipeTable)) {
|
|
77
79
|
return;
|
|
78
80
|
}
|
|
@@ -87,7 +89,7 @@ async function connectForFile(fileName) {
|
|
|
87
89
|
if (client) {
|
|
88
90
|
const response = await sendRequestWorker({ type: 'containsFile', args: [fileName] }, client);
|
|
89
91
|
if (response) {
|
|
90
|
-
return
|
|
92
|
+
return server;
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
}
|
|
@@ -95,15 +97,20 @@ async function connectForFile(fileName) {
|
|
|
95
97
|
if (!path.relative(server.currentDirectory, fileName).startsWith('..')) {
|
|
96
98
|
const client = await (0, utils_1.connect)(server.path);
|
|
97
99
|
if (client) {
|
|
98
|
-
return
|
|
100
|
+
return server;
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
|
-
exports.
|
|
105
|
+
exports.searchNamedPipeServerForFile = searchNamedPipeServerForFile;
|
|
104
106
|
function sendRequestWorker(request, client) {
|
|
105
107
|
return new Promise(resolve => {
|
|
106
|
-
|
|
108
|
+
let dataChunks = [];
|
|
109
|
+
client.on('data', chunk => {
|
|
110
|
+
dataChunks.push(chunk);
|
|
111
|
+
});
|
|
112
|
+
client.on('end', () => {
|
|
113
|
+
const data = Buffer.concat(dataChunks);
|
|
107
114
|
const text = data.toString();
|
|
108
115
|
resolve(JSON.parse(text));
|
|
109
116
|
});
|
package/lib/server.js
CHANGED
|
@@ -62,6 +62,7 @@ function startNamedPipeServer(serverKind, currentDirectory) {
|
|
|
62
62
|
console.warn('[Vue Named Pipe Server] Unknown request type:', request.type);
|
|
63
63
|
connection.write(JSON.stringify(null));
|
|
64
64
|
}
|
|
65
|
+
connection.end();
|
|
65
66
|
});
|
|
66
67
|
connection.on('error', err => console.error('[Vue Named Pipe Server]', err.message));
|
|
67
68
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/typescript-plugin",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@volar/typescript": "~2.1.0",
|
|
16
|
-
"@vue/language-core": "2.0.
|
|
16
|
+
"@vue/language-core": "2.0.4",
|
|
17
17
|
"@vue/shared": "^3.4.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/node": "latest"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "241300968fd3084c7c09139d05691a51a7800fdc"
|
|
23
23
|
}
|