-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use UMD bundle and ES6 modules #1069
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4f76c57
Use UMD bundle and ES6 modules
kamilkisiela de2e7a2
Single imports
kamilkisiela a781301
Fix circular dependencies
Urigo cc52b46
Compile to commonjs with babel
kamilkisiela 0b2c92c
Inlude mising tests
kamilkisiela bc00bac
Exclude bundle from babel
kamilkisiela 87d2e83
Fix missing ApolloQueryResult in tests
kamilkisiela db06402
Fix tests
kamilkisiela d960c6a
Compile with sourcemaps
kamilkisiela f542f14
Make everything ready to npm publish
kamilkisiela 696e2ed
Use UMD bundle to filesize check
kamilkisiela 5fe7970
Fix wrong function usage in test
kamilkisiela 6ad6da8
Add lodash to globals in rollup
kamilkisiela fa58b1f
Make code coverage works
kamilkisiela 5ba7fe5
Add jsnext:main
kamilkisiela ecef360
Define globals for lodash in rollup
kamilkisiela c90a749
Update to [email protected]
kamilkisiela c42b761
Add recent changes to the changelog
kamilkisiela File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"plugins": [ | ||
"transform-es2015-modules-commonjs" | ||
], | ||
"ignore": [ | ||
"lib/**/*.d.ts", | ||
"lib/bundles/**", | ||
"node_modules/**" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ appveyor.yml | |
CHANGELOG.md | ||
design.md | ||
Gruntfile.js | ||
rollup.config.js | ||
tsconfig.json | ||
tslint.json | ||
typings.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
function globals(mod) { | ||
if (mod.indexOf('lodash/') === 0) return '_'; | ||
} | ||
|
||
export default { | ||
entry: 'lib/src/index.js', | ||
dest: 'lib/apollo.umd.js', | ||
format: 'umd', | ||
sourceMap: true, | ||
moduleName: 'apollo', | ||
external: [ | ||
'lodash' | ||
], | ||
globals | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Document } from 'graphql'; | ||
import { | ||
QueryStoreValue, | ||
NetworkStatus, | ||
} from '../queries/store'; | ||
|
||
export interface SubscriptionOptions { | ||
document: Document; | ||
variables?: { [key: string]: any }; | ||
}; | ||
|
||
export type QueryListener = (queryStoreValue: QueryStoreValue) => void; | ||
|
||
export type ApolloQueryResult = { | ||
data: any; | ||
loading: boolean; | ||
networkStatus: NetworkStatus; | ||
|
||
// This type is different from the GraphQLResult type because it doesn't include errors. | ||
// Those are thrown via the standard promise/observer catch mechanism. | ||
}; | ||
|
||
// A result transformer is given the data that is to be returned from the store from a query or | ||
// mutation, and can modify or observe it before the value is provided to your application. | ||
// | ||
// For watched queries, the transformer is only called when the data retrieved from the server is | ||
// different from previous. | ||
// | ||
// If the transformer wants to mutate results (say, by setting the prototype of result data), it | ||
// will likely need to be paired with a custom resultComparator. By default, Apollo performs a | ||
// deep equality comparsion on results, and skips those that are considered equal - reducing | ||
// re-renders. | ||
export type ResultTransformer = (resultData: ApolloQueryResult) => ApolloQueryResult; | ||
|
||
// Controls how Apollo compares two query results and considers their equality. Two equal results | ||
// will not trigger re-renders. | ||
export type ResultComparator = (result1: ApolloQueryResult, result2: ApolloQueryResult) => boolean; | ||
|
||
export enum FetchType { | ||
normal = 1, | ||
refetch = 2, | ||
poll = 3, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the assumption here that the compiler and bundler already ran at this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm run compile
is here, so there's no point of running it twiceThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.