@volar/vue-language-core
Advanced tools
Comparing version 1.0.0-alpha.5 to 1.0.0-beta.0
@@ -45,3 +45,2 @@ import { DocumentCapabilities, EmbeddedFile, EmbeddedFileSourceMap, PositionCapabilities, SourceFile, Teleport, TeleportMappingData } from '@volar/language-core'; | ||
template: string; | ||
templateOffset: number; | ||
snapshot: ts.IScriptSnapshot; | ||
@@ -48,0 +47,0 @@ result: CompilerDom.CodegenResult; |
@@ -7,33 +7,2 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
class VueSourceFile { | ||
constructor(fileName, pscriptSnapshot, ts, plugins) { | ||
this.fileName = fileName; | ||
this.pscriptSnapshot = pscriptSnapshot; | ||
this.ts = ts; | ||
this.plugins = plugins; | ||
this.sfc = (0, reactivity_1.reactive)({ | ||
template: null, | ||
script: null, | ||
scriptSetup: null, | ||
styles: [], | ||
customBlocks: [], | ||
getTemplateAst: () => { | ||
var _a; | ||
return (_a = this.compiledSFCTemplate) === null || _a === void 0 ? void 0 : _a.ast; | ||
}, | ||
scriptAst: (0, reactivity_1.computed)(() => { | ||
if (this.sfc.script) { | ||
return this.ts.createSourceFile(this.fileName + '.' + this.sfc.script.lang, this.sfc.script.content, this.ts.ScriptTarget.Latest); | ||
} | ||
}), | ||
scriptSetupAst: (0, reactivity_1.computed)(() => { | ||
if (this.sfc.scriptSetup) { | ||
return this.ts.createSourceFile(this.fileName + '.' + this.sfc.scriptSetup.lang, this.sfc.scriptSetup.content, this.ts.ScriptTarget.Latest); | ||
} | ||
}), | ||
}) /* avoid Sfc unwrap in .d.ts by reactive */; | ||
this._allEmbeddeds = (0, reactivity_1.shallowRef)([]); | ||
this._embeddeds = (0, reactivity_1.shallowRef)([]); | ||
this._snapshot = (0, reactivity_1.shallowRef)(this.pscriptSnapshot); | ||
this.update(this._snapshot.value, true); | ||
} | ||
static getSFC(plugins, fileName, snapshot) { | ||
@@ -85,4 +54,3 @@ var _a, _b, _c; | ||
if (((_b = VueSourceFile.compiledSFCTemplateCache) === null || _b === void 0 ? void 0 : _b.fileName) === sourceFile.fileName | ||
&& VueSourceFile.compiledSFCTemplateCache.template === ((_c = sourceFile.sfc.template) === null || _c === void 0 ? void 0 : _c.content) | ||
&& VueSourceFile.compiledSFCTemplateCache.templateOffset === sourceFile.sfc.template.startTagEnd) { | ||
&& VueSourceFile.compiledSFCTemplateCache.template === ((_c = sourceFile.sfc.template) === null || _c === void 0 ? void 0 : _c.content)) { | ||
return { | ||
@@ -108,3 +76,2 @@ errors: [], | ||
VueSourceFile.compiledSFCTemplateCache.template = sourceFile.sfc.template.content; | ||
VueSourceFile.compiledSFCTemplateCache.templateOffset = sourceFile.sfc.template.startTagEnd; | ||
VueSourceFile.compiledSFCTemplateCache.snapshot = newSnapshot; | ||
@@ -140,3 +107,2 @@ VueSourceFile.compiledSFCTemplateCache.result = newResult; | ||
template: sourceFile.sfc.template.content, | ||
templateOffset: sourceFile.sfc.template.startTagEnd, | ||
snapshot: newSnapshot, | ||
@@ -169,2 +135,33 @@ result: result, | ||
} | ||
constructor(fileName, pscriptSnapshot, ts, plugins) { | ||
this.fileName = fileName; | ||
this.pscriptSnapshot = pscriptSnapshot; | ||
this.ts = ts; | ||
this.plugins = plugins; | ||
this.sfc = (0, reactivity_1.reactive)({ | ||
template: null, | ||
script: null, | ||
scriptSetup: null, | ||
styles: [], | ||
customBlocks: [], | ||
getTemplateAst: () => { | ||
var _a; | ||
return (_a = this.compiledSFCTemplate) === null || _a === void 0 ? void 0 : _a.ast; | ||
}, | ||
scriptAst: (0, reactivity_1.computed)(() => { | ||
if (this.sfc.script) { | ||
return this.ts.createSourceFile(this.fileName + '.' + this.sfc.script.lang, this.sfc.script.content, this.ts.ScriptTarget.Latest); | ||
} | ||
}), | ||
scriptSetupAst: (0, reactivity_1.computed)(() => { | ||
if (this.sfc.scriptSetup) { | ||
return this.ts.createSourceFile(this.fileName + '.' + this.sfc.scriptSetup.lang, this.sfc.scriptSetup.content, this.ts.ScriptTarget.Latest); | ||
} | ||
}), | ||
}) /* avoid Sfc unwrap in .d.ts by reactive */; | ||
this._allEmbeddeds = (0, reactivity_1.shallowRef)([]); | ||
this._embeddeds = (0, reactivity_1.shallowRef)([]); | ||
this._snapshot = (0, reactivity_1.shallowRef)(this.pscriptSnapshot); | ||
this.update(this._snapshot.value, true); | ||
} | ||
update(newScriptSnapshot, init = false) { | ||
@@ -171,0 +168,0 @@ const self = this; |
@@ -6,6 +6,6 @@ import * as embedded from '@volar/language-core'; | ||
import { VueEmbeddedFile } from './sourceFile'; | ||
export declare type LanguageServiceHost = embedded.LanguageServiceHost & { | ||
export type LanguageServiceHost = embedded.LanguageServiceHost & { | ||
getVueCompilationSettings(): VueCompilerOptions; | ||
}; | ||
export declare type VueCompilerOptions = Partial<ResolvedVueCompilerOptions>; | ||
export type VueCompilerOptions = Partial<ResolvedVueCompilerOptions>; | ||
export interface ResolvedVueCompilerOptions { | ||
@@ -26,3 +26,3 @@ target: 2 | 2.7 | 3; | ||
} | ||
export declare type VueLanguagePlugin = (ctx: { | ||
export type VueLanguagePlugin = (ctx: { | ||
modules: { | ||
@@ -29,0 +29,0 @@ typescript: typeof import('typescript/lib/tsserverlibrary'); |
export declare const SearchTexts: { | ||
Components: string; | ||
GlobalAttrs: string; | ||
PropsCompletion: (tag: string) => string; | ||
EmitCompletion: (tag: string) => string; | ||
}; |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SearchTexts = void 0; | ||
const shared_1 = require("@vue/shared"); | ||
exports.SearchTexts = { | ||
PropsCompletion: (tag) => `/* __VLS_.SearchTexts.Completion.Props.${(0, shared_1.hyphenate)(tag)} */`, | ||
EmitCompletion: (tag) => `/* __VLS_.SearchTexts.Completion.Emit.${(0, shared_1.hyphenate)(tag)} */`, | ||
Components: '/* __VLS_.SearchTexts.Components */', | ||
GlobalAttrs: '/* __VLS_.SearchTexts.GlobalAttrs */', | ||
PropsCompletion: (tag) => `/* __VLS_.SearchTexts.Completion.Props.${tag} */`, | ||
EmitCompletion: (tag) => `/* __VLS_.SearchTexts.Completion.Emit.${tag} */`, | ||
}; | ||
//# sourceMappingURL=string.js.map |
import type * as ts from 'typescript/lib/tsserverlibrary'; | ||
import type { VueCompilerOptions, ResolvedVueCompilerOptions } from '../types'; | ||
export declare type ParsedCommandLine = ts.ParsedCommandLine & { | ||
export type ParsedCommandLine = ts.ParsedCommandLine & { | ||
vueOptions: VueCompilerOptions; | ||
@@ -5,0 +5,0 @@ }; |
{ | ||
"name": "@volar/vue-language-core", | ||
"version": "1.0.0-alpha.5", | ||
"version": "1.0.0-beta.0", | ||
"main": "out/index.js", | ||
@@ -16,8 +16,8 @@ "license": "MIT", | ||
"devDependencies": { | ||
"typescript": "latest" | ||
"typescript": "beta" | ||
}, | ||
"dependencies": { | ||
"@volar/code-gen": "1.0.0-alpha.5", | ||
"@volar/language-core": "1.0.0-alpha.5", | ||
"@volar/source-map": "1.0.0-alpha.5", | ||
"@volar/code-gen": "1.0.0-beta.0", | ||
"@volar/language-core": "1.0.0-beta.0", | ||
"@volar/source-map": "1.0.0-beta.0", | ||
"@vue/compiler-dom": "^3.2.38", | ||
@@ -29,3 +29,3 @@ "@vue/compiler-sfc": "^3.2.38", | ||
}, | ||
"gitHead": "dd3efd3f7458aca9ba5dcdf549ce80999cb7affd" | ||
"gitHead": "e93a2cf6e614f6c8fa9b8a61e314c123cbe9a95a" | ||
} |
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
235296
5057
+ Added@volar/code-gen@1.0.0-beta.0(transitive)
+ Added@volar/language-core@1.0.0-beta.0(transitive)
+ Added@volar/source-map@1.0.0-beta.0(transitive)
- Removed@volar/code-gen@1.0.0-alpha.5(transitive)
- Removed@volar/language-core@1.0.0-alpha.5(transitive)
- Removed@volar/source-map@1.0.0-alpha.5(transitive)
Updated@volar/code-gen@1.0.0-beta.0