@vladimirdev635/gql-codegen 0.0.38 → 0.0.40

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.
@@ -0,0 +1,3 @@
1
+ import { Formatter } from '../../shared.js';
2
+ import { LoadESLintFuncType } from './types.js';
3
+ export declare function buildESLintFormatter(loadFunc: LoadESLintFuncType): Promise<Formatter>;
@@ -0,0 +1,12 @@
1
+ import assert from 'assert';
2
+ export async function buildESLintFormatter(loadFunc) {
3
+ const ESLint = await loadFunc({ useFlatConfig: true });
4
+ const eslint = new ESLint({ fix: true });
5
+ return async (code) => {
6
+ const results = await eslint.lintText(code);
7
+ const result = results[0];
8
+ const formattedCode = result.output || result.source;
9
+ assert(formattedCode !== undefined);
10
+ return formattedCode;
11
+ };
12
+ }
@@ -0,0 +1,2 @@
1
+ export type { LintResult, ESLintClass, ESLintClassConstructor, LoadESLintFuncType } from './types.js';
2
+ export { buildESLintFormatter } from './formatter.js';
@@ -0,0 +1 @@
1
+ export { buildESLintFormatter } from './formatter.js';
@@ -0,0 +1,15 @@
1
+ export interface LintResult {
2
+ output?: string;
3
+ source?: string;
4
+ }
5
+ export interface ESLintClass {
6
+ lintText(code: string): Promise<LintResult[]>;
7
+ }
8
+ export interface ESLintClassConstructor {
9
+ new (opts: {
10
+ fix: boolean;
11
+ }): ESLintClass;
12
+ }
13
+ export type LoadESLintFuncType = (opts: {
14
+ useFlatConfig: boolean;
15
+ }) => Promise<ESLintClassConstructor>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * as eslint from './eslint/index.js';
@@ -0,0 +1 @@
1
+ export * as eslint from './eslint/index.js';
@@ -1,6 +1,6 @@
1
1
  import { PathOrFileDescriptor } from 'fs';
2
2
  import ts from 'typescript';
3
- import { Actor, ActorContext } from '@/config.js';
3
+ import { Actor, ActorContext } from '../../../config.js';
4
4
  import { TSActorConfig } from '../shared.js';
5
5
  export type OperationReturnType = 'ExecuteResult' | 'ExecuteResult.result';
