@soda-gql/typegen 0.10.1
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.
- package/dist/index.cjs +652 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +236 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +236 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +648 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["warnings: string[]","outputFormatters: TypeFormatters","inputFormatters: TypeFormatters","toImportSpecifier","lines: string[]","formatters: TypeFormatters","lines: string[]","typeImports: string[]","runtimeImports: string[]","gqlEntries: string[]","extensionMap: Record<string, string>","withPrefix","currentExt","injects: Record<string, { readonly scalars: string }>"],"sources":["../src/emitter.ts","../src/errors.ts","../src/prebuilt-generator.ts","../src/runner.ts"],"sourcesContent":["/**\n * Prebuilt types emitter.\n *\n * Generates TypeScript type definitions for PrebuiltTypes registry\n * from field selection data and schema.\n *\n * ## Error Handling Strategy\n *\n * The emitter uses a partial failure approach for type calculation errors:\n *\n * **Recoverable errors** (result in warnings, element skipped):\n * - Type calculation failures (e.g., `calculateFieldsType` throws)\n * - Input type generation failures (e.g., `generateInputType` throws)\n * - These are caught per-element, logged as warnings, and the element is omitted\n *\n * **Fatal errors** (result in error result):\n * - `SCHEMA_NOT_FOUND`: Selection references non-existent schema\n * - `WRITE_FAILED`: Cannot write output file to disk\n *\n * This allows builds to succeed with partial type coverage when some elements\n * have issues, while providing visibility into problems via warnings.\n *\n * @module\n */\n\nimport { writeFile } from \"node:fs/promises\";\nimport { dirname, join, relative } from \"node:path\";\nimport { type BuilderError, builderErrors, type FieldSelectionsMap } from \"@soda-gql/builder\";\nimport type { AnyGraphqlSchema, InputTypeSpecifiers, TypeFormatters } from \"@soda-gql/core\";\nimport { calculateFieldsType, generateInputObjectType, generateInputType, generateInputTypeFromSpecifiers } from \"@soda-gql/core\";\nimport { Kind, type TypeNode, type VariableDefinitionNode } from \"graphql\";\nimport { err, ok, type Result } from \"neverthrow\";\n\n/**\n * Options for emitting prebuilt types.\n */\nexport type PrebuiltTypesEmitterOptions = {\n /**\n * Schema definitions per schema name.\n * These come from the codegen output.\n */\n readonly schemas: Record<string, AnyGraphqlSchema>;\n /**\n * Field selections extracted from the builder.\n */\n readonly fieldSelections: FieldSelectionsMap;\n /**\n * Output directory (where prebuilt/types.ts should be written).\n * This should be the same as config.outdir.\n */\n readonly outdir: string;\n /**\n * Inject configuration per schema.\n * Maps schema name to inject file paths (absolute paths).\n */\n readonly injects: Record<string, { readonly scalars: string }>;\n};\n\ntype PrebuiltTypeEntry = {\n readonly key: string;\n readonly inputType: string;\n readonly outputType: string;\n};\n\ntype SchemaGroup = {\n fragments: PrebuiltTypeEntry[];\n operations: PrebuiltTypeEntry[];\n inputObjects: Set<string>;\n};\n\ntype GroupBySchemaResult = {\n readonly grouped: Map<string, SchemaGroup>;\n readonly warnings: string[];\n};\n\n/**\n * Group field selections by schema.\n * Uses the schemaLabel from each selection to group them correctly.\n *\n * @returns Result containing grouped selections and warnings, or error if schema not found\n */\nconst groupBySchema = (\n fieldSelections: FieldSelectionsMap,\n schemas: Record<string, AnyGraphqlSchema>,\n): Result<GroupBySchemaResult, BuilderError> => {\n const grouped = new Map<string, SchemaGroup>();\n const warnings: string[] = [];\n\n // Initialize groups for each schema\n for (const schemaName of Object.keys(schemas)) {\n grouped.set(schemaName, { fragments: [], operations: [], inputObjects: new Set() });\n }\n\n for (const [canonicalId, selection] of fieldSelections) {\n // Use schemaLabel to determine which schema this selection belongs to\n const schemaName = selection.schemaLabel;\n const schema = schemas[schemaName];\n const group = grouped.get(schemaName);\n\n if (!schema || !group) {\n return err(builderErrors.schemaNotFound(schemaName, canonicalId));\n }\n\n // Create formatters for schema-specific type names\n const outputFormatters: TypeFormatters = {\n scalarOutput: (name) => `ScalarOutput_${schemaName}<\"${name}\">`,\n };\n const inputFormatters: TypeFormatters = {\n scalarInput: (name) => `ScalarInput_${schemaName}<\"${name}\">`,\n inputObject: (name) => `Input_${schemaName}_${name}`,\n };\n\n if (selection.type === \"fragment\") {\n // Skip fragments without keys (they can't be looked up)\n if (!selection.key) {\n continue;\n }\n\n try {\n // Collect input objects used in fragment variables\n const usedInputObjects = collectUsedInputObjectsFromSpecifiers(schema, selection.variableDefinitions);\n for (const inputName of usedInputObjects) {\n group.inputObjects.add(inputName);\n }\n\n // Generate output type with schema-specific scalar names\n const outputType = calculateFieldsType(schema, selection.fields, outputFormatters);\n\n // Generate input type from variableDefinitions with schema-specific names\n const hasVariables = Object.keys(selection.variableDefinitions).length > 0;\n const inputType = hasVariables\n ? generateInputTypeFromSpecifiers(schema, selection.variableDefinitions, { formatters: inputFormatters })\n : \"void\";\n\n group.fragments.push({\n key: selection.key,\n inputType,\n outputType,\n });\n } catch (error) {\n warnings.push(\n `[prebuilt] Failed to calculate type for fragment \"${selection.key}\": ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n } else if (selection.type === \"operation\") {\n try {\n // Collect input objects used in this operation\n const usedInputObjects = collectUsedInputObjects(schema, selection.variableDefinitions);\n for (const inputName of usedInputObjects) {\n group.inputObjects.add(inputName);\n }\n\n // Generate output type with schema-specific scalar names\n const outputType = calculateFieldsType(schema, selection.fields, outputFormatters);\n\n // Generate input type with schema-specific scalar and input object names\n const inputType = generateInputType(schema, selection.variableDefinitions, inputFormatters);\n\n group.operations.push({\n key: selection.operationName,\n inputType,\n outputType,\n });\n } catch (error) {\n warnings.push(\n `[prebuilt] Failed to calculate type for operation \"${selection.operationName}\": ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n }\n\n return ok({ grouped, warnings });\n};\n\n/**\n * Calculate relative import path from one file to another.\n */\nconst toImportSpecifier = (from: string, to: string): string => {\n const fromDir = dirname(from);\n let relativePath = relative(fromDir, to);\n // Ensure starts with ./\n if (!relativePath.startsWith(\".\")) {\n relativePath = `./${relativePath}`;\n }\n // Remove .ts extension\n return relativePath.replace(/\\.ts$/, \"\");\n};\n\n/**\n * Extract input object names from a GraphQL TypeNode.\n */\nconst extractInputObjectsFromType = (schema: AnyGraphqlSchema, typeNode: TypeNode, inputObjects: Set<string>): void => {\n switch (typeNode.kind) {\n case Kind.NON_NULL_TYPE:\n extractInputObjectsFromType(schema, typeNode.type, inputObjects);\n break;\n case Kind.LIST_TYPE:\n extractInputObjectsFromType(schema, typeNode.type, inputObjects);\n break;\n case Kind.NAMED_TYPE: {\n const name = typeNode.name.value;\n // Check if it's an input object (not a scalar or enum)\n if (!schema.scalar[name] && !schema.enum[name] && schema.input[name]) {\n inputObjects.add(name);\n }\n break;\n }\n }\n};\n\n/**\n * Recursively collect nested input objects from schema definitions.\n * Takes a set of initial input names and expands to include all nested inputs.\n */\nconst collectNestedInputObjects = (schema: AnyGraphqlSchema, initialInputNames: Set<string>): Set<string> => {\n const inputObjects = new Set(initialInputNames);\n\n const collectNested = (inputName: string, seen: Set<string>): void => {\n if (seen.has(inputName)) {\n return;\n }\n seen.add(inputName);\n\n const inputDef = schema.input[inputName];\n if (!inputDef) {\n return;\n }\n\n for (const field of Object.values(inputDef.fields)) {\n if (field.kind === \"input\" && !inputObjects.has(field.name)) {\n inputObjects.add(field.name);\n collectNested(field.name, seen);\n }\n }\n };\n\n for (const inputName of Array.from(initialInputNames)) {\n collectNested(inputName, new Set());\n }\n\n return inputObjects;\n};\n\n/**\n * Collect all input object types used in variable definitions.\n * Recursively collects nested input objects from the schema.\n */\nconst collectUsedInputObjects = (\n schema: AnyGraphqlSchema,\n variableDefinitions: readonly VariableDefinitionNode[],\n): Set<string> => {\n const directInputs = new Set<string>();\n for (const varDef of variableDefinitions) {\n extractInputObjectsFromType(schema, varDef.type, directInputs);\n }\n return collectNestedInputObjects(schema, directInputs);\n};\n\n/**\n * Collect all input object types used in InputTypeSpecifiers.\n * Recursively collects nested input objects from the schema.\n */\nconst collectUsedInputObjectsFromSpecifiers = (schema: AnyGraphqlSchema, specifiers: InputTypeSpecifiers): Set<string> => {\n const directInputs = new Set<string>();\n for (const specifier of Object.values(specifiers)) {\n if (specifier.kind === \"input\" && schema.input[specifier.name]) {\n directInputs.add(specifier.name);\n }\n }\n return collectNestedInputObjects(schema, directInputs);\n};\n\n/**\n * Generate type definitions for input objects.\n */\nconst generateInputObjectTypeDefinitions = (schema: AnyGraphqlSchema, schemaName: string, inputNames: Set<string>): string[] => {\n const lines: string[] = [];\n\n // Get depth config from schema (optional properties defined in AnyGraphqlSchema)\n const defaultDepth = schema.__defaultInputDepth ?? 3;\n const depthOverrides = schema.__inputDepthOverrides ?? {};\n\n // Create formatters for schema-specific type names\n const formatters: TypeFormatters = {\n scalarInput: (name) => `ScalarInput_${schemaName}<\"${name}\">`,\n inputObject: (name) => `Input_${schemaName}_${name}`,\n };\n\n // Sort for deterministic output\n const sortedNames = Array.from(inputNames).sort();\n\n for (const inputName of sortedNames) {\n const typeString = generateInputObjectType(schema, inputName, {\n defaultDepth,\n depthOverrides,\n formatters,\n });\n\n lines.push(`type Input_${schemaName}_${inputName} = ${typeString};`);\n }\n\n return lines;\n};\n\n/**\n * Generate the TypeScript code for prebuilt types.\n */\nconst generateTypesCode = (\n grouped: Map<string, SchemaGroup>,\n schemas: Record<string, AnyGraphqlSchema>,\n injects: Record<string, { readonly scalars: string }>,\n outdir: string,\n): string => {\n const typesFilePath = join(outdir, \"prebuilt\", \"types.ts\");\n\n const lines: string[] = [\n \"/**\",\n \" * Prebuilt type registry.\",\n \" *\",\n \" * This file is auto-generated by @soda-gql/typegen.\",\n \" * Do not edit manually.\",\n \" *\",\n \" * @module\",\n \" * @generated\",\n \" */\",\n \"\",\n 'import type { PrebuiltTypeRegistry } from \"@soda-gql/core\";',\n ];\n\n // Generate imports from inject files\n for (const [schemaName, inject] of Object.entries(injects)) {\n const relativePath = toImportSpecifier(typesFilePath, inject.scalars);\n lines.push(`import type { scalar as scalar_${schemaName} } from \"${relativePath}\";`);\n }\n\n lines.push(\"\");\n\n // Generate ScalarInput and ScalarOutput helper types\n for (const schemaName of Object.keys(injects)) {\n lines.push(\n `type ScalarInput_${schemaName}<T extends keyof typeof scalar_${schemaName}> = ` +\n `typeof scalar_${schemaName}[T][\"$type\"][\"input\"];`,\n );\n lines.push(\n `type ScalarOutput_${schemaName}<T extends keyof typeof scalar_${schemaName}> = ` +\n `typeof scalar_${schemaName}[T][\"$type\"][\"output\"];`,\n );\n }\n\n lines.push(\"\");\n\n for (const [schemaName, { fragments, operations, inputObjects }] of grouped) {\n const schema = schemas[schemaName];\n\n // Generate input object type definitions if there are any\n if (inputObjects.size > 0 && schema) {\n lines.push(\"// Input object types\");\n const inputTypeLines = generateInputObjectTypeDefinitions(schema, schemaName, inputObjects);\n lines.push(...inputTypeLines);\n lines.push(\"\");\n }\n\n // Generate fragments type\n const fragmentEntries = fragments\n .sort((a, b) => a.key.localeCompare(b.key))\n .map((f) => ` readonly \"${f.key}\": { readonly input: ${f.inputType}; readonly output: ${f.outputType} };`);\n\n // Generate operations type\n const operationEntries = operations\n .sort((a, b) => a.key.localeCompare(b.key))\n .map((o) => ` readonly \"${o.key}\": { readonly input: ${o.inputType}; readonly output: ${o.outputType} };`);\n\n lines.push(`export type PrebuiltTypes_${schemaName} = {`);\n lines.push(\" readonly fragments: {\");\n if (fragmentEntries.length > 0) {\n lines.push(...fragmentEntries);\n }\n lines.push(\" };\");\n lines.push(\" readonly operations: {\");\n if (operationEntries.length > 0) {\n lines.push(...operationEntries);\n }\n lines.push(\" };\");\n lines.push(\"} satisfies PrebuiltTypeRegistry;\");\n lines.push(\"\");\n }\n\n return lines.join(\"\\n\");\n};\n\n/**\n * Result of emitting prebuilt types.\n */\nexport type PrebuiltTypesEmitResult = {\n readonly path: string;\n readonly warnings: readonly string[];\n};\n\n/**\n * Emit prebuilt types to the prebuilt/types.ts file.\n *\n * This function uses a partial failure strategy: if type calculation fails for\n * individual elements (e.g., due to invalid field selections or missing schema\n * types), those elements are skipped and warnings are collected rather than\n * failing the entire emission. This allows builds to succeed even when some\n * elements have issues, while still reporting problems via warnings.\n *\n * @param options - Emitter options including schemas, field selections, and output directory\n * @returns Result containing output path and warnings, or error if a hard failure occurs\n *\n * @example\n * ```typescript\n * const result = await emitPrebuiltTypes({\n * schemas: { mySchema: schema },\n * fieldSelections,\n * outdir: \"./generated\",\n * injects: { mySchema: { scalars: \"./scalars.ts\" } },\n * });\n *\n * if (result.isOk()) {\n * console.log(`Generated: ${result.value.path}`);\n * if (result.value.warnings.length > 0) {\n * console.warn(\"Warnings:\", result.value.warnings);\n * }\n * }\n * ```\n */\nexport const emitPrebuiltTypes = async (\n options: PrebuiltTypesEmitterOptions,\n): Promise<Result<PrebuiltTypesEmitResult, BuilderError>> => {\n const { schemas, fieldSelections, outdir, injects } = options;\n\n // Group selections by schema\n const groupResult = groupBySchema(fieldSelections, schemas);\n if (groupResult.isErr()) {\n return err(groupResult.error);\n }\n const { grouped, warnings } = groupResult.value;\n\n // Generate the types code\n const code = generateTypesCode(grouped, schemas, injects, outdir);\n\n // Write to prebuilt/types.ts\n const typesPath = join(outdir, \"prebuilt\", \"types.ts\");\n\n try {\n await writeFile(typesPath, code, \"utf-8\");\n return ok({ path: typesPath, warnings });\n } catch (error) {\n return err(\n builderErrors.writeFailed(\n typesPath,\n `Failed to write prebuilt types: ${error instanceof Error ? error.message : String(error)}`,\n error,\n ),\n );\n }\n};\n","/**\n * Error types for typegen package.\n *\n * @module\n */\n\nimport type { BuilderError } from \"@soda-gql/builder\";\n\n/**\n * Error codes specific to typegen operations.\n */\nexport type TypegenErrorCode =\n | \"TYPEGEN_CODEGEN_REQUIRED\"\n | \"TYPEGEN_SCHEMA_LOAD_FAILED\"\n | \"TYPEGEN_BUILD_FAILED\"\n | \"TYPEGEN_EMIT_FAILED\"\n | \"TYPEGEN_BUNDLE_FAILED\";\n\n/**\n * Typegen-specific error type.\n */\nexport type TypegenSpecificError =\n | {\n readonly code: \"TYPEGEN_CODEGEN_REQUIRED\";\n readonly message: string;\n readonly outdir: string;\n }\n | {\n readonly code: \"TYPEGEN_SCHEMA_LOAD_FAILED\";\n readonly message: string;\n readonly schemaNames: readonly string[];\n readonly cause?: unknown;\n }\n | {\n readonly code: \"TYPEGEN_BUILD_FAILED\";\n readonly message: string;\n readonly cause?: unknown;\n }\n | {\n readonly code: \"TYPEGEN_EMIT_FAILED\";\n readonly message: string;\n readonly path: string;\n readonly cause?: unknown;\n }\n | {\n readonly code: \"TYPEGEN_BUNDLE_FAILED\";\n readonly message: string;\n readonly path: string;\n readonly cause?: unknown;\n };\n\n/**\n * Union of all typegen errors (specific + builder errors).\n */\nexport type TypegenError = TypegenSpecificError | BuilderError;\n\n/**\n * Error constructor helpers for concise error creation.\n */\nexport const typegenErrors = {\n codegenRequired: (outdir: string): TypegenSpecificError => ({\n code: \"TYPEGEN_CODEGEN_REQUIRED\",\n message: `Generated graphql-system module not found at '${outdir}'. Run 'soda-gql codegen' first.`,\n outdir,\n }),\n\n schemaLoadFailed: (schemaNames: readonly string[], cause?: unknown): TypegenSpecificError => ({\n code: \"TYPEGEN_SCHEMA_LOAD_FAILED\",\n message: `Failed to load schemas: ${schemaNames.join(\", \")}`,\n schemaNames,\n cause,\n }),\n\n buildFailed: (message: string, cause?: unknown): TypegenSpecificError => ({\n code: \"TYPEGEN_BUILD_FAILED\",\n message,\n cause,\n }),\n\n emitFailed: (path: string, message: string, cause?: unknown): TypegenSpecificError => ({\n code: \"TYPEGEN_EMIT_FAILED\",\n message,\n path,\n cause,\n }),\n\n bundleFailed: (path: string, message: string, cause?: unknown): TypegenSpecificError => ({\n code: \"TYPEGEN_BUNDLE_FAILED\",\n message,\n path,\n cause,\n }),\n} as const;\n\n/**\n * Format TypegenError for console output (human-readable).\n */\nexport const formatTypegenError = (error: TypegenError): string => {\n const lines: string[] = [];\n\n lines.push(`Error [${error.code}]: ${error.message}`);\n\n switch (error.code) {\n case \"TYPEGEN_CODEGEN_REQUIRED\":\n lines.push(` Output directory: ${error.outdir}`);\n lines.push(\" Hint: Run 'soda-gql codegen' to generate the graphql-system module first.\");\n break;\n case \"TYPEGEN_SCHEMA_LOAD_FAILED\":\n lines.push(` Schemas: ${error.schemaNames.join(\", \")}`);\n break;\n case \"TYPEGEN_EMIT_FAILED\":\n case \"TYPEGEN_BUNDLE_FAILED\":\n lines.push(` Path: ${error.path}`);\n break;\n }\n\n if (\"cause\" in error && error.cause) {\n lines.push(` Caused by: ${error.cause}`);\n }\n\n return lines.join(\"\\n\");\n};\n","/**\n * Prebuilt module generator for bundler-compatible type resolution.\n *\n * Generates a prebuilt version of the gql composer that uses\n * PrebuiltTypes for type lookup instead of complex inference.\n *\n * @module\n */\n\nimport type { DocumentNode } from \"graphql\";\n\nexport type PrebuiltGeneratorOptions = {\n /**\n * Relative import path to the main gql module.\n * Example: \"../index\" (from prebuilt/index.ts to index.ts)\n */\n readonly mainModulePath: string;\n /**\n * Per-schema injection config (adapter import paths).\n */\n readonly injection?: Map<\n string,\n {\n readonly adapterImportPath?: string;\n }\n >;\n};\n\nexport type PrebuiltGeneratedModule = {\n /** The generated code for prebuilt/index.ts */\n readonly indexCode: string;\n /** The generated code for prebuilt/types.ts (placeholder) */\n readonly typesCode: string;\n};\n\n/**\n * Generate the prebuilt module code.\n *\n * This generates:\n * - prebuilt/index.ts: Uses createPrebuiltGqlElementComposer with types from PrebuiltTypes\n * - prebuilt/types.ts: Placeholder types that typegen will populate\n */\nexport const generatePrebuiltModule = (\n schemas: Map<string, DocumentNode>,\n options: PrebuiltGeneratorOptions,\n): PrebuiltGeneratedModule => {\n const schemaNames = Array.from(schemas.keys());\n\n // Generate type imports from main module\n const typeImports: string[] = [];\n // Generate runtime imports from main module (the __ prefixed exports)\n const runtimeImports: string[] = [];\n\n for (const name of schemaNames) {\n // Type imports - include Context type from main module\n typeImports.push(`Schema_${name}`, `FragmentBuilders_${name}`, `Context_${name}`);\n\n // Runtime imports\n runtimeImports.push(`__schema_${name}`, `__inputTypeMethods_${name}`, `__directiveMethods_${name}`);\n\n // Check if adapter is used for this schema\n const hasAdapter = options.injection?.get(name)?.adapterImportPath !== undefined;\n if (hasAdapter) {\n typeImports.push(`Adapter_${name}`);\n runtimeImports.push(`__adapter_${name}`);\n }\n }\n\n // Generate gql entries with createPrebuiltGqlElementComposer\n const gqlEntries: string[] = [];\n\n for (const name of schemaNames) {\n const document = schemas.get(name);\n if (!document) continue;\n\n const hasAdapter = options.injection?.get(name)?.adapterImportPath !== undefined;\n\n // Generate gql entry with PrebuiltGqlElementComposer\n // Context type is now imported from main module\n if (hasAdapter) {\n gqlEntries.push(\n ` ${name}: createPrebuiltGqlElementComposer<Schema_${name}, PrebuiltTypes_${name}, FragmentBuilders_${name}, typeof __directiveMethods_${name}, Context_${name}, Adapter_${name}>(__schema_${name}, { adapter: __adapter_${name}, inputTypeMethods: __inputTypeMethods_${name}, directiveMethods: __directiveMethods_${name} })`,\n );\n } else {\n gqlEntries.push(\n ` ${name}: createPrebuiltGqlElementComposer<Schema_${name}, PrebuiltTypes_${name}, FragmentBuilders_${name}, typeof __directiveMethods_${name}, Context_${name}>(__schema_${name}, { inputTypeMethods: __inputTypeMethods_${name}, directiveMethods: __directiveMethods_${name} })`,\n );\n }\n }\n\n // Generate the prebuilt/index.ts code\n const indexCode = `\\\n/**\n * Prebuilt GQL module for bundler-compatible type resolution.\n *\n * This module uses createPrebuiltGqlElementComposer which looks up types\n * from PrebuiltTypes instead of using complex type inference.\n *\n * @module\n * @generated by @soda-gql/typegen\n */\n\nimport { createPrebuiltGqlElementComposer } from \"@soda-gql/core\";\nimport {\n ${runtimeImports.join(\",\\n \")},\n type ${typeImports.join(\",\\n type \")},\n} from \"${options.mainModulePath}\";\nimport type { ${schemaNames.map((name) => `PrebuiltTypes_${name}`).join(\", \")} } from \"./types\";\n\nexport const gql = {\n${gqlEntries.join(\",\\n\")}\n};\n\n// Re-export types from main module\nexport type { ${typeImports.join(\", \")} };\n`;\n\n // Generate the prebuilt/types.ts placeholder\n const typesCode = `\\\n/**\n * Prebuilt type registry.\n *\n * This file contains placeholder types that will be populated by typegen\n * when running \\`soda-gql typegen\\` command.\n *\n * @module\n * @generated by @soda-gql/typegen\n */\n\nimport type { EmptyPrebuiltTypeRegistry } from \"@soda-gql/core\";\n\n${schemaNames.map((name) => `// Placeholder for ${name} schema - populated by typegen\\nexport type PrebuiltTypes_${name} = EmptyPrebuiltTypeRegistry;`).join(\"\\n\\n\")}\n`;\n\n return {\n indexCode,\n typesCode,\n };\n};\n","/**\n * Main typegen runner.\n *\n * Orchestrates the prebuilt type generation process:\n * 1. Load schemas from generated CJS bundle\n * 2. Generate prebuilt/index.ts\n * 3. Build artifact to evaluate elements\n * 4. Extract field selections\n * 5. Emit prebuilt/types.ts\n * 6. Bundle prebuilt module\n *\n * @module\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { dirname, extname, join, relative, resolve } from \"node:path\";\nimport {\n createBuilderService,\n extractFieldSelections,\n type IntermediateArtifactElement,\n loadSchemasFromBundle,\n} from \"@soda-gql/builder\";\nimport type { CanonicalId } from \"@soda-gql/common\";\nimport type { ResolvedSodaGqlConfig } from \"@soda-gql/config\";\nimport { build } from \"esbuild\";\nimport { type DocumentNode, parse } from \"graphql\";\nimport { err, ok } from \"neverthrow\";\nimport { emitPrebuiltTypes } from \"./emitter\";\nimport { typegenErrors } from \"./errors\";\nimport { generatePrebuiltModule } from \"./prebuilt-generator\";\nimport type { TypegenResult, TypegenSuccess } from \"./types\";\n\n/**\n * Options for running typegen.\n */\nexport type RunTypegenOptions = {\n /**\n * Resolved soda-gql configuration.\n */\n readonly config: ResolvedSodaGqlConfig;\n};\n\nconst extensionMap: Record<string, string> = {\n \".ts\": \".js\",\n \".tsx\": \".js\",\n \".mts\": \".mjs\",\n \".cts\": \".cjs\",\n \".js\": \".js\",\n \".mjs\": \".mjs\",\n \".cjs\": \".cjs\",\n};\n\ntype ImportSpecifierOptions = {\n includeExtension?: boolean;\n};\n\nconst toImportSpecifier = (fromPath: string, targetPath: string, options?: ImportSpecifierOptions): string => {\n const fromDir = dirname(fromPath);\n const normalized = relative(fromDir, targetPath).replace(/\\\\/g, \"/\");\n const sourceExt = extname(targetPath);\n\n // When includeExtension is false (default), strip the extension entirely\n if (!options?.includeExtension) {\n if (normalized.length === 0) {\n return `./${targetPath.slice(0, -sourceExt.length).split(\"/\").pop()}`;\n }\n const withPrefix = normalized.startsWith(\".\") ? normalized : `./${normalized}`;\n const currentExt = extname(withPrefix);\n return currentExt ? withPrefix.slice(0, -currentExt.length) : withPrefix;\n }\n\n // When includeExtension is true, convert to runtime extension\n const runtimeExt = extensionMap[sourceExt] ?? sourceExt;\n\n if (normalized.length === 0) {\n const base = runtimeExt !== sourceExt ? targetPath.slice(0, -sourceExt.length).split(\"/\").pop() : targetPath.split(\"/\").pop();\n return `./${base}${runtimeExt}`;\n }\n\n const withPrefix = normalized.startsWith(\".\") ? normalized : `./${normalized}`;\n if (!runtimeExt) {\n return withPrefix;\n }\n if (withPrefix.endsWith(runtimeExt)) {\n return withPrefix;\n }\n\n const currentExt = extname(withPrefix);\n const withoutExt = currentExt ? withPrefix.slice(0, -currentExt.length) : withPrefix;\n return `${withoutExt}${runtimeExt}`;\n};\n\n/**\n * Bundle the prebuilt module to CJS format.\n */\nconst bundlePrebuiltModule = async (sourcePath: string): Promise<{ cjsPath: string }> => {\n const sourceExt = extname(sourcePath);\n const baseName = sourcePath.slice(0, -sourceExt.length);\n const cjsPath = `${baseName}.cjs`;\n\n await build({\n entryPoints: [sourcePath],\n outfile: cjsPath,\n format: \"cjs\",\n platform: \"node\",\n bundle: true,\n external: [\"@soda-gql/core\", \"@soda-gql/runtime\"],\n sourcemap: false,\n minify: false,\n treeShaking: false,\n });\n\n return { cjsPath };\n};\n\n/**\n * Write a TypeScript module to disk.\n */\nconst writeModule = async (path: string, content: string): Promise<void> => {\n await mkdir(dirname(path), { recursive: true });\n await writeFile(path, content, \"utf-8\");\n};\n\n/**\n * Load GraphQL schema documents from schema paths.\n * This is needed for generatePrebuiltModule which expects DocumentNode.\n */\nconst loadSchemaDocuments = (schemasConfig: ResolvedSodaGqlConfig[\"schemas\"]): Map<string, DocumentNode> => {\n const documents = new Map<string, DocumentNode>();\n\n for (const [name, schemaConfig] of Object.entries(schemasConfig)) {\n const schemaPaths = Array.isArray(schemaConfig.schema) ? schemaConfig.schema : [schemaConfig.schema];\n\n // Concatenate all schema files\n let combinedSource = \"\";\n for (const schemaPath of schemaPaths) {\n combinedSource += `${readFileSync(schemaPath, \"utf-8\")}\\n`;\n }\n\n documents.set(name, parse(combinedSource));\n }\n\n return documents;\n};\n\n/**\n * Run the typegen process.\n *\n * This function:\n * 1. Loads schemas from the generated CJS bundle\n * 2. Generates prebuilt/index.ts using generatePrebuiltModule\n * 3. Creates a BuilderService and builds the artifact\n * 4. Extracts field selections from the artifact\n * 5. Emits prebuilt/types.ts using emitPrebuiltTypes\n * 6. Bundles the prebuilt module\n *\n * @param options - Typegen options including config\n * @returns Result containing success data or error\n */\nexport const runTypegen = async (options: RunTypegenOptions): Promise<TypegenResult> => {\n const { config } = options;\n const outdir = resolve(config.outdir);\n const cjsPath = join(outdir, \"index.cjs\");\n const importSpecifierOptions = { includeExtension: config.styles.importExtension };\n\n // Step 1: Check if codegen has been run\n if (!existsSync(cjsPath)) {\n return err(typegenErrors.codegenRequired(outdir));\n }\n\n // Step 2: Load schemas from CJS bundle\n const schemaNames = Object.keys(config.schemas);\n const schemasResult = loadSchemasFromBundle(cjsPath, schemaNames);\n if (schemasResult.isErr()) {\n return err(typegenErrors.schemaLoadFailed(schemaNames, schemasResult.error));\n }\n const schemas = schemasResult.value;\n\n // Step 3: Create prebuilt directory\n const prebuiltDir = join(outdir, \"prebuilt\");\n await mkdir(prebuiltDir, { recursive: true });\n\n // Step 4: Load schema documents and generate prebuilt/index.ts\n const schemaDocuments = loadSchemaDocuments(config.schemas);\n const mainModulePath = toImportSpecifier(join(prebuiltDir, \"index.ts\"), join(outdir, \"index.ts\"), importSpecifierOptions);\n\n // Build injection config for generatePrebuiltModule\n const injection = new Map<string, { adapterImportPath?: string }>();\n for (const [schemaName, schemaConfig] of Object.entries(config.schemas)) {\n if (schemaConfig.inject.adapter) {\n injection.set(schemaName, {\n adapterImportPath: toImportSpecifier(join(outdir, \"index.ts\"), schemaConfig.inject.adapter, importSpecifierOptions),\n });\n } else {\n injection.set(schemaName, {});\n }\n }\n\n const prebuilt = generatePrebuiltModule(schemaDocuments, {\n mainModulePath,\n injection,\n });\n\n // Write prebuilt/index.ts\n const prebuiltIndexPath = join(prebuiltDir, \"index.ts\");\n try {\n await writeModule(prebuiltIndexPath, prebuilt.indexCode);\n } catch (error) {\n return err(\n typegenErrors.emitFailed(\n prebuiltIndexPath,\n `Failed to write prebuilt index: ${error instanceof Error ? error.message : String(error)}`,\n error,\n ),\n );\n }\n\n // Step 5: Build artifact using BuilderService\n const builderService = createBuilderService({\n config,\n });\n\n const artifactResult = await builderService.buildAsync();\n\n if (artifactResult.isErr()) {\n return err(typegenErrors.buildFailed(`Builder failed: ${artifactResult.error.message}`, artifactResult.error));\n }\n\n // Step 6: Extract field selections from intermediate elements\n const intermediateElements = builderService.getIntermediateElements();\n if (!intermediateElements) {\n return err(typegenErrors.buildFailed(\"No intermediate elements available after build\", undefined));\n }\n\n const fieldSelectionsResult = extractFieldSelections(intermediateElements as Record<CanonicalId, IntermediateArtifactElement>);\n const { selections: fieldSelections, warnings: extractWarnings } = fieldSelectionsResult;\n\n // Step 7: Emit prebuilt/types.ts\n const injects: Record<string, { readonly scalars: string }> = {};\n for (const [schemaName, schemaConfig] of Object.entries(config.schemas)) {\n injects[schemaName] = { scalars: schemaConfig.inject.scalars };\n }\n\n const emitResult = await emitPrebuiltTypes({\n schemas,\n fieldSelections,\n outdir,\n injects,\n });\n\n if (emitResult.isErr()) {\n return err(emitResult.error);\n }\n\n const { path: prebuiltTypesPath, warnings: emitWarnings } = emitResult.value;\n\n // Step 8: Bundle prebuilt module\n try {\n await bundlePrebuiltModule(prebuiltIndexPath);\n } catch (error) {\n return err(\n typegenErrors.bundleFailed(\n prebuiltIndexPath,\n `Failed to bundle prebuilt module: ${error instanceof Error ? error.message : String(error)}`,\n error,\n ),\n );\n }\n\n // Count fragments and operations\n let fragmentCount = 0;\n let operationCount = 0;\n for (const selection of fieldSelections.values()) {\n if (selection.type === \"fragment\" && selection.key) {\n fragmentCount++;\n } else if (selection.type === \"operation\") {\n operationCount++;\n }\n }\n\n const allWarnings = [...extractWarnings, ...emitWarnings];\n\n return ok({\n prebuiltIndexPath,\n prebuiltTypesPath,\n fragmentCount,\n operationCount,\n warnings: allWarnings,\n } satisfies TypegenSuccess);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,MAAM,iBACJ,iBACA,YAC8C;CAC9C,MAAM,UAAU,IAAI,KAA0B;CAC9C,MAAMA,WAAqB,EAAE;AAG7B,MAAK,MAAM,cAAc,OAAO,KAAK,QAAQ,EAAE;AAC7C,UAAQ,IAAI,YAAY;GAAE,WAAW,EAAE;GAAE,YAAY,EAAE;GAAE,cAAc,IAAI,KAAK;GAAE,CAAC;;AAGrF,MAAK,MAAM,CAAC,aAAa,cAAc,iBAAiB;EAEtD,MAAM,aAAa,UAAU;EAC7B,MAAM,SAAS,QAAQ;EACvB,MAAM,QAAQ,QAAQ,IAAI,WAAW;AAErC,MAAI,CAAC,UAAU,CAAC,OAAO;AACrB,UAAO,IAAI,cAAc,eAAe,YAAY,YAAY,CAAC;;EAInE,MAAMC,mBAAmC,EACvC,eAAe,SAAS,gBAAgB,WAAW,IAAI,KAAK,KAC7D;EACD,MAAMC,kBAAkC;GACtC,cAAc,SAAS,eAAe,WAAW,IAAI,KAAK;GAC1D,cAAc,SAAS,SAAS,WAAW,GAAG;GAC/C;AAED,MAAI,UAAU,SAAS,YAAY;AAEjC,OAAI,CAAC,UAAU,KAAK;AAClB;;AAGF,OAAI;IAEF,MA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AI,WAAW,OAAO,EAAE;AACtB,SAAO,IAAI,WAAW,MAAM;;CAG9B,MAAM,EAAE,MAAM,mBAAmB,UAAU,iBAAiB,WAAW;AAGvE,KAAI;AACF,QAAM,qBAAqB,kBAAkB;UACtC,OAAO;AACd,SAAO,IACL,cAAc,aACZ,mBACA,qCAAqC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,IAC3F,MACD,CACF;;CAIH,IAAI,gBAAgB;CACpB,IAAI,iBAAiB;AACrB,MAAK,MAAM,aAAa,gBAAgB,QAAQ,EAAE;AAChD,MAAI,UAAU,SAAS,cAAc,UAAU,KAAK;AAClD;aACS,UAAU,SAAS,aAAa;AACzC;;;CAIJ,MAAM,cAAc,CAAC,GAAG,iBAAiB,GAAG,aAAa;AAEzD,QAAO,GAAG;EACR;EACA;EACA;EACA;EACA,UAAU;EACX,CAA0B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@soda-gql/typegen",
|
|
3
|
+
"version": "0.10.1",
|
|
4
|
+
"description": "Prebuilt type generation for soda-gql",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"author": {
|
|
12
|
+
"name": "Shota Hatada",
|
|
13
|
+
"email": "shota.hatada@whatasoda.me",
|
|
14
|
+
"url": "https://github.com/whatasoda"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"graphql",
|
|
18
|
+
"codegen",
|
|
19
|
+
"zero-runtime",
|
|
20
|
+
"typescript",
|
|
21
|
+
"prebuilt",
|
|
22
|
+
"types"
|
|
23
|
+
],
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/whatasoda/soda-gql.git",
|
|
27
|
+
"directory": "packages/typegen"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/whatasoda/soda-gql#readme",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/whatasoda/soda-gql/issues"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18"
|
|
35
|
+
},
|
|
36
|
+
"main": "./dist/index.mjs",
|
|
37
|
+
"module": "./dist/index.mjs",
|
|
38
|
+
"types": "./dist/index.d.mts",
|
|
39
|
+
"exports": {
|
|
40
|
+
".": {
|
|
41
|
+
"@soda-gql": "./@x-index.ts",
|
|
42
|
+
"types": "./dist/index.d.mts",
|
|
43
|
+
"import": "./dist/index.mjs",
|
|
44
|
+
"require": "./dist/index.cjs",
|
|
45
|
+
"default": "./dist/index.mjs"
|
|
46
|
+
},
|
|
47
|
+
"./package.json": "./package.json"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@soda-gql/builder": "~0.10.0",
|
|
51
|
+
"@soda-gql/common": "~0.10.0",
|
|
52
|
+
"@soda-gql/config": "~0.10.0",
|
|
53
|
+
"@soda-gql/core": "~0.10.0",
|
|
54
|
+
"esbuild": "^0.24.0",
|
|
55
|
+
"graphql": "^16.8.1",
|
|
56
|
+
"neverthrow": "^8.1.1"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {},
|
|
59
|
+
"peerDependencies": {},
|
|
60
|
+
"optionalDependencies": {}
|
|
61
|
+
}
|