Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vue/language-service

Package Overview
Dependencies
Maintainers
0
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue/language-service - npm Package Compare versions

Comparing version 2.1.6 to 2.1.8

16

lib/ideFeatures/nameCasing.js

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

const language_core_1 = require("@vue/language-core");
const computeds_1 = require("computeds");
const alien_signals_1 = require("alien-signals");
const types_1 = require("../types");

@@ -21,3 +21,3 @@ async function convertTagName(context, uri, casing, tsPluginClient) {

}
const desc = rootCode.sfc;
const desc = rootCode._sfc;
if (!desc.template) {

@@ -58,3 +58,3 @@ return;

}
const desc = rootCode.sfc;
const desc = rootCode._sfc;
if (!desc.template) {

@@ -140,4 +140,4 @@ return;

const result = new Set();
if (file.sfc.template?.ast) {
for (const element of vue.forEachElementNode(file.sfc.template.ast)) {
if (file._sfc.template?.ast) {
for (const element of vue.forEachElementNode(file._sfc.template.ast)) {
if (element.tagType === 1) {

@@ -162,7 +162,7 @@ if (element.tag !== (0, language_core_1.hyphenateTag)(element.tag)) {

if (!map.has(sourceFile)) {
const getter = (0, computeds_1.computed)(() => {
const getter = (0, alien_signals_1.computed)(() => {
if (!(sourceFile instanceof vue.VueVirtualCode)) {
return;
}
const ast = sourceFile.sfc.template?.ast;
const ast = sourceFile._sfc.template?.ast;
const tags = new Map();

@@ -207,4 +207,4 @@ if (ast) {

}
return map.get(sourceFile)() ?? new Map();
return map.get(sourceFile).get() ?? new Map();
}
//# sourceMappingURL=nameCasing.js.map

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

const newName = (0, shared_1.capitalize)((0, shared_1.camelize)(baseName));
const { sfc } = vueVirtualCode;
const { _sfc: sfc } = vueVirtualCode;
const script = sfc.scriptSetup ?? sfc.script;

@@ -51,0 +51,0 @@ if (!script) {

@@ -20,8 +20,8 @@ "use strict";

const result = [];
const codegen = language_core_1.tsCodegen.get(sourceScript.generated.root.sfc);
const scopedClasses = codegen?.generatedTemplate()?.scopedClasses ?? [];
const codegen = language_core_1.tsCodegen.get(sourceScript.generated.root._sfc);
const scopedClasses = codegen?.generatedTemplate.get()?.scopedClasses ?? [];
const styleClasses = new Map();
const option = sourceScript.generated.root.vueCompilerOptions.experimentalResolveStyleCssClasses;
for (let i = 0; i < sourceScript.generated.root.sfc.styles.length; i++) {
const style = sourceScript.generated.root.sfc.styles[i];
for (let i = 0; i < sourceScript.generated.root._sfc.styles.length; i++) {
const style = sourceScript.generated.root._sfc.styles[i];
if (option === 'always' || (option === 'scoped' && style.scoped)) {

@@ -28,0 +28,0 @@ for (const className of style.classNames) {

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

}
const { sfc } = sourceScript.generated.root;
const { _sfc: sfc } = sourceScript.generated.root;
const script = sfc.scriptSetup ?? sfc.script;

@@ -66,3 +66,3 @@ if (!sfc.template || !script) {

const sfcDocument = context.documents.get(sourceScript.id, sourceScript.languageId, sourceScript.snapshot);
const { sfc } = sourceScript.generated.root;
const { _sfc: sfc } = sourceScript.generated.root;
const script = sfc.scriptSetup ?? sfc.script;

@@ -69,0 +69,0 @@ if (!sfc.template || !script) {

@@ -7,2 +7,2 @@ import type { LanguageServicePlugin } from '../types';

*/
export declare function findDestructuredProps(ts: typeof import('typescript'), ast: ts.SourceFile, props: string[]): [ts.Identifier, boolean][];
export declare function findDestructuredProps(ts: typeof import('typescript'), ast: ts.SourceFile, props: Set<string>): [ts.Identifier, boolean][];

@@ -23,26 +23,30 @@ "use strict";

if (virtualCode instanceof language_core_1.VueVirtualCode) {
const codegen = language_core_1.tsCodegen.get(virtualCode.sfc);
const codegen = language_core_1.tsCodegen.get(virtualCode._sfc);
const inlayHints = [
...codegen?.generatedTemplate()?.inlayHints ?? [],
...codegen?.generatedScript()?.inlayHints ?? [],
...codegen?.generatedTemplate.get()?.inlayHints ?? [],
...codegen?.generatedScript.get()?.inlayHints ?? [],
];
const scriptSetupRanges = codegen?.scriptSetupRanges();
if (scriptSetupRanges?.props.destructured && virtualCode.sfc.scriptSetup?.ast) {
for (const [prop, isShorthand] of findDestructuredProps(ts, virtualCode.sfc.scriptSetup.ast, scriptSetupRanges.props.destructured)) {
const name = prop.text;
const end = prop.getEnd();
const pos = isShorthand ? end : end - name.length;
const label = isShorthand ? `: props.${name}` : 'props.';
inlayHints.push({
blockName: 'scriptSetup',
offset: pos,
setting: 'vue.inlayHints.destructuredProps',
label,
});
const scriptSetupRanges = codegen?.scriptSetupRanges.get();
if (scriptSetupRanges?.props.destructured && virtualCode._sfc.scriptSetup?.ast) {
const setting = 'vue.inlayHints.destructuredProps';
settings[setting] ??= await context.env.getConfiguration?.(setting) ?? false;
if (settings[setting]) {
for (const [prop, isShorthand] of findDestructuredProps(ts, virtualCode._sfc.scriptSetup.ast, scriptSetupRanges.props.destructured)) {
const name = prop.text;
const end = prop.getEnd();
const pos = isShorthand ? end : end - name.length;
const label = isShorthand ? `: props.${name}` : 'props.';
inlayHints.push({
blockName: 'scriptSetup',
offset: pos,
setting,
label,
});
}
}
}
const blocks = [
virtualCode.sfc.template,
virtualCode.sfc.script,
virtualCode.sfc.scriptSetup,
virtualCode._sfc.template,
virtualCode._sfc.script,
virtualCode._sfc.scriptSetup,
];

@@ -83,3 +87,3 @@ const start = document.offsetAt(range.start);

function findDestructuredProps(ts, ast, props) {
const rootScope = {};
const rootScope = Object.create(null);
const scopeStack = [rootScope];

@@ -140,3 +144,3 @@ let currentScope = rootScope;

&& initializer.expression.getText(ast) === 'defineProps';
for (const id of (0, common_1.collectIdentifiers)(ts, name)) {
for (const [id] of (0, common_1.collectIdentifiers)(ts, name)) {
if (isDefineProps) {

@@ -156,3 +160,3 @@ excludedIds.add(id);

for (const p of parameters) {
for (const id of (0, common_1.collectIdentifiers)(ts, p)) {
for (const [id] of (0, common_1.collectIdentifiers)(ts, p)) {
registerLocalBinding(id);

@@ -159,0 +163,0 @@ }

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

const blockTypes = ['template', 'script', 'style'];
for (const customBlock of vueCode.sfc.customBlocks) {
for (const customBlock of vueCode._sfc.customBlocks) {
blockTypes.push(customBlock.type);

@@ -70,3 +70,3 @@ }

const result = [];
const descriptor = vueSourceFile.sfc;
const descriptor = vueSourceFile._sfc;
if (descriptor.template) {

@@ -73,0 +73,0 @@ result.push({

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

const templateErrors = [];
const { template } = code.sfc;
const { template } = code._sfc;
if (template) {

@@ -331,6 +331,6 @@ for (const error of template.errors) {

|| !(sourceScript.generated?.root instanceof language_core_1.VueVirtualCode)
|| !sourceScript.generated.root.sfc.template) {
|| !sourceScript.generated.root._sfc.template) {
return [];
}
const { template } = sourceScript.generated.root.sfc;
const { template } = sourceScript.generated.root._sfc;
const spans = common_1.getComponentSpans.call({

@@ -402,4 +402,4 @@ files: context.language.scripts,

}
const scriptSetupRanges = vueCode.sfc.scriptSetup
? (0, language_core_1.parseScriptSetupRanges)(ts, vueCode.sfc.scriptSetup.ast, vueCompilerOptions)
const scriptSetupRanges = vueCode._sfc.scriptSetup
? (0, language_core_1.parseScriptSetupRanges)(ts, vueCode._sfc.scriptSetup.ast, vueCompilerOptions)
: undefined;

@@ -417,3 +417,3 @@ const names = new Set();

for (const binding of scriptSetupRanges?.bindings ?? []) {
const name = vueCode.sfc.scriptSetup.content.substring(binding.start, binding.end);
const name = vueCode._sfc.scriptSetup.content.substring(binding.start, binding.end);
if (casing.tag === types_1.TagNameCasing.Kebab) {

@@ -453,3 +453,3 @@ names.add((0, language_core_1.hyphenateTag)(name));

const attributes = [];
const _tsCodegen = language_core_1.tsCodegen.get(vueCode.sfc);
const _tsCodegen = language_core_1.tsCodegen.get(vueCode._sfc);
if (_tsCodegen) {

@@ -464,4 +464,4 @@ if (!templateContextProps) {

let ctxVars = [
..._tsCodegen.scriptRanges()?.bindings.map(binding => vueCode.sfc.script.content.substring(binding.start, binding.end)) ?? [],
..._tsCodegen.scriptSetupRanges()?.bindings.map(binding => vueCode.sfc.scriptSetup.content.substring(binding.start, binding.end)) ?? [],
..._tsCodegen.scriptRanges.get()?.bindings.map(binding => vueCode._sfc.script.content.substring(binding.start, binding.end)) ?? [],
..._tsCodegen.scriptSetupRanges.get()?.bindings.map(binding => vueCode._sfc.scriptSetup.content.substring(binding.start, binding.end)) ?? [],
...templateContextProps,

@@ -625,3 +625,3 @@ ];

}
completionList.items = completionList.items.filter(item => !specialTags.has(item.label));
completionList.items = completionList.items.filter(item => !specialTags.has(parseLabel(item.label).name));
const htmlDocumentations = new Map();

@@ -638,3 +638,3 @@ for (const item of completionList.items) {

const name = resolvedLabelKey.tag;
item.label = name;
item.label = resolvedLabelKey.leadingSlash ? '/' + name : name;
if (item.textEdit) {

@@ -689,2 +689,3 @@ item.textEdit.newText = name;

prop: propName,
leadingSlash: false
};

@@ -821,2 +822,10 @@ }

;
function parseLabel(label) {
const leadingSlash = label.startsWith('/');
const name = label.slice(leadingSlash ? 1 : 0);
return {
name,
leadingSlash
};
}
function parseItemKey(type, tag, prop) {

@@ -829,4 +838,5 @@ return '__VLS_data=' + type + ',' + tag + ',' + prop;

function resolveItemKey(key) {
if (isItemKey(key)) {
const strs = key.slice('__VLS_data='.length).split(',');
const { leadingSlash, name } = parseLabel(key);
if (isItemKey(name)) {
const strs = name.slice('__VLS_data='.length).split(',');
return {

@@ -836,2 +846,3 @@ type: strs[0],

prop: strs[2],
leadingSlash
};

@@ -838,0 +849,0 @@ }

{
"name": "@vue/language-service",
"version": "2.1.6",
"version": "2.1.8",
"license": "MIT",

@@ -10,2 +10,3 @@ "files": [

],
"sideEffects": false,
"repository": {

@@ -20,10 +21,10 @@ "type": "git",

"dependencies": {
"@volar/language-core": "~2.4.1",
"@volar/language-service": "~2.4.1",
"@volar/typescript": "~2.4.1",
"@vue/compiler-dom": "^3.4.0",
"@vue/language-core": "2.1.6",
"@vue/shared": "^3.4.0",
"@vue/typescript-plugin": "2.1.6",
"computeds": "^0.0.1",
"@volar/language-core": "~2.4.8",
"@volar/language-service": "~2.4.8",
"@volar/typescript": "~2.4.8",
"@vue/compiler-dom": "^3.5.0",
"@vue/language-core": "2.1.8",
"@vue/shared": "^3.5.0",
"@vue/typescript-plugin": "2.1.8",
"alien-signals": "^0.2.0",
"path-browserify": "^1.0.1",

@@ -45,6 +46,6 @@ "volar-service-css": "0.0.62",

"@types/path-browserify": "latest",
"@volar/kit": "~2.4.1",
"@volar/kit": "~2.4.8",
"vscode-languageserver-protocol": "^3.17.5"
},
"gitHead": "fd61953ce9eb924eeaf4df0bf8d2237267321194"
"gitHead": "25cccedc53e7361ed4e34296d6ecd43d7de2a095"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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