Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
openedPages: {},
/**
* Multiple browsers support
* @type {Boolean}
*/
isMultiBrowser: false,
/**
* Puppeteer initialization options
* @type {*}
* @private
*/
_options: {
ignoreHTTPSErrors: true,
headless: !debug.enabled('puppeteer'),
slowMo: debug.enabled('puppeteer') ? 250 : 0,
timeout: 60000,
dumpio: debug.enabled('puppeteer'),
// avoid issues in Travis
args: Env.isCI ? [ '--no-sandbox', '--disable-setuid-sandbox' ] : [],
},
/**
* Open new page in browser
* @param {String} id
* @param {String} pageUrl
* @returns {Promise}
*/
async openBrowser(id, pageUrl) {
const browser = await puppeteer.launch(this._options);
async function onError (error: any): Promise {
// If debug is on, log the entire error object, otherwise log just the message
log('error', debug.enabled('rx:cli') ? error : error.message)
process.exit(1)
}
function ReactPlugin(options = {}) {
const { placeholder = '' } = options
const debugEventsPlugin = Debug.enabled('slate:events')
? DebugEventsPlugin(options)
: null
const debugBatchEventsPlugin = Debug.enabled('slate:batch-events')
? DebugBatchEventsPlugin(options)
: null
const debugMutationsPlugin = Debug.enabled('slate:mutations')
? DebugMutationsPlugin(options)
: null
const renderingPlugin = RenderingPlugin(options)
const commandsPlugin = CommandsPlugin(options)
const queriesPlugin = QueriesPlugin(options)
const editorPropsPlugin = EditorPropsPlugin(options)
const domPlugin = DOMPlugin(options)
const restoreDomPlugin = RestoreDOMPlugin()
// Disable placeholder for Android because it messes with reconciliation
// and doesn't disappear until composition is complete.
// e.g. In empty, type "h" and autocomplete on Android 9 and deletes all text.
const placeholderPlugin = IS_ANDROID
? null
: PlaceholderPlugin({
placeholder,
async openBrowser (id, pageUrl) {
const conf = {
show: debug.enabled(),
openDevTools: debug.enabled(),
};
this.nightmareInstances[id] = Nightmare(conf);
await this.nightmareInstances[id].goto(pageUrl);
},
fetchChallengeCompleted,
fetchChallengesCompleted,
fetchNewBlock,
challengeSelector,
nextChallengeSelector
} from './';
import {
isChallengeLoaded,
fullBlocksSelector
} from '../entities';
import { shapeChallenges } from './utils';
import { types as challenge } from '../routes/Challenges/redux';
import { langSelector } from '../Router/redux';
const isDev = debug.enabled('fcc:*');
function fetchChallengeEpic(actions, { getState }, { services }) {
return actions::ofType(challenge.onRouteChallenges)
.filter(({ payload }) => !isChallengeLoaded(getState(), payload))
.flatMapLatest(({ payload: params }) => {
const options = {
service: 'challenge',
params
};
return services.readService$(options)
.retry(3)
.map(({ entities, ...rest }) => ({
entities: shapeChallenges(entities, isDev),
...rest
}))
.flatMap(({ entities, result, redirect } = {}) => {
'use strict'
var fs = require('fs')
var os = require('os')
var spawn = require('child_process').spawn
var path = require('path')
var tmp = require('tmp')
var MBTiles = require('mbtiles')
var tileReduce = require('tile-reduce')
var log = require('single-line-log').stderr
var prettyMs = require('pretty-ms')
var debug = require('debug')
var debugLog = debug('vt-grid:main')
var debugEnabled = debug.enabled('vt-grid:main')
if (!debugEnabled) {
tmp.setGracefulCleanup()
}
module.exports = vtGrid
/**
* Build a pyramid of aggregated square-grid features.
*
* @param {string} output Path to output aggregated mbtiles data
* @param {string} input Path to the input mbtiles data
* @param {Object|Array} options Options OR an array of options objects to allow different aggregations/settings for different zoom levels
* @param {number} options.basezoom The zoom level at which to find the initial data
* @param {Array} [options.tiles] An array of [z, x, y] tile coordinates to start with
* @param {Array} [options.bbox] A [w, s, e, n] bbox defining the area to start with
async _createGatewayServer (host, port, ipfs) {
const server = Hapi.server({
host,
port,
routes: {
cors: true
}
})
server.app.ipfs = ipfs
await server.register({
plugin: Pino,
options: {
prettyPrint: Boolean(debug.enabled(LOG)),
logEvents: ['onPostStart', 'onPostStop', 'response', 'request-error'],
level: debug.enabled(LOG) ? 'debug' : (debug.enabled(LOG_ERROR) ? 'error' : 'fatal')
}
})
server.route(require('./gateway/routes'))
return server
}
get: function() {
if (lastCheckedStalenessCounter !== currentStalenessCounter) {
currentlyEnabled = debug.enabled(prefix);
lastCheckedStalenessCounter = currentStalenessCounter;
}
return currentlyEnabled;
},
set: function (val) {
import debug from 'debug';
import { pickBy } from 'lodash';
import { Observable } from 'rx';
import { cachedMap, getChallenge } from '../utils/map';
import { shapeChallenges } from '../../common/app/redux/utils';
const log = debug('fcc:services:challenge');
const isDev = debug.enabled('fcc:*');
export default function getChallengesForBlock(app) {
const challengeMap = cachedMap(app.models);
return {
name: 'challenge',
read: function readChallengesForBlock(
req,
resource,
{ dashedName, blockName} = {},
config,
cb
) {
const getChallengeBlock$ = challengeMap
.flatMap(({
result: { superBlocks },
entities: {
export default function enableDebug(namespace: string) {
const { DEBUG } = process.env;
const flag = `${namespace}:*`;
if (DEBUG) {
if (DEBUG.includes(flag)) {
return;
}
process.env.DEBUG += `,${flag}`;
} else {
process.env.DEBUG = flag;
}
debug.enabled(flag);
}