vovk 0.2.3-beta.33 → 0.2.3-beta.35

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.
@@ -19,22 +19,25 @@ function canRequire(moduleName) {
19
19
  async function generateClient(rcPath) {
20
20
  const vovkrc = getVovkrc(rcPath);
21
21
  const jsonPath = '../../.vovk.json';
22
- const fetcherPath = vovkrc.fetcher.startsWith('.')
23
- ? path.join(__dirname, '../../..', vovkrc.fetcher)
24
- : vovkrc.fetcher;
22
+ const localJsonPath = path.join('..', jsonPath);
23
+ const fetcherPath = vovkrc.fetcher.startsWith('.') ? path.join(__dirname, '../..', vovkrc.fetcher) : vovkrc.fetcher;
25
24
  const streamFetcherPath = vovkrc.streamFetcher.startsWith('.')
26
- ? path.join(__dirname, '../../..', vovkrc.streamFetcher)
25
+ ? path.join(__dirname, '../..', vovkrc.streamFetcher)
27
26
  : vovkrc.streamFetcher;
27
+ const validatePath = vovkrc.validateOnClient?.startsWith('.')
28
+ ? path.join(__dirname, '../..', vovkrc.validateOnClient)
29
+ : vovkrc.validateOnClient;
30
+ const localValidatePath = vovkrc.validateOnClient?.startsWith('.') ? path.join('..', validatePath) : validatePath;
28
31
 
29
32
  if (typeof vovkrc.validateOnClient === 'undefined') {
30
33
  vovkrc.validateOnClient = canRequire('vovk-zod/zodValidateOnClient') ? 'vovk-zod/zodValidateOnClient' : null;
31
- } else if (vovkrc.validateOnClient && !canRequire(vovkrc.validateOnClient)) {
34
+ } else if (vovkrc.validateOnClient && !canRequire(localValidatePath)) {
32
35
  throw new Error(
33
36
  `Unble to generate Vovk Client: cannot find "validateOnClient" module '${vovkrc.validateOnClient}'. Check your .vovkrc.js file`
34
37
  );
35
38
  }
36
39
 
37
- if (!canRequire(jsonPath)) {
40
+ if (!canRequire(localJsonPath)) {
38
41
  throw new Error(`Unble to generate Vovk Client: cannot find ".vovk.json" file '${jsonPath}'.`);
39
42
  }
40
43
 
@@ -49,7 +52,7 @@ type Options = typeof fetcher extends VovkClientFetcher<infer U> ? U : never;
49
52
  `;
50
53
  let js = `const { clientizeController } = require('vovk/client');
51
54
  const { promisifyWorker } = require('vovk/worker');
52
- const metadata = require('${jsonPath}');
55
+ const metadata = require('${localJsonPath}');
53
56
  const { default: fetcher } = require('${fetcherPath}');
54
57
  const { default: streamFetcher } = require('${streamFetcherPath}');
55
58
  const prefix = '${vovkrc.prefix ?? '/api'}';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk",
3
- "version": "0.2.3-beta.33",
3
+ "version": "0.2.3-beta.35",
4
4
  "description": "Structural add-on for Next.js",
5
5
  "bin": "./cli/index.js",
6
6
  "scripts": {