| 1137 | */ |
| 1138 | _emitRecords(callback) { |
| 1139 | const writeFile = () => { |
| 1140 | /** @type {OutputFileSystem} */ |
| 1141 | (this.outputFileSystem).writeFile( |
| 1142 | /** @type {string} */ (this.recordsOutputPath), |
| 1143 | JSON.stringify( |
| 1144 | this.records, |
| 1145 | (n, value) => { |
| 1146 | if ( |
| 1147 | typeof value === "object" && |
| 1148 | value !== null && |
| 1149 | !Array.isArray(value) |
| 1150 | ) { |
| 1151 | const keys = Object.keys(value); |
| 1152 | if (!isSorted(keys)) { |
| 1153 | return sortObject(value, keys); |
| 1154 | } |
| 1155 | } |
| 1156 | return value; |
| 1157 | }, |
| 1158 | 2 |
| 1159 | ), |
| 1160 | callback |
| 1161 | ); |
| 1162 | }; |
| 1163 | |
| 1164 | const recordsOutputPathDirectory = dirname( |
| 1165 | /** @type {OutputFileSystem} */ |