Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expo-updates

Package Overview
Dependencies
Maintainers
18
Versions
230
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-updates - npm Package Compare versions

Comparing version 0.0.1-rc.2 to 0.0.1-rc.3

build/ExponentUpdates.d.ts

1

build/ExpoUpdates.web.d.ts
declare const _default: {
readonly name: string;
reload(): Promise<void>;
};
export default _default;

@@ -5,3 +5,6 @@ export default {

},
async reload() {
location.reload(true);
},
};
//# sourceMappingURL=ExpoUpdates.web.js.map

37

build/Updates.d.ts

@@ -1,37 +0,7 @@

import Constants from 'expo-constants';
import { EventSubscription } from 'fbemitter';
export declare enum UpdateEventType {
UPDATE_AVAILABLE = "updateAvailable",
NO_UPDATE_AVAILABLE = "noUpdateAvailable",
ERROR = "error"
}
declare type Manifest = typeof Constants.manifest;
declare type UpdateCheckResult = {
isAvailable: false;
} | {
isAvailable: true;
manifest: Manifest;
};
declare type UpdateFetchResult = {
isNew: false;
} | {
isNew: true;
manifest: Manifest;
};
declare type Listener<E> = (event: E) => void;
declare type UpdateEvent = {
type: UpdateEventType.NO_UPDATE_AVAILABLE;
} | {
type: UpdateEventType.UPDATE_AVAILABLE;
manifest: Manifest;
} | {
type: UpdateEventType.ERROR;
message: string;
};
declare type LocalAssets = {
[remoteUrl: string]: string;
};
import { Listener, LocalAssets, Manifest, UpdateCheckResult, UpdateEvent, UpdateFetchResult } from './Updates.types';
export * from './Updates.types';
export declare const localAssets: LocalAssets;
export declare const isEmergencyLaunch: boolean;
export declare const manifest: Manifest | object;
export declare const isEmergencyLaunch: boolean;
export declare function reloadAsync(): Promise<void>;

@@ -41,2 +11,1 @@ export declare function checkForUpdateAsync(): Promise<UpdateCheckResult>;

