@glasshome/widget-sdk 1.34.1 → 1.34.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/export-history.json +150 -0
- package/dist/index.js +1 -1
- package/dist/vite/build.d.ts +21 -0
- package/dist/vite/css-guard.d.ts +2 -0
- package/dist/vite/discover.d.ts +9 -0
- package/dist/vite/import-guards.d.ts +53 -0
- package/dist/vite/index.d.ts +8 -126
- package/dist/vite/index.js +924 -884
- package/dist/vite/normalize-path.d.ts +1 -0
- package/dist/vite/plugin.d.ts +28 -0
- package/dist/vite/schema-guard.d.ts +26 -0
- package/dist/vite/tailwind-entry.d.ts +19 -0
- package/package.json +1 -1
package/dist/vite/index.js
CHANGED
|
@@ -1,122 +1,576 @@
|
|
|
1
1
|
import { deprecations as e, formatDeprecation as t } from "../deprecations.js";
|
|
2
2
|
import { formatSchemaError as n, isHostProvidedModule as r, matchesRead as i, widgetManifestSchema as a } from "@glasshome/widget-contract";
|
|
3
|
-
import {
|
|
4
|
-
import { existsSync as
|
|
5
|
-
import { createRequire as m } from "node:module";
|
|
3
|
+
import { spawn as o, spawnSync as s } from "node:child_process";
|
|
4
|
+
import { existsSync as c, mkdirSync as l, readFileSync as u, readdirSync as d, rmSync as f, statSync as p, writeFileSync as m } from "node:fs";
|
|
6
5
|
import { dirname as h, join as g, relative as _, resolve as v, sep as y } from "node:path";
|
|
7
6
|
import { fileURLToPath as b } from "node:url";
|
|
8
|
-
import {
|
|
9
|
-
import ee from "@
|
|
10
|
-
import {
|
|
7
|
+
import { createHash as x } from "node:crypto";
|
|
8
|
+
import { sdkImportsOf as ee } from "@glasshome/widget-contract/sdk-floor";
|
|
9
|
+
import { createRequire as S } from "node:module";
|
|
10
|
+
import te from "@tailwindcss/vite";
|
|
11
11
|
//#region \0rolldown/runtime.js
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
SEMVER_SPEC_VERSION: "2.0.0",
|
|
29
|
-
FLAG_INCLUDE_PRERELEASE: 1,
|
|
30
|
-
FLAG_LOOSE: 2
|
|
31
|
-
};
|
|
32
|
-
})), w = /* @__PURE__ */ S(((e, t) => {
|
|
33
|
-
t.exports = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...e) => console.error("SEMVER", ...e) : () => {};
|
|
34
|
-
})), T = /* @__PURE__ */ S(((e, t) => {
|
|
35
|
-
var { MAX_SAFE_COMPONENT_LENGTH: n, MAX_SAFE_BUILD_LENGTH: r, MAX_LENGTH: i } = C(), a = w();
|
|
36
|
-
e = t.exports = {};
|
|
37
|
-
var o = e.re = [], s = e.safeRe = [], c = e.src = [], l = e.safeSrc = [], u = e.t = {}, d = 0, f = "[a-zA-Z0-9-]", p = [
|
|
38
|
-
["\\s", 1],
|
|
39
|
-
["\\d", i],
|
|
40
|
-
[f, r]
|
|
41
|
-
], m = (e) => {
|
|
42
|
-
for (let [t, n] of p) e = e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);
|
|
43
|
-
return e;
|
|
44
|
-
}, h = (e, t, n) => {
|
|
45
|
-
let r = m(t), i = d++;
|
|
46
|
-
a(e, i, t), u[e] = i, c[i] = t, l[i] = r, o[i] = new RegExp(t, n ? "g" : void 0), s[i] = new RegExp(r, n ? "g" : void 0);
|
|
47
|
-
};
|
|
48
|
-
h("NUMERICIDENTIFIER", "0|[1-9]\\d*"), h("NUMERICIDENTIFIERLOOSE", "\\d+"), h("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${f}*`), h("MAINVERSION", `(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`), h("MAINVERSIONLOOSE", `(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`), h("PRERELEASEIDENTIFIER", `(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`), h("PRERELEASEIDENTIFIERLOOSE", `(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`), h("PRERELEASE", `(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`), h("PRERELEASELOOSE", `(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`), h("BUILDIDENTIFIER", `${f}+`), h("BUILD", `(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`), h("FULLPLAIN", `v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`), h("FULL", `^${c[u.FULLPLAIN]}$`), h("LOOSEPLAIN", `[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`), h("LOOSE", `^${c[u.LOOSEPLAIN]}$`), h("GTLT", "((?:<|>)?=?)"), h("XRANGEIDENTIFIERLOOSE", `${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), h("XRANGEIDENTIFIER", `${c[u.NUMERICIDENTIFIER]}|x|X|\\*`), h("XRANGEPLAIN", `[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`), h("XRANGEPLAINLOOSE", `[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`), h("XRANGE", `^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`), h("XRANGELOOSE", `^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`), h("COERCEPLAIN", `(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`), h("COERCE", `${c[u.COERCEPLAIN]}(?:$|[^\\d])`), h("COERCEFULL", c[u.COERCEPLAIN] + `(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`), h("COERCERTL", c[u.COERCE], !0), h("COERCERTLFULL", c[u.COERCEFULL], !0), h("LONETILDE", "(?:~>?)"), h("TILDETRIM", `(\\s*)${c[u.LONETILDE]}\\s+`, !0), e.tildeTrimReplace = "$1~", h("TILDE", `^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`), h("TILDELOOSE", `^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`), h("LONECARET", "(?:\\^)"), h("CARETTRIM", `(\\s*)${c[u.LONECARET]}\\s+`, !0), e.caretTrimReplace = "$1^", h("CARET", `^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`), h("CARETLOOSE", `^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`), h("COMPARATORLOOSE", `^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`), h("COMPARATOR", `^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`), h("COMPARATORTRIM", `(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`, !0), e.comparatorTrimReplace = "$1$2$3", h("HYPHENRANGE", `^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`), h("HYPHENRANGELOOSE", `^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`), h("STAR", "(<|>)?=?\\s*\\*"), h("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), h("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
49
|
-
})), E = /* @__PURE__ */ S(((e, t) => {
|
|
50
|
-
var n = Object.freeze({ loose: !0 }), r = Object.freeze({});
|
|
51
|
-
t.exports = (e) => e ? typeof e == "object" ? e : n : r;
|
|
52
|
-
})), D = /* @__PURE__ */ S(((e, t) => {
|
|
53
|
-
var n = /^[0-9]+$/, r = (e, t) => {
|
|
54
|
-
if (typeof e == "number" && typeof t == "number") return e === t ? 0 : e < t ? -1 : 1;
|
|
55
|
-
let r = n.test(e), i = n.test(t);
|
|
56
|
-
return r && i && (e = +e, t = +t), e === t ? 0 : r && !i ? -1 : i && !r ? 1 : e < t ? -1 : 1;
|
|
12
|
+
var C = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), w = (e) => e, T = (e) => e, E = {
|
|
13
|
+
now: () => Date.now(),
|
|
14
|
+
setTimeout: (e, t) => w(globalThis.setTimeout(e, t)),
|
|
15
|
+
clearTimeout: (e) => globalThis.clearTimeout(T(e)),
|
|
16
|
+
setInterval: (e, t) => w(globalThis.setInterval(e, t)),
|
|
17
|
+
clearInterval: (e) => globalThis.clearInterval(T(e))
|
|
18
|
+
}, ne = 262144e3, D = 3e4, re = 3e3;
|
|
19
|
+
function O(e) {
|
|
20
|
+
let t = h(b(import.meta.url));
|
|
21
|
+
return [g(t, `${e}.js`), g(t, `${e}.ts`)].find((e) => c(e)) ?? null;
|
|
22
|
+
}
|
|
23
|
+
function k(e, t) {
|
|
24
|
+
let n = O("introspect");
|
|
25
|
+
if (!n) return {
|
|
26
|
+
ok: !1,
|
|
27
|
+
reason: "introspect not found next to the sdk"
|
|
57
28
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
29
|
+
let r = s(process.execPath, [
|
|
30
|
+
"--conditions",
|
|
31
|
+
"browser",
|
|
32
|
+
n,
|
|
33
|
+
e
|
|
34
|
+
], {
|
|
35
|
+
encoding: "utf-8",
|
|
36
|
+
timeout: t?.timeoutMs ?? D
|
|
37
|
+
});
|
|
38
|
+
if (r.error) return {
|
|
39
|
+
ok: !1,
|
|
40
|
+
reason: r.error.message
|
|
61
41
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (n.length > e.length) return !1;
|
|
66
|
-
for (let t = 0; t < n.length; t++) if (c(e[t], n[t]) !== 0) return !1;
|
|
67
|
-
return !0;
|
|
42
|
+
if (r.status !== 0) return {
|
|
43
|
+
ok: !1,
|
|
44
|
+
reason: (r.stderr || "").trim().split("\n")[0] || `exit ${r.status}`
|
|
68
45
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
46
|
+
try {
|
|
47
|
+
return {
|
|
48
|
+
ok: !0,
|
|
49
|
+
value: JSON.parse(r.stdout)
|
|
50
|
+
};
|
|
51
|
+
} catch {
|
|
52
|
+
return {
|
|
53
|
+
ok: !1,
|
|
54
|
+
reason: "introspect returned unparseable output"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function ie(e) {
|
|
59
|
+
let t = o(process.execPath, [
|
|
60
|
+
"--conditions",
|
|
61
|
+
"browser",
|
|
62
|
+
e
|
|
63
|
+
], { stdio: [
|
|
64
|
+
"pipe",
|
|
65
|
+
"pipe",
|
|
66
|
+
"inherit"
|
|
67
|
+
] });
|
|
68
|
+
return {
|
|
69
|
+
write(e) {
|
|
70
|
+
return t.stdin?.writable ? (t.stdin.write(e), !0) : !1;
|
|
71
|
+
},
|
|
72
|
+
onLine(e) {
|
|
73
|
+
let n = "";
|
|
74
|
+
t.stdout?.setEncoding("utf-8"), t.stdout?.on("data", (t) => {
|
|
75
|
+
n += t;
|
|
76
|
+
let r = n.indexOf("\n");
|
|
77
|
+
for (; r >= 0;) {
|
|
78
|
+
let t = n.slice(0, r).trim();
|
|
79
|
+
n = n.slice(r + 1), t && e(t), r = n.indexOf("\n");
|
|
86
80
|
}
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
onExit(e) {
|
|
84
|
+
t.on("error", (t) => e(t.message)), t.on("exit", (t, n) => e(`introspect worker exited (${n ?? `code ${t}`})`));
|
|
85
|
+
},
|
|
86
|
+
kill() {
|
|
87
|
+
t.kill();
|
|
88
|
+
},
|
|
89
|
+
get pid() {
|
|
90
|
+
return t.pid ?? null;
|
|
89
91
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function ae(e) {
|
|
95
|
+
return {
|
|
96
|
+
introspect: async (t) => k(t, { timeoutMs: e }),
|
|
97
|
+
dispose: async () => {},
|
|
98
|
+
childPid: null
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function oe(e) {
|
|
102
|
+
if (process.env.GLASSHOME_WIDGET_NO_WORKER === "1") return ae(e?.timeoutMs);
|
|
103
|
+
let t = e?.rssLimitBytes ?? ne, n = e?.timeoutMs ?? D, r = e?.slowMs ?? re, i = e?.clock ?? E, a = e?.spawnWorker ?? ie, o = null, s = !1, c = 0, l = Promise.resolve();
|
|
104
|
+
function u(e, t) {
|
|
105
|
+
for (let n of e.pending.values()) n({
|
|
106
|
+
ok: !1,
|
|
107
|
+
reason: t
|
|
108
|
+
});
|
|
109
|
+
e.pending.clear();
|
|
110
|
+
}
|
|
111
|
+
function d(e, t) {
|
|
112
|
+
o === e && (o = null), u(e, t), e.proc.kill();
|
|
113
|
+
}
|
|
114
|
+
function f(e, n) {
|
|
115
|
+
let i;
|
|
116
|
+
try {
|
|
117
|
+
i = JSON.parse(n);
|
|
118
|
+
} catch {
|
|
119
|
+
return;
|
|
92
120
|
}
|
|
93
|
-
|
|
94
|
-
|
|
121
|
+
if (typeof i.id != "number") return;
|
|
122
|
+
let a = e.pending.get(i.id);
|
|
123
|
+
a && (e.pending.delete(i.id), (i.rss ?? 0) > t && (e.retireAfterRequest = !0), (i.importMs ?? 0) > r && console.warn(`[widget-sdk] introspection took ${i.importMs}ms`), a(i.ok ? {
|
|
124
|
+
ok: !0,
|
|
125
|
+
value: i.value
|
|
126
|
+
} : {
|
|
127
|
+
ok: !1,
|
|
128
|
+
reason: i.reason ?? "introspection failed"
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
function p(e) {
|
|
132
|
+
let t = i.now(), n = {
|
|
133
|
+
proc: a(e),
|
|
134
|
+
ready: Promise.resolve(),
|
|
135
|
+
pending: /* @__PURE__ */ new Map(),
|
|
136
|
+
retireAfterRequest: !1
|
|
137
|
+
};
|
|
138
|
+
return n.ready = new Promise((e, a) => {
|
|
139
|
+
let s = !1;
|
|
140
|
+
n.proc.onLine((a) => {
|
|
141
|
+
if (!s && a.includes("\"ready\"")) {
|
|
142
|
+
s = !0;
|
|
143
|
+
let n = i.now() - t;
|
|
144
|
+
n > r && console.warn(`[widget-sdk] introspect worker took ${n}ms to boot`), e();
|
|
145
|
+
} else f(n, a);
|
|
146
|
+
}), n.proc.onExit((e) => {
|
|
147
|
+
s || a(Error(e)), o === n && (o = null), u(n, e);
|
|
148
|
+
});
|
|
149
|
+
}), n;
|
|
150
|
+
}
|
|
151
|
+
async function m(e) {
|
|
152
|
+
if (s) return {
|
|
153
|
+
ok: !1,
|
|
154
|
+
reason: "introspect session disposed"
|
|
155
|
+
};
|
|
156
|
+
let t = O("introspect-worker");
|
|
157
|
+
if (!t) return {
|
|
158
|
+
ok: !1,
|
|
159
|
+
reason: "introspect-worker not found next to the sdk"
|
|
160
|
+
};
|
|
161
|
+
o?.retireAfterRequest && d(o, "worker was replaced");
|
|
162
|
+
let r = o ??= p(t);
|
|
163
|
+
try {
|
|
164
|
+
await r.ready;
|
|
165
|
+
} catch (e) {
|
|
166
|
+
return {
|
|
167
|
+
ok: !1,
|
|
168
|
+
reason: e instanceof Error ? e.message : String(e)
|
|
169
|
+
};
|
|
95
170
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
171
|
+
let a = ++c;
|
|
172
|
+
return new Promise((t) => {
|
|
173
|
+
let o = i.setTimeout(() => {
|
|
174
|
+
r.pending.delete(a), d(r, `introspection timed out after ${n}ms`), t({
|
|
175
|
+
ok: !1,
|
|
176
|
+
reason: `introspection timed out after ${n}ms`
|
|
177
|
+
});
|
|
178
|
+
}, n);
|
|
179
|
+
r.pending.set(a, (e) => {
|
|
180
|
+
i.clearTimeout(o), t(e);
|
|
181
|
+
});
|
|
182
|
+
try {
|
|
183
|
+
if (!r.proc.write(`${JSON.stringify({
|
|
184
|
+
id: a,
|
|
185
|
+
outFile: e
|
|
186
|
+
})}\n`)) throw Error("introspect worker is not writable");
|
|
187
|
+
} catch (e) {
|
|
188
|
+
i.clearTimeout(o), r.pending.delete(a), r.retireAfterRequest = !0, t({
|
|
189
|
+
ok: !1,
|
|
190
|
+
reason: e instanceof Error ? e.message : String(e)
|
|
191
|
+
});
|
|
100
192
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (n("prerelease compare", r, e, i), e === void 0 && i === void 0) return 0;
|
|
114
|
-
if (i === void 0) return 1;
|
|
115
|
-
if (e === void 0) return -1;
|
|
116
|
-
if (e !== i) return c(e, i);
|
|
117
|
-
} while (++r);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
introspect(e) {
|
|
197
|
+
let t = l.then(() => m(e));
|
|
198
|
+
return l = t.catch(() => void 0), t;
|
|
199
|
+
},
|
|
200
|
+
async dispose() {
|
|
201
|
+
s = !0, o && d(o, "introspect session disposed");
|
|
202
|
+
},
|
|
203
|
+
get childPid() {
|
|
204
|
+
return o?.proc.pid ?? null;
|
|
118
205
|
}
|
|
119
|
-
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/vite/discover.ts
|
|
210
|
+
function A(e) {
|
|
211
|
+
let t = [];
|
|
212
|
+
if (!c(e)) return t;
|
|
213
|
+
for (let n of d(e)) {
|
|
214
|
+
let r = v(e, n);
|
|
215
|
+
if (!p(r).isDirectory()) continue;
|
|
216
|
+
let i = v(r, "index.tsx"), a = v(r, "manifest.json");
|
|
217
|
+
c(i) && c(a) && t.push({
|
|
218
|
+
name: n,
|
|
219
|
+
entry: i
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
return t;
|
|
223
|
+
}
|
|
224
|
+
function se(e, t) {
|
|
225
|
+
return c(e) ? d(e).flatMap((r) => {
|
|
226
|
+
if (!p(g(e, r)).isDirectory()) return [];
|
|
227
|
+
let i = g(e, r, "manifest.json");
|
|
228
|
+
if (!c(i)) return [];
|
|
229
|
+
let o = a.safeParse(JSON.parse(u(i, "utf-8")));
|
|
230
|
+
if (!o.success) throw Error(`[registry] Invalid manifest for "${r}": ${n(o.error)}`);
|
|
231
|
+
let s = c(g(t, `${r}.css`));
|
|
232
|
+
return [{
|
|
233
|
+
...o.data,
|
|
234
|
+
bundleUrl: `./${r}.js`,
|
|
235
|
+
...s ? { cssUrl: `./${r}.css` } : {}
|
|
236
|
+
}];
|
|
237
|
+
}) : [];
|
|
238
|
+
}
|
|
239
|
+
function ce(e, t) {
|
|
240
|
+
let n = se(e, t), r = {
|
|
241
|
+
version: 1,
|
|
242
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
243
|
+
baseUrl: "./",
|
|
244
|
+
widgets: n
|
|
245
|
+
};
|
|
246
|
+
c(t) || l(t, { recursive: !0 }), m(g(t, "registry.json"), JSON.stringify(r, null, 2)), console.log(`[registry] Generated registry.json with ${n.length} widget(s)`);
|
|
247
|
+
}
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/vite/normalize-path.ts
|
|
250
|
+
function j(e) {
|
|
251
|
+
return y === "\\" ? e.split(y).join("/") : e;
|
|
252
|
+
}
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/vite/import-guards.ts
|
|
255
|
+
function M(e) {
|
|
256
|
+
return r(e);
|
|
257
|
+
}
|
|
258
|
+
var le = /\.(ts|tsx|js|jsx)$/, ue = /from\s+["']@glasshome\/sync-layer(\/[^"']*)?["']/;
|
|
259
|
+
function de(e, t) {
|
|
260
|
+
let n = j(e).split("?")[0] ?? "";
|
|
261
|
+
return n.includes("/node_modules/") || !le.test(n) ? !1 : ue.test(t);
|
|
262
|
+
}
|
|
263
|
+
function fe() {
|
|
264
|
+
return {
|
|
265
|
+
name: "glasshome-widget:sync-layer-guard",
|
|
266
|
+
apply: "build",
|
|
267
|
+
enforce: "pre",
|
|
268
|
+
transform(e, t) {
|
|
269
|
+
if (de(t, e)) throw Error(`Widgets must not import "@glasshome/sync-layer" directly (imported by ${j(_(process.cwd(), t.split("?")[0] ?? t))}). Import the equivalent hook from "@glasshome/widget-sdk" instead (e.g. useEntity, useEntities, useService).`);
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function pe(t, n) {
|
|
275
|
+
let r = j(t).split("?")[0] ?? "";
|
|
276
|
+
if (r.includes("/node_modules/") || !le.test(r)) return !1;
|
|
277
|
+
let i = e.find((e) => e.id === "direct-ui-import");
|
|
278
|
+
return i?.sourcePattern ? new RegExp(i.sourcePattern).test(n) : !1;
|
|
279
|
+
}
|
|
280
|
+
function me(e = /* @__PURE__ */ new Set()) {
|
|
281
|
+
let t = /* @__PURE__ */ new Set();
|
|
282
|
+
return {
|
|
283
|
+
scan(e, n) {
|
|
284
|
+
pe(e, n) && t.add(j(_(process.cwd(), e.split("?")[0] ?? e)));
|
|
285
|
+
},
|
|
286
|
+
take() {
|
|
287
|
+
let n = [...t].filter((t) => !e.has(t));
|
|
288
|
+
for (let t of n) e.add(t);
|
|
289
|
+
return n;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function he(n) {
|
|
294
|
+
let r = me(n);
|
|
295
|
+
return {
|
|
296
|
+
name: "glasshome-widget:ui-import-guard",
|
|
297
|
+
apply: "build",
|
|
298
|
+
enforce: "pre",
|
|
299
|
+
transform(e, t) {
|
|
300
|
+
return r.scan(t, e), null;
|
|
301
|
+
},
|
|
302
|
+
buildEnd() {
|
|
303
|
+
let n = r.take();
|
|
304
|
+
if (n.length === 0) return;
|
|
305
|
+
let i = e.find((e) => e.id === "direct-ui-import"), a = i ? t(i) : "[@glasshome/widget-sdk] Direct @glasshome/ui imports are deprecated; import the same export from \"@glasshome/widget-sdk\".", o = n.map((e) => ` ${e}`).join("\n");
|
|
306
|
+
console.warn(`${a}\n Direct @glasshome/ui import(s) in:\n${o}`);
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
//#endregion
|
|
311
|
+
//#region src/vite/css-guard.ts
|
|
312
|
+
var ge = [
|
|
313
|
+
"--radius",
|
|
314
|
+
"--background",
|
|
315
|
+
"--foreground",
|
|
316
|
+
"--card",
|
|
317
|
+
"--primary",
|
|
318
|
+
"--border",
|
|
319
|
+
"--muted",
|
|
320
|
+
"--accent"
|
|
321
|
+
];
|
|
322
|
+
function _e(e) {
|
|
323
|
+
return e.replace(/(?<=[{;])\s*(--[\w-]+)\s*:\s*var\(\s*\1\s*\)\s*(;|(?=\}))/g, "");
|
|
324
|
+
}
|
|
325
|
+
function ve(e, t) {
|
|
326
|
+
let n = g(e, `${t}.css`);
|
|
327
|
+
if (!c(n)) return;
|
|
328
|
+
let r = u(n, "utf-8"), i = _e(r);
|
|
329
|
+
i !== r && m(n, i);
|
|
330
|
+
for (let e of i.matchAll(/:host[^{]*\{([^}]*)\}/g)) {
|
|
331
|
+
let n = e[1] ?? "", r = ge.find((e) => n.includes(`${e}:`));
|
|
332
|
+
if (r) throw Error(`[glasshome-widget] "${t}.css" defines theme variable "${r}" on :host. Theme variables must inherit from the document so widgets follow the household theme, never re-scope them into the widget's shadow root.`);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
//#endregion
|
|
336
|
+
//#region src/vite/schema-guard.ts
|
|
337
|
+
var N = 2;
|
|
338
|
+
function P(e) {
|
|
339
|
+
if (Array.isArray(e)) return `[${e.map(P).join(",")}]`;
|
|
340
|
+
if (typeof e == "object" && e) {
|
|
341
|
+
let t = e;
|
|
342
|
+
return `{${Object.keys(t).sort().filter((e) => t[e] !== void 0).map((e) => `${JSON.stringify(e)}:${P(t[e])}`).join(",")}}`;
|
|
343
|
+
}
|
|
344
|
+
return JSON.stringify(e) ?? "null";
|
|
345
|
+
}
|
|
346
|
+
function ye(e) {
|
|
347
|
+
return x("sha256").update(P(e)).digest("hex").slice(0, 16);
|
|
348
|
+
}
|
|
349
|
+
var be = 20;
|
|
350
|
+
async function xe(e, t) {
|
|
351
|
+
if (e === void 0) return;
|
|
352
|
+
let n;
|
|
353
|
+
try {
|
|
354
|
+
({z: n} = await import("zod"));
|
|
355
|
+
} catch {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
let r = n.number().int().positive(), i = n.array(n.object({
|
|
359
|
+
config: n.record(n.string(), n.unknown()),
|
|
360
|
+
size: n.object({
|
|
361
|
+
w: r,
|
|
362
|
+
h: r
|
|
363
|
+
}),
|
|
364
|
+
label: n.string().optional()
|
|
365
|
+
})).max(20).safeParse(e);
|
|
366
|
+
if (i.success) return;
|
|
367
|
+
let a = i.error.issues.map((e) => ` examples${e.path.length ? `[${e.path.join("][")}]` : ""}: ${e.message}`).join("\n");
|
|
368
|
+
throw Error(`[widget-sdk] Invalid \`examples\` for "${t}":\n${a}\nEach example needs a \`config\` object and a \`size\` of whole positive tiles, and at most 20 are rendered.`);
|
|
369
|
+
}
|
|
370
|
+
function Se(e, t) {
|
|
371
|
+
if (!e?.length) return;
|
|
372
|
+
let n = e.map((e) => {
|
|
373
|
+
let t = e.label ? `"${e.label}"` : `#${e.index}`;
|
|
374
|
+
return [` examples[${e.index}] ${t}:`, ...e.problems.map((e) => ` ${e}`)].join("\n");
|
|
375
|
+
}).join("\n");
|
|
376
|
+
throw Error(`[widget-sdk] Example config rejected by "${t}"'s own configSchema:\n${n}\nEach example's \`config\` must be a config the widget would actually accept, or its preview renders empty.`);
|
|
377
|
+
}
|
|
378
|
+
var Ce = [
|
|
379
|
+
"schema",
|
|
380
|
+
"defaultConfig",
|
|
381
|
+
"examples",
|
|
382
|
+
"configVersion",
|
|
383
|
+
"defaultSize",
|
|
384
|
+
"capabilities",
|
|
385
|
+
"name",
|
|
386
|
+
"description",
|
|
387
|
+
"icon",
|
|
388
|
+
"minSize",
|
|
389
|
+
"maxSize"
|
|
390
|
+
];
|
|
391
|
+
function we(e, t, n) {
|
|
392
|
+
let r = u(e, "utf-8"), i = JSON.parse(r), a = {
|
|
393
|
+
...t.manifest ?? {},
|
|
394
|
+
schema: n
|
|
395
|
+
};
|
|
396
|
+
for (let e of Ce) a[e] !== void 0 && (i[e] = a[e]);
|
|
397
|
+
let o = `${JSON.stringify(i, null, 2)}\n`;
|
|
398
|
+
o !== r && m(e, o);
|
|
399
|
+
}
|
|
400
|
+
var F = { useDaylight: "sun.sun" };
|
|
401
|
+
function Te(e, t, n) {
|
|
402
|
+
let r = ee(e);
|
|
403
|
+
for (let [e, a] of Object.entries(F)) {
|
|
404
|
+
if (!r.has(e) && !r.has("*") || i(t, a)) continue;
|
|
405
|
+
let o = a.split(".")[0];
|
|
406
|
+
throw Error(`[widget-sdk] "${n}" uses ${e}(), which reads ${a}, but its capabilities grant no read of it.\n Add { "domain": "${o}", "access": "read" } to capabilities, so the homeowner is told before installing.`);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function Ee(e) {
|
|
410
|
+
let { hash: t, configVersion: n, widgetName: r, hashFile: i } = e, a = e.currentRecord.trim(), o = null;
|
|
411
|
+
if (a.startsWith("{")) try {
|
|
412
|
+
o = JSON.parse(a);
|
|
413
|
+
} catch {
|
|
414
|
+
o = null;
|
|
415
|
+
}
|
|
416
|
+
if (o && o.hashVersion === N) {
|
|
417
|
+
if (o.hash !== t && o.configVersion === n) throw Error(`[widget-sdk] Config schema shape changed for "${r}" without a configVersion bump. Bump configVersion in defineWidget (currently ${n ?? "unset"}) or revert the schema change, then rebuild. Recorded in ${i}`);
|
|
418
|
+
} else console.warn(`[widget-sdk] Schema shape record for "${r}" was written by an older SDK, so it cannot be compared. Re-recording it under hash format ${N}. This build is not checked for a missing configVersion bump; the next one is. (${i})`);
|
|
419
|
+
}
|
|
420
|
+
async function De(e) {
|
|
421
|
+
let t = e.session ? await e.session.introspect(e.outFile) : await (e.introspect ?? k)(e.outFile);
|
|
422
|
+
if (!t.ok) throw Error(`[widget-sdk] Could not read "${e.widgetName}" to check it: ${t.reason}\n Its examples and config schema could not be validated, so the build cannot continue.
|
|
423
|
+
This usually means the bundle throws while being imported.`);
|
|
424
|
+
return t.value;
|
|
425
|
+
}
|
|
426
|
+
async function Oe(e, t) {
|
|
427
|
+
let n = t.manifest?.name ?? e.widgetName;
|
|
428
|
+
await xe(t.manifest?.examples, n), Se(t.exampleConfigIssues, n);
|
|
429
|
+
let r = e.manifestPath && c(e.manifestPath) ? e.manifestPath : null;
|
|
430
|
+
t.jsonSchema && r && we(r, t, t.jsonSchema);
|
|
431
|
+
let i = r ? JSON.parse(u(r, "utf-8")).capabilities : t.manifest?.capabilities;
|
|
432
|
+
Te(u(e.outFile, "utf-8"), i ?? [], n);
|
|
433
|
+
}
|
|
434
|
+
function ke(e, t, n) {
|
|
435
|
+
let r = ye(n), i = t.manifest?.configVersion ?? null, a = t.manifest?.name ?? e.widgetName, o = c(e.hashFile) ? u(e.hashFile, "utf-8") : null;
|
|
436
|
+
o !== null && Ee({
|
|
437
|
+
currentRecord: o,
|
|
438
|
+
hash: r,
|
|
439
|
+
configVersion: i,
|
|
440
|
+
widgetName: a,
|
|
441
|
+
hashFile: e.hashFile
|
|
442
|
+
});
|
|
443
|
+
let s = `${JSON.stringify({
|
|
444
|
+
hash: r,
|
|
445
|
+
configVersion: i,
|
|
446
|
+
hashVersion: N
|
|
447
|
+
})}\n`;
|
|
448
|
+
s !== o && m(e.hashFile, s);
|
|
449
|
+
}
|
|
450
|
+
async function Ae(e) {
|
|
451
|
+
if (!c(e.outFile)) return;
|
|
452
|
+
let t = await De(e);
|
|
453
|
+
await Oe(e, t), t.jsonSchema && ke(e, t, t.jsonSchema);
|
|
454
|
+
}
|
|
455
|
+
async function je(e) {
|
|
456
|
+
ve(e.outDir, e.name), await Ae({
|
|
457
|
+
outFile: g(e.outDir, `${e.name}.js`),
|
|
458
|
+
hashFile: e.hashFile,
|
|
459
|
+
widgetName: e.name,
|
|
460
|
+
manifestPath: e.manifestPath,
|
|
461
|
+
session: e.session
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
//#endregion
|
|
465
|
+
//#region node_modules/semver/internal/constants.js
|
|
466
|
+
var I = /* @__PURE__ */ C(((e, t) => {
|
|
467
|
+
t.exports = {
|
|
468
|
+
MAX_LENGTH: 256,
|
|
469
|
+
MAX_SAFE_COMPONENT_LENGTH: 16,
|
|
470
|
+
MAX_SAFE_BUILD_LENGTH: 250,
|
|
471
|
+
MAX_SAFE_INTEGER: 2 ** 53 - 1 ||
|
|
472
|
+
/* istanbul ignore next */ 9007199254740991,
|
|
473
|
+
RELEASE_TYPES: [
|
|
474
|
+
"major",
|
|
475
|
+
"premajor",
|
|
476
|
+
"minor",
|
|
477
|
+
"preminor",
|
|
478
|
+
"patch",
|
|
479
|
+
"prepatch",
|
|
480
|
+
"prerelease"
|
|
481
|
+
],
|
|
482
|
+
SEMVER_SPEC_VERSION: "2.0.0",
|
|
483
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
484
|
+
FLAG_LOOSE: 2
|
|
485
|
+
};
|
|
486
|
+
})), L = /* @__PURE__ */ C(((e, t) => {
|
|
487
|
+
t.exports = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...e) => console.error("SEMVER", ...e) : () => {};
|
|
488
|
+
})), R = /* @__PURE__ */ C(((e, t) => {
|
|
489
|
+
var { MAX_SAFE_COMPONENT_LENGTH: n, MAX_SAFE_BUILD_LENGTH: r, MAX_LENGTH: i } = I(), a = L();
|
|
490
|
+
e = t.exports = {};
|
|
491
|
+
var o = e.re = [], s = e.safeRe = [], c = e.src = [], l = e.safeSrc = [], u = e.t = {}, d = 0, f = "[a-zA-Z0-9-]", p = [
|
|
492
|
+
["\\s", 1],
|
|
493
|
+
["\\d", i],
|
|
494
|
+
[f, r]
|
|
495
|
+
], m = (e) => {
|
|
496
|
+
for (let [t, n] of p) e = e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);
|
|
497
|
+
return e;
|
|
498
|
+
}, h = (e, t, n) => {
|
|
499
|
+
let r = m(t), i = d++;
|
|
500
|
+
a(e, i, t), u[e] = i, c[i] = t, l[i] = r, o[i] = new RegExp(t, n ? "g" : void 0), s[i] = new RegExp(r, n ? "g" : void 0);
|
|
501
|
+
};
|
|
502
|
+
h("NUMERICIDENTIFIER", "0|[1-9]\\d*"), h("NUMERICIDENTIFIERLOOSE", "\\d+"), h("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${f}*`), h("MAINVERSION", `(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`), h("MAINVERSIONLOOSE", `(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`), h("PRERELEASEIDENTIFIER", `(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`), h("PRERELEASEIDENTIFIERLOOSE", `(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`), h("PRERELEASE", `(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`), h("PRERELEASELOOSE", `(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`), h("BUILDIDENTIFIER", `${f}+`), h("BUILD", `(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`), h("FULLPLAIN", `v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`), h("FULL", `^${c[u.FULLPLAIN]}$`), h("LOOSEPLAIN", `[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`), h("LOOSE", `^${c[u.LOOSEPLAIN]}$`), h("GTLT", "((?:<|>)?=?)"), h("XRANGEIDENTIFIERLOOSE", `${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), h("XRANGEIDENTIFIER", `${c[u.NUMERICIDENTIFIER]}|x|X|\\*`), h("XRANGEPLAIN", `[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`), h("XRANGEPLAINLOOSE", `[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`), h("XRANGE", `^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`), h("XRANGELOOSE", `^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`), h("COERCEPLAIN", `(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`), h("COERCE", `${c[u.COERCEPLAIN]}(?:$|[^\\d])`), h("COERCEFULL", c[u.COERCEPLAIN] + `(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`), h("COERCERTL", c[u.COERCE], !0), h("COERCERTLFULL", c[u.COERCEFULL], !0), h("LONETILDE", "(?:~>?)"), h("TILDETRIM", `(\\s*)${c[u.LONETILDE]}\\s+`, !0), e.tildeTrimReplace = "$1~", h("TILDE", `^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`), h("TILDELOOSE", `^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`), h("LONECARET", "(?:\\^)"), h("CARETTRIM", `(\\s*)${c[u.LONECARET]}\\s+`, !0), e.caretTrimReplace = "$1^", h("CARET", `^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`), h("CARETLOOSE", `^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`), h("COMPARATORLOOSE", `^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`), h("COMPARATOR", `^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`), h("COMPARATORTRIM", `(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`, !0), e.comparatorTrimReplace = "$1$2$3", h("HYPHENRANGE", `^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`), h("HYPHENRANGELOOSE", `^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`), h("STAR", "(<|>)?=?\\s*\\*"), h("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), h("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
503
|
+
})), z = /* @__PURE__ */ C(((e, t) => {
|
|
504
|
+
var n = Object.freeze({ loose: !0 }), r = Object.freeze({});
|
|
505
|
+
t.exports = (e) => e ? typeof e == "object" ? e : n : r;
|
|
506
|
+
})), Me = /* @__PURE__ */ C(((e, t) => {
|
|
507
|
+
var n = /^[0-9]+$/, r = (e, t) => {
|
|
508
|
+
if (typeof e == "number" && typeof t == "number") return e === t ? 0 : e < t ? -1 : 1;
|
|
509
|
+
let r = n.test(e), i = n.test(t);
|
|
510
|
+
return r && i && (e = +e, t = +t), e === t ? 0 : r && !i ? -1 : i && !r ? 1 : e < t ? -1 : 1;
|
|
511
|
+
};
|
|
512
|
+
t.exports = {
|
|
513
|
+
compareIdentifiers: r,
|
|
514
|
+
rcompareIdentifiers: (e, t) => r(t, e)
|
|
515
|
+
};
|
|
516
|
+
})), B = /* @__PURE__ */ C(((e, t) => {
|
|
517
|
+
var n = L(), { MAX_LENGTH: r, MAX_SAFE_INTEGER: i } = I(), { safeRe: a, t: o } = R(), s = z(), { compareIdentifiers: c } = Me(), l = (e, t) => {
|
|
518
|
+
let n = t.split(".");
|
|
519
|
+
if (n.length > e.length) return !1;
|
|
520
|
+
for (let t = 0; t < n.length; t++) if (c(e[t], n[t]) !== 0) return !1;
|
|
521
|
+
return !0;
|
|
522
|
+
};
|
|
523
|
+
t.exports = class e {
|
|
524
|
+
constructor(t, c) {
|
|
525
|
+
if (c = s(c), t instanceof e) {
|
|
526
|
+
if (t.loose === !!c.loose && t.includePrerelease === !!c.includePrerelease) return t;
|
|
527
|
+
t = t.version;
|
|
528
|
+
} else if (typeof t != "string") throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);
|
|
529
|
+
if (t.length > r) throw TypeError(`version is longer than ${r} characters`);
|
|
530
|
+
n("SemVer", t, c), this.options = c, this.loose = !!c.loose, this.includePrerelease = !!c.includePrerelease;
|
|
531
|
+
let l = t.trim().match(c.loose ? a[o.LOOSE] : a[o.FULL]);
|
|
532
|
+
if (!l) throw TypeError(`Invalid Version: ${t}`);
|
|
533
|
+
if (this.raw = t, this.major = +l[1], this.minor = +l[2], this.patch = +l[3], this.major > i || this.major < 0) throw TypeError("Invalid major version");
|
|
534
|
+
if (this.minor > i || this.minor < 0) throw TypeError("Invalid minor version");
|
|
535
|
+
if (this.patch > i || this.patch < 0) throw TypeError("Invalid patch version");
|
|
536
|
+
this.prerelease = l[4] ? l[4].split(".").map((e) => {
|
|
537
|
+
if (/^[0-9]+$/.test(e)) {
|
|
538
|
+
let t = +e;
|
|
539
|
+
if (t >= 0 && t < i) return t;
|
|
540
|
+
}
|
|
541
|
+
return e;
|
|
542
|
+
}) : [], this.build = l[5] ? l[5].split(".") : [], this.format();
|
|
543
|
+
}
|
|
544
|
+
format() {
|
|
545
|
+
return this.version = `${this.major}.${this.minor}.${this.patch}`, this.prerelease.length && (this.version += `-${this.prerelease.join(".")}`), this.version;
|
|
546
|
+
}
|
|
547
|
+
toString() {
|
|
548
|
+
return this.version;
|
|
549
|
+
}
|
|
550
|
+
compare(t) {
|
|
551
|
+
if (n("SemVer.compare", this.version, this.options, t), !(t instanceof e)) {
|
|
552
|
+
if (typeof t == "string" && t === this.version) return 0;
|
|
553
|
+
t = new e(t, this.options);
|
|
554
|
+
}
|
|
555
|
+
return t.version === this.version ? 0 : this.compareMain(t) || this.comparePre(t);
|
|
556
|
+
}
|
|
557
|
+
compareMain(t) {
|
|
558
|
+
return t instanceof e || (t = new e(t, this.options)), this.major < t.major ? -1 : this.major > t.major ? 1 : this.minor < t.minor ? -1 : this.minor > t.minor ? 1 : this.patch < t.patch ? -1 : +(this.patch > t.patch);
|
|
559
|
+
}
|
|
560
|
+
comparePre(t) {
|
|
561
|
+
if (t instanceof e || (t = new e(t, this.options)), this.prerelease.length && !t.prerelease.length) return -1;
|
|
562
|
+
if (!this.prerelease.length && t.prerelease.length) return 1;
|
|
563
|
+
if (!this.prerelease.length && !t.prerelease.length) return 0;
|
|
564
|
+
let r = 0;
|
|
565
|
+
do {
|
|
566
|
+
let e = this.prerelease[r], i = t.prerelease[r];
|
|
567
|
+
if (n("prerelease compare", r, e, i), e === void 0 && i === void 0) return 0;
|
|
568
|
+
if (i === void 0) return 1;
|
|
569
|
+
if (e === void 0) return -1;
|
|
570
|
+
if (e !== i) return c(e, i);
|
|
571
|
+
} while (++r);
|
|
572
|
+
}
|
|
573
|
+
compareBuild(t) {
|
|
120
574
|
t instanceof e || (t = new e(t, this.options));
|
|
121
575
|
let r = 0;
|
|
122
576
|
do {
|
|
@@ -186,8 +640,8 @@ var S = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
186
640
|
return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this;
|
|
187
641
|
}
|
|
188
642
|
};
|
|
189
|
-
})),
|
|
190
|
-
var n =
|
|
643
|
+
})), V = /* @__PURE__ */ C(((e, t) => {
|
|
644
|
+
var n = B();
|
|
191
645
|
t.exports = (e, t, r = !1) => {
|
|
192
646
|
if (e instanceof n) return e;
|
|
193
647
|
try {
|
|
@@ -197,20 +651,20 @@ var S = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
197
651
|
throw e;
|
|
198
652
|
}
|
|
199
653
|
};
|
|
200
|
-
})),
|
|
201
|
-
var n =
|
|
654
|
+
})), Ne = /* @__PURE__ */ C(((e, t) => {
|
|
655
|
+
var n = V();
|
|
202
656
|
t.exports = (e, t) => {
|
|
203
657
|
let r = n(e, t);
|
|
204
658
|
return r ? r.version : null;
|
|
205
659
|
};
|
|
206
|
-
})),
|
|
207
|
-
var n =
|
|
660
|
+
})), Pe = /* @__PURE__ */ C(((e, t) => {
|
|
661
|
+
var n = V();
|
|
208
662
|
t.exports = (e, t) => {
|
|
209
663
|
let r = n(e.trim().replace(/^[=v]+/, ""), t);
|
|
210
664
|
return r ? r.version : null;
|
|
211
665
|
};
|
|
212
|
-
})),
|
|
213
|
-
var n =
|
|
666
|
+
})), Fe = /* @__PURE__ */ C(((e, t) => {
|
|
667
|
+
var n = B();
|
|
214
668
|
t.exports = (e, t, r, i, a) => {
|
|
215
669
|
typeof r == "string" && (a = i, i = r, r = void 0);
|
|
216
670
|
try {
|
|
@@ -219,8 +673,8 @@ var S = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
219
673
|
return null;
|
|
220
674
|
}
|
|
221
675
|
};
|
|
222
|
-
})),
|
|
223
|
-
var n =
|
|
676
|
+
})), Ie = /* @__PURE__ */ C(((e, t) => {
|
|
677
|
+
var n = V();
|
|
224
678
|
t.exports = (e, t) => {
|
|
225
679
|
let r = n(e, null, !0), i = n(t, null, !0), a = r.compare(i);
|
|
226
680
|
if (a === 0) return null;
|
|
@@ -232,62 +686,62 @@ var S = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
232
686
|
let u = l ? "pre" : "";
|
|
233
687
|
return r.major === i.major ? r.minor === i.minor ? r.patch === i.patch ? "prerelease" : u + "patch" : u + "minor" : u + "major";
|
|
234
688
|
};
|
|
235
|
-
})),
|
|
236
|
-
var n =
|
|
689
|
+
})), Le = /* @__PURE__ */ C(((e, t) => {
|
|
690
|
+
var n = B();
|
|
237
691
|
t.exports = (e, t) => new n(e, t).major;
|
|
238
|
-
})),
|
|
239
|
-
var n =
|
|
692
|
+
})), Re = /* @__PURE__ */ C(((e, t) => {
|
|
693
|
+
var n = B();
|
|
240
694
|
t.exports = (e, t) => new n(e, t).minor;
|
|
241
|
-
})),
|
|
242
|
-
var n =
|
|
695
|
+
})), ze = /* @__PURE__ */ C(((e, t) => {
|
|
696
|
+
var n = B();
|
|
243
697
|
t.exports = (e, t) => new n(e, t).patch;
|
|
244
|
-
})),
|
|
245
|
-
var n =
|
|
698
|
+
})), Be = /* @__PURE__ */ C(((e, t) => {
|
|
699
|
+
var n = V();
|
|
246
700
|
t.exports = (e, t) => {
|
|
247
701
|
let r = n(e, t);
|
|
248
702
|
return r && r.prerelease.length ? r.prerelease : null;
|
|
249
703
|
};
|
|
250
|
-
})),
|
|
251
|
-
var n =
|
|
704
|
+
})), H = /* @__PURE__ */ C(((e, t) => {
|
|
705
|
+
var n = B();
|
|
252
706
|
t.exports = (e, t, r) => new n(e, r).compare(new n(t, r));
|
|
253
|
-
})),
|
|
254
|
-
var n =
|
|
707
|
+
})), Ve = /* @__PURE__ */ C(((e, t) => {
|
|
708
|
+
var n = H();
|
|
255
709
|
t.exports = (e, t, r) => n(t, e, r);
|
|
256
|
-
})),
|
|
257
|
-
var n =
|
|
710
|
+
})), He = /* @__PURE__ */ C(((e, t) => {
|
|
711
|
+
var n = H();
|
|
258
712
|
t.exports = (e, t) => n(e, t, !0);
|
|
259
|
-
})),
|
|
260
|
-
var n =
|
|
713
|
+
})), U = /* @__PURE__ */ C(((e, t) => {
|
|
714
|
+
var n = B();
|
|
261
715
|
t.exports = (e, t, r) => {
|
|
262
716
|
let i = new n(e, r), a = new n(t, r);
|
|
263
717
|
return i.compare(a) || i.compareBuild(a);
|
|
264
718
|
};
|
|
265
|
-
})),
|
|
266
|
-
var n =
|
|
719
|
+
})), Ue = /* @__PURE__ */ C(((e, t) => {
|
|
720
|
+
var n = U();
|
|
267
721
|
t.exports = (e, t) => e.sort((e, r) => n(e, r, t));
|
|
268
|
-
})),
|
|
269
|
-
var n =
|
|
722
|
+
})), We = /* @__PURE__ */ C(((e, t) => {
|
|
723
|
+
var n = U();
|
|
270
724
|
t.exports = (e, t) => e.sort((e, r) => n(r, e, t));
|
|
271
|
-
})),
|
|
272
|
-
var n =
|
|
725
|
+
})), W = /* @__PURE__ */ C(((e, t) => {
|
|
726
|
+
var n = H();
|
|
273
727
|
t.exports = (e, t, r) => n(e, t, r) > 0;
|
|
274
|
-
})),
|
|
275
|
-
var n =
|
|
728
|
+
})), G = /* @__PURE__ */ C(((e, t) => {
|
|
729
|
+
var n = H();
|
|
276
730
|
t.exports = (e, t, r) => n(e, t, r) < 0;
|
|
277
|
-
})),
|
|
278
|
-
var n =
|
|
731
|
+
})), Ge = /* @__PURE__ */ C(((e, t) => {
|
|
732
|
+
var n = H();
|
|
279
733
|
t.exports = (e, t, r) => n(e, t, r) === 0;
|
|
280
|
-
})),
|
|
281
|
-
var n =
|
|
734
|
+
})), Ke = /* @__PURE__ */ C(((e, t) => {
|
|
735
|
+
var n = H();
|
|
282
736
|
t.exports = (e, t, r) => n(e, t, r) !== 0;
|
|
283
|
-
})),
|
|
284
|
-
var n =
|
|
737
|
+
})), K = /* @__PURE__ */ C(((e, t) => {
|
|
738
|
+
var n = H();
|
|
285
739
|
t.exports = (e, t, r) => n(e, t, r) >= 0;
|
|
286
|
-
})),
|
|
287
|
-
var n =
|
|
740
|
+
})), q = /* @__PURE__ */ C(((e, t) => {
|
|
741
|
+
var n = H();
|
|
288
742
|
t.exports = (e, t, r) => n(e, t, r) <= 0;
|
|
289
|
-
})),
|
|
290
|
-
var n =
|
|
743
|
+
})), qe = /* @__PURE__ */ C(((e, t) => {
|
|
744
|
+
var n = Ge(), r = Ke(), i = W(), a = K(), o = G(), s = q();
|
|
291
745
|
t.exports = (e, t, c, l) => {
|
|
292
746
|
switch (t) {
|
|
293
747
|
case "===": return typeof e == "object" && (e = e.version), typeof c == "object" && (c = c.version), e === c;
|
|
@@ -303,8 +757,8 @@ var S = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
303
757
|
default: throw TypeError(`Invalid operator: ${t}`);
|
|
304
758
|
}
|
|
305
759
|
};
|
|
306
|
-
})),
|
|
307
|
-
var n =
|
|
760
|
+
})), Je = /* @__PURE__ */ C(((e, t) => {
|
|
761
|
+
var n = B(), r = V(), { safeRe: i, t: a } = R();
|
|
308
762
|
t.exports = (e, t) => {
|
|
309
763
|
if (e instanceof n) return e;
|
|
310
764
|
if (typeof e == "number" && (e = String(e)), typeof e != "string") return null;
|
|
@@ -320,8 +774,8 @@ var S = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
320
774
|
let s = o[2];
|
|
321
775
|
return r(`${s}.${o[3] || "0"}.${o[4] || "0"}${t.includePrerelease && o[5] ? `-${o[5]}` : ""}${t.includePrerelease && o[6] ? `+${o[6]}` : ""}`, t);
|
|
322
776
|
};
|
|
323
|
-
})),
|
|
324
|
-
var n =
|
|
777
|
+
})), Ye = /* @__PURE__ */ C(((e, t) => {
|
|
778
|
+
var n = V(), r = I(), i = B(), a = (e, t, n) => {
|
|
325
779
|
if (!r.RELEASE_TYPES.includes(t)) return null;
|
|
326
780
|
let i = o(e, n);
|
|
327
781
|
return i && s(i, t);
|
|
@@ -336,7 +790,7 @@ var S = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
336
790
|
return e.format();
|
|
337
791
|
}, c = (e) => e.startsWith("pre");
|
|
338
792
|
t.exports = a;
|
|
339
|
-
})),
|
|
793
|
+
})), Xe = /* @__PURE__ */ C(((e, t) => {
|
|
340
794
|
t.exports = class {
|
|
341
795
|
constructor() {
|
|
342
796
|
this.max = 1e3, this.map = /* @__PURE__ */ new Map();
|
|
@@ -359,7 +813,7 @@ var S = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
359
813
|
return this;
|
|
360
814
|
}
|
|
361
815
|
};
|
|
362
|
-
})),
|
|
816
|
+
})), J = /* @__PURE__ */ C(((e, t) => {
|
|
363
817
|
var n = /\s+/g;
|
|
364
818
|
t.exports = class e {
|
|
365
819
|
constructor(t, r) {
|
|
@@ -400,8 +854,8 @@ var S = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
400
854
|
let t = ((this.options.includePrerelease && m) | (this.options.loose && h)) + ":" + e, n = r.get(t);
|
|
401
855
|
if (n) return n;
|
|
402
856
|
let i = this.options.loose, s = i ? c[u.HYPHENRANGELOOSE] : c[u.HYPHENRANGE];
|
|
403
|
-
e = e.replace(s,
|
|
404
|
-
let l = e.split(" ").map((e) => b(e, this.options)).join(" ").split(/\s+/).map((e) =>
|
|
857
|
+
e = e.replace(s, re(this.options.includePrerelease)), o("hyphen replace", e), e = e.replace(c[u.COMPARATORTRIM], d), o("comparator trim", e), e = e.replace(c[u.TILDETRIM], f), o("tilde trim", e), e = e.replace(c[u.CARETTRIM], p), o("caret trim", e);
|
|
858
|
+
let l = e.split(" ").map((e) => b(e, this.options)).join(" ").split(/\s+/).map((e) => D(e, this.options));
|
|
405
859
|
i && (l = l.filter((e) => (o("loose invalid filter", e, this.options), !!e.match(c[u.COMPARATORLOOSE])))), o("range list", l);
|
|
406
860
|
let v = /* @__PURE__ */ new Map(), y = l.map((e) => new a(e, this.options));
|
|
407
861
|
for (let e of y) {
|
|
@@ -423,22 +877,22 @@ var S = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
423
877
|
} catch {
|
|
424
878
|
return !1;
|
|
425
879
|
}
|
|
426
|
-
for (let t = 0; t < this.set.length; t++) if (
|
|
880
|
+
for (let t = 0; t < this.set.length; t++) if (O(this.set[t], e, this.options)) return !0;
|
|
427
881
|
return !1;
|
|
428
882
|
}
|
|
429
883
|
};
|
|
430
|
-
var r = new (
|
|
884
|
+
var r = new (Xe())(), i = z(), a = Y(), o = L(), s = B(), { safeRe: c, src: l, t: u, comparatorTrimReplace: d, tildeTrimReplace: f, caretTrimReplace: p } = R(), { FLAG_INCLUDE_PRERELEASE: m, FLAG_LOOSE: h } = I(), g = new RegExp(l[u.BUILD], "g"), _ = (e) => e.value === "<0.0.0-0", v = (e) => e.value === "", y = (e, t) => {
|
|
431
885
|
let n = !0, r = e.slice(), i = r.pop();
|
|
432
886
|
for (; n && r.length;) n = r.every((e) => i.intersects(e, t)), i = r.pop();
|
|
433
887
|
return n;
|
|
434
|
-
}, b = (e, t) => (e = e.replace(c[u.BUILD], ""), o("comp", e, t), e =
|
|
888
|
+
}, b = (e, t) => (e = e.replace(c[u.BUILD], ""), o("comp", e, t), e = C(e, t), o("caret", e), e = S(e, t), o("tildes", e), e = T(e, t), o("xrange", e), e = ne(e, t), o("stars", e), e), x = (e) => !e || e.toLowerCase() === "x" || e === "*", ee = (e, t, n) => x(e) && !x(t) || x(t) && n && !x(n), S = (e, t) => e.trim().split(/\s+/).map((e) => te(e, t)).join(" "), te = (e, t) => {
|
|
435
889
|
let n = t.loose ? c[u.TILDELOOSE] : c[u.TILDE], r = t.includePrerelease ? "-0" : "";
|
|
436
890
|
return e.replace(n, (t, n, i, a, s) => {
|
|
437
891
|
o("tilde", e, t, n, i, a, s);
|
|
438
892
|
let c;
|
|
439
893
|
return x(n) ? c = "" : x(i) ? c = `>=${n}.0.0${r} <${+n + 1}.0.0-0` : x(a) ? c = `>=${n}.${i}.0${r} <${n}.${+i + 1}.0-0` : s ? (o("replaceTilde pr", s), c = `>=${n}.${i}.${a}-${s} <${n}.${+i + 1}.0-0`) : c = `>=${n}.${i}.${a} <${n}.${+i + 1}.0-0`, o("tilde return", c), c;
|
|
440
894
|
});
|
|
441
|
-
},
|
|
895
|
+
}, C = (e, t) => e.trim().split(/\s+/).map((e) => w(e, t)).join(" "), w = (e, t) => {
|
|
442
896
|
o("caret", e, t);
|
|
443
897
|
let n = t.loose ? c[u.CARETLOOSE] : c[u.CARET], r = t.includePrerelease ? "-0" : "";
|
|
444
898
|
return e.replace(n, (t, n, i, a, s) => {
|
|
@@ -446,7 +900,7 @@ var S = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
446
900
|
let c;
|
|
447
901
|
return x(n) ? c = "" : x(i) ? c = `>=${n}.0.0${r} <${+n + 1}.0.0-0` : x(a) ? c = n === "0" ? `>=${n}.${i}.0${r} <${n}.${+i + 1}.0-0` : `>=${n}.${i}.0${r} <${+n + 1}.0.0-0` : s ? (o("replaceCaret pr", s), c = n === "0" ? i === "0" ? `>=${n}.${i}.${a}-${s} <${n}.${i}.${+a + 1}-0` : `>=${n}.${i}.${a}-${s} <${n}.${+i + 1}.0-0` : `>=${n}.${i}.${a}-${s} <${+n + 1}.0.0-0`) : (o("no pr"), c = n === "0" ? i === "0" ? `>=${n}.${i}.${a} <${n}.${i}.${+a + 1}-0` : `>=${n}.${i}.${a} <${n}.${+i + 1}.0-0` : `>=${n}.${i}.${a} <${+n + 1}.0.0-0`), o("caret return", c), c;
|
|
448
902
|
});
|
|
449
|
-
},
|
|
903
|
+
}, T = (e, t) => (o("replaceXRanges", e, t), e.split(/\s+/).map((e) => E(e, t)).join(" ")), E = (e, t) => {
|
|
450
904
|
e = e.trim();
|
|
451
905
|
let n = t.loose ? c[u.XRANGELOOSE] : c[u.XRANGE];
|
|
452
906
|
return e.replace(n, (n, r, i, a, s, c) => {
|
|
@@ -454,7 +908,7 @@ var S = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
454
908
|
let l = x(i), u = l || x(a), d = u || x(s), f = d;
|
|
455
909
|
return r === "=" && f && (r = ""), c = t.includePrerelease ? "-0" : "", l ? n = r === ">" || r === "<" ? "<0.0.0-0" : "*" : r && f ? (u && (a = 0), s = 0, r === ">" ? (r = ">=", u ? (i = +i + 1, a = 0, s = 0) : (a = +a + 1, s = 0)) : r === "<=" && (r = "<", u ? i = +i + 1 : a = +a + 1), r === "<" && (c = "-0"), n = `${r + i}.${a}.${s}${c}`) : u ? n = `>=${i}.0.0${c} <${+i + 1}.0.0-0` : d && (n = `>=${i}.${a}.0${c} <${i}.${+a + 1}.0-0`), o("xRange return", n), n;
|
|
456
910
|
});
|
|
457
|
-
},
|
|
911
|
+
}, ne = (e, t) => (o("replaceStars", e, t), e.trim().replace(c[u.STAR], "")), D = (e, t) => (o("replaceGTE0", e, t), e.trim().replace(c[t.includePrerelease ? u.GTE0PRE : u.GTE0], "")), re = (e) => (t, n, r, i, a, o, s, c, l, u, d, f) => (n = x(r) ? "" : x(i) ? `>=${r}.0.0${e ? "-0" : ""}` : x(a) ? `>=${r}.${i}.0${e ? "-0" : ""}` : o ? `>=${n}` : `>=${n}${e ? "-0" : ""}`, c = x(l) ? "" : x(u) ? `<${+l + 1}.0.0-0` : x(d) ? `<${l}.${+u + 1}.0-0` : f ? `<=${l}.${u}.${d}-${f}` : e ? `<${l}.${u}.${+d + 1}-0` : `<=${c}`, `${n} ${c}`.trim()), O = (e, t, n) => {
|
|
458
912
|
for (let n = 0; n < e.length; n++) if (!e[n].test(t)) return !1;
|
|
459
913
|
if (t.prerelease.length && !n.includePrerelease) {
|
|
460
914
|
for (let n = 0; n < e.length; n++) if (o(e[n].semver), e[n].semver !== a.ANY && e[n].semver.prerelease.length > 0) {
|
|
@@ -465,7 +919,7 @@ var S = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
465
919
|
}
|
|
466
920
|
return !0;
|
|
467
921
|
};
|
|
468
|
-
})),
|
|
922
|
+
})), Y = /* @__PURE__ */ C(((e, t) => {
|
|
469
923
|
var n = Symbol("SemVer ANY");
|
|
470
924
|
t.exports = class e {
|
|
471
925
|
static get ANY() {
|
|
@@ -483,658 +937,272 @@ var S = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e
|
|
|
483
937
|
if (!r) throw TypeError(`Invalid comparator: ${e}`);
|
|
484
938
|
this.operator = r[1] === void 0 ? "" : r[1], this.operator === "=" && (this.operator = ""), this.semver = r[2] ? new c(r[2], this.options.loose) : n;
|
|
485
939
|
}
|
|
486
|
-
toString() {
|
|
487
|
-
return this.value;
|
|
488
|
-
}
|
|
489
|
-
test(e) {
|
|
490
|
-
if (s("Comparator.test", e, this.options.loose), this.semver === n || e === n) return !0;
|
|
491
|
-
if (typeof e == "string") try {
|
|
492
|
-
e = new c(e, this.options);
|
|
493
|
-
} catch {
|
|
494
|
-
return !1;
|
|
495
|
-
}
|
|
496
|
-
return o(e, this.operator, this.semver, this.options);
|
|
497
|
-
}
|
|
498
|
-
intersects(t, n) {
|
|
499
|
-
if (!(t instanceof e)) throw TypeError("a Comparator is required");
|
|
500
|
-
return this.operator === "" ? this.value === "" || new l(t.value, n).test(this.value) : t.operator === "" ? t.value === "" || new l(this.value, n).test(t.semver) : (n = r(n), n.includePrerelease && (this.value === "<0.0.0-0" || t.value === "<0.0.0-0") || !n.includePrerelease && (this.value.startsWith("<0.0.0") || t.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && t.operator.startsWith(">") || this.operator.startsWith("<") && t.operator.startsWith("<") || this.semver.version === t.semver.version && this.operator.includes("=") && t.operator.includes("=") || o(this.semver, "<", t.semver, n) && this.operator.startsWith(">") && t.operator.startsWith("<") || o(this.semver, ">", t.semver, n) && this.operator.startsWith("<") && t.operator.startsWith(">")));
|
|
501
|
-
}
|
|
502
|
-
};
|
|
503
|
-
var r = E(), { safeRe: i, t: a } = T(), o = B(), s = w(), c = O(), l = V();
|
|
504
|
-
})), U = /* @__PURE__ */ S(((e, t) => {
|
|
505
|
-
var n = V();
|
|
506
|
-
t.exports = (e, t, r) => {
|
|
507
|
-
try {
|
|
508
|
-
t = new n(t, r);
|
|
509
|
-
} catch {
|
|
510
|
-
return !1;
|
|
511
|
-
}
|
|
512
|
-
return t.test(e);
|
|
513
|
-
};
|
|
514
|
-
})), ge = /* @__PURE__ */ S(((e, t) => {
|
|
515
|
-
var n = V();
|
|
516
|
-
t.exports = (e, t) => new n(e, t).set.map((e) => e.map((e) => e.value).join(" ").trim().split(" "));
|
|
517
|
-
})), _e = /* @__PURE__ */ S(((e, t) => {
|
|
518
|
-
var n = O(), r = V();
|
|
519
|
-
t.exports = (e, t, i) => {
|
|
520
|
-
let a = null, o = null, s = null;
|
|
521
|
-
try {
|
|
522
|
-
s = new r(t, i);
|
|
523
|
-
} catch {
|
|
524
|
-
return null;
|
|
525
|
-
}
|
|
526
|
-
return e.forEach((e) => {
|
|
527
|
-
s.test(e) && (!a || o.compare(e) === -1) && (a = e, o = new n(a, i));
|
|
528
|
-
}), a;
|
|
529
|
-
};
|
|
530
|
-
})), ve = /* @__PURE__ */ S(((e, t) => {
|
|
531
|
-
var n = O(), r = V();
|
|
532
|
-
t.exports = (e, t, i) => {
|
|
533
|
-
let a = null, o = null, s = null;
|
|
534
|
-
try {
|
|
535
|
-
s = new r(t, i);
|
|
536
|
-
} catch {
|
|
537
|
-
return null;
|
|
538
|
-
}
|
|
539
|
-
return e.forEach((e) => {
|
|
540
|
-
s.test(e) && (!a || o.compare(e) === 1) && (a = e, o = new n(a, i));
|
|
541
|
-
}), a;
|
|
542
|
-
};
|
|
543
|
-
})), ye = /* @__PURE__ */ S(((e, t) => {
|
|
544
|
-
var n = O(), r = V(), i = F();
|
|
545
|
-
t.exports = (e, t) => {
|
|
546
|
-
e = new r(e, t);
|
|
547
|
-
let a = new n("0.0.0");
|
|
548
|
-
if (e.test(a) || (a = new n("0.0.0-0"), e.test(a))) return a;
|
|
549
|
-
a = null;
|
|
550
|
-
for (let t = 0; t < e.set.length; ++t) {
|
|
551
|
-
let r = e.set[t], o = null;
|
|
552
|
-
r.forEach((e) => {
|
|
553
|
-
let t = new n(e.semver.version);
|
|
554
|
-
switch (e.operator) {
|
|
555
|
-
case ">": t.prerelease.length === 0 ? t.patch++ : t.prerelease.push(0), t.raw = t.format();
|
|
556
|
-
case "":
|
|
557
|
-
case ">=":
|
|
558
|
-
(!o || i(t, o)) && (o = t);
|
|
559
|
-
break;
|
|
560
|
-
case "<":
|
|
561
|
-
case "<=": break;
|
|
562
|
-
/* istanbul ignore next */
|
|
563
|
-
default: throw Error(`Unexpected operation: ${e.operator}`);
|
|
564
|
-
}
|
|
565
|
-
}), o && (!a || i(a, o)) && (a = o);
|
|
566
|
-
}
|
|
567
|
-
return a && e.test(a) ? a : null;
|
|
568
|
-
};
|
|
569
|
-
})), be = /* @__PURE__ */ S(((e, t) => {
|
|
570
|
-
var n = V();
|
|
571
|
-
t.exports = (e, t) => {
|
|
572
|
-
try {
|
|
573
|
-
return new n(e, t).range || "*";
|
|
574
|
-
} catch {
|
|
575
|
-
return null;
|
|
576
|
-
}
|
|
577
|
-
};
|
|
578
|
-
})), W = /* @__PURE__ */ S(((e, t) => {
|
|
579
|
-
var n = O(), r = H(), { ANY: i } = r, a = V(), o = U(), s = F(), c = I(), l = z(), u = R();
|
|
580
|
-
t.exports = (e, t, d, f) => {
|
|
581
|
-
e = new n(e, f), t = new a(t, f);
|
|
582
|
-
let p, m, h, g, _;
|
|
583
|
-
switch (d) {
|
|
584
|
-
case ">":
|
|
585
|
-
p = s, m = l, h = c, g = ">", _ = ">=";
|
|
586
|
-
break;
|
|
587
|
-
case "<":
|
|
588
|
-
p = c, m = u, h = s, g = "<", _ = "<=";
|
|
589
|
-
break;
|
|
590
|
-
default: throw TypeError("Must provide a hilo val of \"<\" or \">\"");
|
|
591
|
-
}
|
|
592
|
-
if (o(e, t, f)) return !1;
|
|
593
|
-
for (let n = 0; n < t.set.length; ++n) {
|
|
594
|
-
let a = t.set[n], o = null, s = null;
|
|
595
|
-
if (a.forEach((e) => {
|
|
596
|
-
e.semver === i && (e = new r(">=0.0.0")), o ||= e, s ||= e, p(e.semver, o.semver, f) ? o = e : h(e.semver, s.semver, f) && (s = e);
|
|
597
|
-
}), o.operator === g || o.operator === _ || (!s.operator || s.operator === g) && m(e, s.semver) || s.operator === _ && h(e, s.semver)) return !1;
|
|
598
|
-
}
|
|
599
|
-
return !0;
|
|
600
|
-
};
|
|
601
|
-
})), xe = /* @__PURE__ */ S(((e, t) => {
|
|
602
|
-
var n = W();
|
|
603
|
-
t.exports = (e, t, r) => n(e, t, ">", r);
|
|
604
|
-
})), Se = /* @__PURE__ */ S(((e, t) => {
|
|
605
|
-
var n = W();
|
|
606
|
-
t.exports = (e, t, r) => n(e, t, "<", r);
|
|
607
|
-
})), Ce = /* @__PURE__ */ S(((e, t) => {
|
|
608
|
-
var n = V();
|
|
609
|
-
t.exports = (e, t, r) => (e = new n(e, r), t = new n(t, r), e.intersects(t, r));
|
|
610
|
-
})), we = /* @__PURE__ */ S(((e, t) => {
|
|
611
|
-
var n = U(), r = N();
|
|
612
|
-
t.exports = (e, t, i) => {
|
|
613
|
-
let a = [], o = null, s = null, c = e.sort((e, t) => r(e, t, i));
|
|
614
|
-
for (let e of c) n(e, t, i) ? (s = e, o ||= e) : (s && a.push([o, s]), s = null, o = null);
|
|
615
|
-
o && a.push([o, null]);
|
|
616
|
-
let l = [];
|
|
617
|
-
for (let [e, t] of a) e === t ? l.push(e) : !t && e === c[0] ? l.push("*") : t ? e === c[0] ? l.push(`<=${t}`) : l.push(`${e} - ${t}`) : l.push(`>=${e}`);
|
|
618
|
-
let u = l.join(" || "), d = typeof t.raw == "string" ? t.raw : String(t);
|
|
619
|
-
return u.length < d.length ? u : t;
|
|
620
|
-
};
|
|
621
|
-
})), Te = /* @__PURE__ */ S(((e, t) => {
|
|
622
|
-
var n = V(), r = H(), { ANY: i } = r, a = U(), o = N(), s = (e, t, r = {}) => {
|
|
623
|
-
if (e === t) return !0;
|
|
624
|
-
e = new n(e, r), t = new n(t, r);
|
|
625
|
-
let i = !1;
|
|
626
|
-
OUTER: for (let n of e.set) {
|
|
627
|
-
for (let e of t.set) {
|
|
628
|
-
let t = u(n, e, r);
|
|
629
|
-
if (i ||= t !== null, t) continue OUTER;
|
|
630
|
-
}
|
|
631
|
-
if (i) return !1;
|
|
632
|
-
}
|
|
633
|
-
return !0;
|
|
634
|
-
}, c = [new r(">=0.0.0-0")], l = [new r(">=0.0.0")], u = (e, t, n) => {
|
|
635
|
-
if (e === t) return !0;
|
|
636
|
-
if (e.length === 1 && e[0].semver === i) {
|
|
637
|
-
if (t.length === 1 && t[0].semver === i) return !0;
|
|
638
|
-
e = n.includePrerelease ? c : l;
|
|
639
|
-
}
|
|
640
|
-
if (t.length === 1 && t[0].semver === i) {
|
|
641
|
-
if (n.includePrerelease) return !0;
|
|
642
|
-
t = l;
|
|
643
|
-
}
|
|
644
|
-
let r = /* @__PURE__ */ new Set(), s, u;
|
|
645
|
-
for (let t of e) t.operator === ">" || t.operator === ">=" ? s = d(s, t, n) : t.operator === "<" || t.operator === "<=" ? u = f(u, t, n) : r.add(t.semver);
|
|
646
|
-
if (r.size > 1) return null;
|
|
647
|
-
let p;
|
|
648
|
-
if (s && u && (p = o(s.semver, u.semver, n), p > 0 || p === 0 && (s.operator !== ">=" || u.operator !== "<="))) return null;
|
|
649
|
-
for (let e of r) {
|
|
650
|
-
if (s && !a(e, String(s), n) || u && !a(e, String(u), n)) return null;
|
|
651
|
-
for (let r of t) if (!a(e, String(r), n)) return !1;
|
|
652
|
-
return !0;
|
|
653
|
-
}
|
|
654
|
-
let m, h, g, _, v = u && !n.includePrerelease && u.semver.prerelease.length ? u.semver : !1, y = s && !n.includePrerelease && s.semver.prerelease.length ? s.semver : !1;
|
|
655
|
-
v && v.prerelease.length === 1 && u.operator === "<" && v.prerelease[0] === 0 && (v = !1);
|
|
656
|
-
for (let e of t) {
|
|
657
|
-
if (_ = _ || e.operator === ">" || e.operator === ">=", g = g || e.operator === "<" || e.operator === "<=", s) {
|
|
658
|
-
if (y && e.semver.prerelease && e.semver.prerelease.length && e.semver.major === y.major && e.semver.minor === y.minor && e.semver.patch === y.patch && (y = !1), e.operator === ">" || e.operator === ">=") {
|
|
659
|
-
if (m = d(s, e, n), m === e && m !== s) return !1;
|
|
660
|
-
} else if (s.operator === ">=" && !e.test(s.semver)) return !1;
|
|
661
|
-
}
|
|
662
|
-
if (u) {
|
|
663
|
-
if (v && e.semver.prerelease && e.semver.prerelease.length && e.semver.major === v.major && e.semver.minor === v.minor && e.semver.patch === v.patch && (v = !1), e.operator === "<" || e.operator === "<=") {
|
|
664
|
-
if (h = f(u, e, n), h === e && h !== u) return !1;
|
|
665
|
-
} else if (u.operator === "<=" && !e.test(u.semver)) return !1;
|
|
666
|
-
}
|
|
667
|
-
if (!e.operator && (u || s) && p !== 0) return !1;
|
|
668
|
-
}
|
|
669
|
-
return !(s && g && !u && p !== 0 || u && _ && !s && p !== 0 || y || v);
|
|
670
|
-
}, d = (e, t, n) => {
|
|
671
|
-
if (!e) return t;
|
|
672
|
-
let r = o(e.semver, t.semver, n);
|
|
673
|
-
return r > 0 ? e : r < 0 || t.operator === ">" && e.operator === ">=" ? t : e;
|
|
674
|
-
}, f = (e, t, n) => {
|
|
675
|
-
if (!e) return t;
|
|
676
|
-
let r = o(e.semver, t.semver, n);
|
|
677
|
-
return r < 0 ? e : r > 0 || t.operator === "<" && e.operator === "<=" ? t : e;
|
|
678
|
-
};
|
|
679
|
-
t.exports = s;
|
|
680
|
-
})), Ee = (/* @__PURE__ */ S(((e, t) => {
|
|
681
|
-
var n = T(), r = C(), i = O(), a = D();
|
|
682
|
-
t.exports = {
|
|
683
|
-
parse: k(),
|
|
684
|
-
valid: re(),
|
|
685
|
-
clean: A(),
|
|
686
|
-
inc: j(),
|
|
687
|
-
diff: M(),
|
|
688
|
-
major: ie(),
|
|
689
|
-
minor: ae(),
|
|
690
|
-
patch: oe(),
|
|
691
|
-
prerelease: se(),
|
|
692
|
-
compare: N(),
|
|
693
|
-
rcompare: ce(),
|
|
694
|
-
compareLoose: le(),
|
|
695
|
-
compareBuild: P(),
|
|
696
|
-
sort: ue(),
|
|
697
|
-
rsort: de(),
|
|
698
|
-
gt: F(),
|
|
699
|
-
lt: I(),
|
|
700
|
-
eq: fe(),
|
|
701
|
-
neq: L(),
|
|
702
|
-
gte: R(),
|
|
703
|
-
lte: z(),
|
|
704
|
-
cmp: B(),
|
|
705
|
-
coerce: pe(),
|
|
706
|
-
truncate: me(),
|
|
707
|
-
Comparator: H(),
|
|
708
|
-
Range: V(),
|
|
709
|
-
satisfies: U(),
|
|
710
|
-
toComparators: ge(),
|
|
711
|
-
maxSatisfying: _e(),
|
|
712
|
-
minSatisfying: ve(),
|
|
713
|
-
minVersion: ye(),
|
|
714
|
-
validRange: be(),
|
|
715
|
-
outside: W(),
|
|
716
|
-
gtr: xe(),
|
|
717
|
-
ltr: Se(),
|
|
718
|
-
intersects: Ce(),
|
|
719
|
-
simplifyRange: we(),
|
|
720
|
-
subset: Te(),
|
|
721
|
-
SemVer: i,
|
|
722
|
-
re: n.re,
|
|
723
|
-
src: n.src,
|
|
724
|
-
tokens: n.t,
|
|
725
|
-
SEMVER_SPEC_VERSION: r.SEMVER_SPEC_VERSION,
|
|
726
|
-
RELEASE_TYPES: r.RELEASE_TYPES,
|
|
727
|
-
compareIdentifiers: a.compareIdentifiers,
|
|
728
|
-
rcompareIdentifiers: a.rcompareIdentifiers
|
|
729
|
-
};
|
|
730
|
-
})))(), De = (e) => e, Oe = (e) => e, ke = {
|
|
731
|
-
now: () => Date.now(),
|
|
732
|
-
setTimeout: (e, t) => De(globalThis.setTimeout(e, t)),
|
|
733
|
-
clearTimeout: (e) => globalThis.clearTimeout(Oe(e)),
|
|
734
|
-
setInterval: (e, t) => De(globalThis.setInterval(e, t)),
|
|
735
|
-
clearInterval: (e) => globalThis.clearInterval(Oe(e))
|
|
736
|
-
}, Ae = 262144e3, je = 3e4, Me = 3e3;
|
|
737
|
-
function Ne(e) {
|
|
738
|
-
let t = h(b(import.meta.url));
|
|
739
|
-
return [g(t, `${e}.js`), g(t, `${e}.ts`)].find((e) => s(e)) ?? null;
|
|
740
|
-
}
|
|
741
|
-
function G(e, t) {
|
|
742
|
-
let n = Ne("introspect");
|
|
743
|
-
if (!n) return {
|
|
744
|
-
ok: !1,
|
|
745
|
-
reason: "introspect not found next to the sdk"
|
|
746
|
-
};
|
|
747
|
-
let r = ne(process.execPath, [
|
|
748
|
-
"--conditions",
|
|
749
|
-
"browser",
|
|
750
|
-
n,
|
|
751
|
-
e
|
|
752
|
-
], {
|
|
753
|
-
encoding: "utf-8",
|
|
754
|
-
timeout: t?.timeoutMs ?? je
|
|
755
|
-
});
|
|
756
|
-
if (r.error) return {
|
|
757
|
-
ok: !1,
|
|
758
|
-
reason: r.error.message
|
|
759
|
-
};
|
|
760
|
-
if (r.status !== 0) return {
|
|
761
|
-
ok: !1,
|
|
762
|
-
reason: (r.stderr || "").trim().split("\n")[0] || `exit ${r.status}`
|
|
763
|
-
};
|
|
764
|
-
try {
|
|
765
|
-
return {
|
|
766
|
-
ok: !0,
|
|
767
|
-
value: JSON.parse(r.stdout)
|
|
768
|
-
};
|
|
769
|
-
} catch {
|
|
770
|
-
return {
|
|
771
|
-
ok: !1,
|
|
772
|
-
reason: "introspect returned unparseable output"
|
|
773
|
-
};
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
function Pe(e) {
|
|
777
|
-
let t = te(process.execPath, [
|
|
778
|
-
"--conditions",
|
|
779
|
-
"browser",
|
|
780
|
-
e
|
|
781
|
-
], { stdio: [
|
|
782
|
-
"pipe",
|
|
783
|
-
"pipe",
|
|
784
|
-
"inherit"
|
|
785
|
-
] });
|
|
786
|
-
return {
|
|
787
|
-
write(e) {
|
|
788
|
-
return t.stdin?.writable ? (t.stdin.write(e), !0) : !1;
|
|
789
|
-
},
|
|
790
|
-
onLine(e) {
|
|
791
|
-
let n = "";
|
|
792
|
-
t.stdout?.setEncoding("utf-8"), t.stdout?.on("data", (t) => {
|
|
793
|
-
n += t;
|
|
794
|
-
let r = n.indexOf("\n");
|
|
795
|
-
for (; r >= 0;) {
|
|
796
|
-
let t = n.slice(0, r).trim();
|
|
797
|
-
n = n.slice(r + 1), t && e(t), r = n.indexOf("\n");
|
|
798
|
-
}
|
|
799
|
-
});
|
|
800
|
-
},
|
|
801
|
-
onExit(e) {
|
|
802
|
-
t.on("error", (t) => e(t.message)), t.on("exit", (t, n) => e(`introspect worker exited (${n ?? `code ${t}`})`));
|
|
803
|
-
},
|
|
804
|
-
kill() {
|
|
805
|
-
t.kill();
|
|
806
|
-
},
|
|
807
|
-
get pid() {
|
|
808
|
-
return t.pid ?? null;
|
|
809
|
-
}
|
|
810
|
-
};
|
|
811
|
-
}
|
|
812
|
-
function Fe(e) {
|
|
813
|
-
return {
|
|
814
|
-
introspect: async (t) => G(t, { timeoutMs: e }),
|
|
815
|
-
dispose: async () => {},
|
|
816
|
-
childPid: null
|
|
817
|
-
};
|
|
818
|
-
}
|
|
819
|
-
function Ie(e) {
|
|
820
|
-
if (process.env.GLASSHOME_WIDGET_NO_WORKER === "1") return Fe(e?.timeoutMs);
|
|
821
|
-
let t = e?.rssLimitBytes ?? Ae, n = e?.timeoutMs ?? je, r = e?.slowMs ?? Me, i = e?.clock ?? ke, a = e?.spawnWorker ?? Pe, o = null, s = !1, c = 0, l = Promise.resolve();
|
|
822
|
-
function u(e, t) {
|
|
823
|
-
for (let n of e.pending.values()) n({
|
|
824
|
-
ok: !1,
|
|
825
|
-
reason: t
|
|
826
|
-
});
|
|
827
|
-
e.pending.clear();
|
|
828
|
-
}
|
|
829
|
-
function d(e, t) {
|
|
830
|
-
o === e && (o = null), u(e, t), e.proc.kill();
|
|
831
|
-
}
|
|
832
|
-
function f(e, n) {
|
|
833
|
-
let i;
|
|
834
|
-
try {
|
|
835
|
-
i = JSON.parse(n);
|
|
836
|
-
} catch {
|
|
837
|
-
return;
|
|
838
|
-
}
|
|
839
|
-
if (typeof i.id != "number") return;
|
|
840
|
-
let a = e.pending.get(i.id);
|
|
841
|
-
a && (e.pending.delete(i.id), (i.rss ?? 0) > t && (e.retireAfterRequest = !0), (i.importMs ?? 0) > r && console.warn(`[widget-sdk] introspection took ${i.importMs}ms`), a(i.ok ? {
|
|
842
|
-
ok: !0,
|
|
843
|
-
value: i.value
|
|
844
|
-
} : {
|
|
845
|
-
ok: !1,
|
|
846
|
-
reason: i.reason ?? "introspection failed"
|
|
847
|
-
}));
|
|
848
|
-
}
|
|
849
|
-
function p(e) {
|
|
850
|
-
let t = i.now(), n = {
|
|
851
|
-
proc: a(e),
|
|
852
|
-
ready: Promise.resolve(),
|
|
853
|
-
pending: /* @__PURE__ */ new Map(),
|
|
854
|
-
retireAfterRequest: !1
|
|
855
|
-
};
|
|
856
|
-
return n.ready = new Promise((e, a) => {
|
|
857
|
-
let s = !1;
|
|
858
|
-
n.proc.onLine((a) => {
|
|
859
|
-
if (!s && a.includes("\"ready\"")) {
|
|
860
|
-
s = !0;
|
|
861
|
-
let n = i.now() - t;
|
|
862
|
-
n > r && console.warn(`[widget-sdk] introspect worker took ${n}ms to boot`), e();
|
|
863
|
-
} else f(n, a);
|
|
864
|
-
}), n.proc.onExit((e) => {
|
|
865
|
-
s || a(Error(e)), o === n && (o = null), u(n, e);
|
|
866
|
-
});
|
|
867
|
-
}), n;
|
|
868
|
-
}
|
|
869
|
-
async function m(e) {
|
|
870
|
-
if (s) return {
|
|
871
|
-
ok: !1,
|
|
872
|
-
reason: "introspect session disposed"
|
|
873
|
-
};
|
|
874
|
-
let t = Ne("introspect-worker");
|
|
875
|
-
if (!t) return {
|
|
876
|
-
ok: !1,
|
|
877
|
-
reason: "introspect-worker not found next to the sdk"
|
|
878
|
-
};
|
|
879
|
-
o?.retireAfterRequest && d(o, "worker was replaced");
|
|
880
|
-
let r = o ??= p(t);
|
|
881
|
-
try {
|
|
882
|
-
await r.ready;
|
|
883
|
-
} catch (e) {
|
|
884
|
-
return {
|
|
885
|
-
ok: !1,
|
|
886
|
-
reason: e instanceof Error ? e.message : String(e)
|
|
887
|
-
};
|
|
888
|
-
}
|
|
889
|
-
let a = ++c;
|
|
890
|
-
return new Promise((t) => {
|
|
891
|
-
let o = i.setTimeout(() => {
|
|
892
|
-
r.pending.delete(a), d(r, `introspection timed out after ${n}ms`), t({
|
|
893
|
-
ok: !1,
|
|
894
|
-
reason: `introspection timed out after ${n}ms`
|
|
895
|
-
});
|
|
896
|
-
}, n);
|
|
897
|
-
r.pending.set(a, (e) => {
|
|
898
|
-
i.clearTimeout(o), t(e);
|
|
899
|
-
});
|
|
900
|
-
try {
|
|
901
|
-
if (!r.proc.write(`${JSON.stringify({
|
|
902
|
-
id: a,
|
|
903
|
-
outFile: e
|
|
904
|
-
})}\n`)) throw Error("introspect worker is not writable");
|
|
905
|
-
} catch (e) {
|
|
906
|
-
i.clearTimeout(o), r.pending.delete(a), r.retireAfterRequest = !0, t({
|
|
907
|
-
ok: !1,
|
|
908
|
-
reason: e instanceof Error ? e.message : String(e)
|
|
909
|
-
});
|
|
910
|
-
}
|
|
911
|
-
});
|
|
912
|
-
}
|
|
913
|
-
return {
|
|
914
|
-
introspect(e) {
|
|
915
|
-
let t = l.then(() => m(e));
|
|
916
|
-
return l = t.catch(() => void 0), t;
|
|
917
|
-
},
|
|
918
|
-
async dispose() {
|
|
919
|
-
s = !0, o && d(o, "introspect session disposed");
|
|
920
|
-
},
|
|
921
|
-
get childPid() {
|
|
922
|
-
return o?.proc.pid ?? null;
|
|
923
|
-
}
|
|
924
|
-
};
|
|
925
|
-
}
|
|
926
|
-
//#endregion
|
|
927
|
-
//#region src/vite/index.ts
|
|
928
|
-
var K = 2;
|
|
929
|
-
function q(e) {
|
|
930
|
-
if (Array.isArray(e)) return `[${e.map(q).join(",")}]`;
|
|
931
|
-
if (typeof e == "object" && e) {
|
|
932
|
-
let t = e;
|
|
933
|
-
return `{${Object.keys(t).sort().filter((e) => t[e] !== void 0).map((e) => `${JSON.stringify(e)}:${q(t[e])}`).join(",")}}`;
|
|
934
|
-
}
|
|
935
|
-
return JSON.stringify(e) ?? "null";
|
|
936
|
-
}
|
|
937
|
-
function Le(e) {
|
|
938
|
-
return o("sha256").update(q(e)).digest("hex").slice(0, 16);
|
|
939
|
-
}
|
|
940
|
-
var Re = 20;
|
|
941
|
-
async function ze(e, t) {
|
|
942
|
-
if (e === void 0) return;
|
|
943
|
-
let n;
|
|
944
|
-
try {
|
|
945
|
-
({z: n} = await import("zod"));
|
|
946
|
-
} catch {
|
|
947
|
-
return;
|
|
948
|
-
}
|
|
949
|
-
let r = n.number().int().positive(), i = n.array(n.object({
|
|
950
|
-
config: n.record(n.string(), n.unknown()),
|
|
951
|
-
size: n.object({
|
|
952
|
-
w: r,
|
|
953
|
-
h: r
|
|
954
|
-
}),
|
|
955
|
-
label: n.string().optional()
|
|
956
|
-
})).max(20).safeParse(e);
|
|
957
|
-
if (i.success) return;
|
|
958
|
-
let a = i.error.issues.map((e) => ` examples${e.path.length ? `[${e.path.join("][")}]` : ""}: ${e.message}`).join("\n");
|
|
959
|
-
throw Error(`[widget-sdk] Invalid \`examples\` for "${t}":\n${a}\nEach example needs a \`config\` object and a \`size\` of whole positive tiles, and at most 20 are rendered.`);
|
|
960
|
-
}
|
|
961
|
-
function Be(e, t) {
|
|
962
|
-
if (!e?.length) return;
|
|
963
|
-
let n = e.map((e) => {
|
|
964
|
-
let t = e.label ? `"${e.label}"` : `#${e.index}`;
|
|
965
|
-
return [` examples[${e.index}] ${t}:`, ...e.problems.map((e) => ` ${e}`)].join("\n");
|
|
966
|
-
}).join("\n");
|
|
967
|
-
throw Error(`[widget-sdk] Example config rejected by "${t}"'s own configSchema:\n${n}\nEach example's \`config\` must be a config the widget would actually accept, or its preview renders empty.`);
|
|
968
|
-
}
|
|
969
|
-
var Ve = [
|
|
970
|
-
"schema",
|
|
971
|
-
"defaultConfig",
|
|
972
|
-
"examples",
|
|
973
|
-
"configVersion",
|
|
974
|
-
"defaultSize",
|
|
975
|
-
"capabilities",
|
|
976
|
-
"name",
|
|
977
|
-
"description",
|
|
978
|
-
"icon",
|
|
979
|
-
"minSize",
|
|
980
|
-
"maxSize"
|
|
981
|
-
];
|
|
982
|
-
function He(e, t, n) {
|
|
983
|
-
let r = l(e, "utf-8"), i = JSON.parse(r), a = {
|
|
984
|
-
...t.manifest ?? {},
|
|
985
|
-
schema: n
|
|
940
|
+
toString() {
|
|
941
|
+
return this.value;
|
|
942
|
+
}
|
|
943
|
+
test(e) {
|
|
944
|
+
if (s("Comparator.test", e, this.options.loose), this.semver === n || e === n) return !0;
|
|
945
|
+
if (typeof e == "string") try {
|
|
946
|
+
e = new c(e, this.options);
|
|
947
|
+
} catch {
|
|
948
|
+
return !1;
|
|
949
|
+
}
|
|
950
|
+
return o(e, this.operator, this.semver, this.options);
|
|
951
|
+
}
|
|
952
|
+
intersects(t, n) {
|
|
953
|
+
if (!(t instanceof e)) throw TypeError("a Comparator is required");
|
|
954
|
+
return this.operator === "" ? this.value === "" || new l(t.value, n).test(this.value) : t.operator === "" ? t.value === "" || new l(this.value, n).test(t.semver) : (n = r(n), n.includePrerelease && (this.value === "<0.0.0-0" || t.value === "<0.0.0-0") || !n.includePrerelease && (this.value.startsWith("<0.0.0") || t.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && t.operator.startsWith(">") || this.operator.startsWith("<") && t.operator.startsWith("<") || this.semver.version === t.semver.version && this.operator.includes("=") && t.operator.includes("=") || o(this.semver, "<", t.semver, n) && this.operator.startsWith(">") && t.operator.startsWith("<") || o(this.semver, ">", t.semver, n) && this.operator.startsWith("<") && t.operator.startsWith(">")));
|
|
955
|
+
}
|
|
986
956
|
};
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
let r = x(e);
|
|
994
|
-
for (let [e, a] of Object.entries(Ue)) {
|
|
995
|
-
if (!r.has(e) && !r.has("*") || i(t, a)) continue;
|
|
996
|
-
let o = a.split(".")[0];
|
|
997
|
-
throw Error(`[widget-sdk] "${n}" uses ${e}(), which reads ${a}, but its capabilities grant no read of it.\n Add { "domain": "${o}", "access": "read" } to capabilities, so the homeowner is told before installing.`);
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
async function J(e) {
|
|
1001
|
-
if (!s(e.outFile)) return;
|
|
1002
|
-
let t = e.session ? await e.session.introspect(e.outFile) : await (e.introspect ?? G)(e.outFile);
|
|
1003
|
-
if (!t.ok) throw Error(`[widget-sdk] Could not read "${e.widgetName}" to check it: ${t.reason}\n Its examples and config schema could not be validated, so the build cannot continue.
|
|
1004
|
-
This usually means the bundle throws while being imported.`);
|
|
1005
|
-
let n = t.value, r = n.manifest?.name ?? e.widgetName;
|
|
1006
|
-
await ze(n.manifest?.examples, r), Be(n.exampleConfigIssues, r);
|
|
1007
|
-
let i = n.jsonSchema, a = e.manifestPath && s(e.manifestPath) ? e.manifestPath : null;
|
|
1008
|
-
i && a && He(a, n, i);
|
|
1009
|
-
let o = a ? JSON.parse(l(a, "utf-8")).capabilities : n.manifest?.capabilities;
|
|
1010
|
-
if (We(l(e.outFile, "utf-8"), o ?? [], r), !i) return;
|
|
1011
|
-
let c = Le(i), u = n.manifest?.configVersion ?? null, d = n.manifest?.name ?? e.widgetName, f = s(e.hashFile) ? l(e.hashFile, "utf-8") : null;
|
|
1012
|
-
if (f !== null) {
|
|
1013
|
-
let t = f.trim(), n = null;
|
|
1014
|
-
if (t.startsWith("{")) try {
|
|
1015
|
-
n = JSON.parse(t);
|
|
957
|
+
var r = z(), { safeRe: i, t: a } = R(), o = qe(), s = L(), c = B(), l = J();
|
|
958
|
+
})), X = /* @__PURE__ */ C(((e, t) => {
|
|
959
|
+
var n = J();
|
|
960
|
+
t.exports = (e, t, r) => {
|
|
961
|
+
try {
|
|
962
|
+
t = new n(t, r);
|
|
1016
963
|
} catch {
|
|
1017
|
-
|
|
964
|
+
return !1;
|
|
1018
965
|
}
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
function Y(e) {
|
|
1032
|
-
return y === "\\" ? e.split(y).join("/") : e;
|
|
1033
|
-
}
|
|
1034
|
-
function X() {
|
|
1035
|
-
let e = b(import.meta.url);
|
|
1036
|
-
return v(h(e), "../../preview");
|
|
1037
|
-
}
|
|
1038
|
-
function Z(e) {
|
|
1039
|
-
return r(e);
|
|
1040
|
-
}
|
|
1041
|
-
var Je = /\.(ts|tsx|js|jsx)$/, Ye = /from\s+["']@glasshome\/sync-layer(\/[^"']*)?["']/;
|
|
1042
|
-
function Xe(e, t) {
|
|
1043
|
-
let n = Y(e).split("?")[0] ?? "";
|
|
1044
|
-
return n.includes("/node_modules/") || !Je.test(n) ? !1 : Ye.test(t);
|
|
1045
|
-
}
|
|
1046
|
-
function Ze() {
|
|
1047
|
-
return {
|
|
1048
|
-
name: "glasshome-widget:sync-layer-guard",
|
|
1049
|
-
apply: "build",
|
|
1050
|
-
enforce: "pre",
|
|
1051
|
-
transform(e, t) {
|
|
1052
|
-
if (Xe(t, e)) throw Error(`Widgets must not import "@glasshome/sync-layer" directly (imported by ${Y(_(process.cwd(), t.split("?")[0] ?? t))}). Import the equivalent hook from "@glasshome/widget-sdk" instead (e.g. useEntity, useEntities, useService).`);
|
|
966
|
+
return t.test(e);
|
|
967
|
+
};
|
|
968
|
+
})), Ze = /* @__PURE__ */ C(((e, t) => {
|
|
969
|
+
var n = J();
|
|
970
|
+
t.exports = (e, t) => new n(e, t).set.map((e) => e.map((e) => e.value).join(" ").trim().split(" "));
|
|
971
|
+
})), Qe = /* @__PURE__ */ C(((e, t) => {
|
|
972
|
+
var n = B(), r = J();
|
|
973
|
+
t.exports = (e, t, i) => {
|
|
974
|
+
let a = null, o = null, s = null;
|
|
975
|
+
try {
|
|
976
|
+
s = new r(t, i);
|
|
977
|
+
} catch {
|
|
1053
978
|
return null;
|
|
1054
979
|
}
|
|
980
|
+
return e.forEach((e) => {
|
|
981
|
+
s.test(e) && (!a || o.compare(e) === -1) && (a = e, o = new n(a, i));
|
|
982
|
+
}), a;
|
|
1055
983
|
};
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
let t = /* @__PURE__ */ new Set();
|
|
1065
|
-
return {
|
|
1066
|
-
scan(e, n) {
|
|
1067
|
-
Qe(e, n) && t.add(Y(_(process.cwd(), e.split("?")[0] ?? e)));
|
|
1068
|
-
},
|
|
1069
|
-
take() {
|
|
1070
|
-
let n = [...t].filter((t) => !e.has(t));
|
|
1071
|
-
for (let t of n) e.add(t);
|
|
1072
|
-
return n;
|
|
984
|
+
})), $e = /* @__PURE__ */ C(((e, t) => {
|
|
985
|
+
var n = B(), r = J();
|
|
986
|
+
t.exports = (e, t, i) => {
|
|
987
|
+
let a = null, o = null, s = null;
|
|
988
|
+
try {
|
|
989
|
+
s = new r(t, i);
|
|
990
|
+
} catch {
|
|
991
|
+
return null;
|
|
1073
992
|
}
|
|
993
|
+
return e.forEach((e) => {
|
|
994
|
+
s.test(e) && (!a || o.compare(e) === 1) && (a = e, o = new n(a, i));
|
|
995
|
+
}), a;
|
|
1074
996
|
};
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
997
|
+
})), et = /* @__PURE__ */ C(((e, t) => {
|
|
998
|
+
var n = B(), r = J(), i = W();
|
|
999
|
+
t.exports = (e, t) => {
|
|
1000
|
+
e = new r(e, t);
|
|
1001
|
+
let a = new n("0.0.0");
|
|
1002
|
+
if (e.test(a) || (a = new n("0.0.0-0"), e.test(a))) return a;
|
|
1003
|
+
a = null;
|
|
1004
|
+
for (let t = 0; t < e.set.length; ++t) {
|
|
1005
|
+
let r = e.set[t], o = null;
|
|
1006
|
+
r.forEach((e) => {
|
|
1007
|
+
let t = new n(e.semver.version);
|
|
1008
|
+
switch (e.operator) {
|
|
1009
|
+
case ">": t.prerelease.length === 0 ? t.patch++ : t.prerelease.push(0), t.raw = t.format();
|
|
1010
|
+
case "":
|
|
1011
|
+
case ">=":
|
|
1012
|
+
(!o || i(t, o)) && (o = t);
|
|
1013
|
+
break;
|
|
1014
|
+
case "<":
|
|
1015
|
+
case "<=": break;
|
|
1016
|
+
/* istanbul ignore next */
|
|
1017
|
+
default: throw Error(`Unexpected operation: ${e.operator}`);
|
|
1018
|
+
}
|
|
1019
|
+
}), o && (!a || i(a, o)) && (a = o);
|
|
1020
|
+
}
|
|
1021
|
+
return a && e.test(a) ? a : null;
|
|
1022
|
+
};
|
|
1023
|
+
})), tt = /* @__PURE__ */ C(((e, t) => {
|
|
1024
|
+
var n = J();
|
|
1025
|
+
t.exports = (e, t) => {
|
|
1026
|
+
try {
|
|
1027
|
+
return new n(e, t).range || "*";
|
|
1028
|
+
} catch {
|
|
1029
|
+
return null;
|
|
1090
1030
|
}
|
|
1091
1031
|
};
|
|
1092
|
-
}
|
|
1093
|
-
var
|
|
1094
|
-
|
|
1032
|
+
})), Z = /* @__PURE__ */ C(((e, t) => {
|
|
1033
|
+
var n = B(), r = Y(), { ANY: i } = r, a = J(), o = X(), s = W(), c = G(), l = q(), u = K();
|
|
1034
|
+
t.exports = (e, t, d, f) => {
|
|
1035
|
+
e = new n(e, f), t = new a(t, f);
|
|
1036
|
+
let p, m, h, g, _;
|
|
1037
|
+
switch (d) {
|
|
1038
|
+
case ">":
|
|
1039
|
+
p = s, m = l, h = c, g = ">", _ = ">=";
|
|
1040
|
+
break;
|
|
1041
|
+
case "<":
|
|
1042
|
+
p = c, m = u, h = s, g = "<", _ = "<=";
|
|
1043
|
+
break;
|
|
1044
|
+
default: throw TypeError("Must provide a hilo val of \"<\" or \">\"");
|
|
1045
|
+
}
|
|
1046
|
+
if (o(e, t, f)) return !1;
|
|
1047
|
+
for (let n = 0; n < t.set.length; ++n) {
|
|
1048
|
+
let a = t.set[n], o = null, s = null;
|
|
1049
|
+
if (a.forEach((e) => {
|
|
1050
|
+
e.semver === i && (e = new r(">=0.0.0")), o ||= e, s ||= e, p(e.semver, o.semver, f) ? o = e : h(e.semver, s.semver, f) && (s = e);
|
|
1051
|
+
}), o.operator === g || o.operator === _ || (!s.operator || s.operator === g) && m(e, s.semver) || s.operator === _ && h(e, s.semver)) return !1;
|
|
1052
|
+
}
|
|
1053
|
+
return !0;
|
|
1054
|
+
};
|
|
1055
|
+
})), nt = /* @__PURE__ */ C(((e, t) => {
|
|
1056
|
+
var n = Z();
|
|
1057
|
+
t.exports = (e, t, r) => n(e, t, ">", r);
|
|
1058
|
+
})), rt = /* @__PURE__ */ C(((e, t) => {
|
|
1059
|
+
var n = Z();
|
|
1060
|
+
t.exports = (e, t, r) => n(e, t, "<", r);
|
|
1061
|
+
})), it = /* @__PURE__ */ C(((e, t) => {
|
|
1062
|
+
var n = J();
|
|
1063
|
+
t.exports = (e, t, r) => (e = new n(e, r), t = new n(t, r), e.intersects(t, r));
|
|
1064
|
+
})), at = /* @__PURE__ */ C(((e, t) => {
|
|
1065
|
+
var n = X(), r = H();
|
|
1066
|
+
t.exports = (e, t, i) => {
|
|
1067
|
+
let a = [], o = null, s = null, c = e.sort((e, t) => r(e, t, i));
|
|
1068
|
+
for (let e of c) n(e, t, i) ? (s = e, o ||= e) : (s && a.push([o, s]), s = null, o = null);
|
|
1069
|
+
o && a.push([o, null]);
|
|
1070
|
+
let l = [];
|
|
1071
|
+
for (let [e, t] of a) e === t ? l.push(e) : !t && e === c[0] ? l.push("*") : t ? e === c[0] ? l.push(`<=${t}`) : l.push(`${e} - ${t}`) : l.push(`>=${e}`);
|
|
1072
|
+
let u = l.join(" || "), d = typeof t.raw == "string" ? t.raw : String(t);
|
|
1073
|
+
return u.length < d.length ? u : t;
|
|
1074
|
+
};
|
|
1075
|
+
})), ot = /* @__PURE__ */ C(((e, t) => {
|
|
1076
|
+
var n = J(), r = Y(), { ANY: i } = r, a = X(), o = H(), s = (e, t, r = {}) => {
|
|
1077
|
+
if (e === t) return !0;
|
|
1078
|
+
e = new n(e, r), t = new n(t, r);
|
|
1079
|
+
let i = !1;
|
|
1080
|
+
OUTER: for (let n of e.set) {
|
|
1081
|
+
for (let e of t.set) {
|
|
1082
|
+
let t = u(n, e, r);
|
|
1083
|
+
if (i ||= t !== null, t) continue OUTER;
|
|
1084
|
+
}
|
|
1085
|
+
if (i) return !1;
|
|
1086
|
+
}
|
|
1087
|
+
return !0;
|
|
1088
|
+
}, c = [new r(">=0.0.0-0")], l = [new r(">=0.0.0")], u = (e, t, n) => {
|
|
1089
|
+
if (e === t) return !0;
|
|
1090
|
+
if (e.length === 1 && e[0].semver === i) {
|
|
1091
|
+
if (t.length === 1 && t[0].semver === i) return !0;
|
|
1092
|
+
e = n.includePrerelease ? c : l;
|
|
1093
|
+
}
|
|
1094
|
+
if (t.length === 1 && t[0].semver === i) {
|
|
1095
|
+
if (n.includePrerelease) return !0;
|
|
1096
|
+
t = l;
|
|
1097
|
+
}
|
|
1098
|
+
let r = /* @__PURE__ */ new Set(), s, u;
|
|
1099
|
+
for (let t of e) t.operator === ">" || t.operator === ">=" ? s = d(s, t, n) : t.operator === "<" || t.operator === "<=" ? u = f(u, t, n) : r.add(t.semver);
|
|
1100
|
+
if (r.size > 1) return null;
|
|
1101
|
+
let p;
|
|
1102
|
+
if (s && u && (p = o(s.semver, u.semver, n), p > 0 || p === 0 && (s.operator !== ">=" || u.operator !== "<="))) return null;
|
|
1103
|
+
for (let e of r) {
|
|
1104
|
+
if (s && !a(e, String(s), n) || u && !a(e, String(u), n)) return null;
|
|
1105
|
+
for (let r of t) if (!a(e, String(r), n)) return !1;
|
|
1106
|
+
return !0;
|
|
1107
|
+
}
|
|
1108
|
+
let m, h, g, _, v = u && !n.includePrerelease && u.semver.prerelease.length ? u.semver : !1, y = s && !n.includePrerelease && s.semver.prerelease.length ? s.semver : !1;
|
|
1109
|
+
v && v.prerelease.length === 1 && u.operator === "<" && v.prerelease[0] === 0 && (v = !1);
|
|
1110
|
+
for (let e of t) {
|
|
1111
|
+
if (_ = _ || e.operator === ">" || e.operator === ">=", g = g || e.operator === "<" || e.operator === "<=", s) {
|
|
1112
|
+
if (y && e.semver.prerelease && e.semver.prerelease.length && e.semver.major === y.major && e.semver.minor === y.minor && e.semver.patch === y.patch && (y = !1), e.operator === ">" || e.operator === ">=") {
|
|
1113
|
+
if (m = d(s, e, n), m === e && m !== s) return !1;
|
|
1114
|
+
} else if (s.operator === ">=" && !e.test(s.semver)) return !1;
|
|
1115
|
+
}
|
|
1116
|
+
if (u) {
|
|
1117
|
+
if (v && e.semver.prerelease && e.semver.prerelease.length && e.semver.major === v.major && e.semver.minor === v.minor && e.semver.patch === v.patch && (v = !1), e.operator === "<" || e.operator === "<=") {
|
|
1118
|
+
if (h = f(u, e, n), h === e && h !== u) return !1;
|
|
1119
|
+
} else if (u.operator === "<=" && !e.test(u.semver)) return !1;
|
|
1120
|
+
}
|
|
1121
|
+
if (!e.operator && (u || s) && p !== 0) return !1;
|
|
1122
|
+
}
|
|
1123
|
+
return !(s && g && !u && p !== 0 || u && _ && !s && p !== 0 || y || v);
|
|
1124
|
+
}, d = (e, t, n) => {
|
|
1125
|
+
if (!e) return t;
|
|
1126
|
+
let r = o(e.semver, t.semver, n);
|
|
1127
|
+
return r > 0 ? e : r < 0 || t.operator === ">" && e.operator === ">=" ? t : e;
|
|
1128
|
+
}, f = (e, t, n) => {
|
|
1129
|
+
if (!e) return t;
|
|
1130
|
+
let r = o(e.semver, t.semver, n);
|
|
1131
|
+
return r < 0 ? e : r > 0 || t.operator === "<" && e.operator === "<=" ? t : e;
|
|
1132
|
+
};
|
|
1133
|
+
t.exports = s;
|
|
1134
|
+
})), st = (/* @__PURE__ */ C(((e, t) => {
|
|
1135
|
+
var n = R(), r = I(), i = B(), a = Me();
|
|
1136
|
+
t.exports = {
|
|
1137
|
+
parse: V(),
|
|
1138
|
+
valid: Ne(),
|
|
1139
|
+
clean: Pe(),
|
|
1140
|
+
inc: Fe(),
|
|
1141
|
+
diff: Ie(),
|
|
1142
|
+
major: Le(),
|
|
1143
|
+
minor: Re(),
|
|
1144
|
+
patch: ze(),
|
|
1145
|
+
prerelease: Be(),
|
|
1146
|
+
compare: H(),
|
|
1147
|
+
rcompare: Ve(),
|
|
1148
|
+
compareLoose: He(),
|
|
1149
|
+
compareBuild: U(),
|
|
1150
|
+
sort: Ue(),
|
|
1151
|
+
rsort: We(),
|
|
1152
|
+
gt: W(),
|
|
1153
|
+
lt: G(),
|
|
1154
|
+
eq: Ge(),
|
|
1155
|
+
neq: Ke(),
|
|
1156
|
+
gte: K(),
|
|
1157
|
+
lte: q(),
|
|
1158
|
+
cmp: qe(),
|
|
1159
|
+
coerce: Je(),
|
|
1160
|
+
truncate: Ye(),
|
|
1161
|
+
Comparator: Y(),
|
|
1162
|
+
Range: J(),
|
|
1163
|
+
satisfies: X(),
|
|
1164
|
+
toComparators: Ze(),
|
|
1165
|
+
maxSatisfying: Qe(),
|
|
1166
|
+
minSatisfying: $e(),
|
|
1167
|
+
minVersion: et(),
|
|
1168
|
+
validRange: tt(),
|
|
1169
|
+
outside: Z(),
|
|
1170
|
+
gtr: nt(),
|
|
1171
|
+
ltr: rt(),
|
|
1172
|
+
intersects: it(),
|
|
1173
|
+
simplifyRange: at(),
|
|
1174
|
+
subset: ot(),
|
|
1175
|
+
SemVer: i,
|
|
1176
|
+
re: n.re,
|
|
1177
|
+
src: n.src,
|
|
1178
|
+
tokens: n.t,
|
|
1179
|
+
SEMVER_SPEC_VERSION: r.SEMVER_SPEC_VERSION,
|
|
1180
|
+
RELEASE_TYPES: r.RELEASE_TYPES,
|
|
1181
|
+
compareIdentifiers: a.compareIdentifiers,
|
|
1182
|
+
rcompareIdentifiers: a.rcompareIdentifiers
|
|
1183
|
+
};
|
|
1184
|
+
})))(), ct = "node_modules/.cache/glasshome-widgets";
|
|
1185
|
+
function lt(e) {
|
|
1095
1186
|
try {
|
|
1096
|
-
return
|
|
1187
|
+
return S(g(process.cwd(), "package.json")).resolve(e);
|
|
1097
1188
|
} catch {
|
|
1098
1189
|
return null;
|
|
1099
1190
|
}
|
|
1100
1191
|
}
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
"--foreground",
|
|
1105
|
-
"--card",
|
|
1106
|
-
"--primary",
|
|
1107
|
-
"--border",
|
|
1108
|
-
"--muted",
|
|
1109
|
-
"--accent"
|
|
1110
|
-
];
|
|
1111
|
-
function rt(e) {
|
|
1112
|
-
return e.replace(/(?<=[{;])\s*(--[\w-]+)\s*:\s*var\(\s*\1\s*\)\s*(;|(?=\}))/g, "");
|
|
1113
|
-
}
|
|
1114
|
-
function it(e, t) {
|
|
1115
|
-
let n = g(e, `${t}.css`);
|
|
1116
|
-
if (!s(n)) return;
|
|
1117
|
-
let r = l(n, "utf-8"), i = rt(r);
|
|
1118
|
-
i !== r && p(n, i);
|
|
1119
|
-
for (let e of i.matchAll(/:host[^{]*\{([^}]*)\}/g)) {
|
|
1120
|
-
let n = e[1] ?? "", r = nt.find((e) => n.includes(`${e}:`));
|
|
1121
|
-
if (r) throw Error(`[glasshome-widget] "${t}.css" defines theme variable "${r}" on :host. Theme variables must inherit from the document so widgets follow the household theme — never re-scope them into the widget's shadow root.`);
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
function at(e, t) {
|
|
1125
|
-
let n = v(e), r = h(t), i = new Set($(n).map((e) => h(e.entry)));
|
|
1126
|
-
return [r, ...u(n, { withFileTypes: !0 }).filter((e) => e.isDirectory()).map((e) => g(n, e.name)).filter((e) => !i.has(e))];
|
|
1192
|
+
function ut(e, t) {
|
|
1193
|
+
let n = v(e), r = h(t), i = new Set(A(n).map((e) => h(e.entry)));
|
|
1194
|
+
return [r, ...d(n, { withFileTypes: !0 }).filter((e) => e.isDirectory()).map((e) => g(n, e.name)).filter((e) => !i.has(e))];
|
|
1127
1195
|
}
|
|
1128
|
-
var
|
|
1129
|
-
function
|
|
1130
|
-
return !e || (0,
|
|
1196
|
+
var dt = "1.24.0";
|
|
1197
|
+
function ft(e) {
|
|
1198
|
+
return !e || (0, st.validRange)(e) === null ? !1 : !(0, st.intersects)(e, `<${dt}`, { includePrerelease: !0 });
|
|
1131
1199
|
}
|
|
1132
|
-
function
|
|
1133
|
-
if (!
|
|
1134
|
-
let t = JSON.parse(
|
|
1200
|
+
function pt(e) {
|
|
1201
|
+
if (!c(e)) return;
|
|
1202
|
+
let t = JSON.parse(u(e, "utf-8"));
|
|
1135
1203
|
if (typeof t == "object" && t && "sdkVersion" in t) return typeof t.sdkVersion == "string" ? t.sdkVersion : void 0;
|
|
1136
1204
|
}
|
|
1137
|
-
function
|
|
1205
|
+
function Q(e, t) {
|
|
1138
1206
|
let n = t ? ["@import \"tailwindcss\" source(none);"] : [
|
|
1139
1207
|
"@layer theme, base, components, utilities;",
|
|
1140
1208
|
"@import \"tailwindcss/theme.css\" layer(theme);",
|
|
@@ -1148,7 +1216,7 @@ function lt(e, t) {
|
|
|
1148
1216
|
...n,
|
|
1149
1217
|
"@import \"tw-animate-css\";",
|
|
1150
1218
|
t ? "@import \"@glasshome/ui/styles/theme\";" : "@reference \"@glasshome/ui/styles/theme\";",
|
|
1151
|
-
...r.filter((e) =>
|
|
1219
|
+
...r.filter((e) => c(e)).map((e) => `@source "${j(e)}";`),
|
|
1152
1220
|
"@custom-variant dark {",
|
|
1153
1221
|
" &:is(.dark *) { @slot }",
|
|
1154
1222
|
" :host(.dark) & { @slot }",
|
|
@@ -1156,68 +1224,33 @@ function lt(e, t) {
|
|
|
1156
1224
|
""
|
|
1157
1225
|
].join("\n");
|
|
1158
1226
|
}
|
|
1159
|
-
function
|
|
1160
|
-
let a = v(e,
|
|
1161
|
-
|
|
1162
|
-
let o =
|
|
1227
|
+
function mt(e, t, n, r, i) {
|
|
1228
|
+
let a = v(e, ct);
|
|
1229
|
+
l(a, { recursive: !0 });
|
|
1230
|
+
let o = lt("@glasshome/ui/styles");
|
|
1163
1231
|
if (!o) throw Error("[widget-sdk] @glasshome/ui is required to build widgets (it provides the theme every GlassHome widget ships with). Add it to your widget's dependencies.");
|
|
1164
|
-
let s =
|
|
1165
|
-
|
|
1166
|
-
let
|
|
1167
|
-
return p
|
|
1168
|
-
`import "${
|
|
1169
|
-
`export { default } from "${
|
|
1232
|
+
let s = lt("@glasshome/widget-sdk/tailwind-sources"), c = s ? h(s) : null, u = [...c ? [g(c, "src"), g(c, "dist")] : [], ...ut(r, n)], d = ft(pt(i)) ? null : v(h(o), "../.."), f = v(a, `${t}.tailwind.css`);
|
|
1233
|
+
m(f, Q(u, d));
|
|
1234
|
+
let p = v(a, `${t}.entry.ts`);
|
|
1235
|
+
return m(p, [
|
|
1236
|
+
`import "${j(f)}";`,
|
|
1237
|
+
`export { default } from "${j(n)}";`,
|
|
1170
1238
|
""
|
|
1171
|
-
].join("\n")),
|
|
1239
|
+
].join("\n")), p;
|
|
1172
1240
|
}
|
|
1173
|
-
function
|
|
1174
|
-
let { Features: e } =
|
|
1241
|
+
function ht() {
|
|
1242
|
+
let { Features: e } = S(import.meta.url)("lightningcss");
|
|
1175
1243
|
return { lightningcss: { include: e.HexAlphaColors } };
|
|
1176
1244
|
}
|
|
1177
|
-
function
|
|
1178
|
-
let e =
|
|
1245
|
+
function gt() {
|
|
1246
|
+
let e = te();
|
|
1179
1247
|
for (let t of e) t.apply ??= "build";
|
|
1180
1248
|
return e;
|
|
1181
1249
|
}
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
let r = v(e, n);
|
|
1187
|
-
if (!f(r).isDirectory()) continue;
|
|
1188
|
-
let i = v(r, "index.tsx"), a = v(r, "manifest.json");
|
|
1189
|
-
s(i) && s(a) && t.push({
|
|
1190
|
-
name: n,
|
|
1191
|
-
entry: i
|
|
1192
|
-
});
|
|
1193
|
-
}
|
|
1194
|
-
return t;
|
|
1195
|
-
}
|
|
1196
|
-
function pt(e, t) {
|
|
1197
|
-
let r = [];
|
|
1198
|
-
if (s(e)) for (let i of u(e)) {
|
|
1199
|
-
if (!f(g(e, i)).isDirectory()) continue;
|
|
1200
|
-
let o = g(e, i, "manifest.json");
|
|
1201
|
-
if (!s(o)) continue;
|
|
1202
|
-
let c = a.safeParse(JSON.parse(l(o, "utf-8")));
|
|
1203
|
-
if (!c.success) throw Error(`[registry] Invalid manifest for "${i}": ${n(c.error)}`);
|
|
1204
|
-
let u = s(g(t, `${i}.css`));
|
|
1205
|
-
r.push({
|
|
1206
|
-
...c.data,
|
|
1207
|
-
bundleUrl: `./${i}.js`,
|
|
1208
|
-
...u ? { cssUrl: `./${i}.css` } : {}
|
|
1209
|
-
});
|
|
1210
|
-
}
|
|
1211
|
-
let i = {
|
|
1212
|
-
version: 1,
|
|
1213
|
-
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1214
|
-
baseUrl: "./",
|
|
1215
|
-
widgets: r
|
|
1216
|
-
};
|
|
1217
|
-
s(t) || c(t, { recursive: !0 }), p(g(t, "registry.json"), JSON.stringify(i, null, 2)), console.log(`[registry] Generated registry.json with ${r.length} widget(s)`);
|
|
1218
|
-
}
|
|
1219
|
-
async function mt(e) {
|
|
1220
|
-
let { build: t } = await import("vite"), n = process.cwd(), r = v(n, e?.srcDir ?? "src"), i = v(n, e?.outDir ?? "dist"), a = $(r);
|
|
1250
|
+
//#endregion
|
|
1251
|
+
//#region src/vite/build.ts
|
|
1252
|
+
async function _t(e) {
|
|
1253
|
+
let { build: t } = await import("vite"), n = process.cwd(), r = v(n, e?.srcDir ?? "src"), i = v(n, e?.outDir ?? "dist"), a = A(r);
|
|
1221
1254
|
if (a.length === 0) {
|
|
1222
1255
|
console.warn("[glasshome-widgets] No widgets found in", r);
|
|
1223
1256
|
return;
|
|
@@ -1226,61 +1259,68 @@ async function mt(e) {
|
|
|
1226
1259
|
let t = new Set(e.only);
|
|
1227
1260
|
a = a.filter((e) => t.has(e.name));
|
|
1228
1261
|
}
|
|
1229
|
-
e?.only ||
|
|
1262
|
+
e?.only || c(i) && f(i, { recursive: !0 }), c(i) || l(i, { recursive: !0 });
|
|
1230
1263
|
let o = /* @__PURE__ */ new Set();
|
|
1231
1264
|
for (let s of a) await t({
|
|
1232
1265
|
configFile: !1,
|
|
1233
1266
|
root: n,
|
|
1234
1267
|
plugins: [
|
|
1235
|
-
...
|
|
1268
|
+
...gt(),
|
|
1236
1269
|
...e?.plugins ?? [],
|
|
1237
|
-
|
|
1238
|
-
|
|
1270
|
+
fe(),
|
|
1271
|
+
he(o)
|
|
1239
1272
|
],
|
|
1240
1273
|
...e?.viteConfig,
|
|
1241
1274
|
css: {
|
|
1242
1275
|
...e?.viteConfig?.css,
|
|
1243
|
-
...
|
|
1276
|
+
...ht()
|
|
1244
1277
|
},
|
|
1245
1278
|
build: {
|
|
1246
1279
|
lib: {
|
|
1247
|
-
entry:
|
|
1280
|
+
entry: mt(n, s.name, s.entry, r, g(h(s.entry), "manifest.json")),
|
|
1248
1281
|
formats: ["es"],
|
|
1249
1282
|
fileName: s.name,
|
|
1250
1283
|
cssFileName: s.name
|
|
1251
1284
|
},
|
|
1252
|
-
rollupOptions: { external:
|
|
1285
|
+
rollupOptions: { external: M },
|
|
1253
1286
|
outDir: i,
|
|
1254
1287
|
emptyOutDir: !1,
|
|
1255
1288
|
copyPublicDir: !1,
|
|
1256
1289
|
...e?.viteConfig?.build
|
|
1257
1290
|
},
|
|
1258
1291
|
logLevel: "warn"
|
|
1259
|
-
}),
|
|
1260
|
-
|
|
1292
|
+
}), await je({
|
|
1293
|
+
outDir: i,
|
|
1294
|
+
name: s.name,
|
|
1261
1295
|
hashFile: g(h(s.entry), ".schema-hash"),
|
|
1262
|
-
widgetName: s.name,
|
|
1263
1296
|
manifestPath: g(h(s.entry), "manifest.json"),
|
|
1264
1297
|
session: e?.session
|
|
1265
1298
|
});
|
|
1266
|
-
|
|
1299
|
+
ce(r, i);
|
|
1300
|
+
}
|
|
1301
|
+
//#endregion
|
|
1302
|
+
//#region src/vite/plugin.ts
|
|
1303
|
+
var vt = "virtual:glasshome-widget", yt = "\0virtual:glasshome-widget", bt = "/@glasshome/preview";
|
|
1304
|
+
function $() {
|
|
1305
|
+
let e = b(import.meta.url);
|
|
1306
|
+
return v(h(e), "../../preview");
|
|
1267
1307
|
}
|
|
1268
|
-
function
|
|
1308
|
+
function xt(e) {
|
|
1269
1309
|
let t = e?.entry ?? "src/index.tsx", n = {
|
|
1270
1310
|
name: "glasshome-widget:build",
|
|
1271
1311
|
apply: "build",
|
|
1272
1312
|
config() {
|
|
1273
1313
|
let e = process.cwd();
|
|
1274
1314
|
return {
|
|
1275
|
-
css:
|
|
1315
|
+
css: ht(),
|
|
1276
1316
|
build: {
|
|
1277
1317
|
lib: {
|
|
1278
|
-
entry:
|
|
1318
|
+
entry: mt(e, "index", v(e, t), h(v(e, t)), v(e, "manifest.json")),
|
|
1279
1319
|
formats: ["es"],
|
|
1280
1320
|
fileName: "index",
|
|
1281
1321
|
cssFileName: "index"
|
|
1282
1322
|
},
|
|
1283
|
-
rollupOptions: { external:
|
|
1323
|
+
rollupOptions: { external: M }
|
|
1284
1324
|
}
|
|
1285
1325
|
};
|
|
1286
1326
|
}
|
|
@@ -1289,7 +1329,7 @@ function ht(e) {
|
|
|
1289
1329
|
apply: "serve",
|
|
1290
1330
|
enforce: "pre",
|
|
1291
1331
|
config() {
|
|
1292
|
-
let e =
|
|
1332
|
+
let e = $(), t = process.cwd();
|
|
1293
1333
|
return { server: { fs: { allow: [
|
|
1294
1334
|
e,
|
|
1295
1335
|
t,
|
|
@@ -1297,10 +1337,10 @@ function ht(e) {
|
|
|
1297
1337
|
] } } };
|
|
1298
1338
|
},
|
|
1299
1339
|
configureServer(e) {
|
|
1300
|
-
let t =
|
|
1340
|
+
let t = $(), n = g(t, "preview.html");
|
|
1301
1341
|
e.middlewares.use(async (t, r, i) => {
|
|
1302
1342
|
if (t.url === "/" || t.url === "/index.html") try {
|
|
1303
|
-
let i =
|
|
1343
|
+
let i = u(n, "utf-8");
|
|
1304
1344
|
i = await e.transformIndexHtml(t.url, i), r.setHeader("Content-Type", "text/html"), r.statusCode = 200, r.end(i);
|
|
1305
1345
|
} catch (e) {
|
|
1306
1346
|
i(e);
|
|
@@ -1309,37 +1349,37 @@ function ht(e) {
|
|
|
1309
1349
|
});
|
|
1310
1350
|
},
|
|
1311
1351
|
resolveId(e) {
|
|
1312
|
-
if (e ===
|
|
1313
|
-
let e =
|
|
1314
|
-
return
|
|
1352
|
+
if (e === bt) {
|
|
1353
|
+
let e = $();
|
|
1354
|
+
return j(g(e, "host.tsx"));
|
|
1315
1355
|
}
|
|
1316
|
-
if (e ===
|
|
1356
|
+
if (e === vt) return yt;
|
|
1317
1357
|
},
|
|
1318
1358
|
load(e) {
|
|
1319
|
-
if (e ===
|
|
1359
|
+
if (e === yt) return `export { default } from "${j(v(process.cwd(), t))}";`;
|
|
1320
1360
|
}
|
|
1321
1361
|
}, i = {
|
|
1322
1362
|
name: "glasshome-widget:schema",
|
|
1323
1363
|
apply: "build",
|
|
1324
1364
|
async closeBundle() {
|
|
1325
|
-
|
|
1326
|
-
|
|
1365
|
+
await je({
|
|
1366
|
+
outDir: v(process.cwd(), "dist"),
|
|
1367
|
+
name: "index",
|
|
1327
1368
|
hashFile: v(process.cwd(), ".schema-hash"),
|
|
1328
|
-
widgetName: "index",
|
|
1329
1369
|
manifestPath: v(process.cwd(), "manifest.json")
|
|
1330
1370
|
});
|
|
1331
1371
|
}
|
|
1332
1372
|
};
|
|
1333
1373
|
return [
|
|
1334
|
-
...
|
|
1374
|
+
...gt(),
|
|
1335
1375
|
n,
|
|
1336
|
-
|
|
1337
|
-
|
|
1376
|
+
fe(),
|
|
1377
|
+
he(),
|
|
1338
1378
|
i,
|
|
1339
1379
|
r
|
|
1340
1380
|
];
|
|
1341
1381
|
}
|
|
1342
|
-
function
|
|
1382
|
+
function St(e) {
|
|
1343
1383
|
let t = e?.srcDir ?? "src", n = e?.outDir ?? "dist", r = [];
|
|
1344
1384
|
return [{
|
|
1345
1385
|
name: "glasshome-widgets:build",
|
|
@@ -1358,7 +1398,7 @@ function gt(e) {
|
|
|
1358
1398
|
if (e === "\0glasshome-noop") return "export {}";
|
|
1359
1399
|
},
|
|
1360
1400
|
async closeBundle() {
|
|
1361
|
-
await
|
|
1401
|
+
await _t({
|
|
1362
1402
|
srcDir: t,
|
|
1363
1403
|
outDir: n,
|
|
1364
1404
|
plugins: r
|
|
@@ -1367,4 +1407,4 @@ function gt(e) {
|
|
|
1367
1407
|
}];
|
|
1368
1408
|
}
|
|
1369
1409
|
//#endregion
|
|
1370
|
-
export {
|
|
1410
|
+
export { F as HOOK_READS, be as MAX_EXAMPLES, Te as assertHookReadsDeclared, _t as buildWidgets, oe as createIntrospectSession, me as createUiImportTracker, A as discoverWidgets, _e as dropSelfReferencingVars, ce as generateRegistry, xt as glasshomeWidget, St as glasshomeWidgets, ft as hostStylesUi, k as introspectOnce, de as isDirectSyncLayerImportSource, pe as isDirectUiImportSource, M as isWidgetExternal, Ae as runSchemaGuard, ut as widgetProjectScanDirs, Q as widgetTailwindEntry };
|