brakit 0.7.3 → 0.7.5
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/api.d.ts +116 -3
- package/dist/api.js +593 -309
- package/dist/bin/brakit.js +11 -9
- package/dist/runtime/index.js +1142 -471
- package/package.json +1 -1
package/dist/bin/brakit.js
CHANGED
|
@@ -5,7 +5,7 @@ import { runMain } from "citty";
|
|
|
5
5
|
// src/cli/commands/install.ts
|
|
6
6
|
import { defineCommand } from "citty";
|
|
7
7
|
import { resolve as resolve3, join as join2 } from "path";
|
|
8
|
-
import { readFile as readFile3, writeFile as
|
|
8
|
+
import { readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
|
|
9
9
|
import { execSync } from "child_process";
|
|
10
10
|
import pc from "picocolors";
|
|
11
11
|
|
|
@@ -592,7 +592,7 @@ var RequestStore = class {
|
|
|
592
592
|
responseHeaders: flattenHeaders(input.responseHeaders),
|
|
593
593
|
responseBody: responseBodyStr,
|
|
594
594
|
startedAt: input.startTime,
|
|
595
|
-
durationMs: Math.round(performance.now() - input.startTime),
|
|
595
|
+
durationMs: Math.round((input.endTime ?? performance.now()) - input.startTime),
|
|
596
596
|
responseSize: input.responseBody?.length ?? 0,
|
|
597
597
|
isStatic: isStaticPath(path)
|
|
598
598
|
};
|
|
@@ -685,15 +685,17 @@ import {
|
|
|
685
685
|
writeFileSync as writeFileSync2,
|
|
686
686
|
mkdirSync as mkdirSync2,
|
|
687
687
|
existsSync as existsSync2,
|
|
688
|
-
unlinkSync
|
|
688
|
+
unlinkSync,
|
|
689
|
+
renameSync
|
|
689
690
|
} from "fs";
|
|
691
|
+
import { writeFile as writeFile2, mkdir, rename } from "fs/promises";
|
|
690
692
|
import { resolve as resolve2 } from "path";
|
|
691
693
|
|
|
692
694
|
// src/analysis/group.ts
|
|
693
695
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
694
696
|
|
|
695
697
|
// src/index.ts
|
|
696
|
-
var VERSION = "0.7.
|
|
698
|
+
var VERSION = "0.7.5";
|
|
697
699
|
|
|
698
700
|
// src/cli/commands/install.ts
|
|
699
701
|
var IMPORT_LINE = `import "brakit";`;
|
|
@@ -807,7 +809,7 @@ async function setupNextjs(rootDir) {
|
|
|
807
809
|
`}`,
|
|
808
810
|
``
|
|
809
811
|
].join("\n");
|
|
810
|
-
await
|
|
812
|
+
await writeFile3(absPath, content);
|
|
811
813
|
return { action: "created", file: relPath, content };
|
|
812
814
|
}
|
|
813
815
|
async function setupNuxt(rootDir) {
|
|
@@ -825,7 +827,7 @@ async function setupNuxt(rootDir) {
|
|
|
825
827
|
const dir = join2(rootDir, "server/plugins");
|
|
826
828
|
const { mkdirSync: mkdirSync3 } = await import("fs");
|
|
827
829
|
mkdirSync3(dir, { recursive: true });
|
|
828
|
-
await
|
|
830
|
+
await writeFile3(absPath, content);
|
|
829
831
|
return { action: "created", file: relPath, content };
|
|
830
832
|
}
|
|
831
833
|
async function setupPrepend(rootDir, ...candidates) {
|
|
@@ -836,7 +838,7 @@ async function setupPrepend(rootDir, ...candidates) {
|
|
|
836
838
|
if (content.includes(IMPORT_MARKER)) {
|
|
837
839
|
return { action: "exists", file: relPath };
|
|
838
840
|
}
|
|
839
|
-
await
|
|
841
|
+
await writeFile3(absPath, `${IMPORT_LINE}
|
|
840
842
|
${content}`);
|
|
841
843
|
return { action: "prepended", file: relPath };
|
|
842
844
|
}
|
|
@@ -890,7 +892,7 @@ function printManualInstructions(framework) {
|
|
|
890
892
|
// src/cli/commands/uninstall.ts
|
|
891
893
|
import { defineCommand as defineCommand2 } from "citty";
|
|
892
894
|
import { resolve as resolve4, join as join3 } from "path";
|
|
893
|
-
import { readFile as readFile4, writeFile as
|
|
895
|
+
import { readFile as readFile4, writeFile as writeFile4, unlink } from "fs/promises";
|
|
894
896
|
import { execSync as execSync2 } from "child_process";
|
|
895
897
|
import pc2 from "picocolors";
|
|
896
898
|
var IMPORT_LINE2 = `import "brakit";`;
|
|
@@ -968,7 +970,7 @@ var uninstall_default = defineCommand2({
|
|
|
968
970
|
const content = await readFile4(absPath, "utf-8");
|
|
969
971
|
if (!content.includes(IMPORT_LINE2)) continue;
|
|
970
972
|
const updated = content.split("\n").filter((line) => line.trim() !== IMPORT_LINE2.trim()).join("\n");
|
|
971
|
-
await
|
|
973
|
+
await writeFile4(absPath, updated);
|
|
972
974
|
console.log(pc2.green(` \u2713 Removed brakit import from ${relPath}`));
|
|
973
975
|
removed = true;
|
|
974
976
|
break;
|