Upgrade to version 11.0.1 #1

Merged
steve merged 60 commits from v11.0.1 into main 2025-10-30 22:14:46 +00:00
Showing only changes of commit 47a48480bd - Show all commits

View File

@@ -205,12 +205,28 @@ export function wordpressThemeJson({
fs.readFileSync(path.resolve('./theme.json'), 'utf8') fs.readFileSync(path.resolve('./theme.json'), 'utf8')
) )
const themeMatch = cssContent.match(/@(?:layer\s+)?theme\s*{([^}]*)}/s) const themeContent = (() => {
if (!themeMatch) { const match = cssContent.match(/@(?:layer\s+)?theme\s*{/s)
if (!match[0]) {
return null
}
const startIndex = match.index + match[0].length;
let braceCount = 1;
for (let i = startIndex; i < cssContent.length; i++) {
if (cssContent[i] === "{") braceCount++;
if (cssContent[i] === "}") braceCount--;
if (braceCount === 0) {
return cssContent.substring(startIndex, i );
}
}
return null
})()
if (!themeContent) {
return; return;
} }
const themeContent = themeMatch[1]
if (!themeContent.trim().startsWith(':root')) { if (!themeContent.trim().startsWith(':root')) {
return; return;
} }