Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// TODO this may include unnecessary code
/* eslint-disable global-require, prefer-destructuring, prefer-const */
import { Image, PixelRatio, Platform } from 'react-native';
import AssetRegistry from 'react-native/Libraries/Image/AssetRegistry';
import AssetSourceResolver from 'react-native/Libraries/Image/AssetSourceResolver';
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
import uriparser from 'uri-parser';
import urljoin from 'url-join';
let Constants;
try {
Constants = require('expo-constants').default;
} catch (error) {
throw new Error('`expo-asset` requires `expo-constants` package to be installed and linked.');
}
const parser = new uriparser.Parser();
// Fast lookup check if asset map has any overrides in the manifest
const assetMapOverride = Constants.manifest && Constants.manifest.assetMapOverride;
// get base url of manifest (ie) https://site.com
const getManifestBaseUrl = (manifestUrl) => {
const urlComponents = parser.parse(manifestUrl);
// change to http(s) if scheme is exp/exps
if (urlComponents.protocol === 'exp') {
urlComponents.protocol = 'http';
/* global __DEV__ */
const { schema } = require('@bugsnag/core/config')
const { reduce } = require('@bugsnag/core/lib/es-utils')
const Constants = require('expo-constants').default
// If the developer property is not present in the manifest, it means the app is
// not connected to a development tool and is either a published app running in
// the Expo client, or a standalone app (we also assume production for a missing
// manifest, but that should never happen)
const IS_PRODUCTION = !Constants.manifest || !Constants.manifest.developer
// The app can still run in production "mode" in development environments, in which
// cases the global boolean __DEV__ will be set to true
const IS_PRODUCTION_MODE = typeof __DEV__ === 'undefined' || __DEV__ !== true
module.exports = {
logger: {
...schema.logger,
defaultValue: () => getPrefixedConsole()
},
import AssetRegistry from 'react-native/Libraries/Image/AssetRegistry';
import AssetSourceResolver from 'react-native/Libraries/Image/AssetSourceResolver';
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
import uriparser from 'uri-parser';
import urljoin from 'url-join';
let FS, Constants;
try {
FS = require('expo-file-system').FileSystem;
} catch (error) {
throw new Error('`expo-asset` requires `expo-file-system` package to be installed and linked.');
}
try {
Constants = require('expo-constants').default;
} catch (error) {
throw new Error('`expo-asset` requires `expo-constants` package to be installed and linked.');
}
const parser = new uriparser.Parser();
// Fast lookup check if assets are available in the local bundle.
const bundledAssets = new Set(FS.bundledAssets || []);
// Fast lookup check if asset map has any overrides in the manifest
const assetMapOverride = Constants.manifest && Constants.manifest.assetMapOverride;
// get base url of manifest (ie) https://site.com
const getManifestBaseUrl = manifestUrl => {
const urlComponents = parser.parse(manifestUrl);
const name = 'Bugsnag Expo'
const { version } = require('../package.json')
const url = 'https://github.com/bugsnag/bugsnag-js'
const React = require('react')
const Constants = require('expo-constants').default
const Client = require('@bugsnag/core/client')
const delivery = require('@bugsnag/delivery-expo')
const schema = { ...require('@bugsnag/core/config').schema, ...require('./config') }
const plugins = [
require('@bugsnag/plugin-react-native-global-error-handler'),
require('@bugsnag/plugin-react-native-unhandled-rejection'),
require('@bugsnag/plugin-expo-device'),
require('@bugsnag/plugin-expo-app'),
require('@bugsnag/plugin-console-breadcrumbs'),
require('@bugsnag/plugin-network-breadcrumbs'),
require('@bugsnag/plugin-react-native-app-state-breadcrumbs'),
require('@bugsnag/plugin-react-native-connectivity-breadcrumbs'),
const Constants = require('expo-constants').default
const { AppState } = require('react-native')
const appStart = new Date()
module.exports = {
init: client => {
let lastEnteredForeground = appStart
let lastState = AppState.currentState
AppState.addEventListener('change', newState => {
if (newState === 'active' && lastState !== 'active') {
lastEnteredForeground = new Date()
}
lastState = newState
})
get() {
return require('expo-constants').default;
},
},
get() {
deprecatedModule(
`import { Constants } from 'expo' -> import Constants from 'expo-constants'`,
'expo-constants'
);
return require('expo-constants').default;
},
},
const Constants = require('expo-constants').default
const { Dimensions, Platform } = require('react-native')
const { isoDate } = require('@bugsnag/core/lib/es-utils')
const rnVersion = require('react-native/package.json').version
module.exports = {
init: client => {
let orientation
const updateOrientation = () => {
const { height, width } = Dimensions.get('screen')
if (height > width) {
orientation = 'portrait'
} else if (height < width) {
orientation = 'landscape'
} else {
orientation = undefined
}