@graphql-inspector/config
Advanced tools
Comparing version 1.30.0-rc.0 to 1.30.1
@@ -5,26 +5,29 @@ 'use strict'; | ||
const tslib = require('tslib'); | ||
const cosmiconfig = require('cosmiconfig'); | ||
const path = require('path'); | ||
async function useConfig(options) { | ||
function useConfig(options) { | ||
var _a, _b, _c, _d; | ||
const cosmi = cosmiconfig.cosmiconfig('inspector', { | ||
cache: true, | ||
return tslib.__awaiter(this, void 0, void 0, function* () { | ||
const cosmi = cosmiconfig.cosmiconfig('inspector', { | ||
cache: true, | ||
}); | ||
const config = yield ((options === null || options === void 0 ? void 0 : options.config) ? cosmi.load(path.isAbsolute(options.config) | ||
? options.config | ||
: path.resolve(process.cwd(), options.config)) | ||
: cosmi.search()); | ||
if (!config) { | ||
throw new Error('Config not found'); | ||
} | ||
if (config.isEmpty) { | ||
throw new Error('Config is empty'); | ||
} | ||
return { | ||
use: { | ||
loaders: ensureList((_b = (_a = config.config) === null || _a === void 0 ? void 0 : _a.use) === null || _b === void 0 ? void 0 : _b.loaders, 'loaders'), | ||
commands: ensureList((_d = (_c = config.config) === null || _c === void 0 ? void 0 : _c.use) === null || _d === void 0 ? void 0 : _d.commands, 'commands'), | ||
}, | ||
}; | ||
}); | ||
const config = await ((options === null || options === void 0 ? void 0 : options.config) ? cosmi.load(path.isAbsolute(options.config) | ||
? options.config | ||
: path.resolve(process.cwd(), options.config)) | ||
: cosmi.search()); | ||
if (!config) { | ||
throw new Error('Config not found'); | ||
} | ||
if (config.isEmpty) { | ||
throw new Error('Config is empty'); | ||
} | ||
return { | ||
use: { | ||
loaders: ensureList((_b = (_a = config.config) === null || _a === void 0 ? void 0 : _a.use) === null || _b === void 0 ? void 0 : _b.loaders, 'loaders'), | ||
commands: ensureList((_d = (_c = config.config) === null || _c === void 0 ? void 0 : _c.use) === null || _d === void 0 ? void 0 : _d.commands, 'commands'), | ||
}, | ||
}; | ||
} | ||
@@ -31,0 +34,0 @@ function ensureList(list, path) { |
@@ -0,25 +1,28 @@ | ||
import { __awaiter } from 'tslib'; | ||
import { cosmiconfig } from 'cosmiconfig'; | ||
import { isAbsolute, resolve } from 'path'; | ||
async function useConfig(options) { | ||
function useConfig(options) { | ||
var _a, _b, _c, _d; | ||
const cosmi = cosmiconfig('inspector', { | ||
cache: true, | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const cosmi = cosmiconfig('inspector', { | ||
cache: true, | ||
}); | ||
const config = yield ((options === null || options === void 0 ? void 0 : options.config) ? cosmi.load(isAbsolute(options.config) | ||
? options.config | ||
: resolve(process.cwd(), options.config)) | ||
: cosmi.search()); | ||
if (!config) { | ||
throw new Error('Config not found'); | ||
} | ||
if (config.isEmpty) { | ||
throw new Error('Config is empty'); | ||
} | ||
return { | ||
use: { | ||
loaders: ensureList((_b = (_a = config.config) === null || _a === void 0 ? void 0 : _a.use) === null || _b === void 0 ? void 0 : _b.loaders, 'loaders'), | ||
commands: ensureList((_d = (_c = config.config) === null || _c === void 0 ? void 0 : _c.use) === null || _d === void 0 ? void 0 : _d.commands, 'commands'), | ||
}, | ||
}; | ||
}); | ||
const config = await ((options === null || options === void 0 ? void 0 : options.config) ? cosmi.load(isAbsolute(options.config) | ||
? options.config | ||
: resolve(process.cwd(), options.config)) | ||
: cosmi.search()); | ||
if (!config) { | ||
throw new Error('Config not found'); | ||
} | ||
if (config.isEmpty) { | ||
throw new Error('Config is empty'); | ||
} | ||
return { | ||
use: { | ||
loaders: ensureList((_b = (_a = config.config) === null || _a === void 0 ? void 0 : _a.use) === null || _b === void 0 ? void 0 : _b.loaders, 'loaders'), | ||
commands: ensureList((_d = (_c = config.config) === null || _c === void 0 ? void 0 : _c.use) === null || _d === void 0 ? void 0 : _d.commands, 'commands'), | ||
}, | ||
}; | ||
} | ||
@@ -26,0 +29,0 @@ function ensureList(list, path) { |
{ | ||
"name": "@graphql-inspector/config", | ||
"version": "1.30.0-rc.0", | ||
"version": "1.30.1", | ||
"peerDependencies": { | ||
@@ -8,6 +8,2 @@ "graphql": "^0.13.0 || ^14.0.0 || ^15.0.0", | ||
}, | ||
"dependencies": { | ||
"cosmiconfig": "6.0.0", | ||
"tslib": "^1.11.1" | ||
}, | ||
"repository": { | ||
@@ -14,0 +10,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
10103
2
89
1
- Removedcosmiconfig@6.0.0
- Removedtslib@^1.11.1
- Removed@babel/code-frame@7.26.2(transitive)
- Removed@babel/helper-validator-identifier@7.25.9(transitive)
- Removed@types/parse-json@4.0.2(transitive)
- Removedcallsites@3.1.0(transitive)
- Removedcosmiconfig@6.0.0(transitive)
- Removederror-ex@1.3.2(transitive)
- Removedimport-fresh@3.3.0(transitive)
- Removedis-arrayish@0.2.1(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedjson-parse-even-better-errors@2.3.1(transitive)
- Removedlines-and-columns@1.2.4(transitive)
- Removedparent-module@1.0.1(transitive)
- Removedparse-json@5.2.0(transitive)
- Removedpath-type@4.0.0(transitive)
- Removedpicocolors@1.1.1(transitive)
- Removedresolve-from@4.0.0(transitive)
- Removedtslib@1.14.1(transitive)
- Removedyaml@1.10.2(transitive)