marko 6.0.20 → 6.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1618,19 +1618,13 @@ function nextRefAccess(state) {
1618
1618
  return "_." + nextId(state);
1619
1619
  }
1620
1620
  function nextId(state) {
1621
- const encodeChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";
1622
- const encodeLen = encodeChars.length;
1623
- const encodeStartLen = encodeLen - 11;
1624
- let index = state.ids++;
1625
- let mod = index % encodeStartLen;
1626
- let id = encodeChars[mod];
1627
- index = (index - mod) / encodeStartLen;
1628
- while (index > 0) {
1629
- mod = index % encodeLen;
1630
- id += encodeChars[mod];
1631
- index = (index - mod) / encodeLen;
1632
- }
1633
- return id;
1621
+ const c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";
1622
+ let n = state.ids++;
1623
+ let r = c[n % 53];
1624
+ for (n = n / 53 | 0; n; n >>>= 6) {
1625
+ r += c[n & 63];
1626
+ }
1627
+ return r;
1634
1628
  }
1635
1629
  function hasSymbolIterator(value) {
1636
1630
  return Symbol.iterator in value;
@@ -2211,19 +2205,13 @@ var State2 = class {
2211
2205
  }
2212
2206
  }
2213
2207
  nextReorderId() {
2214
- const encodeChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";
2215
- const encodeLen = encodeChars.length;
2216
- const encodeStartLen = encodeLen - 10;
2217
- let index = this.reorderId++;
2218
- let mod = index % encodeStartLen;
2219
- let id = encodeChars[mod];
2220
- index = (index - mod) / encodeStartLen;
2221
- while (index > 0) {
2222
- mod = index % encodeLen;
2223
- id += encodeChars[mod];
2224
- index = (index - mod) / encodeLen;
2225
- }
2226
- return id;
2208
+ const c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";
2209
+ let n = this.reorderId++;
2210
+ let r = c[n % 54];
2211
+ for (n = n / 54 | 0; n; n >>>= 6) {
2212
+ r += c[n & 63];
2213
+ }
2214
+ return r;
2227
2215
  }
2228
2216
  mark(code, str) {
2229
2217
  return "<!--" + this.commentPrefix + code + str + "-->";
@@ -3053,7 +3041,11 @@ var ServerRendered = class {
3053
3041
  const head = this.#head;
3054
3042
  this.#head = null;
3055
3043
  if (!head) throw new Error("Cannot read from a consumed render result");
3056
- if (!head.boundary.done) throw new Error("Cannot fork in sync mode");
3044
+ const { boundary } = head;
3045
+ if (!boundary.done) {
3046
+ throw new Error("Cannot consume asynchronous render with 'toString'");
3047
+ }
3048
+ if (boundary.signal.aborted) throw boundary.signal.reason;
3057
3049
  return head.consume().flushHTML();
3058
3050
  }
3059
3051
  };
@@ -1537,19 +1537,13 @@ function nextRefAccess(state) {
1537
1537
  return "_." + nextId(state);
1538
1538
  }
1539
1539
  function nextId(state) {
1540
- const encodeChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";
1541
- const encodeLen = encodeChars.length;
1542
- const encodeStartLen = encodeLen - 11;
1543
- let index = state.ids++;
1544
- let mod = index % encodeStartLen;
1545
- let id = encodeChars[mod];
1546
- index = (index - mod) / encodeStartLen;
1547
- while (index > 0) {
1548
- mod = index % encodeLen;
1549
- id += encodeChars[mod];
1550
- index = (index - mod) / encodeLen;
1551
- }
1552
- return id;
1540
+ const c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";
1541
+ let n = state.ids++;
1542
+ let r = c[n % 53];
1543
+ for (n = n / 53 | 0; n; n >>>= 6) {
1544
+ r += c[n & 63];
1545
+ }
1546
+ return r;
1553
1547
  }
1554
1548
  function hasSymbolIterator(value) {
1555
1549
  return Symbol.iterator in value;
@@ -2130,19 +2124,13 @@ var State2 = class {
2130
2124
  }
2131
2125
  }
