@isograph/babel-plugin 0.4.1 → 0.4.3

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.
@@ -11,14 +11,6 @@ const configExplorer = cosmiconfig('isograph', {
11
11
  });
12
12
  /** @type {NonNullable<import("cosmiconfig").CosmiconfigResult>} */
13
13
  let IsographConfig;
14
- const result = configExplorer.searchSync();
15
- if (result) {
16
- IsographConfig = result;
17
- } else {
18
- throw new Error(
19
- 'No config found. Do you have a isograph.config.json file somewhere?',
20
- );
21
- }
22
14
 
23
15
  /** @typedef {import("@babel/core")} babel*/
24
16
 
@@ -27,10 +19,25 @@ if (result) {
27
19
  * @property {typeof babel.types} [types]
28
20
  * */
29
21
 
22
+ /**
23
+ * @typedef {Object} Options
24
+ * @property {string} [searchFrom]
25
+ * */
26
+
30
27
  /**
31
28
  * @param {Context} context
29
+ * @param {Options} options
32
30
  * @returns {babel.PluginObj} */
33
- module.exports = function BabelPluginIsograph(context) {
31
+ module.exports = function BabelPluginIsograph(context, options) {
32
+ const result = configExplorer.searchSync(options.searchFrom);
33
+ if (result) {
34
+ IsographConfig = result;
35
+ } else {
36
+ throw new Error(
37
+ 'No config found. Do you have a isograph.config.json file somewhere?',
38
+ );
39
+ }
40
+
34
41
  const { types } = context;
35
42
  if (!types) {
36
43
  throw new Error(
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@isograph/babel-plugin",
3
3
  "description": "A Babel plugin for use with Isograph applications.",
4
4
  "homepage": "https://isograph.dev",
5
- "version": "0.4.1",
5
+ "version": "0.4.3",
6
6
  "keywords": [
7
7
  "graphql",
8
8
  "isograph",