export declare function addListener(listener: Listener<UpdateEvent>): EventSubscription;
export {};
import { RCTDeviceEventEmitter, UnavailabilityError } from '@unimodules/core';
import { EventEmitter } from 'fbemitter';
import ExpoUpdates from './ExpoUpdates';
export var UpdateEventType;
(function (UpdateEventType) {
UpdateEventType["UPDATE_AVAILABLE"] = "updateAvailable";
UpdateEventType["NO_UPDATE_AVAILABLE"] = "noUpdateAvailable";
UpdateEventType["ERROR"] = "error";
})(UpdateEventType || (UpdateEventType = {}));
export * from './Updates.types';
export const localAssets = ExpoUpdates.localAssets ?? {};
export const manifest = ExpoUpdates.manifest ?? {};
export const isEmergencyLaunch = ExpoUpdates.isEmergencyLaunch || false;
let _manifest = ExpoUpdates.manifest;
if (ExpoUpdates.manifestString) {
_manifest = JSON.parse(ExpoUpdates.manifestString);
}
export const manifest = _manifest ?? {};
export async function reloadAsync() {

@@ -14,0 +13,0 @@ if (!ExpoUpdates.reload) {

{
"name": "expo-updates",
"version": "0.0.1-rc.2",
"version": "0.0.1-rc.3",
"description": "Fetches and manages remotely-hosted assets and updates to your app's JS bundle.",
"main": "build/Updates.js",
"types": "build/Updates.d.ts",
"main": "build/index.js",
"types": "build/index.d.ts",
"sideEffects": false,

@@ -43,3 +43,3 @@ "scripts": {

},
"gitHead": "da37f8fe5d4f87140fbc134496cce487d35a3e3f"
"gitHead": "e6fa3c621d15ad97525ce4d2f6e16d927994dc94"
}

@@ -1,2 +0,2 @@

import ExpoUpdates from '../ExpoUpdates';
import ExponentUpdates from '../ExponentUpdates';
import * as Updates from '../Updates';

@@ -10,6 +10,3 @@

it('returns the proper object in checkForUpdateAsync if an update is available and manifest is returned', async () => {
ExpoUpdates.checkForUpdateAsync.mockReturnValueOnce({
isAvailable: true,
manifest: fakeManifest,
});
ExponentUpdates.checkForUpdateAsync.mockReturnValueOnce(fakeManifest);

@@ -22,6 +19,3 @@ const actual = await Updates.checkForUpdateAsync();

it('returns the proper object in checkForUpdateAsync if an update is available and manifestString is returned', async () => {
ExpoUpdates.checkForUpdateAsync.mockReturnValueOnce({
isAvailable: true,
manifestString: JSON.stringify(fakeManifest),
});
ExponentUpdates.checkForUpdateAsync.mockReturnValueOnce(JSON.stringify(fakeManifest));

@@ -33,4 +27,12 @@ const actual = await Updates.checkForUpdateAsync();

it('returns the proper object in checkForUpdateAsync if an update is not available', async () => {
ExponentUpdates.checkForUpdateAsync.mockReturnValueOnce(false);
const actual = await Updates.checkForUpdateAsync();
const expected = { isAvailable: false };
expect(actual).toEqual(expected);
});
it('returns the proper object in fetchUpdateAsync if an update is available and manifest is returned', async () => {
ExpoUpdates.fetchUpdateAsync.mockReturnValueOnce({ isNew: true, manifest: fakeManifest });
ExponentUpdates.fetchUpdateAsync.mockReturnValueOnce(fakeManifest);

@@ -43,6 +45,3 @@ const actual = await Updates.fetchUpdateAsync();

it('returns the proper object in fetchUpdateAsync if an update is available and manifestString is returned', async () => {
ExpoUpdates.fetchUpdateAsync.mockReturnValueOnce({
isNew: true,
manifestString: JSON.stringify(fakeManifest),
});
ExponentUpdates.fetchUpdateAsync.mockReturnValueOnce(JSON.stringify(fakeManifest));

@@ -53,1 +52,9 @@ const actual = await Updates.fetchUpdateAsync();

});
it('returns the proper object in fetchUpdateAsync if an update is not available', async () => {
ExponentUpdates.fetchUpdateAsync.mockReturnValueOnce(false);
const actual = await Updates.fetchUpdateAsync();
const expected = { isNew: false };
expect(actual).toEqual(expected);
});

@@ -5,2 +5,5 @@ export default {

},
async reload(): Promise<void> {
location.reload(true);
},
};
import { RCTDeviceEventEmitter, UnavailabilityError } from '@unimodules/core';
import Constants from 'expo-constants';
import { EventEmitter, EventSubscription } from 'fbemitter';
import ExpoUpdates from './ExpoUpdates';
import {
Listener,
LocalAssets,
Manifest,
UpdateCheckResult,
UpdateEvent,
UpdateFetchResult,
} from './Updates.types';
export enum UpdateEventType {
UPDATE_AVAILABLE = 'updateAvailable',
NO_UPDATE_AVAILABLE = 'noUpdateAvailable',
ERROR = 'error',
}
export * from './Updates.types';
// TODO(eric): move source of truth for manifest type to this module
type Manifest = typeof Constants.manifest;
type UpdateCheckResult = { isAvailable: false } | { isAvailable: true; manifest: Manifest };
type UpdateFetchResult = { isNew: false } | { isNew: true; manifest: Manifest };
type Listener<E> = (event: E) => void;
type UpdateEvent =
| { type: UpdateEventType.NO_UPDATE_AVAILABLE }
| { type: UpdateEventType.UPDATE_AVAILABLE; manifest: Manifest }
| { type: UpdateEventType.ERROR; message: string };
type LocalAssets = { [remoteUrl: string]: string };
export const localAssets: LocalAssets = ExpoUpdates.localAssets ?? {};
export const manifest: Manifest | object = ExpoUpdates.manifest ?? {};
export const isEmergencyLaunch: boolean = ExpoUpdates.isEmergencyLaunch || false;
let _manifest = ExpoUpdates.manifest;
if (ExpoUpdates.manifestString) {
_manifest = JSON.parse(ExpoUpdates.manifestString);
}
export const manifest: Manifest | object = _manifest ?? {};
export async function reloadAsync(): Promise<void> {

@@ -34,0 +26,0 @@ if (!ExpoUpdates.reload) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc