devframe 0.2.1 → 0.2.3
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/adapters/build.d.mts +1 -1
- package/dist/adapters/build.mjs +6 -6
- package/dist/adapters/cli.d.mts +1 -1
- package/dist/adapters/cli.mjs +2 -2
- package/dist/adapters/dev.d.mts +2 -2
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.mjs +3 -3
- package/dist/client/index.d.mts +18 -4
- package/dist/client/index.mjs +314 -8
- package/dist/{context-BaX-SZti.d.mts → context-GUzIxrEK.d.mts} +1 -1
- package/dist/{dev-CA0-8Amw.mjs → dev-BVtS7qBK.mjs} +4 -4
- package/dist/{devframe-BXZUBuy6.d.mts → devframe-C4DNeFuG.d.mts} +3 -52
- package/dist/diagnostics-D7miaTpL.mjs +36 -0
- package/dist/{rpc-BlVCyk9W.mjs → dump-C5LPsKJC.mjs} +139 -126
- package/dist/helpers/vite.d.mts +1 -1
- package/dist/helpers/vite.mjs +3 -3
- package/dist/{host-h3-CpYkiCIU.mjs → host-h3-DYFKJxAV.mjs} +255 -7
- package/dist/human-id-CiBWzVcg.mjs +803 -0
- package/dist/{index-BO4daMzR.d.mts → index-CSi2Y5JU.d.mts} +31 -78
- package/dist/index-DWczSqdd.d.mts +79 -0
- package/dist/index-aNunf5Za.d.mts +639 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/{launch-editor-1dAC7Uk5.mjs → launch-editor-BbNhtg7b.mjs} +25 -1
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/auth.mjs +1 -2
- package/dist/node/index.d.mts +5 -5
- package/dist/node/index.mjs +3 -3
- package/dist/node/internal.d.mts +2 -2
- package/dist/node/internal.mjs +3 -4
- package/dist/recipes/open-helpers.d.mts +1 -1
- package/dist/recipes/open-helpers.mjs +3 -3
- package/dist/rpc/dump.d.mts +2 -0
- package/dist/rpc/dump.mjs +2 -0
- package/dist/rpc/index.d.mts +2 -2
- package/dist/rpc/index.mjs +129 -3
- package/dist/rpc/transports/ws-client.d.mts +25 -1
- package/dist/rpc/transports/ws-client.mjs +2 -2
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/rpc/transports/ws-server.mjs +2 -2
- package/dist/{serialization-CwO31axa.mjs → serialization-lBLV02kQ.mjs} +2 -36
- package/dist/{server-CgqyJG9m.d.mts → server-DjMtJQhO.d.mts} +1 -1
- package/dist/shared-state-SzgfilJP.mjs +1058 -0
- package/dist/{shared-state-q9-1EOSX.mjs → shared-state-u0y123fi.mjs} +6 -6
- package/dist/{storage-BaLJK6e_.mjs → storage-CTlHUtXI.mjs} +1 -2
- package/dist/structured-clone-qP1sPovr.mjs +208 -0
- package/dist/types/index.d.mts +3 -3
- package/dist/utils/colors.mjs +30 -1
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/hash.mjs +1 -1
- package/dist/utils/human-id.d.mts +1 -1
- package/dist/utils/human-id.mjs +768 -1
- package/dist/utils/launch-editor.mjs +1 -1
- package/dist/utils/open.mjs +1 -1
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/shared-state.mjs +1 -1
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/utils/structured-clone.mjs +1 -1
- package/dist/{ws-server-kW8RZXTw.d.mts → ws-server-lHQaafrS.d.mts} +1 -1
- package/package.json +2 -5
- package/dist/chunk-e9Ob2GDo.mjs +0 -26
- package/dist/colors-DS7k8ljB.mjs +0 -123
- package/dist/diagnostics-Cg9ycFIM.mjs +0 -56
- package/dist/human-id-mPh1HcFO.mjs +0 -852
- package/dist/revoke-CWSPBbJH.mjs +0 -35
- package/dist/ws-client-DFUf-xgm.d.mts +0 -26
- /package/dist/{_shared-C_yZKUmx.mjs → _shared-BNoPn1NG.mjs} +0 -0
- /package/dist/{define-CW9gLnyG.mjs → define-Bb4zh-Dc.mjs} +0 -0
- /package/dist/{hash-CIBte1yS.mjs → hash-bwOD8RgU.mjs} +0 -0
- /package/dist/{open-CWL4Zasd.mjs → open-CX4CiMyw.mjs} +0 -0
- /package/dist/{server-G1ymmN3_.mjs → server-DxiOFSpu.mjs} +0 -0
- /package/dist/{structured-clone-CD2l4fI3.mjs → structured-clone-PdCZwt7F.mjs} +0 -0
- /package/dist/{transports-BLwT342H.mjs → transports-Bl1zuYhZ.mjs} +0 -0
- /package/dist/{types-ip8THGH1.d.mts → types-kKDaD2NT.d.mts} +0 -0
|
@@ -4,7 +4,7 @@ import { nanoid } from "./utils/nanoid.mjs";
|
|
|
4
4
|
var NOTHING = Symbol.for("immer-nothing");
|
|
5
5
|
var DRAFTABLE = Symbol.for("immer-draftable");
|
|
6
6
|
var DRAFT_STATE = Symbol.for("immer-state");
|
|
7
|
-
var errors =
|
|
7
|
+
var errors = [
|
|
8
8
|
function(plugin) {
|
|
9
9
|
return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`;
|
|
10
10
|
},
|
|
@@ -31,9 +31,9 @@ var errors = process.env.NODE_ENV !== "production" ? [
|
|
|
31
31
|
function(thing) {
|
|
32
32
|
return `'original' expects a draft, got: ${thing}`;
|
|
33
33
|
}
|
|
34
|
-
]
|
|
34
|
+
];
|
|
35
35
|
function die(error, ...args) {
|
|
36
|
-
|
|
36
|
+
{
|
|
37
37
|
const e = errors[error];
|
|
38
38
|
const msg = isFunction(e) ? e.apply(null, args) : e;
|
|
39
39
|
throw new Error(`[Immer] ${msg}`);
|
|
@@ -438,11 +438,11 @@ for (let key in objectTraps) {
|
|
|
438
438
|
};
|
|
439
439
|
}
|
|
440
440
|
arrayTraps.deleteProperty = function(state, prop) {
|
|
441
|
-
if (
|
|
441
|
+
if (isNaN(parseInt(prop))) die(13);
|
|
442
442
|
return arrayTraps.set.call(this, state, prop, void 0);
|
|
443
443
|
};
|
|
444
444
|
arrayTraps.set = function(state, prop, value) {
|
|
445
|
-
if (
|
|
445
|
+
if (prop !== "length" && isNaN(parseInt(prop))) die(14);
|
|
446
446
|
return objectTraps.set.call(this, state[0], prop, value, state[0]);
|
|
447
447
|
};
|
|
448
448
|
function peek(draft, prop) {
|
|
@@ -651,7 +651,7 @@ function currentImpl(value) {
|
|
|
651
651
|
}
|
|
652
652
|
function enablePatches() {
|
|
653
653
|
const errorOffset = 16;
|
|
654
|
-
|
|
654
|
+
errors.push("Sets cannot have \"replace\" patches.", function(op) {
|
|
655
655
|
return "Unsupported patch operation: " + op;
|
|
656
656
|
}, function(path) {
|
|
657
657
|
return "Cannot apply patch, path doesn't resolve: " + path;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createSharedState } from "./shared-state-q9-1EOSX.mjs";
|
|
1
|
+
import { a as logger, t as createSharedState } from "./shared-state-SzgfilJP.mjs";
|
|
3
2
|
import fs from "node:fs";
|
|
4
3
|
import { dirname } from "pathe";
|
|
5
4
|
//#region ../../node_modules/.pnpm/perfect-debounce@2.1.0/node_modules/perfect-debounce/dist/index.mjs
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/structured-clone-es@2.0.0/node_modules/structured-clone-es/dist/index.mjs
|
|
2
|
+
const env = typeof self === "object" ? self : globalThis;
|
|
3
|
+
function deserializer($, _) {
|
|
4
|
+
const as = (out, index) => {
|
|
5
|
+
$.set(index, out);
|
|
6
|
+
return out;
|
|
7
|
+
};
|
|
8
|
+
const unpair = (index) => {
|
|
9
|
+
if ($.has(index)) return $.get(index);
|
|
10
|
+
const [type, value] = _[index];
|
|
11
|
+
switch (type) {
|
|
12
|
+
case 0:
|
|
13
|
+
case -1: return as(value, index);
|
|
14
|
+
case 1: {
|
|
15
|
+
const arr = as([], index);
|
|
16
|
+
for (const index of value) arr.push(unpair(index));
|
|
17
|
+
return arr;
|
|
18
|
+
}
|
|
19
|
+
case 2: {
|
|
20
|
+
const object = as({}, index);
|
|
21
|
+
for (const [key, index] of value) object[unpair(key)] = unpair(index);
|
|
22
|
+
return object;
|
|
23
|
+
}
|
|
24
|
+
case 3: return as(new Date(value), index);
|
|
25
|
+
case 4: {
|
|
26
|
+
const { source, flags } = value;
|
|
27
|
+
return as(new RegExp(source, flags), index);
|
|
28
|
+
}
|
|
29
|
+
case 5: {
|
|
30
|
+
const map = as(/* @__PURE__ */ new Map(), index);
|
|
31
|
+
for (const [key, index] of value) map.set(unpair(key), unpair(index));
|
|
32
|
+
return map;
|
|
33
|
+
}
|
|
34
|
+
case 6: {
|
|
35
|
+
const set = as(/* @__PURE__ */ new Set(), index);
|
|
36
|
+
for (const index of value) set.add(unpair(index));
|
|
37
|
+
return set;
|
|
38
|
+
}
|
|
39
|
+
case 7: {
|
|
40
|
+
const { name, message } = value;
|
|
41
|
+
return as(new env[name](message), index);
|
|
42
|
+
}
|
|
43
|
+
case 8: return as(BigInt(value), index);
|
|
44
|
+
case "BigInt": return as(Object(BigInt(value)), index);
|
|
45
|
+
case "ArrayBuffer": return as(new Uint8Array(value).buffer, value);
|
|
46
|
+
case "DataView": {
|
|
47
|
+
const { buffer } = new Uint8Array(value);
|
|
48
|
+
return as(new DataView(buffer), value);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return as(new env[type](value), index);
|
|
52
|
+
};
|
|
53
|
+
return unpair;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Returns a deserialized value from a serialized array of Records.
|
|
57
|
+
* @param serialized a previously serialized value.
|
|
58
|
+
*/
|
|
59
|
+
function deserialize(serialized) {
|
|
60
|
+
return deserializer(/* @__PURE__ */ new Map(), serialized)(0);
|
|
61
|
+
}
|
|
62
|
+
const EMPTY = "";
|
|
63
|
+
const { toString } = {};
|
|
64
|
+
const { keys } = Object;
|
|
65
|
+
function typeOf(value) {
|
|
66
|
+
const type = typeof value;
|
|
67
|
+
if (type !== "object" || !value) return [0, type];
|
|
68
|
+
const asString = toString.call(value).slice(8, -1);
|
|
69
|
+
switch (asString) {
|
|
70
|
+
case "Array": return [1, EMPTY];
|
|
71
|
+
case "Object": return [2, EMPTY];
|
|
72
|
+
case "Date": return [3, EMPTY];
|
|
73
|
+
case "RegExp": return [4, EMPTY];
|
|
74
|
+
case "Map": return [5, EMPTY];
|
|
75
|
+
case "Set": return [6, EMPTY];
|
|
76
|
+
case "DataView": return [1, asString];
|
|
77
|
+
}
|
|
78
|
+
if (asString.includes("Array")) return [1, asString];
|
|
79
|
+
if (asString.includes("Error")) return [7, asString];
|
|
80
|
+
return [2, asString];
|
|
81
|
+
}
|
|
82
|
+
function shouldSkip([TYPE, type]) {
|
|
83
|
+
return TYPE === 0 && (type === "function" || type === "symbol");
|
|
84
|
+
}
|
|
85
|
+
function serializer(strict, json, $, _) {
|
|
86
|
+
const as = (out, value) => {
|
|
87
|
+
const index = _.push(out) - 1;
|
|
88
|
+
$.set(value, index);
|
|
89
|
+
return index;
|
|
90
|
+
};
|
|
91
|
+
const pair = (value) => {
|
|
92
|
+
if ($.has(value)) return $.get(value);
|
|
93
|
+
let [TYPE, type] = typeOf(value);
|
|
94
|
+
switch (TYPE) {
|
|
95
|
+
case 0: {
|
|
96
|
+
let entry = value;
|
|
97
|
+
switch (type) {
|
|
98
|
+
case "bigint":
|
|
99
|
+
TYPE = 8;
|
|
100
|
+
entry = value.toString();
|
|
101
|
+
break;
|
|
102
|
+
case "function":
|
|
103
|
+
case "symbol":
|
|
104
|
+
if (strict) throw new TypeError(`unable to serialize ${type}`);
|
|
105
|
+
entry = null;
|
|
106
|
+
break;
|
|
107
|
+
case "undefined": return as([-1], value);
|
|
108
|
+
}
|
|
109
|
+
return as([TYPE, entry], value);
|
|
110
|
+
}
|
|
111
|
+
case 1: {
|
|
112
|
+
if (type) {
|
|
113
|
+
let spread = value;
|
|
114
|
+
if (type === "DataView") spread = new Uint8Array(value.buffer);
|
|
115
|
+
else if (type === "ArrayBuffer") spread = new Uint8Array(value);
|
|
116
|
+
return as([type, [...spread]], value);
|
|
117
|
+
}
|
|
118
|
+
const arr = [];
|
|
119
|
+
const index = as([TYPE, arr], value);
|
|
120
|
+
for (const entry of value) arr.push(pair(entry));
|
|
121
|
+
return index;
|
|
122
|
+
}
|
|
123
|
+
case 2: {
|
|
124
|
+
if (type) switch (type) {
|
|
125
|
+
case "BigInt": return as([type, value.toString()], value);
|
|
126
|
+
case "Boolean":
|
|
127
|
+
case "Number":
|
|
128
|
+
case "String": return as([type, value.valueOf()], value);
|
|
129
|
+
}
|
|
130
|
+
if (json && "toJSON" in value) return pair(value.toJSON());
|
|
131
|
+
const entries = [];
|
|
132
|
+
const index = as([TYPE, entries], value);
|
|
133
|
+
for (const key of keys(value)) if (strict || !shouldSkip(typeOf(value[key]))) entries.push([pair(key), pair(value[key])]);
|
|
134
|
+
return index;
|
|
135
|
+
}
|
|
136
|
+
case 3: return as([TYPE, value.toISOString()], value);
|
|
137
|
+
case 4: {
|
|
138
|
+
const { source, flags } = value;
|
|
139
|
+
return as([TYPE, {
|
|
140
|
+
source,
|
|
141
|
+
flags
|
|
142
|
+
}], value);
|
|
143
|
+
}
|
|
144
|
+
case 5: {
|
|
145
|
+
const entries = [];
|
|
146
|
+
const index = as([TYPE, entries], value);
|
|
147
|
+
for (const [key, entry] of value) if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry)))) entries.push([pair(key), pair(entry)]);
|
|
148
|
+
return index;
|
|
149
|
+
}
|
|
150
|
+
case 6: {
|
|
151
|
+
const entries = [];
|
|
152
|
+
const index = as([TYPE, entries], value);
|
|
153
|
+
for (const entry of value) if (strict || !shouldSkip(typeOf(entry))) entries.push(pair(entry));
|
|
154
|
+
return index;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const { message } = value;
|
|
158
|
+
return as([TYPE, {
|
|
159
|
+
name: type,
|
|
160
|
+
message
|
|
161
|
+
}], value);
|
|
162
|
+
};
|
|
163
|
+
return pair;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Returns an array of serialized Records.
|
|
167
|
+
*/
|
|
168
|
+
function serialize(value, options = {}) {
|
|
169
|
+
const _ = [];
|
|
170
|
+
serializer(!(options.json || options.lossy), !!options.json, /* @__PURE__ */ new Map(), _)(value);
|
|
171
|
+
return _;
|
|
172
|
+
}
|
|
173
|
+
const { parse: $parse, stringify: $stringify } = JSON;
|
|
174
|
+
const options = {
|
|
175
|
+
json: true,
|
|
176
|
+
lossy: true
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Revive a previously stringified structured clone.
|
|
180
|
+
* @param str previously stringified data as string.
|
|
181
|
+
*/
|
|
182
|
+
function parse(str) {
|
|
183
|
+
return deserialize($parse(str));
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Represent a structured clone value as string.
|
|
187
|
+
* @param any some clone-able value to stringify.
|
|
188
|
+
*/
|
|
189
|
+
function stringify(any) {
|
|
190
|
+
return $stringify(serialize(any, options));
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/utils/structured-clone.ts
|
|
194
|
+
/**
|
|
195
|
+
* Serialize a structured-cloneable value to a single string. Equivalent
|
|
196
|
+
* to `JSON.stringify(structuredCloneSerialize(value))`.
|
|
197
|
+
*/
|
|
198
|
+
function structuredCloneStringify(value) {
|
|
199
|
+
return stringify(value);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Inverse of {@link structuredCloneStringify}.
|
|
203
|
+
*/
|
|
204
|
+
function structuredCloneParse(value) {
|
|
205
|
+
return parse(value);
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
export { structuredCloneStringify as n, structuredCloneParse as t };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { h as RpcFunctionAgentOptions } from "../types-
|
|
3
|
-
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-
|
|
1
|
+
import { A as DevToolsDiagnosticsHost, B as DevToolsAgentHostEvents, C as PartialWithoutId, D as DevToolsRpcSharedStates, E as DevToolsRpcServerFunctions, F as AgentResourceContent, H as EventUnsubscribe, I as AgentResourceInput, L as AgentTool, M as AgentHandle, N as AgentManifest, O as DevToolsHost, P as AgentResource, R as AgentToolInput, S as EntriesToObject, T as DevToolsRpcClientFunctions, U as EventsMap, V as EventEmitter, _ as RpcStreamingChannel, a as DevframeRuntime, c as defineDevframe, d as DevToolsNodeContext, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, h as RpcSharedStateGetOptions, i as DevframeDeploymentKind, j as DevToolsDiagnosticsLogger, k as DevToolsDiagnosticsDefinition, l as ConnectionMeta, m as RpcFunctionsHost, n as DevframeCliOptions, o as DevframeSetupInfo, p as RpcBroadcastOptions, r as DevframeDefinition, s as DevframeSpaOptions, t as DevframeBrowserContext, u as DevToolsCapabilities, v as RpcStreamingChannelOptions, w as Thenable, x as DevToolsViewHost, y as RpcStreamingHost, z as DevToolsAgentHost } from "../devframe-C4DNeFuG.mjs";
|
|
2
|
+
import { h as RpcFunctionAgentOptions } from "../types-kKDaD2NT.mjs";
|
|
3
|
+
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-lHQaafrS.mjs";
|
|
4
4
|
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ConnectionMeta, DevToolsAgentHost, DevToolsAgentHostEvents, DevToolsCapabilities, DevToolsDiagnosticsDefinition, DevToolsDiagnosticsHost, DevToolsDiagnosticsLogger, DevToolsHost, DevToolsNodeContext, DevToolsNodeRpcSession, DevToolsNodeRpcSessionMeta, DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, DevToolsRpcSharedStates, DevToolsViewHost, DevframeBrowserContext, DevframeCliOptions, DevframeDefinition, DevframeDeploymentKind, DevframeRuntime, DevframeSetupInfo, DevframeSpaOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, PartialWithoutId, RpcBroadcastOptions, RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, Thenable, defineDevframe };
|
package/dist/utils/colors.mjs
CHANGED
|
@@ -1,2 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/utils/colors.ts
|
|
2
|
+
function makeColor(open, close) {
|
|
3
|
+
const o = `\x1B[${open}m`;
|
|
4
|
+
const c = `\x1B[${close}m`;
|
|
5
|
+
return ((arg, ...values) => {
|
|
6
|
+
if (Array.isArray(arg) && "raw" in arg) {
|
|
7
|
+
const strings = arg;
|
|
8
|
+
let out = "";
|
|
9
|
+
for (let i = 0; i < strings.length; i++) {
|
|
10
|
+
out += strings[i];
|
|
11
|
+
if (i < values.length) out += String(values[i]);
|
|
12
|
+
}
|
|
13
|
+
return `${o}${out}${c}`;
|
|
14
|
+
}
|
|
15
|
+
return `${o}${String(arg)}${c}`;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const colors = {
|
|
19
|
+
blue: makeColor(34, 39),
|
|
20
|
+
cyan: makeColor(36, 39),
|
|
21
|
+
gray: makeColor(90, 39),
|
|
22
|
+
green: makeColor(32, 39),
|
|
23
|
+
red: makeColor(31, 39),
|
|
24
|
+
yellow: makeColor(33, 39),
|
|
25
|
+
bold: makeColor(1, 22),
|
|
26
|
+
dim: makeColor(2, 22),
|
|
27
|
+
reset: makeColor(0, 0),
|
|
28
|
+
underline: makeColor(4, 24)
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
2
31
|
export { colors };
|
package/dist/utils/events.d.mts
CHANGED
package/dist/utils/hash.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as hash } from "../hash-
|
|
1
|
+
import { t as hash } from "../hash-bwOD8RgU.mjs";
|
|
2
2
|
export { hash };
|