New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vue/typescript-plugin

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue/typescript-plugin - npm Package Compare versions

Comparing version 2.0.16 to 2.0.17

lib/requests/types.d.ts

2

index.js

@@ -45,3 +45,3 @@ "use strict";

(0, decorateLanguageService_1.decorateLanguageService)(language, info.languageService);
(0, common_1.decorateLanguageServiceForVue)(language, info.languageService, vueOptions, ts, true);
(0, common_1.decorateLanguageServiceForVue)(language, info.languageService, vueOptions, ts, true, fileName => fileName);
(0, decorateLanguageServiceHost_1.decorateLanguageServiceHost)(ts, language, info.languageServiceHost);

@@ -48,0 +48,0 @@ (0, server_1.startNamedPipeServer)(ts, info.project.projectKind, info.project.getCurrentDirectory());

import * as vue from '@vue/language-core';
import type * as ts from 'typescript';
export declare function decorateLanguageServiceForVue(language: vue.Language, languageService: ts.LanguageService, vueOptions: vue.VueCompilerOptions, ts: typeof import('typescript'), isTsPlugin: boolean): void;
export declare function decorateLanguageServiceForVue(language: vue.Language, languageService: ts.LanguageService, vueOptions: vue.VueCompilerOptions, ts: typeof import('typescript'), isTsPlugin: boolean, getScriptId: (fileName: string) => string): void;
export declare function getComponentSpans(this: {

@@ -5,0 +5,0 @@ typescript: typeof import('typescript');

@@ -7,4 +7,4 @@ "use strict";

const componentInfos_1 = require("./requests/componentInfos");
function decorateLanguageServiceForVue(language, languageService, vueOptions, ts, isTsPlugin) {
const { getCompletionsAtPosition, getCompletionEntryDetails, getCodeFixesAtPosition, getEncodedSemanticClassifications, } = languageService;
function decorateLanguageServiceForVue(language, languageService, vueOptions, ts, isTsPlugin, getScriptId) {
const { getCompletionsAtPosition, getCompletionEntryDetails, getCodeFixesAtPosition, getEncodedSemanticClassifications, getQuickInfoAtPosition, } = languageService;
languageService.getCompletionsAtPosition = (fileName, position, options, formattingSettings) => {

@@ -40,2 +40,8 @@ const result = getCompletionsAtPosition(fileName, position, options, formattingSettings);

}
if (item.data) {
// @ts-expect-error
item.data.__isAutoImport = {
fileName,
};
}
}

@@ -61,2 +67,23 @@ }

}
// @ts-expect-error
if (args[6]?.__isAutoImport) {
// @ts-expect-error
const { fileName } = args[6]?.__isAutoImport;
const sourceScript = language.scripts.get(getScriptId(fileName));
if (sourceScript?.generated?.root instanceof vue.VueVirtualCode) {
const sfc = sourceScript.generated.root.getVueSfc();
if (!sfc?.descriptor.script && !sfc?.descriptor.scriptSetup) {
for (const codeAction of details?.codeActions ?? []) {
for (const change of codeAction.changes) {
for (const textChange of change.textChanges) {
textChange.newText = `<script setup lang="ts">${textChange.newText}</script>\n\n`;
break;
}
break;
}
break;
}
}
}
}
return details;

@@ -70,6 +97,42 @@ };

};
languageService.getQuickInfoAtPosition = (...args) => {
const result = getQuickInfoAtPosition(...args);
if (result && result.documentation?.length === 1 && result.documentation[0].text.startsWith('__VLS_emit,')) {
const [_, emitVarName, eventName] = result.documentation[0].text.split(',');
const program = languageService.getProgram();
const typeChecker = program.getTypeChecker();
const sourceFile = program.getSourceFile(args[0]);
result.documentation = undefined;
let symbolNode;
sourceFile?.forEachChild(function visit(node) {
if (ts.isIdentifier(node) && node.text === emitVarName) {
symbolNode = node;
}
if (symbolNode) {
return;
}
ts.forEachChild(node, visit);
});
if (symbolNode) {
const emitSymbol = typeChecker.getSymbolAtLocation(symbolNode);
if (emitSymbol) {
const type = typeChecker.getTypeOfSymbolAtLocation(emitSymbol, symbolNode);
const calls = type.getCallSignatures();
for (const call of calls) {
const callEventName = typeChecker.getTypeOfSymbolAtLocation(call.parameters[0], symbolNode).value;
call.getJsDocTags();
if (callEventName === eventName) {
result.documentation = call.getDocumentationComment(typeChecker);
result.tags = call.getJsDocTags();
}
}
}
}
}
return result;
};
if (isTsPlugin) {
languageService.getEncodedSemanticClassifications = (fileName, span, format) => {
const result = getEncodedSemanticClassifications(fileName, span, format);
const file = language.scripts.get(fileName);
const file = language.scripts.get(getScriptId(fileName));
if (file?.generated?.root instanceof vue.VueVirtualCode) {

@@ -76,0 +139,0 @@ const { template } = file.generated.root.sfc;

@@ -1,10 +0,3 @@

import { Language } from '@vue/language-core';
import type * as ts from 'typescript';
export declare function collectExtractProps(this: {
typescript: typeof import('typescript');
languageService: ts.LanguageService;
language: Language;
isTsPlugin: boolean;
getFileId: (fileName: string) => string;
}, fileName: string, templateCodeRange: [number, number]): {
import type { RequestContext } from './types';
export declare function collectExtractProps(this: RequestContext, fileName: string, templateCodeRange: [number, number]): {
name: string;

@@ -11,0 +4,0 @@ type: string;

import * as vue from '@vue/language-core';
import type * as ts from 'typescript';
export declare function getComponentProps(this: {
typescript: typeof import('typescript');
languageService: ts.LanguageService;
language: vue.Language;
getFileId: (fileName: string) => string;
}, fileName: string, tag: string, requiredOnly?: boolean): string[] | undefined;
import type { RequestContext } from './types';
export declare function getComponentProps(this: RequestContext, fileName: string, tag: string, requiredOnly?: boolean): string[] | undefined;
export declare function getComponentEvents(this: {

@@ -10,0 +6,0 @@ typescript: typeof import('typescript');

import type * as ts from 'typescript';
export declare function getImportPathForFile(this: {
typescript: typeof import('typescript');
languageService: ts.LanguageService;
languageServiceHost: ts.LanguageServiceHost;
}, fileName: string, incomingFileName: string, preferences: ts.UserPreferences): string | undefined;
import type { RequestContext } from './types';
export declare function getImportPathForFile(this: RequestContext, fileName: string, incomingFileName: string, preferences: ts.UserPreferences): string | undefined;

@@ -1,9 +0,2 @@

import { Language } from '@vue/language-core';
import type * as ts from 'typescript';
export declare function getPropertiesAtLocation(this: {
typescript: typeof import('typescript');
languageService: ts.LanguageService;
language: Language;
isTsPlugin: boolean;
getFileId: (fileName: string) => string;
}, fileName: string, position: number): string[] | undefined;
import type { RequestContext } from './types';
export declare function getPropertiesAtLocation(this: RequestContext, fileName: string, position: number): string[] | undefined;

@@ -1,4 +0,2 @@

import type * as ts from 'typescript';
export declare function getQuickInfoAtPosition(this: {
languageService: ts.LanguageService;
}, fileName: string, position: number): ts.QuickInfo | undefined;
import type { RequestContext } from './types';
export declare function getQuickInfoAtPosition(this: RequestContext, fileName: string, position: number): import("typescript").QuickInfo | undefined;

@@ -0,3 +1,3 @@

import type { Language, VueCompilerOptions } from '@vue/language-core';
import type * as ts from 'typescript';
import type { Language, VueCompilerOptions } from '@vue/language-core';
export interface Request {

@@ -4,0 +4,0 @@ type: 'projectInfoForFile' | 'collectExtractProps' | 'getImportPathForFile' | 'getPropertiesAtLocation' | 'getQuickInfoAtPosition' | 'getComponentProps' | 'getComponentEvents' | 'getTemplateContextProps' | 'getComponentNames' | 'getElementAttrs';

@@ -41,3 +41,2 @@ "use strict";

language: project.language,
vueOptions: project.vueOptions,
isTsPlugin: true,

@@ -44,0 +43,0 @@ getFileId: (fileName) => fileName,

{
"name": "@vue/typescript-plugin",
"version": "2.0.16",
"version": "2.0.17",
"license": "MIT",

@@ -15,4 +15,4 @@ "files": [

"dependencies": {
"@volar/typescript": "~2.2.0",
"@vue/language-core": "2.0.16",
"@volar/typescript": "~2.2.2",
"@vue/language-core": "2.0.17",
"@vue/shared": "^3.4.0"

@@ -23,3 +23,3 @@ },

},
"gitHead": "95b78c38cbf75481ebb59e11956b592346f01d92"
"gitHead": "968039cbb07961f318b4bf122bfa8e3e4a824277"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc