devframe 1.2.0 → 1.2.2

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.
@@ -2,7 +2,7 @@ import { a as defineDiagnostics, i as createBirpc, n as argsToJsonSchema, o as D
2
2
  import { t as hash } from "../hash-DdPnc4k3.mjs";
3
3
  import { createEventEmitter } from "../utils/events.mjs";
4
4
  import { withBase, withProtocol } from "../utils/url.mjs";
5
- import { t as createSharedState } from "../shared-state-eQVYHNqA.mjs";
5
+ import { t as createSharedState } from "../shared-state-Cow3u-_m.mjs";
6
6
  import { i as structuredCloneStringify, n as structuredCloneParse, t as structuredCloneDeserialize } from "../structured-clone-CgtQ61SA.mjs";
7
7
  import { createStreamReader, createStreamSink } from "../utils/streaming-channel.mjs";
8
8
  import { toAgentToolName } from "../utils/agent-tool-name.mjs";
@@ -1,6 +1,6 @@
1
1
  import { a as defineDiagnostics, i as createBirpc, n as argsToJsonSchema, o as DEVFRAME_EVENTS, r as resolveAgentSafety, t as toolInputToRpcArgs } from "../tool-input-BAQXvvqL.mjs";
2
2
  import { createEventEmitter } from "../utils/events.mjs";
3
- import { t as createSharedState } from "../shared-state-eQVYHNqA.mjs";
3
+ import { t as createSharedState } from "../shared-state-Cow3u-_m.mjs";
4
4
  import { nanoid } from "../utils/nanoid.mjs";
5
5
  import { r as registerBrowserAgentTool } from "../browser-agent-Pu-FLk6I.mjs";
6
6
  //#region src/in-page-channel/diagnostics.ts
@@ -1,6 +1,6 @@
1
1
  import { createEventEmitter } from "./utils/events.mjs";
2
2
  import { nanoid } from "./utils/nanoid.mjs";
3
- //#region ../../node_modules/.pnpm/immer@11.1.18/node_modules/immer/dist/immer.mjs
3
+ //#region ../../node_modules/.pnpm/immer@11.1.21/node_modules/immer/dist/immer.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");
@@ -384,7 +384,7 @@ var objectTraps = {
384
384
  const currentState = current2?.[DRAFT_STATE];
385
385
  if (currentState && currentState.base_ === value) {
386
386
  state.copy_[prop] = value;
387
- state.assigned_.set(prop, false);
387
+ state.assigned_.delete(prop);
388
388
  return true;
389
389
  }
390
390
  if (is(value, current2) && (value !== void 0 || has(state.base_, prop, state.type_))) return true;
@@ -69,20 +69,29 @@ var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
69
69
  module.exports.createColors = createColors;
70
70
  }));
71
71
  //#endregion
72
- //#region ../../node_modules/.pnpm/shell-quote@1.11.0/node_modules/shell-quote/quote.js
72
+ //#region ../../node_modules/.pnpm/shell-quote@1.12.0/node_modules/shell-quote/quote.js
73
73
  var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
74
74
  /** @import { ControlOperator } from './parse' */
75
75
  /** @type {ControlOperator['op'][]} */
76
76
  var OPS = [
77
77
  "||",
78
78
  "&&",
79
+ ";;&",
79
80
  ";;",
81
+ ";&",
80
82
  "|&",
81
83
  "<(",
84
+ ">(",
82
85
  "<<<",
86
+ "<<-",
87
+ "<<",
83
88
  ">>",
84
89
  ">&",
90
+ ">|",
91
+ "&>>",
92
+ "&>",
85
93
  "<&",
94
+ "<>",
86
95
  "&",
87
96
  ";",
88
97
  "(",
@@ -125,7 +134,7 @@ var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
125
134
  };
126
135
  }));
127
136
  //#endregion
128
- //#region ../../node_modules/.pnpm/shell-quote@1.11.0/node_modules/shell-quote/parse.js
137
+ //#region ../../node_modules/.pnpm/shell-quote@1.12.0/node_modules/shell-quote/parse.js
129
138
  var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
130
139
  /**
131
140
  * @import {
@@ -136,14 +145,16 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
136
145
  * } from './parse' */
