Files
FrenoCorp/node_modules/metro/src/DeltaBundler.js
Michael Freno 7c684a42cc FRE-600: Fix code review blockers
- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-25 00:08:01 -04:00

80 lines
2.1 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = void 0;
var _DeltaCalculator = _interopRequireDefault(
require("./DeltaBundler/DeltaCalculator"),
);
function _interopRequireDefault(e) {
return e && e.__esModule ? e : { default: e };
}
class DeltaBundler {
_deltaCalculators = new Map();
constructor(changeEventSource) {
this._changeEventSource = changeEventSource;
}
end() {
this._deltaCalculators.forEach((deltaCalculator) => deltaCalculator.end());
this._deltaCalculators = new Map();
}
async getDependencies(entryPoints, options) {
const deltaCalculator = new _DeltaCalculator.default(
new Set(entryPoints),
this._changeEventSource,
options,
);
await deltaCalculator.getDelta({
reset: true,
shallow: options.shallow,
});
const graph = deltaCalculator.getGraph();
deltaCalculator.end();
return graph.dependencies;
}
async buildGraph(entryPoints, options) {
const deltaCalculator = new _DeltaCalculator.default(
new Set(entryPoints),
this._changeEventSource,
options,
);
await deltaCalculator.getDelta({
reset: true,
shallow: options.shallow,
});
const graph = deltaCalculator.getGraph();
this._deltaCalculators.set(graph, deltaCalculator);
return graph;
}
async getDelta(graph, { reset, shallow }) {
const deltaCalculator = this._deltaCalculators.get(graph);
if (!deltaCalculator) {
throw new Error("Graph not found");
}
return await deltaCalculator.getDelta({
reset,
shallow,
});
}
listen(graph, callback) {
const deltaCalculator = this._deltaCalculators.get(graph);
if (!deltaCalculator) {
throw new Error("Graph not found");
}
deltaCalculator.on("change", callback);
return () => {
deltaCalculator.removeListener("change", callback);
};
}
endGraph(graph) {
const deltaCalculator = this._deltaCalculators.get(graph);
if (!deltaCalculator) {
throw new Error("Graph not found");
}
deltaCalculator.end();
this._deltaCalculators.delete(graph);
}
}
exports.default = DeltaBundler;