@json-render/devtools 0.21.1 → 0.21.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/README.md CHANGED
@@ -11,6 +11,10 @@ Most users never import from this package directly. Pick the adapter that matche
11
11
 
12
12
  See the [devtools guide](https://json-render.dev/docs/devtools) for the full walkthrough.
13
13
 
14
+ ## Production builds
15
+
16
+ Framework adapters render no devtools UI when the bundler replaces `process.env.NODE_ENV` with `"production"`, including in browsers without a `process` global. Unbundled environments without `process.env` fall back to development behavior.
17
+
14
18
  ## Installation
15
19
 
16
20
  ```bash
package/dist/index.d.mts CHANGED
@@ -125,9 +125,9 @@ declare function createEventStore(options?: EventStoreOptions): EventStore;
125
125
  * returns true, so dropping `<JsonRenderDevtools />` into an app costs
126
126
  * nothing in production builds.
127
127
  *
128
- * Tree-shaken bundlers will fold constant `process.env.NODE_ENV` checks.
129
- * Consumers that run in browsers without `process` also work because the
130
- * typeof check guards the access.
128
+ * Keep `process.env.NODE_ENV` directly replaceable by bundlers, even when
129
+ * the browser has no `process` global. Unbundled environments without
130
+ * `process.env` fall back to development behavior.
131
131
  */
132
132
  declare function isProduction(): boolean;
133
133
 
package/dist/index.d.ts CHANGED
@@ -125,9 +125,9 @@ declare function createEventStore(options?: EventStoreOptions): EventStore;
125
125
  * returns true, so dropping `<JsonRenderDevtools />` into an app costs
126
126
  * nothing in production builds.
127
127
  *
128
- * Tree-shaken bundlers will fold constant `process.env.NODE_ENV` checks.
129
- * Consumers that run in browsers without `process` also work because the
130
- * typeof check guards the access.
128
+ * Keep `process.env.NODE_ENV` directly replaceable by bundlers, even when
129
+ * the browser has no `process` global. Unbundled environments without
130
+ * `process.env` fall back to development behavior.
131
131
  */
132
132
  declare function isProduction(): boolean;
133
133
 
package/dist/index.js CHANGED
@@ -97,10 +97,11 @@ function createEventStore(options = {}) {
97
97
 
98
98
  // src/prod-guard.ts
99
99
  function isProduction() {
100
- if (typeof process !== "undefined" && process.env) {
100
+ try {
101
101
  return process.env.NODE_ENV === "production";
102
+ } catch {
103
+ return false;
102
104
  }
103
- return false;
104
105
  }
105
106
 
106
107
  // src/panel/dom.ts