mergeJSContexts() — astro Function Reference
Architecture documentation for the mergeJSContexts() function in parseJS.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 63417ab6_763d_1ad1_771b_10c76ce5a8e7["mergeJSContexts()"] 2208f162_1b21_d542_51aa_98ca1eda9260["parseJS.ts"] 63417ab6_763d_1ad1_771b_10c76ce5a8e7 -->|defined in| 2208f162_1b21_d542_51aa_98ca1eda9260 ec8d4bbf_da51_efdd_06cc_5efbc5901fc5["extractScriptTags()"] ec8d4bbf_da51_efdd_06cc_5efbc5901fc5 -->|calls| 63417ab6_763d_1ad1_771b_10c76ce5a8e7 83cae376_4307_8290_1999_12a3fa77a3a2["buildMappings()"] 63417ab6_763d_1ad1_771b_10c76ce5a8e7 -->|calls| 83cae376_4307_8290_1999_12a3fa77a3a2 style 63417ab6_763d_1ad1_771b_10c76ce5a8e7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/language-tools/language-server/src/core/parseJS.ts lines 105–145
function mergeJSContexts(inlineScripts: TSXExtractedScript[]): VirtualCode | undefined {
if (inlineScripts.length === 0) {
return undefined;
}
const codes: Segment<CodeInformation>[] = [];
for (const javascriptContext of inlineScripts) {
codes.push([
// Add a semicolon to the end of the event attribute to attempt to prevent errors from spreading to the rest of the document
// This is not perfect, but it's better than nothing
// See: https://github.com/microsoft/vscode/blob/e8e04769ec817a3374c3eaa26a08d3ae491820d5/extensions/html-language-features/server/src/modes/embeddedSupport.ts#L192
javascriptContext.content + ';',
undefined,
javascriptContext.position.start,
{
verification: true,
completion: true,
semantic: true,
navigation: true,
structure: true,
format: false,
},
]);
}
const mappings = buildMappings(codes);
const text = toString(codes);
return {
id: 'inline.mjs',
languageId: 'javascript',
snapshot: {
getText: (start, end) => text.substring(start, end),
getLength: () => text.length,
getChangeRange: () => undefined,
},
embeddedCodes: [],
mappings,
};
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does mergeJSContexts() do?
mergeJSContexts() is a function in the astro codebase, defined in packages/language-tools/language-server/src/core/parseJS.ts.
Where is mergeJSContexts() defined?
mergeJSContexts() is defined in packages/language-tools/language-server/src/core/parseJS.ts at line 105.
What does mergeJSContexts() call?
mergeJSContexts() calls 1 function(s): buildMappings.
What calls mergeJSContexts()?
mergeJSContexts() is called by 1 function(s): extractScriptTags.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free