@dsh-workbench/core 0.1.1 → 0.1.3
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 +2 -2
- package/client.js +2236 -701
- package/dist/client/client.body.js +2235 -700
- package/dist/client/index.js +2228 -693
- package/dist/host/index.js +728 -2047
- package/dist/types/app/client.d.ts +774 -69
- package/dist/types/app/layouts/market/AddModuleDialog.d.ts +8 -0
- package/dist/types/app/layouts/market/AddModuleForm.d.ts +6 -0
- package/dist/types/app/layouts/market/AddModuleRegistry.d.ts +6 -0
- package/dist/types/app/layouts/market/AddModuleStages.d.ts +14 -0
- package/dist/types/app/layouts/market/SafetyNote.d.ts +4 -0
- package/dist/types/app/layouts/market/__tests__/add-module-mock.test.d.ts +1 -0
- package/dist/types/app/layouts/market/__tests__/add-module-text.test.d.ts +1 -0
- package/dist/types/app/layouts/market/add-module-mock.d.ts +15 -0
- package/dist/types/app/layouts/market/add-module-text.d.ts +31 -0
- package/dist/types/app/layouts/market/panel.d.ts +2 -2
- package/dist/types/app/layouts/market/use-add-module.d.ts +49 -0
- package/dist/types/app/layouts/rightbar/MarketView.d.ts +6 -1
- package/dist/types/app/layouts/rightbar/__tests__/market-installed.test.d.ts +1 -0
- package/dist/types/app/layouts/rightbar/market-mock.d.ts +11 -4
- package/dist/types/app/layouts/rightbar/market-rows.d.ts +19 -5
- package/dist/types/app/units/__tests__/fixture-unit-mock.test.d.ts +1 -0
- package/dist/types/app/units/fixture-unit-mock.d.ts +5 -0
- package/dist/types/app/units/registry.d.ts +2 -1
- package/dist/types/modules/panels/__tests__/market-bundle.test.d.ts +1 -0
- package/dist/types/modules/panels/__tests__/market-dispatch.test.d.ts +1 -0
- package/dist/types/modules/panels/model/handoff.d.ts +1 -1
- package/dist/types/modules/panels/model/market-dependency.d.ts +1 -1
- package/dist/types/modules/panels/model/market-dispatch.d.ts +19 -1
- package/dist/types/modules/panels/model/market.d.ts +39 -0
- package/dist/types/shared/api/bundle-install.d.ts +97 -0
- package/dist/types/shared/api/dsh-plugins.d.ts +11 -0
- package/dist/types/shared/api/dsh-plugins.test.d.ts +1 -0
- package/dist/types/shared/api/host/bundle-manager.d.ts +10 -0
- package/dist/types/shared/api/host/bundle-manager.test.d.ts +1 -0
- package/dist/types/shared/api/host/bundle-routes.d.ts +5 -0
- package/dist/types/shared/api/host/bundle-routes.test.d.ts +1 -0
- package/dist/types/shared/api/host/context-inject.d.ts +1 -1
- package/dist/types/shared/api/host/dsh-plugins.d.ts +5 -0
- package/dist/types/shared/api/host/dsh-plugins.test.d.ts +1 -0
- package/dist/types/shared/api/host/installed-module.d.ts +22 -0
- package/dist/types/shared/api/host/installed-module.test.d.ts +1 -0
- package/dist/types/shared/api/host/mount-units.d.ts +1 -1
- package/dist/types/shared/api/host/probe-libs.d.ts +1 -1
- package/dist/types/shared/components/PanelFoot.d.ts +7 -0
- package/dist/types/shared/hooks/bundle-queries.d.ts +5 -0
- package/docs/OPERATIONS.md +10 -2
- package/package.json +4 -3
package/dist/host/index.js
CHANGED
|
@@ -1,47 +1,6 @@
|
|
|
1
1
|
import { createHash, randomUUID } from "node:crypto";
|
|
2
2
|
import fs, { readFileSync } from "node:fs";
|
|
3
3
|
import path, { join } from "node:path";
|
|
4
|
-
//#region \0rolldown/runtime.js
|
|
5
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
6
|
-
var MARKER = new RegExp(`@工作台:([a-z][a-z0-9-]*:[A-Za-z0-9._~%#/-]+)`, "g");
|
|
7
|
-
var TRAILING_PUNCTUATION = /[.,;:!?]+$/;
|
|
8
|
-
function encodeRef(ref) {
|
|
9
|
-
return `${ref.kind}:${ref.parts.join("/")}`;
|
|
10
|
-
}
|
|
11
|
-
function decodeRef(text) {
|
|
12
|
-
const at = text.indexOf(":");
|
|
13
|
-
if (at <= 0 || at === text.length - 1) return void 0;
|
|
14
|
-
const kind = text.slice(0, at);
|
|
15
|
-
if (!/^[a-z][a-z0-9-]*$/.test(kind)) return void 0;
|
|
16
|
-
const parts = text.slice(at + 1).split("/").filter((part) => part !== "");
|
|
17
|
-
if (parts.length === 0) return void 0;
|
|
18
|
-
return {
|
|
19
|
-
kind,
|
|
20
|
-
parts
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function parseMarkers(text) {
|
|
24
|
-
const seen = /* @__PURE__ */ new Set();
|
|
25
|
-
const refs = [];
|
|
26
|
-
for (const match of String(text ?? "").matchAll(MARKER)) {
|
|
27
|
-
const ref = decodeRef(match[1].replace(TRAILING_PUNCTUATION, ""));
|
|
28
|
-
if (ref === void 0) continue;
|
|
29
|
-
const key = encodeRef(ref);
|
|
30
|
-
if (seen.has(key)) continue;
|
|
31
|
-
seen.add(key);
|
|
32
|
-
refs.push(ref);
|
|
33
|
-
}
|
|
34
|
-
return refs;
|
|
35
|
-
}
|
|
36
|
-
function unitFactScope(unit) {
|
|
37
|
-
return `${unit}*`;
|
|
38
|
-
}
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region ../shared/dist/api/long-task.js
|
|
41
|
-
function runsRouteOf(unit) {
|
|
42
|
-
return `${unit}/runs`;
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
45
4
|
//#region ../shared/dist/config/constants.js
|
|
46
5
|
var PLUGIN_ID = "@dsh-workbench/core";
|
|
47
6
|
var API_PREFIX = "/workbench/api";
|
|
@@ -52,1950 +11,50 @@ var PROVISION_PREFIX = `${API_PREFIX}/provision`;
|
|
|
52
11
|
var OPENCLI_PIN = "1.8.8";
|
|
53
12
|
var PANELS_SERVICE = "workbenchPanels";
|
|
54
13
|
var UNITS_SERVICE = "workbenchUnits";
|
|
55
|
-
var OPENCLI_TIMEOUT_MS = 12e4;
|
|
56
|
-
var WARM_TIMEOUT_MS = 2e4;
|
|
57
|
-
var INSTALL_TIMEOUT_MS = 3e5;
|
|
58
|
-
var VERSION_CHECK_TIMEOUT_MS = 1e4;
|
|
59
|
-
var PROBE_TTL_MS = 3e4;
|
|
60
|
-
var GIT_TIMEOUT_MS = 1e4;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
enqueueForceUpdate: function() {},
|
|
95
|
-
enqueueReplaceState: function() {},
|
|
96
|
-
enqueueSetState: function() {}
|
|
97
|
-
};
|
|
98
|
-
var C = Object.assign;
|
|
99
|
-
var D = {};
|
|
100
|
-
function E(a, b, e) {
|
|
101
|
-
this.props = a;
|
|
102
|
-
this.context = b;
|
|
103
|
-
this.refs = D;
|
|
104
|
-
this.updater = e || B;
|
|
105
|
-
}
|
|
106
|
-
E.prototype.isReactComponent = {};
|
|
107
|
-
E.prototype.setState = function(a, b) {
|
|
108
|
-
if ("object" !== typeof a && "function" !== typeof a && null != a) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
|
|
109
|
-
this.updater.enqueueSetState(this, a, b, "setState");
|
|
110
|
-
};
|
|
111
|
-
E.prototype.forceUpdate = function(a) {
|
|
112
|
-
this.updater.enqueueForceUpdate(this, a, "forceUpdate");
|
|
113
|
-
};
|
|
114
|
-
function F() {}
|
|
115
|
-
F.prototype = E.prototype;
|
|
116
|
-
function G(a, b, e) {
|
|
117
|
-
this.props = a;
|
|
118
|
-
this.context = b;
|
|
119
|
-
this.refs = D;
|
|
120
|
-
this.updater = e || B;
|
|
121
|
-
}
|
|
122
|
-
var H = G.prototype = new F();
|
|
123
|
-
H.constructor = G;
|
|
124
|
-
C(H, E.prototype);
|
|
125
|
-
H.isPureReactComponent = !0;
|
|
126
|
-
var I = Array.isArray;
|
|
127
|
-
var J = Object.prototype.hasOwnProperty;
|
|
128
|
-
var K = { current: null };
|
|
129
|
-
var L = {
|
|
130
|
-
key: !0,
|
|
131
|
-
ref: !0,
|
|
132
|
-
__self: !0,
|
|
133
|
-
__source: !0
|
|
134
|
-
};
|
|
135
|
-
function M(a, b, e) {
|
|
136
|
-
var d, c = {}, k = null, h = null;
|
|
137
|
-
if (null != b) for (d in void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k = "" + b.key), b) J.call(b, d) && !L.hasOwnProperty(d) && (c[d] = b[d]);
|
|
138
|
-
var g = arguments.length - 2;
|
|
139
|
-
if (1 === g) c.children = e;
|
|
140
|
-
else if (1 < g) {
|
|
141
|
-
for (var f = Array(g), m = 0; m < g; m++) f[m] = arguments[m + 2];
|
|
142
|
-
c.children = f;
|
|
143
|
-
}
|
|
144
|
-
if (a && a.defaultProps) for (d in g = a.defaultProps, g) void 0 === c[d] && (c[d] = g[d]);
|
|
145
|
-
return {
|
|
146
|
-
$$typeof: l,
|
|
147
|
-
type: a,
|
|
148
|
-
key: k,
|
|
149
|
-
ref: h,
|
|
150
|
-
props: c,
|
|
151
|
-
_owner: K.current
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
function N(a, b) {
|
|
155
|
-
return {
|
|
156
|
-
$$typeof: l,
|
|
157
|
-
type: a.type,
|
|
158
|
-
key: b,
|
|
159
|
-
ref: a.ref,
|
|
160
|
-
props: a.props,
|
|
161
|
-
_owner: a._owner
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
function O(a) {
|
|
165
|
-
return "object" === typeof a && null !== a && a.$$typeof === l;
|
|
166
|
-
}
|
|
167
|
-
function escape(a) {
|
|
168
|
-
var b = {
|
|
169
|
-
"=": "=0",
|
|
170
|
-
":": "=2"
|
|
171
|
-
};
|
|
172
|
-
return "$" + a.replace(/[=:]/g, function(a) {
|
|
173
|
-
return b[a];
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
var P = /\/+/g;
|
|
177
|
-
function Q(a, b) {
|
|
178
|
-
return "object" === typeof a && null !== a && null != a.key ? escape("" + a.key) : b.toString(36);
|
|
179
|
-
}
|
|
180
|
-
function R(a, b, e, d, c) {
|
|
181
|
-
var k = typeof a;
|
|
182
|
-
if ("undefined" === k || "boolean" === k) a = null;
|
|
183
|
-
var h = !1;
|
|
184
|
-
if (null === a) h = !0;
|
|
185
|
-
else switch (k) {
|
|
186
|
-
case "string":
|
|
187
|
-
case "number":
|
|
188
|
-
h = !0;
|
|
189
|
-
break;
|
|
190
|
-
case "object": switch (a.$$typeof) {
|
|
191
|
-
case l:
|
|
192
|
-
case n: h = !0;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if (h) return h = a, c = c(h), a = "" === d ? "." + Q(h, 0) : d, I(c) ? (e = "", null != a && (e = a.replace(P, "$&/") + "/"), R(c, b, e, "", function(a) {
|
|
196
|
-
return a;
|
|
197
|
-
})) : null != c && (O(c) && (c = N(c, e + (!c.key || h && h.key === c.key ? "" : ("" + c.key).replace(P, "$&/") + "/") + a)), b.push(c)), 1;
|
|
198
|
-
h = 0;
|
|
199
|
-
d = "" === d ? "." : d + ":";
|
|
200
|
-
if (I(a)) for (var g = 0; g < a.length; g++) {
|
|
201
|
-
k = a[g];
|
|
202
|
-
var f = d + Q(k, g);
|
|
203
|
-
h += R(k, b, e, f, c);
|
|
204
|
-
}
|
|
205
|
-
else if (f = A(a), "function" === typeof f) for (a = f.call(a), g = 0; !(k = a.next()).done;) k = k.value, f = d + Q(k, g++), h += R(k, b, e, f, c);
|
|
206
|
-
else if ("object" === k) throw b = String(a), Error("Objects are not valid as a React child (found: " + ("[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead.");
|
|
207
|
-
return h;
|
|
208
|
-
}
|
|
209
|
-
function S(a, b, e) {
|
|
210
|
-
if (null == a) return a;
|
|
211
|
-
var d = [], c = 0;
|
|
212
|
-
R(a, d, "", "", function(a) {
|
|
213
|
-
return b.call(e, a, c++);
|
|
214
|
-
});
|
|
215
|
-
return d;
|
|
216
|
-
}
|
|
217
|
-
function T(a) {
|
|
218
|
-
if (-1 === a._status) {
|
|
219
|
-
var b = a._result;
|
|
220
|
-
b = b();
|
|
221
|
-
b.then(function(b) {
|
|
222
|
-
if (0 === a._status || -1 === a._status) a._status = 1, a._result = b;
|
|
223
|
-
}, function(b) {
|
|
224
|
-
if (0 === a._status || -1 === a._status) a._status = 2, a._result = b;
|
|
225
|
-
});
|
|
226
|
-
-1 === a._status && (a._status = 0, a._result = b);
|
|
227
|
-
}
|
|
228
|
-
if (1 === a._status) return a._result.default;
|
|
229
|
-
throw a._result;
|
|
230
|
-
}
|
|
231
|
-
var U = { current: null };
|
|
232
|
-
var V = { transition: null };
|
|
233
|
-
var W = {
|
|
234
|
-
ReactCurrentDispatcher: U,
|
|
235
|
-
ReactCurrentBatchConfig: V,
|
|
236
|
-
ReactCurrentOwner: K
|
|
237
|
-
};
|
|
238
|
-
function X() {
|
|
239
|
-
throw Error("act(...) is not supported in production builds of React.");
|
|
240
|
-
}
|
|
241
|
-
exports.Children = {
|
|
242
|
-
map: S,
|
|
243
|
-
forEach: function(a, b, e) {
|
|
244
|
-
S(a, function() {
|
|
245
|
-
b.apply(this, arguments);
|
|
246
|
-
}, e);
|
|
247
|
-
},
|
|
248
|
-
count: function(a) {
|
|
249
|
-
var b = 0;
|
|
250
|
-
S(a, function() {
|
|
251
|
-
b++;
|
|
252
|
-
});
|
|
253
|
-
return b;
|
|
254
|
-
},
|
|
255
|
-
toArray: function(a) {
|
|
256
|
-
return S(a, function(a) {
|
|
257
|
-
return a;
|
|
258
|
-
}) || [];
|
|
259
|
-
},
|
|
260
|
-
only: function(a) {
|
|
261
|
-
if (!O(a)) throw Error("React.Children.only expected to receive a single React element child.");
|
|
262
|
-
return a;
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
exports.Component = E;
|
|
266
|
-
exports.Fragment = p;
|
|
267
|
-
exports.Profiler = r;
|
|
268
|
-
exports.PureComponent = G;
|
|
269
|
-
exports.StrictMode = q;
|
|
270
|
-
exports.Suspense = w;
|
|
271
|
-
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W;
|
|
272
|
-
exports.act = X;
|
|
273
|
-
exports.cloneElement = function(a, b, e) {
|
|
274
|
-
if (null === a || void 0 === a) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + ".");
|
|
275
|
-
var d = C({}, a.props), c = a.key, k = a.ref, h = a._owner;
|
|
276
|
-
if (null != b) {
|
|
277
|
-
void 0 !== b.ref && (k = b.ref, h = K.current);
|
|
278
|
-
void 0 !== b.key && (c = "" + b.key);
|
|
279
|
-
if (a.type && a.type.defaultProps) var g = a.type.defaultProps;
|
|
280
|
-
for (f in b) J.call(b, f) && !L.hasOwnProperty(f) && (d[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]);
|
|
281
|
-
}
|
|
282
|
-
var f = arguments.length - 2;
|
|
283
|
-
if (1 === f) d.children = e;
|
|
284
|
-
else if (1 < f) {
|
|
285
|
-
g = Array(f);
|
|
286
|
-
for (var m = 0; m < f; m++) g[m] = arguments[m + 2];
|
|
287
|
-
d.children = g;
|
|
288
|
-
}
|
|
289
|
-
return {
|
|
290
|
-
$$typeof: l,
|
|
291
|
-
type: a.type,
|
|
292
|
-
key: c,
|
|
293
|
-
ref: k,
|
|
294
|
-
props: d,
|
|
295
|
-
_owner: h
|
|
296
|
-
};
|
|
297
|
-
};
|
|
298
|
-
exports.createContext = function(a) {
|
|
299
|
-
a = {
|
|
300
|
-
$$typeof: u,
|
|
301
|
-
_currentValue: a,
|
|
302
|
-
_currentValue2: a,
|
|
303
|
-
_threadCount: 0,
|
|
304
|
-
Provider: null,
|
|
305
|
-
Consumer: null,
|
|
306
|
-
_defaultValue: null,
|
|
307
|
-
_globalName: null
|
|
308
|
-
};
|
|
309
|
-
a.Provider = {
|
|
310
|
-
$$typeof: t,
|
|
311
|
-
_context: a
|
|
312
|
-
};
|
|
313
|
-
return a.Consumer = a;
|
|
314
|
-
};
|
|
315
|
-
exports.createElement = M;
|
|
316
|
-
exports.createFactory = function(a) {
|
|
317
|
-
var b = M.bind(null, a);
|
|
318
|
-
b.type = a;
|
|
319
|
-
return b;
|
|
320
|
-
};
|
|
321
|
-
exports.createRef = function() {
|
|
322
|
-
return { current: null };
|
|
323
|
-
};
|
|
324
|
-
exports.forwardRef = function(a) {
|
|
325
|
-
return {
|
|
326
|
-
$$typeof: v,
|
|
327
|
-
render: a
|
|
328
|
-
};
|
|
329
|
-
};
|
|
330
|
-
exports.isValidElement = O;
|
|
331
|
-
exports.lazy = function(a) {
|
|
332
|
-
return {
|
|
333
|
-
$$typeof: y,
|
|
334
|
-
_payload: {
|
|
335
|
-
_status: -1,
|
|
336
|
-
_result: a
|
|
337
|
-
},
|
|
338
|
-
_init: T
|
|
339
|
-
};
|
|
340
|
-
};
|
|
341
|
-
exports.memo = function(a, b) {
|
|
342
|
-
return {
|
|
343
|
-
$$typeof: x,
|
|
344
|
-
type: a,
|
|
345
|
-
compare: void 0 === b ? null : b
|
|
346
|
-
};
|
|
347
|
-
};
|
|
348
|
-
exports.startTransition = function(a) {
|
|
349
|
-
var b = V.transition;
|
|
350
|
-
V.transition = {};
|
|
351
|
-
try {
|
|
352
|
-
a();
|
|
353
|
-
} finally {
|
|
354
|
-
V.transition = b;
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
exports.unstable_act = X;
|
|
358
|
-
exports.useCallback = function(a, b) {
|
|
359
|
-
return U.current.useCallback(a, b);
|
|
360
|
-
};
|
|
361
|
-
exports.useContext = function(a) {
|
|
362
|
-
return U.current.useContext(a);
|
|
363
|
-
};
|
|
364
|
-
exports.useDebugValue = function() {};
|
|
365
|
-
exports.useDeferredValue = function(a) {
|
|
366
|
-
return U.current.useDeferredValue(a);
|
|
367
|
-
};
|
|
368
|
-
exports.useEffect = function(a, b) {
|
|
369
|
-
return U.current.useEffect(a, b);
|
|
370
|
-
};
|
|
371
|
-
exports.useId = function() {
|
|
372
|
-
return U.current.useId();
|
|
373
|
-
};
|
|
374
|
-
exports.useImperativeHandle = function(a, b, e) {
|
|
375
|
-
return U.current.useImperativeHandle(a, b, e);
|
|
376
|
-
};
|
|
377
|
-
exports.useInsertionEffect = function(a, b) {
|
|
378
|
-
return U.current.useInsertionEffect(a, b);
|
|
379
|
-
};
|
|
380
|
-
exports.useLayoutEffect = function(a, b) {
|
|
381
|
-
return U.current.useLayoutEffect(a, b);
|
|
382
|
-
};
|
|
383
|
-
exports.useMemo = function(a, b) {
|
|
384
|
-
return U.current.useMemo(a, b);
|
|
385
|
-
};
|
|
386
|
-
exports.useReducer = function(a, b, e) {
|
|
387
|
-
return U.current.useReducer(a, b, e);
|
|
388
|
-
};
|
|
389
|
-
exports.useRef = function(a) {
|
|
390
|
-
return U.current.useRef(a);
|
|
391
|
-
};
|
|
392
|
-
exports.useState = function(a) {
|
|
393
|
-
return U.current.useState(a);
|
|
394
|
-
};
|
|
395
|
-
exports.useSyncExternalStore = function(a, b, e) {
|
|
396
|
-
return U.current.useSyncExternalStore(a, b, e);
|
|
397
|
-
};
|
|
398
|
-
exports.useTransition = function() {
|
|
399
|
-
return U.current.useTransition();
|
|
400
|
-
};
|
|
401
|
-
exports.version = "18.3.1";
|
|
402
|
-
}));
|
|
403
|
-
//#endregion
|
|
404
|
-
//#region ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js
|
|
405
|
-
/**
|
|
406
|
-
* @license React
|
|
407
|
-
* react.development.js
|
|
408
|
-
*
|
|
409
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
410
|
-
*
|
|
411
|
-
* This source code is licensed under the MIT license found in the
|
|
412
|
-
* LICENSE file in the root directory of this source tree.
|
|
413
|
-
*/
|
|
414
|
-
var require_react_development = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
415
|
-
if (process.env.NODE_ENV !== "production") (function() {
|
|
416
|
-
"use strict";
|
|
417
|
-
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(/* @__PURE__ */ new Error());
|
|
418
|
-
var ReactVersion = "18.3.1";
|
|
419
|
-
var REACT_ELEMENT_TYPE = Symbol.for("react.element");
|
|
420
|
-
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
421
|
-
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
422
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
|
423
|
-
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
424
|
-
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
|
|
425
|
-
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
|
426
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
|
427
|
-
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
|
|
428
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
|
|
429
|
-
var REACT_MEMO_TYPE = Symbol.for("react.memo");
|
|
430
|
-
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
431
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
|
432
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
433
|
-
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
434
|
-
function getIteratorFn(maybeIterable) {
|
|
435
|
-
if (maybeIterable === null || typeof maybeIterable !== "object") return null;
|
|
436
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
437
|
-
if (typeof maybeIterator === "function") return maybeIterator;
|
|
438
|
-
return null;
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* Keeps track of the current dispatcher.
|
|
442
|
-
*/
|
|
443
|
-
var ReactCurrentDispatcher = {
|
|
444
|
-
/**
|
|
445
|
-
* @internal
|
|
446
|
-
* @type {ReactComponent}
|
|
447
|
-
*/
|
|
448
|
-
current: null };
|
|
449
|
-
/**
|
|
450
|
-
* Keeps track of the current batch's configuration such as how long an update
|
|
451
|
-
* should suspend for if it needs to.
|
|
452
|
-
*/
|
|
453
|
-
var ReactCurrentBatchConfig = { transition: null };
|
|
454
|
-
var ReactCurrentActQueue = {
|
|
455
|
-
current: null,
|
|
456
|
-
isBatchingLegacy: false,
|
|
457
|
-
didScheduleLegacyUpdate: false
|
|
458
|
-
};
|
|
459
|
-
/**
|
|
460
|
-
* Keeps track of the current owner.
|
|
461
|
-
*
|
|
462
|
-
* The current owner is the component who should own any components that are
|
|
463
|
-
* currently being constructed.
|
|
464
|
-
*/
|
|
465
|
-
var ReactCurrentOwner = {
|
|
466
|
-
/**
|
|
467
|
-
* @internal
|
|
468
|
-
* @type {ReactComponent}
|
|
469
|
-
*/
|
|
470
|
-
current: null };
|
|
471
|
-
var ReactDebugCurrentFrame = {};
|
|
472
|
-
var currentExtraStackFrame = null;
|
|
473
|
-
function setExtraStackFrame(stack) {
|
|
474
|
-
currentExtraStackFrame = stack;
|
|
475
|
-
}
|
|
476
|
-
ReactDebugCurrentFrame.setExtraStackFrame = function(stack) {
|
|
477
|
-
currentExtraStackFrame = stack;
|
|
478
|
-
};
|
|
479
|
-
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
480
|
-
ReactDebugCurrentFrame.getStackAddendum = function() {
|
|
481
|
-
var stack = "";
|
|
482
|
-
if (currentExtraStackFrame) stack += currentExtraStackFrame;
|
|
483
|
-
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
484
|
-
if (impl) stack += impl() || "";
|
|
485
|
-
return stack;
|
|
486
|
-
};
|
|
487
|
-
var enableScopeAPI = false;
|
|
488
|
-
var enableCacheElement = false;
|
|
489
|
-
var enableTransitionTracing = false;
|
|
490
|
-
var enableLegacyHidden = false;
|
|
491
|
-
var enableDebugTracing = false;
|
|
492
|
-
var ReactSharedInternals = {
|
|
493
|
-
ReactCurrentDispatcher,
|
|
494
|
-
ReactCurrentBatchConfig,
|
|
495
|
-
ReactCurrentOwner
|
|
496
|
-
};
|
|
497
|
-
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
|
498
|
-
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
|
|
499
|
-
function warn(format) {
|
|
500
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key];
|
|
501
|
-
printWarning("warn", format, args);
|
|
502
|
-
}
|
|
503
|
-
function error(format) {
|
|
504
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
|
|
505
|
-
printWarning("error", format, args);
|
|
506
|
-
}
|
|
507
|
-
function printWarning(level, format, args) {
|
|
508
|
-
var stack = ReactSharedInternals.ReactDebugCurrentFrame.getStackAddendum();
|
|
509
|
-
if (stack !== "") {
|
|
510
|
-
format += "%s";
|
|
511
|
-
args = args.concat([stack]);
|
|
512
|
-
}
|
|
513
|
-
var argsWithFormat = args.map(function(item) {
|
|
514
|
-
return String(item);
|
|
515
|
-
});
|
|
516
|
-
argsWithFormat.unshift("Warning: " + format);
|
|
517
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
518
|
-
}
|
|
519
|
-
var didWarnStateUpdateForUnmountedComponent = {};
|
|
520
|
-
function warnNoop(publicInstance, callerName) {
|
|
521
|
-
var _constructor = publicInstance.constructor;
|
|
522
|
-
var componentName = _constructor && (_constructor.displayName || _constructor.name) || "ReactClass";
|
|
523
|
-
var warningKey = componentName + "." + callerName;
|
|
524
|
-
if (didWarnStateUpdateForUnmountedComponent[warningKey]) return;
|
|
525
|
-
error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", callerName, componentName);
|
|
526
|
-
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
|
-
* This is the abstract API for an update queue.
|
|
530
|
-
*/
|
|
531
|
-
var ReactNoopUpdateQueue = {
|
|
532
|
-
/**
|
|
533
|
-
* Checks whether or not this composite component is mounted.
|
|
534
|
-
* @param {ReactClass} publicInstance The instance we want to test.
|
|
535
|
-
* @return {boolean} True if mounted, false otherwise.
|
|
536
|
-
* @protected
|
|
537
|
-
* @final
|
|
538
|
-
*/
|
|
539
|
-
isMounted: function(publicInstance) {
|
|
540
|
-
return false;
|
|
541
|
-
},
|
|
542
|
-
/**
|
|
543
|
-
* Forces an update. This should only be invoked when it is known with
|
|
544
|
-
* certainty that we are **not** in a DOM transaction.
|
|
545
|
-
*
|
|
546
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
547
|
-
* component's state has changed but `setState` was not called.
|
|
548
|
-
*
|
|
549
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
550
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
551
|
-
*
|
|
552
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
553
|
-
* @param {?function} callback Called after component is updated.
|
|
554
|
-
* @param {?string} callerName name of the calling function in the public API.
|
|
555
|
-
* @internal
|
|
556
|
-
*/
|
|
557
|
-
enqueueForceUpdate: function(publicInstance, callback, callerName) {
|
|
558
|
-
warnNoop(publicInstance, "forceUpdate");
|
|
559
|
-
},
|
|
560
|
-
/**
|
|
561
|
-
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
562
|
-
* You should treat `this.state` as immutable.
|
|
563
|
-
*
|
|
564
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
565
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
566
|
-
*
|
|
567
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
568
|
-
* @param {object} completeState Next state.
|
|
569
|
-
* @param {?function} callback Called after component is updated.
|
|
570
|
-
* @param {?string} callerName name of the calling function in the public API.
|
|
571
|
-
* @internal
|
|
572
|
-
*/
|
|
573
|
-
enqueueReplaceState: function(publicInstance, completeState, callback, callerName) {
|
|
574
|
-
warnNoop(publicInstance, "replaceState");
|
|
575
|
-
},
|
|
576
|
-
/**
|
|
577
|
-
* Sets a subset of the state. This only exists because _pendingState is
|
|
578
|
-
* internal. This provides a merging strategy that is not available to deep
|
|
579
|
-
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
580
|
-
* during the merge.
|
|
581
|
-
*
|
|
582
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
583
|
-
* @param {object} partialState Next partial state to be merged with state.
|
|
584
|
-
* @param {?function} callback Called after component is updated.
|
|
585
|
-
* @param {?string} Name of the calling function in the public API.
|
|
586
|
-
* @internal
|
|
587
|
-
*/
|
|
588
|
-
enqueueSetState: function(publicInstance, partialState, callback, callerName) {
|
|
589
|
-
warnNoop(publicInstance, "setState");
|
|
590
|
-
}
|
|
591
|
-
};
|
|
592
|
-
var assign = Object.assign;
|
|
593
|
-
var emptyObject = {};
|
|
594
|
-
Object.freeze(emptyObject);
|
|
595
|
-
/**
|
|
596
|
-
* Base class helpers for the updating state of a component.
|
|
597
|
-
*/
|
|
598
|
-
function Component(props, context, updater) {
|
|
599
|
-
this.props = props;
|
|
600
|
-
this.context = context;
|
|
601
|
-
this.refs = emptyObject;
|
|
602
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
603
|
-
}
|
|
604
|
-
Component.prototype.isReactComponent = {};
|
|
605
|
-
/**
|
|
606
|
-
* Sets a subset of the state. Always use this to mutate
|
|
607
|
-
* state. You should treat `this.state` as immutable.
|
|
608
|
-
*
|
|
609
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
610
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
611
|
-
*
|
|
612
|
-
* There is no guarantee that calls to `setState` will run synchronously,
|
|
613
|
-
* as they may eventually be batched together. You can provide an optional
|
|
614
|
-
* callback that will be executed when the call to setState is actually
|
|
615
|
-
* completed.
|
|
616
|
-
*
|
|
617
|
-
* When a function is provided to setState, it will be called at some point in
|
|
618
|
-
* the future (not synchronously). It will be called with the up to date
|
|
619
|
-
* component arguments (state, props, context). These values can be different
|
|
620
|
-
* from this.* because your function may be called after receiveProps but before
|
|
621
|
-
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
622
|
-
* assigned to this.
|
|
623
|
-
*
|
|
624
|
-
* @param {object|function} partialState Next partial state or function to
|
|
625
|
-
* produce next partial state to be merged with current state.
|
|
626
|
-
* @param {?function} callback Called after state is updated.
|
|
627
|
-
* @final
|
|
628
|
-
* @protected
|
|
629
|
-
*/
|
|
630
|
-
Component.prototype.setState = function(partialState, callback) {
|
|
631
|
-
if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null) throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
|
|
632
|
-
this.updater.enqueueSetState(this, partialState, callback, "setState");
|
|
633
|
-
};
|
|
634
|
-
/**
|
|
635
|
-
* Forces an update. This should only be invoked when it is known with
|
|
636
|
-
* certainty that we are **not** in a DOM transaction.
|
|
637
|
-
*
|
|
638
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
639
|
-
* component's state has changed but `setState` was not called.
|
|
640
|
-
*
|
|
641
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
642
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
643
|
-
*
|
|
644
|
-
* @param {?function} callback Called after update is complete.
|
|
645
|
-
* @final
|
|
646
|
-
* @protected
|
|
647
|
-
*/
|
|
648
|
-
Component.prototype.forceUpdate = function(callback) {
|
|
649
|
-
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
|
|
650
|
-
};
|
|
651
|
-
var deprecatedAPIs = {
|
|
652
|
-
isMounted: ["isMounted", "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],
|
|
653
|
-
replaceState: ["replaceState", "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]
|
|
654
|
-
};
|
|
655
|
-
var defineDeprecationWarning = function(methodName, info) {
|
|
656
|
-
Object.defineProperty(Component.prototype, methodName, { get: function() {
|
|
657
|
-
warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
|
|
658
|
-
} });
|
|
659
|
-
};
|
|
660
|
-
for (var fnName in deprecatedAPIs) if (deprecatedAPIs.hasOwnProperty(fnName)) defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
661
|
-
function ComponentDummy() {}
|
|
662
|
-
ComponentDummy.prototype = Component.prototype;
|
|
663
|
-
/**
|
|
664
|
-
* Convenience component with default shallow equality check for sCU.
|
|
665
|
-
*/
|
|
666
|
-
function PureComponent(props, context, updater) {
|
|
667
|
-
this.props = props;
|
|
668
|
-
this.context = context;
|
|
669
|
-
this.refs = emptyObject;
|
|
670
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
671
|
-
}
|
|
672
|
-
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
673
|
-
pureComponentPrototype.constructor = PureComponent;
|
|
674
|
-
assign(pureComponentPrototype, Component.prototype);
|
|
675
|
-
pureComponentPrototype.isPureReactComponent = true;
|
|
676
|
-
function createRef() {
|
|
677
|
-
var refObject = { current: null };
|
|
678
|
-
Object.seal(refObject);
|
|
679
|
-
return refObject;
|
|
680
|
-
}
|
|
681
|
-
var isArrayImpl = Array.isArray;
|
|
682
|
-
function isArray(a) {
|
|
683
|
-
return isArrayImpl(a);
|
|
684
|
-
}
|
|
685
|
-
function typeName(value) {
|
|
686
|
-
return typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
687
|
-
}
|
|
688
|
-
function willCoercionThrow(value) {
|
|
689
|
-
try {
|
|
690
|
-
testStringCoercion(value);
|
|
691
|
-
return false;
|
|
692
|
-
} catch (e) {
|
|
693
|
-
return true;
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
function testStringCoercion(value) {
|
|
697
|
-
return "" + value;
|
|
698
|
-
}
|
|
699
|
-
function checkKeyStringCoercion(value) {
|
|
700
|
-
if (willCoercionThrow(value)) {
|
|
701
|
-
error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
|
|
702
|
-
return testStringCoercion(value);
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
706
|
-
var displayName = outerType.displayName;
|
|
707
|
-
if (displayName) return displayName;
|
|
708
|
-
var functionName = innerType.displayName || innerType.name || "";
|
|
709
|
-
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
710
|
-
}
|
|
711
|
-
function getContextName(type) {
|
|
712
|
-
return type.displayName || "Context";
|
|
713
|
-
}
|
|
714
|
-
function getComponentNameFromType(type) {
|
|
715
|
-
if (type == null) return null;
|
|
716
|
-
if (typeof type.tag === "number") error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
|
|
717
|
-
if (typeof type === "function") return type.displayName || type.name || null;
|
|
718
|
-
if (typeof type === "string") return type;
|
|
719
|
-
switch (type) {
|
|
720
|
-
case REACT_FRAGMENT_TYPE: return "Fragment";
|
|
721
|
-
case REACT_PORTAL_TYPE: return "Portal";
|
|
722
|
-
case REACT_PROFILER_TYPE: return "Profiler";
|
|
723
|
-
case REACT_STRICT_MODE_TYPE: return "StrictMode";
|
|
724
|
-
case REACT_SUSPENSE_TYPE: return "Suspense";
|
|
725
|
-
case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList";
|
|
726
|
-
}
|
|
727
|
-
if (typeof type === "object") switch (type.$$typeof) {
|
|
728
|
-
case REACT_CONTEXT_TYPE: return getContextName(type) + ".Consumer";
|
|
729
|
-
case REACT_PROVIDER_TYPE: return getContextName(type._context) + ".Provider";
|
|
730
|
-
case REACT_FORWARD_REF_TYPE: return getWrappedName(type, type.render, "ForwardRef");
|
|
731
|
-
case REACT_MEMO_TYPE:
|
|
732
|
-
var outerName = type.displayName || null;
|
|
733
|
-
if (outerName !== null) return outerName;
|
|
734
|
-
return getComponentNameFromType(type.type) || "Memo";
|
|
735
|
-
case REACT_LAZY_TYPE:
|
|
736
|
-
var lazyComponent = type;
|
|
737
|
-
var payload = lazyComponent._payload;
|
|
738
|
-
var init = lazyComponent._init;
|
|
739
|
-
try {
|
|
740
|
-
return getComponentNameFromType(init(payload));
|
|
741
|
-
} catch (x) {
|
|
742
|
-
return null;
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
return null;
|
|
746
|
-
}
|
|
747
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
748
|
-
var RESERVED_PROPS = {
|
|
749
|
-
key: true,
|
|
750
|
-
ref: true,
|
|
751
|
-
__self: true,
|
|
752
|
-
__source: true
|
|
753
|
-
};
|
|
754
|
-
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs = {};
|
|
755
|
-
function hasValidRef(config) {
|
|
756
|
-
if (hasOwnProperty.call(config, "ref")) {
|
|
757
|
-
var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
|
|
758
|
-
if (getter && getter.isReactWarning) return false;
|
|
759
|
-
}
|
|
760
|
-
return config.ref !== void 0;
|
|
761
|
-
}
|
|
762
|
-
function hasValidKey(config) {
|
|
763
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
764
|
-
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
765
|
-
if (getter && getter.isReactWarning) return false;
|
|
766
|
-
}
|
|
767
|
-
return config.key !== void 0;
|
|
768
|
-
}
|
|
769
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
770
|
-
var warnAboutAccessingKey = function() {
|
|
771
|
-
if (!specialPropKeyWarningShown) {
|
|
772
|
-
specialPropKeyWarningShown = true;
|
|
773
|
-
error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
|
|
774
|
-
}
|
|
775
|
-
};
|
|
776
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
777
|
-
Object.defineProperty(props, "key", {
|
|
778
|
-
get: warnAboutAccessingKey,
|
|
779
|
-
configurable: true
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
783
|
-
var warnAboutAccessingRef = function() {
|
|
784
|
-
if (!specialPropRefWarningShown) {
|
|
785
|
-
specialPropRefWarningShown = true;
|
|
786
|
-
error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
|
|
787
|
-
}
|
|
788
|
-
};
|
|
789
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
790
|
-
Object.defineProperty(props, "ref", {
|
|
791
|
-
get: warnAboutAccessingRef,
|
|
792
|
-
configurable: true
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
796
|
-
if (typeof config.ref === "string" && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
797
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
798
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
|
799
|
-
error("Component \"%s\" contains the string ref \"%s\". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref", componentName, config.ref);
|
|
800
|
-
didWarnAboutStringRefs[componentName] = true;
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
/**
|
|
805
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
806
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
807
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
808
|
-
* if something is a React Element.
|
|
809
|
-
*
|
|
810
|
-
* @param {*} type
|
|
811
|
-
* @param {*} props
|
|
812
|
-
* @param {*} key
|
|
813
|
-
* @param {string|object} ref
|
|
814
|
-
* @param {*} owner
|
|
815
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
816
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
817
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
818
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
819
|
-
* change in behavior.
|
|
820
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
821
|
-
* indicating filename, line number, and/or other information.
|
|
822
|
-
* @internal
|
|
823
|
-
*/
|
|
824
|
-
var ReactElement = function(type, key, ref, self, source, owner, props) {
|
|
825
|
-
var element = {
|
|
826
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
827
|
-
type,
|
|
828
|
-
key,
|
|
829
|
-
ref,
|
|
830
|
-
props,
|
|
831
|
-
_owner: owner
|
|
832
|
-
};
|
|
833
|
-
element._store = {};
|
|
834
|
-
Object.defineProperty(element._store, "validated", {
|
|
835
|
-
configurable: false,
|
|
836
|
-
enumerable: false,
|
|
837
|
-
writable: true,
|
|
838
|
-
value: false
|
|
839
|
-
});
|
|
840
|
-
Object.defineProperty(element, "_self", {
|
|
841
|
-
configurable: false,
|
|
842
|
-
enumerable: false,
|
|
843
|
-
writable: false,
|
|
844
|
-
value: self
|
|
845
|
-
});
|
|
846
|
-
Object.defineProperty(element, "_source", {
|
|
847
|
-
configurable: false,
|
|
848
|
-
enumerable: false,
|
|
849
|
-
writable: false,
|
|
850
|
-
value: source
|
|
851
|
-
});
|
|
852
|
-
if (Object.freeze) {
|
|
853
|
-
Object.freeze(element.props);
|
|
854
|
-
Object.freeze(element);
|
|
855
|
-
}
|
|
856
|
-
return element;
|
|
857
|
-
};
|
|
858
|
-
/**
|
|
859
|
-
* Create and return a new ReactElement of the given type.
|
|
860
|
-
* See https://reactjs.org/docs/react-api.html#createelement
|
|
861
|
-
*/
|
|
862
|
-
function createElement(type, config, children) {
|
|
863
|
-
var propName;
|
|
864
|
-
var props = {};
|
|
865
|
-
var key = null;
|
|
866
|
-
var ref = null;
|
|
867
|
-
var self = null;
|
|
868
|
-
var source = null;
|
|
869
|
-
if (config != null) {
|
|
870
|
-
if (hasValidRef(config)) {
|
|
871
|
-
ref = config.ref;
|
|
872
|
-
warnIfStringRefCannotBeAutoConverted(config);
|
|
873
|
-
}
|
|
874
|
-
if (hasValidKey(config)) {
|
|
875
|
-
checkKeyStringCoercion(config.key);
|
|
876
|
-
key = "" + config.key;
|
|
877
|
-
}
|
|
878
|
-
self = config.__self === void 0 ? null : config.__self;
|
|
879
|
-
source = config.__source === void 0 ? null : config.__source;
|
|
880
|
-
for (propName in config) if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) props[propName] = config[propName];
|
|
881
|
-
}
|
|
882
|
-
var childrenLength = arguments.length - 2;
|
|
883
|
-
if (childrenLength === 1) props.children = children;
|
|
884
|
-
else if (childrenLength > 1) {
|
|
885
|
-
var childArray = Array(childrenLength);
|
|
886
|
-
for (var i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 2];
|
|
887
|
-
if (Object.freeze) Object.freeze(childArray);
|
|
888
|
-
props.children = childArray;
|
|
889
|
-
}
|
|
890
|
-
if (type && type.defaultProps) {
|
|
891
|
-
var defaultProps = type.defaultProps;
|
|
892
|
-
for (propName in defaultProps) if (props[propName] === void 0) props[propName] = defaultProps[propName];
|
|
893
|
-
}
|
|
894
|
-
if (key || ref) {
|
|
895
|
-
var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
|
|
896
|
-
if (key) defineKeyPropWarningGetter(props, displayName);
|
|
897
|
-
if (ref) defineRefPropWarningGetter(props, displayName);
|
|
898
|
-
}
|
|
899
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
900
|
-
}
|
|
901
|
-
function cloneAndReplaceKey(oldElement, newKey) {
|
|
902
|
-
return ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
903
|
-
}
|
|
904
|
-
/**
|
|
905
|
-
* Clone and return a new ReactElement using element as the starting point.
|
|
906
|
-
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
907
|
-
*/
|
|
908
|
-
function cloneElement(element, config, children) {
|
|
909
|
-
if (element === null || element === void 0) throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
|
|
910
|
-
var propName;
|
|
911
|
-
var props = assign({}, element.props);
|
|
912
|
-
var key = element.key;
|
|
913
|
-
var ref = element.ref;
|
|
914
|
-
var self = element._self;
|
|
915
|
-
var source = element._source;
|
|
916
|
-
var owner = element._owner;
|
|
917
|
-
if (config != null) {
|
|
918
|
-
if (hasValidRef(config)) {
|
|
919
|
-
ref = config.ref;
|
|
920
|
-
owner = ReactCurrentOwner.current;
|
|
921
|
-
}
|
|
922
|
-
if (hasValidKey(config)) {
|
|
923
|
-
checkKeyStringCoercion(config.key);
|
|
924
|
-
key = "" + config.key;
|
|
925
|
-
}
|
|
926
|
-
var defaultProps;
|
|
927
|
-
if (element.type && element.type.defaultProps) defaultProps = element.type.defaultProps;
|
|
928
|
-
for (propName in config) if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
929
|
-
if (config[propName] === void 0 && defaultProps !== void 0) props[propName] = defaultProps[propName];
|
|
930
|
-
else props[propName] = config[propName];
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
var childrenLength = arguments.length - 2;
|
|
934
|
-
if (childrenLength === 1) props.children = children;
|
|
935
|
-
else if (childrenLength > 1) {
|
|
936
|
-
var childArray = Array(childrenLength);
|
|
937
|
-
for (var i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 2];
|
|
938
|
-
props.children = childArray;
|
|
939
|
-
}
|
|
940
|
-
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
941
|
-
}
|
|
942
|
-
/**
|
|
943
|
-
* Verifies the object is a ReactElement.
|
|
944
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
945
|
-
* @param {?object} object
|
|
946
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
947
|
-
* @final
|
|
948
|
-
*/
|
|
949
|
-
function isValidElement(object) {
|
|
950
|
-
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
951
|
-
}
|
|
952
|
-
var SEPARATOR = ".";
|
|
953
|
-
var SUBSEPARATOR = ":";
|
|
954
|
-
/**
|
|
955
|
-
* Escape and wrap key so it is safe to use as a reactid
|
|
956
|
-
*
|
|
957
|
-
* @param {string} key to be escaped.
|
|
958
|
-
* @return {string} the escaped key.
|
|
959
|
-
*/
|
|
960
|
-
function escape(key) {
|
|
961
|
-
var escapeRegex = /[=:]/g;
|
|
962
|
-
var escaperLookup = {
|
|
963
|
-
"=": "=0",
|
|
964
|
-
":": "=2"
|
|
965
|
-
};
|
|
966
|
-
return "$" + key.replace(escapeRegex, function(match) {
|
|
967
|
-
return escaperLookup[match];
|
|
968
|
-
});
|
|
969
|
-
}
|
|
970
|
-
/**
|
|
971
|
-
* TODO: Test that a single child and an array with one item have the same key
|
|
972
|
-
* pattern.
|
|
973
|
-
*/
|
|
974
|
-
var didWarnAboutMaps = false;
|
|
975
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
976
|
-
function escapeUserProvidedKey(text) {
|
|
977
|
-
return text.replace(userProvidedKeyEscapeRegex, "$&/");
|
|
978
|
-
}
|
|
979
|
-
/**
|
|
980
|
-
* Generate a key string that identifies a element within a set.
|
|
981
|
-
*
|
|
982
|
-
* @param {*} element A element that could contain a manual key.
|
|
983
|
-
* @param {number} index Index that is used if a manual key is not provided.
|
|
984
|
-
* @return {string}
|
|
985
|
-
*/
|
|
986
|
-
function getElementKey(element, index) {
|
|
987
|
-
if (typeof element === "object" && element !== null && element.key != null) {
|
|
988
|
-
checkKeyStringCoercion(element.key);
|
|
989
|
-
return escape("" + element.key);
|
|
990
|
-
}
|
|
991
|
-
return index.toString(36);
|
|
992
|
-
}
|
|
993
|
-
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
994
|
-
var type = typeof children;
|
|
995
|
-
if (type === "undefined" || type === "boolean") children = null;
|
|
996
|
-
var invokeCallback = false;
|
|
997
|
-
if (children === null) invokeCallback = true;
|
|
998
|
-
else switch (type) {
|
|
999
|
-
case "string":
|
|
1000
|
-
case "number":
|
|
1001
|
-
invokeCallback = true;
|
|
1002
|
-
break;
|
|
1003
|
-
case "object": switch (children.$$typeof) {
|
|
1004
|
-
case REACT_ELEMENT_TYPE:
|
|
1005
|
-
case REACT_PORTAL_TYPE: invokeCallback = true;
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
if (invokeCallback) {
|
|
1009
|
-
var _child = children;
|
|
1010
|
-
var mappedChild = callback(_child);
|
|
1011
|
-
var childKey = nameSoFar === "" ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
|
1012
|
-
if (isArray(mappedChild)) {
|
|
1013
|
-
var escapedChildKey = "";
|
|
1014
|
-
if (childKey != null) escapedChildKey = escapeUserProvidedKey(childKey) + "/";
|
|
1015
|
-
mapIntoArray(mappedChild, array, escapedChildKey, "", function(c) {
|
|
1016
|
-
return c;
|
|
1017
|
-
});
|
|
1018
|
-
} else if (mappedChild != null) {
|
|
1019
|
-
if (isValidElement(mappedChild)) {
|
|
1020
|
-
if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) checkKeyStringCoercion(mappedChild.key);
|
|
1021
|
-
mappedChild = cloneAndReplaceKey(mappedChild, escapedPrefix + (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey("" + mappedChild.key) + "/" : "") + childKey);
|
|
1022
|
-
}
|
|
1023
|
-
array.push(mappedChild);
|
|
1024
|
-
}
|
|
1025
|
-
return 1;
|
|
1026
|
-
}
|
|
1027
|
-
var child;
|
|
1028
|
-
var nextName;
|
|
1029
|
-
var subtreeCount = 0;
|
|
1030
|
-
var nextNamePrefix = nameSoFar === "" ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
1031
|
-
if (isArray(children)) for (var i = 0; i < children.length; i++) {
|
|
1032
|
-
child = children[i];
|
|
1033
|
-
nextName = nextNamePrefix + getElementKey(child, i);
|
|
1034
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
1035
|
-
}
|
|
1036
|
-
else {
|
|
1037
|
-
var iteratorFn = getIteratorFn(children);
|
|
1038
|
-
if (typeof iteratorFn === "function") {
|
|
1039
|
-
var iterableChildren = children;
|
|
1040
|
-
if (iteratorFn === iterableChildren.entries) {
|
|
1041
|
-
if (!didWarnAboutMaps) warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead.");
|
|
1042
|
-
didWarnAboutMaps = true;
|
|
1043
|
-
}
|
|
1044
|
-
var iterator = iteratorFn.call(iterableChildren);
|
|
1045
|
-
var step;
|
|
1046
|
-
var ii = 0;
|
|
1047
|
-
while (!(step = iterator.next()).done) {
|
|
1048
|
-
child = step.value;
|
|
1049
|
-
nextName = nextNamePrefix + getElementKey(child, ii++);
|
|
1050
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
1051
|
-
}
|
|
1052
|
-
} else if (type === "object") {
|
|
1053
|
-
var childrenString = String(children);
|
|
1054
|
-
throw new Error("Objects are not valid as a React child (found: " + (childrenString === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : childrenString) + "). If you meant to render a collection of children, use an array instead.");
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
return subtreeCount;
|
|
1058
|
-
}
|
|
1059
|
-
/**
|
|
1060
|
-
* Maps children that are typically specified as `props.children`.
|
|
1061
|
-
*
|
|
1062
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
|
1063
|
-
*
|
|
1064
|
-
* The provided mapFunction(child, index) will be called for each
|
|
1065
|
-
* leaf child.
|
|
1066
|
-
*
|
|
1067
|
-
* @param {?*} children Children tree container.
|
|
1068
|
-
* @param {function(*, int)} func The map function.
|
|
1069
|
-
* @param {*} context Context for mapFunction.
|
|
1070
|
-
* @return {object} Object containing the ordered map of results.
|
|
1071
|
-
*/
|
|
1072
|
-
function mapChildren(children, func, context) {
|
|
1073
|
-
if (children == null) return children;
|
|
1074
|
-
var result = [];
|
|
1075
|
-
var count = 0;
|
|
1076
|
-
mapIntoArray(children, result, "", "", function(child) {
|
|
1077
|
-
return func.call(context, child, count++);
|
|
1078
|
-
});
|
|
1079
|
-
return result;
|
|
1080
|
-
}
|
|
1081
|
-
/**
|
|
1082
|
-
* Count the number of children that are typically specified as
|
|
1083
|
-
* `props.children`.
|
|
1084
|
-
*
|
|
1085
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
|
1086
|
-
*
|
|
1087
|
-
* @param {?*} children Children tree container.
|
|
1088
|
-
* @return {number} The number of children.
|
|
1089
|
-
*/
|
|
1090
|
-
function countChildren(children) {
|
|
1091
|
-
var n = 0;
|
|
1092
|
-
mapChildren(children, function() {
|
|
1093
|
-
n++;
|
|
1094
|
-
});
|
|
1095
|
-
return n;
|
|
1096
|
-
}
|
|
1097
|
-
/**
|
|
1098
|
-
* Iterates through children that are typically specified as `props.children`.
|
|
1099
|
-
*
|
|
1100
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
1101
|
-
*
|
|
1102
|
-
* The provided forEachFunc(child, index) will be called for each
|
|
1103
|
-
* leaf child.
|
|
1104
|
-
*
|
|
1105
|
-
* @param {?*} children Children tree container.
|
|
1106
|
-
* @param {function(*, int)} forEachFunc
|
|
1107
|
-
* @param {*} forEachContext Context for forEachContext.
|
|
1108
|
-
*/
|
|
1109
|
-
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1110
|
-
mapChildren(children, function() {
|
|
1111
|
-
forEachFunc.apply(this, arguments);
|
|
1112
|
-
}, forEachContext);
|
|
1113
|
-
}
|
|
1114
|
-
/**
|
|
1115
|
-
* Flatten a children object (typically specified as `props.children`) and
|
|
1116
|
-
* return an array with appropriately re-keyed children.
|
|
1117
|
-
*
|
|
1118
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
1119
|
-
*/
|
|
1120
|
-
function toArray(children) {
|
|
1121
|
-
return mapChildren(children, function(child) {
|
|
1122
|
-
return child;
|
|
1123
|
-
}) || [];
|
|
1124
|
-
}
|
|
1125
|
-
/**
|
|
1126
|
-
* Returns the first child in a collection of children and verifies that there
|
|
1127
|
-
* is only one child in the collection.
|
|
1128
|
-
*
|
|
1129
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
|
1130
|
-
*
|
|
1131
|
-
* The current implementation of this function assumes that a single child gets
|
|
1132
|
-
* passed without a wrapper, but the purpose of this helper function is to
|
|
1133
|
-
* abstract away the particular structure of children.
|
|
1134
|
-
*
|
|
1135
|
-
* @param {?object} children Child collection structure.
|
|
1136
|
-
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
1137
|
-
* structure.
|
|
1138
|
-
*/
|
|
1139
|
-
function onlyChild(children) {
|
|
1140
|
-
if (!isValidElement(children)) throw new Error("React.Children.only expected to receive a single React element child.");
|
|
1141
|
-
return children;
|
|
1142
|
-
}
|
|
1143
|
-
function createContext(defaultValue) {
|
|
1144
|
-
var context = {
|
|
1145
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
1146
|
-
_currentValue: defaultValue,
|
|
1147
|
-
_currentValue2: defaultValue,
|
|
1148
|
-
_threadCount: 0,
|
|
1149
|
-
Provider: null,
|
|
1150
|
-
Consumer: null,
|
|
1151
|
-
_defaultValue: null,
|
|
1152
|
-
_globalName: null
|
|
1153
|
-
};
|
|
1154
|
-
context.Provider = {
|
|
1155
|
-
$$typeof: REACT_PROVIDER_TYPE,
|
|
1156
|
-
_context: context
|
|
1157
|
-
};
|
|
1158
|
-
var hasWarnedAboutUsingNestedContextConsumers = false;
|
|
1159
|
-
var hasWarnedAboutUsingConsumerProvider = false;
|
|
1160
|
-
var hasWarnedAboutDisplayNameOnConsumer = false;
|
|
1161
|
-
var Consumer = {
|
|
1162
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
1163
|
-
_context: context
|
|
1164
|
-
};
|
|
1165
|
-
Object.defineProperties(Consumer, {
|
|
1166
|
-
Provider: {
|
|
1167
|
-
get: function() {
|
|
1168
|
-
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
1169
|
-
hasWarnedAboutUsingConsumerProvider = true;
|
|
1170
|
-
error("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?");
|
|
1171
|
-
}
|
|
1172
|
-
return context.Provider;
|
|
1173
|
-
},
|
|
1174
|
-
set: function(_Provider) {
|
|
1175
|
-
context.Provider = _Provider;
|
|
1176
|
-
}
|
|
1177
|
-
},
|
|
1178
|
-
_currentValue: {
|
|
1179
|
-
get: function() {
|
|
1180
|
-
return context._currentValue;
|
|
1181
|
-
},
|
|
1182
|
-
set: function(_currentValue) {
|
|
1183
|
-
context._currentValue = _currentValue;
|
|
1184
|
-
}
|
|
1185
|
-
},
|
|
1186
|
-
_currentValue2: {
|
|
1187
|
-
get: function() {
|
|
1188
|
-
return context._currentValue2;
|
|
1189
|
-
},
|
|
1190
|
-
set: function(_currentValue2) {
|
|
1191
|
-
context._currentValue2 = _currentValue2;
|
|
1192
|
-
}
|
|
1193
|
-
},
|
|
1194
|
-
_threadCount: {
|
|
1195
|
-
get: function() {
|
|
1196
|
-
return context._threadCount;
|
|
1197
|
-
},
|
|
1198
|
-
set: function(_threadCount) {
|
|
1199
|
-
context._threadCount = _threadCount;
|
|
1200
|
-
}
|
|
1201
|
-
},
|
|
1202
|
-
Consumer: { get: function() {
|
|
1203
|
-
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
1204
|
-
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
1205
|
-
error("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?");
|
|
1206
|
-
}
|
|
1207
|
-
return context.Consumer;
|
|
1208
|
-
} },
|
|
1209
|
-
displayName: {
|
|
1210
|
-
get: function() {
|
|
1211
|
-
return context.displayName;
|
|
1212
|
-
},
|
|
1213
|
-
set: function(displayName) {
|
|
1214
|
-
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
|
1215
|
-
warn("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
|
1216
|
-
hasWarnedAboutDisplayNameOnConsumer = true;
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
});
|
|
1221
|
-
context.Consumer = Consumer;
|
|
1222
|
-
context._currentRenderer = null;
|
|
1223
|
-
context._currentRenderer2 = null;
|
|
1224
|
-
return context;
|
|
1225
|
-
}
|
|
1226
|
-
var Uninitialized = -1;
|
|
1227
|
-
var Pending = 0;
|
|
1228
|
-
var Resolved = 1;
|
|
1229
|
-
var Rejected = 2;
|
|
1230
|
-
function lazyInitializer(payload) {
|
|
1231
|
-
if (payload._status === Uninitialized) {
|
|
1232
|
-
var ctor = payload._result;
|
|
1233
|
-
var thenable = ctor();
|
|
1234
|
-
thenable.then(function(moduleObject) {
|
|
1235
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1236
|
-
var resolved = payload;
|
|
1237
|
-
resolved._status = Resolved;
|
|
1238
|
-
resolved._result = moduleObject;
|
|
1239
|
-
}
|
|
1240
|
-
}, function(error) {
|
|
1241
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1242
|
-
var rejected = payload;
|
|
1243
|
-
rejected._status = Rejected;
|
|
1244
|
-
rejected._result = error;
|
|
1245
|
-
}
|
|
1246
|
-
});
|
|
1247
|
-
if (payload._status === Uninitialized) {
|
|
1248
|
-
var pending = payload;
|
|
1249
|
-
pending._status = Pending;
|
|
1250
|
-
pending._result = thenable;
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
if (payload._status === Resolved) {
|
|
1254
|
-
var moduleObject = payload._result;
|
|
1255
|
-
if (moduleObject === void 0) error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", moduleObject);
|
|
1256
|
-
if (!("default" in moduleObject)) error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
|
|
1257
|
-
return moduleObject.default;
|
|
1258
|
-
} else throw payload._result;
|
|
1259
|
-
}
|
|
1260
|
-
function lazy(ctor) {
|
|
1261
|
-
var lazyType = {
|
|
1262
|
-
$$typeof: REACT_LAZY_TYPE,
|
|
1263
|
-
_payload: {
|
|
1264
|
-
_status: Uninitialized,
|
|
1265
|
-
_result: ctor
|
|
1266
|
-
},
|
|
1267
|
-
_init: lazyInitializer
|
|
1268
|
-
};
|
|
1269
|
-
var defaultProps;
|
|
1270
|
-
var propTypes;
|
|
1271
|
-
Object.defineProperties(lazyType, {
|
|
1272
|
-
defaultProps: {
|
|
1273
|
-
configurable: true,
|
|
1274
|
-
get: function() {
|
|
1275
|
-
return defaultProps;
|
|
1276
|
-
},
|
|
1277
|
-
set: function(newDefaultProps) {
|
|
1278
|
-
error("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.");
|
|
1279
|
-
defaultProps = newDefaultProps;
|
|
1280
|
-
Object.defineProperty(lazyType, "defaultProps", { enumerable: true });
|
|
1281
|
-
}
|
|
1282
|
-
},
|
|
1283
|
-
propTypes: {
|
|
1284
|
-
configurable: true,
|
|
1285
|
-
get: function() {
|
|
1286
|
-
return propTypes;
|
|
1287
|
-
},
|
|
1288
|
-
set: function(newPropTypes) {
|
|
1289
|
-
error("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.");
|
|
1290
|
-
propTypes = newPropTypes;
|
|
1291
|
-
Object.defineProperty(lazyType, "propTypes", { enumerable: true });
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
});
|
|
1295
|
-
return lazyType;
|
|
1296
|
-
}
|
|
1297
|
-
function forwardRef(render) {
|
|
1298
|
-
if (render != null && render.$$typeof === REACT_MEMO_TYPE) error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).");
|
|
1299
|
-
else if (typeof render !== "function") error("forwardRef requires a render function but was given %s.", render === null ? "null" : typeof render);
|
|
1300
|
-
else if (render.length !== 0 && render.length !== 2) error("forwardRef render functions accept exactly two parameters: props and ref. %s", render.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined.");
|
|
1301
|
-
if (render != null) {
|
|
1302
|
-
if (render.defaultProps != null || render.propTypes != null) error("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");
|
|
1303
|
-
}
|
|
1304
|
-
var elementType = {
|
|
1305
|
-
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
1306
|
-
render
|
|
1307
|
-
};
|
|
1308
|
-
var ownName;
|
|
1309
|
-
Object.defineProperty(elementType, "displayName", {
|
|
1310
|
-
enumerable: false,
|
|
1311
|
-
configurable: true,
|
|
1312
|
-
get: function() {
|
|
1313
|
-
return ownName;
|
|
1314
|
-
},
|
|
1315
|
-
set: function(name) {
|
|
1316
|
-
ownName = name;
|
|
1317
|
-
if (!render.name && !render.displayName) render.displayName = name;
|
|
1318
|
-
}
|
|
1319
|
-
});
|
|
1320
|
-
return elementType;
|
|
1321
|
-
}
|
|
1322
|
-
var REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
|
|
1323
|
-
function isValidElementType(type) {
|
|
1324
|
-
if (typeof type === "string" || typeof type === "function") return true;
|
|
1325
|
-
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) return true;
|
|
1326
|
-
if (typeof type === "object" && type !== null) {
|
|
1327
|
-
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) return true;
|
|
1328
|
-
}
|
|
1329
|
-
return false;
|
|
1330
|
-
}
|
|
1331
|
-
function memo(type, compare) {
|
|
1332
|
-
if (!isValidElementType(type)) error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
|
|
1333
|
-
var elementType = {
|
|
1334
|
-
$$typeof: REACT_MEMO_TYPE,
|
|
1335
|
-
type,
|
|
1336
|
-
compare: compare === void 0 ? null : compare
|
|
1337
|
-
};
|
|
1338
|
-
var ownName;
|
|
1339
|
-
Object.defineProperty(elementType, "displayName", {
|
|
1340
|
-
enumerable: false,
|
|
1341
|
-
configurable: true,
|
|
1342
|
-
get: function() {
|
|
1343
|
-
return ownName;
|
|
1344
|
-
},
|
|
1345
|
-
set: function(name) {
|
|
1346
|
-
ownName = name;
|
|
1347
|
-
if (!type.name && !type.displayName) type.displayName = name;
|
|
1348
|
-
}
|
|
1349
|
-
});
|
|
1350
|
-
return elementType;
|
|
1351
|
-
}
|
|
1352
|
-
function resolveDispatcher() {
|
|
1353
|
-
var dispatcher = ReactCurrentDispatcher.current;
|
|
1354
|
-
if (dispatcher === null) error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
|
|
1355
|
-
return dispatcher;
|
|
1356
|
-
}
|
|
1357
|
-
function useContext(Context) {
|
|
1358
|
-
var dispatcher = resolveDispatcher();
|
|
1359
|
-
if (Context._context !== void 0) {
|
|
1360
|
-
var realContext = Context._context;
|
|
1361
|
-
if (realContext.Consumer === Context) error("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?");
|
|
1362
|
-
else if (realContext.Provider === Context) error("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?");
|
|
1363
|
-
}
|
|
1364
|
-
return dispatcher.useContext(Context);
|
|
1365
|
-
}
|
|
1366
|
-
function useState(initialState) {
|
|
1367
|
-
return resolveDispatcher().useState(initialState);
|
|
1368
|
-
}
|
|
1369
|
-
function useReducer(reducer, initialArg, init) {
|
|
1370
|
-
return resolveDispatcher().useReducer(reducer, initialArg, init);
|
|
1371
|
-
}
|
|
1372
|
-
function useRef(initialValue) {
|
|
1373
|
-
return resolveDispatcher().useRef(initialValue);
|
|
1374
|
-
}
|
|
1375
|
-
function useEffect(create, deps) {
|
|
1376
|
-
return resolveDispatcher().useEffect(create, deps);
|
|
1377
|
-
}
|
|
1378
|
-
function useInsertionEffect(create, deps) {
|
|
1379
|
-
return resolveDispatcher().useInsertionEffect(create, deps);
|
|
1380
|
-
}
|
|
1381
|
-
function useLayoutEffect(create, deps) {
|
|
1382
|
-
return resolveDispatcher().useLayoutEffect(create, deps);
|
|
1383
|
-
}
|
|
1384
|
-
function useCallback(callback, deps) {
|
|
1385
|
-
return resolveDispatcher().useCallback(callback, deps);
|
|
1386
|
-
}
|
|
1387
|
-
function useMemo(create, deps) {
|
|
1388
|
-
return resolveDispatcher().useMemo(create, deps);
|
|
1389
|
-
}
|
|
1390
|
-
function useImperativeHandle(ref, create, deps) {
|
|
1391
|
-
return resolveDispatcher().useImperativeHandle(ref, create, deps);
|
|
1392
|
-
}
|
|
1393
|
-
function useDebugValue(value, formatterFn) {
|
|
1394
|
-
return resolveDispatcher().useDebugValue(value, formatterFn);
|
|
1395
|
-
}
|
|
1396
|
-
function useTransition() {
|
|
1397
|
-
return resolveDispatcher().useTransition();
|
|
1398
|
-
}
|
|
1399
|
-
function useDeferredValue(value) {
|
|
1400
|
-
return resolveDispatcher().useDeferredValue(value);
|
|
1401
|
-
}
|
|
1402
|
-
function useId() {
|
|
1403
|
-
return resolveDispatcher().useId();
|
|
1404
|
-
}
|
|
1405
|
-
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
1406
|
-
return resolveDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
1407
|
-
}
|
|
1408
|
-
var disabledDepth = 0;
|
|
1409
|
-
var prevLog;
|
|
1410
|
-
var prevInfo;
|
|
1411
|
-
var prevWarn;
|
|
1412
|
-
var prevError;
|
|
1413
|
-
var prevGroup;
|
|
1414
|
-
var prevGroupCollapsed;
|
|
1415
|
-
var prevGroupEnd;
|
|
1416
|
-
function disabledLog() {}
|
|
1417
|
-
disabledLog.__reactDisabledLog = true;
|
|
1418
|
-
function disableLogs() {
|
|
1419
|
-
if (disabledDepth === 0) {
|
|
1420
|
-
prevLog = console.log;
|
|
1421
|
-
prevInfo = console.info;
|
|
1422
|
-
prevWarn = console.warn;
|
|
1423
|
-
prevError = console.error;
|
|
1424
|
-
prevGroup = console.group;
|
|
1425
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
1426
|
-
prevGroupEnd = console.groupEnd;
|
|
1427
|
-
var props = {
|
|
1428
|
-
configurable: true,
|
|
1429
|
-
enumerable: true,
|
|
1430
|
-
value: disabledLog,
|
|
1431
|
-
writable: true
|
|
1432
|
-
};
|
|
1433
|
-
Object.defineProperties(console, {
|
|
1434
|
-
info: props,
|
|
1435
|
-
log: props,
|
|
1436
|
-
warn: props,
|
|
1437
|
-
error: props,
|
|
1438
|
-
group: props,
|
|
1439
|
-
groupCollapsed: props,
|
|
1440
|
-
groupEnd: props
|
|
1441
|
-
});
|
|
1442
|
-
}
|
|
1443
|
-
disabledDepth++;
|
|
1444
|
-
}
|
|
1445
|
-
function reenableLogs() {
|
|
1446
|
-
disabledDepth--;
|
|
1447
|
-
if (disabledDepth === 0) {
|
|
1448
|
-
var props = {
|
|
1449
|
-
configurable: true,
|
|
1450
|
-
enumerable: true,
|
|
1451
|
-
writable: true
|
|
1452
|
-
};
|
|
1453
|
-
Object.defineProperties(console, {
|
|
1454
|
-
log: assign({}, props, { value: prevLog }),
|
|
1455
|
-
info: assign({}, props, { value: prevInfo }),
|
|
1456
|
-
warn: assign({}, props, { value: prevWarn }),
|
|
1457
|
-
error: assign({}, props, { value: prevError }),
|
|
1458
|
-
group: assign({}, props, { value: prevGroup }),
|
|
1459
|
-
groupCollapsed: assign({}, props, { value: prevGroupCollapsed }),
|
|
1460
|
-
groupEnd: assign({}, props, { value: prevGroupEnd })
|
|
1461
|
-
});
|
|
1462
|
-
}
|
|
1463
|
-
if (disabledDepth < 0) error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
1464
|
-
}
|
|
1465
|
-
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
1466
|
-
var prefix;
|
|
1467
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
1468
|
-
if (prefix === void 0) try {
|
|
1469
|
-
throw Error();
|
|
1470
|
-
} catch (x) {
|
|
1471
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
1472
|
-
prefix = match && match[1] || "";
|
|
1473
|
-
}
|
|
1474
|
-
return "\n" + prefix + name;
|
|
1475
|
-
}
|
|
1476
|
-
var reentry = false;
|
|
1477
|
-
var componentFrameCache = new (typeof WeakMap === "function" ? WeakMap : Map)();
|
|
1478
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
1479
|
-
if (!fn || reentry) return "";
|
|
1480
|
-
var frame = componentFrameCache.get(fn);
|
|
1481
|
-
if (frame !== void 0) return frame;
|
|
1482
|
-
var control;
|
|
1483
|
-
reentry = true;
|
|
1484
|
-
var previousPrepareStackTrace = Error.prepareStackTrace;
|
|
1485
|
-
Error.prepareStackTrace = void 0;
|
|
1486
|
-
var previousDispatcher = ReactCurrentDispatcher$1.current;
|
|
1487
|
-
ReactCurrentDispatcher$1.current = null;
|
|
1488
|
-
disableLogs();
|
|
1489
|
-
try {
|
|
1490
|
-
if (construct) {
|
|
1491
|
-
var Fake = function() {
|
|
1492
|
-
throw Error();
|
|
1493
|
-
};
|
|
1494
|
-
Object.defineProperty(Fake.prototype, "props", { set: function() {
|
|
1495
|
-
throw Error();
|
|
1496
|
-
} });
|
|
1497
|
-
if (typeof Reflect === "object" && Reflect.construct) {
|
|
1498
|
-
try {
|
|
1499
|
-
Reflect.construct(Fake, []);
|
|
1500
|
-
} catch (x) {
|
|
1501
|
-
control = x;
|
|
1502
|
-
}
|
|
1503
|
-
Reflect.construct(fn, [], Fake);
|
|
1504
|
-
} else {
|
|
1505
|
-
try {
|
|
1506
|
-
Fake.call();
|
|
1507
|
-
} catch (x) {
|
|
1508
|
-
control = x;
|
|
1509
|
-
}
|
|
1510
|
-
fn.call(Fake.prototype);
|
|
1511
|
-
}
|
|
1512
|
-
} else {
|
|
1513
|
-
try {
|
|
1514
|
-
throw Error();
|
|
1515
|
-
} catch (x) {
|
|
1516
|
-
control = x;
|
|
1517
|
-
}
|
|
1518
|
-
fn();
|
|
1519
|
-
}
|
|
1520
|
-
} catch (sample) {
|
|
1521
|
-
if (sample && control && typeof sample.stack === "string") {
|
|
1522
|
-
var sampleLines = sample.stack.split("\n");
|
|
1523
|
-
var controlLines = control.stack.split("\n");
|
|
1524
|
-
var s = sampleLines.length - 1;
|
|
1525
|
-
var c = controlLines.length - 1;
|
|
1526
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) c--;
|
|
1527
|
-
for (; s >= 1 && c >= 0; s--, c--) if (sampleLines[s] !== controlLines[c]) {
|
|
1528
|
-
if (s !== 1 || c !== 1) do {
|
|
1529
|
-
s--;
|
|
1530
|
-
c--;
|
|
1531
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
1532
|
-
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
|
|
1533
|
-
if (fn.displayName && _frame.includes("<anonymous>")) _frame = _frame.replace("<anonymous>", fn.displayName);
|
|
1534
|
-
if (typeof fn === "function") componentFrameCache.set(fn, _frame);
|
|
1535
|
-
return _frame;
|
|
1536
|
-
}
|
|
1537
|
-
} while (s >= 1 && c >= 0);
|
|
1538
|
-
break;
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1541
|
-
} finally {
|
|
1542
|
-
reentry = false;
|
|
1543
|
-
ReactCurrentDispatcher$1.current = previousDispatcher;
|
|
1544
|
-
reenableLogs();
|
|
1545
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
1546
|
-
}
|
|
1547
|
-
var name = fn ? fn.displayName || fn.name : "";
|
|
1548
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
|
1549
|
-
if (typeof fn === "function") componentFrameCache.set(fn, syntheticFrame);
|
|
1550
|
-
return syntheticFrame;
|
|
1551
|
-
}
|
|
1552
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
1553
|
-
return describeNativeComponentFrame(fn, false);
|
|
1554
|
-
}
|
|
1555
|
-
function shouldConstruct(Component) {
|
|
1556
|
-
var prototype = Component.prototype;
|
|
1557
|
-
return !!(prototype && prototype.isReactComponent);
|
|
1558
|
-
}
|
|
1559
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
1560
|
-
if (type == null) return "";
|
|
1561
|
-
if (typeof type === "function") return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
1562
|
-
if (typeof type === "string") return describeBuiltInComponentFrame(type);
|
|
1563
|
-
switch (type) {
|
|
1564
|
-
case REACT_SUSPENSE_TYPE: return describeBuiltInComponentFrame("Suspense");
|
|
1565
|
-
case REACT_SUSPENSE_LIST_TYPE: return describeBuiltInComponentFrame("SuspenseList");
|
|
1566
|
-
}
|
|
1567
|
-
if (typeof type === "object") switch (type.$$typeof) {
|
|
1568
|
-
case REACT_FORWARD_REF_TYPE: return describeFunctionComponentFrame(type.render);
|
|
1569
|
-
case REACT_MEMO_TYPE: return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
1570
|
-
case REACT_LAZY_TYPE:
|
|
1571
|
-
var lazyComponent = type;
|
|
1572
|
-
var payload = lazyComponent._payload;
|
|
1573
|
-
var init = lazyComponent._init;
|
|
1574
|
-
try {
|
|
1575
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
1576
|
-
} catch (x) {}
|
|
1577
|
-
}
|
|
1578
|
-
return "";
|
|
1579
|
-
}
|
|
1580
|
-
var loggedTypeFailures = {};
|
|
1581
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1582
|
-
function setCurrentlyValidatingElement(element) {
|
|
1583
|
-
if (element) {
|
|
1584
|
-
var owner = element._owner;
|
|
1585
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
1586
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
1587
|
-
} else ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
1588
|
-
}
|
|
1589
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
1590
|
-
var has = Function.call.bind(hasOwnProperty);
|
|
1591
|
-
for (var typeSpecName in typeSpecs) if (has(typeSpecs, typeSpecName)) {
|
|
1592
|
-
var error$1 = void 0;
|
|
1593
|
-
try {
|
|
1594
|
-
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
1595
|
-
var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
1596
|
-
err.name = "Invariant Violation";
|
|
1597
|
-
throw err;
|
|
1598
|
-
}
|
|
1599
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
1600
|
-
} catch (ex) {
|
|
1601
|
-
error$1 = ex;
|
|
1602
|
-
}
|
|
1603
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
1604
|
-
setCurrentlyValidatingElement(element);
|
|
1605
|
-
error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
|
|
1606
|
-
setCurrentlyValidatingElement(null);
|
|
1607
|
-
}
|
|
1608
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
1609
|
-
loggedTypeFailures[error$1.message] = true;
|
|
1610
|
-
setCurrentlyValidatingElement(element);
|
|
1611
|
-
error("Failed %s type: %s", location, error$1.message);
|
|
1612
|
-
setCurrentlyValidatingElement(null);
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
|
-
}
|
|
1616
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
1617
|
-
if (element) {
|
|
1618
|
-
var owner = element._owner;
|
|
1619
|
-
setExtraStackFrame(describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null));
|
|
1620
|
-
} else setExtraStackFrame(null);
|
|
1621
|
-
}
|
|
1622
|
-
var propTypesMisspellWarningShown = false;
|
|
1623
|
-
function getDeclarationErrorAddendum() {
|
|
1624
|
-
if (ReactCurrentOwner.current) {
|
|
1625
|
-
var name = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
1626
|
-
if (name) return "\n\nCheck the render method of `" + name + "`.";
|
|
1627
|
-
}
|
|
1628
|
-
return "";
|
|
1629
|
-
}
|
|
1630
|
-
function getSourceInfoErrorAddendum(source) {
|
|
1631
|
-
if (source !== void 0) {
|
|
1632
|
-
var fileName = source.fileName.replace(/^.*[\\\/]/, "");
|
|
1633
|
-
var lineNumber = source.lineNumber;
|
|
1634
|
-
return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
|
|
1635
|
-
}
|
|
1636
|
-
return "";
|
|
1637
|
-
}
|
|
1638
|
-
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
1639
|
-
if (elementProps !== null && elementProps !== void 0) return getSourceInfoErrorAddendum(elementProps.__source);
|
|
1640
|
-
return "";
|
|
1641
|
-
}
|
|
1642
|
-
/**
|
|
1643
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1644
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
1645
|
-
* updates.
|
|
1646
|
-
*/
|
|
1647
|
-
var ownerHasKeyUseWarning = {};
|
|
1648
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
1649
|
-
var info = getDeclarationErrorAddendum();
|
|
1650
|
-
if (!info) {
|
|
1651
|
-
var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
|
|
1652
|
-
if (parentName) info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
1653
|
-
}
|
|
1654
|
-
return info;
|
|
1655
|
-
}
|
|
1656
|
-
/**
|
|
1657
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1658
|
-
* This element is in an array. The array could grow and shrink or be
|
|
1659
|
-
* reordered. All children that haven't already been validated are required to
|
|
1660
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1661
|
-
* will only be shown once.
|
|
1662
|
-
*
|
|
1663
|
-
* @internal
|
|
1664
|
-
* @param {ReactElement} element Element that requires a key.
|
|
1665
|
-
* @param {*} parentType element's parent's type.
|
|
1666
|
-
*/
|
|
1667
|
-
function validateExplicitKey(element, parentType) {
|
|
1668
|
-
if (!element._store || element._store.validated || element.key != null) return;
|
|
1669
|
-
element._store.validated = true;
|
|
1670
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1671
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) return;
|
|
1672
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
1673
|
-
var childOwner = "";
|
|
1674
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner.current) childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
1675
|
-
setCurrentlyValidatingElement$1(element);
|
|
1676
|
-
error("Each child in a list should have a unique \"key\" prop.%s%s See https://reactjs.org/link/warning-keys for more information.", currentComponentErrorInfo, childOwner);
|
|
1677
|
-
setCurrentlyValidatingElement$1(null);
|
|
1678
|
-
}
|
|
1679
|
-
/**
|
|
1680
|
-
* Ensure that every element either is passed in a static location, in an
|
|
1681
|
-
* array with an explicit keys property defined, or in an object literal
|
|
1682
|
-
* with valid key property.
|
|
1683
|
-
*
|
|
1684
|
-
* @internal
|
|
1685
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
1686
|
-
* @param {*} parentType node's parent's type.
|
|
1687
|
-
*/
|
|
1688
|
-
function validateChildKeys(node, parentType) {
|
|
1689
|
-
if (typeof node !== "object") return;
|
|
1690
|
-
if (isArray(node)) for (var i = 0; i < node.length; i++) {
|
|
1691
|
-
var child = node[i];
|
|
1692
|
-
if (isValidElement(child)) validateExplicitKey(child, parentType);
|
|
1693
|
-
}
|
|
1694
|
-
else if (isValidElement(node)) {
|
|
1695
|
-
if (node._store) node._store.validated = true;
|
|
1696
|
-
} else if (node) {
|
|
1697
|
-
var iteratorFn = getIteratorFn(node);
|
|
1698
|
-
if (typeof iteratorFn === "function") {
|
|
1699
|
-
if (iteratorFn !== node.entries) {
|
|
1700
|
-
var iterator = iteratorFn.call(node);
|
|
1701
|
-
var step;
|
|
1702
|
-
while (!(step = iterator.next()).done) if (isValidElement(step.value)) validateExplicitKey(step.value, parentType);
|
|
1703
|
-
}
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
}
|
|
1707
|
-
/**
|
|
1708
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
1709
|
-
* provided by the type.
|
|
1710
|
-
*
|
|
1711
|
-
* @param {ReactElement} element
|
|
1712
|
-
*/
|
|
1713
|
-
function validatePropTypes(element) {
|
|
1714
|
-
var type = element.type;
|
|
1715
|
-
if (type === null || type === void 0 || typeof type === "string") return;
|
|
1716
|
-
var propTypes;
|
|
1717
|
-
if (typeof type === "function") propTypes = type.propTypes;
|
|
1718
|
-
else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MEMO_TYPE)) propTypes = type.propTypes;
|
|
1719
|
-
else return;
|
|
1720
|
-
if (propTypes) {
|
|
1721
|
-
var name = getComponentNameFromType(type);
|
|
1722
|
-
checkPropTypes(propTypes, element.props, "prop", name, element);
|
|
1723
|
-
} else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
|
|
1724
|
-
propTypesMisspellWarningShown = true;
|
|
1725
|
-
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", getComponentNameFromType(type) || "Unknown");
|
|
1726
|
-
}
|
|
1727
|
-
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
1728
|
-
}
|
|
1729
|
-
/**
|
|
1730
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
1731
|
-
* @param {ReactElement} fragment
|
|
1732
|
-
*/
|
|
1733
|
-
function validateFragmentProps(fragment) {
|
|
1734
|
-
var keys = Object.keys(fragment.props);
|
|
1735
|
-
for (var i = 0; i < keys.length; i++) {
|
|
1736
|
-
var key = keys[i];
|
|
1737
|
-
if (key !== "children" && key !== "key") {
|
|
1738
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1739
|
-
error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
|
|
1740
|
-
setCurrentlyValidatingElement$1(null);
|
|
1741
|
-
break;
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
if (fragment.ref !== null) {
|
|
1745
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
1746
|
-
error("Invalid attribute `ref` supplied to `React.Fragment`.");
|
|
1747
|
-
setCurrentlyValidatingElement$1(null);
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
function createElementWithValidation(type, props, children) {
|
|
1751
|
-
var validType = isValidElementType(type);
|
|
1752
|
-
if (!validType) {
|
|
1753
|
-
var info = "";
|
|
1754
|
-
if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
|
|
1755
|
-
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
1756
|
-
if (sourceInfo) info += sourceInfo;
|
|
1757
|
-
else info += getDeclarationErrorAddendum();
|
|
1758
|
-
var typeString;
|
|
1759
|
-
if (type === null) typeString = "null";
|
|
1760
|
-
else if (isArray(type)) typeString = "array";
|
|
1761
|
-
else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1762
|
-
typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
|
|
1763
|
-
info = " Did you accidentally export a JSX literal instead of a component?";
|
|
1764
|
-
} else typeString = typeof type;
|
|
1765
|
-
error("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
|
|
1766
|
-
}
|
|
1767
|
-
var element = createElement.apply(this, arguments);
|
|
1768
|
-
if (element == null) return element;
|
|
1769
|
-
if (validType) for (var i = 2; i < arguments.length; i++) validateChildKeys(arguments[i], type);
|
|
1770
|
-
if (type === REACT_FRAGMENT_TYPE) validateFragmentProps(element);
|
|
1771
|
-
else validatePropTypes(element);
|
|
1772
|
-
return element;
|
|
1773
|
-
}
|
|
1774
|
-
var didWarnAboutDeprecatedCreateFactory = false;
|
|
1775
|
-
function createFactoryWithValidation(type) {
|
|
1776
|
-
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
1777
|
-
validatedFactory.type = type;
|
|
1778
|
-
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
1779
|
-
didWarnAboutDeprecatedCreateFactory = true;
|
|
1780
|
-
warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.");
|
|
1781
|
-
}
|
|
1782
|
-
Object.defineProperty(validatedFactory, "type", {
|
|
1783
|
-
enumerable: false,
|
|
1784
|
-
get: function() {
|
|
1785
|
-
warn("Factory.type is deprecated. Access the class directly before passing it to createFactory.");
|
|
1786
|
-
Object.defineProperty(this, "type", { value: type });
|
|
1787
|
-
return type;
|
|
1788
|
-
}
|
|
1789
|
-
});
|
|
1790
|
-
return validatedFactory;
|
|
1791
|
-
}
|
|
1792
|
-
function cloneElementWithValidation(element, props, children) {
|
|
1793
|
-
var newElement = cloneElement.apply(this, arguments);
|
|
1794
|
-
for (var i = 2; i < arguments.length; i++) validateChildKeys(arguments[i], newElement.type);
|
|
1795
|
-
validatePropTypes(newElement);
|
|
1796
|
-
return newElement;
|
|
1797
|
-
}
|
|
1798
|
-
function startTransition(scope, options) {
|
|
1799
|
-
var prevTransition = ReactCurrentBatchConfig.transition;
|
|
1800
|
-
ReactCurrentBatchConfig.transition = {};
|
|
1801
|
-
var currentTransition = ReactCurrentBatchConfig.transition;
|
|
1802
|
-
ReactCurrentBatchConfig.transition._updatedFibers = /* @__PURE__ */ new Set();
|
|
1803
|
-
try {
|
|
1804
|
-
scope();
|
|
1805
|
-
} finally {
|
|
1806
|
-
ReactCurrentBatchConfig.transition = prevTransition;
|
|
1807
|
-
if (prevTransition === null && currentTransition._updatedFibers) {
|
|
1808
|
-
if (currentTransition._updatedFibers.size > 10) warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.");
|
|
1809
|
-
currentTransition._updatedFibers.clear();
|
|
1810
|
-
}
|
|
1811
|
-
}
|
|
1812
|
-
}
|
|
1813
|
-
var didWarnAboutMessageChannel = false;
|
|
1814
|
-
var enqueueTaskImpl = null;
|
|
1815
|
-
function enqueueTask(task) {
|
|
1816
|
-
if (enqueueTaskImpl === null) try {
|
|
1817
|
-
var requireString = ("require" + Math.random()).slice(0, 7);
|
|
1818
|
-
enqueueTaskImpl = (module && module[requireString]).call(module, "timers").setImmediate;
|
|
1819
|
-
} catch (_err) {
|
|
1820
|
-
enqueueTaskImpl = function(callback) {
|
|
1821
|
-
if (didWarnAboutMessageChannel === false) {
|
|
1822
|
-
didWarnAboutMessageChannel = true;
|
|
1823
|
-
if (typeof MessageChannel === "undefined") error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning.");
|
|
1824
|
-
}
|
|
1825
|
-
var channel = new MessageChannel();
|
|
1826
|
-
channel.port1.onmessage = callback;
|
|
1827
|
-
channel.port2.postMessage(void 0);
|
|
1828
|
-
};
|
|
1829
|
-
}
|
|
1830
|
-
return enqueueTaskImpl(task);
|
|
1831
|
-
}
|
|
1832
|
-
var actScopeDepth = 0;
|
|
1833
|
-
var didWarnNoAwaitAct = false;
|
|
1834
|
-
function act(callback) {
|
|
1835
|
-
var prevActScopeDepth = actScopeDepth;
|
|
1836
|
-
actScopeDepth++;
|
|
1837
|
-
if (ReactCurrentActQueue.current === null) ReactCurrentActQueue.current = [];
|
|
1838
|
-
var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
|
|
1839
|
-
var result;
|
|
1840
|
-
try {
|
|
1841
|
-
ReactCurrentActQueue.isBatchingLegacy = true;
|
|
1842
|
-
result = callback();
|
|
1843
|
-
if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
|
|
1844
|
-
var queue = ReactCurrentActQueue.current;
|
|
1845
|
-
if (queue !== null) {
|
|
1846
|
-
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
|
|
1847
|
-
flushActQueue(queue);
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
} catch (error) {
|
|
1851
|
-
popActScope(prevActScopeDepth);
|
|
1852
|
-
throw error;
|
|
1853
|
-
} finally {
|
|
1854
|
-
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
|
|
1855
|
-
}
|
|
1856
|
-
if (result !== null && typeof result === "object" && typeof result.then === "function") {
|
|
1857
|
-
var thenableResult = result;
|
|
1858
|
-
var wasAwaited = false;
|
|
1859
|
-
var thenable = { then: function(resolve, reject) {
|
|
1860
|
-
wasAwaited = true;
|
|
1861
|
-
thenableResult.then(function(returnValue) {
|
|
1862
|
-
popActScope(prevActScopeDepth);
|
|
1863
|
-
if (actScopeDepth === 0) recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
1864
|
-
else resolve(returnValue);
|
|
1865
|
-
}, function(error) {
|
|
1866
|
-
popActScope(prevActScopeDepth);
|
|
1867
|
-
reject(error);
|
|
1868
|
-
});
|
|
1869
|
-
} };
|
|
1870
|
-
if (!didWarnNoAwaitAct && typeof Promise !== "undefined") Promise.resolve().then(function() {}).then(function() {
|
|
1871
|
-
if (!wasAwaited) {
|
|
1872
|
-
didWarnNoAwaitAct = true;
|
|
1873
|
-
error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);");
|
|
1874
|
-
}
|
|
1875
|
-
});
|
|
1876
|
-
return thenable;
|
|
1877
|
-
} else {
|
|
1878
|
-
var returnValue = result;
|
|
1879
|
-
popActScope(prevActScopeDepth);
|
|
1880
|
-
if (actScopeDepth === 0) {
|
|
1881
|
-
var _queue = ReactCurrentActQueue.current;
|
|
1882
|
-
if (_queue !== null) {
|
|
1883
|
-
flushActQueue(_queue);
|
|
1884
|
-
ReactCurrentActQueue.current = null;
|
|
1885
|
-
}
|
|
1886
|
-
return { then: function(resolve, reject) {
|
|
1887
|
-
if (ReactCurrentActQueue.current === null) {
|
|
1888
|
-
ReactCurrentActQueue.current = [];
|
|
1889
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
1890
|
-
} else resolve(returnValue);
|
|
1891
|
-
} };
|
|
1892
|
-
} else return { then: function(resolve, reject) {
|
|
1893
|
-
resolve(returnValue);
|
|
1894
|
-
} };
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
function popActScope(prevActScopeDepth) {
|
|
1898
|
-
if (prevActScopeDepth !== actScopeDepth - 1) error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
|
|
1899
|
-
actScopeDepth = prevActScopeDepth;
|
|
1900
|
-
}
|
|
1901
|
-
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
1902
|
-
var queue = ReactCurrentActQueue.current;
|
|
1903
|
-
if (queue !== null) try {
|
|
1904
|
-
flushActQueue(queue);
|
|
1905
|
-
enqueueTask(function() {
|
|
1906
|
-
if (queue.length === 0) {
|
|
1907
|
-
ReactCurrentActQueue.current = null;
|
|
1908
|
-
resolve(returnValue);
|
|
1909
|
-
} else recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
1910
|
-
});
|
|
1911
|
-
} catch (error) {
|
|
1912
|
-
reject(error);
|
|
1913
|
-
}
|
|
1914
|
-
else resolve(returnValue);
|
|
1915
|
-
}
|
|
1916
|
-
var isFlushing = false;
|
|
1917
|
-
function flushActQueue(queue) {
|
|
1918
|
-
if (!isFlushing) {
|
|
1919
|
-
isFlushing = true;
|
|
1920
|
-
var i = 0;
|
|
1921
|
-
try {
|
|
1922
|
-
for (; i < queue.length; i++) {
|
|
1923
|
-
var callback = queue[i];
|
|
1924
|
-
do
|
|
1925
|
-
callback = callback(true);
|
|
1926
|
-
while (callback !== null);
|
|
1927
|
-
}
|
|
1928
|
-
queue.length = 0;
|
|
1929
|
-
} catch (error) {
|
|
1930
|
-
queue = queue.slice(i + 1);
|
|
1931
|
-
throw error;
|
|
1932
|
-
} finally {
|
|
1933
|
-
isFlushing = false;
|
|
1934
|
-
}
|
|
1935
|
-
}
|
|
1936
|
-
}
|
|
1937
|
-
var createElement$1 = createElementWithValidation;
|
|
1938
|
-
var cloneElement$1 = cloneElementWithValidation;
|
|
1939
|
-
var createFactory = createFactoryWithValidation;
|
|
1940
|
-
exports.Children = {
|
|
1941
|
-
map: mapChildren,
|
|
1942
|
-
forEach: forEachChildren,
|
|
1943
|
-
count: countChildren,
|
|
1944
|
-
toArray,
|
|
1945
|
-
only: onlyChild
|
|
1946
|
-
};
|
|
1947
|
-
exports.Component = Component;
|
|
1948
|
-
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
1949
|
-
exports.Profiler = REACT_PROFILER_TYPE;
|
|
1950
|
-
exports.PureComponent = PureComponent;
|
|
1951
|
-
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
1952
|
-
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
1953
|
-
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
|
1954
|
-
exports.act = act;
|
|
1955
|
-
exports.cloneElement = cloneElement$1;
|
|
1956
|
-
exports.createContext = createContext;
|
|
1957
|
-
exports.createElement = createElement$1;
|
|
1958
|
-
exports.createFactory = createFactory;
|
|
1959
|
-
exports.createRef = createRef;
|
|
1960
|
-
exports.forwardRef = forwardRef;
|
|
1961
|
-
exports.isValidElement = isValidElement;
|
|
1962
|
-
exports.lazy = lazy;
|
|
1963
|
-
exports.memo = memo;
|
|
1964
|
-
exports.startTransition = startTransition;
|
|
1965
|
-
exports.unstable_act = act;
|
|
1966
|
-
exports.useCallback = useCallback;
|
|
1967
|
-
exports.useContext = useContext;
|
|
1968
|
-
exports.useDebugValue = useDebugValue;
|
|
1969
|
-
exports.useDeferredValue = useDeferredValue;
|
|
1970
|
-
exports.useEffect = useEffect;
|
|
1971
|
-
exports.useId = useId;
|
|
1972
|
-
exports.useImperativeHandle = useImperativeHandle;
|
|
1973
|
-
exports.useInsertionEffect = useInsertionEffect;
|
|
1974
|
-
exports.useLayoutEffect = useLayoutEffect;
|
|
1975
|
-
exports.useMemo = useMemo;
|
|
1976
|
-
exports.useReducer = useReducer;
|
|
1977
|
-
exports.useRef = useRef;
|
|
1978
|
-
exports.useState = useState;
|
|
1979
|
-
exports.useSyncExternalStore = useSyncExternalStore;
|
|
1980
|
-
exports.useTransition = useTransition;
|
|
1981
|
-
exports.version = ReactVersion;
|
|
1982
|
-
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(/* @__PURE__ */ new Error());
|
|
1983
|
-
})();
|
|
1984
|
-
}));
|
|
14
|
+
var OPENCLI_TIMEOUT_MS = 12e4;
|
|
15
|
+
var WARM_TIMEOUT_MS = 2e4;
|
|
16
|
+
var INSTALL_TIMEOUT_MS = 3e5;
|
|
17
|
+
var VERSION_CHECK_TIMEOUT_MS = 1e4;
|
|
18
|
+
var PROBE_TTL_MS = 3e4;
|
|
19
|
+
var GIT_TIMEOUT_MS = 1e4;
|
|
20
|
+
var MARKER = new RegExp(`@工作台:([a-z][a-z0-9-]*:[A-Za-z0-9._~%#/-]+)`, "g");
|
|
21
|
+
var TRAILING_PUNCTUATION = /[.,;:!?]+$/;
|
|
22
|
+
function encodeRef(ref) {
|
|
23
|
+
return `${ref.kind}:${ref.parts.join("/")}`;
|
|
24
|
+
}
|
|
25
|
+
function decodeRef(text) {
|
|
26
|
+
const at = text.indexOf(":");
|
|
27
|
+
if (at <= 0 || at === text.length - 1) return void 0;
|
|
28
|
+
const kind = text.slice(0, at);
|
|
29
|
+
if (!/^[a-z][a-z0-9-]*$/.test(kind)) return void 0;
|
|
30
|
+
const parts = text.slice(at + 1).split("/").filter((part) => part !== "");
|
|
31
|
+
if (parts.length === 0) return void 0;
|
|
32
|
+
return {
|
|
33
|
+
kind,
|
|
34
|
+
parts
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function parseMarkers(text) {
|
|
38
|
+
const seen = /* @__PURE__ */ new Set();
|
|
39
|
+
const refs = [];
|
|
40
|
+
for (const match of String(text ?? "").matchAll(MARKER)) {
|
|
41
|
+
const ref = decodeRef(match[1].replace(TRAILING_PUNCTUATION, ""));
|
|
42
|
+
if (ref === void 0) continue;
|
|
43
|
+
const key = encodeRef(ref);
|
|
44
|
+
if (seen.has(key)) continue;
|
|
45
|
+
seen.add(key);
|
|
46
|
+
refs.push(ref);
|
|
47
|
+
}
|
|
48
|
+
return refs;
|
|
49
|
+
}
|
|
50
|
+
function unitFactScope(unit) {
|
|
51
|
+
return `${unit}*`;
|
|
52
|
+
}
|
|
1985
53
|
//#endregion
|
|
1986
|
-
//#region ../shared/dist/
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
})))();
|
|
1991
|
-
react.createElement;
|
|
1992
|
-
react.Fragment;
|
|
1993
|
-
react.useState;
|
|
1994
|
-
react.useEffect;
|
|
1995
|
-
react.useMemo;
|
|
1996
|
-
react.useCallback;
|
|
1997
|
-
react.useRef;
|
|
1998
|
-
react.useSyncExternalStore;
|
|
54
|
+
//#region ../shared/dist/api/long-task.js
|
|
55
|
+
function runsRouteOf(unit) {
|
|
56
|
+
return `${unit}/runs`;
|
|
57
|
+
}
|
|
1999
58
|
//#endregion
|
|
2000
59
|
//#region ../shared/dist/lib/text.js
|
|
2001
60
|
function quoteShellArg(value) {
|
|
@@ -2114,12 +173,93 @@ var PROVISION_ACTIONS = [
|
|
|
2114
173
|
"install",
|
|
2115
174
|
"update",
|
|
2116
175
|
"uninstall",
|
|
176
|
+
"install-bundle",
|
|
177
|
+
"update-bundle",
|
|
178
|
+
"remove-bundle",
|
|
179
|
+
"cancel-install",
|
|
2117
180
|
"update-dependency"
|
|
2118
181
|
];
|
|
2119
182
|
var DEPENDENCY_ACTIONS = ["update-dependency"];
|
|
2120
183
|
function isDependencyAction(action) {
|
|
2121
184
|
return DEPENDENCY_ACTIONS.includes(action);
|
|
2122
185
|
}
|
|
186
|
+
function provisionTargetOf(action) {
|
|
187
|
+
if (action === "update-dependency") return "id";
|
|
188
|
+
if (action === "install-bundle") return "spec";
|
|
189
|
+
if (action === "remove-bundle") return "name";
|
|
190
|
+
if (action === "cancel-install") return "requestId";
|
|
191
|
+
return "unit";
|
|
192
|
+
}
|
|
193
|
+
var TARGET_CODE = {
|
|
194
|
+
unit: "workbench/no-unit",
|
|
195
|
+
id: "workbench/no-id",
|
|
196
|
+
spec: "workbench/no-spec",
|
|
197
|
+
name: "workbench/no-name",
|
|
198
|
+
requestId: "workbench/no-request-id"
|
|
199
|
+
};
|
|
200
|
+
function asRecord$3(value) {
|
|
201
|
+
return typeof value === "object" && value !== null ? value : {};
|
|
202
|
+
}
|
|
203
|
+
function stringsOf$1(value) {
|
|
204
|
+
if (!Array.isArray(value)) return void 0;
|
|
205
|
+
const items = value.filter((item) => typeof item === "string" && item.trim() !== "");
|
|
206
|
+
return items.length === 0 ? void 0 : items;
|
|
207
|
+
}
|
|
208
|
+
function requestOf$1(action, value) {
|
|
209
|
+
if (action === "update-dependency") return {
|
|
210
|
+
action,
|
|
211
|
+
id: value
|
|
212
|
+
};
|
|
213
|
+
if (action === "install-bundle") return {
|
|
214
|
+
action,
|
|
215
|
+
spec: value
|
|
216
|
+
};
|
|
217
|
+
if (action === "remove-bundle") return {
|
|
218
|
+
action,
|
|
219
|
+
name: value
|
|
220
|
+
};
|
|
221
|
+
if (action === "cancel-install") return {
|
|
222
|
+
action,
|
|
223
|
+
requestId: value
|
|
224
|
+
};
|
|
225
|
+
return {
|
|
226
|
+
action,
|
|
227
|
+
unit: value
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function parseProvisionBody(body) {
|
|
231
|
+
const raw = asRecord$3(body);
|
|
232
|
+
const action = raw.action;
|
|
233
|
+
if (typeof action !== "string" || !PROVISION_ACTIONS.includes(action)) return {
|
|
234
|
+
ok: false,
|
|
235
|
+
code: "workbench/bad-action",
|
|
236
|
+
message: `不认识的 action:${String(action)}(可用:${PROVISION_ACTIONS.join(" / ")})`
|
|
237
|
+
};
|
|
238
|
+
const wanted = action;
|
|
239
|
+
const target = provisionTargetOf(wanted);
|
|
240
|
+
const value = raw[target];
|
|
241
|
+
if (typeof value !== "string" || value.trim() === "") return {
|
|
242
|
+
ok: false,
|
|
243
|
+
code: TARGET_CODE[target],
|
|
244
|
+
message: `缺少 ${target}`
|
|
245
|
+
};
|
|
246
|
+
if (wanted !== "install-bundle") return {
|
|
247
|
+
ok: true,
|
|
248
|
+
request: requestOf$1(wanted, value.trim())
|
|
249
|
+
};
|
|
250
|
+
const registry = typeof raw.registry === "string" && raw.registry.trim() !== "" ? raw.registry.trim() : void 0;
|
|
251
|
+
const approvedBuilds = stringsOf$1(raw.approvedBuilds);
|
|
252
|
+
const requestId = typeof raw.requestId === "string" && raw.requestId.trim() !== "" ? raw.requestId.trim() : void 0;
|
|
253
|
+
return {
|
|
254
|
+
ok: true,
|
|
255
|
+
request: {
|
|
256
|
+
...requestOf$1(wanted, value.trim()),
|
|
257
|
+
...registry === void 0 ? {} : { registry },
|
|
258
|
+
...approvedBuilds === void 0 ? {} : { approvedBuilds },
|
|
259
|
+
...requestId === void 0 ? {} : { requestId }
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
}
|
|
2123
263
|
//#endregion
|
|
2124
264
|
//#region ../shared/dist/host/opencli.js
|
|
2125
265
|
var SITE_SESSION_ARGS = ["--site-session", "persistent"];
|
|
@@ -2292,38 +432,18 @@ function registerProvision(ctx, provision, log) {
|
|
|
2292
432
|
});
|
|
2293
433
|
return;
|
|
2294
434
|
}
|
|
2295
|
-
const
|
|
2296
|
-
|
|
2297
|
-
if (typeof action !== "string" || !PROVISION_ACTIONS.includes(action)) {
|
|
2298
|
-
sendJson(res, 400, {
|
|
2299
|
-
ok: false,
|
|
2300
|
-
error: {
|
|
2301
|
-
code: "workbench/bad-action",
|
|
2302
|
-
message: `不认识的 action:${String(action)}(可用:${PROVISION_ACTIONS.join(" / ")})`
|
|
2303
|
-
}
|
|
2304
|
-
});
|
|
2305
|
-
return;
|
|
2306
|
-
}
|
|
2307
|
-
const wanted = action;
|
|
2308
|
-
const target = isDependencyAction(wanted) ? body.id : body.unit;
|
|
2309
|
-
if (typeof target !== "string" || target.trim() === "") {
|
|
435
|
+
const parsed = parseProvisionBody(payload);
|
|
436
|
+
if (!parsed.ok) {
|
|
2310
437
|
sendJson(res, 400, {
|
|
2311
438
|
ok: false,
|
|
2312
439
|
error: {
|
|
2313
|
-
code:
|
|
2314
|
-
message:
|
|
440
|
+
code: parsed.code,
|
|
441
|
+
message: parsed.message
|
|
2315
442
|
}
|
|
2316
443
|
});
|
|
2317
444
|
return;
|
|
2318
445
|
}
|
|
2319
|
-
const
|
|
2320
|
-
const request = isDependencyAction(wanted) ? {
|
|
2321
|
-
action: wanted,
|
|
2322
|
-
id: key
|
|
2323
|
-
} : {
|
|
2324
|
-
action: wanted,
|
|
2325
|
-
unit: key
|
|
2326
|
-
};
|
|
446
|
+
const request = parsed.request;
|
|
2327
447
|
try {
|
|
2328
448
|
const result = await provision.handle(request);
|
|
2329
449
|
log?.bump(provisionFacts(provision, request));
|
|
@@ -3077,6 +1197,256 @@ function createWorkspaceStore(options) {
|
|
|
3077
1197
|
};
|
|
3078
1198
|
}
|
|
3079
1199
|
//#endregion
|
|
1200
|
+
//#region src/shared/api/host/bundle-manager.ts
|
|
1201
|
+
var MANAGER_SERVICE$1 = "pluginManager";
|
|
1202
|
+
var APPLICATIONS = [
|
|
1203
|
+
"applied",
|
|
1204
|
+
"restart-required",
|
|
1205
|
+
"overridden",
|
|
1206
|
+
"failed",
|
|
1207
|
+
"cancelled"
|
|
1208
|
+
];
|
|
1209
|
+
var STAGES = [
|
|
1210
|
+
"install",
|
|
1211
|
+
"enable",
|
|
1212
|
+
"remove"
|
|
1213
|
+
];
|
|
1214
|
+
var PROBLEMS = [
|
|
1215
|
+
"invalid-spec",
|
|
1216
|
+
"already-installed",
|
|
1217
|
+
"not-found",
|
|
1218
|
+
"not-a-package",
|
|
1219
|
+
"not-a-bundle",
|
|
1220
|
+
"network",
|
|
1221
|
+
"unknown"
|
|
1222
|
+
];
|
|
1223
|
+
var SPEC_KINDS = [
|
|
1224
|
+
"registry",
|
|
1225
|
+
"path",
|
|
1226
|
+
"git",
|
|
1227
|
+
"tarball"
|
|
1228
|
+
];
|
|
1229
|
+
var FAILURE_KINDS = [
|
|
1230
|
+
"pnpm-missing",
|
|
1231
|
+
"timeout",
|
|
1232
|
+
"not-found",
|
|
1233
|
+
"no-matching-version",
|
|
1234
|
+
"network",
|
|
1235
|
+
"disk-full",
|
|
1236
|
+
"permission",
|
|
1237
|
+
"build-blocked",
|
|
1238
|
+
"integrity",
|
|
1239
|
+
"unknown"
|
|
1240
|
+
];
|
|
1241
|
+
var CANCELLATIONS = [
|
|
1242
|
+
"cancelled",
|
|
1243
|
+
"too-late",
|
|
1244
|
+
"not-running"
|
|
1245
|
+
];
|
|
1246
|
+
function asRecord$2(value) {
|
|
1247
|
+
return typeof value === "object" && value !== null ? value : void 0;
|
|
1248
|
+
}
|
|
1249
|
+
function asText$2(value) {
|
|
1250
|
+
return typeof value === "string" ? value : "";
|
|
1251
|
+
}
|
|
1252
|
+
function pick(allowed, value) {
|
|
1253
|
+
return typeof value === "string" && allowed.includes(value) ? value : void 0;
|
|
1254
|
+
}
|
|
1255
|
+
function asRegistry(value) {
|
|
1256
|
+
if (value === null) return null;
|
|
1257
|
+
return typeof value === "string" ? value : void 0;
|
|
1258
|
+
}
|
|
1259
|
+
function asTextArray(value) {
|
|
1260
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
1261
|
+
}
|
|
1262
|
+
function asRegistries(raw) {
|
|
1263
|
+
const record = asRecord$2(raw);
|
|
1264
|
+
if (record === void 0) return null;
|
|
1265
|
+
const registry = asRegistry(record.registry);
|
|
1266
|
+
if (registry === void 0) return null;
|
|
1267
|
+
return {
|
|
1268
|
+
registry,
|
|
1269
|
+
fallbackRegistries: asTextArray(record.fallbackRegistries),
|
|
1270
|
+
resolved: typeof record.resolved === "string" ? record.resolved : null
|
|
1271
|
+
};
|
|
1272
|
+
}
|
|
1273
|
+
function asPackageResult(raw) {
|
|
1274
|
+
const record = asRecord$2(raw);
|
|
1275
|
+
if (record === void 0) return void 0;
|
|
1276
|
+
const kind = pick(FAILURE_KINDS, record.kind);
|
|
1277
|
+
return {
|
|
1278
|
+
exitCode: typeof record.exitCode === "number" ? record.exitCode : -1,
|
|
1279
|
+
output: asText$2(record.output),
|
|
1280
|
+
truncated: record.truncated === true,
|
|
1281
|
+
logPath: asText$2(record.logPath),
|
|
1282
|
+
...kind === void 0 ? {} : { kind }
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1285
|
+
function asChange(raw) {
|
|
1286
|
+
const record = asRecord$2(raw);
|
|
1287
|
+
if (record === void 0) return null;
|
|
1288
|
+
const application = pick(APPLICATIONS, record.application);
|
|
1289
|
+
const stage = pick(STAGES, record.stage);
|
|
1290
|
+
if (application === void 0 || stage === void 0) return null;
|
|
1291
|
+
const error = asRecord$2(record.error);
|
|
1292
|
+
const packageResult = asPackageResult(record.packageResult);
|
|
1293
|
+
const pendingBuilds = asTextArray(record.pendingBuilds);
|
|
1294
|
+
const failedAt = pick(["registry", "spec-host"], record.failedAt);
|
|
1295
|
+
const bundle = asText$2(record.bundle);
|
|
1296
|
+
const errorCode = error === void 0 ? "" : asText$2(error.code);
|
|
1297
|
+
const errorDetail = error === void 0 ? "" : asText$2(error.diagnostic);
|
|
1298
|
+
return {
|
|
1299
|
+
application,
|
|
1300
|
+
stage,
|
|
1301
|
+
changed: record.changed === true,
|
|
1302
|
+
target: asText$2(record.target),
|
|
1303
|
+
...bundle === "" ? {} : { bundle },
|
|
1304
|
+
...errorCode === "" ? {} : { errorCode },
|
|
1305
|
+
...errorDetail === "" ? {} : { errorDetail },
|
|
1306
|
+
...packageResult === void 0 ? {} : { packageResult },
|
|
1307
|
+
...pendingBuilds.length === 0 ? {} : { pendingBuilds },
|
|
1308
|
+
...failedAt === void 0 ? {} : { failedAt }
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
function asInspection(raw) {
|
|
1312
|
+
const record = asRecord$2(raw);
|
|
1313
|
+
if (record === void 0) return null;
|
|
1314
|
+
const status = asText$2(record.status);
|
|
1315
|
+
if (status === "refused") {
|
|
1316
|
+
const problem = pick(PROBLEMS, record.problem) ?? "unknown";
|
|
1317
|
+
const registries = Array.isArray(record.registries) ? record.registries.map(asRegistry).filter((item) => item !== void 0) : [];
|
|
1318
|
+
return {
|
|
1319
|
+
status: "refused",
|
|
1320
|
+
problem,
|
|
1321
|
+
reason: asText$2(record.reason),
|
|
1322
|
+
...registries.length === 0 ? {} : { registries }
|
|
1323
|
+
};
|
|
1324
|
+
}
|
|
1325
|
+
if (status !== "accepted") return null;
|
|
1326
|
+
const kind = pick(SPEC_KINDS, record.kind);
|
|
1327
|
+
const registry = asRegistry(record.registry);
|
|
1328
|
+
if (kind === void 0 || registry === void 0) return null;
|
|
1329
|
+
const name = asText$2(record.name);
|
|
1330
|
+
const version = asText$2(record.version);
|
|
1331
|
+
const description = asText$2(record.description);
|
|
1332
|
+
const host = asText$2(record.host);
|
|
1333
|
+
return {
|
|
1334
|
+
status: "accepted",
|
|
1335
|
+
kind,
|
|
1336
|
+
bundle: typeof record.bundle === "boolean" ? record.bundle : null,
|
|
1337
|
+
registry,
|
|
1338
|
+
...name === "" ? {} : { name },
|
|
1339
|
+
...version === "" ? {} : { version },
|
|
1340
|
+
...description === "" ? {} : { description },
|
|
1341
|
+
...host === "" ? {} : { host }
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1344
|
+
function readBundleManager(ctx) {
|
|
1345
|
+
const face = ctx.get(MANAGER_SERVICE$1);
|
|
1346
|
+
if (face === void 0) return void 0;
|
|
1347
|
+
if (typeof face.installBundle !== "function" || typeof face.removeBundle !== "function") return void 0;
|
|
1348
|
+
return {
|
|
1349
|
+
async registries() {
|
|
1350
|
+
if (typeof face.registries !== "function") return null;
|
|
1351
|
+
return asRegistries(await face.registries());
|
|
1352
|
+
},
|
|
1353
|
+
async inspect(spec, registry) {
|
|
1354
|
+
if (typeof face.inspect !== "function") return null;
|
|
1355
|
+
return asInspection(await face.inspect(spec, registry === void 0 ? void 0 : { registry }));
|
|
1356
|
+
},
|
|
1357
|
+
async install(request) {
|
|
1358
|
+
const options = {
|
|
1359
|
+
...request.registry === void 0 ? {} : { registry: request.registry },
|
|
1360
|
+
...request.requestId === void 0 ? {} : { requestId: request.requestId },
|
|
1361
|
+
...request.approvedBuilds === void 0 ? {} : { approvedBuilds: request.approvedBuilds }
|
|
1362
|
+
};
|
|
1363
|
+
return asChange(await face.installBundle?.(request.spec, options));
|
|
1364
|
+
},
|
|
1365
|
+
async remove(name) {
|
|
1366
|
+
return asChange(await face.removeBundle?.(name));
|
|
1367
|
+
},
|
|
1368
|
+
async cancel(requestId) {
|
|
1369
|
+
if (typeof face.cancelInstall !== "function") return null;
|
|
1370
|
+
return pick(CANCELLATIONS, (asRecord$2(await face.cancelInstall(requestId)) ?? {}).status) ?? null;
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
//#endregion
|
|
1375
|
+
//#region src/shared/api/host/installed-module.ts
|
|
1376
|
+
var PACKAGE_NAME = /^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/;
|
|
1377
|
+
function asRecord$1(value) {
|
|
1378
|
+
return typeof value === "object" && value !== null ? value : void 0;
|
|
1379
|
+
}
|
|
1380
|
+
function asText$1(value) {
|
|
1381
|
+
return typeof value === "string" ? value : "";
|
|
1382
|
+
}
|
|
1383
|
+
function isPackageName(value) {
|
|
1384
|
+
return value.length <= 214 && PACKAGE_NAME.test(value);
|
|
1385
|
+
}
|
|
1386
|
+
function profileDirOf(ctx) {
|
|
1387
|
+
const profile = ctx.get("profileContext");
|
|
1388
|
+
const dir = typeof profile?.dir === "string" ? profile.dir.trim() : "";
|
|
1389
|
+
return dir === "" ? null : dir;
|
|
1390
|
+
}
|
|
1391
|
+
function stringsOf(value) {
|
|
1392
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
1393
|
+
}
|
|
1394
|
+
function profileModules(profileDir) {
|
|
1395
|
+
if (profileDir === null) return [];
|
|
1396
|
+
let manifest;
|
|
1397
|
+
try {
|
|
1398
|
+
manifest = JSON.parse(fs.readFileSync(path.join(profileDir, "package.json"), "utf8"));
|
|
1399
|
+
} catch {
|
|
1400
|
+
return [];
|
|
1401
|
+
}
|
|
1402
|
+
const record = asRecord$1(manifest);
|
|
1403
|
+
if (record === void 0) return [];
|
|
1404
|
+
const bundles = stringsOf(asRecord$1(asRecord$1(record.dsh)?.profile)?.bundles);
|
|
1405
|
+
const names = bundles.length > 0 ? bundles : Object.keys(asRecord$1(record.dependencies) ?? {});
|
|
1406
|
+
const found = [];
|
|
1407
|
+
for (const pkg of names) {
|
|
1408
|
+
const read = readInstalledModule(profileDir, pkg);
|
|
1409
|
+
if (read.kind === "module") found.push({
|
|
1410
|
+
pkg: read.pkg,
|
|
1411
|
+
unit: read.unit,
|
|
1412
|
+
version: read.version
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1415
|
+
return found;
|
|
1416
|
+
}
|
|
1417
|
+
function readInstalledModule(profileDir, pkg) {
|
|
1418
|
+
if (profileDir === null || !isPackageName(pkg)) return {
|
|
1419
|
+
kind: "unknown",
|
|
1420
|
+
pkg
|
|
1421
|
+
};
|
|
1422
|
+
let manifest;
|
|
1423
|
+
try {
|
|
1424
|
+
manifest = JSON.parse(fs.readFileSync(path.join(profileDir, "node_modules", pkg, "package.json"), "utf8"));
|
|
1425
|
+
} catch {
|
|
1426
|
+
return {
|
|
1427
|
+
kind: "unknown",
|
|
1428
|
+
pkg
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
const record = asRecord$1(manifest);
|
|
1432
|
+
if (record === void 0) return {
|
|
1433
|
+
kind: "unknown",
|
|
1434
|
+
pkg
|
|
1435
|
+
};
|
|
1436
|
+
const declared = asRecord$1(asRecord$1(record.dsh)?.workbench);
|
|
1437
|
+
const unit = declared === void 0 ? "" : asText$1(declared.unit);
|
|
1438
|
+
if (unit === "") return {
|
|
1439
|
+
kind: "not-module",
|
|
1440
|
+
pkg
|
|
1441
|
+
};
|
|
1442
|
+
return {
|
|
1443
|
+
kind: "module",
|
|
1444
|
+
pkg,
|
|
1445
|
+
unit,
|
|
1446
|
+
version: asText$1(record.version)
|
|
1447
|
+
};
|
|
1448
|
+
}
|
|
1449
|
+
//#endregion
|
|
3080
1450
|
//#region src/shared/api/host/release.ts
|
|
3081
1451
|
function parseLedgerVersion(stdout, name) {
|
|
3082
1452
|
const parsed = parseJsonLoose(stdout);
|
|
@@ -3298,13 +1668,18 @@ function sourceProblemText(problem, env) {
|
|
|
3298
1668
|
}
|
|
3299
1669
|
//#endregion
|
|
3300
1670
|
//#region src/modules/panels/model/market.ts
|
|
1671
|
+
function bundleNameOf(change, spec) {
|
|
1672
|
+
if (change.bundle !== void 0 && change.bundle !== "") return change.bundle;
|
|
1673
|
+
const at = spec.lastIndexOf("@");
|
|
1674
|
+
return at > 0 ? spec.slice(0, at) : spec;
|
|
1675
|
+
}
|
|
3301
1676
|
function createMarketService(options) {
|
|
3302
|
-
const { manifests, probe, shell, logger, onInstalled, onUninstalled, isReleased } = options;
|
|
1677
|
+
const { manifests, manifestsNow, probe, shell, logger, onInstalled, onUninstalled, isReleased, bundles, installed, modules } = options;
|
|
3303
1678
|
const command = options.command ?? "opencli";
|
|
3304
|
-
const catalog = manifests.filter((manifest) => (manifest.env?.plugins ?? []).length > 0 || (manifest.env?.libs ?? []).length > 0);
|
|
1679
|
+
const catalog = () => (manifestsNow?.() ?? manifests).filter((manifest) => (manifest.env?.plugins ?? []).length > 0 || (manifest.env?.libs ?? []).length > 0);
|
|
3305
1680
|
function requireEntry(unit) {
|
|
3306
|
-
const manifest = catalog.find((item) => item.id === unit);
|
|
3307
|
-
if (manifest === void 0) throw new Error(`市场里没有这个模块:${unit}(可安装:${catalog.map((item) => item.id).join(", ") || "(空)"})`);
|
|
1681
|
+
const manifest = catalog().find((item) => item.id === unit);
|
|
1682
|
+
if (manifest === void 0) throw new Error(`市场里没有这个模块:${unit}(可安装:${catalog().map((item) => item.id).join(", ") || "(空)"})`);
|
|
3308
1683
|
return manifest;
|
|
3309
1684
|
}
|
|
3310
1685
|
async function capabilityOf(unit, force = false) {
|
|
@@ -3357,25 +1732,25 @@ function createMarketService(options) {
|
|
|
3357
1732
|
for (const step of commands) await run(step.line, step.optional === true);
|
|
3358
1733
|
}
|
|
3359
1734
|
async function probeSharing(request) {
|
|
3360
|
-
for (const id of affectedUnitsOf(catalog, request)) if (id !== request.unit) await capabilityOf(id, true);
|
|
1735
|
+
for (const id of affectedUnitsOf(catalog(), request)) if (id !== request.unit) await capabilityOf(id, true);
|
|
3361
1736
|
}
|
|
3362
1737
|
async function snapshot(force = false) {
|
|
3363
|
-
const modules = await Promise.all(catalog.map((manifest) => entryOf(manifest.id, force)));
|
|
1738
|
+
const modules = await Promise.all(catalog().map((manifest) => entryOf(manifest.id, force)));
|
|
3364
1739
|
const capabilities = new Map(modules.map((entry) => [entry.unit, entry.capability]));
|
|
3365
1740
|
return {
|
|
3366
1741
|
modules,
|
|
3367
1742
|
shared: sharedDependencies({
|
|
3368
|
-
manifests: catalog,
|
|
1743
|
+
manifests: catalog(),
|
|
3369
1744
|
capabilities,
|
|
3370
1745
|
...isReleased === void 0 ? {} : { isReleased }
|
|
3371
1746
|
})
|
|
3372
1747
|
};
|
|
3373
1748
|
}
|
|
3374
1749
|
function requireDependency(id) {
|
|
3375
|
-
const target = findDependency(catalog, id, isReleased);
|
|
1750
|
+
const target = findDependency(catalog(), id, isReleased);
|
|
3376
1751
|
if (target === void 0) {
|
|
3377
1752
|
const known = sharedDependencies({
|
|
3378
|
-
manifests: catalog,
|
|
1753
|
+
manifests: catalog(),
|
|
3379
1754
|
capabilities: /* @__PURE__ */ new Map()
|
|
3380
1755
|
}).map((item) => item.id);
|
|
3381
1756
|
throw new Error(`市场里没有这份依赖:${id}(可用的:${known.join(", ") || "(空)"})`);
|
|
@@ -3398,7 +1773,53 @@ function createMarketService(options) {
|
|
|
3398
1773
|
}
|
|
3399
1774
|
return (await snapshot()).shared;
|
|
3400
1775
|
}
|
|
3401
|
-
|
|
1776
|
+
function requireBundles() {
|
|
1777
|
+
if (bundles === void 0) throw new Error("这个 profile 里没有插件管理器,装不了模块包。");
|
|
1778
|
+
return bundles;
|
|
1779
|
+
}
|
|
1780
|
+
async function dropEnv(unit, env, before) {
|
|
1781
|
+
const kept = /* @__PURE__ */ new Set();
|
|
1782
|
+
const onMachine = new Set((before.plugins ?? []).filter((state) => state.status !== "missing").map((state) => state.name));
|
|
1783
|
+
const unknown = before.plugins === void 0;
|
|
1784
|
+
for (const need of env?.plugins ?? []) {
|
|
1785
|
+
const keepers = catalog().filter((item) => item.id !== unit && (item.env?.plugins ?? []).some((other) => other.name === need.name) && !(isReleased?.(item.id) ?? false));
|
|
1786
|
+
if (keepers.length > 0) {
|
|
1787
|
+
for (const item of keepers) kept.add(item.id);
|
|
1788
|
+
continue;
|
|
1789
|
+
}
|
|
1790
|
+
if (!unknown && !onMachine.has(need.name)) continue;
|
|
1791
|
+
await run(`${quoteShellArg(command)} plugin uninstall ${quoteShellArg(need.name)}`);
|
|
1792
|
+
}
|
|
1793
|
+
for (const need of env?.libs ?? []) {
|
|
1794
|
+
const keepers = catalog().filter((item) => item.id !== unit && (item.env?.libs ?? []).some((other) => other.name === need.name) && !(isReleased?.(item.id) ?? false));
|
|
1795
|
+
if (keepers.length > 0) {
|
|
1796
|
+
for (const item of keepers) kept.add(item.id);
|
|
1797
|
+
continue;
|
|
1798
|
+
}
|
|
1799
|
+
const present = (before.libs ?? []).some((state) => state.name === need.name && state.status !== "missing");
|
|
1800
|
+
if (before.libs !== void 0 && !present) continue;
|
|
1801
|
+
await run(`npm uninstall --prefix ${quoteShellArg(libsPrefix())} ${quoteShellArg(need.name)}`, true);
|
|
1802
|
+
}
|
|
1803
|
+
return [...kept];
|
|
1804
|
+
}
|
|
1805
|
+
async function supplyAfter(module, change) {
|
|
1806
|
+
if (module.kind !== "module") return { state: "not-a-module" };
|
|
1807
|
+
const manifest = catalog().find((item) => item.id === module.unit);
|
|
1808
|
+
if (manifest === void 0) return change.application === "restart-required" ? { state: "pending-restart" } : { state: "no-needs" };
|
|
1809
|
+
if ((manifest.env?.plugins ?? []).length + (manifest.env?.libs ?? []).length === 0) return { state: "no-needs" };
|
|
1810
|
+
try {
|
|
1811
|
+
return {
|
|
1812
|
+
state: "installed",
|
|
1813
|
+
entry: await service.install(module.unit)
|
|
1814
|
+
};
|
|
1815
|
+
} catch (error) {
|
|
1816
|
+
return {
|
|
1817
|
+
state: "failed",
|
|
1818
|
+
reason: error instanceof Error ? error.message : String(error)
|
|
1819
|
+
};
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
const service = {
|
|
3402
1823
|
async list() {
|
|
3403
1824
|
return snapshot();
|
|
3404
1825
|
},
|
|
@@ -3467,29 +1888,24 @@ function createMarketService(options) {
|
|
|
3467
1888
|
return entryOf(unit, true);
|
|
3468
1889
|
},
|
|
3469
1890
|
async uninstall(unit) {
|
|
3470
|
-
const
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
if (keepers.length > 0) {
|
|
3486
|
-
for (const item of keepers) keptModules.add(item.id);
|
|
3487
|
-
continue;
|
|
3488
|
-
}
|
|
3489
|
-
const onMachine = (before.libs ?? []).some((state) => state.name === need.name && state.status !== "missing");
|
|
3490
|
-
if (before.libs !== void 0 && !onMachine) continue;
|
|
3491
|
-
await run(`npm uninstall --prefix ${quoteShellArg(libsPrefix())} ${quoteShellArg(need.name)}`, true);
|
|
1891
|
+
const pkg = (modules?.() ?? []).find((item) => item.unit === unit)?.pkg;
|
|
1892
|
+
if (pkg !== void 0) {
|
|
1893
|
+
const entry = await entryOf(unit, true);
|
|
1894
|
+
const { change, keptFor } = await service.removeBundle(pkg);
|
|
1895
|
+
return {
|
|
1896
|
+
entry: change.application === "applied" ? {
|
|
1897
|
+
...entry,
|
|
1898
|
+
capability: {
|
|
1899
|
+
...entry.capability,
|
|
1900
|
+
released: true
|
|
1901
|
+
}
|
|
1902
|
+
} : entry,
|
|
1903
|
+
keptFor,
|
|
1904
|
+
change
|
|
1905
|
+
};
|
|
3492
1906
|
}
|
|
1907
|
+
const before = await capabilityOf(unit, true);
|
|
1908
|
+
const keptFor = await dropEnv(unit, requireEntry(unit).env, before);
|
|
3493
1909
|
await probeSharing({
|
|
3494
1910
|
action: "uninstall",
|
|
3495
1911
|
unit
|
|
@@ -3504,11 +1920,61 @@ function createMarketService(options) {
|
|
|
3504
1920
|
released: true
|
|
3505
1921
|
}
|
|
3506
1922
|
},
|
|
3507
|
-
keptFor
|
|
1923
|
+
keptFor
|
|
1924
|
+
};
|
|
1925
|
+
},
|
|
1926
|
+
async installBundle(spec, options) {
|
|
1927
|
+
const change = await requireBundles().install({
|
|
1928
|
+
spec,
|
|
1929
|
+
...options?.registry === void 0 ? {} : { registry: options.registry },
|
|
1930
|
+
...options?.requestId === void 0 ? {} : { requestId: options.requestId },
|
|
1931
|
+
...options?.approvedBuilds === void 0 ? {} : { approvedBuilds: options.approvedBuilds }
|
|
1932
|
+
});
|
|
1933
|
+
if (change === null) throw new Error("插件管理器回的安装结果看不懂。");
|
|
1934
|
+
const pkg = bundleNameOf(change, spec);
|
|
1935
|
+
const module = installed?.(pkg) ?? {
|
|
1936
|
+
kind: "unknown",
|
|
1937
|
+
pkg
|
|
1938
|
+
};
|
|
1939
|
+
return {
|
|
1940
|
+
change,
|
|
1941
|
+
module,
|
|
1942
|
+
supply: await supplyAfter(module, change)
|
|
1943
|
+
};
|
|
1944
|
+
},
|
|
1945
|
+
async removeBundle(pkg) {
|
|
1946
|
+
const manager = requireBundles();
|
|
1947
|
+
const module = installed?.(pkg) ?? {
|
|
1948
|
+
kind: "unknown",
|
|
1949
|
+
pkg
|
|
1950
|
+
};
|
|
1951
|
+
const unit = module.kind === "module" ? module.unit : void 0;
|
|
1952
|
+
const manifest = unit === void 0 ? void 0 : catalog().find((item) => item.id === unit);
|
|
1953
|
+
const before = unit === void 0 ? void 0 : await capabilityOf(unit, true);
|
|
1954
|
+
const change = await manager.remove(pkg);
|
|
1955
|
+
if (change === null) throw new Error("插件管理器回的卸载结果看不懂。");
|
|
1956
|
+
if (change.application !== "applied" || unit === void 0) return {
|
|
1957
|
+
change,
|
|
1958
|
+
keptFor: []
|
|
1959
|
+
};
|
|
1960
|
+
const keptFor = manifest === void 0 || before === void 0 ? [] : await dropEnv(unit, manifest.env, before);
|
|
1961
|
+
onUninstalled?.(unit);
|
|
1962
|
+
return {
|
|
1963
|
+
change,
|
|
1964
|
+
keptFor
|
|
3508
1965
|
};
|
|
3509
1966
|
},
|
|
1967
|
+
async cancelInstall(requestId) {
|
|
1968
|
+
return requireBundles().cancel(requestId);
|
|
1969
|
+
},
|
|
1970
|
+
async updateBundle(unit) {
|
|
1971
|
+
const pkg = (modules?.() ?? []).find((item) => item.unit === unit)?.pkg;
|
|
1972
|
+
if (pkg === void 0) return null;
|
|
1973
|
+
return service.installBundle(pkg);
|
|
1974
|
+
},
|
|
3510
1975
|
updateDependency: updateDependencyRow
|
|
3511
1976
|
};
|
|
1977
|
+
return service;
|
|
3512
1978
|
}
|
|
3513
1979
|
//#endregion
|
|
3514
1980
|
//#region src/modules/panels/model/market-dispatch.ts
|
|
@@ -3525,14 +1991,50 @@ async function dispatchMarket(market, request) {
|
|
|
3525
1991
|
shared
|
|
3526
1992
|
};
|
|
3527
1993
|
}
|
|
1994
|
+
if (request.action === "install-bundle") return {
|
|
1995
|
+
ok: true,
|
|
1996
|
+
action: "install-bundle",
|
|
1997
|
+
...await market.installBundle(request.spec ?? "", {
|
|
1998
|
+
...request.registry === void 0 ? {} : { registry: request.registry },
|
|
1999
|
+
...request.approvedBuilds === void 0 ? {} : { approvedBuilds: request.approvedBuilds },
|
|
2000
|
+
...request.requestId === void 0 ? {} : { requestId: request.requestId }
|
|
2001
|
+
})
|
|
2002
|
+
};
|
|
2003
|
+
if (request.action === "update-bundle") {
|
|
2004
|
+
const outcome = await market.updateBundle(request.unit ?? "");
|
|
2005
|
+
return outcome === null ? {
|
|
2006
|
+
ok: true,
|
|
2007
|
+
action: "update",
|
|
2008
|
+
module: await market.update(request.unit ?? "")
|
|
2009
|
+
} : {
|
|
2010
|
+
ok: true,
|
|
2011
|
+
action: "update-bundle",
|
|
2012
|
+
...outcome
|
|
2013
|
+
};
|
|
2014
|
+
}
|
|
2015
|
+
if (request.action === "remove-bundle") {
|
|
2016
|
+
const { change, keptFor } = await market.removeBundle(request.name ?? "");
|
|
2017
|
+
return {
|
|
2018
|
+
ok: true,
|
|
2019
|
+
action: "remove-bundle",
|
|
2020
|
+
change,
|
|
2021
|
+
keptFor
|
|
2022
|
+
};
|
|
2023
|
+
}
|
|
2024
|
+
if (request.action === "cancel-install") return {
|
|
2025
|
+
ok: true,
|
|
2026
|
+
action: "cancel-install",
|
|
2027
|
+
cancellation: await market.cancelInstall(request.requestId ?? "")
|
|
2028
|
+
};
|
|
3528
2029
|
const unit = request.unit ?? "";
|
|
3529
2030
|
if (request.action === "uninstall") {
|
|
3530
|
-
const { entry, keptFor } = await market.uninstall(unit);
|
|
2031
|
+
const { entry, keptFor, change } = await market.uninstall(unit);
|
|
3531
2032
|
return {
|
|
3532
2033
|
ok: true,
|
|
3533
2034
|
action: "uninstall",
|
|
3534
2035
|
module: entry,
|
|
3535
|
-
keptFor
|
|
2036
|
+
keptFor,
|
|
2037
|
+
...change === void 0 ? {} : { change }
|
|
3536
2038
|
};
|
|
3537
2039
|
}
|
|
3538
2040
|
if (request.action === "update") return {
|
|
@@ -3574,6 +2076,9 @@ function render$1(entries, shared) {
|
|
|
3574
2076
|
if (shared.length === 0) return modules;
|
|
3575
2077
|
return `${modules}\n\n共用依赖(只有升级):\n${shared.map((dep) => `${dep.id} · ${stateOfDependency(dep)}${versionsOf(dep)}` + (dep.usedBy.length === 0 ? "" : ` · 供 ${dep.usedBy.join("、")} 使用`)).join("\n")}`;
|
|
3576
2078
|
}
|
|
2079
|
+
function describeInstall(spec, module, supply, change) {
|
|
2080
|
+
return `${change.application === "applied" ? "装好了,已生效" : change.application === "restart-required" ? "装好了,要重启一次才生效" : `没成功:${change.errorCode ?? change.application}`}:${module.kind === "module" ? `${module.unit}(${module.pkg})` : module.pkg}${supply.state === "installed" ? ";它要的 opencli 插件也装上了" : supply.state === "pending-restart" ? ";重启后再装它要的 opencli 插件" : supply.state === "not-a-module" ? ";但它不是工作台模块(没有 dsh.workbench 声明,不会出现在面板上)" : supply.state === "failed" ? `;但它要的插件没装上:${supply.reason}` : ""}(spec:${spec})`;
|
|
2081
|
+
}
|
|
3577
2082
|
var OUTPUT_SCHEMA$1 = {
|
|
3578
2083
|
type: "object",
|
|
3579
2084
|
properties: {
|
|
@@ -3600,6 +2105,7 @@ var ACTIONS = [
|
|
|
3600
2105
|
"install",
|
|
3601
2106
|
"update",
|
|
3602
2107
|
"uninstall",
|
|
2108
|
+
"install-bundle",
|
|
3603
2109
|
"update-dependency"
|
|
3604
2110
|
];
|
|
3605
2111
|
function registerMarketTools(ctx, market) {
|
|
@@ -3610,18 +2116,26 @@ function registerMarketTools(ctx, market) {
|
|
|
3610
2116
|
}
|
|
3611
2117
|
const tool = {
|
|
3612
2118
|
name: "workbench_modules",
|
|
3613
|
-
description: "看 / 装 / 升 /
|
|
2119
|
+
description: "看 / 装 / 升 / 卸工作台的面板模块。install-bundle 按 spec(包名,可带版本;git / tarball / 本地路径也行)把模块包装进 profile —— 装完会连带装它声明的 opencli 插件;其余 action 按模块 id 动它要的外部供给。卸载只动工作台运行时,不影响终端那套;共用依赖只有升级。",
|
|
3614
2120
|
parameters: {
|
|
3615
2121
|
type: "object",
|
|
3616
2122
|
properties: {
|
|
3617
2123
|
action: {
|
|
3618
2124
|
type: "string",
|
|
3619
|
-
description: "update-dependency
|
|
2125
|
+
description: "install-bundle=按 spec 装模块包(要 spec),update-dependency=升级共用依赖,其余=对模块(要 id)。",
|
|
3620
2126
|
enum: [...ACTIONS]
|
|
3621
2127
|
},
|
|
3622
2128
|
id: {
|
|
3623
2129
|
type: "string",
|
|
3624
2130
|
description: "模块 id(如 coding-issues);update-dependency 填共用依赖 id(如 plugin:coding)。"
|
|
2131
|
+
},
|
|
2132
|
+
spec: {
|
|
2133
|
+
type: "string",
|
|
2134
|
+
description: "install-bundle 用:包名(可带 @版本),也可以是 git 地址 / tarball / 本地绝对路径。"
|
|
2135
|
+
},
|
|
2136
|
+
registry: {
|
|
2137
|
+
type: "string",
|
|
2138
|
+
description: "install-bundle 用:先问哪个源(不填就用这个 profile 自己配的源)。"
|
|
3625
2139
|
}
|
|
3626
2140
|
},
|
|
3627
2141
|
required: ["action"],
|
|
@@ -3648,6 +2162,18 @@ function registerMarketTools(ctx, market) {
|
|
|
3648
2162
|
text: render$1(modules, shared)
|
|
3649
2163
|
};
|
|
3650
2164
|
}
|
|
2165
|
+
if (action === "install-bundle") {
|
|
2166
|
+
const spec = args?.spec?.trim() ?? "";
|
|
2167
|
+
if (spec === "") throw new Error("install-bundle 需要一个 spec:包名(可带版本,如 @scope/module@1.2.3),也可以是 git 地址 / tarball / 本地绝对路径。");
|
|
2168
|
+
const registry = args?.registry?.trim();
|
|
2169
|
+
const outcome = await market.installBundle(spec, registry === void 0 || registry === "" ? {} : { registry });
|
|
2170
|
+
return {
|
|
2171
|
+
change: outcome.change,
|
|
2172
|
+
module: outcome.module,
|
|
2173
|
+
supply: outcome.supply,
|
|
2174
|
+
text: describeInstall(spec, outcome.module, outcome.supply, outcome.change)
|
|
2175
|
+
};
|
|
2176
|
+
}
|
|
3651
2177
|
const id = args?.id;
|
|
3652
2178
|
if (id === void 0 || id.trim() === "") {
|
|
3653
2179
|
const { modules, shared } = await market.list();
|
|
@@ -4101,11 +2627,16 @@ var HOST_UNITS = [{
|
|
|
4101
2627
|
logger
|
|
4102
2628
|
});
|
|
4103
2629
|
ctx.provide(PANELS_SERVICE, panels);
|
|
2630
|
+
const profileDir = profileDirOf(ctx);
|
|
4104
2631
|
const market = createMarketService({
|
|
4105
2632
|
manifests: manifests(),
|
|
2633
|
+
manifestsNow: manifests,
|
|
4106
2634
|
...probe === void 0 ? {} : { probe },
|
|
4107
2635
|
shell: ctx.get("shell"),
|
|
4108
2636
|
...opencliCommand === void 0 ? {} : { command: opencliCommand },
|
|
2637
|
+
bundles: readBundleManager(ctx),
|
|
2638
|
+
installed: (pkg) => readInstalledModule(profileDir, pkg),
|
|
2639
|
+
modules: () => profileModules(profileDir),
|
|
4109
2640
|
onUninstalled: (unit) => {
|
|
4110
2641
|
panels.release(unit);
|
|
4111
2642
|
},
|
|
@@ -4220,6 +2751,152 @@ function registerFactStream(ctx, log) {
|
|
|
4220
2751
|
};
|
|
4221
2752
|
}
|
|
4222
2753
|
//#endregion
|
|
2754
|
+
//#region src/shared/api/host/dsh-plugins.ts
|
|
2755
|
+
var MANAGER_SERVICE = "pluginManager";
|
|
2756
|
+
function asRecord(value) {
|
|
2757
|
+
return typeof value === "object" && value !== null ? value : void 0;
|
|
2758
|
+
}
|
|
2759
|
+
function asArray(value) {
|
|
2760
|
+
if (Array.isArray(value)) return value;
|
|
2761
|
+
const record = asRecord(value);
|
|
2762
|
+
if (record === void 0) return [];
|
|
2763
|
+
for (const key of [
|
|
2764
|
+
"rows",
|
|
2765
|
+
"items",
|
|
2766
|
+
"list",
|
|
2767
|
+
"bundles",
|
|
2768
|
+
"plugins"
|
|
2769
|
+
]) {
|
|
2770
|
+
const inner = record[key];
|
|
2771
|
+
if (Array.isArray(inner)) return inner;
|
|
2772
|
+
}
|
|
2773
|
+
return [];
|
|
2774
|
+
}
|
|
2775
|
+
function asText(value) {
|
|
2776
|
+
return typeof value === "string" ? value : "";
|
|
2777
|
+
}
|
|
2778
|
+
function rowOf(value) {
|
|
2779
|
+
const record = asRecord(value);
|
|
2780
|
+
if (record === void 0) return void 0;
|
|
2781
|
+
const name = asText(record.name) || asText(record.id);
|
|
2782
|
+
if (name === "") return void 0;
|
|
2783
|
+
return {
|
|
2784
|
+
name,
|
|
2785
|
+
version: asText(record.version),
|
|
2786
|
+
enabled: record.disabled !== true && record.enabled !== false
|
|
2787
|
+
};
|
|
2788
|
+
}
|
|
2789
|
+
function rowsOf(value) {
|
|
2790
|
+
const rows = [];
|
|
2791
|
+
for (const item of asArray(value)) {
|
|
2792
|
+
const row = rowOf(item);
|
|
2793
|
+
if (row !== void 0) rows.push(row);
|
|
2794
|
+
}
|
|
2795
|
+
return rows;
|
|
2796
|
+
}
|
|
2797
|
+
async function readDshPlugins(ctx) {
|
|
2798
|
+
const manager = ctx.get(MANAGER_SERVICE);
|
|
2799
|
+
if (manager === void 0) return {
|
|
2800
|
+
available: false,
|
|
2801
|
+
bundles: [],
|
|
2802
|
+
plugins: []
|
|
2803
|
+
};
|
|
2804
|
+
const [bundles, plugins] = await Promise.all([manager.listBundles === void 0 ? void 0 : manager.listBundles(), manager.listPlugins === void 0 ? void 0 : manager.listPlugins()]);
|
|
2805
|
+
return {
|
|
2806
|
+
available: true,
|
|
2807
|
+
bundles: rowsOf(bundles),
|
|
2808
|
+
plugins: rowsOf(plugins)
|
|
2809
|
+
};
|
|
2810
|
+
}
|
|
2811
|
+
function dshPluginsHandler(ctx) {
|
|
2812
|
+
return () => readDshPlugins(ctx);
|
|
2813
|
+
}
|
|
2814
|
+
//#endregion
|
|
2815
|
+
//#region src/shared/api/bundle-install.ts
|
|
2816
|
+
var BUNDLE_REGISTRIES_ROUTE = "bundle-registries";
|
|
2817
|
+
var BUNDLE_INSPECT_ROUTE = "bundle-inspect";
|
|
2818
|
+
var MODULE_VERSIONS_ROUTE = "module-versions";
|
|
2819
|
+
//#endregion
|
|
2820
|
+
//#region src/shared/api/host/bundle-routes.ts
|
|
2821
|
+
function registryOf(search) {
|
|
2822
|
+
const raw = param(search, "registry");
|
|
2823
|
+
if (raw === void 0) return void 0;
|
|
2824
|
+
return raw === "default" ? null : raw;
|
|
2825
|
+
}
|
|
2826
|
+
function bundleRegistriesHandler(ctx) {
|
|
2827
|
+
return async () => {
|
|
2828
|
+
const manager = readBundleManager(ctx);
|
|
2829
|
+
return {
|
|
2830
|
+
ok: true,
|
|
2831
|
+
...manager === void 0 ? {
|
|
2832
|
+
available: false,
|
|
2833
|
+
registries: null
|
|
2834
|
+
} : {
|
|
2835
|
+
available: true,
|
|
2836
|
+
registries: await manager.registries()
|
|
2837
|
+
}
|
|
2838
|
+
};
|
|
2839
|
+
};
|
|
2840
|
+
}
|
|
2841
|
+
function moduleVersionsHandler(ctx) {
|
|
2842
|
+
return async () => {
|
|
2843
|
+
const manager = readBundleManager(ctx);
|
|
2844
|
+
if (manager === void 0) return {
|
|
2845
|
+
ok: true,
|
|
2846
|
+
modules: []
|
|
2847
|
+
};
|
|
2848
|
+
const found = profileModules(profileDirOf(ctx));
|
|
2849
|
+
return {
|
|
2850
|
+
ok: true,
|
|
2851
|
+
modules: await Promise.all(found.map(async (module) => {
|
|
2852
|
+
const inspection = await manager.inspect(module.pkg).catch(() => null);
|
|
2853
|
+
const latest = inspection?.status === "accepted" ? inspection.version : void 0;
|
|
2854
|
+
return {
|
|
2855
|
+
unit: module.unit,
|
|
2856
|
+
pkg: module.pkg,
|
|
2857
|
+
installed: module.version,
|
|
2858
|
+
...latest === void 0 ? {} : { latest }
|
|
2859
|
+
};
|
|
2860
|
+
}))
|
|
2861
|
+
};
|
|
2862
|
+
};
|
|
2863
|
+
}
|
|
2864
|
+
function bundleInspectHandler(ctx) {
|
|
2865
|
+
return async (search) => {
|
|
2866
|
+
const spec = param(search, "spec");
|
|
2867
|
+
if (spec === void 0) return {
|
|
2868
|
+
ok: false,
|
|
2869
|
+
error: {
|
|
2870
|
+
code: "workbench/no-spec",
|
|
2871
|
+
message: "要预检哪个包?缺 spec。"
|
|
2872
|
+
}
|
|
2873
|
+
};
|
|
2874
|
+
const manager = readBundleManager(ctx);
|
|
2875
|
+
if (manager === void 0) return {
|
|
2876
|
+
ok: false,
|
|
2877
|
+
error: {
|
|
2878
|
+
code: "workbench/no-bundle-manager",
|
|
2879
|
+
message: "这个 profile 里没有插件管理器,装不了模块。"
|
|
2880
|
+
}
|
|
2881
|
+
};
|
|
2882
|
+
const inspection = await manager.inspect(spec, registryOf(search));
|
|
2883
|
+
if (inspection === null) return {
|
|
2884
|
+
ok: false,
|
|
2885
|
+
error: {
|
|
2886
|
+
code: "workbench/bad-inspection",
|
|
2887
|
+
message: "插件管理器回的预检结果看不懂。"
|
|
2888
|
+
}
|
|
2889
|
+
};
|
|
2890
|
+
return {
|
|
2891
|
+
ok: true,
|
|
2892
|
+
inspection
|
|
2893
|
+
};
|
|
2894
|
+
};
|
|
2895
|
+
}
|
|
2896
|
+
//#endregion
|
|
2897
|
+
//#region src/shared/api/dsh-plugins.ts
|
|
2898
|
+
var DSH_PLUGINS_ROUTE = "dsh-plugins";
|
|
2899
|
+
//#endregion
|
|
4223
2900
|
//#region src/shared/api/host/context-inject.ts
|
|
4224
2901
|
var CONTEXT_SOURCE_KIND = "workbench";
|
|
4225
2902
|
function collectContextRefs(messages) {
|
|
@@ -5194,7 +3871,11 @@ function apply(ctx) {
|
|
|
5194
3871
|
const values = createValueHandoff();
|
|
5195
3872
|
const routes = {
|
|
5196
3873
|
health: healthHandler(ctx),
|
|
5197
|
-
changes: changesHandler(facts)
|
|
3874
|
+
changes: changesHandler(facts),
|
|
3875
|
+
[DSH_PLUGINS_ROUTE]: dshPluginsHandler(ctx),
|
|
3876
|
+
[BUNDLE_REGISTRIES_ROUTE]: bundleRegistriesHandler(ctx),
|
|
3877
|
+
[BUNDLE_INSPECT_ROUTE]: bundleInspectHandler(ctx),
|
|
3878
|
+
[MODULE_VERSIONS_ROUTE]: moduleVersionsHandler(ctx)
|
|
5198
3879
|
};
|
|
5199
3880
|
const renderers = /* @__PURE__ */ new Map();
|
|
5200
3881
|
const shell = ctx.get("shell");
|