Skip to content

Commit

Permalink
Actually use DEV import in index.ts files to prevent its tree-shaking.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn committed Jun 17, 2021
1 parent 56ecc6a commit e04e959
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 8 deletions.
4 changes: 0 additions & 4 deletions src/__tests__/__snapshots__/exports.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Array [
"ApolloLink",
"ApolloProvider",
"Cache",
"DEV",
"DocumentType",
"HttpLink",
"InMemoryCache",
Expand Down Expand Up @@ -65,7 +64,6 @@ exports[`exports of public entry points @apollo/client/cache 1`] = `
Array [
"ApolloCache",
"Cache",
"DEV",
"EntityStore",
"InMemoryCache",
"MissingFieldError",
Expand All @@ -87,7 +85,6 @@ Array [
"ApolloError",
"ApolloLink",
"Cache",
"DEV",
"HttpLink",
"InMemoryCache",
"MissingFieldError",
Expand Down Expand Up @@ -228,7 +225,6 @@ exports[`exports of public entry points @apollo/client/react 1`] = `
Array [
"ApolloConsumer",
"ApolloProvider",
"DEV",
"DocumentType",
"getApolloContext",
"operationName",
Expand Down
4 changes: 3 additions & 1 deletion src/cache/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export { DEV } from "../utilities";
import { invariant } from "ts-invariant";
import { DEV } from "../utilities";
invariant("boolean" === typeof DEV, DEV);

export { Transaction, ApolloCache } from './core/cache';
export { Cache } from './core/types/Cache';
Expand Down
4 changes: 2 additions & 2 deletions src/core/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Core */

export { DEV } from "../utilities";
import { DEV } from "../utilities";

export {
ApolloClient,
Expand Down Expand Up @@ -91,7 +91,7 @@ export {
// Note that all invariant.* logging is hidden in production.
import { setVerbosity } from "ts-invariant";
export { setVerbosity as setLogVerbosity }
setVerbosity("log");
setVerbosity(DEV ? "log" : "silent");

// Note that importing `gql` by itself, then destructuring
// additional properties separately before exporting, is intentional.
Expand Down
4 changes: 4 additions & 0 deletions src/errors/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { invariant } from "ts-invariant";
import { DEV } from "../utilities";
invariant("boolean" === typeof DEV, DEV);

import { GraphQLError } from 'graphql';

import { isNonEmptyArray } from '../utilities';
Expand Down
4 changes: 4 additions & 0 deletions src/link/core/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { invariant } from "ts-invariant";
import { DEV } from "../../utilities";
invariant("boolean" === typeof DEV, DEV);

export { empty } from './empty';
export { from } from './from';
export { split } from './split';
Expand Down
4 changes: 3 additions & 1 deletion src/react/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export { DEV } from "../utilities";
import { invariant } from "ts-invariant";
import { DEV } from "../utilities";
invariant("boolean" === typeof DEV, DEV);

export {
ApolloProvider,
Expand Down
3 changes: 3 additions & 0 deletions src/testing/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
import { invariant } from "ts-invariant";
import { DEV } from "../utilities";
invariant("boolean" === typeof DEV, DEV);
export * from '../utilities/testing';
2 changes: 2 additions & 0 deletions src/utilities/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { invariant } from "ts-invariant";
import { DEV } from "./globals";
invariant("boolean" === typeof DEV, DEV);
export { DEV }

export {
Expand Down

0 comments on commit e04e959

Please sign in to comment.