6
6
  export interface SDKConfig {
@@ -1,4 +1,4 @@
1
- import { ActorContext } from '@/config.js';
1
+ import { ActorContext } from '../../../../config.js';
2
2
  import { GQLClientActorConfig } from '../actor.js';
3
3
  import ts from 'typescript';
4
4
  export declare function generateNodes(config: GQLClientActorConfig, context: ActorContext): ts.Node[];
@@ -1,5 +1,5 @@
1
1
  import { PathOrFileDescriptor } from 'fs';
2
- import { Actor, ActorContext } from '@/config.js';
2
+ import { Actor, ActorContext } from '../../../config.js';
3
3
  import { TSActorConfig } from '../shared.js';
4
4
  import ts from 'typescript';
5
5
  export interface GQLClientReactActorConfig extends TSActorConfig {
@@ -1,4 +1,4 @@
1
- import { ActorContext } from '@/config.js';
1
+ import { ActorContext } from '../../../../config.js';
2
2
  import { GQLClientReactActorConfig } from '../actor.js';
3
3
  import ts from 'typescript';
4
4
  export declare function generateNodes(config: GQLClientReactActorConfig, context: ActorContext): ts.Node[];
@@ -1,7 +1,7 @@
1
1
  import { ScalarsMapping } from './generators/server/scalars/index.js';
2
2
  import { PathOrFileDescriptor } from 'fs';
3
3
  import ts from 'typescript';
4
- import { Actor, ActorContext } from '@/config.js';
4
+ import { Actor, ActorContext } from '../../../config.js';
5
5
  import { TSActorConfig } from '../shared.js';
6
6
  export interface GraphqlActorConfig extends TSActorConfig {
7
7
  outPath: PathOrFileDescriptor;
@@ -1,6 +1,6 @@
1
1
  import ts from 'typescript';
2
- import { RootSchema } from '@/schema/root.js';
3
- import { FragmentSpecSchemaType, objectSelection } from '@/schema/client/fragment.js';
2
+ import { RootSchema } from '../../../../../schema/root.js';
3
+ import { FragmentSpecSchemaType, objectSelection } from '../../../../../schema/client/fragment.js';
4
4
  import { z } from 'zod/v4';
5
5
  import { ScalarsMapping } from '../server/scalars/mapping.js';
6
6
  export declare function extractFragmentNamesInSpec(schema: RootSchema, fragmentSpec: FragmentSpecSchemaType): string[];
@@ -1,4 +1,4 @@
1
1
  import ts from 'typescript';
2
- import { ActorContext } from '@/config.js';
2
+ import { ActorContext } from '../../../../../config.js';
3
3
  import { GraphqlActorConfig } from '../../actor.js';
4
4
  export declare function generateClientNodes(config: GraphqlActorConfig, context: ActorContext): ts.Node[];
@@ -1,6 +1,6 @@
1
1
  import ts from 'typescript';
2
- import { RootSchema } from '@/schema/root.js';
3
- import { operationSchema } from '@/schema/client/operation.js';
2
+ import { RootSchema } from '../../../../../schema/root.js';
3
+ import { operationSchema } from '../../../../../schema/client/operation.js';
4
4
  import { z } from 'zod/v4';
5
5
  import { ScalarsMapping } from '../server/scalars/mapping.js';
6
6
  export declare function opTypeToName(type: z.infer<typeof operationSchema>['type']): string;
@@ -1,4 +1,4 @@
1
1
  import ts from 'typescript';
2
- import { ActorContext } from '@/config.js';
2
+ import { ActorContext } from '../../../../config.js';
3
3
  import { GraphqlActorConfig } from '../actor.js';
4
4
  export declare function generateNodes(config: GraphqlActorConfig, context: ActorContext): ts.Node[];
@@ -1,4 +1,4 @@
1
1
  import { z } from 'zod/v4';
2
2
  import ts from 'typescript';
3
- import { enumSchema } from '@/schema/server.js';
3
+ import { enumSchema } from '../../../../../schema/server.js';
4
4
  export declare function generateEnumDefinition(e: z.infer<typeof enumSchema>): ts.EnumDeclaration;
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod/v4';
2
2
  import ts from 'typescript';
3
- import { inputSchema } from '@/schema/server.js';
4
- import { inputFieldSchema } from '@/schema/shared.js';
3
+ import { inputSchema } from '../../../../../schema/server.js';
4
+ import { inputFieldSchema } from '../../../../../schema/shared.js';
5
5
  import { ScalarsMapping } from './scalars/index.js';
6
6
  export declare function generateInputTypeDefinitionFields(scalarsMapping: ScalarsMapping, fields: Record<string, z.infer<typeof inputFieldSchema>>): ts.PropertyAssignment[];
7
7
  export declare function generateInputTypeDefinitions(scalarsMapping: ScalarsMapping, input: z.infer<typeof inputSchema>): ts.Node[];
@@ -1,4 +1,4 @@
1
1
  import ts from 'typescript';
2
2
  import { GraphqlActorConfig } from '../../actor.js';
3
- import { ActorContext } from '@/config.js';
3
+ import { ActorContext } from '../../../../../config.js';
4
4
  export declare function generateServerNodes(config: GraphqlActorConfig, context: ActorContext): ts.Node[];
@@ -1,6 +1,6 @@
1
1
  import { ScalarsMapping } from './scalars/mapping.js';
2
2
  import ts from 'typescript';
3
- import { objectFieldSchema, objectNonCallableFieldSpecSchema, objectSchema } from '@/schema/server.js';
3
+ import { objectFieldSchema, objectNonCallableFieldSpecSchema, objectSchema } from '../../../../../schema/server.js';
4
4
  import { z } from 'zod/v4';
5
5
  export declare function generateObjectNonCallableFieldSpec(scalarsMapping: ScalarsMapping, spec: z.infer<typeof objectNonCallableFieldSpecSchema>): ts.Expression;
6
6
  export declare function generateZodObjectFieldSpec(scalarsMapping: ScalarsMapping, field: z.infer<typeof objectFieldSchema>): ts.Expression;
@@ -1,6 +1,6 @@
1
1
  import ts from 'typescript';
2
2
  import { buildSymmetricScalarSpec } from './mapping.js';
3
- import { invokeMethod } from '@/actors/ts/shared.js';
3
+ import { invokeMethod } from '../../../../../../actors/ts/shared.js';
4
4
  import { builtinScalarsMapping } from './builtin.js';
5
5
  export const additionalScalarsMapping = {
6
6
  Int64: builtinScalarsMapping.Int,
@@ -1,7 +1,7 @@
1
1
  import ts from 'typescript';
2
2
  import { z } from 'zod/v4';
3
- import { objectNonCallableFieldSpecSchema } from '@/schema/server.js';
4
- import { inputFieldSpecSchema } from '@/schema/shared.js';
3
+ import { objectNonCallableFieldSpecSchema } from '../../../../../schema/server.js';
4
+ import { inputFieldSpecSchema } from '../../../../../schema/shared.js';
5
5
  export declare function generateNonCallableFieldSpec(scalars: string[], spec: z.infer<typeof objectNonCallableFieldSpecSchema> | z.infer<typeof inputFieldSpecSchema>): ts.TypeReferenceNode | ts.IndexedAccessTypeNode | ts.ArrayTypeNode;
6
6
  export declare function wrapInMaybeIfNullable(spec: ts.TypeNode, nullable: boolean): ts.TypeNode;
7
7
  export declare function generateZodInferTypeAlias(name: string, typeName: string): ts.TypeAliasDeclaration;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod/v4';
2
2
  import ts from 'typescript';
3
- import { objectSchema, unionSchema } from '@/schema/server.js';
3
+ import { objectSchema, unionSchema } from '../../../../../schema/server.js';
4
4
  import { ScalarsMapping } from './scalars/index.js';
5
5
  export declare function generateUnionTypeDefinitions(scalarsMapping: ScalarsMapping, objects: Record<string, z.infer<typeof objectSchema>>, union: z.infer<typeof unionSchema>): ts.Node[];
@@ -3,3 +3,4 @@ export * as gqlClientReact from './gql-client-react/index.js';
3
3
  export * as graphql from './graphql/index.js';
4
4
  export { type Formatter, type TSActorConfig, renderNodes, loadTsConfigCompilerOptions, addNewLineBetweenNodes, invokeMethod, } from './shared.js';
5
5
  export { generateImportDeclaration } from './utils.js';
6
+ export * as formatters from './formatters/index.js';
@@ -3,3 +3,4 @@ export * as gqlClientReact from './gql-client-react/index.js';
3
3
  export * as graphql from './graphql/index.js';
4
4
  export { renderNodes, loadTsConfigCompilerOptions, addNewLineBetweenNodes, invokeMethod, } from './shared.js';
5
5
  export { generateImportDeclaration } from './utils.js';
6
+ export * as formatters from './formatters/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vladimirdev635/gql-codegen",
3
- "version": "0.0.38",
3
+ "version": "0.0.40",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "lint:fix": "eslint --fix .",
18
18
  "lint:ci": "npm run lint",
19
19
  "test": "vitest",
20
- "build": "tsc && cp package.json ./dist/package.json"
20
+ "build": "tsc && tsc-alias && cp package.json ./dist/package.json"
21
21
  },
22
22
  "keywords": [],
23
23
  "author": "",
@@ -36,6 +36,7 @@
36
36
  "@typescript-eslint/eslint-plugin": "^8.34.0",
37
37
  "eslint": "^9.28.0",
38
38
  "jiti": "^2.4.2",
39
+ "tsc-alias": "^1.8.16",
39
40
  "vitest": "^3.2.4"
40
41
  }
41
42
  }