devframe 0.1.21 → 0.1.22
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/README.md +41 -18
- package/dist/{_shared-iZy45oG3.mjs → _shared-DcJX9-Az.mjs} +2 -2
- package/dist/adapters/build.d.mts +5 -5
- package/dist/adapters/build.mjs +13 -12
- package/dist/adapters/cli.d.mts +2 -2
- package/dist/adapters/cli.mjs +5 -5
- package/dist/adapters/dev.d.mts +18 -9
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +5 -5
- package/dist/adapters/embedded.mjs +2 -2
- package/dist/adapters/mcp.d.mts +3 -3
- package/dist/adapters/mcp.mjs +5 -5
- package/dist/adapters/vite.d.mts +45 -12
- package/dist/adapters/vite.mjs +81 -18
- package/dist/chunk-e9Ob2GDo.mjs +26 -0
- package/dist/client/index.d.mts +10 -5
- package/dist/client/index.mjs +19 -10
- package/dist/colors-Bl4W18Mh.mjs +123 -0
- package/dist/{context-internal-saIAfNVw.d.mts → context-DBd794Rn.d.mts} +2 -2
- package/dist/{context-BJ4r2SmR.mjs → context-DUibxhrR.mjs} +14 -31
- package/dist/{dev-CdAy400a.mjs → dev-BGpTpYiR.mjs} +19 -20
- package/dist/{devtool-CNvLs2_Y.d.mts → devframe-DulcIxwu.d.mts} +49 -58
- package/dist/{diagnostics-DxPnRoXO.mjs → diagnostics-BFhNNmST.mjs} +7 -2
- package/dist/hash-BHZbo80D.mjs +126 -0
- package/dist/{human-id-BLoGo_e5.mjs → human-id-adtUWQLr.mjs} +12 -3
- package/dist/{index-CuLRIMto.d.mts → index-DB2Ie0Or.d.mts} +2 -3
- package/dist/index.d.mts +4 -5
- package/dist/index.mjs +2 -5
- package/dist/launch-editor-KA_21J1T.mjs +581 -0
- package/dist/node/auth.d.mts +44 -0
- package/dist/node/auth.mjs +55 -0
- package/dist/node/index.d.mts +10 -51
- package/dist/node/index.mjs +6 -62
- package/dist/{internal/index.d.mts → node/internal.d.mts} +5 -5
- package/dist/node/internal.mjs +50 -0
- package/dist/{open-Dede_w9r.mjs → open-DmFp0qZA.mjs} +12 -3
- package/dist/recipes/open-helpers.d.mts +4 -9
- package/dist/recipes/open-helpers.mjs +7 -12
- package/dist/revoke-DIMz1r7-.mjs +35 -0
- package/dist/rpc/index.d.mts +3 -3
- package/dist/rpc/index.mjs +4 -4
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-client.mjs +2 -1
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/rpc/transports/ws-server.mjs +2 -1
- package/dist/{rpc-INbWfHoX.mjs → rpc-CkZuoz-m.mjs} +3 -2
- package/dist/{serialization-DwKi05Pn.mjs → serialization-CwO31axa.mjs} +1 -2
- package/dist/{server-CBsxXIH5.mjs → server-ma8-ZVyX.mjs} +1 -1
- package/dist/{server-BAqOajx_.d.mts → server-zKEDxgqD.d.mts} +4 -3
- package/dist/shared-state-DCDs0e7y.mjs +928 -0
- package/dist/{static-dump-D5VH8Iqk.mjs → static-dump-D7AvjrgL.mjs} +1 -1
- package/dist/{context-internal-Dx_NoSv1.mjs → storage-CNC38eU-.mjs} +4 -86
- package/dist/structured-clone-DcDc2Dds.mjs +221 -0
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.mjs +11 -2
- package/dist/utils/colors.d.mts +28 -0
- package/dist/utils/colors.mjs +2 -0
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/hash.d.mts +7 -0
- package/dist/utils/hash.mjs +2 -0
- package/dist/utils/human-id.d.mts +6 -8
- package/dist/utils/human-id.mjs +1 -2
- package/dist/utils/launch-editor.d.mts +13 -0
- package/dist/utils/launch-editor.mjs +2 -0
- package/dist/utils/open.d.mts +16 -0
- package/dist/utils/open.mjs +2 -0
- package/dist/utils/serve-static.d.mts +30 -0
- package/dist/utils/serve-static.mjs +152 -0
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/shared-state.mjs +1 -35
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/utils/structured-clone.d.mts +21 -0
- package/dist/utils/structured-clone.mjs +2 -0
- package/dist/utils/when.d.mts +32 -49
- package/dist/utils/when.mjs +20 -2
- package/dist/{ws-client-CjPuPFbA.d.mts → ws-client-Bavoya6-.d.mts} +1 -1
- package/dist/{ws-server-C7LnhOHi.d.mts → ws-server-DjvlwLuM.d.mts} +1 -1
- package/package.json +23 -10
- package/skills/devframe/SKILL.md +45 -23
- package/skills/devframe/templates/{counter-devtool.ts → counter-devframe.ts} +4 -4
- package/skills/devframe/templates/{spa-devtool.ts → spa-devframe.ts} +3 -3
- package/skills/devframe/templates/vite-client.ts +2 -2
- package/dist/internal/index.mjs +0 -3
- package/dist/utils/state.d.mts +0 -50
- package/dist/utils/state.mjs +0 -26
- package/dist/{define-Bb4zh-Dc.mjs → define-CW9gLnyG.mjs} +0 -0
- package/dist/{host-h3-9jeHcltx.mjs → host-h3-Dz8YnFgu.mjs} +1 -1
- /package/dist/{transports-DSV5_5QM.mjs → transports-BnCs4rj9.mjs} +0 -0
- /package/dist/{types-C5OVe4AC.d.mts → types-4rdUEi2R.d.mts} +0 -0
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
import { n as __require, r as __toESM, t as __commonJSMin } from "./chunk-e9Ob2GDo.mjs";
|
|
2
|
+
//#region ../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
3
|
+
var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
5
|
+
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
6
|
+
let formatter = (open, close, replace = open) => (input) => {
|
|
7
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
8
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
9
|
+
};
|
|
10
|
+
let replaceClose = (string, close, replace, index) => {
|
|
11
|
+
let result = "", cursor = 0;
|
|
12
|
+
do {
|
|
13
|
+
result += string.substring(cursor, index) + replace;
|
|
14
|
+
cursor = index + close.length;
|
|
15
|
+
index = string.indexOf(close, cursor);
|
|
16
|
+
} while (~index);
|
|
17
|
+
return result + string.substring(cursor);
|
|
18
|
+
};
|
|
19
|
+
let createColors = (enabled = isColorSupported) => {
|
|
20
|
+
let f = enabled ? formatter : () => String;
|
|
21
|
+
return {
|
|
22
|
+
isColorSupported: enabled,
|
|
23
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
24
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
25
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
26
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
27
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
28
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
29
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
30
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
31
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
32
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
33
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
34
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
35
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
36
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
37
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
38
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
39
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
40
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
41
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
42
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
43
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
44
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
45
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
46
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
47
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
48
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
49
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
50
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
51
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
52
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
53
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
54
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
55
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
56
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
57
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
58
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
59
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
60
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
61
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
62
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
63
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
module.exports = createColors();
|
|
67
|
+
module.exports.createColors = createColors;
|
|
68
|
+
}));
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region ../../../node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/quote.js
|
|
71
|
+
var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
72
|
+
module.exports = function quote(xs) {
|
|
73
|
+
return xs.map(function(s) {
|
|
74
|
+
if (s === "") return "''";
|
|
75
|
+
if (s && typeof s === "object") return s.op.replace(/(.)/g, "\\$1");
|
|
76
|
+
if (/["\s\\]/.test(s) && !/'/.test(s)) return "'" + s.replace(/(['])/g, "\\$1") + "'";
|
|
77
|
+
if (/["'\s]/.test(s)) return "\"" + s.replace(/(["\\$`!])/g, "\\$1") + "\"";
|
|
78
|
+
return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, "$1\\$2");
|
|
79
|
+
}).join(" ");
|
|
80
|
+
};
|
|
81
|
+
}));
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region ../../../node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/parse.js
|
|
84
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
85
|
+
var CONTROL = "(?:" + [
|
|
86
|
+
"\\|\\|",
|
|
87
|
+
"\\&\\&",
|
|
88
|
+
";;",
|
|
89
|
+
"\\|\\&",
|
|
90
|
+
"\\<\\(",
|
|
91
|
+
"\\<\\<\\<",
|
|
92
|
+
">>",
|
|
93
|
+
">\\&",
|
|
94
|
+
"<\\&",
|
|
95
|
+
"[&;()|<>]"
|
|
96
|
+
].join("|") + ")";
|
|
97
|
+
var controlRE = new RegExp("^" + CONTROL + "$");
|
|
98
|
+
var META = "|&;()<> \\t";
|
|
99
|
+
var SINGLE_QUOTE = "\"((\\\\\"|[^\"])*?)\"";
|
|
100
|
+
var DOUBLE_QUOTE = "'((\\\\'|[^'])*?)'";
|
|
101
|
+
var hash = /^#$/;
|
|
102
|
+
var SQ = "'";
|
|
103
|
+
var DQ = "\"";
|
|
104
|
+
var DS = "$";
|
|
105
|
+
var TOKEN = "";
|
|
106
|
+
var mult = 4294967296;
|
|
107
|
+
for (var i = 0; i < 4; i++) TOKEN += (mult * Math.random()).toString(16);
|
|
108
|
+
var startsWithToken = new RegExp("^" + TOKEN);
|
|
109
|
+
function matchAll(s, r) {
|
|
110
|
+
var origIndex = r.lastIndex;
|
|
111
|
+
var matches = [];
|
|
112
|
+
var matchObj;
|
|
113
|
+
while (matchObj = r.exec(s)) {
|
|
114
|
+
matches.push(matchObj);
|
|
115
|
+
if (r.lastIndex === matchObj.index) r.lastIndex += 1;
|
|
116
|
+
}
|
|
117
|
+
r.lastIndex = origIndex;
|
|
118
|
+
return matches;
|
|
119
|
+
}
|
|
120
|
+
function getVar(env, pre, key) {
|
|
121
|
+
var r = typeof env === "function" ? env(key) : env[key];
|
|
122
|
+
if (typeof r === "undefined" && key != "") r = "";
|
|
123
|
+
else if (typeof r === "undefined") r = "$";
|
|
124
|
+
if (typeof r === "object") return pre + TOKEN + JSON.stringify(r) + TOKEN;
|
|
125
|
+
return pre + r;
|
|
126
|
+
}
|
|
127
|
+
function parseInternal(string, env, opts) {
|
|
128
|
+
if (!opts) opts = {};
|
|
129
|
+
var BS = opts.escape || "\\";
|
|
130
|
+
var BAREWORD = "(\\" + BS + "['\"" + META + "]|[^\\s'\"" + META + "])+";
|
|
131
|
+
var matches = matchAll(string, new RegExp(["(" + CONTROL + ")", "(" + BAREWORD + "|" + SINGLE_QUOTE + "|" + DOUBLE_QUOTE + ")+"].join("|"), "g"));
|
|
132
|
+
if (matches.length === 0) return [];
|
|
133
|
+
if (!env) env = {};
|
|
134
|
+
var commented = false;
|
|
135
|
+
return matches.map(function(match) {
|
|
136
|
+
var s = match[0];
|
|
137
|
+
if (!s || commented) return;
|
|
138
|
+
if (controlRE.test(s)) return { op: s };
|
|
139
|
+
var quote = false;
|
|
140
|
+
var esc = false;
|
|
141
|
+
var out = "";
|
|
142
|
+
var isGlob = false;
|
|
143
|
+
var i;
|
|
144
|
+
function parseEnvVar() {
|
|
145
|
+
i += 1;
|
|
146
|
+
var varend;
|
|
147
|
+
var varname;
|
|
148
|
+
var char = s.charAt(i);
|
|
149
|
+
if (char === "{") {
|
|
150
|
+
i += 1;
|
|
151
|
+
if (s.charAt(i) === "}") throw new Error("Bad substitution: " + s.slice(i - 2, i + 1));
|
|
152
|
+
varend = s.indexOf("}", i);
|
|
153
|
+
if (varend < 0) throw new Error("Bad substitution: " + s.slice(i));
|
|
154
|
+
varname = s.slice(i, varend);
|
|
155
|
+
i = varend;
|
|
156
|
+
} else if (/[*@#?$!_-]/.test(char)) {
|
|
157
|
+
varname = char;
|
|
158
|
+
i += 1;
|
|
159
|
+
} else {
|
|
160
|
+
var slicedFromI = s.slice(i);
|
|
161
|
+
varend = slicedFromI.match(/[^\w\d_]/);
|
|
162
|
+
if (!varend) {
|
|
163
|
+
varname = slicedFromI;
|
|
164
|
+
i = s.length;
|
|
165
|
+
} else {
|
|
166
|
+
varname = slicedFromI.slice(0, varend.index);
|
|
167
|
+
i += varend.index - 1;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return getVar(env, "", varname);
|
|
171
|
+
}
|
|
172
|
+
for (i = 0; i < s.length; i++) {
|
|
173
|
+
var c = s.charAt(i);
|
|
174
|
+
isGlob = isGlob || !quote && (c === "*" || c === "?");
|
|
175
|
+
if (esc) {
|
|
176
|
+
out += c;
|
|
177
|
+
esc = false;
|
|
178
|
+
} else if (quote) if (c === quote) quote = false;
|
|
179
|
+
else if (quote == SQ) out += c;
|
|
180
|
+
else if (c === BS) {
|
|
181
|
+
i += 1;
|
|
182
|
+
c = s.charAt(i);
|
|
183
|
+
if (c === DQ || c === BS || c === DS) out += c;
|
|
184
|
+
else out += BS + c;
|
|
185
|
+
} else if (c === DS) out += parseEnvVar();
|
|
186
|
+
else out += c;
|
|
187
|
+
else if (c === DQ || c === SQ) quote = c;
|
|
188
|
+
else if (controlRE.test(c)) return { op: s };
|
|
189
|
+
else if (hash.test(c)) {
|
|
190
|
+
commented = true;
|
|
191
|
+
var commentObj = { comment: string.slice(match.index + i + 1) };
|
|
192
|
+
if (out.length) return [out, commentObj];
|
|
193
|
+
return [commentObj];
|
|
194
|
+
} else if (c === BS) esc = true;
|
|
195
|
+
else if (c === DS) out += parseEnvVar();
|
|
196
|
+
else out += c;
|
|
197
|
+
}
|
|
198
|
+
if (isGlob) return {
|
|
199
|
+
op: "glob",
|
|
200
|
+
pattern: out
|
|
201
|
+
};
|
|
202
|
+
return out;
|
|
203
|
+
}).reduce(function(prev, arg) {
|
|
204
|
+
return typeof arg === "undefined" ? prev : prev.concat(arg);
|
|
205
|
+
}, []);
|
|
206
|
+
}
|
|
207
|
+
module.exports = function parse(s, env, opts) {
|
|
208
|
+
var mapped = parseInternal(s, env, opts);
|
|
209
|
+
if (typeof env !== "function") return mapped;
|
|
210
|
+
return mapped.reduce(function(acc, s) {
|
|
211
|
+
if (typeof s === "object") return acc.concat(s);
|
|
212
|
+
var xs = s.split(RegExp("(" + TOKEN + ".*?" + TOKEN + ")", "g"));
|
|
213
|
+
if (xs.length === 1) return acc.concat(xs[0]);
|
|
214
|
+
return acc.concat(xs.filter(Boolean).map(function(x) {
|
|
215
|
+
if (startsWithToken.test(x)) return JSON.parse(x.split(TOKEN)[1]);
|
|
216
|
+
return x;
|
|
217
|
+
}));
|
|
218
|
+
}, []);
|
|
219
|
+
};
|
|
220
|
+
}));
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region ../../../node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/index.js
|
|
223
|
+
var require_shell_quote = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
224
|
+
exports.quote = require_quote();
|
|
225
|
+
exports.parse = require_parse();
|
|
226
|
+
}));
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region ../../../node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/editor-info/macos.js
|
|
229
|
+
var require_macos = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
230
|
+
module.exports = {
|
|
231
|
+
"/Applications/Atom.app/Contents/MacOS/Atom": "atom",
|
|
232
|
+
"/Applications/Atom Beta.app/Contents/MacOS/Atom Beta": "/Applications/Atom Beta.app/Contents/MacOS/Atom Beta",
|
|
233
|
+
"/Applications/Brackets.app/Contents/MacOS/Brackets": "brackets",
|
|
234
|
+
"/Applications/Sublime Text.app/Contents/MacOS/Sublime Text": "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl",
|
|
235
|
+
"/Applications/Sublime Text.app/Contents/MacOS/sublime_text": "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl",
|
|
236
|
+
"/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2": "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl",
|
|
237
|
+
"/Applications/Sublime Text Dev.app/Contents/MacOS/Sublime Text": "/Applications/Sublime Text Dev.app/Contents/SharedSupport/bin/subl",
|
|
238
|
+
"/Applications/Visual Studio Code.app/Contents/MacOS/Code": "code",
|
|
239
|
+
"/Applications/Visual Studio Code.app/Contents/MacOS/Electron": "code",
|
|
240
|
+
"/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Code - Insiders": "code-insiders",
|
|
241
|
+
"/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron": "code-insiders",
|
|
242
|
+
"/Applications/VSCodium.app/Contents/MacOS/Electron": "codium",
|
|
243
|
+
"/Applications/Cursor.app/Contents/MacOS/Cursor": "cursor",
|
|
244
|
+
"/Applications/Trae.app/Contents/MacOS/Electron": "trae",
|
|
245
|
+
"/Applications/Antigravity.app/Contents/MacOS/Electron": "antigravity",
|
|
246
|
+
"/Applications/AppCode.app/Contents/MacOS/appcode": "/Applications/AppCode.app/Contents/MacOS/appcode",
|
|
247
|
+
"/Applications/CLion.app/Contents/MacOS/clion": "/Applications/CLion.app/Contents/MacOS/clion",
|
|
248
|
+
"/Applications/IntelliJ IDEA.app/Contents/MacOS/idea": "/Applications/IntelliJ IDEA.app/Contents/MacOS/idea",
|
|
249
|
+
"/Applications/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea": "/Applications/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea",
|
|
250
|
+
"/Applications/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea": "/Applications/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea",
|
|
251
|
+
"/Applications/PhpStorm.app/Contents/MacOS/phpstorm": "/Applications/PhpStorm.app/Contents/MacOS/phpstorm",
|
|
252
|
+
"/Applications/PyCharm.app/Contents/MacOS/pycharm": "/Applications/PyCharm.app/Contents/MacOS/pycharm",
|
|
253
|
+
"/Applications/PyCharm CE.app/Contents/MacOS/pycharm": "/Applications/PyCharm CE.app/Contents/MacOS/pycharm",
|
|
254
|
+
"/Applications/RubyMine.app/Contents/MacOS/rubymine": "/Applications/RubyMine.app/Contents/MacOS/rubymine",
|
|
255
|
+
"/Applications/WebStorm.app/Contents/MacOS/webstorm": "/Applications/WebStorm.app/Contents/MacOS/webstorm",
|
|
256
|
+
"/Applications/MacVim.app/Contents/MacOS/MacVim": "mvim",
|
|
257
|
+
"/Applications/GoLand.app/Contents/MacOS/goland": "/Applications/GoLand.app/Contents/MacOS/goland",
|
|
258
|
+
"/Applications/Rider.app/Contents/MacOS/rider": "/Applications/Rider.app/Contents/MacOS/rider",
|
|
259
|
+
"/Applications/Zed.app/Contents/MacOS/zed": "zed"
|
|
260
|
+
};
|
|
261
|
+
}));
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region ../../../node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/editor-info/linux.js
|
|
264
|
+
var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
265
|
+
module.exports = {
|
|
266
|
+
atom: "atom",
|
|
267
|
+
Brackets: "brackets",
|
|
268
|
+
"code-insiders": "code-insiders",
|
|
269
|
+
code: "code",
|
|
270
|
+
vscodium: "vscodium",
|
|
271
|
+
codium: "codium",
|
|
272
|
+
cursor: "cursor",
|
|
273
|
+
trae: "trae",
|
|
274
|
+
antigravity: "antigravity",
|
|
275
|
+
emacs: "emacs",
|
|
276
|
+
gvim: "gvim",
|
|
277
|
+
idea: "idea",
|
|
278
|
+
"idea.sh": "idea",
|
|
279
|
+
phpstorm: "phpstorm",
|
|
280
|
+
"phpstorm.sh": "phpstorm",
|
|
281
|
+
pycharm: "pycharm",
|
|
282
|
+
"pycharm.sh": "pycharm",
|
|
283
|
+
rubymine: "rubymine",
|
|
284
|
+
"rubymine.sh": "rubymine",
|
|
285
|
+
sublime_text: "subl",
|
|
286
|
+
vim: "vim",
|
|
287
|
+
webstorm: "webstorm",
|
|
288
|
+
"webstorm.sh": "webstorm",
|
|
289
|
+
goland: "goland",
|
|
290
|
+
"goland.sh": "goland",
|
|
291
|
+
rider: "rider",
|
|
292
|
+
"rider.sh": "rider",
|
|
293
|
+
zed: "zed"
|
|
294
|
+
};
|
|
295
|
+
}));
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region ../../../node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/editor-info/windows.js
|
|
298
|
+
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
299
|
+
module.exports = [
|
|
300
|
+
"Brackets.exe",
|
|
301
|
+
"Code.exe",
|
|
302
|
+
"Code - Insiders.exe",
|
|
303
|
+
"VSCodium.exe",
|
|
304
|
+
"Cursor.exe",
|
|
305
|
+
"atom.exe",
|
|
306
|
+
"sublime_text.exe",
|
|
307
|
+
"notepad++.exe",
|
|
308
|
+
"clion.exe",
|
|
309
|
+
"clion64.exe",
|
|
310
|
+
"idea.exe",
|
|
311
|
+
"idea64.exe",
|
|
312
|
+
"phpstorm.exe",
|
|
313
|
+
"phpstorm64.exe",
|
|
314
|
+
"pycharm.exe",
|
|
315
|
+
"pycharm64.exe",
|
|
316
|
+
"rubymine.exe",
|
|
317
|
+
"rubymine64.exe",
|
|
318
|
+
"webstorm.exe",
|
|
319
|
+
"webstorm64.exe",
|
|
320
|
+
"goland.exe",
|
|
321
|
+
"goland64.exe",
|
|
322
|
+
"rider.exe",
|
|
323
|
+
"rider64.exe",
|
|
324
|
+
"Trae.exe",
|
|
325
|
+
"zed.exe",
|
|
326
|
+
"Antigravity.exe"
|
|
327
|
+
];
|
|
328
|
+
}));
|
|
329
|
+
//#endregion
|
|
330
|
+
//#region ../../../node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/guess.js
|
|
331
|
+
var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
332
|
+
const path$2 = __require("path");
|
|
333
|
+
const shellQuote = require_shell_quote();
|
|
334
|
+
const childProcess$1 = __require("child_process");
|
|
335
|
+
const COMMON_EDITORS_MACOS = require_macos();
|
|
336
|
+
const COMMON_EDITORS_LINUX = require_linux();
|
|
337
|
+
const COMMON_EDITORS_WIN = require_windows();
|
|
338
|
+
module.exports = function guessEditor(specifiedEditor) {
|
|
339
|
+
if (specifiedEditor) return shellQuote.parse(specifiedEditor);
|
|
340
|
+
if (process.env.LAUNCH_EDITOR) return [process.env.LAUNCH_EDITOR];
|
|
341
|
+
if (process.versions.webcontainer) return [process.env.EDITOR || "code"];
|
|
342
|
+
try {
|
|
343
|
+
if (process.platform === "darwin") {
|
|
344
|
+
const output = childProcess$1.execSync("ps x -o comm=", { stdio: [
|
|
345
|
+
"pipe",
|
|
346
|
+
"pipe",
|
|
347
|
+
"ignore"
|
|
348
|
+
] }).toString();
|
|
349
|
+
const processNames = Object.keys(COMMON_EDITORS_MACOS);
|
|
350
|
+
const processList = output.split("\n");
|
|
351
|
+
for (let i = 0; i < processNames.length; i++) {
|
|
352
|
+
const processName = processNames[i];
|
|
353
|
+
if (processList.includes(processName)) return [COMMON_EDITORS_MACOS[processName]];
|
|
354
|
+
const processNameWithoutApplications = processName.replace("/Applications", "");
|
|
355
|
+
if (output.indexOf(processNameWithoutApplications) !== -1) {
|
|
356
|
+
if (processName !== COMMON_EDITORS_MACOS[processName]) return [COMMON_EDITORS_MACOS[processName]];
|
|
357
|
+
const runningProcess = processList.find((procName) => procName.endsWith(processNameWithoutApplications));
|
|
358
|
+
if (runningProcess !== void 0) return [runningProcess];
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
} else if (process.platform === "win32") {
|
|
362
|
+
const runningProcesses = childProcess$1.execSync("powershell -NoProfile -Command \"[Console]::OutputEncoding=[Text.Encoding]::UTF8;Get-CimInstance -Query \\\"select executablepath from win32_process where executablepath is not null\\\" | % { $_.ExecutablePath }\"", { stdio: [
|
|
363
|
+
"pipe",
|
|
364
|
+
"pipe",
|
|
365
|
+
"ignore"
|
|
366
|
+
] }).toString().split("\r\n");
|
|
367
|
+
for (let i = 0; i < runningProcesses.length; i++) {
|
|
368
|
+
const fullProcessPath = runningProcesses[i].trim();
|
|
369
|
+
const shortProcessName = path$2.basename(fullProcessPath);
|
|
370
|
+
if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) return [fullProcessPath];
|
|
371
|
+
}
|
|
372
|
+
} else if (process.platform === "linux") {
|
|
373
|
+
const output = childProcess$1.execSync("ps x --no-heading -o comm --sort=comm", { stdio: [
|
|
374
|
+
"pipe",
|
|
375
|
+
"pipe",
|
|
376
|
+
"ignore"
|
|
377
|
+
] }).toString();
|
|
378
|
+
const processNames = Object.keys(COMMON_EDITORS_LINUX);
|
|
379
|
+
for (let i = 0; i < processNames.length; i++) {
|
|
380
|
+
const processName = processNames[i];
|
|
381
|
+
if (output.indexOf(processName) !== -1) return [COMMON_EDITORS_LINUX[processName]];
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
} catch (ignoreError) {}
|
|
385
|
+
if (process.env.VISUAL) return [process.env.VISUAL];
|
|
386
|
+
else if (process.env.EDITOR) return [process.env.EDITOR];
|
|
387
|
+
return [null];
|
|
388
|
+
};
|
|
389
|
+
}));
|
|
390
|
+
//#endregion
|
|
391
|
+
//#region ../../../node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/get-args.js
|
|
392
|
+
var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
393
|
+
const path$1 = __require("path");
|
|
394
|
+
module.exports = function getArgumentsForPosition(editor, fileName, lineNumber, columnNumber = 1) {
|
|
395
|
+
switch (path$1.basename(editor).replace(/\.(exe|cmd|bat)$/i, "")) {
|
|
396
|
+
case "atom":
|
|
397
|
+
case "Atom":
|
|
398
|
+
case "Atom Beta":
|
|
399
|
+
case "subl":
|
|
400
|
+
case "sublime":
|
|
401
|
+
case "sublime_text":
|
|
402
|
+
case "wstorm":
|
|
403
|
+
case "charm":
|
|
404
|
+
case "zed": return [`${fileName}:${lineNumber}:${columnNumber}`];
|
|
405
|
+
case "notepad++": return [
|
|
406
|
+
"-n" + lineNumber,
|
|
407
|
+
"-c" + columnNumber,
|
|
408
|
+
fileName
|
|
409
|
+
];
|
|
410
|
+
case "vim":
|
|
411
|
+
case "mvim": return [`+call cursor(${lineNumber}, ${columnNumber})`, fileName];
|
|
412
|
+
case "joe":
|
|
413
|
+
case "gvim": return [`+${lineNumber}`, fileName];
|
|
414
|
+
case "emacs":
|
|
415
|
+
case "emacsclient": return [`+${lineNumber}:${columnNumber}`, fileName];
|
|
416
|
+
case "rmate":
|
|
417
|
+
case "mate":
|
|
418
|
+
case "mine": return [
|
|
419
|
+
"--line",
|
|
420
|
+
lineNumber,
|
|
421
|
+
fileName
|
|
422
|
+
];
|
|
423
|
+
case "code":
|
|
424
|
+
case "Code":
|
|
425
|
+
case "code-insiders":
|
|
426
|
+
case "Code - Insiders":
|
|
427
|
+
case "codium":
|
|
428
|
+
case "trae":
|
|
429
|
+
case "antigravity":
|
|
430
|
+
case "cursor":
|
|
431
|
+
case "vscodium":
|
|
432
|
+
case "VSCodium": return [
|
|
433
|
+
"-r",
|
|
434
|
+
"-g",
|
|
435
|
+
`${fileName}:${lineNumber}:${columnNumber}`
|
|
436
|
+
];
|
|
437
|
+
case "appcode":
|
|
438
|
+
case "clion":
|
|
439
|
+
case "clion64":
|
|
440
|
+
case "idea":
|
|
441
|
+
case "idea64":
|
|
442
|
+
case "phpstorm":
|
|
443
|
+
case "phpstorm64":
|
|
444
|
+
case "pycharm":
|
|
445
|
+
case "pycharm64":
|
|
446
|
+
case "rubymine":
|
|
447
|
+
case "rubymine64":
|
|
448
|
+
case "webstorm":
|
|
449
|
+
case "webstorm64":
|
|
450
|
+
case "goland":
|
|
451
|
+
case "goland64":
|
|
452
|
+
case "rider":
|
|
453
|
+
case "rider64": return [
|
|
454
|
+
"--line",
|
|
455
|
+
lineNumber,
|
|
456
|
+
"--column",
|
|
457
|
+
columnNumber,
|
|
458
|
+
fileName
|
|
459
|
+
];
|
|
460
|
+
}
|
|
461
|
+
if (process.env.LAUNCH_EDITOR) return [
|
|
462
|
+
fileName,
|
|
463
|
+
lineNumber,
|
|
464
|
+
columnNumber
|
|
465
|
+
];
|
|
466
|
+
return [fileName];
|
|
467
|
+
};
|
|
468
|
+
}));
|
|
469
|
+
//#endregion
|
|
470
|
+
//#region src/utils/launch-editor.ts
|
|
471
|
+
var import_launch_editor = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
472
|
+
/**
|
|
473
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
474
|
+
*
|
|
475
|
+
* This source code is licensed under the MIT license found in the
|
|
476
|
+
* LICENSE file at
|
|
477
|
+
* https://github.com/facebookincubator/create-react-app/blob/master/LICENSE
|
|
478
|
+
*
|
|
479
|
+
* Modified by Yuxi Evan You
|
|
480
|
+
*/
|
|
481
|
+
const fs = __require("fs");
|
|
482
|
+
const os = __require("os");
|
|
483
|
+
const path = __require("path");
|
|
484
|
+
const colors = require_picocolors();
|
|
485
|
+
const childProcess = __require("child_process");
|
|
486
|
+
const guessEditor = require_guess();
|
|
487
|
+
const getArgumentsForPosition = require_get_args();
|
|
488
|
+
function wrapErrorCallback(cb) {
|
|
489
|
+
return (fileName, errorMessage) => {
|
|
490
|
+
console.log();
|
|
491
|
+
console.log(colors.red("Could not open " + path.basename(fileName) + " in the editor."));
|
|
492
|
+
if (errorMessage) {
|
|
493
|
+
if (errorMessage[errorMessage.length - 1] !== ".") errorMessage += ".";
|
|
494
|
+
console.log(colors.red("The editor process exited with an error: " + errorMessage));
|
|
495
|
+
}
|
|
496
|
+
console.log();
|
|
497
|
+
if (cb) cb(fileName, errorMessage);
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
function isTerminalEditor(editor) {
|
|
501
|
+
switch (editor) {
|
|
502
|
+
case "vim":
|
|
503
|
+
case "emacs":
|
|
504
|
+
case "nano": return true;
|
|
505
|
+
}
|
|
506
|
+
return false;
|
|
507
|
+
}
|
|
508
|
+
const positionRE = /:(\d+)(:(\d+))?$/;
|
|
509
|
+
function parseFile(file) {
|
|
510
|
+
if (file.startsWith("file://")) file = __require("url").fileURLToPath(file);
|
|
511
|
+
const fileName = file.replace(positionRE, "");
|
|
512
|
+
const match = file.match(positionRE);
|
|
513
|
+
return {
|
|
514
|
+
fileName,
|
|
515
|
+
lineNumber: match && match[1],
|
|
516
|
+
columnNumber: match && match[3]
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
let _childProcess = null;
|
|
520
|
+
function launchEditor(file, specifiedEditor, onErrorCallback) {
|
|
521
|
+
const parsed = parseFile(file);
|
|
522
|
+
let { fileName } = parsed;
|
|
523
|
+
const { lineNumber, columnNumber } = parsed;
|
|
524
|
+
if (!fs.existsSync(fileName)) return;
|
|
525
|
+
if (typeof specifiedEditor === "function") {
|
|
526
|
+
onErrorCallback = specifiedEditor;
|
|
527
|
+
specifiedEditor = void 0;
|
|
528
|
+
}
|
|
529
|
+
onErrorCallback = wrapErrorCallback(onErrorCallback);
|
|
530
|
+
const [editor, ...args] = guessEditor(specifiedEditor);
|
|
531
|
+
if (!editor) {
|
|
532
|
+
onErrorCallback(fileName, null);
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
if (process.platform === "linux" && fileName.startsWith("/mnt/") && /Microsoft/i.test(os.release())) fileName = path.relative("", fileName);
|
|
536
|
+
if (lineNumber) {
|
|
537
|
+
const extraArgs = getArgumentsForPosition(editor, fileName, lineNumber, columnNumber);
|
|
538
|
+
args.push.apply(args, extraArgs);
|
|
539
|
+
} else args.push(fileName);
|
|
540
|
+
if (_childProcess && isTerminalEditor(editor)) _childProcess.kill("SIGKILL");
|
|
541
|
+
if (process.platform === "win32") {
|
|
542
|
+
function escapeCmdArgs(cmdArgs) {
|
|
543
|
+
return cmdArgs.replace(/([&|<>,;=^])/g, "^$1");
|
|
544
|
+
}
|
|
545
|
+
function doubleQuoteIfNeeded(str) {
|
|
546
|
+
if (str.includes("^")) return `^"${str}^"`;
|
|
547
|
+
else if (str.includes(" ")) return `"${str}"`;
|
|
548
|
+
return str;
|
|
549
|
+
}
|
|
550
|
+
const launchCommand = [editor, ...args.map(escapeCmdArgs)].map(doubleQuoteIfNeeded).join(" ");
|
|
551
|
+
_childProcess = childProcess.exec(launchCommand, {
|
|
552
|
+
stdio: "inherit",
|
|
553
|
+
shell: true
|
|
554
|
+
});
|
|
555
|
+
} else _childProcess = childProcess.spawn(editor, args, { stdio: "inherit" });
|
|
556
|
+
_childProcess.on("exit", function(errorCode) {
|
|
557
|
+
_childProcess = null;
|
|
558
|
+
if (errorCode) onErrorCallback(fileName, "(code " + errorCode + ")");
|
|
559
|
+
});
|
|
560
|
+
_childProcess.on("error", function(error) {
|
|
561
|
+
let { code, message } = error;
|
|
562
|
+
if ("ENOENT" === code) message = `${message} ('${editor}' command does not exist in 'PATH')`;
|
|
563
|
+
onErrorCallback(fileName, message);
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
module.exports = launchEditor;
|
|
567
|
+
})))(), 1);
|
|
568
|
+
/**
|
|
569
|
+
* Open a file in the user's editor.
|
|
570
|
+
*
|
|
571
|
+
* `target` may be a plain path, `file:line`, or `file:line:column`.
|
|
572
|
+
*
|
|
573
|
+
* If `editor` is provided, it is used as the editor command (e.g. `'code'`,
|
|
574
|
+
* `'subl'`) or absolute binary path. Otherwise the editor is auto-detected
|
|
575
|
+
* via the `LAUNCH_EDITOR` env var with a fallback to common defaults.
|
|
576
|
+
*/
|
|
577
|
+
function launchEditor(target, editor) {
|
|
578
|
+
(0, import_launch_editor.default)(target, editor);
|
|
579
|
+
}
|
|
580
|
+
//#endregion
|
|
581
|
+
export { launchEditor as t };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { H as SharedState, b as DevToolsNodeRpcSession, y as DevToolsNodeContext } from "../devframe-DulcIxwu.mjs";
|
|
2
|
+
import { n as InternalAnonymousAuthStorage } from "../context-DBd794Rn.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/node/auth/revoke.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Flip `isTrusted` to false on any live WS clients connected with `token`
|
|
7
|
+
* and broadcast the `auth:revoked` event so they can react.
|
|
8
|
+
*
|
|
9
|
+
* Shared between persisted-auth revocation and remote-dock token revocation.
|
|
10
|
+
*/
|
|
11
|
+
declare function revokeActiveConnectionsForToken(context: DevToolsNodeContext, token: string): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Revoke an auth token: remove from storage and notify all connected clients
|
|
14
|
+
* using this token that they are no longer trusted.
|
|
15
|
+
*/
|
|
16
|
+
declare function revokeAuthToken(context: DevToolsNodeContext, storage: SharedState<InternalAnonymousAuthStorage>, token: string): Promise<void>;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/node/auth/state.d.ts
|
|
19
|
+
interface PendingAuthRequest {
|
|
20
|
+
clientAuthToken: string;
|
|
21
|
+
session: DevToolsNodeRpcSession;
|
|
22
|
+
ua: string;
|
|
23
|
+
origin: string;
|
|
24
|
+
resolve: (result: {
|
|
25
|
+
isTrusted: boolean;
|
|
26
|
+
}) => void;
|
|
27
|
+
abortController: AbortController;
|
|
28
|
+
timeout: ReturnType<typeof setTimeout>;
|
|
29
|
+
}
|
|
30
|
+
declare function getTempAuthToken(): string;
|
|
31
|
+
declare function refreshTempAuthToken(): string;
|
|
32
|
+
declare function getPendingAuth(): PendingAuthRequest | null;
|
|
33
|
+
declare function setPendingAuth(request: PendingAuthRequest | null): void;
|
|
34
|
+
/**
|
|
35
|
+
* Abort and clean up any existing pending auth request.
|
|
36
|
+
*/
|
|
37
|
+
declare function abortPendingAuth(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Consume the temp auth ID: verify it matches, trust the pending client, and clean up.
|
|
40
|
+
* Returns the client's authToken if successful, null otherwise.
|
|
41
|
+
*/
|
|
42
|
+
declare function consumeTempAuthToken(id: string, storage: SharedState<InternalAnonymousAuthStorage>): string | null;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { PendingAuthRequest, abortPendingAuth, consumeTempAuthToken, getPendingAuth, getTempAuthToken, refreshTempAuthToken, revokeActiveConnectionsForToken, revokeAuthToken, setPendingAuth };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "../revoke-DIMz1r7-.mjs";
|
|
2
|
+
import { t as humanId } from "../human-id-adtUWQLr.mjs";
|
|
3
|
+
//#region src/node/auth/state.ts
|
|
4
|
+
let pendingAuth = null;
|
|
5
|
+
let tempAuthToken = generateTempId();
|
|
6
|
+
function generateTempId() {
|
|
7
|
+
return humanId();
|
|
8
|
+
}
|
|
9
|
+
function getTempAuthToken() {
|
|
10
|
+
return tempAuthToken;
|
|
11
|
+
}
|
|
12
|
+
function refreshTempAuthToken() {
|
|
13
|
+
tempAuthToken = generateTempId();
|
|
14
|
+
return tempAuthToken;
|
|
15
|
+
}
|
|
16
|
+
function getPendingAuth() {
|
|
17
|
+
return pendingAuth;
|
|
18
|
+
}
|
|
19
|
+
function setPendingAuth(request) {
|
|
20
|
+
pendingAuth = request;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Abort and clean up any existing pending auth request.
|
|
24
|
+
*/
|
|
25
|
+
function abortPendingAuth() {
|
|
26
|
+
if (pendingAuth) {
|
|
27
|
+
pendingAuth.abortController.abort();
|
|
28
|
+
clearTimeout(pendingAuth.timeout);
|
|
29
|
+
pendingAuth = null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Consume the temp auth ID: verify it matches, trust the pending client, and clean up.
|
|
34
|
+
* Returns the client's authToken if successful, null otherwise.
|
|
35
|
+
*/
|
|
36
|
+
function consumeTempAuthToken(id, storage) {
|
|
37
|
+
if (id !== tempAuthToken || !pendingAuth) return null;
|
|
38
|
+
const { clientAuthToken, session, ua, origin, resolve } = pendingAuth;
|
|
39
|
+
storage.mutate((state) => {
|
|
40
|
+
state.trusted[clientAuthToken] = {
|
|
41
|
+
authToken: clientAuthToken,
|
|
42
|
+
ua,
|
|
43
|
+
origin,
|
|
44
|
+
timestamp: Date.now()
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
session.meta.clientAuthToken = clientAuthToken;
|
|
48
|
+
session.meta.isTrusted = true;
|
|
49
|
+
resolve({ isTrusted: true });
|
|
50
|
+
abortPendingAuth();
|
|
51
|
+
refreshTempAuthToken();
|
|
52
|
+
return clientAuthToken;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { abortPendingAuth, consumeTempAuthToken, getPendingAuth, getTempAuthToken, refreshTempAuthToken, revokeActiveConnectionsForToken, revokeAuthToken, setPendingAuth };
|