@openpkg-ts/extract 0.1.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/tspec.js CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  extract
4
- } from "../shared/chunk-esvc8n1x.js";
4
+ } from "../shared/chunk-570ne82m.js";
5
5
 
6
6
  // src/cli/spec.ts
7
- import { Command } from "commander";
8
- import { normalize, validateSpec } from "@openpkg-ts/spec";
9
7
  import * as fs from "node:fs";
10
8
  import * as path from "node:path";
9
+ import { normalize, validateSpec } from "@openpkg-ts/spec";
10
+ import { Command } from "commander";
11
11
  function createProgram() {
12
12
  const program = new Command("tspec").description("Extract TypeScript package API to OpenPkg spec").argument("[entry]", "Entry point file").option("-o, --output <file>", "Output file", "openpkg.json").option("--max-depth <n>", "Max type depth", "20").option("--skip-resolve", "Skip external type resolution").option("--runtime", "Enable Standard Schema runtime extraction").action(async (entry, options) => {
13
13
  const entryFile = entry || findEntryPoint(process.cwd());
@@ -1,52 +1,3 @@
1
- // src/compiler/program.ts
2
- import * as path from "node:path";
3
- import ts from "typescript";
4
- var DEFAULT_COMPILER_OPTIONS = {
5
- target: ts.ScriptTarget.Latest,
6
- module: ts.ModuleKind.CommonJS,
7
- lib: ["lib.es2021.d.ts"],
8
- declaration: true,
9
- moduleResolution: ts.ModuleResolutionKind.NodeJs
10
- };
11
- function createProgram({
12
- entryFile,
13
- baseDir = path.dirname(entryFile),
14
- content
15
- }) {
16
- const configPath = ts.findConfigFile(baseDir, ts.sys.fileExists, "tsconfig.json");
17
- let compilerOptions = { ...DEFAULT_COMPILER_OPTIONS };
18
- if (configPath) {
19
- const configFile = ts.readConfigFile(configPath, ts.sys.readFile);
20
- const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath));
21
- compilerOptions = { ...compilerOptions, ...parsedConfig.options };
22
- }
23
- const allowJsVal = compilerOptions.allowJs;
24
- if (typeof allowJsVal === "boolean" && allowJsVal) {
25
- compilerOptions = { ...compilerOptions, allowJs: false, checkJs: false };
26
- }
27
- const compilerHost = ts.createCompilerHost(compilerOptions, true);
28
- let inMemorySource;
29
- if (content !== undefined) {
30
- inMemorySource = ts.createSourceFile(entryFile, content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
31
- const originalGetSourceFile = compilerHost.getSourceFile.bind(compilerHost);
32
- compilerHost.getSourceFile = (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
33
- if (fileName === entryFile) {
34
- return inMemorySource;
35
- }
36
- return originalGetSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
37
- };
38
- }
39
- const program = ts.createProgram([entryFile], compilerOptions, compilerHost);
40
- const sourceFile = inMemorySource ?? program.getSourceFile(entryFile);
41
- return {
42
- program,
43
- compilerHost,
44
- compilerOptions,
45
- sourceFile,
46
- configPath
47
- };
48
- }
49
-
50
1
  // src/ast/registry.ts
51
2
  class TypeRegistry {
52
3
  types = new Map;
@@ -77,19 +28,19 @@ class TypeRegistry {
77
28
  }
78
29
 
79
30
  // src/ast/utils.ts
80
- import ts2 from "typescript";
31
+ import ts from "typescript";
81
32
  function getJSDocComment(node) {
82
- const jsDocTags = ts2.getJSDocTags(node);
33
+ const jsDocTags = ts.getJSDocTags(node);
83
34
  const tags = jsDocTags.map((tag) => ({
84
35
  name: tag.tagName.text,
85
- text: typeof tag.comment === "string" ? tag.comment : ts2.getTextOfJSDocComment(tag.comment) ?? ""
36
+ text: typeof tag.comment === "string" ? tag.comment : ts.getTextOfJSDocComment(tag.comment) ?? ""
86
37
  }));
87
38
  const jsDocComments = node.jsDoc;
88
39
  let description;
89
40
  if (jsDocComments && jsDocComments.length > 0) {
90
41
  const firstDoc = jsDocComments[0];
91
42
  if (firstDoc.comment) {
92
- description = typeof firstDoc.comment === "string" ? firstDoc.comment : ts2.getTextOfJSDocComment(firstDoc.comment);
43
+ description = typeof firstDoc.comment === "string" ? firstDoc.comment : ts.getTextOfJSDocComment(firstDoc.comment);
93
44
  }
94
45
  }
95
46
  return { description, tags };
@@ -102,6 +53,104 @@ function getSourceLocation(node, sourceFile) {
102
53
  };
103
54
  }
104
55
 
56
+ // src/compiler/program.ts
57
+ import * as path from "node:path";
58
+ import ts2 from "typescript";
59
+ var DEFAULT_COMPILER_OPTIONS = {
60
+ target: ts2.ScriptTarget.Latest,
61
+ module: ts2.ModuleKind.CommonJS,
62
+ lib: ["lib.es2021.d.ts"],
63
+ declaration: true,
64
+ moduleResolution: ts2.ModuleResolutionKind.NodeJs
65
+ };
66
+ function createProgram({
67
+ entryFile,
68
+ baseDir = path.dirname(entryFile),
69
+ content
70
+ }) {
71
+ const configPath = ts2.findConfigFile(baseDir, ts2.sys.fileExists, "tsconfig.json");
72
+ let compilerOptions = { ...DEFAULT_COMPILER_OPTIONS };
73
+ if (configPath) {
74
+ const configFile = ts2.readConfigFile(configPath, ts2.sys.readFile);
75
+ const parsedConfig = ts2.parseJsonConfigFileContent(configFile.config, ts2.sys, path.dirname(configPath));
76
+ compilerOptions = { ...compilerOptions, ...parsedConfig.options };
77
+ }
78
+ const allowJsVal = compilerOptions.allowJs;
79
+ if (typeof allowJsVal === "boolean" && allowJsVal) {
80
+ compilerOptions = { ...compilerOptions, allowJs: false, checkJs: false };
81
+ }
82
+ const compilerHost = ts2.createCompilerHost(compilerOptions, true);
83
+ let inMemorySource;
84
+ if (content !== undefined) {
85
+ inMemorySource = ts2.createSourceFile(entryFile, content, ts2.ScriptTarget.Latest, true, ts2.ScriptKind.TS);
86
+ const originalGetSourceFile = compilerHost.getSourceFile.bind(compilerHost);
87
+ compilerHost.getSourceFile = (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
88
+ if (fileName === entryFile) {
89
+ return inMemorySource;
90
+ }
91
+ return originalGetSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
92
+ };
93
+ }
94
+ const program = ts2.createProgram([entryFile], compilerOptions, compilerHost);
95
+ const sourceFile = inMemorySource ?? program.getSourceFile(entryFile);
96
+ return {
97
+ program,
98
+ compilerHost,
99
+ compilerOptions,
100
+ sourceFile,
101
+ configPath
102
+ };
103
+ }
104
+
105
+ // src/serializers/classes.ts
106
+ function serializeClass(node, ctx) {
107
+ const symbol = ctx.typeChecker.getSymbolAtLocation(node.name ?? node);
108
+ const name = symbol?.getName() ?? node.name?.getText();
109
+ if (!name)
110
+ return null;
111
+ const declSourceFile = node.getSourceFile();
112
+ const { description, tags } = getJSDocComment(node);
113
+ const source = getSourceLocation(node, declSourceFile);
114
+ return {
115
+ id: name,
116
+ name,
117
+ kind: "class",
118
+ description,
119
+ tags,
120
+ source,
121
+ members: []
122
+ };
123
+ }
124
+
125
+ // src/serializers/enums.ts
126
+ function serializeEnum(node, ctx) {
127
+ const symbol = ctx.typeChecker.getSymbolAtLocation(node.name ?? node);
128
+ const name = symbol?.getName() ?? node.name?.getText();
129
+ if (!name)
130
+ return null;
131
+ const declSourceFile = node.getSourceFile();
132
+ const { description, tags } = getJSDocComment(node);
133
+ const source = getSourceLocation(node, declSourceFile);
134
+ const members = node.members.map((member) => {
135
+ const memberSymbol = ctx.typeChecker.getSymbolAtLocation(member.name);
136
+ const memberName = memberSymbol?.getName() ?? member.name.getText();
137
+ return {
138
+ id: memberName,
139
+ name: memberName,
140
+ kind: "enum-member"
141
+ };
142
+ });
143
+ return {
144
+ id: name,
145
+ name,
146
+ kind: "enum",
147
+ description,
148
+ tags,
149
+ source,
150
+ members
151
+ };
152
+ }
153
+
105
154
  // src/types/parameters.ts
106
155
  function extractParameters(signature, checker) {
107
156
  return signature.getParameters().map((param) => {
@@ -146,26 +195,6 @@ function serializeFunctionExport(node, ctx) {
146
195
  };
147
196
  }
148
197
 
149
- // src/serializers/classes.ts
150
- function serializeClass(node, ctx) {
151
- const symbol = ctx.typeChecker.getSymbolAtLocation(node.name ?? node);
152
- const name = symbol?.getName() ?? node.name?.getText();
153
- if (!name)
154
- return null;
155
- const declSourceFile = node.getSourceFile();
156
- const { description, tags } = getJSDocComment(node);
157
- const source = getSourceLocation(node, declSourceFile);
158
- return {
159
- id: name,
160
- name,
161
- kind: "class",
162
- description,
163
- tags,
164
- source,
165
- members: []
166
- };
167
- }
168
-
169
198
  // src/serializers/interfaces.ts
170
199
  function serializeInterface(node, ctx) {
171
200
  const symbol = ctx.typeChecker.getSymbolAtLocation(node.name ?? node);
@@ -208,35 +237,6 @@ function serializeTypeAlias(node, ctx) {
208
237
  };
209
238
  }
210
239
 
211
- // src/serializers/enums.ts
212
- function serializeEnum(node, ctx) {
213
- const symbol = ctx.typeChecker.getSymbolAtLocation(node.name ?? node);
214
- const name = symbol?.getName() ?? node.name?.getText();
215
- if (!name)
216
- return null;
217
- const declSourceFile = node.getSourceFile();
218
- const { description, tags } = getJSDocComment(node);
219
- const source = getSourceLocation(node, declSourceFile);
220
- const members = node.members.map((member) => {
221
- const memberSymbol = ctx.typeChecker.getSymbolAtLocation(member.name);
222
- const memberName = memberSymbol?.getName() ?? member.name.getText();
223
- return {
224
- id: memberName,
225
- name: memberName,
226
- kind: "enum-member"
227
- };
228
- });
229
- return {
230
- id: name,
231
- name,
232
- kind: "enum",
233
- description,
234
- tags,
235
- source,
236
- members
237
- };
238
- }
239
-
240
240
  // src/serializers/variables.ts
241
241
  function serializeVariable(node, statement, ctx) {
242
242
  const symbol = ctx.typeChecker.getSymbolAtLocation(node.name);
@@ -260,8 +260,10 @@ function serializeVariable(node, statement, ctx) {
260
260
  }
261
261
 
262
262
  // src/builder/spec-builder.ts
263
- import ts3 from "typescript";
263
+ import * as fs from "node:fs";
264
+ import * as path2 from "node:path";
264
265
  import { SCHEMA_VERSION } from "@openpkg-ts/spec";
266
+ import ts3 from "typescript";
265
267
 
266
268
  // src/serializers/context.ts
267
269
  function createContext(program, sourceFile, options = {}) {
@@ -276,8 +278,6 @@ function createContext(program, sourceFile, options = {}) {
276
278
  }
277
279
 
278
280
  // src/builder/spec-builder.ts
279
- import * as path2 from "node:path";
280
- import * as fs from "node:fs";
281
281
  async function extract(options) {
282
282
  const { entryFile, baseDir, content, maxTypeDepth, resolveExternalTypes } = options;
283
283
  const diagnostics = [];
@@ -400,4 +400,4 @@ async function getPackageMeta(entryFile, baseDir) {
400
400
  } catch {}
401
401
  return { name: path2.basename(searchDir) };
402
402
  }
403
- export { createProgram, TypeRegistry, getJSDocComment, getSourceLocation, extractParameters, serializeFunctionExport, serializeClass, serializeInterface, serializeTypeAlias, serializeEnum, serializeVariable, extract };
403
+ export { TypeRegistry, getJSDocComment, getSourceLocation, createProgram, serializeClass, serializeEnum, extractParameters, serializeFunctionExport, serializeInterface, serializeTypeAlias, serializeVariable, extract };
@@ -1,3 +1,20 @@
1
+ import { SpecType } from "@openpkg-ts/spec";
2
+ import ts from "typescript";
3
+ declare class TypeRegistry {
4
+ private types;
5
+ add(type: SpecType): void;
6
+ get(id: string): SpecType | undefined;
7
+ has(id: string): boolean;
8
+ getAll(): SpecType[];
9
+ registerFromSymbol(symbol: ts.Symbol, checker: ts.TypeChecker): SpecType | undefined;
10
+ }
11
+ import { SpecSource, SpecTag } from "@openpkg-ts/spec";
12
+ import ts2 from "typescript";
13
+ declare function getJSDocComment(node: ts2.Node): {
14
+ description?: string;
15
+ tags: SpecTag[];
16
+ };
17
+ declare function getSourceLocation(node: ts2.Node, sourceFile: ts2.SourceFile): SpecSource;
1
18
  import { OpenPkg } from "@openpkg-ts/spec";
2
19
  interface ExtractOptions {
3
20
  entryFile: string;
@@ -28,96 +45,79 @@ interface SerializerContext {
28
45
  resolveExternalTypes: boolean;
29
46
  }
30
47
  declare function extract(options: ExtractOptions): Promise<ExtractResult>;
31
- import ts from "typescript";
48
+ import ts3 from "typescript";
49
+ interface ProgramOptions {
50
+ entryFile: string;
51
+ baseDir?: string;
52
+ content?: string;
53
+ }
54
+ interface ProgramResult {
55
+ program: ts3.Program;
56
+ compilerHost: ts3.CompilerHost;
57
+ compilerOptions: ts3.CompilerOptions;
58
+ sourceFile?: ts3.SourceFile;
59
+ configPath?: string;
60
+ }
61
+ declare function createProgram({ entryFile, baseDir, content }: ProgramOptions): ProgramResult;
32
62
  import { SpecSchema } from "@openpkg-ts/spec";
63
+ import ts4 from "typescript";
33
64
  type SchemaAdapter = {
34
65
  name: string;
35
- detect: (node: ts.Node, checker: ts.TypeChecker) => boolean;
36
- extract: (node: ts.Node, checker: ts.TypeChecker) => SpecSchema | null;
66
+ detect: (node: ts4.Node, checker: ts4.TypeChecker) => boolean;
67
+ extract: (node: ts4.Node, checker: ts4.TypeChecker) => SpecSchema | null;
37
68
  };
38
69
  declare function registerAdapter(adapter: SchemaAdapter): void;
39
- declare function findAdapter(node: ts.Node, checker: ts.TypeChecker): SchemaAdapter | undefined;
40
- declare function isSchemaType(node: ts.Node, checker: ts.TypeChecker): boolean;
41
- declare function extractSchemaType(node: ts.Node, checker: ts.TypeChecker): SpecSchema | null;
42
- declare const zodAdapter: SchemaAdapter;
43
- declare const typeboxAdapter: SchemaAdapter;
70
+ declare function findAdapter(node: ts4.Node, checker: ts4.TypeChecker): SchemaAdapter | undefined;
71
+ declare function isSchemaType(node: ts4.Node, checker: ts4.TypeChecker): boolean;
72
+ declare function extractSchemaType(node: ts4.Node, checker: ts4.TypeChecker): SpecSchema | null;
44
73
  declare const arktypeAdapter: SchemaAdapter;
74
+ declare const typeboxAdapter: SchemaAdapter;
45
75
  declare const valibotAdapter: SchemaAdapter;
46
- import ts2 from "typescript";
76
+ declare const zodAdapter: SchemaAdapter;
47
77
  import { SpecSchema as SpecSchema2 } from "@openpkg-ts/spec";
78
+ import ts5 from "typescript";
48
79
  interface StandardSchemaResult {
49
80
  schema: SpecSchema2;
50
81
  vendor: string;
51
82
  }
52
- declare function extractStandardSchemas(_program: ts2.Program, _entryFile: string): StandardSchemaResult[];
53
- import ts3 from "typescript";
54
- declare function formatTypeReference(type: ts3.Type, checker: ts3.TypeChecker): string;
55
- declare function collectReferencedTypes(type: ts3.Type, checker: ts3.TypeChecker, visited?: Set<string>): string[];
56
- import ts4 from "typescript";
57
- declare function isExported(node: ts4.Node): boolean;
58
- declare function getNodeName(node: ts4.Node): string | undefined;
59
- import ts5 from "typescript";
60
- import { SpecSignatureParameter } from "@openpkg-ts/spec";
61
- declare function extractParameters(signature: ts5.Signature, checker: ts5.TypeChecker): SpecSignatureParameter[];
62
- import ts6 from "typescript";
63
- import { SpecSchema as SpecSchema3 } from "@openpkg-ts/spec";
64
- declare function buildSchema(type: ts6.Type, checker: ts6.TypeChecker, depth?: number): SpecSchema3;
65
- import ts7 from "typescript";
66
- import { SpecSource, SpecTag } from "@openpkg-ts/spec";
67
- declare function getJSDocComment(node: ts7.Node): {
68
- description?: string;
69
- tags: SpecTag[];
70
- };
71
- declare function getSourceLocation(node: ts7.Node, sourceFile: ts7.SourceFile): SpecSource;
72
- import ts8 from "typescript";
73
- import { SpecType } from "@openpkg-ts/spec";
74
- declare class TypeRegistry {
75
- private types;
76
- add(type: SpecType): void;
77
- get(id: string): SpecType | undefined;
78
- has(id: string): boolean;
79
- getAll(): SpecType[];
80
- registerFromSymbol(symbol: ts8.Symbol, checker: ts8.TypeChecker): SpecType | undefined;
81
- }
82
- import ts10 from "typescript";
83
+ declare function extractStandardSchemas(_program: ts5.Program, _entryFile: string): StandardSchemaResult[];
83
84
  import { SpecExport } from "@openpkg-ts/spec";
84
- import ts9 from "typescript";
85
+ import ts7 from "typescript";
86
+ import ts6 from "typescript";
85
87
  interface SerializerContext2 {
86
- typeChecker: ts9.TypeChecker;
87
- program: ts9.Program;
88
- sourceFile: ts9.SourceFile;
88
+ typeChecker: ts6.TypeChecker;
89
+ program: ts6.Program;
90
+ sourceFile: ts6.SourceFile;
89
91
  maxTypeDepth: number;
90
92
  resolveExternalTypes: boolean;
91
93
  typeRegistry: TypeRegistry;
92
94
  }
93
- declare function serializeFunctionExport(node: ts10.FunctionDeclaration | ts10.ArrowFunction, ctx: SerializerContext2): SpecExport | null;
94
- import ts11 from "typescript";
95
+ declare function serializeClass(node: ts7.ClassDeclaration, ctx: SerializerContext2): SpecExport | null;
95
96
  import { SpecExport as SpecExport2 } from "@openpkg-ts/spec";
96
- declare function serializeClass(node: ts11.ClassDeclaration, ctx: SerializerContext2): SpecExport2 | null;
97
- import ts12 from "typescript";
97
+ import ts8 from "typescript";
98
+ declare function serializeEnum(node: ts8.EnumDeclaration, ctx: SerializerContext2): SpecExport2 | null;
98
99
  import { SpecExport as SpecExport3 } from "@openpkg-ts/spec";
99
- declare function serializeInterface(node: ts12.InterfaceDeclaration, ctx: SerializerContext2): SpecExport3 | null;
100
- import ts13 from "typescript";
100
+ import ts9 from "typescript";
101
+ declare function serializeFunctionExport(node: ts9.FunctionDeclaration | ts9.ArrowFunction, ctx: SerializerContext2): SpecExport3 | null;
101
102
  import { SpecExport as SpecExport4 } from "@openpkg-ts/spec";
102
- declare function serializeTypeAlias(node: ts13.TypeAliasDeclaration, ctx: SerializerContext2): SpecExport4 | null;
103
- import ts14 from "typescript";
103
+ import ts10 from "typescript";
104
+ declare function serializeInterface(node: ts10.InterfaceDeclaration, ctx: SerializerContext2): SpecExport4 | null;
104
105
  import { SpecExport as SpecExport5 } from "@openpkg-ts/spec";
105
- declare function serializeEnum(node: ts14.EnumDeclaration, ctx: SerializerContext2): SpecExport5 | null;
106
- import ts15 from "typescript";
106
+ import ts11 from "typescript";
107
+ declare function serializeTypeAlias(node: ts11.TypeAliasDeclaration, ctx: SerializerContext2): SpecExport5 | null;
107
108
  import { SpecExport as SpecExport6 } from "@openpkg-ts/spec";
108
- declare function serializeVariable(node: ts15.VariableDeclaration, statement: ts15.VariableStatement, ctx: SerializerContext2): SpecExport6 | null;
109
+ import ts12 from "typescript";
110
+ declare function serializeVariable(node: ts12.VariableDeclaration, statement: ts12.VariableStatement, ctx: SerializerContext2): SpecExport6 | null;
111
+ import ts13 from "typescript";
112
+ declare function formatTypeReference(type: ts13.Type, checker: ts13.TypeChecker): string;
113
+ declare function collectReferencedTypes(type: ts13.Type, checker: ts13.TypeChecker, visited?: Set<string>): string[];
114
+ import { SpecSignatureParameter } from "@openpkg-ts/spec";
115
+ import ts14 from "typescript";
116
+ declare function extractParameters(signature: ts14.Signature, checker: ts14.TypeChecker): SpecSignatureParameter[];
117
+ import { SpecSchema as SpecSchema3 } from "@openpkg-ts/spec";
118
+ import ts15 from "typescript";
119
+ declare function buildSchema(type: ts15.Type, checker: ts15.TypeChecker, depth?: number): SpecSchema3;
109
120
  import ts16 from "typescript";
110
- interface ProgramOptions {
111
- entryFile: string;
112
- baseDir?: string;
113
- content?: string;
114
- }
115
- interface ProgramResult {
116
- program: ts16.Program;
117
- compilerHost: ts16.CompilerHost;
118
- compilerOptions: ts16.CompilerOptions;
119
- sourceFile?: ts16.SourceFile;
120
- configPath?: string;
121
- }
122
- declare function createProgram({ entryFile, baseDir, content }: ProgramOptions): ProgramResult;
121
+ declare function isExported(node: ts16.Node): boolean;
122
+ declare function getNodeName(node: ts16.Node): string | undefined;
123
123
  export { zodAdapter, valibotAdapter, typeboxAdapter, serializeVariable, serializeTypeAlias, serializeInterface, serializeFunctionExport, serializeEnum, serializeClass, registerAdapter, isSchemaType, isExported, getSourceLocation, getNodeName, getJSDocComment, formatTypeReference, findAdapter, extractStandardSchemas, extractSchemaType, extractParameters, extract, createProgram, collectReferencedTypes, buildSchema, arktypeAdapter, TypeRegistry, StandardSchemaResult, SerializerContext, SchemaAdapter, ProgramResult, ProgramOptions, ExtractResult, ExtractOptions, Diagnostic };
package/dist/src/index.js CHANGED
@@ -11,10 +11,10 @@ import {
11
11
  serializeInterface,
12
12
  serializeTypeAlias,
13
13
  serializeVariable
14
- } from "../shared/chunk-esvc8n1x.js";
15
- // src/schema/adapters/zod.ts
16
- var zodAdapter = {
17
- name: "zod",
14
+ } from "../shared/chunk-570ne82m.js";
15
+ // src/schema/adapters/arktype.ts
16
+ var arktypeAdapter = {
17
+ name: "arktype",
18
18
  detect: () => false,
19
19
  extract: () => null
20
20
  };
@@ -24,18 +24,18 @@ var typeboxAdapter = {
24
24
  detect: () => false,
25
25
  extract: () => null
26
26
  };
27
- // src/schema/adapters/arktype.ts
28
- var arktypeAdapter = {
29
- name: "arktype",
30
- detect: () => false,
31
- extract: () => null
32
- };
33
27
  // src/schema/adapters/valibot.ts
34
28
  var valibotAdapter = {
35
29
  name: "valibot",
36
30
  detect: () => false,
37
31
  extract: () => null
38
32
  };
33
+ // src/schema/adapters/zod.ts
34
+ var zodAdapter = {
35
+ name: "zod",
36
+ detect: () => false,
37
+ extract: () => null
38
+ };
39
39
  // src/schema/registry.ts
40
40
  var adapters = [];
41
41
  function registerAdapter(adapter) {
@@ -69,20 +69,6 @@ function collectReferencedTypes(type, checker, visited = new Set) {
69
69
  visited.add(name);
70
70
  return [name];
71
71
  }
72
- // src/types/utils.ts
73
- function isExported(node) {
74
- const modifiers = node.modifiers;
75
- if (!modifiers)
76
- return false;
77
- return modifiers.some((m) => m.kind === 95);
78
- }
79
- function getNodeName(node) {
80
- if ("name" in node && node.name) {
81
- const name = node.name;
82
- return name.text;
83
- }
84
- return;
85
- }
86
72
  // src/types/schema-builder.ts
87
73
  function buildSchema(type, checker, depth = 0) {
88
74
  if (depth > 10) {
@@ -109,6 +95,20 @@ function buildSchema(type, checker, depth = 0) {
109
95
  return { type: "never" };
110
96
  return { type: typeString };
111
97
  }
98
+ // src/types/utils.ts
99
+ function isExported(node) {
100
+ const modifiers = node.modifiers;
101
+ if (!modifiers)
102
+ return false;
103
+ return modifiers.some((m) => m.kind === 95);
104
+ }
105
+ function getNodeName(node) {
106
+ if ("name" in node && node.name) {
107
+ const name = node.name;
108
+ return name.text;
109
+ }
110
+ return;
111
+ }
112
112
  export {
113
113
  zodAdapter,
114
114
  valibotAdapter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpkg-ts/extract",
3
- "version": "0.1.0",
3
+ "version": "0.11.1",
4
4
  "description": "TypeScript export extraction to OpenPkg spec",
5
5
  "keywords": [
6
6
  "openpkg",