@apollo/client 3.4.0-rc.7 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apollo-client.cjs.js +300 -263
- package/apollo-client.cjs.js.map +1 -1
- package/apollo-client.cjs.min.js +1 -1
- package/cache/cache.cjs.js +105 -41
- package/cache/cache.cjs.js.map +1 -1
- package/cache/core/types/DataProxy.js +1 -0
- package/cache/index.d.ts +0 -1
- package/cache/index.d.ts.map +1 -1
- package/cache/index.js +3 -1
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +3 -2
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +22 -10
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fixPolyfills.native.js +1 -0
- package/cache/inmemory/helpers.d.ts +1 -1
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +5 -1
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +24 -3
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/object-canon.d.ts +3 -1
- package/cache/inmemory/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +12 -7
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +23 -10
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +5 -2
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +9 -6
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.js +1 -0
- package/cache/inmemory/writeToStore.d.ts +1 -0
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +16 -7
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +3 -0
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +2 -4
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +7 -6
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +116 -78
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +0 -1
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +3 -6
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +3 -3
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +13 -10
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs.js +137 -181
- package/core/core.cjs.js.map +1 -1
- package/core/index.d.ts +0 -1
- package/core/index.d.ts.map +1 -1
- package/core/index.js +2 -2
- package/core/index.js.map +1 -1
- package/core/types.d.ts +4 -1
- package/core/types.d.ts.map +1 -1
- package/core/types.js +1 -0
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.js +1 -0
- package/errors/errors.cjs.js +2 -0
- package/errors/errors.cjs.js.map +1 -1
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +3 -0
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +82 -57
- package/link/context/context.cjs.js +4 -0
- package/link/context/context.cjs.js.map +1 -1
- package/link/context/index.d.ts.map +1 -1
- package/link/context/index.js +4 -0
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.js +1 -1
- package/link/core/core.cjs.js +4 -2
- package/link/core/core.cjs.js.map +1 -1
- package/link/core/index.d.ts.map +1 -1
- package/link/core/index.js +3 -0
- package/link/core/index.js.map +1 -1
- package/link/core/types.js +1 -0
- package/link/http/checkFetcher.js +1 -1
- package/link/http/http.cjs.js +13 -3
- package/link/http/http.cjs.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +11 -1
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs.js.map +1 -1
- package/link/utils/utils.cjs.js +1 -1
- package/link/utils/utils.cjs.js.map +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/package.json +20 -20
- package/react/components/Mutation.d.ts +1 -1
- package/react/components/Query.js +1 -1
- package/react/components/Query.js.map +1 -1
- package/react/components/components.cjs.js +45 -31
- package/react/components/components.cjs.js.map +1 -1
- package/react/components/types.js +1 -0
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs.js +22 -8
- package/react/context/context.cjs.js.map +1 -1
- package/react/data/OperationData.js +2 -2
- package/react/data/QueryData.d.ts +1 -2
- package/react/data/QueryData.d.ts.map +1 -1
- package/react/data/QueryData.js +65 -72
- package/react/data/QueryData.js.map +1 -1
- package/react/data/data.cjs.js +65 -71
- package/react/data/data.cjs.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts +2 -1
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc.cjs.js +35 -18
- package/react/hoc/hoc.cjs.js.map +1 -1
- package/react/hoc/mutation-hoc.d.ts.map +1 -1
- package/react/hoc/query-hoc.d.ts.map +1 -1
- package/react/hoc/subscription-hoc.d.ts.map +1 -1
- package/react/hoc/types.js +1 -0
- package/react/hoc/withApollo.js +1 -1
- package/react/hooks/hooks.cjs.js +56 -10
- package/react/hooks/hooks.cjs.js.map +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +16 -6
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/utils/useAfterFastRefresh.d.ts +2 -0
- package/react/hooks/utils/useAfterFastRefresh.d.ts.map +1 -0
- package/react/hooks/utils/useAfterFastRefresh.js +18 -0
- package/react/hooks/utils/useAfterFastRefresh.js.map +1 -0
- package/react/hooks/utils/useBaseQuery.d.ts.map +1 -1
- package/react/hooks/utils/useBaseQuery.js +10 -3
- package/react/hooks/utils/useBaseQuery.js.map +1 -1
- package/react/index.d.ts +0 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +3 -1
- package/react/index.js.map +1 -1
- package/react/parser/index.js +4 -4
- package/react/parser/parser.cjs.js +4 -4
- package/react/parser/parser.cjs.js.map +1 -1
- package/react/react.cjs.js +2 -2
- package/react/react.cjs.js.map +1 -1
- package/react/ssr/ssr.cjs.js +15 -1
- package/react/ssr/ssr.cjs.js.map +1 -1
- package/react/types/types.d.ts +9 -3
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js +1 -0
- package/react/types/types.js.map +1 -1
- package/testing/index.d.ts.map +1 -1
- package/testing/index.js +3 -0
- package/testing/index.js.map +1 -1
- package/testing/testing.cjs.js +68 -17
- package/testing/testing.cjs.js.map +1 -1
- package/utilities/common/canUse.d.ts +1 -0
- package/utilities/common/canUse.d.ts.map +1 -1
- package/utilities/common/canUse.js +1 -0
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/global.d.ts.map +1 -1
- package/utilities/common/mergeDeep.js +2 -2
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/common/stringifyForDisplay.d.ts +2 -0
- package/utilities/common/stringifyForDisplay.d.ts.map +1 -0
- package/utilities/common/stringifyForDisplay.js +8 -0
- package/utilities/common/stringifyForDisplay.js.map +1 -0
- package/utilities/globals/DEV.d.ts +3 -0
- package/utilities/globals/DEV.d.ts.map +1 -0
- package/utilities/globals/DEV.js +20 -0
- package/utilities/globals/DEV.js.map +1 -0
- package/utilities/globals/graphql.d.ts +1 -1
- package/utilities/globals/graphql.d.ts.map +1 -1
- package/utilities/globals/graphql.js +3 -3
- package/utilities/globals/graphql.js.map +1 -1
- package/utilities/globals/index.d.ts +4 -2
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +5 -4
- package/utilities/globals/index.js.map +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/fragments.js +5 -5
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +3 -1
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +5 -1
- package/utilities/index.js.map +1 -1
- package/utilities/package.json +3 -1
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js +10 -11
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/testing/index.d.ts +1 -0
- package/utilities/testing/index.d.ts.map +1 -1
- package/utilities/testing/index.js +1 -0
- package/utilities/testing/index.js.map +1 -1
- package/utilities/testing/itAsync.d.ts +5 -8
- package/utilities/testing/itAsync.d.ts.map +1 -1
- package/utilities/testing/itAsync.js +6 -7
- package/utilities/testing/itAsync.js.map +1 -1
- package/utilities/testing/mocking/mockFetch.js +2 -2
- package/utilities/testing/mocking/mockFetch.js.map +1 -1
- package/utilities/testing/mocking/mockLink.d.ts.map +1 -1
- package/utilities/testing/mocking/mockLink.js +2 -8
- package/utilities/testing/mocking/mockLink.js.map +1 -1
- package/utilities/testing/mocking/mockWatchQuery.d.ts.map +1 -1
- package/utilities/testing/mocking/mockWatchQuery.js +2 -2
- package/utilities/testing/mocking/mockWatchQuery.js.map +1 -1
- package/utilities/testing/observableToPromise.js +2 -2
- package/utilities/testing/observableToPromise.js.map +1 -1
- package/utilities/testing/withConsoleSpy.d.ts +4 -0
- package/utilities/testing/withConsoleSpy.d.ts.map +1 -0
- package/utilities/testing/withConsoleSpy.js +39 -0
- package/utilities/testing/withConsoleSpy.js.map +1 -0
- package/utilities/types/IsStrictlyAny.js +1 -0
- package/utilities/utilities.cjs.js +56 -48
- package/utilities/utilities.cjs.js.map +1 -1
- package/version.js +1 -1
- package/core/Reobserver.d.ts +0 -18
- package/core/Reobserver.d.ts.map +0 -1
- package/core/Reobserver.js +0 -87
- package/core/Reobserver.js.map +0 -1
- package/utilities/globals/__DEV__.d.ts +0 -3
- package/utilities/globals/__DEV__.d.ts.map +0 -1
- package/utilities/globals/__DEV__.js +0 -32
- package/utilities/globals/__DEV__.js.map +0 -1
- package/utilities/globals/process.d.ts +0 -2
- package/utilities/globals/process.d.ts.map +0 -1
- package/utilities/globals/process.js +0 -31
- package/utilities/globals/process.js.map +0 -1
package/core/Reobserver.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Reobserver.js","sourceRoot":"","sources":["../../src/core/Reobserver.ts"],"names":[],"mappings":"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","sourcesContent":["import { WatchQueryOptions } from './watchQueryOptions';\nimport { NetworkStatus } from './networkStatus';\nimport { ApolloQueryResult } from './types';\nimport { Observer, Concast, compact } from '../utilities';\nimport { invariant } from 'ts-invariant';\n\n// Given that QueryManager#fetchQueryObservable returns only a single\n// query's worth of results, other code must be responsible for repeatedly\n// calling fetchQueryObservable, while ensuring that the ObservableQuery\n// consuming those results remains subscribed to the concatenation of all\n// the observables returned by fetchQueryObservable. That responsibility\n// falls to this Reobserver class. As a bonus, the Reobserver class is\n// perfectly poised to handle polling logic, since polling is essentially\n// repeated reobservation. In principle, this code could have remained in\n// the ObservableQuery class, but I felt it would be easier to explain and\n// understand reobservation if it was confined to a separate class.\nexport class Reobserver<TData, TVars> {\n constructor(\n private observer: Observer<ApolloQueryResult<TData>>,\n private options: WatchQueryOptions<TVars, TData>,\n // Almost certainly just a wrapper function around\n // QueryManager#fetchQueryObservable, but this small dose of\n // indirection means the Reobserver doesn't have to know/assume\n // anything about the QueryManager class.\n private fetch: (\n options: WatchQueryOptions<TVars, TData>,\n newNetworkStatus?: NetworkStatus,\n ) => Concast<ApolloQueryResult<TData>>,\n // If we're polling, there may be times when we should avoid fetching,\n // such as when the query is already in flight, or polling has been\n // completely disabled for server-side rendering. Passing false for\n // this parameter disables polling completely, and passing a boolean\n // function allows determining fetch safety dynamically.\n private shouldFetch: false | (() => boolean),\n ) {}\n\n private concast?: Concast<ApolloQueryResult<TData>>;\n\n public reobserve(\n newOptions?: Partial<WatchQueryOptions<TVars, TData>>,\n newNetworkStatus?: NetworkStatus,\n ): Promise<ApolloQueryResult<TData>> {\n if (newOptions) {\n this.updateOptions(newOptions);\n } else {\n // When we call this.updateOptions(newOptions) in the branch above,\n // it takes care of calling this.updatePolling(). In this branch, we\n // still need to update polling, even if there were no newOptions.\n this.updatePolling();\n }\n\n const concast = this.fetch(this.options, newNetworkStatus);\n\n if (this.concast) {\n // We use the {add,remove}Observer methods directly to avoid\n // wrapping observer with an unnecessary SubscriptionObserver\n // object, in part so that we can remove it here without triggering\n // any unsubscriptions, because we just want to ignore the old\n // observable, not prematurely shut it down, since other consumers\n // may be awaiting this.concast.promise.\n this.concast.removeObserver(this.observer, true);\n }\n\n concast.addObserver(this.observer);\n\n return (this.concast = concast).promise;\n }\n\n public updateOptions(newOptions: Partial<WatchQueryOptions<TVars, TData>>) {\n Object.assign(this.options, compact(newOptions));\n this.updatePolling();\n return this;\n }\n\n public stop() {\n if (this.concast) {\n this.concast.removeObserver(this.observer);\n delete this.concast;\n }\n\n if (this.pollingInfo) {\n clearTimeout(this.pollingInfo.timeout);\n this.options.pollInterval = 0;\n this.updatePolling();\n }\n }\n\n private pollingInfo?: {\n interval: number;\n timeout: ReturnType<typeof setTimeout>;\n };\n\n // Turns polling on or off based on this.options.pollInterval.\n private updatePolling() {\n const {\n pollingInfo,\n options: {\n pollInterval,\n },\n } = this;\n\n if (!pollInterval) {\n if (pollingInfo) {\n clearTimeout(pollingInfo.timeout);\n delete this.pollingInfo;\n }\n return;\n }\n\n if (pollingInfo &&\n pollingInfo.interval === pollInterval) {\n return;\n }\n\n invariant(\n pollInterval,\n 'Attempted to start a polling query without a polling interval.',\n );\n\n // Go no further if polling is disabled.\n if (this.shouldFetch === false) {\n return;\n }\n\n const info = pollingInfo || (\n this.pollingInfo = {} as Reobserver<TData, TVars>[\"pollingInfo\"]\n )!;\n\n info.interval = pollInterval;\n\n const maybeFetch = () => {\n if (this.pollingInfo) {\n if (this.shouldFetch && this.shouldFetch()) {\n this.reobserve({\n fetchPolicy: \"network-only\",\n nextFetchPolicy: this.options.fetchPolicy || \"cache-first\",\n }, NetworkStatus.poll).then(poll, poll);\n } else {\n poll();\n }\n };\n };\n\n const poll = () => {\n const info = this.pollingInfo;\n if (info) {\n clearTimeout(info.timeout);\n info.timeout = setTimeout(maybeFetch, info.interval);\n }\n };\n\n poll();\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"__DEV__.d.ts","sourceRoot":"","sources":["../../../src/utilities/globals/__DEV__.ts"],"names":[],"mappings":";AA4CA,wBAAwB"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { invariant } from "ts-invariant";
|
|
2
|
-
import global from "../common/global.js";
|
|
3
|
-
import { maybe } from "../common/maybe.js";
|
|
4
|
-
function getDEV() {
|
|
5
|
-
try {
|
|
6
|
-
return Boolean(__DEV__);
|
|
7
|
-
}
|
|
8
|
-
catch (_a) {
|
|
9
|
-
var maybeNodeEnv = maybe(function () { return process.env.NODE_ENV; });
|
|
10
|
-
var runningInNode = !!maybe(function () { return process.versions.node; });
|
|
11
|
-
Object.defineProperty(global, "__DEV__", {
|
|
12
|
-
value: maybeNodeEnv !== "production",
|
|
13
|
-
enumerable: false,
|
|
14
|
-
configurable: true,
|
|
15
|
-
writable: true,
|
|
16
|
-
});
|
|
17
|
-
if (maybeNodeEnv && !runningInNode) {
|
|
18
|
-
__DEV__ && invariant.log([
|
|
19
|
-
"Apollo Client has provided a default value for the __DEV__ constant " +
|
|
20
|
-
("(" + global.__DEV__ + "), but you may be able to reduce production bundle ") +
|
|
21
|
-
"sizes by configuring your JavaScript minifier to replace __DEV__ with " +
|
|
22
|
-
"false, allowing development-only code to be stripped from the bundle.",
|
|
23
|
-
"",
|
|
24
|
-
"For more information about the switch to __DEV__, see " +
|
|
25
|
-
"https://github.com/apollographql/apollo-client/pull/8347.",
|
|
26
|
-
].join("\n"));
|
|
27
|
-
}
|
|
28
|
-
return global.__DEV__;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export default getDEV();
|
|
32
|
-
//# sourceMappingURL=__DEV__.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"__DEV__.js","sourceRoot":"","sources":["../../../src/utilities/globals/__DEV__.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,SAAS,MAAM;IACb,IAAI;QACF,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;KACzB;IAAC,WAAM;QACN,IAAM,YAAY,GAAG,KAAK,CAAC,cAAM,OAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,EAApB,CAAoB,CAAC,CAAC;QACvD,IAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,cAAM,OAAA,OAAO,CAAC,QAAQ,CAAC,IAAI,EAArB,CAAqB,CAAC,CAAC;QAE3D,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE;YAIvC,KAAK,EAAE,YAAY,KAAK,YAAY;YACpC,UAAU,EAAE,KAAK;YACjB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAEH,IAAI,YAAY,IAAI,CAAC,aAAa,EAAE;YAOlC,SAAS,CAAC,GAAG,CAAC;gBACZ,sEAAsE;qBACtE,MAAI,MAAM,CAAC,OAAO,wDAAqD,CAAA;oBACvE,wEAAwE;oBACxE,uEAAuE;gBACvE,EAAE;gBACF,wDAAwD;oBACxD,2DAA2D;aAC5D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;SACf;QAED,OAAO,MAAM,CAAC,OAAO,CAAC;KACvB;AACH,CAAC;AAED,eAAe,MAAM,EAAE,CAAC","sourcesContent":["import { invariant } from \"ts-invariant\";\n\nimport global from \"../common/global\";\nimport { maybe } from \"../common/maybe\";\n\nfunction getDEV() {\n try {\n return Boolean(__DEV__);\n } catch {\n const maybeNodeEnv = maybe(() => process.env.NODE_ENV);\n const runningInNode = !!maybe(() => process.versions.node);\n\n Object.defineProperty(global, \"__DEV__\", {\n // In a buildless browser environment, maybe(() => process.env.NODE_ENV)\n // evaluates as undefined, so __DEV__ becomes true by default, but can be\n // initialized to false instead by a script/module that runs earlier.\n value: maybeNodeEnv !== \"production\",\n enumerable: false,\n configurable: true,\n writable: true,\n });\n\n if (maybeNodeEnv && !runningInNode) {\n // Issue this warning only if the developer has some sort of configuration\n // that provides process.env.NODE_ENV already (and we're not running in\n // Node.js), since they probably have an existing minifier configuration\n // (e.g. using terser's global_defs option or webpack's DefinePlugin) that\n // can be adapted to replace __DEV__ with false, similar to replacing\n // process.env.NODE_ENV with a string literal.\n invariant.log([\n \"Apollo Client has provided a default value for the __DEV__ constant \" +\n `(${global.__DEV__}), but you may be able to reduce production bundle ` +\n \"sizes by configuring your JavaScript minifier to replace __DEV__ with \" +\n \"false, allowing development-only code to be stripped from the bundle.\",\n \"\",\n \"For more information about the switch to __DEV__, see \" +\n \"https://github.com/apollographql/apollo-client/pull/8347.\",\n ].join(\"\\n\"));\n }\n\n return global.__DEV__;\n }\n}\n\nexport default getDEV();\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../src/utilities/globals/process.ts"],"names":[],"mappings":"AAuCA,wBAAgB,IAAI,SASnB"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { maybe } from "../common/maybe.js";
|
|
2
|
-
import global from "../common/global.js";
|
|
3
|
-
var originalProcessDescriptor = global &&
|
|
4
|
-
Object.getOwnPropertyDescriptor(global, "process");
|
|
5
|
-
var needToUndo = false;
|
|
6
|
-
if (!maybe(function () { return process.env.NODE_ENV; }) &&
|
|
7
|
-
(!originalProcessDescriptor || originalProcessDescriptor.configurable)) {
|
|
8
|
-
Object.defineProperty(global, "process", {
|
|
9
|
-
value: {
|
|
10
|
-
env: {
|
|
11
|
-
NODE_ENV: "production",
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
configurable: true,
|
|
15
|
-
enumerable: false,
|
|
16
|
-
writable: true,
|
|
17
|
-
});
|
|
18
|
-
needToUndo = "process" in global;
|
|
19
|
-
}
|
|
20
|
-
export function undo() {
|
|
21
|
-
if (needToUndo) {
|
|
22
|
-
if (originalProcessDescriptor) {
|
|
23
|
-
Object.defineProperty(global, "process", originalProcessDescriptor);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
delete global.process;
|
|
27
|
-
}
|
|
28
|
-
needToUndo = false;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=process.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../../src/utilities/globals/process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAEtC,IAAM,yBAAyB,GAAG,MAAM;IACtC,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAErD,IAAI,UAAU,GAAG,KAAK,CAAC;AAUvB,IAAI,CAAC,KAAK,CAAC,cAAM,OAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,EAApB,CAAoB,CAAC;IAElC,CAAC,CAAC,yBAAyB,IAAI,yBAAyB,CAAC,YAAY,CAAC,EAAE;IAC1E,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE;QACvC,KAAK,EAAE;YACL,GAAG,EAAE;gBAIH,QAAQ,EAAE,YAAY;aACvB;SACF;QAGD,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAGH,UAAU,GAAG,SAAS,IAAI,MAAM,CAAC;CAClC;AAED,MAAM,UAAU,IAAI;IAClB,IAAI,UAAU,EAAE;QACd,IAAI,yBAAyB,EAAE;YAC7B,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,yBAAyB,CAAC,CAAC;SACrE;aAAM;YACL,OAAQ,MAAc,CAAC,OAAO,CAAC;SAChC;QACD,UAAU,GAAG,KAAK,CAAC;KACpB;AACH,CAAC","sourcesContent":["import { maybe } from \"../common/maybe\";\nimport global from \"../common/global\";\n\nconst originalProcessDescriptor = global &&\n Object.getOwnPropertyDescriptor(global, \"process\");\n\nlet needToUndo = false;\n\n// The process.env.NODE_ENV expression can be provided in two different ways:\n// either process.env.NODE_ENV works because a literal globalThis.process object\n// exists, or it works because a build step replaces the process.env.NODE_ENV\n// expression with a string literal like \"production\" or \"development\" at build\n// time. This maybe(() => process.env.NODE_ENV) expression works in either case,\n// because it preserves the syntax of the process.env.NODE_ENV expression,\n// allowing the replacement strategy to produce maybe(() => \"production\"), and\n// defaulting to undefined if NODE_ENV is unavailable for any reason.\nif (!maybe(() => process.env.NODE_ENV) &&\n // Don't try to define global.process unless it will succeed.\n (!originalProcessDescriptor || originalProcessDescriptor.configurable)) {\n Object.defineProperty(global, \"process\", {\n value: {\n env: {\n // This default needs to be \"production\" instead of \"development\", to\n // avoid the problem https://github.com/graphql/graphql-js/pull/2894\n // will eventually solve, once merged and released.\n NODE_ENV: \"production\",\n }\n },\n // Let anyone else change global.process as they see fit, but hide it from\n // Object.keys(global) enumeration.\n configurable: true,\n enumerable: false,\n writable: true,\n });\n\n // We expect this to be true now.\n needToUndo = \"process\" in global;\n}\n\nexport function undo() {\n if (needToUndo) {\n if (originalProcessDescriptor) {\n Object.defineProperty(global, \"process\", originalProcessDescriptor);\n } else {\n delete (global as any).process;\n }\n needToUndo = false;\n }\n}\n"]}
|