@isograph/babel-plugin 0.0.0-main-b82d48f7 → 0.0.0-main-4693ce16
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/BabelPluginIsograph.js +2 -3
- package/compileTag.js +4 -4
- package/package.json +1 -1
package/BabelPluginIsograph.js
CHANGED
@@ -9,12 +9,11 @@ const configExplorer = cosmiconfig('isograph', {
|
|
9
9
|
'.json': cosmiconfig.loadJson,
|
10
10
|
},
|
11
11
|
});
|
12
|
-
|
13
|
-
/** @type {import("cosmiconfig").Config} */
|
12
|
+
/** @type {NonNullable<import("cosmiconfig").CosmiconfigResult>} */
|
14
13
|
let IsographConfig;
|
15
14
|
const result = configExplorer.searchSync();
|
16
15
|
if (result) {
|
17
|
-
IsographConfig = result
|
16
|
+
IsographConfig = result;
|
18
17
|
} else {
|
19
18
|
throw new Error(
|
20
19
|
'No config found. Do you have a isograph.config.json file somewhere?',
|
package/compileTag.js
CHANGED
@@ -7,7 +7,7 @@ const os = require('os');
|
|
7
7
|
* @typedef {import("@babel/core")} babel
|
8
8
|
* @param {typeof babel.types} t
|
9
9
|
* @param {babel.NodePath<babel.types.CallExpression>} path
|
10
|
-
* @param {import("cosmiconfig").
|
10
|
+
* @param {NonNullable<import("cosmiconfig").CosmiconfigResult>} config
|
11
11
|
*/
|
12
12
|
function compileTag(t, path, config) {
|
13
13
|
const callee = path.node.callee;
|
@@ -85,15 +85,15 @@ function getTypeAndField(path) {
|
|
85
85
|
* @param {string} type
|
86
86
|
* @param {string} field
|
87
87
|
* @param {string} artifactType
|
88
|
-
* @param {import("cosmiconfig").
|
88
|
+
* @param {NonNullable<import("cosmiconfig").CosmiconfigResult>} config
|
89
89
|
*/
|
90
90
|
function compileImportStatement(t, path, type, field, artifactType, config) {
|
91
91
|
const filename = path.state.filename;
|
92
92
|
const folder = pathModule.dirname(filename);
|
93
|
-
const cwd =
|
93
|
+
const cwd = pathModule.dirname(config.filepath);
|
94
94
|
const artifactDirectory = pathModule.join(
|
95
95
|
cwd,
|
96
|
-
config['artifact_directory'] ?? config['project_root'],
|
96
|
+
config.config['artifact_directory'] ?? config.config['project_root'],
|
97
97
|
);
|
98
98
|
|
99
99
|
const fileToArtifactDir = pathModule.relative(folder, artifactDirectory);
|
package/package.json
CHANGED