Skip to content

Commit

Permalink
Export wrap as es2015 instead of commonjs (#4158)
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan authored and benjamn committed Jan 2, 2019
1 parent 7589180 commit be30577
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
1 change: 1 addition & 0 deletions packages/apollo-boost/rollup-bundle.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const globals = {
'fast-json-stable-stringify': 'stringify',
'graphql-tag': 'gql',
'apollo-utilities': 'apolloUtilities',
optimism: 'optimism',
};

export default {
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-cache-inmemory/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/apollo-cache-inmemory/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import build, { globals } from '../../config/rollup.config';
const globalsOverride = {
...globals,
'graphql/language/printer': 'print',
optimism: 'optimism',
'graphql/language/visitor': 'visitor',
};

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 be30577

Please sign in to comment.