@biffo/cli 0.324.10 → 0.324.11
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 +14 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10716,6 +10716,10 @@ function malformedRegistryError(cwd, pluginSlug) {
|
|
|
10716
10716
|
`${PLUGIN_REGISTRY_RELATIVE_PATH} in ${cwd} does not carry the managed "${REGISTRY_START_MARKER}" / "${REGISTRY_END_MARKER}" region that plugin "${pluginSlug}"'s install needs to write into. Add that managed region around the INSTALLED_PLUGINS array contents (see plugin-frontend-registry.ts's module docstring) rather than hand-editing the array.`
|
|
10717
10717
|
);
|
|
10718
10718
|
}
|
|
10719
|
+
function detectEol(source) {
|
|
10720
|
+
const firstLf = source.indexOf("\n");
|
|
10721
|
+
return firstLf > 0 && source[firstLf - 1] === "\r" ? "\r\n" : "\n";
|
|
10722
|
+
}
|
|
10719
10723
|
function findManagedRegion(source) {
|
|
10720
10724
|
const startIdx = source.indexOf(REGISTRY_START_MARKER);
|
|
10721
10725
|
if (startIdx === -1) return null;
|
|
@@ -10725,7 +10729,11 @@ function findManagedRegion(source) {
|
|
|
10725
10729
|
const lineStart = source.lastIndexOf("\n", endIdx - 1) + 1;
|
|
10726
10730
|
const seam = lineStart >= bodyStart && /^[ \t]*$/.test(source.slice(lineStart, endIdx)) ? lineStart : endIdx;
|
|
10727
10731
|
return {
|
|
10728
|
-
region: {
|
|
10732
|
+
region: {
|
|
10733
|
+
before: source.slice(0, bodyStart),
|
|
10734
|
+
after: source.slice(seam),
|
|
10735
|
+
eol: detectEol(source)
|
|
10736
|
+
},
|
|
10729
10737
|
body: source.slice(bodyStart, seam)
|
|
10730
10738
|
};
|
|
10731
10739
|
}
|
|
@@ -10771,12 +10779,8 @@ function splitEntries(body) {
|
|
|
10771
10779
|
}
|
|
10772
10780
|
return entries;
|
|
10773
10781
|
}
|
|
10774
|
-
function serializeEntryRaw(entry) {
|
|
10775
|
-
return
|
|
10776
|
-
slug: ${JSON.stringify(entry.slug)},
|
|
10777
|
-
title: ${JSON.stringify(entry.title)},
|
|
10778
|
-
frontendUrl: ${JSON.stringify(entry.frontendUrl)},
|
|
10779
|
-
`;
|
|
10782
|
+
function serializeEntryRaw(entry, eol) {
|
|
10783
|
+
return `${eol} slug: ${JSON.stringify(entry.slug)},${eol} title: ${JSON.stringify(entry.title)},${eol} frontendUrl: ${JSON.stringify(entry.frontendUrl)},${eol} `;
|
|
10780
10784
|
}
|
|
10781
10785
|
function assertPluginRegistryReady(cwd, pluginSlug) {
|
|
10782
10786
|
readManagedEntries(cwd, pluginSlug);
|
|
@@ -10790,14 +10794,14 @@ function readManagedEntries(cwd, pluginSlug) {
|
|
|
10790
10794
|
return { source, region: found.region, entries: splitEntries(found.body) };
|
|
10791
10795
|
}
|
|
10792
10796
|
function writeManagedEntries(cwd, region, entries) {
|
|
10793
|
-
const
|
|
10794
|
-
`).join("")
|
|
10797
|
+
const { eol } = region;
|
|
10798
|
+
const body = eol + entries.map((e) => ` {${e.raw}},${eol}`).join("");
|
|
10795
10799
|
writeFileSync12(registryPath2(cwd), region.before + body + region.after, "utf8");
|
|
10796
10800
|
}
|
|
10797
10801
|
function upsertPluginRegistryEntry(cwd, entry) {
|
|
10798
10802
|
const { region, entries } = readManagedEntries(cwd, entry.slug);
|
|
10799
10803
|
const preserved = entries.filter((e) => e.slug !== entry.slug);
|
|
10800
|
-
const next = { raw: serializeEntryRaw(entry), slug: entry.slug };
|
|
10804
|
+
const next = { raw: serializeEntryRaw(entry, region.eol), slug: entry.slug };
|
|
10801
10805
|
writeManagedEntries(cwd, region, [...preserved, next]);
|
|
10802
10806
|
}
|
|
10803
10807
|
function removePluginRegistryEntry(cwd, pluginSlug) {
|