Skip to content

Commit

Permalink
Merge pull request #4361 from apollographql/release-2.5.0
Browse files Browse the repository at this point in the history
Release 2.5.0
  • Loading branch information
hwillson authored Feb 26, 2019
2 parents 853d8e7 + dcbda3d commit 26c4ff3
Show file tree
Hide file tree
Showing 82 changed files with 7,119 additions and 3,281 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# fs
.DS_Store
.rpt2_cache

# Logs
logs
Expand Down
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
16 changes: 12 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
**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 (2.5.0)

## Apollo Client (vNext)
## Apollo Client (2.5.0)

- Fixes an issue where the `QueryManager` was accidentally returning cached
- 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
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/',
],
};
133 changes: 91 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,87 @@ 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(),
],
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
}
}
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
rootDir: '.',
projects: ['<rootDir>/packages/*'],
};
Loading

0 comments on commit 26c4ff3

Please sign in to comment.