@dimina-kit/devtools 0.4.0-dev.20260702175315 → 0.4.0-dev.20260703051110

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.
Files changed (50) hide show
  1. package/dist/main/app/app.js +5 -25
  2. package/dist/main/app/native-overview.d.ts +27 -0
  3. package/dist/main/app/native-overview.js +44 -0
  4. package/dist/main/index.bundle.js +826 -690
  5. package/dist/main/ipc/bridge-router.js +180 -141
  6. package/dist/main/ipc/project-fs.js +39 -21
  7. package/dist/main/services/automation/handlers/app.js +143 -109
  8. package/dist/main/services/mcp/tools/simulator-tools.js +118 -97
  9. package/dist/main/services/network-forward/dispatch-batch.d.ts +22 -0
  10. package/dist/main/services/network-forward/dispatch-batch.js +21 -0
  11. package/dist/main/services/network-forward/index.js +5 -20
  12. package/dist/main/services/projects/create-project-service.js +54 -34
  13. package/dist/main/services/projects/types.d.ts +1 -32
  14. package/dist/main/services/service-console/console-api.js +36 -27
  15. package/dist/main/services/simulator-temp-files/disk.js +109 -86
  16. package/dist/main/services/workbench-coi-server.js +58 -45
  17. package/dist/main/utils/logger.d.ts +5 -12
  18. package/dist/main/utils/logger.js +5 -45
  19. package/dist/preload/instrumentation/wxml-extract.js +94 -62
  20. package/dist/preload/runtime/main-api-runner.d.ts +1 -1
  21. package/dist/preload/windows/main.cjs +284 -565
  22. package/dist/preload/windows/main.cjs.map +2 -2
  23. package/dist/preload/windows/simulator.cjs +37 -39
  24. package/dist/preload/windows/simulator.cjs.map +2 -2
  25. package/dist/preload/windows/simulator.js +37 -39
  26. package/dist/render-host/render-inspect.js +63 -52
  27. package/dist/renderer/assets/index-D-ksyN1p.js +49 -0
  28. package/dist/renderer/assets/workbenchSettings-COhuFF-i.js +8 -0
  29. package/dist/renderer/entries/main/index.html +1 -1
  30. package/dist/renderer/entries/workbench-settings/index.html +1 -1
  31. package/dist/shared/appdata-accumulator.js +53 -48
  32. package/dist/shared/open-in-editor-resource-path.d.ts +56 -0
  33. package/dist/shared/open-in-editor-resource-path.js +133 -0
  34. package/dist/shared/open-in-editor.d.ts +2 -9
  35. package/dist/shared/open-in-editor.js +8 -93
  36. package/dist/shared/types.d.ts +13 -0
  37. package/dist/simulator/assets/{device-shell-CUl0ILfn.js → device-shell-CiLAPa0I.js} +2 -2
  38. package/dist/simulator/assets/simulator-Dvnxry3y.js +10 -0
  39. package/dist/simulator/simulator.html +1 -1
  40. package/dist/vscode-workbench/assets/__vite-browser-external-CXi6Kz9W.js +1 -0
  41. package/dist/vscode-workbench/assets/{dist-CS7SQP3K.js → dist-TpGpmMGi.js} +3 -3
  42. package/dist/vscode-workbench/assets/{iconv-lite-umd-D3q-1-o6.js → iconv-lite-umd-C9tiCAJa.js} +1 -1
  43. package/dist/vscode-workbench/assets/{index-zjigpZ25.js → index-DJ1HyMZ7.js} +20 -22
  44. package/dist/vscode-workbench/assets/{jschardet-Cu4ufeHq.js → jschardet-DE1jV513.js} +1 -1
  45. package/dist/vscode-workbench/index.html +1 -1
  46. package/package.json +5 -5
  47. package/dist/renderer/assets/index-B-Dqb7G0.js +0 -49
  48. package/dist/renderer/assets/workbenchSettings-Bim9ol9R.js +0 -8
  49. package/dist/simulator/assets/simulator-Dz8iGcgy.js +0 -10
  50. package/dist/vscode-workbench/assets/__vite-browser-external-B0DTNerG.js +0 -1
@@ -381,53 +381,51 @@ function installConsoleInstrumentation() {
381
381
  }
382
382
 
383
383
  // src/shared/appdata-accumulator.ts
