Skip to content

Commit 1b5917d

Browse files
authored
Merge pull request #2 from ZON-Format/copilot/update-zonf-extension
Standardize format identifiers to 'zonf' throughout codebase and bump version to 1.3.1
2 parents 27a39fb + a7f6eda commit 1b5917d

File tree

10 files changed

+35
-39
lines changed

10 files changed

+35
-39
lines changed

benchmarks/scripts/comprehensive-benchmark.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,21 @@ for (const datasetName of datasetNames) {
8181

8282
results.byDataset[datasetName] = {
8383
gpt4o: {
84-
zon: zonTokensGPT,
84+
zonf: zonTokensGPT,
8585
toon: toonTokensGPT,
8686
json: jsonTokensGPT,
8787
savingsVsTOON: parseFloat(savingsVsTOON_GPT),
8888
savingsVsJSON: parseFloat(savingsVsJSON_GPT)
8989
},
9090
claude: {
91-
zon: zonTokensClaude,
91+
zonf: zonTokensClaude,
9292
toon: toonTokensClaude,
9393
json: jsonTokensClaude,
9494
savingsVsTOON: parseFloat(savingsVsTOON_Claude),
9595
savingsVsJSON: parseFloat(savingsVsJSON_Claude)
9696
},
9797
llama: {
98-
zon: zonTokensLlama,
98+
zonf: zonTokensLlama,
9999
toon: toonTokensLlama,
100100
json: jsonTokensLlama,
101101
savingsVsTOON: parseFloat(savingsVsTOON_Llama),

docs/cli-guide.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,18 +221,14 @@ diff <(zon format data.zonf) data.zonf
221221

222222
### `.zonf`
223223

224-
**ZON Format** - The standard extension for ZON files.
224+
**ZON Format** - The standard and only extension for ZON files.
225225

226226
```bash
227227
users.zonf
228228
config.zonf
229229
data.zonf
230230
```
231231

232-
### `.zon`
233-
234-
Alternative extension (also supported by VS Code extension).
235-
236232
---
237233

238234
## Pipeline Examples

docs/production-architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ function logFormatStats(data: any, label: string) {
254254
const stats = compareFormats(data);
255255

256256
console.log(`[${label}] Format Sizes:`);
257-
console.log(` ZON: ${stats.zon} bytes`);
258-
console.log(` Binary: ${stats.binary} bytes (${stats.savings.binaryVsZon.toFixed(1)}% savings)`);
257+
console.log(` ZON: ${stats.zonf} bytes`);
258+
console.log(` Binary: ${stats.binary} bytes (${stats.savings.binaryVsZonf.toFixed(1)}% savings)`);
259259
console.log(` JSON: ${stats.json} bytes`);
260260
}
261261
```

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zon-format",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "ZON: The most token-efficient serialization format for LLMs - beats CSV, TOON, JSON, and all competitors",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/__tests__/versioning.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('ZON Versioning', () => {
2424
expect(versioned.__zon_meta).toBeDefined();
2525
expect(versioned.__zon_meta.version).toBe('2.0.0');
2626
expect(versioned.__zon_meta.schemaId).toBe('user-schema');
27-
expect(versioned.__zon_meta.encoding).toBe('zon');
27+
expect(versioned.__zon_meta.encoding).toBe('zonf');
2828
expect(versioned.__zon_meta.timestamp).toBeDefined();
2929
expect(versioned.users).toEqual(data.users);
3030
});
@@ -50,7 +50,7 @@ describe('ZON Versioning', () => {
5050
__zon_meta: {
5151
version: '1.5.0',
5252
schemaId: 'test-schema',
53-
encoding: 'zon',
53+
encoding: 'zonf',
5454
timestamp: 1234567890
5555
},
5656
users: []
@@ -79,7 +79,7 @@ describe('ZON Versioning', () => {
7979
describe('stripVersion', () => {
8080
it('should remove version metadata', () => {
8181
const data = {
82-
__zon_meta: { version: '1.0.0', encoding: 'zon', timestamp: 123 },
82+
__zon_meta: { version: '1.0.0', encoding: 'zonf', timestamp: 123 },
8383
users: [{ id: 1 }]
8484
};
8585

src/cli.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function printUsage() {
3232
console.error(' diff Compare two ZON files');
3333
console.error('Options:');
3434
console.error(' --format <json|csv|yaml|binary> Specify format');
35-
console.error(' --to <zon|json|binary> Target format for convert');
35+
console.error(' --to <zonf|json|binary> Target format for convert');
3636
console.error(' --colors Use syntax highlighting');
3737
console.error(' --strict Strict validation mode');
3838
}
@@ -171,9 +171,9 @@ try {
171171
console.log(`Types Found: ${Array.from(stats.types).join(', ')}`);
172172
console.log('');
173173
console.log('Format Sizes:');
174-
console.log(` ZON: ${sizes.zon} bytes`);
175-
console.log(` Binary: ${sizes.binary} bytes (-${sizes.savings.binaryVsZon.toFixed(1)}%)`);
176-
console.log(` JSON: ${sizes.json} bytes (+${((sizes.json/sizes.zon - 1) * 100).toFixed(1)}%)`);
174+
console.log(` ZON: ${sizes.zonf} bytes`);
175+
console.log(` Binary: ${sizes.binary} bytes (-${sizes.savings.binaryVsZonf.toFixed(1)}%)`);
176+
console.log(` JSON: ${sizes.json} bytes (+${((sizes.json/sizes.zonf - 1) * 100).toFixed(1)}%)`);
177177
} else if (command === 'diff') {
178178
const file2 = args[2];
179179
if (!file2) {
@@ -230,7 +230,7 @@ try {
230230
const formatArg = args.find(a => a.startsWith('--format='));
231231
const toArg = args.find(a => a.startsWith('--to='));
232232
const format = formatArg ? formatArg.split('=')[1] : ext.replace('.', '');
233-
const targetFormat = toArg ? toArg.split('=')[1] : 'zon';
233+
const targetFormat = toArg ? toArg.split('=')[1] : 'zonf';
234234

235235
let data;
236236
if (format === 'binary' || format === 'zonb') {
@@ -249,7 +249,7 @@ try {
249249
process.exit(1);
250250
}
251251

252-
if (targetFormat === 'zon') {
252+
if (targetFormat === 'zonf') {
253253
console.log(encode(data));
254254
} else if (targetFormat === 'binary') {
255255
const binary = encodeBinary(data);

src/core/versioning.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface ZonDocumentMetadata {
1212
/** Optional schema identifier (e.g., "user-profile-v2") */
1313
schemaId?: string;
1414

15-
/** Encoding format used ("zon" | "zon-binary") */
15+
/** Encoding format used ("zonf" | "zonf-binary") */
1616
encoding?: string;
1717

1818
/** Unix timestamp when document was created */
@@ -42,7 +42,7 @@ export function embedVersion(
4242
data: any,
4343
version: string,
4444
schemaId?: string,
45-
encoding: string = 'zon'
45+
encoding: string = 'zonf'
4646
): any {
4747
if (typeof data !== 'object' || data === null || Array.isArray(data)) {
4848
throw new Error('Can only embed version in root objects');

src/tools/converter.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class BatchConverter {
8080
/**
8181
* Queue a conversion
8282
*/
83-
add(data: any, from: 'json' | 'zon' | 'binary', to: 'json' | 'zon' | 'binary'): void {
83+
add(data: any, from: 'json' | 'zonf' | 'binary', to: 'json' | 'zonf' | 'binary'): void {
8484
this.conversions.push({ from, to, data });
8585
}
8686

@@ -102,7 +102,7 @@ export class BatchConverter {
102102

103103
if (from === 'json') {
104104
normalized = typeof data === 'string' ? JSON.parse(data) : data;
105-
} else if (from === 'zon') {
105+
} else if (from === 'zonf') {
106106
normalized = decode(data);
107107
} else if (from === 'binary') {
108108
normalized = decodeBinary(data);
@@ -111,7 +111,7 @@ export class BatchConverter {
111111

112112
if (to === 'json') {
113113
return JSON.stringify(normalized, null, 2);
114-
} else if (to === 'zon') {
114+
} else if (to === 'zonf') {
115115
return encode(normalized);
116116
} else if (to === 'binary') {
117117
return encodeBinary(normalized);
@@ -133,18 +133,18 @@ export class BatchConverter {
133133
*/
134134
export function autoConvert(
135135
input: string | Uint8Array,
136-
targetFormat: 'json' | 'zon' | 'binary',
136+
targetFormat: 'json' | 'zonf' | 'binary',
137137
options?: ConversionOptions
138138
): string | Uint8Array {
139139

140-
let sourceFormat: 'json' | 'zon' | 'binary';
140+
let sourceFormat: 'json' | 'zonf' | 'binary';
141141

142142
if (input instanceof Uint8Array) {
143143
sourceFormat = 'binary';
144144
} else if (input.trim().startsWith('{') || input.trim().startsWith('[')) {
145145
sourceFormat = 'json';
146146
} else {
147-
sourceFormat = 'zon';
147+
sourceFormat = 'zonf';
148148
}
149149

150150

src/tools/helpers.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import type { ZonSchema } from '../schema/schema';
1212
/**
1313
* Calculate the encoded size of data in different formats
1414
*/
15-
export function size(data: any, format: 'zon' | 'binary' | 'json' = 'zon'): number {
15+
export function size(data: any, format: 'zonf' | 'binary' | 'json' = 'zonf'): number {
1616
switch (format) {
17-
case 'zon':
17+
case 'zonf':
1818
return encode(data).length;
1919
case 'binary':
2020
return encodeBinary(data).length;
@@ -27,27 +27,27 @@ export function size(data: any, format: 'zon' | 'binary' | 'json' = 'zon'): numb
2727
* Compare sizes across all formats
2828
*/
2929
export function compareFormats(data: any): {
30-
zon: number;
30+
zonf: number;
3131
binary: number;
3232
json: number;
3333
savings: {
34-
zonVsJson: number;
34+
zonfVsJson: number;
3535
binaryVsJson: number;
36-
binaryVsZon: number;
36+
binaryVsZonf: number;
3737
};
3838
} {
39-
const zonSize = size(data, 'zon');
39+
const zonfSize = size(data, 'zonf');
4040
const binarySize = size(data, 'binary');
4141
const jsonSize = size(data, 'json');
4242

4343
return {
44-
zon: zonSize,
44+
zonf: zonfSize,
4545
binary: binarySize,
4646
json: jsonSize,
4747
savings: {
48-
zonVsJson: ((1 - zonSize / jsonSize) * 100),
48+
zonfVsJson: ((1 - zonfSize / jsonSize) * 100),
4949
binaryVsJson: ((1 - binarySize / jsonSize) * 100),
50-
binaryVsZon: ((1 - binarySize / zonSize) * 100)
50+
binaryVsZonf: ((1 - binarySize / zonfSize) * 100)
5151
}
5252
};
5353
}

0 commit comments

Comments
 (0)