@diphyx/harlemify 1.0.2 → 1.0.3
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 +7 -14
- package/dist/module.d.ts +7 -14
- package/dist/module.json +1 -1
- package/dist/module.mjs +10 -12
- package/dist/runtime/core/store.js +2 -3
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/plugin.js +3 -0
- package/dist/runtime/shared.d.ts +7 -0
- package/dist/runtime/shared.js +3 -0
- package/package.json +1 -1
package/dist/module.d.mts
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { MaybeRefOrGetter } from 'vue';
|
|
3
2
|
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
timeout?: number;
|
|
11
|
-
}
|
|
3
|
+
type SharedConfig = {
|
|
4
|
+
api?: {
|
|
5
|
+
url?: string;
|
|
6
|
+
timeout?: number;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
api?: Pick<ApiOptions, "url" | "timeout">;
|
|
15
|
-
}
|
|
16
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
10
|
+
declare const _default: _nuxt_schema.NuxtModule<SharedConfig, SharedConfig, false>;
|
|
17
11
|
|
|
18
12
|
export { _default as default };
|
|
19
|
-
export type { ModuleOptions };
|
package/dist/module.d.ts
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { MaybeRefOrGetter } from 'vue';
|
|
3
2
|
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
timeout?: number;
|
|
11
|
-
}
|
|
3
|
+
type SharedConfig = {
|
|
4
|
+
api?: {
|
|
5
|
+
url?: string;
|
|
6
|
+
timeout?: number;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
api?: Pick<ApiOptions, "url" | "timeout">;
|
|
15
|
-
}
|
|
16
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
10
|
+
declare const _default: _nuxt_schema.NuxtModule<SharedConfig, SharedConfig, false>;
|
|
17
11
|
|
|
18
12
|
export { _default as default };
|
|
19
|
-
export type { ModuleOptions };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addPlugin, addImportsDir
|
|
1
|
+
import { defineNuxtModule, createResolver, addTemplate, addPlugin, addImportsDir } from '@nuxt/kit';
|
|
2
2
|
|
|
3
3
|
const module = defineNuxtModule({
|
|
4
4
|
meta: {
|
|
@@ -11,22 +11,20 @@ const module = defineNuxtModule({
|
|
|
11
11
|
defaults: {
|
|
12
12
|
api: {}
|
|
13
13
|
},
|
|
14
|
-
setup(options,
|
|
14
|
+
setup(options, nuxt) {
|
|
15
15
|
const { resolve } = createResolver(import.meta.url);
|
|
16
|
+
addTemplate({
|
|
17
|
+
write: true,
|
|
18
|
+
filename: "harlemify.config.mjs",
|
|
19
|
+
getContents() {
|
|
20
|
+
return `export default ${JSON.stringify(options)}`;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
16
23
|
addPlugin(resolve("./runtime", "plugin"));
|
|
17
24
|
addImportsDir(resolve("./runtime", "core"));
|
|
18
25
|
addImportsDir(resolve("./runtime", "composables"));
|
|
19
26
|
addImportsDir(resolve("./runtime", "utils"));
|
|
20
|
-
|
|
21
|
-
public: {
|
|
22
|
-
harlemify: options
|
|
23
|
-
},
|
|
24
|
-
options: {
|
|
25
|
-
build: {
|
|
26
|
-
transpile: [/@harlem\//]
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
});
|
|
27
|
+
nuxt.options.build.transpile.push(/@harlem\//);
|
|
30
28
|
}
|
|
31
29
|
});
|
|
32
30
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defu } from "defu";
|
|
2
2
|
import { createStore as createHarlemStore } from "@harlem/core";
|
|
3
|
-
import { useRuntimeConfig } from "#imports";
|
|
4
3
|
import { createApi } from "./api.js";
|
|
4
|
+
import { sharedConfig } from "../shared.js";
|
|
5
5
|
import { resolveSchema } from "../utils/schema.js";
|
|
6
6
|
import { pluralize } from "../utils/transform.js";
|
|
7
7
|
import { Endpoint, EndpointStatus, getEndpoint, makeEndpointStatusName, resolveEndpointUrl } from "../utils/endpoint.js";
|
|
@@ -23,9 +23,8 @@ export function createStore(entity, schema, endpoints, options) {
|
|
|
23
23
|
let apiClient;
|
|
24
24
|
function api() {
|
|
25
25
|
if (!apiClient) {
|
|
26
|
-
const config = useRuntimeConfig();
|
|
27
26
|
apiClient = createApi({
|
|
28
|
-
...
|
|
27
|
+
...sharedConfig.api ?? {},
|
|
29
28
|
...options?.api
|
|
30
29
|
});
|
|
31
30
|
}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { getMeta, resolveSchema } from "./utils/schema.js";
|
|
|
3
3
|
export { createApi, ApiResponseType, ApiErrorSource, ApiError, ApiRequestError, ApiResponseError } from "./core/api.js";
|
|
4
4
|
export { createStore, StoreMemoryPosition } from "./core/store.js";
|
|
5
5
|
export { useStoreAlias } from "./composables/use.js";
|
|
6
|
+
export type { SharedConfig } from "./shared.js";
|
|
6
7
|
export type { EndpointDefinition } from "./utils/endpoint.js";
|
|
7
8
|
export type { SchemaMeta } from "./utils/schema.js";
|
|
8
9
|
export type { ApiRequestHeader, ApiRequestQuery, ApiRequestBody, ApiRequestOptions, ApiOptions, EndpointMethodOptions, ApiErrorOptions, } from "./core/api.js";
|
package/dist/runtime/plugin.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { defineNuxtPlugin, useHead } from "#imports";
|
|
2
2
|
import { createVuePlugin } from "@harlem/core";
|
|
3
3
|
import { createServerSSRPlugin, createClientSSRPlugin, getBridgingScript } from "@harlem/plugin-ssr";
|
|
4
|
+
import config from "#build/harlemify.config";
|
|
5
|
+
import { sharedConfig } from "./shared.js";
|
|
4
6
|
export default defineNuxtPlugin((nuxtApp) => {
|
|
7
|
+
sharedConfig.api = config.api;
|
|
5
8
|
const plugins = [];
|
|
6
9
|
if (import.meta.server) {
|
|
7
10
|
plugins.push(createServerSSRPlugin());
|