@volar/language-core
Advanced tools
Comparing version 1.0.0-rc.4 to 1.0.0-rc.5
import { Mapping, SourceMapBase } from '@volar/source-map'; | ||
import { Teleport } from './sourceMaps'; | ||
import type { EmbeddedFile, EmbeddedLanguageModule, SourceFile } from './types'; | ||
import type { EmbeddedFile, LanguageModule, SourceFile } from './types'; | ||
export declare function forEachEmbeddeds(input: EmbeddedFile[], cb: (embedded: EmbeddedFile) => void): void; | ||
export type DocumentRegistry = ReturnType<typeof createDocumentRegistry>; | ||
export declare function createDocumentRegistry(): { | ||
get: (fileName: string) => [SourceFile, EmbeddedLanguageModule] | undefined; | ||
get: (fileName: string) => [SourceFile, LanguageModule] | undefined; | ||
delete: (fileName: string) => boolean; | ||
has: (fileName: string) => boolean; | ||
set: (fileName: string, vueFile: SourceFile, languageModule: EmbeddedLanguageModule) => [SourceFile, EmbeddedLanguageModule<SourceFile>]; | ||
set: (fileName: string, vueFile: SourceFile, languageModule: LanguageModule) => [SourceFile, LanguageModule<SourceFile>]; | ||
getFileNames: () => string[]; | ||
getAll: () => [SourceFile, EmbeddedLanguageModule<SourceFile>][]; | ||
getAll: () => [SourceFile, LanguageModule<SourceFile>][]; | ||
getTeleport: (fileName: string) => Teleport | undefined; | ||
getAllEmbeddeds: () => Generator<{ | ||
vueFile: SourceFile; | ||
sourceFile: SourceFile; | ||
embedded: EmbeddedFile; | ||
@@ -31,3 +31,3 @@ }, void, unknown>; | ||
fromEmbeddedFileName: (fileName: string) => { | ||
vueFile: SourceFile; | ||
sourceFile: SourceFile; | ||
embedded: EmbeddedFile; | ||
@@ -34,0 +34,0 @@ } | undefined; |
@@ -32,3 +32,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
forEachEmbeddeds(sourceFile.embeddeds, embedded => { | ||
map.set(normalizePath(embedded.fileName), { vueFile: sourceFile, embedded }); | ||
map.set(normalizePath(embedded.fileName), { sourceFile, embedded }); | ||
}); | ||
@@ -71,6 +71,6 @@ } | ||
if (mapped) { | ||
const sourceMap = getSourceMap(mapped.vueFile, mapped.embedded.mappings); | ||
const sourceMap = getSourceMap(mapped.sourceFile, mapped.embedded.mappings); | ||
for (const vueRange of sourceMap.toSourceOffsets(offset)) { | ||
yield { | ||
fileName: mapped.vueFile.fileName, | ||
fileName: mapped.sourceFile.fileName, | ||
offset: vueRange[0], | ||
@@ -77,0 +77,0 @@ mapping: vueRange[1], |
import type * as ts from 'typescript/lib/tsserverlibrary'; | ||
import { EmbeddedLanguageModule, SourceFile, LanguageServiceHost } from './types'; | ||
import { LanguageModule, SourceFile, LanguageServiceHost } from './types'; | ||
export type EmbeddedLanguageContext = ReturnType<typeof createEmbeddedLanguageServiceHost>; | ||
export declare function createEmbeddedLanguageServiceHost(host: LanguageServiceHost, languageModules: EmbeddedLanguageModule[]): { | ||
export declare function createEmbeddedLanguageServiceHost(host: LanguageServiceHost, languageModules: LanguageModule[]): { | ||
typescriptLanguageServiceHost: ts.LanguageServiceHost; | ||
mapper: { | ||
get: (fileName: string) => [SourceFile, EmbeddedLanguageModule<SourceFile>] | undefined; | ||
get: (fileName: string) => [SourceFile, LanguageModule<SourceFile>] | undefined; | ||
delete: (fileName: string) => boolean; | ||
has: (fileName: string) => boolean; | ||
set: (fileName: string, vueFile: SourceFile, languageModule: EmbeddedLanguageModule<SourceFile>) => [SourceFile, EmbeddedLanguageModule<SourceFile>]; | ||
set: (fileName: string, vueFile: SourceFile, languageModule: LanguageModule<SourceFile>) => [SourceFile, LanguageModule<SourceFile>]; | ||
getFileNames: () => string[]; | ||
getAll: () => [SourceFile, EmbeddedLanguageModule<SourceFile>][]; | ||
getAll: () => [SourceFile, LanguageModule<SourceFile>][]; | ||
getTeleport: (fileName: string) => import("./sourceMaps").Teleport | undefined; | ||
getAllEmbeddeds: () => Generator<{ | ||
vueFile: SourceFile; | ||
sourceFile: SourceFile; | ||
embedded: import("./types").EmbeddedFile; | ||
@@ -31,3 +31,3 @@ }, void, unknown>; | ||
fromEmbeddedFileName: (fileName: string) => { | ||
vueFile: SourceFile; | ||
sourceFile: SourceFile; | ||
embedded: import("./types").EmbeddedFile; | ||
@@ -34,0 +34,0 @@ } | undefined; |
@@ -230,3 +230,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
// fix https://github.com/johnsoncodehk/volar/issues/1082 | ||
version = host.getScriptVersion(mapped.vueFile.fileName) + ':' + version; | ||
version = host.getScriptVersion(mapped.sourceFile.fileName) + ':' + version; | ||
} | ||
@@ -233,0 +233,0 @@ fileVersions.set(mapped.embedded.fileName, version); |
@@ -60,3 +60,3 @@ import { Mapping } from '@volar/source-map'; | ||
} | ||
export interface EmbeddedLanguageModule<T extends SourceFile = SourceFile> { | ||
export interface LanguageModule<T extends SourceFile = SourceFile> { | ||
createSourceFile(fileName: string, snapshot: ts.IScriptSnapshot): T | undefined; | ||
@@ -63,0 +63,0 @@ updateSourceFile(sourceFile: T, snapshot: ts.IScriptSnapshot): void; |
{ | ||
"name": "@volar/language-core", | ||
"version": "1.0.0-rc.4", | ||
"version": "1.0.0-rc.5", | ||
"main": "out/index.js", | ||
@@ -16,7 +16,7 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/source-map": "1.0.0-rc.4", | ||
"@volar/source-map": "1.0.0-rc.5", | ||
"@vue/reactivity": "^3.2.38", | ||
"muggle-string": "^0.1.0" | ||
}, | ||
"gitHead": "eadcf13bb66b02e190ab61eca8fe1a9e6cf84207" | ||
"gitHead": "21006891299e4a81b0be2e179129f0d0983c70d3" | ||
} |
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
25967
+ Added@volar/source-map@1.0.0-rc.5(transitive)
- Removed@volar/source-map@1.0.0-rc.4(transitive)
Updated@volar/source-map@1.0.0-rc.5