Socket
Socket
Sign inDemoInstall

@vue/language-core

Package Overview
Dependencies
Maintainers
1
Versions
81
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 1.8.4 to 1.8.5

12

out/generators/script.js

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

const templateEnd = (0, source_map_1.getLength)(codes);
codes.push(`: {} as typeof `);
codes.push(`: ${varName} as typeof `);
const scriptStart = (0, source_map_1.getLength)(codes);

@@ -727,3 +727,3 @@ codes.push(varName);

for (const className of style.classNames) {
generateCssClassProperty(i, className.text.substring(1), { start: className.offset, end: className.offset + className.text.length }, 'string', false);
generateCssClassProperty(i, className.text.substring(1), { start: className.offset, end: className.offset + className.text.length }, 'string', false, true);
}

@@ -744,6 +744,6 @@ codes.push('>;\n');

const style = _sfc.styles[i];
if (!style.scoped)
if (!style.scoped && vueCompilerOptions.experimentalResolveStyleCssClasses !== 'always')
continue;
for (const className of style.classNames) {
generateCssClassProperty(i, className.text.substring(1), { start: className.offset, end: className.offset + className.text.length }, 'boolean', true);
generateCssClassProperty(i, className.text.substring(1), { start: className.offset, end: className.offset + className.text.length }, 'boolean', true, !style.module);
}

@@ -779,3 +779,3 @@ }

