Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-inspector/config

Package Overview
Dependencies
Maintainers
2
Versions
247
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-inspector/config - npm Package Compare versions

Comparing version 0.0.0-canary.3c127cf to 0.0.0-canary.485af9a

73

index.cjs.js

@@ -32,52 +32,49 @@ 'use strict';

const availableCommands = [
'coverage',
'diff',
'docs',
'introspect',
'serve',
'similar',
'validate',
'coverage',
'diff',
'docs',
'introspect',
'serve',
'similar',
'validate',
];
const availableLoaders = [
'code',
'git',
'github',
'graphql',
'json',
'url',
'code',
'git',
'github',
'graphql',
'json',
'url',
];
function useConfig() {
return __awaiter(this, void 0, void 0, function* () {
return {
loaders: ensureList(discoverLoaders(availableLoaders), 'loaders'),
commands: ensureList(discoverCommands(availableCommands), 'commands'),
};
});
return __awaiter(this, void 0, void 0, function* () {
return {
loaders: ensureList(discoverLoaders(availableLoaders), 'loaders'),
commands: ensureList(discoverCommands(availableCommands), 'commands'),
};
});
}
function moduleExists(name) {
try {
require.resolve(name);
return true;
} catch (error) {
return false;
}
try {
require.resolve(name);
return true;
}
catch (error) {
return false;
}
}
function discoverLoaders(loaders) {
return loaders.filter((name) =>
moduleExists(`@graphql-inspector/${name}-loader`),
);
return loaders.filter((name) => moduleExists(`@graphql-inspector/${name}-loader`));
}
function discoverCommands(commands) {
return commands.filter((name) =>
moduleExists(`@graphql-inspector/${name}-command`),
);
return commands.filter((name) => moduleExists(`@graphql-inspector/${name}-command`));
}
function ensureList(list, path) {
if (!list) {
return [];
}
if (Array.isArray(list)) {
return list;
}
throw new Error(`Value of ${path} expected to be a list`);
if (!list) {
return [];
}
if (Array.isArray(list)) {
return list;
}
throw new Error(`Value of ${path} expected to be a list`);
}

@@ -84,0 +81,0 @@

export interface InspectorConfig {
loaders: string[];
commands: string[];
loaders: string[];
commands: string[];
}

@@ -5,0 +5,0 @@ export declare const availableCommands: string[];

@@ -28,52 +28,49 @@ /*! *****************************************************************************

const availableCommands = [
'coverage',
'diff',
'docs',
'introspect',
'serve',
'similar',
'validate',
'coverage',
'diff',
'docs',
'introspect',
'serve',
'similar',
'validate',
];
const availableLoaders = [
'code',
'git',
'github',
'graphql',
'json',
'url',
'code',
'git',
'github',
'graphql',
'json',
'url',
];
function useConfig() {
return __awaiter(this, void 0, void 0, function* () {
return {
loaders: ensureList(discoverLoaders(availableLoaders), 'loaders'),
commands: ensureList(discoverCommands(availableCommands), 'commands'),
};
});
return __awaiter(this, void 0, void 0, function* () {
return {
loaders: ensureList(discoverLoaders(availableLoaders), 'loaders'),
commands: ensureList(discoverCommands(availableCommands), 'commands'),
};
});
}
function moduleExists(name) {
try {
require.resolve(name);
return true;
} catch (error) {
return false;
}
try {
require.resolve(name);
return true;
}
catch (error) {
return false;
}
}
function discoverLoaders(loaders) {
return loaders.filter((name) =>
moduleExists(`@graphql-inspector/${name}-loader`),
);
return loaders.filter((name) => moduleExists(`@graphql-inspector/${name}-loader`));
}
function discoverCommands(commands) {
return commands.filter((name) =>
moduleExists(`@graphql-inspector/${name}-command`),
);
return commands.filter((name) => moduleExists(`@graphql-inspector/${name}-command`));
}
function ensureList(list, path) {
if (!list) {
return [];
}
if (Array.isArray(list)) {
return list;
}
throw new Error(`Value of ${path} expected to be a list`);
if (!list) {
return [];
}
if (Array.isArray(list)) {
return list;
}
throw new Error(`Value of ${path} expected to be a list`);
}

@@ -80,0 +77,0 @@

{
"name": "@graphql-inspector/config",
"version": "0.0.0-canary.3c127cf",
"version": "0.0.0-canary.485af9a",
"sideEffects": false,

@@ -5,0 +5,0 @@ "peerDependencies": {

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc