mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Convert app to typescript
This commit is contained in:
18
app/.babelrc
18
app/.babelrc
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env"
|
||||
, {
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/plugin-syntax-dynamic-import"
|
||||
, "@babel/plugin-syntax-import-meta"
|
||||
, "@babel/plugin-proposal-class-properties"
|
||||
, "@babel/plugin-proposal-json-strings"
|
||||
]
|
||||
}
|
||||
61
app/@types/castv2/index.d.ts
vendored
Normal file
61
app/@types/castv2/index.d.ts
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
declare module "castv2" {
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
interface ClientConnectOptions {
|
||||
host: string
|
||||
, port?: number
|
||||
}
|
||||
|
||||
interface ClientConnectCallback {
|
||||
(): void;
|
||||
}
|
||||
|
||||
export interface ClientChannel extends EventEmitter {
|
||||
bus: Client;
|
||||
sourceId: string;
|
||||
destinationId: string;
|
||||
namespace: string;
|
||||
encoding: string;
|
||||
|
||||
send (data: any): void;
|
||||
close (): void;
|
||||
}
|
||||
|
||||
interface ServerListenCallback {
|
||||
(): void;
|
||||
}
|
||||
|
||||
|
||||
export class Client extends EventEmitter {
|
||||
connect (host: string, callback?: ClientConnectCallback): void;
|
||||
connect (options: ClientConnectOptions, callback: ClientConnectCallback): void;
|
||||
|
||||
close (): void;
|
||||
|
||||
send (sourceId: string
|
||||
, destinationId: string
|
||||
, namespace: string
|
||||
, data: Buffer | string): void;
|
||||
|
||||
createChannel (sourceId: string
|
||||
, destinationId: string
|
||||
, namespace: string
|
||||
, encoding: string): ClientChannel;
|
||||
}
|
||||
|
||||
export class Server {
|
||||
constructor (options: object);
|
||||
|
||||
listen (port: number
|
||||
, host: string
|
||||
, callback: ServerListenCallback): void;
|
||||
|
||||
send (clientId: string
|
||||
, sourceId: string
|
||||
, destinationId: string
|
||||
, namespace: string
|
||||
, data: Buffer | string): void;
|
||||
|
||||
close (): void;
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,9 @@ const argv = minimist(process.argv.slice(2), {
|
||||
}
|
||||
});
|
||||
|
||||
const BUILD_PATH = path.join(__dirname, "../build");
|
||||
const ROOT_PATH = path.join(__dirname, "..");
|
||||
const SRC_PATH = path.join(ROOT_PATH, "src");
|
||||
const BUILD_PATH = path.join(ROOT_PATH, "build");
|
||||
|
||||
|
||||
// Clean
|
||||
@@ -45,9 +47,25 @@ fs.ensureDirSync(DIST_PATH, { recursive: true });
|
||||
|
||||
|
||||
async function build () {
|
||||
// Run Babel
|
||||
spawnSync(`babel src -d ${BUILD_PATH} --copy-files `
|
||||
, { shell: true });
|
||||
// Run tsc
|
||||
spawnSync(`tsc --project ${ROOT_PATH} \
|
||||
--outDir ${BUILD_PATH}`
|
||||
, {
|
||||
shell: true
|
||||
, stdio: [ process.stdin, process.stdout, process.stderr ]
|
||||
});
|
||||
|
||||
// Move tsc output to build dir
|
||||
fs.moveSync(path.join(BUILD_PATH, "src"), BUILD_PATH);
|
||||
|
||||
// Copy other files
|
||||
fs.copySync(SRC_PATH, BUILD_PATH, {
|
||||
overwrite: true
|
||||
, filter (src, dest) {
|
||||
return !/.(js|ts)$/.test(src);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Create app manifest
|
||||
const manifest = {
|
||||
|
||||
1896
app/package-lock.json
generated
1896
app/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,6 @@
|
||||
"remove-manifest": "node bin/install-manifest.js --remove"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.2.0",
|
||||
"bplist-creator": "0.0.7",
|
||||
"bplist-parser": "^0.1.1",
|
||||
"castv2": "^0.1.9",
|
||||
@@ -22,18 +21,12 @@
|
||||
"tweetnacl": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.2.0",
|
||||
"@babel/core": "^7.2.0",
|
||||
"@babel/plugin-proposal-class-properties": "^7.2.1",
|
||||
"@babel/plugin-proposal-json-strings": "^7.2.0",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
||||
"@babel/plugin-syntax-import-meta": "^7.2.0",
|
||||
"@babel/plugin-transform-runtime": "^7.2.0",
|
||||
"@babel/preset-env": "^7.2.0",
|
||||
"@babel/register": "^7.0.0",
|
||||
"minimist": "^1.2.0",
|
||||
"@types/dnssd": "^0.4.1",
|
||||
"@types/mime-types": "^2.1.0",
|
||||
"@types/node": "^11.9.5",
|
||||
"mustache": "^3.0.1",
|
||||
"pkg": "^4.3.5"
|
||||
"pkg": "^4.3.5",
|
||||
"typescript": "^3.3.3333"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"rage-edit": "^1.2.0"
|
||||
|
||||
@@ -1,5 +1,87 @@
|
||||
"use strict";
|
||||
|
||||
import Session from "./Session";
|
||||
|
||||
import { Message
|
||||
, SendMessageCallback } from "./types";
|
||||
|
||||
|
||||
const MEDIA_NAMESPACE = "urn:x-cast:com.google.cast.media";
|
||||
|
||||
export interface UpdateMessageData {
|
||||
_volumeLevel: number;
|
||||
_volumeMuted: boolean;
|
||||
_lastCurrentTime: number;
|
||||
currentTime: number;
|
||||
customData?: any;
|
||||
playbackRate: number;
|
||||
playerState: string;
|
||||
repeatMode?: string;
|
||||
media?: any;
|
||||
mediaSessionId?: number;
|
||||
}
|
||||
|
||||
|
||||
export default class Media {
|
||||
messageHandler (message) {
|
||||
private sessionId: number;
|
||||
private mediaSessionId: number;
|
||||
private _id: string;
|
||||
private session: Session;
|
||||
private channel: any;
|
||||
private _sendMessage: SendMessageCallback;
|
||||
|
||||
constructor (sessionId: number
|
||||
, mediaSessionId: number
|
||||
, _id: string
|
||||
, parentSession: Session,
|
||||
_sendMessage: SendMessageCallback) {
|
||||
|
||||
this._id = _id;
|
||||
|
||||
this._sendMessage = _sendMessage;
|
||||
|
||||
this.sessionId = sessionId;
|
||||
this.mediaSessionId = mediaSessionId;
|
||||
|
||||
this.session = parentSession;
|
||||
this.session.createChannel(MEDIA_NAMESPACE);
|
||||
this.channel = this.session.channelMap.get(MEDIA_NAMESPACE);
|
||||
|
||||
this.channel.on("message", (data: any) => {
|
||||
if (data && data.type === "MEDIA_STATUS"
|
||||
&& data.status && data.status.length > 0) {
|
||||
|
||||
const status = data.status[0];
|
||||
|
||||
const messageData = {
|
||||
currentTime: status.currentTime
|
||||
, _lastCurrentTime: Date.now() / 1000
|
||||
, customData: status.customData
|
||||
, _volumeLevel: status.volume.level
|
||||
, _volumeMuted: status.volume.muted
|
||||
, playbackRate: status.playbackRate
|
||||
, playerState: status.playerState
|
||||
, repeatMode: status.repeatMode
|
||||
} as UpdateMessageData;
|
||||
|
||||
if (status.media) {
|
||||
messageData.media = status.media;
|
||||
}
|
||||
if (status.mediaSessionId) {
|
||||
messageData.mediaSessionId = status.mediaSessionId;
|
||||
}
|
||||
|
||||
this.sendMessage("shim:/media/update", messageData);
|
||||
|
||||
// Update ID
|
||||
if (status.mediaSessionId) {
|
||||
this.mediaSessionId = status.mediaSessionId;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
messageHandler (message: Message) {
|
||||
switch (message.subject) {
|
||||
case "bridge:/media/sendMediaMessage": {
|
||||
let error = false;
|
||||
@@ -19,60 +101,7 @@ export default class Media {
|
||||
}
|
||||
}
|
||||
|
||||
constructor (sessionId
|
||||
, mediaSessionId
|
||||
, _id
|
||||
, parentSession,
|
||||
_sendMessage) {
|
||||
|
||||
this._id = _id;
|
||||
|
||||
this._sendMessage = _sendMessage;
|
||||
|
||||
this.sessionId = sessionId;
|
||||
this.mediaSessionId = mediaSessionId;
|
||||
|
||||
const namespace = "urn:x-cast:com.google.cast.media";
|
||||
|
||||
this.session = parentSession;
|
||||
this.session.createChannel(namespace);
|
||||
this.channel = this.session.channelMap.get(namespace);
|
||||
|
||||
this.channel.on("message", data => {
|
||||
if (data && data.type === "MEDIA_STATUS"
|
||||
&& data.status && data.status.length > 0) {
|
||||
|
||||
const status = data.status[0];
|
||||
|
||||
const messageData = {
|
||||
currentTime: status.currentTime
|
||||
, _lastCurrentTime: Date.now() / 1000
|
||||
, customData: status.customData
|
||||
, _volumeLevel: status.volume.level
|
||||
, _volumeMuted: status.volume.muted
|
||||
, playbackRate: status.playbackRate
|
||||
, playerState: status.playerState
|
||||
, repeatMode: status.repeatMode
|
||||
};
|
||||
|
||||
if (status.media) {
|
||||
messageData.media = status.media;
|
||||
}
|
||||
if (status.mediaSessionId) {
|
||||
messageData.mediaSessionId = status.mediaSessionId;
|
||||
}
|
||||
|
||||
this.sendMessage("shim:/media/update", messageData);
|
||||
|
||||
// Update ID
|
||||
if (status.mediaSessionId) {
|
||||
this.mediaSessionId = status.mediaSessionId;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
sendMessage (subject, data = {}) {
|
||||
sendMessage (subject: string, data: any = {}) {
|
||||
this._sendMessage({
|
||||
subject
|
||||
, data
|
||||
@@ -1,7 +1,128 @@
|
||||
import { Client } from "castv2";
|
||||
"use strict";
|
||||
|
||||
import { Client, ClientChannel } from "castv2";
|
||||
|
||||
import { Message
|
||||
, SendMessageCallback } from "./types";
|
||||
|
||||
|
||||
const NS_CONNECTION = "urn:x-cast:com.google.cast.tp.connection";
|
||||
const NS_HEARTBEAT = "urn:x-cast:com.google.cast.tp.heartbeat";
|
||||
const NS_RECEIVER = "urn:x-cast:com.google.cast.receiver";
|
||||
|
||||
export default class Session {
|
||||
messageHandler (message) {
|
||||
private _sendMessage: SendMessageCallback;
|
||||
private sessionId: number;
|
||||
private _id: string;
|
||||
|
||||
private client: Client;
|
||||
private clientConnection: ClientChannel;
|
||||
private clientHeartbeat: ClientChannel;
|
||||
private clientReceiver: ClientChannel;
|
||||
private clientHeartbeatIntervalId: NodeJS.Timer;
|
||||
|
||||
private isSessionCreated = false;
|
||||
|
||||
private clientId: string;
|
||||
private transportId: string;
|
||||
private transportConnection: ClientChannel;
|
||||
private app: any;
|
||||
|
||||
|
||||
public channelMap = new Map<string, ClientChannel>();
|
||||
|
||||
|
||||
constructor (host: string
|
||||
, port: number
|
||||
, appId: string
|
||||
, sessionId: number
|
||||
, _sendMessage: SendMessageCallback) {
|
||||
|
||||
this._sendMessage = _sendMessage;
|
||||
this.sessionId = sessionId;
|
||||
|
||||
this.client = new Client();
|
||||
|
||||
this.client.connect({ host, port }, () => {
|
||||
let transportHeartbeat: ClientChannel;
|
||||
|
||||
const sourceId = "sender-0";
|
||||
const destinationId = "receiver-0";
|
||||
|
||||
this.clientConnection = this.client.createChannel(
|
||||
sourceId, destinationId, NS_CONNECTION, "JSON");
|
||||
this.clientHeartbeat = this.client.createChannel(
|
||||
sourceId, destinationId, NS_HEARTBEAT, "JSON");
|
||||
this.clientReceiver = this.client.createChannel(
|
||||
sourceId, destinationId, NS_RECEIVER, "JSON");
|
||||
|
||||
this.clientConnection.send({ type: "CONNECT" });
|
||||
this.clientHeartbeat.send({ type: "PING" });
|
||||
|
||||
this.clientHeartbeatIntervalId = setInterval(() => {
|
||||
if (transportHeartbeat) {
|
||||
transportHeartbeat.send({ type: "PING" });
|
||||
}
|
||||
this.clientHeartbeat.send({ type: "PING" });
|
||||
}, 5000);
|
||||
|
||||
this.clientReceiver.send({
|
||||
type: "LAUNCH"
|
||||
, appId
|
||||
, requestId: 1
|
||||
});
|
||||
|
||||
this.clientReceiver.on("message", (message: any) => {
|
||||
switch (message.type) {
|
||||
case "RECEIVER_STATUS": {
|
||||
this.sendMessage("shim:/session/updateStatus", message.status);
|
||||
|
||||
if (!message.status.applications) return;
|
||||
|
||||
const receiverApp = message.status.applications[0];
|
||||
const receiverAppId = receiverApp.appId;
|
||||
|
||||
this.app = receiverApp;
|
||||
|
||||
if (receiverAppId !== appId) {
|
||||
// Close session
|
||||
this.sendMessage("shim:/session/stopped");
|
||||
this.client.close();
|
||||
clearInterval(this.clientHeartbeatIntervalId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.isSessionCreated) {
|
||||
this.isSessionCreated = true;
|
||||
|
||||
this.transportId = this.app.transportId;
|
||||
this.clientId = `client-${Math.floor(Math.random() * 10e5)}`;
|
||||
|
||||
this.transportConnection = this.client.createChannel(
|
||||
this.clientId, this.transportId, NS_CONNECTION, "JSON");
|
||||
transportHeartbeat = this.client.createChannel(
|
||||
this.clientId, this.transportId, NS_HEARTBEAT, "JSON");
|
||||
|
||||
this.transportConnection.send({ type: "CONNECT" });
|
||||
|
||||
this.sessionId = this.app.sessionId;
|
||||
|
||||
this.sendMessage("shim:/session/connected", {
|
||||
sessionId: this.app.sessionId
|
||||
, namespaces: this.app.namespaces
|
||||
, displayName: this.app.displayName
|
||||
, statusText: this.app.displayName
|
||||
});
|
||||
}
|
||||
|
||||
break;
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
messageHandler (message: Message) {
|
||||
switch (message.subject) {
|
||||
case "bridge:/session/close":
|
||||
this.close();
|
||||
@@ -36,115 +157,7 @@ export default class Session {
|
||||
}
|
||||
}
|
||||
|
||||
constructor (host, port, appId, sessionId, _sendMessage) {
|
||||
this._sendMessage = _sendMessage;
|
||||
|
||||
this.sessionId = sessionId;
|
||||
this.clientConnection;
|
||||
this.clientHeartbeat;
|
||||
this.clientReceiver;
|
||||
|
||||
this.channelMap = new Map();
|
||||
|
||||
this.client = new Client();
|
||||
this.client.connect({ host, port }, () => {
|
||||
let transportHeartbeat;
|
||||
|
||||
this.clientConnection = this.client.createChannel(
|
||||
"sender-0"
|
||||
, "receiver-0"
|
||||
, "urn:x-cast:com.google.cast.tp.connection"
|
||||
, "JSON");
|
||||
this.clientHeartbeat = this.client.createChannel(
|
||||
"sender-0"
|
||||
, "receiver-0"
|
||||
, "urn:x-cast:com.google.cast.tp.heartbeat"
|
||||
, "JSON");
|
||||
this.clientReceiver = this.client.createChannel(
|
||||
"sender-0"
|
||||
, "receiver-0"
|
||||
, "urn:x-cast:com.google.cast.receiver"
|
||||
, "JSON");
|
||||
|
||||
this.clientConnection.send({ type: "CONNECT" });
|
||||
this.clientHeartbeat.send({ type: "PING" });
|
||||
|
||||
this.clientHeartbeatInterval = setInterval(() => {
|
||||
if (transportHeartbeat) {
|
||||
transportHeartbeat.send({ type: "PING" });
|
||||
}
|
||||
this.clientHeartbeat.send({ type: "PING" });
|
||||
}, 5000);
|
||||
|
||||
this.clientReceiver.send({
|
||||
type: "LAUNCH"
|
||||
, appId
|
||||
, requestId: 1
|
||||
});
|
||||
|
||||
|
||||
let sessionCreated = false;
|
||||
|
||||
this.clientReceiver.on("message", (data, broadcast) => {
|
||||
switch (data.type) {
|
||||
case "RECEIVER_STATUS":
|
||||
|
||||
this.sendMessage("shim:/session/updateStatus", data.status);
|
||||
|
||||
if (!data.status.applications) return;
|
||||
|
||||
const receiverApp = data.status.applications[0];
|
||||
const receiverAppId = receiverApp.appId;
|
||||
|
||||
this.app = receiverApp;
|
||||
|
||||
if (receiverAppId !== appId) {
|
||||
// Close session
|
||||
this.sendMessage("shim:/session/stopped");
|
||||
this.client.close();
|
||||
clearInterval(this.clientHeartbeatInterval);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sessionCreated) {
|
||||
sessionCreated = true;
|
||||
|
||||
this.transport = this.app.transportId;
|
||||
this.transportId = this.app.transportId;
|
||||
this.clientId = `client-${Math.floor(Math.random() * 10e5)}`;
|
||||
|
||||
this.transportConnect = this.client.createChannel(
|
||||
this.clientId
|
||||
, this.transport
|
||||
, "urn:x-cast:com.google.cast.tp.connection"
|
||||
, "JSON");
|
||||
|
||||
this.transportConnect.send({ type: "CONNECT" });
|
||||
|
||||
transportHeartbeat = this.client.createChannel(
|
||||
this.clientId
|
||||
, this.transport
|
||||
, "urn:x-cast:com.google.cast.tp.heartbeat"
|
||||
, "JSON");
|
||||
|
||||
this.sessionId = this.app.sessionId;
|
||||
|
||||
this.sendMessage("shim:/session/connected", {
|
||||
sessionId: this.app.sessionId
|
||||
, namespaces: this.app.namespaces
|
||||
, displayName: this.app.displayName
|
||||
, statusText: this.app.displayName
|
||||
});
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
sendMessage (subject, data = {}) {
|
||||
sendMessage (subject: string, data: any = {}) {
|
||||
this._sendMessage({
|
||||
subject
|
||||
, data
|
||||
@@ -152,24 +165,25 @@ export default class Session {
|
||||
});
|
||||
}
|
||||
|
||||
createChannel (namespace) {
|
||||
createChannel (namespace: string) {
|
||||
if (!this.channelMap.has(namespace)) {
|
||||
this.channelMap.set(namespace
|
||||
, this.client.createChannel(
|
||||
this.clientId, this.transport, namespace, "JSON"));
|
||||
this.clientId, this.transportId, namespace, "JSON"));
|
||||
}
|
||||
}
|
||||
|
||||
close () {
|
||||
this.clientConnection.send({ type: "CLOSE" });
|
||||
if (this.transportConnect) {
|
||||
this.transportConnect.send({ type: "CLOSE" });
|
||||
if (this.transportConnection) {
|
||||
this.transportConnection.send({ type: "CLOSE" });
|
||||
}
|
||||
}
|
||||
|
||||
_impl_addMessageListener (namespace) {
|
||||
|
||||
_impl_addMessageListener (namespace: string) {
|
||||
this.createChannel(namespace);
|
||||
this.channelMap.get(namespace).on("message", data => {
|
||||
this.channelMap.get(namespace).on("message", (data: any) => {
|
||||
this.sendMessage("shim:/session/impl_addMessageListener", {
|
||||
namespace: namespace
|
||||
, data: JSON.stringify(data)
|
||||
@@ -177,7 +191,7 @@ export default class Session {
|
||||
})
|
||||
}
|
||||
|
||||
_impl_sendMessage (namespace, message, messageId) {
|
||||
_impl_sendMessage (namespace: string, message: object, messageId: string) {
|
||||
let error = false;
|
||||
|
||||
try {
|
||||
@@ -193,7 +207,7 @@ export default class Session {
|
||||
});
|
||||
}
|
||||
|
||||
_impl_setReceiverMuted (muted, volumeId) {
|
||||
_impl_setReceiverMuted (muted: boolean, volumeId: string) {
|
||||
let error = false;
|
||||
|
||||
try {
|
||||
@@ -212,7 +226,7 @@ export default class Session {
|
||||
});
|
||||
}
|
||||
|
||||
_impl_setReceiverVolumeLevel (newLevel, volumeId) {
|
||||
_impl_setReceiverVolumeLevel (newLevel: number, volumeId: string) {
|
||||
let error = false;
|
||||
|
||||
try {
|
||||
@@ -231,7 +245,7 @@ export default class Session {
|
||||
});
|
||||
}
|
||||
|
||||
_impl_stop (stopId) {
|
||||
_impl_stop (stopId: string) {
|
||||
let error = false;
|
||||
|
||||
try {
|
||||
@@ -245,7 +259,8 @@ export default class Session {
|
||||
}
|
||||
|
||||
this.client.close();
|
||||
clearInterval(this.clientHeartbeatInterval);
|
||||
|
||||
clearInterval(this.clientHeartbeatIntervalId);
|
||||
|
||||
this.sendMessage("shim:/session/impl_stop", {
|
||||
stopId
|
||||
@@ -9,14 +9,16 @@ import * as transforms from "./transforms";
|
||||
import Media from "./Media";
|
||||
import Session from "./Session";
|
||||
|
||||
import { Message } from "./types";
|
||||
|
||||
import { __applicationName
|
||||
, __applicationVersion } from "../package.json";
|
||||
|
||||
|
||||
const browser = dnssd.Browser(dnssd.tcp("googlecast"));
|
||||
const browser = new dnssd.Browser(dnssd.tcp("googlecast"));
|
||||
|
||||
// Local media server
|
||||
let httpServer;
|
||||
let httpServer: http.Server;
|
||||
|
||||
process.on("SIGTERM", () => {
|
||||
if (httpServer) httpServer.close();
|
||||
@@ -35,7 +37,7 @@ process.stdin
|
||||
/**
|
||||
* Encode and send a message to the extension.
|
||||
*/
|
||||
function sendMessage (message) {
|
||||
function sendMessage (message: object) {
|
||||
try {
|
||||
transforms.encode.write(message);
|
||||
} catch (err) {}
|
||||
@@ -43,8 +45,8 @@ function sendMessage (message) {
|
||||
|
||||
|
||||
// Existing counterpart Media/Session objects
|
||||
const existingSessions = new Map();
|
||||
const existingMedia = new Map();
|
||||
const existingSessions: Map<string, Session> = new Map();
|
||||
const existingMedia: Map<string, Media> = new Map();
|
||||
|
||||
/**
|
||||
* Handle incoming messages from the extension and forward
|
||||
@@ -53,7 +55,7 @@ const existingMedia = new Map();
|
||||
* Initializes the counterpart objects and is responsible
|
||||
* for managing existing ones.
|
||||
*/
|
||||
async function handleMessage (message) {
|
||||
async function handleMessage (message: Message) {
|
||||
if (message.subject.startsWith("bridge:/media/")) {
|
||||
if (existingMedia.has(message._id)) {
|
||||
// Forward message to instance message handler
|
||||
@@ -99,13 +101,13 @@ async function handleMessage (message) {
|
||||
switch (message.subject) {
|
||||
case "bridge:/getInfo": {
|
||||
const extensionVersion = message.data;
|
||||
|
||||
return __applicationVersion;
|
||||
};
|
||||
|
||||
case "bridge:/startDiscovery":
|
||||
case "bridge:/startDiscovery": {
|
||||
browser.start();
|
||||
break;
|
||||
};
|
||||
|
||||
case "bridge:/startHttpServer": {
|
||||
const { filePath, port } = message.data;
|
||||
@@ -155,14 +157,15 @@ async function handleMessage (message) {
|
||||
break;
|
||||
};
|
||||
|
||||
case "bridge:/stopHttpServer":
|
||||
case "bridge:/stopHttpServer": {
|
||||
if (httpServer) httpServer.close();
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
browser.on("serviceUp", service => {
|
||||
browser.on("serviceUp", (service: dnssd.Service) => {
|
||||
transforms.encode.write({
|
||||
subject: "shim:/serviceUp"
|
||||
, data: {
|
||||
@@ -175,7 +178,7 @@ browser.on("serviceUp", service => {
|
||||
});
|
||||
});
|
||||
|
||||
browser.on("serviceDown", service => {
|
||||
browser.on("serviceDown", (service: dnssd.Service) => {
|
||||
transforms.encode.write({
|
||||
subject:"shim:/serviceDown"
|
||||
, data: {
|
||||
@@ -1,19 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
import { Transform } from "stream";
|
||||
import { Message } from "./types";
|
||||
|
||||
|
||||
interface ResponseHandlerFunction {
|
||||
(message: Message): Promise<any>
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a handler function that implements the transform
|
||||
* and calls the transform callback.
|
||||
*/
|
||||
const response = (handler) => new Transform({
|
||||
export const response = (handler: ResponseHandlerFunction) => new Transform({
|
||||
readableObjectMode: true
|
||||
, writableObjectMode: true
|
||||
|
||||
, transform (chunk, encoding, callback) {
|
||||
|
||||
Promise.resolve(handler(chunk, callback))
|
||||
, transform (chunk: Message, encoding, callback) {
|
||||
Promise.resolve(handler(chunk))
|
||||
.then(response => {
|
||||
if (response) {
|
||||
callback(null, response);
|
||||
@@ -29,43 +33,45 @@ const response = (handler) => new Transform({
|
||||
* Takes input, decodes the message string, parses as JSON
|
||||
* and outputs the parsed result.
|
||||
*/
|
||||
const decode = new Transform({
|
||||
export const decode = new Transform({
|
||||
readableObjectMode: true
|
||||
|
||||
, transform (chunk, encoding, callback) {
|
||||
// Setup persistent data
|
||||
if (!this.hasOwnProperty("buf")
|
||||
&& !this.hasOwnProperty("message_length")) {
|
||||
const self = this as any;
|
||||
|
||||
this.buf = Buffer.alloc(0);
|
||||
this.message_length = null;
|
||||
// Setup persistent data
|
||||
if (!this.hasOwnProperty("_buf")
|
||||
&& !this.hasOwnProperty("_messageLength")) {
|
||||
|
||||
self._buf = Buffer.alloc(0);
|
||||
self._messageLength = null;
|
||||
}
|
||||
|
||||
// Append next chunk to buffer
|
||||
this.buf = Buffer.concat([ this.buf, chunk ]);
|
||||
self._buf = Buffer.concat([ self._buf, chunk ]);
|
||||
|
||||
while (true) {
|
||||
if (this.message_length === null) {
|
||||
if (this.buf.length >= 4) {
|
||||
if (self._messageLength === null) {
|
||||
if (self._buf.length >= 4) {
|
||||
|
||||
// Read message length
|
||||
this.message_length = this.buf.readUInt32LE(0);
|
||||
self._messageLength = self._buf.readUInt32LE(0);
|
||||
|
||||
// Offset buffer
|
||||
this.buf = this.buf.slice(4);
|
||||
self._buf = self._buf.slice(4);
|
||||
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (this.buf.length >= this.message_length) {
|
||||
const message = JSON.parse(this.buf.slice(
|
||||
0, this.message_length));
|
||||
if (self._buf.length >= self._messageLength) {
|
||||
const message = JSON.parse(self._buf.slice(
|
||||
0, self._messageLength));
|
||||
|
||||
this.push(message);
|
||||
|
||||
// Cleanup persistent data
|
||||
this.buf = this.buf.slice(this.message_length);
|
||||
this.message_length = null;
|
||||
self._buf = self._buf.slice(self._messageLength);
|
||||
self._messageLength = null;
|
||||
|
||||
// Parse next message
|
||||
continue;
|
||||
@@ -84,7 +90,7 @@ const decode = new Transform({
|
||||
* Takes input, encodes the message length and content and
|
||||
* outputs the encoded result.
|
||||
*/
|
||||
const encode = new Transform({
|
||||
export const encode = new Transform({
|
||||
writableObjectMode: true
|
||||
|
||||
, transform (chunk, encoding, callback) {
|
||||
@@ -98,10 +104,3 @@ const encode = new Transform({
|
||||
callback(null, Buffer.concat([message_length, message]));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
export {
|
||||
response
|
||||
, decode
|
||||
, encode
|
||||
};
|
||||
11
app/src/types.ts
Normal file
11
app/src/types.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
export interface Message {
|
||||
subject: string;
|
||||
data: any;
|
||||
_id?: string;
|
||||
}
|
||||
|
||||
export interface SendMessageCallback {
|
||||
(message: Message): void
|
||||
}
|
||||
14
app/tsconfig.json
Normal file
14
app/tsconfig.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true
|
||||
, "target": "es5"
|
||||
, "noImplicitAny": true
|
||||
, "esModuleInterop": true
|
||||
, "resolveJsonModule": true
|
||||
, "removeComments": true
|
||||
}
|
||||
, "include": [
|
||||
"./src/**/*"
|
||||
, "./@types/**/*"
|
||||
]
|
||||
}
|
||||
274
ext/package-lock.json
generated
274
ext/package-lock.json
generated
@@ -12,35 +12,35 @@
|
||||
}
|
||||
},
|
||||
"@babel/core": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.2.0.tgz",
|
||||
"integrity": "sha512-7pvAdC4B+iKjFFp9Ztj0QgBndJ++qaMeonT185wAqUnhipw8idm9Rv1UMyBuKtYjfl6ORNkgEgcsYLfHX/GpLw==",
|
||||
"version": "7.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.3.3.tgz",
|
||||
"integrity": "sha512-w445QGI2qd0E0GlSnq6huRZWPMmQGCp5gd5ZWS4hagn0EiwzxD5QMFkpchyusAyVC1n27OKXzQ0/88aVU9n4xQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"@babel/generator": "^7.2.0",
|
||||
"@babel/generator": "^7.3.3",
|
||||
"@babel/helpers": "^7.2.0",
|
||||
"@babel/parser": "^7.2.0",
|
||||
"@babel/template": "^7.1.2",
|
||||
"@babel/traverse": "^7.1.6",
|
||||
"@babel/types": "^7.2.0",
|
||||
"@babel/parser": "^7.3.3",
|
||||
"@babel/template": "^7.2.2",
|
||||
"@babel/traverse": "^7.2.2",
|
||||
"@babel/types": "^7.3.3",
|
||||
"convert-source-map": "^1.1.0",
|
||||
"debug": "^4.1.0",
|
||||
"json5": "^2.1.0",
|
||||
"lodash": "^4.17.10",
|
||||
"lodash": "^4.17.11",
|
||||
"resolve": "^1.3.2",
|
||||
"semver": "^5.4.1",
|
||||
"source-map": "^0.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/types": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.2.0.tgz",
|
||||
"integrity": "sha512-b4v7dyfApuKDvmPb+O488UlGuR1WbwMXFsO/cyqMrnfvRAChZKJAYeeglWTjUO1b9UghKKgepAQM5tsvBJca6A==",
|
||||
"version": "7.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.3.3.tgz",
|
||||
"integrity": "sha512-2tACZ80Wg09UnPg5uGAOUvvInaqLk3l/IAhQzlxLQOIXacr6bMsra5SH6AWw/hIDRCSbCdHP2KzSOD+cT7TzMQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esutils": "^2.0.2",
|
||||
"lodash": "^4.17.10",
|
||||
"lodash": "^4.17.11",
|
||||
"to-fast-properties": "^2.0.0"
|
||||
}
|
||||
},
|
||||
@@ -56,26 +56,26 @@
|
||||
}
|
||||
},
|
||||
"@babel/generator": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.2.0.tgz",
|
||||
"integrity": "sha512-BA75MVfRlFQG2EZgFYIwyT1r6xSkwfP2bdkY/kLZusEYWiJs4xCowab/alaEaT0wSvmVuXGqiefeBlP+7V1yKg==",
|
||||
"version": "7.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.3.3.tgz",
|
||||
"integrity": "sha512-aEADYwRRZjJyMnKN7llGIlircxTCofm3dtV5pmY6ob18MSIuipHpA2yZWkPlycwu5HJcx/pADS3zssd8eY7/6A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/types": "^7.2.0",
|
||||
"@babel/types": "^7.3.3",
|
||||
"jsesc": "^2.5.1",
|
||||
"lodash": "^4.17.10",
|
||||
"lodash": "^4.17.11",
|
||||
"source-map": "^0.5.0",
|
||||
"trim-right": "^1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/types": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.2.0.tgz",
|
||||
"integrity": "sha512-b4v7dyfApuKDvmPb+O488UlGuR1WbwMXFsO/cyqMrnfvRAChZKJAYeeglWTjUO1b9UghKKgepAQM5tsvBJca6A==",
|
||||
"version": "7.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.3.3.tgz",
|
||||
"integrity": "sha512-2tACZ80Wg09UnPg5uGAOUvvInaqLk3l/IAhQzlxLQOIXacr6bMsra5SH6AWw/hIDRCSbCdHP2KzSOD+cT7TzMQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esutils": "^2.0.2",
|
||||
"lodash": "^4.17.10",
|
||||
"lodash": "^4.17.11",
|
||||
"to-fast-properties": "^2.0.0"
|
||||
}
|
||||
}
|
||||
@@ -122,16 +122,16 @@
|
||||
}
|
||||
},
|
||||
"@babel/helper-create-class-features-plugin": {
|
||||
"version": "7.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.2.1.tgz",
|
||||
"integrity": "sha512-EsEP7XLFmcJHjcuFYBxYD1FkP0irC8C9fsrt2tX/jrAi/eTnFI6DOPgVFb+WREeg1GboF+Ib+nCHbGBodyAXSg==",
|
||||
"version": "7.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.3.2.tgz",
|
||||
"integrity": "sha512-tdW8+V8ceh2US4GsYdNVNoohq5uVwOf9k6krjwW4E1lINcHgttnWcNqgdoessn12dAy8QkbezlbQh2nXISNY+A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-function-name": "^7.1.0",
|
||||
"@babel/helper-member-expression-to-functions": "^7.0.0",
|
||||
"@babel/helper-optimise-call-expression": "^7.0.0",
|
||||
"@babel/helper-plugin-utils": "^7.0.0",
|
||||
"@babel/helper-replace-supers": "^7.1.0"
|
||||
"@babel/helper-replace-supers": "^7.2.3"
|
||||
}
|
||||
},
|
||||
"@babel/helper-define-map": {
|
||||
@@ -203,17 +203,30 @@
|
||||
}
|
||||
},
|
||||
"@babel/helper-module-transforms": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.1.0.tgz",
|
||||
"integrity": "sha512-0JZRd2yhawo79Rcm4w0LwSMILFmFXjugG3yqf+P/UsKsRS1mJCmMwwlHDlMg7Avr9LrvSpp4ZSULO9r8jpCzcw==",
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.2.2.tgz",
|
||||
"integrity": "sha512-YRD7I6Wsv+IHuTPkAmAS4HhY0dkPobgLftHp0cRGZSdrRvmZY8rFvae/GVu3bD00qscuvK3WPHB3YdNpBXUqrA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-module-imports": "^7.0.0",
|
||||
"@babel/helper-simple-access": "^7.1.0",
|
||||
"@babel/helper-split-export-declaration": "^7.0.0",
|
||||
"@babel/template": "^7.1.0",
|
||||
"@babel/types": "^7.0.0",
|
||||
"@babel/template": "^7.2.2",
|
||||
"@babel/types": "^7.2.2",
|
||||
"lodash": "^4.17.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/types": {
|
||||
"version": "7.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.3.3.tgz",
|
||||
"integrity": "sha512-2tACZ80Wg09UnPg5uGAOUvvInaqLk3l/IAhQzlxLQOIXacr6bMsra5SH6AWw/hIDRCSbCdHP2KzSOD+cT7TzMQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esutils": "^2.0.2",
|
||||
"lodash": "^4.17.11",
|
||||
"to-fast-properties": "^2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@babel/helper-optimise-call-expression": {
|
||||
@@ -254,14 +267,14 @@
|
||||
}
|
||||
},
|
||||
"@babel/helper-replace-supers": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.1.0.tgz",
|
||||
"integrity": "sha512-BvcDWYZRWVuDeXTYZWxekQNO5D4kO55aArwZOTFXw6rlLQA8ZaDicJR1sO47h+HrnCiDFiww0fSPV0d713KBGQ==",
|
||||
"version": "7.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.2.3.tgz",
|
||||
"integrity": "sha512-GyieIznGUfPXPWu0yLS6U55Mz67AZD9cUk0BfirOWlPrXlBcan9Gz+vHGz+cPfuoweZSnPzPIm67VtQM0OWZbA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-member-expression-to-functions": "^7.0.0",
|
||||
"@babel/helper-optimise-call-expression": "^7.0.0",
|
||||
"@babel/traverse": "^7.1.0",
|
||||
"@babel/traverse": "^7.2.3",
|
||||
"@babel/types": "^7.0.0"
|
||||
}
|
||||
},
|
||||
@@ -297,37 +310,37 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/types": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.2.0.tgz",
|
||||
"integrity": "sha512-b4v7dyfApuKDvmPb+O488UlGuR1WbwMXFsO/cyqMrnfvRAChZKJAYeeglWTjUO1b9UghKKgepAQM5tsvBJca6A==",
|
||||
"version": "7.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.3.3.tgz",
|
||||
"integrity": "sha512-2tACZ80Wg09UnPg5uGAOUvvInaqLk3l/IAhQzlxLQOIXacr6bMsra5SH6AWw/hIDRCSbCdHP2KzSOD+cT7TzMQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esutils": "^2.0.2",
|
||||
"lodash": "^4.17.10",
|
||||
"lodash": "^4.17.11",
|
||||
"to-fast-properties": "^2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@babel/helpers": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.2.0.tgz",
|
||||
"integrity": "sha512-Fr07N+ea0dMcMN8nFpuK6dUIT7/ivt9yKQdEEnjVS83tG2pHwPi03gYmk/tyuwONnZ+sY+GFFPlWGgCtW1hF9A==",
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.3.1.tgz",
|
||||
"integrity": "sha512-Q82R3jKsVpUV99mgX50gOPCWwco9Ec5Iln/8Vyu4osNIOQgSrd9RFrQeUvmvddFNoLwMyOUWU+5ckioEKpDoGA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/template": "^7.1.2",
|
||||
"@babel/traverse": "^7.1.5",
|
||||
"@babel/types": "^7.2.0"
|
||||
"@babel/types": "^7.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/types": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.2.0.tgz",
|
||||
"integrity": "sha512-b4v7dyfApuKDvmPb+O488UlGuR1WbwMXFsO/cyqMrnfvRAChZKJAYeeglWTjUO1b9UghKKgepAQM5tsvBJca6A==",
|
||||
"version": "7.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.3.3.tgz",
|
||||
"integrity": "sha512-2tACZ80Wg09UnPg5uGAOUvvInaqLk3l/IAhQzlxLQOIXacr6bMsra5SH6AWw/hIDRCSbCdHP2KzSOD+cT7TzMQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esutils": "^2.0.2",
|
||||
"lodash": "^4.17.10",
|
||||
"lodash": "^4.17.11",
|
||||
"to-fast-properties": "^2.0.0"
|
||||
}
|
||||
}
|
||||
@@ -345,9 +358,9 @@
|
||||
}
|
||||
},
|
||||
"@babel/parser": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.2.0.tgz",
|
||||
"integrity": "sha512-M74+GvK4hn1eejD9lZ7967qAwvqTZayQa3g10ag4s9uewgR7TKjeaT0YMyoq+gVfKYABiWZ4MQD701/t5e1Jhg==",
|
||||
"version": "7.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.3.3.tgz",
|
||||
"integrity": "sha512-xsH1CJoln2r74hR+y7cg2B5JCPaTh+Hd+EbBRk9nWGSNspuo6krjhX0Om6RnRQuIvFq8wVXCLKH3kwKDYhanSg==",
|
||||
"dev": true
|
||||
},
|
||||
"@babel/plugin-proposal-async-generator-functions": {
|
||||
@@ -362,12 +375,12 @@
|
||||
}
|
||||
},
|
||||
"@babel/plugin-proposal-class-properties": {
|
||||
"version": "7.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.2.1.tgz",
|
||||
"integrity": "sha512-/4FKFChkQ2Jgb8lBDsvFX496YTi7UWTetVgS8oJUpX1e/DlaoeEK57At27ug8Hu2zI2g8bzkJ+8k9qrHZRPGPA==",
|
||||
"version": "7.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.3.3.tgz",
|
||||
"integrity": "sha512-XO9eeU1/UwGPM8L+TjnQCykuVcXqaO5J1bkRPIygqZ/A2L1xVMJ9aZXrY31c0U4H2/LHKL4lbFQLsxktSrc/Ng==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-create-class-features-plugin": "^7.2.1",
|
||||
"@babel/helper-create-class-features-plugin": "^7.3.0",
|
||||
"@babel/helper-plugin-utils": "^7.0.0"
|
||||
}
|
||||
},
|
||||
@@ -392,9 +405,9 @@
|
||||
}
|
||||
},
|
||||
"@babel/plugin-proposal-object-rest-spread": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.2.0.tgz",
|
||||
"integrity": "sha512-1L5mWLSvR76XYUQJXkd/EEQgjq8HHRP6lQuZTTg0VA4tTGPpGemmCdAfQIz1rzEuWAm+ecP8PyyEm30jC1eQCg==",
|
||||
"version": "7.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.3.2.tgz",
|
||||
"integrity": "sha512-DjeMS+J2+lpANkYLLO+m6GjoTMygYglKmRe6cDTbFv3L9i6mmiE8fe6B8MtCSLZpVXscD5kn7s6SgtHrDoBWoA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-plugin-utils": "^7.0.0",
|
||||
@@ -516,9 +529,9 @@
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-classes": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.2.0.tgz",
|
||||
"integrity": "sha512-aPCEkrhJYebDXcGTAP+cdUENkH7zqOlgbKwLbghjjHpJRJBWM/FSlCjMoPGA8oUdiMfOrk3+8EFPLLb5r7zj2w==",
|
||||
"version": "7.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.3.3.tgz",
|
||||
"integrity": "sha512-n0CLbsg7KOXsMF4tSTLCApNMoXk0wOPb0DYfsOO1e7SfIb9gOyfbpKI2MZ+AXfqvlfzq2qsflJ1nEns48Caf2w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-annotate-as-pure": "^7.0.0",
|
||||
@@ -541,9 +554,9 @@
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-destructuring": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.2.0.tgz",
|
||||
"integrity": "sha512-coVO2Ayv7g0qdDbrNiadE4bU7lvCd9H539m2gMknyVjjMdwF/iCOM7R+E8PkntoqLkltO0rk+3axhpp/0v68VQ==",
|
||||
"version": "7.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.3.2.tgz",
|
||||
"integrity": "sha512-Lrj/u53Ufqxl/sGxyjsJ2XNtNuEjDyjpqdhMNh5aZ+XFOdThL46KBj27Uem4ggoezSYBxKWAil6Hu8HtwqesYw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-plugin-utils": "^7.0.0"
|
||||
@@ -648,6 +661,15 @@
|
||||
"@babel/helper-plugin-utils": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-named-capturing-groups-regex": {
|
||||
"version": "7.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.3.0.tgz",
|
||||
"integrity": "sha512-NxIoNVhk9ZxS+9lSoAQ/LM0V2UEvARLttEHUrRDGKFaAxOYQcrkN/nLRE+BbbicCAvZPl7wMP0X60HsHE5DtQw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"regexp-tree": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-new-target": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.0.0.tgz",
|
||||
@@ -668,9 +690,9 @@
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-parameters": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.2.0.tgz",
|
||||
"integrity": "sha512-kB9+hhUidIgUoBQ0MsxMewhzr8i60nMa2KgeJKQWYrqQpqcBYtnpR+JgkadZVZoaEZ/eKu9mclFaVwhRpLNSzA==",
|
||||
"version": "7.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.3.3.tgz",
|
||||
"integrity": "sha512-IrIP25VvXWu/VlBWTpsjGptpomtIkYrN/3aDp4UKm7xK6UxZY88kcJ1UwETbzHAlwN21MnNfwlar0u8y3KpiXw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-call-delegate": "^7.1.0",
|
||||
@@ -737,9 +759,9 @@
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-spread": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.2.0.tgz",
|
||||
"integrity": "sha512-7TtPIdwjS/i5ZBlNiQePQCovDh9pAhVbp/nGVRBZuUdBiVRThyyLend3OHobc0G+RLCPPAN70+z/MAMhsgJd/A==",
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.2.2.tgz",
|
||||
"integrity": "sha512-KWfky/58vubwtS0hLqEnrWJjsMGaOeSBn90Ezn5Jeg9Z8KKHmELbP1yGylMlm5N6TPKeY9A2+UaSYLdxahg01w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-plugin-utils": "^7.0.0"
|
||||
@@ -796,19 +818,20 @@
|
||||
}
|
||||
},
|
||||
"@babel/preset-env": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.2.0.tgz",
|
||||
"integrity": "sha512-haGR38j5vOGVeBatrQPr3l0xHbs14505DcM57cbJy48kgMFvvHHoYEhHuRV+7vi559yyAUAVbTWzbK/B/pzJng==",
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.3.1.tgz",
|
||||
"integrity": "sha512-FHKrD6Dxf30e8xgHQO0zJZpUPfVZg+Xwgz5/RdSWCbza9QLNk4Qbp40ctRoqDxml3O8RMzB1DU55SXeDG6PqHQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-module-imports": "^7.0.0",
|
||||
"@babel/helper-plugin-utils": "^7.0.0",
|
||||
"@babel/plugin-proposal-async-generator-functions": "^7.2.0",
|
||||
"@babel/plugin-proposal-json-strings": "^7.2.0",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.2.0",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.3.1",
|
||||
"@babel/plugin-proposal-optional-catch-binding": "^7.2.0",
|
||||
"@babel/plugin-proposal-unicode-property-regex": "^7.2.0",
|
||||
"@babel/plugin-syntax-async-generators": "^7.2.0",
|
||||
"@babel/plugin-syntax-json-strings": "^7.2.0",
|
||||
"@babel/plugin-syntax-object-rest-spread": "^7.2.0",
|
||||
"@babel/plugin-syntax-optional-catch-binding": "^7.2.0",
|
||||
"@babel/plugin-transform-arrow-functions": "^7.2.0",
|
||||
@@ -828,6 +851,7 @@
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.2.0",
|
||||
"@babel/plugin-transform-modules-systemjs": "^7.2.0",
|
||||
"@babel/plugin-transform-modules-umd": "^7.2.0",
|
||||
"@babel/plugin-transform-named-capturing-groups-regex": "^7.3.0",
|
||||
"@babel/plugin-transform-new-target": "^7.0.0",
|
||||
"@babel/plugin-transform-object-super": "^7.2.0",
|
||||
"@babel/plugin-transform-parameters": "^7.2.0",
|
||||
@@ -891,31 +915,57 @@
|
||||
}
|
||||
},
|
||||
"@babel/template": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.1.2.tgz",
|
||||
"integrity": "sha512-SY1MmplssORfFiLDcOETrW7fCLl+PavlwMh92rrGcikQaRq4iWPVH0MpwPpY3etVMx6RnDjXtr6VZYr/IbP/Ag==",
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.2.2.tgz",
|
||||
"integrity": "sha512-zRL0IMM02AUDwghf5LMSSDEz7sBCO2YnNmpg3uWTZj/v1rcG2BmQUvaGU8GhU8BvfMh1k2KIAYZ7Ji9KXPUg7g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"@babel/parser": "^7.1.2",
|
||||
"@babel/types": "^7.1.2"
|
||||
"@babel/parser": "^7.2.2",
|
||||
"@babel/types": "^7.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/types": {
|
||||
"version": "7.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.3.3.tgz",
|
||||
"integrity": "sha512-2tACZ80Wg09UnPg5uGAOUvvInaqLk3l/IAhQzlxLQOIXacr6bMsra5SH6AWw/hIDRCSbCdHP2KzSOD+cT7TzMQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esutils": "^2.0.2",
|
||||
"lodash": "^4.17.11",
|
||||
"to-fast-properties": "^2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@babel/traverse": {
|
||||
"version": "7.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.1.6.tgz",
|
||||
"integrity": "sha512-CXedit6GpISz3sC2k2FsGCUpOhUqKdyL0lqNrImQojagnUMXf8hex4AxYFRuMkNGcvJX5QAFGzB5WJQmSv8SiQ==",
|
||||
"version": "7.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.2.3.tgz",
|
||||
"integrity": "sha512-Z31oUD/fJvEWVR0lNZtfgvVt512ForCTNKYcJBGbPb1QZfve4WGH8Wsy7+Mev33/45fhP/hwQtvgusNdcCMgSw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"@babel/generator": "^7.1.6",
|
||||
"@babel/generator": "^7.2.2",
|
||||
"@babel/helper-function-name": "^7.1.0",
|
||||
"@babel/helper-split-export-declaration": "^7.0.0",
|
||||
"@babel/parser": "^7.1.6",
|
||||
"@babel/types": "^7.1.6",
|
||||
"@babel/parser": "^7.2.3",
|
||||
"@babel/types": "^7.2.2",
|
||||
"debug": "^4.1.0",
|
||||
"globals": "^11.1.0",
|
||||
"lodash": "^4.17.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/types": {
|
||||
"version": "7.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.3.3.tgz",
|
||||
"integrity": "sha512-2tACZ80Wg09UnPg5uGAOUvvInaqLk3l/IAhQzlxLQOIXacr6bMsra5SH6AWw/hIDRCSbCdHP2KzSOD+cT7TzMQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esutils": "^2.0.2",
|
||||
"lodash": "^4.17.11",
|
||||
"to-fast-properties": "^2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@babel/types": {
|
||||
@@ -2071,14 +2121,14 @@
|
||||
}
|
||||
},
|
||||
"browserslist": {
|
||||
"version": "4.3.5",
|
||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.3.5.tgz",
|
||||
"integrity": "sha512-z9ZhGc3d9e/sJ9dIx5NFXkKoaiQTnrvrMsN3R1fGb1tkWWNSz12UewJn9TNxGo1l7J23h0MRaPmk7jfeTZYs1w==",
|
||||
"version": "4.4.2",
|
||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.4.2.tgz",
|
||||
"integrity": "sha512-ISS/AIAiHERJ3d45Fz0AVYKkgcy+F/eJHzKEvv1j0wwKGKD9T3BrwKr/5g45L+Y4XIK5PlTqefHciRFcfE1Jxg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"caniuse-lite": "^1.0.30000912",
|
||||
"electron-to-chromium": "^1.3.86",
|
||||
"node-releases": "^1.0.5"
|
||||
"caniuse-lite": "^1.0.30000939",
|
||||
"electron-to-chromium": "^1.3.113",
|
||||
"node-releases": "^1.1.8"
|
||||
}
|
||||
},
|
||||
"buffer": {
|
||||
@@ -2227,9 +2277,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"caniuse-lite": {
|
||||
"version": "1.0.30000914",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000914.tgz",
|
||||
"integrity": "sha512-qqj0CL1xANgg6iDOybiPTIxtsmAnfIky9mBC35qgWrnK4WwmhqfpmkDYMYgwXJ8LRZ3/2jXlCntulO8mBaAgSg==",
|
||||
"version": "1.0.30000939",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000939.tgz",
|
||||
"integrity": "sha512-oXB23ImDJOgQpGjRv1tCtzAvJr4/OvrHi5SO2vUgB0g0xpdZZoA/BxfImiWfdwoYdUTtQrPsXsvYU/dmCSM8gg==",
|
||||
"dev": true
|
||||
},
|
||||
"capture-stack-trace": {
|
||||
@@ -2789,9 +2839,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz",
|
||||
"integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
@@ -3245,9 +3295,9 @@
|
||||
}
|
||||
},
|
||||
"electron-to-chromium": {
|
||||
"version": "1.3.88",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.88.tgz",
|
||||
"integrity": "sha512-UPV4NuQMKeUh1S0OWRvwg0PI8ASHN9kBC8yDTk1ROXLC85W5GnhTRu/MZu3Teqx3JjlQYuckuHYXSUSgtb3J+A==",
|
||||
"version": "1.3.113",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.113.tgz",
|
||||
"integrity": "sha512-De+lPAxEcpxvqPTyZAXELNpRZXABRxf+uL/rSykstQhzj/B0l1150G/ExIIxKc16lI89Hgz81J0BHAcbTqK49g==",
|
||||
"dev": true
|
||||
},
|
||||
"elliptic": {
|
||||
@@ -6103,9 +6153,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"js-levenshtein": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.4.tgz",
|
||||
"integrity": "sha512-PxfGzSs0ztShKrUYPIn5r0MtyAhYcCwmndozzpz8YObbPnD1jFxzlBGbRnX2mIu6Z13xN6+PTu05TQFnZFlzow==",
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz",
|
||||
"integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==",
|
||||
"dev": true
|
||||
},
|
||||
"js-select": {
|
||||
@@ -7201,9 +7251,9 @@
|
||||
}
|
||||
},
|
||||
"node-releases": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.0.5.tgz",
|
||||
"integrity": "sha512-Ky7q0BO1BBkG/rQz6PkEZ59rwo+aSfhczHP1wwq8IowoVdN/FpiP7qp0XW0P2+BVCWe5fQUBozdbVd54q1RbCQ==",
|
||||
"version": "1.1.8",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.8.tgz",
|
||||
"integrity": "sha512-gQm+K9mGCiT/NXHy+V/ZZS1N/LOaGGqRAAJJs3X9Ah1g+CIbRcBgNyoNYQ+SEtcyAtB9KqDruu+fF7nWjsqRaA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"semver": "^5.3.0"
|
||||
@@ -8238,9 +8288,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"regenerator-transform": {
|
||||
"version": "0.13.3",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.13.3.tgz",
|
||||
"integrity": "sha512-5ipTrZFSq5vU2YoGoww4uaRVAK4wyYC4TSICibbfEPOruUu8FFP7ErV0BjmbIOEpn3O/k9na9UEdYR/3m7N6uA==",
|
||||
"version": "0.13.4",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.13.4.tgz",
|
||||
"integrity": "sha512-T0QMBjK3J0MtxjPmdIMXm72Wvj2Abb0Bd4HADdfijwMdoIsyQZ6fWC7kDFhk2YinBBEMZDL7Y7wh0J1sGx3S4A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"private": "^0.1.6"
|
||||
@@ -8256,6 +8306,12 @@
|
||||
"safe-regex": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"regexp-tree": {
|
||||
"version": "0.1.5",
|
||||
"resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.5.tgz",
|
||||
"integrity": "sha512-nUmxvfJyAODw+0B13hj8CFVAxhe7fDEAgJgaotBu3nnR+IgGgZq59YedJP5VYTlkEfqjuK6TuRpnymKdatLZfQ==",
|
||||
"dev": true
|
||||
},
|
||||
"regexp.prototype.flags": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.2.0.tgz",
|
||||
@@ -8321,7 +8377,7 @@
|
||||
"dependencies": {
|
||||
"jsesc": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
|
||||
"integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
|
||||
"dev": true
|
||||
}
|
||||
|
||||
@@ -11,15 +11,14 @@
|
||||
"start": "web-ext run -s ../dist/ext/"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.2.0",
|
||||
"@babel/plugin-proposal-class-properties": "^7.2.1",
|
||||
"@babel/core": "^7.3.3",
|
||||
"@babel/plugin-proposal-class-properties": "^7.3.3",
|
||||
"@babel/plugin-proposal-do-expressions": "^7.2.0",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.2.0",
|
||||
"@babel/preset-env": "^7.2.0",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.3.2",
|
||||
"@babel/preset-env": "^7.3.1",
|
||||
"@babel/preset-react": "^7.0.0",
|
||||
"babel-loader": "^8.0.4",
|
||||
"copy-webpack-plugin": "^4.6.0",
|
||||
"minimist": "^1.2.0",
|
||||
"preact": "^8.4.2",
|
||||
"preact-compat": "^3.18.4",
|
||||
"uuid": "^3.3.2",
|
||||
|
||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -277,6 +277,12 @@
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
||||
"dev": true
|
||||
},
|
||||
"node-emoji": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.8.1.tgz",
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"fs-extra": "^7.0.1",
|
||||
"glob": "^7.1.3",
|
||||
"jasmine-console-reporter": "^3.1.0",
|
||||
"minimist": "^1.2.0",
|
||||
"selenium-webdriver": "^4.0.0-alpha.1",
|
||||
"semver": "^5.6.0",
|
||||
"ws": "^6.1.2"
|
||||
|
||||
Reference in New Issue
Block a user