Skip to content

Commit

Permalink
Export wrap as es2015 instead of commonjs
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Nov 20, 2018
1 parent d99a19e commit c299774
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
1 change: 1 addition & 0 deletions packages/apollo-cache-inmemory/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import build, { globals } from '../../config/rollup.config';
const globalsOverride = {
...globals,
'graphql/language/printer': 'print',
'optimism': 'wrap'
};

export default build('apollo.cache.inmemory', {
Expand Down
6 changes: 6 additions & 0 deletions packages/apollo-cache-inmemory/src/declarations.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module 'optimism' {
export function wrap<T>(
originalFunction: T,
options?: OptimisticWrapOptions,
): OptimisticWrapperFunction<T>;
}
13 changes: 1 addition & 12 deletions packages/apollo-cache-inmemory/src/optimism.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
declare function require(id: string): any;

export type OptimisticWrapperFunction<
T = (...args: any[]) => any
> = T & {
Expand All @@ -14,16 +12,7 @@ export type OptimisticWrapOptions = {
makeCacheKey?(...args: any[]): any;
};

const {
wrap,
}: {
wrap<T>(
originalFunction: T,
options?: OptimisticWrapOptions,
): OptimisticWrapperFunction<T>;
} = require('optimism'); // tslint:disable-line

export { wrap };
export { wrap } from 'optimism';

export class CacheKeyNode<KeyType = object> {
private children: Map<any, CacheKeyNode<KeyType>> | null = null;
Expand Down

0 comments on commit c299774

Please sign in to comment.