@devframes/plugin-code-server 0.9.8 → 0.9.10
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 +10 -10
- package/bin.mjs +1 -1
- package/dist/{constants-DtQz38ex.d.mts → constants-DTS2klFC.d.mts} +2 -2
- package/dist/{cli.d.mts → node/cli.d.mts} +3 -3
- package/dist/{cli.mjs → node/cli.mjs} +4 -4
- package/dist/{constants.d.mts → node/constants.d.mts} +1 -1
- package/dist/{constants.mjs → node/constants.mjs} +2 -2
- package/dist/node/index.d.mts +15 -473
- package/dist/node/index.mjs +3 -761
- package/dist/{rpc → node/rpc}/index.d.mts +1 -1
- package/dist/node/rpc/index.mjs +2 -0
- package/dist/node/setup.d.mts +501 -0
- package/dist/node/setup.mjs +801 -0
- package/dist/{types.d.mts → node/types.d.mts} +10 -10
- package/dist/{vite.d.mts → node/vite.d.mts} +1 -1
- package/dist/{vite.mjs → node/vite.mjs} +2 -2
- package/dist/{src-CNJYQ3UQ.mjs → node-C_wU5QYh.mjs} +20 -5
- package/dist/{rpc-EXj5vBYf.mjs → rpc-Df9IRgPd.mjs} +3 -3
- package/package.json +22 -18
- package/dist/client/index.d.mts +0 -13
- package/dist/client/index.mjs +0 -21
- package/dist/index.d.mts +0 -23
- package/dist/index.mjs +0 -3
- package/dist/rpc/index.mjs +0 -2
- /package/dist/{types.mjs → node/types.mjs} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
//#region src/types.d.ts
|
|
1
|
+
//#region src/node/types.d.ts
|
|
2
2
|
/** Lifecycle state of the managed editor process. */
|
|
3
3
|
type CodeServerStatus = 'stopped' | 'starting' | 'running' | 'error';
|
|
4
4
|
/**
|
|
5
5
|
* Which editor server binary the plugin launches in `mode: 'local'`:
|
|
6
6
|
*
|
|
7
|
-
* - `'code-server'
|
|
7
|
+
* - `'code-server'`: Coder's open-source
|
|
8
8
|
* [code-server](https://github.com/coder/code-server) (`code-server …`). The
|
|
9
9
|
* plugin runs it with password auth and hands the client a session cookie, so
|
|
10
10
|
* the embedded editor opens already signed in.
|
|
11
|
-
* - `'ms-code-serve-web'
|
|
11
|
+
* - `'ms-code-serve-web'`: Microsoft's official
|
|
12
12
|
* [`code serve-web`](https://code.visualstudio.com/docs/remote/vscode-server)
|
|
13
13
|
* (ships with the `code` CLI). The plugin generates a connection token and
|
|
14
14
|
* hands it to the client as a `?tkn=` query parameter.
|
|
@@ -17,9 +17,9 @@ type CodeServerBackend = 'code-server' | 'ms-code-serve-web';
|
|
|
17
17
|
/**
|
|
18
18
|
* How the editor is served:
|
|
19
19
|
*
|
|
20
|
-
* - `'local'
|
|
20
|
+
* - `'local'`: a local server ({@link CodeServerBackend}) embedded from this
|
|
21
21
|
* machine's origin.
|
|
22
|
-
* - `'tunnel'
|
|
22
|
+
* - `'tunnel'`: Microsoft's `code tunnel`, which registers a remote tunnel and
|
|
23
23
|
* embeds the hosted `vscode.dev` editor. First launch prints a device-login
|
|
24
24
|
* prompt (surfaced as {@link CodeServerLogin}); authentication is handled by
|
|
25
25
|
* `vscode.dev` itself, not this plugin.
|
|
@@ -70,7 +70,7 @@ interface CodeServerServerInfo {
|
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* The full shared-state payload broadcast to subscribed clients. Deliberately
|
|
73
|
-
* carries no authentication material
|
|
73
|
+
* carries no authentication material; see {@link CodeServerConnect}.
|
|
74
74
|
*/
|
|
75
75
|
interface CodeServerSharedState {
|
|
76
76
|
detection: CodeServerDetection;
|
|
@@ -79,7 +79,7 @@ interface CodeServerSharedState {
|
|
|
79
79
|
/**
|
|
80
80
|
* How the client reaches the running editor. May carry a secret (session
|
|
81
81
|
* cookie or connection token), so it is returned only from the `start` /
|
|
82
|
-
* `status` RPCs to the already-authorized client
|
|
82
|
+
* `status` RPCs to the already-authorized client, never published to shared
|
|
83
83
|
* state.
|
|
84
84
|
*
|
|
85
85
|
* - `url` set → embed it verbatim (tunnel mode's `vscode.dev` URL).
|
|
@@ -98,11 +98,11 @@ interface CodeServerConnect {
|
|
|
98
98
|
value: string;
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
/** Result of the `status` query
|
|
101
|
+
/** Result of the `status` query: shared state plus connect info when running. */
|
|
102
102
|
interface CodeServerStatusResult extends CodeServerSharedState {
|
|
103
103
|
connect?: CodeServerConnect;
|
|
104
104
|
}
|
|
105
|
-
/** Result of the `start` action
|
|
105
|
+
/** Result of the `start` action, identical shape to {@link CodeServerStatusResult}. */
|
|
106
106
|
type CodeServerStartResult = CodeServerStatusResult;
|
|
107
107
|
/** Wire payload for the `start` RPC. */
|
|
108
108
|
interface CodeServerStartRequest {
|
|
@@ -169,7 +169,7 @@ interface CodeServerOptions {
|
|
|
169
169
|
random?: boolean;
|
|
170
170
|
/**
|
|
171
171
|
* Require the trust handshake on the standalone launcher server. Enabled
|
|
172
|
-
* by default
|
|
172
|
+
* by default; `--open` embeds the current OTP in the opened URL, so the
|
|
173
173
|
* tab authenticates automatically without extra prompts. Hosted adapters
|
|
174
174
|
* manage their own auth and ignore this.
|
|
175
175
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CodeServerOptions } from "./types.mjs";
|
|
2
2
|
import { DevframeViteBridgeOptions, DevframeVitePlugin } from "@devframes/vite/single";
|
|
3
|
-
//#region src/vite.d.ts
|
|
3
|
+
//#region src/node/vite.d.ts
|
|
4
4
|
interface CodeServerViteOptions extends CodeServerOptions {
|
|
5
5
|
/** Forwarded to the underlying `devframeViteBridge`/`devframeVitePlugin` (mount base, etc.). */
|
|
6
6
|
vite?: DevframeViteBridgeOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createCodeServerDevframe } from "
|
|
1
|
+
import { t as createCodeServerDevframe } from "../node-C_wU5QYh.mjs";
|
|
2
2
|
import { devframeViteBridge, devframeVitePlugin } from "@devframes/vite/single";
|
|
3
|
-
//#region src/vite.ts
|
|
3
|
+
//#region src/node/vite.ts
|
|
4
4
|
/**
|
|
5
5
|
* Mount the code-server launcher into an existing Vite dev server. Returns two
|
|
6
6
|
* plugins: a bridge that starts the devframe RPC + WebSocket server (so the
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { PLUGIN_ID } from "./constants.mjs";
|
|
1
|
+
import { PLUGIN_ID } from "./node/constants.mjs";
|
|
2
2
|
import { defineDevframe } from "devframe";
|
|
3
3
|
//#region package.json
|
|
4
4
|
var name = "@devframes/plugin-code-server";
|
|
5
|
-
var version = "0.9.
|
|
5
|
+
var version = "0.9.10";
|
|
6
6
|
var description = "Devframe plugin that runs VS Code in the browser as an embedded editor panel.";
|
|
7
7
|
var homepage = "https://github.com/devframes/devframe#readme";
|
|
8
8
|
//#endregion
|
|
9
|
-
//#region src/index.ts
|
|
9
|
+
//#region src/node/index.ts
|
|
10
10
|
const remoteAssets = {
|
|
11
11
|
package: `${name}--assets`,
|
|
12
12
|
version
|
|
@@ -14,7 +14,7 @@ const remoteAssets = {
|
|
|
14
14
|
/**
|
|
15
15
|
* Build a {@link DevframeDefinition} for the code-server panel. The same
|
|
16
16
|
* definition runs standalone (`createCac`), mounts into a Vite host
|
|
17
|
-
* (`/vite`), or docks inside a hub
|
|
17
|
+
* (`/vite`), or docks inside a hub, since its `setup` only relies on the core
|
|
18
18
|
* devframe RPC + shared-state surface.
|
|
19
19
|
*
|
|
20
20
|
* @experimental This plugin is experimental and may change without a major
|
|
@@ -38,6 +38,16 @@ function createCodeServerDevframe(options = {}) {
|
|
|
38
38
|
homepage,
|
|
39
39
|
description,
|
|
40
40
|
icon: "ph:code-duotone",
|
|
41
|
+
/**
|
|
42
|
+
* The whole surface proxies a live `code-server` process, so a static
|
|
43
|
+
* build would only produce a dead shell of the tool: `createBuild`
|
|
44
|
+
* refuses and a hub static build skips this dock.
|
|
45
|
+
*/
|
|
46
|
+
capabilities: { build: false },
|
|
47
|
+
/**
|
|
48
|
+
* Leave undefined so `resolveBasePath` picks `/` standalone and
|
|
49
|
+
* `/__<id>/` when hosted. Authors override via `options.basePath`.
|
|
50
|
+
*/
|
|
41
51
|
basePath: options.basePath,
|
|
42
52
|
cli: {
|
|
43
53
|
command: options.command ?? "devframe-code-server",
|
|
@@ -45,10 +55,15 @@ function createCodeServerDevframe(options = {}) {
|
|
|
45
55
|
portRange: options.portRange,
|
|
46
56
|
random: options.random,
|
|
47
57
|
distDir: resolvedDist,
|
|
58
|
+
/**
|
|
59
|
+
* Gate the standalone launcher by default; `maybeOpenBrowser` folds the
|
|
60
|
+
* current OTP into the `--open` URL so the tab lands already trusted.
|
|
61
|
+
* Hosted adapters supply their own auth layer and ignore this.
|
|
62
|
+
*/
|
|
48
63
|
auth: options.auth ?? true
|
|
49
64
|
},
|
|
50
65
|
async setup(ctx) {
|
|
51
|
-
const { setupCodeServer } = await import("./node/
|
|
66
|
+
const { setupCodeServer } = await import("./node/setup.mjs");
|
|
52
67
|
await setupCodeServer(ctx, options);
|
|
53
68
|
}
|
|
54
69
|
});
|
|
@@ -44,7 +44,7 @@ function getCodeServerSupervisor(ctx) {
|
|
|
44
44
|
return supervisor;
|
|
45
45
|
}
|
|
46
46
|
//#endregion
|
|
47
|
-
//#region src/rpc/functions/detect.ts
|
|
47
|
+
//#region src/node/rpc/functions/detect.ts
|
|
48
48
|
const detect = defineRpcFunction({
|
|
49
49
|
name: "devframes:plugin:code-server:detect",
|
|
50
50
|
type: "query",
|
|
@@ -56,7 +56,7 @@ const detect = defineRpcFunction({
|
|
|
56
56
|
setup: (ctx) => ({ handler: () => getCodeServerSupervisor(ctx).detect() })
|
|
57
57
|
});
|
|
58
58
|
//#endregion
|
|
59
|
-
//#region src/rpc/functions/start.ts
|
|
59
|
+
//#region src/node/rpc/functions/start.ts
|
|
60
60
|
const start = defineRpcFunction({
|
|
61
61
|
name: "devframes:plugin:code-server:start",
|
|
62
62
|
type: "action",
|
|
@@ -68,7 +68,7 @@ const start = defineRpcFunction({
|
|
|
68
68
|
setup: (ctx) => ({ handler: (req = {}) => getCodeServerSupervisor(ctx).start(req) })
|
|
69
69
|
});
|
|
70
70
|
//#endregion
|
|
71
|
-
//#region src/rpc/index.ts
|
|
71
|
+
//#region src/node/rpc/index.ts
|
|
72
72
|
const serverFunctions = [
|
|
73
73
|
detect,
|
|
74
74
|
defineRpcFunction({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devframes/plugin-code-server",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.10",
|
|
5
5
|
"description": "Devframe plugin that runs VS Code in the browser as an embedded editor panel.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -21,17 +21,16 @@
|
|
|
21
21
|
],
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"exports": {
|
|
24
|
-
".": "./dist/index.mjs",
|
|
25
|
-
"./
|
|
26
|
-
"./
|
|
27
|
-
"./
|
|
28
|
-
"./
|
|
29
|
-
"./
|
|
30
|
-
"./
|
|
31
|
-
"./vite": "./dist/vite.mjs",
|
|
24
|
+
".": "./dist/node/index.mjs",
|
|
25
|
+
"./cli": "./dist/node/cli.mjs",
|
|
26
|
+
"./constants": "./dist/node/constants.mjs",
|
|
27
|
+
"./node": "./dist/node/setup.mjs",
|
|
28
|
+
"./rpc": "./dist/node/rpc/index.mjs",
|
|
29
|
+
"./types": "./dist/node/types.mjs",
|
|
30
|
+
"./vite": "./dist/node/vite.mjs",
|
|
32
31
|
"./package.json": "./package.json"
|
|
33
32
|
},
|
|
34
|
-
"types": "./dist/index.d.mts",
|
|
33
|
+
"types": "./dist/node/index.d.mts",
|
|
35
34
|
"bin": {
|
|
36
35
|
"devframe-code-server": "./bin.mjs"
|
|
37
36
|
},
|
|
@@ -40,8 +39,8 @@
|
|
|
40
39
|
"dist"
|
|
41
40
|
],
|
|
42
41
|
"peerDependencies": {
|
|
43
|
-
"@devframes/plugin-code-server--assets": "0.9.
|
|
44
|
-
"devframe": "0.9.
|
|
42
|
+
"@devframes/plugin-code-server--assets": "0.9.10",
|
|
43
|
+
"devframe": "0.9.10",
|
|
45
44
|
"vite": "^8.0.0"
|
|
46
45
|
},
|
|
47
46
|
"peerDependenciesMeta": {
|
|
@@ -53,19 +52,21 @@
|
|
|
53
52
|
}
|
|
54
53
|
},
|
|
55
54
|
"dependencies": {
|
|
56
|
-
"@devframes/vite": "0.9.
|
|
55
|
+
"@devframes/vite": "0.9.10",
|
|
57
56
|
"cac": "^7.0.0"
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
60
59
|
"@antfu/design": "^0.4.0",
|
|
61
|
-
"@devframes/plugin-code-server--assets": "0.9.
|
|
60
|
+
"@devframes/plugin-code-server--assets": "0.9.10",
|
|
62
61
|
"@iconify-json/ph": "^1.2.2",
|
|
63
62
|
"@storybook/addon-docs": "^10.5.10",
|
|
64
63
|
"@storybook/vue3-vite": "^10.5.10",
|
|
65
64
|
"@types/node": "^26.4.0",
|
|
66
65
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
67
66
|
"colorjs.io": "^0.7.1",
|
|
68
|
-
"devframe": "0.9.
|
|
67
|
+
"devframe": "0.9.10",
|
|
68
|
+
"h3": "^2.0.1-rc.29",
|
|
69
|
+
"pathe": "^2.0.3",
|
|
69
70
|
"storybook": "^10.5.10",
|
|
70
71
|
"tsdown": "^0.22.14",
|
|
71
72
|
"unocss": "^66.8.1",
|
|
@@ -74,12 +75,15 @@
|
|
|
74
75
|
"vue": "^3.5.42"
|
|
75
76
|
},
|
|
76
77
|
"scripts": {
|
|
77
|
-
"build": "tsdown && vite build --config
|
|
78
|
+
"build": "tsdown && vite build --config app/vite.config.ts",
|
|
79
|
+
"build:app": "vite build --config app/vite.config.ts",
|
|
78
80
|
"watch": "tsdown --watch",
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
+
"dev": "vite --config app/vite.config.ts --host",
|
|
82
|
+
"play": "pnpm run build && node playgrounds/server.mjs",
|
|
81
83
|
"storybook": "storybook dev -p 6013",
|
|
82
84
|
"build-storybook": "storybook build",
|
|
85
|
+
"cli:build": "node bin.mjs build --out-dir dist/static",
|
|
86
|
+
"typecheck": "tsc --noEmit",
|
|
83
87
|
"test": "vitest run"
|
|
84
88
|
}
|
|
85
89
|
}
|
package/dist/client/index.d.mts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CodeServerBackend, CodeServerConnect, CodeServerDetection, CodeServerLogin, CodeServerMode, CodeServerServerInfo, CodeServerSharedState, CodeServerStartResult, CodeServerStatus, CodeServerStatusResult } from "../types.mjs";
|
|
2
|
-
import { o as STATE_KEY } from "../constants-DtQz38ex.mjs";
|
|
3
|
-
import { DevframeConnectionStatus, DevframeRpcClient, DevframeRpcClientOptions } from "devframe/client";
|
|
4
|
-
import { ConnectionMeta } from "devframe/types";
|
|
5
|
-
//#region src/client/index.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Connect to the code-server plugin's devframe backend. A thin, typed wrapper
|
|
8
|
-
* around devframe's {@link connectDevframe}; the SPA derives its base from
|
|
9
|
-
* `document.baseURI`, so no options are required in the common case.
|
|
10
|
-
*/
|
|
11
|
-
declare function connectCodeServer(options?: DevframeRpcClientOptions): Promise<DevframeRpcClient>;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { type CodeServerBackend, type CodeServerConnect, type CodeServerDetection, type CodeServerLogin, type CodeServerMode, type CodeServerServerInfo, type CodeServerSharedState, type CodeServerStartResult, type CodeServerStatus, type CodeServerStatusResult, type ConnectionMeta, type DevframeConnectionStatus, type DevframeRpcClient, STATE_KEY, connectCodeServer };
|
package/dist/client/index.mjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { connectDevframe } from "devframe/client";
|
|
2
|
-
//#region src/constants.ts
|
|
3
|
-
/**
|
|
4
|
-
* Shared-state key holding the serializable, secret-free server status and
|
|
5
|
-
* detection result. Authentication material is never published here — it is
|
|
6
|
-
* returned only from the `start` / `status` RPCs to the already-authorized
|
|
7
|
-
* client (see {@link import('./types').CodeServerConnect}).
|
|
8
|
-
*/
|
|
9
|
-
const STATE_KEY = "devframes:plugin:code-server:state";
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region src/client/index.ts
|
|
12
|
-
/**
|
|
13
|
-
* Connect to the code-server plugin's devframe backend. A thin, typed wrapper
|
|
14
|
-
* around devframe's {@link connectDevframe}; the SPA derives its base from
|
|
15
|
-
* `document.baseURI`, so no options are required in the common case.
|
|
16
|
-
*/
|
|
17
|
-
function connectCodeServer(options) {
|
|
18
|
-
return connectDevframe(options);
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
export { STATE_KEY, connectCodeServer };
|
package/dist/index.d.mts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CodeServerBackend, CodeServerConnect, CodeServerDetection, CodeServerLogin, CodeServerMode, CodeServerOptions, CodeServerServerInfo, CodeServerSharedState, CodeServerStartRequest, CodeServerStartResult, CodeServerStatus, CodeServerStatusResult, CodeServerTunnelOptions } from "./types.mjs";
|
|
2
|
-
import { i as PLUGIN_ID, l as getCookieSessionName, n as DEFAULT_PORT, o as STATE_KEY, t as DEFAULT_CODE_SERVER_PORT } from "./constants-DtQz38ex.mjs";
|
|
3
|
-
import { DevframeDefinition } from "devframe";
|
|
4
|
-
//#region src/index.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Build a {@link DevframeDefinition} for the code-server panel. The same
|
|
7
|
-
* definition runs standalone (`createCac`), mounts into a Vite host
|
|
8
|
-
* (`/vite`), or docks inside a hub — its `setup` only relies on the core
|
|
9
|
-
* devframe RPC + shared-state surface.
|
|
10
|
-
*
|
|
11
|
-
* @experimental This plugin is experimental and may change without a major
|
|
12
|
-
* version bump until it stabilizes.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* import { createCodeServerDevframe } from '@devframes/plugin-code-server'
|
|
17
|
-
*
|
|
18
|
-
* export default createCodeServerDevframe({ serverPort: 8080 })
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
declare function createCodeServerDevframe(options?: CodeServerOptions): DevframeDefinition;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { type CodeServerBackend, type CodeServerConnect, type CodeServerDetection, type CodeServerLogin, type CodeServerMode, type CodeServerOptions, type CodeServerServerInfo, type CodeServerSharedState, type CodeServerStartRequest, type CodeServerStartResult, type CodeServerStatus, type CodeServerStatusResult, type CodeServerTunnelOptions, DEFAULT_CODE_SERVER_PORT, DEFAULT_PORT, PLUGIN_ID, STATE_KEY, createCodeServerDevframe, createCodeServerDevframe as default, getCookieSessionName };
|
package/dist/index.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { t as createCodeServerDevframe } from "./src-CNJYQ3UQ.mjs";
|
|
2
|
-
import { DEFAULT_CODE_SERVER_PORT, DEFAULT_PORT, PLUGIN_ID, STATE_KEY, getCookieSessionName } from "./constants.mjs";
|
|
3
|
-
export { DEFAULT_CODE_SERVER_PORT, DEFAULT_PORT, PLUGIN_ID, STATE_KEY, createCodeServerDevframe, createCodeServerDevframe as default, getCookieSessionName };
|
package/dist/rpc/index.mjs
DELETED
|
File without changes
|