@kubb/ast 5.23.3 → 5.23.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/factory.cjs +2 -2
- package/dist/factory.d.cts +4 -4
- package/dist/factory.d.ts +4 -4
- package/dist/factory.js +2 -2
- package/dist/{file-KunZhFIV.d.cts → file-B269mZh4.d.cts} +67 -33
- package/dist/file-Bq2GPaxh.js +427 -0
- package/dist/file-Bq2GPaxh.js.map +1 -0
- package/dist/file-C4pqV8yl.cjs +469 -0
- package/dist/file-C4pqV8yl.cjs.map +1 -0
- package/dist/{file-Dj9lsbJu.js → file-D_ih0x7q.js} +15 -11
- package/dist/file-D_ih0x7q.js.map +1 -0
- package/dist/{file-BAICym_L.cjs → file-DiPZBLSP.cjs} +15 -11
- package/dist/file-DiPZBLSP.cjs.map +1 -0
- package/dist/{file-DkFGn_Os.d.ts → file-oLlejzZV.d.ts} +67 -33
- package/dist/file.cjs +5 -2
- package/dist/file.d.cts +2 -2
- package/dist/file.d.ts +2 -2
- package/dist/file.js +3 -1
- package/dist/graph.d.cts +1 -1
- package/dist/graph.d.ts +1 -1
- package/dist/{guards-C6w6KQSY.d.ts → guards-RCnH6re9.d.ts} +1 -1
- package/dist/{guards-COBkDtgu.d.cts → guards-u-dAAtl8.d.cts} +1 -1
- package/dist/http.d.cts +2 -2
- package/dist/http.d.ts +2 -2
- package/dist/{index-CX7yfAGI.d.ts → index-2TMYDLjK.d.ts} +1 -1
- package/dist/index-6-ZZCX9W.d.ts +24 -0
- package/dist/index-B2nnOQjf.d.cts +24 -0
- package/dist/{index-DkThxxxq.d.cts → index-BgFaJtnv.d.ts} +9 -3
- package/dist/index-Bj7a0aSM.d.cts +5 -0
- package/dist/{index-dgiKWRpD.d.cts → index-Bw2oMIM1.d.cts} +3 -3
- package/dist/{index-gDZYBeJw.d.cts → index-C1za72gL.d.cts} +1 -1
- package/dist/index-CW-ztJjd.d.ts +5 -0
- package/dist/{index-DjThtAn4.d.ts → index-DF7CbpYW.d.ts} +2 -2
- package/dist/{index-CPXo4cA8.d.cts → index-D_WLsIMP.d.cts} +2 -2
- package/dist/{index-B5w-X5V6.d.ts → index-DbAnYRRM.d.ts} +1 -1
- package/dist/{index-jWtEIa7j.d.ts → index-DbQ-J072.d.cts} +9 -3
- package/dist/{index-CnY3KmAg.d.ts → index-DfRcRYF2.d.ts} +1 -1
- package/dist/{index-DZe5evGM.d.cts → index-DpnCCtXt.d.cts} +1 -1
- package/dist/{index-CwFC71XK.d.ts → index-DzHcy3vy.d.ts} +2 -2
- package/dist/{index-9l1xMEl_.d.ts → index-UwSVys3m.d.ts} +3 -3
- package/dist/{index-Dr81DOsC.d.cts → index-c9FD2S5f.d.cts} +2 -2
- package/dist/{index-D-BjRrJo.d.cts → index-sdprVPKQ.d.cts} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.js +2 -2
- package/dist/json.d.cts +1 -1
- package/dist/json.d.ts +1 -1
- package/dist/macro.d.cts +1 -1
- package/dist/macro.d.ts +1 -1
- package/dist/node.d.cts +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/{nodes-CwYIFVt5.js → nodes-ClL1C158.js} +2 -2
- package/dist/nodes-ClL1C158.js.map +1 -0
- package/dist/{nodes-BT2Ocq0x.cjs → nodes-DEQjVliP.cjs} +2 -2
- package/dist/nodes-DEQjVliP.cjs.map +1 -0
- package/dist/{operation-BUhPuZMY.d.cts → operation-AFw8tzIN.d.cts} +21 -5
- package/dist/{operation-jxEr2No4.d.ts → operation-Cu4XSaJQ.d.ts} +21 -5
- package/dist/ref.d.cts +1 -1
- package/dist/ref.d.ts +1 -1
- package/dist/schema-gSjYgaCl.cjs.map +1 -1
- package/dist/schema-tH14gE6i.js.map +1 -1
- package/dist/schema.d.cts +3 -3
- package/dist/schema.d.ts +3 -3
- package/dist/{visitor-CFbuH7BY.d.ts → visitor-CpmsR8o5.d.ts} +2 -2
- package/dist/{visitor-DxhkIQyP.d.cts → visitor-DnBK2MNl.d.cts} +2 -2
- package/package.json +1 -1
- package/dist/file-BAICym_L.cjs.map +0 -1
- package/dist/file-DUFttt26.js +0 -293
- package/dist/file-DUFttt26.js.map +0 -1
- package/dist/file-Dj9lsbJu.js.map +0 -1
- package/dist/file-Dz1HPMld.cjs +0 -329
- package/dist/file-Dz1HPMld.cjs.map +0 -1
- package/dist/index-Be5d4Zcl.d.ts +0 -24
- package/dist/index-CI6Tu2c7.d.ts +0 -5
- package/dist/index-DuDvNFQ8.d.cts +0 -5
- package/dist/index-ss1YqjpW.d.cts +0 -24
- package/dist/nodes-BT2Ocq0x.cjs.map +0 -1
- package/dist/nodes-CwYIFVt5.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-Bq2GPaxh.js","names":[],"sources":["../src/utils/moduleNames.ts","../src/utils/combineFileMembers.ts","../src/nodes/base.ts","../src/nodes/file.ts"],"sourcesContent":["import type { ExportNode, ImportNode, ModuleName, SourceNode, Space } from '../nodes/file.ts'\n\n/**\n * Returns the names an import or export brings across. A node built with the deprecated fields gets them from\n * those, each with an explicit `space`, so it prints exactly as before.\n */\nexport function getNames(node: ImportNode | ExportNode): Array<ModuleName> {\n if (node.names) return node.names\n return node.kind === 'Import' ? fromDeprecatedImport(node) : fromDeprecatedExport(node)\n}\n\nexport function getSpace(source: SourceNode): Space {\n if (source.space) return source.space\n if (source.isTypeOnly != null) return source.isTypeOnly ? 'type' : 'value'\n return source.nodes?.[0]?.kind === 'Type' ? 'type' : 'value'\n}\n\ntype DeprecatedImport = Pick<ImportNode, 'name' | 'isTypeOnly' | 'isNameSpace'>\ntype DeprecatedExport = Pick<ExportNode, 'name' | 'isTypeOnly' | 'asAlias'>\n\n/**\n * @deprecated Converts a node built with `name`, `isTypeOnly` and `isNameSpace` to `names`. Removed in Kubb v6.\n */\nexport function fromDeprecatedImport({ name, isTypeOnly, isNameSpace }: DeprecatedImport): Array<ModuleName> {\n const space: Space = isTypeOnly ? 'type' : 'value'\n if (!Array.isArray(name)) return [{ name: isNameSpace ? '*' : 'default', alias: name, space }]\n return name.map((item) => (typeof item === 'string' ? { name: item, space } : { name: item.propertyName, ...(item.name ? { alias: item.name } : {}), space }))\n}\n\n/**\n * @deprecated Converts a node built with `name`, `isTypeOnly` and `asAlias` to `names`. Removed in Kubb v6.\n */\nexport function fromDeprecatedExport({ name, isTypeOnly, asAlias }: DeprecatedExport): Array<ModuleName> {\n const space: Space = isTypeOnly ? 'type' : 'value'\n if (name == null) return [{ name: '*', space }]\n if (!Array.isArray(name)) return [asAlias ? { name: '*', alias: name, space } : { name, space }]\n return name.map((item) => ({ name: item, space }))\n}\n\n/**\n * @deprecated The old import fields for `names`, for code that still reads them. Removed in Kubb v6.\n */\nexport function toDeprecatedImport(names: ReadonlyArray<ModuleName>): DeprecatedImport {\n const isTypeOnly = names.length > 0 && names.every((item) => item.space === 'type')\n const [first] = names\n if (names.length === 1 && first?.alias && (first.name === '*' || first.name === 'default')) {\n return { name: first.alias, isTypeOnly, isNameSpace: first.name === '*' }\n }\n return { name: names.map((item) => (item.alias ? { propertyName: item.name, name: item.alias } : item.name)), isTypeOnly, isNameSpace: false }\n}\n\n/**\n * @deprecated The old export fields for `names`; an alias stands in for its name. Removed in Kubb v6.\n */\nexport function toDeprecatedExport(names: ReadonlyArray<ModuleName>): DeprecatedExport {\n const isTypeOnly = names.length > 0 && names.every((item) => item.space === 'type')\n const [first] = names\n if (names.length === 1 && first?.name === '*') {\n return first.alias ? { name: first.alias, isTypeOnly, asAlias: true } : { isTypeOnly, asAlias: false }\n }\n return { name: names.map((item) => item.alias ?? item.name), isTypeOnly, asAlias: false }\n}\n","/**\n * File-member merging. `combineImports` and `combineExports` deduplicate and sort the import and\n * export entries of one file, while `combineSources` deduplicates source entries in original order.\n * `combineImports` also drops imports nothing references. This works on a file's members, not on\n * schema content.\n */\nimport path from 'node:path'\nimport { memo } from '@internals/utils'\nimport type { ExportNode, ImportNode, ModuleName, SourceNode, Space } from '../nodes/file.ts'\nimport { getNames, getSpace, toDeprecatedExport, toDeprecatedImport } from './moduleNames.ts'\n\nconst IDENTIFIER_RUN = /[\\w$]+/g\n\n/**\n * How many imports a file needs before indexing the source beats scanning it once per name.\n */\nconst INDEX_ABOVE_IMPORTS = 128\n\ntype Form = 'named' | 'default' | '*'\n\ntype Statement = { path: string; root?: string | null; form: Form; space: Space; names: Array<ModuleName> }\n\nconst importForm = (item: ModuleName): Form => (item.alias && (item.name === '*' || item.name === 'default') ? item.name : 'named')\nconst exportForm = (item: ModuleName): Form => (item.name === '*' ? '*' : 'named')\nconst label = (item: ModuleName): string => (item.alias ? `${item.name} as ${item.alias}` : item.name)\n\nfunction statementKey({ path, form, space, names }: Statement): string {\n return form === 'named' ? `${path}\\0named\\0${space}` : `${path}\\0${form}\\0${names[0]?.alias ?? ''}\\0${space}`\n}\n\nfunction toStatements(nodes: ReadonlyArray<ImportNode | ExportNode>, formOf: (item: ModuleName) => Form): Array<Statement> {\n return nodes.flatMap((node) => {\n const statements = new Map<string, Statement>()\n for (const item of getNames(node)) {\n const statement: Statement = {\n path: node.path,\n root: node.kind === 'Import' ? node.root : undefined,\n form: formOf(item),\n space: item.space ?? 'value',\n names: [],\n }\n const key = statementKey({ ...statement, names: [item] })\n const existing = statements.get(key) ?? statement\n statements.set(key, existing)\n existing.names.push(item)\n }\n return [...statements.values()]\n })\n}\n\n/**\n * Relative specifiers by `root`, then `path`. `createFile` sorts a file's imports again on every\n * merge, and the path math dominated that sort on large specs. Two levels keep the existing strings\n * as keys, so lookups reuse their hashes instead of hashing a new joined key each time.\n */\nconst specifierCache = memo.create<string, Map<string, string>>({ max: 10_000 })\n\n/**\n * Returns the specifier a member is written with: POSIX and relative to the importing file when it\n * has a `root`, like `getRelativePath` in parser-ts. Sorting on it keeps the order the same on every OS.\n */\nfunction specifier(node: { path: string; root?: string | null }): string {\n const { root, path: target } = node\n if (!root) return target\n const byPath = memo(specifierCache, root, () => new Map<string, string>())\n return memo(byPath, target, () => {\n const relative = path.relative(path.dirname(root), target).replaceAll('\\\\', '/')\n return relative.startsWith('../') ? relative : `./${relative}`\n })\n}\n\nfunction sortKey(statement: Statement): string {\n const form = statement.form === 'named' ? '1' : '0'\n const space = statement.space === 'type' ? '0' : '1'\n return `${form}:${space}:${specifier(statement)}:${statement.names.map(label).toSorted().join('\\0')}`\n}\n\nfunction mergeStatements(statements: Array<Statement>, keep: (item: ModuleName, statement: Statement) => boolean = () => true): Array<Statement> {\n const merged = new Map<string, { statement: Statement; seen: Set<string> }>()\n const sorted = statements.map((statement) => ({ statement, key: sortKey(statement) })).sort((a, b) => (a.key < b.key ? -1 : a.key > b.key ? 1 : 0))\n\n for (const { statement } of sorted) {\n const key = statementKey(statement)\n const entry = merged.get(key) ?? { statement: { ...statement, names: [] }, seen: new Set<string>() }\n merged.set(key, entry)\n for (const item of statement.names) {\n const id = item.alias ?? item.name\n if (entry.seen.has(id) || !keep(item, statement)) continue\n entry.seen.add(id)\n entry.statement.names.push(item)\n }\n }\n\n const result = [...merged.values()].map(({ statement }) => statement)\n // A name kept as a value also serves its type uses, so a type statement from the same path must not bind it again.\n const bound = ({ path, item }: { path: string; item: ModuleName }) => `${path}\\0${item.alias ?? item.name}`\n const values = new Set(result.filter(({ space }) => space === 'value').flatMap(({ path, names }) => names.map((item) => bound({ path, item }))))\n return result\n .map((statement) =>\n statement.space === 'type' ? { ...statement, names: statement.names.filter((item) => !values.has(bound({ path: statement.path, item }))) } : statement,\n )\n .filter((statement) => statement.names.length > 0)\n}\n\n/**\n * Deduplicates `SourceNode` objects by `name + export + space`, keeping the first of each\n * key. An unnamed source only drops when the same node appears twice, so markdown can repeat a\n * paragraph or a table. Returns the deduplicated array in original order.\n */\nexport function combineSources(sources: Array<SourceNode>): Array<SourceNode> {\n const seen = new Set<SourceNode | string>()\n return sources.filter((source) => {\n const key = source.name != null ? `${source.name}:${source.export ?? source.isExportable ?? false}:${getSpace(source)}` : source\n if (seen.has(key)) return false\n seen.add(key)\n return true\n })\n}\n\n/**\n * Deduplicates and merges `ExportNode` objects: one export per path, form and space. Returns a sorted array.\n */\nexport function combineExports(exports: Array<ExportNode>): Array<ExportNode> {\n return mergeStatements(toStatements(exports, exportForm)).map(({ path, names }) => ({ kind: 'Export', path, ...toDeprecatedExport(names), names }))\n}\n\n/**\n * Deduplicates and merges `ImportNode` objects, filtering out unused imports.\n *\n * Retains imports that are referenced in `source` or re-exported. One import per path, form and space. Returns\n * a sorted, deduplicated, filtered array.\n */\nexport function combineImports(imports: Array<ImportNode>, exports: Array<ExportNode>, source?: string): Array<ImportNode> {\n // Build a lookup of all exported names to retain imports that are re-exported\n const exportedNames = new Set(exports.flatMap((node) => getNames(node).map((item) => item.alias ?? item.name)))\n // `createFile` re-runs on every merge into a file, so scanning the source once per import name\n // costs a heavily merged file that scan again for every fragment it already holds. Indexing pays\n // for itself there, and costs more than it saves on the small files the default output produces.\n const identifiers = source && imports.length > INDEX_ABOVE_IMPORTS ? new Set(source.match(IDENTIFIER_RUN)) : null\n\n // A name in the index is used. One that is not still might be, inside a longer identifier, so the\n // substring test stays behind it.\n const isUsed = (importName: string): boolean => !source || identifiers?.has(importName) || source.includes(importName) || exportedNames.has(importName)\n\n const statements = toStatements(\n imports.filter((node) => node.path !== node.root),\n importForm,\n )\n\n // Paths that keep at least one used named import. A default import from such a path is retained\n // even when its binding can't be found in `source` e.g. a generated `client` default import\n // alongside `import type { Client } from <same path>`, where merged grouped output omits the body.\n const pathsWithUsedNamedImport = new Set(\n statements.filter(({ form, names }) => form === 'named' && names.some((item) => isUsed(item.alias ?? item.name))).map(({ path }) => path),\n )\n const keep = (item: ModuleName, { form, path }: Statement) => isUsed(item.alias ?? item.name) || (form !== 'named' && pathsWithUsedNamedImport.has(path))\n\n return mergeStatements(statements, keep).map(({ path, root, names }) => ({\n kind: 'Import',\n path,\n ...(root != null ? { root } : {}),\n ...toDeprecatedImport(names),\n names,\n }))\n}\n","import type { ValueOf } from '@internals/utils'\nimport type { nodeKinds } from '../constants.ts'\n\n/**\n * `kind` values used by AST nodes.\n *\n * @example\n * ```ts\n * const kind: NodeKind = 'Schema'\n * ```\n */\nexport type NodeKind = ValueOf<typeof nodeKinds>\n\n/**\n * Base shape shared by all AST nodes.\n *\n * @example\n * ```ts\n * const base: BaseNode = { kind: 'Input' }\n * ```\n */\nexport type BaseNode = {\n /**\n * Node discriminator.\n */\n kind: NodeKind\n /**\n * Where the node comes from in the input, in the form the adapter's `locate` reads. Document\n * adapters such as OpenAPI and AsyncAPI use an RFC 6901 JSON pointer, for example\n * `#/components/schemas/Pet`. Plugins can copy it to the code nodes they emit.\n */\n pointer?: string\n}\n\n/** `Omit` applied to each member of a union, so the union survives. */\nexport type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never\n\n/** Builds a `createX` factory for a node whose only computed field is `kind`. */\nexport function nodeFactory<T extends BaseNode>(kind: T['kind']): (input: Omit<T, 'kind'>) => T {\n return (input) => {\n const node = { ...input, kind }\n return node as T\n }\n}\n","import { hash } from 'node:crypto'\nimport path from 'node:path'\nimport { nodeKinds } from '../constants.ts'\nimport { combineExports, combineImports, combineSources } from '../utils/combineFileMembers.ts'\nimport { getNames, toDeprecatedExport, toDeprecatedImport } from '../utils/moduleNames.ts'\nimport { getNodeText } from '../utils/nodeText.ts'\nimport { type BaseNode, nodeFactory } from './base.ts'\nimport type { CodeNode } from './code.ts'\n\n/**\n * Supported file extensions.\n */\ntype Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`\n\ntype ImportName = string | Array<string | { propertyName: string; name?: string }>\n\n/**\n * Whether a declaration exists only at compile time (`'type'`) or also at runtime (`'value'`).\n */\nexport type Space = 'type' | 'value'\n\n/**\n * One name an import or export brings across, as in the ECMAScript `ImportEntry` record.\n */\nexport type ModuleName = {\n /**\n * Name in the other module: `'default'` for its default export, `'*'` for the whole module.\n */\n name: string\n /**\n * Local name for an import, or the exported name for an export.\n */\n alias?: string | null\n /**\n * Type or value.\n * @default 'value'\n */\n space?: Space | null\n}\n\n/**\n * Represents a language-agnostic import/dependency declaration.\n *\n * @example Named import (TypeScript: `import { useState } from 'react'`)\n * ```ts\n * createImport({ names: [{ name: 'useState' }], path: 'react' })\n * ```\n *\n * @example Default import (TypeScript: `import React from 'react'`)\n * ```ts\n * createImport({ names: [{ name: 'default', alias: 'React' }], path: 'react' })\n * ```\n *\n * @example Type-only import (TypeScript: `import type { FC } from 'react'`)\n * ```ts\n * createImport({ names: [{ name: 'FC', space: 'type' }], path: 'react' })\n * ```\n *\n * @example Namespace import (TypeScript: `import * as React from 'react'`)\n * ```ts\n * createImport({ names: [{ name: '*', alias: 'React' }], path: 'react' })\n * ```\n */\nexport type ImportNode = BaseNode & {\n kind: 'Import'\n /**\n * The names the import brings in. `ast.file.getNames` also reads the deprecated fields.\n */\n names?: Array<ModuleName> | null\n /**\n * Import name(s) to be used.\n *\n * @deprecated Use `names`. Removed in Kubb v6.\n */\n name: ImportName\n /**\n * Path for the import.\n *\n * @example\n * `'@kubb/core'`\n */\n path: string\n /**\n * Add a type-only import prefix.\n *\n * @deprecated Set `space: 'type'` on each name. Removed in Kubb v6.\n */\n isTypeOnly?: boolean | null\n /**\n * Import the entire module as a namespace.\n *\n * @deprecated Use `{ name: '*', alias }` in `names`. Removed in Kubb v6.\n */\n isNameSpace?: boolean | null\n /**\n * When set, the import path is resolved relative to this root.\n */\n root?: string | null\n}\n\n/**\n * Represents a language-agnostic export/public API declaration.\n *\n * @example Named export (TypeScript: `export { Pets } from './Pets'`)\n * ```ts\n * createExport({ names: [{ name: 'Pets' }], path: './Pets' })\n * ```\n *\n * @example Type-only export (TypeScript: `export type { Pet } from './Pet'`)\n * ```ts\n * createExport({ names: [{ name: 'Pet', space: 'type' }], path: './Pet' })\n * ```\n *\n * @example Wildcard export (TypeScript: `export * from './utils'`)\n * ```ts\n * createExport({ names: [{ name: '*' }], path: './utils' })\n * ```\n *\n * @example Namespace alias (TypeScript: `export * as utils from './utils'`)\n * ```ts\n * createExport({ names: [{ name: '*', alias: 'utils' }], path: './utils' })\n * ```\n */\nexport type ExportNode = BaseNode & {\n kind: 'Export'\n /**\n * The names the export passes on. `ast.file.getNames` also reads the deprecated fields.\n */\n names?: Array<ModuleName> | null\n /**\n * Export name(s) to be used. When omitted, generates a wildcard export.\n *\n * @deprecated Use `names`. Removed in Kubb v6.\n */\n name?: string | Array<string> | null\n /**\n * Path for the export.\n *\n * @example\n * `'@kubb/core'`\n */\n path: string\n /**\n * Add a type-only export prefix.\n *\n * @deprecated Set `space: 'type'` on each name. Removed in Kubb v6.\n */\n isTypeOnly?: boolean | null\n /**\n * Export as an aliased namespace.\n *\n * @deprecated Use `{ name: '*', alias }` in `names`. Removed in Kubb v6.\n */\n asAlias?: boolean | null\n}\n\n/**\n * Represents a fragment of source code within a file.\n *\n * @example Named exportable source\n * ```ts\n * createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], export: true })\n * ```\n *\n * @example Inline unnamed code block\n * ```ts\n * createSource({ nodes: [createText('const x = 1')] })\n * ```\n */\nexport type SourceNode = BaseNode & {\n kind: 'Source'\n /**\n * Optional name identifying this source (used for deduplication and barrel generation).\n */\n name?: string | null\n /**\n * Type or value. When unset, a source whose first node is a `Type` is a type.\n */\n space?: Space | null\n /**\n * Mark this source as a type-only export.\n *\n * @deprecated Use `space: 'type'`. Removed in Kubb v6.\n */\n isTypeOnly?: boolean | null\n /**\n * Mark this source as an exported declaration, which barrels list. The source text carries its own `export` keyword.\n */\n export?: boolean | null\n /**\n * Mark this exported source as the module's default export. Barrels skip it, since they can't re-export it by name.\n */\n default?: boolean | null\n /**\n * @deprecated Use `export`. Removed in Kubb v6.\n */\n isExportable?: boolean | null\n /**\n * @deprecated Use `export`. Removed in Kubb v6.\n */\n isIndexable?: boolean | null\n /**\n * Marks the source as a definition that importing files absorb instead of import. `expression` is\n * the declaration's right-hand side, such as `{ body: Pet }`.\n *\n * @deprecated Set `inline` on the file. Removed in Kubb v6.\n */\n inline?: { expression: string } | null\n /**\n * Child nodes that make up this source fragment, in DOM order.\n * Use a {@link TextNode} for raw string content.\n */\n nodes?: Array<CodeNode>\n}\n\n/**\n * Represents a fully resolved file in the AST.\n *\n * Created via `createFile()`, which computes the `id`, `name`, and `extname` from the input\n * and deduplicates `imports`, `exports`, and `sources`.\n *\n * @example\n * ```ts\n * const file = createFile({\n * baseName: 'petStore.ts',\n * path: 'src/models/petStore.ts',\n * sources: [createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], export: true })],\n * imports: [createImport({ name: ['z'], path: 'zod' })],\n * exports: [createExport({ name: ['Pet'], path: './petStore' })],\n * })\n * // file.id = SHA256 hash of the path\n * // file.name = 'petStore'\n * // file.extname = '.ts'\n * ```\n */\nexport type FileNode<TMeta extends object = object> = BaseNode & {\n kind: 'File'\n /**\n * Unique identifier derived from a SHA256 hash of the file path. `createFile`\n * computes it, so callers do not need to provide it.\n */\n id: string\n /**\n * File name without extension, derived from `baseName`.\n *\n * @see https://nodejs.org/api/path.html#pathformatpathobject\n */\n name: string\n /**\n * File base name, including extension, shaped like `${name}${extname}`.\n *\n * @see https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\n baseName: `${string}.${string}`\n /**\n * Full qualified path to the file.\n */\n path: string\n /**\n * File extension extracted from `baseName`.\n */\n extname: Extname\n /**\n * Deduplicated list of source code fragments.\n */\n sources: Array<SourceNode>\n /**\n * Deduplicated list of import declarations.\n */\n imports: Array<ImportNode>\n /**\n * Deduplicated list of export declarations.\n */\n exports: Array<ExportNode>\n /**\n * Optional metadata attached to this file, read by plugins during barrel generation.\n */\n meta?: TMeta\n /**\n * Optional banner prepended to the generated file content.\n * Accepts `null` so `resolver.default.banner()` results can be passed directly.\n */\n banner?: string | null\n /**\n * Optional footer appended to the generated file content.\n * Accepts `null` so `resolver.default.footer()` results can be passed directly.\n */\n footer?: string | null\n /**\n * Absolute on-disk path to copy into the output, through the parser's `copy` hook when it has one.\n *\n * Use to emit a real source file shipped inside a package (a template) into the generated\n * folder. When set, `copy` provides the file content and any `sources` nodes are ignored for\n * output; `sources` may still carry `name`/`export` so barrel generation\n * treats the file the same as a rendered one.\n */\n copy?: string | null\n /**\n * Marks a file that is never written. Each file that imports from it gets the body of each imported declaration, such as `{ body: Pet }`, in place of its name.\n */\n inline?: boolean | null\n}\n\nexport type ImportInput = Omit<ImportNode, 'kind' | 'name'> & { name?: ImportName }\n\nexport type ExportInput = Omit<ExportNode, 'kind'>\n\n// A spread node carries the deprecated fields derived from its `names`, so only a value that differs is an override.\ntype Override<TValue> = { value: TValue | null | undefined; derived: TValue | null | undefined }\n\nfunction overrideSpace(names: Array<ModuleName>, { value, derived }: Override<boolean>): Array<ModuleName> {\n if (value == null || value === derived) return names\n const space = value ? 'type' : 'value'\n return names.map((item) => ({ ...item, space }))\n}\n\nconst isOverride = ({ value, derived }: Override<unknown>): boolean => value !== undefined && JSON.stringify(value) !== JSON.stringify(derived)\n\n/**\n * Creates an `ImportNode`. A node built from `names` also gets the deprecated fields. A deprecated `name` or\n * `isTypeOnly` that differs from the one `names` gives overrides it, so `{ ...imp, isTypeOnly: true }` still works.\n *\n * @example Named import\n * ```ts\n * createImport({ names: [{ name: 'useState' }], path: 'react' })\n * // import { useState } from 'react'\n * ```\n */\nexport function createImport(input: ImportInput): ImportNode {\n if (!input.names) return { ...input, name: input.name ?? [], kind: nodeKinds.import }\n const derived = toDeprecatedImport(input.names)\n if (isOverride({ value: input.name, derived: derived.name })) return { ...input, names: null, name: input.name ?? [], kind: nodeKinds.import }\n const names = overrideSpace(input.names, { value: input.isTypeOnly, derived: derived.isTypeOnly })\n return { ...input, ...toDeprecatedImport(names), names, kind: nodeKinds.import }\n}\n\n/**\n * Creates an `ExportNode`. A node built from `names` also gets the deprecated fields. A deprecated `name` or\n * `isTypeOnly` that differs from the one `names` gives overrides it.\n *\n * @example Named export\n * ```ts\n * createExport({ names: [{ name: 'Pet' }], path: './Pet' })\n * // export { Pet } from './Pet'\n * ```\n */\nexport function createExport(input: ExportInput): ExportNode {\n if (!input.names) return { ...input, kind: nodeKinds.export }\n const derived = toDeprecatedExport(input.names)\n if (isOverride({ value: input.name, derived: derived.name })) return { ...input, names: null, kind: nodeKinds.export }\n const names = overrideSpace(input.names, { value: input.isTypeOnly, derived: derived.isTypeOnly })\n return { ...input, ...toDeprecatedExport(names), names, kind: nodeKinds.export }\n}\n\n/**\n * Creates a `SourceNode` representing a fragment of source code within a file.\n *\n * @example\n * ```ts\n * createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], export: true })\n * ```\n */\nexport const createSource = nodeFactory<SourceNode>(nodeKinds.source)\n\n/**\n * Input descriptor for {@link createFile}, before `id`, `name`, and `extname` are computed\n * and `imports`/`exports`/`sources` are deduplicated.\n */\nexport type UserFileNode<TMeta extends object = object> = Omit<FileNode<TMeta>, 'kind' | 'id' | 'name' | 'extname' | 'imports' | 'exports' | 'sources'> &\n Pick<Partial<FileNode<TMeta>>, 'imports' | 'exports' | 'sources'>\n\n/**\n * Creates a fully resolved `FileNode` from a file input descriptor.\n *\n * Computes:\n * - `id` SHA256 hash of the file path\n * - `name` `baseName` without extension\n * - `extname` extension extracted from `baseName`\n *\n * Deduplicates:\n * - `sources` via `combineSources`\n * - `exports` via `combineExports`\n * - `imports` via `combineImports` (also filters unused imports)\n *\n * @throws {Error} when `baseName` has no extension.\n *\n * @example\n * ```ts\n * const file = createFile({\n * baseName: 'petStore.ts',\n * path: 'src/models/petStore.ts',\n * sources: [createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')] })],\n * imports: [createImport({ name: ['z'], path: 'zod' })],\n * exports: [createExport({ name: ['Pet'], path: './petStore' })],\n * })\n * // file.id = SHA256 hash of 'src/models/petStore.ts'\n * // file.name = 'petStore'\n * // file.extname = '.ts'\n * ```\n *\n * @example Copy a real file into the output\n * ```ts\n * const file = createFile({\n * baseName: 'client.ts',\n * path: 'src/gen/client.ts',\n * copy: '/abs/path/to/templates/client.ts',\n * })\n * ```\n */\nexport function createFile<TMeta extends object = object>(input: UserFileNode<TMeta>): FileNode<TMeta> {\n const extname = path.extname(input.baseName) as `.${string}`\n if (!extname) {\n throw new Error(`No extname found for ${input.baseName}`)\n }\n\n const resolvedExports = input.exports?.length ? combineExports(input.exports) : []\n const resolvedSources = input.sources?.length ? combineSources(input.sources) : []\n\n // Skip building the source text and local-name set when there are no imports to resolve against them.\n const resolvedImports: Array<ImportNode> = (() => {\n if (!input.imports?.length) return []\n\n const sourceParts: Array<string> = []\n const localNames = new Set<string>()\n // Only the sources the file keeps count: an import used just by a dropped duplicate is unused.\n for (const item of resolvedSources) {\n const extracted = item.nodes && getNodeText(item.nodes)\n if (extracted) sourceParts.push(extracted)\n if (item.name) localNames.add(item.name)\n }\n const source = sourceParts.join('\\n') || undefined\n const combinedImports = combineImports(input.imports, resolvedExports, source)\n // Consolidating output (`mode: 'file'`) can put a symbol's definition and an import of it in the\n // same file: by path when the import still targets this file, by name when consolidation moved it.\n return combinedImports.flatMap((imp) => {\n if (imp.path === input.path) return []\n const names = getNames(imp)\n const kept = names.filter((item) => !localNames.has(item.alias ?? item.name))\n if (!kept.length) return []\n return [kept.length === names.length ? imp : createImport({ path: imp.path, ...(imp.root != null ? { root: imp.root } : {}), names: kept })]\n })\n })()\n\n return {\n ...input,\n kind: nodeKinds.file,\n id: hash('sha256', input.path, 'hex'),\n name: path.basename(input.baseName, extname),\n extname,\n imports: resolvedImports,\n exports: resolvedExports,\n sources: resolvedSources,\n meta: (input.meta ?? {}) as TMeta,\n }\n}\n"],"mappings":";;;;;;;;;;;AAMA,SAAgB,SAAS,MAAkD;CACzE,IAAI,KAAK,OAAO,OAAO,KAAK;CAC5B,OAAO,KAAK,SAAS,WAAW,qBAAqB,IAAI,IAAI,qBAAqB,IAAI;AACxF;AAEA,SAAgB,SAAS,QAA2B;CAClD,IAAI,OAAO,OAAO,OAAO,OAAO;CAChC,IAAI,OAAO,cAAc,MAAM,OAA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,MAAO,MAAM,QAAQ,CAAC;CACxB;AACF"}
|
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-BV8xUvPy.cjs");
|
|
2
|
+
let node_crypto = require("node:crypto");
|
|
3
|
+
let node_path = require("node:path");
|
|
4
|
+
const require_constants = require("./constants-DztHlVmY.cjs");
|
|
5
|
+
const require_promise = require("./promise-DScaykew.cjs");
|
|
6
|
+
const require_nodeText = require("./nodeText-CZ7wgxu9.cjs");
|
|
7
|
+
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
8
|
+
// src/utils/moduleNames.ts
|
|
9
|
+
/**
|
|
10
|
+
* Returns the names an import or export brings across. A node built with the deprecated fields gets them from
|
|
11
|
+
* those, each with an explicit `space`, so it prints exactly as before.
|
|
12
|
+
*/
|
|
13
|
+
function getNames(node) {
|
|
14
|
+
if (node.names) return node.names;
|
|
15
|
+
return node.kind === "Import" ? fromDeprecatedImport(node) : fromDeprecatedExport(node);
|
|
16
|
+
}
|
|
17
|
+
function getSpace(source) {
|
|
18
|
+
if (source.space) return source.space;
|
|
19
|
+
if (source.isTypeOnly != null) return source.isTypeOnly ? "type" : "value";
|
|
20
|
+
return source.nodes?.[0]?.kind === "Type" ? "type" : "value";
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Converts a node built with `name`, `isTypeOnly` and `isNameSpace` to `names`. Removed in Kubb v6.
|
|
24
|
+
*/
|
|
25
|
+
function fromDeprecatedImport({ name, isTypeOnly, isNameSpace }) {
|
|
26
|
+
const space = isTypeOnly ? "type" : "value";
|
|
27
|
+
if (!Array.isArray(name)) return [{
|
|
28
|
+
name: isNameSpace ? "*" : "default",
|
|
29
|
+
alias: name,
|
|
30
|
+
space
|
|
31
|
+
}];
|
|
32
|
+
return name.map((item) => typeof item === "string" ? {
|
|
33
|
+
name: item,
|
|
34
|
+
space
|
|
35
|
+
} : {
|
|
36
|
+
name: item.propertyName,
|
|
37
|
+
...item.name ? { alias: item.name } : {},
|
|
38
|
+
space
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Converts a node built with `name`, `isTypeOnly` and `asAlias` to `names`. Removed in Kubb v6.
|
|
43
|
+
*/
|
|
44
|
+
function fromDeprecatedExport({ name, isTypeOnly, asAlias }) {
|
|
45
|
+
const space = isTypeOnly ? "type" : "value";
|
|
46
|
+
if (name == null) return [{
|
|
47
|
+
name: "*",
|
|
48
|
+
space
|
|
49
|
+
}];
|
|
50
|
+
if (!Array.isArray(name)) return [asAlias ? {
|
|
51
|
+
name: "*",
|
|
52
|
+
alias: name,
|
|
53
|
+
space
|
|
54
|
+
} : {
|
|
55
|
+
name,
|
|
56
|
+
space
|
|
57
|
+
}];
|
|
58
|
+
return name.map((item) => ({
|
|
59
|
+
name: item,
|
|
60
|
+
space
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated The old import fields for `names`, for code that still reads them. Removed in Kubb v6.
|
|
65
|
+
*/
|
|
66
|
+
function toDeprecatedImport(names) {
|
|
67
|
+
const isTypeOnly = names.length > 0 && names.every((item) => item.space === "type");
|
|
68
|
+
const [first] = names;
|
|
69
|
+
if (names.length === 1 && first?.alias && (first.name === "*" || first.name === "default")) return {
|
|
70
|
+
name: first.alias,
|
|
71
|
+
isTypeOnly,
|
|
72
|
+
isNameSpace: first.name === "*"
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
name: names.map((item) => item.alias ? {
|
|
76
|
+
propertyName: item.name,
|
|
77
|
+
name: item.alias
|
|
78
|
+
} : item.name),
|
|
79
|
+
isTypeOnly,
|
|
80
|
+
isNameSpace: false
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @deprecated The old export fields for `names`; an alias stands in for its name. Removed in Kubb v6.
|
|
85
|
+
*/
|
|
86
|
+
function toDeprecatedExport(names) {
|
|
87
|
+
const isTypeOnly = names.length > 0 && names.every((item) => item.space === "type");
|
|
88
|
+
const [first] = names;
|
|
89
|
+
if (names.length === 1 && first?.name === "*") return first.alias ? {
|
|
90
|
+
name: first.alias,
|
|
91
|
+
isTypeOnly,
|
|
92
|
+
asAlias: true
|
|
93
|
+
} : {
|
|
94
|
+
isTypeOnly,
|
|
95
|
+
asAlias: false
|
|
96
|
+
};
|
|
97
|
+
return {
|
|
98
|
+
name: names.map((item) => item.alias ?? item.name),
|
|
99
|
+
isTypeOnly,
|
|
100
|
+
asAlias: false
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
// src/utils/combineFileMembers.ts
|
|
104
|
+
/**
|
|
105
|
+
* File-member merging. `combineImports` and `combineExports` deduplicate and sort the import and
|
|
106
|
+
* export entries of one file, while `combineSources` deduplicates source entries in original order.
|
|
107
|
+
* `combineImports` also drops imports nothing references. This works on a file's members, not on
|
|
108
|
+
* schema content.
|
|
109
|
+
*/
|
|
110
|
+
const IDENTIFIER_RUN = /[\w$]+/g;
|
|
111
|
+
/**
|
|
112
|
+
* How many imports a file needs before indexing the source beats scanning it once per name.
|
|
113
|
+
*/
|
|
114
|
+
const INDEX_ABOVE_IMPORTS = 128;
|
|
115
|
+
const importForm = (item) => item.alias && (item.name === "*" || item.name === "default") ? item.name : "named";
|
|
116
|
+
const exportForm = (item) => item.name === "*" ? "*" : "named";
|
|
117
|
+
const label = (item) => item.alias ? `${item.name} as ${item.alias}` : item.name;
|
|
118
|
+
function statementKey({ path, form, space, names }) {
|
|
119
|
+
return form === "named" ? `${path}\0named\0${space}` : `${path}\0${form}\0${names[0]?.alias ?? ""}\0${space}`;
|
|
120
|
+
}
|
|
121
|
+
function toStatements(nodes, formOf) {
|
|
122
|
+
return nodes.flatMap((node) => {
|
|
123
|
+
const statements = /* @__PURE__ */ new Map();
|
|
124
|
+
for (const item of getNames(node)) {
|
|
125
|
+
const statement = {
|
|
126
|
+
path: node.path,
|
|
127
|
+
root: node.kind === "Import" ? node.root : void 0,
|
|
128
|
+
form: formOf(item),
|
|
129
|
+
space: item.space ?? "value",
|
|
130
|
+
names: []
|
|
131
|
+
};
|
|
132
|
+
const key = statementKey({
|
|
133
|
+
...statement,
|
|
134
|
+
names: [item]
|
|
135
|
+
});
|
|
136
|
+
const existing = statements.get(key) ?? statement;
|
|
137
|
+
statements.set(key, existing);
|
|
138
|
+
existing.names.push(item);
|
|
139
|
+
}
|
|
140
|
+
return [...statements.values()];
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Relative specifiers by `root`, then `path`. `createFile` sorts a file's imports again on every
|
|
145
|
+
* merge, and the path math dominated that sort on large specs. Two levels keep the existing strings
|
|
146
|
+
* as keys, so lookups reuse their hashes instead of hashing a new joined key each time.
|
|
147
|
+
*/
|
|
148
|
+
const specifierCache = require_promise.memo.create({ max: 1e4 });
|
|
149
|
+
/**
|
|
150
|
+
* Returns the specifier a member is written with: POSIX and relative to the importing file when it
|
|
151
|
+
* has a `root`, like `getRelativePath` in parser-ts. Sorting on it keeps the order the same on every OS.
|
|
152
|
+
*/
|
|
153
|
+
function specifier(node) {
|
|
154
|
+
const { root, path: target } = node;
|
|
155
|
+
if (!root) return target;
|
|
156
|
+
const byPath = require_promise.memo(specifierCache, root, () => /* @__PURE__ */ new Map());
|
|
157
|
+
return require_promise.memo(byPath, target, () => {
|
|
158
|
+
const relative = node_path.default.relative(node_path.default.dirname(root), target).replaceAll("\\", "/");
|
|
159
|
+
return relative.startsWith("../") ? relative : `./${relative}`;
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function sortKey(statement) {
|
|
163
|
+
return `${statement.form === "named" ? "1" : "0"}:${statement.space === "type" ? "0" : "1"}:${specifier(statement)}:${statement.names.map(label).toSorted().join("\0")}`;
|
|
164
|
+
}
|
|
165
|
+
function mergeStatements(statements, keep = () => true) {
|
|
166
|
+
const merged = /* @__PURE__ */ new Map();
|
|
167
|
+
const sorted = statements.map((statement) => ({
|
|
168
|
+
statement,
|
|
169
|
+
key: sortKey(statement)
|
|
170
|
+
})).sort((a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0);
|
|
171
|
+
for (const { statement } of sorted) {
|
|
172
|
+
const key = statementKey(statement);
|
|
173
|
+
const entry = merged.get(key) ?? {
|
|
174
|
+
statement: {
|
|
175
|
+
...statement,
|
|
176
|
+
names: []
|
|
177
|
+
},
|
|
178
|
+
seen: /* @__PURE__ */ new Set()
|
|
179
|
+
};
|
|
180
|
+
merged.set(key, entry);
|
|
181
|
+
for (const item of statement.names) {
|
|
182
|
+
const id = item.alias ?? item.name;
|
|
183
|
+
if (entry.seen.has(id) || !keep(item, statement)) continue;
|
|
184
|
+
entry.seen.add(id);
|
|
185
|
+
entry.statement.names.push(item);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const result = [...merged.values()].map(({ statement }) => statement);
|
|
189
|
+
const bound = ({ path, item }) => `${path}\0${item.alias ?? item.name}`;
|
|
190
|
+
const values = new Set(result.filter(({ space }) => space === "value").flatMap(({ path, names }) => names.map((item) => bound({
|
|
191
|
+
path,
|
|
192
|
+
item
|
|
193
|
+
}))));
|
|
194
|
+
return result.map((statement) => statement.space === "type" ? {
|
|
195
|
+
...statement,
|
|
196
|
+
names: statement.names.filter((item) => !values.has(bound({
|
|
197
|
+
path: statement.path,
|
|
198
|
+
item
|
|
199
|
+
})))
|
|
200
|
+
} : statement).filter((statement) => statement.names.length > 0);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Deduplicates `SourceNode` objects by `name + export + space`, keeping the first of each
|
|
204
|
+
* key. An unnamed source only drops when the same node appears twice, so markdown can repeat a
|
|
205
|
+
* paragraph or a table. Returns the deduplicated array in original order.
|
|
206
|
+
*/
|
|
207
|
+
function combineSources(sources) {
|
|
208
|
+
const seen = /* @__PURE__ */ new Set();
|
|
209
|
+
return sources.filter((source) => {
|
|
210
|
+
const key = source.name != null ? `${source.name}:${source.export ?? source.isExportable ?? false}:${getSpace(source)}` : source;
|
|
211
|
+
if (seen.has(key)) return false;
|
|
212
|
+
seen.add(key);
|
|
213
|
+
return true;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Deduplicates and merges `ExportNode` objects: one export per path, form and space. Returns a sorted array.
|
|
218
|
+
*/
|
|
219
|
+
function combineExports(exports) {
|
|
220
|
+
return mergeStatements(toStatements(exports, exportForm)).map(({ path, names }) => ({
|
|
221
|
+
kind: "Export",
|
|
222
|
+
path,
|
|
223
|
+
...toDeprecatedExport(names),
|
|
224
|
+
names
|
|
225
|
+
}));
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Deduplicates and merges `ImportNode` objects, filtering out unused imports.
|
|
229
|
+
*
|
|
230
|
+
* Retains imports that are referenced in `source` or re-exported. One import per path, form and space. Returns
|
|
231
|
+
* a sorted, deduplicated, filtered array.
|
|
232
|
+
*/
|
|
233
|
+
function combineImports(imports, exports, source) {
|
|
234
|
+
const exportedNames = new Set(exports.flatMap((node) => getNames(node).map((item) => item.alias ?? item.name)));
|
|
235
|
+
const identifiers = source && imports.length > INDEX_ABOVE_IMPORTS ? new Set(source.match(IDENTIFIER_RUN)) : null;
|
|
236
|
+
const isUsed = (importName) => !source || identifiers?.has(importName) || source.includes(importName) || exportedNames.has(importName);
|
|
237
|
+
const statements = toStatements(imports.filter((node) => node.path !== node.root), importForm);
|
|
238
|
+
const pathsWithUsedNamedImport = new Set(statements.filter(({ form, names }) => form === "named" && names.some((item) => isUsed(item.alias ?? item.name))).map(({ path }) => path));
|
|
239
|
+
const keep = (item, { form, path }) => isUsed(item.alias ?? item.name) || form !== "named" && pathsWithUsedNamedImport.has(path);
|
|
240
|
+
return mergeStatements(statements, keep).map(({ path, root, names }) => ({
|
|
241
|
+
kind: "Import",
|
|
242
|
+
path,
|
|
243
|
+
...root != null ? { root } : {},
|
|
244
|
+
...toDeprecatedImport(names),
|
|
245
|
+
names
|
|
246
|
+
}));
|
|
247
|
+
}
|
|
248
|
+
// src/nodes/base.ts
|
|
249
|
+
/** Builds a `createX` factory for a node whose only computed field is `kind`. */
|
|
250
|
+
function nodeFactory(kind) {
|
|
251
|
+
return (input) => {
|
|
252
|
+
return {
|
|
253
|
+
...input,
|
|
254
|
+
kind
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
// src/nodes/file.ts
|
|
259
|
+
function overrideSpace(names, { value, derived }) {
|
|
260
|
+
if (value == null || value === derived) return names;
|
|
261
|
+
const space = value ? "type" : "value";
|
|
262
|
+
return names.map((item) => ({
|
|
263
|
+
...item,
|
|
264
|
+
space
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
const isOverride = ({ value, derived }) => value !== void 0 && JSON.stringify(value) !== JSON.stringify(derived);
|
|
268
|
+
/**
|
|
269
|
+
* Creates an `ImportNode`. A node built from `names` also gets the deprecated fields. A deprecated `name` or
|
|
270
|
+
* `isTypeOnly` that differs from the one `names` gives overrides it, so `{ ...imp, isTypeOnly: true }` still works.
|
|
271
|
+
*
|
|
272
|
+
* @example Named import
|
|
273
|
+
* ```ts
|
|
274
|
+
* createImport({ names: [{ name: 'useState' }], path: 'react' })
|
|
275
|
+
* // import { useState } from 'react'
|
|
276
|
+
* ```
|
|
277
|
+
*/
|
|
278
|
+
function createImport(input) {
|
|
279
|
+
if (!input.names) return {
|
|
280
|
+
...input,
|
|
281
|
+
name: input.name ?? [],
|
|
282
|
+
kind: require_constants.nodeKinds.import
|
|
283
|
+
};
|
|
284
|
+
const derived = toDeprecatedImport(input.names);
|
|
285
|
+
if (isOverride({
|
|
286
|
+
value: input.name,
|
|
287
|
+
derived: derived.name
|
|
288
|
+
})) return {
|
|
289
|
+
...input,
|
|
290
|
+
names: null,
|
|
291
|
+
name: input.name ?? [],
|
|
292
|
+
kind: require_constants.nodeKinds.import
|
|
293
|
+
};
|
|
294
|
+
const names = overrideSpace(input.names, {
|
|
295
|
+
value: input.isTypeOnly,
|
|
296
|
+
derived: derived.isTypeOnly
|
|
297
|
+
});
|
|
298
|
+
return {
|
|
299
|
+
...input,
|
|
300
|
+
...toDeprecatedImport(names),
|
|
301
|
+
names,
|
|
302
|
+
kind: require_constants.nodeKinds.import
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Creates an `ExportNode`. A node built from `names` also gets the deprecated fields. A deprecated `name` or
|
|
307
|
+
* `isTypeOnly` that differs from the one `names` gives overrides it.
|
|
308
|
+
*
|
|
309
|
+
* @example Named export
|
|
310
|
+
* ```ts
|
|
311
|
+
* createExport({ names: [{ name: 'Pet' }], path: './Pet' })
|
|
312
|
+
* // export { Pet } from './Pet'
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
function createExport(input) {
|
|
316
|
+
if (!input.names) return {
|
|
317
|
+
...input,
|
|
318
|
+
kind: require_constants.nodeKinds.export
|
|
319
|
+
};
|
|
320
|
+
const derived = toDeprecatedExport(input.names);
|
|
321
|
+
if (isOverride({
|
|
322
|
+
value: input.name,
|
|
323
|
+
derived: derived.name
|
|
324
|
+
})) return {
|
|
325
|
+
...input,
|
|
326
|
+
names: null,
|
|
327
|
+
kind: require_constants.nodeKinds.export
|
|
328
|
+
};
|
|
329
|
+
const names = overrideSpace(input.names, {
|
|
330
|
+
value: input.isTypeOnly,
|
|
331
|
+
derived: derived.isTypeOnly
|
|
332
|
+
});
|
|
333
|
+
return {
|
|
334
|
+
...input,
|
|
335
|
+
...toDeprecatedExport(names),
|
|
336
|
+
names,
|
|
337
|
+
kind: require_constants.nodeKinds.export
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Creates a `SourceNode` representing a fragment of source code within a file.
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```ts
|
|
345
|
+
* createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], export: true })
|
|
346
|
+
* ```
|
|
347
|
+
*/
|
|
348
|
+
const createSource = nodeFactory(require_constants.nodeKinds.source);
|
|
349
|
+
/**
|
|
350
|
+
* Creates a fully resolved `FileNode` from a file input descriptor.
|
|
351
|
+
*
|
|
352
|
+
* Computes:
|
|
353
|
+
* - `id` SHA256 hash of the file path
|
|
354
|
+
* - `name` `baseName` without extension
|
|
355
|
+
* - `extname` extension extracted from `baseName`
|
|
356
|
+
*
|
|
357
|
+
* Deduplicates:
|
|
358
|
+
* - `sources` via `combineSources`
|
|
359
|
+
* - `exports` via `combineExports`
|
|
360
|
+
* - `imports` via `combineImports` (also filters unused imports)
|
|
361
|
+
*
|
|
362
|
+
* @throws {Error} when `baseName` has no extension.
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* ```ts
|
|
366
|
+
* const file = createFile({
|
|
367
|
+
* baseName: 'petStore.ts',
|
|
368
|
+
* path: 'src/models/petStore.ts',
|
|
369
|
+
* sources: [createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')] })],
|
|
370
|
+
* imports: [createImport({ name: ['z'], path: 'zod' })],
|
|
371
|
+
* exports: [createExport({ name: ['Pet'], path: './petStore' })],
|
|
372
|
+
* })
|
|
373
|
+
* // file.id = SHA256 hash of 'src/models/petStore.ts'
|
|
374
|
+
* // file.name = 'petStore'
|
|
375
|
+
* // file.extname = '.ts'
|
|
376
|
+
* ```
|
|
377
|
+
*
|
|
378
|
+
* @example Copy a real file into the output
|
|
379
|
+
* ```ts
|
|
380
|
+
* const file = createFile({
|
|
381
|
+
* baseName: 'client.ts',
|
|
382
|
+
* path: 'src/gen/client.ts',
|
|
383
|
+
* copy: '/abs/path/to/templates/client.ts',
|
|
384
|
+
* })
|
|
385
|
+
* ```
|
|
386
|
+
*/
|
|
387
|
+
function createFile(input) {
|
|
388
|
+
const extname = node_path.default.extname(input.baseName);
|
|
389
|
+
if (!extname) throw new Error(`No extname found for ${input.baseName}`);
|
|
390
|
+
const resolvedExports = input.exports?.length ? combineExports(input.exports) : [];
|
|
391
|
+
const resolvedSources = input.sources?.length ? combineSources(input.sources) : [];
|
|
392
|
+
const resolvedImports = (() => {
|
|
393
|
+
if (!input.imports?.length) return [];
|
|
394
|
+
const sourceParts = [];
|
|
395
|
+
const localNames = /* @__PURE__ */ new Set();
|
|
396
|
+
for (const item of resolvedSources) {
|
|
397
|
+
const extracted = item.nodes && require_nodeText.getNodeText(item.nodes);
|
|
398
|
+
if (extracted) sourceParts.push(extracted);
|
|
399
|
+
if (item.name) localNames.add(item.name);
|
|
400
|
+
}
|
|
401
|
+
const source = sourceParts.join("\n") || void 0;
|
|
402
|
+
return combineImports(input.imports, resolvedExports, source).flatMap((imp) => {
|
|
403
|
+
if (imp.path === input.path) return [];
|
|
404
|
+
const names = getNames(imp);
|
|
405
|
+
const kept = names.filter((item) => !localNames.has(item.alias ?? item.name));
|
|
406
|
+
if (!kept.length) return [];
|
|
407
|
+
return [kept.length === names.length ? imp : createImport({
|
|
408
|
+
path: imp.path,
|
|
409
|
+
...imp.root != null ? { root: imp.root } : {},
|
|
410
|
+
names: kept
|
|
411
|
+
})];
|
|
412
|
+
});
|
|
413
|
+
})();
|
|
414
|
+
return {
|
|
415
|
+
...input,
|
|
416
|
+
kind: require_constants.nodeKinds.file,
|
|
417
|
+
id: (0, node_crypto.hash)("sha256", input.path, "hex"),
|
|
418
|
+
name: node_path.default.basename(input.baseName, extname),
|
|
419
|
+
extname,
|
|
420
|
+
imports: resolvedImports,
|
|
421
|
+
exports: resolvedExports,
|
|
422
|
+
sources: resolvedSources,
|
|
423
|
+
meta: input.meta ?? {}
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
Object.defineProperty(exports, "createExport", {
|
|
427
|
+
enumerable: true,
|
|
428
|
+
get: function() {
|
|
429
|
+
return createExport;
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
Object.defineProperty(exports, "createFile", {
|
|
433
|
+
enumerable: true,
|
|
434
|
+
get: function() {
|
|
435
|
+
return createFile;
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
Object.defineProperty(exports, "createImport", {
|
|
439
|
+
enumerable: true,
|
|
440
|
+
get: function() {
|
|
441
|
+
return createImport;
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
Object.defineProperty(exports, "createSource", {
|
|
445
|
+
enumerable: true,
|
|
446
|
+
get: function() {
|
|
447
|
+
return createSource;
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
Object.defineProperty(exports, "getNames", {
|
|
451
|
+
enumerable: true,
|
|
452
|
+
get: function() {
|
|
453
|
+
return getNames;
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
Object.defineProperty(exports, "getSpace", {
|
|
457
|
+
enumerable: true,
|
|
458
|
+
get: function() {
|
|
459
|
+
return getSpace;
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
Object.defineProperty(exports, "nodeFactory", {
|
|
463
|
+
enumerable: true,
|
|
464
|
+
get: function() {
|
|
465
|
+
return nodeFactory;
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
//# sourceMappingURL=file-C4pqV8yl.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-C4pqV8yl.cjs","names":["memo","path","nodeKinds","path","getNodeText","hash"],"sources":["../src/utils/moduleNames.ts","../src/utils/combineFileMembers.ts","../src/nodes/base.ts","../src/nodes/file.ts"],"sourcesContent":["import type { ExportNode, ImportNode, ModuleName, SourceNode, Space } from '../nodes/file.ts'\n\n/**\n * Returns the names an import or export brings across. A node built with the deprecated fields gets them from\n * those, each with an explicit `space`, so it prints exactly as before.\n */\nexport function getNames(node: ImportNode | ExportNode): Array<ModuleName> {\n if (node.names) return node.names\n return node.kind === 'Import' ? fromDeprecatedImport(node) : fromDeprecatedExport(node)\n}\n\nexport function getSpace(source: SourceNode): Space {\n if (source.space) return source.space\n if (source.isTypeOnly != null) return source.isTypeOnly ? 'type' : 'value'\n return source.nodes?.[0]?.kind === 'Type' ? 'type' : 'value'\n}\n\ntype DeprecatedImport = Pick<ImportNode, 'name' | 'isTypeOnly' | 'isNameSpace'>\ntype DeprecatedExport = Pick<ExportNode, 'name' | 'isTypeOnly' | 'asAlias'>\n\n/**\n * @deprecated Converts a node built with `name`, `isTypeOnly` and `isNameSpace` to `names`. Removed in Kubb v6.\n */\nexport function fromDeprecatedImport({ name, isTypeOnly, isNameSpace }: DeprecatedImport): Array<ModuleName> {\n const space: Space = isTypeOnly ? 'type' : 'value'\n if (!Array.isArray(name)) return [{ name: isNameSpace ? '*' : 'default', alias: name, space }]\n return name.map((item) => (typeof item === 'string' ? { name: item, space } : { name: item.propertyName, ...(item.name ? { alias: item.name } : {}), space }))\n}\n\n/**\n * @deprecated Converts a node built with `name`, `isTypeOnly` and `asAlias` to `names`. Removed in Kubb v6.\n */\nexport function fromDeprecatedExport({ name, isTypeOnly, asAlias }: DeprecatedExport): Array<ModuleName> {\n const space: Space = isTypeOnly ? 'type' : 'value'\n if (name == null) return [{ name: '*', space }]\n if (!Array.isArray(name)) return [asAlias ? { name: '*', alias: name, space } : { name, space }]\n return name.map((item) => ({ name: item, space }))\n}\n\n/**\n * @deprecated The old import fields for `names`, for code that still reads them. Removed in Kubb v6.\n */\nexport function toDeprecatedImport(names: ReadonlyArray<ModuleName>): DeprecatedImport {\n const isTypeOnly = names.length > 0 && names.every((item) => item.space === 'type')\n const [first] = names\n if (names.length === 1 && first?.alias && (first.name === '*' || first.name === 'default')) {\n return { name: first.alias, isTypeOnly, isNameSpace: first.name === '*' }\n }\n return { name: names.map((item) => (item.alias ? { propertyName: item.name, name: item.alias } : item.name)), isTypeOnly, isNameSpace: false }\n}\n\n/**\n * @deprecated The old export fields for `names`; an alias stands in for its name. Removed in Kubb v6.\n */\nexport function toDeprecatedExport(names: ReadonlyArray<ModuleName>): DeprecatedExport {\n const isTypeOnly = names.length > 0 && names.every((item) => item.space === 'type')\n const [first] = names\n if (names.length === 1 && first?.name === '*') {\n return first.alias ? { name: first.alias, isTypeOnly, asAlias: true } : { isTypeOnly, asAlias: false }\n }\n return { name: names.map((item) => item.alias ?? item.name), isTypeOnly, asAlias: false }\n}\n","/**\n * File-member merging. `combineImports` and `combineExports` deduplicate and sort the import and\n * export entries of one file, while `combineSources` deduplicates source entries in original order.\n * `combineImports` also drops imports nothing references. This works on a file's members, not on\n * schema content.\n */\nimport path from 'node:path'\nimport { memo } from '@internals/utils'\nimport type { ExportNode, ImportNode, ModuleName, SourceNode, Space } from '../nodes/file.ts'\nimport { getNames, getSpace, toDeprecatedExport, toDeprecatedImport } from './moduleNames.ts'\n\nconst IDENTIFIER_RUN = /[\\w$]+/g\n\n/**\n * How many imports a file needs before indexing the source beats scanning it once per name.\n */\nconst INDEX_ABOVE_IMPORTS = 128\n\ntype Form = 'named' | 'default' | '*'\n\ntype Statement = { path: string; root?: string | null; form: Form; space: Space; names: Array<ModuleName> }\n\nconst importForm = (item: ModuleName): Form => (item.alias && (item.name === '*' || item.name === 'default') ? item.name : 'named')\nconst exportForm = (item: ModuleName): Form => (item.name === '*' ? '*' : 'named')\nconst label = (item: ModuleName): string => (item.alias ? `${item.name} as ${item.alias}` : item.name)\n\nfunction statementKey({ path, form, space, names }: Statement): string {\n return form === 'named' ? `${path}\\0named\\0${space}` : `${path}\\0${form}\\0${names[0]?.alias ?? ''}\\0${space}`\n}\n\nfunction toStatements(nodes: ReadonlyArray<ImportNode | ExportNode>, formOf: (item: ModuleName) => Form): Array<Statement> {\n return nodes.flatMap((node) => {\n const statements = new Map<string, Statement>()\n for (const item of getNames(node)) {\n const statement: Statement = {\n path: node.path,\n root: node.kind === 'Import' ? node.root : undefined,\n form: formOf(item),\n space: item.space ?? 'value',\n names: [],\n }\n const key = statementKey({ ...statement, names: [item] })\n const existing = statements.get(key) ?? statement\n statements.set(key, existing)\n existing.names.push(item)\n }\n return [...statements.values()]\n })\n}\n\n/**\n * Relative specifiers by `root`, then `path`. `createFile` sorts a file's imports again on every\n * merge, and the path math dominated that sort on large specs. Two levels keep the existing strings\n * as keys, so lookups reuse their hashes instead of hashing a new joined key each time.\n */\nconst specifierCache = memo.create<string, Map<string, string>>({ max: 10_000 })\n\n/**\n * Returns the specifier a member is written with: POSIX and relative to the importing file when it\n * has a `root`, like `getRelativePath` in parser-ts. Sorting on it keeps the order the same on every OS.\n */\nfunction specifier(node: { path: string; root?: string | null }): string {\n const { root, path: target } = node\n if (!root) return target\n const byPath = memo(specifierCache, root, () => new Map<string, string>())\n return memo(byPath, target, () => {\n const relative = path.relative(path.dirname(root), target).replaceAll('\\\\', '/')\n return relative.startsWith('../') ? relative : `./${relative}`\n })\n}\n\nfunction sortKey(statement: Statement): string {\n const form = statement.form === 'named' ? '1' : '0'\n const space = statement.space === 'type' ? '0' : '1'\n return `${form}:${space}:${specifier(statement)}:${statement.names.map(label).toSorted().join('\\0')}`\n}\n\nfunction mergeStatements(statements: Array<Statement>, keep: (item: ModuleName, statement: Statement) => boolean = () => true): Array<Statement> {\n const merged = new Map<string, { statement: Statement; seen: Set<string> }>()\n const sorted = statements.map((statement) => ({ statement, key: sortKey(statement) })).sort((a, b) => (a.key < b.key ? -1 : a.key > b.key ? 1 : 0))\n\n for (const { statement } of sorted) {\n const key = statementKey(statement)\n const entry = merged.get(key) ?? { statement: { ...statement, names: [] }, seen: new Set<string>() }\n merged.set(key, entry)\n for (const item of statement.names) {\n const id = item.alias ?? item.name\n if (entry.seen.has(id) || !keep(item, statement)) continue\n entry.seen.add(id)\n entry.statement.names.push(item)\n }\n }\n\n const result = [...merged.values()].map(({ statement }) => statement)\n // A name kept as a value also serves its type uses, so a type statement from the same path must not bind it again.\n const bound = ({ path, item }: { path: string; item: ModuleName }) => `${path}\\0${item.alias ?? item.name}`\n const values = new Set(result.filter(({ space }) => space === 'value').flatMap(({ path, names }) => names.map((item) => bound({ path, item }))))\n return result\n .map((statement) =>\n statement.space === 'type' ? { ...statement, names: statement.names.filter((item) => !values.has(bound({ path: statement.path, item }))) } : statement,\n )\n .filter((statement) => statement.names.length > 0)\n}\n\n/**\n * Deduplicates `SourceNode` objects by `name + export + space`, keeping the first of each\n * key. An unnamed source only drops when the same node appears twice, so markdown can repeat a\n * paragraph or a table. Returns the deduplicated array in original order.\n */\nexport function combineSources(sources: Array<SourceNode>): Array<SourceNode> {\n const seen = new Set<SourceNode | string>()\n return sources.filter((source) => {\n const key = source.name != null ? `${source.name}:${source.export ?? source.isExportable ?? false}:${getSpace(source)}` : source\n if (seen.has(key)) return false\n seen.add(key)\n return true\n })\n}\n\n/**\n * Deduplicates and merges `ExportNode` objects: one export per path, form and space. Returns a sorted array.\n */\nexport function combineExports(exports: Array<ExportNode>): Array<ExportNode> {\n return mergeStatements(toStatements(exports, exportForm)).map(({ path, names }) => ({ kind: 'Export', path, ...toDeprecatedExport(names), names }))\n}\n\n/**\n * Deduplicates and merges `ImportNode` objects, filtering out unused imports.\n *\n * Retains imports that are referenced in `source` or re-exported. One import per path, form and space. Returns\n * a sorted, deduplicated, filtered array.\n */\nexport function combineImports(imports: Array<ImportNode>, exports: Array<ExportNode>, source?: string): Array<ImportNode> {\n // Build a lookup of all exported names to retain imports that are re-exported\n const exportedNames = new Set(exports.flatMap((node) => getNames(node).map((item) => item.alias ?? item.name)))\n // `createFile` re-runs on every merge into a file, so scanning the source once per import name\n // costs a heavily merged file that scan again for every fragment it already holds. Indexing pays\n // for itself there, and costs more than it saves on the small files the default output produces.\n const identifiers = source && imports.length > INDEX_ABOVE_IMPORTS ? new Set(source.match(IDENTIFIER_RUN)) : null\n\n // A name in the index is used. One that is not still might be, inside a longer identifier, so the\n // substring test stays behind it.\n const isUsed = (importName: string): boolean => !source || identifiers?.has(importName) || source.includes(importName) || exportedNames.has(importName)\n\n const statements = toStatements(\n imports.filter((node) => node.path !== node.root),\n importForm,\n )\n\n // Paths that keep at least one used named import. A default import from such a path is retained\n // even when its binding can't be found in `source` e.g. a generated `client` default import\n // alongside `import type { Client } from <same path>`, where merged grouped output omits the body.\n const pathsWithUsedNamedImport = new Set(\n statements.filter(({ form, names }) => form === 'named' && names.some((item) => isUsed(item.alias ?? item.name))).map(({ path }) => path),\n )\n const keep = (item: ModuleName, { form, path }: Statement) => isUsed(item.alias ?? item.name) || (form !== 'named' && pathsWithUsedNamedImport.has(path))\n\n return mergeStatements(statements, keep).map(({ path, root, names }) => ({\n kind: 'Import',\n path,\n ...(root != null ? { root } : {}),\n ...toDeprecatedImport(names),\n names,\n }))\n}\n","import type { ValueOf } from '@internals/utils'\nimport type { nodeKinds } from '../constants.ts'\n\n/**\n * `kind` values used by AST nodes.\n *\n * @example\n * ```ts\n * const kind: NodeKind = 'Schema'\n * ```\n */\nexport type NodeKind = ValueOf<typeof nodeKinds>\n\n/**\n * Base shape shared by all AST nodes.\n *\n * @example\n * ```ts\n * const base: BaseNode = { kind: 'Input' }\n * ```\n */\nexport type BaseNode = {\n /**\n * Node discriminator.\n */\n kind: NodeKind\n /**\n * Where the node comes from in the input, in the form the adapter's `locate` reads. Document\n * adapters such as OpenAPI and AsyncAPI use an RFC 6901 JSON pointer, for example\n * `#/components/schemas/Pet`. Plugins can copy it to the code nodes they emit.\n */\n pointer?: string\n}\n\n/** `Omit` applied to each member of a union, so the union survives. */\nexport type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never\n\n/** Builds a `createX` factory for a node whose only computed field is `kind`. */\nexport function nodeFactory<T extends BaseNode>(kind: T['kind']): (input: Omit<T, 'kind'>) => T {\n return (input) => {\n const node = { ...input, kind }\n return node as T\n }\n}\n","import { hash } from 'node:crypto'\nimport path from 'node:path'\nimport { nodeKinds } from '../constants.ts'\nimport { combineExports, combineImports, combineSources } from '../utils/combineFileMembers.ts'\nimport { getNames, toDeprecatedExport, toDeprecatedImport } from '../utils/moduleNames.ts'\nimport { getNodeText } from '../utils/nodeText.ts'\nimport { type BaseNode, nodeFactory } from './base.ts'\nimport type { CodeNode } from './code.ts'\n\n/**\n * Supported file extensions.\n */\ntype Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`\n\ntype ImportName = string | Array<string | { propertyName: string; name?: string }>\n\n/**\n * Whether a declaration exists only at compile time (`'type'`) or also at runtime (`'value'`).\n */\nexport type Space = 'type' | 'value'\n\n/**\n * One name an import or export brings across, as in the ECMAScript `ImportEntry` record.\n */\nexport type ModuleName = {\n /**\n * Name in the other module: `'default'` for its default export, `'*'` for the whole module.\n */\n name: string\n /**\n * Local name for an import, or the exported name for an export.\n */\n alias?: string | null\n /**\n * Type or value.\n * @default 'value'\n */\n space?: Space | null\n}\n\n/**\n * Represents a language-agnostic import/dependency declaration.\n *\n * @example Named import (TypeScript: `import { useState } from 'react'`)\n * ```ts\n * createImport({ names: [{ name: 'useState' }], path: 'react' })\n * ```\n *\n * @example Default import (TypeScript: `import React from 'react'`)\n * ```ts\n * createImport({ names: [{ name: 'default', alias: 'React' }], path: 'react' })\n * ```\n *\n * @example Type-only import (TypeScript: `import type { FC } from 'react'`)\n * ```ts\n * createImport({ names: [{ name: 'FC', space: 'type' }], path: 'react' })\n * ```\n *\n * @example Namespace import (TypeScript: `import * as React from 'react'`)\n * ```ts\n * createImport({ names: [{ name: '*', alias: 'React' }], path: 'react' })\n * ```\n */\nexport type ImportNode = BaseNode & {\n kind: 'Import'\n /**\n * The names the import brings in. `ast.file.getNames` also reads the deprecated fields.\n */\n names?: Array<ModuleName> | null\n /**\n * Import name(s) to be used.\n *\n * @deprecated Use `names`. Removed in Kubb v6.\n */\n name: ImportName\n /**\n * Path for the import.\n *\n * @example\n * `'@kubb/core'`\n */\n path: string\n /**\n * Add a type-only import prefix.\n *\n * @deprecated Set `space: 'type'` on each name. Removed in Kubb v6.\n */\n isTypeOnly?: boolean | null\n /**\n * Import the entire module as a namespace.\n *\n * @deprecated Use `{ name: '*', alias }` in `names`. Removed in Kubb v6.\n */\n isNameSpace?: boolean | null\n /**\n * When set, the import path is resolved relative to this root.\n */\n root?: string | null\n}\n\n/**\n * Represents a language-agnostic export/public API declaration.\n *\n * @example Named export (TypeScript: `export { Pets } from './Pets'`)\n * ```ts\n * createExport({ names: [{ name: 'Pets' }], path: './Pets' })\n * ```\n *\n * @example Type-only export (TypeScript: `export type { Pet } from './Pet'`)\n * ```ts\n * createExport({ names: [{ name: 'Pet', space: 'type' }], path: './Pet' })\n * ```\n *\n * @example Wildcard export (TypeScript: `export * from './utils'`)\n * ```ts\n * createExport({ names: [{ name: '*' }], path: './utils' })\n * ```\n *\n * @example Namespace alias (TypeScript: `export * as utils from './utils'`)\n * ```ts\n * createExport({ names: [{ name: '*', alias: 'utils' }], path: './utils' })\n * ```\n */\nexport type ExportNode = BaseNode & {\n kind: 'Export'\n /**\n * The names the export passes on. `ast.file.getNames` also reads the deprecated fields.\n */\n names?: Array<ModuleName> | null\n /**\n * Export name(s) to be used. When omitted, generates a wildcard export.\n *\n * @deprecated Use `names`. Removed in Kubb v6.\n */\n name?: string | Array<string> | null\n /**\n * Path for the export.\n *\n * @example\n * `'@kubb/core'`\n */\n path: string\n /**\n * Add a type-only export prefix.\n *\n * @deprecated Set `space: 'type'` on each name. Removed in Kubb v6.\n */\n isTypeOnly?: boolean | null\n /**\n * Export as an aliased namespace.\n *\n * @deprecated Use `{ name: '*', alias }` in `names`. Removed in Kubb v6.\n */\n asAlias?: boolean | null\n}\n\n/**\n * Represents a fragment of source code within a file.\n *\n * @example Named exportable source\n * ```ts\n * createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], export: true })\n * ```\n *\n * @example Inline unnamed code block\n * ```ts\n * createSource({ nodes: [createText('const x = 1')] })\n * ```\n */\nexport type SourceNode = BaseNode & {\n kind: 'Source'\n /**\n * Optional name identifying this source (used for deduplication and barrel generation).\n */\n name?: string | null\n /**\n * Type or value. When unset, a source whose first node is a `Type` is a type.\n */\n space?: Space | null\n /**\n * Mark this source as a type-only export.\n *\n * @deprecated Use `space: 'type'`. Removed in Kubb v6.\n */\n isTypeOnly?: boolean | null\n /**\n * Mark this source as an exported declaration, which barrels list. The source text carries its own `export` keyword.\n */\n export?: boolean | null\n /**\n * Mark this exported source as the module's default export. Barrels skip it, since they can't re-export it by name.\n */\n default?: boolean | null\n /**\n * @deprecated Use `export`. Removed in Kubb v6.\n */\n isExportable?: boolean | null\n /**\n * @deprecated Use `export`. Removed in Kubb v6.\n */\n isIndexable?: boolean | null\n /**\n * Marks the source as a definition that importing files absorb instead of import. `expression` is\n * the declaration's right-hand side, such as `{ body: Pet }`.\n *\n * @deprecated Set `inline` on the file. Removed in Kubb v6.\n */\n inline?: { expression: string } | null\n /**\n * Child nodes that make up this source fragment, in DOM order.\n * Use a {@link TextNode} for raw string content.\n */\n nodes?: Array<CodeNode>\n}\n\n/**\n * Represents a fully resolved file in the AST.\n *\n * Created via `createFile()`, which computes the `id`, `name`, and `extname` from the input\n * and deduplicates `imports`, `exports`, and `sources`.\n *\n * @example\n * ```ts\n * const file = createFile({\n * baseName: 'petStore.ts',\n * path: 'src/models/petStore.ts',\n * sources: [createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], export: true })],\n * imports: [createImport({ name: ['z'], path: 'zod' })],\n * exports: [createExport({ name: ['Pet'], path: './petStore' })],\n * })\n * // file.id = SHA256 hash of the path\n * // file.name = 'petStore'\n * // file.extname = '.ts'\n * ```\n */\nexport type FileNode<TMeta extends object = object> = BaseNode & {\n kind: 'File'\n /**\n * Unique identifier derived from a SHA256 hash of the file path. `createFile`\n * computes it, so callers do not need to provide it.\n */\n id: string\n /**\n * File name without extension, derived from `baseName`.\n *\n * @see https://nodejs.org/api/path.html#pathformatpathobject\n */\n name: string\n /**\n * File base name, including extension, shaped like `${name}${extname}`.\n *\n * @see https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\n baseName: `${string}.${string}`\n /**\n * Full qualified path to the file.\n */\n path: string\n /**\n * File extension extracted from `baseName`.\n */\n extname: Extname\n /**\n * Deduplicated list of source code fragments.\n */\n sources: Array<SourceNode>\n /**\n * Deduplicated list of import declarations.\n */\n imports: Array<ImportNode>\n /**\n * Deduplicated list of export declarations.\n */\n exports: Array<ExportNode>\n /**\n * Optional metadata attached to this file, read by plugins during barrel generation.\n */\n meta?: TMeta\n /**\n * Optional banner prepended to the generated file content.\n * Accepts `null` so `resolver.default.banner()` results can be passed directly.\n */\n banner?: string | null\n /**\n * Optional footer appended to the generated file content.\n * Accepts `null` so `resolver.default.footer()` results can be passed directly.\n */\n footer?: string | null\n /**\n * Absolute on-disk path to copy into the output, through the parser's `copy` hook when it has one.\n *\n * Use to emit a real source file shipped inside a package (a template) into the generated\n * folder. When set, `copy` provides the file content and any `sources` nodes are ignored for\n * output; `sources` may still carry `name`/`export` so barrel generation\n * treats the file the same as a rendered one.\n */\n copy?: string | null\n /**\n * Marks a file that is never written. Each file that imports from it gets the body of each imported declaration, such as `{ body: Pet }`, in place of its name.\n */\n inline?: boolean | null\n}\n\nexport type ImportInput = Omit<ImportNode, 'kind' | 'name'> & { name?: ImportName }\n\nexport type ExportInput = Omit<ExportNode, 'kind'>\n\n// A spread node carries the deprecated fields derived from its `names`, so only a value that differs is an override.\ntype Override<TValue> = { value: TValue | null | undefined; derived: TValue | null | undefined }\n\nfunction overrideSpace(names: Array<ModuleName>, { value, derived }: Override<boolean>): Array<ModuleName> {\n if (value == null || value === derived) return names\n const space = value ? 'type' : 'value'\n return names.map((item) => ({ ...item, space }))\n}\n\nconst isOverride = ({ value, derived }: Override<unknown>): boolean => value !== undefined && JSON.stringify(value) !== JSON.stringify(derived)\n\n/**\n * Creates an `ImportNode`. A node built from `names` also gets the deprecated fields. A deprecated `name` or\n * `isTypeOnly` that differs from the one `names` gives overrides it, so `{ ...imp, isTypeOnly: true }` still works.\n *\n * @example Named import\n * ```ts\n * createImport({ names: [{ name: 'useState' }], path: 'react' })\n * // import { useState } from 'react'\n * ```\n */\nexport function createImport(input: ImportInput): ImportNode {\n if (!input.names) return { ...input, name: input.name ?? [], kind: nodeKinds.import }\n const derived = toDeprecatedImport(input.names)\n if (isOverride({ value: input.name, derived: derived.name })) return { ...input, names: null, name: input.name ?? [], kind: nodeKinds.import }\n const names = overrideSpace(input.names, { value: input.isTypeOnly, derived: derived.isTypeOnly })\n return { ...input, ...toDeprecatedImport(names), names, kind: nodeKinds.import }\n}\n\n/**\n * Creates an `ExportNode`. A node built from `names` also gets the deprecated fields. A deprecated `name` or\n * `isTypeOnly` that differs from the one `names` gives overrides it.\n *\n * @example Named export\n * ```ts\n * createExport({ names: [{ name: 'Pet' }], path: './Pet' })\n * // export { Pet } from './Pet'\n * ```\n */\nexport function createExport(input: ExportInput): ExportNode {\n if (!input.names) return { ...input, kind: nodeKinds.export }\n const derived = toDeprecatedExport(input.names)\n if (isOverride({ value: input.name, derived: derived.name })) return { ...input, names: null, kind: nodeKinds.export }\n const names = overrideSpace(input.names, { value: input.isTypeOnly, derived: derived.isTypeOnly })\n return { ...input, ...toDeprecatedExport(names), names, kind: nodeKinds.export }\n}\n\n/**\n * Creates a `SourceNode` representing a fragment of source code within a file.\n *\n * @example\n * ```ts\n * createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], export: true })\n * ```\n */\nexport const createSource = nodeFactory<SourceNode>(nodeKinds.source)\n\n/**\n * Input descriptor for {@link createFile}, before `id`, `name`, and `extname` are computed\n * and `imports`/`exports`/`sources` are deduplicated.\n */\nexport type UserFileNode<TMeta extends object = object> = Omit<FileNode<TMeta>, 'kind' | 'id' | 'name' | 'extname' | 'imports' | 'exports' | 'sources'> &\n Pick<Partial<FileNode<TMeta>>, 'imports' | 'exports' | 'sources'>\n\n/**\n * Creates a fully resolved `FileNode` from a file input descriptor.\n *\n * Computes:\n * - `id` SHA256 hash of the file path\n * - `name` `baseName` without extension\n * - `extname` extension extracted from `baseName`\n *\n * Deduplicates:\n * - `sources` via `combineSources`\n * - `exports` via `combineExports`\n * - `imports` via `combineImports` (also filters unused imports)\n *\n * @throws {Error} when `baseName` has no extension.\n *\n * @example\n * ```ts\n * const file = createFile({\n * baseName: 'petStore.ts',\n * path: 'src/models/petStore.ts',\n * sources: [createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')] })],\n * imports: [createImport({ name: ['z'], path: 'zod' })],\n * exports: [createExport({ name: ['Pet'], path: './petStore' })],\n * })\n * // file.id = SHA256 hash of 'src/models/petStore.ts'\n * // file.name = 'petStore'\n * // file.extname = '.ts'\n * ```\n *\n * @example Copy a real file into the output\n * ```ts\n * const file = createFile({\n * baseName: 'client.ts',\n * path: 'src/gen/client.ts',\n * copy: '/abs/path/to/templates/client.ts',\n * })\n * ```\n */\nexport function createFile<TMeta extends object = object>(input: UserFileNode<TMeta>): FileNode<TMeta> {\n const extname = path.extname(input.baseName) as `.${string}`\n if (!extname) {\n throw new Error(`No extname found for ${input.baseName}`)\n }\n\n const resolvedExports = input.exports?.length ? combineExports(input.exports) : []\n const resolvedSources = input.sources?.length ? combineSources(input.sources) : []\n\n // Skip building the source text and local-name set when there are no imports to resolve against them.\n const resolvedImports: Array<ImportNode> = (() => {\n if (!input.imports?.length) return []\n\n const sourceParts: Array<string> = []\n const localNames = new Set<string>()\n // Only the sources the file keeps count: an import used just by a dropped duplicate is unused.\n for (const item of resolvedSources) {\n const extracted = item.nodes && getNodeText(item.nodes)\n if (extracted) sourceParts.push(extracted)\n if (item.name) localNames.add(item.name)\n }\n const source = sourceParts.join('\\n') || undefined\n const combinedImports = combineImports(input.imports, resolvedExports, source)\n // Consolidating output (`mode: 'file'`) can put a symbol's definition and an import of it in the\n // same file: by path when the import still targets this file, by name when consolidation moved it.\n return combinedImports.flatMap((imp) => {\n if (imp.path === input.path) return []\n const names = getNames(imp)\n const kept = names.filter((item) => !localNames.has(item.alias ?? item.name))\n if (!kept.length) return []\n return [kept.length === names.length ? imp : createImport({ path: imp.path, ...(imp.root != null ? { root: imp.root } : {}), names: kept })]\n })\n })()\n\n return {\n ...input,\n kind: nodeKinds.file,\n id: hash('sha256', input.path, 'hex'),\n name: path.basename(input.baseName, extname),\n extname,\n imports: resolvedImports,\n exports: resolvedExports,\n sources: resolvedSources,\n meta: (input.meta ?? {}) as TMeta,\n }\n}\n"],"mappings":";;;;;;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