gitsheets 1.4.0 → 1.4.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/dist/toml.d.ts.map +1 -1
- package/dist/toml.js +26 -1
- package/dist/toml.js.map +1 -1
- package/package.json +2 -1
package/dist/toml.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toml.d.ts","sourceRoot":"","sources":["../src/toml.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toml.d.ts","sourceRoot":"","sources":["../src/toml.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAWjD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAG1D;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAIrD;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,CAU/E"}
|
package/dist/toml.js
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
// TOML serialization helpers with canonical key sorting.
|
|
2
2
|
// See specs/behaviors/normalization.md for the byte-stable normalization rules.
|
|
3
|
+
//
|
|
4
|
+
// We deliberately use two different TOML libraries, split by direction:
|
|
5
|
+
//
|
|
6
|
+
// parse → smol-toml (reads — the hot, memory-sensitive path)
|
|
7
|
+
// stringify → @iarna/toml (writes — preserves the byte-stable canonical form)
|
|
8
|
+
//
|
|
9
|
+
// Why: @iarna/toml's parser emits string values as V8 sliced/cons-strings that
|
|
10
|
+
// transitively pin large parser buffers — each parsed record retains ~12x its
|
|
11
|
+
// source size, so a consumer holding a full dataset in memory pays a ~5–6x heap
|
|
12
|
+
// blowup (observed: a 31.8k-record store needed >500 MB of heap for ~25 MB of
|
|
13
|
+
// TOML). smol-toml's parser produces flat strings and retains ~2x source size,
|
|
14
|
+
// eliminating that leak at the root. It is also actively maintained and full
|
|
15
|
+
// TOML 1.0 (vs @iarna's frozen 1.0.0-rc.1).
|
|
16
|
+
//
|
|
17
|
+
// We keep @iarna/toml for stringify because its output is what the on-disk
|
|
18
|
+
// canonical form already is: it preserves human-readable multiline strings
|
|
19
|
+
// (triple-quoted markdown bodies) and literal-quoted strings, where smol-toml
|
|
20
|
+
// would escape both to single-line — a ~32% cosmetic byte-churn across a real
|
|
21
|
+
// corpus, with no data change. Serialization isn't memory-sensitive (one record
|
|
22
|
+
// at a time), so there's no reason to take that churn. Verified: smol parse →
|
|
23
|
+
// @iarna stringify round-trips losslessly, and TOML date types stay
|
|
24
|
+
// `instanceof Date` with identical serialized output.
|
|
3
25
|
import * as TOML from '@iarna/toml';
|
|
26
|
+
import { parse as smolParse } from 'smol-toml';
|
|
4
27
|
import sortKeys from 'sort-keys';
|
|
5
28
|
import { ConfigError } from './errors.js';
|
|
6
29
|
const toml = TOML;
|
|
@@ -15,7 +38,9 @@ export function stringifyRecord(record) {
|
|
|
15
38
|
return toml.stringify(sorted);
|
|
16
39
|
}
|
|
17
40
|
export function parseToml(content) {
|
|
18
|
-
|
|
41
|
+
// `integersAsBigInt: 'asNeeded'` mirrors @iarna's behavior: integers within
|
|
42
|
+
// the safe range stay `number`, larger ones become `BigInt` (lossless).
|
|
43
|
+
return smolParse(content, { integersAsBigInt: 'asNeeded' });
|
|
19
44
|
}
|
|
20
45
|
export function parseConfigToml(content, sourcePath) {
|
|
21
46
|
try {
|
package/dist/toml.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toml.js","sourceRoot":"","sources":["../src/toml.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,gFAAgF;
|
|
1
|
+
{"version":3,"file":"toml.js","sourceRoot":"","sources":["../src/toml.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,gFAAgF;AAChF,EAAE;AACF,wEAAwE;AACxE,EAAE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AAE,CACf,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gitsheets",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "A git-backed document store for low-volume, high-touch, human-scale data",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"hologit": "^0.50.2",
|
|
50
50
|
"markdownlint": "^0.40.0",
|
|
51
51
|
"rfc6902": "^5.2.0",
|
|
52
|
+
"smol-toml": "^1.7.0",
|
|
52
53
|
"sort-keys": "^6.0.0",
|
|
53
54
|
"yargs": "^18.0.0"
|
|
54
55
|
},
|