@symbo.ls/utils 3.14.691 → 3.14.702

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @symbo.ls/utils
2
2
 
3
+ ## 3.14.702
4
+
5
+ ### Patch Changes
6
+
7
+ - Auto-generated cross-repo patch release.
8
+
3
9
  ## 3.14.691
4
10
 
5
11
  ### Patch Changes
package/dist/cjs/env.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var n=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var N=(t,o)=>{for(var c in o)n(t,c,{get:o[c],enumerable:!0})},a=(t,o,c,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of g(o))!l.call(t,e)&&e!==c&&n(t,e,{get:()=>o[e],enumerable:!(i=x(o,e))||i.enumerable});return t};var d=t=>a(n({},"__esModule",{value:!0}),t);var P={};N(P,{ENV:()=>E,NODE_ENV:()=>s,getNev:()=>v,isDevelopment:()=>m,isLocal:()=>V,isNotProduction:()=>O,isProduction:()=>r,isStaging:()=>D,isTest:()=>p,isTesting:()=>u});module.exports=d(P);// @preserve-env
2
- const s="production",E=s,r=(t=s)=>t==="production",p=(t=s)=>t==="testing"||t==="test",u=p,D=(t=s)=>t==="staging",V=(t=s)=>t==="local",m=(t=s)=>t==="development"||t==="dev"||t==="local",v=(t,o=s)=>o[t],O=(t=s)=>!r(t);
1
+ "use strict";var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var d=(t,o)=>{for(var n in o)c(t,n,{get:o[n],enumerable:!0})},x=(t,o,n,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of a(o))!l.call(t,s)&&s!==n&&c(t,s,{get:()=>o[s],enumerable:!(i=u(o,s))||i.enumerable});return t};var f=t=>x(c({},"__esModule",{value:!0}),t);var y={};d(y,{ENV:()=>N,NODE_ENV:()=>e,getNev:()=>D,isDevelopment:()=>E,isLocal:()=>m,isLoudDevRuntime:()=>v,isNotProduction:()=>V,isProduction:()=>p,isStaging:()=>h,isTest:()=>r,isTesting:()=>g});module.exports=f(y);// @preserve-env
2
+ const e="production",N=e,p=(t=e)=>t==="production",r=(t=e)=>t==="testing"||t==="test",g=r,h=(t=e)=>t==="staging",m=(t=e)=>t==="local",E=(t=e)=>t==="development"||t==="dev"||t==="local",D=(t,o=e)=>o[t],V=(t=e)=>!p(t),v=t=>{const o=t&&"env"in t?t.env:typeof process<"u"&&process.env?"production":void 0;if(o&&o!=="production")return!0;const n=t&&"hostname"in t?t.hostname:typeof location<"u"?location.hostname:void 0;return typeof n=="string"&&n?n==="localhost"||n==="127.0.0.1"||n.endsWith(".localhost"):!1};
package/dist/esm/env.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @preserve-env
2
- const o="production",n=o,e=(t=o)=>t==="production",c=(t=o)=>t==="testing"||t==="test",i=c,r=(t=o)=>t==="staging",p=(t=o)=>t==="local",x=(t=o)=>t==="development"||t==="dev"||t==="local",g=(t,s=o)=>s[t],l=(t=o)=>!e(t);export{n as ENV,o as NODE_ENV,g as getNev,x as isDevelopment,p as isLocal,l as isNotProduction,e as isProduction,r as isStaging,c as isTest,i as isTesting};
2
+ const o="production",i=o,s=(t=o)=>t==="production",c=(t=o)=>t==="testing"||t==="test",p=c,r=(t=o)=>t==="staging",u=(t=o)=>t==="local",a=(t=o)=>t==="development"||t==="dev"||t==="local",l=(t,e=o)=>e[t],d=(t=o)=>!s(t),x=t=>{const e=t&&"env"in t?t.env:typeof process<"u"&&process.env?"production":void 0;if(e&&e!=="production")return!0;const n=t&&"hostname"in t?t.hostname:typeof location<"u"?location.hostname:void 0;return typeof n=="string"&&n?n==="localhost"||n==="127.0.0.1"||n.endsWith(".localhost"):!1};export{i as ENV,o as NODE_ENV,l as getNev,a as isDevelopment,u as isLocal,x as isLoudDevRuntime,d as isNotProduction,s as isProduction,r as isStaging,c as isTest,p as isTesting};
package/env.js CHANGED
@@ -13,3 +13,59 @@ export const isDevelopment = (env = NODE_ENV) =>
13
13
  env === 'development' || env === 'dev' || env === 'local'
