verison bump, new files need to include var tokens
All checks were successful
Publish npm package / publish (push) Successful in 26s

This commit is contained in:
Gregor Lohaus
2026-05-24 15:05:22 +02:00
parent 7d01b2f7c9
commit e16fc8b482
4 changed files with 43 additions and 4 deletions

View File

@@ -139,6 +139,17 @@ function addReverseMapToken(
state.manifest.tokens[token.result] = tokens
}
function addFlatToken(
state: RenderState | undefined,
result: string,
token: string,
) {
if (!state?.manifest) return
const tokens = state.manifest.tokens[result] ?? []
if (!tokens.includes(token)) tokens.push(token)
state.manifest.tokens[result] = tokens
}
function getReverseMapPath(destRoot: string, reverseMap: true | string): string {
if (reverseMap === true) return resolveOutputPath(destRoot, ".tdir-map.json")
return resolveOutputPath(destRoot, reverseMap)
@@ -384,6 +395,12 @@ function renderContentWithMap(
state?: RenderState,
file?: ReverseMapFile,
): string {
for (const match of content.matchAll(VAR_RE)) {
const token = match[0]
const path = match[1]!
addFlatToken(state, String(resolveContext(context, path) ?? ""), token)
}
const processedResult = processIfBlocksWithMap(content, context)
const processed = processedResult.content
for (const token of processedResult.conditionalTokens) {