Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@graphql-inspector/config

Package Overview
Dependencies
1
Maintainers
1
Versions
245
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.30.3 to 1.30.4

76

index.cjs.js

@@ -5,26 +5,41 @@ 'use strict';

const tslib = require('tslib');
const cosmiconfig = require('cosmiconfig');
const path = require('path');
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
function useConfig(options) {
var _a, _b, _c, _d;
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');
}
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function useConfig() {
return __awaiter(this, void 0, void 0, function* () {
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'),
loaders: ensureList(discoverLoaders(['code', 'git', 'github', 'graphql', 'json', 'url']), 'loaders'),
commands: ensureList(discoverCommands([
'coverage',
'diff',
'docs',
'introspect',
'serve',
'similar',
'validate',
]), 'commands'),
},

@@ -34,2 +49,21 @@ };

}
function moduleExists(name) {
var _a;
try {
require(name);
return true;
}
catch (error) {
if ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes(`Cannot find module '${name}'`)) {
return false;
}
throw error;
}
}
function discoverLoaders(loaders) {
return loaders.filter((name) => moduleExists(`@graphql-inspector/${name}-loader`));
}
function discoverCommands(commands) {
return commands.filter((name) => moduleExists(`@graphql-inspector/${name}-command`));
}
function ensureList(list, path) {

@@ -36,0 +70,0 @@ if (!list) {

@@ -7,6 +7,2 @@ export interface InspectorConfig {

}
interface UseConfigOptions {
config?: string;
}
export declare function useConfig(options?: UseConfigOptions): Promise<InspectorConfig | never>;
export {};
export declare function useConfig(): Promise<InspectorConfig | never>;

@@ -1,25 +0,40 @@

import { __awaiter } from 'tslib';
import { cosmiconfig } from 'cosmiconfig';
import { isAbsolute, resolve } from 'path';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
function useConfig(options) {
var _a, _b, _c, _d;
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function useConfig() {
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'),
loaders: ensureList(discoverLoaders(['code', 'git', 'github', 'graphql', 'json', 'url']), 'loaders'),
commands: ensureList(discoverCommands([
'coverage',
'diff',
'docs',
'introspect',
'serve',
'similar',
'validate',
]), 'commands'),
},

@@ -29,2 +44,21 @@ };

}
function moduleExists(name) {
var _a;
try {
require(name);
return true;
}
catch (error) {
if ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes(`Cannot find module '${name}'`)) {
return false;
}
throw error;
}
}
function discoverLoaders(loaders) {
return loaders.filter((name) => moduleExists(`@graphql-inspector/${name}-loader`));
}
function discoverCommands(commands) {
return commands.filter((name) => moduleExists(`@graphql-inspector/${name}-command`));
}
function ensureList(list, path) {

@@ -31,0 +65,0 @@ if (!list) {

{
"name": "@graphql-inspector/config",
"version": "1.30.3",
"version": "1.30.4",
"peerDependencies": {
"graphql": "^0.13.0 || ^14.0.0 || ^15.0.0",
"yargs": "15.3.1"
"graphql": "^0.13.0 || ^14.0.0 || ^15.0.0"
},
"dependencies": {
"cosmiconfig": "6.0.0",
"tslib": "^1.11.1"
},
"repository": {

@@ -13,0 +8,0 @@ "type": "git",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc