scon-notation 1.0.0 → 1.0.1
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 +63 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
**SCON — Schema-Compact Object Notation for JavaScript**
|
|
4
4
|
|
|
5
|
-
Human-readable serialization with structural dedup.
|
|
5
|
+
Human-readable serialization with structural dedup. 59-66% payload reduction, 64% fewer LLM tokens, optional WASM acceleration.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/scon-notation)
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
|
|
10
10
|
## Install
|
|
11
11
|
|
|
12
|
+
### npm
|
|
12
13
|
```bash
|
|
13
14
|
npm install scon-notation
|
|
14
15
|
```
|
|
@@ -19,6 +20,58 @@ WASM acceleration is included as optional dependency and loads automatically whe
|
|
|
19
20
|
npm install scon-notation --no-optional
|
|
20
21
|
```
|
|
21
22
|
|
|
23
|
+
### CDN (no build step)
|
|
24
|
+
```js
|
|
25
|
+
import SCON from 'https://cdn.jsdelivr.net/npm/scon-notation@1/src/scon.js';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Local (clone and import)
|
|
29
|
+
```js
|
|
30
|
+
import SCON from './src/scon.js';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### WASM behavior by install method
|
|
34
|
+
|
|
35
|
+
| Method | WASM | Performance |
|
|
36
|
+
|--------|------|-------------|
|
|
37
|
+
| `npm install scon-notation` | Auto-detected, loaded if available | Fastest (Rust tape decoder) |
|
|
38
|
+
| `npm install scon-notation --no-optional` | Disabled | Pure JS |
|
|
39
|
+
| CDN / local import | Not available | Pure JS |
|
|
40
|
+
|
|
41
|
+
When WASM is not available, all operations fall back to pure JS transparently — no code changes needed.
|
|
42
|
+
|
|
43
|
+
### WASM without npm
|
|
44
|
+
|
|
45
|
+
If you want WASM acceleration without npm, you can load the WASM module manually:
|
|
46
|
+
|
|
47
|
+
1. Build the WASM module (requires Rust + wasm-pack):
|
|
48
|
+
```bash
|
|
49
|
+
git clone https://github.com/QuijoteShin/scon-rs
|
|
50
|
+
cd scon-rs
|
|
51
|
+
wasm-pack build --target web --out-dir pkg
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
2. Serve the `pkg/` directory alongside your app, then:
|
|
55
|
+
```html
|
|
56
|
+
<script type="module">
|
|
57
|
+
import init, { scon_encode, scon_to_json, scon_minify, scon_expand } from './pkg/scon_wasm.js';
|
|
58
|
+
|
|
59
|
+
await init();
|
|
60
|
+
|
|
61
|
+
// Encode JS object to SCON
|
|
62
|
+
const scon = scon_encode({ name: 'test', version: 1 });
|
|
63
|
+
|
|
64
|
+
// Decode SCON to JS object
|
|
65
|
+
const obj = JSON.parse(scon_to_json(scon));
|
|
66
|
+
|
|
67
|
+
// Minify / Expand
|
|
68
|
+
const mini = scon_minify(scon);
|
|
69
|
+
const expanded = scon_expand(mini, 1);
|
|
70
|
+
</script>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This gives you the Rust tape decoder running natively in the browser — same performance as the npm WASM path, without a package manager.
|
|
74
|
+
|
|
22
75
|
## Quick Start
|
|
23
76
|
|
|
24
77
|
```js
|
|
@@ -73,13 +126,20 @@ const hasWasm = await SCON.ready();
|
|
|
73
126
|
|
|
74
127
|
## Performance
|
|
75
128
|
|
|
129
|
+
Payload reduction on OpenAPI 3.1 spec (71 endpoints):
|
|
130
|
+
|
|
76
131
|
| Format | Bytes | Ratio | Gzip |
|
|
77
|
-
|
|
132
|
+
|--------|------:|------:|-----:|
|
|
78
133
|
| JSON | 90,886 | 1.00x | 4,632 |
|
|
79
134
|
| SCON | 26,347 | 0.29x | 3,969 |
|
|
80
135
|
| SCON (minified) | 20,211 | 0.22x | 3,818 |
|
|
81
136
|
|
|
82
|
-
|
|
137
|
+
LLM token efficiency (cl100k_base): **64% fewer tokens** — less context window waste for RAG pipelines, tool-use agents, and structured prompts.
|
|
138
|
+
|
|
139
|
+
With WASM enabled, decode runs the Rust single-pass tape decoder natively in the browser — no performance compromise vs server-side.
|
|
140
|
+
|
|
141
|
+
Full methodology: [DOI 10.5281/zenodo.14733092](https://doi.org/10.5281/zenodo.14733092)
|
|
142
|
+
Benchmarks, optimization log (21 phases), and industrial protocol fixtures: [github.com/QuijoteShin/scon](https://github.com/QuijoteShin/scon)
|
|
83
143
|
|
|
84
144
|
## Also available
|
|
85
145
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scon-notation",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "SCON — Schema-Compact Object Notation:
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "SCON — Schema-Compact Object Notation: 59-66% smaller than JSON with structural dedup, optional WASM acceleration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/scon.js",
|
|
7
7
|
"exports": {
|