UNPKG

@apollo/client-integration-nextjs

Version:

<div align="center"> <img src="https://raw.githubusercontent.com/apollographql/apollo-client-integrations/main/banner.jpg" width="500" alt="Apollo Client + Next.js App Router" /> </div>

66 lines (62 loc) 2.35 kB
'use strict'; var clientReactStreaming = require('@apollo/client-react-streaming'); var react = require('react'); var manualTransport = require('@apollo/client-react-streaming/manual-transport'); var navigation_js = require('next/navigation.js'); // src/index.shared.ts // src/bundleInfo.ts var bundle = { pkg: "@apollo/client-integration-nextjs", client: "ApolloClient", cache: "InMemoryCache" }; var ApolloClient = class extends clientReactStreaming.ApolloClient { /** * Information about the current package and it's export names, for use in error messages. * * @internal */ static info = bundle; }; var InMemoryCache = class extends clientReactStreaming.InMemoryCache { /** * Information about the current package and it's export names, for use in error messages. * * @internal */ static info = bundle; }; var ApolloNextAppProvider = /* @__PURE__ */ clientReactStreaming.WrapApolloProvider( manualTransport.buildManualDataTransport({ useInsertHtml() { const insertHtml = react.useContext(navigation_js.ServerInsertedHTMLContext); if (!insertHtml) { throw new Error( 'The SSR build of ApolloNextAppProvider cannot be used outside of the Next App Router!\nIf you encounter this in a test, make sure that your tests are using the browser build by adding the "browser" import condition to your test setup.' ); } return insertHtml; } }) ); ApolloNextAppProvider.info = bundle; var resetApolloClientSingletons = manualTransport.resetManualSSRApolloSingletons; exports.built_for_ssr = true; Object.defineProperty(exports, "DebounceMultipartResponsesLink", { enumerable: true, get: function () { return clientReactStreaming.DebounceMultipartResponsesLink; } }); Object.defineProperty(exports, "RemoveMultipartDirectivesLink", { enumerable: true, get: function () { return clientReactStreaming.RemoveMultipartDirectivesLink; } }); Object.defineProperty(exports, "SSRMultipartLink", { enumerable: true, get: function () { return clientReactStreaming.SSRMultipartLink; } }); exports.ApolloClient = ApolloClient; exports.ApolloNextAppProvider = ApolloNextAppProvider; exports.InMemoryCache = InMemoryCache; exports.resetApolloClientSingletons = resetApolloClientSingletons; //# sourceMappingURL=out.js.map //# sourceMappingURL=index.ssr.cjs.map