@hakam-aldeen-kh/blix 0.7.0 → 0.9.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/README.md +99 -23
- package/dist/{DevToolsPanel-OQJ2KXYL.js → DevToolsPanel-5XOY5WN5.js} +3410 -1859
- package/dist/capture/index.d.ts +18 -0
- package/dist/capture/index.js +2 -2
- package/dist/{chunk-2V2YJ5ML.js → chunk-IWI5YFYP.js} +14 -5
- package/dist/{chunk-GGVNJ6QZ.js → chunk-TV2KC74D.js} +1 -1
- package/dist/index.js +14 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,8 @@ a dockable panel with cross-source links, diffing, replay and HAR/cURL
|
|
|
7
7
|
export.
|
|
8
8
|
|
|
9
9
|
The entire panel is eliminated from production builds — see
|
|
10
|
-
[Production elimination](#production-elimination).
|
|
10
|
+
[Production elimination](#production-elimination). To keep it on a staging
|
|
11
|
+
server, see [Enabling Blix in a production build](#enabling-blix-in-a-production-build-staging).
|
|
11
12
|
|
|
12
13
|
Release notes are in [CHANGELOG.md](https://github.com/Hakam-aldeen-Kh/blix/blob/main/CHANGELOG.md).
|
|
13
14
|
|
|
@@ -397,7 +398,9 @@ never creating one of its own — and the panel updates.
|
|
|
397
398
|
It is a **silent no-op** — never a throw, never a console warning — in every
|
|
398
399
|
one of these:
|
|
399
400
|
|
|
400
|
-
- outside development (`process.env.NODE_ENV !== "development"`)
|
|
401
|
+
- outside development (`process.env.NODE_ENV !== "development"`), unless the
|
|
402
|
+
build opted in with `NEXT_PUBLIC_BLIX=true` (see
|
|
403
|
+
[staging](#enabling-blix-in-a-production-build-staging));
|
|
401
404
|
- **outside the browser** — the gate is also `typeof window !== "undefined"`,
|
|
402
405
|
so every call made while rendering on the server does nothing, by design (see
|
|
403
406
|
[Production elimination](#production-elimination));
|
|
@@ -721,7 +724,11 @@ import { store } from "@/src/store";
|
|
|
721
724
|
// module graph, which fails the production build. Importing them here keeps
|
|
722
725
|
// that evaluation on the client side of the boundary.
|
|
723
726
|
export default function BlixMount() {
|
|
724
|
-
if (
|
|
727
|
+
if (
|
|
728
|
+
process.env.NODE_ENV !== "development" &&
|
|
729
|
+
process.env.NEXT_PUBLIC_BLIX !== "true"
|
|
730
|
+
)
|
|
731
|
+
return null;
|
|
725
732
|
return <Blix store={store} apiClient={apiClient} dbName="my-app" />;
|
|
726
733
|
}
|
|
727
734
|
```
|
|
@@ -786,16 +793,25 @@ The panel is one header, one rail and two panes.
|
|
|
786
793
|
Query. They are not filters over one table: each has its own columns and its
|
|
787
794
|
own notion of a row, so switching source switches the whole view. `1`–`4` jump
|
|
788
795
|
between them, and each keeps its own selection, so stepping to Redux and back
|
|
789
|
-
returns you to the request you were reading.
|
|
790
|
-
|
|
791
|
-
|
|
796
|
+
returns you to the request you were reading. Each row ends with its own number
|
|
797
|
+
key, because a shortcut is best taught where it is used. Below the sources it
|
|
798
|
+
carries the session totals; collapsed, it keeps the sources and their counts
|
|
799
|
+
and drops the totals, since four numbers without their labels are four
|
|
800
|
+
unattributed numbers.
|
|
792
801
|
|
|
793
802
|
**The header is the session**, not the entry: whether capture is running, what
|
|
794
|
-
is being filtered out, and where the panel lives.
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
803
|
+
is being filtered out, and where the panel lives. While a filter is on, the
|
|
804
|
+
field carries its own count — `8 of 56` — and a clear button, so you never
|
|
805
|
+
have to read the status bar to know one is applied. `.*` widens the search to
|
|
806
|
+
request and response bodies.
|
|
807
|
+
|
|
808
|
+
**The red bin beside Export clears the source you are reading**, and only
|
|
809
|
+
that one: emptying Redux leaves Network alone. Pinned entries survive it, and
|
|
810
|
+
it is disabled when the source has nothing left to clear. To empty every
|
|
811
|
+
source at once, use **Clear log** in the overflow menu, or `⇧C`.
|
|
812
|
+
|
|
813
|
+
The panel opens **floating** the first time. Dock it to the bottom or the
|
|
814
|
+
right from the header; the choice is saved per project.
|
|
799
815
|
|
|
800
816
|
**`Ctrl/⌘ K` opens the command palette**, and for several things it is the only
|
|
801
817
|
way in — sort order, row density, dock position, the copy formats, the filter
|
|
@@ -804,6 +820,13 @@ reach for occasionally lives one keystroke away instead of costing a button
|
|
|
804
820
|
each. Every row shows its key binding where it has one, so the palette teaches
|
|
805
821
|
its own shortcuts. `?` still opens the full cheatsheet.
|
|
806
822
|
|
|
823
|
+
**The columns are yours.** Right-click the column head — or open **Columns** in
|
|
824
|
+
the overflow menu — and switch off any of Pin, Method, Size, Status, Time,
|
|
825
|
+
Linked and Timing. The choice persists. ROUTE has no switch: it is the column
|
|
826
|
+
that says *which* entry a row is, and a list of rows you cannot identify is not
|
|
827
|
+
a list. A narrow pane drops columns on its own, worst-affordable first, so the
|
|
828
|
+
route keeps the width it needs.
|
|
829
|
+
|
|
807
830
|
**Linked events tie the sources together.** When Blix can see that a query
|
|
808
831
|
caused a request, that a request came from a query, or that one entry is a
|
|
809
832
|
replay of another, the row grows a coloured tick and the foot of the detail
|
|
@@ -895,14 +918,18 @@ panel's other preferences and survives a reload.
|
|
|
895
918
|
The panel never inherits your app's styling — it portals outside every stacking
|
|
896
919
|
context and ships its own palettes, so nothing you do to your own theme can
|
|
897
920
|
distort it. Themes are complete rather than partial: every colour the panel
|
|
898
|
-
paints, down to the JSON syntax highlighting and the
|
|
899
|
-
the active theme.
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
for
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
921
|
+
paints, down to the JSON syntax highlighting and the timing bars, comes from
|
|
922
|
+
the active theme. The two tones that carry text are held to 4.5:1 against every
|
|
923
|
+
ground they land on, which is why a few of the ported palettes differ by a
|
|
924
|
+
shade from the originals in the slots used for dense monospace. One tone is
|
|
925
|
+
deliberately below it and may never hold text: it is for separators, payload
|
|
926
|
+
punctuation and disabled glyphs.
|
|
927
|
+
|
|
928
|
+
There is no API for adding your own; a theme is 33 colour slots in
|
|
929
|
+
`src/ui/themes/bx.ts` if you are working from source. Every theme fills the
|
|
930
|
+
same set — a theme that cannot is reported in the console during development,
|
|
931
|
+
along with any whose text tones fall under 4.5:1 on a ground they actually
|
|
932
|
+
land on.
|
|
906
933
|
|
|
907
934
|
### `dbName` — when you need it
|
|
908
935
|
|
|
@@ -1002,8 +1029,55 @@ payloads for the lifetime of the server. Keeping the server-side singleton
|
|
|
1002
1029
|
permanently empty is the point.
|
|
1003
1030
|
|
|
1004
1031
|
Practically: a `captureEncrypted` call that runs during SSR does nothing, and
|
|
1005
|
-
`<Blix />`
|
|
1006
|
-
|
|
1032
|
+
`<Blix />` renders nothing there. It also renders nothing during hydration, so
|
|
1033
|
+
its first client render matches the server's HTML; the panel mounts on the
|
|
1034
|
+
render right after. (Before 0.9.0 it branched on `typeof window` instead,
|
|
1035
|
+
which Next.js reported as a hydration mismatch on every load.)
|
|
1036
|
+
|
|
1037
|
+
### Enabling Blix in a production build (staging)
|
|
1038
|
+
|
|
1039
|
+
A staging or test server usually runs a production build, where the panel is
|
|
1040
|
+
gone by design. Setting `NODE_ENV=development` for that build does not bring
|
|
1041
|
+
it back on Next.js 16: `next build` runs on Turbopack and inlines `NODE_ENV`
|
|
1042
|
+
as `"production"` whatever the environment says.
|
|
1043
|
+
|
|
1044
|
+
Opt in explicitly instead, in that server's env file:
|
|
1045
|
+
|
|
1046
|
+
```bash
|
|
1047
|
+
NEXT_PUBLIC_BLIX=true
|
|
1048
|
+
```
|
|
1049
|
+
|
|
1050
|
+
The panel and the capture layer both check it next to `NODE_ENV`, as the same
|
|
1051
|
+
kind of literal comparison, so Next.js inlines it at build time.
|
|
1052
|
+
|
|
1053
|
+
> **Set `NEXT_PUBLIC_BLIX=false` in your production env file.** Next.js only
|
|
1054
|
+
> inlines variables that are defined. Left unset, the comparison stays in the
|
|
1055
|
+
> bundle as a runtime check: the panel still never loads — the variable is
|
|
1056
|
+
> undefined in the browser — but its chunk is emitted into your production
|
|
1057
|
+
> build. `false` lets the bundler fold the check and drop the chunk.
|
|
1058
|
+
|
|
1059
|
+
**Never set `NEXT_PUBLIC_BLIX=true` for a build that real users get.** It
|
|
1060
|
+
ships the monitor to them, and with it everything it captures — see
|
|
1061
|
+
[Security](#security).
|
|
1062
|
+
|
|
1063
|
+
**Your own guards need the variable too.** A mount component that returns
|
|
1064
|
+
`null` outside development (as in [Mounting the panel](#mounting-the-panel)),
|
|
1065
|
+
or a call-site guard around `attachHttpMonitor` (below), keeps Blix off on
|
|
1066
|
+
staging regardless of the variable. Add it to each:
|
|
1067
|
+
|
|
1068
|
+
```ts
|
|
1069
|
+
if (
|
|
1070
|
+
(process.env.NODE_ENV === "development" ||
|
|
1071
|
+
process.env.NEXT_PUBLIC_BLIX === "true") &&
|
|
1072
|
+
typeof window !== "undefined"
|
|
1073
|
+
) {
|
|
1074
|
+
attachHttpMonitor(apiClient);
|
|
1075
|
+
}
|
|
1076
|
+
```
|
|
1077
|
+
|
|
1078
|
+
The variable is read under its `NEXT_PUBLIC_` name, which is a Next.js
|
|
1079
|
+
convention. The opt-in has been verified with Next.js 16 (Turbopack) only;
|
|
1080
|
+
other bundlers do not inline that name by default.
|
|
1007
1081
|
|
|
1008
1082
|
### Guard your call sites
|
|
1009
1083
|
|
|
@@ -1073,10 +1147,12 @@ option to keep a third party's traffic out of the log.
|
|
|
1073
1147
|
By default all of that is **in memory only**. Nothing is written to disk, and
|
|
1074
1148
|
a reload starts clean.
|
|
1075
1149
|
|
|
1076
|
-
All of it is dev-only
|
|
1150
|
+
All of it is dev-only unless you opt a build in. Capture is gated on
|
|
1077
1151
|
`process.env.NODE_ENV === "development" && typeof window !== "undefined"`, and
|
|
1078
1152
|
the database is opened only when the panel mounts — see
|
|
1079
|
-
[Production elimination](#production-elimination).
|
|
1153
|
+
[Production elimination](#production-elimination). A build made with
|
|
1154
|
+
`NEXT_PUBLIC_BLIX=true` captures exactly as development does, so everything in
|
|
1155
|
+
this section applies to whoever uses that build.
|
|
1080
1156
|
|
|
1081
1157
|
### What reaches disk, and when
|
|
1082
1158
|
|