solid-js 2.0.0-beta.0 → 2.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dev.cjs CHANGED
@@ -38,17 +38,10 @@ function devComponent(Comp, props) {
38
38
  owner._props = props;
39
39
  owner._name = Comp.name;
40
40
  owner._component = Comp;
41
- return signals.untrack(() => {
42
- Object.assign(Comp, {
43
- [$DEVCOMP]: true
44
- });
45
- signals.setStrictRead(`<${Comp.name || "Anonymous"}>`);
46
- try {
47
- return Comp(props);
48
- } finally {
49
- signals.setStrictRead(false);
50
- }
41
+ Object.assign(Comp, {
42
+ [$DEVCOMP]: true
51
43
  });
44
+ return signals.untrack(() => Comp(props), `<${Comp.name || "Anonymous"}>`);
52
45
  }, {
53
46
  transparent: true
54
47
  });
@@ -60,6 +53,10 @@ function registerGraph(value) {
60
53
  value.graph = owner;
61
54
  }
62
55
 
56
+ const NoHydrateContext = {
57
+ id: Symbol("NoHydrateContext"),
58
+ defaultValue: false
59
+ };
63
60
  const sharedConfig = {
64
61
  hydrating: false,
65
62
  registry: undefined,
@@ -67,6 +64,7 @@ const sharedConfig = {
67
64
  getNextContextId() {
68
65
  const o = signals.getOwner();
69
66
  if (!o) throw new Error(`getNextContextId cannot be used under non-hydrating context`);
67
+ if (signals.getContext(NoHydrateContext)) return undefined;
70
68
  return signals.getNextChildId(o);
71
69
  }
72
70
  };
@@ -156,11 +154,41 @@ function subFetch(fn, prev) {
156
154
  Promise = ogPromise;
157
155
  }
158
156
  }
159
- function consumeFirstSync(ai) {
160
- const iter = ai[Symbol.asyncIterator]();
161
- const r = iter.next();
162
- const value = !(r instanceof Promise) && !r.done ? r.value : undefined;
163
- return [value, iter];
157
+ function syncThenable(value) {
158
+ return {
159
+ then(fn) {
160
+ fn(value);
161
+ }
162
+ };
163
+ }
164
+ function normalizeIterator(it) {
165
+ let first = true;
166
+ let buffered = null;
167
+ return {
168
+ next() {
169
+ if (first) {
170
+ first = false;
171
+ const r = it.next();
172
+ return r && typeof r.then === "function" ? r : syncThenable(r);
173
+ }
174
+ if (buffered) {
175
+ const b = buffered;
176
+ buffered = null;
177
+ return b;
178
+ }
179
+ let latest = it.next();
180
+ if (latest && typeof latest.then === "function") return latest;
181
+ while (!latest.done) {
182
+ const peek = it.next();
183
+ if (peek && typeof peek.then === "function") {
184
+ buffered = peek;
185
+ break;
186
+ }
187
+ latest = peek;
188
+ }
189
+ return Promise.resolve(latest);
190
+ }
191
+ };
164
192
  }
165
193
  function applyPatches(target, patches) {
166
194
  for (const patch of patches) {
@@ -177,24 +205,6 @@ function applyPatches(target, patches) {
177
205
  }
178
206
  }
179
207
  }
180
- function scheduleIteratorConsumption(iter, apply) {
181
- const consume = () => {
182
- while (true) {
183
- const n = iter.next();
184
- if (n instanceof Promise) {
185
- n.then(r => {
186
- if (r.done) return;
187
- apply(r.value);
188
- consume();
189
- });
190
- return;
191
- }
192
- if (n.done) break;
193
- apply(n.value);
194
- }
195
- };
196
- consume();
197
- }
198
208
  function isAsyncIterable(v) {
199
209
  return v != null && typeof v[Symbol.asyncIterator] === "function";
200
210
  }
@@ -202,34 +212,85 @@ function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) {
202
212
  const parent = signals.getOwner();
203
213
  const expectedId = signals.peekNextChildId(parent);
204
214
  if (!sharedConfig.has(expectedId)) return null;
205
- const initP = sharedConfig.load(expectedId);
206
- if (!isAsyncIterable(initP)) return null;
207
- const [firstValue, iter] = consumeFirstSync(initP);
208
- const [get, set] = signals.createSignal(firstValue);
209
- const result = coreFn(() => get(), firstValue, options);
210
- scheduleIteratorConsumption(iter, v => {
211
- set(() => v);
212
- signals.flush();
213
- });
214
- return result;
215
+ const loaded = sharedConfig.load(expectedId);
216
+ if (!isAsyncIterable(loaded)) return null;
217
+ const it = normalizeIterator(loaded[Symbol.asyncIterator]());
218
+ const iterable = {
219
+ [Symbol.asyncIterator]() {
220
+ return it;
221
+ }
222
+ };
223
+ return coreFn(() => iterable, value, options);
215
224
  }
216
225
  function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) {
217
226
  const parent = signals.getOwner();
218
227
  const expectedId = signals.peekNextChildId(parent);
219
228
  if (!sharedConfig.has(expectedId)) return null;
220
- const initP = sharedConfig.load(expectedId);
221
- if (!isAsyncIterable(initP)) return null;
222
- const [firstState, iter] = consumeFirstSync(initP);
223
- const [store, setStore] = coreFn(() => {}, firstState ?? initialValue, options);
224
- scheduleIteratorConsumption(iter, patches => {
225
- setStore(d => {
226
- applyPatches(d, patches);
227
- });
228
- });
229
- return [store, setStore];
229
+ const loaded = sharedConfig.load(expectedId);
230
+ if (!isAsyncIterable(loaded)) return null;
231
+ const srcIt = loaded[Symbol.asyncIterator]();
232
+ let isFirst = true;
233
+ let buffered = null;
234
+ return coreFn(draft => {
235
+ const process = res => {
236
+ if (res.done) return {
237
+ done: true,
238
+ value: undefined
239
+ };
240
+ if (isFirst) {
241
+ isFirst = false;
242
+ if (Array.isArray(res.value)) {
243
+ for (let i = 0; i < res.value.length; i++) draft[i] = res.value[i];
244
+ draft.length = res.value.length;
245
+ } else {
246
+ Object.assign(draft, res.value);
247
+ }
248
+ } else {
249
+ applyPatches(draft, res.value);
250
+ }
251
+ return {
252
+ done: false,
253
+ value: undefined
254
+ };
255
+ };
256
+ return {
257
+ [Symbol.asyncIterator]() {
258
+ return {
259
+ next() {
260
+ if (isFirst) {
261
+ const r = srcIt.next();
262
+ return r && typeof r.then === "function" ? r.then(process) : syncThenable(process(r));
263
+ }
264
+ if (buffered) {
265
+ const b = buffered;
266
+ buffered = null;
267
+ return b.then(process);
268
+ }
269
+ let r = srcIt.next();
270
+ if (r && typeof r.then === "function") {
271
+ return r.then(process);
272
+ }
273
+ let result = process(r);
274
+ while (!r.done) {
275
+ const peek = srcIt.next();
276
+ if (peek && typeof peek.then === "function") {
277
+ buffered = peek;
278
+ break;
279
+ }
280
+ r = peek;
281
+ if (!r.done) result = process(r);
282
+ }
283
+ return Promise.resolve(result);
284
+ }
285
+ };
286
+ }
287
+ };
288
+ }, initialValue, options);
230
289
  }
