@depup/graphql-codegen__cli 6.2.1-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +51 -0
  2. package/changes.json +90 -0
  3. package/cjs/bin.js +13 -0
  4. package/cjs/cli.js +64 -0
  5. package/cjs/codegen.js +388 -0
  6. package/cjs/config.js +370 -0
  7. package/cjs/documentTransforms.js +63 -0
  8. package/cjs/generate-and-save.js +153 -0
  9. package/cjs/graphql-config.js +67 -0
  10. package/cjs/hooks.js +93 -0
  11. package/cjs/index.js +13 -0
  12. package/cjs/init/helpers.js +90 -0
  13. package/cjs/init/index.js +62 -0
  14. package/cjs/init/plugins.js +136 -0
  15. package/cjs/init/questions.js +177 -0
  16. package/cjs/init/targets.js +45 -0
  17. package/cjs/init/types.js +15 -0
  18. package/cjs/load.js +102 -0
  19. package/cjs/package.json +1 -0
  20. package/cjs/plugins.js +43 -0
  21. package/cjs/presets.js +50 -0
  22. package/cjs/utils/abort-controller-polyfill.js +99 -0
  23. package/cjs/utils/cli-error.js +24 -0
  24. package/cjs/utils/debugging.js +22 -0
  25. package/cjs/utils/file-system.js +24 -0
  26. package/cjs/utils/get-latest-version.js +14 -0
  27. package/cjs/utils/helpers.js +12 -0
  28. package/cjs/utils/logger.js +24 -0
  29. package/cjs/utils/patterns.js +235 -0
  30. package/cjs/utils/watcher.js +244 -0
  31. package/esm/bin.js +11 -0
  32. package/esm/cli.js +37 -0
  33. package/esm/codegen.js +384 -0
  34. package/esm/config.js +357 -0
  35. package/esm/documentTransforms.js +59 -0
  36. package/esm/generate-and-save.js +149 -0
  37. package/esm/graphql-config.js +62 -0
  38. package/esm/hooks.js +89 -0
  39. package/esm/index.js +7 -0
  40. package/esm/init/helpers.js +82 -0
  41. package/esm/init/index.js +59 -0
  42. package/esm/init/plugins.js +133 -0
  43. package/esm/init/questions.js +172 -0
  44. package/esm/init/targets.js +42 -0
  45. package/esm/init/types.js +12 -0
  46. package/esm/load.js +97 -0
  47. package/esm/plugins.js +40 -0
  48. package/esm/presets.js +47 -0
  49. package/esm/utils/abort-controller-polyfill.js +96 -0
  50. package/esm/utils/cli-error.js +20 -0
  51. package/esm/utils/debugging.js +17 -0
  52. package/esm/utils/file-system.js +17 -0
  53. package/esm/utils/get-latest-version.js +11 -0
  54. package/esm/utils/helpers.js +9 -0
  55. package/esm/utils/logger.js +18 -0
  56. package/esm/utils/patterns.js +226 -0
  57. package/esm/utils/watcher.js +239 -0
  58. package/package.json +205 -0
  59. package/typings/bin.d.cts +2 -0
  60. package/typings/bin.d.ts +2 -0
  61. package/typings/cli.d.cts +2 -0
  62. package/typings/cli.d.ts +2 -0
  63. package/typings/codegen.d.cts +6 -0
  64. package/typings/codegen.d.ts +6 -0
  65. package/typings/config.d.cts +152 -0
  66. package/typings/config.d.ts +152 -0
  67. package/typings/documentTransforms.d.cts +3 -0
  68. package/typings/documentTransforms.d.ts +3 -0
  69. package/typings/generate-and-save.d.cts +10 -0
  70. package/typings/generate-and-save.d.ts +10 -0
  71. package/typings/graphql-config.d.cts +3 -0
  72. package/typings/graphql-config.d.ts +3 -0
  73. package/typings/hooks.d.cts +11 -0
  74. package/typings/hooks.d.ts +11 -0
  75. package/typings/index.d.cts +8 -0
  76. package/typings/index.d.ts +8 -0
  77. package/typings/init/helpers.d.cts +10 -0
  78. package/typings/init/helpers.d.ts +10 -0
  79. package/typings/init/index.d.cts +1 -0
  80. package/typings/init/index.d.ts +1 -0
  81. package/typings/init/plugins.d.cts +2 -0
  82. package/typings/init/plugins.d.ts +2 -0
  83. package/typings/init/questions.d.cts +13 -0
  84. package/typings/init/questions.d.ts +13 -0
  85. package/typings/init/targets.d.cts +2 -0
  86. package/typings/init/targets.d.ts +2 -0
  87. package/typings/init/types.d.cts +30 -0
  88. package/typings/init/types.d.ts +30 -0
  89. package/typings/load.d.cts +15 -0
  90. package/typings/load.d.ts +15 -0
  91. package/typings/plugins.d.cts +2 -0
  92. package/typings/plugins.d.ts +2 -0
  93. package/typings/presets.d.cts +5 -0
  94. package/typings/presets.d.ts +5 -0
  95. package/typings/utils/abort-controller-polyfill.d.cts +5 -0
  96. package/typings/utils/abort-controller-polyfill.d.ts +5 -0
  97. package/typings/utils/cli-error.d.cts +10 -0
  98. package/typings/utils/cli-error.d.ts +10 -0
  99. package/typings/utils/debugging.d.cts +3 -0
  100. package/typings/utils/debugging.d.ts +3 -0
  101. package/typings/utils/file-system.d.cts +8 -0
  102. package/typings/utils/file-system.d.ts +8 -0
  103. package/typings/utils/get-latest-version.d.cts +6 -0
  104. package/typings/utils/get-latest-version.d.ts +6 -0
  105. package/typings/utils/helpers.d.cts +1 -0
  106. package/typings/utils/helpers.d.ts +1 -0
  107. package/typings/utils/logger.d.cts +5 -0
  108. package/typings/utils/logger.d.ts +5 -0
  109. package/typings/utils/patterns.d.cts +91 -0
  110. package/typings/utils/patterns.d.ts +91 -0
  111. package/typings/utils/watcher.d.cts +16 -0
  112. package/typings/utils/watcher.d.ts +16 -0
