Skip to content

Commit

Permalink
fix(resolvers-composition): fix ESM support for micromatch import
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Jul 7, 2021
1 parent f05dffa commit c6c382b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/resolvers-composition/src/resolvers-composition.ts
Expand Up @@ -2,7 +2,7 @@ import { chainFunctions } from './chain-functions';
import _ from 'lodash';
import { GraphQLFieldResolver, GraphQLScalarTypeConfig } from 'graphql';
import { asArray } from '@graphql-tools/utils';
import { matcher } from 'micromatch';
import micromatch from 'micromatch';

export type ResolversComposition<
Resolver extends GraphQLFieldResolver<any, any, any> = GraphQLFieldResolver<any, any>
Expand Down Expand Up @@ -35,7 +35,7 @@ function resolveRelevantMappings<Resolvers extends Record<string, any> = Record<
}

const [typeNameOrGlob, fieldNameOrGlob] = path.split('.');
const isTypeMatch = matcher(typeNameOrGlob);
const isTypeMatch = micromatch.matcher(typeNameOrGlob);

let fixedFieldGlob = fieldNameOrGlob;
// convert single value OR `{singleField}` to `singleField` as matching will fail otherwise
Expand All @@ -44,7 +44,7 @@ function resolveRelevantMappings<Resolvers extends Record<string, any> = Record<
}
fixedFieldGlob = fixedFieldGlob.replace(', ', ',').trim();

const isFieldMatch = matcher(fixedFieldGlob);
const isFieldMatch = micromatch.matcher(fixedFieldGlob);

const mappings: string[] = [];
for (const typeName in resolvers) {
Expand Down

0 comments on commit c6c382b

Please sign in to comment.