fullstacked 1.0.0-alpha.1783 → 1.0.0-alpha.1804

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/index.js CHANGED
@@ -507,9 +507,10 @@ var require_DOMParser = __commonJS({
507
507
  }
508
508
  var key;
509
509
  var i;
510
- function ParseError(message, locator) {
510
+ function ParseError(message, locator, cause) {
511
511
  this.message = message;
512
512
  this.locator = locator;
513
+ this.cause = cause;
513
514
  if (Error.captureStackTrace) Error.captureStackTrace(this, ParseError);
514
515
  }
515
516
  extendError(ParseError);
@@ -565,7 +566,7 @@ var require_DOMParser = __commonJS({
565
566
  }
566
567
  return isStr ? part : part.source;
567
568
  }).join(""),
568
- UNICODE_SUPPORT ? "mu" : "m"
569
+ UNICODE_SUPPORT ? "u" : ""
569
570
  );
570
571
  }
571
572
  function regg(args2) {
@@ -591,6 +592,7 @@ var require_DOMParser = __commonJS({
591
592
  var NameStartChar_s = chars(NameStartChar);
592
593
  var NameChar = reg("[", NameStartChar_s, chars(/[-.0-9\xB7]/), chars(/[\u0300-\u036F\u203F-\u2040]/), "]");
593
594
  var Name = reg(NameStartChar, NameChar, "*");
595
+ var Name_exact = reg("^", Name, "$");
594
596
  var Nmtoken = reg(NameChar, "+");
595
597
  var EntityRef = reg("&", Name, ";");
596
598
  var CharRef = regg(/&#[0-9]+;|&#x[0-9a-fA-F]+;/);
@@ -605,11 +607,12 @@ var require_DOMParser = __commonJS({
605
607
  var NCNameStartChar = chars_without(NameStartChar, ":");
606
608
  var NCNameChar = chars_without(NameChar, ":");
607
609
  var NCName = reg(NCNameStartChar, NCNameChar, "*");
610
+ var NCName_exact = reg("^", NCName, "$");
608
611
  var QName = reg(NCName, regg(":", NCName), "?");
609
612
  var QName_exact = reg("^", QName, "$");
610
613
  var QName_group = reg("(", QName, ")");
611
614
  var SystemLiteral = regg(/"[^"]*"|'[^']*'/);
612
- var PI = reg(/^<\?/, "(", Name, ")", regg(S, "(", Char, "*?)"), "?", /\?>/);
615
+ var PI = reg(/^<\?/, "(", Name, ")", regg(S, "(?!", _SChar, ")(", Char, "*?)"), "?", /\?>/);
613
616
  var PubidChar = /[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/;
614
617
  var PubidLiteral = regg('"', PubidChar, '*"', "|", "'", chars_without(PubidChar, "'"), "*'");
615
618
  var COMMENT_START = "<!--";
@@ -698,6 +701,8 @@ var require_DOMParser = __commonJS({
698
701
  exports2.ExternalID = ExternalID;
699
702
  exports2.ExternalID_match = ExternalID_match;
700
703
  exports2.Name = Name;
704
+ exports2.Name_exact = Name_exact;
705
+ exports2.NCName_exact = NCName_exact;
701
706
  exports2.NotationDecl = NotationDecl;
702
707
  exports2.Reference = Reference;
703
708
  exports2.PEReference = PEReference;
@@ -987,6 +992,8 @@ var require_DOMParser = __commonJS({
987
992
  };
988
993
  _extends(LiveNodeList, NodeList);
989
994
  function NamedNodeMap() {
995
+ this._nsIndex = /* @__PURE__ */ Object.create(null);
996
+ this._noNsIndex = /* @__PURE__ */ Object.create(null);
990
997
  }
991
998
  function _findNodeIndex(list, node) {
992
999
  var i = 0;
@@ -997,6 +1004,30 @@ var require_DOMParser = __commonJS({
997
1004
  i++;
998
1005
  }
999
1006
  }
1007
+ function _nnmBucket(map, namespaceURI, create) {
1008
+ if (!namespaceURI) {
1009
+ return map._noNsIndex;
1010
+ }
1011
+ var bucket = map._nsIndex[namespaceURI];
1012
+ if (!bucket && create) {
1013
+ bucket = map._nsIndex[namespaceURI] = /* @__PURE__ */ Object.create(null);
1014
+ }
1015
+ return bucket;
1016
+ }
1017
+ function _nnmIndexFind(map, namespaceURI, localName) {
1018
+ var bucket = _nnmBucket(map, namespaceURI, false);
1019
+ var found = bucket && bucket[localName];
1020
+ return found ? found : null;
1021
+ }
1022
+ function _nnmIndexAdd(map, attr) {
1023
+ _nnmBucket(map, attr.namespaceURI, true)[attr.localName] = attr;
1024
+ }
1025
+ function _nnmIndexRemove(map, attr) {
1026
+ var bucket = _nnmBucket(map, attr.namespaceURI, false);
1027
+ if (bucket) {
1028
+ delete bucket[attr.localName];
1029
+ }
1030
+ }
1000
1031
  function _addNamedNode(el, list, newAttr, oldAttr) {
1001
1032
  if (oldAttr) {
1002
1033
  list[_findNodeIndex(list, oldAttr)] = newAttr;
@@ -1004,6 +1035,7 @@ var require_DOMParser = __commonJS({
1004
1035
  list[list.length] = newAttr;
1005
1036
  list.length++;
1006
1037
  }
1038
+ _nnmIndexAdd(list, newAttr);
1007
1039
  if (el) {
1008
1040
  newAttr.ownerElement = el;
1009
1041
  var doc = el.ownerDocument;
@@ -1021,6 +1053,7 @@ var require_DOMParser = __commonJS({
1021
1053
  list[i] = list[++i];
1022
1054
  }
1023
1055
  list.length = lastIndex;
1056
+ _nnmIndexRemove(list, attr);
1024
1057
  if (el) {
1025
1058
  var doc = el.ownerDocument;
1026
1059
  if (doc) {
@@ -1076,7 +1109,7 @@ var require_DOMParser = __commonJS({
1076
1109
  if (el && el !== this._ownerElement) {
1077
1110
  throw new DOMException2(DOMException2.INUSE_ATTRIBUTE_ERR);
1078
1111
  }
1079
- var oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);
1112
+ var oldAttr = _nnmIndexFind(this, attr.namespaceURI, attr.localName);
1080
1113
  if (oldAttr === attr) {
1081
1114
  return attr;
1082
1115
  }
@@ -1738,8 +1771,29 @@ var require_DOMParser = __commonJS({
1738
1771
  while (child) {
1739
1772
  var next = child.nextSibling;
1740
1773
  if (next !== null && next.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE) {
1741
- node.removeChild(next);
1742
- child.appendData(next.data);
1774
+ var tail = [];
1775
+ var sibling = next;
1776
+ while (sibling !== null && sibling.nodeType === TEXT_NODE) {
1777
+ tail.push(sibling.data);
1778
+ sibling = sibling.nextSibling;
1779
+ }
1780
+ var removed = child.nextSibling;
1781
+ while (removed !== sibling) {
1782
+ var following = removed.nextSibling;
1783
+ removed.parentNode = null;
1784
+ removed.previousSibling = null;
1785
+ removed.nextSibling = null;
1786
+ removed = following;
1787
+ }
1788
+ child.nextSibling = sibling;
1789
+ if (sibling !== null) {
1790
+ sibling.previousSibling = child;
1791
+ } else {
1792
+ node.lastChild = child;
1793
+ }
1794
+ child.appendData(tail.join(""));
1795
+ _onUpdateChild(node.ownerDocument, node);
1796
+ child = sibling;
1743
1797
  } else {
1744
1798
  child = next;
1745
1799
  }
@@ -2377,10 +2431,10 @@ var require_DOMParser = __commonJS({
2377
2431
  * "InvalidCharacterError".
2378
2432
  *
2379
2433
  * Note: When the resulting document is serialized with `requireWellFormed: true`, the
2380
- * serializer throws `InvalidStateError` if `.target` contains `:` or is an ASCII
2381
- * case-insensitive match for `"xml"`, or if `.data` contains `?>` or characters outside the
2382
- * XML Char production (W3C DOM Parsing §3.2.1.7). Without that option the data is emitted
2383
- * verbatim.
2434
+ * serializer throws `InvalidStateError` if `.target` is not a valid XML `NCName` (a `Name`
2435
+ * with no colon) or is an ASCII case-insensitive match for `"xml"`, or if `.data` contains
2436
+ * `?>` or characters outside the XML Char production (W3C DOM Parsing §3.2.1.7). Without that
2437
+ * option the target and data are emitted verbatim.
2384
2438
  *
2385
2439
  * @param {string} target
2386
2440
  * @param {string} data
@@ -2435,19 +2489,29 @@ var require_DOMParser = __commonJS({
2435
2489
  * The current implementation does not fill the `childNodes` with those of the corresponding
2436
2490
  * `Entity`
2437
2491
  *
2492
+ * The `name` is validated against the XML `Name` production at creation time; an invalid name
2493
+ * throws `InvalidCharacterError`. When the resulting node is serialized with
2494
+ * `requireWellFormed: true`, the serializer re-validates `nodeName` against the XML `Name`
2495
+ * production and throws `InvalidStateError` if a later `nodeName` mutation made it invalid;
2496
+ * without that option the name is emitted verbatim.
2497
+ *
2498
+ * __This implementation differs from the specification:__ xmldom does not expand entities —
2499
+ * the parser resolves entity references inline and never constructs `EntityReference` nodes,
2500
+ * so this method is the only producer.
2501
+ *
2438
2502
  * @deprecated
2439
2503
  * In DOM Level 4.
2440
2504
  * @param {string} name
2441
2505
  * The name of the entity to reference. No namespace well-formedness checks are performed.
2442
2506
  * @returns {EntityReference}
2443
2507
  * @throws {DOMException}
2444
- * With code `INVALID_CHARACTER_ERR` when `name` is not valid.
2508
+ * With code `INVALID_CHARACTER_ERR` when `name` is not a valid XML `Name`.
2445
2509
  * @throws {DOMException}
2446
2510
  * with code `NOT_SUPPORTED_ERR` when the document is of type `html`
2447
2511
  * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-392B75AE
2448
2512
  */
2449
2513
  createEntityReference: function(name) {
2450
- if (!g.Name.test(name)) {
2514
+ if (!g.Name_exact.test(name)) {
2451
2515
  throw new DOMException2(DOMException2.INVALID_CHARACTER_ERR, 'not a valid xml name "' + name + '"');
2452
2516
  }
2453
2517
  if (this.type === "html") {
@@ -2885,7 +2949,13 @@ var require_DOMParser = __commonJS({
2885
2949
  }
2886
2950
  return true;
2887
2951
  }
2888
- function addSerializedAttribute(buf, qualifiedName, value) {
2952
+ function addSerializedAttribute(buf, qualifiedName, value, requireWellFormed) {
2953
+ if (requireWellFormed && !g.QName_exact.test(qualifiedName)) {
2954
+ throw new DOMException2(
2955
+ 'The attribute name "' + qualifiedName + '" is not a valid XML QName',
2956
+ DOMExceptionName.InvalidStateError
2957
+ );
2958
+ }
2889
2959
  buf.push(" ", qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
2890
2960
  }
2891
2961
  function serializeToString(node, buf, visibleNamespaces, opts) {
@@ -2949,6 +3019,12 @@ var require_DOMParser = __commonJS({
2949
3019
  }
2950
3020
  }
2951
3021
  }
3022
+ if (requireWellFormed && !g.QName_exact.test(prefixedNodeName)) {
3023
+ throw new DOMException2(
3024
+ 'The element name "' + prefixedNodeName + '" is not a valid XML QName',
3025
+ DOMExceptionName.InvalidStateError
3026
+ );
3027
+ }
2952
3028
  buf.push("<", prefixedNodeName);
2953
3029
  var childNamespaces = namespaces.slice();
2954
3030
  for (var i = 0; i < len; i++) {
@@ -2967,7 +3043,7 @@ var require_DOMParser = __commonJS({
2967
3043
  if (needNamespaceDefine(attr, isHTML, childNamespaces)) {
2968
3044
  var attrPrefix = attr.prefix || "";
2969
3045
  var uri = attr.namespaceURI;
2970
- addSerializedAttribute(buf, attrPrefix ? "xmlns:" + attrPrefix : "xmlns", uri);
3046
+ addSerializedAttribute(buf, attrPrefix ? "xmlns:" + attrPrefix : "xmlns", uri, requireWellFormed);
2971
3047
  childNamespaces.push({ prefix: attrPrefix, namespace: uri });
2972
3048
  }
2973
3049
  var filteredAttr = nodeFilter ? nodeFilter(attr) : attr;
@@ -2975,14 +3051,14 @@ var require_DOMParser = __commonJS({
2975
3051
  if (typeof filteredAttr === "string") {
2976
3052
  buf.push(filteredAttr);
2977
3053
  } else {
2978
- addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value);
3054
+ addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value, requireWellFormed);
2979
3055
  }
2980
3056
  }
2981
3057
  }
2982
3058
  if (nodeName === prefixedNodeName && needNamespaceDefine(n, isHTML, childNamespaces)) {
2983
3059
  var nodePrefix = n.prefix || "";
2984
3060
  var uri = n.namespaceURI;
2985
- addSerializedAttribute(buf, nodePrefix ? "xmlns:" + nodePrefix : "xmlns", uri);
3061
+ addSerializedAttribute(buf, nodePrefix ? "xmlns:" + nodePrefix : "xmlns", uri, requireWellFormed);
2986
3062
  childNamespaces.push({ prefix: nodePrefix, namespace: uri });
2987
3063
  }
2988
3064
  var canCloseTag = !n.firstChild;
@@ -3015,7 +3091,7 @@ var require_DOMParser = __commonJS({
3015
3091
  }
3016
3092
  return { ns: namespaces };
3017
3093
  case ATTRIBUTE_NODE:
3018
- addSerializedAttribute(buf, n.name, n.value);
3094
+ addSerializedAttribute(buf, n.name, n.value, requireWellFormed);
3019
3095
  return null;
3020
3096
  case TEXT_NODE:
3021
3097
  if (requireWellFormed && g.InvalidChar.test(n.data)) {
@@ -3057,6 +3133,12 @@ var require_DOMParser = __commonJS({
3057
3133
  var pubid = n.publicId;
3058
3134
  var sysid = n.systemId;
3059
3135
  if (requireWellFormed) {
3136
+ if (!g.Name_exact.test(n.name)) {
3137
+ throw new DOMException2(
3138
+ 'The doctype name "' + n.name + '" is not a valid XML Name',
3139
+ DOMExceptionName.InvalidStateError
3140
+ );
3141
+ }
3060
3142
  if (pubid && !g.PubidLiteral_match.test(pubid)) {
3061
3143
  throw new DOMException2("DocumentType publicId is not a valid PubidLiteral", DOMExceptionName.InvalidStateError);
3062
3144
  }
@@ -3083,8 +3165,11 @@ var require_DOMParser = __commonJS({
3083
3165
  return null;
3084
3166
  case PROCESSING_INSTRUCTION_NODE:
3085
3167
  if (requireWellFormed) {
3086
- if (n.target.indexOf(":") !== -1 || n.target.toLowerCase() === "xml") {
3087
- throw new DOMException2("The ProcessingInstruction target is not well-formed", DOMExceptionName.InvalidStateError);
3168
+ if (!g.NCName_exact.test(n.target) || n.target.toLowerCase() === "xml") {
3169
+ throw new DOMException2(
3170
+ 'The processing instruction target "' + n.target + '" is not a valid XML NCName or is reserved',
3171
+ DOMExceptionName.InvalidStateError
3172
+ );
3088
3173
  }
3089
3174
  if (g.InvalidChar.test(n.data)) {
3090
3175
  throw new DOMException2(
@@ -3099,6 +3184,12 @@ var require_DOMParser = __commonJS({
3099
3184
  buf.push("<?", n.target, " ", n.data, "?>");
3100
3185
  return null;
3101
3186
  case ENTITY_REFERENCE_NODE:
3187
+ if (requireWellFormed && !g.Name_exact.test(n.nodeName)) {
3188
+ throw new DOMException2(
3189
+ 'The entity reference name "' + n.nodeName + '" is not a valid XML Name',
3190
+ DOMExceptionName.InvalidStateError
3191
+ );
3192
+ }
3102
3193
  buf.push("&", n.nodeName, ";");
3103
3194
  return null;
3104
3195
  //case ENTITY_NODE:
@@ -3236,6 +3327,25 @@ var require_DOMParser = __commonJS({
3236
3327
  }
3237
3328
  }
3238
3329
  });
3330
+ Object.defineProperty(CharacterData.prototype, "data", {
3331
+ get: function() {
3332
+ return this._data != null ? this._data : "";
3333
+ },
3334
+ set: function(v) {
3335
+ this._data = v;
3336
+ this.length = typeof v === "string" ? v.length : 0;
3337
+ }
3338
+ });
3339
+ Object.defineProperty(CharacterData.prototype, "nodeValue", {
3340
+ get: function() {
3341
+ return this.data;
3342
+ },
3343
+ set: function(v) {
3344
+ this.data = v;
3345
+ },
3346
+ enumerable: true,
3347
+ configurable: true
3348
+ });
3239
3349
  Object.defineProperty(Element.prototype, "children", {
3240
3350
  get: function() {
3241
3351
  return new LiveNodeList(this, childrenRefresh);
@@ -5545,9 +5655,26 @@ var require_DOMParser = __commonJS({
5545
5655
  if (!tagNameRaw) {
5546
5656
  return errorHandler.fatalError("end tag name missing");
5547
5657
  }
5548
- var tagNameMatch = end > 0 && g.reg("^", g.QName_group, g.S_OPT, "$").exec(tagNameRaw);
5658
+ var endTagNameStrict = g.reg("^", g.QName_group, g.S_OPT, "$");
5659
+ var tagNameMatch = end > 0 && endTagNameStrict.exec(tagNameRaw);
5549
5660
  if (!tagNameMatch) {
5550
- return errorHandler.fatalError('end tag name contains invalid characters: "' + tagNameRaw + '"');
5661
+ var leadingTagNameMatch = end > 0 && g.reg("^", g.QName_group).exec(tagNameRaw);
5662
+ if (isHTML && leadingTagNameMatch) {
5663
+ errorHandler.warning('end tag name contains invalid trailing characters: "' + tagNameRaw + '"');
5664
+ tagNameMatch = leadingTagNameMatch;
5665
+ } else if (
5666
+ // Backward compatibility, remove this whole `else if` arm in the next breaking release
5667
+ // (XML then falls through to the `fatalError` below, for a clean mode split: XML fatal,
5668
+ // HTML warning). A valid end-tag name followed by a line break and trailing content was
5669
+ // silently accepted while `reg` still used the `m` flag; re-adding `m` here matches exactly
5670
+ // those inputs, kept recoverable and reported.
5671
+ leadingTagNameMatch && new RegExp(endTagNameStrict.source, endTagNameStrict.flags + "m").test(tagNameRaw)
5672
+ ) {
5673
+ errorHandler.error('end tag name is followed by a line break and trailing content: "' + tagNameRaw + '"');
5674
+ tagNameMatch = leadingTagNameMatch;
5675
+ } else {
5676
+ return errorHandler.fatalError('end tag name contains invalid characters: "' + tagNameRaw + '"');
5677
+ }
5551
5678
  }
5552
5679
  if (!domBuilder.currentElement && !domBuilder.doc.documentElement) {
5553
5680
  return;
@@ -5621,7 +5748,7 @@ var require_DOMParser = __commonJS({
5621
5748
  if (e instanceof ParseError) {
5622
5749
  throw e;
5623
5750
  } else if (e instanceof DOMException2) {
5624
- throw new ParseError(e.name + ": " + e.message, domBuilder.locator, e);
5751
+ return errorHandler.fatalError("Error constructing the DOM: " + e.name + ": " + e.message, e);
5625
5752
  }
5626
5753
  errorHandler.error("element parse error: " + e);
5627
5754
  end = -1;
@@ -5662,6 +5789,9 @@ var require_DOMParser = __commonJS({
5662
5789
  var s = S_TAG;
5663
5790
  while (true) {
5664
5791
  var c = source.charAt(p);
5792
+ if (s === S_TAG && c === "<") {
5793
+ throw new Error("unexpected < in tag name: " + source.slice(start, p));
5794
+ }
5665
5795
  switch (c) {
5666
5796
  case "=":
5667
5797
  if (s === S_ATTR) {
@@ -5837,7 +5967,7 @@ var require_DOMParser = __commonJS({
5837
5967
  if (nsPrefix !== false) {
5838
5968
  if (localNSMap == null) {
5839
5969
  localNSMap = /* @__PURE__ */ Object.create(null);
5840
- _copy(currentNSMap, currentNSMap = /* @__PURE__ */ Object.create(null));
5970
+ currentNSMap = Object.create(currentNSMap);
5841
5971
  }
5842
5972
  currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
5843
5973
  a.uri = NAMESPACE.XMLNS;
@@ -5884,7 +6014,13 @@ var require_DOMParser = __commonJS({
5884
6014
  function parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) {
5885
6015
  var isEscapableRaw = isHTMLEscapableRawTextElement(tagName);
5886
6016
  if (isEscapableRaw || isHTMLRawTextElement(tagName)) {
5887
- var elEndStart = source.indexOf("</" + tagName + ">", elStartEnd);
6017
+ var closeTag = new RegExp("</" + tagName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + ">", "ig");
6018
+ closeTag.lastIndex = elStartEnd;
6019
+ var match = closeTag.exec(source);
6020
+ var elEndStart = match ? match.index : -1;
6021
+ if (elEndStart < 0) {
6022
+ return elStartEnd + 1;
6023
+ }
5888
6024
  var text = source.substring(elStartEnd + 1, elEndStart);
5889
6025
  if (isEscapableRaw) {
5890
6026
  text = text.replace(ENTITY_REG, entityReplacer);
@@ -6386,14 +6522,16 @@ var require_DOMParser = __commonJS({
6386
6522
  *
6387
6523
  * @param {string} message
6388
6524
  * - The message to be used for reporting and throwing the error.
6525
+ * @param {Error} [cause]
6526
+ * The error that caused this fatal error, preserved as the thrown `ParseError`'s `cause`.
6389
6527
  * @returns {never}
6390
6528
  * This function always throws an error and never returns a value.
6391
6529
  * @throws {ParseError}
6392
6530
  * Always throws a ParseError with the provided message.
6393
6531
  */
6394
- fatalError: function(message) {
6532
+ fatalError: function(message, cause) {
6395
6533
  this.reportError("fatalError", message);
6396
- throw new ParseError(message, this.locator);
6534
+ throw new ParseError(message, this.locator, cause);
6397
6535
  }
6398
6536
  };
6399
6537
  function _locator(l) {
@@ -6541,8 +6679,9 @@ async function BridgeNodeInit() {
6541
6679
  webSocketUrl.protocol = webSocketUrl.protocol === "https:" ? "wss:" : "ws:";
6542
6680
  const ctx = await (await fetch("/ctx")).json();
6543
6681
  let ws;
6682
+ const NativeWebSocket = globalThis.fullstacked?.WebSocket || WebSocket;
6544
6683
  const webSocketForCallback = new Promise((res) => {
6545
- ws = new WebSocket(webSocketUrl);
6684
+ ws = new NativeWebSocket(webSocketUrl);
6546
6685
  ws.binaryType = "arraybuffer";
6547
6686
  ws.onmessage = (e) => {
6548
6687
  globalThis.fullstacked.onStreamData(
@@ -6905,7 +7044,9 @@ async function BridgeLinuxInit() {
6905
7044
  }
6906
7045
  };
6907
7046
  globalThis.fullstacked.window = globalThis.fullstacked.window || {};
6908
- globalThis.fullstacked.window.getSize = () => (globalThis.fullstacked.fetch || fetch)("/resize").then((r) => r.text());
7047
+ globalThis.fullstacked.window.getSize = () => (globalThis.fullstacked.fetch || fetch)("/resize").then(
7048
+ (r) => r.text()
7049
+ );
6909
7050
  globalThis.fullstacked.window.resize = function(size) {
6910
7051
  (globalThis.fullstacked.fetch || fetch)(`/resize?size=${size}`);
6911
7052
  };
@@ -7053,6 +7194,7 @@ var Fetch = 8;
7053
7194
  var Bundle = 9;
7054
7195
  var Packages = 12;
7055
7196
  var Plugin = 14;
7197
+ var WebSocket2 = 15;
7056
7198
  var CoreResponseError = 0;
7057
7199
  var CoreResponseData = 1;
7058
7200
  var CoreResponseStream = 2;
@@ -7820,6 +7962,237 @@ async function fetchCore(request, init2) {
7820
7962
  }
7821
7963
  var fetch_default = fetchCore;
7822
7964
 
7965
+ // ../../core/internal/bundle/lib/@types/websocket.ts
7966
+ var Connect = 0;
7967
+
7968
+ // ../../core/internal/bundle/lib/websocket/index.ts
7969
+ var GlobalCloseEvent = typeof CloseEvent !== "undefined" ? CloseEvent : class CloseEvent2 extends Event {
7970
+ code;
7971
+ reason;
7972
+ wasClean;
7973
+ constructor(type2, eventInitDict) {
7974
+ super(type2, eventInitDict);
7975
+ this.code = eventInitDict?.code ?? 0;
7976
+ this.reason = eventInitDict?.reason ?? "";
7977
+ this.wasClean = eventInitDict?.wasClean ?? false;
7978
+ }
7979
+ };
7980
+ var WebSocketCore = class _WebSocketCore extends EventTarget {
7981
+ static CONNECTING = 0;
7982
+ static OPEN = 1;
7983
+ static CLOSING = 2;
7984
+ static CLOSED = 3;
7985
+ CONNECTING = 0;
7986
+ OPEN = 1;
7987
+ CLOSING = 2;
7988
+ CLOSED = 3;
7989
+ url;
7990
+ readyState = _WebSocketCore.CONNECTING;
7991
+ bufferedAmount = 0;
7992
+ protocol = "";
7993
+ extensions = "";
7994
+ binaryType = "blob";
7995
+ onopen = null;
7996
+ onerror = null;
7997
+ onclose = null;
7998
+ onmessage = null;
7999
+ #duplex = null;
8000
+ #ee = null;
8001
+ constructor(url2, protocols) {
8002
+ super();
8003
+ let parsedUrl;
8004
+ try {
8005
+ if (url2 instanceof URL) {
8006
+ parsedUrl = url2;
8007
+ } else if (typeof url2 === "string") {
8008
+ if (url2.startsWith("/") && typeof globalThis.location !== "undefined") {
8009
+ const origin = globalThis.location.origin || globalThis.location.href || "http://localhost";
8010
+ parsedUrl = new URL(url2, origin);
8011
+ if (parsedUrl.protocol === "http:") {
8012
+ parsedUrl.protocol = "ws:";
8013
+ } else if (parsedUrl.protocol === "https:") {
8014
+ parsedUrl.protocol = "wss:";
8015
+ }
8016
+ } else {
8017
+ parsedUrl = new URL(url2);
8018
+ }
8019
+ } else {
8020
+ throw new Error("Invalid URL");
8021
+ }
8022
+ } catch {
8023
+ throw new DOMException(
8024
+ `The URL '${url2}' is invalid.`,
8025
+ "SyntaxError"
8026
+ );
8027
+ }
8028
+ if (parsedUrl.protocol !== "ws:" && parsedUrl.protocol !== "wss:") {
8029
+ throw new DOMException(
8030
+ `The URL's scheme must be either 'ws' or 'wss'. '${parsedUrl.protocol}' is not allowed.`,
8031
+ "SyntaxError"
8032
+ );
8033
+ }
8034
+ this.url = parsedUrl.toString();
8035
+ let parsedProtocols = [];
8036
+ if (typeof protocols === "string") {
8037
+ parsedProtocols = [protocols];
8038
+ } else if (Array.isArray(protocols)) {
8039
+ parsedProtocols = [...protocols];
8040
+ }
8041
+ this.#init(parsedProtocols);
8042
+ }
8043
+ async #init(protocols) {
8044
+ try {
8045
+ this.#duplex = await globalThis.fullstacked.bridge({
8046
+ mod: WebSocket2,
8047
+ fn: Connect,
8048
+ data: [this.url, protocols]
8049
+ });
8050
+ this.#ee = this.#duplex.eventEmitter();
8051
+ this.#ee.on("open", (selectedProtocol) => {
8052
+ if (this.readyState === _WebSocketCore.CONNECTING) {
8053
+ this.readyState = _WebSocketCore.OPEN;
8054
+ this.protocol = selectedProtocol || "";
8055
+ const event = new Event("open");
8056
+ this.dispatchEvent(event);
8057
+ this.onopen?.(event);
8058
+ }
8059
+ });
8060
+ this.#ee.on(
8061
+ "message",
8062
+ (data, isBinary) => {
8063
+ if (this.readyState !== _WebSocketCore.OPEN && this.readyState !== _WebSocketCore.CLOSING) {
8064
+ return;
8065
+ }
8066
+ let messageData = data;
8067
+ if (isBinary && data instanceof Uint8Array) {
8068
+ if (this.binaryType === "arraybuffer") {
8069
+ messageData = data.buffer.slice(
8070
+ data.byteOffset,
8071
+ data.byteOffset + data.byteLength
8072
+ );
8073
+ } else {
8074
+ messageData = typeof Blob !== "undefined" ? new Blob([data]) : data.buffer.slice(
8075
+ data.byteOffset,
8076
+ data.byteOffset + data.byteLength
8077
+ );
8078
+ }
8079
+ }
8080
+ const event = new MessageEvent("message", {
8081
+ data: messageData,
8082
+ origin: this.url
8083
+ });
8084
+ this.dispatchEvent(event);
8085
+ this.onmessage?.(event);
8086
+ }
8087
+ );
8088
+ this.#ee.on("error", (errorMsg) => {
8089
+ const event = new Event("error");
8090
+ event.message = errorMsg;
8091
+ this.dispatchEvent(event);
8092
+ this.onerror?.(event);
8093
+ });
8094
+ this.#ee.on(
8095
+ "close",
8096
+ (code3, reason, wasClean) => {
8097
+ if (this.readyState === _WebSocketCore.CLOSED) return;
8098
+ this.readyState = _WebSocketCore.CLOSED;
8099
+ const event = new GlobalCloseEvent("close", {
8100
+ code: code3 || 1e3,
8101
+ reason: reason || "",
8102
+ wasClean: wasClean ?? code3 === 1e3
8103
+ });
8104
+ this.dispatchEvent(event);
8105
+ this.onclose?.(event);
8106
+ }
8107
+ );
8108
+ this.#duplex.on("close", () => {
8109
+ if (this.readyState !== _WebSocketCore.CLOSED) {
8110
+ this.readyState = _WebSocketCore.CLOSED;
8111
+ const event = new GlobalCloseEvent("close", {
8112
+ code: 1006,
8113
+ reason: "",
8114
+ wasClean: false
8115
+ });
8116
+ this.dispatchEvent(event);
8117
+ this.onclose?.(event);
8118
+ }
8119
+ });
8120
+ } catch (err) {
8121
+ queueMicrotask(() => {
8122
+ this.readyState = _WebSocketCore.CLOSED;
8123
+ const errorEvent = new Event("error");
8124
+ errorEvent.message = err?.message || String(err);
8125
+ this.dispatchEvent(errorEvent);
8126
+ this.onerror?.(errorEvent);
8127
+ const closeEvent = new GlobalCloseEvent("close", {
8128
+ code: 1006,
8129
+ reason: err?.message || String(err),
8130
+ wasClean: false
8131
+ });
8132
+ this.dispatchEvent(closeEvent);
8133
+ this.onclose?.(closeEvent);
8134
+ });
8135
+ }
8136
+ }
8137
+ send(data) {
8138
+ if (this.readyState === _WebSocketCore.CONNECTING) {
8139
+ throw new DOMException(
8140
+ "WebSocket is still in CONNECTING state.",
8141
+ "InvalidStateError"
8142
+ );
8143
+ }
8144
+ if (this.readyState !== _WebSocketCore.OPEN) {
8145
+ return;
8146
+ }
8147
+ if (typeof data === "string") {
8148
+ this.#duplex?.writeEvent("send", data, false);
8149
+ } else if (data instanceof Uint8Array) {
8150
+ this.#duplex?.writeEvent("send", data, true);
8151
+ } else if (data instanceof ArrayBuffer) {
8152
+ this.#duplex?.writeEvent("send", new Uint8Array(data), true);
8153
+ } else if (ArrayBuffer.isView(data)) {
8154
+ this.#duplex?.writeEvent(
8155
+ "send",
8156
+ new Uint8Array(data.buffer, data.byteOffset, data.byteLength),
8157
+ true
8158
+ );
8159
+ } else if (typeof Blob !== "undefined" && data instanceof Blob) {
8160
+ data.arrayBuffer().then((buf) => {
8161
+ if (this.readyState === _WebSocketCore.OPEN) {
8162
+ this.#duplex?.writeEvent("send", new Uint8Array(buf), true);
8163
+ }
8164
+ });
8165
+ } else {
8166
+ this.#duplex?.writeEvent("send", String(data), false);
8167
+ }
8168
+ }
8169
+ close(code3, reason) {
8170
+ if (code3 !== void 0) {
8171
+ if (code3 !== 1e3 && (code3 < 3e3 || code3 > 4999)) {
8172
+ throw new DOMException(
8173
+ `The code must be either 1000, or between 3000 and 4999. Received ${code3}`,
8174
+ "InvalidAccessError"
8175
+ );
8176
+ }
8177
+ }
8178
+ if (reason !== void 0) {
8179
+ const byteLength = new TextEncoder().encode(reason).byteLength;
8180
+ if (byteLength > 123) {
8181
+ throw new DOMException(
8182
+ "The reason must not be longer than 123 bytes.",
8183
+ "SyntaxError"
8184
+ );
8185
+ }
8186
+ }
8187
+ if (this.readyState === _WebSocketCore.CLOSING || this.readyState === _WebSocketCore.CLOSED) {
8188
+ return;
8189
+ }
8190
+ this.readyState = _WebSocketCore.CLOSING;
8191
+ this.#duplex?.writeEvent("close", code3 ?? 1e3, reason ?? "");
8192
+ }
8193
+ };
8194
+ var websocket_default = WebSocketCore;
8195
+
7823
8196
  // ../../core/internal/bundle/lib/@types/fs.ts
7824
8197
  var Exists = 0;
7825
8198
  var Stats = 1;
@@ -7855,7 +8228,7 @@ var Exit = 5;
7855
8228
  init_isWorker();
7856
8229
 
7857
8230
  // ../../core/internal/bundle/lib/process/version.json
7858
- var version_default = { major: "1", minor: "0", patch: "0-alpha", branch: "v1", build: "1783", hash: "58f6546ee36a4629ac9a7e4ffba71d768b42fdbb" };
8231
+ var version_default = { major: "1", minor: "0", patch: "0-alpha", branch: "v1", build: "1804", hash: "ac2b3e1d237ddbb5538d1f42fe7ec23ad7df9c21" };
7859
8232
 
7860
8233
  // ../../core/internal/bundle/lib/timers/index.ts
7861
8234
  var setTimeout2 = globalThis.setTimeout.bind(globalThis);
@@ -7871,12 +8244,12 @@ globalThis.clearImmediate = ((id) => {
7871
8244
 
7872
8245
  // ../../core/internal/bundle/lib/process/index.ts
7873
8246
  var Item = class {
8247
+ fun;
8248
+ array;
7874
8249
  constructor(fun, array) {
7875
8250
  this.fun = fun;
7876
8251
  this.array = array;
7877
8252
  }
7878
- fun;
7879
- array;
7880
8253
  run() {
7881
8254
  this.fun.apply(null, this.array);
7882
8255
  }
@@ -8850,8 +9223,14 @@ async function init() {
8850
9223
  globalThis.fullstacked.platformBridge = platformBridge2;
8851
9224
  globalThis.fullstacked.bridge = bridge;
8852
9225
  globalThis.fullstacked.fetch = fetch.bind(globalThis);
9226
+ if (typeof WebSocket !== "undefined") {
9227
+ globalThis.fullstacked.WebSocket = WebSocket;
9228
+ }
8853
9229
  globalThis.fullstacked.onStreamData = duplex_default;
8854
9230
  globalThis.fetch = fetch_default;
9231
+ if (typeof window !== "undefined" || !globalThis.process?.versions?.node) {
9232
+ globalThis.WebSocket = websocket_default;
9233
+ }
8855
9234
  await Promise.all([import("timers"), import("buffer")]);
8856
9235
  if (!globalThis.process) {
8857
9236
  globalThis.process = (await import("process")).default;
@@ -8912,11 +9291,12 @@ function bundleFile(entryPoint) {
8912
9291
  async function run(directoryOrOptions) {
8913
9292
  const directory = typeof directoryOrOptions === "string" ? directoryOrOptions : directoryOrOptions?.directory;
8914
9293
  const env2 = typeof directoryOrOptions === "object" ? directoryOrOptions.env : void 0;
9294
+ const safe = typeof directoryOrOptions === "object" ? directoryOrOptions.safe : void 0;
8915
9295
  const resolved = path_default.resolve(directory ?? ".");
8916
9296
  const newCtx = await globalThis.fullstacked.bridge({
8917
9297
  mod: Core,
8918
9298
  fn: Run,
8919
- data: [resolved, env2]
9299
+ data: [resolved, env2, safe]
8920
9300
  });
8921
9301
  return newCtx;
8922
9302
  }
@@ -9231,7 +9611,8 @@ function getPositionalArgs(args2) {
9231
9611
  ["-v", "--version"],
9232
9612
  ["-o", "--open"],
9233
9613
  ["-n", "--no-open"],
9234
- ["-b", "--build"]
9614
+ ["-b", "--build"],
9615
+ ["-s", "--safe"]
9235
9616
  ];
9236
9617
  for (let i = 0; i < args2.length; i++) {
9237
9618
  const arg = args2[i];
@@ -9279,6 +9660,7 @@ function getExtraArgs(args2) {
9279
9660
  ["-v", "--version"],
9280
9661
  ["-o", "--open"],
9281
9662
  ["-n", "--no-open"],
9663
+ ["-s", "--safe"],
9282
9664
  ["-b", "--build"]
9283
9665
  ];
9284
9666
  for (let i = 0; i < args2.length; i++) {
@@ -9374,21 +9756,60 @@ async function bundleAndImportFile(file, startDir, writeErr, extraArgs) {
9374
9756
  }
9375
9757
  }
9376
9758
  async function runFile(file, extraArgs, writeOut, writeErr) {
9377
- const res = await bundleAndImportFile(
9378
- file,
9379
- process.cwd(),
9380
- writeErr,
9381
- extraArgs
9382
- );
9383
- if (!res) return 1;
9759
+ const originalWebSocket = globalThis.WebSocket;
9760
+ const hasOriginalWindow = "window" in globalThis;
9761
+ const hasOriginalBuffer = "Buffer" in globalThis;
9762
+ const originalBuffer = globalThis.Buffer;
9763
+ const hasOriginalFullstacked = "fullstacked" in globalThis;
9764
+ const originalFullstackedWebSocket = globalThis.fullstacked?.WebSocket;
9765
+ if (!globalThis.fullstacked) {
9766
+ globalThis.fullstacked = {};
9767
+ }
9768
+ if (originalWebSocket && !globalThis.fullstacked.WebSocket) {
9769
+ globalThis.fullstacked.WebSocket = originalWebSocket;
9770
+ }
9771
+ globalThis.WebSocket = websocket_default;
9772
+ if (!hasOriginalWindow) {
9773
+ globalThis.window = globalThis;
9774
+ }
9384
9775
  try {
9385
- await waitForInterfaces();
9776
+ const res = await bundleAndImportFile(
9777
+ file,
9778
+ process.cwd(),
9779
+ writeErr,
9780
+ extraArgs
9781
+ );
9782
+ if (!res) return 1;
9783
+ try {
9784
+ await waitForInterfaces();
9785
+ } finally {
9786
+ await res.cleanup();
9787
+ }
9788
+ return 0;
9386
9789
  } finally {
9387
- await res.cleanup();
9790
+ if (originalWebSocket) {
9791
+ globalThis.WebSocket = originalWebSocket;
9792
+ } else {
9793
+ delete globalThis.WebSocket;
9794
+ }
9795
+ if (!hasOriginalWindow) {
9796
+ delete globalThis.window;
9797
+ }
9798
+ if (!hasOriginalBuffer) {
9799
+ delete globalThis.Buffer;
9800
+ } else {
9801
+ globalThis.Buffer = originalBuffer;
9802
+ }
9803
+ if (!hasOriginalFullstacked) {
9804
+ delete globalThis.fullstacked;
9805
+ } else if (originalFullstackedWebSocket) {
9806
+ globalThis.fullstacked.WebSocket = originalFullstackedWebSocket;
9807
+ } else {
9808
+ delete globalThis.fullstacked.WebSocket;
9809
+ }
9388
9810
  }
9389
- return 0;
9390
9811
  }
9391
- async function runDirectory(positionals, pluginsArgs, buildOnly, noOpen, env2, writeOut, writeErr) {
9812
+ async function runDirectory(positionals, pluginsArgs, buildOnly, noOpen, env2, safe, writeOut, writeErr) {
9392
9813
  const targetDirectory = path_default.resolve(positionals.at(-1) || ".");
9393
9814
  const buildPlugins = [];
9394
9815
  const tempPluginFiles = [];
@@ -9453,7 +9874,7 @@ async function runDirectory(positionals, pluginsArgs, buildOnly, noOpen, env2, w
9453
9874
  await cleanupPlugins();
9454
9875
  return 0;
9455
9876
  }
9456
- const newCtx = await run_default({ directory: targetDirectory, env: env2 });
9877
+ const newCtx = await run_default({ directory: targetDirectory, env: env2, safe });
9457
9878
  await cleanupPlugins();
9458
9879
  if (!noOpen && typeof newCtx === "number") {
9459
9880
  globalThis.fullstacked.open?.(newCtx);
@@ -9527,6 +9948,7 @@ Options:
9527
9948
  -o, --open Directly open the browser
9528
9949
  -b, --build Only bundle the project, don't run it afterward
9529
9950
  -f, --file Bundle and execute a single script file
9951
+ -s, --safe Skip the initialDirectory config check
9530
9952
  -h, --help Display this help message
9531
9953
 
9532
9954
  Directory:
@@ -9540,6 +9962,7 @@ Directory:
9540
9962
  const noOpen = hasArgFlag(["-n", "--no-open"], args2);
9541
9963
  const envArgs = findArgValues(["-e", "--env"], args2);
9542
9964
  const pluginsArgs = findArgValues(["-p", "--plugin"], args2);
9965
+ const safe = hasArgFlag(["-s", "--safe"], args2);
9543
9966
  const positionals = getPositionalArgs(args2);
9544
9967
  const env2 = {};
9545
9968
  for (const val of envArgs) {
@@ -9560,6 +9983,7 @@ Directory:
9560
9983
  buildOnly,
9561
9984
  noOpen,
9562
9985
  env2,
9986
+ safe,
9563
9987
  writeOut,
9564
9988
  writeErr
9565
9989
  );
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "fullstacked",
3
- "version": "1.0.0-alpha.1783",
3
+ "version": "1.0.0-alpha.1804",
4
4
  "bin": {
5
5
  "fullstacked": "index.js"
6
6
  },
7
7
  "type": "module",
8
8
  "scripts": {
9
- "build": "node -r @nitrogql/esbuild-register build",
9
+ "build": "node build.ts",
10
10
  "prepack": "npm run build"
11
11
  },
12
12
  "dependencies": {
@@ -14,18 +14,17 @@
14
14
  "ws": "^8.21.1"
15
15
  },
16
16
  "devDependencies": {
17
- "@nitrogql/esbuild-register": "^1.7.2",
18
17
  "@types/ws": "^8.18.1",
19
18
  "esbuild": "^0.28.1",
20
19
  "node-addon-api": "^8.9.0"
21
20
  },
22
21
  "optionalDependencies": {
23
- "@fullstacked/darwin-arm64": "1.0.0-alpha.1783",
24
- "@fullstacked/darwin-x64": "1.0.0-alpha.1783",
25
- "@fullstacked/linux-arm64": "1.0.0-alpha.1783",
26
- "@fullstacked/linux-x64": "1.0.0-alpha.1783",
27
- "@fullstacked/win32-arm64": "1.0.0-alpha.1783",
28
- "@fullstacked/win32-x64": "1.0.0-alpha.1783"
22
+ "@fullstacked/darwin-arm64": "1.0.0-alpha.1804",
23
+ "@fullstacked/darwin-x64": "1.0.0-alpha.1804",
24
+ "@fullstacked/linux-arm64": "1.0.0-alpha.1804",
25
+ "@fullstacked/linux-x64": "1.0.0-alpha.1804",
26
+ "@fullstacked/win32-arm64": "1.0.0-alpha.1804",
27
+ "@fullstacked/win32-x64": "1.0.0-alpha.1804"
29
28
  },
30
29
  "author": "FullStacked",
31
30
  "license": "MIT",
@@ -45,6 +44,9 @@
45
44
  "./bundle": {
46
45
  "types": "./types/bundle/index.d.ts"
47
46
  },
47
+ "./config": {
48
+ "types": "./types/config/index.d.ts"
49
+ },
48
50
  "./git": {
49
51
  "types": "./types/git/index.d.ts"
50
52
  },
@@ -0,0 +1,5 @@
1
+ export type ConfigFn = number;
2
+ export declare const Get: ConfigFn;
3
+ export declare const Set: ConfigFn;
4
+ export declare const List: ConfigFn;
5
+ export declare const Delete: ConfigFn;
@@ -14,6 +14,8 @@ export declare const Git: CoreModule;
14
14
  export declare const Packages: CoreModule;
15
15
  export declare const Dgram: CoreModule;
16
16
  export declare const Plugin: CoreModule;
17
+ export declare const WebSocket: CoreModule;
18
+ export declare const Config: CoreModule;
17
19
  export type ModuleSwitch = any;
18
20
  export type CoreCallResponseType = number;
19
21
  export declare const CoreResponseError: CoreCallResponseType;
@@ -85,7 +87,6 @@ export interface Context {
85
87
  [key: string]: string;
86
88
  };
87
89
  Cwd: string;
88
- NodePaths: string[];
89
90
  Responses: {
90
91
  [key: number]: string;
91
92
  };
@@ -104,7 +105,7 @@ export interface Context {
104
105
  [key: string]: GitAuth | undefined;
105
106
  };
106
107
  GitAuthsMutex?: any;
107
- Exit: boolean;
108
+ Exited: boolean;
108
109
  }
109
110
  export type SerializableData = any;
110
111
  export type SerializableDataType = number;
@@ -53,25 +53,38 @@ export interface PackageMetadata {
53
53
  export interface PackageVersion {
54
54
  name: string;
55
55
  version: string;
56
- dependencies: {
56
+ dependencies?: {
57
+ [key: string]: string;
58
+ };
59
+ devDependencies?: {
57
60
  [key: string]: string;
58
61
  };
59
62
  optionalDependencies?: {
60
63
  [key: string]: string;
61
64
  };
62
- /**
63
- * DevDependencies removed as unused in sub-deps logic
64
- */
65
- dist: PackageDist;
66
- license?: any;
67
- engines?: any;
68
65
  peerDependencies?: {
69
66
  [key: string]: string;
70
67
  };
68
+ peerDependenciesMeta?: {
69
+ [key: string]: {
70
+ optional?: boolean;
71
+ };
72
+ };
71
73
  bundleDependencies?: BundleDependenciesWrapper;
72
74
  bundledDependencies?: BundleDependenciesWrapper;
75
+ dist: PackageDist;
76
+ license?: any;
77
+ funding?: any;
78
+ bin?: any;
79
+ engines?: any;
73
80
  os?: string[];
74
81
  cpu?: string[];
82
+ libc?: string[];
83
+ deprecated?: any;
84
+ hasInstallScript?: boolean;
85
+ scripts?: {
86
+ [key: string]: string;
87
+ };
75
88
  }
76
89
  export type BundleDependenciesWrapper = string[];
77
90
  export interface PackageDist {
@@ -89,41 +102,54 @@ export interface PackageLock {
89
102
  };
90
103
  }
91
104
  export interface LockDependency {
105
+ name?: string;
92
106
  version?: string;
93
107
  resolved?: string;
94
108
  integrity?: string;
95
- dependencies?: {
109
+ dev?: boolean;
110
+ optional?: boolean;
111
+ devOptional?: boolean;
112
+ peer?: boolean;
113
+ inBundle?: boolean;
114
+ hasInstallScript?: boolean;
115
+ hasShrinkwrap?: boolean;
116
+ license?: string;
117
+ funding?: any;
118
+ bin?: {
96
119
  [key: string]: string;
97
120
  };
98
- optionalDependencies?: {
121
+ dependencies?: {
99
122
  [key: string]: string;
100
123
  };
101
- license?: string;
102
- engines?: {
124
+ devDependencies?: {
103
125
  [key: string]: string;
104
126
  };
105
127
  peerDependencies?: {
106
128
  [key: string]: string;
107
129
  };
108
- peer?: boolean;
109
- optional?: boolean;
110
- os?: string[];
111
- cpu?: string[];
112
- }
113
- /**
114
- * Queue for BFS
115
- */
116
- export interface QueueItem {
117
- ParentPath: string;
118
- Deps: {
119
- [key: string]: string;
130
+ peerDependenciesMeta?: {
131
+ [key: string]: any;
120
132
  };
121
- OptionalDeps: {
133
+ optionalDependencies?: {
122
134
  [key: string]: string;
123
135
  };
124
- PeerDeps: {
136
+ bundleDependencies?: string[];
137
+ engines?: {
125
138
  [key: string]: string;
126
139
  };
140
+ os?: string[];
141
+ cpu?: string[];
142
+ libc?: string[];
143
+ deprecated?: string;
144
+ }
145
+ export interface DepItem {
146
+ Name: string;
147
+ Range: string;
148
+ Optional: boolean;
149
+ }
150
+ export interface QueueItem {
151
+ ParentPath: string;
152
+ Items: DepItem[];
127
153
  }
128
154
  export interface ProgressReader {
129
155
  Reader: any;
@@ -0,0 +1,2 @@
1
+ export type WebSocketFn = number;
2
+ export declare const Connect: WebSocketFn;
@@ -1,4 +1,4 @@
1
- import { SerializableData } from "../@types/index.ts";
1
+ import { type SerializableData } from "../@types/index.ts";
2
2
  import { createEventEmitter } from "./eventEmitter.ts";
3
3
  declare function onStreamData(id: number, payload: ArrayBuffer | string): void;
4
4
  type StreamData = string | Buffer | Uint8Array | DataView;
@@ -1,4 +1,4 @@
1
- import { CoreModule, SerializableData } from "../@types/index.ts";
1
+ import { type CoreModule, type SerializableData } from "../@types/index.ts";
2
2
  import type platformBridgeType from "./platform/index.ts";
3
3
  import type { JSPlugin } from "../plugin/index.ts";
4
4
  declare global {
@@ -24,6 +24,7 @@ type FullStacked = {
24
24
  respondGetSize?: (response: any) => void;
25
25
  };
26
26
  fetch: typeof fetch;
27
+ WebSocket: typeof WebSocket;
27
28
  open?: (ctx: number) => void;
28
29
  };
29
30
  type BridgeOpts = {
@@ -1,4 +1,4 @@
1
- import { PlatformBridge } from "./index.ts";
1
+ import type { PlatformBridge } from "./index.ts";
2
2
  declare global {
3
3
  var android: {
4
4
  coreCall?: (payloadBase64: string) => string;
@@ -1,2 +1,2 @@
1
- import { PlatformBridge } from "./index.ts";
1
+ import type { PlatformBridge } from "./index.ts";
2
2
  export declare function BridgeAppleInit(): Promise<PlatformBridge>;
@@ -1,4 +1,4 @@
1
- import { PlatformBridge } from "./index.ts";
1
+ import type { PlatformBridge } from "./index.ts";
2
2
  declare global {
3
3
  var webkit: any;
4
4
  var chrome: any;
@@ -1,2 +1,2 @@
1
- import { PlatformBridge } from "./index.ts";
1
+ import type { PlatformBridge } from "./index.ts";
2
2
  export declare function BridgeWindowsInit(): Promise<PlatformBridge>;
@@ -1,4 +1,4 @@
1
- import { SerializableData, SerializableDataType } from "../@types/index.ts";
1
+ import { type SerializableData, type SerializableDataType } from "../@types/index.ts";
2
2
  export declare function numberToUint4Bytes(num: number): Uint8Array<ArrayBuffer>;
3
3
  export declare function uint4BytesToNumber(bytes: Uint8Array): number;
4
4
  export declare function serializeUndefined(): Uint8Array<ArrayBuffer>;
@@ -1,4 +1,4 @@
1
- import { EsbuildResult } from "../@types/bundle.ts";
1
+ import { type EsbuildResult } from "../@types/bundle.ts";
2
2
  export declare function esbuildVersion(): Promise<string>;
3
3
  export declare function bundle(entryPoint?: string): Promise<EsbuildResult>;
4
4
  export declare function bundleFile(entryPoint: string): Promise<EsbuildResult>;
@@ -0,0 +1,21 @@
1
+ export declare function get(key?: string): Promise<string | undefined>;
2
+ export declare function set(key: string, value: string): Promise<void>;
3
+ export declare function list(): Promise<Record<string, string>>;
4
+ export declare function del(key: string): Promise<void>;
5
+ export { del as delete };
6
+ export declare const getConfig: typeof get;
7
+ export declare const setConfig: typeof set;
8
+ export declare const listConfig: typeof list;
9
+ export declare const deleteConfig: typeof del;
10
+ declare const config: {
11
+ get: typeof get;
12
+ set: typeof set;
13
+ list: typeof list;
14
+ delete: typeof del;
15
+ del: typeof del;
16
+ getConfig: typeof get;
17
+ setConfig: typeof set;
18
+ listConfig: typeof list;
19
+ deleteConfig: typeof del;
20
+ };
21
+ export default config;
@@ -1,4 +1,4 @@
1
- import { GoFileInfo } from "../@types/fs";
1
+ import type { GoFileInfo } from "../@types/fs.ts";
2
2
  export type PathLike = string | URL | Buffer;
3
3
  export declare function formatPathLike(path: PathLike): string;
4
4
  export type ReadFileOpts = string | {
@@ -1,5 +1,5 @@
1
1
  import { Writable } from "stream";
2
- import { Dirent, PathLike, ReadFileOpts, StatOpts, Stats as StatsInterface } from "./common.ts";
2
+ import { type Dirent, type PathLike, type ReadFileOpts, type StatOpts, type Stats as StatsInterface } from "./common.ts";
3
3
  export declare function existsSync(path: PathLike): boolean;
4
4
  export declare function statSync(path: PathLike, options?: StatOpts): StatsInterface;
5
5
  type StatCallback = (err: Error, stat: StatsInterface) => void;
@@ -1,4 +1,4 @@
1
- import { Dirent, PathLike, ReadFileOpts, StatOpts, Stats as StatsInterface } from "./common.ts";
1
+ import { type Dirent, type PathLike, type ReadFileOpts, type StatOpts, type Stats as StatsInterface } from "./common.ts";
2
2
  export declare function readFile(path: PathLike): Promise<Buffer<ArrayBuffer>>;
3
3
  export declare function readFile(path: PathLike, options: ReadFileOpts): Promise<string>;
4
4
  export declare function readdir(path: PathLike, options: {
@@ -1,4 +1,4 @@
1
- import { GitAuthor, GitBranch, GitCommit, GitHead, GitProxy, GitStatus, GitTag } from "../@types/git.ts";
1
+ import { type GitAuthor, type GitBranch, type GitCommit, type GitHead, type GitProxy, type GitStatus, type GitTag } from "../@types/git.ts";
2
2
  import type { Duplex } from "../bridge/duplex.ts";
3
3
  export declare function createGitAuthManager(): Promise<{
4
4
  on(): void;
@@ -1,5 +1,5 @@
1
- import { Progress } from "../@types/packages.ts";
2
- import { EventEmitter } from "../bridge/eventEmitter.ts";
1
+ import { type Progress } from "../@types/packages.ts";
2
+ import type { EventEmitter } from "../bridge/eventEmitter.ts";
3
3
  export declare function install(directory: string, saveDev: boolean, ...packages: string[]): Promise<EventEmitter<{
4
4
  progress: Progress[];
5
5
  }>>;
@@ -1,4 +1,4 @@
1
- import { ParsedPath } from "../@types/path.ts";
1
+ import { type ParsedPath } from "../@types/path.ts";
2
2
  export declare let sep: string;
3
3
  export declare function isAbsolute(path: string): boolean;
4
4
  export declare function resolve(...paths: string[]): string;
@@ -1,5 +1,5 @@
1
- import { GitAuth, PluginTypeGitAuth, PluginTypeBuild } from "../@types/index.ts";
2
- import { PluginBuildData, PluginParams } from "../@types/bundle.ts";
1
+ import { type GitAuth, PluginTypeGitAuth, PluginTypeBuild } from "../@types/index.ts";
2
+ import type { PluginBuildData, PluginParams } from "../@types/bundle.ts";
3
3
  type CommonPluginData = {
4
4
  name?: string;
5
5
  };
@@ -1,6 +1,7 @@
1
1
  type RunOptions = {
2
2
  directory?: string;
3
3
  env?: Record<string, string>;
4
+ safe?: boolean;
4
5
  };
5
6
  export declare function run(directoryOrOptions?: string | RunOptions): Promise<number>;
6
7
  export default run;
@@ -1,4 +1,4 @@
1
- import { Tunnel } from "../@types/tunnel.ts";
1
+ import { type Tunnel } from "../@types/tunnel.ts";
2
2
  export declare function register(tunnel: Tunnel): Promise<string>;
3
3
  declare const tunnel: {
4
4
  register: typeof register;
@@ -0,0 +1,25 @@
1
+ export declare class WebSocketCore extends EventTarget {
2
+ #private;
3
+ static readonly CONNECTING = 0;
4
+ static readonly OPEN = 1;
5
+ static readonly CLOSING = 2;
6
+ static readonly CLOSED = 3;
7
+ readonly CONNECTING = 0;
8
+ readonly OPEN = 1;
9
+ readonly CLOSING = 2;
10
+ readonly CLOSED = 3;
11
+ readonly url: string;
12
+ readyState: number;
13
+ bufferedAmount: number;
14
+ protocol: string;
15
+ extensions: string;
16
+ binaryType: "blob" | "arraybuffer";
17
+ onopen: ((this: WebSocketCore, ev: Event) => any) | null;
18
+ onerror: ((this: WebSocketCore, ev: Event) => any) | null;
19
+ onclose: ((this: WebSocketCore, ev: CloseEvent) => any) | null;
20
+ onmessage: ((this: WebSocketCore, ev: MessageEvent) => any) | null;
21
+ constructor(url: string | URL, protocols?: string | string[]);
22
+ send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
23
+ close(code?: number, reason?: string): void;
24
+ }
25
+ export default WebSocketCore;