@biffo/cli 0.228.10 → 0.229.0
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/dist/index.js +18 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2476,6 +2476,21 @@ function stampCarriedFrom(content, templateFile) {
|
|
|
2476
2476
|
return content.replace(REVISION_RE, (m) => `${CARRIED_FROM_MARKER} ${templateFile}
|
|
2477
2477
|
${m}`);
|
|
2478
2478
|
}
|
|
2479
|
+
var BODY_CHANGE_MARKER = "# biffo:body-change:";
|
|
2480
|
+
var BODY_CHANGE_LINE_RE = /^[ \t]*# biffo:body-change:[ \t]*(.*)$/m;
|
|
2481
|
+
var BODY_CHANGE_VALUE_RE = /^(replay-safe|outcome-changing)\b[ \t]*[-—:]*[ \t]*(.+?)[ \t]*$/;
|
|
2482
|
+
function parseBodyChangeDeclaration(content) {
|
|
2483
|
+
const line = BODY_CHANGE_LINE_RE.exec(content);
|
|
2484
|
+
if (!line) return null;
|
|
2485
|
+
const rest = (line[1] ?? "").trim();
|
|
2486
|
+
const value = BODY_CHANGE_VALUE_RE.exec(rest);
|
|
2487
|
+
if (!value) {
|
|
2488
|
+
throw new Error(
|
|
2489
|
+
`Malformed ${BODY_CHANGE_MARKER} marker: expected "${BODY_CHANGE_MARKER} replay-safe \u2014 <reason>" or "${BODY_CHANGE_MARKER} outcome-changing \u2014 <reason>", got "${rest}".`
|
|
2490
|
+
);
|
|
2491
|
+
}
|
|
2492
|
+
return { classification: value[1], reason: value[2] };
|
|
2493
|
+
}
|
|
2479
2494
|
var DOCSTRING_OPEN_RE = /^[rRuU]?("""|''')/;
|
|
2480
2495
|
var DEF_OR_CLASS_RE = /^(async\s+def|def|class)\b/;
|
|
2481
2496
|
var HEADER_END_RE = /:\s*(#.*)?$/;
|
|
@@ -2564,10 +2579,12 @@ function planMigrationCarry(options) {
|
|
|
2564
2579
|
recognised.push({ file: m.file, instanceFile: already.instance.file, how: already.how });
|
|
2565
2580
|
}
|
|
2566
2581
|
if (migrationBodyHash(m.content) !== migrationBodyHash(already.instance.content)) {
|
|
2582
|
+
const declared = parseBodyChangeDeclaration(m.content);
|
|
2567
2583
|
divergedBodies.push({
|
|
2568
2584
|
file: m.file,
|
|
2569
2585
|
instanceFile: already.instance.file,
|
|
2570
|
-
how: already.how
|
|
2586
|
+
how: already.how,
|
|
2587
|
+
...declared && { declared }
|
|
2571
2588
|
});
|
|
2572
2589
|
}
|
|
2573
2590
|
continue;
|