nuxt-openapi-hyperfetch 0.3.5-beta → 0.3.6-beta

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
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from 'commander';
3
3
  import * as p from '@clack/prompts';
4
+ import { existsSync } from 'fs';
5
+ import * as path from 'path';
4
6
  import { generateOpenApiFiles, generateHeyApiFiles, checkJavaInstalled } from './generate.js';
5
7
  import { generateUseFetchComposables } from './generators/use-fetch/generator.js';
6
8
  import { generateUseAsyncDataComposables } from './generators/use-async-data/generator.js';
@@ -197,13 +199,10 @@ program
197
199
  }
198
200
  // Generate headless connectors if requested (requires useAsyncData)
199
201
  if (generateConnectorsFlag) {
200
- // Check zod is available in the user's project before attempting generation
201
- try {
202
- // Use a variable to prevent TypeScript from resolving the module at compile time
203
- const zodId = 'zod';
204
- await import(zodId);
205
- }
206
- catch {
202
+ // Check zod is available in the user's project by probing their node_modules,
203
+ // not via import() which resolves from the CLI's own context (npx sandbox).
204
+ const zodPath = path.resolve(process.cwd(), 'node_modules', 'zod');
205
+ if (!existsSync(zodPath)) {
207
206
  p.log.warn('Skipping connectors: "zod" is not installed in this project.\n' +
208
207
  ' Run: npm install zod');
209
208
  generateConnectorsFlag = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-openapi-hyperfetch",
3
- "version": "0.3.5-beta",
3
+ "version": "0.3.6-beta",
4
4
  "description": "Nuxt useFetch, useAsyncData and Nuxt server OpenAPI generator",
5
5
  "type": "module",
6
6
  "author": "",
package/src/index.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from 'commander';
3
3
  import * as p from '@clack/prompts';
4
+ import { existsSync } from 'fs';
5
+ import * as path from 'path';
4
6
  import { generateOpenApiFiles, generateHeyApiFiles, checkJavaInstalled } from './generate.js';
5
7
  import { generateUseFetchComposables } from './generators/use-fetch/generator.js';
6
8
  import { generateUseAsyncDataComposables } from './generators/use-async-data/generator.js';
@@ -254,12 +256,10 @@ program
254
256
 
255
257
  // Generate headless connectors if requested (requires useAsyncData)
256
258
  if (generateConnectorsFlag) {
257
- // Check zod is available in the user's project before attempting generation
258
- try {
259
- // Use a variable to prevent TypeScript from resolving the module at compile time
260
- const zodId = 'zod';
261
- await import(zodId);
262
- } catch {
259
+ // Check zod is available in the user's project by probing their node_modules,
260
+ // not via import() which resolves from the CLI's own context (npx sandbox).
261
+ const zodPath = path.resolve(process.cwd(), 'node_modules', 'zod');
262
+ if (!existsSync(zodPath)) {
263
263
  p.log.warn(
264
264
  'Skipping connectors: "zod" is not installed in this project.\n' +
265
265
  ' Run: npm install zod'