- 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>
66 lines
1.6 KiB
JavaScript
66 lines
1.6 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true,
|
|
});
|
|
exports.default = void 0;
|
|
var _Transformer = _interopRequireDefault(
|
|
require("./DeltaBundler/Transformer"),
|
|
);
|
|
var _DependencyGraph = _interopRequireDefault(
|
|
require("./node-haste/DependencyGraph"),
|
|
);
|
|
function _interopRequireDefault(e) {
|
|
return e && e.__esModule ? e : { default: e };
|
|
}
|
|
class Bundler {
|
|
constructor(config, options) {
|
|
this._depGraph = new _DependencyGraph.default(config, options);
|
|
this._initializedPromise = this._depGraph
|
|
.ready()
|
|
.then(() => {
|
|
config.reporter.update({
|
|
type: "transformer_load_started",
|
|
});
|
|
this._transformer = new _Transformer.default(config, {
|
|
getOrComputeSha1: (filePath) =>
|
|
this._depGraph.getOrComputeSha1(filePath),
|
|
});
|
|
config.reporter.update({
|
|
type: "transformer_load_done",
|
|
});
|
|
})
|
|
.catch((error) => {
|
|
console.error("Failed to construct transformer: ", error);
|
|
config.reporter.update({
|
|
type: "transformer_load_failed",
|
|
error,
|
|
});
|
|
});
|
|
}
|
|
getWatcher() {
|
|
return this._depGraph.getWatcher();
|
|
}
|
|
async end() {
|
|
await this.ready();
|
|
await this._transformer.end();
|
|
await this._depGraph.end();
|
|
}
|
|
async getDependencyGraph() {
|
|
await this.ready();
|
|
return this._depGraph;
|
|
}
|
|
async transformFile(filePath, transformOptions, fileBuffer) {
|
|
await this.ready();
|
|
return this._transformer.transformFile(
|
|
filePath,
|
|
transformOptions,
|
|
fileBuffer,
|
|
);
|
|
}
|
|
async ready() {
|
|
await this._initializedPromise;
|
|
}
|
|
}
|
|
exports.default = Bundler;
|