@virou/nuxt 1.0.0 → 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/README.md +3 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.js +41 -0
- package/dist/plugin.mjs +8 -0
- package/package.json +10 -10
- package/dist/module.d.mts +0 -14
- package/dist/module.json +0 -9
- package/dist/module.mjs +0 -28
- package/dist/runtime/plugin.d.ts +0 -2
- package/dist/runtime/plugin.js +0 -6
- package/dist/types.d.mts +0 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<p>
|
|
4
4
|
<a href="https://www.npmjs.com/package/@virou/core"><img src="https://img.shields.io/npm/v/@virou/core.svg?style=flat&colorA=18181B&colorB=39737d" alt="Version"></a>
|
|
5
5
|
<a href="https://www.npmjs.com/package/@virou/core"><img src="https://img.shields.io/npm/dm/@virou/core.svg?style=flat&colorA=18181B&colorB=39737d" alt="Downloads"></a>
|
|
6
|
-
<a href="https://bundlephobia.com/package/@virou/core"><img src="https://img.shields.io/bundlephobia/min/@virou/core?style=flat&colorA=18181B&colorB=39737d" alt="Bundle Size"
|
|
6
|
+
<a href="https://bundlephobia.com/package/@virou/core"><img src="https://img.shields.io/bundlephobia/min/@virou/core?style=flat&colorA=18181B&colorB=39737d" alt="Bundle Size"><a/>
|
|
7
7
|
<a href="https://github.com/tankosinn/virou/tree/main/LICENSE"><img src="https://img.shields.io/github/license/tankosinn/virou.svg?style=flat&colorA=18181B&colorB=39737d" alt="License"></a>
|
|
8
8
|
</p>
|
|
9
9
|
|
|
@@ -66,6 +66,8 @@ createApp(App)
|
|
|
66
66
|
.mount('#app')
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
> ⚠️ Virou doesn’t globally register any components (including `VRouterView`); it only adds a `$virou` global property to store router instances in a `Map<string, VRouterData>`, which are automatically removed when no longer in use.
|
|
70
|
+
|
|
69
71
|
### 🧩 Using with Nuxt
|
|
70
72
|
|
|
71
73
|
Install Virou Nuxt module with your package manager:
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as _nuxt_schema0 from "@nuxt/schema";
|
|
2
|
+
import { VirouPluginOptions } from "@virou/core";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
interface ModuleOptions extends VirouPluginOptions {}
|
|
6
|
+
declare const _default: _nuxt_schema0.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
7
|
+
declare module '@nuxt/schema' {
|
|
8
|
+
interface PublicRuntimeConfig {
|
|
9
|
+
virou?: ModuleOptions;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ModuleOptions, _default as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { dirname, resolve } from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { addComponent, addImports, defineNuxtModule } from "@nuxt/kit";
|
|
4
|
+
import { defu } from "defu";
|
|
5
|
+
|
|
6
|
+
//#region src/index.ts
|
|
7
|
+
const _dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const functions = ["useVRouter"];
|
|
9
|
+
const components = ["VRouterView"];
|
|
10
|
+
var src_default = defineNuxtModule({
|
|
11
|
+
meta: {
|
|
12
|
+
name: "@virou/nuxt",
|
|
13
|
+
configKey: "virou"
|
|
14
|
+
},
|
|
15
|
+
setup(options, nuxt) {
|
|
16
|
+
nuxt.options.runtimeConfig.public.virou = defu(nuxt.options.runtimeConfig.public.virou, options);
|
|
17
|
+
const pluginPath = resolve(_dirname, "./plugin.mjs");
|
|
18
|
+
nuxt.options.plugins = nuxt.options.plugins ?? [];
|
|
19
|
+
nuxt.options.plugins.push(pluginPath);
|
|
20
|
+
nuxt.options.build.transpile.push(pluginPath);
|
|
21
|
+
functions.forEach((name) => {
|
|
22
|
+
addImports({
|
|
23
|
+
name,
|
|
24
|
+
as: name,
|
|
25
|
+
from: "@virou/core",
|
|
26
|
+
priority: -1
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
components.forEach((name) => {
|
|
30
|
+
addComponent({
|
|
31
|
+
name,
|
|
32
|
+
export: name,
|
|
33
|
+
filePath: "@virou/core",
|
|
34
|
+
priority: -1
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { src_default as default };
|
package/dist/plugin.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@virou/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"description": "Virou Nuxt Module",
|
|
6
6
|
"author": "Tankosin<https://github.com/tankosinn>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -25,10 +25,11 @@
|
|
|
25
25
|
],
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"exports": {
|
|
28
|
-
"types": "./dist/
|
|
29
|
-
"default": "./dist/
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"default": "./dist/index.js"
|
|
30
30
|
},
|
|
31
|
-
"main": "./dist/
|
|
31
|
+
"main": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
32
33
|
"files": [
|
|
33
34
|
"dist"
|
|
34
35
|
],
|
|
@@ -36,16 +37,15 @@
|
|
|
36
37
|
"node": ">=18.12.0"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@nuxt/kit": "^
|
|
40
|
+
"@nuxt/kit": "^4.2.2",
|
|
40
41
|
"defu": "^6.1.4",
|
|
41
|
-
"@virou/core": "1.
|
|
42
|
+
"@virou/core": "1.1.1"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
|
-
"@nuxt/
|
|
45
|
-
"
|
|
46
|
-
"nuxt": "3.17.2"
|
|
45
|
+
"@nuxt/schema": "4.2.2",
|
|
46
|
+
"nuxt": "4.2.2"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
|
-
"build": "
|
|
49
|
+
"build": "pnpm -w tsdown -F @virou/nuxt"
|
|
50
50
|
}
|
|
51
51
|
}
|
package/dist/module.d.mts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { VirouPluginOptions } from '@virou/core';
|
|
3
|
-
|
|
4
|
-
interface ModuleOptions extends VirouPluginOptions {
|
|
5
|
-
}
|
|
6
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
7
|
-
|
|
8
|
-
declare module '@nuxt/schema' {
|
|
9
|
-
interface PublicRuntimeConfig {
|
|
10
|
-
virou?: ModuleOptions;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { type ModuleOptions, _default as default };
|
package/dist/module.json
DELETED
package/dist/module.mjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addPlugin, addImports, addComponent } from '@nuxt/kit';
|
|
2
|
-
import { defu } from 'defu';
|
|
3
|
-
|
|
4
|
-
const functions = [
|
|
5
|
-
"useVRouter"
|
|
6
|
-
];
|
|
7
|
-
const components = [
|
|
8
|
-
"VRouterView"
|
|
9
|
-
];
|
|
10
|
-
const module = defineNuxtModule({
|
|
11
|
-
meta: {
|
|
12
|
-
name: "@virou/nuxt",
|
|
13
|
-
configKey: "virou"
|
|
14
|
-
},
|
|
15
|
-
setup(options, nuxt) {
|
|
16
|
-
const resolver = createResolver(import.meta.url);
|
|
17
|
-
nuxt.options.runtimeConfig.public.virou = defu(nuxt.options.runtimeConfig.public.virou, options);
|
|
18
|
-
addPlugin(resolver.resolve("./runtime/plugin"));
|
|
19
|
-
functions.forEach((name) => {
|
|
20
|
-
addImports({ name, as: name, from: "@virou/core", priority: -1 });
|
|
21
|
-
});
|
|
22
|
-
components.forEach((name) => {
|
|
23
|
-
addComponent({ name, export: name, filePath: "@virou/core", priority: -1 });
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export { module as default };
|
package/dist/runtime/plugin.d.ts
DELETED
package/dist/runtime/plugin.js
DELETED
package/dist/types.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { type ModuleOptions, default } from './module.mjs'
|