@graphql-tools/graphql-file-loader
Advanced tools
+7
-10
@@ -24,3 +24,3 @@ 'use strict'; | ||
| const normalizedFilePath = path.isAbsolute(pointer) ? pointer : path.resolve(options.cwd, pointer); | ||
| return new Promise(resolve => fsExtra.exists(normalizedFilePath, resolve)); | ||
| return fsExtra.pathExists(normalizedFilePath); | ||
| } | ||
@@ -34,3 +34,3 @@ } | ||
| const normalizedFilePath = path.isAbsolute(pointer) ? pointer : path.resolve(options.cwd, pointer); | ||
| return fsExtra.existsSync(normalizedFilePath); | ||
| return fsExtra.pathExistsSync(normalizedFilePath); | ||
| } | ||
@@ -43,9 +43,3 @@ } | ||
| const rawSDL = await fsExtra.readFile(normalizedFilePath, { encoding: 'utf8' }); | ||
| if (isGraphQLImportFile(rawSDL)) { | ||
| return { | ||
| location: pointer, | ||
| document: _import.processImport(pointer, options.cwd), | ||
| }; | ||
| } | ||
| return utils.parseGraphQLSDL(pointer, rawSDL.trim(), options); | ||
| return this.handleFileContent(rawSDL, pointer, options); | ||
| } | ||
@@ -56,3 +50,6 @@ loadSync(pointer, options) { | ||
| const rawSDL = fsExtra.readFileSync(normalizedFilePath, { encoding: 'utf8' }); | ||
| if (isGraphQLImportFile(rawSDL)) { | ||
| return this.handleFileContent(rawSDL, pointer, options); | ||
| } | ||
| handleFileContent(rawSDL, pointer, options) { | ||
| if (!options.skipGraphQLImport && isGraphQLImportFile(rawSDL)) { | ||
| return { | ||
@@ -59,0 +56,0 @@ location: pointer, |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.cjs.js","sources":["../../../dist/loaders/graphql-file/src/index.js"],"sourcesContent":["import { isValidPath, parseGraphQLSDL, } from '@graphql-tools/utils';\nimport { isAbsolute, resolve } from 'path';\nimport { exists, existsSync, readFile, readFileSync } from 'fs-extra';\nimport { cwd as processCwd } from 'process';\nimport { processImport } from '@graphql-tools/import';\nconst FILE_EXTENSIONS = ['.gql', '.gqls', '.graphql', '.graphqls'];\nfunction isGraphQLImportFile(rawSDL) {\n const trimmedRawSDL = rawSDL.trim();\n return trimmedRawSDL.startsWith('# import') || trimmedRawSDL.startsWith('#import');\n}\nexport class GraphQLFileLoader {\n loaderId() {\n return 'graphql-file';\n }\n async canLoad(pointer, options) {\n if (isValidPath(pointer)) {\n if (FILE_EXTENSIONS.find(extension => pointer.endsWith(extension))) {\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd, pointer);\n return new Promise(resolve => exists(normalizedFilePath, resolve));\n }\n }\n return false;\n }\n canLoadSync(pointer, options) {\n if (isValidPath(pointer)) {\n if (FILE_EXTENSIONS.find(extension => pointer.endsWith(extension))) {\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd, pointer);\n return existsSync(normalizedFilePath);\n }\n }\n return false;\n }\n async load(pointer, options) {\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd, pointer);\n const rawSDL = await readFile(normalizedFilePath, { encoding: 'utf8' });\n if (isGraphQLImportFile(rawSDL)) {\n return {\n location: pointer,\n document: processImport(pointer, options.cwd),\n };\n }\n return parseGraphQLSDL(pointer, rawSDL.trim(), options);\n }\n loadSync(pointer, options) {\n const cwd = options.cwd || processCwd();\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(cwd, pointer);\n const rawSDL = readFileSync(normalizedFilePath, { encoding: 'utf8' });\n if (isGraphQLImportFile(rawSDL)) {\n return {\n location: pointer,\n document: processImport(pointer, options.cwd),\n };\n }\n return parseGraphQLSDL(pointer, rawSDL.trim(), options);\n }\n}\n//# sourceMappingURL=index.js.map"],"names":["isValidPath","isAbsolute","resolve","exists","existsSync","readFile","processImport","parseGraphQLSDL","processCwd","readFileSync"],"mappings":";;;;;;;;;;AAKA,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;AACnE,SAAS,mBAAmB,CAAC,MAAM,EAAE;AACrC,IAAI,MAAM,aAAa,GAAG,MAAM,CAAC,IAA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K;AACL;;;;"} | ||
| {"version":3,"file":"index.cjs.js","sources":["../../../dist/loaders/graphql-file/src/index.js"],"sourcesContent":["import { isValidPath, parseGraphQLSDL, } from '@graphql-tools/utils';\nimport { isAbsolute, resolve } from 'path';\nimport { readFile, readFileSync, pathExists, pathExistsSync } from 'fs-extra';\nimport { cwd as processCwd } from 'process';\nimport { processImport } from '@graphql-tools/import';\nconst FILE_EXTENSIONS = ['.gql', '.gqls', '.graphql', '.graphqls'];\nfunction isGraphQLImportFile(rawSDL) {\n const trimmedRawSDL = rawSDL.trim();\n return trimmedRawSDL.startsWith('# import') || trimmedRawSDL.startsWith('#import');\n}\nexport class GraphQLFileLoader {\n loaderId() {\n return 'graphql-file';\n }\n async canLoad(pointer, options) {\n if (isValidPath(pointer)) {\n if (FILE_EXTENSIONS.find(extension => pointer.endsWith(extension))) {\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd, pointer);\n return pathExists(normalizedFilePath);\n }\n }\n return false;\n }\n canLoadSync(pointer, options) {\n if (isValidPath(pointer)) {\n if (FILE_EXTENSIONS.find(extension => pointer.endsWith(extension))) {\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd, pointer);\n return pathExistsSync(normalizedFilePath);\n }\n }\n return false;\n }\n async load(pointer, options) {\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd, pointer);\n const rawSDL = await readFile(normalizedFilePath, { encoding: 'utf8' });\n return this.handleFileContent(rawSDL, pointer, options);\n }\n loadSync(pointer, options) {\n const cwd = options.cwd || processCwd();\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(cwd, pointer);\n const rawSDL = readFileSync(normalizedFilePath, { encoding: 'utf8' });\n return this.handleFileContent(rawSDL, pointer, options);\n }\n handleFileContent(rawSDL, pointer, options) {\n if (!options.skipGraphQLImport && isGraphQLImportFile(rawSDL)) {\n return {\n location: pointer,\n document: processImport(pointer, options.cwd),\n };\n }\n return parseGraphQLSDL(pointer, rawSDL.trim(), options);\n }\n}\n//# sourceMappingURL=index.js.map"],"names":["isValidPath","isAbsolute","resolve","pathExists","pathExistsSync","readFile","processCwd","readFileSync","processImport","parseGraphQLSDL"],"mappings":";;;;;;;;;;AAKA,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;AACnE,SAAS,mBAAmB,CAAC,MAAM,EAAE;AACrC,IAAI,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;AACxC,IAAI,OAAO,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACvF,CAAC;AACM,MAAM,iBAAiB,CAAC;AAC/B,IAAI,QAAQ,GAAG;AACf,QAAQ,OAAO,cAAc,CAAC;AAC9B,KAAK;AACL,IAAI,MAAM,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE;AACpC,QAAQ,IAAIA,iBAAW,CAAC,OAAO,CAAC,EAAE;AAClC,YAAY,IAAI,eAAe,CAAC,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE;AAChF,gBAAgB,MAAM,kBAAkB,GAAGC,eAAU,CAAC,OAAO,CAAC,GAAG,OAAO,GAAGC,YAAO,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACzG,gBAAgB,OAAOC,kBAAU,CAAC,kBAAkB,CAAC,CAAC;AACtD,aAAa;AACb,SAAS;AACT,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE;AAClC,QAAQ,IAAIH,iBAAW,CAAC,OAAO,CAAC,EAAE;AAClC,YAAY,IAAI,eAAe,CAAC,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE;AAChF,gBAAgB,MAAM,kBAAkB,GAAGC,e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gBAAgB,QAAQ,EAAE,OAAO;AACjC,gBAAgB,QAAQ,EAAEC,qBAAa,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC;AAC7D,aAAa,CAAC;AACd,SAAS;AACT,QAAQ,OAAOC,qBAAe,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;AAChE,KAAK;AACL;;;;"} |
+9
-0
| import { Source, UniversalLoader, DocumentPointerSingle, SchemaPointerSingle, SingleFileOptions } from '@graphql-tools/utils'; | ||
| export interface GraphQLFileLoaderOptions extends SingleFileOptions { | ||
| skipGraphQLImport?: boolean; | ||
| } | ||
@@ -10,2 +11,10 @@ export declare class GraphQLFileLoader implements UniversalLoader<GraphQLFileLoaderOptions> { | ||
| loadSync(pointer: SchemaPointerSingle | DocumentPointerSingle, options: GraphQLFileLoaderOptions): Source; | ||
| handleFileContent(rawSDL: string, pointer: string, options: GraphQLFileLoaderOptions): { | ||
| location: string; | ||
| document: import("graphql").DocumentNode; | ||
| rawSDL: string; | ||
| } | { | ||
| location: string; | ||
| document: import("graphql").DocumentNode; | ||
| }; | ||
| } |
+8
-11
| import { isValidPath, parseGraphQLSDL } from '@graphql-tools/utils'; | ||
| import { isAbsolute, resolve } from 'path'; | ||
| import { exists, existsSync, readFile, readFileSync } from 'fs-extra'; | ||
| import { pathExists, pathExistsSync, readFile, readFileSync } from 'fs-extra'; | ||
| import { cwd } from 'process'; | ||
@@ -20,3 +20,3 @@ import { processImport } from '@graphql-tools/import'; | ||
| const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd, pointer); | ||
| return new Promise(resolve => exists(normalizedFilePath, resolve)); | ||
| return pathExists(normalizedFilePath); | ||
| } | ||
@@ -30,3 +30,3 @@ } | ||
| const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd, pointer); | ||
| return existsSync(normalizedFilePath); | ||
| return pathExistsSync(normalizedFilePath); | ||
| } | ||
@@ -39,9 +39,3 @@ } | ||
| const rawSDL = await readFile(normalizedFilePath, { encoding: 'utf8' }); | ||
| if (isGraphQLImportFile(rawSDL)) { | ||
| return { | ||
| location: pointer, | ||
| document: processImport(pointer, options.cwd), | ||
| }; | ||
| } | ||
| return parseGraphQLSDL(pointer, rawSDL.trim(), options); | ||
| return this.handleFileContent(rawSDL, pointer, options); | ||
| } | ||
@@ -52,3 +46,6 @@ loadSync(pointer, options) { | ||
| const rawSDL = readFileSync(normalizedFilePath, { encoding: 'utf8' }); | ||
| if (isGraphQLImportFile(rawSDL)) { | ||
| return this.handleFileContent(rawSDL, pointer, options); | ||
| } | ||
| handleFileContent(rawSDL, pointer, options) { | ||
| if (!options.skipGraphQLImport && isGraphQLImportFile(rawSDL)) { | ||
| return { | ||
@@ -55,0 +52,0 @@ location: pointer, |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.esm.js","sources":["../../../dist/loaders/graphql-file/src/index.js"],"sourcesContent":["import { isValidPath, parseGraphQLSDL, } from '@graphql-tools/utils';\nimport { isAbsolute, resolve } from 'path';\nimport { exists, existsSync, readFile, readFileSync } from 'fs-extra';\nimport { cwd as processCwd } from 'process';\nimport { processImport } from '@graphql-tools/import';\nconst FILE_EXTENSIONS = ['.gql', '.gqls', '.graphql', '.graphqls'];\nfunction isGraphQLImportFile(rawSDL) {\n const trimmedRawSDL = rawSDL.trim();\n return trimmedRawSDL.startsWith('# import') || trimmedRawSDL.startsWith('#import');\n}\nexport class GraphQLFileLoader {\n loaderId() {\n return 'graphql-file';\n }\n async canLoad(pointer, options) {\n if (isValidPath(pointer)) {\n if (FILE_EXTENSIONS.find(extension => pointer.endsWith(extension))) {\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd, pointer);\n return new Promise(resolve => exists(normalizedFilePath, resolve));\n }\n }\n return false;\n }\n canLoadSync(pointer, options) {\n if (isValidPath(pointer)) {\n if (FILE_EXTENSIONS.find(extension => pointer.endsWith(extension))) {\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd, pointer);\n return existsSync(normalizedFilePath);\n }\n }\n return false;\n }\n async load(pointer, options) {\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd, pointer);\n const rawSDL = await readFile(normalizedFilePath, { encoding: 'utf8' });\n if (isGraphQLImportFile(rawSDL)) {\n return {\n location: pointer,\n document: processImport(pointer, options.cwd),\n };\n }\n return parseGraphQLSDL(pointer, rawSDL.trim(), options);\n }\n loadSync(pointer, options) {\n const cwd = options.cwd || processCwd();\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(cwd, pointer);\n const rawSDL = readFileSync(normalizedFilePath, { encoding: 'utf8' });\n if (isGraphQLImportFile(rawSDL)) {\n return {\n location: pointer,\n document: processImport(pointer, options.cwd),\n };\n }\n return parseGraphQLSDL(pointer, rawSDL.trim(), options);\n }\n}\n//# sourceMappingURL=index.js.map"],"names":["cwd","processCwd"],"mappings":";;;;;;AAKA,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;AACnE,SAAS,mBAAmB,CAAC,MAAM,EAAE;AACrC,IAAI,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;AACxC,IAAI,OAAO,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACvF,CAAC;AACM,MAAM,iBAAiB,CAAC;AAC/B,IAAI,QAAQ,GAAG;AACf,QAAQ,OAAO,cAAc,CAAC;AAC9B,KAAK;AACL,IAAI,MAAM,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE;AACpC,QAAQ,IAAI,WAAW,CAAC,OAAO,CAAC,EAAE;AAClC,YAAY,IAAI,eAAe,CAAC,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE;AAChF,gBAAgB,MAAM,kBAAkB,GAAG,UAAU,CAA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OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;AAChE,KAAK;AACL,IAAI,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE;AAC/B,QAAQ,MAAMA,KAAG,GAAG,OAAO,CAAC,GAAG,IAAIC,GAAU,EAAE,CAAC;AAChD,QAAQ,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,OAAO,CAACD,KAAG,EAAE,OAAO,CAAC,CAAC;AACzF,QAAQ,MAAM,MAAM,GAAG,YAAY,CAAC,kBAAkB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AAC9E,QAAQ,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE;AACzC,YAAY,OAAO;AACnB,gBAAgB,QAAQ,EAAE,OAAO;AACjC,gBAAgB,QAAQ,EAAE,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC;AAC7D,aAAa,CAAC;AACd,SAAS;AACT,QAAQ,OAAO,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;AAChE,KAAK;AACL;;;;"} | ||
| {"version":3,"file":"index.esm.js","sources":["../../../dist/loaders/graphql-file/src/index.js"],"sourcesContent":["import { isValidPath, parseGraphQLSDL, } from '@graphql-tools/utils';\nimport { isAbsolute, resolve } from 'path';\nimport { readFile, readFileSync, pathExists, pathExistsSync } from 'fs-extra';\nimport { cwd as processCwd } from 'process';\nimport { processImport } from '@graphql-tools/import';\nconst FILE_EXTENSIONS = ['.gql', '.gqls', '.graphql', '.graphqls'];\nfunction isGraphQLImportFile(rawSDL) {\n const trimmedRawSDL = rawSDL.trim();\n return trimmedRawSDL.startsWith('# import') || trimmedRawSDL.startsWith('#import');\n}\nexport class GraphQLFileLoader {\n loaderId() {\n return 'graphql-file';\n }\n async canLoad(pointer, options) {\n if (isValidPath(pointer)) {\n if (FILE_EXTENSIONS.find(extension => pointer.endsWith(extension))) {\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd, pointer);\n return pathExists(normalizedFilePath);\n }\n }\n return false;\n }\n canLoadSync(pointer, options) {\n if (isValidPath(pointer)) {\n if (FILE_EXTENSIONS.find(extension => pointer.endsWith(extension))) {\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd, pointer);\n return pathExistsSync(normalizedFilePath);\n }\n }\n return false;\n }\n async load(pointer, options) {\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd, pointer);\n const rawSDL = await readFile(normalizedFilePath, { encoding: 'utf8' });\n return this.handleFileContent(rawSDL, pointer, options);\n }\n loadSync(pointer, options) {\n const cwd = options.cwd || processCwd();\n const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(cwd, pointer);\n const rawSDL = readFileSync(normalizedFilePath, { encoding: 'utf8' });\n return this.handleFileContent(rawSDL, pointer, options);\n }\n handleFileContent(rawSDL, pointer, options) {\n if (!options.skipGraphQLImport && isGraphQLImportFile(rawSDL)) {\n return {\n location: pointer,\n document: processImport(pointer, options.cwd),\n };\n }\n return parseGraphQLSDL(pointer, rawSDL.trim(), options);\n }\n}\n//# sourceMappingURL=index.js.map"],"names":["cwd","processCwd"],"mappings":";;;;;;AAKA,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;AACnE,SAAS,mBAAmB,CAAC,MAAM,EAAE;AACrC,IAAI,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;AACxC,IAAI,OAAO,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACvF,CAAC;AACM,MAAM,iBAAiB,CAAC;AAC/B,IAAI,QAAQ,GAAG;AACf,QAAQ,OAAO,cAAc,CAAC;AAC9B,KAAK;AACL,IAAI,MAAM,OAAO,CAAC,OAAO,EAAE,O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AC,CAAC;AAChE,KAAK;AACL,IAAI,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE;AAC/B,QAAQ,MAAMA,KAAG,GAAG,OAAO,CAAC,GAAG,IAAIC,GAAU,EAAE,CAAC;AAChD,QAAQ,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,OAAO,CAACD,KAAG,EAAE,OAAO,CAAC,CAAC;AACzF,QAAQ,MAAM,MAAM,GAAG,YAAY,CAAC,kBAAkB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AAC9E,QAAQ,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAChE,KAAK;AACL,IAAI,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE;AAChD,QAAQ,IAAI,CAAC,OAAO,CAAC,iBAAiB,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE;AACvE,YAAY,OAAO;AACnB,gBAAgB,QAAQ,EAAE,OAAO;AACjC,gBAAgB,QAAQ,EAAE,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC;AAC7D,aAAa,CAAC;AACd,SAAS;AACT,QAAQ,OAAO,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;AAChE,KAAK;AACL;;;;"} |
+3
-3
| { | ||
| "name": "@graphql-tools/graphql-file-loader", | ||
| "version": "6.0.7-alpha-258b8cb.0", | ||
| "version": "6.0.7-alpha-3f2c64a.0", | ||
| "description": "A set of utils for faster development of GraphQL tools", | ||
@@ -10,4 +10,4 @@ "sideEffects": false, | ||
| "dependencies": { | ||
| "@graphql-tools/import": "6.0.7-alpha-258b8cb.0", | ||
| "@graphql-tools/utils": "6.0.7-alpha-258b8cb.0", | ||
| "@graphql-tools/import": "6.0.7-alpha-3f2c64a.0", | ||
| "@graphql-tools/utils": "6.0.7-alpha-3f2c64a.0", | ||
| "fs-extra": "9.0.0", | ||
@@ -14,0 +14,0 @@ "tslib": "~2.0.0" |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
131
2.34%16202
-0.16%+ Added
+ Added
- Removed
- Removed