@vue/language-core
Advanced tools
Comparing version 2.1.8 to 2.1.10
@@ -91,5 +91,3 @@ "use strict"; | ||
function __VLS_getVForSourceType<T extends any[]>(source: T): [ | ||
item: ${(target >= 3 ? `import('${lib}').Reactive<T[number]>` : | ||
target >= 2.7 ? `import('${lib}').UnwrapNestedRefs<T[number]>` : | ||
`T[number]`)}, | ||
item: T[number], | ||
key: number, | ||
@@ -96,0 +94,0 @@ index: number, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateComponentSelf = generateComponentSelf; | ||
const path = require("path-browserify"); | ||
const common_1 = require("../common"); | ||
@@ -57,3 +58,3 @@ const component_1 = require("./component"); | ||
else if (options.sfc.script) { | ||
yield `let __VLS_self!: typeof import('./${options.fileBaseName}').default${common_1.endOfLine}`; | ||
yield `let __VLS_self!: typeof import('./${path.basename(options.fileName)}').default${common_1.endOfLine}`; | ||
} | ||
@@ -60,0 +61,0 @@ else { |
@@ -16,3 +16,3 @@ import type { Mapping } from '@volar/language-core'; | ||
export interface ScriptCodegenOptions { | ||
fileBaseName: string; | ||
fileName: string; | ||
ts: typeof ts; | ||
@@ -19,0 +19,0 @@ compilerOptions: ts.CompilerOptions; |
@@ -6,2 +6,3 @@ "use strict"; | ||
exports.generateScriptSectionPartiallyEnding = generateScriptSectionPartiallyEnding; | ||
const path = require("path-browserify"); | ||
const common_1 = require("../common"); | ||
@@ -42,3 +43,7 @@ const globalTypes_1 = require("../globalTypes"); | ||
if (typeof globalTypes === 'object') { | ||
yield `/// <reference types="${globalTypes.absolutePath}" />${common_1.newLine}`; | ||
let relativePath = path.relative(path.dirname(options.fileName), globalTypes.absolutePath); | ||
if (relativePath !== globalTypes.absolutePath && !relativePath.startsWith('./') && !relativePath.startsWith('../')) { | ||
relativePath = './' + relativePath; | ||
} | ||
yield `/// <reference types="${relativePath}" />${common_1.newLine}`; | ||
} | ||
@@ -45,0 +50,0 @@ else { |
@@ -159,17 +159,21 @@ "use strict"; | ||
if (scriptSetupRanges.cssModules.length) { | ||
for (const { define: { arg, exp } } of scriptSetupRanges.cssModules) { | ||
for (const { define } of scriptSetupRanges.cssModules) { | ||
setupCodeModifies.push([ | ||
arg ? [ | ||
[`(`], | ||
define.start, | ||
define.start | ||
], [ | ||
define.arg ? [ | ||
` as Omit<__VLS_StyleModules, '$style'>[`, | ||
(0, common_1.generateSfcBlockSection)(scriptSetup, arg.start, arg.end, index_1.codeFeatures.all), | ||
`]` | ||
(0, common_1.generateSfcBlockSection)(scriptSetup, define.arg.start, define.arg.end, index_1.codeFeatures.all), | ||
`])` | ||
] : [ | ||
` as __VLS_StyleModules[`, | ||
['', scriptSetup.name, exp.start, index_1.codeFeatures.verification], | ||
['', scriptSetup.name, define.exp.start, index_1.codeFeatures.verification], | ||
`'$style'`, | ||
['', scriptSetup.name, exp.end, index_1.codeFeatures.verification], | ||
`]` | ||
['', scriptSetup.name, define.exp.end, index_1.codeFeatures.verification], | ||
`])` | ||
], | ||
exp.end, | ||
exp.end | ||
define.end, | ||
define.end | ||
]); | ||
@@ -180,3 +184,3 @@ } | ||
for (const { define } of scriptSetupRanges.templateRefs) { | ||
if (!define?.arg) { | ||
if (!define.arg) { | ||
continue; | ||
@@ -183,0 +187,0 @@ } |
@@ -9,3 +9,3 @@ "use strict"; | ||
const styles = options.sfc.styles.map((style, i) => [style, i]).filter(([style]) => style.module); | ||
if (!styles.length) { | ||
if (!styles.length && !options.scriptSetupRanges?.cssModules.length) { | ||
return; | ||
@@ -12,0 +12,0 @@ } |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.getTemplateUsageVars = getTemplateUsageVars; | ||
const path = require("path-browserify"); | ||
const shared_1 = require("../../utils/shared"); | ||
@@ -17,3 +18,3 @@ const common_1 = require("../common"); | ||
exps.push(`{} as InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>`); | ||
if (options.vueCompilerOptions.petiteVueExtensions.some(ext => options.fileBaseName.endsWith(ext))) { | ||
if (options.vueCompilerOptions.petiteVueExtensions.some(ext => options.fileName.endsWith(ext))) { | ||
exps.push(`globalThis`); | ||
@@ -56,3 +57,4 @@ } | ||
else if (options.sfc.scriptSetup) { | ||
nameType = `'${options.scriptSetupRanges?.options.name ?? options.fileBaseName.substring(0, options.fileBaseName.lastIndexOf('.'))}'`; | ||
const baseName = path.basename(options.fileName); | ||
nameType = `'${options.scriptSetupRanges?.options.name ?? baseName.substring(0, baseName.lastIndexOf('.'))}'`; | ||
} | ||
@@ -59,0 +61,0 @@ if (nameType) { |
@@ -32,3 +32,5 @@ import type * as ts from 'typescript'; | ||
typeArg?: TextRange; | ||
}>; | ||
}> & { | ||
statement: TextRange; | ||
}; | ||
}; | ||
@@ -35,0 +37,0 @@ emits: { |
@@ -210,3 +210,6 @@ "use strict"; | ||
else if (vueCompilerOptions.macros.defineSlots.includes(callText)) { | ||
slots.define = parseDefineFunction(node); | ||
slots.define = { | ||
...parseDefineFunction(node), | ||
statement: getStatementRange(ts, parents, node, ast) | ||
}; | ||
if (ts.isVariableDeclaration(parent)) { | ||
@@ -213,0 +216,0 @@ if (ts.isIdentifier(parent.name)) { |
@@ -45,3 +45,5 @@ import type { Mapping } from '@volar/language-core'; | ||
typeArg?: import("../types").TextRange; | ||
}>; | ||
}> & { | ||
statement: import("../types").TextRange; | ||
}; | ||
}; | ||
@@ -48,0 +50,0 @@ emits: { |
@@ -5,3 +5,2 @@ "use strict"; | ||
const alien_signals_1 = require("alien-signals"); | ||
const path_browserify_1 = require("path-browserify"); | ||
const script_1 = require("../codegen/script"); | ||
@@ -152,3 +151,3 @@ const template_1 = require("../codegen/template"); | ||
ts, | ||
fileBaseName: path_browserify_1.posix.basename(fileName), | ||
fileName, | ||
sfc: _sfc, | ||
@@ -155,0 +154,0 @@ lang: lang.get(), |
@@ -9,3 +9,3 @@ "use strict"; | ||
const untrackedSnapshot = () => { | ||
const prevTrackId = alien_signals_1.System.activeTrackId = 0; | ||
const prevTrackId = alien_signals_1.System.activeTrackId; | ||
alien_signals_1.System.activeTrackId = 0; | ||
@@ -12,0 +12,0 @@ const res = snapshot.get(); |
{ | ||
"name": "@vue/language-core", | ||
"version": "2.1.8", | ||
"version": "2.1.10", | ||
"license": "MIT", | ||
@@ -40,3 +40,3 @@ "files": [ | ||
}, | ||
"gitHead": "25cccedc53e7361ed4e34296d6ecd43d7de2a095" | ||
"gitHead": "b0af30caee2f8dfb1a8393c1b400f38e31fa4883" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
335674
7548
1
126