Sync generated provider output

This commit is contained in:
github-actions[bot]
2026-08-13 21:01:41 +00:00
parent fde4a3ee71
commit 3b96bd5090
32 changed files with 528 additions and 736 deletions
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
+22 -38
View File
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
+22 -38
View File
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
+22 -38
View File
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
+22 -38
View File
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
+22 -38
View File
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';
@@ -425,25 +425,28 @@ const REGEX_MATCHERS = [
}, },
fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` }, fmt: (m) => `cubic-bezier(${m[1]}, ${m[2]}, ${m[3]}, ${m[4]})` },
// --- Layout property transition --- // --- Layout property transition ---
{ id: 'layout-transition', regex: /transition\s*:\s*([^;{}]+)/gi, // JSX inline style objects use comma-delimited quoted values, not semicolons (issue #548).
{ id: 'layout-transition', regex: /transition\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
{ id: 'layout-transition', regex: /transition-property\s*:\s*([^;{}]+)/gi, { id: 'layout-transition', regex: /transition-property\s*:\s*(?:(['"])((?:(?!\1)[^\\]|\\.)*)\1|([^;{}]+))/gi,
test: (m) => { test: (m) => {
const val = m[1].toLowerCase(); const val = (m[2] ?? m[3] ?? '').toLowerCase();
if (/\ball\b/.test(val)) return false; if (/\ball\b/.test(val)) return false;
return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val); return /\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding\b|\bmargin\b/.test(val);
}, },
fmt: (m) => { fmt: (m) => {
const found = m[1].match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi); const raw = m[2] ?? m[3] ?? '';
return `transition-property: ${found ? found.join(', ') : m[1].trim()}`; const found = raw.match(/\b(?:(?:max|min)-)?(?:width|height)\b|\bpadding(?:-(?:top|right|bottom|left))?\b|\bmargin(?:-(?:top|right|bottom|left))?\b/gi);
return `transition-property: ${found ? found.join(', ') : raw.trim()}`;
} }, } },
// --- Broken image: src="" or src="#" or src=" " --- // --- Broken image: src="" or src="#" or src=" " ---
{ id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi, { id: 'broken-image', regex: /<img\b[^>]*?\bsrc\s*=\s*(?:""|''|"\s+"|'\s+'|"#"|'#')/gi,
@@ -170,51 +170,35 @@ Output (JSON):
} }
if (svelteComponentManifest) { if (svelteComponentManifest) {
if (isDiscard) { const { sourceFile, componentDir } = svelteComponentManifest;
let result; const resultContext = {
try { file: sourceFile,
result = withSourceLockSync( ...(isDiscard ? { carbonize: false } : { sourceFile }),
path.resolve(process.cwd(), svelteComponentManifest.sourceFile), previewMode: 'svelte-component',
'discard:' + id, componentDir,
() => { };
removeSvelteComponentSession(id, process.cwd()); const runOperation = isDiscard
return { handled: true }; ? () => {
}, removeSvelteComponentSession(id, process.cwd());
{ waitMs: ACCEPT_LOCK_WAIT_MS }, return { handled: true, ...resultContext };
); }
} catch (err) { : () => inlineSvelteComponentAccept(
result = operationFailure(err);
}
emitResult({
...result,
file: svelteComponentManifest.sourceFile,
carbonize: false,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
return;
}
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), svelteComponentManifest.sourceFile),
'accept:' + id,
() => inlineSvelteComponentAccept(
svelteComponentManifest, svelteComponentManifest,
variantNum, variantNum,
paramValues, paramValues,
process.cwd(), process.cwd(),
), );
let result;
try {
result = withSourceLockSync(
path.resolve(process.cwd(), sourceFile),
requestedOperation + ':' + id,
runOperation,
{ waitMs: ACCEPT_LOCK_WAIT_MS }, { waitMs: ACCEPT_LOCK_WAIT_MS },
); );
} catch (err) { } catch (err) {
result = operationFailure(err, { result = operationFailure(err, resultContext);
file: svelteComponentManifest.sourceFile,
sourceFile: svelteComponentManifest.sourceFile,
previewMode: 'svelte-component',
componentDir: svelteComponentManifest.componentDir,
});
} }
if (result.carbonize) { if (result.carbonize) {
result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".'; result.todo = 'REQUIRED before next poll: carbonize cleanup in ' + result.file + '. See reference/live.md "Required after accept".';