@symbo.ls/utils 3.14.685 → 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,17 @@
1
1
  # @symbo.ls/utils
2
2
 
3
+ ## 3.14.702
4
+
5
+ ### Patch Changes
6
+
7
+ - Auto-generated cross-repo patch release.
8
+
9
+ ## 3.14.691
10
+
11
+ ### Patch Changes
12
+
13
+ - Auto-generated cross-repo patch release.
14
+
3
15
  ## 3.14.685
4
16
 
5
17
  ### 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};
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var j=(n,e)=>{for(var i in e)u(n,i,{get:e[i],enumerable:!0})},E=(n,e,i,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of R(e))!U.call(n,r)&&r!==i&&u(n,r,{get:()=>e[r],enumerable:!(t=g(e,r))||t.enumerable});return n};var S=n=>E(u({},"__esModule",{value:!0}),n);var K={};j(K,{deepDefaults:()=>f,fetchLibraryData:()=>k,isWrappedLibrary:()=>p,mergeSharedLibraries:()=>T,normalizeIgnoreList:()=>w,normalizeLibraryKey:()=>l,resolveSharedLibraries:()=>G,sharedLibrary:()=>P});module.exports=S(K);var s=require("./types.js");const m="system",_="https://smbls-kv.nika-980.workers.dev",I="https://api.symbols.app";function l(n){const e=String(n||"").trim();if(!e)return{owner:m,key:"",full:""};let i=null,t=e;if(e.includes("/")){const o=e.indexOf("/");i=e.slice(0,o),t=e.slice(o+1)}t=t.replace(/\.symbo\.ls$/iu,""),i||(i=m);const r=t?`${i}/${t}`:"";return{owner:i,key:t,full:r}}const f=(n,e,i,t)=>{for(const r in e){const o=t?`${t}/${r}`:r;i&&i.has(o)||(r in n?(0,s.isObject)(n[r])&&(0,s.isObject)(e[r])&&f(n[r],e[r],i,o):n[r]=e[r])}},O=new Set,B=n=>n.replace(/\.js$/iu,""),w=n=>{const e=new Set;if(!Array.isArray(n))return e;for(const i of n){if(!(0,s.isString)(i))continue;const t=i.split("/").map(r=>B(r.trim())).filter(Boolean).join("/");t&&e.add(t)}return e},P=(n,e={})=>({library:n,ignoreList:Array.isArray(e.ignoreList)?e.ignoreList:[]}),p=n=>(0,s.isObject)(n)&&Array.isArray(n.ignoreList)&&("library"in n||"key"in n||"name"in n),x=n=>n.library!==void 0?n.library:n.key??n.name,C=(n,e,i)=>{const t=e.sharePages===!1;for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&r!=="sharePages"&&!(r==="pages"&&t)&&!i.has(r))if((0,s.isObject)(e[r])&&(0,s.isObject)(n[r]))if(r==="designSystem")f(n[r],e[r],i,r);else for(const o in e[r])i.has(`${r}/${o}`)||o in n[r]||(n[r][o]=e[r][o]);else r in n||(n[r]=e[r])},T=(n,e)=>{if(!(!e||!e.length))for(let i=0;i<e.length;i++){let t=e[i],r=O;p(t)&&(r=w(t.ignoreList),t=t.library),(0,s.isObject)(t)&&C(n,t,r)}};async function k(n,e={}){if((e.provider||"kv")==="api")return h(n,e);const t=await F(n,e);return t||h(n,e)}async function F(n,e={}){const i=e.kvBaseUrl||_,t=e.env||"production",r=`${i}/kv/${encodeURIComponent(n)}?env=${t}`;try{const o=await fetch(r,{method:"GET"});return o.ok&&(await o.json())?.value||null}catch{return null}}async function h(n,e={}){const i=e.apiBaseUrl||I,{key:t}=l(n);try{const r=`${i}/core/projects/libraries/available?search=${encodeURIComponent(t)}&limit=10`,o=await fetch(r,{method:"GET"});if(!o.ok)return null;const a=await o.json(),c=(a?.items||a?.data||(Array.isArray(a)?a:[])).find($=>{const{key:A}=l($?.key);return A.toLowerCase()===t.toLowerCase()});if(!c?.id&&!c?._id)return null;const v=c.id||c._id,L=`${i}/core/projects/${encodeURIComponent(v)}/data?branch=main`,y=await fetch(L,{method:"GET"});if(!y.ok)return null;const d=await y.json();return d?.data||d||null}catch{return null}}async function b(n,e={}){if((0,s.isObject)(n))return n;if((0,s.isString)(n)){const{full:i}=l(n);if(!i)return null;try{const t=await k(i,e);return t||console.warn(`[smbls] Shared library "${i}" not found`),t}catch(t){return console.warn(`[smbls] Failed to fetch shared library "${i}":`,t.message),null}}return null}async function G(n,e={}){return!n||!n.length?[]:(await Promise.all(n.map(async t=>{if(p(t)){const r=await b(x(t),e);return r?{library:r,ignoreList:t.ignoreList}:null}return b(t,e)}))).filter(Boolean)}
1
+ "use strict";var u=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var j=(n,e)=>{for(var t in e)u(n,t,{get:e[t],enumerable:!0})},I=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of R(e))!U.call(n,i)&&i!==t&&u(n,i,{get:()=>e[i],enumerable:!(r=A(e,i))||r.enumerable});return n};var S=n=>I(u({},"__esModule",{value:!0}),n);var K={};j(K,{deepDefaults:()=>f,fetchLibraryData:()=>k,isWrappedLibrary:()=>p,mergeSharedLibraries:()=>T,normalizeIgnoreList:()=>d,normalizeLibraryKey:()=>c,resolveSharedLibraries:()=>G,sharedLibrary:()=>P});module.exports=S(K);var s=require("./types.js");const h="system",E="https://smbls-kv.nika-980.workers.dev",_="https://api.symbols.app";function c(n){const e=String(n||"").trim();if(!e)return{owner:h,key:"",full:""};let t=null,r=e;if(e.includes("/")){const o=e.indexOf("/");t=e.slice(0,o),r=e.slice(o+1)}r=r.replace(/\.symbo\.ls$/iu,""),t||(t=h);const i=r?`${t}/${r}`:"";return{owner:t,key:r,full:i}}const f=(n,e,t,r)=>{for(const i in e){const o=r?`${r}/${i}`:i;t&&t.has(o)||(i in n?(0,s.isObject)(n[i])&&(0,s.isObject)(e[i])&&f(n[i],e[i],t,o):n[i]=e[i])}},O=new Set,B=n=>n.replace(/\.js$/iu,""),d=n=>{const e=new Set;if(!Array.isArray(n))return e;for(const t of n){if(!(0,s.isString)(t))continue;const r=t.split("/").map(i=>B(i.trim())).filter(Boolean).join("/");r&&e.add(r)}return e},P=(n,e={})=>({library:n,ignoreList:Array.isArray(e.ignoreList)?e.ignoreList:[]}),p=n=>(0,s.isObject)(n)&&Array.isArray(n.ignoreList)&&("library"in n||"key"in n||"name"in n),x=n=>n.library!==void 0?n.library:n.key??n.name,C=(n,e,t)=>{const r=d(e.sharedLibIgnore);e.sharePages===!1&&r.add("pages");const i=r.size?new Set([...t,...r]):t;for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o)&&!(o==="sharePages"||o==="sharedLibIgnore")&&!i.has(o))if((0,s.isObject)(e[o])&&(0,s.isObject)(n[o]))if(o==="designSystem")f(n[o],e[o],i,o);else for(const a in e[o])i.has(`${o}/${a}`)||a in n[o]||(n[o][a]=e[o][a]);else o in n||(n[o]=e[o])},T=(n,e)=>{if(!(!e||!e.length))for(let t=0;t<e.length;t++){let r=e[t],i=O;p(r)&&(i=d(r.ignoreList),r=r.library),(0,s.isObject)(r)&&C(n,r,i)}};async function k(n,e={}){if((e.provider||"kv")==="api")return b(n,e);const r=await F(n,e);return r||b(n,e)}async function F(n,e={}){const t=e.kvBaseUrl||E,r=e.env||"production",i=`${t}/kv/${encodeURIComponent(n)}?env=${r}`;try{const o=await fetch(i,{method:"GET"});return o.ok&&(await o.json())?.value||null}catch{return null}}async function b(n,e={}){const t=e.apiBaseUrl||_,{key:r}=c(n);try{const i=`${t}/core/projects/libraries/available?search=${encodeURIComponent(r)}&limit=10`,o=await fetch(i,{method:"GET"});if(!o.ok)return null;const a=await o.json(),l=(a?.items||a?.data||(Array.isArray(a)?a:[])).find(g=>{const{key:$}=c(g?.key);return $.toLowerCase()===r.toLowerCase()});if(!l?.id&&!l?._id)return null;const L=l.id||l._id,v=`${t}/core/projects/${encodeURIComponent(L)}/data?branch=main`,y=await fetch(v,{method:"GET"});if(!y.ok)return null;const m=await y.json();return m?.data||m||null}catch{return null}}async function w(n,e={}){if((0,s.isObject)(n))return n;if((0,s.isString)(n)){const{full:t}=c(n);if(!t)return null;try{const r=await k(t,e);return r||console.warn(`[smbls] Shared library "${t}" not found`),r}catch(r){return console.warn(`[smbls] Failed to fetch shared library "${t}":`,r.message),null}}return null}async function G(n,e={}){return!n||!n.length?[]:(await Promise.all(n.map(async r=>{if(p(r)){const i=await w(x(r),e);return i?{library:i,ignoreList:r.ignoreList}:null}return w(r,e)}))).filter(Boolean)}
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};
@@ -1 +1 @@
1
- import{isObject as s,isString as p}from"./types.js";const y="system",$="https://smbls-kv.nika-980.workers.dev",A="https://api.symbols.app";function l(n){const e=String(n||"").trim();if(!e)return{owner:y,key:"",full:""};let i=null,t=e;if(e.includes("/")){const o=e.indexOf("/");i=e.slice(0,o),t=e.slice(o+1)}t=t.replace(/\.symbo\.ls$/iu,""),i||(i=y);const r=t?`${i}/${t}`:"";return{owner:i,key:t,full:r}}const d=(n,e,i,t)=>{for(const r in e){const o=t?`${t}/${r}`:r;i&&i.has(o)||(r in n?s(n[r])&&s(e[r])&&d(n[r],e[r],i,o):n[r]=e[r])}},g=new Set,R=n=>n.replace(/\.js$/iu,""),U=n=>{const e=new Set;if(!Array.isArray(n))return e;for(const i of n){if(!p(i))continue;const t=i.split("/").map(r=>R(r.trim())).filter(Boolean).join("/");t&&e.add(t)}return e},B=(n,e={})=>({library:n,ignoreList:Array.isArray(e.ignoreList)?e.ignoreList:[]}),m=n=>s(n)&&Array.isArray(n.ignoreList)&&("library"in n||"key"in n||"name"in n),j=n=>n.library!==void 0?n.library:n.key??n.name,E=(n,e,i)=>{const t=e.sharePages===!1;for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&r!=="sharePages"&&!(r==="pages"&&t)&&!i.has(r))if(s(e[r])&&s(n[r]))if(r==="designSystem")d(n[r],e[r],i,r);else for(const o in e[r])i.has(`${r}/${o}`)||o in n[r]||(n[r][o]=e[r][o]);else r in n||(n[r]=e[r])},P=(n,e)=>{if(!(!e||!e.length))for(let i=0;i<e.length;i++){let t=e[i],r=g;m(t)&&(r=U(t.ignoreList),t=t.library),s(t)&&E(n,t,r)}};async function S(n,e={}){if((e.provider||"kv")==="api")return h(n,e);const t=await _(n,e);return t||h(n,e)}async function _(n,e={}){const i=e.kvBaseUrl||$,t=e.env||"production",r=`${i}/kv/${encodeURIComponent(n)}?env=${t}`;try{const o=await fetch(r,{method:"GET"});return o.ok&&(await o.json())?.value||null}catch{return null}}async function h(n,e={}){const i=e.apiBaseUrl||A,{key:t}=l(n);try{const r=`${i}/core/projects/libraries/available?search=${encodeURIComponent(t)}&limit=10`,o=await fetch(r,{method:"GET"});if(!o.ok)return null;const a=await o.json(),c=(a?.items||a?.data||(Array.isArray(a)?a:[])).find(v=>{const{key:L}=l(v?.key);return L.toLowerCase()===t.toLowerCase()});if(!c?.id&&!c?._id)return null;const w=c.id||c._id,k=`${i}/core/projects/${encodeURIComponent(w)}/data?branch=main`,u=await fetch(k,{method:"GET"});if(!u.ok)return null;const f=await u.json();return f?.data||f||null}catch{return null}}async function b(n,e={}){if(s(n))return n;if(p(n)){const{full:i}=l(n);if(!i)return null;try{const t=await S(i,e);return t||console.warn(`[smbls] Shared library "${i}" not found`),t}catch(t){return console.warn(`[smbls] Failed to fetch shared library "${i}":`,t.message),null}}return null}async function x(n,e={}){return!n||!n.length?[]:(await Promise.all(n.map(async t=>{if(m(t)){const r=await b(j(t),e);return r?{library:r,ignoreList:t.ignoreList}:null}return b(t,e)}))).filter(Boolean)}export{d as deepDefaults,S as fetchLibraryData,m as isWrappedLibrary,P as mergeSharedLibraries,U as normalizeIgnoreList,l as normalizeLibraryKey,x as resolveSharedLibraries,B as sharedLibrary};
1
+ import{isObject as a,isString as d}from"./types.js";const p="system",$="https://smbls-kv.nika-980.workers.dev",A="https://api.symbols.app";function c(n){const e=String(n||"").trim();if(!e)return{owner:p,key:"",full:""};let t=null,r=e;if(e.includes("/")){const i=e.indexOf("/");t=e.slice(0,i),r=e.slice(i+1)}r=r.replace(/\.symbo\.ls$/iu,""),t||(t=p);const o=r?`${t}/${r}`:"";return{owner:t,key:r,full:o}}const y=(n,e,t,r)=>{for(const o in e){const i=r?`${r}/${o}`:o;t&&t.has(i)||(o in n?a(n[o])&&a(e[o])&&y(n[o],e[o],t,i):n[o]=e[o])}},R=new Set,U=n=>n.replace(/\.js$/iu,""),m=n=>{const e=new Set;if(!Array.isArray(n))return e;for(const t of n){if(!d(t))continue;const r=t.split("/").map(o=>U(o.trim())).filter(Boolean).join("/");r&&e.add(r)}return e},B=(n,e={})=>({library:n,ignoreList:Array.isArray(e.ignoreList)?e.ignoreList:[]}),h=n=>a(n)&&Array.isArray(n.ignoreList)&&("library"in n||"key"in n||"name"in n),j=n=>n.library!==void 0?n.library:n.key??n.name,I=(n,e,t)=>{const r=m(e.sharedLibIgnore);e.sharePages===!1&&r.add("pages");const o=r.size?new Set([...t,...r]):t;for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&!(i==="sharePages"||i==="sharedLibIgnore")&&!o.has(i))if(a(e[i])&&a(n[i]))if(i==="designSystem")y(n[i],e[i],o,i);else for(const s in e[i])o.has(`${i}/${s}`)||s in n[i]||(n[i][s]=e[i][s]);else i in n||(n[i]=e[i])},P=(n,e)=>{if(!(!e||!e.length))for(let t=0;t<e.length;t++){let r=e[t],o=R;h(r)&&(o=m(r.ignoreList),r=r.library),a(r)&&I(n,r,o)}};async function S(n,e={}){if((e.provider||"kv")==="api")return b(n,e);const r=await E(n,e);return r||b(n,e)}async function E(n,e={}){const t=e.kvBaseUrl||$,r=e.env||"production",o=`${t}/kv/${encodeURIComponent(n)}?env=${r}`;try{const i=await fetch(o,{method:"GET"});return i.ok&&(await i.json())?.value||null}catch{return null}}async function b(n,e={}){const t=e.apiBaseUrl||A,{key:r}=c(n);try{const o=`${t}/core/projects/libraries/available?search=${encodeURIComponent(r)}&limit=10`,i=await fetch(o,{method:"GET"});if(!i.ok)return null;const s=await i.json(),l=(s?.items||s?.data||(Array.isArray(s)?s:[])).find(v=>{const{key:g}=c(v?.key);return g.toLowerCase()===r.toLowerCase()});if(!l?.id&&!l?._id)return null;const k=l.id||l._id,L=`${t}/core/projects/${encodeURIComponent(k)}/data?branch=main`,u=await fetch(L,{method:"GET"});if(!u.ok)return null;const f=await u.json();return f?.data||f||null}catch{return null}}async function w(n,e={}){if(a(n))return n;if(d(n)){const{full:t}=c(n);if(!t)return null;try{const r=await S(t,e);return r||console.warn(`[smbls] Shared library "${t}" not found`),r}catch(r){return console.warn(`[smbls] Failed to fetch shared library "${t}":`,r.message),null}}return null}async function x(n,e={}){return!n||!n.length?[]:(await Promise.all(n.map(async r=>{if(h(r)){const o=await w(j(r),e);return o?{library:o,ignoreList:r.ignoreList}:null}return w(r,e)}))).filter(Boolean)}export{y as deepDefaults,S as fetchLibraryData,h as isWrappedLibrary,P as mergeSharedLibraries,m as normalizeIgnoreList,c as normalizeLibraryKey,x as resolveSharedLibraries,B as sharedLibrary};
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.685",
3
+ "version": "3.14.702",
4
4
  "license": "CC-BY-NC-4.0",
