solid-js 1.3.0 → 1.3.4

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
@@ -249,7 +249,7 @@ function createResource(source, fetcher, options) {
249
249
  fetcher = source;
250
250
  source = true;
251
251
  }
252
- options ||= {};
252
+ options || (options = {});
253
253
  if (options.globalRefetch !== false) {
254
254
  Resources || (Resources = new Set());
255
255
  Resources.add(load);
@@ -506,7 +506,7 @@ function startTransition(fn) {
506
506
  queue: new Set(),
507
507
  running: true
508
508
  });
509
- t.done ||= new Promise(res => t.resolve = res);
509
+ t.done || (t.done = new Promise(res => t.resolve = res));
510
510
  t.running = true;
511
511
  }
512
512
  batch(fn);
@@ -1313,7 +1313,6 @@ function lazy(fn) {
1313
1313
  const wrap = props => {
1314
1314
  const ctx = sharedConfig.context;
1315
1315
  if (ctx) {
1316
- ctx.count++;
1317
1316
  const [s, set] = createSignal();
1318
1317
  (p || (p = fn())).then(mod => {
1319
1318
  setHydrateContext(ctx);
@@ -1332,6 +1331,9 @@ function lazy(fn) {
1332
1331
  }
1333
1332
  let Comp;
1334
1333
  return createMemo(() => (Comp = comp()) && untrack(() => {
1334
+ Object.assign(Comp, {
1335
+ [$DEVCOMP]: true
1336
+ });
1335
1337
  if (!ctx) return Comp(props);
1336
1338
  const c = sharedConfig.context;
1337
1339
  setHydrateContext(ctx);
@@ -1399,12 +1401,19 @@ function Switch(props) {
1399
1401
  function Match(props) {
1400
1402
  return props;
1401
1403
  }
1404
+ let Errors;
1405
+ function resetErrorBoundaries() {
1406
+ Errors && [...Errors].forEach(fn => fn());
1407
+ }
1402
1408
  function ErrorBoundary(props) {
1403
1409
  let err = undefined;
1404
1410
  if (sharedConfig.context && sharedConfig.load) {
1405
1411
  err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
1406
1412
  }
1407
1413
  const [errored, setErrored] = createSignal(err);
1414
+ Errors || (Errors = new Set());
1415
+ Errors.add(setErrored);
1416
+ onCleanup(() => Errors.delete(setErrored));
1408
1417
  let e;
1409
1418
  return createMemo(() => {
1410
1419
  if ((e = errored()) != null) {
@@ -1508,20 +1517,18 @@ function Suspense(props) {
1508
1517
  const key = sharedConfig.context.id + sharedConfig.context.count;
1509
1518
  p = sharedConfig.load(key);
1510
1519
  if (p) {
1511
- if (typeof p !== "object" || !("then" in p)) error = p;else {
1512
- const [s, set] = createSignal(undefined, {
1513
- equals: false
1514
- });
1515
- flicker = s;
1516
- p.then(err => {
1517
- if (error = err) return set();
1518
- sharedConfig.gather(key);
1519
- setHydrateContext(ctx);
1520
- set();
1521
- setHydrateContext();
1522
- p = undefined;
1523
- });
1524
- }
1520
+ if (typeof p !== "object" || !("then" in p)) p = Promise.resolve(p);
1521
+ const [s, set] = createSignal(undefined, {
1522
+ equals: false
1523
+ });
1524
+ flicker = s;
1525
+ p.then(err => {
1526
+ if (error = err) return set();
1527
+ sharedConfig.gather(key);
1528
+ setHydrateContext(ctx);
1529
+ set();
1530
+ setHydrateContext();
1531
+ });
1525
1532
  }
1526
1533
  }
1527
1534
  const listContext = useContext(SuspenseListContext);
@@ -1547,6 +1554,7 @@ function Suspense(props) {
1547
1554
  dispose && dispose();
1548
1555
  if ((!inFallback || p !== undefined) && visibleContent) {
1549
1556
  store.resolved = true;
1557
+ ctx = p = undefined;
1550
1558
  resumeEffects(store.effects);
1551
1559
  return rendered;
1552
1560
  }
@@ -1625,6 +1633,7 @@ exports.onError = onError;
1625
1633
  exports.onMount = onMount;
1626
1634
  exports.refetchResources = refetchResources;
1627
1635
  exports.requestCallback = requestCallback;
1636
+ exports.resetErrorBoundaries = resetErrorBoundaries;
1628
1637
  exports.runWithOwner = runWithOwner;
1629
1638
  exports.sharedConfig = sharedConfig;
1630
1639
  exports.splitProps = splitProps;
package/dist/dev.js CHANGED
@@ -245,7 +245,7 @@ function createResource(source, fetcher, options) {
245
245
  fetcher = source;
246
246
  source = true;
247
247
  }
248
- options ||= {};
248
+ options || (options = {});
249
249
  if (options.globalRefetch !== false) {
250
250
  Resources || (Resources = new Set());
251
251
  Resources.add(load);
@@ -502,7 +502,7 @@ function startTransition(fn) {
502
502
  queue: new Set(),
503
503
  running: true
504
504
  });
505
- t.done ||= new Promise(res => t.resolve = res);
505
+ t.done || (t.done = new Promise(res => t.resolve = res));
506
506
  t.running = true;
507
507
  }
508
508
  batch(fn);
@@ -1309,7 +1309,6 @@ function lazy(fn) {
1309
1309
  const wrap = props => {
1310
1310
  const ctx = sharedConfig.context;
1311
1311
  if (ctx) {
1312
- ctx.count++;
1313
1312
  const [s, set] = createSignal();
1314
1313
  (p || (p = fn())).then(mod => {
1315
1314
  setHydrateContext(ctx);
@@ -1328,6 +1327,9 @@ function lazy(fn) {
1328
1327
  }
1329
1328
  let Comp;
1330
1329
  return createMemo(() => (Comp = comp()) && untrack(() => {
1330
+ Object.assign(Comp, {
1331
+ [$DEVCOMP]: true
1332
+ });
1331
1333
  if (!ctx) return Comp(props);
1332
1334
  const c = sharedConfig.context;
1333
1335
  setHydrateContext(ctx);
@@ -1395,12 +1397,19 @@ function Switch(props) {
1395
1397
  function Match(props) {
1396
1398
  return props;
1397
1399
  }
1400
+ let Errors;
1401
+ function resetErrorBoundaries() {
1402
+ Errors && [...Errors].forEach(fn => fn());
1403
+ }
1398
1404
  function ErrorBoundary(props) {
1399
1405
  let err = undefined;
1400
1406
  if (sharedConfig.context && sharedConfig.load) {
1401
1407
  err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
1402
1408
  }
1403
1409
  const [errored, setErrored] = createSignal(err);
1410
+ Errors || (Errors = new Set());
1411
+ Errors.add(setErrored);
1412
+ onCleanup(() => Errors.delete(setErrored));
1404
1413
  let e;
1405
1414
  return createMemo(() => {
1406
1415
  if ((e = errored()) != null) {
@@ -1504,20 +1513,18 @@ function Suspense(props) {
1504
1513
  const key = sharedConfig.context.id + sharedConfig.context.count;
1505
1514
  p = sharedConfig.load(key);
1506
1515
  if (p) {
1507
- if (typeof p !== "object" || !("then" in p)) error = p;else {
1508
- const [s, set] = createSignal(undefined, {
1509
- equals: false
1510
- });
1511
- flicker = s;
1512
- p.then(err => {
1513
- if (error = err) return set();
1514
- sharedConfig.gather(key);
1515
- setHydrateContext(ctx);
1516
- set();
1517
- setHydrateContext();
1518
- p = undefined;
1519
- });
1520
- }
1516
+ if (typeof p !== "object" || !("then" in p)) p = Promise.resolve(p);
1517
+ const [s, set] = createSignal(undefined, {
1518
+ equals: false
1519
+ });
1520
+ flicker = s;
1521
+ p.then(err => {
1522
+ if (error = err) return set();
1523
+ sharedConfig.gather(key);
1524
+ setHydrateContext(ctx);
1525
+ set();
1526
+ setHydrateContext();
1527
+ });
1521
1528
  }
1522
1529
  }
1523
1530
  const listContext = useContext(SuspenseListContext);
@@ -1543,6 +1550,7 @@ function Suspense(props) {
1543
1550
  dispose && dispose();
1544
1551
  if ((!inFallback || p !== undefined) && visibleContent) {
1545
1552
  store.resolved = true;
1553
+ ctx = p = undefined;
1546
1554
  resumeEffects(store.effects);
1547
1555
  return rendered;
1548
1556
  }
@@ -1577,4 +1585,4 @@ if (globalThis) {
1577
1585
  if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
1578
1586
  }
1579
1587
 
1580
- export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
1588
+ export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, resetErrorBoundaries, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
package/dist/server.cjs CHANGED
@@ -349,7 +349,7 @@ function createResource(fn, fetcher, options = {}) {
349
349
  if (sharedConfig.context.async) {
350
350
  resource = sharedConfig.context.resources[id] || (sharedConfig.context.resources[id] = {});
351
351
  if (resource.ref) {
352
- if (!resource.data && !resource.ref[0].loading) resource.ref[1].refetch();
352
+ if (!resource.data && !resource.ref[0].loading && !resource.ref[0].error) resource.ref[1].refetch();
353
353
  return resource.ref;
354
354
  }
355
355
  }
@@ -367,6 +367,7 @@ function createResource(fn, fetcher, options = {}) {
367
367
  return resolved ? sharedConfig.context.resources[id].data : value;
368
368
  };
369
369
  read.loading = false;
370
+ read.error = undefined;
370
371
  function load() {
371
372
  const ctx = sharedConfig.context;
372
373
  if (!ctx.async) return read.loading = !!(typeof fn === "function" ? fn() : fn);
@@ -395,7 +396,7 @@ function createResource(fn, fetcher, options = {}) {
395
396
  return res;
396
397
  }).catch(err => {
397
398
  read.loading = false;
398
- error = err;
399
+ read.error = error = err;
399
400
  p = null;
400
401
  notifySuspense(contexts);
401
402
  });
@@ -416,11 +417,12 @@ function lazy(fn) {
416
417
  const contexts = new Set();
417
418
  p.then(mod => resolved = mod.default);
418
419
  const wrap = props => {
419
- const id = sharedConfig.context.id + sharedConfig.context.count++;
420
+ const id = sharedConfig.context.id.slice(0, -1);
420
421
  if (resolved) return resolved(props);
421
422
  const ctx = useContext(SuspenseContext);
422
423
  const track = {
423
- loading: true
424
+ loading: true,
425
+ error: undefined
424
426
  };
425
427
  if (ctx) {
426
428
  ctx.resources.set(id, track);
package/dist/server.js CHANGED
@@ -345,7 +345,7 @@ function createResource(fn, fetcher, options = {}) {
345
345
  if (sharedConfig.context.async) {
346
346
  resource = sharedConfig.context.resources[id] || (sharedConfig.context.resources[id] = {});
347
347
  if (resource.ref) {
348
- if (!resource.data && !resource.ref[0].loading) resource.ref[1].refetch();
348
+ if (!resource.data && !resource.ref[0].loading && !resource.ref[0].error) resource.ref[1].refetch();
349
349
  return resource.ref;
350
350
  }
351
351
  }
@@ -363,6 +363,7 @@ function createResource(fn, fetcher, options = {}) {
363
363
  return resolved ? sharedConfig.context.resources[id].data : value;
364
364
  };
365
365
  read.loading = false;
366
+ read.error = undefined;
366
367
  function load() {
367
368
  const ctx = sharedConfig.context;
368
369
  if (!ctx.async) return read.loading = !!(typeof fn === "function" ? fn() : fn);
@@ -391,7 +392,7 @@ function createResource(fn, fetcher, options = {}) {
391
392
  return res;
392
393
  }).catch(err => {
393
394
  read.loading = false;
394
- error = err;
395
+ read.error = error = err;
395
396
  p = null;
396
397
  notifySuspense(contexts);
397
398
  });
@@ -412,11 +413,12 @@ function lazy(fn) {
412
413
  const contexts = new Set();
413
414
  p.then(mod => resolved = mod.default);
414
415
  const wrap = props => {
415
- const id = sharedConfig.context.id + sharedConfig.context.count++;
416
+ const id = sharedConfig.context.id.slice(0, -1);
416
417
  if (resolved) return resolved(props);
417
418
  const ctx = useContext(SuspenseContext);
418
419
  const track = {
419
- loading: true
420
+ loading: true,
421
+ error: undefined
420
422
  };
421
423
  if (ctx) {
422
424
  ctx.resources.set(id, track);
package/dist/solid.cjs CHANGED
@@ -246,7 +246,7 @@ function createResource(source, fetcher, options) {
246
246
  fetcher = source;
247
247
  source = true;
248
248
  }
249
- options ||= {};
249
+ options || (options = {});
250
250
  if (options.globalRefetch !== false) {
251
251
  Resources || (Resources = new Set());
252
252
  Resources.add(load);
@@ -503,7 +503,7 @@ function startTransition(fn) {
503
503
  queue: new Set(),
504
504
  running: true
505
505
  });
506
- t.done ||= new Promise(res => t.resolve = res);
506
+ t.done || (t.done = new Promise(res => t.resolve = res));
507
507
  t.running = true;
508
508
  }
509
509
  batch(fn);
@@ -1232,7 +1232,6 @@ function lazy(fn) {
1232
1232
  const wrap = props => {
1233
1233
  const ctx = sharedConfig.context;
1234
1234
  if (ctx) {
1235
- ctx.count++;
1236
1235
  const [s, set] = createSignal();
1237
1236
  (p || (p = fn())).then(mod => {
1238
1237
  setHydrateContext(ctx);
@@ -1318,12 +1317,19 @@ function Switch(props) {
1318
1317
  function Match(props) {
1319
1318
  return props;
1320
1319
  }
1320
+ let Errors;
1321
+ function resetErrorBoundaries() {
1322
+ Errors && [...Errors].forEach(fn => fn());
1323
+ }
1321
1324
  function ErrorBoundary(props) {
1322
1325
  let err = undefined;
1323
1326
  if (sharedConfig.context && sharedConfig.load) {
1324
1327
  err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
1325
1328
  }
1326
1329
  const [errored, setErrored] = createSignal(err);
1330
+ Errors || (Errors = new Set());
1331
+ Errors.add(setErrored);
1332
+ onCleanup(() => Errors.delete(setErrored));
1327
1333
  let e;
1328
1334
  return createMemo(() => {
1329
1335
  if ((e = errored()) != null) {
@@ -1427,20 +1433,18 @@ function Suspense(props) {
1427
1433
  const key = sharedConfig.context.id + sharedConfig.context.count;
1428
1434
  p = sharedConfig.load(key);
1429
1435
  if (p) {
1430
- if (typeof p !== "object" || !("then" in p)) error = p;else {
1431
- const [s, set] = createSignal(undefined, {
1432
- equals: false
1433
- });
1434
- flicker = s;
1435
- p.then(err => {
1436
- if (error = err) return set();
1437
- sharedConfig.gather(key);
1438
- setHydrateContext(ctx);
1439
- set();
1440
- setHydrateContext();
1441
- p = undefined;
1442
- });
1443
- }
1436
+ if (typeof p !== "object" || !("then" in p)) p = Promise.resolve(p);
1437
+ const [s, set] = createSignal(undefined, {
1438
+ equals: false
1439
+ });
1440
+ flicker = s;
1441
+ p.then(err => {
1442
+ if (error = err) return set();
1443
+ sharedConfig.gather(key);
1444
+ setHydrateContext(ctx);
1445
+ set();
1446
+ setHydrateContext();
1447
+ });
1444
1448
  }
1445
1449
  }
1446
1450
  const listContext = useContext(SuspenseListContext);
@@ -1466,6 +1470,7 @@ function Suspense(props) {
1466
1470
  dispose && dispose();
1467
1471
  if ((!inFallback || p !== undefined) && visibleContent) {
1468
1472
  store.resolved = true;
1473
+ ctx = p = undefined;
1469
1474
  resumeEffects(store.effects);
1470
1475
  return rendered;
1471
1476
  }
@@ -1534,6 +1539,7 @@ exports.onError = onError;
1534
1539
  exports.onMount = onMount;
1535
1540
  exports.refetchResources = refetchResources;
1536
1541
  exports.requestCallback = requestCallback;
1542
+ exports.resetErrorBoundaries = resetErrorBoundaries;
1537
1543
  exports.runWithOwner = runWithOwner;
1538
1544
  exports.sharedConfig = sharedConfig;
1539
1545
  exports.splitProps = splitProps;
package/dist/solid.js CHANGED
@@ -242,7 +242,7 @@ function createResource(source, fetcher, options) {
242
242
  fetcher = source;
243
243
  source = true;
244
244
  }
245
- options ||= {};
245
+ options || (options = {});
246
246
  if (options.globalRefetch !== false) {
247
247
  Resources || (Resources = new Set());
248
248
  Resources.add(load);
@@ -499,7 +499,7 @@ function startTransition(fn) {
499
499
  queue: new Set(),
500
500
  running: true
501
501
  });
502
- t.done ||= new Promise(res => t.resolve = res);
502
+ t.done || (t.done = new Promise(res => t.resolve = res));
503
503
  t.running = true;
504
504
  }
505
505
  batch(fn);
@@ -1228,7 +1228,6 @@ function lazy(fn) {
1228
1228
  const wrap = props => {
1229
1229
  const ctx = sharedConfig.context;
1230
1230
  if (ctx) {
1231
- ctx.count++;
1232
1231
  const [s, set] = createSignal();
1233
1232
  (p || (p = fn())).then(mod => {
1234
1233
  setHydrateContext(ctx);
@@ -1314,12 +1313,19 @@ function Switch(props) {
1314
1313
  function Match(props) {
1315
1314
  return props;
1316
1315
  }
1316
+ let Errors;
1317
+ function resetErrorBoundaries() {
1318
+ Errors && [...Errors].forEach(fn => fn());
1319
+ }
1317
1320
  function ErrorBoundary(props) {
1318
1321
  let err = undefined;
1319
1322
  if (sharedConfig.context && sharedConfig.load) {
1320
1323
  err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
1321
1324
  }
1322
1325
  const [errored, setErrored] = createSignal(err);
1326
+ Errors || (Errors = new Set());
1327
+ Errors.add(setErrored);
1328
+ onCleanup(() => Errors.delete(setErrored));
1323
1329
  let e;
1324
1330
  return createMemo(() => {
1325
1331
  if ((e = errored()) != null) {
@@ -1423,20 +1429,18 @@ function Suspense(props) {
1423
1429
  const key = sharedConfig.context.id + sharedConfig.context.count;
1424
1430
  p = sharedConfig.load(key);
1425
1431
  if (p) {
1426
- if (typeof p !== "object" || !("then" in p)) error = p;else {
1427
- const [s, set] = createSignal(undefined, {
1428
- equals: false
1429
- });
1430
- flicker = s;
1431
- p.then(err => {
1432
- if (error = err) return set();
1433
- sharedConfig.gather(key);
1434
- setHydrateContext(ctx);
1435
- set();
1436
- setHydrateContext();
1437
- p = undefined;
1438
- });
1439
- }
1432
+ if (typeof p !== "object" || !("then" in p)) p = Promise.resolve(p);
1433
+ const [s, set] = createSignal(undefined, {
1434
+ equals: false
1435
+ });
1436
+ flicker = s;
1437
+ p.then(err => {
1438
+ if (error = err) return set();
1439
+ sharedConfig.gather(key);
1440
+ setHydrateContext(ctx);
1441
+ set();
1442
+ setHydrateContext();
1443
+ });
1440
1444
  }
1441
1445
  }
1442
1446
  const listContext = useContext(SuspenseListContext);
@@ -1462,6 +1466,7 @@ function Suspense(props) {
1462
1466
  dispose && dispose();
1463
1467
  if ((!inFallback || p !== undefined) && visibleContent) {
1464
1468
  store.resolved = true;
1469
+ ctx = p = undefined;
1465
1470
  resumeEffects(store.effects);
1466
1471
  return rendered;
1467
1472
  }
@@ -1485,4 +1490,4 @@ function Suspense(props) {
1485
1490
 
1486
1491
  let DEV;
1487
1492
 
1488
- export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
1493
+ export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, resetErrorBoundaries, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solid-js",
3
3
  "description": "A declarative JavaScript library for building user interfaces.",
4
- "version": "1.3.0",
4
+ "version": "1.3.4",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -124,9 +124,9 @@
124
124
  "build": "npm-run-all -cnl build:*",
125
125
  "build:link": "symlink-dir . node_modules/solid-js",
126
126
  "build:js": "ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./src/jsx.d.ts && rollup -c",
127
- "build:types": "tsc",
128
- "build:types-store": "tsc --project ./store/tsconfig.json && tsconfig-replace-paths --project ./store/tsconfig.types.json",
129
- "build:types-web": "tsc --project ./web/tsconfig.json && tsconfig-replace-paths --project ./web/tsconfig.types.json",
127
+ "build:types": "tsc --project ./tsconfig.build.json",
128
+ "build:types-store": "tsc --project ./store/tsconfig.build.json && tsconfig-replace-paths --project ./store/tsconfig.types.json",
129
+ "build:types-web": "tsc --project ./web/tsconfig.build.json && tsconfig-replace-paths --project ./web/tsconfig.types.json",
130
130
  "build:types-html": "tsc --project ./html/tsconfig.json",
131
131
  "build:types-h": "tsc --project ./h/tsconfig.json",
132
132
  "build:types-universal": "tsc --project ./universal/tsconfig.json",
@@ -144,5 +144,5 @@
144
144
  "compiler",
145
145
  "performance"
146
146
  ],
147
- "gitHead": "9525e859cc86e444e2c8f043af218043e719b964"
147
+ "gitHead": "4c08b520a8cb3ed03886fba160154a679dfab8a6"
148
148
  }
@@ -103,7 +103,7 @@ const proxyTraps$1 = {
103
103
  node = nodes[property] || (nodes[property] = createDataNode());
104
104
  node();
105
105
  }
106
- return wrappable ? wrap$1(value, target[$NAME] && `${target[$NAME]}:${property}`) : value;
106
+ return wrappable ? wrap$1(value, target[$NAME] && `${target[$NAME]}:${property.toString()}`) : value;
107
107
  },
108
108
  set() {
109
109
  console.warn("Cannot mutate a Store directly");
@@ -344,8 +344,7 @@ function reconcile(value, options = {}) {
344
344
  key = "id"
345
345
  } = options,
346
346
  v = unwrap(value);
347
- return s => {
348
- const state = s;
347
+ return state => {
349
348
  if (!isWrappable(state) || !isWrappable(v)) return v;
350
349
  applyState(v, {
351
350
  state
@@ -369,8 +368,7 @@ const setterTraps = {
369
368
  }
370
369
  };
371
370
  function produce(fn) {
372
- return s => {
373
- const state = s;
371
+ return state => {
374
372
  if (isWrappable(state)) fn(new Proxy(state, setterTraps));
375
373
  return state;
376
374
  };
package/store/dist/dev.js CHANGED
@@ -99,7 +99,7 @@ const proxyTraps$1 = {
99
99
  node = nodes[property] || (nodes[property] = createDataNode());
100
100
  node();
101
101
  }
102
- return wrappable ? wrap$1(value, target[$NAME] && `${target[$NAME]}:${property}`) : value;
102
+ return wrappable ? wrap$1(value, target[$NAME] && `${target[$NAME]}:${property.toString()}`) : value;
103
103
  },
104
104
  set() {
105
105
  console.warn("Cannot mutate a Store directly");
@@ -340,8 +340,7 @@ function reconcile(value, options = {}) {
340
340
  key = "id"
341
341
  } = options,
342
342
  v = unwrap(value);
343
- return s => {
344
- const state = s;
343
+ return state => {
345
344
  if (!isWrappable(state) || !isWrappable(v)) return v;
346
345
  applyState(v, {
347
346
  state
@@ -365,8 +364,7 @@ const setterTraps = {
365
364
  }
366
365
  };
367
366
  function produce(fn) {
368
- return s => {
369
- const state = s;
367
+ return state => {
370
368
  if (isWrappable(state)) fn(new Proxy(state, setterTraps));
371
369
  return state;
372
370
  };
@@ -324,8 +324,7 @@ function reconcile(value, options = {}) {
324
324
  key = "id"
325
325
  } = options,
326
326
  v = unwrap(value);
327
- return s => {
328
- const state = s;
327
+ return state => {
329
328
  if (!isWrappable(state) || !isWrappable(v)) return v;
330
329
  applyState(v, {
331
330
  state
@@ -349,8 +348,7 @@ const setterTraps = {
349
348
  }
350
349
  };
351
350
  function produce(fn) {
352
- return s => {
353
- const state = s;
351
+ return state => {
354
352
  if (isWrappable(state)) fn(new Proxy(state, setterTraps));
355
353
  return state;
356
354
  };
@@ -320,8 +320,7 @@ function reconcile(value, options = {}) {
320
320
  key = "id"
321
321
  } = options,
322
322
  v = unwrap(value);
323
- return s => {
324
- const state = s;
323
+ return state => {
325
324
  if (!isWrappable(state) || !isWrappable(v)) return v;
326
325
  applyState(v, {
327
326
  state
@@ -345,8 +344,7 @@ const setterTraps = {
345
344
  }
346
345
  };
347
346
  function produce(fn) {
348
- return s => {
349
- const state = s;
347
+ return state => {
350
348
  if (isWrappable(state)) fn(new Proxy(state, setterTraps));
351
349
  return state;
352
350
  };
@@ -9,5 +9,27 @@
9
9
  "unpkg": "./dist/store.cjs",
10
10
  "types": "./types/index.d.ts",
11
11
  "type": "module",
12
- "sideEffects": false
12
+ "sideEffects": false,
13
+ "exports": {
14
+ ".": {
15
+ "browser": {
16
+ "development": {
17
+ "import": "./dist/dev.js",
18
+ "require": "./dist/dev.cjs"
19
+ },
20
+ "import": "./dist/store.js",
21
+ "require": "./dist/store.cjs"
22
+ },
23
+ "node": {
24
+ "import": "./dist/server.js",
25
+ "require": "./dist/server.cjs"
26
+ },
27
+ "development": {
28
+ "import": "./dist/dev.js",
29
+ "require": "./dist/dev.cjs"
30
+ },
31
+ "import": "./dist/store.js",
32
+ "require": "./dist/store.cjs"
33
+ }
34
+ }
13
35
  }
@@ -1,4 +1,4 @@
1
1
  export { createStore, unwrap, $RAW } from "./store";
2
- export type { Store, SetStoreFunction, NotWrappable, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, Part, Next, Readonly, DeepReadonly } from "./store";
2
+ export type { Store, SetStoreFunction, NotWrappable, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, Part, Next, WrappableNext, DeepReadonly } from "./store";
3
3
  export * from "./mutable";
4
4
  export * from "./modifiers";
@@ -1,7 +1,7 @@
1
- import { Store, NotWrappable, DeepReadonly } from "./store";
1
+ import { Store } from "./store";
2
2
  export declare type ReconcileOptions = {
3
3
  key?: string | null;
4
4
  merge?: boolean;
5
5
  };
6
- export declare function reconcile<T>(value: T | Store<T>, options?: ReconcileOptions): (state: T extends NotWrappable ? T : Store<DeepReadonly<T>>) => T extends NotWrappable ? T : Store<T>;
7
- export declare function produce<T>(fn: (state: T) => void): (state: T extends NotWrappable ? T : Store<DeepReadonly<T>>) => T extends NotWrappable ? T : Store<T>;
6
+ export declare function reconcile<T>(value: T, options?: ReconcileOptions): (state: unknown) => Store<T>;
7
+ export declare function produce<T>(fn: (state: T) => void): (state: Store<T>) => Store<T>;
@@ -1,4 +1,4 @@
1
- import { StoreNode, Store } from "./store";
2
- export declare function createMutable<T extends StoreNode>(state: T | Store<T>, options?: {
1
+ import { StoreNode } from "./store";
2
+ export declare function createMutable<T extends StoreNode>(state: T, options?: {
3
3
  name?: string;
4
- }): Store<T>;
4
+ }): T;