@devframes/vite 0.9.0-beta.4 → 0.9.0-beta.8
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/hub-client.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createDevframeClientHost } from "@devframes/hub/client";
|
|
2
|
+
import { DEVFRAMES_HUB_BASE } from "@devframes/hub/constants";
|
|
2
3
|
//#region src/hub-client.ts
|
|
3
|
-
/** Default hub mount base — mirrors `@devframes/hub`'s `DEVFRAMES_HUB_BASE`. */
|
|
4
|
-
const DEVFRAMES_HUB_BASE = "/__devframes/";
|
|
5
4
|
/**
|
|
6
5
|
* Boot the devframes-hub **client runtime** in the host page — the browser
|
|
7
6
|
* half of {@link import('./hub').viteDevframeHub}. Connects RPC to the hub
|
package/dist/hub.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DevframeHubUi, DockRendererRegistration, InitHubOptions } from "@devframes/hub/initiate";
|
|
2
|
-
import { Plugin } from "vite";
|
|
3
2
|
import { DevframeHubContext } from "@devframes/hub/node";
|
|
4
3
|
import { ClientScriptEntry } from "@devframes/hub/types";
|
|
4
|
+
import { Plugin } from "vite";
|
|
5
5
|
//#region src/hub.d.ts
|
|
6
6
|
interface ViteDevframeHubOptions {
|
|
7
7
|
/**
|
|
@@ -93,7 +93,7 @@ interface ViteDevframeHubOptions {
|
|
|
93
93
|
* (`@vitejs/devtools-kit`) integrates the same hub protocol natively and is
|
|
94
94
|
* the recommended path for a Vite app, so this plugin emits a one-time notice
|
|
95
95
|
* to that effect (silence it with `{ quiet: true }`). For dev-serving a
|
|
96
|
-
* single devframe's own SPA, reach for `@devframes/vite/
|
|
96
|
+
* single devframe's own SPA, reach for `@devframes/vite/single` instead.
|
|
97
97
|
*/
|
|
98
98
|
declare function viteDevframeHub(options?: ViteDevframeHubOptions): Plugin;
|
|
99
99
|
//#endregion
|
package/dist/hub.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Server } from "node:http";
|
|
2
1
|
import process from "node:process";
|
|
3
|
-
import {
|
|
2
|
+
import { Server } from "node:http";
|
|
3
|
+
import { DEVFRAMES_HUB_BASE, normalizeHubBase } from "@devframes/hub/constants";
|
|
4
|
+
import { initHub } from "@devframes/hub/initiate";
|
|
4
5
|
//#region src/hub.ts
|
|
5
6
|
let recommendedViteDevtools = false;
|
|
6
7
|
function recommendViteDevtools() {
|
|
@@ -21,10 +22,10 @@ function recommendViteDevtools() {
|
|
|
21
22
|
* (`@vitejs/devtools-kit`) integrates the same hub protocol natively and is
|
|
22
23
|
* the recommended path for a Vite app, so this plugin emits a one-time notice
|
|
23
24
|
* to that effect (silence it with `{ quiet: true }`). For dev-serving a
|
|
24
|
-
* single devframe's own SPA, reach for `@devframes/vite/
|
|
25
|
+
* single devframe's own SPA, reach for `@devframes/vite/single` instead.
|
|
25
26
|
*/
|
|
26
27
|
function viteDevframeHub(options = {}) {
|
|
27
|
-
const base =
|
|
28
|
+
const base = normalizeHubBase(options.base ?? DEVFRAMES_HUB_BASE);
|
|
28
29
|
let viteConfig;
|
|
29
30
|
let instance;
|
|
30
31
|
let embeddedSrc;
|
|
@@ -117,10 +118,5 @@ function attachClientScripts(devframes, clientScripts) {
|
|
|
117
118
|
};
|
|
118
119
|
});
|
|
119
120
|
}
|
|
120
|
-
function normalizeBase(base) {
|
|
121
|
-
let out = base.startsWith("/") ? base : `/${base}`;
|
|
122
|
-
if (!out.endsWith("/")) out = `${out}/`;
|
|
123
|
-
return out;
|
|
124
|
-
}
|
|
125
121
|
//#endregion
|
|
126
122
|
export { viteDevframeHub };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/index.ts
|
|
2
|
-
throw new Error("[@devframes/vite] has no root export. Import from a scoped subpath instead:\n • \"@devframes/vite/
|
|
2
|
+
throw new Error("[@devframes/vite] has no root export. Import from a scoped subpath instead:\n • \"@devframes/vite/single\" — dev-serve one devframe's SPA with Vite\n • \"@devframes/vite/hub\" — mount a devframes-hub inside a Vite app\n");
|
|
3
3
|
//#endregion
|
|
4
4
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import { Plugin } from "vite";
|
|
2
3
|
import { DevframeDefinition, McpRouteOptions } from "devframe";
|
|
3
4
|
import { DevframeAuthHandler } from "devframe/node/auth";
|
|
4
|
-
|
|
5
|
-
//#region src/dev-spa.d.ts
|
|
5
|
+
//#region src/single.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* The slice of a Vite dev server these plugins touch — deliberately
|
|
8
8
|
* narrower than Vite's real `ViteDevServer` (which carries the module
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import process from "node:process";
|
|
1
2
|
import { initDevframe } from "devframe/initiate";
|
|
2
3
|
import { diagnostics, normalizeBasePath, resolveBasePath } from "devframe/internal";
|
|
4
|
+
import { resolveStaticAssetsSource } from "devframe/utils/remote-assets";
|
|
3
5
|
import { serveStaticNodeMiddleware } from "devframe/utils/serve-static";
|
|
4
|
-
import { resolve } from "pathe";
|
|
5
|
-
//#region src/
|
|
6
|
+
import { join, resolve } from "pathe";
|
|
7
|
+
//#region src/single.ts
|
|
6
8
|
/**
|
|
7
9
|
* Statically mount a devframe's built SPA (`def.cli.distDir`) at
|
|
8
10
|
* `options.base` inside an existing Vite dev server. No RPC server is
|
|
@@ -22,7 +24,8 @@ function devframeVitePlugin(d, options = {}) {
|
|
|
22
24
|
apply: "serve",
|
|
23
25
|
configureServer(server) {
|
|
24
26
|
if (!distDir) return;
|
|
25
|
-
|
|
27
|
+
const source = resolveStaticAssetsSource(distDir, join(process.cwd(), "node_modules", `.${d.id}`, "devframe"));
|
|
28
|
+
server.middlewares.use(base, serveStaticNodeMiddleware(typeof source === "string" ? resolve(source) : source));
|
|
26
29
|
}
|
|
27
30
|
};
|
|
28
31
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devframes/vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.9.0-beta.
|
|
4
|
+
"version": "0.9.0-beta.8",
|
|
5
5
|
"description": "Vite plugin for mounting a devframe inside any Vite-based host (Astro, SolidStart, Nuxt, plain Vite apps).",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"exports": {
|
|
22
22
|
".": "./dist/index.mjs",
|
|
23
|
-
"./
|
|
23
|
+
"./single": "./dist/single.mjs",
|
|
24
24
|
"./hub": "./dist/hub.mjs",
|
|
25
25
|
"./hub/client": "./dist/hub-client.mjs",
|
|
26
26
|
"./package.json": "./package.json"
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
],
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"vite": "^7.0.0 || ^8.0.0",
|
|
34
|
-
"@devframes/hub
|
|
35
|
-
"
|
|
36
|
-
"
|
|
34
|
+
"@devframes/hub": "0.9.0-beta.8",
|
|
35
|
+
"@devframes/hub-ui": "0.9.0-beta.8",
|
|
36
|
+
"devframe": "0.9.0-beta.8"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
|
39
39
|
"@devframes/hub": {
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"tsdown": "^0.22.14",
|
|
57
57
|
"vite": "^8.2.1",
|
|
58
58
|
"vitest": "^4.1.10",
|
|
59
|
-
"@devframes/hub": "0.9.0-beta.
|
|
60
|
-
"@devframes/hub-ui": "0.9.0-beta.
|
|
61
|
-
"devframe": "0.9.0-beta.
|
|
59
|
+
"@devframes/hub": "0.9.0-beta.8",
|
|
60
|
+
"@devframes/hub-ui": "0.9.0-beta.8",
|
|
61
|
+
"devframe": "0.9.0-beta.8"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "tsdown",
|