@hypen-space/core 0.4.36 → 0.4.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -14
- package/dist/app.js +289 -227
- package/dist/app.js.map +5 -5
- package/dist/components/builtin.js +289 -227
- package/dist/components/builtin.js.map +5 -5
- package/dist/context.js +60 -64
- package/dist/context.js.map +2 -2
- package/dist/datasource.js +80 -0
- package/dist/datasource.js.map +10 -0
- package/dist/disposable.js +60 -63
- package/dist/disposable.js.map +2 -2
- package/dist/events.js +60 -63
- package/dist/events.js.map +2 -2
- package/dist/hypen.js +78 -0
- package/dist/hypen.js.map +10 -0
- package/dist/index.browser.d.ts +2 -1
- package/dist/index.browser.js +303 -244
- package/dist/index.browser.js.map +6 -7
- package/dist/index.d.ts +0 -3
- package/dist/index.js +492 -180
- package/dist/index.js.map +6 -6
- package/dist/logger.js +60 -64
- package/dist/logger.js.map +2 -2
- package/dist/remote/client.js +243 -158
- package/dist/remote/client.js.map +6 -6
- package/dist/remote/index.d.ts +6 -5
- package/dist/remote/index.js +241 -1986
- package/dist/remote/index.js.map +6 -13
- package/dist/remote/session.js +151 -0
- package/dist/remote/session.js.map +10 -0
- package/dist/renderer.js +60 -63
- package/dist/renderer.js.map +2 -2
- package/dist/result.js +220 -0
- package/dist/result.js.map +10 -0
- package/dist/retry.js +329 -0
- package/dist/retry.js.map +11 -0
- package/dist/router.js +62 -70
- package/dist/router.js.map +2 -2
- package/dist/state.js +3 -8
- package/dist/state.js.map +2 -2
- package/package.json +11 -56
- package/src/index.browser.ts +5 -4
- package/src/index.ts +10 -23
- package/src/remote/index.ts +9 -5
- package/dist/discovery.d.ts +0 -90
- package/dist/discovery.js +0 -1334
- package/dist/discovery.js.map +0 -15
- package/dist/engine.browser.d.ts +0 -116
- package/dist/engine.browser.js +0 -479
- package/dist/engine.browser.js.map +0 -12
- package/dist/engine.d.ts +0 -107
- package/dist/engine.js +0 -543
- package/dist/engine.js.map +0 -12
- package/dist/loader.d.ts +0 -51
- package/dist/loader.js +0 -292
- package/dist/loader.js.map +0 -11
- package/dist/plugin.d.ts +0 -39
- package/dist/plugin.js +0 -685
- package/dist/plugin.js.map +0 -12
- package/dist/remote/server.d.ts +0 -188
- package/dist/remote/server.js +0 -2270
- package/dist/remote/server.js.map +0 -19
- package/src/discovery.ts +0 -527
- package/src/engine.browser.ts +0 -302
- package/src/engine.ts +0 -282
- package/src/loader.ts +0 -136
- package/src/plugin.ts +0 -220
- package/src/remote/server.ts +0 -879
- package/wasm-browser/README.md +0 -594
- package/wasm-browser/hypen_engine.d.ts +0 -389
- package/wasm-browser/hypen_engine.js +0 -1070
- package/wasm-browser/hypen_engine_bg.wasm +0 -0
- package/wasm-browser/hypen_engine_bg.wasm.d.ts +0 -37
- package/wasm-browser/package.json +0 -24
- package/wasm-node/README.md +0 -594
- package/wasm-node/hypen_engine.d.ts +0 -327
- package/wasm-node/hypen_engine.js +0 -979
- package/wasm-node/hypen_engine_bg.wasm +0 -0
- package/wasm-node/hypen_engine_bg.wasm.d.ts +0 -37
- package/wasm-node/package.json +0 -22
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __returnValue = (v) => v;
|
|
4
3
|
function __exportSetter(name, newValue) {
|
|
@@ -14,7 +13,353 @@ var __export = (target, all) => {
|
|
|
14
13
|
});
|
|
15
14
|
};
|
|
16
15
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
|
-
var __require = /* @__PURE__ */
|
|
16
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
17
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
18
|
+
}) : x)(function(x) {
|
|
19
|
+
if (typeof require !== "undefined")
|
|
20
|
+
return require.apply(this, arguments);
|
|
21
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// node:path
|
|
25
|
+
var exports_path = {};
|
|
26
|
+
__export(exports_path, {
|
|
27
|
+
sep: () => sep,
|
|
28
|
+
resolve: () => resolve,
|
|
29
|
+
relative: () => relative,
|
|
30
|
+
posix: () => posix,
|
|
31
|
+
parse: () => parse,
|
|
32
|
+
normalize: () => normalize,
|
|
33
|
+
join: () => join,
|
|
34
|
+
isAbsolute: () => isAbsolute,
|
|
35
|
+
format: () => format,
|
|
36
|
+
extname: () => extname,
|
|
37
|
+
dirname: () => dirname,
|
|
38
|
+
delimiter: () => delimiter,
|
|
39
|
+
default: () => path_default,
|
|
40
|
+
basename: () => basename,
|
|
41
|
+
_makeLong: () => _makeLong
|
|
42
|
+
});
|
|
43
|
+
function assertPath(path) {
|
|
44
|
+
if (typeof path !== "string")
|
|
45
|
+
throw TypeError("Path must be a string. Received " + JSON.stringify(path));
|
|
46
|
+
}
|
|
47
|
+
function normalizeStringPosix(path, allowAboveRoot) {
|
|
48
|
+
var res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, code;
|
|
49
|
+
for (var i = 0;i <= path.length; ++i) {
|
|
50
|
+
if (i < path.length)
|
|
51
|
+
code = path.charCodeAt(i);
|
|
52
|
+
else if (code === 47)
|
|
53
|
+
break;
|
|
54
|
+
else
|
|
55
|
+
code = 47;
|
|
56
|
+
if (code === 47) {
|
|
57
|
+
if (lastSlash === i - 1 || dots === 1)
|
|
58
|
+
;
|
|
59
|
+
else if (lastSlash !== i - 1 && dots === 2) {
|
|
60
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 || res.charCodeAt(res.length - 2) !== 46) {
|
|
61
|
+
if (res.length > 2) {
|
|
62
|
+
var lastSlashIndex = res.lastIndexOf("/");
|
|
63
|
+
if (lastSlashIndex !== res.length - 1) {
|
|
64
|
+
if (lastSlashIndex === -1)
|
|
65
|
+
res = "", lastSegmentLength = 0;
|
|
66
|
+
else
|
|
67
|
+
res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
68
|
+
lastSlash = i, dots = 0;
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
} else if (res.length === 2 || res.length === 1) {
|
|
72
|
+
res = "", lastSegmentLength = 0, lastSlash = i, dots = 0;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (allowAboveRoot) {
|
|
77
|
+
if (res.length > 0)
|
|
78
|
+
res += "/..";
|
|
79
|
+
else
|
|
80
|
+
res = "..";
|
|
81
|
+
lastSegmentLength = 2;
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
if (res.length > 0)
|
|
85
|
+
res += "/" + path.slice(lastSlash + 1, i);
|
|
86
|
+
else
|
|
87
|
+
res = path.slice(lastSlash + 1, i);
|
|
88
|
+
lastSegmentLength = i - lastSlash - 1;
|
|
89
|
+
}
|
|
90
|
+
lastSlash = i, dots = 0;
|
|
91
|
+
} else if (code === 46 && dots !== -1)
|
|
92
|
+
++dots;
|
|
93
|
+
else
|
|
94
|
+
dots = -1;
|
|
95
|
+
}
|
|
96
|
+
return res;
|
|
97
|
+
}
|
|
98
|
+
function _format(sep, pathObject) {
|
|
99
|
+
var dir = pathObject.dir || pathObject.root, base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
100
|
+
if (!dir)
|
|
101
|
+
return base;
|
|
102
|
+
if (dir === pathObject.root)
|
|
103
|
+
return dir + base;
|
|
104
|
+
return dir + sep + base;
|
|
105
|
+
}
|
|
106
|
+
function resolve() {
|
|
107
|
+
var resolvedPath = "", resolvedAbsolute = false, cwd;
|
|
108
|
+
for (var i = arguments.length - 1;i >= -1 && !resolvedAbsolute; i--) {
|
|
109
|
+
var path;
|
|
110
|
+
if (i >= 0)
|
|
111
|
+
path = arguments[i];
|
|
112
|
+
else {
|
|
113
|
+
if (cwd === undefined)
|
|
114
|
+
cwd = process.cwd();
|
|
115
|
+
path = cwd;
|
|
116
|
+
}
|
|
117
|
+
if (assertPath(path), path.length === 0)
|
|
118
|
+
continue;
|
|
119
|
+
resolvedPath = path + "/" + resolvedPath, resolvedAbsolute = path.charCodeAt(0) === 47;
|
|
120
|
+
}
|
|
121
|
+
if (resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute), resolvedAbsolute)
|
|
122
|
+
if (resolvedPath.length > 0)
|
|
123
|
+
return "/" + resolvedPath;
|
|
124
|
+
else
|
|
125
|
+
return "/";
|
|
126
|
+
else if (resolvedPath.length > 0)
|
|
127
|
+
return resolvedPath;
|
|
128
|
+
else
|
|
129
|
+
return ".";
|
|
130
|
+
}
|
|
131
|
+
function normalize(path) {
|
|
132
|
+
if (assertPath(path), path.length === 0)
|
|
133
|
+
return ".";
|
|
134
|
+
var isAbsolute = path.charCodeAt(0) === 47, trailingSeparator = path.charCodeAt(path.length - 1) === 47;
|
|
135
|
+
if (path = normalizeStringPosix(path, !isAbsolute), path.length === 0 && !isAbsolute)
|
|
136
|
+
path = ".";
|
|
137
|
+
if (path.length > 0 && trailingSeparator)
|
|
138
|
+
path += "/";
|
|
139
|
+
if (isAbsolute)
|
|
140
|
+
return "/" + path;
|
|
141
|
+
return path;
|
|
142
|
+
}
|
|
143
|
+
function isAbsolute(path) {
|
|
144
|
+
return assertPath(path), path.length > 0 && path.charCodeAt(0) === 47;
|
|
145
|
+
}
|
|
146
|
+
function join() {
|
|
147
|
+
if (arguments.length === 0)
|
|
148
|
+
return ".";
|
|
149
|
+
var joined;
|
|
150
|
+
for (var i = 0;i < arguments.length; ++i) {
|
|
151
|
+
var arg = arguments[i];
|
|
152
|
+
if (assertPath(arg), arg.length > 0)
|
|
153
|
+
if (joined === undefined)
|
|
154
|
+
joined = arg;
|
|
155
|
+
else
|
|
156
|
+
joined += "/" + arg;
|
|
157
|
+
}
|
|
158
|
+
if (joined === undefined)
|
|
159
|
+
return ".";
|
|
160
|
+
return normalize(joined);
|
|
161
|
+
}
|
|
162
|
+
function relative(from, to) {
|
|
163
|
+
if (assertPath(from), assertPath(to), from === to)
|
|
164
|
+
return "";
|
|
165
|
+
if (from = resolve(from), to = resolve(to), from === to)
|
|
166
|
+
return "";
|
|
167
|
+
var fromStart = 1;
|
|
168
|
+
for (;fromStart < from.length; ++fromStart)
|
|
169
|
+
if (from.charCodeAt(fromStart) !== 47)
|
|
170
|
+
break;
|
|
171
|
+
var fromEnd = from.length, fromLen = fromEnd - fromStart, toStart = 1;
|
|
172
|
+
for (;toStart < to.length; ++toStart)
|
|
173
|
+
if (to.charCodeAt(toStart) !== 47)
|
|
174
|
+
break;
|
|
175
|
+
var toEnd = to.length, toLen = toEnd - toStart, length = fromLen < toLen ? fromLen : toLen, lastCommonSep = -1, i = 0;
|
|
176
|
+
for (;i <= length; ++i) {
|
|
177
|
+
if (i === length) {
|
|
178
|
+
if (toLen > length) {
|
|
179
|
+
if (to.charCodeAt(toStart + i) === 47)
|
|
180
|
+
return to.slice(toStart + i + 1);
|
|
181
|
+
else if (i === 0)
|
|
182
|
+
return to.slice(toStart + i);
|
|
183
|
+
} else if (fromLen > length) {
|
|
184
|
+
if (from.charCodeAt(fromStart + i) === 47)
|
|
185
|
+
lastCommonSep = i;
|
|
186
|
+
else if (i === 0)
|
|
187
|
+
lastCommonSep = 0;
|
|
188
|
+
}
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
var fromCode = from.charCodeAt(fromStart + i), toCode = to.charCodeAt(toStart + i);
|
|
192
|
+
if (fromCode !== toCode)
|
|
193
|
+
break;
|
|
194
|
+
else if (fromCode === 47)
|
|
195
|
+
lastCommonSep = i;
|
|
196
|
+
}
|
|
197
|
+
var out = "";
|
|
198
|
+
for (i = fromStart + lastCommonSep + 1;i <= fromEnd; ++i)
|
|
199
|
+
if (i === fromEnd || from.charCodeAt(i) === 47)
|
|
200
|
+
if (out.length === 0)
|
|
201
|
+
out += "..";
|
|
202
|
+
else
|
|
203
|
+
out += "/..";
|
|
204
|
+
if (out.length > 0)
|
|
205
|
+
return out + to.slice(toStart + lastCommonSep);
|
|
206
|
+
else {
|
|
207
|
+
if (toStart += lastCommonSep, to.charCodeAt(toStart) === 47)
|
|
208
|
+
++toStart;
|
|
209
|
+
return to.slice(toStart);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function _makeLong(path) {
|
|
213
|
+
return path;
|
|
214
|
+
}
|
|
215
|
+
function dirname(path) {
|
|
216
|
+
if (assertPath(path), path.length === 0)
|
|
217
|
+
return ".";
|
|
218
|
+
var code = path.charCodeAt(0), hasRoot = code === 47, end = -1, matchedSlash = true;
|
|
219
|
+
for (var i = path.length - 1;i >= 1; --i)
|
|
220
|
+
if (code = path.charCodeAt(i), code === 47) {
|
|
221
|
+
if (!matchedSlash) {
|
|
222
|
+
end = i;
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
} else
|
|
226
|
+
matchedSlash = false;
|
|
227
|
+
if (end === -1)
|
|
228
|
+
return hasRoot ? "/" : ".";
|
|
229
|
+
if (hasRoot && end === 1)
|
|
230
|
+
return "//";
|
|
231
|
+
return path.slice(0, end);
|
|
232
|
+
}
|
|
233
|
+
function basename(path, ext) {
|
|
234
|
+
if (ext !== undefined && typeof ext !== "string")
|
|
235
|
+
throw TypeError('"ext" argument must be a string');
|
|
236
|
+
assertPath(path);
|
|
237
|
+
var start = 0, end = -1, matchedSlash = true, i;
|
|
238
|
+
if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
|
|
239
|
+
if (ext.length === path.length && ext === path)
|
|
240
|
+
return "";
|
|
241
|
+
var extIdx = ext.length - 1, firstNonSlashEnd = -1;
|
|
242
|
+
for (i = path.length - 1;i >= 0; --i) {
|
|
243
|
+
var code = path.charCodeAt(i);
|
|
244
|
+
if (code === 47) {
|
|
245
|
+
if (!matchedSlash) {
|
|
246
|
+
start = i + 1;
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
} else {
|
|
250
|
+
if (firstNonSlashEnd === -1)
|
|
251
|
+
matchedSlash = false, firstNonSlashEnd = i + 1;
|
|
252
|
+
if (extIdx >= 0)
|
|
253
|
+
if (code === ext.charCodeAt(extIdx)) {
|
|
254
|
+
if (--extIdx === -1)
|
|
255
|
+
end = i;
|
|
256
|
+
} else
|
|
257
|
+
extIdx = -1, end = firstNonSlashEnd;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (start === end)
|
|
261
|
+
end = firstNonSlashEnd;
|
|
262
|
+
else if (end === -1)
|
|
263
|
+
end = path.length;
|
|
264
|
+
return path.slice(start, end);
|
|
265
|
+
} else {
|
|
266
|
+
for (i = path.length - 1;i >= 0; --i)
|
|
267
|
+
if (path.charCodeAt(i) === 47) {
|
|
268
|
+
if (!matchedSlash) {
|
|
269
|
+
start = i + 1;
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
} else if (end === -1)
|
|
273
|
+
matchedSlash = false, end = i + 1;
|
|
274
|
+
if (end === -1)
|
|
275
|
+
return "";
|
|
276
|
+
return path.slice(start, end);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
function extname(path) {
|
|
280
|
+
assertPath(path);
|
|
281
|
+
var startDot = -1, startPart = 0, end = -1, matchedSlash = true, preDotState = 0;
|
|
282
|
+
for (var i = path.length - 1;i >= 0; --i) {
|
|
283
|
+
var code = path.charCodeAt(i);
|
|
284
|
+
if (code === 47) {
|
|
285
|
+
if (!matchedSlash) {
|
|
286
|
+
startPart = i + 1;
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
if (end === -1)
|
|
292
|
+
matchedSlash = false, end = i + 1;
|
|
293
|
+
if (code === 46) {
|
|
294
|
+
if (startDot === -1)
|
|
295
|
+
startDot = i;
|
|
296
|
+
else if (preDotState !== 1)
|
|
297
|
+
preDotState = 1;
|
|
298
|
+
} else if (startDot !== -1)
|
|
299
|
+
preDotState = -1;
|
|
300
|
+
}
|
|
301
|
+
if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)
|
|
302
|
+
return "";
|
|
303
|
+
return path.slice(startDot, end);
|
|
304
|
+
}
|
|
305
|
+
function format(pathObject) {
|
|
306
|
+
if (pathObject === null || typeof pathObject !== "object")
|
|
307
|
+
throw TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
|
308
|
+
return _format("/", pathObject);
|
|
309
|
+
}
|
|
310
|
+
function parse(path) {
|
|
311
|
+
assertPath(path);
|
|
312
|
+
var ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
313
|
+
if (path.length === 0)
|
|
314
|
+
return ret;
|
|
315
|
+
var code = path.charCodeAt(0), isAbsolute2 = code === 47, start;
|
|
316
|
+
if (isAbsolute2)
|
|
317
|
+
ret.root = "/", start = 1;
|
|
318
|
+
else
|
|
319
|
+
start = 0;
|
|
320
|
+
var startDot = -1, startPart = 0, end = -1, matchedSlash = true, i = path.length - 1, preDotState = 0;
|
|
321
|
+
for (;i >= start; --i) {
|
|
322
|
+
if (code = path.charCodeAt(i), code === 47) {
|
|
323
|
+
if (!matchedSlash) {
|
|
324
|
+
startPart = i + 1;
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
if (end === -1)
|
|
330
|
+
matchedSlash = false, end = i + 1;
|
|
331
|
+
if (code === 46) {
|
|
332
|
+
if (startDot === -1)
|
|
333
|
+
startDot = i;
|
|
334
|
+
else if (preDotState !== 1)
|
|
335
|
+
preDotState = 1;
|
|
336
|
+
} else if (startDot !== -1)
|
|
337
|
+
preDotState = -1;
|
|
338
|
+
}
|
|
339
|
+
if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
340
|
+
if (end !== -1)
|
|
341
|
+
if (startPart === 0 && isAbsolute2)
|
|
342
|
+
ret.base = ret.name = path.slice(1, end);
|
|
343
|
+
else
|
|
344
|
+
ret.base = ret.name = path.slice(startPart, end);
|
|
345
|
+
} else {
|
|
346
|
+
if (startPart === 0 && isAbsolute2)
|
|
347
|
+
ret.name = path.slice(1, startDot), ret.base = path.slice(1, end);
|
|
348
|
+
else
|
|
349
|
+
ret.name = path.slice(startPart, startDot), ret.base = path.slice(startPart, end);
|
|
350
|
+
ret.ext = path.slice(startDot, end);
|
|
351
|
+
}
|
|
352
|
+
if (startPart > 0)
|
|
353
|
+
ret.dir = path.slice(0, startPart - 1);
|
|
354
|
+
else if (isAbsolute2)
|
|
355
|
+
ret.dir = "/";
|
|
356
|
+
return ret;
|
|
357
|
+
}
|
|
358
|
+
var sep = "/", delimiter = ":", posix, path_default;
|
|
359
|
+
var init_path = __esm(() => {
|
|
360
|
+
posix = ((p) => (p.posix = p, p))({ resolve, normalize, isAbsolute, join, relative, _makeLong, dirname, basename, extname, format, parse, sep, delimiter, win32: null, posix: null });
|
|
361
|
+
path_default = posix;
|
|
362
|
+
});
|
|
18
363
|
|
|
19
364
|
// src/result.ts
|
|
20
365
|
function Ok(value) {
|
|
@@ -102,6 +447,79 @@ function all(results) {
|
|
|
102
447
|
}
|
|
103
448
|
return Ok(values);
|
|
104
449
|
}
|
|
450
|
+
|
|
451
|
+
class HypenError extends Error {
|
|
452
|
+
code;
|
|
453
|
+
context;
|
|
454
|
+
cause;
|
|
455
|
+
constructor(code, message, options) {
|
|
456
|
+
super(message);
|
|
457
|
+
this.name = "HypenError";
|
|
458
|
+
this.code = code;
|
|
459
|
+
this.context = options?.context;
|
|
460
|
+
this.cause = options?.cause;
|
|
461
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
class ActionError extends HypenError {
|
|
466
|
+
actionName;
|
|
467
|
+
constructor(actionName, cause) {
|
|
468
|
+
super("ACTION_ERROR", `Action handler "${actionName}" failed: ${cause instanceof Error ? cause.message : String(cause)}`, {
|
|
469
|
+
context: { actionName },
|
|
470
|
+
cause: cause instanceof Error ? cause : undefined
|
|
471
|
+
});
|
|
472
|
+
this.name = "ActionError";
|
|
473
|
+
this.actionName = actionName;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
class ConnectionError extends HypenError {
|
|
478
|
+
url;
|
|
479
|
+
attempt;
|
|
480
|
+
constructor(url, cause, attempt) {
|
|
481
|
+
super("CONNECTION_ERROR", `Connection to "${url}" failed${attempt ? ` (attempt ${attempt})` : ""}: ${cause instanceof Error ? cause.message : String(cause)}`, {
|
|
482
|
+
context: { url, attempt },
|
|
483
|
+
cause: cause instanceof Error ? cause : undefined
|
|
484
|
+
});
|
|
485
|
+
this.name = "ConnectionError";
|
|
486
|
+
this.url = url;
|
|
487
|
+
this.attempt = attempt;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
class StateError extends HypenError {
|
|
492
|
+
path;
|
|
493
|
+
constructor(message, path, cause) {
|
|
494
|
+
super("STATE_ERROR", message, {
|
|
495
|
+
context: { path },
|
|
496
|
+
cause: cause instanceof Error ? cause : undefined
|
|
497
|
+
});
|
|
498
|
+
this.name = "StateError";
|
|
499
|
+
this.path = path;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
class ParseError extends HypenError {
|
|
504
|
+
source;
|
|
505
|
+
constructor(message, source, cause) {
|
|
506
|
+
super("PARSE_ERROR", message, {
|
|
507
|
+
context: { source },
|
|
508
|
+
cause: cause instanceof Error ? cause : undefined
|
|
509
|
+
});
|
|
510
|
+
this.name = "ParseError";
|
|
511
|
+
this.source = source;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
class RenderError extends HypenError {
|
|
516
|
+
constructor(message, cause) {
|
|
517
|
+
super("RENDER_ERROR", message, {
|
|
518
|
+
cause: cause instanceof Error ? cause : undefined
|
|
519
|
+
});
|
|
520
|
+
this.name = "RenderError";
|
|
521
|
+
}
|
|
522
|
+
}
|
|
105
523
|
function classifyEngineError(err) {
|
|
106
524
|
const message = err instanceof Error ? err.message : String(err);
|
|
107
525
|
if (message.startsWith("Parse error:")) {
|
|
@@ -115,76 +533,6 @@ function classifyEngineError(err) {
|
|
|
115
533
|
}
|
|
116
534
|
return new RenderError(message);
|
|
117
535
|
}
|
|
118
|
-
var HypenError, ActionError, ConnectionError, StateError, ParseError, RenderError;
|
|
119
|
-
var init_result = __esm(() => {
|
|
120
|
-
HypenError = class HypenError extends Error {
|
|
121
|
-
code;
|
|
122
|
-
context;
|
|
123
|
-
cause;
|
|
124
|
-
constructor(code, message, options) {
|
|
125
|
-
super(message);
|
|
126
|
-
this.name = "HypenError";
|
|
127
|
-
this.code = code;
|
|
128
|
-
this.context = options?.context;
|
|
129
|
-
this.cause = options?.cause;
|
|
130
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
ActionError = class ActionError extends HypenError {
|
|
134
|
-
actionName;
|
|
135
|
-
constructor(actionName, cause) {
|
|
136
|
-
super("ACTION_ERROR", `Action handler "${actionName}" failed: ${cause instanceof Error ? cause.message : String(cause)}`, {
|
|
137
|
-
context: { actionName },
|
|
138
|
-
cause: cause instanceof Error ? cause : undefined
|
|
139
|
-
});
|
|
140
|
-
this.name = "ActionError";
|
|
141
|
-
this.actionName = actionName;
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
ConnectionError = class ConnectionError extends HypenError {
|
|
145
|
-
url;
|
|
146
|
-
attempt;
|
|
147
|
-
constructor(url, cause, attempt) {
|
|
148
|
-
super("CONNECTION_ERROR", `Connection to "${url}" failed${attempt ? ` (attempt ${attempt})` : ""}: ${cause instanceof Error ? cause.message : String(cause)}`, {
|
|
149
|
-
context: { url, attempt },
|
|
150
|
-
cause: cause instanceof Error ? cause : undefined
|
|
151
|
-
});
|
|
152
|
-
this.name = "ConnectionError";
|
|
153
|
-
this.url = url;
|
|
154
|
-
this.attempt = attempt;
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
StateError = class StateError extends HypenError {
|
|
158
|
-
path;
|
|
159
|
-
constructor(message, path, cause) {
|
|
160
|
-
super("STATE_ERROR", message, {
|
|
161
|
-
context: { path },
|
|
162
|
-
cause: cause instanceof Error ? cause : undefined
|
|
163
|
-
});
|
|
164
|
-
this.name = "StateError";
|
|
165
|
-
this.path = path;
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
ParseError = class ParseError extends HypenError {
|
|
169
|
-
source;
|
|
170
|
-
constructor(message, source, cause) {
|
|
171
|
-
super("PARSE_ERROR", message, {
|
|
172
|
-
context: { source },
|
|
173
|
-
cause: cause instanceof Error ? cause : undefined
|
|
174
|
-
});
|
|
175
|
-
this.name = "ParseError";
|
|
176
|
-
this.source = source;
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
RenderError = class RenderError extends HypenError {
|
|
180
|
-
constructor(message, cause) {
|
|
181
|
-
super("RENDER_ERROR", message, {
|
|
182
|
-
cause: cause instanceof Error ? cause : undefined
|
|
183
|
-
});
|
|
184
|
-
this.name = "RenderError";
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
});
|
|
188
536
|
|
|
189
537
|
// src/datasource.ts
|
|
190
538
|
class DataSourceManager {
|
|
@@ -240,6 +588,8 @@ class DataSourceManager {
|
|
|
240
588
|
}
|
|
241
589
|
|
|
242
590
|
// src/state.ts
|
|
591
|
+
var IS_PROXY = Symbol.for("hypen.isProxy");
|
|
592
|
+
var RAW_TARGET = Symbol.for("hypen.rawTarget");
|
|
243
593
|
function deepClone(obj) {
|
|
244
594
|
if (obj === null || typeof obj !== "object") {
|
|
245
595
|
return obj;
|
|
@@ -484,19 +834,33 @@ function unwrapProxy(value) {
|
|
|
484
834
|
}
|
|
485
835
|
return value;
|
|
486
836
|
}
|
|
487
|
-
var IS_PROXY, RAW_TARGET;
|
|
488
|
-
var init_state = __esm(() => {
|
|
489
|
-
IS_PROXY = Symbol.for("hypen.isProxy");
|
|
490
|
-
RAW_TARGET = Symbol.for("hypen.rawTarget");
|
|
491
|
-
});
|
|
492
837
|
|
|
493
838
|
// src/logger.ts
|
|
839
|
+
var LOG_LEVEL_ORDER = {
|
|
840
|
+
debug: 0,
|
|
841
|
+
info: 1,
|
|
842
|
+
warn: 2,
|
|
843
|
+
error: 3,
|
|
844
|
+
none: 4
|
|
845
|
+
};
|
|
846
|
+
var LOG_LEVEL_COLORS = {
|
|
847
|
+
debug: "\x1B[36m",
|
|
848
|
+
info: "\x1B[32m",
|
|
849
|
+
warn: "\x1B[33m",
|
|
850
|
+
error: "\x1B[31m"
|
|
851
|
+
};
|
|
852
|
+
var RESET_COLOR = "\x1B[0m";
|
|
494
853
|
function isProduction() {
|
|
495
854
|
if (typeof process !== "undefined" && process.env) {
|
|
496
855
|
return false;
|
|
497
856
|
}
|
|
498
857
|
return false;
|
|
499
858
|
}
|
|
859
|
+
var config = {
|
|
860
|
+
level: isProduction() ? "error" : "info",
|
|
861
|
+
colors: true,
|
|
862
|
+
timestamps: false
|
|
863
|
+
};
|
|
500
864
|
function setLogLevel(level) {
|
|
501
865
|
config.level = level;
|
|
502
866
|
}
|
|
@@ -627,76 +991,49 @@ class Logger {
|
|
|
627
991
|
function createLogger(tag) {
|
|
628
992
|
return new Logger(tag);
|
|
629
993
|
}
|
|
630
|
-
var
|
|
631
|
-
var
|
|
632
|
-
|
|
633
|
-
debug
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
console.error(formatTag(tag, "error"), ...args);
|
|
671
|
-
}
|
|
672
|
-
};
|
|
673
|
-
frameworkLoggers = {
|
|
674
|
-
hypen: createLogger("Hypen"),
|
|
675
|
-
engine: createLogger("Engine"),
|
|
676
|
-
router: createLogger("Router"),
|
|
677
|
-
state: createLogger("State"),
|
|
678
|
-
events: createLogger("Events"),
|
|
679
|
-
remote: createLogger("Remote"),
|
|
680
|
-
renderer: createLogger("Renderer"),
|
|
681
|
-
module: createLogger("Module"),
|
|
682
|
-
lifecycle: createLogger("Lifecycle"),
|
|
683
|
-
loader: createLogger("Loader"),
|
|
684
|
-
context: createLogger("Context"),
|
|
685
|
-
discovery: createLogger("Discovery"),
|
|
686
|
-
plugin: createLogger("Plugin"),
|
|
687
|
-
canvas: createLogger("Canvas"),
|
|
688
|
-
debug: createLogger("Debug")
|
|
689
|
-
};
|
|
690
|
-
});
|
|
994
|
+
var logger = createLogger("Hypen");
|
|
995
|
+
var log = {
|
|
996
|
+
debug: (tag, ...args) => {
|
|
997
|
+
if (!shouldLog("debug"))
|
|
998
|
+
return;
|
|
999
|
+
console.log(formatTag(tag, "debug"), ...args);
|
|
1000
|
+
},
|
|
1001
|
+
info: (tag, ...args) => {
|
|
1002
|
+
if (!shouldLog("info"))
|
|
1003
|
+
return;
|
|
1004
|
+
console.info(formatTag(tag, "info"), ...args);
|
|
1005
|
+
},
|
|
1006
|
+
warn: (tag, ...args) => {
|
|
1007
|
+
if (!shouldLog("warn"))
|
|
1008
|
+
return;
|
|
1009
|
+
console.warn(formatTag(tag, "warn"), ...args);
|
|
1010
|
+
},
|
|
1011
|
+
error: (tag, ...args) => {
|
|
1012
|
+
if (!shouldLog("error"))
|
|
1013
|
+
return;
|
|
1014
|
+
console.error(formatTag(tag, "error"), ...args);
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
var frameworkLoggers = {
|
|
1018
|
+
hypen: createLogger("Hypen"),
|
|
1019
|
+
engine: createLogger("Engine"),
|
|
1020
|
+
router: createLogger("Router"),
|
|
1021
|
+
state: createLogger("State"),
|
|
1022
|
+
events: createLogger("Events"),
|
|
1023
|
+
remote: createLogger("Remote"),
|
|
1024
|
+
renderer: createLogger("Renderer"),
|
|
1025
|
+
module: createLogger("Module"),
|
|
1026
|
+
lifecycle: createLogger("Lifecycle"),
|
|
1027
|
+
loader: createLogger("Loader"),
|
|
1028
|
+
context: createLogger("Context"),
|
|
1029
|
+
discovery: createLogger("Discovery"),
|
|
1030
|
+
plugin: createLogger("Plugin"),
|
|
1031
|
+
canvas: createLogger("Canvas"),
|
|
1032
|
+
debug: createLogger("Debug")
|
|
1033
|
+
};
|
|
691
1034
|
|
|
692
1035
|
// src/app.ts
|
|
693
|
-
var
|
|
694
|
-
__export(exports_app, {
|
|
695
|
-
app: () => app,
|
|
696
|
-
HypenModuleInstance: () => HypenModuleInstance,
|
|
697
|
-
HypenAppBuilder: () => HypenAppBuilder,
|
|
698
|
-
HypenApp: () => HypenApp
|
|
699
|
-
});
|
|
1036
|
+
var log2 = createLogger("ModuleInstance");
|
|
700
1037
|
|
|
701
1038
|
class HypenAppBuilder {
|
|
702
1039
|
initialState;
|
|
@@ -753,7 +1090,7 @@ class HypenAppBuilder {
|
|
|
753
1090
|
return this.build();
|
|
754
1091
|
}
|
|
755
1092
|
uiFile(path) {
|
|
756
|
-
const fs =
|
|
1093
|
+
const fs = (() => ({}));
|
|
757
1094
|
this.template = fs.readFileSync(path, "utf-8").trim();
|
|
758
1095
|
return this.build();
|
|
759
1096
|
}
|
|
@@ -820,6 +1157,7 @@ class HypenApp {
|
|
|
820
1157
|
this._registry.clear();
|
|
821
1158
|
}
|
|
822
1159
|
}
|
|
1160
|
+
var app = new HypenApp;
|
|
823
1161
|
|
|
824
1162
|
class HypenModuleInstance {
|
|
825
1163
|
engine;
|
|
@@ -1023,17 +1361,6 @@ class HypenModuleInstance {
|
|
|
1023
1361
|
Object.assign(this.state, patch);
|
|
1024
1362
|
}
|
|
1025
1363
|
}
|
|
1026
|
-
var log2, app;
|
|
1027
|
-
var init_app = __esm(() => {
|
|
1028
|
-
init_result();
|
|
1029
|
-
init_state();
|
|
1030
|
-
init_logger();
|
|
1031
|
-
log2 = createLogger("ModuleInstance");
|
|
1032
|
-
app = new HypenApp;
|
|
1033
|
-
});
|
|
1034
|
-
|
|
1035
|
-
// src/index.ts
|
|
1036
|
-
init_app();
|
|
1037
1364
|
|
|
1038
1365
|
// src/hypen.ts
|
|
1039
1366
|
function createBindingProxy(root) {
|
|
@@ -1083,11 +1410,7 @@ function hypen(strings, ...expressions) {
|
|
|
1083
1410
|
return result.trim();
|
|
1084
1411
|
}
|
|
1085
1412
|
|
|
1086
|
-
// src/index.ts
|
|
1087
|
-
init_state();
|
|
1088
|
-
|
|
1089
1413
|
// src/renderer.ts
|
|
1090
|
-
init_logger();
|
|
1091
1414
|
var log3 = frameworkLoggers.renderer;
|
|
1092
1415
|
|
|
1093
1416
|
class BaseRenderer {
|
|
@@ -1137,11 +1460,8 @@ class ConsoleRenderer {
|
|
|
1137
1460
|
console.groupEnd();
|
|
1138
1461
|
}
|
|
1139
1462
|
}
|
|
1140
|
-
// src/router.ts
|
|
1141
|
-
init_state();
|
|
1142
1463
|
|
|
1143
1464
|
// src/disposable.ts
|
|
1144
|
-
init_logger();
|
|
1145
1465
|
var log4 = frameworkLoggers.lifecycle;
|
|
1146
1466
|
function isDisposable(obj) {
|
|
1147
1467
|
return obj !== null && typeof obj === "object" && "dispose" in obj && typeof obj.dispose === "function";
|
|
@@ -1289,7 +1609,6 @@ function usingSync(resource, fn) {
|
|
|
1289
1609
|
}
|
|
1290
1610
|
|
|
1291
1611
|
// src/router.ts
|
|
1292
|
-
init_logger();
|
|
1293
1612
|
var log5 = frameworkLoggers.router;
|
|
1294
1613
|
|
|
1295
1614
|
class HypenRouter {
|
|
@@ -1499,8 +1818,8 @@ class HypenRouter {
|
|
|
1499
1818
|
this.dispose();
|
|
1500
1819
|
}
|
|
1501
1820
|
}
|
|
1821
|
+
|
|
1502
1822
|
// src/events.ts
|
|
1503
|
-
init_logger();
|
|
1504
1823
|
var log6 = frameworkLoggers.events;
|
|
1505
1824
|
|
|
1506
1825
|
class TypedEventEmitter {
|
|
@@ -1564,8 +1883,8 @@ class TypedEventEmitter {
|
|
|
1564
1883
|
function createEventEmitter() {
|
|
1565
1884
|
return new TypedEventEmitter;
|
|
1566
1885
|
}
|
|
1886
|
+
|
|
1567
1887
|
// src/context.ts
|
|
1568
|
-
init_logger();
|
|
1569
1888
|
var log7 = frameworkLoggers.context;
|
|
1570
1889
|
|
|
1571
1890
|
class HypenGlobalContext {
|
|
@@ -1669,11 +1988,8 @@ class HypenGlobalContext {
|
|
|
1669
1988
|
};
|
|
1670
1989
|
}
|
|
1671
1990
|
}
|
|
1672
|
-
// src/remote/client.ts
|
|
1673
|
-
init_result();
|
|
1674
1991
|
|
|
1675
1992
|
// src/retry.ts
|
|
1676
|
-
init_result();
|
|
1677
1993
|
var DEFAULT_OPTIONS = {
|
|
1678
1994
|
maxAttempts: 3,
|
|
1679
1995
|
delayMs: 1000,
|
|
@@ -1799,7 +2115,6 @@ var RetryPresets = {
|
|
|
1799
2115
|
};
|
|
1800
2116
|
|
|
1801
2117
|
// src/remote/client.ts
|
|
1802
|
-
init_logger();
|
|
1803
2118
|
var log8 = frameworkLoggers.remote;
|
|
1804
2119
|
|
|
1805
2120
|
class RemoteEngine {
|
|
@@ -2065,6 +2380,7 @@ class RemoteEngine {
|
|
|
2065
2380
|
}, this.options.reconnectInterval);
|
|
2066
2381
|
}
|
|
2067
2382
|
}
|
|
2383
|
+
|
|
2068
2384
|
// src/remote/session.ts
|
|
2069
2385
|
class SessionManager {
|
|
2070
2386
|
activeSessions = new Map;
|
|
@@ -2188,6 +2504,7 @@ class SessionManager {
|
|
|
2188
2504
|
this.sessionConnections.clear();
|
|
2189
2505
|
}
|
|
2190
2506
|
}
|
|
2507
|
+
|
|
2191
2508
|
// src/resolver.ts
|
|
2192
2509
|
class ComponentResolver {
|
|
2193
2510
|
cache = new Map;
|
|
@@ -2235,9 +2552,9 @@ class ComponentResolver {
|
|
|
2235
2552
|
return this.extractComponents(importStmt.clause, component);
|
|
2236
2553
|
}
|
|
2237
2554
|
async resolveLocal(path) {
|
|
2238
|
-
const { resolve, join } = await
|
|
2555
|
+
const { resolve: resolve2, join: join2 } = await Promise.resolve().then(() => (init_path(), exports_path));
|
|
2239
2556
|
const { readFile } = await import("fs/promises");
|
|
2240
|
-
const basePath =
|
|
2557
|
+
const basePath = resolve2(this.options.baseDir, path);
|
|
2241
2558
|
const hypenPath = basePath.endsWith(".hypen") ? basePath : `${basePath}.hypen`;
|
|
2242
2559
|
const template = await readFile(hypenPath, "utf-8");
|
|
2243
2560
|
const modulePath = hypenPath.replace(/\.hypen$/, ".ts");
|
|
@@ -2308,9 +2625,8 @@ class ComponentResolver {
|
|
|
2308
2625
|
return imports;
|
|
2309
2626
|
}
|
|
2310
2627
|
}
|
|
2628
|
+
|
|
2311
2629
|
// src/components/builtin.ts
|
|
2312
|
-
init_app();
|
|
2313
|
-
init_logger();
|
|
2314
2630
|
var log9 = frameworkLoggers.router;
|
|
2315
2631
|
var Router = app.defineState({
|
|
2316
2632
|
currentPath: "/",
|
|
@@ -2385,10 +2701,6 @@ var Link = app.defineState({
|
|
|
2385
2701
|
});
|
|
2386
2702
|
}
|
|
2387
2703
|
}).build();
|
|
2388
|
-
|
|
2389
|
-
// src/index.ts
|
|
2390
|
-
init_result();
|
|
2391
|
-
init_logger();
|
|
2392
2704
|
export {
|
|
2393
2705
|
withRetry,
|
|
2394
2706
|
usingSync,
|
|
@@ -2471,4 +2783,4 @@ export {
|
|
|
2471
2783
|
ActionError
|
|
2472
2784
|
};
|
|
2473
2785
|
|
|
2474
|
-
//# debugId=
|
|
2786
|
+
//# debugId=D79999CB9031D22F64756E2164756E21
|