11const path = require ( 'path' ) ;
2- const v8 = require ( 'v8' ) ;
2+ // const v8 = require('v8');
33const vm = require ( 'vm' ) ;
44const sortKeys = require ( 'sort-keys' ) ;
55const TOML = require ( '@iarna/toml' ) ;
@@ -40,7 +40,7 @@ class Sheet extends Configurable
4040 }
4141 }
4242
43- #recordCache;
43+ // #recordCache;
4444
4545 constructor ( { workspace, name, dataTree = null , configPath = null } ) {
4646 if ( ! workspace ) {
@@ -57,7 +57,7 @@ class Sheet extends Configurable
5757 this . configPath = configPath || `.gitsheets/${ name } .toml` ;
5858 this . dataTree = dataTree || workspace . root ;
5959
60- this . #recordCache = new Map ( ) ;
60+ // this.#recordCache = new Map();
6161
6262 Object . freeze ( this ) ;
6363 }
@@ -116,22 +116,28 @@ class Sheet extends Configurable
116116 }
117117
118118 async readRecord ( blob , path = null ) {
119- const cache = this . #recordCache. get ( blob . hash ) ;
119+ /**
120+ * caching is disabled for now, because v8.serialize doesn't
121+ * preserve the custom Date classes that iarna/toml uses to
122+ * preserve extended date types
123+ */
124+
125+ // const cache = this.#recordCache.get(blob.hash);
120126
121127 let record ;
122128
123- if ( cache ) {
124- record = v8 . deserialize ( cache ) ;
125- } else {
126- const toml = await blob . read ( ) ;
129+ // if (cache) {
130+ // record = v8.deserialize(cache);
131+ // } else {
132+ const toml = await blob . read ( ) ;
127133
128- try {
129- record = TOML . parse ( toml ) ;
130- } catch ( err ) {
131- err . file = path ;
132- throw err ;
133- }
134+ try {
135+ record = TOML . parse ( toml ) ;
136+ } catch ( err ) {
137+ err . file = path ;
138+ throw err ;
134139 }
140+ // }
135141
136142 // annotate with gitsheets keys
137143 record [ RECORD_SHEET_KEY ] = this . name ;
@@ -140,9 +146,9 @@ class Sheet extends Configurable
140146 }
141147
142148 // fill cache
143- if ( ! cache ) {
144- this . #recordCache. set ( blob . hash , v8 . serialize ( record ) ) ;
145- }
149+ // if (!cache) {
150+ // this.#recordCache.set(blob.hash, toml );
151+ // }
146152
147153 return record ;
148154 }
0 commit comments