@ikas/component-cli 1.4.0-beta.20 → 1.4.0-beta.201
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/build-tools.d.ts +37 -0
- package/dist/build-tools.d.ts.map +1 -0
- package/dist/build-tools.js +36 -0
- package/dist/build-tools.js.map +1 -0
- package/dist/commands/add-sections-to-page.d.ts +3 -0
- package/dist/commands/add-sections-to-page.d.ts.map +1 -0
- package/dist/commands/add-sections-to-page.js +39 -0
- package/dist/commands/add-sections-to-page.js.map +1 -0
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +11 -2
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +5 -165
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/config.d.ts +35 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +1082 -147
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/create-design-tokens.d.ts +24 -0
- package/dist/commands/create-design-tokens.d.ts.map +1 -0
- package/dist/commands/create-design-tokens.js +327 -0
- package/dist/commands/create-design-tokens.js.map +1 -0
- package/dist/commands/create-global-variable.d.ts +3 -0
- package/dist/commands/create-global-variable.d.ts.map +1 -0
- package/dist/commands/create-global-variable.js +73 -0
- package/dist/commands/create-global-variable.js.map +1 -0
- package/dist/commands/create-page.d.ts +3 -0
- package/dist/commands/create-page.d.ts.map +1 -0
- package/dist/commands/create-page.js +31 -0
- package/dist/commands/create-page.js.map +1 -0
- package/dist/commands/delete-page.d.ts +3 -0
- package/dist/commands/delete-page.d.ts.map +1 -0
- package/dist/commands/delete-page.js +28 -0
- package/dist/commands/delete-page.js.map +1 -0
- package/dist/commands/delete-theme-globals.d.ts +4 -0
- package/dist/commands/delete-theme-globals.d.ts.map +1 -0
- package/dist/commands/delete-theme-globals.js +48 -0
- package/dist/commands/delete-theme-globals.js.map +1 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +170 -31
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/enable-builtin-pages.d.ts +3 -0
- package/dist/commands/enable-builtin-pages.d.ts.map +1 -0
- package/dist/commands/enable-builtin-pages.js +27 -0
- package/dist/commands/enable-builtin-pages.js.map +1 -0
- package/dist/commands/get-component-props.d.ts +3 -0
- package/dist/commands/get-component-props.d.ts.map +1 -0
- package/dist/commands/get-component-props.js +32 -0
- package/dist/commands/get-component-props.js.map +1 -0
- package/dist/commands/get-page-by-type.d.ts +3 -0
- package/dist/commands/get-page-by-type.d.ts.map +1 -0
- package/dist/commands/get-page-by-type.js +25 -0
- package/dist/commands/get-page-by-type.js.map +1 -0
- package/dist/commands/get-section-values.d.ts +3 -0
- package/dist/commands/get-section-values.d.ts.map +1 -0
- package/dist/commands/get-section-values.js +39 -0
- package/dist/commands/get-section-values.js.map +1 -0
- package/dist/commands/list-builtin-pages.d.ts +3 -0
- package/dist/commands/list-builtin-pages.d.ts.map +1 -0
- package/dist/commands/list-builtin-pages.js +28 -0
- package/dist/commands/list-builtin-pages.js.map +1 -0
- package/dist/commands/list-entities.d.ts +3 -0
- package/dist/commands/list-entities.d.ts.map +1 -0
- package/dist/commands/list-entities.js +32 -0
- package/dist/commands/list-entities.js.map +1 -0
- package/dist/commands/list-page-sections.d.ts.map +1 -1
- package/dist/commands/list-page-sections.js +8 -2
- package/dist/commands/list-page-sections.js.map +1 -1
- package/dist/commands/list-theme-globals.d.ts +3 -0
- package/dist/commands/list-theme-globals.d.ts.map +1 -0
- package/dist/commands/list-theme-globals.js +22 -0
- package/dist/commands/list-theme-globals.js.map +1 -0
- package/dist/commands/move-page-section.d.ts +3 -0
- package/dist/commands/move-page-section.d.ts.map +1 -0
- package/dist/commands/move-page-section.js +62 -0
- package/dist/commands/move-page-section.js.map +1 -0
- package/dist/commands/publish-theme.d.ts +3 -0
- package/dist/commands/publish-theme.d.ts.map +1 -0
- package/dist/commands/publish-theme.js +29 -0
- package/dist/commands/publish-theme.js.map +1 -0
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +54 -3
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/remove-page-section.d.ts +3 -0
- package/dist/commands/remove-page-section.d.ts.map +1 -0
- package/dist/commands/remove-page-section.js +40 -0
- package/dist/commands/remove-page-section.js.map +1 -0
- package/dist/commands/search-products.d.ts +3 -0
- package/dist/commands/search-products.d.ts.map +1 -0
- package/dist/commands/search-products.js +40 -0
- package/dist/commands/search-products.js.map +1 -0
- package/dist/commands/update-builtin-page-prop.d.ts +3 -0
- package/dist/commands/update-builtin-page-prop.d.ts.map +1 -0
- package/dist/commands/update-builtin-page-prop.js +49 -0
- package/dist/commands/update-builtin-page-prop.js.map +1 -0
- package/dist/commands/update-global-variable.d.ts +3 -0
- package/dist/commands/update-global-variable.d.ts.map +1 -0
- package/dist/commands/update-global-variable.js +70 -0
- package/dist/commands/update-global-variable.js.map +1 -0
- package/dist/commands/update-page-sections.d.ts +3 -0
- package/dist/commands/update-page-sections.d.ts.map +1 -0
- package/dist/commands/update-page-sections.js +39 -0
- package/dist/commands/update-page-sections.js.map +1 -0
- package/dist/commands/update-section-prop.d.ts.map +1 -1
- package/dist/commands/update-section-prop.js +25 -8
- package/dist/commands/update-section-prop.js.map +1 -1
- package/dist/commands/upload-image.d.ts.map +1 -1
- package/dist/commands/upload-image.js +5 -46
- package/dist/commands/upload-image.js.map +1 -1
- package/dist/commands/upload-images.d.ts +3 -0
- package/dist/commands/upload-images.d.ts.map +1 -0
- package/dist/commands/upload-images.js +48 -0
- package/dist/commands/upload-images.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/compile.d.ts +17 -2
- package/dist/utils/compile.d.ts.map +1 -1
- package/dist/utils/compile.js +750 -117
- package/dist/utils/compile.js.map +1 -1
- package/dist/utils/component-helpers.d.ts +145 -2
- package/dist/utils/component-helpers.d.ts.map +1 -1
- package/dist/utils/component-helpers.js +397 -29
- package/dist/utils/component-helpers.js.map +1 -1
- package/dist/utils/css-import-resolver.d.ts +4 -1
- package/dist/utils/css-import-resolver.d.ts.map +1 -1
- package/dist/utils/css-import-resolver.js +9 -1
- package/dist/utils/css-import-resolver.js.map +1 -1
- package/dist/utils/editor-action-client.d.ts +4 -3
- package/dist/utils/editor-action-client.d.ts.map +1 -1
- package/dist/utils/editor-action-client.js +55 -19
- package/dist/utils/editor-action-client.js.map +1 -1
- package/dist/utils/esm-transform.d.ts +30 -0
- package/dist/utils/esm-transform.d.ts.map +1 -1
- package/dist/utils/esm-transform.js +169 -2
- package/dist/utils/esm-transform.js.map +1 -1
- package/dist/utils/find-component-for-file.d.ts +12 -0
- package/dist/utils/find-component-for-file.d.ts.map +1 -0
- package/dist/utils/find-component-for-file.js +24 -0
- package/dist/utils/find-component-for-file.js.map +1 -0
- package/dist/utils/forbid-deep-imports.d.ts +3 -0
- package/dist/utils/forbid-deep-imports.d.ts.map +1 -0
- package/dist/utils/forbid-deep-imports.js +54 -0
- package/dist/utils/forbid-deep-imports.js.map +1 -0
- package/dist/utils/forbid-external-packages.d.ts +26 -0
- package/dist/utils/forbid-external-packages.d.ts.map +1 -0
- package/dist/utils/forbid-external-packages.js +99 -0
- package/dist/utils/forbid-external-packages.js.map +1 -0
- package/dist/utils/load-image.d.ts +16 -0
- package/dist/utils/load-image.d.ts.map +1 -0
- package/dist/utils/load-image.js +50 -0
- package/dist/utils/load-image.js.map +1 -0
- package/dist/utils/vendor-storefront.d.ts +13 -0
- package/dist/utils/vendor-storefront.d.ts.map +1 -0
- package/dist/utils/vendor-storefront.js +91 -0
- package/dist/utils/vendor-storefront.js.map +1 -0
- package/dist/utils/websocket-server.d.ts +88 -5
- package/dist/utils/websocket-server.d.ts.map +1 -1
- package/dist/utils/websocket-server.js +241 -44
- package/dist/utils/websocket-server.js.map +1 -1
- package/package.json +17 -2
- package/templates/add/section.css +11 -0
- package/dist/commands/create.d.ts +0 -4
- package/dist/commands/create.d.ts.map +0 -1
- package/dist/commands/create.js +0 -228
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/proxy.d.ts +0 -39
- package/dist/commands/proxy.d.ts.map +0 -1
- package/dist/commands/proxy.js +0 -210
- package/dist/commands/proxy.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentProp } from "../types.js";
|
|
1
|
+
import type { ComponentProp, ThemeSettingMeta } from "../types.js";
|
|
2
2
|
import type { IThemePropGroupData } from "./component-helpers.js";
|
|
3
3
|
/**
|
|
4
4
|
* Shared module data sent to editors (chunk extracted by code splitting)
|
|
@@ -51,6 +51,13 @@ export interface ICodeComponentData {
|
|
|
51
51
|
typeId?: string;
|
|
52
52
|
/** For ENUM props — the enum type ID from TypeStore */
|
|
53
53
|
enumTypeId?: string;
|
|
54
|
+
/** For NUMBER_RANGE props — slider config (min/max/interval/unit) */
|
|
55
|
+
numberRangeData?: {
|
|
56
|
+
min?: number;
|
|
57
|
+
max?: number;
|
|
58
|
+
interval?: number;
|
|
59
|
+
unit?: string;
|
|
60
|
+
};
|
|
54
61
|
/** For COMPONENT/COMPONENT_LIST props — map of variable keys to { id, typeId } */
|
|
55
62
|
privateVarMap?: Record<string, {
|
|
56
63
|
id: string;
|
|
@@ -58,6 +65,17 @@ export interface ICodeComponentData {
|
|
|
58
65
|
}>;
|
|
59
66
|
/** For COMPONENT/COMPONENT_LIST props — restrict which components can be selected */
|
|
60
67
|
filteredComponentIds?: string[];
|
|
68
|
+
/**
|
|
69
|
+
* Conditional visibility. Resolved from the config's `requiredProp` (a NAME) at broadcast time
|
|
70
|
+
* into the id the editor addresses props by.
|
|
71
|
+
*/
|
|
72
|
+
requiredPropId?: string;
|
|
73
|
+
/** For a BOOLEAN gate — which state of `requiredPropId` shows this prop. Defaults to `true`. */
|
|
74
|
+
requiredPropValue?: boolean;
|
|
75
|
+
/** For an ENUM gate — the option's id. */
|
|
76
|
+
requiredEnumOptionId?: string;
|
|
77
|
+
/** For an ENUM gate — the option value `requiredPropId` must hold. */
|
|
78
|
+
requiredEnumOptionValue?: string;
|
|
61
79
|
}>;
|
|
62
80
|
compiledServerJs: string;
|
|
63
81
|
compiledClientJs: string;
|
|
@@ -78,10 +96,18 @@ export interface ICodeComponentData {
|
|
|
78
96
|
id: string;
|
|
79
97
|
name: string;
|
|
80
98
|
description?: string;
|
|
99
|
+
requiredProp?: string;
|
|
100
|
+
requiredPropValue?: boolean;
|
|
101
|
+
requiredEnumOptionId?: string;
|
|
102
|
+
requiredEnumOptionValue?: string;
|
|
81
103
|
children?: Array<{
|
|
82
104
|
id: string;
|
|
83
105
|
name: string;
|
|
84
106
|
description?: string;
|
|
107
|
+
requiredProp?: string;
|
|
108
|
+
requiredPropValue?: boolean;
|
|
109
|
+
requiredEnumOptionId?: string;
|
|
110
|
+
requiredEnumOptionValue?: string;
|
|
85
111
|
}>;
|
|
86
112
|
}>;
|
|
87
113
|
/** Custom IType definitions referenced by this component's props (for portability across projects) */
|
|
@@ -151,7 +177,7 @@ export type DevServerMessage = {
|
|
|
151
177
|
} | {
|
|
152
178
|
type: "editor-action";
|
|
153
179
|
requestId: string;
|
|
154
|
-
action: "list-pages" | "list-imported-components" | "import-component" | "add-section-to-page" | "list-page-sections" | "update-section-prop" | "upload-image";
|
|
180
|
+
action: "list-pages" | "list-imported-components" | "import-component" | "add-section-to-page" | "add-sections-to-page" | "list-page-sections" | "get-section-values" | "get-component-props" | "update-section-prop" | "upload-image" | "search-products" | "list-entities" | "get-page-by-type" | "update-page-sections" | "upload-images";
|
|
155
181
|
payload?: any;
|
|
156
182
|
} | {
|
|
157
183
|
type: "editor-action-result";
|
|
@@ -159,6 +185,12 @@ export type DevServerMessage = {
|
|
|
159
185
|
success: boolean;
|
|
160
186
|
payload?: any;
|
|
161
187
|
error?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Server-generated transient failure: the editor handling the action is
|
|
190
|
+
* gone or not back yet. Safe to resend the SAME requestId — the editor
|
|
191
|
+
* deduplicates by it, so a retry can never run the action twice.
|
|
192
|
+
*/
|
|
193
|
+
retryable?: boolean;
|
|
162
194
|
};
|
|
163
195
|
/**
|
|
164
196
|
* Messages from editor to dev server
|
|
@@ -169,6 +201,24 @@ export type EditorMessage = {
|
|
|
169
201
|
type: "request-state";
|
|
170
202
|
} | {
|
|
171
203
|
type: "ping";
|
|
204
|
+
} | {
|
|
205
|
+
type: "editor-hello";
|
|
206
|
+
payload?: {
|
|
207
|
+
/** Human-readable identity shown when several tabs are connected. */
|
|
208
|
+
label?: string;
|
|
209
|
+
/** True when the tab is visible at the time of sending. */
|
|
210
|
+
visible?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Theme the tab is editing. When connected tabs disagree, an
|
|
213
|
+
* `editor-action` is refused instead of mutating an arbitrary theme.
|
|
214
|
+
*/
|
|
215
|
+
themeId?: string;
|
|
216
|
+
/**
|
|
217
|
+
* Stable per-tab id (survives reconnects, dies with the tab). Lets a
|
|
218
|
+
* retried `editor-action` be pinned back to the tab that first got it.
|
|
219
|
+
*/
|
|
220
|
+
tabId?: string;
|
|
221
|
+
};
|
|
172
222
|
} | {
|
|
173
223
|
type: "create-component";
|
|
174
224
|
requestId: string;
|
|
@@ -208,6 +258,10 @@ export type EditorMessage = {
|
|
|
208
258
|
name: string;
|
|
209
259
|
description?: string;
|
|
210
260
|
parentGroupId?: string;
|
|
261
|
+
requiredProp?: string;
|
|
262
|
+
requiredPropValue?: boolean;
|
|
263
|
+
requiredEnumOptionId?: string;
|
|
264
|
+
requiredEnumOptionValue?: string;
|
|
211
265
|
};
|
|
212
266
|
};
|
|
213
267
|
} | {
|
|
@@ -219,6 +273,10 @@ export type EditorMessage = {
|
|
|
219
273
|
propGroup: {
|
|
220
274
|
name?: string;
|
|
221
275
|
description?: string;
|
|
276
|
+
requiredProp?: string;
|
|
277
|
+
requiredPropValue?: boolean;
|
|
278
|
+
requiredEnumOptionId?: string;
|
|
279
|
+
requiredEnumOptionValue?: string;
|
|
222
280
|
};
|
|
223
281
|
};
|
|
224
282
|
} | {
|
|
@@ -259,6 +317,8 @@ export type EditorMessage = {
|
|
|
259
317
|
enumOptions?: Record<string, string>;
|
|
260
318
|
}>;
|
|
261
319
|
customTypes?: Array<Record<string, any>>;
|
|
320
|
+
/** Theme global variables (Styles panel) — drives the typed key union in global-types.ts. */
|
|
321
|
+
themeSettings?: Array<ThemeSettingMeta>;
|
|
262
322
|
};
|
|
263
323
|
} | {
|
|
264
324
|
type: "request-types";
|
|
@@ -286,7 +346,7 @@ export type EditorMessage = {
|
|
|
286
346
|
} | {
|
|
287
347
|
type: "editor-action";
|
|
288
348
|
requestId: string;
|
|
289
|
-
action: "list-pages" | "list-imported-components" | "import-component" | "add-section-to-page" | "list-page-sections" | "update-section-prop" | "upload-image";
|
|
349
|
+
action: "list-pages" | "list-imported-components" | "import-component" | "add-section-to-page" | "add-sections-to-page" | "list-page-sections" | "get-section-values" | "get-component-props" | "update-section-prop" | "upload-image" | "search-products" | "list-entities" | "get-page-by-type" | "update-page-sections" | "upload-images";
|
|
290
350
|
payload?: any;
|
|
291
351
|
} | {
|
|
292
352
|
type: "editor-action-result";
|
|
@@ -315,10 +375,18 @@ export interface EditorMessageHandlers {
|
|
|
315
375
|
name: string;
|
|
316
376
|
description?: string;
|
|
317
377
|
parentGroupId?: string;
|
|
378
|
+
requiredProp?: string;
|
|
379
|
+
requiredPropValue?: boolean;
|
|
380
|
+
requiredEnumOptionId?: string;
|
|
381
|
+
requiredEnumOptionValue?: string;
|
|
318
382
|
}) => Promise<void>;
|
|
319
383
|
onUpdatePropGroup?: (componentId: string, propGroupId: string, propGroup: {
|
|
320
384
|
name?: string;
|
|
321
385
|
description?: string;
|
|
386
|
+
requiredProp?: string;
|
|
387
|
+
requiredPropValue?: boolean;
|
|
388
|
+
requiredEnumOptionId?: string;
|
|
389
|
+
requiredEnumOptionValue?: string;
|
|
322
390
|
}) => Promise<void>;
|
|
323
391
|
onDeletePropGroup?: (componentId: string, propGroupId: string) => Promise<void>;
|
|
324
392
|
onMovePropToGroup?: (componentId: string, propName: string, groupId: string | null) => Promise<void>;
|
|
@@ -330,7 +398,7 @@ export interface EditorMessageHandlers {
|
|
|
330
398
|
category: "type" | "enum";
|
|
331
399
|
sectionAllowed: boolean;
|
|
332
400
|
enumOptions?: Record<string, string>;
|
|
333
|
-
}>, customTypes?: Array<Record<string, any
|
|
401
|
+
}>, customTypes?: Array<Record<string, any>>, themeSettings?: Array<ThemeSettingMeta>) => void;
|
|
334
402
|
onRequestTypes?: () => Array<{
|
|
335
403
|
id: string;
|
|
336
404
|
name: string;
|
|
@@ -351,9 +419,10 @@ export interface EditorMessageHandlers {
|
|
|
351
419
|
export declare class DevServerWebSocket {
|
|
352
420
|
private wss;
|
|
353
421
|
private httpServer;
|
|
354
|
-
private clients;
|
|
355
422
|
private port;
|
|
356
423
|
private pendingEditorActions;
|
|
424
|
+
private clientInfo;
|
|
425
|
+
private forwardedEditorActions;
|
|
357
426
|
constructor(port?: number);
|
|
358
427
|
/**
|
|
359
428
|
* Start the WebSocket server
|
|
@@ -369,6 +438,20 @@ export declare class DevServerWebSocket {
|
|
|
369
438
|
* dead socket.
|
|
370
439
|
*/
|
|
371
440
|
private dropPendingEditorActionsForClient;
|
|
441
|
+
/**
|
|
442
|
+
* Pick the single editor that should run an `editor-action`, preferring the
|
|
443
|
+
* tab the user is looking at: most recently visible, then most recently
|
|
444
|
+
* active. Control clients are never targets.
|
|
445
|
+
*
|
|
446
|
+
* The server has no theme identity of its own, so ambiguity is refused, not
|
|
447
|
+
* guessed at: tabs reporting DIFFERENT themes → `conflictingThemes`; a tab
|
|
448
|
+
* with NO theme identity (old build or still loading) next to identified
|
|
449
|
+
* ones → `hasUnidentified` — that tab could be on any theme, and routing
|
|
450
|
+
* either way risks silently mutating the wrong one. Only an unambiguous
|
|
451
|
+
* pool (all identified with one theme, or all unidentified legacy tabs) is
|
|
452
|
+
* ranked.
|
|
453
|
+
*/
|
|
454
|
+
private pickEditorActionTarget;
|
|
372
455
|
/**
|
|
373
456
|
* Send message to a specific client
|
|
374
457
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket-server.d.ts","sourceRoot":"","sources":["../../src/utils/websocket-server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAwC,MAAM,aAAa,CAAC;AACvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,OAAO,CAAC;QACpB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,wDAAwD;QACxD,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,kDAAkD;QAClD,MAAM,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CAAC,WAAW,EAAE,MAAM;IAU7C;;OAEG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,OAAO,CAExB;IAED;;OAEG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAiCtB"}
|
|
1
|
+
{"version":3,"file":"websocket-server.d.ts","sourceRoot":"","sources":["../../src/utils/websocket-server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,OAAO,CAAC;QACpB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,wDAAwD;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
|
|
12
|
-
// Tracks in-flight editor-action requests: requestId →
|
|
13
|
-
//
|
|
11
|
+
// Tracks in-flight editor-action requests: requestId → { sender, target }.
|
|
12
|
+
// `sender` routes the `editor-action-result` back; `target` lets us fail the
|
|
13
|
+
// request fast when the editor that was asked to run it goes away.
|
|
14
|
+
// `targetGone` marks a legacy (unpinned) target whose socket dropped: its
|
|
15
|
+
// reply may still arrive on a reconnected socket, so the entry is kept and
|
|
16
|
+
// the late reply is relayed — the pre-routing behaviour old editors rely on.
|
|
14
17
|
pendingEditorActions = new Map();
|
|
18
|
+
// The connected sockets, and what each one is. Also the client registry:
|
|
19
|
+
// `broadcast`/`clientCount` iterate its keys.
|
|
20
|
+
clientInfo = new Map();
|
|
21
|
+
// requestId → tabId of the editor an action was first forwarded to. A retry
|
|
22
|
+
// of that requestId must go to the SAME tab (whose dedup cache makes the
|
|
23
|
+
// retry exactly-once) — any other tab would execute it a second time.
|
|
24
|
+
forwardedEditorActions = new Map();
|
|
15
25
|
constructor(port = 5201) {
|
|
16
26
|
this.port = port;
|
|
17
27
|
}
|
|
@@ -47,20 +57,41 @@ export class DevServerWebSocket {
|
|
|
47
57
|
this.wss.emit("connection", ws, req);
|
|
48
58
|
});
|
|
49
59
|
});
|
|
50
|
-
this.wss.on("connection", (ws) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
this.wss.on("connection", (ws, req) => {
|
|
61
|
+
// Control clients tag themselves on connect, so an `editor-action`
|
|
62
|
+
// is never routed to another one-shot CLI socket that would drop it.
|
|
63
|
+
// Parse the query properly: the editor's routing URL can carry a
|
|
64
|
+
// token, and substring matching could false-positive on it.
|
|
65
|
+
let isControl = false;
|
|
66
|
+
try {
|
|
67
|
+
isControl = new URL(req?.url ?? "/", "http://localhost").searchParams.get("client") === "control";
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Malformed upgrade URL — treat as an editor, the safe default.
|
|
71
|
+
}
|
|
72
|
+
const clientInfo = {
|
|
73
|
+
isControl,
|
|
74
|
+
lastActivityAt: Date.now(),
|
|
75
|
+
lastVisibleAt: 0
|
|
76
|
+
};
|
|
77
|
+
this.clientInfo.set(ws, clientInfo);
|
|
78
|
+
if (!isControl)
|
|
79
|
+
console.log(chalk.green(" Editor connected"));
|
|
80
|
+
// Send initial state on connection. Control clients discard it, and
|
|
81
|
+
// it carries every component's compiled JS/CSS — no point shipping
|
|
82
|
+
// the whole dev bundle to a socket that exists to send one command.
|
|
83
|
+
if (!isControl) {
|
|
84
|
+
const state = handlers.onRequestState();
|
|
85
|
+
this.sendTo(ws, {
|
|
86
|
+
type: "initial-state",
|
|
87
|
+
payload: {
|
|
88
|
+
components: state.components,
|
|
89
|
+
sharedModules: state.sharedModules,
|
|
90
|
+
globalStyles: state.globalStyles,
|
|
91
|
+
timestamp: Date.now()
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
64
95
|
ws.on("message", (data) => {
|
|
65
96
|
try {
|
|
66
97
|
const message = JSON.parse(data.toString());
|
|
@@ -73,13 +104,18 @@ export class DevServerWebSocket {
|
|
|
73
104
|
}
|
|
74
105
|
});
|
|
75
106
|
ws.on("close", () => {
|
|
76
|
-
this.
|
|
107
|
+
this.clientInfo.delete(ws);
|
|
77
108
|
this.dropPendingEditorActionsForClient(ws);
|
|
78
|
-
|
|
109
|
+
// Read the live flag, not the connect-time one: legacy control
|
|
110
|
+
// clients (no `?client=control`) are only marked once they send an
|
|
111
|
+
// `editor-action`. The object outlives the map entry, which the
|
|
112
|
+
// "error" handler may already have removed.
|
|
113
|
+
if (!clientInfo.isControl)
|
|
114
|
+
console.log(chalk.yellow(" Editor disconnected"));
|
|
79
115
|
});
|
|
80
116
|
ws.on("error", (error) => {
|
|
81
117
|
console.error(chalk.red(" WebSocket error:"), error.message);
|
|
82
|
-
this.
|
|
118
|
+
this.clientInfo.delete(ws);
|
|
83
119
|
this.dropPendingEditorActionsForClient(ws);
|
|
84
120
|
});
|
|
85
121
|
});
|
|
@@ -104,10 +140,36 @@ export class DevServerWebSocket {
|
|
|
104
140
|
* Handle incoming messages from editor
|
|
105
141
|
*/
|
|
106
142
|
async handleMessage(ws, message, handlers) {
|
|
143
|
+
const info = this.clientInfo.get(ws);
|
|
144
|
+
if (info) {
|
|
145
|
+
// Heartbeats are not activity: they would reshuffle which tab wins ties.
|
|
146
|
+
if (message.type !== "ping")
|
|
147
|
+
info.lastActivityAt = Date.now();
|
|
148
|
+
// Fallback for control clients too old to send `?client=control`: only
|
|
149
|
+
// they issue `editor-action` or `request-types` (the editor pushes
|
|
150
|
+
// `sync-types`, it never requests them), and the mark is sticky.
|
|
151
|
+
if (message.type === "editor-action" || message.type === "request-types")
|
|
152
|
+
info.isControl = true;
|
|
153
|
+
}
|
|
107
154
|
switch (message.type) {
|
|
108
155
|
case "subscribe":
|
|
109
156
|
// Already subscribed on connection
|
|
110
157
|
break;
|
|
158
|
+
case "editor-hello": {
|
|
159
|
+
// Record which tab is visible so commands land on the one the user is
|
|
160
|
+
// looking at.
|
|
161
|
+
if (info) {
|
|
162
|
+
if (message.payload?.visible)
|
|
163
|
+
info.lastVisibleAt = Date.now();
|
|
164
|
+
if (message.payload?.label)
|
|
165
|
+
info.label = message.payload.label;
|
|
166
|
+
if (message.payload?.themeId)
|
|
167
|
+
info.themeId = message.payload.themeId;
|
|
168
|
+
if (message.payload?.tabId)
|
|
169
|
+
info.tabId = message.payload.tabId;
|
|
170
|
+
}
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
111
173
|
case "request-state": {
|
|
112
174
|
const state = handlers.onRequestState();
|
|
113
175
|
this.sendTo(ws, {
|
|
@@ -297,7 +359,7 @@ export class DevServerWebSocket {
|
|
|
297
359
|
}
|
|
298
360
|
case "sync-types": {
|
|
299
361
|
if (handlers.onSyncTypes) {
|
|
300
|
-
handlers.onSyncTypes(message.payload.types, message.payload.customTypes);
|
|
362
|
+
handlers.onSyncTypes(message.payload.types, message.payload.customTypes, message.payload.themeSettings);
|
|
301
363
|
}
|
|
302
364
|
break;
|
|
303
365
|
}
|
|
@@ -352,37 +414,96 @@ export class DevServerWebSocket {
|
|
|
352
414
|
}
|
|
353
415
|
case "editor-action": {
|
|
354
416
|
// Control client (e.g., `ikas-component list-pages`) asks the dev server
|
|
355
|
-
// to forward an action to the
|
|
356
|
-
//
|
|
357
|
-
|
|
358
|
-
|
|
417
|
+
// to forward an action to the editor. An action is a COMMAND, not a
|
|
418
|
+
// broadcast: every tab that receives it applies it to the shared Yjs
|
|
419
|
+
// document, so N open tabs would import N copies of a component and
|
|
420
|
+
// place N copies of its section. Route it to exactly one editor.
|
|
421
|
+
const fail = (error, retryable) => {
|
|
359
422
|
this.sendTo(ws, {
|
|
360
423
|
type: "editor-action-result",
|
|
361
424
|
requestId: message.requestId,
|
|
362
425
|
success: false,
|
|
363
|
-
error
|
|
426
|
+
error,
|
|
427
|
+
...(retryable ? { retryable: true } : {}),
|
|
364
428
|
});
|
|
365
|
-
|
|
429
|
+
};
|
|
430
|
+
let target = null;
|
|
431
|
+
const pinnedTabId = this.forwardedEditorActions.get(message.requestId);
|
|
432
|
+
if (pinnedTabId) {
|
|
433
|
+
// A retried requestId is pinned to the tab that first received it:
|
|
434
|
+
// that tab replays its stored result (exactly-once); any other tab
|
|
435
|
+
// would execute the action a second time. Last match wins — a
|
|
436
|
+
// reconnected tab registers after its lingering zombie socket.
|
|
437
|
+
for (const [client, info] of this.clientInfo) {
|
|
438
|
+
if (info.tabId === pinnedTabId && client.readyState === WebSocket.OPEN)
|
|
439
|
+
target = client;
|
|
440
|
+
}
|
|
441
|
+
if (!target) {
|
|
442
|
+
fail("The editor that first received this action is not back yet — it may already have been applied; verify before re-running manually", true);
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
const picked = this.pickEditorActionTarget(ws);
|
|
448
|
+
if (picked.conflictingThemes) {
|
|
449
|
+
fail(`Editors for different themes are connected (${picked.conflictingThemes.join(", ")}) — ` +
|
|
450
|
+
`close the editor tabs for the other themes and try again`);
|
|
451
|
+
break;
|
|
452
|
+
}
|
|
453
|
+
if (picked.hasUnidentified) {
|
|
454
|
+
// A tab with no theme identity next to identified ones could be on
|
|
455
|
+
// ANY theme — routing either way risks mutating the wrong one.
|
|
456
|
+
// Transient for a tab that is still loading, hence retryable.
|
|
457
|
+
fail("An editor tab that has not identified its theme is connected (old build or still loading) — reload or close that tab and try again", true);
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
if (!picked.target) {
|
|
461
|
+
fail("No editor connected — open the editor and try again");
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
target = picked.target;
|
|
465
|
+
if (picked.candidates > 1) {
|
|
466
|
+
const label = this.clientInfo.get(target)?.label ?? "the most recently active tab";
|
|
467
|
+
console.log(chalk.yellow(` ${picked.candidates} editors connected — sending "${message.action}" to ${label} only`));
|
|
468
|
+
}
|
|
469
|
+
const targetTabId = this.clientInfo.get(target)?.tabId;
|
|
470
|
+
if (targetTabId) {
|
|
471
|
+
this.forwardedEditorActions.set(message.requestId, targetTabId);
|
|
472
|
+
if (this.forwardedEditorActions.size > 500) {
|
|
473
|
+
const oldest = this.forwardedEditorActions.keys().next().value;
|
|
474
|
+
if (oldest !== undefined)
|
|
475
|
+
this.forwardedEditorActions.delete(oldest);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
366
478
|
}
|
|
367
|
-
this.pendingEditorActions.set(message.requestId, ws);
|
|
368
|
-
|
|
479
|
+
this.pendingEditorActions.set(message.requestId, { sender: ws, target });
|
|
480
|
+
this.sendTo(target, {
|
|
369
481
|
type: "editor-action",
|
|
370
482
|
requestId: message.requestId,
|
|
371
483
|
action: message.action,
|
|
372
484
|
payload: message.payload,
|
|
373
|
-
};
|
|
374
|
-
for (const client of otherClients) {
|
|
375
|
-
this.sendTo(client, forwarded);
|
|
376
|
-
}
|
|
485
|
+
});
|
|
377
486
|
break;
|
|
378
487
|
}
|
|
379
488
|
case "editor-action-result": {
|
|
380
489
|
// Editor replied to a previously forwarded `editor-action`. Route the
|
|
381
|
-
// result back to the original control-client sender.
|
|
382
|
-
|
|
490
|
+
// result back to the original control-client sender. Only the targeted
|
|
491
|
+
// editor may answer — except when a legacy target's socket dropped
|
|
492
|
+
// (`targetGone`): its reply arrives on a reconnected socket, and
|
|
493
|
+
// pre-routing servers accepted exactly that.
|
|
494
|
+
const pending = this.pendingEditorActions.get(message.requestId);
|
|
495
|
+
if (!pending)
|
|
496
|
+
break;
|
|
497
|
+
const fromTarget = pending.target === ws;
|
|
498
|
+
const legacyLateReply = pending.targetGone === true && !this.clientInfo.get(ws)?.isControl;
|
|
499
|
+
if (!fromTarget && !legacyLateReply)
|
|
500
|
+
break;
|
|
383
501
|
this.pendingEditorActions.delete(message.requestId);
|
|
384
|
-
|
|
385
|
-
|
|
502
|
+
// The exchange is complete — free the pin so the FIFO cap only ever
|
|
503
|
+
// holds in-flight or lost-reply requests.
|
|
504
|
+
this.forwardedEditorActions.delete(message.requestId);
|
|
505
|
+
if (pending.sender.readyState === WebSocket.OPEN) {
|
|
506
|
+
this.sendTo(pending.sender, {
|
|
386
507
|
type: "editor-action-result",
|
|
387
508
|
requestId: message.requestId,
|
|
388
509
|
success: message.success,
|
|
@@ -411,10 +532,85 @@ export class DevServerWebSocket {
|
|
|
411
532
|
* dead socket.
|
|
412
533
|
*/
|
|
413
534
|
dropPendingEditorActionsForClient(ws) {
|
|
414
|
-
for (const [requestId,
|
|
415
|
-
if (sender === ws)
|
|
535
|
+
for (const [requestId, pending] of this.pendingEditorActions) {
|
|
536
|
+
if (pending.sender === ws) {
|
|
537
|
+
// Nobody is left to retry or receive this request.
|
|
416
538
|
this.pendingEditorActions.delete(requestId);
|
|
539
|
+
this.forwardedEditorActions.delete(requestId);
|
|
540
|
+
continue;
|
|
541
|
+
}
|
|
542
|
+
if (pending.target === ws) {
|
|
543
|
+
if (this.forwardedEditorActions.has(requestId)) {
|
|
544
|
+
// Pinned target (new editor with a requestId dedup cache): fail fast
|
|
545
|
+
// so the CLI auto-retries the same requestId — the pin routes the
|
|
546
|
+
// retry back to this tab, whose cache makes it exactly-once.
|
|
547
|
+
this.pendingEditorActions.delete(requestId);
|
|
548
|
+
this.sendTo(pending.sender, {
|
|
549
|
+
type: "editor-action-result",
|
|
550
|
+
requestId,
|
|
551
|
+
success: false,
|
|
552
|
+
error: "The editor handling this action disconnected — it may already have been applied; verify before re-running manually",
|
|
553
|
+
retryable: true,
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
else {
|
|
557
|
+
// Legacy target (no dedup cache): a retry would re-execute the
|
|
558
|
+
// action, and its reply may still arrive on a reconnected socket.
|
|
559
|
+
// Keep waiting like pre-routing servers did; the CLI's own timeout
|
|
560
|
+
// bounds it.
|
|
561
|
+
pending.targetGone = true;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Pick the single editor that should run an `editor-action`, preferring the
|
|
568
|
+
* tab the user is looking at: most recently visible, then most recently
|
|
569
|
+
* active. Control clients are never targets.
|
|
570
|
+
*
|
|
571
|
+
* The server has no theme identity of its own, so ambiguity is refused, not
|
|
572
|
+
* guessed at: tabs reporting DIFFERENT themes → `conflictingThemes`; a tab
|
|
573
|
+
* with NO theme identity (old build or still loading) next to identified
|
|
574
|
+
* ones → `hasUnidentified` — that tab could be on any theme, and routing
|
|
575
|
+
* either way risks silently mutating the wrong one. Only an unambiguous
|
|
576
|
+
* pool (all identified with one theme, or all unidentified legacy tabs) is
|
|
577
|
+
* ranked.
|
|
578
|
+
*/
|
|
579
|
+
pickEditorActionTarget(sender) {
|
|
580
|
+
const entries = [];
|
|
581
|
+
for (const [client, info] of this.clientInfo) {
|
|
582
|
+
if (client === sender || info.isControl || client.readyState !== WebSocket.OPEN)
|
|
583
|
+
continue;
|
|
584
|
+
entries.push([client, info]);
|
|
585
|
+
}
|
|
586
|
+
const themeIds = new Set();
|
|
587
|
+
for (const [, info] of entries) {
|
|
588
|
+
if (info.themeId)
|
|
589
|
+
themeIds.add(info.themeId);
|
|
590
|
+
}
|
|
591
|
+
if (themeIds.size > 1) {
|
|
592
|
+
const labels = new Set();
|
|
593
|
+
for (const [, info] of entries) {
|
|
594
|
+
if (info.themeId)
|
|
595
|
+
labels.add(info.label ?? info.themeId);
|
|
596
|
+
}
|
|
597
|
+
return { target: null, candidates: entries.length, conflictingThemes: Array.from(labels) };
|
|
598
|
+
}
|
|
599
|
+
if (themeIds.size === 1 && entries.some(([, info]) => !info.themeId)) {
|
|
600
|
+
return { target: null, candidates: entries.length, hasUnidentified: true };
|
|
601
|
+
}
|
|
602
|
+
let target = null;
|
|
603
|
+
let best = null;
|
|
604
|
+
for (const [client, info] of entries) {
|
|
605
|
+
const wins = !best ||
|
|
606
|
+
info.lastVisibleAt > best.lastVisibleAt ||
|
|
607
|
+
(info.lastVisibleAt === best.lastVisibleAt && info.lastActivityAt > best.lastActivityAt);
|
|
608
|
+
if (wins) {
|
|
609
|
+
target = client;
|
|
610
|
+
best = info;
|
|
611
|
+
}
|
|
417
612
|
}
|
|
613
|
+
return { target, candidates: entries.length };
|
|
418
614
|
}
|
|
419
615
|
/**
|
|
420
616
|
* Send message to a specific client
|
|
@@ -429,7 +625,7 @@ export class DevServerWebSocket {
|
|
|
429
625
|
*/
|
|
430
626
|
broadcast(message) {
|
|
431
627
|
const data = JSON.stringify(message);
|
|
432
|
-
for (const client of this.
|
|
628
|
+
for (const client of this.clientInfo.keys()) {
|
|
433
629
|
if (client.readyState === WebSocket.OPEN) {
|
|
434
630
|
client.send(data);
|
|
435
631
|
}
|
|
@@ -478,13 +674,13 @@ export class DevServerWebSocket {
|
|
|
478
674
|
* Get number of connected clients
|
|
479
675
|
*/
|
|
480
676
|
get clientCount() {
|
|
481
|
-
return this.
|
|
677
|
+
return this.clientInfo.size;
|
|
482
678
|
}
|
|
483
679
|
/**
|
|
484
680
|
* Check if any clients are connected
|
|
485
681
|
*/
|
|
486
682
|
get hasClients() {
|
|
487
|
-
return this.
|
|
683
|
+
return this.clientInfo.size > 0;
|
|
488
684
|
}
|
|
489
685
|
/**
|
|
490
686
|
* Stop the WebSocket server
|
|
@@ -495,10 +691,11 @@ export class DevServerWebSocket {
|
|
|
495
691
|
resolve();
|
|
496
692
|
return;
|
|
497
693
|
}
|
|
498
|
-
for (const client of this.
|
|
694
|
+
for (const client of this.clientInfo.keys()) {
|
|
499
695
|
client.close();
|
|
500
696
|
}
|
|
501
|
-
this.
|
|
697
|
+
this.clientInfo.clear();
|
|
698
|
+
this.pendingEditorActions.clear();
|
|
502
699
|
const closeHttp = () => {
|
|
503
700
|
if (this.httpServer) {
|
|
504
701
|
this.httpServer.close(() => {
|