Socket
Socket
Sign inDemoInstall

graphql-config

Package Overview
Dependencies
Maintainers
0
Versions
319
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-config - npm Package Compare versions

Comparing version 5.0.3 to 5.1.0

6

cjs/config.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GraphQLConfig = exports.loadConfigSync = exports.loadConfig = void 0;
exports.GraphQLConfig = void 0;
exports.loadConfig = loadConfig;
exports.loadConfigSync = loadConfigSync;
const path_1 = require("path");

@@ -36,3 +38,2 @@ const project_config_js_1 = require("./project-config.js");

}
exports.loadConfig = loadConfig;
function loadConfigSync(options) {

@@ -53,3 +54,2 @@ const { filepath, configName, rootDir, extensions, throwOnEmpty, throwOnMissing, legacy } = {

}
exports.loadConfigSync = loadConfigSync;
function handleError(error, options) {

@@ -56,0 +56,0 @@ if ((!options.throwOnMissing && error instanceof errors_js_1.ConfigNotFoundError) ||

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExtensionMissingError = exports.LoaderNoResultError = exports.LoadersMissingError = exports.ProjectNotFoundError = exports.ConfigInvalidError = exports.ConfigEmptyError = exports.ConfigNotFoundError = exports.composeMessage = void 0;
exports.ExtensionMissingError = exports.LoaderNoResultError = exports.LoadersMissingError = exports.ProjectNotFoundError = exports.ConfigInvalidError = exports.ConfigEmptyError = exports.ConfigNotFoundError = void 0;
exports.composeMessage = composeMessage;
// eslint-disable-next-line @typescript-eslint/ban-types -- TODO: fix lint error

@@ -16,3 +17,2 @@ function ExtendableBuiltin(cls) {

}
exports.composeMessage = composeMessage;
class ConfigNotFoundError extends ExtendableBuiltin(Error) {

@@ -19,0 +19,0 @@ constructor(message) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createCosmiConfigSync = exports.createCosmiConfig = exports.isLegacyConfig = void 0;
exports.isLegacyConfig = isLegacyConfig;
exports.createCosmiConfig = createCosmiConfig;
exports.createCosmiConfigSync = createCosmiConfigSync;
const tslib_1 = require("tslib");

@@ -18,3 +20,2 @@ const cosmiconfig_1 = require("cosmiconfig");

}
exports.isLegacyConfig = isLegacyConfig;
function transformContent(content) {

@@ -30,3 +31,2 @@ return (0, string_env_interpolation_1.env)(content);

}
exports.createCosmiConfig = createCosmiConfig;
function createCosmiConfigSync(moduleName, legacy) {

@@ -36,3 +36,2 @@ const options = prepareCosmiconfig(moduleName, legacy);

}
exports.createCosmiConfigSync = createCosmiConfigSync;
const loadTypeScript = (filepath) => {

@@ -49,4 +48,4 @@ const jitiLoader = (0, jiti_1.default)(__filename, {

};
const loadYaml = createCustomLoader(cosmiconfig_1.defaultLoaders['.yaml']);
function prepareCosmiconfig(moduleName, legacy) {
const loadYaml = createCustomLoader(cosmiconfig_1.defaultLoaders['.yaml']);
const searchPlaces = [

@@ -58,2 +57,3 @@ '#.config.ts',

'#.config.cjs',
'#.config.mjs',
'#.config.json',

@@ -69,2 +69,3 @@ '#.config.yaml',

'.#rc.cjs',
'.#rc.mjs',
'.#rc.json',

@@ -85,6 +86,7 @@ '.#rc.yml',

'.ts': loadTypeScript,
'.cts': loadTypeScript,
'.mts': loadTypeScript,
'.cts': loadTypeScript,
'.js': cosmiconfig_1.defaultLoaders['.js'],
'.json': createCustomLoader(cosmiconfig_1.defaultLoaders['.json']),
'.js': loadTypeScript,
'.mjs': loadTypeScript,
'.json': cosmiconfig_1.defaultLoaders['.json'],
'.yaml': loadYaml,

@@ -91,0 +93,0 @@ '.yml': loadYaml,

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.findConfigSync = exports.findConfig = void 0;
exports.findConfig = findConfig;
exports.findConfigSync = findConfigSync;
const errors_js_1 = require("../errors.js");

@@ -14,3 +15,2 @@ const cosmiconfig_js_1 = require("./cosmiconfig.js");

}
exports.findConfig = findConfig;
function findConfigSync({ rootDir = CWD, legacy = true, configName }) {

@@ -23,3 +23,2 @@ validate(rootDir);

}
exports.findConfigSync = findConfigSync;
function validate(rootDir) {

@@ -26,0 +25,0 @@ if (!rootDir) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getConfigSync = exports.getConfig = void 0;
exports.getConfig = getConfig;
exports.getConfigSync = getConfigSync;
const errors_js_1 = require("../errors.js");

@@ -13,3 +14,2 @@ const cosmiconfig_js_1 = require("./cosmiconfig.js");

}
exports.getConfig = getConfig;
function getConfigSync({ filepath, configName, legacy = true, }) {

@@ -22,3 +22,2 @@ validate(filepath);

}
exports.getConfigSync = getConfigSync;
//

@@ -25,0 +24,0 @@ function resolve({ result, filepath }) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useMiddleware = exports.isLegacyProjectConfig = exports.isSingleProjectConfig = exports.isMultipleProjectConfig = void 0;
exports.isMultipleProjectConfig = isMultipleProjectConfig;
exports.isSingleProjectConfig = isSingleProjectConfig;
exports.isLegacyProjectConfig = isLegacyProjectConfig;
exports.useMiddleware = useMiddleware;
function isMultipleProjectConfig(config) {
return typeof config.projects === 'object';
}
exports.isMultipleProjectConfig = isMultipleProjectConfig;
function isSingleProjectConfig(config) {
return config.schema !== undefined;
}
exports.isSingleProjectConfig = isSingleProjectConfig;
function isLegacyProjectConfig(config) {

@@ -17,3 +18,2 @@ return (config.schemaPath !== undefined ||

}
exports.isLegacyProjectConfig = isLegacyProjectConfig;
function useMiddleware(fns) {

@@ -27,2 +27,1 @@ return (input) => {

}
exports.useMiddleware = useMiddleware;

@@ -105,3 +105,6 @@ "use strict";

exports.GraphQLProjectConfig = GraphQLProjectConfig;
// XXX: it works but uses nodejs - expose normalization of file and dir paths in config
function isSDLSchemaLike(schema) {
return schema.includes('\n');
}
// XXX: it works but uses Node.js - expose normalization of file and dir paths in config
function match(filepath, dirpath, pointer) {

@@ -115,2 +118,5 @@ if (!pointer) {

if (typeof pointer === 'string') {
if (isSDLSchemaLike(pointer)) {
return false;
}
const normalizedFilepath = (0, path_1.normalize)((0, path_1.isAbsolute)(filepath) ? (0, path_1.relative)(dirpath, filepath) : filepath);

@@ -117,0 +123,0 @@ return (0, minimatch_1.default)(normalizedFilepath, (0, path_1.normalize)(pointer), { dot: true });

@@ -43,4 +43,4 @@ import { createRequire } from 'module';

};
const loadYaml = createCustomLoader(defaultLoaders['.yaml']);
function prepareCosmiconfig(moduleName, legacy) {
const loadYaml = createCustomLoader(defaultLoaders['.yaml']);
const searchPlaces = [

@@ -52,2 +52,3 @@ '#.config.ts',

'#.config.cjs',
'#.config.mjs',
'#.config.json',

@@ -63,2 +64,3 @@ '#.config.yaml',

'.#rc.cjs',
'.#rc.mjs',
'.#rc.json',

@@ -79,6 +81,7 @@ '.#rc.yml',

'.ts': loadTypeScript,
'.cts': loadTypeScript,
'.mts': loadTypeScript,
'.cts': loadTypeScript,
'.js': defaultLoaders['.js'],
'.json': createCustomLoader(defaultLoaders['.json']),
'.js': loadTypeScript,
'.mjs': loadTypeScript,
'.json': defaultLoaders['.json'],
'.yaml': loadYaml,

@@ -85,0 +88,0 @@ '.yml': loadYaml,

@@ -100,3 +100,6 @@ import { dirname, isAbsolute, relative, normalize } from 'path';

}
// XXX: it works but uses nodejs - expose normalization of file and dir paths in config
function isSDLSchemaLike(schema) {
return schema.includes('\n');
}
// XXX: it works but uses Node.js - expose normalization of file and dir paths in config
function match(filepath, dirpath, pointer) {

@@ -110,2 +113,5 @@ if (!pointer) {

if (typeof pointer === 'string') {
if (isSDLSchemaLike(pointer)) {
return false;
}
const normalizedFilepath = normalize(isAbsolute(filepath) ? relative(dirpath, filepath) : filepath);

@@ -112,0 +118,0 @@ return minimatch(normalizedFilepath, normalize(pointer), { dot: true });

{
"name": "graphql-config",
"version": "5.0.3",
"version": "5.1.0",
"description": "The easiest way to configure your development environment with your GraphQL schema (supported by most tools, editors & IDEs)",

@@ -5,0 +5,0 @@ "sideEffects": false,

@@ -1,3 +0,1 @@

[![GraphQL Conf 2023](/GraphQLConf-2023-Banner.png)](https://graphql.org/conf/)
![GraphQL Config](https://i.imgur.com/hw5tXw2.gif 'GraphQL Config')

@@ -4,0 +2,0 @@ [![npm version](https://badge.fury.io/js/graphql-config.svg)](https://npmjs.com/package/graphql-config)

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