How to use fusion-tokens - 3 common examples

To help you get started, we’ve selected a few fusion-tokens examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fusionjs / fusionjs / fusion-plugin-apollo / src / apollo-client / index.js View on Github external
typeDefs: typeof ApolloClientLocalSchemaToken.optional,
  schema: typeof GraphQLSchemaToken.optional,
  resolvers: typeof ApolloClientResolversToken.optional,
  defaultOptions: typeof ApolloClientDefaultOptionsToken.optional,
};

function Container() {}

const ApolloClientPlugin: FusionPlugin<
  ApolloClientDepsType,
  InitApolloClientType<*>
> = createPlugin({
  deps: {
    getCache: GetApolloClientCacheToken.optional,
    endpoint: GraphQLEndpointToken.optional,
    fetch: __NODE__ ? FetchToken.optional : FetchToken,
    includeCredentials: ApolloClientCredentialsToken.optional,
    apolloContext: ApolloContextToken.optional,
    getApolloLinks: GetApolloClientLinksToken.optional,
    typeDefs: ApolloClientLocalSchemaToken.optional,
    schema: GraphQLSchemaToken.optional,
    resolvers: ApolloClientResolversToken.optional,
    defaultOptions: ApolloClientDefaultOptionsToken.optional,
  },
  provides({
    getCache = ctx =>
      // don't automatically add typename when handling POST requests via the executor. This saves size on the response
      new InMemoryCache({
        addTypename: ctx.method === 'POST' ? false : true,
      }),
    endpoint = '/graphql',
    fetch,
github fusionjs / fusionjs / fusion-plugin-apollo / src / plugin.js View on Github external
function getDeps(): DepsType {
  if (__NODE__) {
    return {
      apolloContext: ApolloContextToken.optional,
      logger: LoggerToken.optional,
      schema: GraphQLSchemaToken.optional,
      endpoint: GraphQLEndpointToken.optional,
      getApolloClient: ApolloClientToken,
      getDataFromTree: GetDataFromTreeToken.optional,
      bodyParserConfig: ApolloBodyParserConfigToken.optional,
      defaultOptionsConfig: ApolloDefaultOptionsConfigToken.optional,
    };
  }
  // $FlowFixMe
  return {
    getApolloClient: ApolloClientToken,
  };
}
github fusionjs / fusionjs / fusion-plugin-i18n / src / browser.js View on Github external
const pluginFactory: () => PluginType = () =>
  createPlugin({
    deps: {
      fetch: FetchToken.optional,
      hydrationState: HydrationStateToken.optional,
      events: UniversalEventsToken.optional,
    },
    provides: ({fetch = window.fetch, hydrationState, events} = {}) => {
      class I18n {
        locale: string;
        translations: TranslationsObjectType;
        requestedKeys: Set;

        constructor() {
          const {localeCode, translations} =
            hydrationState || loadTranslations();
          this.requestedKeys = new Set();
          this.translations = translations || {};
          if (localeCode) {
            this.locale = localeCode;

fusion-tokens

Dependency injection tokens for FusionJS

MIT
Latest version published 1 year ago

Package Health Score

57 / 100
Full package analysis

Similar packages