@graphql-mesh/config 10.1.15-alpha-20230405175658-1ce7bb775 → 10.1.15-alpha-20230406040317-8ed7f8ea7

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/cjs/process.js CHANGED
@@ -206,7 +206,7 @@ async function processConfig(config, options) {
206
206
  });
207
207
  })) || []),
208
208
  Promise.all(((_b = config.plugins) === null || _b === void 0 ? void 0 : _b.map(async (p, pluginIndex) => {
209
- const pluginName = Object.keys(p)[0].toString();
209
+ const [pluginName, maybeImportName] = Object.keys(p)[0].toString().split('#');
210
210
  const pluginConfig = p[pluginName];
211
211
  if (ENVELOP_CORE_PLUGINS_MAP[pluginName] != null) {
212
212
  const { importName, moduleName, pluginFactory } = ENVELOP_CORE_PLUGINS_MAP[pluginName];
@@ -245,18 +245,18 @@ async function processConfig(config, options) {
245
245
  }
246
246
  }
247
247
  else {
248
- Object.keys(possiblePluginFactory).forEach(importName => {
249
- if ((importName.toString().startsWith('use') ||
250
- importName.toString().endsWith('Plugin')) &&
251
- typeof possiblePluginFactory[importName] === 'function') {
252
- pluginFactory = possiblePluginFactory[importName];
253
- importName = importName.toString();
254
- if (options.generateCode) {
255
- importCodes.add(`import { ${importName} } from ${JSON.stringify(moduleName)};`);
256
- codes.add(`additionalEnvelopPlugins[${pluginIndex}] = await ${importName}(${JSON.stringify(pluginConfig, null, 2)});`);
257
- }
248
+ const importName = maybeImportName ||
249
+ Object.keys(possiblePluginFactory)
250
+ .find(iName => (iName.toString().startsWith('use') || iName.toString().endsWith('Plugin')) &&
251
+ typeof possiblePluginFactory[iName] === 'function')
252
+ .toString();
253
+ if (importName) {
254
+ pluginFactory = possiblePluginFactory[importName];
255
+ if (options.generateCode) {
256
+ importCodes.add(`import { ${importName} } from ${JSON.stringify(moduleName)};`);
257
+ codes.add(`additionalEnvelopPlugins[${pluginIndex}] = await ${importName}(${JSON.stringify(pluginConfig, null, 2)});`);
258
258
  }
259
- });
259
+ }
260
260
  }
261
261
  return pluginFactory({
262
262
  ...pluginConfig,
package/esm/process.js CHANGED
@@ -203,7 +203,7 @@ export async function processConfig(config, options) {
203
203
  });
204
204
  })) || []),
205
205
  Promise.all(((_b = config.plugins) === null || _b === void 0 ? void 0 : _b.map(async (p, pluginIndex) => {
206
- const pluginName = Object.keys(p)[0].toString();
206
+ const [pluginName, maybeImportName] = Object.keys(p)[0].toString().split('#');
207
207
  const pluginConfig = p[pluginName];
208
208
  if (ENVELOP_CORE_PLUGINS_MAP[pluginName] != null) {
209
209
  const { importName, moduleName, pluginFactory } = ENVELOP_CORE_PLUGINS_MAP[pluginName];
@@ -242,18 +242,18 @@ export async function processConfig(config, options) {
242
242
  }
243
243
  }
244
244
  else {
245
- Object.keys(possiblePluginFactory).forEach(importName => {
246
- if ((importName.toString().startsWith('use') ||
247
- importName.toString().endsWith('Plugin')) &&
248
- typeof possiblePluginFactory[importName] === 'function') {
249
- pluginFactory = possiblePluginFactory[importName];
250
- importName = importName.toString();
251
- if (options.generateCode) {
252
- importCodes.add(`import { ${importName} } from ${JSON.stringify(moduleName)};`);
253
- codes.add(`additionalEnvelopPlugins[${pluginIndex}] = await ${importName}(${JSON.stringify(pluginConfig, null, 2)});`);
254
- }
245
+ const importName = maybeImportName ||
246
+ Object.keys(possiblePluginFactory)
247
+ .find(iName => (iName.toString().startsWith('use') || iName.toString().endsWith('Plugin')) &&
248
+ typeof possiblePluginFactory[iName] === 'function')
249
+ .toString();
250
+ if (importName) {
251
+ pluginFactory = possiblePluginFactory[importName];
252
+ if (options.generateCode) {
253
+ importCodes.add(`import { ${importName} } from ${JSON.stringify(moduleName)};`);
254
+ codes.add(`additionalEnvelopPlugins[${pluginIndex}] = await ${importName}(${JSON.stringify(pluginConfig, null, 2)});`);
255
255
  }
256
- });
256
+ }
257
257
  }
258
258
  return pluginFactory({
259
259
  ...pluginConfig,
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@graphql-mesh/config",
3
- "version": "10.1.15-alpha-20230405175658-1ce7bb775",
3
+ "version": "10.1.15-alpha-20230406040317-8ed7f8ea7",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "@graphql-mesh/cross-helpers": "^0.3.4",
7
- "@graphql-mesh/runtime": "0.46.23-alpha-20230405175658-1ce7bb775",
7
+ "@graphql-mesh/runtime": "0.46.23-alpha-20230406040317-8ed7f8ea7",
8
8
  "@graphql-mesh/store": "^0.9.20",
9
- "@graphql-mesh/types": "0.91.14-alpha-20230405175658-1ce7bb775",
10
- "@graphql-mesh/utils": "0.43.22-alpha-20230405175658-1ce7bb775",
9
+ "@graphql-mesh/types": "0.91.14-alpha-20230406040317-8ed7f8ea7",
10
+ "@graphql-mesh/utils": "0.43.22-alpha-20230406040317-8ed7f8ea7",
11
11
  "@graphql-tools/utils": "^9.2.1",
12
12
  "graphql": "*",
13
13
  "tslib": "^2.4.0"
@@ -15,8 +15,8 @@
15
15
  "dependencies": {
16
16
  "@envelop/core": "3.0.6",
17
17
  "@graphql-mesh/cache-localforage": "0.7.20",
18
- "@graphql-mesh/merger-bare": "0.16.24-alpha-20230405175658-1ce7bb775",
19
- "@graphql-mesh/merger-stitching": "0.18.24-alpha-20230405175658-1ce7bb775",
18
+ "@graphql-mesh/merger-bare": "0.16.24-alpha-20230406040317-8ed7f8ea7",
19
+ "@graphql-mesh/merger-stitching": "0.18.24-alpha-20230406040317-8ed7f8ea7",
20
20
  "@graphql-tools/code-file-loader": "7.3.21",
21
21
  "@graphql-tools/graphql-file-loader": "7.5.16",
22
22
  "@graphql-tools/load": "7.8.13",