5
5
  "type": "module",
6
6
  "module": "./dist/esm/index.js",
@@ -123,23 +123,30 @@ const wrappedLibraryRef = (entry) =>
123
123
  entry.library !== undefined ? entry.library : (entry.key ?? entry.name)
124
124
 
125
125
  const mergeOneLibrary = (context, sharedLib, ignore) => {
126
- // A library can declare its `pages` private (`sharePages: false` on its
127
- // context). Library site routes would otherwise auto-mount into every
128
- // consumer that doesn't define the same route key — a library serving its
129
- // own doc site (e.g. system/brand) must be able to opt out. Default stays
130
- // ON (legacy behavior) so no existing library changes meaning.
131
- const pagesArePrivate = sharedLib.sharePages === false
126
+ // A library can declare parts of itself private via `sharedLibIgnore` on
127
+ // its own context same path grammar as the consumer-side `ignoreList`
128
+ // (top-level keys or nested 'components/Header'). A library serving its
129
+ // own doc site (e.g. system/brand with `sharedLibIgnore: ['pages']`)
130
+ // must be able to keep its routes out of every consumer; without it,
131
+ // library pages auto-mount into any consumer that doesn't define the same
132
+ // route key. `sharePages: false` is the earlier, narrower alias — kept
133
+ // working, superseded by sharedLibIgnore.
134
+ const libIgnore = normalizeIgnoreList(sharedLib.sharedLibIgnore)
135
+ if (sharedLib.sharePages === false) libIgnore.add('pages')
136
+ const skip = libIgnore.size
137
+ ? new Set([...ignore, ...libIgnore])
138
+ : ignore
132
139
  for (const key in sharedLib) {
133
140
  if (!Object.prototype.hasOwnProperty.call(sharedLib, key)) continue
134
- if (key === 'sharePages') continue // merge directive, not library content
135
- if (key === 'pages' && pagesArePrivate) continue
136
- if (ignore.has(key)) continue // top-level skip: 'designSystem', 'app', 'state'
141
+ // merge directives, not library content
142
+ if (key === 'sharePages' || key === 'sharedLibIgnore') continue
143
+ if (skip.has(key)) continue // top-level skip: 'designSystem', 'app', 'state'
137
144
  if (isObject(sharedLib[key]) && isObject(context[key])) {
138
145
  if (key === 'designSystem') {
139
- deepDefaults(context[key], sharedLib[key], ignore, key)
146
+ deepDefaults(context[key], sharedLib[key], skip, key)
140
147
  } else {
141
148
  for (const k in sharedLib[key]) {
142
- if (ignore.has(`${key}/${k}`)) continue // nested skip: 'components/Header'
149
+ if (skip.has(`${key}/${k}`)) continue // nested skip: 'components/Header'
143
150
  if (!(k in context[key])) context[key][k] = sharedLib[key][k]
144
151
  }
145
152
  }