137
146
  var CONTROL = "(?:" + [
138
147
  "\\|\\|",
139
- "\\&\\&",
140
- ";;",
141
- "\\|\\&",
148
+ "\\&(?:\\&|>>?)",
149
+ ";;\\&?",
150
+ "[;|]\\&",
142
151
  "\\<\\(",
143
152
  "\\<\\<\\<",
153
+ "\\<\\<-",
154
+ "\\<\\<(?!\\()",
144
155
  ">>",
145
- ">\\&",
146
- "<\\&",
156
+ ">[&|(]",
157
+ "<[&>]",
147
158
  "[&;()|<>]"
148
159
  ].join("|") + ")";
149
160
  var controlRE = new RegExp("^" + CONTROL + "$");
@@ -391,13 +402,13 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
391
402
  };
392
403
  }));
393
404
  //#endregion
394
- //#region ../../node_modules/.pnpm/shell-quote@1.11.0/node_modules/shell-quote/index.js
405
+ //#region ../../node_modules/.pnpm/shell-quote@1.12.0/node_modules/shell-quote/index.js
395
406
  var require_shell_quote = /* @__PURE__ */ __commonJSMin(((exports) => {
396
407
  exports.quote = require_quote();
397
408
  exports.parse = require_parse();
398
409
  }));
399
410
  //#endregion
400
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/macos.js
411
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/editor-info/macos.js
401
412
  var require_macos = /* @__PURE__ */ __commonJSMin(((exports, module) => {
402
413
  module.exports = {
403
414
  "/Applications/Atom.app/Contents/MacOS/Atom": "atom",
@@ -432,7 +443,7 @@ var require_macos = /* @__PURE__ */ __commonJSMin(((exports, module) => {
432
443
  };
433
444
  }));
434
445
  //#endregion
435
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/linux.js
446
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/editor-info/linux.js
436
447
  var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
437
448
  module.exports = {
438
449
  atom: "atom",
@@ -466,7 +477,7 @@ var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
466
477
  };
467
478
  }));
468
479
  //#endregion
469
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/windows.js
480
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/editor-info/windows.js
470
481
  var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
471
482
  module.exports = [
472
483
  "Brackets.exe",
@@ -499,9 +510,9 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
499
510
  ];
500
511
  }));
501
512
  //#endregion
502
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/guess.js
513
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/guess.js
503
514
  var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
504
- const path$2 = __require("path");
515
+ const path$3 = __require("path");
505
516
  const shellQuote = require_shell_quote();
506
517
  const childProcess$1 = __require("child_process");
507
518
  const COMMON_EDITORS_MACOS = require_macos();
@@ -525,7 +536,7 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
525
536
  const runningProcesses = output.split("\r\n");
526
537
  for (let i = 0; i < runningProcesses.length; i++) {
527
538
  const fullProcessPath = runningProcesses[i].trim();
528
- const shortProcessName = path$2.win32.basename(fullProcessPath);
539
+ const shortProcessName = path$3.win32.basename(fullProcessPath);
529
540
  if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) return fullProcessPath;
530
541
  }
531
542
  }
@@ -574,11 +585,15 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
574
585
  module.exports.getEditorFromLinuxProcesses = getEditorFromLinuxProcesses;
575
586
  }));
576
587
  //#endregion
577
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/get-args.js
588
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/get-args.js
578
589
  var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
579
- const path$1 = __require("path");
580
- module.exports = function getArgumentsForPosition(editor, fileName, lineNumber, columnNumber = 1) {
581
- switch (path$1.basename(editor).replace(/\.(exe|cmd|bat)$/i, "")) {
590
+ const os = __require("os");
591
+ const path$2 = __require("path");
592
+ module.exports = function getArgumentsForFile(editor, fileName, lineNumber, columnNumber = 1) {
593
+ fileName = path$2.resolve(fileName);
594
+ if (process.platform === "linux" && fileName.startsWith("/mnt/") && /Microsoft/i.test(os.release())) fileName = `./${path$2.relative("", fileName)}`;
595
+ if (!lineNumber) return [fileName];
596
+ switch (path$2.basename(editor).replace(/\.(exe|cmd|bat)$/i, "")) {
582
597
  case "atom":
583
598
  case "Atom":
584
599
  case "Atom Beta":
@@ -653,6 +668,41 @@ var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
653
668
  };
654
669
  }));
655
670
  //#endregion
