@soda-gql/codegen 0.0.7 → 0.0.8

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 { n as generateMultiSchemaModule, t as createSchemaIndex } from "./generator-DSOZFGSD.mjs";
2
+
3
+ export { createSchemaIndex, generateMultiSchemaModule };
@@ -372,13 +372,29 @@ const multiRuntimeTemplate = ($$) => {
372
372
  const adapterAliases = new Map();
373
373
  const scalarAliases = new Map();
374
374
  if ($$.injection.mode === "inject") {
375
+ const importsByPath = new Map();
375
376
  for (const [schemaName, injection] of $$.injection.perSchema) {
376
377
  const adapterAlias = `adapter_${schemaName}`;
377
378
  const scalarAlias = `scalar_${schemaName}`;
378
379
  adapterAliases.set(schemaName, adapterAlias);
379
380
  scalarAliases.set(schemaName, scalarAlias);
380
- imports.push(`import { adapter as ${adapterAlias} } from "${injection.adapterImportPath}";`);
381
- imports.push(`import { scalar as ${scalarAlias} } from "${injection.scalarImportPath}";`);
381
+ const adapterSpecifiers = importsByPath.get(injection.adapterImportPath) ?? [];
382
+ if (!importsByPath.has(injection.adapterImportPath)) {
383
+ importsByPath.set(injection.adapterImportPath, adapterSpecifiers);
384
+ }
385
+ adapterSpecifiers.push(`adapter as ${adapterAlias}`);
386
+ const scalarSpecifiers = importsByPath.get(injection.scalarImportPath) ?? [];
387
+ if (!importsByPath.has(injection.scalarImportPath)) {
388
+ importsByPath.set(injection.scalarImportPath, scalarSpecifiers);
389
+ }
390
+ scalarSpecifiers.push(`scalar as ${scalarAlias}`);
391
+ }
392
+ for (const [path, specifiers] of importsByPath) {
393
+ if (specifiers.length === 1) {
394
+ imports.push(`import { ${specifiers[0]} } from "${path}";`);
395
+ } else {
396
+ imports.push(`import {\n ${specifiers.join(",\n ")},\n} from "${path}";`);
397
+ }
382
398
  }
383
399
  }
384
400
  const extraImports = imports.length > 0 ? `${imports.join("\n")}\n` : "";
@@ -1,4 +1,4 @@
1
- const require_generator = require('./generator-CoK2jtNh.cjs');
1
+ const require_generator = require('./generator-CxkxGwRx.cjs');
2
2
 
3
3
  exports.createSchemaIndex = require_generator.createSchemaIndex;
4
4
  exports.generateMultiSchemaModule = require_generator.generateMultiSchemaModule;
@@ -372,13 +372,29 @@ const multiRuntimeTemplate = ($$) => {
372
372
  const adapterAliases = new Map();
373
373
  const scalarAliases = new Map();
374
374
  if ($$.injection.mode === "inject") {
375
+ const importsByPath = new Map();
375
376
  for (const [schemaName, injection] of $$.injection.perSchema) {
376
377
  const adapterAlias = `adapter_${schemaName}`;
377
378
  const scalarAlias = `scalar_${schemaName}`;
378
379
  adapterAliases.set(schemaName, adapterAlias);
379
380
  scalarAliases.set(schemaName, scalarAlias);
380
- imports.push(`import { adapter as ${adapterAlias} } from "${injection.adapterImportPath}";`);
381
- imports.push(`import { scalar as ${scalarAlias} } from "${injection.scalarImportPath}";`);
381
+ const adapterSpecifiers = importsByPath.get(injection.adapterImportPath) ?? [];
382
+ if (!importsByPath.has(injection.adapterImportPath)) {
383
+ importsByPath.set(injection.adapterImportPath, adapterSpecifiers);
384
+ }
385
+ adapterSpecifiers.push(`adapter as ${adapterAlias}`);
386
+ const scalarSpecifiers = importsByPath.get(injection.scalarImportPath) ?? [];
387
+ if (!importsByPath.has(injection.scalarImportPath)) {
388
+ importsByPath.set(injection.scalarImportPath, scalarSpecifiers);
389
+ }
390
+ scalarSpecifiers.push(`scalar as ${scalarAlias}`);
391
+ }
392
+ for (const [path, specifiers] of importsByPath) {
393
+ if (specifiers.length === 1) {
394
+ imports.push(`import { ${specifiers[0]} } from "${path}";`);
395
+ } else {
396
+ imports.push(`import {\n ${specifiers.join(",\n ")},\n} from "${path}";`);
397
+ }
382
398
  }
383
399
  }
384
400
  const extraImports = imports.length > 0 ? `${imports.join("\n")}\n` : "";
@@ -507,4 +523,4 @@ const generateMultiSchemaModule = (schemas, options) => {
507
523
 
508
524
  //#endregion
509
525
  export { generateMultiSchemaModule as n, createSchemaIndex as t };
510
- //# sourceMappingURL=generator-CVAppANp.mjs.map
526
+ //# sourceMappingURL=generator-DSOZFGSD.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"generator-CVAppANp.mjs","names":["operationTypes: OperationTypeNames","modifier: TypeModifier","imports: string[]","schemaBlocks: string[]","gqlEntries: string[]","schemaConfigs: Record<string, any>","name","injection: RuntimeTemplateInjection"],"sources":["../src/generator.ts"],"sourcesContent":["import type { TypeModifier } from \"@soda-gql/core\";\nimport {\n type ConstDirectiveNode,\n type ConstValueNode,\n type DocumentNode,\n type EnumValueDefinitionNode,\n type FieldDefinitionNode,\n type InputValueDefinitionNode,\n Kind,\n type NamedTypeNode,\n type SchemaDefinitionNode,\n type SchemaExtensionNode,\n type TypeNode,\n} from \"graphql\";\n\nconst builtinScalarTypes = new Map<string, { readonly input: string; readonly output: string }>([\n [\"ID\", { input: \"string\", output: \"string\" }],\n [\"String\", { input: \"string\", output: \"string\" }],\n [\"Int\", { input: \"number\", output: \"number\" }],\n [\"Float\", { input: \"number\", output: \"number\" }],\n [\"Boolean\", { input: \"boolean\", output: \"boolean\" }],\n]);\n\ntype OperationTypeNames = {\n query?: string;\n mutation?: string;\n subscription?: string;\n};\n\ntype ObjectRecord = {\n readonly name: string;\n readonly fields: Map<string, FieldDefinitionNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype InputRecord = {\n readonly name: string;\n readonly fields: Map<string, InputValueDefinitionNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype EnumRecord = {\n readonly name: string;\n readonly values: Map<string, EnumValueDefinitionNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype UnionRecord = {\n readonly name: string;\n readonly members: Map<string, NamedTypeNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype ScalarRecord = {\n readonly name: string;\n directives: ConstDirectiveNode[];\n};\n\ntype SchemaIndex = {\n readonly objects: Map<string, ObjectRecord>;\n readonly inputs: Map<string, InputRecord>;\n readonly enums: Map<string, EnumRecord>;\n readonly unions: Map<string, UnionRecord>;\n readonly scalars: Map<string, ScalarRecord>;\n readonly operationTypes: OperationTypeNames;\n};\n\nconst ensureRecord = <T>(collection: Map<string, T>, key: string, factory: (name: string) => T): T => {\n const existing = collection.get(key);\n if (existing) {\n return existing;\n }\n\n const created = factory(key);\n collection.set(key, created);\n return created;\n};\n\nconst addObjectFields = (target: Map<string, FieldDefinitionNode>, fields: readonly FieldDefinitionNode[] | undefined): void => {\n if (!fields) {\n return;\n }\n\n for (const field of fields) {\n target.set(field.name.value, field);\n }\n};\n\nconst addInputFields = (\n target: Map<string, InputValueDefinitionNode>,\n fields: readonly InputValueDefinitionNode[] | undefined,\n): void => {\n if (!fields) {\n return;\n }\n\n for (const field of fields) {\n target.set(field.name.value, field);\n }\n};\n\nconst addEnumValues = (\n target: Map<string, EnumValueDefinitionNode>,\n values: readonly EnumValueDefinitionNode[] | undefined,\n): void => {\n if (!values) {\n return;\n }\n\n for (const value of values) {\n target.set(value.name.value, value);\n }\n};\n\nconst addUnionMembers = (target: Map<string, NamedTypeNode>, members: readonly NamedTypeNode[] | undefined): void => {\n if (!members) {\n return;\n }\n\n for (const member of members) {\n target.set(member.name.value, member);\n }\n};\n\nconst mergeDirectives = (\n existing: ConstDirectiveNode[] | undefined,\n incoming: readonly ConstDirectiveNode[] | undefined,\n precedence: \"definition\" | \"extension\",\n): ConstDirectiveNode[] => {\n const current = existing ?? [];\n const next = incoming ? Array.from(incoming) : [];\n return precedence === \"definition\" ? [...next, ...current] : [...current, ...next];\n};\n\nconst updateOperationTypes = (\n operationTypes: OperationTypeNames,\n definition: SchemaDefinitionNode | SchemaExtensionNode,\n): void => {\n for (const operation of definition.operationTypes ?? []) {\n const typeName = operation.type.name.value;\n switch (operation.operation) {\n case \"query\":\n operationTypes.query = typeName;\n break;\n case \"mutation\":\n operationTypes.mutation = typeName;\n break;\n case \"subscription\":\n operationTypes.subscription = typeName;\n break;\n default:\n break;\n }\n }\n};\n\nexport const createSchemaIndex = (document: DocumentNode): SchemaIndex => {\n const objects = new Map<string, ObjectRecord>();\n const inputs = new Map<string, InputRecord>();\n const enums = new Map<string, EnumRecord>();\n const unions = new Map<string, UnionRecord>();\n const scalars = new Map<string, ScalarRecord>();\n const operationTypes: OperationTypeNames = {};\n\n for (const definition of document.definitions) {\n switch (definition.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n case Kind.OBJECT_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.OBJECT_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(objects, definition.name.value, (name) => ({\n name,\n fields: new Map<string, FieldDefinitionNode>(),\n directives: [],\n }));\n addObjectFields(record.fields, definition.fields);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n case Kind.INPUT_OBJECT_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(inputs, definition.name.value, (name) => ({\n name,\n fields: new Map<string, InputValueDefinitionNode>(),\n directives: [],\n }));\n addInputFields(record.fields, definition.fields);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.ENUM_TYPE_DEFINITION:\n case Kind.ENUM_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.ENUM_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(enums, definition.name.value, (name) => ({\n name,\n values: new Map<string, EnumValueDefinitionNode>(),\n directives: [],\n }));\n addEnumValues(record.values, definition.values);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.UNION_TYPE_DEFINITION:\n case Kind.UNION_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.UNION_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(unions, definition.name.value, (name) => ({\n name,\n members: new Map<string, NamedTypeNode>(),\n directives: [],\n }));\n addUnionMembers(record.members, definition.types);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.SCALAR_TYPE_DEFINITION:\n case Kind.SCALAR_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.SCALAR_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(scalars, definition.name.value, (name) => ({\n name,\n directives: [],\n }));\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.SCHEMA_DEFINITION:\n case Kind.SCHEMA_EXTENSION:\n updateOperationTypes(operationTypes, definition);\n break;\n default:\n break;\n }\n }\n\n if (!operationTypes.query && objects.has(\"Query\")) {\n operationTypes.query = \"Query\";\n }\n if (!operationTypes.mutation && objects.has(\"Mutation\")) {\n operationTypes.mutation = \"Mutation\";\n }\n if (!operationTypes.subscription && objects.has(\"Subscription\")) {\n operationTypes.subscription = \"Subscription\";\n }\n\n return {\n objects,\n inputs,\n enums,\n unions,\n scalars,\n operationTypes,\n } satisfies SchemaIndex;\n};\n\ntype TypeLevel = {\n readonly kind: \"list\" | \"named\";\n readonly nonNull: boolean;\n};\n\nconst collectTypeLevels = (\n type: TypeNode,\n nonNull = false,\n levels: TypeLevel[] = [],\n): { readonly name: string; readonly levels: TypeLevel[] } => {\n if (type.kind === Kind.NON_NULL_TYPE) {\n return collectTypeLevels(type.type, true, levels);\n }\n\n if (type.kind === Kind.LIST_TYPE) {\n levels.push({ kind: \"list\", nonNull });\n return collectTypeLevels(type.type, false, levels);\n }\n\n levels.push({ kind: \"named\", nonNull });\n return { name: type.name.value, levels };\n};\n\nconst buildTypeModifier = (levels: TypeLevel[]): TypeModifier => {\n let modifier: TypeModifier = \"?\";\n\n for (const level of levels.slice().reverse()) {\n if (level.kind === \"named\") {\n // Inner type: always explicit nullable marker\n modifier = level.nonNull ? \"!\" : \"?\";\n continue;\n }\n\n // List type: append []? or []! based on list's nullability\n const listSuffix = level.nonNull ? \"[]!\" : \"[]?\";\n modifier = `${modifier}${listSuffix}` as TypeModifier;\n }\n\n return modifier;\n};\n\nconst parseTypeReference = (type: TypeNode): { readonly name: string; readonly modifier: string } => {\n const { name, levels } = collectTypeLevels(type);\n return { name, modifier: buildTypeModifier(levels) };\n};\n\nconst renderType = (name: string, modifier: string): string => JSON.stringify(`${name}:${modifier}`);\n\nconst isScalarName = (schema: SchemaIndex, name: string): boolean => builtinScalarTypes.has(name) || schema.scalars.has(name);\nconst isEnumName = (schema: SchemaIndex, name: string): boolean => schema.enums.has(name);\nconst _isInputName = (schema: SchemaIndex, name: string): boolean => schema.inputs.has(name);\nconst isUnionName = (schema: SchemaIndex, name: string): boolean => schema.unions.has(name);\nconst isObjectName = (schema: SchemaIndex, name: string): boolean => schema.objects.has(name);\n\nconst renderConstValue = (value: ConstValueNode): string => {\n switch (value.kind) {\n case Kind.NULL:\n return \"null\";\n case Kind.INT:\n case Kind.FLOAT:\n return value.value;\n case Kind.STRING:\n case Kind.ENUM:\n return JSON.stringify(value.value);\n case Kind.BOOLEAN:\n return value.value ? \"true\" : \"false\";\n case Kind.LIST:\n return `[${value.values.map((item) => renderConstValue(item)).join(\", \")}]`;\n case Kind.OBJECT: {\n if (value.fields.length === 0) {\n return \"{}\";\n }\n const entries = value.fields.map((field) => `${field.name.value}: ${renderConstValue(field.value)}`);\n return `{ ${entries.join(\", \")} }`;\n }\n }\n};\n\nconst renderConstArgumentMap = (\n args: readonly { readonly name: { readonly value: string }; readonly value: ConstValueNode }[] | undefined,\n): string => {\n const entries = (args ?? []).map((arg) => `${arg.name.value}: ${renderConstValue(arg.value)}`);\n return renderPropertyLines({ entries, indentSize: 8 });\n};\n\nconst renderDirectives = (directives: readonly ConstDirectiveNode[] | undefined): string => {\n const entries = (directives ?? []).map(\n (directive) => `${directive.name.value}: ${renderConstArgumentMap(directive.arguments)}`,\n );\n return renderPropertyLines({ entries, indentSize: 8 });\n};\n\nconst renderDefaultValue = (value: ConstValueNode | null | undefined): string =>\n value ? `() => (${renderConstValue(value)})` : \"null\";\n\nconst renderInputRef = (schema: SchemaIndex, definition: InputValueDefinitionNode): string => {\n const { name, modifier } = parseTypeReference(definition.type);\n const tuple = renderType(name, modifier);\n const defaultValue = renderDefaultValue(definition.defaultValue ?? null);\n const directives = renderDirectives(definition.directives);\n\n if (isScalarName(schema, name)) {\n return `unsafeInputType.scalar(${tuple}, { default: ${defaultValue}, directives: ${directives} })`;\n }\n\n if (isEnumName(schema, name)) {\n return `unsafeInputType.enum(${tuple}, { default: ${defaultValue}, directives: ${directives} })`;\n }\n\n return `unsafeInputType.input(${tuple}, { default: ${defaultValue}, directives: ${directives} })`;\n};\n\nconst renderArgumentMap = (schema: SchemaIndex, args: readonly InputValueDefinitionNode[] | undefined): string => {\n const entries = [...(args ?? [])]\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((arg) => `${arg.name.value}: ${renderInputRef(schema, arg)}`);\n\n return renderPropertyLines({ entries, indentSize: 8 });\n};\n\nconst renderOutputRef = (schema: SchemaIndex, type: TypeNode, args: readonly InputValueDefinitionNode[] | undefined): string => {\n const { name, modifier } = parseTypeReference(type);\n const modifiedType = renderType(name, modifier);\n const argumentMap = renderArgumentMap(schema, args);\n\n if (isScalarName(schema, name)) {\n return `unsafeOutputType.scalar(${modifiedType}, { arguments: ${argumentMap} })`;\n }\n\n if (isEnumName(schema, name)) {\n return `unsafeOutputType.enum(${modifiedType}, { arguments: ${argumentMap} })`;\n }\n\n if (isUnionName(schema, name)) {\n return `unsafeOutputType.union(${modifiedType}, { arguments: ${argumentMap} })`;\n }\n\n if (isObjectName(schema, name)) {\n return `unsafeOutputType.object(${modifiedType}, { arguments: ${argumentMap} })`;\n }\n\n return `unsafeOutputType.scalar(${modifiedType}, { arguments: ${argumentMap} })`;\n};\n\nconst renderPropertyLines = ({ entries, indentSize }: { entries: string[]; indentSize: number }) => {\n if (entries.length === 0) {\n return \"{}\";\n }\n\n const indent = \" \".repeat(indentSize);\n const lastIndent = \" \".repeat(indentSize - 2);\n return [\"{\", `${indent}${entries.join(`,\\n${indent}`)},`, `${lastIndent}}`].join(`\\n`);\n};\n\nconst renderObjectFields = (schema: SchemaIndex, fields: Map<string, FieldDefinitionNode>): string => {\n const entries = Array.from(fields.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((field) => `${field.name.value}: ${renderOutputRef(schema, field.type, field.arguments)}`);\n\n return renderPropertyLines({ entries, indentSize: 6 });\n};\n\nconst renderInputFields = (schema: SchemaIndex, fields: Map<string, InputValueDefinitionNode>): string => {\n const entries = Array.from(fields.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((field) => `${field.name.value}: ${renderInputRef(schema, field)}`);\n\n return renderPropertyLines({ entries, indentSize: 6 });\n};\n\nconst renderScalarDefinition = (record: ScalarRecord): string => {\n const typeInfo = builtinScalarTypes.get(record.name) ?? { input: \"string\", output: \"string\" };\n const scalarType = `type<{ input: ${typeInfo.input}; output: ${typeInfo.output} }>()`;\n return `${record.name}: define(\"${record.name}\").scalar(${scalarType})`;\n};\n\nconst renderObjectDefinition = (schema: SchemaIndex, typeName: string): string => {\n const record = schema.objects.get(typeName);\n if (!record) {\n return \"\";\n }\n\n const fields = renderObjectFields(schema, record.fields);\n return `${record.name}: define(\"${record.name}\").object(${fields})`;\n};\n\nconst renderInputDefinition = (schema: SchemaIndex, typeName: string): string => {\n const record = schema.inputs.get(typeName);\n if (!record) {\n return \"\";\n }\n\n const fields = renderInputFields(schema, record.fields);\n return `${record.name}: define(\"${record.name}\").input(${fields})`;\n};\n\nconst renderEnumDefinition = (schema: SchemaIndex, typeName: string): string => {\n const record = schema.enums.get(typeName);\n if (!record) {\n return \"\";\n }\n\n const values = Array.from(record.values.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((value) => `${value.name.value}: true`)\n .join(\", \");\n const body = values.length === 0 ? \"{}\" : `{ ${values} }`;\n\n return `${record.name}: define(\"${record.name}\").enum(${body})`;\n};\n\nconst renderUnionDefinition = (schema: SchemaIndex, typeName: string): string => {\n const record = schema.unions.get(typeName);\n if (!record) {\n return \"\";\n }\n\n const members = Array.from(record.members.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((member) => `${member.name.value}: true`)\n .join(\", \");\n const body = members.length === 0 ? \"{}\" : `{ ${members} }`;\n\n return `${record.name}: define(\"${record.name}\").union(${body})`;\n};\n\nconst collectObjectTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.objects.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectInputTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.inputs.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectEnumTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.enums.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectUnionTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.unions.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectScalarNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.scalars.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nexport type GeneratedModule = {\n readonly code: string;\n readonly stats: {\n readonly objects: number;\n readonly enums: number;\n readonly inputs: number;\n readonly unions: number;\n };\n};\n\ntype PerSchemaInjection = {\n readonly adapterImportPath: string;\n readonly scalarImportPath: string;\n};\n\ntype RuntimeTemplateInjection =\n | { readonly mode: \"inline\" }\n | {\n readonly mode: \"inject\";\n readonly perSchema: Map<string, PerSchemaInjection>;\n };\n\nexport type RuntimeGenerationOptions = {\n readonly injection?: Map<string, PerSchemaInjection>;\n};\n\ntype MultiRuntimeTemplateOptions = {\n readonly schemas: Record<\n string,\n {\n readonly queryType: string;\n readonly mutationType: string;\n readonly subscriptionType: string;\n readonly scalarBlock: string;\n readonly enumBlock: string;\n readonly inputBlock: string;\n readonly objectBlock: string;\n readonly unionBlock: string;\n }\n >;\n readonly injection: RuntimeTemplateInjection;\n};\n\nconst multiRuntimeTemplate = ($$: MultiRuntimeTemplateOptions) => {\n // Build imports based on injection mode\n const imports: string[] = [];\n const adapterAliases = new Map<string, string>();\n const scalarAliases = new Map<string, string>();\n\n if ($$.injection.mode === \"inject\") {\n // Generate per-schema imports\n for (const [schemaName, injection] of $$.injection.perSchema) {\n const adapterAlias = `adapter_${schemaName}`;\n const scalarAlias = `scalar_${schemaName}`;\n adapterAliases.set(schemaName, adapterAlias);\n scalarAliases.set(schemaName, scalarAlias);\n\n imports.push(`import { adapter as ${adapterAlias} } from \"${injection.adapterImportPath}\";`);\n imports.push(`import { scalar as ${scalarAlias} } from \"${injection.scalarImportPath}\";`);\n }\n }\n\n const extraImports = imports.length > 0 ? `${imports.join(\"\\n\")}\\n` : \"\";\n\n // Generate per-schema definitions\n const schemaBlocks: string[] = [];\n const gqlEntries: string[] = [];\n\n for (const [name, config] of Object.entries($$.schemas)) {\n const schemaVar = `${name}Schema`;\n const adapterVar = $$.injection.mode === \"inject\" ? adapterAliases.get(name) : `adapter_${name}`;\n const scalarBlock = $$.injection.mode === \"inject\" ? scalarAliases.get(name) : config.scalarBlock;\n\n // Generate adapter if inline mode\n const adapterDefinition =\n $$.injection.mode === \"inject\"\n ? \"\"\n : `const ${adapterVar} = createRuntimeAdapter(({ type }) => ({\\n nonGraphqlErrorType: type<{ type: \"non-graphql-error\"; cause: unknown }>(),\\n}));\\n`;\n\n schemaBlocks.push(`${adapterDefinition}\nconst ${schemaVar} = {\n label: \"${name}\" as const,\n operations: defineOperationRoots({\n query: \"${config.queryType}\",\n mutation: \"${config.mutationType}\",\n subscription: \"${config.subscriptionType}\",\n }),\n scalar: ${scalarBlock},\n enum: ${config.enumBlock},\n input: ${config.inputBlock},\n object: ${config.objectBlock},\n union: ${config.unionBlock},\n} satisfies AnyGraphqlSchema;\n\nexport type Schema_${name} = typeof ${schemaVar} & { _?: never };\nexport type Adapter_${name} = typeof ${adapterVar} & { _?: never };`);\n\n gqlEntries.push(` ${name}: createGqlElementComposer<Schema_${name}, Adapter_${name}>(${schemaVar})`);\n }\n\n // Include createRuntimeAdapter import only in inline mode\n const runtimeImport = $$.injection.mode === \"inline\" ? '\\nimport { createRuntimeAdapter } from \"@soda-gql/runtime\";' : \"\";\n\n return `\\\nimport {\n type AnyGraphqlSchema,\n createGqlElementComposer,\n define,\n defineOperationRoots,\n unsafeInputType,\n unsafeOutputType,\n} from \"@soda-gql/core\";${runtimeImport}\n${extraImports}\n${schemaBlocks.join(\"\\n\")}\n\nexport const gql = {\n${gqlEntries.join(\",\\n\")}\n};\n`;\n};\n\nexport const generateMultiSchemaModule = (\n schemas: Map<string, DocumentNode>,\n options?: RuntimeGenerationOptions,\n): GeneratedModule => {\n // biome-ignore lint/suspicious/noExplicitAny: complex schema config type\n const schemaConfigs: Record<string, any> = {};\n const allStats = {\n objects: 0,\n enums: 0,\n inputs: 0,\n unions: 0,\n };\n\n for (const [name, document] of schemas.entries()) {\n const schema = createSchemaIndex(document);\n\n const builtinScalarDefinitions = Array.from(builtinScalarTypes.keys()).map((name) =>\n renderScalarDefinition(schema.scalars.get(name) ?? { name, directives: [] }),\n );\n\n const customScalarDefinitions = collectScalarNames(schema)\n .filter((name) => !builtinScalarTypes.has(name))\n .map((name) => {\n const record = schema.scalars.get(name);\n return record ? renderScalarDefinition(record) : \"\";\n })\n .filter((definition) => definition.length > 0);\n\n const allScalarDefinitions = builtinScalarDefinitions.concat(customScalarDefinitions);\n\n const objectTypeNames = collectObjectTypeNames(schema);\n const enumTypeNames = collectEnumTypeNames(schema);\n const inputTypeNames = collectInputTypeNames(schema);\n const unionTypeNames = collectUnionTypeNames(schema);\n\n const scalarBlock = renderPropertyLines({ entries: allScalarDefinitions, indentSize: 4 });\n const enumDefinitions = enumTypeNames\n .map((name) => renderEnumDefinition(schema, name))\n .filter((definition) => definition.length > 0);\n const enumBlock = renderPropertyLines({ entries: enumDefinitions, indentSize: 4 });\n const inputDefinitions = inputTypeNames\n .map((name) => renderInputDefinition(schema, name))\n .filter((definition) => definition.length > 0);\n const inputBlock = renderPropertyLines({ entries: inputDefinitions, indentSize: 4 });\n const objectDefinitions = objectTypeNames\n .map((name) => renderObjectDefinition(schema, name))\n .filter((definition) => definition.length > 0);\n const objectBlock = renderPropertyLines({ entries: objectDefinitions, indentSize: 4 });\n const unionDefinitions = unionTypeNames\n .map((name) => renderUnionDefinition(schema, name))\n .filter((definition) => definition.length > 0);\n const unionBlock = renderPropertyLines({ entries: unionDefinitions, indentSize: 4 });\n\n const queryType = schema.operationTypes.query ?? \"Query\";\n const mutationType = schema.operationTypes.mutation ?? \"Mutation\";\n const subscriptionType = schema.operationTypes.subscription ?? \"Subscription\";\n\n schemaConfigs[name] = {\n queryType,\n mutationType,\n subscriptionType,\n scalarBlock,\n enumBlock,\n inputBlock,\n objectBlock,\n unionBlock,\n };\n\n // Accumulate stats\n allStats.objects += objectDefinitions.length;\n allStats.enums += enumDefinitions.length;\n allStats.inputs += inputDefinitions.length;\n allStats.unions += unionDefinitions.length;\n }\n\n const injection: RuntimeTemplateInjection = options?.injection\n ? { mode: \"inject\", perSchema: options.injection }\n : { mode: \"inline\" };\n\n const code = multiRuntimeTemplate({\n schemas: schemaConfigs,\n injection,\n });\n\n return {\n code,\n stats: allStats,\n };\n};\n"],"mappings":";;;AAeA,MAAM,qBAAqB,IAAI,IAAiE;CAC9F,CAAC,MAAM;EAAE,OAAO;EAAU,QAAQ;EAAU,CAAC;CAC7C,CAAC,UAAU;EAAE,OAAO;EAAU,QAAQ;EAAU,CAAC;CACjD,CAAC,OAAO;EAAE,OAAO;EAAU,QAAQ;EAAU,CAAC;CAC9C,CAAC,SAAS;EAAE,OAAO;EAAU,QAAQ;EAAU,CAAC;CAChD,CAAC,WAAW;EAAE,OAAO;EAAW,QAAQ;EAAW,CAAC;CACrD,CAAC;AA8CF,MAAM,gBAAmB,YAA4B,KAAa,YAAoC;CACpG,MAAM,WAAW,WAAW,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;EAChD,MAAM,YAAY,oBAAoB;GAAE,SAAS;GAAiB,YAAY;GAAG,CAAC;EAClF,MAAM,mBAAmB,eACtB,KAAK,WAAS,sBAAsB,QAAQA,OAAK,CAAC,CAClD,QAAQ,eAAe,WAAW,SAAS,EAAE;EAChD,MAAM,aAAa,oBAAoB;GAAE,SAAS;GAAkB,YAAY;GAAG,CAAC;EACpF,MAAM,oBAAoB,gBACvB,KAAK,WAAS,uBAAuB,QAAQA,OAAK,CAAC,CACnD,QAAQ,eAAe,WAAW,SAAS,EAAE;EAChD,MAAM,cAAc,oBAAoB;GAAE,SAAS;GAAmB,YAAY;GAAG,CAAC;EACtF,MAAM,mBAAmB,eACtB,KAAK,WAAS,sBAAsB,QAAQA,OAAK,CAAC,CAClD,QAAQ,eAAe,WAAW,SAAS,EAAE;EAChD,MAAM,aAAa,oBAAoB;GAAE,SAAS;GAAkB,YAAY;GAAG,CAAC;EAEpF,MAAM,YAAY,OAAO,eAAe,SAAS;EACjD,MAAM,eAAe,OAAO,eAAe,YAAY;EACvD,MAAM,mBAAmB,OAAO,eAAe,gBAAgB;AAE/D,gBAAc,QAAQ;GACpB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;AAGD,WAAS,WAAW,kBAAkB;AACtC,WAAS,SAAS,gBAAgB;AAClC,WAAS,UAAU,iBAAiB;AACpC,WAAS,UAAU,iBAAiB;;CAGtC,MAAMC,YAAsC,SAAS,YACjD;EAAE,MAAM;EAAU,WAAW,QAAQ;EAAW,GAChD,EAAE,MAAM,UAAU;CAEtB,MAAM,OAAO,qBAAqB;EAChC,SAAS;EACT;EACD,CAAC;AAEF,QAAO;EACL;EACA,OAAO;EACR"}
1
+ {"version":3,"file":"generator-DSOZFGSD.mjs","names":["operationTypes: OperationTypeNames","modifier: TypeModifier","imports: string[]","schemaBlocks: string[]","gqlEntries: string[]","schemaConfigs: Record<string, any>","name","injection: RuntimeTemplateInjection"],"sources":["../src/generator.ts"],"sourcesContent":["import type { TypeModifier } from \"@soda-gql/core\";\nimport {\n type ConstDirectiveNode,\n type ConstValueNode,\n type DocumentNode,\n type EnumValueDefinitionNode,\n type FieldDefinitionNode,\n type InputValueDefinitionNode,\n Kind,\n type NamedTypeNode,\n type SchemaDefinitionNode,\n type SchemaExtensionNode,\n type TypeNode,\n} from \"graphql\";\n\nconst builtinScalarTypes = new Map<string, { readonly input: string; readonly output: string }>([\n [\"ID\", { input: \"string\", output: \"string\" }],\n [\"String\", { input: \"string\", output: \"string\" }],\n [\"Int\", { input: \"number\", output: \"number\" }],\n [\"Float\", { input: \"number\", output: \"number\" }],\n [\"Boolean\", { input: \"boolean\", output: \"boolean\" }],\n]);\n\ntype OperationTypeNames = {\n query?: string;\n mutation?: string;\n subscription?: string;\n};\n\ntype ObjectRecord = {\n readonly name: string;\n readonly fields: Map<string, FieldDefinitionNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype InputRecord = {\n readonly name: string;\n readonly fields: Map<string, InputValueDefinitionNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype EnumRecord = {\n readonly name: string;\n readonly values: Map<string, EnumValueDefinitionNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype UnionRecord = {\n readonly name: string;\n readonly members: Map<string, NamedTypeNode>;\n directives: ConstDirectiveNode[];\n};\n\ntype ScalarRecord = {\n readonly name: string;\n directives: ConstDirectiveNode[];\n};\n\ntype SchemaIndex = {\n readonly objects: Map<string, ObjectRecord>;\n readonly inputs: Map<string, InputRecord>;\n readonly enums: Map<string, EnumRecord>;\n readonly unions: Map<string, UnionRecord>;\n readonly scalars: Map<string, ScalarRecord>;\n readonly operationTypes: OperationTypeNames;\n};\n\nconst ensureRecord = <T>(collection: Map<string, T>, key: string, factory: (name: string) => T): T => {\n const existing = collection.get(key);\n if (existing) {\n return existing;\n }\n\n const created = factory(key);\n collection.set(key, created);\n return created;\n};\n\nconst addObjectFields = (target: Map<string, FieldDefinitionNode>, fields: readonly FieldDefinitionNode[] | undefined): void => {\n if (!fields) {\n return;\n }\n\n for (const field of fields) {\n target.set(field.name.value, field);\n }\n};\n\nconst addInputFields = (\n target: Map<string, InputValueDefinitionNode>,\n fields: readonly InputValueDefinitionNode[] | undefined,\n): void => {\n if (!fields) {\n return;\n }\n\n for (const field of fields) {\n target.set(field.name.value, field);\n }\n};\n\nconst addEnumValues = (\n target: Map<string, EnumValueDefinitionNode>,\n values: readonly EnumValueDefinitionNode[] | undefined,\n): void => {\n if (!values) {\n return;\n }\n\n for (const value of values) {\n target.set(value.name.value, value);\n }\n};\n\nconst addUnionMembers = (target: Map<string, NamedTypeNode>, members: readonly NamedTypeNode[] | undefined): void => {\n if (!members) {\n return;\n }\n\n for (const member of members) {\n target.set(member.name.value, member);\n }\n};\n\nconst mergeDirectives = (\n existing: ConstDirectiveNode[] | undefined,\n incoming: readonly ConstDirectiveNode[] | undefined,\n precedence: \"definition\" | \"extension\",\n): ConstDirectiveNode[] => {\n const current = existing ?? [];\n const next = incoming ? Array.from(incoming) : [];\n return precedence === \"definition\" ? [...next, ...current] : [...current, ...next];\n};\n\nconst updateOperationTypes = (\n operationTypes: OperationTypeNames,\n definition: SchemaDefinitionNode | SchemaExtensionNode,\n): void => {\n for (const operation of definition.operationTypes ?? []) {\n const typeName = operation.type.name.value;\n switch (operation.operation) {\n case \"query\":\n operationTypes.query = typeName;\n break;\n case \"mutation\":\n operationTypes.mutation = typeName;\n break;\n case \"subscription\":\n operationTypes.subscription = typeName;\n break;\n default:\n break;\n }\n }\n};\n\nexport const createSchemaIndex = (document: DocumentNode): SchemaIndex => {\n const objects = new Map<string, ObjectRecord>();\n const inputs = new Map<string, InputRecord>();\n const enums = new Map<string, EnumRecord>();\n const unions = new Map<string, UnionRecord>();\n const scalars = new Map<string, ScalarRecord>();\n const operationTypes: OperationTypeNames = {};\n\n for (const definition of document.definitions) {\n switch (definition.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n case Kind.OBJECT_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.OBJECT_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(objects, definition.name.value, (name) => ({\n name,\n fields: new Map<string, FieldDefinitionNode>(),\n directives: [],\n }));\n addObjectFields(record.fields, definition.fields);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n case Kind.INPUT_OBJECT_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(inputs, definition.name.value, (name) => ({\n name,\n fields: new Map<string, InputValueDefinitionNode>(),\n directives: [],\n }));\n addInputFields(record.fields, definition.fields);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.ENUM_TYPE_DEFINITION:\n case Kind.ENUM_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.ENUM_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(enums, definition.name.value, (name) => ({\n name,\n values: new Map<string, EnumValueDefinitionNode>(),\n directives: [],\n }));\n addEnumValues(record.values, definition.values);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.UNION_TYPE_DEFINITION:\n case Kind.UNION_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.UNION_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(unions, definition.name.value, (name) => ({\n name,\n members: new Map<string, NamedTypeNode>(),\n directives: [],\n }));\n addUnionMembers(record.members, definition.types);\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.SCALAR_TYPE_DEFINITION:\n case Kind.SCALAR_TYPE_EXTENSION: {\n const precedence = definition.kind === Kind.SCALAR_TYPE_DEFINITION ? \"definition\" : \"extension\";\n const record = ensureRecord(scalars, definition.name.value, (name) => ({\n name,\n directives: [],\n }));\n record.directives = mergeDirectives(record.directives, definition.directives, precedence);\n break;\n }\n case Kind.SCHEMA_DEFINITION:\n case Kind.SCHEMA_EXTENSION:\n updateOperationTypes(operationTypes, definition);\n break;\n default:\n break;\n }\n }\n\n if (!operationTypes.query && objects.has(\"Query\")) {\n operationTypes.query = \"Query\";\n }\n if (!operationTypes.mutation && objects.has(\"Mutation\")) {\n operationTypes.mutation = \"Mutation\";\n }\n if (!operationTypes.subscription && objects.has(\"Subscription\")) {\n operationTypes.subscription = \"Subscription\";\n }\n\n return {\n objects,\n inputs,\n enums,\n unions,\n scalars,\n operationTypes,\n } satisfies SchemaIndex;\n};\n\ntype TypeLevel = {\n readonly kind: \"list\" | \"named\";\n readonly nonNull: boolean;\n};\n\nconst collectTypeLevels = (\n type: TypeNode,\n nonNull = false,\n levels: TypeLevel[] = [],\n): { readonly name: string; readonly levels: TypeLevel[] } => {\n if (type.kind === Kind.NON_NULL_TYPE) {\n return collectTypeLevels(type.type, true, levels);\n }\n\n if (type.kind === Kind.LIST_TYPE) {\n levels.push({ kind: \"list\", nonNull });\n return collectTypeLevels(type.type, false, levels);\n }\n\n levels.push({ kind: \"named\", nonNull });\n return { name: type.name.value, levels };\n};\n\nconst buildTypeModifier = (levels: TypeLevel[]): TypeModifier => {\n let modifier: TypeModifier = \"?\";\n\n for (const level of levels.slice().reverse()) {\n if (level.kind === \"named\") {\n // Inner type: always explicit nullable marker\n modifier = level.nonNull ? \"!\" : \"?\";\n continue;\n }\n\n // List type: append []? or []! based on list's nullability\n const listSuffix = level.nonNull ? \"[]!\" : \"[]?\";\n modifier = `${modifier}${listSuffix}` as TypeModifier;\n }\n\n return modifier;\n};\n\nconst parseTypeReference = (type: TypeNode): { readonly name: string; readonly modifier: string } => {\n const { name, levels } = collectTypeLevels(type);\n return { name, modifier: buildTypeModifier(levels) };\n};\n\nconst renderType = (name: string, modifier: string): string => JSON.stringify(`${name}:${modifier}`);\n\nconst isScalarName = (schema: SchemaIndex, name: string): boolean => builtinScalarTypes.has(name) || schema.scalars.has(name);\nconst isEnumName = (schema: SchemaIndex, name: string): boolean => schema.enums.has(name);\nconst _isInputName = (schema: SchemaIndex, name: string): boolean => schema.inputs.has(name);\nconst isUnionName = (schema: SchemaIndex, name: string): boolean => schema.unions.has(name);\nconst isObjectName = (schema: SchemaIndex, name: string): boolean => schema.objects.has(name);\n\nconst renderConstValue = (value: ConstValueNode): string => {\n switch (value.kind) {\n case Kind.NULL:\n return \"null\";\n case Kind.INT:\n case Kind.FLOAT:\n return value.value;\n case Kind.STRING:\n case Kind.ENUM:\n return JSON.stringify(value.value);\n case Kind.BOOLEAN:\n return value.value ? \"true\" : \"false\";\n case Kind.LIST:\n return `[${value.values.map((item) => renderConstValue(item)).join(\", \")}]`;\n case Kind.OBJECT: {\n if (value.fields.length === 0) {\n return \"{}\";\n }\n const entries = value.fields.map((field) => `${field.name.value}: ${renderConstValue(field.value)}`);\n return `{ ${entries.join(\", \")} }`;\n }\n }\n};\n\nconst renderConstArgumentMap = (\n args: readonly { readonly name: { readonly value: string }; readonly value: ConstValueNode }[] | undefined,\n): string => {\n const entries = (args ?? []).map((arg) => `${arg.name.value}: ${renderConstValue(arg.value)}`);\n return renderPropertyLines({ entries, indentSize: 8 });\n};\n\nconst renderDirectives = (directives: readonly ConstDirectiveNode[] | undefined): string => {\n const entries = (directives ?? []).map(\n (directive) => `${directive.name.value}: ${renderConstArgumentMap(directive.arguments)}`,\n );\n return renderPropertyLines({ entries, indentSize: 8 });\n};\n\nconst renderDefaultValue = (value: ConstValueNode | null | undefined): string =>\n value ? `() => (${renderConstValue(value)})` : \"null\";\n\nconst renderInputRef = (schema: SchemaIndex, definition: InputValueDefinitionNode): string => {\n const { name, modifier } = parseTypeReference(definition.type);\n const tuple = renderType(name, modifier);\n const defaultValue = renderDefaultValue(definition.defaultValue ?? null);\n const directives = renderDirectives(definition.directives);\n\n if (isScalarName(schema, name)) {\n return `unsafeInputType.scalar(${tuple}, { default: ${defaultValue}, directives: ${directives} })`;\n }\n\n if (isEnumName(schema, name)) {\n return `unsafeInputType.enum(${tuple}, { default: ${defaultValue}, directives: ${directives} })`;\n }\n\n return `unsafeInputType.input(${tuple}, { default: ${defaultValue}, directives: ${directives} })`;\n};\n\nconst renderArgumentMap = (schema: SchemaIndex, args: readonly InputValueDefinitionNode[] | undefined): string => {\n const entries = [...(args ?? [])]\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((arg) => `${arg.name.value}: ${renderInputRef(schema, arg)}`);\n\n return renderPropertyLines({ entries, indentSize: 8 });\n};\n\nconst renderOutputRef = (schema: SchemaIndex, type: TypeNode, args: readonly InputValueDefinitionNode[] | undefined): string => {\n const { name, modifier } = parseTypeReference(type);\n const modifiedType = renderType(name, modifier);\n const argumentMap = renderArgumentMap(schema, args);\n\n if (isScalarName(schema, name)) {\n return `unsafeOutputType.scalar(${modifiedType}, { arguments: ${argumentMap} })`;\n }\n\n if (isEnumName(schema, name)) {\n return `unsafeOutputType.enum(${modifiedType}, { arguments: ${argumentMap} })`;\n }\n\n if (isUnionName(schema, name)) {\n return `unsafeOutputType.union(${modifiedType}, { arguments: ${argumentMap} })`;\n }\n\n if (isObjectName(schema, name)) {\n return `unsafeOutputType.object(${modifiedType}, { arguments: ${argumentMap} })`;\n }\n\n return `unsafeOutputType.scalar(${modifiedType}, { arguments: ${argumentMap} })`;\n};\n\nconst renderPropertyLines = ({ entries, indentSize }: { entries: string[]; indentSize: number }) => {\n if (entries.length === 0) {\n return \"{}\";\n }\n\n const indent = \" \".repeat(indentSize);\n const lastIndent = \" \".repeat(indentSize - 2);\n return [\"{\", `${indent}${entries.join(`,\\n${indent}`)},`, `${lastIndent}}`].join(`\\n`);\n};\n\nconst renderObjectFields = (schema: SchemaIndex, fields: Map<string, FieldDefinitionNode>): string => {\n const entries = Array.from(fields.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((field) => `${field.name.value}: ${renderOutputRef(schema, field.type, field.arguments)}`);\n\n return renderPropertyLines({ entries, indentSize: 6 });\n};\n\nconst renderInputFields = (schema: SchemaIndex, fields: Map<string, InputValueDefinitionNode>): string => {\n const entries = Array.from(fields.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((field) => `${field.name.value}: ${renderInputRef(schema, field)}`);\n\n return renderPropertyLines({ entries, indentSize: 6 });\n};\n\nconst renderScalarDefinition = (record: ScalarRecord): string => {\n const typeInfo = builtinScalarTypes.get(record.name) ?? { input: \"string\", output: \"string\" };\n const scalarType = `type<{ input: ${typeInfo.input}; output: ${typeInfo.output} }>()`;\n return `${record.name}: define(\"${record.name}\").scalar(${scalarType})`;\n};\n\nconst renderObjectDefinition = (schema: SchemaIndex, typeName: string): string => {\n const record = schema.objects.get(typeName);\n if (!record) {\n return \"\";\n }\n\n const fields = renderObjectFields(schema, record.fields);\n return `${record.name}: define(\"${record.name}\").object(${fields})`;\n};\n\nconst renderInputDefinition = (schema: SchemaIndex, typeName: string): string => {\n const record = schema.inputs.get(typeName);\n if (!record) {\n return \"\";\n }\n\n const fields = renderInputFields(schema, record.fields);\n return `${record.name}: define(\"${record.name}\").input(${fields})`;\n};\n\nconst renderEnumDefinition = (schema: SchemaIndex, typeName: string): string => {\n const record = schema.enums.get(typeName);\n if (!record) {\n return \"\";\n }\n\n const values = Array.from(record.values.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((value) => `${value.name.value}: true`)\n .join(\", \");\n const body = values.length === 0 ? \"{}\" : `{ ${values} }`;\n\n return `${record.name}: define(\"${record.name}\").enum(${body})`;\n};\n\nconst renderUnionDefinition = (schema: SchemaIndex, typeName: string): string => {\n const record = schema.unions.get(typeName);\n if (!record) {\n return \"\";\n }\n\n const members = Array.from(record.members.values())\n .sort((left, right) => left.name.value.localeCompare(right.name.value))\n .map((member) => `${member.name.value}: true`)\n .join(\", \");\n const body = members.length === 0 ? \"{}\" : `{ ${members} }`;\n\n return `${record.name}: define(\"${record.name}\").union(${body})`;\n};\n\nconst collectObjectTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.objects.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectInputTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.inputs.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectEnumTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.enums.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectUnionTypeNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.unions.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nconst collectScalarNames = (schema: SchemaIndex): string[] =>\n Array.from(schema.scalars.keys())\n .filter((name) => !name.startsWith(\"__\"))\n .sort((left, right) => left.localeCompare(right));\n\nexport type GeneratedModule = {\n readonly code: string;\n readonly stats: {\n readonly objects: number;\n readonly enums: number;\n readonly inputs: number;\n readonly unions: number;\n };\n};\n\ntype PerSchemaInjection = {\n readonly adapterImportPath: string;\n readonly scalarImportPath: string;\n};\n\ntype RuntimeTemplateInjection =\n | { readonly mode: \"inline\" }\n | {\n readonly mode: \"inject\";\n readonly perSchema: Map<string, PerSchemaInjection>;\n };\n\nexport type RuntimeGenerationOptions = {\n readonly injection?: Map<string, PerSchemaInjection>;\n};\n\ntype MultiRuntimeTemplateOptions = {\n readonly schemas: Record<\n string,\n {\n readonly queryType: string;\n readonly mutationType: string;\n readonly subscriptionType: string;\n readonly scalarBlock: string;\n readonly enumBlock: string;\n readonly inputBlock: string;\n readonly objectBlock: string;\n readonly unionBlock: string;\n }\n >;\n readonly injection: RuntimeTemplateInjection;\n};\n\nconst multiRuntimeTemplate = ($$: MultiRuntimeTemplateOptions) => {\n // Build imports based on injection mode\n const imports: string[] = [];\n const adapterAliases = new Map<string, string>();\n const scalarAliases = new Map<string, string>();\n\n if ($$.injection.mode === \"inject\") {\n // Group imports by file path\n const importsByPath = new Map<string, string[]>();\n\n for (const [schemaName, injection] of $$.injection.perSchema) {\n const adapterAlias = `adapter_${schemaName}`;\n const scalarAlias = `scalar_${schemaName}`;\n adapterAliases.set(schemaName, adapterAlias);\n scalarAliases.set(schemaName, scalarAlias);\n\n // Group adapter import\n const adapterSpecifiers = importsByPath.get(injection.adapterImportPath) ?? [];\n if (!importsByPath.has(injection.adapterImportPath)) {\n importsByPath.set(injection.adapterImportPath, adapterSpecifiers);\n }\n adapterSpecifiers.push(`adapter as ${adapterAlias}`);\n\n // Group scalar import (may be same file as adapter)\n const scalarSpecifiers = importsByPath.get(injection.scalarImportPath) ?? [];\n if (!importsByPath.has(injection.scalarImportPath)) {\n importsByPath.set(injection.scalarImportPath, scalarSpecifiers);\n }\n scalarSpecifiers.push(`scalar as ${scalarAlias}`);\n }\n\n // Generate grouped imports\n for (const [path, specifiers] of importsByPath) {\n if (specifiers.length === 1) {\n imports.push(`import { ${specifiers[0]} } from \"${path}\";`);\n } else {\n imports.push(`import {\\n ${specifiers.join(\",\\n \")},\\n} from \"${path}\";`);\n }\n }\n }\n\n const extraImports = imports.length > 0 ? `${imports.join(\"\\n\")}\\n` : \"\";\n\n // Generate per-schema definitions\n const schemaBlocks: string[] = [];\n const gqlEntries: string[] = [];\n\n for (const [name, config] of Object.entries($$.schemas)) {\n const schemaVar = `${name}Schema`;\n const adapterVar = $$.injection.mode === \"inject\" ? adapterAliases.get(name) : `adapter_${name}`;\n const scalarBlock = $$.injection.mode === \"inject\" ? scalarAliases.get(name) : config.scalarBlock;\n\n // Generate adapter if inline mode\n const adapterDefinition =\n $$.injection.mode === \"inject\"\n ? \"\"\n : `const ${adapterVar} = createRuntimeAdapter(({ type }) => ({\\n nonGraphqlErrorType: type<{ type: \"non-graphql-error\"; cause: unknown }>(),\\n}));\\n`;\n\n schemaBlocks.push(`${adapterDefinition}\nconst ${schemaVar} = {\n label: \"${name}\" as const,\n operations: defineOperationRoots({\n query: \"${config.queryType}\",\n mutation: \"${config.mutationType}\",\n subscription: \"${config.subscriptionType}\",\n }),\n scalar: ${scalarBlock},\n enum: ${config.enumBlock},\n input: ${config.inputBlock},\n object: ${config.objectBlock},\n union: ${config.unionBlock},\n} satisfies AnyGraphqlSchema;\n\nexport type Schema_${name} = typeof ${schemaVar} & { _?: never };\nexport type Adapter_${name} = typeof ${adapterVar} & { _?: never };`);\n\n gqlEntries.push(` ${name}: createGqlElementComposer<Schema_${name}, Adapter_${name}>(${schemaVar})`);\n }\n\n // Include createRuntimeAdapter import only in inline mode\n const runtimeImport = $$.injection.mode === \"inline\" ? '\\nimport { createRuntimeAdapter } from \"@soda-gql/runtime\";' : \"\";\n\n return `\\\nimport {\n type AnyGraphqlSchema,\n createGqlElementComposer,\n define,\n defineOperationRoots,\n unsafeInputType,\n unsafeOutputType,\n} from \"@soda-gql/core\";${runtimeImport}\n${extraImports}\n${schemaBlocks.join(\"\\n\")}\n\nexport const gql = {\n${gqlEntries.join(\",\\n\")}\n};\n`;\n};\n\nexport const generateMultiSchemaModule = (\n schemas: Map<string, DocumentNode>,\n options?: RuntimeGenerationOptions,\n): GeneratedModule => {\n // biome-ignore lint/suspicious/noExplicitAny: complex schema config type\n const schemaConfigs: Record<string, any> = {};\n const allStats = {\n objects: 0,\n enums: 0,\n inputs: 0,\n unions: 0,\n };\n\n for (const [name, document] of schemas.entries()) {\n const schema = createSchemaIndex(document);\n\n const builtinScalarDefinitions = Array.from(builtinScalarTypes.keys()).map((name) =>\n renderScalarDefinition(schema.scalars.get(name) ?? { name, directives: [] }),\n );\n\n const customScalarDefinitions = collectScalarNames(schema)\n .filter((name) => !builtinScalarTypes.has(name))\n .map((name) => {\n const record = schema.scalars.get(name);\n return record ? renderScalarDefinition(record) : \"\";\n })\n .filter((definition) => definition.length > 0);\n\n const allScalarDefinitions = builtinScalarDefinitions.concat(customScalarDefinitions);\n\n const objectTypeNames = collectObjectTypeNames(schema);\n const enumTypeNames = collectEnumTypeNames(schema);\n const inputTypeNames = collectInputTypeNames(schema);\n const unionTypeNames = collectUnionTypeNames(schema);\n\n const scalarBlock = renderPropertyLines({ entries: allScalarDefinitions, indentSize: 4 });\n const enumDefinitions = enumTypeNames\n .map((name) => renderEnumDefinition(schema, name))\n .filter((definition) => definition.length > 0);\n const enumBlock = renderPropertyLines({ entries: enumDefinitions, indentSize: 4 });\n const inputDefinitions = inputTypeNames\n .map((name) => renderInputDefinition(schema, name))\n .filter((definition) => definition.length > 0);\n const inputBlock = renderPropertyLines({ entries: inputDefinitions, indentSize: 4 });\n const objectDefinitions = objectTypeNames\n .map((name) => renderObjectDefinition(schema, name))\n .filter((definition) => definition.length > 0);\n const objectBlock = renderPropertyLines({ entries: objectDefinitions, indentSize: 4 });\n const unionDefinitions = unionTypeNames\n .map((name) => renderUnionDefinition(schema, name))\n .filter((definition) => definition.length > 0);\n const unionBlock = renderPropertyLines({ entries: unionDefinitions, indentSize: 4 });\n\n const queryType = schema.operationTypes.query ?? \"Query\";\n const mutationType = schema.operationTypes.mutation ?? \"Mutation\";\n const subscriptionType = schema.operationTypes.subscription ?? \"Subscription\";\n\n schemaConfigs[name] = {\n queryType,\n mutationType,\n subscriptionType,\n scalarBlock,\n enumBlock,\n inputBlock,\n objectBlock,\n unionBlock,\n };\n\n // Accumulate stats\n allStats.objects += objectDefinitions.length;\n allStats.enums += enumDefinitions.length;\n allStats.inputs += inputDefinitions.length;\n allStats.unions += unionDefinitions.length;\n }\n\n const injection: RuntimeTemplateInjection = options?.injection\n ? { mode: \"inject\", perSchema: options.injection }\n : { mode: \"inline\" };\n\n const code = multiRuntimeTemplate({\n schemas: schemaConfigs,\n injection,\n });\n\n return {\n code,\n stats: allStats,\n };\n};\n"],"mappings":";;;AAeA,MAAM,qBAAqB,IAAI,IAAiE;CAC9F,CAAC,MAAM;EAAE,OAAO;EAAU,QAAQ;EAAU,CAAC;CAC7C,CAAC,UAAU;EAAE,OAAO;EAAU,QAAQ;EAAU,CAAC;CACjD,CAAC,OAAO;EAAE,OAAO;EAAU,QAAQ;EAAU,CAAC;CAC9C,CAAC,SAAS;EAAE,OAAO;EAAU,QAAQ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AAO,eAAe,SAAS;EACjD,MAAM,eAAe,OAAO,eAAe,YAAY;EACvD,MAAM,mBAAmB,OAAO,eAAe,gBAAgB;AAE/D,gBAAc,QAAQ;GACpB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;AAGD,WAAS,WAAW,kBAAkB;AACtC,WAAS,SAAS,gBAAgB;AAClC,WAAS,UAAU,iBAAiB;AACpC,WAAS,UAAU,iBAAiB;;CAGtC,MAAMC,YAAsC,SAAS,YACjD;EAAE,MAAM;EAAU,WAAW,QAAQ;EAAW,GAChD,EAAE,MAAM,UAAU;CAEtB,MAAM,OAAO,qBAAqB;EAChC,SAAS;EACT;EACD,CAAC;AAEF,QAAO;EACL;EACA,OAAO;EACR"}
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_generator = require('./generator-CoK2jtNh.cjs');
1
+ const require_generator = require('./generator-CxkxGwRx.cjs');
2
2
  let node_fs = require("node:fs");
3
3
  let node_path = require("node:path");
4
4
  let neverthrow = require("neverthrow");
@@ -154,10 +154,18 @@ const extensionMap = {
154
154
  ".mjs": ".mjs",
155
155
  ".cjs": ".cjs"
156
156
  };
157
- const toImportSpecifier = (fromPath, targetPath) => {
157
+ const toImportSpecifier = (fromPath, targetPath, options) => {
158
158
  const fromDir = (0, node_path.dirname)(fromPath);
159
159
  const normalized = (0, node_path.relative)(fromDir, targetPath).replace(/\\/g, "/");
160
160
  const sourceExt = (0, node_path.extname)(targetPath);
161
+ if (!options?.includeExtension) {
162
+ if (normalized.length === 0) {
163
+ return `./${(0, node_path.basename)(targetPath, sourceExt)}`;
164
+ }
165
+ const withPrefix$1 = normalized.startsWith(".") ? normalized : `./${normalized}`;
166
+ const currentExt$1 = (0, node_path.extname)(withPrefix$1);
167
+ return currentExt$1 ? withPrefix$1.slice(0, -currentExt$1.length) : withPrefix$1;
168
+ }
161
169
  const runtimeExt = extensionMap[sourceExt] ?? sourceExt;
162
170
  if (normalized.length === 0) {
163
171
  const base = runtimeExt !== sourceExt ? (0, node_path.basename)(targetPath, sourceExt) : (0, node_path.basename)(targetPath);
@@ -221,14 +229,15 @@ const runMultiSchemaCodegen = async (options) => {
221
229
  message: `Missing adapter or scalar configuration for schema '${schemaName}'`
222
230
  });
223
231
  }
232
+ const importSpecifierOptions = { includeExtension: options.importExtension };
224
233
  injectionConfig.set(schemaName, {
225
- adapterImportPath: toImportSpecifier(outPath, adapterPath),
226
- scalarImportPath: toImportSpecifier(outPath, scalarPath)
234
+ adapterImportPath: toImportSpecifier(outPath, adapterPath, importSpecifierOptions),
235
+ scalarImportPath: toImportSpecifier(outPath, scalarPath, importSpecifierOptions)
227
236
  });
228
237
  }
229
238
  const { code } = require_generator.generateMultiSchemaModule(schemas, { injection: injectionConfig });
230
239
  for (const [name, document] of schemas.entries()) {
231
- const schemaIndex = (await Promise.resolve().then(() => require("./generator-C2PYxsdV.cjs"))).createSchemaIndex(document);
240
+ const schemaIndex = (await Promise.resolve().then(() => require("./generator-DRMPDjI-.cjs"))).createSchemaIndex(document);
232
241
  const objects = Array.from(schemaIndex.objects.keys()).filter((n) => !n.startsWith("__")).length;
233
242
  const enums = Array.from(schemaIndex.enums.keys()).filter((n) => !n.startsWith("__")).length;
234
243
  const inputs = Array.from(schemaIndex.inputs.keys()).filter((n) => !n.startsWith("__")).length;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import * as neverthrow0 from "neverthrow";
1
+ import * as neverthrow1 from "neverthrow";
2
2
  import { Result } from "neverthrow";
3
3
  import { DocumentNode } from "graphql";
4
4
 
@@ -17,6 +17,7 @@ type MultiSchemaCodegenOptions = {
17
17
  readonly runtimeAdapters?: Record<string, string>;
18
18
  readonly scalars?: Record<string, string>;
19
19
  readonly injectFromPath?: string;
20
+ readonly importExtension?: boolean;
20
21
  };
21
22
  type CodegenCliCommand = {
22
23
  readonly kind: "generate";
@@ -77,14 +78,14 @@ type CodegenResult = Result<CodegenSuccess, CodegenError>;
77
78
  type MultiSchemaCodegenResult = Result<MultiSchemaCodegenSuccess, CodegenError>;
78
79
  //#endregion
79
80
  //#region packages/codegen/src/inject-template.d.ts
80
- declare const writeInjectTemplate: (outPath: string) => neverthrow0.Err<void, CodegenError> | neverthrow0.Ok<void, CodegenError>;
81
+ declare const writeInjectTemplate: (outPath: string) => neverthrow1.Err<void, CodegenError> | neverthrow1.Ok<void, CodegenError>;
81
82
  declare const getInjectTemplate: () => string;
82
83
  //#endregion
83
84
  //#region packages/codegen/src/runner.d.ts
84
85
  declare const runMultiSchemaCodegen: (options: MultiSchemaCodegenOptions) => Promise<MultiSchemaCodegenResult>;
85
86
  //#endregion
86
87
  //#region packages/codegen/src/schema.d.ts
87
- declare const loadSchema: (schemaPath: string) => neverthrow0.Err<DocumentNode, CodegenError> | neverthrow0.Ok<DocumentNode, CodegenError>;
88
+ declare const loadSchema: (schemaPath: string) => neverthrow1.Err<DocumentNode, CodegenError> | neverthrow1.Ok<DocumentNode, CodegenError>;
88
89
  declare const hashSchema: (document: DocumentNode) => string;
89
90
  //#endregion
90
91
  export { type CodegenCliCommand, type CodegenError, type CodegenFormat, type MultiSchemaCodegenOptions, type MultiSchemaCodegenResult, type MultiSchemaCodegenSuccess, hashSchema, loadSchema, runMultiSchemaCodegen, writeInjectTemplate };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/inject-template.ts","../src/runner.ts","../src/schema.ts"],"sourcesContent":[],"mappings":";;;;;KAEY,aAAA;KAEA,cAAA;;;EAFA,SAAA,MAAA,EAKO,aALM;EAEb,SAAA,cAAc,EAAA,MAGP;AAInB,CAAA;AACoB,KADR,yBAAA,GACQ;EAED,SAAA,OAAA,EAFC,MAED,CAAA,MAAA,EAAA,MAAA,CAAA;EACU,SAAA,OAAA,EAAA,MAAA;EACR,SAAA,MAAA,EAFF,aAEE;EAAM,SAAA,eAAA,CAAA,EADE,MACF,CAAA,MAAA,EAAA,MAAA,CAAA;EAIf,SAAA,OAAA,CAAA,EAJS,MAIQ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A,gBAAA,WAAA,CAAA,GAAA,cAAA;cAyBhC,uBAAwB"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/inject-template.ts","../src/runner.ts","../src/schema.ts"],"sourcesContent":[],"mappings":";;;;;KAEY,aAAA;KAEA,cAAA;;;EAFA,SAAA,MAAA,EAKO,aALM;EAEb,SAAA,cAAc,EAAA,MAGP;AAInB,CAAA;AACoB,KADR,yBAAA,GACQ;EAED,SAAA,OAAA,EAFC,MAED,CAAA,MAAA,EAAA,MAAA,CAAA;EACU,SAAA,OAAA,EAAA,MAAA;EACR,SAAA,MAAA,EAFF,aAEE;EAAM,SAAA,eAAA,CAAA,EADE,MACF,CAAA,MAAA,EAAA,MAAA,CAAA;EAKf,SAAA,OAAA,CAAA,EALS,MAKQ,CAAA,MAGL,EAAA,MAAA,CAAA;EAQZ,SAAA,cAAY,CAAA,EAAA,MAAA;EAoCZ,SAAA,eAAc,CAAA,EAAA,OAAA;AAS1B,CAAA;AAeY,KAvEA,iBAAA,GAuEa;EAAU,SAAA,IAAA,EAAA,UAAA;EAAgB,SAAA,OAAA,EApE3B,cAoE2B;CAAvB,GAAA;EAAM,SAAA,IAAA,EAAA,oBAAA;EACtB,SAAA,OAAA,EAAA,MAAA;EAAkC,SAAA,MAAA,EAhEvB,aAgEuB;CAA2B;AAAlC,KA7D3B,YAAA,GA6D2B;EAAM,SAAA,IAAA,EAAA,kBAAA;;;;EClDhC,SAAA,IAAA,EAAA,gBAuBZ;EAvBkD,SAAA,OAAA,EAAA,MAAA;EAAA,SAAA,UAAA,EAAA,MAAA;CAAA,GAAA;EAAA,SAAA,IAAA,EAAA,aAAA;EAAA,SAAA,OAAA,EAAA,MAAA;EAyBtC,SAAA,OAAA,EAAA,MAAyD;;;;ACTtE,CAAA,GAAa;EAAwC,SAAA,IAAA,EAAA,yBAAA;EAAoC,SAAA,OAAA,EAAA,MAAA;EAAR,SAAA,UAAA,EAAA,MAAA;CAAO,GAAA;;;;ACnDxF,CAAA,GAAa;EAAgC,SAAA,IAAA,EAAA,wBAAA;EAAA,SAAA,OAAA,EAAA,MAAA;EAAA,SAAA,OAAA,EAAA,MAAA;CAAA;AAAA,KH4DjC,cAAA,GG5DiC;EAAA,SAAA,UAAA,EAAA,MAAA;EAAA,SAAA,OAAA,EAAA,MAAA;EAyBhC,SAAA,OAA2G,EAAA,MAAA;;;;;KH4C5G,yBAAA;oBACQ;;;;;;;;;;KAcR,aAAA,GAAgB,OAAO,gBAAgB;KACvC,wBAAA,GAA2B,OAAO,2BAA2B;;;cClD5D,0CAAsC,WAAA,CAAA,UAAA,gBAAA,WAAA,CAAA,SAAA;cAyBtC;;;cCTA,iCAAwC,8BAA4B,QAAQ;;;cCnD5E,oCAAgC,WAAA,CAAA,IAAA,cAAA,gBAAA,WAAA,CAAA,GAAA,cAAA;cAyBhC,uBAAwB"}
package/dist/index.d.mts CHANGED
@@ -17,6 +17,7 @@ type MultiSchemaCodegenOptions = {
17
17
  readonly runtimeAdapters?: Record<string, string>;
18
18
  readonly scalars?: Record<string, string>;
19
19
  readonly injectFromPath?: string;
20
+ readonly importExtension?: boolean;
20
21
  };
21
22
  type CodegenCliCommand = {
22
23
  readonly kind: "generate";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/inject-template.ts","../src/runner.ts","../src/schema.ts"],"sourcesContent":[],"mappings":";;;;;KAEY,aAAA;KAEA,cAAA;;;EAFA,SAAA,MAAA,EAKO,aALM;EAEb,SAAA,cAAc,EAAA,MAGP;AAInB,CAAA;AACoB,KADR,yBAAA,GACQ;EAED,SAAA,OAAA,EAFC,MAED,CAAA,MAAA,EAAA,MAAA,CAAA;EACU,SAAA,OAAA,EAAA,MAAA;EACR,SAAA,MAAA,EAFF,aAEE;EAAM,SAAA,eAAA,CAAA,EADE,MACF,CAAA,MAAA,EAAA,MAAA,CAAA;EAIf,SAAA,OAAA,CAAA,EAJS,MAIQ,CAAA,MAGL,EAAA,MAA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AA,cAAA;cAyBhC,uBAAwB"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/inject-template.ts","../src/runner.ts","../src/schema.ts"],"sourcesContent":[],"mappings":";;;;;KAEY,aAAA;KAEA,cAAA;;;EAFA,SAAA,MAAA,EAKO,aALM;EAEb,SAAA,cAAc,EAAA,MAGP;AAInB,CAAA;AACoB,KADR,yBAAA,GACQ;EAED,SAAA,OAAA,EAFC,MAED,CAAA,MAAA,EAAA,MAAA,CAAA;EACU,SAAA,OAAA,EAAA,MAAA;EACR,SAAA,MAAA,EAFF,aAEE;EAAM,SAAA,eAAA,CAAA,EADE,MACF,CAAA,MAAA,EAAA,MAAA,CAAA;EAKf,SAAA,OAAA,CAAA,EALS,MAKQ,CAAA,MAGL,EAAA,MAAA,CAAA;EAQZ,SAAA,cAAY,CAAA,EAAA,MAAA;EAoCZ,SAAA,eAAc,CAAA,EAAA,OAAA;AAS1B,CAAA;AAeY,KAvEA,iBAAA,GAuEa;EAAU,SAAA,IAAA,EAAA,UAAA;EAAgB,SAAA,OAAA,EApE3B,cAoE2B;CAAvB,GAAA;EAAM,SAAA,IAAA,EAAA,oBAAA;EACtB,SAAA,OAAA,EAAA,MAAA;EAAkC,SAAA,MAAA,EAhEvB,aAgEuB;CAA2B;AAAlC,KA7D3B,YAAA,GA6D2B;EAAM,SAAA,IAAA,EAAA,kBAAA;;;;EClDhC,SAAA,IAAA,EAAA,gBAuBZ;EAvBkD,SAAA,OAAA,EAAA,MAAA;EAAA,SAAA,UAAA,EAAA,MAAA;CAAA,GAAA;EAAA,SAAA,IAAA,EAAA,aAAA;EAAA,SAAA,OAAA,EAAA,MAAA;EAyBtC,SAAA,OAAA,EAAA,MAAyD;;;;ACTtE,CAAA,GAAa;EAAwC,SAAA,IAAA,EAAA,yBAAA;EAAoC,SAAA,OAAA,EAAA,MAAA;EAAR,SAAA,UAAA,EAAA,MAAA;CAAO,GAAA;;;;ACnDxF,CAAA,GAAa;EAAgC,SAAA,IAAA,EAAA,wBAAA;EAAA,SAAA,OAAA,EAAA,MAAA;EAAA,SAAA,OAAA,EAAA,MAAA;CAAA;AAAA,KH4DjC,cAAA,GG5DiC;EAAA,SAAA,UAAA,EAAA,MAAA;EAAA,SAAA,OAAA,EAAA,MAAA;EAyBhC,SAAA,OAA2G,EAAA,MAAnF;;;;;KH4CzB,yBAAA;oBACQ;;;;;;;;;;KAcR,aAAA,GAAgB,OAAO,gBAAgB;KACvC,wBAAA,GAA2B,OAAO,2BAA2B;;;cClD5D,0CAAsC,WAAA,CAAA,UAAA,gBAAA,WAAA,CAAA,SAAA;cAyBtC;;;cCTA,iCAAwC,8BAA4B,QAAQ;;;cCnD5E,oCAAgC,WAAA,CAAA,IAAA,cAAA,gBAAA,WAAA,CAAA,GAAA,cAAA;cAyBhC,uBAAwB"}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as generateMultiSchemaModule } from "./generator-CVAppANp.mjs";
1
+ import { n as generateMultiSchemaModule } from "./generator-DSOZFGSD.mjs";
2
2
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
3
  import { basename, dirname, extname, relative, resolve } from "node:path";
4
4
  import { err, ok } from "neverthrow";
@@ -154,10 +154,18 @@ const extensionMap = {
154
154
  ".mjs": ".mjs",
155
155
  ".cjs": ".cjs"
156
156
  };
157
- const toImportSpecifier = (fromPath, targetPath) => {
157
+ const toImportSpecifier = (fromPath, targetPath, options) => {
158
158
  const fromDir = dirname(fromPath);
159
159
  const normalized = relative(fromDir, targetPath).replace(/\\/g, "/");
160
160
  const sourceExt = extname(targetPath);
161
+ if (!options?.includeExtension) {
162
+ if (normalized.length === 0) {
163
+ return `./${basename(targetPath, sourceExt)}`;
164
+ }
165
+ const withPrefix$1 = normalized.startsWith(".") ? normalized : `./${normalized}`;
166
+ const currentExt$1 = extname(withPrefix$1);
167
+ return currentExt$1 ? withPrefix$1.slice(0, -currentExt$1.length) : withPrefix$1;
168
+ }
161
169
  const runtimeExt = extensionMap[sourceExt] ?? sourceExt;
162
170
  if (normalized.length === 0) {
163
171
  const base = runtimeExt !== sourceExt ? basename(targetPath, sourceExt) : basename(targetPath);
@@ -221,14 +229,15 @@ const runMultiSchemaCodegen = async (options) => {
221
229
  message: `Missing adapter or scalar configuration for schema '${schemaName}'`
222
230
  });
223
231
  }
232
+ const importSpecifierOptions = { includeExtension: options.importExtension };
224
233
  injectionConfig.set(schemaName, {
225
- adapterImportPath: toImportSpecifier(outPath, adapterPath),
226
- scalarImportPath: toImportSpecifier(outPath, scalarPath)
234
+ adapterImportPath: toImportSpecifier(outPath, adapterPath, importSpecifierOptions),
235
+ scalarImportPath: toImportSpecifier(outPath, scalarPath, importSpecifierOptions)
227
236
  });
228
237
  }
229
238
  const { code } = generateMultiSchemaModule(schemas, { injection: injectionConfig });
230
239
  for (const [name, document] of schemas.entries()) {
231
- const schemaIndex = (await import("./generator-D-iGYq3g.mjs")).createSchemaIndex(document);
240
+ const schemaIndex = (await import("./generator-CoRRPbfk.mjs")).createSchemaIndex(document);
232
241
  const objects = Array.from(schemaIndex.objects.keys()).filter((n) => !n.startsWith("__")).length;
233
242
  const enums = Array.from(schemaIndex.enums.keys()).filter((n) => !n.startsWith("__")).length;
234
243
  const inputs = Array.from(schemaIndex.inputs.keys()).filter((n) => !n.startsWith("__")).length;
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["extensionMap: Record<string, string>","schemaHashes: Record<string, { schemaHash: string; objects: number; enums: number; inputs: number; unions: number }>"],"sources":["../src/inject-template.ts","../src/file.ts","../src/schema.ts","../src/tsdown-bundle.ts","../src/runner.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { err, ok } from \"neverthrow\";\n\nimport type { CodegenError } from \"./types\";\n\nconst templateContents = `\\\nimport { defineScalar } from \"@soda-gql/core\";\nimport { createRuntimeAdapter } from \"@soda-gql/runtime\";\n\nexport const scalar = {\n ...defineScalar(\"ID\", ({ type }) => ({\n input: type<string>(),\n output: type<string>(),\n directives: {},\n })),\n ...defineScalar(\"String\", ({ type }) => ({\n input: type<string>(),\n output: type<string>(),\n directives: {},\n })),\n ...defineScalar(\"Int\", ({ type }) => ({\n input: type<number>(),\n output: type<number>(),\n directives: {},\n })),\n ...defineScalar(\"Float\", ({ type }) => ({\n input: type<number>(),\n output: type<number>(),\n directives: {},\n })),\n ...defineScalar(\"Boolean\", ({ type }) => ({\n input: type<boolean>(),\n output: type<boolean>(),\n directives: {},\n })),\n} as const;\n\nexport const adapter = createRuntimeAdapter(({ type }) => ({\n nonGraphqlErrorType: type<{ type: \"non-graphql-error\"; cause: unknown }>(),\n}));\n`;\n\nexport const writeInjectTemplate = (outPath: string) => {\n const targetPath = resolve(outPath);\n\n try {\n if (existsSync(targetPath)) {\n return err<void, CodegenError>({\n code: \"INJECT_TEMPLATE_EXISTS\",\n message: `Inject module already exists: ${targetPath}`,\n outPath: targetPath,\n });\n }\n\n mkdirSync(dirname(targetPath), { recursive: true });\n writeFileSync(targetPath, `${templateContents}\\n`);\n return ok<void, CodegenError>(undefined);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return err<void, CodegenError>({\n code: \"INJECT_TEMPLATE_FAILED\",\n message,\n outPath: targetPath,\n });\n }\n};\n\nexport const getInjectTemplate = (): string => `${templateContents}\\n`;\n","import { mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { err, ok } from \"neverthrow\";\n\nimport type { CodegenError } from \"./types\";\n\nexport const writeModule = (outPath: string, contents: string) => {\n const targetPath = resolve(outPath);\n\n try {\n mkdirSync(dirname(targetPath), { recursive: true });\n writeFileSync(targetPath, contents);\n return ok<void, CodegenError>(undefined);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return err<void, CodegenError>({\n code: \"EMIT_FAILED\",\n message,\n outPath: targetPath,\n });\n }\n};\n","import { createHash } from \"node:crypto\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { type DocumentNode, parse, print } from \"graphql\";\nimport { err, ok } from \"neverthrow\";\n\nimport type { CodegenError } from \"./types\";\n\nexport const loadSchema = (schemaPath: string) => {\n const resolvedPath = resolve(schemaPath);\n\n if (!existsSync(resolvedPath)) {\n return err<DocumentNode, CodegenError>({\n code: \"SCHEMA_NOT_FOUND\",\n message: `Schema file not found at ${resolvedPath}`,\n schemaPath: resolvedPath,\n });\n }\n\n try {\n const schemaSource = readFileSync(resolvedPath, \"utf8\");\n const document = parse(schemaSource);\n return ok<DocumentNode, CodegenError>(document);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return err<DocumentNode, CodegenError>({\n code: \"SCHEMA_INVALID\",\n message: `SchemaValidationError: ${message}`,\n schemaPath: resolvedPath,\n });\n }\n};\n\nexport const hashSchema = (document: DocumentNode): string => createHash(\"sha256\").update(print(document)).digest(\"hex\");\n","import { dirname, extname } from \"node:path\";\nimport { err, ok, type Result } from \"neverthrow\";\nimport { build, type Options } from \"tsdown\";\nimport type { CodegenError } from \"./types\";\n\nexport type BundleResult = {\n readonly cjsPath: string;\n};\n\nexport const bundleGraphqlSystem = async (sourcePath: string): Promise<Result<BundleResult, CodegenError>> => {\n try {\n const sourceDir = dirname(sourcePath);\n const sourceExt = extname(sourcePath);\n const baseName = sourcePath.slice(0, -sourceExt.length);\n\n await build({\n config: false,\n entry: sourcePath,\n format: [\"cjs\"],\n platform: \"node\",\n external: [\"@soda-gql/core\", \"@soda-gql/runtime\"],\n dts: false,\n outDir: sourceDir,\n fixedExtension: true,\n clean: false,\n minify: false,\n sourcemap: false,\n treeshake: false,\n } satisfies Options);\n\n const cjsPath = `${baseName}.cjs`;\n\n return ok({ cjsPath });\n } catch (error) {\n return err({\n code: \"EMIT_FAILED\",\n message: `Failed to bundle graphql-system: ${error instanceof Error ? error.message : String(error)}`,\n outPath: sourcePath,\n });\n }\n};\n","import { existsSync } from \"node:fs\";\nimport { basename, dirname, extname, relative, resolve } from \"node:path\";\nimport { err, ok } from \"neverthrow\";\nimport { writeModule } from \"./file\";\nimport { generateMultiSchemaModule } from \"./generator\";\nimport { hashSchema, loadSchema } from \"./schema\";\nimport { bundleGraphqlSystem } from \"./tsdown-bundle\";\nimport type { MultiSchemaCodegenOptions, MultiSchemaCodegenResult, MultiSchemaCodegenSuccess } from \"./types\";\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\nconst toImportSpecifier = (fromPath: string, targetPath: string): string => {\n const fromDir = dirname(fromPath);\n const normalized = relative(fromDir, targetPath).replace(/\\\\/g, \"/\");\n const sourceExt = extname(targetPath);\n const runtimeExt = extensionMap[sourceExt] ?? sourceExt;\n\n if (normalized.length === 0) {\n const base = runtimeExt !== sourceExt ? basename(targetPath, sourceExt) : basename(targetPath);\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\nexport const runMultiSchemaCodegen = async (options: MultiSchemaCodegenOptions): Promise<MultiSchemaCodegenResult> => {\n const outPath = resolve(options.outPath);\n\n // Handle legacy injectFromPath for backward compatibility\n const runtimeAdapters = options.runtimeAdapters ?? (options.injectFromPath ? { default: options.injectFromPath } : {});\n const scalars = options.scalars ?? (options.injectFromPath ? { default: options.injectFromPath } : {});\n\n // Validate that all adapter and scalar files exist\n const adapterPaths = new Map<string, string>();\n const scalarPaths = new Map<string, string>();\n\n for (const [schemaName, adapterPath] of Object.entries(runtimeAdapters)) {\n const resolvedPath = resolve(adapterPath);\n if (!existsSync(resolvedPath)) {\n return err({\n code: \"INJECT_MODULE_NOT_FOUND\",\n message: `Runtime adapter module not found for schema '${schemaName}': ${resolvedPath}`,\n injectPath: resolvedPath,\n });\n }\n adapterPaths.set(schemaName, resolvedPath);\n }\n\n for (const [schemaName, scalarPath] of Object.entries(scalars)) {\n const resolvedPath = resolve(scalarPath);\n if (!existsSync(resolvedPath)) {\n return err({\n code: \"INJECT_MODULE_NOT_FOUND\",\n message: `Scalar module not found for schema '${schemaName}': ${resolvedPath}`,\n injectPath: resolvedPath,\n });\n }\n scalarPaths.set(schemaName, resolvedPath);\n }\n\n // Load all schemas\n const schemas = new Map<string, import(\"graphql\").DocumentNode>();\n const schemaHashes: Record<string, { schemaHash: string; objects: number; enums: number; inputs: number; unions: number }> = {};\n\n for (const [name, schemaPath] of Object.entries(options.schemas)) {\n const result = await loadSchema(schemaPath).match(\n (doc) => Promise.resolve(ok(doc)),\n (error) => Promise.resolve(err(error)),\n );\n\n if (result.isErr()) {\n return err(result.error);\n }\n\n schemas.set(name, result.value);\n }\n\n // Build injection config for each schema\n const injectionConfig = new Map<string, { adapterImportPath: string; scalarImportPath: string }>();\n\n for (const schemaName of schemas.keys()) {\n const adapterPath = adapterPaths.get(schemaName);\n const scalarPath = scalarPaths.get(schemaName);\n\n if (!adapterPath || !scalarPath) {\n return err({\n code: \"INJECT_MODULE_REQUIRED\",\n message: `Missing adapter or scalar configuration for schema '${schemaName}'`,\n });\n }\n\n injectionConfig.set(schemaName, {\n adapterImportPath: toImportSpecifier(outPath, adapterPath),\n scalarImportPath: toImportSpecifier(outPath, scalarPath),\n });\n }\n\n // Generate multi-schema module\n const { code } = generateMultiSchemaModule(schemas, {\n injection: injectionConfig,\n });\n\n // Calculate individual schema stats and hashes\n for (const [name, document] of schemas.entries()) {\n const schemaIndex = (await import(\"./generator\")).createSchemaIndex(document);\n const objects = Array.from(schemaIndex.objects.keys()).filter((n) => !n.startsWith(\"__\")).length;\n const enums = Array.from(schemaIndex.enums.keys()).filter((n) => !n.startsWith(\"__\")).length;\n const inputs = Array.from(schemaIndex.inputs.keys()).filter((n) => !n.startsWith(\"__\")).length;\n const unions = Array.from(schemaIndex.unions.keys()).filter((n) => !n.startsWith(\"__\")).length;\n\n schemaHashes[name] = {\n schemaHash: hashSchema(document),\n objects,\n enums,\n inputs,\n unions,\n };\n }\n\n // Write the module\n const writeResult = await writeModule(outPath, code).match(\n () => Promise.resolve(ok(undefined)),\n (error) => Promise.resolve(err(error)),\n );\n\n if (writeResult.isErr()) {\n return err(writeResult.error);\n }\n\n // Bundle the generated module with tsdown\n const bundleOutcome = await bundleGraphqlSystem(outPath);\n const bundleResult = bundleOutcome.match(\n (result) => ok(result),\n (error) => err(error),\n );\n\n if (bundleResult.isErr()) {\n return err(bundleResult.error);\n }\n\n return ok({\n schemas: schemaHashes,\n outPath,\n cjsPath: bundleResult.value.cjsPath,\n } satisfies MultiSchemaCodegenSuccess);\n};\n"],"mappings":";;;;;;;;;AAMA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCzB,MAAa,uBAAuB,YAAoB;CACtD,MAAM,aAAa,QAAQ,QAAQ;AAEnC,KAAI;AACF,MAAI,WAAW,WAAW,EAAE;AAC1B,UAAO,IAAwB;IAC7B,MAAM;IACN,SAAS,iCAAiC;IAC1C,SAAS;IACV,CAAC;;AAGJ,YAAU,QAAQ,WAAW,EAAE,EAAE,WAAW,MAAM,CAAC;AACnD,gBAAc,YAAY,GAAG,iBAAiB,IAAI;AAClD,SAAO,GAAuB,UAAU;UACjC,OAAO;EACd,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AACtE,SAAO,IAAwB;GAC7B,MAAM;GACN;GACA,SAAS;GACV,CAAC;;;AAIN,MAAa,0BAAkC,GAAG,iBAAiB;;;;AC9DnE,MAAa,eAAe,SAAiB,aAAqB;CAChE,MAAM,aAAa,QAAQ,QAAQ;AAEnC,KAAI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e,MAAM,OAAO,6BAAgB,kBAAkB,SAAS;EAC7E,MAAM,UAAU,MAAM,KAAK,YAAY,QAAQ,MAAM,CAAC,CAAC,QAAQ,MAAM,CAAC,EAAE,WAAW,KAAK,CAAC,CAAC;EAC1F,MAAM,QAAQ,MAAM,KAAK,YAAY,MAAM,MAAM,CAAC,CAAC,QAAQ,MAAM,CAAC,EAAE,WAAW,KAAK,CAAC,CAAC;EACtF,MAAM,SAAS,MAAM,KAAK,YAAY,OAAO,MAAM,CAAC,CAAC,QAAQ,MAAM,CAAC,EAAE,WAAW,KAAK,CAAC,CAAC;EACxF,MAAM,SAAS,MAAM,KAAK,YAAY,OAAO,MAAM,CAAC,CAAC,QAAQ,MAAM,CAAC,EAAE,WAAW,KAAK,CAAC,CAAC;AAExF,eAAa,QAAQ;GACnB,YAAY,WAAW,SAAS;GAChC;GACA;GACA;GACA;GACD;;CAIH,MAAM,cAAc,MAAM,YAAY,SAAS,KAAK,CAAC,YAC7C,QAAQ,QAAQ,GAAG,UAAU,CAAC,GACnC,UAAU,QAAQ,QAAQ,IAAI,MAAM,CAAC,CACvC;AAED,KAAI,YAAY,OAAO,EAAE;AACvB,SAAO,IAAI,YAAY,MAAM;;CAI/B,MAAM,gBAAgB,MAAM,oBAAoB,QAAQ;CACxD,MAAM,eAAe,cAAc,OAChC,WAAW,GAAG,OAAO,GACrB,UAAU,IAAI,MAAM,CACtB;AAED,KAAI,aAAa,OAAO,EAAE;AACxB,SAAO,IAAI,aAAa,MAAM;;AAGhC,QAAO,GAAG;EACR,SAAS;EACT;EACA,SAAS,aAAa,MAAM;EAC7B,CAAqC"}
1
+ {"version":3,"file":"index.mjs","names":["extensionMap: Record<string, string>","withPrefix","currentExt","schemaHashes: Record<string, { schemaHash: string; objects: number; enums: number; inputs: number; unions: number }>"],"sources":["../src/inject-template.ts","../src/file.ts","../src/schema.ts","../src/tsdown-bundle.ts","../src/runner.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { err, ok } from \"neverthrow\";\n\nimport type { CodegenError } from \"./types\";\n\nconst templateContents = `\\\nimport { defineScalar } from \"@soda-gql/core\";\nimport { createRuntimeAdapter } from \"@soda-gql/runtime\";\n\nexport const scalar = {\n ...defineScalar(\"ID\", ({ type }) => ({\n input: type<string>(),\n output: type<string>(),\n directives: {},\n })),\n ...defineScalar(\"String\", ({ type }) => ({\n input: type<string>(),\n output: type<string>(),\n directives: {},\n })),\n ...defineScalar(\"Int\", ({ type }) => ({\n input: type<number>(),\n output: type<number>(),\n directives: {},\n })),\n ...defineScalar(\"Float\", ({ type }) => ({\n input: type<number>(),\n output: type<number>(),\n directives: {},\n })),\n ...defineScalar(\"Boolean\", ({ type }) => ({\n input: type<boolean>(),\n output: type<boolean>(),\n directives: {},\n })),\n} as const;\n\nexport const adapter = createRuntimeAdapter(({ type }) => ({\n nonGraphqlErrorType: type<{ type: \"non-graphql-error\"; cause: unknown }>(),\n}));\n`;\n\nexport const writeInjectTemplate = (outPath: string) => {\n const targetPath = resolve(outPath);\n\n try {\n if (existsSync(targetPath)) {\n return err<void, CodegenError>({\n code: \"INJECT_TEMPLATE_EXISTS\",\n message: `Inject module already exists: ${targetPath}`,\n outPath: targetPath,\n });\n }\n\n mkdirSync(dirname(targetPath), { recursive: true });\n writeFileSync(targetPath, `${templateContents}\\n`);\n return ok<void, CodegenError>(undefined);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return err<void, CodegenError>({\n code: \"INJECT_TEMPLATE_FAILED\",\n message,\n outPath: targetPath,\n });\n }\n};\n\nexport const getInjectTemplate = (): string => `${templateContents}\\n`;\n","import { mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { err, ok } from \"neverthrow\";\n\nimport type { CodegenError } from \"./types\";\n\nexport const writeModule = (outPath: string, contents: string) => {\n const targetPath = resolve(outPath);\n\n try {\n mkdirSync(dirname(targetPath), { recursive: true });\n writeFileSync(targetPath, contents);\n return ok<void, CodegenError>(undefined);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return err<void, CodegenError>({\n code: \"EMIT_FAILED\",\n message,\n outPath: targetPath,\n });\n }\n};\n","import { createHash } from \"node:crypto\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { type DocumentNode, parse, print } from \"graphql\";\nimport { err, ok } from \"neverthrow\";\n\nimport type { CodegenError } from \"./types\";\n\nexport const loadSchema = (schemaPath: string) => {\n const resolvedPath = resolve(schemaPath);\n\n if (!existsSync(resolvedPath)) {\n return err<DocumentNode, CodegenError>({\n code: \"SCHEMA_NOT_FOUND\",\n message: `Schema file not found at ${resolvedPath}`,\n schemaPath: resolvedPath,\n });\n }\n\n try {\n const schemaSource = readFileSync(resolvedPath, \"utf8\");\n const document = parse(schemaSource);\n return ok<DocumentNode, CodegenError>(document);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return err<DocumentNode, CodegenError>({\n code: \"SCHEMA_INVALID\",\n message: `SchemaValidationError: ${message}`,\n schemaPath: resolvedPath,\n });\n }\n};\n\nexport const hashSchema = (document: DocumentNode): string => createHash(\"sha256\").update(print(document)).digest(\"hex\");\n","import { dirname, extname } from \"node:path\";\nimport { err, ok, type Result } from \"neverthrow\";\nimport { build, type Options } from \"tsdown\";\nimport type { CodegenError } from \"./types\";\n\nexport type BundleResult = {\n readonly cjsPath: string;\n};\n\nexport const bundleGraphqlSystem = async (sourcePath: string): Promise<Result<BundleResult, CodegenError>> => {\n try {\n const sourceDir = dirname(sourcePath);\n const sourceExt = extname(sourcePath);\n const baseName = sourcePath.slice(0, -sourceExt.length);\n\n await build({\n config: false,\n entry: sourcePath,\n format: [\"cjs\"],\n platform: \"node\",\n external: [\"@soda-gql/core\", \"@soda-gql/runtime\"],\n dts: false,\n outDir: sourceDir,\n fixedExtension: true,\n clean: false,\n minify: false,\n sourcemap: false,\n treeshake: false,\n } satisfies Options);\n\n const cjsPath = `${baseName}.cjs`;\n\n return ok({ cjsPath });\n } catch (error) {\n return err({\n code: \"EMIT_FAILED\",\n message: `Failed to bundle graphql-system: ${error instanceof Error ? error.message : String(error)}`,\n outPath: sourcePath,\n });\n }\n};\n","import { existsSync } from \"node:fs\";\nimport { basename, dirname, extname, relative, resolve } from \"node:path\";\nimport { err, ok } from \"neverthrow\";\nimport { writeModule } from \"./file\";\nimport { generateMultiSchemaModule } from \"./generator\";\nimport { hashSchema, loadSchema } from \"./schema\";\nimport { bundleGraphqlSystem } from \"./tsdown-bundle\";\nimport type { MultiSchemaCodegenOptions, MultiSchemaCodegenResult, MultiSchemaCodegenSuccess } from \"./types\";\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 `./${basename(targetPath, sourceExt)}`;\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 ? basename(targetPath, sourceExt) : basename(targetPath);\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\nexport const runMultiSchemaCodegen = async (options: MultiSchemaCodegenOptions): Promise<MultiSchemaCodegenResult> => {\n const outPath = resolve(options.outPath);\n\n // Handle legacy injectFromPath for backward compatibility\n const runtimeAdapters = options.runtimeAdapters ?? (options.injectFromPath ? { default: options.injectFromPath } : {});\n const scalars = options.scalars ?? (options.injectFromPath ? { default: options.injectFromPath } : {});\n\n // Validate that all adapter and scalar files exist\n const adapterPaths = new Map<string, string>();\n const scalarPaths = new Map<string, string>();\n\n for (const [schemaName, adapterPath] of Object.entries(runtimeAdapters)) {\n const resolvedPath = resolve(adapterPath);\n if (!existsSync(resolvedPath)) {\n return err({\n code: \"INJECT_MODULE_NOT_FOUND\",\n message: `Runtime adapter module not found for schema '${schemaName}': ${resolvedPath}`,\n injectPath: resolvedPath,\n });\n }\n adapterPaths.set(schemaName, resolvedPath);\n }\n\n for (const [schemaName, scalarPath] of Object.entries(scalars)) {\n const resolvedPath = resolve(scalarPath);\n if (!existsSync(resolvedPath)) {\n return err({\n code: \"INJECT_MODULE_NOT_FOUND\",\n message: `Scalar module not found for schema '${schemaName}': ${resolvedPath}`,\n injectPath: resolvedPath,\n });\n }\n scalarPaths.set(schemaName, resolvedPath);\n }\n\n // Load all schemas\n const schemas = new Map<string, import(\"graphql\").DocumentNode>();\n const schemaHashes: Record<string, { schemaHash: string; objects: number; enums: number; inputs: number; unions: number }> = {};\n\n for (const [name, schemaPath] of Object.entries(options.schemas)) {\n const result = await loadSchema(schemaPath).match(\n (doc) => Promise.resolve(ok(doc)),\n (error) => Promise.resolve(err(error)),\n );\n\n if (result.isErr()) {\n return err(result.error);\n }\n\n schemas.set(name, result.value);\n }\n\n // Build injection config for each schema\n const injectionConfig = new Map<string, { adapterImportPath: string; scalarImportPath: string }>();\n\n for (const schemaName of schemas.keys()) {\n const adapterPath = adapterPaths.get(schemaName);\n const scalarPath = scalarPaths.get(schemaName);\n\n if (!adapterPath || !scalarPath) {\n return err({\n code: \"INJECT_MODULE_REQUIRED\",\n message: `Missing adapter or scalar configuration for schema '${schemaName}'`,\n });\n }\n\n const importSpecifierOptions = { includeExtension: options.importExtension };\n injectionConfig.set(schemaName, {\n adapterImportPath: toImportSpecifier(outPath, adapterPath, importSpecifierOptions),\n scalarImportPath: toImportSpecifier(outPath, scalarPath, importSpecifierOptions),\n });\n }\n\n // Generate multi-schema module\n const { code } = generateMultiSchemaModule(schemas, {\n injection: injectionConfig,\n });\n\n // Calculate individual schema stats and hashes\n for (const [name, document] of schemas.entries()) {\n const schemaIndex = (await import(\"./generator\")).createSchemaIndex(document);\n const objects = Array.from(schemaIndex.objects.keys()).filter((n) => !n.startsWith(\"__\")).length;\n const enums = Array.from(schemaIndex.enums.keys()).filter((n) => !n.startsWith(\"__\")).length;\n const inputs = Array.from(schemaIndex.inputs.keys()).filter((n) => !n.startsWith(\"__\")).length;\n const unions = Array.from(schemaIndex.unions.keys()).filter((n) => !n.startsWith(\"__\")).length;\n\n schemaHashes[name] = {\n schemaHash: hashSchema(document),\n objects,\n enums,\n inputs,\n unions,\n };\n }\n\n // Write the module\n const writeResult = await writeModule(outPath, code).match(\n () => Promise.resolve(ok(undefined)),\n (error) => Promise.resolve(err(error)),\n );\n\n if (writeResult.isErr()) {\n return err(writeResult.error);\n }\n\n // Bundle the generated module with tsdown\n const bundleOutcome = await bundleGraphqlSystem(outPath);\n const bundleResult = bundleOutcome.match(\n (result) => ok(result),\n (error) => err(error),\n );\n\n if (bundleResult.isErr()) {\n return err(bundleResult.error);\n }\n\n return ok({\n schemas: schemaHashes,\n outPath,\n cjsPath: bundleResult.value.cjsPath,\n } satisfies MultiSchemaCodegenSuccess);\n};\n"],"mappings":";;;;;;;;;AAMA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCzB,MAAa,uBAAuB,YAAoB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,MAAM,SAAS,MAAM,KAAK,YAAY,OAAO,MAAM,CAAC,CAAC,QAAQ,MAAM,CAAC,EAAE,WAAW,KAAK,CAAC,CAAC;AAExF,eAAa,QAAQ;GACnB,YAAY,WAAW,SAAS;GAChC;GACA;GACA;GACA;GACD;;CAIH,MAAM,cAAc,MAAM,YAAY,SAAS,KAAK,CAAC,YAC7C,QAAQ,QAAQ,GAAG,UAAU,CAAC,GACnC,UAAU,QAAQ,QAAQ,IAAI,MAAM,CAAC,CACvC;AAED,KAAI,YAAY,OAAO,EAAE;AACvB,SAAO,IAAI,YAAY,MAAM;;CAI/B,MAAM,gBAAgB,MAAM,oBAAoB,QAAQ;CACxD,MAAM,eAAe,cAAc,OAChC,WAAW,GAAG,OAAO,GACrB,UAAU,IAAI,MAAM,CACtB;AAED,KAAI,aAAa,OAAO,EAAE;AACxB,SAAO,IAAI,aAAa,MAAM;;AAGhC,QAAO,GAAG;EACR,SAAS;EACT;EACA,SAAS,aAAa,MAAM;EAC7B,CAAqC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soda-gql/codegen",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "license": "MIT",
@@ -26,8 +26,8 @@
26
26
  "./package.json": "./package.json"
27
27
  },
28
28
  "dependencies": {
29
- "@soda-gql/core": "0.0.7",
30
- "@soda-gql/runtime": "0.0.7",
29
+ "@soda-gql/core": "0.0.8",
30
+ "@soda-gql/runtime": "0.0.8",
31
31
  "graphql": "^16.8.1",
32
32
  "neverthrow": "^8.1.1",
33
33
  "tsdown": "^0.15.7"
@@ -1,3 +0,0 @@
1
- import { n as generateMultiSchemaModule, t as createSchemaIndex } from "./generator-CVAppANp.mjs";
2
-
3
- export { createSchemaIndex, generateMultiSchemaModule };