@famgia/omnify-typescript 0.0.83 → 0.0.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  toEnumName,
25
25
  toInterfaceName,
26
26
  toPropertyName
27
- } from "./chunk-LHNMWILH.js";
27
+ } from "./chunk-BC2GNXUY.js";
28
28
 
29
29
  // src/stubs.ts
30
30
  import fs from "fs";
package/dist/plugin.cjs CHANGED
@@ -885,14 +885,18 @@ function generateModelRules(schema, locales, fallbackLocale, templates) {
885
885
  properties
886
886
  };
887
887
  }
888
- function formatRulesFile(schemaName, rules) {
888
+ function getImportExt(options) {
889
+ return options.useJsExtension ? ".js" : "";
890
+ }
891
+ function formatRulesFile(schemaName, rules, options) {
889
892
  const parts = [];
893
+ const ext = getImportExt(options);
890
894
  parts.push(`/**
891
895
  * Auto-generated validation rules and metadata for ${schemaName}.
892
896
  * DO NOT EDIT - This file is automatically generated and will be overwritten.
893
897
  */
894
898
 
895
- import type { LocaleMap, ValidationRule } from '../common.js';
899
+ import type { LocaleMap, ValidationRule } from '../common${ext}';
896
900
 
897
901
  `);
898
902
  parts.push(`/** Display name for ${schemaName} */
@@ -982,7 +986,7 @@ function generateRulesFiles(schemas, options = {}) {
982
986
  if (schema.kind === "enum") continue;
983
987
  if (schema.options?.hidden === true) continue;
984
988
  const rules = generateModelRules(schema, locales, fallbackLocale, templates);
985
- const content = formatRulesFile(schema.name, rules);
989
+ const content = formatRulesFile(schema.name, rules, options);
986
990
  files.push({
987
991
  filePath: `rules/${schema.name}.rules.ts`,
988
992
  content,
@@ -1549,7 +1553,7 @@ var DEFAULT_OPTIONS = {
1549
1553
  useJsExtension: false
1550
1554
  // Bundlers (Vite, webpack) don't need .js extension
1551
1555
  };
1552
- function getImportExt(options) {
1556
+ function getImportExt2(options) {
1553
1557
  return options.useJsExtension ? ".js" : "";
1554
1558
  }
1555
1559
  function generateBaseHeader() {
@@ -1646,7 +1650,7 @@ function generateBaseInterfaceFile(schemaName, schemas, options) {
1646
1650
  const commonImports = [];
1647
1651
  if (dateImports.dateTime) commonImports.push("DateTimeString");
1648
1652
  if (dateImports.date) commonImports.push("DateString");
1649
- const ext = getImportExt(options);
1653
+ const ext = getImportExt2(options);
1650
1654
  if (commonImports.length > 0) {
1651
1655
  parts.push(`import type { ${commonImports.join(", ")} } from '../common${ext}';
1652
1656
  `);
@@ -1718,14 +1722,14 @@ function generateModelFile(schemaName, options) {
1718
1722
  if (options.generateZodSchemas) {
1719
1723
  return {
1720
1724
  filePath: `${schemaName}.ts`,
1721
- content: formatZodModelFile(schemaName, getImportExt(options)),
1725
+ content: formatZodModelFile(schemaName, getImportExt2(options)),
1722
1726
  types: [schemaName],
1723
1727
  overwrite: false
1724
1728
  // Never overwrite user models
1725
1729
  };
1726
1730
  }
1727
1731
  const parts = [generateModelHeader(schemaName)];
1728
- const ext = getImportExt(options);
1732
+ const ext = getImportExt2(options);
1729
1733
  parts.push(`import type { ${schemaName} as ${schemaName}Base } from './base/${schemaName}${ext}';
1730
1734
 
1731
1735
  `);
@@ -1907,7 +1911,7 @@ function generateI18nFile(options) {
1907
1911
  }
1908
1912
  }
1909
1913
  const messagesJson = JSON.stringify(mergedMessages, null, 2);
1910
- const ext = getImportExt(options);
1914
+ const ext = getImportExt2(options);
1911
1915
  const content = `${generateBaseHeader()}
1912
1916
  import type { LocaleMap } from './common${ext}';
1913
1917
 
@@ -1992,7 +1996,7 @@ export function getMessages(locale: string): Record<string, string> {
1992
1996
  }
1993
1997
  function generateIndexFile(schemas, enums, pluginEnums, typeAliases, options) {
1994
1998
  const parts = [generateBaseHeader()];
1995
- const ext = getImportExt(options);
1999
+ const ext = getImportExt2(options);
1996
2000
  parts.push(`// Common Types
1997
2001
  `);
1998
2002
  parts.push(`export type { LocaleMap, Locale, ValidationRule, DateTimeString, DateString } from './common${ext}';