671
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/construct-windows-launch-command.js
672
+ var require_construct_windows_launch_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
673
+ function escapeCmdArgs(cmdArgs) {
674
+ return cmdArgs.replace(/([&|<>,;=^])/g, "^$1");
675
+ }
676
+ function doubleQuoteIfNeeded(str) {
677
+ if (str.includes("^")) return `^"${str}^"`;
678
+ else if (str.includes(" ")) return `"${str}"`;
679
+ return str;
680
+ }
681
+ function constructWindowsLaunchCommand(editor, args) {
682
+ if (args.some((arg) => /[\r\n]/.test(arg))) throw new Error("Cannot launch an editor with an argument containing a line break");
683
+ if (args.some((arg) => arg.includes("%"))) throw new Error("Cannot launch an editor with an argument containing \"%\"");
684
+ return [editor, ...args.map(escapeCmdArgs)].map(doubleQuoteIfNeeded).join(" ");
685
+ }
686
+ module.exports = constructWindowsLaunchCommand;
687
+ }));
688
+ //#endregion
689
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/parse-file.js
690
+ var require_parse_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
691
+ const path$1 = __require("path");
692
+ const positionRE = /:(\d+)(:(\d+))?$/;
693
+ module.exports = function parseFile(file) {
694
+ if (file.startsWith("file://")) file = __require("url").fileURLToPath(file);
695
+ const unresolvedFileName = file.replace(positionRE, "");
696
+ const fileName = unresolvedFileName ? path$1.resolve(unresolvedFileName) : "";
697
+ const match = file.match(positionRE);
698
+ return {
699
+ fileName,
700
+ lineNumber: match && match[1],
701
+ columnNumber: match && match[3]
702
+ };
703
+ };
704
+ }));
705
+ //#endregion
656
706
  //#region src/utils/launch-editor.ts
657
707
  var import_launch_editor = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
658
708
  /**
@@ -665,12 +715,13 @@ var import_launch_editor = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
665
715
  * Modified by Yuxi Evan You
666
716
  */
667
717
  const fs = __require("fs");
668
- const os = __require("os");
669
718
  const path = __require("path");
670
719
  const colors = require_picocolors();
671
720
  const childProcess = __require("child_process");
672
721
  const guessEditor = require_guess();
673
- const getArgumentsForPosition = require_get_args();
722
+ const getArgumentsForFile = require_get_args();
723
+ const constructWindowsLaunchCommand = require_construct_windows_launch_command();
724
+ const parseFile = require_parse_file();
674
725
  function wrapErrorCallback(cb) {
675
726
  return (fileName, errorMessage) => {
676
727
  console.log();
@@ -691,55 +742,36 @@ var import_launch_editor = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
691
742
  }
692
743
  return false;
693
744
  }
694
- const positionRE = /:(\d+)(:(\d+))?$/;
695
- function parseFile(file) {
696
- if (file.startsWith("file://")) file = __require("url").fileURLToPath(file);
697
- const fileName = file.replace(positionRE, "");
698
- const match = file.match(positionRE);
699
- return {
700
- fileName,
701
- lineNumber: match && match[1],
702
- columnNumber: match && match[3]
703
- };
704
- }
705
745
  let currentChildProcess = null;
