headson 0.5.1__tar.gz → 0.5.3__tar.gz
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.
Potentially problematic release.
This version of headson might be problematic. Click here for more details.
- {headson-0.5.1 → headson-0.5.3}/Cargo.lock +1 -1
- {headson-0.5.1 → headson-0.5.3}/Cargo.toml +2 -1
- {headson-0.5.1 → headson-0.5.3}/PKG-INFO +6 -39
- {headson-0.5.1 → headson-0.5.3}/README.md +5 -38
- headson-0.5.3/docs/assets/algorithm.svg +81 -0
- {headson-0.5.1 → headson-0.5.3}/pyproject.toml +1 -1
- {headson-0.5.1 → headson-0.5.3}/python/Cargo.lock +2 -2
- {headson-0.5.1 → headson-0.5.3}/python/Cargo.toml +1 -1
- {headson-0.5.1 → headson-0.5.3}/src/main.rs +16 -9
- {headson-0.5.1 → headson-0.5.3}/JSONTestSuite/LICENSE +0 -0
- {headson-0.5.1 → headson-0.5.3}/JSONTestSuite/README.md +0 -0
- {headson-0.5.1 → headson-0.5.3}/LICENSE +0 -0
- {headson-0.5.1 → headson-0.5.3}/python/README.md +0 -0
- {headson-0.5.1 → headson-0.5.3}/python/headson/__init__.py +0 -0
- {headson-0.5.1 → headson-0.5.3}/python/src/lib.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/json_ingest/builder.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/json_ingest/mod.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/json_ingest/samplers/default.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/json_ingest/samplers/head.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/json_ingest/samplers/mod.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/json_ingest/samplers/tail.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/lib.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/order/build.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/order/mod.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/order/scoring.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/order/snapshots/headson__order__build__tests__order_empty_array_order.snap +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/order/snapshots/headson__order__build__tests__order_single_string_array_order.snap +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/order/types.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/serialization/fileset.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/serialization/mod.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/serialization/snapshots/headson__serialization__tests__arena_render_empty.snap +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/serialization/snapshots/headson__serialization__tests__arena_render_single.snap +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/serialization/templates/core.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/serialization/templates/js.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/serialization/templates/json.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/serialization/templates/mod.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/serialization/templates/pseudo.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/serialization/types.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/snapshots/headson__order__tests__order_empty_array_order.snap +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/snapshots/headson__order__tests__order_single_string_array_order.snap +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/snapshots/headson__order__tests__pq_empty_array_queue.snap +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/snapshots/headson__order__tests__pq_single_string_array_queue.snap +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/snapshots/headson__queue__tests__pq_empty_array_queue.snap +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/snapshots/headson__queue__tests__pq_single_string_array_queue.snap +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/snapshots/headson__tree__tests__build_tree_empty.snap +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/snapshots/headson__tree__tests__build_tree_single.snap +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/utils/graph.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/utils/json.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/utils/mod.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/utils/search.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/utils/text.rs +0 -0
- {headson-0.5.1 → headson-0.5.3}/src/utils/tree_arena.rs +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "headson"
|
|
3
|
-
version = "0.5.
|
|
3
|
+
version = "0.5.3"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
description = "Budget‑constrained JSON preview renderer"
|
|
6
6
|
readme = "README.md"
|
|
@@ -15,6 +15,7 @@ include = [
|
|
|
15
15
|
"src/**",
|
|
16
16
|
"Cargo.toml",
|
|
17
17
|
"README.md",
|
|
18
|
+
"docs/assets/**",
|
|
18
19
|
"LICENSE*",
|
|
19
20
|
]
|
|
20
21
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: headson
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.3
|
|
4
4
|
Classifier: Programming Language :: Python
|
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
|
6
6
|
Classifier: Programming Language :: Rust
|
|
@@ -58,8 +58,9 @@ If you’re comfortable with tools like `head` and `tail`, use `headson` when yo
|
|
|
58
58
|
|
|
59
59
|
Common flags:
|
|
60
60
|
|
|
61
|
-
- `-n, --budget <BYTES>`: per‑file output budget. When multiple input files are provided, the total budget equals `<BYTES> * number_of_inputs`.
|
|
62
|
-
- `-N, --global-budget <BYTES>`: total output budget across all inputs. Useful when you want a fixed-size preview across many files (may omit entire files).
|
|
61
|
+
- `-n, --budget <BYTES>`: per‑file output budget. When multiple input files are provided, the default total budget equals `<BYTES> * number_of_inputs`.
|
|
62
|
+
- `-N, --global-budget <BYTES>`: total output budget across all inputs. Useful when you want a fixed-size preview across many files (may omit entire files).
|
|
63
|
+
- When used together with `--budget`, the final total budget is `min(global, per_file * number_of_inputs)`. Files are only truncated if they don't fit into this final global limit, and no single file expands beyond the per‑file budget.
|
|
63
64
|
- `-f, --template <json|pseudo|js>`: output style (default: `pseudo`)
|
|
64
65
|
- `-m, --compact`: no indentation, no spaces, no newlines
|
|
65
66
|
- `--no-newline`: single line output
|
|
@@ -167,48 +168,14 @@ print(
|
|
|
167
168
|
|
|
168
169
|
# Algorithm
|
|
169
170
|
|
|
170
|
-
|
|
171
|
-
%%{init: {"themeCSS": ".cluster > rect { fill: transparent; stroke: transparent; } .clusterLabel > text { font-size: 16px; font-weight: 600; } .clusterLabel span { padding: 6px 10px; font-size: 16px; font-weight: 600; }"}}%%
|
|
172
|
-
flowchart TD
|
|
173
|
-
subgraph Deserialization
|
|
174
|
-
direction TB
|
|
175
|
-
A["Input file(s)"]
|
|
176
|
-
A -- Single --> C["Parse into optimized tree (with array pre‑sampling) ¹"]
|
|
177
|
-
A -- Multiple --> D["Parse each file and wrap into a fileset object"]
|
|
178
|
-
D --> C
|
|
179
|
-
end
|
|
180
|
-
subgraph Prioritization
|
|
181
|
-
direction TB
|
|
182
|
-
E["Build priority order ²"]
|
|
183
|
-
F["Choose top N nodes ³"]
|
|
184
|
-
end
|
|
185
|
-
subgraph Serialization
|
|
186
|
-
direction TB
|
|
187
|
-
G["Render attempt ⁴"]
|
|
188
|
-
H["Output preview string"]
|
|
189
|
-
end
|
|
190
|
-
C --> E
|
|
191
|
-
E --> F
|
|
192
|
-
F --> G
|
|
193
|
-
G --> F
|
|
194
|
-
F --> H
|
|
195
|
-
%% Color classes for categories
|
|
196
|
-
classDef des fill:#eaf2ff,stroke:#3b82f6,stroke-width:1px,color:#0f172a;
|
|
197
|
-
classDef prio fill:#ecfdf5,stroke:#10b981,stroke-width:1px,color:#064e3b;
|
|
198
|
-
classDef ser fill:#fff1f2,stroke:#f43f5e,stroke-width:1px,color:#7f1d1d;
|
|
199
|
-
class A,C,D des;
|
|
200
|
-
class E,F prio;
|
|
201
|
-
class G,H ser;
|
|
202
|
-
style Deserialization fill:transparent,stroke:transparent
|
|
203
|
-
style Prioritization fill:transparent,stroke:transparent
|
|
204
|
-
style Serialization fill:transparent,stroke:transparent
|
|
205
|
-
```
|
|
171
|
+

|
|
206
172
|
|
|
207
173
|
## Footnotes
|
|
208
174
|
- <sup><b>[1]</b></sup> <b>Optimized tree representation</b>: An arena‑style tree stored in flat, contiguous buffers. Each node records its kind and value plus index ranges into shared child and key arrays. Arrays are ingested in a single pass and may be deterministically pre‑sampled: the first element is always kept; additional elements are selected via a fixed per‑index inclusion test; for kept elements, original indices are stored and full lengths are counted. This enables accurate omission info and internal gap markers later, while minimizing pointer chasing.
|
|
209
175
|
- <sup><b>[2]</b></sup> <b>Priority order</b>: Nodes are scored so previews surface representative structure and values first. Arrays can favor head/mid/tail coverage (default) or strictly the head; tail preference flips head/tail when configured. Object properties are ordered by key, and strings expand by grapheme with early characters prioritized over very deep expansions.
|
|
210
176
|
- <sup><b>[3]</b></sup> <b>Choose top N nodes (binary search)</b>: Iteratively picks N so that the rendered preview fits within the character budget, looping between “choose N” and a render attempt to converge quickly.
|
|
211
177
|
- <sup><b>[4]</b></sup> <b>Render attempt</b>: Serializes the currently included nodes using the selected template. Omission summaries and per-file section headers appear in display templates (pseudo/js); json remains strict. For arrays, display templates may insert internal gap markers between non‑contiguous kept items using original indices.
|
|
178
|
+
- <sup><b>[5]</b></sup> <b>Diagram source</b>: The Algorithm diagram is generated from `docs/diagrams/algorithm.mmd`. Regenerate the SVG with `cargo make diagrams` before releasing.
|
|
212
179
|
|
|
213
180
|
## License
|
|
214
181
|
|
|
@@ -43,8 +43,9 @@ If you’re comfortable with tools like `head` and `tail`, use `headson` when yo
|
|
|
43
43
|
|
|
44
44
|
Common flags:
|
|
45
45
|
|
|
46
|
-
- `-n, --budget <BYTES>`: per‑file output budget. When multiple input files are provided, the total budget equals `<BYTES> * number_of_inputs`.
|
|
47
|
-
- `-N, --global-budget <BYTES>`: total output budget across all inputs. Useful when you want a fixed-size preview across many files (may omit entire files).
|
|
46
|
+
- `-n, --budget <BYTES>`: per‑file output budget. When multiple input files are provided, the default total budget equals `<BYTES> * number_of_inputs`.
|
|
47
|
+
- `-N, --global-budget <BYTES>`: total output budget across all inputs. Useful when you want a fixed-size preview across many files (may omit entire files).
|
|
48
|
+
- When used together with `--budget`, the final total budget is `min(global, per_file * number_of_inputs)`. Files are only truncated if they don't fit into this final global limit, and no single file expands beyond the per‑file budget.
|
|
48
49
|
- `-f, --template <json|pseudo|js>`: output style (default: `pseudo`)
|
|
49
50
|
- `-m, --compact`: no indentation, no spaces, no newlines
|
|
50
51
|
- `--no-newline`: single line output
|
|
@@ -152,48 +153,14 @@ print(
|
|
|
152
153
|
|
|
153
154
|
# Algorithm
|
|
154
155
|
|
|
155
|
-
|
|
156
|
-
%%{init: {"themeCSS": ".cluster > rect { fill: transparent; stroke: transparent; } .clusterLabel > text { font-size: 16px; font-weight: 600; } .clusterLabel span { padding: 6px 10px; font-size: 16px; font-weight: 600; }"}}%%
|
|
157
|
-
flowchart TD
|
|
158
|
-
subgraph Deserialization
|
|
159
|
-
direction TB
|
|
160
|
-
A["Input file(s)"]
|
|
161
|
-
A -- Single --> C["Parse into optimized tree (with array pre‑sampling) ¹"]
|
|
162
|
-
A -- Multiple --> D["Parse each file and wrap into a fileset object"]
|
|
163
|
-
D --> C
|
|
164
|
-
end
|
|
165
|
-
subgraph Prioritization
|
|
166
|
-
direction TB
|
|
167
|
-
E["Build priority order ²"]
|
|
168
|
-
F["Choose top N nodes ³"]
|
|
169
|
-
end
|
|
170
|
-
subgraph Serialization
|
|
171
|
-
direction TB
|
|
172
|
-
G["Render attempt ⁴"]
|
|
173
|
-
H["Output preview string"]
|
|
174
|
-
end
|
|
175
|
-
C --> E
|
|
176
|
-
E --> F
|
|
177
|
-
F --> G
|
|
178
|
-
G --> F
|
|
179
|
-
F --> H
|
|
180
|
-
%% Color classes for categories
|
|
181
|
-
classDef des fill:#eaf2ff,stroke:#3b82f6,stroke-width:1px,color:#0f172a;
|
|
182
|
-
classDef prio fill:#ecfdf5,stroke:#10b981,stroke-width:1px,color:#064e3b;
|
|
183
|
-
classDef ser fill:#fff1f2,stroke:#f43f5e,stroke-width:1px,color:#7f1d1d;
|
|
184
|
-
class A,C,D des;
|
|
185
|
-
class E,F prio;
|
|
186
|
-
class G,H ser;
|
|
187
|
-
style Deserialization fill:transparent,stroke:transparent
|
|
188
|
-
style Prioritization fill:transparent,stroke:transparent
|
|
189
|
-
style Serialization fill:transparent,stroke:transparent
|
|
190
|
-
```
|
|
156
|
+

|
|
191
157
|
|
|
192
158
|
## Footnotes
|
|
193
159
|
- <sup><b>[1]</b></sup> <b>Optimized tree representation</b>: An arena‑style tree stored in flat, contiguous buffers. Each node records its kind and value plus index ranges into shared child and key arrays. Arrays are ingested in a single pass and may be deterministically pre‑sampled: the first element is always kept; additional elements are selected via a fixed per‑index inclusion test; for kept elements, original indices are stored and full lengths are counted. This enables accurate omission info and internal gap markers later, while minimizing pointer chasing.
|
|
194
160
|
- <sup><b>[2]</b></sup> <b>Priority order</b>: Nodes are scored so previews surface representative structure and values first. Arrays can favor head/mid/tail coverage (default) or strictly the head; tail preference flips head/tail when configured. Object properties are ordered by key, and strings expand by grapheme with early characters prioritized over very deep expansions.
|
|
195
161
|
- <sup><b>[3]</b></sup> <b>Choose top N nodes (binary search)</b>: Iteratively picks N so that the rendered preview fits within the character budget, looping between “choose N” and a render attempt to converge quickly.
|
|
196
162
|
- <sup><b>[4]</b></sup> <b>Render attempt</b>: Serializes the currently included nodes using the selected template. Omission summaries and per-file section headers appear in display templates (pseudo/js); json remains strict. For arrays, display templates may insert internal gap markers between non‑contiguous kept items using original indices.
|
|
163
|
+
- <sup><b>[5]</b></sup> <b>Diagram source</b>: The Algorithm diagram is generated from `docs/diagrams/algorithm.mmd`. Regenerate the SVG with `cargo make diagrams` before releasing.
|
|
197
164
|
|
|
198
165
|
## License
|
|
199
166
|
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<svg id="my-svg" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="max-width: 597.039px; background-color: transparent;" viewBox="-8 -8 597.0390625 811" role="graphics-document document" aria-roledescription="flowchart-v2"><style>#my-svg{font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,Arial,'Apple Color Emoji','Segoe UI Emoji',sans-serif;font-size:14px;fill:#000000;}#my-svg .error-icon{fill:#552222;}#my-svg .error-text{fill:#552222;stroke:#552222;}#my-svg .edge-thickness-normal{stroke-width:2px;}#my-svg .edge-thickness-thick{stroke-width:3.5px;}#my-svg .edge-pattern-solid{stroke-dasharray:0;}#my-svg .edge-pattern-dashed{stroke-dasharray:3;}#my-svg .edge-pattern-dotted{stroke-dasharray:2;}#my-svg .marker{fill:#666;stroke:#666;}#my-svg .marker.cross{stroke:#666;}#my-svg svg{font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,Arial,'Apple Color Emoji','Segoe UI Emoji',sans-serif;font-size:14px;}#my-svg .label{font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,Arial,'Apple Color Emoji','Segoe UI Emoji',sans-serif;color:#000000;}#my-svg .cluster-label text{fill:#333;}#my-svg .cluster-label span,#my-svg p{color:#333;}#my-svg .label text,#my-svg span,#my-svg p{fill:#000000;color:#000000;}#my-svg .node rect,#my-svg .node circle,#my-svg .node ellipse,#my-svg .node polygon,#my-svg .node path{fill:#eee;stroke:#999;stroke-width:1px;}#my-svg .flowchart-label text{text-anchor:middle;}#my-svg .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#my-svg .node .label{text-align:center;}#my-svg .node.clickable{cursor:pointer;}#my-svg .arrowheadPath{fill:#333333;}#my-svg .edgePath .path{stroke:#666;stroke-width:2.0px;}#my-svg .flowchart-link{stroke:#666;fill:none;}#my-svg .edgeLabel{background-color:white;text-align:center;}#my-svg .edgeLabel rect{opacity:0.5;background-color:white;fill:white;}#my-svg .labelBkg{background-color:rgba(255, 255, 255, 0.5);}#my-svg .cluster rect{fill:hsl(0, 0%, 98.9215686275%);stroke:#707070;stroke-width:1px;}#my-svg .cluster text{fill:#333;}#my-svg .cluster span,#my-svg p{color:#333;}#my-svg div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,Arial,'Apple Color Emoji','Segoe UI Emoji',sans-serif;font-size:12px;background:hsl(-160, 0%, 93.3333333333%);border:1px solid #707070;border-radius:2px;pointer-events:none;z-index:100;}#my-svg .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#000000;}#my-svg :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}#my-svg .des>*{fill:#eaf2ff!important;stroke:#3b82f6!important;stroke-width:1px!important;color:#0f172a!important;}#my-svg .des span{fill:#eaf2ff!important;stroke:#3b82f6!important;stroke-width:1px!important;color:#0f172a!important;}#my-svg .des tspan{fill:#0f172a!important;}#my-svg .prio>*{fill:#ecfdf5!important;stroke:#10b981!important;stroke-width:1px!important;color:#064e3b!important;}#my-svg .prio span{fill:#ecfdf5!important;stroke:#10b981!important;stroke-width:1px!important;color:#064e3b!important;}#my-svg .prio tspan{fill:#064e3b!important;}#my-svg .ser>*{fill:#fff1f2!important;stroke:#f43f5e!important;stroke-width:1px!important;color:#7f1d1d!important;}#my-svg .ser span{fill:#fff1f2!important;stroke:#f43f5e!important;stroke-width:1px!important;color:#7f1d1d!important;}#my-svg .ser tspan{fill:#7f1d1d!important;}</style><g><marker id="my-svg_flowchart-pointEnd" class="marker flowchart" viewBox="0 0 10 10" refX="6" refY="5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"><path d="M 0 0 L 10 5 L 0 10 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"/></marker><marker id="my-svg_flowchart-pointStart" class="marker flowchart" viewBox="0 0 10 10" refX="4.5" refY="5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"><path d="M 0 5 L 10 10 L 10 0 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"/></marker><marker id="my-svg_flowchart-circleEnd" class="marker flowchart" viewBox="0 0 10 10" refX="11" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"/></marker><marker id="my-svg_flowchart-circleStart" class="marker flowchart" viewBox="0 0 10 10" refX="-1" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"/></marker><marker id="my-svg_flowchart-crossEnd" class="marker cross flowchart" viewBox="0 0 11 11" refX="12" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"/></marker><marker id="my-svg_flowchart-crossStart" class="marker cross flowchart" viewBox="0 0 11 11" refX="-1" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"/></marker><g class="root"><g class="clusters"><g class="cluster default flowchart-label" id="Serialization"><rect style="" rx="0" ry="0" x="0" y="442" width="231.734375" height="353"/></g><g class="cluster default flowchart-label" id="Prioritization"><rect style="" rx="0" ry="0" x="251.734375" y="442" width="229.625" height="214"/></g><g class="cluster default flowchart-label" id="Deserialization"><rect style="" rx="0" ry="0" x="197.60546875" y="0" width="383.43359375" height="378"/></g></g><g class="edgePaths"><path d="M335.473,75L326.746,81.917C318.019,88.833,300.564,102.667,291.837,121.667C283.109,140.667,283.109,164.833,283.109,187.417C283.109,210,283.109,231,289.147,246.285C295.184,261.569,307.258,271.139,313.295,275.923L319.333,280.708" id="L-A-C-0" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-A LE-C" style="fill:none;" marker-end="url(#my-svg_flowchart-pointEnd)"/><path d="M389.73,75L398.457,81.917C407.184,88.833,424.639,102.667,433.366,115.617C442.094,128.567,442.094,140.633,442.094,146.667L442.094,152.7" id="L-A-D-0" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-A LE-D" style="fill:none;" marker-end="url(#my-svg_flowchart-pointEnd)"/><path d="M442.094,220L442.094,225.333C442.094,230.667,442.094,241.333,436.057,251.451C430.019,261.569,417.945,271.139,411.908,275.923L405.87,280.708" id="L-D-C-0" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-D LE-C" style="fill:none;" marker-end="url(#my-svg_flowchart-pointEnd)"/><path d="M362.602,346L362.602,351.333C362.602,356.667,362.602,367.333,362.602,378C362.602,388.667,362.602,399.333,362.602,410C362.602,420.667,362.602,431.333,362.602,441.117C362.602,450.9,362.602,459.8,362.602,464.25L362.602,468.7" id="L-C-E-0" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-C LE-E" style="fill:none;" marker-end="url(#my-svg_flowchart-pointEnd)"/><path d="M362.602,517L362.602,522.333C362.602,527.667,362.602,538.333,362.93,548.119C363.258,557.905,363.915,566.81,364.243,571.262L364.572,575.714" id="L-E-F-0" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-E LE-F" style="fill:none;" marker-end="url(#my-svg_flowchart-pointEnd)"/><path d="M283.734,581.462L262.438,576.052C241.141,570.641,198.547,559.821,173.784,549.784C149.02,539.747,142.087,530.494,138.621,525.868L135.155,521.241" id="L-F-G-0" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-F LE-G" style="fill:none;" marker-end="url(#my-svg_flowchart-pointEnd)"/><path d="M99.758,517L95.762,522.333C91.766,527.667,83.773,538.333,113.567,549.884C143.361,561.435,210.942,573.869,244.732,580.086L278.522,586.304" id="L-G-F-0" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-G LE-F" style="fill:none;" marker-end="url(#my-svg_flowchart-pointEnd)"/><path d="M366.547,624L366.547,629.333C366.547,634.667,366.547,645.333,324.767,656C282.987,666.667,199.427,677.333,157.647,687.117C115.867,696.9,115.867,705.8,115.867,710.25L115.867,714.7" id="L-F-H-0" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-F LE-H" style="fill:none;" marker-end="url(#my-svg_flowchart-pointEnd)"/></g><g class="edgeLabels"><g class="edgeLabel" transform="translate(283.109375, 189)"><g class="label" transform="translate(-20.0390625, -9.5)"><foreignObject width="40.078125" height="19"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="edgeLabel">Single</span></div></foreignObject></g></g><g class="edgeLabel" transform="translate(442.09375, 116.5)"><g class="label" transform="translate(-26.875, -9.5)"><foreignObject width="53.75" height="19"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="edgeLabel">Multiple</span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="edgeLabel"></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="edgeLabel"></span></div></foreignObject></g></g></g><g class="nodes"><g class="node default ser flowchart-label" id="flowchart-G-9" data-node="true" data-id="G" transform="translate(115.8671875, 495.5)"><rect class="basic label-container" style="" rx="0" ry="0" x="-68.171875" y="-21.5" width="136.34375" height="43"/><g class="label" style="" transform="translate(-56.171875, -9.5)"><rect/><foreignObject width="112.34375" height="19"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="nodeLabel">Render attempt ⁴</span></div></foreignObject></g></g><g class="node default ser flowchart-label" id="flowchart-H-10" data-node="true" data-id="H" transform="translate(115.8671875, 741.5)"><rect class="basic label-container" style="" rx="0" ry="0" x="-83.8671875" y="-21.5" width="167.734375" height="43"/><g class="label" style="" transform="translate(-71.8671875, -9.5)"><rect/><foreignObject width="143.734375" height="19"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="nodeLabel">Output preview string</span></div></foreignObject></g></g><g class="node default prio flowchart-label" id="flowchart-E-7" data-node="true" data-id="E" transform="translate(362.6015625, 495.5)"><rect class="basic label-container" style="" rx="0" ry="0" x="-78.8671875" y="-21.5" width="157.734375" height="43"/><g class="label" style="" transform="translate(-66.8671875, -9.5)"><rect/><foreignObject width="133.734375" height="19"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="nodeLabel">Build priority order ²</span></div></foreignObject></g></g><g class="node default prio flowchart-label" id="flowchart-F-8" data-node="true" data-id="F" transform="translate(366.546875, 602.5)"><rect class="basic label-container" style="" rx="0" ry="0" x="-82.8125" y="-21.5" width="165.625" height="43"/><g class="label" style="" transform="translate(-70.8125, -9.5)"><rect/><foreignObject width="141.625" height="19"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="nodeLabel">Choose top N nodes ³</span></div></foreignObject></g></g><g class="node default des flowchart-label" id="flowchart-A-0" data-node="true" data-id="A" transform="translate(362.6015625, 53.5)"><rect class="basic label-container" style="" rx="0" ry="0" x="-49.203125" y="-21.5" width="98.40625" height="43"/><g class="label" style="" transform="translate(-37.203125, -9.5)"><rect/><foreignObject width="74.40625" height="19"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="nodeLabel">Input file(s)</span></div></foreignObject></g></g><g class="node default des flowchart-label" id="flowchart-C-2" data-node="true" data-id="C" transform="translate(362.6015625, 315)"><rect class="basic label-container" style="" rx="0" ry="0" x="-98.96875" y="-31" width="197.9375" height="62"/><g class="label" style="" transform="translate(-86.96875, -19)"><rect/><foreignObject width="173.9375" height="38"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="nodeLabel">Parse into optimized tree<br />(with array pre‑sampling) ¹</span></div></foreignObject></g></g><g class="node default des flowchart-label" id="flowchart-D-4" data-node="true" data-id="D" transform="translate(442.09375, 189)"><rect class="basic label-container" style="" rx="0" ry="0" x="-106.9453125" y="-31" width="213.890625" height="62"/><g class="label" style="" transform="translate(-94.9453125, -19)"><rect/><foreignObject width="189.890625" height="38"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="nodeLabel">Parse each file<br />and wrap into a fileset object</span></div></foreignObject></g></g></g></g></g><style>/* Mermaid diagram CSS overrides for good light/dark rendering on GitHub/docs.rs */
|
|
2
|
+
/* Use a GitHub-like sans-serif stack for consistent sizing/flow */
|
|
3
|
+
svg, svg * { font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif; }
|
|
4
|
+
|
|
5
|
+
/* Define light defaults */
|
|
6
|
+
svg { --m-text: #0f172a; /* slate-900 */
|
|
7
|
+
--m-edge: #334155; /* slate-700 */
|
|
8
|
+
--m-label-outline: #ffffff;
|
|
9
|
+
--m-cluster-bg: #f8fafc; /* zinc-50 */
|
|
10
|
+
--m-cluster-border: #e5e7eb; /* zinc-200 */
|
|
11
|
+
--m-cluster-bg-opacity: 0.85;
|
|
12
|
+
--m-cluster-label-bg: #ffffff;
|
|
13
|
+
--m-cluster-label-fg: #0f172a;
|
|
14
|
+
--m-des-fill: #eaf2ff; --m-des-stroke: #3b82f6;
|
|
15
|
+
--m-pri-fill: #ecfdf5; --m-pri-stroke: #10b981;
|
|
16
|
+
--m-ser-fill: #fff1f2; --m-ser-stroke: #f43f5e; }
|
|
17
|
+
|
|
18
|
+
/* Dark mode overrides */
|
|
19
|
+
@media (prefers-color-scheme: dark) {
|
|
20
|
+
svg { --m-text: #e5e7eb; /* zinc-200 */
|
|
21
|
+
--m-edge: #cbd5e1; /* slate-300 */
|
|
22
|
+
--m-label-outline: #0b1220;
|
|
23
|
+
--m-cluster-bg: #0b1220; /* deep slate */
|
|
24
|
+
--m-cluster-border: #1f2937; /* slate-800 */
|
|
25
|
+
--m-cluster-bg-opacity: 0.75;
|
|
26
|
+
--m-cluster-label-bg: #000000;
|
|
27
|
+
--m-cluster-label-fg: #ffffff;
|
|
28
|
+
--m-des-fill: #0b1220; --m-des-stroke: #60a5fa; /* deeper blue bg, soft blue border */
|
|
29
|
+
--m-pri-fill: #052e2b; --m-pri-stroke: #34d399; /* deep teal bg, green border */
|
|
30
|
+
--m-ser-fill: #2a0f12; --m-ser-stroke: #fb7185; /* deep rose bg, rose border */ }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* General text and edges */
|
|
34
|
+
svg text { fill: var(--m-text) !important; }
|
|
35
|
+
svg .edgePath path, svg path { stroke: var(--m-edge) !important; }
|
|
36
|
+
/* Slimmer edges and smaller arrowheads */
|
|
37
|
+
svg .edgePath path { stroke-width: 1.1px !important; }
|
|
38
|
+
svg marker path {
|
|
39
|
+
fill: var(--m-edge) !important;
|
|
40
|
+
stroke: var(--m-edge) !important;
|
|
41
|
+
stroke-width: 1.2px !important;
|
|
42
|
+
transform-box: fill-box;
|
|
43
|
+
transform-origin: 50% 50%;
|
|
44
|
+
transform: scale(0.75);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Avoid overriding label metrics; let Mermaid compute sizes */
|
|
48
|
+
|
|
49
|
+
/* Node category fills based on classDef in the diagram (des/prio/ser) */
|
|
50
|
+
/* Remove borders from all nodes */
|
|
51
|
+
svg .node rect, svg g.node > rect, svg .label-container > rect { stroke: none !important; }
|
|
52
|
+
svg .des rect { fill: var(--m-des-fill) !important; }
|
|
53
|
+
svg .prio rect { fill: var(--m-pri-fill) !important; }
|
|
54
|
+
svg .ser rect { fill: var(--m-ser-fill) !important; }
|
|
55
|
+
|
|
56
|
+
/* Cluster boxes invisible; labels styled */
|
|
57
|
+
/* Subgraphs: no background or border, only label visible */
|
|
58
|
+
svg g.cluster rect { fill: transparent !important; stroke: transparent !important; }
|
|
59
|
+
/* Subgraph label sizing/styling for both SVG and HTML label renderers */
|
|
60
|
+
svg .clusterLabel > text, svg .cluster-label > text { font-size: 22px !important; font-weight: 700 !important; fill: var(--m-text) !important; }
|
|
61
|
+
/* HTML-based cluster labels (when htmlLabels=true) */
|
|
62
|
+
svg foreignObject .clusterLabel,
|
|
63
|
+
svg foreignObject .cluster-label,
|
|
64
|
+
svg foreignObject div[class*="clusterLabel"],
|
|
65
|
+
svg foreignObject div[class*="cluster-label"] {
|
|
66
|
+
display: inline-block;
|
|
67
|
+
padding: 3px 12px;
|
|
68
|
+
border-radius: 6px;
|
|
69
|
+
background-color: var(--m-cluster-label-bg) !important;
|
|
70
|
+
color: var(--m-cluster-label-fg) !important;
|
|
71
|
+
font-size: 22px !important;
|
|
72
|
+
font-weight: 700 !important;
|
|
73
|
+
/* Mask nearby edges without outlines */
|
|
74
|
+
box-shadow: 0 0 0 6px var(--m-cluster-label-bg);
|
|
75
|
+
}
|
|
76
|
+
</style>
|
|
77
|
+
<!-- moved cluster labels to top layer -->
|
|
78
|
+
<g class="cluster-label" transform="translate(75.7265625, 442)"><foreignObject width="80.28125" height="19"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="nodeLabel">Serialization</span></div></foreignObject></g>
|
|
79
|
+
<g class="cluster-label" transform="translate(324.234375, 442)"><foreignObject width="84.625" height="19"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="nodeLabel">Prioritization</span></div></foreignObject></g>
|
|
80
|
+
<g class="cluster-label" transform="translate(340.611328125, 0)"><foreignObject width="97.421875" height="19"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span class="nodeLabel">Deserialization</span></div></foreignObject></g>
|
|
81
|
+
</svg>
|
|
@@ -169,7 +169,7 @@ dependencies = [
|
|
|
169
169
|
|
|
170
170
|
[[package]]
|
|
171
171
|
name = "headson"
|
|
172
|
-
version = "0.5.
|
|
172
|
+
version = "0.5.3"
|
|
173
173
|
dependencies = [
|
|
174
174
|
"anyhow",
|
|
175
175
|
"clap",
|
|
@@ -182,7 +182,7 @@ dependencies = [
|
|
|
182
182
|
|
|
183
183
|
[[package]]
|
|
184
184
|
name = "headson-python"
|
|
185
|
-
version = "0.5.
|
|
185
|
+
version = "0.5.3"
|
|
186
186
|
dependencies = [
|
|
187
187
|
"anyhow",
|
|
188
188
|
"headson",
|
|
@@ -17,7 +17,7 @@ type IgnoreNotices = Vec<String>;
|
|
|
17
17
|
about = "Get a small but useful preview of a JSON file"
|
|
18
18
|
)]
|
|
19
19
|
struct Cli {
|
|
20
|
-
#[arg(short = 'n', long = "budget"
|
|
20
|
+
#[arg(short = 'n', long = "budget")]
|
|
21
21
|
budget: Option<usize>,
|
|
22
22
|
#[arg(short = 'f', long = "template", value_enum, default_value_t = Template::Pseudo)]
|
|
23
23
|
template: Template,
|
|
@@ -49,8 +49,7 @@ struct Cli {
|
|
|
49
49
|
short = 'N',
|
|
50
50
|
long = "global-budget",
|
|
51
51
|
value_name = "BYTES",
|
|
52
|
-
|
|
53
|
-
help = "Total output budget across all inputs; useful to keep multiple files within a fixed overall output size (may omit entire files)."
|
|
52
|
+
help = "Total output budget across all inputs. When combined with --budget, the effective global limit is the smaller of the two."
|
|
54
53
|
)]
|
|
55
54
|
global_budget: Option<usize>,
|
|
56
55
|
#[arg(
|
|
@@ -101,11 +100,11 @@ fn main() -> Result<()> {
|
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
fn compute_effective_budget(cli: &Cli, input_count: usize) -> usize {
|
|
104
|
-
|
|
105
|
-
g
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
match (cli.global_budget, cli.budget) {
|
|
104
|
+
(Some(g), Some(n)) => g.min(n.saturating_mul(input_count)),
|
|
105
|
+
(Some(g), None) => g,
|
|
106
|
+
(None, Some(n)) => n.saturating_mul(input_count),
|
|
107
|
+
(None, None) => 500usize.saturating_mul(input_count),
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
110
|
|
|
@@ -114,7 +113,15 @@ fn compute_priority(
|
|
|
114
113
|
effective_budget: usize,
|
|
115
114
|
input_count: usize,
|
|
116
115
|
) -> headson::PriorityConfig {
|
|
117
|
-
let per_file_for_priority =
|
|
116
|
+
let per_file_for_priority =
|
|
117
|
+
if cli.global_budget.is_some() && cli.budget.is_some() {
|
|
118
|
+
// When both limits are provided, base per-file heuristics on the per-file
|
|
119
|
+
// budget but also respect the effective per-file slice of the final global.
|
|
120
|
+
let eff_per_file = (effective_budget / input_count.max(1)).max(1);
|
|
121
|
+
cli.budget.unwrap().min(eff_per_file).max(1)
|
|
122
|
+
} else {
|
|
123
|
+
(effective_budget / input_count.max(1)).max(1)
|
|
124
|
+
};
|
|
118
125
|
get_priority_config(per_file_for_priority, cli)
|
|
119
126
|
}
|
|
120
127
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{headson-0.5.1 → headson-0.5.3}/src/snapshots/headson__order__tests__order_empty_array_order.snap
RENAMED
|
File without changes
|
|
File without changes
|
{headson-0.5.1 → headson-0.5.3}/src/snapshots/headson__order__tests__pq_empty_array_queue.snap
RENAMED
|
File without changes
|
|
File without changes
|
{headson-0.5.1 → headson-0.5.3}/src/snapshots/headson__queue__tests__pq_empty_array_queue.snap
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|