@anweb/nuxt-ancore 1.3.5 → 1.3.6
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/module.d.mts
CHANGED
package/dist/module.d.ts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -7,11 +7,12 @@ const module = defineNuxtModule({
|
|
|
7
7
|
},
|
|
8
8
|
defaults: {},
|
|
9
9
|
async setup(_options, _nuxt) {
|
|
10
|
-
const { resolve } = createResolver(import.meta.url);
|
|
11
|
-
_nuxt.options.runtimeConfig.public
|
|
12
|
-
api: _options.api
|
|
13
|
-
};
|
|
10
|
+
const { resolve, resolvePath } = createResolver(import.meta.url);
|
|
11
|
+
_nuxt.options.runtimeConfig.public = {};
|
|
14
12
|
_nuxt.options.alias["#ancore/types"] = resolve("./runtime/types");
|
|
13
|
+
if (_options.api) {
|
|
14
|
+
_nuxt.options.alias["#ancore/customApi"] = await resolvePath(_options.api);
|
|
15
|
+
}
|
|
15
16
|
addImportsDir(resolve("./runtime/composables"));
|
|
16
17
|
addImportsDir(resolve("./runtime/utils"));
|
|
17
18
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ModuleOptions } from '../../module'
|
|
2
|
+
import type { TApi } from '#ancore/types'
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
declare module 'nuxt/schema' {
|
|
@@ -10,8 +11,9 @@ declare module 'nuxt/schema' {
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
interface PublicRuntimeConfig {
|
|
13
|
-
ancore?: Partial<ModuleOptions>
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
declare module '#ancore/customApi' {
|
|
18
|
+
export const api: TApi
|
|
19
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { NitroFetchOptions, NitroFetchRequest } from 'nitropack';
|
|
2
|
-
export declare const userApi: <TData = unknown, TError = unknown>(request: NitroFetchRequest, opts: NitroFetchOptions<string>) =>
|
|
2
|
+
export declare const userApi: <TData = unknown, TError = unknown>(request: NitroFetchRequest, opts: NitroFetchOptions<string>) => any;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { useRuntimeConfig } from "#app";
|
|
2
1
|
import { coreApi } from "./index.js";
|
|
2
|
+
import { api as customApi } from "#ancore/customApi";
|
|
3
3
|
export const userApi = (request, opts) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return runtimeConfig.api(request, opts);
|
|
4
|
+
if (customApi) {
|
|
5
|
+
return customApi(request, opts);
|
|
7
6
|
} else {
|
|
8
7
|
return coreApi(request, opts);
|
|
9
8
|
}
|