Files
FrenoCorp/node_modules/metro-source-map/src/B64Builder.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

66 lines
1.4 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.default = void 0;
var _encode = _interopRequireDefault(require("./encode"));
function _interopRequireDefault(e) {
return e && e.__esModule ? e : { default: e };
}
const MAX_SEGMENT_LENGTH = 7;
const ONE_MEG = 1024 * 1024;
const COMMA = 0x2c;
const SEMICOLON = 0x3b;
class B64Builder {
constructor() {
this.buffer = Buffer.alloc(ONE_MEG);
this.pos = 0;
this.hasSegment = false;
}
markLines(n) {
if (n < 1) {
return this;
}
this.hasSegment = false;
if (this.pos + n >= this.buffer.length) {
this._realloc();
}
while (n--) {
this.buffer[this.pos++] = SEMICOLON;
}
return this;
}
startSegment(column) {
if (this.hasSegment) {
this._writeByte(COMMA);
} else {
this.hasSegment = true;
}
this.append(column);
return this;
}
append(value) {
if (this.pos + MAX_SEGMENT_LENGTH >= this.buffer.length) {
this._realloc();
}
this.pos = (0, _encode.default)(value, this.buffer, this.pos);
return this;
}
toString() {
return this.buffer.toString("ascii", 0, this.pos);
}
_writeByte(byte) {
if (this.pos === this.buffer.length) {
this._realloc();
}
this.buffer[this.pos++] = byte;
}
_realloc() {
const { buffer } = this;
this.buffer = Buffer.alloc(buffer.length * 2);
buffer.copy(this.buffer);
}
}
exports.default = B64Builder;