2132
2126
  nextReorderId() {
2133
- const encodeChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";
2134
- const encodeLen = encodeChars.length;
2135
- const encodeStartLen = encodeLen - 10;
2136
- let index = this.reorderId++;
2137
- let mod = index % encodeStartLen;
2138
- let id = encodeChars[mod];
2139
- index = (index - mod) / encodeStartLen;
2140
- while (index > 0) {
2141
- mod = index % encodeLen;
2142
- id += encodeChars[mod];
2143
- index = (index - mod) / encodeLen;
2144
- }
2145
- return id;
2127
+ const c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";
2128
+ let n = this.reorderId++;
2129
+ let r = c[n % 54];
2130
+ for (n = n / 54 | 0; n; n >>>= 6) {
2131
+ r += c[n & 63];
2132
+ }
2133
+ return r;
2146
2134
  }
2147
2135
  mark(code, str) {
2148
2136
  return "<!--" + this.commentPrefix + code + str + "-->";
@@ -2972,7 +2960,11 @@ var ServerRendered = class {
2972
2960
  const head = this.#head;
2973
2961
  this.#head = null;
2974
2962
  if (!head) throw new Error("Cannot read from a consumed render result");
2975
- if (!head.boundary.done) throw new Error("Cannot fork in sync mode");
2963
+ const { boundary } = head;
2964
+ if (!boundary.done) {
2965
+ throw new Error("Cannot consume asynchronous render with 'toString'");
2966
+ }
2967
+ if (boundary.signal.aborted) throw boundary.signal.reason;
2976
2968
  return head.consume().flushHTML();
2977
2969
  }
2978
2970
  };
package/dist/html.js CHANGED
@@ -1037,10 +1037,10 @@ function nextRefAccess(state) {
1037
1037
  return "_." + nextId(state);
1038
1038
  }
1039
1039
  function nextId(state) {
1040
- let encodeChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", encodeLen = encodeChars.length, encodeStartLen = encodeLen - 11, index = state.ids++, mod = index % encodeStartLen, id = encodeChars[mod];
1041
- for (index = (index - mod) / encodeStartLen; index > 0; )
1042
- mod = index % encodeLen, id += encodeChars[mod], index = (index - mod) / encodeLen;
1043
- return id;
1040
+ let c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = state.ids++, r = c[n % 53];
1041
+ for (n = n / 53 | 0; n; n >>>= 6)
1042
+ r += c[n & 63];
1043
+ return r;
1044
1044
  }
