@envelop/core 1.5.0-alpha-6952fd9.0 → 1.5.0

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/enable-if.d.ts CHANGED
@@ -10,5 +10,5 @@ export declare function isPluginEnabled(t: PluginOrDisabledPlugin): t is Plugin;
10
10
  /**
11
11
  * Utility function to enable a plugin.
12
12
  */
13
- export declare function enableIf(condition: boolean, plugin: Plugin): PluginOrDisabledPlugin;
13
+ export declare function enableIf(condition: boolean, plugin: Plugin | (() => Plugin)): PluginOrDisabledPlugin;
14
14
  export {};
package/index.js CHANGED
@@ -19,7 +19,12 @@ function isPluginEnabled(t) {
19
19
  * Utility function to enable a plugin.
20
20
  */
21
21
  function enableIf(condition, plugin) {
22
- return condition ? plugin : EnableIfBranded.DisabledPlugin;
22
+ if (condition) {
23
+ return typeof plugin === 'function' ? plugin() : plugin;
24
+ }
25
+ else {
26
+ return EnableIfBranded.DisabledPlugin;
27
+ }
23
28
  }
24
29
 
25
30
  const trackedSchemaSymbol = Symbol('TRACKED_SCHEMA');
package/index.mjs CHANGED
@@ -16,7 +16,12 @@ function isPluginEnabled(t) {
16
16
  * Utility function to enable a plugin.
17
17
  */
18
18
  function enableIf(condition, plugin) {
19
- return condition ? plugin : EnableIfBranded.DisabledPlugin;
19
+ if (condition) {
20
+ return typeof plugin === 'function' ? plugin() : plugin;
21
+ }
22
+ else {
23
+ return EnableIfBranded.DisabledPlugin;
24
+ }
20
25
  }
21
26
 
22
27
  const trackedSchemaSymbol = Symbol('TRACKED_SCHEMA');
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@envelop/core",
3
- "version": "1.5.0-alpha-6952fd9.0",
3
+ "version": "1.5.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
7
7
  },
8
8
  "dependencies": {
9
- "@envelop/types": "1.4.0-alpha-6952fd9.0"
9
+ "@envelop/types": "1.4.0"
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",