MCPcopy
hub / github.com/webpack/webpack / _emitRecords

Method _emitRecords

lib/Compiler.js:1138–1181  ·  view source on GitHub ↗

* Processes the provided error callback. * @param {ErrorCallback} callback signals when the call finishes * @returns {void}

(callback)

Source from the content-addressed store, hash-verified

1136 * @returns {void}
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} */
1166 (this.outputFileSystem),
1167 /** @type {string} */
1168 (this.recordsOutputPath)
1169 );
1170 if (!recordsOutputPathDirectory) {
1171 return writeFile();
1172 }
1173 mkdirp(
1174 /** @type {OutputFileSystem} */ (this.outputFileSystem),
1175 recordsOutputPathDirectory,
1176 (err) => {
1177 if (err) return callback(err);
1178 writeFile();
1179 }
1180 );
1181 }
1182
1183 /**
1184 * Processes the provided error callback.

Callers 1

emitRecordsMethod · 0.95

Calls 4

dirnameFunction · 0.85
mkdirpFunction · 0.85
writeFileFunction · 0.50
callbackFunction · 0.50

Tested by

no test coverage detected