Skip to content

Commit

Permalink
Merge branch 'master' into fetchMore_cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn authored Apr 8, 2019
2 parents 3e77bba + 7b026d2 commit 49069bf
Show file tree
Hide file tree
Showing 140 changed files with 21,709 additions and 11,109 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* text eol=lf
* text=auto eol=lf
1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# fs
.DS_Store
.rpt2_cache

# Logs
logs
Expand Down Expand Up @@ -50,7 +51,8 @@ db.json
docs.json
*.log
docs/public/*
!docs/public/_redirects
.idea/

junit.xml

.rpt2_cache
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ test
typings
.gitignore
.travis.yml
.rpt2_cache
ambient.d.ts
CHANGELOG.md
design.md
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
"**/.rpt2_cache": true,
"node_modules": true,
"test-lib": true,
"lib": true,
Expand Down
65 changes: 64 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,69 @@
**Note:** This is a cumulative changelog that outlines all of the Apollo Client project child package changes that were bundled into a specific `apollo-client` release.

## Apollo Client (vNext)
## Apollo Client vNEXT

- In production, `invariant(condition, message)` failures will now include
a unique error code that can be used to trace the error back to the
point of failure. <br/>
[@benjamn](https://github.com/benjamn) in [#4521](https://github.com/apollographql/apollo-client/pull/4521)

### Apollo Client

- Update the React Native docs to remove the request for external example
apps that we can link to. We're no longer going to manage a list of
external example apps. <br />
[@hwillson](https://github.com/hwillson) in [#4531](https://github.com/apollographql/apollo-client/pull/4531)

- If you can be sure your application code does not modify cache result objects (see `freezeResults` note below), you can unlock substantial performance improvements by communicating this assumption via
```ts
new ApolloClient({ assumeImmutableResults: true })
```
which allows the client to avoid taking defensive snapshots of past results using `cloneDeep`, as explained by [@benjamn](https://github.com/benjamn) in [#4543](https://github.com/apollographql/apollo-client/pull/4543).

- Avoid updating (and later invalidating) cache watches when `fetchPolicy` is `'no-cache'`. <br/>
[@bradleyayers](https://github.com/bradleyayers) in [PR #4573](https://github.com/apollographql/apollo-client/pull/4573), part of [issue #3452](https://github.com/apollographql/apollo-client/issues/3452)

### Apollo Cache In-Memory

- Support `new InMemoryCache({ freezeResults: true })` to help enforce immutability. <br/>
[@benjamn](https://github.com/benjamn) in [#4514](https://github.com/apollographql/apollo-client/pull/4514)

- Allow `IntrospectionFragmentMatcher` to match fragments against the root `Query`, as `HeuristicFragmentMatcher` does. <br/>
[@rynobax](https://github.com/rynobax) in [#4620](https://github.com/apollographql/apollo-client/pull/4620)

## Apollo Client 2.5.1

### apollo-client 2.5.1

- Fixes `A tuple type element list cannot be empty` issue. <br/>
[@benjamn](https://github.com/benjamn) in [#4502](https://github.com/apollographql/apollo-client/pull/4502)

### graphql-anywhere 4.2.1

- Adds back the missing `graphql-anywhere/lib/async` entry point. <br/>
[@benjamn](https://github.com/benjamn) in [#4503](https://github.com/apollographql/apollo-client/pull/4503)


## Apollo Client (2.5.0)

### Apollo Client (2.5.0)

- Introduces new local state management features (client-side schema
and local resolver / `@client` support) and many overall code improvements,
to help reduce the Apollo Client bundle size. <br/>
[#4361](https://github.com/apollographql/apollo-client/pull/4361)
- Revamped CJS and ESM bundling approach with Rollup. <br/>
[@rosskevin](https://github.com/rosskevin) in [#4261](https://github.com/apollographql/apollo-client/pull/4261)
- Fixes an issue where the `QueryManager` was accidentally returning cached
data for `network-only` queries. <br/>
[@danilobuerger](https://github.com/danilobuerger) in [#4352](https://github.com/apollographql/apollo-client/pull/4352)
- Fixed an issue in the repo `.gitattributes` that was causing binary files
to have their line endings adjusted, and cleaned up corrupted documentation
images (ref: https://github.com/apollographql/apollo-client/pull/4232). <br/>
[@rajington](https://github.com/rajington) in [#4438](https://github.com/apollographql/apollo-client/pull/4438)
- Improve (and shorten) query polling implementation. <br/>
[PR #4337](https://github.com/apollographql/apollo-client/pull/4337)


## Apollo Client (2.4.13)

Expand Down
21 changes: 21 additions & 0 deletions config/jest.config.settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
transform: {
'.(ts|tsx)': 'ts-jest',
},

globals: {
'ts-jest': {
diagnostics: false,
},
},

moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
testURL: 'http://localhost',

testMatch: ['<rootDir>/src/**/__tests__/**/*.ts'],
testPathIgnorePatterns: [
'/node_modules/',
'/lib/',
'<rootDir>/lib/',
],
};
141 changes: 99 additions & 42 deletions config/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
import node from 'rollup-plugin-node-resolve';
import sourcemaps from 'rollup-plugin-sourcemaps';
import nodeResolve from 'rollup-plugin-node-resolve';
import typescriptPlugin from 'rollup-plugin-typescript2';
import typescript from 'typescript';
import path from 'path';
import invariantPlugin from 'rollup-plugin-invariant';
import { terser as minify } from 'rollup-plugin-terser';

export const globals = {
// Apollo
function onwarn(message) {
const suppressed = ['UNRESOLVED_IMPORT', 'THIS_IS_UNDEFINED'];

if (!suppressed.find(code => message.code === code)) {
return console.warn(message.message);
}
}

const defaultGlobals = {
'apollo-client': 'apollo.core',
'apollo-cache': 'apolloCache.core',
'apollo-link': 'apolloLink.core',
Expand All @@ -11,49 +22,95 @@ export const globals = {
'graphql-anywhere': 'graphqlAnywhere',
'graphql-anywhere/lib/async': 'graphqlAnywhere.async',
'apollo-boost': 'apollo.boost',
'tslib': 'tslib',
'ts-invariant': 'invariant',
};

export default (name, override = {}) => {
const config = Object.assign(
export function rollup({
name,
input = './src/index.ts',
outputPrefix = 'bundle',
extraGlobals = {},
}) {
const projectDir = path.join(__filename, '..');
console.info(`Building project esm ${projectDir}`);
const tsconfig = `${projectDir}/tsconfig.json`;

const globals = {
...defaultGlobals,
...extraGlobals,
};

function external(id) {
return Object.prototype.hasOwnProperty.call(globals, id);
}

function outputFile(format) {
return './lib/' + outputPrefix + '.' + format + '.js';
}

function convert(format) {
return {
input: outputFile('esm'),
external,
output: {
file: outputFile(format),
format,
sourcemap: true,
name,
globals,
},
onwarn,
};
}

return [
{
input: 'lib/index.js',
//output: merged separately
input,
external,
output: {
file: outputFile('esm'),
format: 'esm',
sourcemap: true,
},
plugins: [
nodeResolve({
extensions: ['.ts', '.tsx'],
module: true,
}),
typescriptPlugin({ typescript, tsconfig }),
invariantPlugin({
// Instead of completely stripping InvariantError messages in
// production, this option assigns a numeric code to the
// production version of each error (unique to the call/throw
// location), which makes it much easier to trace production
// errors back to the unminified code where they were thrown,
// where the full error string can be found. See #4519.
errorCodes: true,
}),
],
onwarn,
external: Object.keys(globals),
},
override,
);

config.output = Object.assign(
convert('umd'),
convert('cjs'),
{
file: 'lib/bundle.umd.js',
format: 'umd',
name,
exports: 'named',
sourcemap: true,
globals,
input: outputFile('cjs'),
output: {
file: outputFile('cjs.min'),
format: 'cjs',
},
plugins: [
minify({
mangle: {
toplevel: true,
},
compress: {
global_defs: {
'@process.env.NODE_ENV': JSON.stringify('production'),
},
},
}),
],
},
config.output,
);

config.plugins = config.plugins || [];
config.plugins.push(
sourcemaps(),
node({
// Inline anything imported from the tslib package, e.g. __extends
// and __assign. This depends on the "importHelpers":true option in
// tsconfig.base.json.
module: true,
only: ['tslib'],
}),
);
return config;
};

function onwarn(message) {
const suppressed = ['UNRESOLVED_IMPORT', 'THIS_IS_UNDEFINED'];

if (!suppressed.find(code => message.code === code)) {
return console.warn(message.message);
}
];
}
2 changes: 1 addition & 1 deletion config/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"declaration": true,
"declarationMap": true,
"target": "es5",
"module": "es2015",
"module": "commonjs",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
_multiconfig.yml
.cache
public
68 changes: 0 additions & 68 deletions docs/_config.yml

This file was deleted.

1 change: 0 additions & 1 deletion docs/assets/theme-colors.less

This file was deleted.

Loading

0 comments on commit 49069bf

Please sign in to comment.