706
746
  function launchEditor(file, specifiedEditor, onErrorCallback) {
707
- const parsed = parseFile(file);
708
- let { fileName } = parsed;
709
- const { lineNumber, columnNumber } = parsed;
710
- if (process.platform === "win32" && path.resolve(fileName).startsWith("\\\\")) return onErrorCallback(fileName, "UNC paths are not supported on Windows to avoid security issues. See https://github.com/vitejs/launch-editor/tree/main/packages/launch-editor#unc-paths-on-windows for details.");
711
- if (!fs.existsSync(fileName)) return;
747
+ const { fileName, lineNumber, columnNumber } = parseFile(file);
712
748
  if (typeof specifiedEditor === "function") {
713
749
  onErrorCallback = specifiedEditor;
714
750
  specifiedEditor = void 0;
715
751
  }
716
752
  onErrorCallback = wrapErrorCallback(onErrorCallback);
753
+ if (process.platform === "win32" && fileName.startsWith("\\\\")) return onErrorCallback(fileName, "UNC paths are not supported on Windows to avoid security issues. See https://github.com/vitejs/launch-editor/tree/main/packages/launch-editor#unc-paths-on-windows for details.");
754
+ if (!fs.existsSync(fileName)) return;
717
755
  const [editor, ...args] = guessEditor(specifiedEditor);
718
756
  if (!editor) {
719
757
  onErrorCallback(fileName, null);
720
758
  return;
721
759
  }
722
- if (process.platform === "linux" && fileName.startsWith("/mnt/") && /Microsoft/i.test(os.release())) fileName = path.relative("", fileName);
723
- if (lineNumber) {
724
- const extraArgs = getArgumentsForPosition(editor, fileName, lineNumber, columnNumber);
725
- args.push.apply(args, extraArgs);
726
- } else args.push(fileName);
760
+ const extraArgs = getArgumentsForFile(editor, fileName, lineNumber, columnNumber);
761
+ args.push.apply(args, extraArgs);
762
+ let launchCommand;
763
+ if (process.platform === "win32") try {
764
+ launchCommand = constructWindowsLaunchCommand(editor, args);
765
+ } catch (error) {
766
+ onErrorCallback(fileName, error.message);
767
+ return;
768
+ }
727
769
  if (currentChildProcess && isTerminalEditor(editor)) currentChildProcess.kill("SIGKILL");
728
- if (process.platform === "win32") {
729
- function escapeCmdArgs(cmdArgs) {
730
- return cmdArgs.replace(/([&|<>,;=^])/g, "^$1");
731
- }
732
- function doubleQuoteIfNeeded(str) {
733
- if (str.includes("^")) return `^"${str}^"`;
734
- else if (str.includes(" ")) return `"${str}"`;
735
- return str;
736
- }
737
- const launchCommand = [editor, ...args.map(escapeCmdArgs)].map(doubleQuoteIfNeeded).join(" ");
738
- currentChildProcess = childProcess.exec(launchCommand, {
739
- stdio: "inherit",
740
- shell: true
741
- });
742
- } else currentChildProcess = childProcess.spawn(editor, args, { stdio: "inherit" });
770
+ if (process.platform === "win32") currentChildProcess = childProcess.exec(launchCommand, {
771
+ stdio: "inherit",
772
+ shell: true
773
+ });
774
+ else currentChildProcess = childProcess.spawn(editor, args, { stdio: "inherit" });
743
775
  currentChildProcess.on("exit", function(errorCode) {
744
776
  currentChildProcess = null;
745
777
  if (errorCode) onErrorCallback(fileName, "(code " + errorCode + ")");
@@ -1,2 +1,2 @@
1
- import { t as createSharedState } from "../shared-state-eQVYHNqA.mjs";
1
+ import { t as createSharedState } from "../shared-state-Cow3u-_m.mjs";
2
2
  export { createSharedState };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "devframe",
3
3
  "type": "module",
4
- "version": "1.2.0",
4
+ "version": "1.2.2",
5
5
  "description": "Framework for building one portable devtool integration that runs in any viewer.",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -77,7 +77,7 @@
77
77
  "skills"
78
78
  ],
79
79
  "peerDependencies": {
80
- "@devframes/agentic": "1.2.0",
80
+ "@devframes/agentic": "1.2.2",
81
81
  "cac": "^7.0.0"
82
82
  },
83
83
  "peerDependenciesMeta": {
@@ -90,18 +90,18 @@
90
90
  },
91
91
  "dependencies": {
92
92
  "crossws": "^0.4.12",
93
- "h3": "^2.0.1-rc.32",
93
+ "h3": "^2.0.1",
94
94
  "nostics": "^1.3.0",
95
95
  "pathe": "^2.0.3"
96
96
  },
97
97
  "devDependencies": {
98
- "@devframes/agentic": "1.2.0",
98
+ "@devframes/agentic": "1.2.2",
99
99
  "@standard-schema/spec": "^1.1.0",
100
100
  "birpc": "^4.2.0",
101
101
  "cac": "^7.0.0",
102
102
  "get-port-please": "^3.2.0",
103
- "immer": "^11.1.18",
104
- "launch-editor": "^2.14.1",
103
+ "immer": "^11.1.21",
104
+ "launch-editor": "^2.14.2",
105
105
  "mlly": "^1.8.2",
106
106
  "mrmime": "^2.0.1",
107
107
  "obug": "^3.0.0",