@famgia/omnify-typescript 0.0.143 → 0.0.145

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.cjs CHANGED
@@ -30,7 +30,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/plugin.ts
31
31
  var plugin_exports = {};
32
32
  __export(plugin_exports, {
33
+ LEGACY_DEFAULTS: () => LEGACY_DEFAULTS,
34
+ MODERN_DEFAULTS: () => MODERN_DEFAULTS,
33
35
  default: () => typescriptPlugin,
36
+ typescriptModern: () => typescriptModern,
34
37
  typescriptPlugin: () => typescriptPlugin
35
38
  });
36
39
  module.exports = __toCommonJS(plugin_exports);
@@ -2374,14 +2377,22 @@ var import_url = require("url");
2374
2377
  var import_meta = {};
2375
2378
  var __filename = (0, import_url.fileURLToPath)(import_meta.url);
2376
2379
  var __dirname = import_path.default.dirname(__filename);
2380
+ var MODERN_DEFAULTS = {
2381
+ modelsPath: "node_modules/.omnify/schemas",
2382
+ stubsPath: false
2383
+ };
2384
+ var LEGACY_DEFAULTS = {
2385
+ modelsPath: "types/schemas",
2386
+ stubsPath: "omnify"
2387
+ };
2377
2388
  var TYPESCRIPT_CONFIG_SCHEMA = {
2378
2389
  fields: [
2379
2390
  {
2380
2391
  key: "modelsPath",
2381
2392
  type: "path",
2382
2393
  label: "Schemas Output Path",
2383
- description: "Directory for generated TypeScript types and Zod schemas",
2384
- default: "types/schemas",
2394
+ description: 'Directory for generated TypeScript types and Zod schemas. Use "node_modules/.omnify/schemas" for modern mode with @famgia/omnify-react.',
2395
+ default: LEGACY_DEFAULTS.modelsPath,
2385
2396
  group: "output"
2386
2397
  },
2387
2398
  {
@@ -2396,17 +2407,24 @@ var TYPESCRIPT_CONFIG_SCHEMA = {
2396
2407
  key: "stubsPath",
2397
2408
  type: "path",
2398
2409
  label: "React Stubs Path",
2399
- description: "Directory for React utility stubs (hooks, components). Leave empty to disable.",
2400
- default: "omnify",
2410
+ description: "Directory for React utility stubs (hooks, components). Leave empty to disable. Recommended: use @famgia/omnify-react instead.",
2411
+ default: LEGACY_DEFAULTS.stubsPath,
2401
2412
  group: "output"
2402
2413
  }
2403
2414
  ]
2404
2415
  };
2416
+ function isNodeModulesPath(p) {
2417
+ return p.includes("node_modules");
2418
+ }
2405
2419
  function resolveOptions(options) {
2420
+ const modelsPath = options?.modelsPath ?? LEGACY_DEFAULTS.modelsPath;
2421
+ const isModernMode = isNodeModulesPath(modelsPath);
2422
+ const defaultStubsPath = isModernMode ? false : LEGACY_DEFAULTS.stubsPath;
2406
2423
  return {
2407
- modelsPath: options?.modelsPath ?? "types/schemas",
2424
+ modelsPath,
2408
2425
  generateZodSchemas: options?.generateZodSchemas ?? true,
2409
- stubsPath: options?.stubsPath ?? "omnify"
2426
+ stubsPath: options?.stubsPath ?? defaultStubsPath,
2427
+ isModernMode
2410
2428
  };
2411
2429
  }
2412
2430
  var STUB_FILES = [
@@ -2487,11 +2505,16 @@ function typescriptPlugin(options) {
2487
2505
  },
2488
2506
  {
2489
2507
  name: "typescript-stubs",
2490
- description: "Generate React utility stubs (hooks, components)",
2491
- generate: async () => {
2508
+ description: "Generate React utility stubs (hooks, components) - DEPRECATED: use @famgia/omnify-react",
2509
+ generate: async (ctx) => {
2492
2510
  if (resolved.stubsPath === false) {
2493
2511
  return [];
2494
2512
  }
2513
+ if (ctx.logger) {
2514
+ ctx.logger.warn(
2515
+ "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."
2516
+ );
2517
+ }
2495
2518
  const outputs = [];
2496
2519
  const stubsDir = import_path.default.join(__dirname, "..", "stubs");
2497
2520
  for (const { stub, output } of STUB_FILES) {
@@ -2538,8 +2561,18 @@ export * from './rules';
2538
2561
  ]
2539
2562
  };
2540
2563
  }
2564
+ function typescriptModern(options) {
2565
+ return typescriptPlugin({
2566
+ ...options,
2567
+ modelsPath: MODERN_DEFAULTS.modelsPath,
2568
+ stubsPath: MODERN_DEFAULTS.stubsPath
2569
+ });
2570
+ }
2541
2571
  // Annotate the CommonJS export names for ESM import in node:
2542
2572
  0 && (module.exports = {
2573
+ LEGACY_DEFAULTS,
2574
+ MODERN_DEFAULTS,
2575
+ typescriptModern,
2543
2576
  typescriptPlugin
2544
2577
  });
2545
2578
  //# sourceMappingURL=plugin.cjs.map