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,QAAQ,gBAAgB,GAC1B,CACH,SAAU,EACV,SAAU,GAGX,IACX,CACA,SAAS,mBAAmB,EAAS,GACjC,OAAO,EAAI,OAAO,YAAY,GAAW,GAAU,EAAI,OAAO,SAAS,EAAQ,MAAO,EAAI,UAAU,OAAQ,EAChH,CArBA,QAAQ,eAAiB","file":"/npm/@graphql-tools/code-file-loader@8.1.32/cjs/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@graphql-tools/code-file-loader@8.1.32/cjs/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CodeFileLoader = void 0;\nconst tslib_1 = require(\"tslib\");\nconst fs_1 = require(\"fs\");\nconst module_1 = require(\"module\");\nconst path_1 = require(\"path\");\nconst process_1 = require(\"process\");\nconst globby_1 = tslib_1.__importDefault(require(\"globby\"));\nconst graphql_1 = require(\"graphql\");\nconst unixify_1 = tslib_1.__importDefault(require(\"unixify\"));\nconst graphql_tag_pluck_1 = require(\"@graphql-tools/graphql-tag-pluck\");\nconst utils_1 = require(\"@graphql-tools/utils\");\nconst load_from_module_js_1 = require(\"./load-from-module.js\");\nconst { readFile, access } = fs_1.promises;\nconst FILE_EXTENSIONS = [\n    '.ts',\n    '.mts',\n    '.cts',\n    '.tsx',\n    '.js',\n    '.mjs',\n    'cjs',\n    '.jsx',\n    '.vue',\n    '.svelte',\n    '.astro',\n    '.gts',\n    '.gjs',\n];\nfunction createGlobbyOptions(options) {\n    return { absolute: true, ...options, ignore: [] };\n}\nconst buildIgnoreGlob = (path) => `!${path}`;\n/**\n * This loader loads GraphQL documents and type definitions from code files\n * using `graphql-tag-pluck`.\n *\n * ```js\n * const documents = await loadDocuments('queries/*.js', {\n *   loaders: [\n *     new CodeFileLoader()\n *   ]\n * });\n * ```\n *\n * Supported extensions include: `.ts`, `.mts`, `.cts`, `.tsx`, `.js`, `.mjs`,\n * `.cjs`, `.jsx`, `.vue`, `.svelte`, `.astro`, `.gts`, `.gjs`.\n */\nclass CodeFileLoader {\n    config;\n    constructor(config) {\n        this.config = config ?? {};\n    }\n    getMergedOptions(options) {\n        return {\n            ...this.config,\n            ...options,\n            pluckConfig: { ...(this.config.pluckConfig || {}), ...(options.pluckConfig || {}) },\n        };\n    }\n    async canLoad(pointer, options) {\n        options = this.getMergedOptions(options);\n        if ((0, utils_1.isValidPath)(pointer)) {\n            if (FILE_EXTENSIONS.find(extension => pointer.endsWith(extension))) {\n                const normalizedFilePath = (0, path_1.isAbsolute)(pointer)\n                    ? pointer\n                    : (0, path_1.resolve)(options.cwd || (0, process_1.cwd)(), pointer);\n                try {\n                    await access(normalizedFilePath);\n                    return true;\n                }\n                catch {\n                    return false;\n                }\n            }\n        }\n        return false;\n    }\n    canLoadSync(pointer, options) {\n        options = this.getMergedOptions(options);\n        if ((0, utils_1.isValidPath)(pointer)) {\n            if (FILE_EXTENSIONS.find(extension => pointer.endsWith(extension))) {\n                const normalizedFilePath = (0, path_1.isAbsolute)(pointer)\n                    ? pointer\n                    : (0, path_1.resolve)(options.cwd || (0, process_1.cwd)(), pointer);\n                return (0, fs_1.existsSync)(normalizedFilePath);\n            }\n        }\n        return false;\n    }\n    _buildGlobs(glob, options) {\n        const ignores = (0, utils_1.asArray)(options.ignore || []);\n        const globs = [(0, unixify_1.default)(glob), ...ignores.map(v => buildIgnoreGlob((0, unixify_1.default)(v)))];\n        return globs;\n    }\n    async resolveGlobs(glob, options) {\n        options = this.getMergedOptions(options);\n        const globs = this._buildGlobs(glob, options);\n        return (0, globby_1.default)(globs, createGlobbyOptions(options));\n    }\n    resolveGlobsSync(glob, options) {\n        options = this.getMergedOptions(options);\n        const globs = this._buildGlobs(glob, options);\n        return globby_1.default.sync(globs, createGlobbyOptions(options));\n    }\n    async load(pointer, options) {\n        options = this.getMergedOptions(options);\n        const resolvedPaths = await this.resolveGlobs(pointer, options);\n        const finalResult = [];\n        const errors = [];\n        await Promise.all(resolvedPaths.map(async (path) => {\n            try {\n                const result = await this.handleSinglePath(path, options);\n                result?.forEach(result => finalResult.push(result));\n            }\n            catch (e) {\n                if (process_1.env['DEBUG']) {\n                    console.error(e);\n                }\n                errors.push(e);\n            }\n        }));\n        if (errors.length > 0 && (options.noSilentErrors || finalResult.length === 0)) {\n            if (errors.length === 1) {\n                throw errors[0];\n            }\n            throw new AggregateError(errors, `Reading from ${pointer} failed ; \\n ` + errors.map((e) => e.message).join('\\n'));\n        }\n        return finalResult;\n    }\n    loadSync(pointer, options) {\n        options = this.getMergedOptions(options);\n        const resolvedPaths = this.resolveGlobsSync(pointer, options);\n        const finalResult = [];\n        const errors = [];\n        for (const path of resolvedPaths) {\n            if (this.canLoadSync(path, options)) {\n                try {\n                    const result = this.handleSinglePathSync(path, options);\n                    result?.forEach(result => finalResult.push(result));\n                }\n                catch (e) {\n                    if (process_1.env['DEBUG']) {\n                        console.error(e);\n                    }\n                    errors.push(e);\n                }\n            }\n        }\n        if (errors.length > 0 && (options.noSilentErrors || finalResult.length === 0)) {\n            if (errors.length === 1) {\n                throw errors[0];\n            }\n            throw new AggregateError(errors, `Reading from ${pointer} failed ; \\n ` + errors.map((e) => e.message).join('\\n'));\n        }\n        return finalResult;\n    }\n    async handleSinglePath(location, options) {\n        if (!(await this.canLoad(location, options))) {\n            return [];\n        }\n        options = this.getMergedOptions(options);\n        const normalizedFilePath = ensureAbsolutePath(location, options);\n        const errors = [];\n        if (!options.noPluck) {\n            try {\n                const content = await readFile(normalizedFilePath, { encoding: 'utf-8' });\n                const sources = await (0, graphql_tag_pluck_1.gqlPluckFromCodeString)(normalizedFilePath, content, options.pluckConfig);\n                if (sources.length) {\n                    return sources.map(source => ({\n                        rawSDL: source.body,\n                        document: (0, graphql_1.parse)(source),\n                        location,\n                    }));\n                }\n            }\n            catch (e) {\n                if (process_1.env['DEBUG']) {\n                    console.error(`Failed to load schema from code file \"${normalizedFilePath}\": ${e.message}`);\n                }\n                errors.push(e);\n            }\n        }\n        if (!options.noRequire) {\n            try {\n                if (options && options.require) {\n                    await Promise.all((0, utils_1.asArray)(options.require).map(m => Promise.resolve(`${m}`).then(s => tslib_1.__importStar(require(s)))));\n                }\n                const loaded = await (0, load_from_module_js_1.tryToLoadFromExport)(normalizedFilePath);\n                const sources = (0, utils_1.asArray)(loaded)\n                    .map(value => resolveSource(location, value, options))\n                    .filter(Boolean);\n                if (sources.length) {\n                    return sources;\n                }\n            }\n            catch (e) {\n                errors.push(e);\n            }\n        }\n        if (errors.length > 0) {\n            throw errors[0];\n        }\n        return [];\n    }\n    handleSinglePathSync(location, options) {\n        if (!this.canLoadSync(location, options)) {\n            return [];\n        }\n        options = this.getMergedOptions(options);\n        const normalizedFilePath = ensureAbsolutePath(location, options);\n        const errors = [];\n        if (!options.noPluck) {\n            try {\n                const content = (0, fs_1.readFileSync)(normalizedFilePath, { encoding: 'utf-8' });\n                const sources = (0, graphql_tag_pluck_1.gqlPluckFromCodeStringSync)(normalizedFilePath, content, options.pluckConfig);\n                if (sources.length) {\n                    return sources.map(source => ({\n                        rawSDL: source.body,\n                        document: (0, graphql_1.parse)(source),\n                        location,\n                    }));\n                }\n            }\n            catch (e) {\n                if (process_1.env['DEBUG']) {\n                    console.error(`Failed to load schema from code file \"${normalizedFilePath}\": ${e.message}`);\n                }\n                errors.push(e);\n            }\n        }\n        if (!options.noRequire) {\n            try {\n                if (options && options.require) {\n                    const cwdRequire = (0, module_1.createRequire)(options.cwd || (0, process_1.cwd)());\n                    for (const m of (0, utils_1.asArray)(options.require)) {\n                        cwdRequire(m);\n                    }\n                }\n                const loaded = (0, load_from_module_js_1.tryToLoadFromExportSync)(normalizedFilePath);\n                const sources = (0, utils_1.asArray)(loaded)\n                    .map(value => resolveSource(location, value, options))\n                    .filter(Boolean);\n                if (sources.length) {\n                    return sources;\n                }\n            }\n            catch (e) {\n                errors.push(e);\n            }\n        }\n        if (errors.length > 0) {\n            throw errors[0];\n        }\n        return null;\n    }\n}\nexports.CodeFileLoader = CodeFileLoader;\nfunction resolveSource(pointer, value, options) {\n    if (typeof value === 'string') {\n        return (0, utils_1.parseGraphQLSDL)(pointer, value, options);\n    }\n    else if ((0, graphql_1.isSchema)(value)) {\n        return {\n            location: pointer,\n            schema: value,\n        };\n    }\n    else if ((0, utils_1.isDocumentNode)(value)) {\n        return {\n            location: pointer,\n            document: value,\n        };\n    }\n    return null;\n}\nfunction ensureAbsolutePath(pointer, options) {\n    return (0, path_1.isAbsolute)(pointer) ? pointer : (0, path_1.resolve)(options.cwd || (0, process_1.cwd)(), pointer);\n}\n"]}