mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-29 16:57:00 +08:00
[deps] Update 'terser' to 5.19.1
The update contains a bug fix that improves the quality for DevTools release source maps. The update also seems to stop minifiying certain names in the overlay bundle so we had to slightly bump the limit. * Old size: 69660 * New size: 71295 DISABLE_THIRD_PARTY_CHECK=Bump overlay size limit R=alexrudenko@chromium.org Bug: 1459146 Change-Id: I3036787bbb3ba8d28669b9aaab9c29c5f5581e55 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4693881 Commit-Queue: Simon Zünd <szuend@chromium.org> Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
This commit is contained in:
committed by
Devtools-frontend LUCI CQ
parent
cb81c05f37
commit
cba2ac9e1c
-20
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* Replaces every Buffer | ArrayBuffer | Blob | File in packet with a numbered placeholder.
|
||||
*
|
||||
* @param {Object} packet - socket.io event packet
|
||||
* @return {Object} with deconstructed packet and list of buffers
|
||||
* @public
|
||||
*/
|
||||
export declare function deconstructPacket(packet: any): {
|
||||
packet: any;
|
||||
buffers: any[];
|
||||
};
|
||||
/**
|
||||
* Reconstructs a binary packet from its placeholder packet and buffers
|
||||
*
|
||||
* @param {Object} packet - event packet with placeholders
|
||||
* @param {Array} buffers - binary buffers to put in placeholder positions
|
||||
* @return {Object} reconstructed packet
|
||||
* @public
|
||||
*/
|
||||
export declare function reconstructPacket(packet: any, buffers: any): any;
|
||||
+2
-2
@@ -21,7 +21,7 @@ exports.deconstructPacket = deconstructPacket;
|
||||
function _deconstructPacket(data, buffers) {
|
||||
if (!data)
|
||||
return data;
|
||||
if ((0, is_binary_js_1.isBinary)(data)) {
|
||||
if (is_binary_js_1.isBinary(data)) {
|
||||
const placeholder = { _placeholder: true, num: buffers.length };
|
||||
buffers.push(data);
|
||||
return placeholder;
|
||||
@@ -54,7 +54,7 @@ function _deconstructPacket(data, buffers) {
|
||||
*/
|
||||
function reconstructPacket(packet, buffers) {
|
||||
packet.data = _reconstructPacket(packet.data, buffers);
|
||||
delete packet.attachments; // no longer useful
|
||||
packet.attachments = undefined; // no longer useful
|
||||
return packet;
|
||||
}
|
||||
exports.reconstructPacket = reconstructPacket;
|
||||
|
||||
-90
@@ -1,90 +0,0 @@
|
||||
import { Emitter } from "@socket.io/component-emitter";
|
||||
/**
|
||||
* Protocol version.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare const protocol: number;
|
||||
export declare enum PacketType {
|
||||
CONNECT = 0,
|
||||
DISCONNECT = 1,
|
||||
EVENT = 2,
|
||||
ACK = 3,
|
||||
CONNECT_ERROR = 4,
|
||||
BINARY_EVENT = 5,
|
||||
BINARY_ACK = 6
|
||||
}
|
||||
export interface Packet {
|
||||
type: PacketType;
|
||||
nsp: string;
|
||||
data?: any;
|
||||
id?: number;
|
||||
attachments?: number;
|
||||
}
|
||||
/**
|
||||
* A socket.io Encoder instance
|
||||
*/
|
||||
export declare class Encoder {
|
||||
private replacer?;
|
||||
/**
|
||||
* Encoder constructor
|
||||
*
|
||||
* @param {function} replacer - custom replacer to pass down to JSON.parse
|
||||
*/
|
||||
constructor(replacer?: (this: any, key: string, value: any) => any);
|
||||
/**
|
||||
* Encode a packet as a single string if non-binary, or as a
|
||||
* buffer sequence, depending on packet type.
|
||||
*
|
||||
* @param {Object} obj - packet object
|
||||
*/
|
||||
encode(obj: Packet): any[];
|
||||
/**
|
||||
* Encode packet as string.
|
||||
*/
|
||||
private encodeAsString;
|
||||
/**
|
||||
* Encode packet as 'buffer sequence' by removing blobs, and
|
||||
* deconstructing packet into object with placeholders and
|
||||
* a list of buffers.
|
||||
*/
|
||||
private encodeAsBinary;
|
||||
}
|
||||
interface DecoderReservedEvents {
|
||||
decoded: (packet: Packet) => void;
|
||||
}
|
||||
/**
|
||||
* A socket.io Decoder instance
|
||||
*
|
||||
* @return {Object} decoder
|
||||
*/
|
||||
export declare class Decoder extends Emitter<{}, {}, DecoderReservedEvents> {
|
||||
private reviver?;
|
||||
private reconstructor;
|
||||
/**
|
||||
* Decoder constructor
|
||||
*
|
||||
* @param {function} reviver - custom reviver to pass down to JSON.stringify
|
||||
*/
|
||||
constructor(reviver?: (this: any, key: string, value: any) => any);
|
||||
/**
|
||||
* Decodes an encoded packet string into packet JSON.
|
||||
*
|
||||
* @param {String} obj - encoded packet
|
||||
*/
|
||||
add(obj: any): void;
|
||||
/**
|
||||
* Decode a packet String (JSON data)
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Object} packet
|
||||
*/
|
||||
private decodeString;
|
||||
private tryParse;
|
||||
private static isPayloadValid;
|
||||
/**
|
||||
* Deallocates a parser's resources
|
||||
*/
|
||||
destroy(): void;
|
||||
}
|
||||
export {};
|
||||
+14
-37
@@ -5,18 +5,7 @@ const component_emitter_1 = require("@socket.io/component-emitter");
|
||||
const binary_js_1 = require("./binary.js");
|
||||
const is_binary_js_1 = require("./is-binary.js");
|
||||
const debug_1 = require("debug"); // debug()
|
||||
const debug = (0, debug_1.default)("socket.io-parser"); // debug()
|
||||
/**
|
||||
* These strings must not be used as event names, as they have a special meaning.
|
||||
*/
|
||||
const RESERVED_EVENTS = [
|
||||
"connect",
|
||||
"connect_error",
|
||||
"disconnect",
|
||||
"disconnecting",
|
||||
"newListener",
|
||||
"removeListener", // used by the Node.js EventEmitter
|
||||
];
|
||||
const debug = debug_1.default("socket.io-parser"); // debug()
|
||||
/**
|
||||
* Protocol version.
|
||||
*
|
||||
@@ -54,15 +43,12 @@ class Encoder {
|
||||
encode(obj) {
|
||||
debug("encoding packet %j", obj);
|
||||
if (obj.type === PacketType.EVENT || obj.type === PacketType.ACK) {
|
||||
if ((0, is_binary_js_1.hasBinary)(obj)) {
|
||||
return this.encodeAsBinary({
|
||||
type: obj.type === PacketType.EVENT
|
||||
if (is_binary_js_1.hasBinary(obj)) {
|
||||
obj.type =
|
||||
obj.type === PacketType.EVENT
|
||||
? PacketType.BINARY_EVENT
|
||||
: PacketType.BINARY_ACK,
|
||||
nsp: obj.nsp,
|
||||
data: obj.data,
|
||||
id: obj.id,
|
||||
});
|
||||
: PacketType.BINARY_ACK;
|
||||
return this.encodeAsBinary(obj);
|
||||
}
|
||||
}
|
||||
return [this.encodeAsString(obj)];
|
||||
@@ -100,7 +86,7 @@ class Encoder {
|
||||
* a list of buffers.
|
||||
*/
|
||||
encodeAsBinary(obj) {
|
||||
const deconstruction = (0, binary_js_1.deconstructPacket)(obj);
|
||||
const deconstruction = binary_js_1.deconstructPacket(obj);
|
||||
const pack = this.encodeAsString(deconstruction.packet);
|
||||
const buffers = deconstruction.buffers;
|
||||
buffers.unshift(pack); // add packet info to beginning of data list
|
||||
@@ -108,10 +94,6 @@ class Encoder {
|
||||
}
|
||||
}
|
||||
exports.Encoder = Encoder;
|
||||
// see https://stackoverflow.com/questions/8511281/check-if-a-value-is-an-object-in-javascript
|
||||
function isObject(value) {
|
||||
return Object.prototype.toString.call(value) === "[object Object]";
|
||||
}
|
||||
/**
|
||||
* A socket.io Decoder instance
|
||||
*
|
||||
@@ -139,9 +121,8 @@ class Decoder extends component_emitter_1.Emitter {
|
||||
throw new Error("got plaintext data when reconstructing a packet");
|
||||
}
|
||||
packet = this.decodeString(obj);
|
||||
const isBinaryEvent = packet.type === PacketType.BINARY_EVENT;
|
||||
if (isBinaryEvent || packet.type === PacketType.BINARY_ACK) {
|
||||
packet.type = isBinaryEvent ? PacketType.EVENT : PacketType.ACK;
|
||||
if (packet.type === PacketType.BINARY_EVENT ||
|
||||
packet.type === PacketType.BINARY_ACK) {
|
||||
// binary packet's json
|
||||
this.reconstructor = new BinaryReconstructor(packet);
|
||||
// no attachments, labeled binary but no binary data to follow
|
||||
@@ -154,7 +135,7 @@ class Decoder extends component_emitter_1.Emitter {
|
||||
super.emitReserved("decoded", packet);
|
||||
}
|
||||
}
|
||||
else if ((0, is_binary_js_1.isBinary)(obj) || obj.base64) {
|
||||
else if (is_binary_js_1.isBinary(obj) || obj.base64) {
|
||||
// raw binary data
|
||||
if (!this.reconstructor) {
|
||||
throw new Error("got binary data when not reconstructing a packet");
|
||||
@@ -252,17 +233,14 @@ class Decoder extends component_emitter_1.Emitter {
|
||||
static isPayloadValid(type, payload) {
|
||||
switch (type) {
|
||||
case PacketType.CONNECT:
|
||||
return isObject(payload);
|
||||
return typeof payload === "object";
|
||||
case PacketType.DISCONNECT:
|
||||
return payload === undefined;
|
||||
case PacketType.CONNECT_ERROR:
|
||||
return typeof payload === "string" || isObject(payload);
|
||||
return typeof payload === "string" || typeof payload === "object";
|
||||
case PacketType.EVENT:
|
||||
case PacketType.BINARY_EVENT:
|
||||
return (Array.isArray(payload) &&
|
||||
(typeof payload[0] === "number" ||
|
||||
(typeof payload[0] === "string" &&
|
||||
RESERVED_EVENTS.indexOf(payload[0]) === -1)));
|
||||
return Array.isArray(payload) && payload.length > 0;
|
||||
case PacketType.ACK:
|
||||
case PacketType.BINARY_ACK:
|
||||
return Array.isArray(payload);
|
||||
@@ -274,7 +252,6 @@ class Decoder extends component_emitter_1.Emitter {
|
||||
destroy() {
|
||||
if (this.reconstructor) {
|
||||
this.reconstructor.finishedReconstruction();
|
||||
this.reconstructor = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -305,7 +282,7 @@ class BinaryReconstructor {
|
||||
this.buffers.push(binData);
|
||||
if (this.buffers.length === this.reconPack.attachments) {
|
||||
// done with buffer list
|
||||
const packet = (0, binary_js_1.reconstructPacket)(this.reconPack, this.buffers);
|
||||
const packet = binary_js_1.reconstructPacket(this.reconPack, this.buffers);
|
||||
this.finishedReconstruction();
|
||||
return packet;
|
||||
}
|
||||
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* Returns true if obj is a Buffer, an ArrayBuffer, a Blob or a File.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
export declare function isBinary(obj: any): boolean;
|
||||
export declare function hasBinary(obj: any, toJSON?: boolean): any;
|
||||
Reference in New Issue
Block a user