@volar/language-core
Advanced tools
Comparing version 1.0.13 to 1.0.14
import { Mapping, SourceMapBase } from '@volar/source-map'; | ||
import { Teleport } from './sourceMaps'; | ||
import type { EmbeddedFile, LanguageModule, SourceFile } from './types'; | ||
export declare function forEachEmbeddeds(input: EmbeddedFile[], cb: (embedded: EmbeddedFile) => void): void; | ||
export declare function forEachEmbeddeds(file: EmbeddedFile, cb: (embedded: EmbeddedFile) => void): void; | ||
export type DocumentRegistry = ReturnType<typeof createDocumentRegistry>; | ||
@@ -18,3 +18,3 @@ export declare function createDocumentRegistry(): { | ||
}, void, unknown>; | ||
fromEmbeddedLocation: (fileName: string, offset: number) => Generator<{ | ||
fromEmbeddedLocation: (fileName: string, offset: number, baseOnRight?: boolean) => Generator<{ | ||
fileName: string; | ||
@@ -21,0 +21,0 @@ offset: number; |
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
const sourceMaps_1 = require("./sourceMaps"); | ||
function forEachEmbeddeds(input, cb) { | ||
for (const child of input) { | ||
if (child) { | ||
cb(child); | ||
} | ||
forEachEmbeddeds(child.embeddeds, cb); | ||
function forEachEmbeddeds(file, cb) { | ||
cb(file); | ||
for (const child of file.embeddeds) { | ||
forEachEmbeddeds(child, cb); | ||
} | ||
@@ -23,3 +21,3 @@ } | ||
for (const [sourceFile] of all.value) { | ||
forEachEmbeddeds(sourceFile.embeddeds, embedded => { | ||
forEachEmbeddeds(sourceFile, embedded => { | ||
map.set(embedded, sourceFile); | ||
@@ -33,3 +31,3 @@ }); | ||
for (const [sourceFile] of all.value) { | ||
forEachEmbeddeds(sourceFile.embeddeds, embedded => { | ||
forEachEmbeddeds(sourceFile, embedded => { | ||
map.set(normalizePath(embedded.fileName), { sourceFile, embedded }); | ||
@@ -44,3 +42,3 @@ }); | ||
const [sourceFile] = files[key]; | ||
forEachEmbeddeds(sourceFile.embeddeds, embedded => { | ||
forEachEmbeddeds(sourceFile, embedded => { | ||
if (embedded.teleportMappings) { | ||
@@ -68,3 +66,3 @@ map.set(normalizePath(embedded.fileName), getTeleport(sourceFile, embedded.teleportMappings)); | ||
}, | ||
fromEmbeddedLocation: function* (fileName, offset) { | ||
fromEmbeddedLocation: function* (fileName, offset, baseOnRight = false) { | ||
if (fileName.endsWith('/__VLS_types.ts')) { // TODO: monkey fix | ||
@@ -76,3 +74,3 @@ return; | ||
const sourceMap = getSourceMap(mapped.sourceFile, mapped.embedded.mappings); | ||
for (const vueRange of sourceMap.toSourceOffsets(offset)) { | ||
for (const vueRange of sourceMap.toSourceOffsets(offset, baseOnRight)) { | ||
yield { | ||
@@ -79,0 +77,0 @@ fileName: mapped.sourceFile.fileName, |
@@ -18,3 +18,3 @@ import type * as ts from 'typescript/lib/tsserverlibrary'; | ||
}, void, unknown>; | ||
fromEmbeddedLocation: (fileName: string, offset: number) => Generator<{ | ||
fromEmbeddedLocation: (fileName: string, offset: number, baseOnRight?: boolean) => Generator<{ | ||
fileName: string; | ||
@@ -21,0 +21,0 @@ offset: number; |
@@ -176,3 +176,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
for (const [sourceFile, languageModule, snapshot] of sourceFilesToUpdate) { | ||
(0, documentRegistry_1.forEachEmbeddeds)(sourceFile.embeddeds, embedded => { | ||
(0, documentRegistry_1.forEachEmbeddeds)(sourceFile, embedded => { | ||
fileVersions.delete(embedded.fileName); | ||
@@ -183,3 +183,3 @@ }); | ||
if (!tsFileUpdated) { | ||
(0, documentRegistry_1.forEachEmbeddeds)(sourceFile.embeddeds, embedded => { | ||
(0, documentRegistry_1.forEachEmbeddeds)(sourceFile, embedded => { | ||
if (embedded.kind) { | ||
@@ -193,3 +193,3 @@ oldScripts[embedded.fileName] = embedded.text; | ||
if (!tsFileUpdated) { | ||
(0, documentRegistry_1.forEachEmbeddeds)(sourceFile.embeddeds, embedded => { | ||
(0, documentRegistry_1.forEachEmbeddeds)(sourceFile, embedded => { | ||
if (embedded.kind) { | ||
@@ -196,0 +196,0 @@ newScripts[embedded.fileName] = embedded.text; |
@@ -43,6 +43,3 @@ import { Mapping } from '@volar/source-map'; | ||
} | ||
export interface SourceFile { | ||
fileName: string; | ||
text: string; | ||
embeddeds: EmbeddedFile[]; | ||
export interface SourceFile extends EmbeddedFile { | ||
} | ||
@@ -49,0 +46,0 @@ export declare enum EmbeddedFileKind { |
{ | ||
"name": "@volar/language-core", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"main": "out/index.js", | ||
@@ -16,7 +16,7 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/source-map": "1.0.13", | ||
"@volar/source-map": "1.0.14", | ||
"@vue/reactivity": "^3.2.45", | ||
"muggle-string": "^0.1.0" | ||
}, | ||
"gitHead": "cba2eba187b2d82e1d45dd86b3edeab0ca7caad6" | ||
"gitHead": "ce4d48b37db784400e15fe08282edc836e24d4cd" | ||
} |
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
26211
583
+ Added@volar/source-map@1.0.14(transitive)
- Removed@volar/source-map@1.0.13(transitive)
Updated@volar/source-map@1.0.14