@vueuse/nuxt 7.0.0-alpha.3 → 7.4.0
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/README.md +2 -15
- package/index.cjs +4 -44
- package/index.d.ts +1 -48
- package/index.mjs +63 -32
- package/indexes.json +70 -10
- package/package.json +4 -11
- package/module.cjs +0 -6
- package/module.d.ts +0 -1
- package/module.mjs +0 -73
package/README.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@vueuse/nuxt)
|
|
4
4
|
|
|
5
|
-
> This is an add-on of [VueUse](https://github.com/vueuse/vueuse), provides Nuxt
|
|
6
|
-
|
|
7
|
-
> Experimental. **Will NOT follow semvar**.
|
|
5
|
+
> This is an add-on of [VueUse](https://github.com/vueuse/vueuse), which provides better Nuxt integration auto-import capabilities.
|
|
8
6
|
|
|
9
7
|
## Install
|
|
10
8
|
|
|
@@ -17,22 +15,11 @@ npm i <b>@vueuse/nuxt</b>
|
|
|
17
15
|
|
|
18
16
|
export function defineNuxtConfig({
|
|
19
17
|
buildModules: [
|
|
20
|
-
'@vueuse/nuxt
|
|
18
|
+
'@vueuse/nuxt'
|
|
21
19
|
]
|
|
22
20
|
})
|
|
23
21
|
```
|
|
24
22
|
|
|
25
|
-
## Functions
|
|
26
|
-
|
|
27
|
-
`@vueuse/nuxt` provides the following functions
|
|
28
|
-
|
|
29
|
-
<!--GENERATED LIST, DO NOT MODIFY MANUALLY-->
|
|
30
|
-
<!--FUNCTIONS_LIST_STARTS-->
|
|
31
|
-
- [`useNuxtDark`](https://vueuse.org/nuxt/useNuxtDark/) — reactive dark mode with auto data persistence for Nuxt
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<!--FUNCTIONS_LIST_ENDS-->
|
|
35
|
-
|
|
36
23
|
## License
|
|
37
24
|
|
|
38
25
|
[MIT License](https://github.com/vueuse/vueuse/blob/master/LICENSE) © 2021-PRESENT [Anthony Fu](https://github.com/antfu)
|
package/index.cjs
CHANGED
|
@@ -1,46 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var core = require('@vueuse/core');
|
|
6
|
-
var vueDemi = require('vue-demi');
|
|
7
|
-
var _app = require('#app');
|
|
8
|
-
|
|
9
|
-
function useNuxtDark(options = {}) {
|
|
10
|
-
const {
|
|
11
|
-
attribute = "class",
|
|
12
|
-
valueDark = "dark",
|
|
13
|
-
valueLight = "light",
|
|
14
|
-
window = core.defaultWindow,
|
|
15
|
-
cookieKey = "vueuse-color-schema"
|
|
16
|
-
} = options;
|
|
17
|
-
const preferredDark = core.usePreferredDark({ window });
|
|
18
|
-
const store = _app.useCookie(cookieKey);
|
|
19
|
-
if (store.value == null)
|
|
20
|
-
store.value = "auto";
|
|
21
|
-
const isDark = vueDemi.computed({
|
|
22
|
-
get() {
|
|
23
|
-
return store.value === "auto" ? preferredDark.value : store.value === "dark";
|
|
24
|
-
},
|
|
25
|
-
set(v) {
|
|
26
|
-
if (v === preferredDark.value)
|
|
27
|
-
store.value = "auto";
|
|
28
|
-
else
|
|
29
|
-
store.value = v ? "dark" : "light";
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
_app.useMeta(vueDemi.computed(() => ({
|
|
33
|
-
htmlAttrs: {
|
|
34
|
-
[attribute]: isDark.value ? valueDark : valueLight
|
|
35
|
-
}
|
|
36
|
-
})));
|
|
37
|
-
return isDark;
|
|
1
|
+
// CommonJS proxy to bypass jiti transforms from nuxt 2 and using native ESM
|
|
2
|
+
module.exports = function(...args) {
|
|
3
|
+
return import('./index.mjs').then(m => m.default.call(this, ...args))
|
|
38
4
|
}
|
|
39
5
|
|
|
40
|
-
exports.
|
|
41
|
-
Object.keys(core).forEach(function (k) {
|
|
42
|
-
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () { return core[k]; }
|
|
45
|
-
});
|
|
46
|
-
});
|
|
6
|
+
module.exports.meta = require('./package.json')
|
package/index.d.ts
CHANGED
|
@@ -1,48 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { ConfigurableWindow } from '@vueuse/core';
|
|
3
|
-
export * from '@vueuse/core';
|
|
4
|
-
|
|
5
|
-
interface UseNuxtDarkOptions extends ConfigurableWindow {
|
|
6
|
-
/**
|
|
7
|
-
* HTML attribute applying the target element
|
|
8
|
-
*
|
|
9
|
-
* @default 'class'
|
|
10
|
-
*/
|
|
11
|
-
attribute?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Value applying to the target element when isDark=true
|
|
14
|
-
*
|
|
15
|
-
* @default 'dark'
|
|
16
|
-
*/
|
|
17
|
-
valueDark?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Value applying to the target element when isDark=false
|
|
20
|
-
*
|
|
21
|
-
* @default 'light'
|
|
22
|
-
*/
|
|
23
|
-
valueLight?: string;
|
|
24
|
-
/**
|
|
25
|
-
* A custom handler for handle the updates.
|
|
26
|
-
* When specified, the default behavior will be overridded.
|
|
27
|
-
*
|
|
28
|
-
* @default undefined
|
|
29
|
-
*/
|
|
30
|
-
onChanged?: (isDark: boolean) => void;
|
|
31
|
-
/**
|
|
32
|
-
* Key to persist the data into Nuxt's useCookie.
|
|
33
|
-
*
|
|
34
|
-
* Pass `null` to disable persistence
|
|
35
|
-
*
|
|
36
|
-
* @default 'vueuse-color-schema'
|
|
37
|
-
*/
|
|
38
|
-
cookieKey?: string;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Reactive dark mode with auto data persistence for Nuxt.
|
|
42
|
-
*
|
|
43
|
-
* @see https://vueuse.org/useNuxtDark
|
|
44
|
-
* @param options
|
|
45
|
-
*/
|
|
46
|
-
declare function useNuxtDark(options?: UseNuxtDarkOptions): vue_demi.WritableComputedRef<boolean>;
|
|
47
|
-
|
|
48
|
-
export { UseNuxtDarkOptions, useNuxtDark };
|
|
1
|
+
export default function(): void
|
package/index.mjs
CHANGED
|
@@ -1,37 +1,68 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { dirname, resolve } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { isPackageExists } from 'local-pkg';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
6
|
+
const _dirname = typeof __dirname === "undefined" ? dirname(fileURLToPath(import.meta.url)) : __dirname;
|
|
7
|
+
const disabledFunctions = [
|
|
8
|
+
"useFetch",
|
|
9
|
+
"toRefs",
|
|
10
|
+
"useCookie"
|
|
11
|
+
];
|
|
12
|
+
const packages = [
|
|
13
|
+
"core",
|
|
14
|
+
"shared",
|
|
15
|
+
"nuxt",
|
|
16
|
+
"integrations",
|
|
17
|
+
"components",
|
|
18
|
+
"motion",
|
|
19
|
+
"firebase",
|
|
20
|
+
"rxjs",
|
|
21
|
+
"sound",
|
|
22
|
+
"head"
|
|
23
|
+
];
|
|
24
|
+
const fullPackages = packages.map((p) => `@vueuse/${p}`);
|
|
25
|
+
function VueUseModule() {
|
|
26
|
+
const { nuxt } = this;
|
|
27
|
+
nuxt.hook("vite:extend", ({ config }) => {
|
|
28
|
+
config.optimizeDeps = config.optimizeDeps || {};
|
|
29
|
+
config.optimizeDeps.exclude = config.optimizeDeps.exclude || [];
|
|
30
|
+
config.optimizeDeps.exclude.push(...fullPackages);
|
|
28
31
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
nuxt.options.build = nuxt.options.build || {};
|
|
33
|
+
nuxt.options.build.transpile = nuxt.options.build.transpile || [];
|
|
34
|
+
nuxt.options.build.transpile.push("@vueuse/nuxt", "@vueuse/core", "@vueuse/shared");
|
|
35
|
+
let indexes;
|
|
36
|
+
nuxt.hook("autoImports:sources", (sources) => {
|
|
37
|
+
if (sources.find((i) => fullPackages.includes(i.from)))
|
|
38
|
+
return;
|
|
39
|
+
if (!indexes) {
|
|
40
|
+
try {
|
|
41
|
+
indexes = JSON.parse(fs.readFileSync(resolve(_dirname, "./indexes.json"), "utf-8"));
|
|
42
|
+
indexes == null ? void 0 : indexes.functions.forEach((i) => {
|
|
43
|
+
if (i.package === "shared")
|
|
44
|
+
i.package = "core";
|
|
45
|
+
});
|
|
46
|
+
} catch (e) {
|
|
47
|
+
throw new Error("[@vueuse/nuxt] Failed to load indexes.json");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (!indexes)
|
|
51
|
+
return;
|
|
52
|
+
for (const pkg of packages) {
|
|
53
|
+
if (pkg === "shared")
|
|
54
|
+
continue;
|
|
55
|
+
if (!isPackageExists(`@vueuse/${pkg}`))
|
|
56
|
+
continue;
|
|
57
|
+
const functions = indexes.functions.filter((i) => (i.package === "core" || i.package === "shared") && !i.internal);
|
|
58
|
+
if (functions.length) {
|
|
59
|
+
sources.push({
|
|
60
|
+
from: `@vueuse/${pkg}`,
|
|
61
|
+
names: indexes.functions.filter((i) => i.package === pkg && !i.internal).map((i) => i.name).filter((i) => i.length >= 4 && !disabledFunctions.includes(i))
|
|
62
|
+
});
|
|
63
|
+
}
|
|
32
64
|
}
|
|
33
|
-
})
|
|
34
|
-
return isDark;
|
|
65
|
+
});
|
|
35
66
|
}
|
|
36
67
|
|
|
37
|
-
export {
|
|
68
|
+
export { VueUseModule as default };
|
package/indexes.json
CHANGED
|
@@ -26,13 +26,16 @@
|
|
|
26
26
|
"name": "nuxt",
|
|
27
27
|
"display": "Nuxt",
|
|
28
28
|
"description": "VueUse Nuxt Module",
|
|
29
|
+
"manualImport": true,
|
|
29
30
|
"addon": true,
|
|
30
31
|
"iife": false,
|
|
32
|
+
"cjs": false,
|
|
33
|
+
"dts": false,
|
|
34
|
+
"target": "node14",
|
|
31
35
|
"external": [
|
|
32
36
|
"@vueuse/core",
|
|
33
37
|
"@vueuse/shared",
|
|
34
|
-
"
|
|
35
|
-
"#app"
|
|
38
|
+
"local-pkg"
|
|
36
39
|
],
|
|
37
40
|
"dir": "packages/nuxt",
|
|
38
41
|
"docs": "https://vueuse.org/nuxt/README.html"
|
|
@@ -134,7 +137,6 @@
|
|
|
134
137
|
"@Electron",
|
|
135
138
|
"@Firebase",
|
|
136
139
|
"@Integrations",
|
|
137
|
-
"@Nuxt",
|
|
138
140
|
"@Router",
|
|
139
141
|
"@RxJS",
|
|
140
142
|
"Animation",
|
|
@@ -627,6 +629,14 @@
|
|
|
627
629
|
"category": "Browser",
|
|
628
630
|
"description": "reactive [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API)"
|
|
629
631
|
},
|
|
632
|
+
{
|
|
633
|
+
"name": "useColorMode",
|
|
634
|
+
"package": "core",
|
|
635
|
+
"component": true,
|
|
636
|
+
"docs": "https://vueuse.org/core/useColorMode/",
|
|
637
|
+
"category": "Browser",
|
|
638
|
+
"description": "reactive color mode (dark / light / customs) with auto data persistence"
|
|
639
|
+
},
|
|
630
640
|
{
|
|
631
641
|
"name": "useConfirmDialog",
|
|
632
642
|
"package": "core",
|
|
@@ -641,6 +651,13 @@
|
|
|
641
651
|
"category": "Browser",
|
|
642
652
|
"description": "manipulate CSS variables"
|
|
643
653
|
},
|
|
654
|
+
{
|
|
655
|
+
"name": "useCycleList",
|
|
656
|
+
"package": "core",
|
|
657
|
+
"docs": "https://vueuse.org/core/useCycleList/",
|
|
658
|
+
"category": "Utilities",
|
|
659
|
+
"description": "cycle through a list of items"
|
|
660
|
+
},
|
|
644
661
|
{
|
|
645
662
|
"name": "useDark",
|
|
646
663
|
"package": "core",
|
|
@@ -719,6 +736,13 @@
|
|
|
719
736
|
"category": "Sensors",
|
|
720
737
|
"description": "reactive [bounding box](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect) of an HTML element"
|
|
721
738
|
},
|
|
739
|
+
{
|
|
740
|
+
"name": "useElementByPoint",
|
|
741
|
+
"package": "core",
|
|
742
|
+
"docs": "https://vueuse.org/core/useElementByPoint/",
|
|
743
|
+
"category": "Sensors",
|
|
744
|
+
"description": "reactive element by point"
|
|
745
|
+
},
|
|
722
746
|
{
|
|
723
747
|
"name": "useElementHover",
|
|
724
748
|
"package": "core",
|
|
@@ -792,6 +816,13 @@
|
|
|
792
816
|
"category": "Sensors",
|
|
793
817
|
"description": "reactive utility to track or set the focus state of a DOM element"
|
|
794
818
|
},
|
|
819
|
+
{
|
|
820
|
+
"name": "useFocusWithin",
|
|
821
|
+
"package": "core",
|
|
822
|
+
"docs": "https://vueuse.org/core/useFocusWithin/",
|
|
823
|
+
"category": "Sensors",
|
|
824
|
+
"description": "reactive utility to track if an element or one of its decendants has focus"
|
|
825
|
+
},
|
|
795
826
|
{
|
|
796
827
|
"name": "useFps",
|
|
797
828
|
"package": "core",
|
|
@@ -917,6 +948,13 @@
|
|
|
917
948
|
"category": "Sensors",
|
|
918
949
|
"description": "watch for changes being made to the DOM tree"
|
|
919
950
|
},
|
|
951
|
+
{
|
|
952
|
+
"name": "useNavigatorLanguage",
|
|
953
|
+
"package": "core",
|
|
954
|
+
"docs": "https://vueuse.org/core/useNavigatorLanguage/",
|
|
955
|
+
"category": "Sensors",
|
|
956
|
+
"description": "watch for changes being made to the navigator language preference by the user"
|
|
957
|
+
},
|
|
920
958
|
{
|
|
921
959
|
"name": "useNetwork",
|
|
922
960
|
"package": "core",
|
|
@@ -1023,6 +1061,14 @@
|
|
|
1023
1061
|
"category": "Sensors",
|
|
1024
1062
|
"description": "reports changes to the dimensions of an Element's content or the border-box"
|
|
1025
1063
|
},
|
|
1064
|
+
{
|
|
1065
|
+
"name": "useScreenSafeArea",
|
|
1066
|
+
"package": "core",
|
|
1067
|
+
"component": true,
|
|
1068
|
+
"docs": "https://vueuse.org/core/useScreenSafeArea/",
|
|
1069
|
+
"category": "Browser",
|
|
1070
|
+
"description": "reactive `env(safe-area-inset-*)`"
|
|
1071
|
+
},
|
|
1026
1072
|
{
|
|
1027
1073
|
"name": "useScriptTag",
|
|
1028
1074
|
"package": "core",
|
|
@@ -1079,6 +1125,13 @@
|
|
|
1079
1125
|
"category": "State",
|
|
1080
1126
|
"description": "reactive [LocalStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage)/[SessionStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage)"
|
|
1081
1127
|
},
|
|
1128
|
+
{
|
|
1129
|
+
"name": "useStorageAsync",
|
|
1130
|
+
"package": "core",
|
|
1131
|
+
"docs": "https://vueuse.org/core/useStorageAsync/",
|
|
1132
|
+
"category": "State",
|
|
1133
|
+
"description": "reactive Storage in with async support"
|
|
1134
|
+
},
|
|
1082
1135
|
{
|
|
1083
1136
|
"name": "useSwipe",
|
|
1084
1137
|
"package": "core",
|
|
@@ -1093,6 +1146,13 @@
|
|
|
1093
1146
|
"category": "Component",
|
|
1094
1147
|
"description": "shorthand for binding refs to template elements and components inside `v-for`"
|
|
1095
1148
|
},
|
|
1149
|
+
{
|
|
1150
|
+
"name": "useTextSelection",
|
|
1151
|
+
"package": "core",
|
|
1152
|
+
"docs": "https://vueuse.org/core/useTextSelection/",
|
|
1153
|
+
"category": "Sensors",
|
|
1154
|
+
"description": "reactively track user text selection based on [`Window.getSelection`](https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection)"
|
|
1155
|
+
},
|
|
1096
1156
|
{
|
|
1097
1157
|
"name": "useThrottledRefHistory",
|
|
1098
1158
|
"package": "core",
|
|
@@ -1217,13 +1277,6 @@
|
|
|
1217
1277
|
"category": "Sensors",
|
|
1218
1278
|
"description": "reactive window size"
|
|
1219
1279
|
},
|
|
1220
|
-
{
|
|
1221
|
-
"name": "useNuxtDark",
|
|
1222
|
-
"package": "nuxt",
|
|
1223
|
-
"docs": "https://vueuse.org/nuxt/useNuxtDark/",
|
|
1224
|
-
"category": "@Nuxt",
|
|
1225
|
-
"description": "reactive dark mode with auto data persistence for Nuxt"
|
|
1226
|
-
},
|
|
1227
1280
|
{
|
|
1228
1281
|
"name": "useRouteHash",
|
|
1229
1282
|
"package": "router",
|
|
@@ -1316,6 +1369,13 @@
|
|
|
1316
1369
|
"category": "@RxJS",
|
|
1317
1370
|
"description": "use an Observable"
|
|
1318
1371
|
},
|
|
1372
|
+
{
|
|
1373
|
+
"name": "useSubject",
|
|
1374
|
+
"package": "rxjs",
|
|
1375
|
+
"docs": "https://vueuse.org/rxjs/useSubject/",
|
|
1376
|
+
"category": "@RxJS",
|
|
1377
|
+
"description": "bind Subject to ref and propagate value changes both ways"
|
|
1378
|
+
},
|
|
1319
1379
|
{
|
|
1320
1380
|
"name": "useSubscription",
|
|
1321
1381
|
"package": "rxjs",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueuse/nuxt",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
4
4
|
"description": "VueUse Nuxt Module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -23,12 +23,7 @@
|
|
|
23
23
|
"require": "./index.cjs",
|
|
24
24
|
"types": "./index.d.ts"
|
|
25
25
|
},
|
|
26
|
-
"./*": "./*"
|
|
27
|
-
"./module": {
|
|
28
|
-
"import": "./module.mjs",
|
|
29
|
-
"require": "./module.cjs",
|
|
30
|
-
"types": "./module.d.ts"
|
|
31
|
-
}
|
|
26
|
+
"./*": "./*"
|
|
32
27
|
},
|
|
33
28
|
"main": "./index.cjs",
|
|
34
29
|
"types": "./index.d.ts",
|
|
@@ -39,10 +34,8 @@
|
|
|
39
34
|
},
|
|
40
35
|
"homepage": "https://github.com/vueuse/vueuse/tree/main/packages/nuxt#readme",
|
|
41
36
|
"dependencies": {
|
|
42
|
-
"@vueuse/core": "7.
|
|
37
|
+
"@vueuse/core": "7.4.0",
|
|
38
|
+
"local-pkg": "^0.4.0",
|
|
43
39
|
"vue-demi": "*"
|
|
44
|
-
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"nuxt3": "latest"
|
|
47
40
|
}
|
|
48
41
|
}
|
package/module.cjs
DELETED
package/module.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function(): void
|
package/module.mjs
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import { dirname, resolve } from 'path'
|
|
3
|
-
import { fileURLToPath } from 'url'
|
|
4
|
-
|
|
5
|
-
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
6
|
-
|
|
7
|
-
const disabled = [
|
|
8
|
-
'useFetch',
|
|
9
|
-
'toRefs',
|
|
10
|
-
'useCookie',
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Auto import for VueUse in Nuxt
|
|
15
|
-
* Usage:
|
|
16
|
-
*
|
|
17
|
-
* ```ts
|
|
18
|
-
* // nuxt.config.js
|
|
19
|
-
* export deafult {
|
|
20
|
-
* buildModules: [
|
|
21
|
-
* '@vueuse/nuxt'
|
|
22
|
-
* ]
|
|
23
|
-
* }
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export default function() {
|
|
27
|
-
const { nuxt } = this
|
|
28
|
-
|
|
29
|
-
// opt-out Vite deps optimization for VueUse
|
|
30
|
-
nuxt.hook('vite:extend', ({ config }) => {
|
|
31
|
-
config.optimizeDeps = config.optimizeDeps || {}
|
|
32
|
-
config.optimizeDeps.exclude = config.optimizeDeps.exclude || []
|
|
33
|
-
config.optimizeDeps.exclude.push(
|
|
34
|
-
'@vueuse/core',
|
|
35
|
-
'@vueuse/shared',
|
|
36
|
-
'@vueuse/nuxt',
|
|
37
|
-
'@vueuse/integrations',
|
|
38
|
-
'@vueuse/components',
|
|
39
|
-
'@vueuse/motion',
|
|
40
|
-
'@vueuse/firebase',
|
|
41
|
-
'@vueuse/rxjs',
|
|
42
|
-
'@vueuse/sound',
|
|
43
|
-
'@vueuse/head',
|
|
44
|
-
)
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
// add @vueuse/nuxt to transpile target for alias resolution
|
|
48
|
-
nuxt.options.build = nuxt.options.build || {}
|
|
49
|
-
nuxt.options.build.transpile = nuxt.options.build.transpile || []
|
|
50
|
-
nuxt.options.build.transpile.push('@vueuse/nuxt')
|
|
51
|
-
|
|
52
|
-
// auto Import
|
|
53
|
-
nuxt.hook('autoImports:sources', (sources) => {
|
|
54
|
-
if (sources.find(i => i.from === '@vueuse/core' || i.from === '@vueuse/nuxt'))
|
|
55
|
-
return
|
|
56
|
-
const indexes = JSON.parse(fs.readFileSync(resolve(__dirname, './indexes.json'), 'utf-8'))
|
|
57
|
-
sources.push({
|
|
58
|
-
from: '@vueuse/core',
|
|
59
|
-
names: indexes
|
|
60
|
-
.functions
|
|
61
|
-
.filter(i => (i.package === 'core' || i.package === 'shared') && !i.internal)
|
|
62
|
-
.map(i => i.name)
|
|
63
|
-
.filter(i => i.length >= 4 && !disabled.includes(i)),
|
|
64
|
-
})
|
|
65
|
-
sources.push({
|
|
66
|
-
from: '@vueuse/nuxt',
|
|
67
|
-
names: indexes
|
|
68
|
-
.functions
|
|
69
|
-
.filter(i => i.package === 'nuxt' && !i.internal)
|
|
70
|
-
.map(i => i.name),
|
|
71
|
-
})
|
|
72
|
-
})
|
|
73
|
-
}
|