@vue/language-core
Advanced tools
Comparing version 1.8.22 to 1.8.24
@@ -7,3 +7,3 @@ "use strict"; | ||
const muggle = require("muggle-string"); | ||
const path_1 = require("path"); | ||
const path = require("path-browserify"); | ||
const shared_1 = require("../utils/shared"); | ||
@@ -198,3 +198,3 @@ const transform_1 = require("../utils/transform"); | ||
if (!!scriptSetup && scriptRanges?.exportDefault) { | ||
addVirtualCode('script', scriptRanges.exportDefault.end, script.content.length); | ||
addVirtualCode('script', scriptRanges.exportDefault.expression.end, script.content.length); | ||
} | ||
@@ -214,15 +214,2 @@ } | ||
} | ||
function generateExportDefaultEndMapping() { | ||
if (!scriptSetup) { | ||
return; | ||
} | ||
// fix https://github.com/vuejs/language-tools/issues/1127 | ||
codes.push([ | ||
'', | ||
'scriptSetup', | ||
scriptSetup.content.length, | ||
{ diagnostic: true }, | ||
]); | ||
codes.push(`\n`); | ||
} | ||
function generateScriptSetupAndTemplate() { | ||
@@ -350,3 +337,2 @@ if (!scriptSetup || !scriptSetupRanges) { | ||
} | ||
generateExportDefaultEndMapping(); | ||
if (scriptSetupGeneratedOffset !== undefined) { | ||
@@ -516,5 +502,2 @@ for (const defineProp of scriptSetupRanges.defineProp) { | ||
} | ||
if (mode === 'export') { | ||
generateExportDefaultEndMapping(); | ||
} | ||
return scriptSetupGeneratedOffset; | ||
@@ -533,3 +516,2 @@ } | ||
} | ||
generateComponentOptions(functional); | ||
codes.push(`setup() {\n`); | ||
@@ -543,2 +525,3 @@ codes.push(`return {\n`); | ||
codes.push(`},\n`); | ||
generateComponentOptions(functional); | ||
codes.push(`})`); | ||
@@ -644,3 +627,2 @@ } | ||
codes.push(`const __VLS_internalComponent = (await import('${vueCompilerOptions.lib}')).defineComponent({\n`); | ||
generateComponentOptions(functional); | ||
codes.push(`setup() {\n`); | ||
@@ -682,6 +664,7 @@ codes.push(`return {\n`); | ||
codes.push(`},\n`); // setup() { | ||
generateComponentOptions(functional); | ||
codes.push(`});\n`); // defineComponent({ | ||
} | ||
else if (script) { | ||
codes.push(`let __VLS_internalComponent!: typeof import('./${path_1.posix.basename(fileName)}')['default'];\n`); | ||
codes.push(`let __VLS_internalComponent!: typeof import('./${path.basename(fileName)}')['default'];\n`); | ||
} | ||
@@ -721,3 +704,3 @@ else { | ||
else if (scriptSetup) { | ||
codes.push(`let __VLS_name!: '${path_1.posix.basename(fileName.substring(0, fileName.lastIndexOf('.')))}';\n`); | ||
codes.push(`let __VLS_name!: '${path.basename(fileName.substring(0, fileName.lastIndexOf('.')))}';\n`); | ||
} | ||
@@ -724,0 +707,0 @@ else { |
@@ -9,3 +9,3 @@ import type { Language } from '@volar/language-core'; | ||
*/ | ||
export declare function createLanguages(compilerOptions?: ts.CompilerOptions, vueCompilerOptions?: Partial<VueCompilerOptions>, ts?: typeof import('typescript/lib/tsserverlibrary'), codegenStack?: boolean): Language[]; | ||
export declare function createLanguages(ts: typeof import('typescript/lib/tsserverlibrary'), compilerOptions?: ts.CompilerOptions, vueCompilerOptions?: Partial<VueCompilerOptions>, codegenStack?: boolean): Language[]; | ||
//# sourceMappingURL=languageModule.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createLanguages = exports.createVueLanguage = void 0; | ||
const path_1 = require("path"); | ||
const path = require("path-browserify"); | ||
const plugins_1 = require("./plugins"); | ||
@@ -63,3 +63,3 @@ const vueFile_1 = require("./virtualFile/vueFile"); | ||
const sharedTypesSnapshot = ts.ScriptSnapshot.fromString(sharedTypes.getTypesCode(vueCompilerOptions)); | ||
const sharedTypesFileName = path_1.posix.join(host.rootPath, sharedTypes.baseName); | ||
const sharedTypesFileName = path.join(host.rootPath, sharedTypes.baseName); | ||
return { | ||
@@ -93,3 +93,3 @@ ...host, | ||
*/ | ||
function createLanguages(compilerOptions = {}, vueCompilerOptions = {}, ts = require('typescript'), codegenStack = false) { | ||
function createLanguages(ts, compilerOptions = {}, vueCompilerOptions = {}, codegenStack = false) { | ||
return [ | ||
@@ -96,0 +96,0 @@ createVueLanguage(ts, compilerOptions, vueCompilerOptions, codegenStack), |
@@ -12,5 +12,6 @@ import type * as ts from 'typescript/lib/tsserverlibrary'; | ||
define?: (TextRange & { | ||
statement: TextRange; | ||
arg?: TextRange | undefined; | ||
typeArg?: TextRange | undefined; | ||
} & { | ||
statement: TextRange; | ||
}) | undefined; | ||
@@ -23,7 +24,13 @@ withDefaults?: (TextRange & { | ||
name?: string | undefined; | ||
define?: TextRange | undefined; | ||
define?: (TextRange & { | ||
arg?: TextRange | undefined; | ||
typeArg?: TextRange | undefined; | ||
}) | undefined; | ||
}; | ||
emits: { | ||
name?: string | undefined; | ||
define?: TextRange | undefined; | ||
define?: (TextRange & { | ||
arg?: TextRange | undefined; | ||
typeArg?: TextRange | undefined; | ||
}) | undefined; | ||
}; | ||
@@ -30,0 +37,0 @@ expose: { |
@@ -50,2 +50,9 @@ "use strict"; | ||
} | ||
function parseDefineFunction(node) { | ||
return { | ||
..._getStartEnd(node), | ||
arg: node.arguments.length ? _getStartEnd(node.arguments[0]) : undefined, | ||
typeArg: node.typeArguments?.length ? _getStartEnd(node.typeArguments[0]) : undefined, | ||
}; | ||
} | ||
function visitNode(node, parents) { | ||
@@ -132,3 +139,3 @@ const parent = parents[parents.length - 1]; | ||
else if (vueCompilerOptions.macros.defineSlots.includes(callText)) { | ||
slots.define = _getStartEnd(node); | ||
slots.define = parseDefineFunction(node); | ||
if (ts.isVariableDeclaration(parent)) { | ||
@@ -139,3 +146,3 @@ slots.name = parent.name.getText(ast); | ||
else if (vueCompilerOptions.macros.defineEmits.includes(callText)) { | ||
emits.define = _getStartEnd(node); | ||
emits.define = parseDefineFunction(node); | ||
if (ts.isVariableDeclaration(parent)) { | ||
@@ -146,9 +153,3 @@ emits.name = parent.name.getText(ast); | ||
else if (vueCompilerOptions.macros.defineExpose.includes(callText)) { | ||
expose.define = _getStartEnd(node); | ||
if (node.arguments.length) { | ||
expose.define.arg = _getStartEnd(node.arguments[0]); | ||
} | ||
if (node.typeArguments?.length) { | ||
expose.define.typeArg = _getStartEnd(node.typeArguments[0]); | ||
} | ||
expose.define = parseDefineFunction(node); | ||
} | ||
@@ -172,3 +173,3 @@ else if (vueCompilerOptions.macros.defineProps.includes(callText)) { | ||
props.define = { | ||
..._getStartEnd(node), | ||
...parseDefineFunction(node), | ||
statement: statementRange, | ||
@@ -175,0 +176,0 @@ }; |
@@ -17,5 +17,5 @@ "use strict"; | ||
const plugins = [ | ||
file_md_1.default, | ||
file_html_1.default, | ||
file_vue_1.default, | ||
file_md_1.default, // .md for VitePress | ||
file_html_1.default, // .html for PetiteVue | ||
file_vue_1.default, // .vue and others for Vue | ||
vue_template_html_1.default, | ||
@@ -22,0 +22,0 @@ vue_sfc_styles_1.default, |
@@ -22,6 +22,13 @@ "use strict"; | ||
} | ||
hitBlock.content = | ||
const oldContent = hitBlock.content; | ||
const newContent = hitBlock.content = | ||
hitBlock.content.substring(0, change.start - hitBlock.loc.start.offset) | ||
+ change.newText | ||
+ hitBlock.content.substring(change.end - hitBlock.loc.start.offset); | ||
// #3449 | ||
const endTagRegex = new RegExp(`</\\s*${hitBlock.type}\\s*>`); | ||
const insertedEndTag = !!oldContent.match(endTagRegex) !== !!newContent.match(endTagRegex); | ||
if (insertedEndTag) { | ||
return; | ||
} | ||
const lengthDiff = change.newText.length - (change.end - change.start); | ||
@@ -28,0 +35,0 @@ for (const block of blocks) { |
@@ -8,5 +8,5 @@ import { Sfc, VueLanguagePlugin } from '../types'; | ||
args: import("../types").TextRange; | ||
argsNode: import("typescript/lib/tsserverlibrary").ObjectLiteralExpression | undefined; | ||
argsNode: import("typescript").ObjectLiteralExpression | undefined; | ||
componentsOption: import("../types").TextRange | undefined; | ||
componentsOptionNode: import("typescript/lib/tsserverlibrary").ObjectLiteralExpression | undefined; | ||
componentsOptionNode: import("typescript").ObjectLiteralExpression | undefined; | ||
nameOption: import("../types").TextRange | undefined; | ||
@@ -23,5 +23,6 @@ }) | undefined; | ||
define?: (import("../types").TextRange & { | ||
statement: import("../types").TextRange; | ||
arg?: import("../types").TextRange | undefined; | ||
typeArg?: import("../types").TextRange | undefined; | ||
} & { | ||
statement: import("../types").TextRange; | ||
}) | undefined; | ||
@@ -34,7 +35,13 @@ withDefaults?: (import("../types").TextRange & { | ||
name?: string | undefined; | ||
define?: import("../types").TextRange | undefined; | ||
define?: (import("../types").TextRange & { | ||
arg?: import("../types").TextRange | undefined; | ||
typeArg?: import("../types").TextRange | undefined; | ||
}) | undefined; | ||
}; | ||
emits: { | ||
name?: string | undefined; | ||
define?: import("../types").TextRange | undefined; | ||
define?: (import("../types").TextRange & { | ||
arg?: import("../types").TextRange | undefined; | ||
typeArg?: import("../types").TextRange | undefined; | ||
}) | undefined; | ||
}; | ||
@@ -41,0 +48,0 @@ expose: { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.resolveVueCompilerOptions = exports.createParsedCommandLine = exports.createParsedCommandLineByJson = void 0; | ||
const path = require("path"); | ||
const path = require("path-browserify"); | ||
function createParsedCommandLineByJson(ts, parseConfigHost, rootDir, json, configFileName = rootDir + '/jsconfig.json') { | ||
@@ -6,0 +6,0 @@ const proxyHost = proxyParseConfigHostForExtendConfigPaths(parseConfigHost); |
{ | ||
"name": "@vue/language-core", | ||
"version": "1.8.22", | ||
"version": "1.8.24", | ||
"main": "out/index.js", | ||
@@ -16,4 +16,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/language-core": "~1.10.5", | ||
"@volar/source-map": "~1.10.5", | ||
"@volar/language-core": "~1.11.1", | ||
"@volar/source-map": "~1.11.1", | ||
"@vue/compiler-dom": "^3.3.0", | ||
@@ -24,2 +24,3 @@ "@vue/shared": "^3.3.0", | ||
"muggle-string": "^0.3.1", | ||
"path-browserify": "^1.0.1", | ||
"vue-template-compiler": "^2.7.14" | ||
@@ -29,2 +30,4 @@ }, | ||
"@types/minimatch": "^5.1.2", | ||
"@types/node": "latest", | ||
"@types/path-browserify": "^1.0.1", | ||
"@vue/compiler-sfc": "^3.3.0" | ||
@@ -40,3 +43,3 @@ }, | ||
}, | ||
"gitHead": "1e8d09af0282c42dd816671ffcd5a2321276e3c3" | ||
"gitHead": "6f850196d6b9cd1bee62104d3d92867cf0b6777e" | ||
} |
Sorry, the diff of this file is too big to display
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
250961
5429
10
4
+ Addedpath-browserify@^1.0.1
+ Added@volar/language-core@1.11.1(transitive)
+ Added@volar/source-map@1.11.1(transitive)
+ Addedpath-browserify@1.0.1(transitive)
- Removed@volar/language-core@1.10.10(transitive)
- Removed@volar/source-map@1.10.10(transitive)
Updated@volar/language-core@~1.11.1
Updated@volar/source-map@~1.11.1