mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-01 13:14:16 +08:00
bump(electron): 1.2.1 and React Devtools in dev mode 🎉
This commit is contained in:
parent
a00d4f2028
commit
5b69cea5d5
18 changed files with 43075 additions and 9 deletions
|
@ -11,7 +11,7 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/nylas/N1/issues"
|
||||
},
|
||||
"electronVersion": "1.1.1",
|
||||
"electronVersion": "1.2.1",
|
||||
"dependencies": {
|
||||
"async": "^0.9",
|
||||
"babel-core": "6.8.0",
|
||||
|
|
|
@ -48,7 +48,7 @@ function makeSqlite3Command() {
|
|||
|
||||
// Use our local version of npm (npm 3x) to build sqlite
|
||||
var npmPath = '"' + path.resolve(__dirname, '..', 'build', 'node_modules', '.bin', 'npm') + '"';
|
||||
return npmPath + " install https://github.com/bengotow/node-sqlite3/archive/bengotow/fts5.tar.gz --ignore-scripts && cd node_modules/sqlite3 && "+nodeGypPath+" configure rebuild --target="+targetElectronVersion+" --arch="+targetArch+" --target_platform="+targetPlatform+" --dist-url=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=../lib/binding/electron-v1.1-"+targetPlatform+"-"+targetArch
|
||||
return npmPath + " install https://github.com/bengotow/node-sqlite3/archive/bengotow/fts5.tar.gz --ignore-scripts && cd node_modules/sqlite3 && "+nodeGypPath+" configure rebuild --target="+targetElectronVersion+" --arch="+targetArch+" --target_platform="+targetPlatform+" --dist-url=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=../lib/binding/electron-v1.2-"+targetPlatform+"-"+targetArch
|
||||
}
|
||||
|
||||
function bootstrap() {
|
||||
|
|
|
@ -49,6 +49,7 @@ export default class Application extends EventEmitter {
|
|||
if (initializeInBackground === undefined) {
|
||||
initializeInBackground = false;
|
||||
}
|
||||
|
||||
this.autoUpdateManager = new AutoUpdateManager(version, config, specMode);
|
||||
this.applicationMenu = new ApplicationMenu(version);
|
||||
this.windowManager = new WindowManager({
|
||||
|
@ -63,6 +64,12 @@ export default class Application extends EventEmitter {
|
|||
this._databasePhase = 'setup';
|
||||
this.perf = new PerformanceMonitor()
|
||||
|
||||
if (this.devMode) {
|
||||
console.log("In Dev Mode: Installing React Developer Tools...");
|
||||
const reactPath = path.resolve('./static/devtools-extensions/react-devtools-0.14.11');
|
||||
BrowserWindow.addDevToolsExtension(reactPath);
|
||||
}
|
||||
|
||||
this.setupJavaScriptArguments();
|
||||
this.handleEvents();
|
||||
this.handleLaunchOptions(options);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
[{"description":"treehash per file","signed_content":{"payload":"eyJjb250ZW50X2hhc2hlcyI6W3siYmxvY2tfc2l6ZSI6NDA5NiwiZGlnZXN0Ijoic2hhMjU2IiwiZmlsZXMiOlt7InBhdGgiOiJidWlsZC9iYWNrZW5kLmpzIiwicm9vdF9oYXNoIjoiNkRHU0FFTlVQN3F2RXkxVVJDMGc3dlptUFlaR2hIUW50ZndJM0tEZmlNTSJ9LHsicGF0aCI6ImJ1aWxkL2JhY2tncm91bmQuanMiLCJyb290X2hhc2giOiJYb2xmbGVOV280b3pPZW1KQ3FUSzVWdExKb3ZyZ2VJcmFBU3FWRzE3VFA0In0seyJwYXRoIjoiYnVpbGQvY29udGVudFNjcmlwdC5qcyIsInJvb3RfaGFzaCI6Iklnd3FjMFBoVGVFa1dLeEc1TEkzeEo0Vy1tYTdOanp3cTNJNVFRTDdTcjgifSx7InBhdGgiOiJidWlsZC9pbmplY3QuanMiLCJyb290X2hhc2giOiJWWW8wQ1VzTjJ0cHg3QVhMY1VLdHh0Sllsa2dBZzBOVGR3Yk1NM0ZsalZVIn0seyJwYXRoIjoiYnVpbGQvbWFpbi5qcyIsInJvb3RfaGFzaCI6IkZnQmhiTDhyNGZyaGp2NmpNSlJBV1FzNWtqWndPOGNWSC15VXBWYS1pS2cifSx7InBhdGgiOiJidWlsZC9wYW5lbC5qcyIsInJvb3RfaGFzaCI6IjJsMVYyUXMwbk52M1dWb29NZ2FLSFdDMTI2aEtaOGNMeHdqYVJqa2ZlaWMifSx7InBhdGgiOiJpY29ucy9pY29uMTI4LnBuZyIsInJvb3RfaGFzaCI6ImVaN2FyZEt5dHpNZW1MMGtMX3Fnb3JoU2VlNGpfTmFyMC1iZzR1Y1QwTWsifSx7InBhdGgiOiJpY29ucy9pY29uNDgucG5nIiwicm9vdF9oYXNoIjoibjdYX2xURkVZWl8ydzFVVUcwRkFOUXRQR2l5bU5KNzNPOW5uRUhVTXB3USJ9LHsicGF0aCI6Im1haW4uaHRtbCIsInJvb3RfaGFzaCI6Ik81Qm5xMVJ3UldLcGdBZTN4S3dfcXpvTGV0Ty1NVGpRbDlxS3hiVnpfb3cifSx7ImNhbm9uaWNhbF9qc29uX3Jvb3RfaGFzaCI6Iko5RnJTR29ZWjhqeUZXeUNMRFZxZlF1WTloMzRHb2dHVE54Sm04SnpWZkUiLCJwYXRoIjoibWFuaWZlc3QuanNvbiIsInJvb3RfaGFzaCI6IjFNUjZwVlo1elVTMUk3VGdNaDA3aWlyVFZ3V2lBbTR0aXRId2RnZHdlWkkifSx7InBhdGgiOiJwYW5lbC5odG1sIiwicm9vdF9oYXNoIjoiZlRMRzFmczcxZGJLM2tCZFhEdGZaaVpjRHc3bDJaR2l5ZVM4Z1JxVnExUSJ9XSwiZm9ybWF0IjoidHJlZWhhc2giLCJoYXNoX2Jsb2NrX3NpemUiOjQwOTZ9XSwiaXRlbV9pZCI6ImZta2FkbWFwZ29mYWRvcGxqYmpma2FwZGtvaWVuaWhpIiwiaXRlbV92ZXJzaW9uIjoiMC4xNC4xMSIsInByb3RvY29sX3ZlcnNpb24iOjF9","signatures":[{"header":{"kid":"publisher"},"protected":"eyJhbGciOiJSUzI1NiJ9","signature":"UIzIMK3yusYX4AfBpOr_VgNHMR4LxG7U1movZPReNTk2jAD2O7Jhx_1VnNKbWZOksa5tg-RTmNili5pQ70kRXQZcvOQ5oz1zw7WVLnsBVTtBcTIAs3Ej5QnF2plC9TgtuxVJM7XkUTLJnNIY6byoeZ6MUJ2gv3ujjATP5DWYkk1q3QQEpij88A61JbauATzBF6mp9eblbpBqIRWu-PO48iQ7tcJr8woCxNpKMHnpYYty8t5XfN5RqR3LfWTAoI3_GrLJ6w5JO_u3ZTMd9DBxLe2ppcxf916ZFGN8jkmRpGFkwevETDKcezWn0cKh5lDQhNNU1jfbutJV47SGHIOhIQ"},{"header":{"kid":"webstore"},"protected":"eyJhbGciOiJSUzI1NiJ9","signature":"hrxX0Jem07hCjZqp_2qt-J8wrpJO4jjXcxXL_6PWovFPREJt1a_PxHfV7NhEOJJsrwN0XGeWsFWsVwQVX-C_anG7_OA8yfCRzlZ4I5zrrfERCQnNO6bjKHCPTiC085Xibs-KDQiucV8hSGBw4yYzmQPBVHs2MWeuGUoPfgXK3Ndt6X44zxXqQ0dAb39u5JWI0c07Vy2QkawuuzxpckglHXl4gvHNfJAtDlvDXYMp51s7eCHVGvLpGJpgMuetNxjbOohL0NDQbNSK6wePOdvuonU8G8CGq_MaFJ9NzQzJN11EklywACm2EolvBpI7o9twfQuy9nz6DN-GN52IEDHXng"}]}}]
|
9478
static/devtools-extensions/react-devtools-0.14.11/build/backend.js
Normal file
9478
static/devtools-extensions/react-devtools-0.14.11/build/backend.js
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,118 @@
|
|||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId])
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ exports: {},
|
||||
/******/ id: moduleId,
|
||||
/******/ loaded: false
|
||||
/******/ };
|
||||
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.loaded = true;
|
||||
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
|
||||
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(0);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ function(module, exports) {
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
/* global chrome */
|
||||
|
||||
var ports = {};
|
||||
|
||||
chrome.runtime.onConnect.addListener(function (port) {
|
||||
var tab = null;
|
||||
var name = null;
|
||||
if (isNumeric(port.name)) {
|
||||
tab = port.name;
|
||||
name = 'devtools';
|
||||
installContentScript(+port.name);
|
||||
} else {
|
||||
tab = port.sender.tab.id;
|
||||
name = 'content-script';
|
||||
}
|
||||
|
||||
if (!ports[tab]) {
|
||||
ports[tab] = {
|
||||
devtools: null,
|
||||
'content-script': null
|
||||
};
|
||||
}
|
||||
ports[tab][name] = port;
|
||||
|
||||
if (ports[tab].devtools && ports[tab]['content-script']) {
|
||||
doublePipe(ports[tab].devtools, ports[tab]['content-script']);
|
||||
}
|
||||
});
|
||||
|
||||
function isNumeric(str) {
|
||||
return +str + '' === str;
|
||||
}
|
||||
|
||||
function installContentScript(tabId) {
|
||||
chrome.tabs.executeScript(tabId, { file: '/build/contentScript.js' }, function () {});
|
||||
}
|
||||
|
||||
function doublePipe(one, two) {
|
||||
one.onMessage.addListener(lOne);
|
||||
function lOne(message) {
|
||||
// console.log('dv -> rep', message);
|
||||
two.postMessage(message);
|
||||
}
|
||||
two.onMessage.addListener(lTwo);
|
||||
function lTwo(message) {
|
||||
// console.log('rep -> dv', message);
|
||||
one.postMessage(message);
|
||||
}
|
||||
function shutdown() {
|
||||
one.onMessage.removeListener(lOne);
|
||||
two.onMessage.removeListener(lTwo);
|
||||
one.disconnect();
|
||||
two.disconnect();
|
||||
}
|
||||
one.onDisconnect.addListener(shutdown);
|
||||
two.onDisconnect.addListener(shutdown);
|
||||
}
|
||||
|
||||
/***/ }
|
||||
/******/ ]);
|
|
@ -0,0 +1,102 @@
|
|||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId])
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ exports: {},
|
||||
/******/ id: moduleId,
|
||||
/******/ loaded: false
|
||||
/******/ };
|
||||
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.loaded = true;
|
||||
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
|
||||
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(0);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ function(module, exports) {
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
/* global chrome */
|
||||
|
||||
// proxy from main page to devtools (via the background page)
|
||||
|
||||
var port = chrome.runtime.connect({
|
||||
name: 'content-script'
|
||||
});
|
||||
|
||||
port.onMessage.addListener(handleMessageFromDevtools);
|
||||
port.onDisconnect.addListener(handleDisconnect);
|
||||
window.addEventListener('message', handleMessageFromPage);
|
||||
|
||||
window.postMessage({
|
||||
source: 'react-devtools-content-script',
|
||||
hello: true
|
||||
}, '*');
|
||||
|
||||
function handleMessageFromDevtools(message) {
|
||||
window.postMessage({
|
||||
source: 'react-devtools-content-script',
|
||||
payload: message
|
||||
}, '*');
|
||||
}
|
||||
|
||||
function handleMessageFromPage(evt) {
|
||||
if (evt.data && evt.data.source === 'react-devtools-bridge') {
|
||||
// console.log('page -> rep -> dev', evt.data);
|
||||
port.postMessage(evt.data.payload);
|
||||
}
|
||||
}
|
||||
|
||||
function handleDisconnect() {
|
||||
window.removeEventListener('message', handleMessageFromPage);
|
||||
window.postMessage({
|
||||
source: 'react-devtools-content-script',
|
||||
payload: {
|
||||
type: 'event',
|
||||
evt: 'shutdown'
|
||||
}
|
||||
}, '*');
|
||||
}
|
||||
|
||||
/***/ }
|
||||
/******/ ]);
|
|
@ -0,0 +1,305 @@
|
|||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId])
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ exports: {},
|
||||
/******/ id: moduleId,
|
||||
/******/ loaded: false
|
||||
/******/ };
|
||||
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.loaded = true;
|
||||
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
|
||||
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(0);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
// Inject a `__REACT_DEVTOOLS_GLOBAL_HOOK__` global so that React can detect that the
|
||||
// devtools are installed (and skip its suggestion to install the devtools).
|
||||
|
||||
var installGlobalHook = __webpack_require__(1);
|
||||
var installRelayHook = __webpack_require__(3);
|
||||
|
||||
var saveNativeValues = '\nwindow.__REACT_DEVTOOLS_GLOBAL_HOOK__.nativeObjectCreate = Object.create;\nwindow.__REACT_DEVTOOLS_GLOBAL_HOOK__.nativeMap = Map;\nwindow.__REACT_DEVTOOLS_GLOBAL_HOOK__.nativeWeakMap = WeakMap;\nwindow.__REACT_DEVTOOLS_GLOBAL_HOOK__.nativeSet = Set;\n';
|
||||
|
||||
var js = ';(' + installGlobalHook.toString() + '(window))' + ';(' + installRelayHook.toString() + '(window))' + saveNativeValues;
|
||||
|
||||
// This script runs before the <head> element is created, so we add the script
|
||||
// to <html> instead.
|
||||
var script = document.createElement('script');
|
||||
script.textContent = js + saveNativeValues;
|
||||
document.documentElement.appendChild(script);
|
||||
script.parentNode.removeChild(script);
|
||||
|
||||
/***/ },
|
||||
/* 1 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var _types = __webpack_require__(2);
|
||||
|
||||
/**
|
||||
* NOTE: This file cannot `require` any other modules. We `.toString()` the
|
||||
* function in some places and inject the source into the page.
|
||||
*/
|
||||
function installGlobalHook(window) {
|
||||
if (window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
||||
return;
|
||||
}
|
||||
Object.defineProperty(window, '__REACT_DEVTOOLS_GLOBAL_HOOK__', {
|
||||
value: {
|
||||
_renderers: {},
|
||||
helpers: {},
|
||||
inject: function inject(renderer) {
|
||||
var id = Math.random().toString(16).slice(2);
|
||||
this._renderers[id] = renderer;
|
||||
this.emit('renderer', { id: id, renderer: renderer });
|
||||
},
|
||||
_listeners: {},
|
||||
sub: function sub(evt, fn) {
|
||||
var _this = this;
|
||||
|
||||
this.on(evt, fn);
|
||||
return function () {
|
||||
return _this.off(evt, fn);
|
||||
};
|
||||
},
|
||||
on: function on(evt, fn) {
|
||||
if (!this._listeners[evt]) {
|
||||
this._listeners[evt] = [];
|
||||
}
|
||||
this._listeners[evt].push(fn);
|
||||
},
|
||||
off: function off(evt, fn) {
|
||||
if (!this._listeners[evt]) {
|
||||
return;
|
||||
}
|
||||
var ix = this._listeners[evt].indexOf(fn);
|
||||
if (ix !== -1) {
|
||||
this._listeners[evt].splice(ix, 1);
|
||||
}
|
||||
if (!this._listeners[evt].length) {
|
||||
this._listeners[evt] = null;
|
||||
}
|
||||
},
|
||||
emit: function emit(evt, data) {
|
||||
if (this._listeners[evt]) {
|
||||
this._listeners[evt].map(function (fn) {
|
||||
return fn(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = installGlobalHook;
|
||||
|
||||
/***/ },
|
||||
/* 2 */
|
||||
/***/ function(module, exports) {
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
/***/ },
|
||||
/* 3 */
|
||||
/***/ function(module, exports) {
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* NOTE: This file cannot `require` any other modules. We `.toString()` the
|
||||
* function in some places and inject the source into the page.
|
||||
*/
|
||||
|
||||
function installRelayHook(window) {
|
||||
var TEXT_CHUNK_LENGTH = 500;
|
||||
|
||||
var hook = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
if (!hook) {
|
||||
return;
|
||||
}
|
||||
|
||||
function decorate(obj, attr, fn) {
|
||||
var old = obj[attr];
|
||||
obj[attr] = function () {
|
||||
var res = old.apply(this, arguments);
|
||||
fn.apply(this, arguments);
|
||||
return res;
|
||||
};
|
||||
}
|
||||
|
||||
var _eventQueue = [];
|
||||
var _listener = null;
|
||||
function emit(name, data) {
|
||||
_eventQueue.push({ name: name, data: data });
|
||||
if (_listener) {
|
||||
_listener(name, data);
|
||||
}
|
||||
}
|
||||
|
||||
function setRequestListener(listener) {
|
||||
if (_listener) {
|
||||
throw new Error('Relay Devtools: Called only call setRequestListener once.');
|
||||
}
|
||||
_listener = listener;
|
||||
_eventQueue.forEach(function (_ref) {
|
||||
var name = _ref.name;
|
||||
var data = _ref.data;
|
||||
|
||||
listener(name, data);
|
||||
});
|
||||
|
||||
return function () {
|
||||
_listener = null;
|
||||
};
|
||||
}
|
||||
|
||||
function recordRequest(type, start, request, requestNumber) {
|
||||
var id = Math.random().toString(16).substr(2);
|
||||
request.then(function (response) {
|
||||
emit('relay:success', {
|
||||
id: id,
|
||||
end: performance.now(),
|
||||
response: response.response
|
||||
});
|
||||
}, function (error) {
|
||||
emit('relay:failure', {
|
||||
id: id,
|
||||
end: performance.now(),
|
||||
error: error
|
||||
});
|
||||
});
|
||||
var textChunks = [];
|
||||
var text = request.getQueryString();
|
||||
while (text.length > 0) {
|
||||
textChunks.push(text.substr(0, TEXT_CHUNK_LENGTH));
|
||||
text = text.substr(TEXT_CHUNK_LENGTH);
|
||||
}
|
||||
return {
|
||||
id: id,
|
||||
name: request.getDebugName(),
|
||||
requestNumber: requestNumber,
|
||||
start: start,
|
||||
text: textChunks,
|
||||
type: type,
|
||||
variables: request.getVariables()
|
||||
};
|
||||
}
|
||||
|
||||
var requestNumber = 0;
|
||||
|
||||
function instrumentRelayRequests(relayInternals) {
|
||||
var NetworkLayer = relayInternals.NetworkLayer;
|
||||
|
||||
decorate(NetworkLayer, 'sendMutation', function (mutation) {
|
||||
requestNumber++;
|
||||
emit('relay:pending', [recordRequest('mutation', performance.now(), mutation, requestNumber)]);
|
||||
});
|
||||
|
||||
decorate(NetworkLayer, 'sendQueries', function (queries) {
|
||||
requestNumber++;
|
||||
var start = performance.now();
|
||||
emit('relay:pending', queries.map(function (query) {
|
||||
return recordRequest('query', start, query, requestNumber);
|
||||
}));
|
||||
});
|
||||
|
||||
var instrumented = {};
|
||||
for (var key in relayInternals) {
|
||||
if (relayInternals.hasOwnProperty(key)) {
|
||||
instrumented[key] = relayInternals[key];
|
||||
}
|
||||
}
|
||||
instrumented.setRequestListener = setRequestListener;
|
||||
return instrumented;
|
||||
}
|
||||
|
||||
var _relayInternals = null;
|
||||
Object.defineProperty(hook, '_relayInternals', {
|
||||
set: function set(relayInternals) {
|
||||
_relayInternals = instrumentRelayRequests(relayInternals);
|
||||
},
|
||||
get: function get() {
|
||||
return _relayInternals;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = installRelayHook;
|
||||
|
||||
/***/ }
|
||||
/******/ ]);
|
106
static/devtools-extensions/react-devtools-0.14.11/build/main.js
Normal file
106
static/devtools-extensions/react-devtools-0.14.11/build/main.js
Normal file
|
@ -0,0 +1,106 @@
|
|||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId])
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ exports: {},
|
||||
/******/ id: moduleId,
|
||||
/******/ loaded: false
|
||||
/******/ };
|
||||
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.loaded = true;
|
||||
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
|
||||
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(0);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ function(module, exports) {
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
/* global chrome */
|
||||
|
||||
var panelCreated = false;
|
||||
|
||||
function createPanelIfReactLoaded() {
|
||||
if (panelCreated) {
|
||||
return;
|
||||
}
|
||||
chrome.devtools.inspectedWindow.eval('!!(\n Object.keys(window.__REACT_DEVTOOLS_GLOBAL_HOOK__._renderers).length || window.React\n )', function (pageHasReact, err) {
|
||||
if (!pageHasReact || panelCreated) {
|
||||
return;
|
||||
}
|
||||
|
||||
clearInterval(loadCheckInterval);
|
||||
panelCreated = true;
|
||||
chrome.devtools.panels.create('React', '', 'panel.html', function (panel) {
|
||||
var reactPanel = null;
|
||||
panel.onShown.addListener(function (window) {
|
||||
// when the user switches to the panel, check for an elements tab
|
||||
// selection
|
||||
window.panel.getNewSelection();
|
||||
reactPanel = window.panel;
|
||||
reactPanel.resumeTransfer();
|
||||
});
|
||||
panel.onHidden.addListener(function () {
|
||||
if (reactPanel) {
|
||||
reactPanel.hideHighlight();
|
||||
reactPanel.pauseTransfer();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
chrome.devtools.network.onNavigated.addListener(function () {
|
||||
createPanelIfReactLoaded();
|
||||
});
|
||||
|
||||
// Check to see if React has loaded once per second in case React is added
|
||||
// after page load
|
||||
var loadCheckInterval = setInterval(function () {
|
||||
createPanelIfReactLoaded();
|
||||
}, 1000);
|
||||
|
||||
createPanelIfReactLoaded();
|
||||
|
||||
/***/ }
|
||||
/******/ ]);
|
32887
static/devtools-extensions/react-devtools-0.14.11/build/panel.js
Normal file
32887
static/devtools-extensions/react-devtools-0.14.11/build/panel.js
Normal file
File diff suppressed because it is too large
Load diff
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
|
@ -0,0 +1,8 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="./build/main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"background": {
|
||||
"persistent": false,
|
||||
"scripts": [ "build/background.js" ]
|
||||
},
|
||||
"content_scripts": [ {
|
||||
"js": [ "build/inject.js" ],
|
||||
"matches": [ "\u003Call_urls>" ],
|
||||
"run_at": "document_start"
|
||||
} ],
|
||||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
||||
"description": "Adds React debugging tools to the Chrome Developer Tools.",
|
||||
"devtools_page": "main.html",
|
||||
"icons": {
|
||||
"128": "icons/icon128.png",
|
||||
"48": "icons/icon48.png"
|
||||
},
|
||||
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA39Lr82J1eer+RvXeQG6HYHb2A6xU/83bcIyOcu+Wu2vYO/jbBvlD3m/xqrU4xSXJ/uAC1XY/YtlRs2X2RE1XiYMMlnqw27QdI5tVcSnKedmTFNAsnSaQ/OZT5tzH3HntLDfrFof5BC5RmFuie+kQKGTh673JW0ZdKTUsW406Fckagl9WpPL+qp3Gah3Jw02zxfQX9yUd5gJHYvv8T31DO9+HsI8lPeEjanURY59rRUfg3JKy1aPfts6eISy9kpHC+LrRSHU2Zp5AuUkOh8qEg6DoHFwBNYX20bdd6ekj0OZiIz/9xj9ceNhAr85QYB0641Tzhs3Tg96k56VNwjdN2QIDAQAB",
|
||||
"manifest_version": 2,
|
||||
"minimum_chrome_version": "43",
|
||||
"name": "React Developer Tools",
|
||||
"permissions": [ "file:///*", "http://*/*", "https://*/*" ],
|
||||
"update_url": "https://clients2.google.com/service/update2/crx",
|
||||
"version": "0.14.11",
|
||||
"web_accessible_resources": [ "main.html", "panel.html", "build/backend.js" ]
|
||||
}
|
33
static/devtools-extensions/react-devtools-0.14.11/panel.html
Normal file
33
static/devtools-extensions/react-devtools-0.14.11/panel.html
Normal file
|
@ -0,0 +1,33 @@
|
|||
<!doctype html>
|
||||
<html style="display: flex">
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
<style>
|
||||
html {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
#container {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- main react mount point -->
|
||||
<div id="container">Unable to find React on the page.</div>
|
||||
<script src="./build/panel.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<title>Nylas N1</title>
|
||||
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src * nylas:; script-src 'self'; style-src * 'unsafe-inline' nylas:; img-src * data: nylas: file:;">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src * nylas:; script-src 'self' chrome-extension://react-developer-tools; style-src * 'unsafe-inline' nylas:; img-src * data: nylas: file:;">
|
||||
|
||||
<style>
|
||||
.application-loading-cover {
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
// This is to prevent React from displaying an annoying message about
|
||||
// installing their dev tools. The React dev tools put a variable on the
|
||||
// global scope. We need to do it here before React loads.
|
||||
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {}
|
||||
|
||||
window.eval = global.eval = function() {
|
||||
throw new Error("Sorry, N1 does not support window.eval() for security reasons.");
|
||||
}
|
||||
|
||||
var path = require('path');
|
||||
|
||||
var electron = require('electron');
|
||||
var remote = electron.remote;
|
||||
|
||||
|
|
Loading…
Reference in a new issue