utils.ts — astro Source File
Architecture documentation for utils.ts, a typescript file in the astro codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 16797996_1eb4_d7a9_ad38_47fe954cb188["utils.ts"] 38342bd4_11df_7a37_2e70_333185fe2db2["../../core/index.js"] 16797996_1eb4_d7a9_ad38_47fe954cb188 --> 38342bd4_11df_7a37_2e70_333185fe2db2 89de2635_6169_bc8a_5f3b_51a713363774["../utils.js"] 16797996_1eb4_d7a9_ad38_47fe954cb188 --> 89de2635_6169_bc8a_5f3b_51a713363774 4e2ee814_ff7b_a348_0e3a_6e6d7b34afb6["vscode-html-languageservice"] 16797996_1eb4_d7a9_ad38_47fe954cb188 --> 4e2ee814_ff7b_a348_0e3a_6e6d7b34afb6 style 16797996_1eb4_d7a9_ad38_47fe954cb188 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { TextEdit } from 'vscode-html-languageservice';
import type { AstroVirtualCode } from '../../core/index.js';
import { editShouldBeInFrontmatter, ensureProperEditForFrontmatter } from '../utils.js';
export function mapEdit(edit: TextEdit, code: AstroVirtualCode, languageId: string) {
// Don't attempt to move the edit to the frontmatter if the file isn't the root TSX file, it means it's a script tag
if (languageId === 'typescriptreact') {
if (editShouldBeInFrontmatter(edit.range, code.astroMeta).itShould) {
edit = ensureProperEditForFrontmatter(edit, code.astroMeta, '\n');
}
} else {
// If the edit is at the start of the file, add a newline before it, otherwise we'll get `<script>text`
if (edit.range.start.line === 0 && edit.range.start.character === 0) {
edit.newText = '\n' + edit.newText;
}
}
return edit;
}
Domain
Subdomains
Functions
Dependencies
- ../../core/index.js
- ../utils.js
- vscode-html-languageservice
Source
Frequently Asked Questions
What does utils.ts do?
utils.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RoutingSystem subdomain.
What functions are defined in utils.ts?
utils.ts defines 1 function(s): mapEdit.
What does utils.ts depend on?
utils.ts imports 3 module(s): ../../core/index.js, ../utils.js, vscode-html-languageservice.
Where is utils.ts in the architecture?
utils.ts is located at packages/language-tools/language-server/src/plugins/typescript/utils.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/language-tools/language-server/src/plugins/typescript).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free