14
14
  export const getNev = (key, env = NODE_ENV) => env[key]
15
15
  export const isNotProduction = (env = NODE_ENV) => !isProduction(env)
16
+
17
+ /**
18
+ * FRAMEWORK-6: shared gate for dev-only loud-failure diagnostics, usable by
19
+ * any package (originally lived only in `@symbo.ls/element/src/devRuntime.js`
20
+ * — moved here so `@symbo.ls/scratch`, which `element` itself depends on,
21
+ * can gate its own loud-dev warnings without a reverse dependency).
22
+ *
23
+ * Why a hybrid gate instead of `process.env.NODE_ENV !== 'production'` alone:
24
+ * the dist build (`esbuild --minify`, default platform=browser) auto-defines
25
+ * `process.env.NODE_ENV` to `"production"` and dead-code-eliminates any
26
+ * branch gated on it — verified against `dist/esm/src/create.js`, where a
27
+ * NODE_ENV-only-gated warning was compiled out entirely. Consumers resolve
28
+ * `dist/esm`, not `src` (see the workspace bundle), so a NODE_ENV-only gate
29
+ * can never fire in a real dev browser session.
30
+ *
31
+ * Why not hostname alone: node/test consumers (vitest, SSR) resolve source,
32
+ * where NODE_ENV is live and `location` may not exist.
33
+ *
34
+ * So:
35
+ * - build-time leg — `process.env.NODE_ENV` — live for source/test
36
+ * consumers; folds to `false` at dist build time (esbuild substitutes the
37
+ * literal, leaving the guarded `process` reference unreachable).
38
+ * - runtime leg — `location.hostname` is `localhost`, `127.0.0.1`, or any
39
+ * `*.localhost` — survives the dist build, so dev servers
40
+ * (`workspace.localhost:1355` etc.) still get loud failures.
41
+ *
42
+ * A visitor on a production domain (`my.symbols.app`, `*.symbo.ls`, custom
43
+ * domains) matches neither leg and never sees console noise from this.
44
+ *
45
+ * @param {object} [overrides] test-only injection: `{ env, hostname }`
46
+ * @returns {boolean}
47
+ */
48
+ export const isLoudDevRuntime = (overrides) => {
49
+ const env =
50
+ overrides && 'env' in overrides
51
+ ? overrides.env
52
+ : typeof process !== 'undefined' && process.env
53
+ ? process.env.NODE_ENV
54
+ : undefined
55
+ if (env && env !== 'production') return true
56
+
57
+ const hostname =
58
+ overrides && 'hostname' in overrides
59
+ ? overrides.hostname
60
+ : typeof location !== 'undefined'
61
+ ? location.hostname
62
+ : undefined
63
+ if (typeof hostname === 'string' && hostname) {
64
+ return (
65
+ hostname === 'localhost' ||
66
+ hostname === '127.0.0.1' ||
67
+ hostname.endsWith('.localhost')
68
+ )
69
+ }
70
+ return false
71
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/utils",
3
- "version": "3.14.691",
3
+ "version": "3.14.702",
4
4
  "license": "CC-BY-NC-4.0",
5
5
  "type": "module",
6
6
  "module": "./dist/esm/index.js",