return { cssIds };
function generateCssClassProperty(styleIndex, className, classRange, propertyType, optional) {
function generateCssClassProperty(styleIndex, className, classRange, propertyType, optional, referencesCodeLens) {
codes.push(`\n & { `);

@@ -788,3 +788,3 @@ codes.push([

references: true,
referencesCodeLens: true,
referencesCodeLens,
},

@@ -791,0 +791,0 @@ ]);

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

const sharedTypesSnapshot = ts.ScriptSnapshot.fromString(sharedTypes.getTypesCode(vueCompilerOptions));
const sharedTypesFileName = path_1.posix.join(host.getCurrentDirectory(), sharedTypes.baseName);
const sharedTypesFileName = path_1.posix.join(host.rootPath, sharedTypes.baseName);
return {

@@ -29,0 +29,0 @@ ...host,

@@ -30,3 +30,10 @@ "use strict";

&& !ts.isImportEqualsDeclaration(node)) {
importSectionEndOffset = node.getStart(ast, true);
const commentRanges = ts.getLeadingCommentRanges(ast.getFullText(), node.getFullStart());
if (commentRanges?.length) {
const commentRange = commentRanges.sort((a, b) => a.pos - b.pos)[0];
importSectionEndOffset = commentRange.pos;
}
else {
importSectionEndOffset = node.getStart(ast);
}
foundNonImportExportNode = true;

@@ -33,0 +40,0 @@ }

"use strict";
const sfcBlockReg = /\<(script|style)\b([\s\S]*?)\>([\s\S]*?)\<\/\1\>/g;
const langReg = /\blang\s*=\s*(['\"]?)(\S*)\b\1/;
const plugin = () => {

@@ -23,4 +25,2 @@ return {

let templateContent = content;
const sfcBlockReg = /\<(script|style)\b([\s\S]*?)\>([\s\S]*?)\<\/\1\>/g;
const langReg = /\blang\s*=\s*(['\"]?)(\S*)\b\1/;
for (const match of content.matchAll(sfcBlockReg)) {

@@ -27,0 +27,0 @@ const matchText = match[0];

"use strict";
const source_map_1 = require("@volar/source-map");
const parseSfc_1 = require("../utils/parseSfc");
const codeblockReg = /```[\s\S]+?```/g;
const inlineCodeblockReg = /`[^\n`]+?`/g;
const scriptSetupReg = /\\\<[\s\S]+?\>\n?/g;
const sfcBlockReg = /\<(script|style)\b[\s\S]*?\>([\s\S]*?)\<\/\1\>/g;
const angleBracketReg = /\<\S*\:\S*\>/g;
const linkReg = /\[[\s\S]*?\]\([\s\S]*?\)/g;
const plugin = () => {

@@ -11,8 +17,7 @@ return {

// code block
.replace(/```[\s\S]+?```/g, match => '```' + ' '.repeat(match.length - 6) + '```')
.replace(codeblockReg, match => '```' + ' '.repeat(match.length - 6) + '```')
// inline code block
.replace(/`[^\n`]+?`/g, match => `\`${' '.repeat(match.length - 2)}\``)
.replace(inlineCodeblockReg, match => `\`${' '.repeat(match.length - 2)}\``)
// # \<script setup>
.replace(/\\\<[\s\S]+?\>\n?/g, match => ' '.repeat(match.length));
const sfcBlockReg = /\<(script|style)\b[\s\S]*?\>([\s\S]*?)\<\/\1\>/g;
.replace(scriptSetupReg, match => ' '.repeat(match.length));
const codes = [];

@@ -29,5 +34,5 @@ for (const match of content.matchAll(sfcBlockReg)) {

// angle bracket: <http://foo.com>
.replace(/\<\S*\:\S*\>/g, match => ' '.repeat(match.length))
.replace(angleBracketReg, match => ' '.repeat(match.length))
// [foo](http://foo.com)
.replace(/\[[\s\S]*?\]\([\s\S]*?\)/g, match => ' '.repeat(match.length));
.replace(linkReg, match => ' '.repeat(match.length));
codes.push('<template>\n');

@@ -34,0 +39,0 @@ codes.push([content, undefined, 0]);

"use strict";
const language_core_1 = require("@volar/language-core");
const customBlockReg = /^(.*)\.customBlock_([^_]+)_(\d+)\.([^.]+)$/;
const plugin = () => {

@@ -15,3 +16,3 @@ return {

resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
const match = embeddedFile.fileName.match(/^(.*)\.customBlock_([^_]+)_(\d+)\.([^.]+)$/);
const match = embeddedFile.fileName.match(customBlockReg);
if (match) {

@@ -18,0 +19,0 @@ const index = parseInt(match[3]);

"use strict";
const language_core_1 = require("@volar/language-core");
const scriptFormatReg = /^(.*)\.script_format\.([^.]+)$/;
const scriptSetupFormatReg = /^(.*)\.scriptSetup_format\.([^.]+)$/;
const plugin = () => {

@@ -17,4 +19,4 @@ return {

resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
const scriptMatch = embeddedFile.fileName.match(/^(.*)\.script_format\.([^.]+)$/);
const scriptSetupMatch = embeddedFile.fileName.match(/^(.*)\.scriptSetup_format\.([^.]+)$/);
const scriptMatch = embeddedFile.fileName.match(scriptFormatReg);
const scriptSetupMatch = embeddedFile.fileName.match(scriptSetupFormatReg);
const script = scriptMatch ? sfc.script : scriptSetupMatch ? sfc.scriptSetup : undefined;

@@ -21,0 +23,0 @@ if (script) {

"use strict";
const language_core_1 = require("@volar/language-core");
const styleReg = /^(.*)\.style_(\d+)\.([^.]+)$/;
const plugin = () => {

@@ -15,3 +16,3 @@ return {

resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
const match = embeddedFile.fileName.match(/^(.*)\.style_(\d+)\.([^.]+)$/);
const match = embeddedFile.fileName.match(styleReg);
if (match) {

@@ -18,0 +19,0 @@ const index = parseInt(match[2]);

"use strict";
const language_core_1 = require("@volar/language-core");
const templateReg = /^(.*)\.template\.([^.]+)$/;
const plugin = () => {

@@ -13,3 +14,3 @@ return {

resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
const match = embeddedFile.fileName.match(/^(.*)\.template\.([^.]+)$/);
const match = embeddedFile.fileName.match(templateReg);
if (match && sfc.template) {

@@ -16,0 +17,0 @@ embeddedFile.capabilities = language_core_1.FileCapabilities.full;

@@ -10,2 +10,4 @@ "use strict";

const muggle = require("muggle-string");
const templateFormatReg = /^\.template_format\.ts$/;
const templateStyleCssReg = /^\.template_style\.css$/;
const plugin = ({ modules, vueCompilerOptions, compilerOptions, codegenStack }) => {

@@ -47,3 +49,3 @@ const ts = modules.typescript;

}
else if (suffix.match(/^\.template_format\.ts$/)) {
else if (suffix.match(templateFormatReg)) {
embeddedFile.parentFileName = fileName + '.template.' + sfc.template?.lang;

@@ -77,3 +79,3 @@ embeddedFile.kind = language_core_1.FileKind.TextFile;

}
else if (suffix.match(/^\.template_style\.css$/)) {
else if (suffix.match(templateStyleCssReg)) {
embeddedFile.parentFileName = fileName + '.template.' + sfc.template?.lang;

@@ -80,0 +82,0 @@ if (_tsx.htmlGen.value) {

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

const parseCssClassNames_1 = require("./utils/parseCssClassNames");
const jsxReg = /^\.(js|ts)x?$/;
class VueEmbeddedFile {

@@ -27,3 +28,3 @@ constructor(fileName, content, contentStacks) {

get mainScriptName() {
return this._allEmbeddedFiles.value.find(e => e.file.fileName.replace(this.fileName, '').match(/^\.(js|ts)x?$/))?.file.fileName ?? '';
return this._allEmbeddedFiles.value.find(e => e.file.fileName.replace(this.fileName, '').match(jsxReg))?.file.fileName ?? '';
}

@@ -30,0 +31,0 @@ get embeddedFiles() {

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

declare function __VLS_normalizeSlot<S>(s: S): S extends () => infer R ? (props: {}) => R : S;
declare function __VLS_componentProps<T, K>(comp: T, fnReturn: K):

@@ -116,0 +117,0 @@ __VLS_PickNotAny<K, {}> extends { __ctx: { props: infer P } } ? NonNullable<P>

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

const parseCssVars_1 = require("./parseCssVars");
const cssClassNameReg = /(?=([\.]{1}[a-zA-Z_]+[\w\_\-]*)[\s\.\+\{\>#\:]{1})/g;
function* parseCssClassNames(styleContent) {
styleContent = (0, parseCssVars_1.clearComments)(styleContent);
const cssClassNameRegex = /(?=([\.]{1}[a-zA-Z_]+[\w\_\-]*)[\s\.\+\{\>#\:]{1})/g;
const matchs = styleContent.matchAll(cssClassNameRegex);
for (const match of matchs) {
const matches = styleContent.matchAll(cssClassNameReg);
for (const match of matches) {
if (match.index !== undefined) {

@@ -12,0 +12,0 @@ const matchText = match[1];

"use strict";
// https://github.com/vuejs/core/blob/main/packages/compiler-sfc/src/cssVars.ts#L47-L61
Object.defineProperty(exports, "__esModule", { value: true });
exports.clearComments = exports.parseCssVars = void 0;
// https://github.com/vuejs/core/blob/main/packages/compiler-sfc/src/cssVars.ts#L47-L61
const vBindCssVarReg = /\bv-bind\(\s*(?:'([^']+)'|"([^"]+)"|([^'"][^)]*))\s*\)/g;
const commentReg1 = /\/\*([\s\S]*?)\*\//g;
const commentReg2 = /\/\/([\s\S]*?)\n/g;
function* parseCssVars(styleContent) {
styleContent = clearComments(styleContent);
const reg = /\bv-bind\(\s*(?:'([^']+)'|"([^"]+)"|([^'"][^)]*))\s*\)/g;
const matchs = styleContent.matchAll(reg);
const matchs = styleContent.matchAll(vBindCssVarReg);
for (const match of matchs) {

@@ -22,6 +24,6 @@ if (match.index !== undefined) {

return css
.replace(/\/\*([\s\S]*?)\*\//g, match => `/*${' '.repeat(match.length - 4)}*/`)
.replace(/\/\/([\s\S]*?)\n/g, match => `//${' '.repeat(match.length - 3)}\n`);
.replace(commentReg1, match => `/*${' '.repeat(match.length - 4)}*/`)
.replace(commentReg2, match => `//${' '.repeat(match.length - 3)}\n`);
}
exports.clearComments = clearComments;
//# sourceMappingURL=parseCssVars.js.map

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

catch (err) {
console.warn('Failed to resolve tsconfig path:', tsConfigPath, err);
// console.warn('Failed to resolve tsconfig path:', tsConfigPath, err);
return {

@@ -66,0 +66,0 @@ fileNames: [],

{
"name": "@vue/language-core",
"version": "1.8.4",
"version": "1.8.5",
"main": "out/index.js",

@@ -16,4 +16,4 @@ "license": "MIT",

"dependencies": {
"@volar/language-core": "~1.8.0",
"@volar/source-map": "~1.8.0",
"@volar/language-core": "~1.9.0",
"@volar/source-map": "~1.9.0",
"@vue/compiler-dom": "^3.3.0",

@@ -38,3 +38,3 @@ "@vue/reactivity": "^3.3.0",

},
"gitHead": "a62aa882911de149ae65f4c28eddfd93e1dee99d"
"gitHead": "971820b55ea42cb7e8c8ba7c35c8998d5572b420"
}

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