@dimina-kit/devtools 0.4.0-dev.20260731100034 → 0.4.0-dev.20260801163345

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.
@@ -1,4 +1,26 @@
1
1
  "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
2
24
 
3
25
  // src/preload/shared/expose.ts
4
26
  var import_electron = require("electron");
@@ -485,6 +507,31 @@ function installCustomApisBridge() {
485
507
  return exposeOnMainWorld("__diminaCustomApis", bridge);
486
508
  }
487
509
 
510
+ // src/preload/runtime/node-bindings.ts
511
+ var import_node_fs = __toESM(require("node:fs"), 1);
512
+ var import_node_os = __toESM(require("node:os"), 1);
513
+ var import_node_path = __toESM(require("node:path"), 1);
514
+ var import_node_crypto = __toESM(require("node:crypto"), 1);
515
+ var import_node_buffer = __toESM(require("node:buffer"), 1);
516
+
517
+ // ../dimina-electron-runtime/dist/shared/node-bindings.js
518
+ var NODE_BINDINGS_GLOBAL = "__diminaNodeBindings";
519
+
520
+ // src/preload/runtime/node-bindings.ts
521
+ function installNodeBindings() {
522
+ const existing = Object.getOwnPropertyDescriptor(globalThis, NODE_BINDINGS_GLOBAL);
523
+ if (existing && !existing.configurable) {
524
+ return;
525
+ }
526
+ const bindings = Object.freeze({ fs: import_node_fs.default, os: import_node_os.default, path: import_node_path.default, crypto: import_node_crypto.default, buffer: import_node_buffer.default });
527
+ Object.defineProperty(globalThis, NODE_BINDINGS_GLOBAL, {
528
+ value: bindings,
529
+ writable: false,
530
+ configurable: false,
531
+ enumerable: true
532
+ });
533
+ }
534
+
488
535
  // src/preload/runtime/temp-files.ts
489
536
  var import_electron3 = require("electron");
490
537
 
@@ -497,18 +544,18 @@ function setTempFileSink(sink) {
497
544
  // src/preload/runtime/temp-files.ts
498
545
  function installTempFileBridge() {
499
546
  setTempFileSink({
500
- write(path, blob) {
547
+ write(path2, blob) {
501
548
  blob.arrayBuffer().then((bytes) => {
502
549
  import_electron3.ipcRenderer.send("simulator:temp-file:write", {
503
- path,
550
+ path: path2,
504
551
  mime: blob.type,
505
552
  bytes
506
553
  });
507
554
  }).catch(() => {
508
555
  });
509
556
  },
510
- revoke(path) {
511
- import_electron3.ipcRenderer.send("simulator:temp-file:revoke", { path });
557
+ revoke(path2) {
558
+ import_electron3.ipcRenderer.send("simulator:temp-file:revoke", { path: path2 });
512
559
  },
513
560
  revokeAll() {
514
561
  import_electron3.ipcRenderer.send("simulator:temp-file:revoke-all");
@@ -955,11 +1002,25 @@ function setupApiCompatHook() {
955
1002
  var import_electron5 = require("electron");
956
1003
 
957
1004
  // ../dimina-electron-runtime/dist/shared/dmb-resource-url.js
958
- var DMB_SDK_PREFIX = "/__sdk__/";
1005
+ var DMB_PAGEFRAME_DOC_NAME = "__frame__.html";
959
1006
  function buildRenderHostDocumentUrl(opts) {
960
- const url = new URL(`dmb-resource://${opts.bridgeId}${DMB_SDK_PREFIX}render-host/pageFrame.html`);
1007
+ const PATH_SEPARATOR_RE = /[/\\]/;
1008
+ for (const [name, value] of [["appId", opts.appId], ["root", opts.root]]) {
1009
+ if (PATH_SEPARATOR_RE.test(value) || value === "." || value === "..") {
1010
+ throw new Error(`[dmb-resource-url] ${name} must be a single path segment, got ${JSON.stringify(value)}`);
1011
+ }
1012
+ }
1013
+ const pageDirSegments = opts.pagePath.split(PATH_SEPARATOR_RE).slice(0, -1).filter(Boolean);
1014
+ for (const segment of pageDirSegments) {
1015
+ if (segment === "." || segment === "..") {
1016
+ throw new Error(`[dmb-resource-url] pagePath must not contain '.'/'..' segments, got ${JSON.stringify(opts.pagePath)}`);
1017
+ }
1018
+ }
1019
+ const pathSegments = [opts.appId, opts.root, ...pageDirSegments, DMB_PAGEFRAME_DOC_NAME].map(encodeURIComponent);
1020
+ const url = new URL(`dmb-resource://${opts.bridgeId}/${pathSegments.join("/")}`);
961
1021
  url.searchParams.set("bridgeId", opts.bridgeId);
962
1022
  url.searchParams.set("appId", opts.appId);
1023
+ url.searchParams.set("root", opts.root);
963
1024
  url.searchParams.set("pagePath", opts.pagePath);
964
1025
  if (opts.isTab)
965
1026
  url.searchParams.set("isTab", "1");
@@ -1044,6 +1105,7 @@ function installClipboardBridge() {
1044
1105
  }
1045
1106
 
1046
1107
  // src/preload/windows/simulator.ts
1108
+ installNodeBindings();
1047
1109
  setupApiCompatHook();
1048
1110
  installSimulatorBridge();
1049
1111
  installCustomApisBridge();