231
290
  function hydratedCreateMemo(compute, value, options) {
232
- if (!sharedConfig.hydrating) return signals.createMemo(compute, value, options);
291
+ if (!sharedConfig.hydrating) {
292
+ return signals.createMemo(compute, value, options);
293
+ }
233
294
  markTopLevelSnapshotScope();
234
295
  const ssrSource = options?.ssrSource;
235
296
  if (ssrSource === "client") {
@@ -381,14 +442,16 @@ function hydratedCreateOptimisticStore(first, second, third) {
381
442
  return signals.createOptimisticStore(wrapStoreFn(first, ssrSource), second, third);
382
443
  }
383
444
  function hydratedCreateProjection(fn, initialValue, options) {
384
- if (!sharedConfig.hydrating) return signals.createProjection(fn, initialValue, options);
445
+ if (!sharedConfig.hydrating) {
446
+ return signals.createProjection(fn, initialValue, options);
447
+ }
385
448
  markTopLevelSnapshotScope();
386
449
  const ssrSource = options?.ssrSource;
387
450
  if (ssrSource === "client" || ssrSource === "initial") {
388
451
  return signals.createProjection(draft => draft, initialValue, options);
389
452
  }
390
- const aiResult = hydrateStoreFromAsyncIterable(signals.createStore, initialValue, options);
391
- if (aiResult !== null) return aiResult[0];
453
+ const aiResult = hydrateStoreFromAsyncIterable(signals.createProjection, initialValue, options);
454
+ if (aiResult !== null) return aiResult;
392
455
  return signals.createProjection(wrapStoreFn(fn, ssrSource), initialValue, options);
393
456
  }
394
457
  function hydratedEffect(coreFn, compute, effectFn, value, options) {
@@ -586,6 +649,17 @@ function Loading(props) {
586
649
  return signals.createLoadBoundary(() => props.children, () => props.fallback);
587
650
  });
588
651
  }
652
+ function NoHydration(props) {
653
+ const o = signals.createOwner();
654
+ return signals.runWithOwner(o, () => {
655
+ signals.setContext(NoHydrateContext, true);
656
+ if (sharedConfig.hydrating) return undefined;
657
+ return props.children;
658
+ });
659
+ }
660
+ function Hydration(props) {
661
+ return props.children;
662
+ }
589
663
 
590
664
  function createComponent(Comp, props) {
591
665
  return devComponent(Comp, props || {});
@@ -617,6 +691,7 @@ function lazy(fn, moduleUrl) {
617
691
  }) : "");
