@ciwergrp/nuxid 1.0.6 → 1.1.1
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 +24 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +82 -3
- package/dist/runtime/form.d.ts +1 -2
- package/dist/runtime/plugin.js +0 -1
- package/package.json +3 -2
package/dist/module.d.mts
CHANGED
|
@@ -173,6 +173,29 @@ interface PiniaOptions {
|
|
|
173
173
|
}
|
|
174
174
|
type PiniaFeatureInput = boolean | Partial<PiniaOptions> | undefined;
|
|
175
175
|
|
|
176
|
+
interface VueUseOptions {
|
|
177
|
+
/**
|
|
178
|
+
* Enable VueUse integration
|
|
179
|
+
* @default true
|
|
180
|
+
*/
|
|
181
|
+
enabled: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* Enable auto-imports from @vueuse/nuxt
|
|
184
|
+
* @default true
|
|
185
|
+
*/
|
|
186
|
+
autoImports: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Register VueUse SSR handlers
|
|
189
|
+
* @default false
|
|
190
|
+
*/
|
|
191
|
+
ssrHandlers: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Extra VueUse functions to exclude from auto-imports
|
|
194
|
+
*/
|
|
195
|
+
exclude: string[];
|
|
196
|
+
}
|
|
197
|
+
type VueUseFeatureInput = boolean | Partial<VueUseOptions> | undefined;
|
|
198
|
+
|
|
176
199
|
interface ModuleOptions {
|
|
177
200
|
lodash?: LodashFeatureInput;
|
|
178
201
|
validator?: ValidatorFeatureInput;
|
|
@@ -181,6 +204,7 @@ interface ModuleOptions {
|
|
|
181
204
|
elementPlus?: ElementPlusFeatureInput;
|
|
182
205
|
helper?: HelperFeatureInput;
|
|
183
206
|
pinia?: PiniaFeatureInput;
|
|
207
|
+
vueuse?: VueUseFeatureInput;
|
|
184
208
|
}
|
|
185
209
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
186
210
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -373,6 +373,80 @@ function registerPiniaFeature(options, nuxt, { runtimeDir, payload, plugin, comp
|
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
+
const disabledFunctions = [
|
|
377
|
+
"toRefs",
|
|
378
|
+
"toRef",
|
|
379
|
+
"toValue",
|
|
380
|
+
"useFetch",
|
|
381
|
+
"useCookie",
|
|
382
|
+
"useHead",
|
|
383
|
+
"useStorage",
|
|
384
|
+
"useImage",
|
|
385
|
+
"useTitle"
|
|
386
|
+
];
|
|
387
|
+
|
|
388
|
+
const vueuseDefaults = {
|
|
389
|
+
enabled: false,
|
|
390
|
+
autoImports: true,
|
|
391
|
+
ssrHandlers: false,
|
|
392
|
+
exclude: []
|
|
393
|
+
};
|
|
394
|
+
function resolveVueUseOptions(input) {
|
|
395
|
+
if (input === false) {
|
|
396
|
+
return { ...vueuseDefaults, enabled: false };
|
|
397
|
+
}
|
|
398
|
+
const overrides = typeof input === "boolean" || input === void 0 ? {} : input;
|
|
399
|
+
return {
|
|
400
|
+
...vueuseDefaults,
|
|
401
|
+
...overrides,
|
|
402
|
+
enabled: overrides?.enabled ?? true,
|
|
403
|
+
autoImports: overrides?.autoImports ?? vueuseDefaults.autoImports,
|
|
404
|
+
ssrHandlers: overrides?.ssrHandlers ?? vueuseDefaults.ssrHandlers,
|
|
405
|
+
exclude: [
|
|
406
|
+
...disabledFunctions,
|
|
407
|
+
...vueuseDefaults.exclude,
|
|
408
|
+
...overrides?.exclude ?? []
|
|
409
|
+
]
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
function registerVueUseFeature(options, nuxt) {
|
|
413
|
+
if (!options.enabled || !options.autoImports || !options.exclude.length) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
const excluded = new Set(options.exclude);
|
|
417
|
+
const hasFrom = (value) => {
|
|
418
|
+
if (typeof value !== "object" || value === null || !("from" in value)) {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
return typeof value.from === "string";
|
|
422
|
+
};
|
|
423
|
+
nuxt.hook("imports:sources", (sources) => {
|
|
424
|
+
for (let index = sources.length - 1; index >= 0; index -= 1) {
|
|
425
|
+
const source = sources[index];
|
|
426
|
+
const sourceFrom = source.from;
|
|
427
|
+
const hasVueUseSource = typeof sourceFrom === "string" && sourceFrom.startsWith("@vueuse/");
|
|
428
|
+
const hasVueUseImport = Array.isArray(source.imports) && source.imports.some((item) => typeof item === "object" && item !== null && hasFrom(item) && item.from.startsWith("@vueuse/"));
|
|
429
|
+
if (!hasVueUseSource && !hasVueUseImport) {
|
|
430
|
+
continue;
|
|
431
|
+
}
|
|
432
|
+
const filteredImports = (source.imports ?? []).filter((item) => {
|
|
433
|
+
if (typeof item === "string") {
|
|
434
|
+
return !excluded.has(item);
|
|
435
|
+
}
|
|
436
|
+
if (typeof item === "object" && item !== null && "name" in item) {
|
|
437
|
+
return !excluded.has(item.name);
|
|
438
|
+
}
|
|
439
|
+
return true;
|
|
440
|
+
});
|
|
441
|
+
if (!filteredImports.length) {
|
|
442
|
+
sources.splice(index, 1);
|
|
443
|
+
continue;
|
|
444
|
+
}
|
|
445
|
+
source.imports = filteredImports;
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
|
|
376
450
|
const module$1 = defineNuxtModule({
|
|
377
451
|
meta: {
|
|
378
452
|
name: "@ciwergrp/nuxid",
|
|
@@ -382,9 +456,6 @@ const module$1 = defineNuxtModule({
|
|
|
382
456
|
const dependencies = {
|
|
383
457
|
"@sentry/nuxt": {
|
|
384
458
|
version: "10.32.1"
|
|
385
|
-
},
|
|
386
|
-
"@vueuse/nuxt": {
|
|
387
|
-
version: "14.1.0"
|
|
388
459
|
}
|
|
389
460
|
};
|
|
390
461
|
return dependencies;
|
|
@@ -398,6 +469,7 @@ const module$1 = defineNuxtModule({
|
|
|
398
469
|
const elementPlusOptions = resolveElementPlusOptions(options.elementPlus);
|
|
399
470
|
const helperOptions = resolveHelperOptions(options.helper);
|
|
400
471
|
const piniaOptions = resolvePiniaOptions(options.pinia);
|
|
472
|
+
const vueuseOptions = resolveVueUseOptions(options.vueuse);
|
|
401
473
|
if (iconOptions.enabled) {
|
|
402
474
|
await installModule("@nuxt/icon", iconOptions.config);
|
|
403
475
|
}
|
|
@@ -432,6 +504,13 @@ const module$1 = defineNuxtModule({
|
|
|
432
504
|
resolver
|
|
433
505
|
});
|
|
434
506
|
}
|
|
507
|
+
if (vueuseOptions.enabled) {
|
|
508
|
+
await installModule("@vueuse/nuxt", {
|
|
509
|
+
autoImports: vueuseOptions.autoImports,
|
|
510
|
+
ssrHandlers: vueuseOptions.ssrHandlers
|
|
511
|
+
});
|
|
512
|
+
registerVueUseFeature(vueuseOptions, nuxt);
|
|
513
|
+
}
|
|
435
514
|
addPlugin(resolver.resolve("./runtime/plugin"));
|
|
436
515
|
}
|
|
437
516
|
});
|
package/dist/runtime/form.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { HTTPMethod } from 'h3';
|
|
2
2
|
import type { NitroFetchOptions, NitroFetchRequest } from 'nitropack';
|
|
3
|
-
export type FormFetcher = <T = any>(request: NitroFetchRequest, opts?: NitroFetchOptions<NitroFetchRequest>) => Promise<T>;
|
|
4
3
|
export interface UseHttp<DefaultResponseType = any> {
|
|
5
4
|
_method?: HTTPMethod;
|
|
6
5
|
submit: <APIResponseType = DefaultResponseType>(method: HTTPMethod, url: NitroFetchRequest, options?: NitroFetchOptions<NitroFetchRequest>) => Promise<APIResponseType>;
|
|
@@ -15,7 +14,7 @@ export interface UseHttp<DefaultResponseType = any> {
|
|
|
15
14
|
}
|
|
16
15
|
export interface FormComposableOptions {
|
|
17
16
|
alwaysFormData?: boolean;
|
|
18
|
-
fetcher?:
|
|
17
|
+
fetcher?: typeof $fetch;
|
|
19
18
|
fetchOptions?: NitroFetchOptions<NitroFetchRequest>;
|
|
20
19
|
}
|
|
21
20
|
export default function useHttp<TData extends object, DefaultResponseType = any>(initialData: TData, formOptions?: FormComposableOptions): TData & UseHttp<DefaultResponseType>;
|
package/dist/runtime/plugin.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ciwergrp/nuxid",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "All-in-one essential modules for Nuxt",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -75,7 +75,8 @@
|
|
|
75
75
|
"nuxt": "^4.2.1",
|
|
76
76
|
"typescript": "~5.9.3",
|
|
77
77
|
"vitest": "^4.0.13",
|
|
78
|
-
"vue-tsc": "^3.1.5"
|
|
78
|
+
"vue-tsc": "^3.1.5",
|
|
79
|
+
"@vueuse/nuxt": "14.1.0"
|
|
79
80
|
},
|
|
80
81
|
"scripts": {
|
|
81
82
|
"dev": "npm run dev:prepare && nuxi dev playground",
|