@@ -0,0 +1,152 @@
1
+ import { Profiler, Types } from '@graphql-codegen/plugin-helpers';
2
+ import { GraphQLSchema } from 'graphql';
3
+ import { GraphQLConfig } from 'graphql-config';
4
+ export type CodegenConfig = Types.Config;
5
+ export type YamlCliFlags = {
6
+ config: string;
7
+ watch: boolean | string | string[];
8
+ require: string[];
9
+ overwrite: boolean;
10
+ project: string;
11
+ silent: boolean;
12
+ errorsOnly: boolean;
13
+ profile: boolean;
14
+ check?: boolean;
15
+ verbose?: boolean;
16
+ debug?: boolean;
17
+ ignoreNoDocuments?: boolean;
18
+ emitLegacyCommonJSImports?: boolean;
19
+ importExtension?: '' | `.${string}`;
20
+ };
21
+ export declare function generateSearchPlaces(moduleName: string): string[];
22
+ export type CodegenConfigLoader = (filepath: string, content: string) => Promise<Types.Config> | Types.Config;
23
+ export interface LoadCodegenConfigOptions {
24
+ /**
25
+ * The path to the config file or directory contains the config file.
26
+ * @default process.cwd()
27
+ */
28
+ configFilePath?: string;
29
+ /**
30
+ * The name of the config file
31
+ * @default codegen
32
+ */
33
+ moduleName?: string;
34
+ /**
35
+ * Additional search paths for the config file you want to check
36
+ */
37
+ searchPlaces?: string[];
38
+ /**
39
+ * @default codegen
40
+ */
41
+ packageProp?: string;
42
+ /**
43
+ * Overrides or extends the loaders for specific file extensions
44
+ */
45
+ loaders?: Record<string, CodegenConfigLoader>;
46
+ }
47
+ export interface LoadCodegenConfigResult {
48
+ filepath: string;
49
+ config: Types.Config;
50
+ isEmpty?: boolean;
51
+ }
52
+ export declare function loadCodegenConfig({ configFilePath, moduleName, searchPlaces: additionalSearchPlaces, packageProp, loaders: customLoaders, }: LoadCodegenConfigOptions): Promise<LoadCodegenConfigResult>;
53
+ export declare function loadContext(configFilePath?: string): Promise<CodegenContext> | never;
54
+ export declare function buildOptions(): {
55
+ c: {
56
+ alias: string;
57
+ type: "string";
58
+ describe: string;
59
+ };
60
+ w: {
61
+ alias: string;
62
+ describe: string;
63
+ coerce(watch: any): string | boolean | any[];
64
+ };
65
+ r: {
66
+ alias: string;
67
+ describe: string;
68
+ type: "array";
69
+ default: any[];
70
+ };
71
+ o: {
72
+ alias: string;
73
+ describe: string;
74
+ type: "boolean";
75
+ };
76
+ s: {
77
+ alias: string;
78
+ describe: string;
79
+ type: "boolean";
80
+ };
81
+ e: {
82
+ alias: string;
83
+ describe: string;
84
+ type: "boolean";
85
+ };
86
+ profile: {
87
+ describe: string;
88
+ type: "boolean";
89
+ };
90
+ p: {
91
+ alias: string;
92
+ describe: string;
93
+ type: "string";
94
+ };
95
+ v: {
96
+ alias: string;
97
+ describe: string;
98
+ type: "boolean";
99
+ default: boolean;
100
+ };
101
+ d: {
102
+ alias: string;
103
+ describe: string;
104
+ type: "boolean";
105
+ default: boolean;
106
+ };
107
+ 'emit-legacy-common-js-imports': {
108
+ describe: string;
109
+ type: "boolean";
110
+ };
111
+ 'import-extension': {
112
+ describe: string;
113
+ type: "string";
114
+ };
115
+ 'ignore-no-documents': {
116
+ describe: string;
117
+ type: "boolean";
118
+ };
119
+ };
120
+ export declare function parseArgv(argv?: string[]): YamlCliFlags;
121
+ export declare function createContext(cliFlags?: YamlCliFlags): Promise<CodegenContext>;
122
+ export declare function updateContextWithCliFlags(context: CodegenContext, cliFlags: YamlCliFlags): void;
123
+ export declare class CodegenContext {
124
+ private _config;
125
+ private _graphqlConfig?;
126
+ private config;
127
+ private _project?;
128
+ private _checkMode;
129
+ private _pluginContext;
130
+ cwd: string;
131
+ filepath: string;
132
+ profiler: Profiler;
133
+ profilerOutput?: string;
134
+ checkModeStaleFiles: any[];
135
+ constructor({ config, graphqlConfig, filepath, }: {
136
+ config?: Types.Config;
137
+ graphqlConfig?: GraphQLConfig;
138
+ filepath?: string;
139
+ });
140
+ useProject(name?: string): void;
141
+ getConfig<T>(extraConfig?: T): T & Types.Config;
142
+ updateConfig(config: Partial<Types.Config>): void;
143
+ enableCheckMode(): void;
144
+ get checkMode(): boolean;
145
+ useProfiler(): void;
146
+ getPluginContext(): {
147
+ [key: string]: any;
148
+ };
149
+ loadSchema(pointer: Types.Schema | Types.Schema[]): Promise<GraphQLSchema>;
150
+ loadDocuments(pointer: Types.OperationDocument[]): Promise<Types.DocumentFile[]>;
151
+ }
152
+ export declare function ensureContext(input: CodegenContext | Types.Config): CodegenContext;
@@ -0,0 +1,3 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ export declare function getDocumentTransform(documentTransform: Types.OutputDocumentTransform, loader: Types.PackageLoaderFn<Types.DocumentTransformObject>, defaultName: string): Promise<Types.ConfiguredDocumentTransform>;
3
+ export declare function getDocumentTransformByName(name: string, loader: Types.PackageLoaderFn<Types.DocumentTransformObject>): Promise<Types.DocumentTransformObject>;
@@ -0,0 +1,3 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ export declare function getDocumentTransform(documentTransform: Types.OutputDocumentTransform, loader: Types.PackageLoaderFn<Types.DocumentTransformObject>, defaultName: string): Promise<Types.ConfiguredDocumentTransform>;
3
+ export declare function getDocumentTransformByName(name: string, loader: Types.PackageLoaderFn<Types.DocumentTransformObject>): Promise<Types.DocumentTransformObject>;
@@ -0,0 +1,10 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ import { CodegenContext } from './config.cjs';
3
+ export declare function generate(input: CodegenContext | (Types.Config & {
4
+ cwd?: string;
5
+ }), saveToFile?: boolean): Promise<Types.FileOutput[]
6
+ /**
7
+ * When this function runs in watch mode, it'd return an empty promise that doesn't resolve until the watcher exits
8
+ * FIXME: this effectively makes the result `any`, which loses type-hints
9
+ */
10
+ | any>;
@@ -0,0 +1,10 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ import { CodegenContext } from './config.js';
3
+ export declare function generate(input: CodegenContext | (Types.Config & {
4
+ cwd?: string;
5
+ }), saveToFile?: boolean): Promise<Types.FileOutput[]
6
+ /**
7
+ * When this function runs in watch mode, it'd return an empty promise that doesn't resolve until the watcher exits
8
+ * FIXME: this effectively makes the result `any`, which loses type-hints
9
+ */
10
+ | any>;
@@ -0,0 +1,3 @@
1
+ import { GraphQLConfig, GraphQLExtensionDeclaration } from 'graphql-config';
2
+ export declare const CodegenExtension: GraphQLExtensionDeclaration;
3
+ export declare function findAndLoadGraphQLConfig(filepath?: string): Promise<GraphQLConfig | void>;
@@ -0,0 +1,3 @@
1
+ import { GraphQLConfig, GraphQLExtensionDeclaration } from 'graphql-config';
2
+ export declare const CodegenExtension: GraphQLExtensionDeclaration;
3
+ export declare function findAndLoadGraphQLConfig(filepath?: string): Promise<GraphQLConfig | void>;
@@ -0,0 +1,11 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ export declare const lifecycleHooks: (_hooks?: Partial<Types.LifecycleHooksDefinition>) => {
3
+ afterStart: () => Promise<void>;
4
+ onWatchTriggered: (event: string, path: string) => Promise<void>;
5
+ onError: (error: string) => Promise<void>;
6
+ afterOneFileWrite: (path: string) => Promise<void>;
7
+ afterAllFileWrite: (paths: string[]) => Promise<void>;
8
+ beforeOneFileWrite: (path: string, content: string) => Promise<string>;
9
+ beforeAllFileWrite: (paths: string[]) => Promise<void>;
10
+ beforeDone: () => Promise<void>;
11
+ };
@@ -0,0 +1,11 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ export declare const lifecycleHooks: (_hooks?: Partial<Types.LifecycleHooksDefinition>) => {
3
+ afterStart: () => Promise<void>;
4
+ onWatchTriggered: (event: string, path: string) => Promise<void>;
5
+ onError: (error: string) => Promise<void>;
6
+ afterOneFileWrite: (path: string) => Promise<void>;
7
+ afterAllFileWrite: (paths: string[]) => Promise<void>;
8
+ beforeOneFileWrite: (path: string, content: string) => Promise<string>;
9
+ beforeAllFileWrite: (paths: string[]) => Promise<void>;
10
+ beforeDone: () => Promise<void>;
11
+ };
@@ -0,0 +1,8 @@
1
+ export * from './cli.cjs';
2
+ export { executeCodegen } from './codegen.cjs';
3
+ export * from './config.cjs';
4
+ export { CodegenConfig } from './config.cjs';
5
+ export { generate } from './generate-and-save.cjs';
6
+ export * from './graphql-config.cjs';
7
+ export * from './init/index.cjs';
8
+ export * from './utils/cli-error.cjs';
@@ -0,0 +1,8 @@
1
+ export * from './cli.js';
2
+ export { executeCodegen } from './codegen.js';
3
+ export * from './config.js';
4
+ export { CodegenConfig } from './config.js';
5
+ export { generate } from './generate-and-save.js';
6
+ export * from './graphql-config.js';
7
+ export * from './init/index.js';
8
+ export * from './utils/cli-error.js';
@@ -0,0 +1,10 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ import { Answers } from './types.cjs';
3
+ export declare function writeConfig(answers: Answers, config: Types.Config): Promise<{
4
+ relativePath: string;
5
+ fullPath: string;
6
+ }>;
7
+ export declare function writePackage(answers: Answers, configLocation: string): Promise<void>;
8
+ export declare function bold(str: string): string;
9
+ export declare function grey(str: string): string;
10
+ export declare function italic(str: string): string;
@@ -0,0 +1,10 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ import { Answers } from './types.js';
3
+ export declare function writeConfig(answers: Answers, config: Types.Config): Promise<{
4
+ relativePath: string;
5
+ fullPath: string;
6
+ }>;
7
+ export declare function writePackage(answers: Answers, configLocation: string): Promise<void>;
8
+ export declare function bold(str: string): string;
9
+ export declare function grey(str: string): string;
10
+ export declare function italic(str: string): string;
@@ -0,0 +1 @@
1
+ export declare function init(): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function init(): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { PluginOption } from './types.cjs';
2
+ export declare const plugins: Array<PluginOption>;
@@ -0,0 +1,2 @@
1
+ import { PluginOption } from './types.js';
2
+ export declare const plugins: Array<PluginOption>;
@@ -0,0 +1,13 @@
1
+ import { type Answers, type PluginOption, Tags } from './types.cjs';
2
+ export declare function getAnswers(possibleTargets: Record<Tags, boolean>): Promise<Answers>;
3
+ export declare function getApplicationTypeChoices(possibleTargets: Record<Tags, boolean>): {
4
+ name: string;
5
+ key: string;
6
+ value: Tags[];
7
+ checked: boolean;
8
+ }[];
9
+ export declare function getPluginChoices(targets: Tags[]): {
10
+ name: string;
11
+ value: PluginOption;
12
+ checked: boolean;
13
+ }[];
@@ -0,0 +1,13 @@
1
+ import { type Answers, type PluginOption, Tags } from './types.js';
2
+ export declare function getAnswers(possibleTargets: Record<Tags, boolean>): Promise<Answers>;
3
+ export declare function getApplicationTypeChoices(possibleTargets: Record<Tags, boolean>): {
4
+ name: string;
5
+ key: string;
6
+ value: Tags[];
7
+ checked: boolean;
8
+ }[];
9
+ export declare function getPluginChoices(targets: Tags[]): {
10
+ name: string;
11
+ value: PluginOption;
12
+ checked: boolean;
13
+ }[];
@@ -0,0 +1,2 @@
1
+ import { Tags } from './types.cjs';
2
+ export declare function guessTargets(): Promise<Record<Tags, boolean>>;
@@ -0,0 +1,2 @@
1
+ import { Tags } from './types.js';
2
+ export declare function guessTargets(): Promise<Record<Tags, boolean>>;
@@ -0,0 +1,30 @@
1
+ export interface PluginOption {
2
+ name: string;
3
+ package: string;
4
+ value: string;
5
+ pathInRepo: string;
6
+ available(tags: Tags[]): boolean;
7
+ shouldBeSelected(tags: Tags[]): boolean;
8
+ defaultExtension: string;
9
+ }
10
+ export interface Answers {
11
+ targets: Tags[];
12
+ config: string;
13
+ plugins?: PluginOption[];
14
+ schema: string;
15
+ documents?: string;
16
+ output: string;
17
+ script: string;
18
+ introspection: boolean;
19
+ }
20
+ export declare enum Tags {
21
+ client = "Browser",
22
+ node = "Node",
23
+ typescript = "TypeScript",
24
+ flow = "Flow",
25
+ angular = "Angular",
26
+ stencil = "Stencil",
27
+ react = "React",
28
+ vue = "Vue",
29
+ graphqlRequest = "graphqlRequest"
30
+ }
@@ -0,0 +1,30 @@
1
+ export interface PluginOption {
2
+ name: string;
3
+ package: string;
4
+ value: string;
5
+ pathInRepo: string;
6
+ available(tags: Tags[]): boolean;
7
+ shouldBeSelected(tags: Tags[]): boolean;
8
+ defaultExtension: string;
9
+ }
10
+ export interface Answers {
11
+ targets: Tags[];
12
+ config: string;
13
+ plugins?: PluginOption[];
14
+ schema: string;
15
+ documents?: string;
16
+ output: string;
17
+ script: string;
18
+ introspection: boolean;
19
+ }
20
+ export declare enum Tags {
21
+ client = "Browser",
22
+ node = "Node",
23
+ typescript = "TypeScript",
24
+ flow = "Flow",
25
+ angular = "Angular",
26
+ stencil = "Stencil",
27
+ react = "React",
28
+ vue = "Vue",
29
+ graphqlRequest = "graphqlRequest"
30
+ }
@@ -0,0 +1,15 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ import { UnnormalizedTypeDefPointer } from '@graphql-tools/load';
3
+ import { GraphQLSchema } from 'graphql';
4
+ export declare const defaultSchemaLoadOptions: {
5
+ assumeValidSDL: boolean;
6
+ sort: boolean;
7
+ convertExtensions: boolean;
8
+ includeSources: boolean;
9
+ };
10
+ export declare const defaultDocumentsLoadOptions: {
11
+ sort: boolean;
12
+ skipGraphQLImport: boolean;
13
+ };
14
+ export declare function loadSchema(schemaPointers: UnnormalizedTypeDefPointer | UnnormalizedTypeDefPointer[], config: Types.Config): Promise<GraphQLSchema>;
15
+ export declare function loadDocuments(documentPointers: UnnormalizedTypeDefPointer | UnnormalizedTypeDefPointer[], config: Types.Config): Promise<Types.DocumentFile[]>;
@@ -0,0 +1,15 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ import { UnnormalizedTypeDefPointer } from '@graphql-tools/load';
3
+ import { GraphQLSchema } from 'graphql';
4
+ export declare const defaultSchemaLoadOptions: {
5
+ assumeValidSDL: boolean;
6
+ sort: boolean;
7
+ convertExtensions: boolean;
8
+ includeSources: boolean;
9
+ };
10
+ export declare const defaultDocumentsLoadOptions: {
11
+ sort: boolean;
12
+ skipGraphQLImport: boolean;
13
+ };
14
+ export declare function loadSchema(schemaPointers: UnnormalizedTypeDefPointer | UnnormalizedTypeDefPointer[], config: Types.Config): Promise<GraphQLSchema>;
15
+ export declare function loadDocuments(documentPointers: UnnormalizedTypeDefPointer | UnnormalizedTypeDefPointer[], config: Types.Config): Promise<Types.DocumentFile[]>;
@@ -0,0 +1,2 @@
1
+ import { CodegenPlugin, Types } from '@graphql-codegen/plugin-helpers';
2
+ export declare function getPluginByName(name: string, pluginLoader: Types.PackageLoaderFn<CodegenPlugin>): Promise<CodegenPlugin>;
@@ -0,0 +1,2 @@
1
+ import { CodegenPlugin, Types } from '@graphql-codegen/plugin-helpers';
2
+ export declare function getPluginByName(name: string, pluginLoader: Types.PackageLoaderFn<CodegenPlugin>): Promise<CodegenPlugin>;
@@ -0,0 +1,5 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ export declare function getPresetByName(name: string, loader: Types.PackageLoaderFn<{
3
+ preset?: Types.OutputPreset;
4
+ default?: Types.OutputPreset;
5
+ }>): Promise<Types.OutputPreset>;
@@ -0,0 +1,5 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ export declare function getPresetByName(name: string, loader: Types.PackageLoaderFn<{
3
+ preset?: Types.OutputPreset;
4
+ default?: Types.OutputPreset;
5
+ }>): Promise<Types.OutputPreset>;
@@ -0,0 +1,5 @@
1
+ declare const AbortController: {
2
+ new (): AbortController;
3
+ prototype: AbortController;
4
+ };
5
+ export { AbortController };
@@ -0,0 +1,5 @@
1
+ declare const AbortController: {
2
+ new (): AbortController;
3
+ prototype: AbortController;
4
+ };
5
+ export { AbortController };
@@ -0,0 +1,10 @@
1
+ type CompositeError = Error;
2
+ type ListrError = Error & {
3
+ errors: CompositeError[];
4
+ };
5
+ export declare function isListrError(err: Error & {
6
+ name?: unknown;
7
+ errors?: unknown;
8
+ }): err is ListrError;
9
+ export declare function cliError(err: any, exitOnError?: boolean): void;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ type CompositeError = Error;
2
+ type ListrError = Error & {
3
+ errors: CompositeError[];
4
+ };
5
+ export declare function isListrError(err: Error & {
6
+ name?: unknown;
7
+ errors?: unknown;
8
+ }): err is ListrError;
9
+ export declare function cliError(err: any, exitOnError?: boolean): void;
10
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare function debugLog(message: string, ...meta: any[]): void;
2
+ export declare function printLogs(): void;
3
+ export declare function resetLogs(): void;
@@ -0,0 +1,3 @@
1
+ export declare function debugLog(message: string, ...meta: any[]): void;
2
+ export declare function printLogs(): void;
3
+ export declare function resetLogs(): void;
@@ -0,0 +1,8 @@
1
+ import { promises } from 'fs';
2
+ declare const fsAccess: typeof promises.access;
3
+ export declare function access(...args: Parameters<typeof fsAccess>): Promise<void>;
4
+ export declare function writeFile(filepath: string, content: string): Promise<void>;
5
+ export declare function readFile(filepath: string): Promise<string>;
6
+ export declare function unlinkFile(filePath: string, cb?: (err?: Error) => any): void;
7
+ export declare function mkdirp(filePath: string): Promise<string>;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import { promises } from 'fs';
2
+ declare const fsAccess: typeof promises.access;
3
+ export declare function access(...args: Parameters<typeof fsAccess>): Promise<void>;
4
+ export declare function writeFile(filepath: string, content: string): Promise<void>;
5
+ export declare function readFile(filepath: string): Promise<string>;
6
+ export declare function unlinkFile(filePath: string, cb?: (err?: Error) => any): void;
7
+ export declare function mkdirp(filePath: string): Promise<string>;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Fetches the version directly from the registry instead of depending on
3
+ * an ESM only module as latest-version does.
4
+ * @param packageName
5
+ */
6
+ export declare function getLatestVersion(packageName: string): Promise<string>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Fetches the version directly from the registry instead of depending on
3
+ * an ESM only module as latest-version does.
4
+ * @param packageName
5
+ */
6
+ export declare function getLatestVersion(packageName: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function isURL(str: string): boolean;
@@ -0,0 +1 @@
1
+ export declare function isURL(str: string): boolean;
@@ -0,0 +1,5 @@
1
+ import { Logger } from 'ts-log';
2
+ export declare function getLogger(): Logger;
3
+ export declare function setLogger(newLogger: Logger): void;
4
+ export declare function setSilentLogger(): void;
5
+ export declare function useWinstonLogger(): void;
@@ -0,0 +1,5 @@
1
+ import { Logger } from 'ts-log';
2
+ export declare function getLogger(): Logger;
3
+ export declare function setLogger(newLogger: Logger): void;
4
+ export declare function setSilentLogger(): void;
5
+ export declare function useWinstonLogger(): void;
@@ -0,0 +1,91 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ import { CodegenContext } from '../config.cjs';
3
+ type NegatedPattern = `!${string}`;
4
+ /**
5
+ * Flatten a list of pattern sets to be a list of only the affirmative patterns
6
+ * are contained in all of them.
7
+ *
8
+ * This can be used, for example, to find the "longest common prefix directory"
9
+ * by examining `mm.scan(pattern).base` for each `pattern`.
10
+ */
11
+ export declare const allAffirmativePatternsFromPatternSets: (patternSets: PatternSet[]) => string[];
12
+ /**
13
+ * Create a rebuild trigger that follows the algorithm described here:
14
+ * https://github.com/dotansimha/graphql-code-generator/issues/9270#issuecomment-1496765045
15
+ *
16
+ * There is a flow chart diagram in that comment.
17
+ *
18
+ * Basically:
19
+ *
20
+ * * "Global" patterns are defined at top level of config file, and "local"
21
+ * patterns are defined for each output target
22
+ * * Each pattern can have "watch", "documents", and "schemas"
23
+ * * Watch patterns (global and local) always take precedence over documents and
24
+ * schemas patterns, i.e. a watch negation always negates, and a watch match is
25
+ * a match even if it would be negated by some pattern in documents or schemas
26
+ * * The trigger returns true if any output target's local patterns result in
27
+ * a match, after considering the precedence of any global and local negations
28
+ */
29
+ export declare const makeShouldRebuild: ({ globalPatternSet, localPatternSets, }: {
30
+ globalPatternSet: PatternSet;
31
+ localPatternSets: PatternSet[];
32
+ }) => ({ path: absolutePath }: {
33
+ path: string;
34
+ }) => boolean;
35
+ /**
36
+ * Create the pattern set for the "global" (top level) config.
37
+ *
38
+ * In the `shouldRebuild` algorithm, any of these watch patterns will take
39
+ * precedence over local configs, and any schemas and documents patterns will be
40
+ * mixed into the pattern set of each local config.
41
+ */
42
+ export declare const makeGlobalPatternSet: (initialContext: CodegenContext) => {
43
+ watch: SortedPatterns<string>;
44
+ schemas: SortedPatterns<string>;
45
+ documents: SortedPatterns<string>;
46
+ };
47
+ /**
48
+ * Create the pattern set for a "local" (output target) config
49
+ *
50
+ * In the `shouldRebuild` algorithm, any of these watch patterns will take
51
+ * precedence over documents or schemas patterns, and the documents and schemas
52
+ * patterns will be mixed into the pattern set of their respective gobal pattern
53
+ * set equivalents.
54
+ */
55
+ export declare const makeLocalPatternSet: (conf: Types.ConfiguredOutput) => {
56
+ watch: SortedPatterns<string>;
57
+ documents: SortedPatterns<string>;
58
+ schemas: SortedPatterns<string>;
59
+ };
60
+ /**
61
+ * Given a list of micromatch patterns, sort them into `patterns` (all of them),
62
+ * `affirmative` (only the affirmative patterns), and `negated` (only the negated patterns)
63
+ *
64
+ * @param patterns List of micromatch patterns
65
+ */
66
+ export declare const sortPatterns: <P extends string | NegatedPattern>(patterns: P[]) => SortedPatterns<P>;
67
+ /**
68
+ * A type that "sorts" (or "groups") patterns. For a given list of `patterns`,
69
+ * this type will include the original list in `patterns`, all of its
70
+ * "affirmative" (non-negated) patterns in `affirmative`, and all of its
71
+ * "negated" patterns in `negated`
72
+ */
73
+ type SortedPatterns<PP extends string | NegatedPattern = string | NegatedPattern> = {
74
+ /** List of patterns, which could include both negated and affirmative patterns */
75
+ patterns: PP[];
76
+ /** List of only the affirmative (non-negated) patterns in `patterns` */
77
+ affirmative: PP[];
78
+ /** List of only the negated patterns in `patterns` */
79
+ negated: Extract<PP, NegatedPattern>[];
80
+ };
81
+ /**
82
+ * The global (top-level) config and each local (output target) config can have
83
+ * patterns which are separable into "watch" (always takes precedence), "documents",
84
+ * and "schemas". This type can hold sorted versions of these patterns.
85
+ */
86
+ type PatternSet = {
87
+ watch: SortedPatterns;
88
+ documents: SortedPatterns;
89
+ schemas: SortedPatterns;
90
+ };
91
+ export {};