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

@vue/language-core

Package Overview
Dependencies
Maintainers
0
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue/language-core - npm Package Compare versions

Comparing version

to
2.2.8

1

lib/codegen/template/elementEvents.d.ts

@@ -9,3 +9,2 @@ import * as CompilerDOM from '@vue/compiler-dom';

export declare function generateEventExpression(options: TemplateCodegenOptions, ctx: TemplateCodegenContext, prop: CompilerDOM.DirectiveNode): Generator<Code>;
export declare function generateModelEventExpression(options: TemplateCodegenOptions, ctx: TemplateCodegenContext, prop: CompilerDOM.DirectiveNode): Generator<Code>;
export declare function isCompoundExpression(ts: typeof import('typescript'), ast: ts.SourceFile): boolean;

46

lib/codegen/template/elementEvents.js

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

exports.generateEventExpression = generateEventExpression;
exports.generateModelEventExpression = generateModelEventExpression;
exports.isCompoundExpression = isCompoundExpression;

@@ -21,4 +20,5 @@ const CompilerDOM = require("@vue/compiler-dom");

if (prop.type === CompilerDOM.NodeTypes.DIRECTIVE
&& (prop.name === 'on' && (prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION && prop.arg.isStatic)
|| prop.name === 'model' && (!prop.arg || prop.arg.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION && prop.arg.isStatic))) {
&& prop.name === 'on'
&& prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION
&& prop.arg.isStatic) {
ctx.currentComponent.used = true;

@@ -33,27 +33,17 @@ if (!emitVar) {

}
let source = prop.arg?.loc.source ?? 'model-value';
let start = prop.arg?.loc.start.offset;
let propPrefix = 'on-';
let source = prop.arg.loc.source;
let start = prop.arg.loc.start.offset;
let propPrefix = 'on';
let emitPrefix = '';
if (prop.name === 'model') {
propPrefix = 'onUpdate:';
emitPrefix = 'update:';
}
else if (source.startsWith('vue:')) {
if (source.startsWith('vue:')) {
source = source.slice('vue:'.length);
start = start + 'vue:'.length;
propPrefix = 'onVnode-';
propPrefix = 'onVnode';
emitPrefix = 'vnode-';
}
yield `(): __VLS_NormalizeComponentEvent<typeof ${propsVar}, typeof ${eventsVar}, '${(0, shared_1.camelize)(propPrefix + source)}', '${emitPrefix + source}', '${(0, shared_1.camelize)(emitPrefix + source)}'> => ({${utils_1.newLine}`;
if (prop.name === 'on') {
yield* generateEventArg(ctx, source, start, propPrefix.slice(0, -1));
yield `: `;
yield* generateEventExpression(options, ctx, prop);
}
else {
yield `'${(0, shared_1.camelize)(propPrefix + source)}': `;
yield* generateModelEventExpression(options, ctx, prop);
}
yield `})${utils_1.endOfLine}`;
yield `const ${ctx.getInternalVariable()}: __VLS_NormalizeComponentEvent<typeof ${propsVar}, typeof ${eventsVar}, '${(0, shared_1.camelize)(propPrefix + '-' + source)}', '${emitPrefix}${source}', '${(0, shared_1.camelize)(emitPrefix + source)}'> = {${utils_1.newLine}`;
yield* generateEventArg(ctx, source, start, propPrefix);
yield `: `;
yield* generateEventExpression(options, ctx, prop);
yield `}${utils_1.endOfLine}`;
}

@@ -121,12 +111,2 @@ }

}
function* generateModelEventExpression(options, ctx, prop) {
if (prop.exp?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
yield `(...[$event]) => (`;
yield* (0, interpolation_1.generateInterpolation)(options, ctx, 'template', ctx.codeFeatures.verification, prop.exp.content, prop.exp.loc.start.offset, prop.exp.loc);
yield ` = $event)`;
}
else {
yield `() => {}`;
}
}
function isCompoundExpression(ts, ast) {

@@ -133,0 +113,0 @@ let result = true;

{
"name": "@vue/language-core",
"version": "2.2.6",
"version": "2.2.8",
"license": "MIT",

@@ -40,3 +40,3 @@ "files": [

},
"gitHead": "f2088e256dc0220db9549d28d9f865a5711dcfbe"
"gitHead": "cdf00e6f19971260607ea2347924b94126a254fc"
}