@revojs/vue 0.1.44 → 0.1.46
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/index.d.mts +2 -0
- package/dist/index.mjs +37 -35
- package/dist/module/app.ts +1 -1
- package/dist/module/entry.ts +1 -1
- package/dist/module/routes/[...]/get.ts +1 -1
- package/package.json +2 -1
- package/src/types/index.d.ts +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { Options } from "@vitejs/plugin-vue";
|
|
1
2
|
import { App, Module } from "revojs";
|
|
2
3
|
|
|
3
4
|
//#region src/index.d.ts
|
|
4
5
|
interface VueOptions {
|
|
5
6
|
serverSideRendering?: boolean;
|
|
7
|
+
compilerOption?: Options;
|
|
6
8
|
}
|
|
7
9
|
declare function addPages(app: App, path: string): void;
|
|
8
10
|
declare function vue(options?: VueOptions): Module;
|
package/dist/index.mjs
CHANGED
|
@@ -1,44 +1,46 @@
|
|
|
1
|
-
import
|
|
1
|
+
import vueCompiler from "@vitejs/plugin-vue";
|
|
2
|
+
import { addRoutes, addTypes, useKit } from "revojs/kit";
|
|
2
3
|
//#region src/index.ts
|
|
3
4
|
function addPages(app, path) {
|
|
4
5
|
app.config.sources.pages?.entries.push(path);
|
|
5
6
|
}
|
|
6
7
|
function vue(options) {
|
|
7
|
-
return {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
return { setup(app) {
|
|
9
|
+
const { fromModule } = useKit(import.meta.url);
|
|
10
|
+
app.config.template.head.children.push({
|
|
11
|
+
tagName: "script",
|
|
12
|
+
attributes: { type: "module" },
|
|
13
|
+
children: [`import "${fromModule("./module/entry.ts")}"`]
|
|
14
|
+
}, {
|
|
15
|
+
tagName: "script",
|
|
16
|
+
attributes: {
|
|
17
|
+
id: "states",
|
|
18
|
+
type: "application/json"
|
|
19
|
+
},
|
|
20
|
+
children: ["<!-- STATES -->"]
|
|
21
|
+
});
|
|
22
|
+
app.config.template.body.children.push({
|
|
23
|
+
tagName: "div",
|
|
24
|
+
attributes: { id: "app" },
|
|
25
|
+
children: ["<!-- APP -->"]
|
|
26
|
+
});
|
|
27
|
+
addRoutes(app, fromModule("./module/routes"));
|
|
28
|
+
addTypes(app, "revojs-vue", () => `import "@revojs/vue/types"`);
|
|
29
|
+
return {
|
|
30
|
+
variables: { SERVER_SIDE_RENDERING: options?.serverSideRendering ?? true },
|
|
31
|
+
sources: { pages: {
|
|
32
|
+
match: "**/{page,layout}.vue",
|
|
33
|
+
entries: ["./routes"]
|
|
34
|
+
} },
|
|
35
|
+
vite: {
|
|
36
|
+
plugins: [vueCompiler(options?.compilerOption)],
|
|
37
|
+
resolve: { alias: {
|
|
38
|
+
"#vue/app": fromModule("./module/app.ts"),
|
|
39
|
+
"#vue/main": fromModule("./module/main.vue")
|
|
14
40
|
} }
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const { fromModule } = useKit(import.meta.url);
|
|
19
|
-
app.config.template.head.children.push({
|
|
20
|
-
tagName: "script",
|
|
21
|
-
attributes: { type: "module" },
|
|
22
|
-
children: [`import "${fromModule("./module/entry.ts")}"`]
|
|
23
|
-
}, {
|
|
24
|
-
tagName: "script",
|
|
25
|
-
attributes: {
|
|
26
|
-
id: "states",
|
|
27
|
-
type: "application/json"
|
|
28
|
-
},
|
|
29
|
-
children: ["<!-- STATES -->"]
|
|
30
|
-
});
|
|
31
|
-
app.config.template.body.children.push({
|
|
32
|
-
tagName: "div",
|
|
33
|
-
attributes: { id: "app" },
|
|
34
|
-
children: ["<!-- APP -->"]
|
|
35
|
-
});
|
|
36
|
-
addRoutes(app, fromModule("./module/routes"));
|
|
37
|
-
addAlias(app, "vue/app", fromModule("./module/app.ts"));
|
|
38
|
-
addAlias(app, "vue/main", fromModule("./module/main.vue"));
|
|
39
|
-
addTypes(app, "revojs-vue", () => `import "@revojs/vue/types"`);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
} };
|
|
42
44
|
}
|
|
43
45
|
//#endregion
|
|
44
46
|
export { addPages, vue };
|
package/dist/module/app.ts
CHANGED
package/dist/module/entry.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import createApp from "#alias/vue/app";
|
|
2
1
|
import client from "#client";
|
|
2
|
+
import createApp from "#vue/app";
|
|
3
3
|
import { defineRoute, sendOk, useServer } from "revojs";
|
|
4
4
|
import { renderToString } from "vue/server-renderer";
|
|
5
5
|
import { isServerSideRendering } from "../../../client";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revojs/vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.46",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "tellua/revojs",
|
|
6
6
|
"files": [
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"watch": "tsdown -w"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
+
"@vitejs/plugin-vue": "^6.0.5",
|
|
32
33
|
"revojs": "*",
|
|
33
34
|
"vue": "^3.5.30",
|
|
34
35
|
"vue-router": "^5.0.3"
|
package/src/types/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
declare module "#
|
|
1
|
+
declare module "#vue/app" {
|
|
2
2
|
import type { Scope } from "revojs";
|
|
3
3
|
import type { App } from "vue";
|
|
4
4
|
|
|
5
5
|
export default function createApp(scope: Scope): Promise<App>;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
declare module "#
|
|
8
|
+
declare module "#vue/main" {
|
|
9
9
|
import type { Component } from "vue";
|
|
10
10
|
|
|
11
11
|
const main: Component;
|