Skip to content

Commit 93fd2a4

Browse files
committed
fix(apollo-client): get build working
1 parent ee9dc06 commit 93fd2a4

File tree

3 files changed

+1719
-3550
lines changed

3 files changed

+1719
-3550
lines changed

lib/reactotron-apollo-client/rollup.config.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import resolve from "rollup-plugin-node-resolve"
22
import babel from "rollup-plugin-babel"
33
import filesize from "rollup-plugin-filesize"
4-
import minify from "rollup-plugin-babel-minify"
4+
// import minify from "rollup-plugin-babel-minify"
55

66
const pkg = require("./package.json")
77

@@ -28,11 +28,13 @@ export default {
2828
plugins: [
2929
resolve({ extensions: [".ts"] }),
3030
babel({ extensions: [".ts"], runtimeHelpers: true }),
31-
process.env.NODE_ENV === "production"
32-
? minify({
33-
comments: false,
34-
})
35-
: null,
31+
// TODO fix minification via rollup-plugin-terser?
32+
// rollout-plugin-babel-minify is deprecated and causing build to fail
33+
// process.env.NODE_ENV === "production"
34+
// ? minify({
35+
// comments: false,
36+
// })
37+
// : null,
3638
filesize(),
3739
],
3840
external: ["@apollo/client", "reactotron-core-client", "graphql"],

lib/reactotron-apollo-client/src/reactotron-apollo-client.ts

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type MutationData = {
4646
body: string | undefined
4747
}
4848

49-
type Callback = () => any
49+
// type Callback = () => any
5050

5151
type ArrayOfQuery = Array<QueryData>
5252
type ArrayOfMutations = Array<MutationData>
@@ -59,45 +59,46 @@ type ApolloClientState = {
5959
cache: object
6060
}
6161

62-
type RawMutationBody = {
63-
id: string
64-
name: string | null
65-
body: string
66-
variables: object
67-
}
68-
69-
type RawQueryBody = {
70-
id: string
71-
name: string | null
72-
cachedData: object
73-
}
74-
75-
type RawData = {
76-
id: string
77-
lastUpdateAt: Date
78-
queries: ArrayOfQuery
79-
mutations: ArrayOfMutations
80-
cache: Array<BlockType>
81-
}
82-
83-
type Data = {
84-
id: string
85-
lastUpdateAt: Date
86-
queries: Array<BlockType>
87-
mutations: Array<BlockType>
88-
cache: Array<BlockType>
89-
}
90-
91-
type BlockType = {
92-
id?: string
93-
operationType?: string
94-
name?: string | null
95-
blocks?: Array<{
96-
blockType: string
97-
blockLabel: string
98-
blockValue: any
99-
}>
100-
}
62+
// TODO utilize when we do Queries and Mutations
63+
// type RawMutationBody = {
64+
// id: string
65+
// name: string | null
66+
// body: string
67+
// variables: object
68+
// }
69+
70+
// type RawQueryBody = {
71+
// id: string
72+
// name: string | null
73+
// cachedData: object
74+
// }
75+
76+
// type RawData = {
77+
// id: string
78+
// lastUpdateAt: Date
79+
// queries: ArrayOfQuery
80+
// mutations: ArrayOfMutations
81+
// cache: Array<BlockType>
82+
// }
83+
84+
// type Data = {
85+
// id: string
86+
// lastUpdateAt: Date
87+
// queries: Array<BlockType>
88+
// mutations: Array<BlockType>
89+
// cache: Array<BlockType>
90+
// }
91+
92+
// type BlockType = {
93+
// id?: string
94+
// operationType?: string
95+
// name?: string | null
96+
// blocks?: Array<{
97+
// blockType: string
98+
// blockLabel: string
99+
// blockValue: any
100+
// }>
101+
// }
101102

102103
let tick = 0
103104

@@ -119,6 +120,7 @@ function getQueries(queryMap: Map<string, RawQueryData>): ArrayOfQuery {
119120
const queries: ArrayOfQuery = []
120121

121122
if (queryMap) {
123+
// @ts-expect-error Type 'IterableIterator<RawQueryData>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher
122124
;[...queryMap.values()].forEach(
123125
({ document, variables, observableQuery, diff, lastDiff }, queryId) => {
124126
if (document && observableQuery) {
@@ -194,7 +196,7 @@ async function getCurrentState(client: ApolloClientType): Promise<ApolloClientSt
194196
}
195197

196198
function debounce(func: (...args: any) => any, timeout = 500): () => any {
197-
let timer: NodeJS.Timeout
199+
let timer
198200
return (...args) => {
199201
clearTimeout(timer)
200202
timer = setTimeout(() => {

0 commit comments

Comments
 (0)