384
- function decodeWorkerMessage(message) {
385
- let payload = message;
386
- if (typeof payload === "string") {
387
- try {
388
- payload = JSON.parse(payload);
389
- } catch {
390
- return null;
391
- }
384
+ function parseMessagePayload(message) {
385
+ if (typeof message !== "string") return message;
386
+ try {
387
+ return JSON.parse(message);
388
+ } catch {
389
+ return null;
392
390
  }
391
+ }
392
+ function decodeUpdateBatchBody(rawBody) {
393
+ const body = rawBody;
394
+ if (!body || typeof body !== "object") return null;
395
+ if (typeof body.bridgeId !== "string" || !Array.isArray(body.updates)) return null;
396
+ const out = [];
397
+ for (const u of body.updates) {
398
+ if (!u || typeof u.moduleId !== "string") continue;
399
+ if (!u.moduleId.startsWith("page_")) continue;
400
+ out.push({ mode: "patch", bridgeId: body.bridgeId, moduleId: u.moduleId, data: u.data });
401
+ }
402
+ return out.length > 0 ? out : null;
403
+ }
404
+ function decodePageInitBody(moduleId, rawBody) {
405
+ const body = rawBody;
406
+ if (!body || typeof body !== "object") return null;
407
+ if (typeof body.bridgeId !== "string" || typeof body.path !== "string") return null;
408
+ if (!body.data || typeof body.data !== "object") return null;
409
+ return [{
410
+ mode: "init",
411
+ bridgeId: body.bridgeId,
412
+ moduleId,
413
+ componentPath: body.path,
414
+ data: body.data
415
+ }];
416
+ }
417
+ function decodeWorkerMessage(message) {
418
+ const payload = parseMessagePayload(message);
393
419
  if (!payload || typeof payload !== "object") return null;
394
420
  const record = payload;
395
- if (record.type === "ub") {
396
- const body = record.body;
397
- if (!body || typeof body !== "object") return null;
398
- if (typeof body.bridgeId !== "string" || !Array.isArray(body.updates)) return null;
399
- const out = [];
400
- for (const u of body.updates) {
401
- if (!u || typeof u.moduleId !== "string") continue;
402
- if (!u.moduleId.startsWith("page_")) continue;
403
- out.push({ mode: "patch", bridgeId: body.bridgeId, moduleId: u.moduleId, data: u.data });
404
- }
405
- return out.length > 0 ? out : null;
406
- }
421
+ if (record.type === "ub") return decodeUpdateBatchBody(record.body);
407
422
  if (typeof record.type === "string" && record.type.startsWith("page_")) {
408
- const body = record.body;
409
- if (!body || typeof body !== "object") return null;
410
- if (typeof body.bridgeId !== "string" || typeof body.path !== "string") return null;
411
- if (!body.data || typeof body.data !== "object") return null;
412
- return [{
413
- mode: "init",
414
- bridgeId: body.bridgeId,
415
- moduleId: record.type,
416
- componentPath: body.path,
417
- data: body.data
418
- }];
423
+ return decodePageInitBody(record.type, record.body);
419
424
  }
420
425
  return null;
421
426
  }
422
427
  function decodeOutgoingMessage(message) {
423
- let payload = message;
424
- if (typeof payload === "string") {
425
- try {
426
- payload = JSON.parse(payload);
427
- } catch {
428
- return null;
429
- }
430
- }
428
+ const payload = parseMessagePayload(message);
431
429
  if (!payload || typeof payload !== "object") return null;
432
430
  const r = payload;
433
431
  if (typeof r.type !== "string") return null;
@@ -99,20 +99,32 @@
99
99
  if (/^[A-Z]/.test(name)) return pascalToKebab(name);
100
100
  return name;
101
101
  }
102
+ function isSkippedProp(key, value) {
103
+ if (typeof value === "function" || value === void 0) return true;
104
+ if (key === "data" || key.startsWith("__")) return true;
105
+ return typeof value === "boolean" && !value;
106
+ }
107
+ function cleanClassAttr(value) {
108
+ return value.split(/\s+/).filter((c) => !c.startsWith("dd-")).join(" ");
109
+ }
110
+ function stringifyPropValue(value) {
111
+ return typeof value === "object" ? JSON.stringify(value) : String(value);
112
+ }
113
+ function assignProp(out, key, value) {
114
+ if (isSkippedProp(key, value)) return;
115
+ if (key === "class" && typeof value === "string") {
116
+ const cleaned = cleanClassAttr(value);
117
+ if (cleaned) out[key] = cleaned;
118
+ return;
119
+ }
120
+ out[key] = stringifyPropValue(value);
121
+ }
102
122
  function extractProps(instance) {
103
123
  const out = {};
104
124
  for (const raw of [instance.props, instance.attrs]) {
105
125
  if (!raw) continue;
106
126
  for (const [k, v] of Object.entries(raw)) {
107
- if (typeof v === "function" || v === void 0) continue;
108
- if (k === "data" || k.startsWith("__")) continue;
109
- if (typeof v === "boolean" && !v) continue;
110
- if (k === "class" && typeof v === "string") {
111
- const cleaned = v.split(/\s+/).filter((c) => !c.startsWith("dd-")).join(" ");
112
- if (cleaned) out[k] = cleaned;
113
- continue;
114
- }
115
- out[k] = typeof v === "object" ? JSON.stringify(v) : String(v);
127
+ assignProp(out, k, v);
116
128
  }
117
129
  }
118
130
  return out;
@@ -153,56 +165,55 @@
153
165
  const children = typeof vnode.children === "string" ? vnode.children : "";
154
166
  return /^v-(if|else|else-if|for)$/.test(children);
155
167
  }
168
+ function textNode(text) {
169
+ return { tagName: "#text", attrs: {}, children: [], text };
170
+ }
171
+ function childrenFromComponentVNode(component, depth) {
172
+ const result = walkInstance(component, depth + 1);
173
+ if (!result) return [];
174
+ return Array.isArray(result) ? result : [result];
175
+ }
176
+ function childrenFromSuspenseVNode(suspense, depth) {
177
+ const activeBranch = suspense.activeBranch;
178
+ return activeBranch ? extractChildrenFromVNode(activeBranch, depth + 1) : [];
179
+ }
180
+ function directTextChild(vnode) {
181
+ if (typeof vnode.children !== "string" || !vnode.children.trim()) return null;
182
+ const vnodeType = vnode.type;
183
+ if (typeof vnodeType !== "symbol" && typeof vnodeType !== "string") return null;
184
+ return [textNode(vnode.children.trim())];
185
+ }
186
+ function textChildEntry(child) {
187
+ const trimmed = child.trim();
188
+ return trimmed ? [textNode(trimmed)] : [];
189
+ }
190
+ function domTypedChildEntries(c, depth) {
191
+ if (isInternalElement(c)) return extractChildrenFromVNode(c, depth + 1);
192
+ if (typeof c.children === "string" && c.children.trim()) return [textNode(c.children.trim())];
193
+ return extractChildrenFromVNode(c, depth + 1);
194
+ }
195
+ function extractChildEntry(child, depth) {
196
+ if (!child) return [];
197
+ if (typeof child === "string") return textChildEntry(child);
198
+ if (typeof child !== "object") return [];
199
+ const c = child;
200
+ if (c.component) return childrenFromComponentVNode(c.component, depth);
201
+ if (typeof c.type === "symbol") return extractChildrenFromVNode(c, depth + 1);
202
+ if (typeof c.type === "string") return domTypedChildEntries(c, depth);
203
+ return extractChildrenFromVNode(c, depth + 1);
204
+ }
156
205
  function extractChildrenFromVNode(vnode, depth) {
157
206
  if (!vnode || depth > 50) return [];
158
207
  if (isCommentVNode(vnode)) return [];
159
- if (vnode.component) {
160
- const result2 = walkInstance(vnode.component, depth + 1);
161
- return result2 ? Array.isArray(result2) ? result2 : [result2] : [];
162
- }
163
- if (vnode.suspense) {
164
- const suspense = vnode.suspense;
165
- const activeBranch = suspense.activeBranch;
166
- return activeBranch ? extractChildrenFromVNode(activeBranch, depth + 1) : [];
167
- }
168
- if (typeof vnode.children === "string" && vnode.children.trim()) {
169
- const vnodeType = vnode.type;
170
- if (typeof vnodeType === "symbol" || typeof vnodeType === "string") {
171
- return [{ tagName: "#text", attrs: {}, children: [], text: vnode.children.trim() }];
172
- }
173
- }
208
+ if (vnode.component) return childrenFromComponentVNode(vnode.component, depth);
209
+ if (vnode.suspense) return childrenFromSuspenseVNode(vnode.suspense, depth);
210
+ const directText = directTextChild(vnode);
211
+ if (directText) return directText;
174
212
  const kids = vnode.children;
175
213
  if (!Array.isArray(kids)) return [];
176
214
  const result = [];
177
215
  for (const child of kids) {
178
- if (!child) continue;
179
- if (typeof child === "string") {
180
- const trimmed = child.trim();
181
- if (trimmed) result.push({ tagName: "#text", attrs: {}, children: [], text: trimmed });
182
- continue;
183
- }
184
- if (typeof child !== "object") continue;
185
- const c = child;
186
- if (c.component) {
187
- const walked = walkInstance(c.component, depth + 1);
188
- if (walked) result.push(...Array.isArray(walked) ? walked : [walked]);
189
- continue;
190
- }
191
- if (typeof c.type === "symbol") {
192
- result.push(...extractChildrenFromVNode(c, depth + 1));
193
- continue;
194
- }
195
- if (typeof c.type === "string") {
196
- if (isInternalElement(c)) {
197
- result.push(...extractChildrenFromVNode(c, depth + 1));
198
- } else if (typeof c.children === "string" && c.children.trim()) {
199
- result.push({ tagName: "#text", attrs: {}, children: [], text: c.children.trim() });
200
- } else {
201
- result.push(...extractChildrenFromVNode(c, depth + 1));
202
- }
203
- continue;
204
- }
205
- result.push(...extractChildrenFromVNode(c, depth + 1));
216
+ result.push(...extractChildEntry(child, depth));
206
217
  }
207
218
  return result;
208
219
  }