1045
1045
  function hasSymbolIterator(value) {
1046
1046
  return Symbol.iterator in value;
@@ -1424,10 +1424,10 @@ var State2 = class {
1424
1424
  this.writeReorders ? this.writeReorders.push(chunk) : (this.needsMainRuntime = !0, this.writeReorders = [chunk]);
1425
1425
  }
1426
1426
  nextReorderId() {
1427
- let encodeChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", encodeLen = encodeChars.length, encodeStartLen = encodeLen - 10, index = this.reorderId++, mod = index % encodeStartLen, id = encodeChars[mod];
1428
- for (index = (index - mod) / encodeStartLen; index > 0; )
1429
- mod = index % encodeLen, id += encodeChars[mod], index = (index - mod) / encodeLen;
1430
- return id;
1427
+ let c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = this.reorderId++, r = c[n % 54];
1428
+ for (n = n / 54 | 0; n; n >>>= 6)
1429
+ r += c[n & 63];
1430
+ return r;
1431
1431
  }
1432
1432
  mark(code, str) {
1433
1433
  return "<!--" + this.commentPrefix + code + str + "-->";
@@ -1967,7 +1967,10 @@ var ServerRendered = class {
1967
1967
  toString() {
1968
1968
  let head = this.#head;
1969
1969
  if (this.#head = null, !head) throw new Error("Cannot read from a consumed render result");
1970
- if (!head.boundary.done) throw new Error("Cannot fork in sync mode");
1970
+ let { boundary } = head;
1971
+ if (!boundary.done)
1972
+ throw new Error("Cannot consume asynchronous render with 'toString'");
1973
+ if (boundary.signal.aborted) throw boundary.signal.reason;
1971
1974
  return head.consume().flushHTML();
1972
1975
  }
1973
1976
  };
package/dist/html.mjs CHANGED
@@ -959,10 +959,10 @@ function nextRefAccess(state) {
959
959
  return "_." + nextId(state);
960
960
  }
961
961
  function nextId(state) {
962
- let encodeChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", encodeLen = encodeChars.length, encodeStartLen = encodeLen - 11, index = state.ids++, mod = index % encodeStartLen, id = encodeChars[mod];
963
- for (index = (index - mod) / encodeStartLen; index > 0; )
964
- mod = index % encodeLen, id += encodeChars[mod], index = (index - mod) / encodeLen;
965
- return id;
962
+ let c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = state.ids++, r = c[n % 53];
963
+ for (n = n / 53 | 0; n; n >>>= 6)
964
+ r += c[n & 63];
965
+ return r;
966
966
  }
967
967
  function hasSymbolIterator(value) {
968
968
  return Symbol.iterator in value;
@@ -1346,10 +1346,10 @@ var State2 = class {
1346
1346
  this.writeReorders ? this.writeReorders.push(chunk) : (this.needsMainRuntime = !0, this.writeReorders = [chunk]);
1347
1347
  }
1348
1348
  nextReorderId() {
1349
- let encodeChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", encodeLen = encodeChars.length, encodeStartLen = encodeLen - 10, index = this.reorderId++, mod = index % encodeStartLen, id = encodeChars[mod];
1350
- for (index = (index - mod) / encodeStartLen; index > 0; )
1351
- mod = index % encodeLen, id += encodeChars[mod], index = (index - mod) / encodeLen;
1352
- return id;
1349
+ let c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = this.reorderId++, r = c[n % 54];
1350
+ for (n = n / 54 | 0; n; n >>>= 6)
1351
+ r += c[n & 63];
1352
+ return r;
1353
1353
  }
1354
1354
  mark(code, str) {
1355
1355
  return "<!--" + this.commentPrefix + code + str + "-->";
@@ -1889,7 +1889,10 @@ var ServerRendered = class {
1889
1889
  toString() {
1890
1890
  let head = this.#head;
1891
1891
  if (this.#head = null, !head) throw new Error("Cannot read from a consumed render result");
1892
- if (!head.boundary.done) throw new Error("Cannot fork in sync mode");
1892
+ let { boundary } = head;
1893
+ if (!boundary.done)
1894
+ throw new Error("Cannot consume asynchronous render with 'toString'");
1895
+ if (boundary.signal.aborted) throw boundary.signal.reason;
1893
1896
  return head.consume().flushHTML();
1894
1897
  }
1895
1898
  };
@@ -9438,7 +9438,7 @@ var style_default = {
9438
9438
  } else if (import_compiler49.types.isIdentifier(node.var)) {
9439
9439
  (0, import_babel_utils42.getProgram)().node.body.push(
9440
9440
  import_compiler49.types.importDeclaration(
9441
- [import_compiler49.types.importDefaultSpecifier(node.var)],
9441
+ [import_compiler49.types.importNamespaceSpecifier(node.var)],
9442
9442
  import_compiler49.types.stringLiteral(importPath)
9443
9443
  )
9444
9444
  );
@@ -9447,7 +9447,7 @@ var style_default = {
9447
9447
  import_compiler49.types.variableDeclaration("const", [
9448
9448
  import_compiler49.types.variableDeclarator(
9449
9449
  node.var,
9450
- (0, import_babel_utils42.importDefault)(file, importPath, "style")
9450
+ (0, import_babel_utils42.importStar)(file, importPath, "style")
9451
9451
  )
9452
9452
  ])
9453
9453
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.20",
3
+ "version": "6.0.22",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",
@@ -48,7 +48,7 @@
48
48
  "build": "node -r ~ts ./scripts/bundle.ts"
49
49
  },
50
50
  "dependencies": {
51
- "@marko/compiler": "^5.39.20",
51
+ "@marko/compiler": "^5.39.22",
52
52
  "csstype": "^3.1.3",
53
53
  "magic-string": "^0.30.17"
54
54
  },