618
692
  };
619
693
  wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
694
+ wrap.moduleUrl = moduleUrl;
620
695
  return wrap;
621
696
  }
622
697
  let counter = 0;
@@ -657,17 +732,10 @@ function Show(props) {
657
732
  if (c) {
658
733
  const child = props.children;
659
734
  const fn = typeof child === "function" && child.length > 0;
660
- return fn ? signals.untrack(() => {
661
- signals.setStrictRead("<Show>");
662
- try {
663
- return child(() => {
664
- if (!signals.untrack(condition)) throw narrowedError("Show");
665
- return conditionValue();
666
- });
667
- } finally {
668
- signals.setStrictRead(false);
669
- }
670
- }) : child;
735
+ return fn ? signals.untrack(() => child(() => {
736
+ if (!signals.untrack(condition)) throw narrowedError("Show");
737
+ return conditionValue();
738
+ }), "<Show>") : child;
671
739
  }
672
740
  return props.fallback;
673
741
  }, undefined, {
@@ -700,17 +768,10 @@ function Switch(props) {
700
768
  const [index, conditionValue, mp] = sel;
701
769
  const child = mp.children;
702
770
  const fn = typeof child === "function" && child.length > 0;
703
- return fn ? signals.untrack(() => {
704
- signals.setStrictRead("<Match>");
705
- try {
706
- return child(() => {
707
- if (signals.untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
708
- return conditionValue();
709
- });
710
- } finally {
711
- signals.setStrictRead(false);
712
- }
713
- }) : child;
771
+ return fn ? signals.untrack(() => child(() => {
772
+ if (signals.untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
773
+ return conditionValue();
774
+ }), "<Match>") : child;
714
775
  }, undefined, {
715
776
  name: "eval conditions"
716
777
  } );
@@ -741,6 +802,10 @@ Object.defineProperty(exports, "$PROXY", {
741
802
  enumerable: true,
742
803
  get: function () { return signals.$PROXY; }
743
804
  });
805
+ Object.defineProperty(exports, "$REFRESH", {
806
+ enumerable: true,
807
+ get: function () { return signals.$REFRESH; }
808
+ });
744
809
  Object.defineProperty(exports, "$TRACK", {
745
810
  enumerable: true,
746
811
  get: function () { return signals.$TRACK; }
@@ -853,6 +918,10 @@ Object.defineProperty(exports, "runWithOwner", {
853
918
  enumerable: true,
854
919
  get: function () { return signals.runWithOwner; }
855
920
  });
921
+ Object.defineProperty(exports, "setOnUnhandledAsync", {
922
+ enumerable: true,
923
+ get: function () { return signals.setOnUnhandledAsync; }
924
+ });
856
925
  Object.defineProperty(exports, "snapshot", {
857
926
  enumerable: true,
858
927
  get: function () { return signals.snapshot; }
@@ -869,8 +938,11 @@ exports.$DEVCOMP = $DEVCOMP;
869
938
  exports.DEV = DEV;
870
939
  exports.Errored = Errored;
871
940
  exports.For = For;
941
+ exports.Hydration = Hydration;
872
942
  exports.Loading = Loading;
873
943
  exports.Match = Match;
944
+ exports.NoHydrateContext = NoHydrateContext;
945
+ exports.NoHydration = NoHydration;
874
946
  exports.Repeat = Repeat;
875
947
  exports.Show = Show;
876
948
  exports.Switch = Switch;
package/dist/dev.js CHANGED
@@ -1,5 +1,5 @@
1
- import { getContext, createMemo as createMemo$1, flatten, getOwner, createRoot, setContext, untrack, setStrictRead, createLoadBoundary, onCleanup, isDisposed, runWithOwner, createEffect as createEffect$1, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createRenderEffect as createRenderEffect$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, getNextChildId, createErrorBoundary as createErrorBoundary$1, markSnapshotScope, flush, clearSnapshots, peekNextChildId, mapArray, repeat } from '@solidjs/signals';
2
- export { $PROXY, $TRACK, NotReadyError, action, createOwner, createReaction, createRoot, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isPending, isRefreshing, isWrappable, latest, mapArray, merge, omit, onCleanup, onSettled, reconcile, refresh, repeat, resolve, runWithOwner, snapshot, storePath, untrack } from '@solidjs/signals';
1
+ import { getContext, createMemo as createMemo$1, flatten, getOwner, createRoot, setContext, untrack, createLoadBoundary, onCleanup, isDisposed, runWithOwner, createOwner, createEffect as createEffect$1, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createRenderEffect as createRenderEffect$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, getNextChildId, createErrorBoundary as createErrorBoundary$1, markSnapshotScope, flush, clearSnapshots, peekNextChildId, mapArray, repeat } from '@solidjs/signals';
2
+ export { $PROXY, $REFRESH, $TRACK, NotReadyError, action, createOwner, createReaction, createRoot, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isPending, isRefreshing, isWrappable, latest, mapArray, merge, omit, onCleanup, onSettled, reconcile, refresh, repeat, resolve, runWithOwner, setOnUnhandledAsync, snapshot, storePath, untrack } from '@solidjs/signals';
3
3
 
4
4
  const $DEVCOMP = Symbol("COMPONENT_DEV" );
5
5
  function createContext(defaultValue, options) {
@@ -37,17 +37,10 @@ function devComponent(Comp, props) {
37
37
  owner._props = props;
38
38
  owner._name = Comp.name;
39
39
  owner._component = Comp;
40
- return untrack(() => {
41
- Object.assign(Comp, {
42
- [$DEVCOMP]: true
43
- });
44
- setStrictRead(`<${Comp.name || "Anonymous"}>`);
45
- try {
46
- return Comp(props);
47
- } finally {
48
- setStrictRead(false);
49
- }
40
+ Object.assign(Comp, {
41
+ [$DEVCOMP]: true
50
42
  });
43
+ return untrack(() => Comp(props), `<${Comp.name || "Anonymous"}>`);
51
44
  }, {
52
45
  transparent: true
53
46
  });
@@ -59,6 +52,10 @@ function registerGraph(value) {
59
52
  value.graph = owner;
60
53
  }
61
54
 
55
+ const NoHydrateContext = {
56
+ id: Symbol("NoHydrateContext"),
57
+ defaultValue: false
58
+ };
62
59
  const sharedConfig = {
63
60
  hydrating: false,
64
61
  registry: undefined,
@@ -66,6 +63,7 @@ const sharedConfig = {
66
63
  getNextContextId() {
67
64
  const o = getOwner();
68
65
  if (!o) throw new Error(`getNextContextId cannot be used under non-hydrating context`);
66
+ if (getContext(NoHydrateContext)) return undefined;
69
67
  return getNextChildId(o);
70
68
  }
71
69
  };
@@ -155,11 +153,41 @@ function subFetch(fn, prev) {
155
153
  Promise = ogPromise;
156
154
  }
157
155
  }
158
- function consumeFirstSync(ai) {
159
- const iter = ai[Symbol.asyncIterator]();
160
- const r = iter.next();
161
- const value = !(r instanceof Promise) && !r.done ? r.value : undefined;
162
- return [value, iter];
156
+ function syncThenable(value) {
157
+ return {
158
+ then(fn) {
159
+ fn(value);
160
+ }
161
+ };
162
+ }
163
+ function normalizeIterator(it) {
164
+ let first = true;
165
+ let buffered = null;
166
+ return {
167
+ next() {
168
+ if (first) {
169
+ first = false;
170
+ const r = it.next();
171
+ return r && typeof r.then === "function" ? r : syncThenable(r);
172
+ }
173
+ if (buffered) {
174
+ const b = buffered;
175
+ buffered = null;
176
+ return b;
177
+ }
178
+ let latest = it.next();
179
+ if (latest && typeof latest.then === "function") return latest;
180
+ while (!latest.done) {
181
+ const peek = it.next();
182
+ if (peek && typeof peek.then === "function") {
183
+ buffered = peek;
184
+ break;
185
+ }
186
+ latest = peek;
187
+ }
188
+ return Promise.resolve(latest);
189
+ }
190
+ };
163
191
  }
164
192
  function applyPatches(target, patches) {
165
193
  for (const patch of patches) {
@@ -176,24 +204,6 @@ function applyPatches(target, patches) {
176
204
  }
177
205
  }
178
206
  }
179
- function scheduleIteratorConsumption(iter, apply) {
180
- const consume = () => {
181
- while (true) {
182
- const n = iter.next();
183
- if (n instanceof Promise) {
184
- n.then(r => {
185
- if (r.done) return;
186
- apply(r.value);
187
- consume();
188
- });
189
- return;
190
- }
191
- if (n.done) break;
192
- apply(n.value);
193
- }
194
- };
195
- consume();
196
- }
197
207
  function isAsyncIterable(v) {
198
208
  return v != null && typeof v[Symbol.asyncIterator] === "function";
199
209
  }
@@ -201,34 +211,85 @@ function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) {
201
211
  const parent = getOwner();
202
212
  const expectedId = peekNextChildId(parent);
203
213
  if (!sharedConfig.has(expectedId)) return null;
204
- const initP = sharedConfig.load(expectedId);
205
- if (!isAsyncIterable(initP)) return null;
206
- const [firstValue, iter] = consumeFirstSync(initP);
207
- const [get, set] = createSignal$1(firstValue);
208
- const result = coreFn(() => get(), firstValue, options);
209
- scheduleIteratorConsumption(iter, v => {
210
- set(() => v);
211
- flush();
212
- });
213
- return result;
214
+ const loaded = sharedConfig.load(expectedId);
215
+ if (!isAsyncIterable(loaded)) return null;
216
+ const it = normalizeIterator(loaded[Symbol.asyncIterator]());
217
+ const iterable = {
218
+ [Symbol.asyncIterator]() {
219
+ return it;
220
+ }
221
+ };
222
+ return coreFn(() => iterable, value, options);
214
223
  }
215
224
  function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) {
216
225
  const parent = getOwner();
217
226
  const expectedId = peekNextChildId(parent);
218
227
  if (!sharedConfig.has(expectedId)) return null;
219
- const initP = sharedConfig.load(expectedId);
220
- if (!isAsyncIterable(initP)) return null;
221
- const [firstState, iter] = consumeFirstSync(initP);
222
- const [store, setStore] = coreFn(() => {}, firstState ?? initialValue, options);
223
- scheduleIteratorConsumption(iter, patches => {
224
- setStore(d => {
225
- applyPatches(d, patches);
226
- });
227
- });
228
- return [store, setStore];
228
+ const loaded = sharedConfig.load(expectedId);
229
+ if (!isAsyncIterable(loaded)) return null;
230
+ const srcIt = loaded[Symbol.asyncIterator]();
231
+ let isFirst = true;
232
+ let buffered = null;
233
+ return coreFn(draft => {
234
+ const process = res => {
235
+ if (res.done) return {
236
+ done: true,
237
+ value: undefined
238
+ };
239
+ if (isFirst) {
240
+ isFirst = false;
241
+ if (Array.isArray(res.value)) {
242
+ for (let i = 0; i < res.value.length; i++) draft[i] = res.value[i];
243
+ draft.length = res.value.length;
244
+ } else {
245
+ Object.assign(draft, res.value);
246
+ }
247
+ } else {
248
+ applyPatches(draft, res.value);
249
+ }
250
+ return {
251
+ done: false,
252
+ value: undefined
253
+ };
254
+ };
255
+ return {
256
+ [Symbol.asyncIterator]() {
257
+ return {
258
+ next() {
259
+ if (isFirst) {
260
+ const r = srcIt.next();
261
+ return r && typeof r.then === "function" ? r.then(process) : syncThenable(process(r));
262
+ }
263
+ if (buffered) {
264
+ const b = buffered;
265
+ buffered = null;
266
+ return b.then(process);
267
+ }
268
+ let r = srcIt.next();
269
+ if (r && typeof r.then === "function") {
270
+ return r.then(process);
271
+ }
272
+ let result = process(r);
273
+ while (!r.done) {
274
+ const peek = srcIt.next();
275
+ if (peek && typeof peek.then === "function") {
276
+ buffered = peek;
277
+ break;
278
+ }
279
+ r = peek;
280
+ if (!r.done) result = process(r);
281
+ }
282
+ return Promise.resolve(result);
283
+ }
284
+ };
285
+ }
286
+ };
287
+ }, initialValue, options);
229
288
  }
230
289
  function hydratedCreateMemo(compute, value, options) {
231
- if (!sharedConfig.hydrating) return createMemo$1(compute, value, options);
290
+ if (!sharedConfig.hydrating) {
291
+ return createMemo$1(compute, value, options);
292
+ }
232
293
  markTopLevelSnapshotScope();
233
294
  const ssrSource = options?.ssrSource;
234
295
  if (ssrSource === "client") {
@@ -380,14 +441,16 @@ function hydratedCreateOptimisticStore(first, second, third) {
380
441
  return createOptimisticStore$1(wrapStoreFn(first, ssrSource), second, third);
381
442
  }
382
443
  function hydratedCreateProjection(fn, initialValue, options) {
383
- if (!sharedConfig.hydrating) return createProjection$1(fn, initialValue, options);
444
+ if (!sharedConfig.hydrating) {
445
+ return createProjection$1(fn, initialValue, options);
446
+ }
384
447
  markTopLevelSnapshotScope();
385
448
  const ssrSource = options?.ssrSource;
386
449
  if (ssrSource === "client" || ssrSource === "initial") {
387
450
  return createProjection$1(draft => draft, initialValue, options);
388
451
  }
389
- const aiResult = hydrateStoreFromAsyncIterable(createStore$1, initialValue, options);
390
- if (aiResult !== null) return aiResult[0];
452
+ const aiResult = hydrateStoreFromAsyncIterable(createProjection$1, initialValue, options);
453
+ if (aiResult !== null) return aiResult;
391
454
  return createProjection$1(wrapStoreFn(fn, ssrSource), initialValue, options);
392
455
  }
393
456
  function hydratedEffect(coreFn, compute, effectFn, value, options) {
@@ -585,6 +648,17 @@ function Loading(props) {
585
648
  return createLoadBoundary(() => props.children, () => props.fallback);
586
649
  });
587
650
  }
651
+ function NoHydration(props) {
652
+ const o = createOwner();
653
+ return runWithOwner(o, () => {
654
+ setContext(NoHydrateContext, true);
655
+ if (sharedConfig.hydrating) return undefined;
656
+ return props.children;
657
+ });
658
+ }
659
+ function Hydration(props) {
660
+ return props.children;
661
+ }
588
662
 
589
663
  function createComponent(Comp, props) {
590
664
  return devComponent(Comp, props || {});
@@ -616,6 +690,7 @@ function lazy(fn, moduleUrl) {
616
690
  }) : "");
617
691
  };
618
692
  wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
693
+ wrap.moduleUrl = moduleUrl;
619
694
  return wrap;
620
695
  }
621
696
  let counter = 0;
@@ -656,17 +731,10 @@ function Show(props) {
656
731
  if (c) {
657
732
  const child = props.children;
658
733
  const fn = typeof child === "function" && child.length > 0;
659
- return fn ? untrack(() => {
660
- setStrictRead("<Show>");
661
- try {
662
- return child(() => {
663
- if (!untrack(condition)) throw narrowedError("Show");
664
- return conditionValue();
665
- });
666
- } finally {
667
- setStrictRead(false);
668
- }
669
- }) : child;
734
+ return fn ? untrack(() => child(() => {
735
+ if (!untrack(condition)) throw narrowedError("Show");
736
+ return conditionValue();
737
+ }), "<Show>") : child;
670
738
  }
671
739
  return props.fallback;
672
740
  }, undefined, {
@@ -699,17 +767,10 @@ function Switch(props) {
699
767
  const [index, conditionValue, mp] = sel;
700
768
  const child = mp.children;
701
769
  const fn = typeof child === "function" && child.length > 0;
702
- return fn ? untrack(() => {
703
- setStrictRead("<Match>");
704
- try {
705
- return child(() => {
706
- if (untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
707
- return conditionValue();
708
- });
709
- } finally {
710
- setStrictRead(false);
711
- }
712
- }) : child;
770
+ return fn ? untrack(() => child(() => {
771
+ if (untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
772
+ return conditionValue();
773
+ }), "<Match>") : child;
713
774
  }, undefined, {
714
775
  name: "eval conditions"
715
776
  } );
@@ -736,4 +797,4 @@ if (globalThis) {
736
797
  if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
737
798
  }
738
799
 
739
- export { $DEVCOMP, DEV, Errored, For, Loading, Match, Repeat, Show, Switch, children, createComponent, createContext, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createRenderEffect, createSignal, createStore, createUniqueId, enableHydration, lazy, sharedConfig, ssrHandleError, ssrRunInScope, useContext };
800
+ export { $DEVCOMP, DEV, Errored, For, Hydration, Loading, Match, NoHydrateContext, NoHydration, Repeat, Show, Switch, children, createComponent, createContext, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createRenderEffect, createSignal, createStore, createUniqueId, enableHydration, lazy, sharedConfig, ssrHandleError, ssrRunInScope, useContext };