@famgia/omnify-typescript 0.0.148 → 0.0.149

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/plugin.d.cts CHANGED
@@ -5,34 +5,8 @@ import { OmnifyPlugin } from '@famgia/omnify-types';
5
5
  *
6
6
  * Plugin for generating TypeScript type definitions and Zod schemas from Omnify schemas.
7
7
  *
8
- * ## Modern Mode (Recommended)
8
+ * ## Usage
9
9
  *
10
- * Use with `@famgia/omnify-react` runtime package:
11
- * - Output to `node_modules/.omnify/` (like Prisma's .prisma/)
12
- * - Schemas are re-exported from `@famgia/omnify-react`
13
- * - No stubs generated (use package's components/hooks)
14
- *
15
- * ```typescript
16
- * typescript({
17
- * modelsPath: 'node_modules/.omnify/schemas',
18
- * stubsPath: false, // Use @famgia/omnify-react instead
19
- * })
20
- * ```
21
- *
22
- * ## Legacy Mode
23
- *
24
- * For projects not using `@famgia/omnify-react`:
25
- * - Output to custom path (e.g., 'resources/ts/omnify/schemas')
26
- * - Stubs generated alongside schemas
27
- *
28
- * ```typescript
29
- * typescript({
30
- * modelsPath: 'resources/ts/omnify/schemas',
31
- * stubsPath: 'resources/ts/omnify', // Generate stubs
32
- * })
33
- * ```
34
- *
35
- * @example
36
10
  * ```typescript
37
11
  * import { defineConfig } from '@famgia/omnify';
38
12
  * import typescript from '@famgia/omnify-typescript/plugin';
@@ -40,27 +14,32 @@ import { OmnifyPlugin } from '@famgia/omnify-types';
40
14
  * export default defineConfig({
41
15
  * plugins: [
42
16
  * typescript({
43
- * modelsPath: 'node_modules/.omnify/schemas', // Modern (Prisma-like)
17
+ * modelsPath: 'resources/ts/omnify',
44
18
  * generateZodSchemas: true,
45
19
  * }),
46
20
  * ],
47
21
  * });
48
22
  * ```
23
+ *
24
+ * ## With @famgia/omnify-react
25
+ *
26
+ * Use with `@famgia/omnify-react` runtime package for React utilities:
27
+ *
28
+ * ```typescript
29
+ * import {
30
+ * JapaneseNameField,
31
+ * JapaneseAddressField,
32
+ * useFormMutation,
33
+ * zodRule,
34
+ * } from '@famgia/omnify-react';
35
+ * ```
49
36
  */
50
37
 
51
38
  /**
52
- * Default paths for modern mode (node_modules/.omnify/)
53
- */
54
- declare const MODERN_DEFAULTS: {
55
- modelsPath: string;
56
- stubsPath: false;
57
- };
58
- /**
59
- * Default paths for legacy mode (types/schemas)
39
+ * Default paths
60
40
  */
61
- declare const LEGACY_DEFAULTS: {
41
+ declare const DEFAULTS: {
62
42
  modelsPath: string;
63
- stubsPath: string;
64
43
  };
65
44
  /**
66
45
  * Options for the TypeScript plugin.
@@ -69,10 +48,7 @@ interface TypeScriptPluginOptions {
69
48
  /**
70
49
  * Path for TypeScript model files.
71
50
  *
72
- * Modern mode: 'node_modules/.omnify/schemas' (use with @famgia/omnify-react)
73
- * Legacy mode: 'types/schemas' or custom path
74
- *
75
- * @default 'types/schemas'
51
+ * @default 'resources/ts/omnify'
76
52
  */
77
53
  modelsPath?: string;
78
54
  /**
@@ -80,15 +56,6 @@ interface TypeScriptPluginOptions {
80
56
  * @default true
81
57
  */
82
58
  generateZodSchemas?: boolean;
83
- /**
84
- * Path for React utility stubs (hooks, components, lib).
85
- * Set to false to disable stub generation.
86
- *
87
- * When using @famgia/omnify-react, set to false.
88
- *
89
- * @default 'omnify'
90
- */
91
- stubsPath?: string | false;
92
59
  }
93
60
  /**
94
61
  * Creates the TypeScript plugin with the specified options.
@@ -98,9 +65,14 @@ interface TypeScriptPluginOptions {
98
65
  */
99
66
  declare function typescriptPlugin(options?: TypeScriptPluginOptions): OmnifyPlugin;
100
67
 
68
+ declare const MODERN_DEFAULTS: {
69
+ modelsPath: string;
70
+ };
71
+ declare const LEGACY_DEFAULTS: {
72
+ modelsPath: string;
73
+ };
101
74
  /**
102
- * Create TypeScript plugin with modern mode defaults.
103
- * Use this when using @famgia/omnify-react package.
75
+ * Create TypeScript plugin with default settings.
104
76
  *
105
77
  * @example
106
78
  * ```typescript
@@ -111,6 +83,6 @@ declare function typescriptPlugin(options?: TypeScriptPluginOptions): OmnifyPlug
111
83
  * });
112
84
  * ```
113
85
  */
114
- declare function typescriptModern(options?: Omit<TypeScriptPluginOptions, 'modelsPath' | 'stubsPath'>): OmnifyPlugin;
86
+ declare function typescriptModern(options?: TypeScriptPluginOptions): OmnifyPlugin;
115
87
 
116
- export { LEGACY_DEFAULTS, MODERN_DEFAULTS, type TypeScriptPluginOptions, typescriptPlugin as default, typescriptModern, typescriptPlugin };
88
+ export { DEFAULTS, LEGACY_DEFAULTS, MODERN_DEFAULTS, type TypeScriptPluginOptions, typescriptPlugin as default, typescriptModern, typescriptPlugin };
package/dist/plugin.d.ts CHANGED
@@ -5,34 +5,8 @@ import { OmnifyPlugin } from '@famgia/omnify-types';
5
5
  *
6
6
  * Plugin for generating TypeScript type definitions and Zod schemas from Omnify schemas.
7
7
  *
8
- * ## Modern Mode (Recommended)
8
+ * ## Usage
9
9
  *
10
- * Use with `@famgia/omnify-react` runtime package:
11
- * - Output to `node_modules/.omnify/` (like Prisma's .prisma/)
12
- * - Schemas are re-exported from `@famgia/omnify-react`
13
- * - No stubs generated (use package's components/hooks)
14
- *
15
- * ```typescript
16
- * typescript({
17
- * modelsPath: 'node_modules/.omnify/schemas',
18
- * stubsPath: false, // Use @famgia/omnify-react instead
19
- * })
20
- * ```
21
- *
22
- * ## Legacy Mode
23
- *
24
- * For projects not using `@famgia/omnify-react`:
25
- * - Output to custom path (e.g., 'resources/ts/omnify/schemas')
26
- * - Stubs generated alongside schemas
27
- *
28
- * ```typescript
29
- * typescript({
30
- * modelsPath: 'resources/ts/omnify/schemas',
31
- * stubsPath: 'resources/ts/omnify', // Generate stubs
32
- * })
33
- * ```
34
- *
35
- * @example
36
10
  * ```typescript
37
11
  * import { defineConfig } from '@famgia/omnify';
38
12
  * import typescript from '@famgia/omnify-typescript/plugin';
@@ -40,27 +14,32 @@ import { OmnifyPlugin } from '@famgia/omnify-types';
40
14
  * export default defineConfig({
41
15
  * plugins: [
42
16
  * typescript({
43
- * modelsPath: 'node_modules/.omnify/schemas', // Modern (Prisma-like)
17
+ * modelsPath: 'resources/ts/omnify',
44
18
  * generateZodSchemas: true,
45
19
  * }),
46
20
  * ],
47
21
  * });
48
22
  * ```
23
+ *
24
+ * ## With @famgia/omnify-react
25
+ *
26
+ * Use with `@famgia/omnify-react` runtime package for React utilities:
27
+ *
28
+ * ```typescript
29
+ * import {
30
+ * JapaneseNameField,
31
+ * JapaneseAddressField,
32
+ * useFormMutation,
33
+ * zodRule,
34
+ * } from '@famgia/omnify-react';
35
+ * ```
49
36
  */
50
37
 
51
38
  /**
52
- * Default paths for modern mode (node_modules/.omnify/)
53
- */
54
- declare const MODERN_DEFAULTS: {
55
- modelsPath: string;
56
- stubsPath: false;
57
- };
58
- /**
59
- * Default paths for legacy mode (types/schemas)
39
+ * Default paths
60
40
  */
61
- declare const LEGACY_DEFAULTS: {
41
+ declare const DEFAULTS: {
62
42
  modelsPath: string;
63
- stubsPath: string;
64
43
  };
65
44
  /**
66
45
  * Options for the TypeScript plugin.
@@ -69,10 +48,7 @@ interface TypeScriptPluginOptions {
69
48
  /**
70
49
  * Path for TypeScript model files.
71
50
  *
72
- * Modern mode: 'node_modules/.omnify/schemas' (use with @famgia/omnify-react)
73
- * Legacy mode: 'types/schemas' or custom path
74
- *
75
- * @default 'types/schemas'
51
+ * @default 'resources/ts/omnify'
76
52
  */
77
53
  modelsPath?: string;
78
54
  /**
@@ -80,15 +56,6 @@ interface TypeScriptPluginOptions {
80
56
  * @default true
81
57
  */
82
58
  generateZodSchemas?: boolean;
83
- /**
84
- * Path for React utility stubs (hooks, components, lib).
85
- * Set to false to disable stub generation.
86
- *
87
- * When using @famgia/omnify-react, set to false.
88
- *
89
- * @default 'omnify'
90
- */
91
- stubsPath?: string | false;
92
59
  }
93
60
  /**
94
61
  * Creates the TypeScript plugin with the specified options.
@@ -98,9 +65,14 @@ interface TypeScriptPluginOptions {
98
65
  */
99
66
  declare function typescriptPlugin(options?: TypeScriptPluginOptions): OmnifyPlugin;
100
67
 
68
+ declare const MODERN_DEFAULTS: {
69
+ modelsPath: string;
70
+ };
71
+ declare const LEGACY_DEFAULTS: {
72
+ modelsPath: string;
73
+ };
101
74
  /**
102
- * Create TypeScript plugin with modern mode defaults.
103
- * Use this when using @famgia/omnify-react package.
75
+ * Create TypeScript plugin with default settings.
104
76
  *
105
77
  * @example
106
78
  * ```typescript
@@ -111,6 +83,6 @@ declare function typescriptPlugin(options?: TypeScriptPluginOptions): OmnifyPlug
111
83
  * });
112
84
  * ```
113
85
  */
114
- declare function typescriptModern(options?: Omit<TypeScriptPluginOptions, 'modelsPath' | 'stubsPath'>): OmnifyPlugin;
86
+ declare function typescriptModern(options?: TypeScriptPluginOptions): OmnifyPlugin;
115
87
 
116
- export { LEGACY_DEFAULTS, MODERN_DEFAULTS, type TypeScriptPluginOptions, typescriptPlugin as default, typescriptModern, typescriptPlugin };
88
+ export { DEFAULTS, LEGACY_DEFAULTS, MODERN_DEFAULTS, type TypeScriptPluginOptions, typescriptPlugin as default, typescriptModern, typescriptPlugin };
package/dist/plugin.js CHANGED
@@ -1,20 +1,10 @@
1
1
  import {
2
2
  generateTypeScript
3
- } from "./chunk-PA7B7ZFK.js";
3
+ } from "./chunk-VLDDJNHY.js";
4
4
 
5
5
  // src/plugin.ts
6
- import fs from "fs";
7
- import path from "path";
8
- import { fileURLToPath } from "url";
9
- var __filename = fileURLToPath(import.meta.url);
10
- var __dirname = path.dirname(__filename);
11
- var MODERN_DEFAULTS = {
12
- modelsPath: "node_modules/.omnify/schemas",
13
- stubsPath: false
14
- };
15
- var LEGACY_DEFAULTS = {
16
- modelsPath: "types/schemas",
17
- stubsPath: "omnify"
6
+ var DEFAULTS = {
7
+ modelsPath: "resources/ts/omnify"
18
8
  };
19
9
  var TYPESCRIPT_CONFIG_SCHEMA = {
20
10
  fields: [
@@ -22,8 +12,8 @@ var TYPESCRIPT_CONFIG_SCHEMA = {
22
12
  key: "modelsPath",
23
13
  type: "path",
24
14
  label: "Schemas Output Path",
25
- description: 'Directory for generated TypeScript types and Zod schemas. Use "node_modules/.omnify/schemas" for modern mode with @famgia/omnify-react.',
26
- default: LEGACY_DEFAULTS.modelsPath,
15
+ description: "Directory for generated TypeScript types and Zod schemas.",
16
+ default: DEFAULTS.modelsPath,
27
17
  group: "output"
28
18
  },
29
19
  {
@@ -33,69 +23,15 @@ var TYPESCRIPT_CONFIG_SCHEMA = {
33
23
  description: "Generate Zod schemas alongside TypeScript types for form validation",
34
24
  default: true,
35
25
  group: "output"
36
- },
37
- {
38
- key: "stubsPath",
39
- type: "path",
40
- label: "React Stubs Path",
41
- description: "Directory for React utility stubs (hooks, components). Leave empty to disable. Recommended: use @famgia/omnify-react instead.",
42
- default: LEGACY_DEFAULTS.stubsPath,
43
- group: "output"
44
26
  }
45
27
  ]
46
28
  };
47
- function isNodeModulesPath(p) {
48
- return p.includes("node_modules");
49
- }
50
29
  function resolveOptions(options) {
51
- const modelsPath = options?.modelsPath ?? LEGACY_DEFAULTS.modelsPath;
52
- const isModernMode = isNodeModulesPath(modelsPath);
53
- const defaultStubsPath = isModernMode ? false : LEGACY_DEFAULTS.stubsPath;
54
30
  return {
55
- modelsPath,
56
- generateZodSchemas: options?.generateZodSchemas ?? true,
57
- stubsPath: options?.stubsPath ?? defaultStubsPath,
58
- isModernMode
31
+ modelsPath: options?.modelsPath ?? DEFAULTS.modelsPath,
32
+ generateZodSchemas: options?.generateZodSchemas ?? true
59
33
  };
60
34
  }
61
- var STUB_FILES = [
62
- // Components
63
- {
64
- stub: "JapaneseNameField.tsx.stub",
65
- output: "components/JapaneseNameField.tsx"
66
- },
67
- {
68
- stub: "JapaneseAddressField.tsx.stub",
69
- output: "components/JapaneseAddressField.tsx"
70
- },
71
- {
72
- stub: "JapaneseBankField.tsx.stub",
73
- output: "components/JapaneseBankField.tsx"
74
- },
75
- // Hooks
76
- {
77
- stub: "use-form-mutation.ts.stub",
78
- output: "hooks/use-form-mutation.ts"
79
- },
80
- // Lib - validation utilities
81
- {
82
- stub: "zod-i18n.ts.stub",
83
- output: "lib/zod-i18n.ts"
84
- },
85
- {
86
- stub: "form-validation.ts.stub",
87
- output: "lib/form-validation.ts"
88
- },
89
- // Rules - Japanese validation rules
90
- {
91
- stub: "rules/kana.ts.stub",
92
- output: "lib/rules/kana.ts"
93
- },
94
- {
95
- stub: "rules/index.ts.stub",
96
- output: "lib/rules/index.ts"
97
- }
98
- ];
99
35
  function typescriptPlugin(options) {
100
36
  const resolved = resolveOptions(options);
101
37
  return {
@@ -107,29 +43,39 @@ function typescriptPlugin(options) {
107
43
  name: "typescript-models",
108
44
  description: "Generate TypeScript model definitions",
109
45
  generate: async (ctx) => {
110
- const modelsDir = path.dirname(resolved.modelsPath);
111
- const frontendRoot = modelsDir.replace(/\/src\/.*$/, "");
112
- const pluginEnumBase = `${frontendRoot}/node_modules/@omnify-client`;
113
- const pluginEnumPath = `${pluginEnumBase}/enum`;
114
- const hasPluginEnums = ctx.pluginEnums && ctx.pluginEnums.size > 0;
46
+ const omnifyBaseDir = "node_modules/@omnify-base";
115
47
  const files = generateTypeScript(ctx.schemas, {
116
48
  generateZodSchemas: resolved.generateZodSchemas,
117
49
  localeConfig: ctx.localeConfig,
118
50
  customTypes: ctx.customTypes,
119
51
  pluginEnums: ctx.pluginEnums,
120
- pluginEnumImportPrefix: "@omnify-client/enum"
52
+ // All generated files (enums, base) go to @omnify-base - they shouldn't be edited
53
+ enumImportPrefix: "@omnify-base/enum",
54
+ pluginEnumImportPrefix: "@omnify-base/enum",
55
+ baseImportPrefix: "@omnify-base/schemas"
121
56
  });
122
57
  const outputs = [];
123
- if (hasPluginEnums) {
58
+ const hasOmnifyClientFiles = files.some(
59
+ (f) => f.category === "enum" || f.category === "plugin-enum" || f.category === "base"
60
+ );
61
+ if (hasOmnifyClientFiles) {
124
62
  outputs.push({
125
- path: `${pluginEnumBase}/package.json`,
63
+ path: `${omnifyBaseDir}/package.json`,
126
64
  content: JSON.stringify({
127
- name: "@omnify-client",
65
+ name: "@omnify-base",
128
66
  version: "0.0.0",
129
67
  private: true,
130
- main: "./enum/index.js",
68
+ type: "module",
131
69
  exports: {
132
- "./enum/*": "./enum/*.js"
70
+ // Wildcard exports for TypeScript bundlers (Vite, esbuild, etc.)
71
+ "./enum/*": {
72
+ types: "./enum/*.ts",
73
+ default: "./enum/*.ts"
74
+ },
75
+ "./schemas/*": {
76
+ types: "./schemas/*.ts",
77
+ default: "./schemas/*.ts"
78
+ }
133
79
  }
134
80
  }, null, 2),
135
81
  type: "other",
@@ -138,11 +84,13 @@ function typescriptPlugin(options) {
138
84
  }
139
85
  for (const file of files) {
140
86
  let outputPath;
141
- if (file.category === "plugin-enum") {
142
- outputPath = `${pluginEnumPath}/${file.filePath}`;
143
- } else if (file.category === "enum") {
144
- const enumPath = resolved.modelsPath.replace(/\/schemas\/?$/, "/enum");
145
- outputPath = `${enumPath}/${file.filePath}`;
87
+ if (file.category === "plugin-enum" || file.category === "enum") {
88
+ outputPath = `${omnifyBaseDir}/enum/${file.filePath}`;
89
+ } else if (file.category === "base") {
90
+ const fileName = file.filePath.replace(/^base\//, "");
91
+ outputPath = `${omnifyBaseDir}/schemas/${fileName}`;
92
+ } else if (file.overwrite && (file.filePath === "common.ts" || file.filePath === "i18n.ts")) {
93
+ outputPath = `${omnifyBaseDir}/schemas/${file.filePath}`;
146
94
  } else {
147
95
  outputPath = `${resolved.modelsPath}/${file.filePath}`;
148
96
  }
@@ -159,73 +107,20 @@ function typescriptPlugin(options) {
159
107
  }
160
108
  return outputs;
161
109
  }
162
- },
163
- {
164
- name: "typescript-stubs",
165
- description: "Generate React utility stubs (hooks, components) - DEPRECATED: use @famgia/omnify-react",
166
- generate: async (ctx) => {
167
- if (resolved.stubsPath === false) {
168
- return [];
169
- }
170
- if (ctx.logger) {
171
- ctx.logger.warn(
172
- "Stub generation is deprecated. Consider using @famgia/omnify-react package instead.\n npm install @famgia/omnify-react\n Then set stubsPath: false in your config."
173
- );
174
- }
175
- const outputs = [];
176
- const stubsDir = path.join(__dirname, "..", "stubs");
177
- for (const { stub, output } of STUB_FILES) {
178
- const stubPath = path.join(stubsDir, stub);
179
- if (fs.existsSync(stubPath)) {
180
- const content = fs.readFileSync(stubPath, "utf-8");
181
- outputs.push({
182
- path: `${resolved.stubsPath}/${output}`,
183
- content,
184
- type: "other",
185
- skipIfExists: false
186
- // Always overwrite - library files should stay in sync
187
- });
188
- }
189
- }
190
- outputs.push({
191
- path: `${resolved.stubsPath}/components/index.ts`,
192
- content: `export { JapaneseNameField, type JapaneseNameFieldProps } from './JapaneseNameField';
193
- export { JapaneseAddressField, type JapaneseAddressFieldProps } from './JapaneseAddressField';
194
- export { JapaneseBankField, type JapaneseBankFieldProps } from './JapaneseBankField';
195
- `,
196
- type: "other",
197
- skipIfExists: false
198
- });
199
- outputs.push({
200
- path: `${resolved.stubsPath}/hooks/index.ts`,
201
- content: `export { useFormMutation } from './use-form-mutation';
202
- `,
203
- type: "other",
204
- skipIfExists: false
205
- });
206
- outputs.push({
207
- path: `${resolved.stubsPath}/lib/index.ts`,
208
- content: `export { setZodLocale, getZodLocale, getZodMessage } from './zod-i18n';
209
- export { zodRule, requiredRule } from './form-validation';
210
- export * from './rules';
211
- `,
212
- type: "other",
213
- skipIfExists: false
214
- });
215
- return outputs;
216
- }
217
110
  }
218
111
  ]
219
112
  };
220
113
  }
114
+ var MODERN_DEFAULTS = DEFAULTS;
115
+ var LEGACY_DEFAULTS = DEFAULTS;
221
116
  function typescriptModern(options) {
222
117
  return typescriptPlugin({
223
118
  ...options,
224
- modelsPath: MODERN_DEFAULTS.modelsPath,
225
- stubsPath: MODERN_DEFAULTS.stubsPath
119
+ modelsPath: options?.modelsPath ?? DEFAULTS.modelsPath
226
120
  });
227
121
  }
228
122
  export {
123
+ DEFAULTS,
229
124
  LEGACY_DEFAULTS,
230
125
  MODERN_DEFAULTS,
231
126
  typescriptPlugin as default,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["/**\n * @famgia/omnify-typescript - Plugin\n *\n * Plugin for generating TypeScript type definitions and Zod schemas from Omnify schemas.\n *\n * ## Modern Mode (Recommended)\n *\n * Use with `@famgia/omnify-react` runtime package:\n * - Output to `node_modules/.omnify/` (like Prisma's .prisma/)\n * - Schemas are re-exported from `@famgia/omnify-react`\n * - No stubs generated (use package's components/hooks)\n *\n * ```typescript\n * typescript({\n * modelsPath: 'node_modules/.omnify/schemas',\n * stubsPath: false, // Use @famgia/omnify-react instead\n * })\n * ```\n *\n * ## Legacy Mode\n *\n * For projects not using `@famgia/omnify-react`:\n * - Output to custom path (e.g., 'resources/ts/omnify/schemas')\n * - Stubs generated alongside schemas\n *\n * ```typescript\n * typescript({\n * modelsPath: 'resources/ts/omnify/schemas',\n * stubsPath: 'resources/ts/omnify', // Generate stubs\n * })\n * ```\n *\n * @example\n * ```typescript\n * import { defineConfig } from '@famgia/omnify';\n * import typescript from '@famgia/omnify-typescript/plugin';\n *\n * export default defineConfig({\n * plugins: [\n * typescript({\n * modelsPath: 'node_modules/.omnify/schemas', // Modern (Prisma-like)\n * generateZodSchemas: true,\n * }),\n * ],\n * });\n * ```\n */\n\nimport type { OmnifyPlugin, GeneratorOutput, GeneratorContext, PluginConfigSchema } from '@famgia/omnify-types';\nimport { generateTypeScript } from './generator.js';\nimport fs from 'fs';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\n/**\n * Default paths for modern mode (node_modules/.omnify/)\n */\nconst MODERN_DEFAULTS = {\n modelsPath: 'node_modules/.omnify/schemas',\n stubsPath: false as const,\n};\n\n/**\n * Default paths for legacy mode (types/schemas)\n */\nconst LEGACY_DEFAULTS = {\n modelsPath: 'types/schemas',\n stubsPath: 'omnify',\n};\n\n/**\n * Configuration schema for TypeScript plugin UI settings\n */\nconst TYPESCRIPT_CONFIG_SCHEMA: PluginConfigSchema = {\n fields: [\n {\n key: 'modelsPath',\n type: 'path',\n label: 'Schemas Output Path',\n description: 'Directory for generated TypeScript types and Zod schemas. Use \"node_modules/.omnify/schemas\" for modern mode with @famgia/omnify-react.',\n default: LEGACY_DEFAULTS.modelsPath,\n group: 'output',\n },\n {\n key: 'generateZodSchemas',\n type: 'boolean',\n label: 'Generate Zod Schemas',\n description: 'Generate Zod schemas alongside TypeScript types for form validation',\n default: true,\n group: 'output',\n },\n {\n key: 'stubsPath',\n type: 'path',\n label: 'React Stubs Path',\n description: 'Directory for React utility stubs (hooks, components). Leave empty to disable. Recommended: use @famgia/omnify-react instead.',\n default: LEGACY_DEFAULTS.stubsPath,\n group: 'output',\n },\n ],\n};\n\n/**\n * Options for the TypeScript plugin.\n */\nexport interface TypeScriptPluginOptions {\n /**\n * Path for TypeScript model files.\n *\n * Modern mode: 'node_modules/.omnify/schemas' (use with @famgia/omnify-react)\n * Legacy mode: 'types/schemas' or custom path\n *\n * @default 'types/schemas'\n */\n modelsPath?: string;\n /**\n * Generate Zod schemas alongside TypeScript types.\n * @default true\n */\n generateZodSchemas?: boolean;\n /**\n * Path for React utility stubs (hooks, components, lib).\n * Set to false to disable stub generation.\n *\n * When using @famgia/omnify-react, set to false.\n *\n * @default 'omnify'\n */\n stubsPath?: string | false;\n}\n\n/**\n * Resolved options with defaults applied.\n */\ninterface ResolvedOptions {\n modelsPath: string;\n generateZodSchemas: boolean;\n stubsPath: string | false;\n isModernMode: boolean;\n}\n\n/**\n * Check if the path targets node_modules (modern mode)\n */\nfunction isNodeModulesPath(p: string): boolean {\n return p.includes('node_modules');\n}\n\n/**\n * Resolves options with defaults.\n */\nfunction resolveOptions(options?: TypeScriptPluginOptions): ResolvedOptions {\n const modelsPath = options?.modelsPath ?? LEGACY_DEFAULTS.modelsPath;\n const isModernMode = isNodeModulesPath(modelsPath);\n\n // In modern mode, disable stubs by default (use @famgia/omnify-react)\n const defaultStubsPath = isModernMode ? false : LEGACY_DEFAULTS.stubsPath;\n\n return {\n modelsPath,\n generateZodSchemas: options?.generateZodSchemas ?? true,\n stubsPath: options?.stubsPath ?? defaultStubsPath,\n isModernMode,\n };\n}\n\n/**\n * Stub file definitions for React utilities.\n */\nconst STUB_FILES = [\n // Components\n {\n stub: 'JapaneseNameField.tsx.stub',\n output: 'components/JapaneseNameField.tsx',\n },\n {\n stub: 'JapaneseAddressField.tsx.stub',\n output: 'components/JapaneseAddressField.tsx',\n },\n {\n stub: 'JapaneseBankField.tsx.stub',\n output: 'components/JapaneseBankField.tsx',\n },\n // Hooks\n {\n stub: 'use-form-mutation.ts.stub',\n output: 'hooks/use-form-mutation.ts',\n },\n // Lib - validation utilities\n {\n stub: 'zod-i18n.ts.stub',\n output: 'lib/zod-i18n.ts',\n },\n {\n stub: 'form-validation.ts.stub',\n output: 'lib/form-validation.ts',\n },\n // Rules - Japanese validation rules\n {\n stub: 'rules/kana.ts.stub',\n output: 'lib/rules/kana.ts',\n },\n {\n stub: 'rules/index.ts.stub',\n output: 'lib/rules/index.ts',\n },\n];\n\n/**\n * Creates the TypeScript plugin with the specified options.\n *\n * @param options - Plugin configuration options\n * @returns OmnifyPlugin configured for TypeScript generation\n */\nexport default function typescriptPlugin(options?: TypeScriptPluginOptions): OmnifyPlugin {\n const resolved = resolveOptions(options);\n\n return {\n name: '@famgia/omnify-typescript',\n version: '0.0.1',\n configSchema: TYPESCRIPT_CONFIG_SCHEMA,\n\n generators: [\n {\n name: 'typescript-models',\n description: 'Generate TypeScript model definitions',\n\n generate: async (ctx: GeneratorContext): Promise<GeneratorOutput[]> => {\n // Determine plugin enum path - relative to the schemas folder's node_modules\n // e.g., if modelsPath is \"./frontend/src/omnify/schemas\", \n // plugin enums go to \"./frontend/node_modules/@omnify-client/enum\"\n const modelsDir = path.dirname(resolved.modelsPath);\n const frontendRoot = modelsDir.replace(/\\/src\\/.*$/, '');\n const pluginEnumBase = `${frontendRoot}/node_modules/@omnify-client`;\n const pluginEnumPath = `${pluginEnumBase}/enum`;\n const hasPluginEnums = ctx.pluginEnums && ctx.pluginEnums.size > 0;\n\n const files = generateTypeScript(ctx.schemas, {\n generateZodSchemas: resolved.generateZodSchemas,\n localeConfig: ctx.localeConfig,\n customTypes: ctx.customTypes,\n pluginEnums: ctx.pluginEnums,\n pluginEnumImportPrefix: '@omnify-client/enum',\n });\n\n const outputs: GeneratorOutput[] = [];\n\n // Add package.json for @omnify-client if plugin enums exist\n if (hasPluginEnums) {\n outputs.push({\n path: `${pluginEnumBase}/package.json`,\n content: JSON.stringify({\n name: '@omnify-client',\n version: '0.0.0',\n private: true,\n main: './enum/index.js',\n exports: {\n './enum/*': './enum/*.js',\n },\n }, null, 2),\n type: 'other' as const,\n skipIfExists: false,\n });\n }\n\n for (const file of files) {\n // Determine output path based on category\n let outputPath: string;\n if (file.category === 'plugin-enum') {\n // Plugin enums go to frontend/node_modules/@omnify-client/enum/\n outputPath = `${pluginEnumPath}/${file.filePath}`;\n } else if (file.category === 'enum') {\n // Schema enums go to ../enum/ folder (sibling to schemas)\n const enumPath = resolved.modelsPath.replace(/\\/schemas\\/?$/, '/enum');\n outputPath = `${enumPath}/${file.filePath}`;\n } else {\n outputPath = `${resolved.modelsPath}/${file.filePath}`;\n }\n\n outputs.push({\n path: outputPath,\n content: file.content,\n type: 'type' as const,\n skipIfExists: !file.overwrite, // Invert: overwrite=true means skipIfExists=false\n metadata: {\n types: file.types,\n },\n });\n }\n\n return outputs;\n },\n },\n {\n name: 'typescript-stubs',\n description: 'Generate React utility stubs (hooks, components) - DEPRECATED: use @famgia/omnify-react',\n\n generate: async (ctx: GeneratorContext): Promise<GeneratorOutput[]> => {\n // Skip if stubs disabled\n if (resolved.stubsPath === false) {\n return [];\n }\n\n // Show deprecation warning when generating stubs\n if (ctx.logger) {\n ctx.logger.warn(\n 'Stub generation is deprecated. Consider using @famgia/omnify-react package instead.\\n' +\n ' npm install @famgia/omnify-react\\n' +\n ' Then set stubsPath: false in your config.'\n );\n }\n\n const outputs: GeneratorOutput[] = [];\n const stubsDir = path.join(__dirname, '..', 'stubs');\n\n for (const { stub, output } of STUB_FILES) {\n const stubPath = path.join(stubsDir, stub);\n if (fs.existsSync(stubPath)) {\n const content = fs.readFileSync(stubPath, 'utf-8');\n outputs.push({\n path: `${resolved.stubsPath}/${output}`,\n content,\n type: 'other' as const,\n skipIfExists: false, // Always overwrite - library files should stay in sync\n });\n }\n }\n\n // Generate index files\n outputs.push({\n path: `${resolved.stubsPath}/components/index.ts`,\n content: `export { JapaneseNameField, type JapaneseNameFieldProps } from './JapaneseNameField';\nexport { JapaneseAddressField, type JapaneseAddressFieldProps } from './JapaneseAddressField';\nexport { JapaneseBankField, type JapaneseBankFieldProps } from './JapaneseBankField';\n`,\n type: 'other' as const,\n skipIfExists: false,\n });\n\n outputs.push({\n path: `${resolved.stubsPath}/hooks/index.ts`,\n content: `export { useFormMutation } from './use-form-mutation';\n`,\n type: 'other' as const,\n skipIfExists: false,\n });\n\n outputs.push({\n path: `${resolved.stubsPath}/lib/index.ts`,\n content: `export { setZodLocale, getZodLocale, getZodMessage } from './zod-i18n';\nexport { zodRule, requiredRule } from './form-validation';\nexport * from './rules';\n`,\n type: 'other' as const,\n skipIfExists: false,\n });\n\n return outputs;\n },\n },\n ],\n };\n}\n\n// Named export for flexibility\nexport { typescriptPlugin };\n\n// Export defaults for user convenience\nexport { MODERN_DEFAULTS, LEGACY_DEFAULTS };\n\n/**\n * Create TypeScript plugin with modern mode defaults.\n * Use this when using @famgia/omnify-react package.\n *\n * @example\n * ```typescript\n * import { typescriptModern } from '@famgia/omnify-typescript/plugin';\n *\n * export default defineConfig({\n * plugins: [typescriptModern()],\n * });\n * ```\n */\nexport function typescriptModern(options?: Omit<TypeScriptPluginOptions, 'modelsPath' | 'stubsPath'>): OmnifyPlugin {\n return typescriptPlugin({\n ...options,\n modelsPath: MODERN_DEFAULTS.modelsPath,\n stubsPath: MODERN_DEFAULTS.stubsPath,\n });\n}\n"],"mappings":";;;;;AAkDA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SA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AAA;AAAA;AAAA,YAIT,MAAM;AAAA,YACN,cAAc;AAAA,UAChB,CAAC;AAED,kBAAQ,KAAK;AAAA,YACX,MAAM,GAAG,SAAS,SAAS;AAAA,YAC3B,SAAS;AAAA;AAAA,YAET,MAAM;AAAA,YACN,cAAc;AAAA,UAChB,CAAC;AAED,kBAAQ,KAAK;AAAA,YACX,MAAM,GAAG,SAAS,SAAS;AAAA,YAC3B,SAAS;AAAA;AAAA;AAAA;AAAA,YAIT,MAAM;AAAA,YACN,cAAc;AAAA,UAChB,CAAC;AAED,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAqBO,SAAS,iBAAiB,SAAmF;AAClH,SAAO,iBAAiB;AAAA,IACtB,GAAG;AAAA,IACH,YAAY,gBAAgB;AAAA,IAC5B,WAAW,gBAAgB;AAAA,EAC7B,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["/**\n * @famgia/omnify-typescript - Plugin\n *\n * Plugin for generating TypeScript type definitions and Zod schemas from Omnify schemas.\n *\n * ## Usage\n *\n * ```typescript\n * import { defineConfig } from '@famgia/omnify';\n * import typescript from '@famgia/omnify-typescript/plugin';\n *\n * export default defineConfig({\n * plugins: [\n * typescript({\n * modelsPath: 'resources/ts/omnify',\n * generateZodSchemas: true,\n * }),\n * ],\n * });\n * ```\n *\n * ## With @famgia/omnify-react\n *\n * Use with `@famgia/omnify-react` runtime package for React utilities:\n *\n * ```typescript\n * import {\n * JapaneseNameField,\n * JapaneseAddressField,\n * useFormMutation,\n * zodRule,\n * } from '@famgia/omnify-react';\n * ```\n */\n\nimport type { OmnifyPlugin, GeneratorOutput, GeneratorContext, PluginConfigSchema } from '@famgia/omnify-types';\nimport { generateTypeScript } from './generator.js';\nimport path from 'path';\n\n/**\n * Default paths\n */\nconst DEFAULTS = {\n modelsPath: 'resources/ts/omnify',\n};\n\n/**\n * Configuration schema for TypeScript plugin UI settings\n */\nconst TYPESCRIPT_CONFIG_SCHEMA: PluginConfigSchema = {\n fields: [\n {\n key: 'modelsPath',\n type: 'path',\n label: 'Schemas Output Path',\n description: 'Directory for generated TypeScript types and Zod schemas.',\n default: DEFAULTS.modelsPath,\n group: 'output',\n },\n {\n key: 'generateZodSchemas',\n type: 'boolean',\n label: 'Generate Zod Schemas',\n description: 'Generate Zod schemas alongside TypeScript types for form validation',\n default: true,\n group: 'output',\n },\n ],\n};\n\n/**\n * Options for the TypeScript plugin.\n */\nexport interface TypeScriptPluginOptions {\n /**\n * Path for TypeScript model files.\n *\n * @default 'resources/ts/omnify'\n */\n modelsPath?: string;\n /**\n * Generate Zod schemas alongside TypeScript types.\n * @default true\n */\n generateZodSchemas?: boolean;\n}\n\n/**\n * Resolved options with defaults applied.\n */\ninterface ResolvedOptions {\n modelsPath: string;\n generateZodSchemas: boolean;\n}\n\n/**\n * Resolves options with defaults.\n */\nfunction resolveOptions(options?: TypeScriptPluginOptions): ResolvedOptions {\n return {\n modelsPath: options?.modelsPath ?? DEFAULTS.modelsPath,\n generateZodSchemas: options?.generateZodSchemas ?? true,\n };\n}\n\n/**\n * Creates the TypeScript plugin with the specified options.\n *\n * @param options - Plugin configuration options\n * @returns OmnifyPlugin configured for TypeScript generation\n */\nexport default function typescriptPlugin(options?: TypeScriptPluginOptions): OmnifyPlugin {\n const resolved = resolveOptions(options);\n\n return {\n name: '@famgia/omnify-typescript',\n version: '0.0.1',\n configSchema: TYPESCRIPT_CONFIG_SCHEMA,\n\n generators: [\n {\n name: 'typescript-models',\n description: 'Generate TypeScript model definitions',\n\n generate: async (ctx: GeneratorContext): Promise<GeneratorOutput[]> => {\n // @omnify-base goes to node_modules/@omnify-base in the project root\n // (where omnify.config.ts is located, same level as package.json)\n const omnifyBaseDir = 'node_modules/@omnify-base';\n\n const files = generateTypeScript(ctx.schemas, {\n generateZodSchemas: resolved.generateZodSchemas,\n localeConfig: ctx.localeConfig,\n customTypes: ctx.customTypes,\n pluginEnums: ctx.pluginEnums,\n // All generated files (enums, base) go to @omnify-base - they shouldn't be edited\n enumImportPrefix: '@omnify-base/enum',\n pluginEnumImportPrefix: '@omnify-base/enum',\n baseImportPrefix: '@omnify-base/schemas',\n });\n\n const outputs: GeneratorOutput[] = [];\n\n // Check if we have any files that need @omnify-base package\n const hasOmnifyClientFiles = files.some(f =>\n f.category === 'enum' || f.category === 'plugin-enum' || f.category === 'base'\n );\n\n // Add package.json for @omnify-base\n if (hasOmnifyClientFiles) {\n outputs.push({\n path: `${omnifyBaseDir}/package.json`,\n content: JSON.stringify({\n name: '@omnify-base',\n version: '0.0.0',\n private: true,\n type: 'module',\n exports: {\n // Wildcard exports for TypeScript bundlers (Vite, esbuild, etc.)\n './enum/*': {\n types: './enum/*.ts',\n default: './enum/*.ts',\n },\n './schemas/*': {\n types: './schemas/*.ts',\n default: './schemas/*.ts',\n },\n },\n }, null, 2),\n type: 'other' as const,\n skipIfExists: false,\n });\n }\n\n for (const file of files) {\n // Route files based on category:\n // - overwrite: true files go to @omnify-base (shouldn't be edited)\n // - overwrite: false files stay in modelsPath (user can edit)\n let outputPath: string;\n\n if (file.category === 'plugin-enum' || file.category === 'enum') {\n // Enums → @omnify-base/enum/\n outputPath = `${omnifyBaseDir}/enum/${file.filePath}`;\n } else if (file.category === 'base') {\n // Base files → @omnify-base/schemas/\n // Remove 'base/' prefix from filePath (e.g., 'base/User.ts' → 'User.ts')\n const fileName = file.filePath.replace(/^base\\//, '');\n outputPath = `${omnifyBaseDir}/schemas/${fileName}`;\n } else if (file.overwrite && (file.filePath === 'common.ts' || file.filePath === 'i18n.ts')) {\n // Shared types and i18n → @omnify-base/schemas/\n // These are imported via @omnify-base/schemas/common and @omnify-base/schemas/i18n\n outputPath = `${omnifyBaseDir}/schemas/${file.filePath}`;\n } else {\n // User-editable files (models, index) → modelsPath\n outputPath = `${resolved.modelsPath}/${file.filePath}`;\n }\n\n outputs.push({\n path: outputPath,\n content: file.content,\n type: 'type' as const,\n skipIfExists: !file.overwrite, // Invert: overwrite=true means skipIfExists=false\n metadata: {\n types: file.types,\n },\n });\n }\n\n return outputs;\n },\n },\n ],\n };\n}\n\n// Named export for flexibility\nexport { typescriptPlugin };\n\n// Export defaults for user convenience\nexport { DEFAULTS };\n\n// Legacy exports for backwards compatibility\nexport const MODERN_DEFAULTS = DEFAULTS;\nexport const LEGACY_DEFAULTS = DEFAULTS;\n\n/**\n * Create TypeScript plugin with default settings.\n *\n * @example\n * ```typescript\n * import { typescriptModern } from '@famgia/omnify-typescript/plugin';\n *\n * export default defineConfig({\n * plugins: [typescriptModern()],\n * });\n * ```\n */\nexport function typescriptModern(options?: TypeScriptPluginOptions): OmnifyPlugin {\n return typescriptPlugin({\n ...options,\n modelsPath: options?.modelsPath ?? DEFAULTS.modelsPath,\n });\n}\n"],"mappings":";;;;;AA0CA,IAAM,WAAW;AAAA,EACf,YAAY;AACd;AAKA,IAAM,2BAA+C;AAAA,EACnD,QAAQ;AAAA,IACN;AAAA,MACE,KAAK;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,MACb,SAAS,SAAS;AAAA,MAClB,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,KAAK;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,MACb,SAAS;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AACF;AA8BA,SAAS,eAAe,SAAoD;AAC1E,SAAO;AAAA,IACL,YAAY,SAAS,cAAc,SAAS;AAAA,IAC5C,oBAAoB,SAAS,sBAAsB;AAAA,EACrD;AACF;AAQe,SAAR,iBAAkC,SAAiD;AACxF,QAAM,WAAW,eAAe,OAAO;AAEvC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,cAAc;AAAA,IAEd,YAAY;AAAA,MACV;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QAEb,UAAU,OAAO,QAAsD;AAGrE,gBAAM,gBAAgB;AAEtB,gBAAM,QAA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AAA,YACtD;AAEA,oBAAQ,KAAK;AAAA,cACX,MAAM;AAAA,cACN,SAAS,KAAK;AAAA,cACd,MAAM;AAAA,cACN,cAAc,CAAC,KAAK;AAAA;AAAA,cACpB,UAAU;AAAA,gBACR,OAAO,KAAK;AAAA,cACd;AAAA,YACF,CAAC;AAAA,UACH;AAEA,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AASO,IAAM,kBAAkB;AACxB,IAAM,kBAAkB;AAcxB,SAAS,iBAAiB,SAAiD;AAChF,SAAO,iBAAiB;AAAA,IACtB,GAAG;AAAA,IACH,YAAY,SAAS,cAAc,SAAS;AAAA,EAC9C,CAAC;AACH;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@famgia/omnify-typescript",
3
- "version": "0.0.148",
3
+ "version": "0.0.149",
4
4
  "description": "TypeScript type definitions generator for Omnify schemas",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -55,8 +55,8 @@
55
55
  "directory": "packages/typescript-generator"
56
56
  },
57
57
  "dependencies": {
58
- "@famgia/omnify-types": "0.0.155",
59
- "@famgia/omnify-core": "0.0.157"
58
+ "@famgia/omnify-core": "0.0.158",
59
+ "@famgia/omnify-types": "0.0.156"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "zod": "^3.25.0 || ^4.0.0"