verison bump, new files need to include var tokens
All checks were successful
Publish npm package / publish (push) Successful in 26s
All checks were successful
Publish npm package / publish (push) Successful in 26s
This commit is contained in:
17
render.ts
17
render.ts
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user