opshot 0.6.0 → 0.6.1

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/README.md CHANGED
@@ -130,7 +130,7 @@ It can't track:
130
130
  - Own function properties on class instances
131
131
  - Non-writable properties that hold an object
132
132
 
133
- By default opshot throws when it meets one of these, naming the value that caused it. Passing `strict: false` turns off those errors but may cause unpredictable behaviour.
133
+ `strict: true` throws when opshot meets one of these, naming the value that caused it; `strict: false` stores the value untracked. It defaults to true in development and false in production.
134
134
 
135
135
  ## Tracked collections
136
136
 
@@ -639,7 +639,7 @@ function createMutableState(properties, options) {
639
639
  if (Object.isFrozen(incoming)) return properties;
640
640
  const root = rawOf(incoming);
641
641
  if (handleOf(incoming) !== void 0) return proxyOf(incoming);
642
- const strict = options?.strict !== false;
642
+ const strict = options?.strict ?? process.env.NODE_ENV !== "production";
643
643
  const exempt = !strict || isUnsafeMarked(root);
644
644
  const handle = {
645
645
  root,
@@ -17,7 +17,7 @@ interface MutableStateOptions {
17
17
  */
18
18
  readonly emitOn?: EmissionScheduler;
19
19
  /**
20
- * When true, throws at a dangerous edge, at the cause. Defaults to true.
20
+ * When true, throws at a dangerous edge, at the cause. Defaults to `process.env.NODE_ENV !== "production"`, so development throws and production tracks what it can.
21
21
  */
22
22
  readonly strict?: boolean;
23
23
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { E as EmissionScheduler, M as MutableStateOptions, c as createMutableState } from './createMutableState-DJ9dmpR-.js';
1
+ export { E as EmissionScheduler, M as MutableStateOptions, c as createMutableState } from './createMutableState-320Vm2AI.js';
2
2
 
3
3
  /**
4
4
  * Returns a stable identity key for a value.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { addressOf, flushWindow, requireHandle, isSameIdentity } from './chunk-4JZIOHSP.js';
2
- export { batch, createMutableState, identify, ignore, isSameIdentity, isState, subscribe, unsafeTrack } from './chunk-4JZIOHSP.js';
1
+ import { addressOf, flushWindow, requireHandle, isSameIdentity } from './chunk-DOMSA2X7.js';
2
+ export { batch, createMutableState, identify, ignore, isSameIdentity, isState, subscribe, unsafeTrack } from './chunk-DOMSA2X7.js';
3
3
 
4
4
  // src/tracked/facadeGuard.ts
5
5
  var assertMutableFacade = (facade, mutationKey) => {
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ComponentType, FC } from 'react';
2
- import { M as MutableStateOptions } from './createMutableState-DJ9dmpR-.js';
2
+ import { M as MutableStateOptions } from './createMutableState-320Vm2AI.js';
3
3
 
4
4
  /**
5
5
  * Wraps a component so it re-renders only when fields it read change.
package/dist/react.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createMutableState, handlesOf, subscribe, proxyOf, isState, isSameIdentity, rawOf, addressOf, versionOf, isDangerousKind, classifyValue, peelReadProxy, recordOf, registerReadProxyTarget, walkDataEntries, isTrackedEntry, isObjectLike } from './chunk-4JZIOHSP.js';
1
+ import { createMutableState, handlesOf, subscribe, proxyOf, isState, isSameIdentity, rawOf, addressOf, versionOf, isDangerousKind, classifyValue, peelReadProxy, recordOf, registerReadProxyTarget, walkDataEntries, isTrackedEntry, isObjectLike } from './chunk-DOMSA2X7.js';
2
2
  import * as React from 'react';
3
3
  import { memo, useState, useReducer, useRef, useEffect, createElement, useLayoutEffect } from 'react';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opshot",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Plain-object state for React: mutate it directly, re-render only the components that read what changed, and track every change operation",
5
5
  "type": "module",
6
6
  "exports": {