mixdog 0.9.107 → 0.9.108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -682,11 +682,18 @@ function extractInlinePatchRoot(patchText) {
|
|
|
682
682
|
|
|
683
683
|
export function expandCompactPatchInput(patchText) {
|
|
684
684
|
const text = String(patchText || '').replace(/^\uFEFF/, '');
|
|
685
|
-
if (/^\s*\*\*\* Begin Patch(?:\r?\n|$)/.test(text)) return text;
|
|
686
685
|
const lines = text.replace(/\r\n/g, '\n').split('\n');
|
|
687
686
|
while (lines.length && lines[0] === '') lines.shift();
|
|
688
687
|
while (lines.length && lines[lines.length - 1] === '') lines.pop();
|
|
689
|
-
|
|
688
|
+
const wrapped = /^\*\*\* Begin Patch\b/i.test(lines[0] || '');
|
|
689
|
+
if (wrapped) {
|
|
690
|
+
lines.shift();
|
|
691
|
+
while (lines.length && lines[0] === '') lines.shift();
|
|
692
|
+
if (/^\*\*\* End Patch\b/i.test(lines[lines.length - 1] || '')) lines.pop();
|
|
693
|
+
while (lines.length && lines[lines.length - 1] === '') lines.pop();
|
|
694
|
+
}
|
|
695
|
+
const sectionIndex = /^(?:R |\*\*\* Root: )/.test(lines[0] || '') ? 1 : 0;
|
|
696
|
+
if (!/^[ADU] /.test(lines[sectionIndex] || '')) return text;
|
|
690
697
|
const mapped = lines.map((line) => {
|
|
691
698
|
if (line.startsWith('R ')) return `*** Root: ${line.slice(2)}`;
|
|
692
699
|
if (line.startsWith('A ')) return `*** Add File: ${line.slice(2)}`;
|