marko 6.0.92 → 6.0.94

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.
@@ -0,0 +1,3 @@
1
+ export declare function _el_read_error(): void;
2
+ export declare function _hoist_read_error(): void;
3
+ export declare function _assert_hoist(value: unknown): void;
@@ -13,9 +13,7 @@ export interface BranchScope extends Scope {
13
13
  ___effects: unknown[] | undefined;
14
14
  }
15
15
  export interface Scope {
16
- $global: Record<string, unknown> & {
17
- ___nextScopeId: number;
18
- };
16
+ $global: Record<string, unknown>;
19
17
  _: Scope | undefined;
20
18
  ___id: number;
21
19
  ___args: unknown;
package/dist/debug/dom.js CHANGED
@@ -22,6 +22,7 @@ var dom_exports = {};
22
22
  __export(dom_exports, {
23
23
  $signal: () => $signal,
24
24
  $signalReset: () => $signalReset,
25
+ _assert_hoist: () => _assert_hoist,
25
26
  _attr: () => _attr,
26
27
  _attr_class: () => _attr_class,
27
28
  _attr_class_item: () => _attr_class_item,
@@ -60,6 +61,7 @@ __export(dom_exports, {
60
61
  _content_resume: () => _content_resume,
61
62
  _dynamic_tag: () => _dynamic_tag,
62
63
  _el: () => _el,
64
+ _el_read: () => _el_read,
63
65
  _enable_catch: () => _enable_catch,
64
66
  _for_closure: () => _for_closure,
65
67
  _for_in: () => _for_in,
@@ -122,6 +124,29 @@ function* attrTagIterator() {
122
124
  yield* this[rest];
123
125
  }
124
126
 
127
+ // src/common/errors.ts
128
+ function _el_read_error() {
129
+ if (true) {
130
+ throw new Error(
131
+ "Element references can only be read in scripts and event handlers."
132
+ );
133
+ }
134
+ }
135
+ function _hoist_read_error() {
136
+ if (true) {
137
+ throw new Error(
138
+ "Hoisted values can only be read in scripts and event handlers."
139
+ );
140
+ }
141
+ }
142
+ function _assert_hoist(value) {
143
+ if (typeof value !== "function") {
144
+ throw new Error(
145
+ `Hoisted values must be functions, received type "${typeof value}".`
146
+ );
147
+ }
148
+ }
149
+
125
150
  // src/common/for.ts
126
151
  function forIn(obj, cb) {
127
152
  for (const key in obj) {
@@ -280,9 +305,10 @@ var DEFAULT_RUNTIME_ID = "M";
280
305
  var DEFAULT_RENDER_ID = "_";
281
306
 
282
307
  // src/dom/scope.ts
308
+ var nextScopeId = 1e6;
283
309
  function createScope($global, closestBranch) {
284
310
  const scope = {
285
- ___id: $global.___nextScopeId++,
311
+ ___id: nextScopeId++,
286
312
  ___creating: 1,
287
313
  ___closestBranch: closestBranch,
288
314
  $global
@@ -290,8 +316,8 @@ function createScope($global, closestBranch) {
290
316
  pendingScopes.push(scope);
291
317
  return scope;
292
318
  }
293
- function skipScope(scope) {
294
- return scope.$global.___nextScopeId++;
319
+ function skipScope() {
320
+ return nextScopeId++;
295
321
  }
296
322
  function findBranchWithKey(scope, key) {
297
323
  let branch = scope.___closestBranch;
@@ -309,7 +335,7 @@ function destroyNestedBranches(branch) {
309
335
  branch.___branchScopes?.forEach(destroyNestedBranches);
310
336
  branch.___abortScopes?.forEach((scope) => {
311
337
  for (const id in scope.___abortControllers) {
312
- scope.___abortControllers[id]?.abort();
338
+ $signalReset(scope, id);
313
339
  }
314
340
  });
315
341
  }
@@ -355,7 +381,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
355
381
  walker.currentNode = scope[true ? getDebugKey(currentScopeIndex++, "#text") : currentScopeIndex++] = new Text()
356
382
  );
357
383
  if (value === 49 /* DynamicTagWithVar */) {
358
- scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
384
+ scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope();
359
385
  }
360
386
  } else if (value === 38 /* EndChild */) {
361
387
  return currentWalkIndex;
@@ -366,7 +392,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
366
392
  scope[true ? getDebugKey(currentScopeIndex++, "#childScope") : currentScopeIndex++] = createScope(scope.$global, scope.___closestBranch)
367
393
  );
368
394
  if (value === 48 /* BeginChildWithVar */) {
369
- scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
395
+ scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope();
370
396
  }
371
397
  } else if (value < 91 /* NextEnd */ + 1) {
372
398
  value = 20 /* Next */ * currentMultiplier + value - 67 /* Next */;
@@ -478,9 +504,11 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
478
504
  branchStarts.push(visit);
479
505
  } else {
480
506
  visitScope[
481
- nextToken()
507
+ "Getter:" /* Getter */ + nextToken()
482
508
  /* read accessor */
483
- ] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? visit.parentNode : visit;
509
+ ] = /* @__PURE__ */ ((node) => () => node)(
510
+ visitScope[lastToken] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? visit.parentNode : visit
511
+ );
484
512
  nextToken();
485
513
  endBranch(
486
514
  visitType !== "]" /* BranchEnd */ && visitType !== ")" /* BranchEndOnlyChildInParent */
@@ -550,7 +578,6 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
550
578
  $global = scope || {};
551
579
  $global.runtimeId = runtimeId;
552
580
  $global.renderId = renderId;
553
- $global.___nextScopeId = 1e6;
554
581
  } else if (typeof scope === "number") {
555
582
  lastScopeId += scope;
556
583
  } else {
@@ -953,7 +980,7 @@ function _let(valueAccessor, fn) {
953
980
  };
954
981
  return (scope, value, valueChange) => {
955
982
  if (rendering) {
956
- if ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value || !(valueAccessor in scope)) {
983
+ if ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value || scope.___creating) {
957
984
  scope[valueAccessor] = value;
958
985
  fn && fn(scope, value);
959
986
  }
@@ -1118,7 +1145,16 @@ function _script(id, fn) {
1118
1145
  queueEffect(scope, fn);
1119
1146
  };
1120
1147
  }
1148
+ function _el_read(value) {
1149
+ if (rendering) {
1150
+ _el_read_error();
1151
+ }
1152
+ return value;
1153
+ }
1121
1154
  function* traverseAllHoisted(scope, path, curIndex = path.length - 1) {
1155
+ if (rendering) {
1156
+ _hoist_read_error();
1157
+ }
1122
1158
  if (scope) {
1123
1159
  if (Symbol.iterator in scope) {
1124
1160
  for (const s of scope instanceof Map ? scope.values() : scope) {
@@ -1133,7 +1169,7 @@ function* traverseAllHoisted(scope, path, curIndex = path.length - 1) {
1133
1169
  }
1134
1170
  function _hoist(...path) {
1135
1171
  return (scope) => {
1136
- const getOne = (...args) => iterator().next().value(...args);
1172
+ const getOne = (...args) => iterator().next().value?.(...args);
1137
1173
  const iterator = getOne[Symbol.iterator] = () => traverseAllHoisted(scope, path);
1138
1174
  return getOne;
1139
1175
  };
@@ -1769,11 +1805,13 @@ function _await(nodeAccessor, renderer) {
1769
1805
  );
1770
1806
  removeAndDestroyBranch(placeholderBranch);
1771
1807
  }
1772
- const pendingEffects2 = tryWithPlaceholder.___effects;
1773
- if (pendingEffects2) {
1774
- tryWithPlaceholder.___effects = [];
1775
- runEffects(pendingEffects2, true);
1776
- }
1808
+ queueEffect(tryWithPlaceholder, (scope2) => {
1809
+ const pendingEffects2 = scope2.___effects;
1810
+ if (pendingEffects2) {
1811
+ scope2.___effects = [];
1812
+ runEffects(pendingEffects2, true);
1813
+ }
1814
+ });
1777
1815
  }
1778
1816
  }
1779
1817
  },
@@ -2298,7 +2336,6 @@ var compat = {
2298
2336
  component.effects = prepareEffects(() => {
2299
2337
  if (!branch) {
2300
2338
  created = 1;
2301
- out.global.___nextScopeId ||= 0;
2302
2339
  branch = component.scope = createAndSetupBranch(
2303
2340
  out.global,
2304
2341
  renderer,
@@ -2342,7 +2379,6 @@ function mount(input = {}, reference, position) {
2342
2379
  if ($global) {
2343
2380
  ({ $global, ...input } = input);
2344
2381
  $global = {
2345
- ___nextScopeId: 0,
2346
2382
  runtimeId: DEFAULT_RUNTIME_ID,
2347
2383
  renderId: DEFAULT_RENDER_ID,
2348
2384
  ...$global
@@ -2361,7 +2397,6 @@ function mount(input = {}, reference, position) {
2361
2397
  }
2362
2398
  } else {
2363
2399
  $global = {
2364
- ___nextScopeId: 0,
2365
2400
  runtimeId: DEFAULT_RUNTIME_ID,
2366
2401
  renderId: DEFAULT_RENDER_ID
2367
2402
  };
@@ -22,6 +22,29 @@ function* attrTagIterator() {
22
22
  yield* this[rest];
23
23
  }
24
24
 
25
+ // src/common/errors.ts
26
+ function _el_read_error() {
27
+ if (true) {
28
+ throw new Error(
29
+ "Element references can only be read in scripts and event handlers."
30
+ );
31
+ }
32
+ }
33
+ function _hoist_read_error() {
34
+ if (true) {
35
+ throw new Error(
36
+ "Hoisted values can only be read in scripts and event handlers."
37
+ );
38
+ }
39
+ }
40
+ function _assert_hoist(value) {
41
+ if (typeof value !== "function") {
42
+ throw new Error(
43
+ `Hoisted values must be functions, received type "${typeof value}".`
44
+ );
45
+ }
46
+ }
47
+
25
48
  // src/common/for.ts
26
49
  function forIn(obj, cb) {
27
50
  for (const key in obj) {
@@ -180,9 +203,10 @@ var DEFAULT_RUNTIME_ID = "M";
180
203
  var DEFAULT_RENDER_ID = "_";
181
204
 
182
205
  // src/dom/scope.ts
206
+ var nextScopeId = 1e6;
183
207
  function createScope($global, closestBranch) {
184
208
  const scope = {
185
- ___id: $global.___nextScopeId++,
209
+ ___id: nextScopeId++,
186
210
  ___creating: 1,
187
211
  ___closestBranch: closestBranch,
188
212
  $global
@@ -190,8 +214,8 @@ function createScope($global, closestBranch) {
190
214
  pendingScopes.push(scope);
191
215
  return scope;
192
216
  }
193
- function skipScope(scope) {
194
- return scope.$global.___nextScopeId++;
217
+ function skipScope() {
218
+ return nextScopeId++;
195
219
  }
196
220
  function findBranchWithKey(scope, key) {
197
221
  let branch = scope.___closestBranch;
@@ -209,7 +233,7 @@ function destroyNestedBranches(branch) {
209
233
  branch.___branchScopes?.forEach(destroyNestedBranches);
210
234
  branch.___abortScopes?.forEach((scope) => {
211
235
  for (const id in scope.___abortControllers) {
212
- scope.___abortControllers[id]?.abort();
236
+ $signalReset(scope, id);
213
237
  }
214
238
  });
215
239
  }
@@ -255,7 +279,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
255
279
  walker.currentNode = scope[true ? getDebugKey(currentScopeIndex++, "#text") : currentScopeIndex++] = new Text()
256
280
  );
257
281
  if (value === 49 /* DynamicTagWithVar */) {
258
- scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
282
+ scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope();
259
283
  }
260
284
  } else if (value === 38 /* EndChild */) {
261
285
  return currentWalkIndex;
@@ -266,7 +290,7 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
266
290
  scope[true ? getDebugKey(currentScopeIndex++, "#childScope") : currentScopeIndex++] = createScope(scope.$global, scope.___closestBranch)
267
291
  );
268
292
  if (value === 48 /* BeginChildWithVar */) {
269
- scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
293
+ scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope();
270
294
  }
271
295
  } else if (value < 91 /* NextEnd */ + 1) {
272
296
  value = 20 /* Next */ * currentMultiplier + value - 67 /* Next */;
@@ -378,9 +402,11 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
378
402
  branchStarts.push(visit);
379
403
  } else {
380
404
  visitScope[
381
- nextToken()
405
+ "Getter:" /* Getter */ + nextToken()
382
406
  /* read accessor */
383
- ] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? visit.parentNode : visit;
407
+ ] = /* @__PURE__ */ ((node) => () => node)(
408
+ visitScope[lastToken] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? visit.parentNode : visit
409
+ );
384
410
  nextToken();
385
411
  endBranch(
386
412
  visitType !== "]" /* BranchEnd */ && visitType !== ")" /* BranchEndOnlyChildInParent */
@@ -450,7 +476,6 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
450
476
  $global = scope || {};
451
477
  $global.runtimeId = runtimeId;
452
478
  $global.renderId = renderId;
453
- $global.___nextScopeId = 1e6;
454
479
  } else if (typeof scope === "number") {
455
480
  lastScopeId += scope;
456
481
  } else {
@@ -853,7 +878,7 @@ function _let(valueAccessor, fn) {
853
878
  };
854
879
  return (scope, value, valueChange) => {
855
880
  if (rendering) {
856
- if ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value || !(valueAccessor in scope)) {
881
+ if ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value || scope.___creating) {
857
882
  scope[valueAccessor] = value;
858
883
  fn && fn(scope, value);
859
884
  }
@@ -1018,7 +1043,16 @@ function _script(id, fn) {
1018
1043
  queueEffect(scope, fn);
1019
1044
  };
1020
1045
  }
1046
+ function _el_read(value) {
1047
+ if (rendering) {
1048
+ _el_read_error();
1049
+ }
1050
+ return value;
1051
+ }
1021
1052
  function* traverseAllHoisted(scope, path, curIndex = path.length - 1) {
1053
+ if (rendering) {
1054
+ _hoist_read_error();
1055
+ }
1022
1056
  if (scope) {
1023
1057
  if (Symbol.iterator in scope) {
1024
1058
  for (const s of scope instanceof Map ? scope.values() : scope) {
@@ -1033,7 +1067,7 @@ function* traverseAllHoisted(scope, path, curIndex = path.length - 1) {
1033
1067
  }
1034
1068
  function _hoist(...path) {
1035
1069
  return (scope) => {
1036
- const getOne = (...args) => iterator().next().value(...args);
1070
+ const getOne = (...args) => iterator().next().value?.(...args);
1037
1071
  const iterator = getOne[Symbol.iterator] = () => traverseAllHoisted(scope, path);
1038
1072
  return getOne;
1039
1073
  };
@@ -1669,11 +1703,13 @@ function _await(nodeAccessor, renderer) {
1669
1703
  );
1670
1704
  removeAndDestroyBranch(placeholderBranch);
1671
1705
  }
1672
- const pendingEffects2 = tryWithPlaceholder.___effects;
1673
- if (pendingEffects2) {
1674
- tryWithPlaceholder.___effects = [];
1675
- runEffects(pendingEffects2, true);
1676
- }
1706
+ queueEffect(tryWithPlaceholder, (scope2) => {
1707
+ const pendingEffects2 = scope2.___effects;
1708
+ if (pendingEffects2) {
1709
+ scope2.___effects = [];
1710
+ runEffects(pendingEffects2, true);
1711
+ }
1712
+ });
1677
1713
  }
1678
1714
  }
1679
1715
  },
@@ -2198,7 +2234,6 @@ var compat = {
2198
2234
  component.effects = prepareEffects(() => {
2199
2235
  if (!branch) {
2200
2236
  created = 1;
2201
- out.global.___nextScopeId ||= 0;
2202
2237
  branch = component.scope = createAndSetupBranch(
2203
2238
  out.global,
2204
2239
  renderer,
@@ -2242,7 +2277,6 @@ function mount(input = {}, reference, position) {
2242
2277
  if ($global) {
2243
2278
  ({ $global, ...input } = input);
2244
2279
  $global = {
2245
- ___nextScopeId: 0,
2246
2280
  runtimeId: DEFAULT_RUNTIME_ID,
2247
2281
  renderId: DEFAULT_RENDER_ID,
2248
2282
  ...$global
@@ -2261,7 +2295,6 @@ function mount(input = {}, reference, position) {
2261
2295
  }
2262
2296
  } else {
2263
2297
  $global = {
2264
- ___nextScopeId: 0,
2265
2298
  runtimeId: DEFAULT_RUNTIME_ID,
2266
2299
  renderId: DEFAULT_RENDER_ID
2267
2300
  };
@@ -2325,6 +2358,7 @@ function mount(input = {}, reference, position) {
2325
2358
  export {
2326
2359
  $signal,
2327
2360
  $signalReset,
2361
+ _assert_hoist,
2328
2362
  _attr,
2329
2363
  _attr_class,
2330
2364
  _attr_class_item,
@@ -2363,6 +2397,7 @@ export {
2363
2397
  _content_resume,
2364
2398
  _dynamic_tag,
2365
2399
  _el,
2400
+ _el_read,
2366
2401
  _enable_catch,
2367
2402
  _for_closure,
2368
2403
  _for_in,
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var html_exports = {};
22
22
  __export(html_exports, {
23
23
  $global: () => $global,
24
+ _assert_hoist: () => _assert_hoist,
24
25
  _attr: () => _attr,
25
26
  _attr_class: () => _attr_class,
26
27
  _attr_content: () => _attr_content,
@@ -42,6 +43,7 @@ __export(html_exports, {
42
43
  _content_resume: () => _content_resume,
43
44
  _dynamic_tag: () => _dynamic_tag,
44
45
  _el: () => _el,
46
+ _el_read_error: () => _el_read_error,
45
47
  _el_resume: () => _el_resume,
46
48
  _escape: () => _escape,
47
49
  _escape_script: () => _escape_script,
@@ -53,6 +55,7 @@ __export(html_exports, {
53
55
  _for_to: () => _for_to,
54
56
  _for_until: () => _for_until,
55
57
  _hoist: () => _hoist,
58
+ _hoist_read_error: () => _hoist_read_error,
56
59
  _html: () => _html,
57
60
  _id: () => _id,
58
61
  _if: () => _if,
@@ -111,6 +114,29 @@ function* attrTagIterator() {
111
114
  yield* this[rest];
112
115
  }
113
116
 
117
+ // src/common/errors.ts
118
+ function _el_read_error() {
119
+ if (true) {
120
+ throw new Error(
121
+ "Element references can only be read in scripts and event handlers."
122
+ );
123
+ }
124
+ }
125
+ function _hoist_read_error() {
126
+ if (true) {
127
+ throw new Error(
128
+ "Hoisted values can only be read in scripts and event handlers."
129
+ );
130
+ }
131
+ }
132
+ function _assert_hoist(value) {
133
+ if (typeof value !== "function") {
134
+ throw new Error(
135
+ `Hoisted values must be functions, received type "${typeof value}".`
136
+ );
137
+ }
138
+ }
139
+
114
140
  // src/common/helpers.ts
115
141
  function classValue(classValue2) {
116
142
  return toDelimitedString(classValue2, " ", stringifyClassObject);
@@ -1835,21 +1861,12 @@ function _sep(shouldResume) {
1835
1861
  return shouldResume === 0 ? "" : "<!>";
1836
1862
  }
1837
1863
  function _el(scopeId, id) {
1838
- const getter = () => {
1839
- if (true) {
1840
- throw new Error("Cannot read a node reference on the server.");
1841
- }
1842
- };
1843
- return id ? _resume(getter, id, scopeId) : getter;
1864
+ return _resume(() => _el_read_error(), id, scopeId);
1844
1865
  }
1845
1866
  function _hoist(scopeId, id) {
1846
- const getter = () => {
1847
- if (true) {
1848
- throw new Error("Cannot read a hoisted value on the server.");
1849
- }
1850
- };
1851
- getter[Symbol.iterator] = getter;
1852
- return id ? _resume(getter, id, scopeId) : getter;
1867
+ const getter = () => _hoist_read_error();
1868
+ getter[Symbol.iterator] = _hoist_read_error;
1869
+ return _resume(getter, id, scopeId);
1853
1870
  }
1854
1871
  function _resume_branch(scopeId) {
1855
1872
  const branchId = $chunk.context?.[branchIdKey];
@@ -3505,6 +3522,7 @@ function NOOP3() {
3505
3522
  // Annotate the CommonJS export names for ESM import in node:
3506
3523
  0 && (module.exports = {
3507
3524
  $global,
3525
+ _assert_hoist,
3508
3526
  _attr,
3509
3527
  _attr_class,
3510
3528
  _attr_content,
@@ -3526,6 +3544,7 @@ function NOOP3() {
3526
3544
  _content_resume,
3527
3545
  _dynamic_tag,
3528
3546
  _el,
3547
+ _el_read_error,
3529
3548
  _el_resume,
3530
3549
  _escape,
3531
3550
  _escape_script,
@@ -3537,6 +3556,7 @@ function NOOP3() {
3537
3556
  _for_to,
3538
3557
  _for_until,
3539
3558
  _hoist,
3559
+ _hoist_read_error,
3540
3560
  _html,
3541
3561
  _id,
3542
3562
  _if,
@@ -22,6 +22,29 @@ function* attrTagIterator() {
22
22
  yield* this[rest];
23
23
  }
24
24
 
25
+ // src/common/errors.ts
26
+ function _el_read_error() {
27
+ if (true) {
28
+ throw new Error(
29
+ "Element references can only be read in scripts and event handlers."
30
+ );
31
+ }
32
+ }
33
+ function _hoist_read_error() {
34
+ if (true) {
35
+ throw new Error(
36
+ "Hoisted values can only be read in scripts and event handlers."
37
+ );
38
+ }
39
+ }
40
+ function _assert_hoist(value) {
41
+ if (typeof value !== "function") {
42
+ throw new Error(
43
+ `Hoisted values must be functions, received type "${typeof value}".`
44
+ );
45
+ }
46
+ }
47
+
25
48
  // src/common/helpers.ts
26
49
  function classValue(classValue2) {
27
50
  return toDelimitedString(classValue2, " ", stringifyClassObject);
@@ -1746,21 +1769,12 @@ function _sep(shouldResume) {
1746
1769
  return shouldResume === 0 ? "" : "<!>";
1747
1770
  }
1748
1771
  function _el(scopeId, id) {
1749
- const getter = () => {
1750
- if (true) {
1751
- throw new Error("Cannot read a node reference on the server.");
1752
- }
1753
- };
1754
- return id ? _resume(getter, id, scopeId) : getter;
1772
+ return _resume(() => _el_read_error(), id, scopeId);
1755
1773
  }
1756
1774
  function _hoist(scopeId, id) {
1757
- const getter = () => {
1758
- if (true) {
1759
- throw new Error("Cannot read a hoisted value on the server.");
1760
- }
1761
- };
1762
- getter[Symbol.iterator] = getter;
1763
- return id ? _resume(getter, id, scopeId) : getter;
1775
+ const getter = () => _hoist_read_error();
1776
+ getter[Symbol.iterator] = _hoist_read_error;
1777
+ return _resume(getter, id, scopeId);
1764
1778
  }
1765
1779
  function _resume_branch(scopeId) {
1766
1780
  const branchId = $chunk.context?.[branchIdKey];
@@ -3415,6 +3429,7 @@ function NOOP3() {
3415
3429
  }
3416
3430
  export {
3417
3431
  $global,
3432
+ _assert_hoist,
3418
3433
  _attr,
3419
3434
  _attr_class,
3420
3435
  _attr_content,
@@ -3436,6 +3451,7 @@ export {
3436
3451
  _content_resume,
3437
3452
  _dynamic_tag,
3438
3453
  _el,
3454
+ _el_read_error,
3439
3455
  _el_resume,
3440
3456
  _escape,
3441
3457
  _escape_script,
@@ -3447,6 +3463,7 @@ export {
3447
3463
  _for_to,
3448
3464
  _for_until,
3449
3465
  _hoist,
3466
+ _hoist_read_error,
3450
3467
  _html,
3451
3468
  _id,
3452
3469
  _if,
@@ -1,6 +1,6 @@
1
1
  import type { BranchScope, Scope } from "../common/types";
2
2
  export declare function createScope($global: Scope["$global"], closestBranch?: BranchScope): Scope;
3
- export declare function skipScope(scope: Scope): number;
3
+ export declare function skipScope(): number;
4
4
  export declare function findBranchWithKey(scope: Scope, key: string): BranchScope | undefined;
5
5
  export declare function destroyBranch(branch: BranchScope): void;
6
6
  export declare function removeAndDestroyBranch(branch: BranchScope): void;
@@ -28,4 +28,5 @@ export declare function _return_change(scope: Scope, changeHandler?: ((value: un
28
28
  export declare const _var_change: (scope: Scope, value: unknown, name?: string) => void;
29
29
  export declare function _id({ $global }: Scope): string;
30
30
  export declare function _script(id: string, fn: (scope: Scope) => void): (scope: Scope) => void;
31
+ export declare function _el_read<T>(value: T): T;
31
32
  export declare function _hoist(...path: Accessor[]): (scope: Scope) => (...args: unknown[]) => any;
package/dist/dom.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { attrTag, attrTags } from "./common/attr-tag";
2
+ export { _assert_hoist } from "./common/errors";
2
3
  export { forIn, forOf, forTo, forUntil } from "./common/for";
3
4
  export { $signal, $signalReset } from "./dom/abort-signal";
4
5
  export { compat } from "./dom/compat";
@@ -9,5 +10,5 @@ export { _on } from "./dom/event";
9
10
  export { _enable_catch as _enable_catch, run } from "./dom/queue";
10
11
  export { _content, _content_branch, _content_closures, _content_resume, } from "./dom/renderer";
11
12
  export { _el, _resume, _var_resume, init } from "./dom/resume";
12
- export { _child_setup, _closure, _closure_get, _const, _for_closure, _hoist, _id, _if_closure, _let, _or, _return, _return_change, _script, _var, _var_change, } from "./dom/signals";
13
+ export { _child_setup, _closure, _closure_get, _const, _el_read, _for_closure, _hoist, _id, _if_closure, _let, _or, _return, _return_change, _script, _var, _var_change, } from "./dom/signals";
13
14
  export { _template } from "./dom/template";