@symbo.ls/utils 3.14.485 → 3.14.595
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 +14 -0
- package/dist/cjs/metadata.js +2 -2
- package/dist/esm/metadata.js +2 -2
- package/metadata.js +3 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @symbo.ls/utils
|
|
2
2
|
|
|
3
|
+
## 3.14.595
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Auto-generated cross-repo patch release.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @symbo.ls/fetch@3.14.595
|
|
10
|
+
|
|
11
|
+
## 3.14.568
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Auto-generated cross-repo patch release.
|
|
16
|
+
|
|
3
17
|
## 3.14.485
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/cjs/metadata.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var j=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var A=(s,i)=>{for(var r in i)j(s,r,{get:i[r],enumerable:!0})},W=(s,i,r,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of L(i))!S.call(s,n)&&n!==r&&j(s,n,{get:()=>i[n],enumerable:!(e=O(i,n))||e.enumerable});return s};var E=s=>W(j({},"__esModule",{value:!0}),s);var K={};A(K,{generateMetaTags:()=>q,getPageMetadata:()=>
|
|
2
|
-
`)),
|
|
1
|
+
"use strict";var j=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var A=(s,i)=>{for(var r in i)j(s,r,{get:i[r],enumerable:!0})},W=(s,i,r,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of L(i))!S.call(s,n)&&n!==r&&j(s,n,{get:()=>i[n],enumerable:!(e=O(i,n))||e.enumerable});return s};var E=s=>W(j({},"__esModule",{value:!0}),s);var K={};A(K,{generateMetaTags:()=>q,getPageMetadata:()=>x});module.exports=E(K);var w=require("./types.js");const h=s=>{if(s==null)return"";const i={"&":"&","<":"<",">":">",'"':""","'":"'"};return s.toString().replace(/[&<>"']/g,r=>i[r])},T=s=>Object.entries(s||{}).filter(([i,r])=>r!==void 0).map(([i,r])=>`${i}="${h(r)}"`).join(" "),q=(s,i)=>(i||(s={...s,robots:"noindex"}),Object.entries(s).reduce((e,[n,o])=>{if(!o&&o!==0&&o!==!1)return e;if(n==="title")return e.push(`<title>${h(o)}</title>`),e;if(n==="canonical")return e.push(`<link rel="canonical" href="${h(o)}">`),e;if(n==="manifest")return e.push(`<link rel="manifest" href="${h(o)}">`),e;if(n==="favicon"||n==="favicons"||n==="icon"||n==="icons")return(Array.isArray(o)?o:[o]).forEach(f=>{if(typeof f=="string")e.push(`<link rel="icon" href="${h(f)}">`);else if(typeof f=="object"){const a=T(f);/rel=/.test(a)?e.push(`<link ${a}>`):e.push(`<link rel="icon" ${a}>`)}}),e;if(n==="alternate")return(Array.isArray(o)?o:[o]).forEach(f=>{if(typeof f=="object"){const a=Object.entries(f).filter(([t,u])=>u!==void 0).map(([t,u])=>`${t}="${h(u)}"`).join(" ");e.push(`<link rel="alternate" ${a}>`)}}),e;const p=(c,f,a="name")=>{if(typeof f=="string"||typeof f=="number"||typeof f=="boolean")e.push(`<meta ${a}="${h(c)}" content="${h(f)}">`);else if(Array.isArray(f))f.forEach(t=>{if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")e.push(`<meta ${a}="${h(c)}" content="${h(t)}">`);else if(typeof t=="object"){const u=Object.entries(t).filter(([m,l])=>l!==void 0).map(([m,l])=>`${m}="${h(l)}"`).join(" ");e.push(`<meta ${u}>`)}});else if(typeof f=="object"){const t=Object.entries(f).filter(([u,m])=>m!==void 0).map(([u,m])=>`${u}="${h(m)}"`).join(" ");e.push(`<meta ${t}>`)}};if(n.startsWith("http-equiv:")){const c=n.replace("http-equiv:","");return p(c,o,"http-equiv"),e}if(n.startsWith("itemprop:")){const c=n.replace("itemprop:","");return p(c,o,"itemprop"),e}const g=["og:","twitter:","fb:","article:","profile:","book:","business:","music:","product:","video:","DC:","DCTERMS:"].find(c=>n.startsWith(c));if(g){const c=n.replace(g,"");return p(`${g.replace(":","")}:${c}`,o,g==="twitter:"||g==="DC:"||g==="DCTERMS:"?"name":"property"),e}if(n.startsWith("apple:")||n.startsWith("msapplication:")){const c=n.startsWith("apple:")?"apple-":"msapplication-",f=n.replace(/^apple:|^msapplication:/,"");return p(`${c}${f}`,o,"name"),e}return p(n,o),e},['<meta charset="UTF-8">','<meta name="viewport" content="width=device-width, initial-scale=1">']).join(`
|
|
2
|
+
`)),D=s=>typeof s=="string"&&s.length>0&&!s.startsWith("/")&&!s.startsWith("http");function F(s,i){if(!i||typeof i!="object")return s;const r=n=>{if(!D(n))return n;const o=i[n];return o?.src?o.src:n},e={...s};for(const[n,o]of Object.entries(e))typeof o=="string"?e[n]=r(o):Array.isArray(o)&&(e[n]=o.map(p=>typeof p=="string"?r(p):p));return e}function y(s,i){if(!s||!i)return;const r=i.split(".");let e=s;for(const n of r){if(e==null||typeof e!="object")return;e=e[n]}return e}function P(s,i,r){const n=(i.config||i.settings||{}).polyglot||i.polyglot,o=r?.lang||n?.defaultLang||"en",d=(n?.translations||{})[o]||{},g=r?.state||{},c={...s};for(const[f,a]of Object.entries(c))typeof a!="string"||!a.includes("{{")||(c[f]=a.replace(/\{\{\s*([^|{}]+?)\s*(?:\|\s*(\w+)\s*)?\}\}/g,(t,u,m)=>{const l=u.trim();if(m==="polyglot")return d[l]??y(d,l)??t;if(m==="getLocalStateLang")return y(g,l+o)??t;const $=y(g,l);return $!==void 0?$:d[l]??y(d,l)??t}));return c}function M(s){const i={...s};for(const[r,e]of Object.entries(i))if(typeof e=="function"){const n=e.toString(),o=n.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(o){i[r]=`{{ ${o[1]} | getLocalStateLang }}`;continue}const p=n.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(p){i[r]=`{{ ${p[1]} | polyglot }}`;continue}const d=n.match(/s\.(\w+(?:\.\w+)+)/);if(d){i[r]=`{{ ${d[1]} }}`;continue}delete i[r]}else if(typeof e=="string"){const n=e.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(n){i[r]=`{{ ${n[1]} | getLocalStateLang }}`;continue}const o=e.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(o){i[r]=`{{ ${o[1]} | polyglot }}`;continue}if(e.includes("=>")&&e.includes("s.")){const p=e.match(/s\.(\w+(?:\.\w+)+)/);if(p){i[r]=`{{ ${p[1]} }}`;continue}}}return i}function x(s,i,r,{isProduction:e=!1,channel:n="production"}={}){const o=s.pages?.[i],p=(0,w.isObject)(o?.state)&&o?.state,d=o?.metadata||o?.helmet||p||{},g=M(d),c=new Set(Object.keys(g)),f=s.app?.metadata||{},a=M(f);let t={};if(s.integrations?.seo?t={...s.integrations.seo,...a,...g}:Object.keys(a).length?t={...a,...g}:t={...g},!t.title){const l=s.name||s.key;l?e?t.title=l:n==="development"?t.title=`${l} / dev:symbo.ls`:n==="staging"?t.title=`${l} / staging:symbo.ls`:t.title=`${l} / symbo.ls`:t.title="Symbols demo"}t=P(t,s,r),t.title&&(c.has("title")||!t["og:title"])&&(c.has("og:title")||(t["og:title"]=t.title)),t.description&&(c.has("description")||!t["og:description"])&&(c.has("og:description")||(t["og:description"]=t.description)),t.title&&!t["twitter:title"]&&(t["twitter:title"]=t.title),t.description&&!t["twitter:description"]&&(t["twitter:description"]=t.description);const u=r?.actualPathname||i;if(t["og:url"]||t.url){const l=(t["og:url"]||t.url||"").replace(/\/$/,"");if(l&&u&&u!=="/"){const $=u.startsWith("/")?u:"/"+u;t["og:url"]=l+$}}t=F(t,s.files);const m=s.name||s.app?.metadata?.title||s.app?.name||"";for(const[l,$]of Object.entries(t))if(typeof $=="string"&&$.includes("{{")){const b=$.replace(/\{\{[^}]*\}\}/g,"").trim();b?t[l]=b:l==="title"?t[l]=m:delete t[l]}return t}
|
package/dist/esm/metadata.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{isObject as M}from"./types.js";const
|
|
2
|
-
`)),O=i=>typeof i=="string"&&i.length>0&&!i.startsWith("/")&&!i.startsWith("http");function L(i,o){if(!o||typeof o!="object")return i;const r=n=>{if(!O(n))return n;const s=o[n];return s?.src?s.src:n},e={...i};for(const[n,s]of Object.entries(e))typeof s=="string"?e[n]=r(s):Array.isArray(s)&&(e[n]=s.map(p=>typeof p=="string"?r(p):p));return e}function y(i,o){if(!i||!o)return;const r=o.split(".");let e=i;for(const n of r){if(e==null||typeof e!="object")return;e=e[n]}return e}function S(i,o,r){const n=(o.config||o.settings||{}).polyglot||o.polyglot,s=r?.lang||n?.defaultLang||"en",d=(n?.translations||{})[s]||{},g=r?.state||{},c={...i};for(const[f,a]of Object.entries(c))typeof a!="string"||!a.includes("{{")||(c[f]=a.replace(/\{\{\s*([^|{}]+?)\s*(?:\|\s*(\w+)\s*)?\}\}/g,(t,u,
|
|
1
|
+
import{isObject as M}from"./types.js";const h=i=>{if(i==null)return"";const o={"&":"&","<":"<",">":">",'"':""","'":"'"};return i.toString().replace(/[&<>"']/g,r=>o[r])},w=i=>Object.entries(i||{}).filter(([o,r])=>r!==void 0).map(([o,r])=>`${o}="${h(r)}"`).join(" "),W=(i,o)=>(o||(i={...i,robots:"noindex"}),Object.entries(i).reduce((e,[n,s])=>{if(!s&&s!==0&&s!==!1)return e;if(n==="title")return e.push(`<title>${h(s)}</title>`),e;if(n==="canonical")return e.push(`<link rel="canonical" href="${h(s)}">`),e;if(n==="manifest")return e.push(`<link rel="manifest" href="${h(s)}">`),e;if(n==="favicon"||n==="favicons"||n==="icon"||n==="icons")return(Array.isArray(s)?s:[s]).forEach(f=>{if(typeof f=="string")e.push(`<link rel="icon" href="${h(f)}">`);else if(typeof f=="object"){const a=w(f);/rel=/.test(a)?e.push(`<link ${a}>`):e.push(`<link rel="icon" ${a}>`)}}),e;if(n==="alternate")return(Array.isArray(s)?s:[s]).forEach(f=>{if(typeof f=="object"){const a=Object.entries(f).filter(([t,u])=>u!==void 0).map(([t,u])=>`${t}="${h(u)}"`).join(" ");e.push(`<link rel="alternate" ${a}>`)}}),e;const p=(c,f,a="name")=>{if(typeof f=="string"||typeof f=="number"||typeof f=="boolean")e.push(`<meta ${a}="${h(c)}" content="${h(f)}">`);else if(Array.isArray(f))f.forEach(t=>{if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")e.push(`<meta ${a}="${h(c)}" content="${h(t)}">`);else if(typeof t=="object"){const u=Object.entries(t).filter(([m,l])=>l!==void 0).map(([m,l])=>`${m}="${h(l)}"`).join(" ");e.push(`<meta ${u}>`)}});else if(typeof f=="object"){const t=Object.entries(f).filter(([u,m])=>m!==void 0).map(([u,m])=>`${u}="${h(m)}"`).join(" ");e.push(`<meta ${t}>`)}};if(n.startsWith("http-equiv:")){const c=n.replace("http-equiv:","");return p(c,s,"http-equiv"),e}if(n.startsWith("itemprop:")){const c=n.replace("itemprop:","");return p(c,s,"itemprop"),e}const g=["og:","twitter:","fb:","article:","profile:","book:","business:","music:","product:","video:","DC:","DCTERMS:"].find(c=>n.startsWith(c));if(g){const c=n.replace(g,"");return p(`${g.replace(":","")}:${c}`,s,g==="twitter:"||g==="DC:"||g==="DCTERMS:"?"name":"property"),e}if(n.startsWith("apple:")||n.startsWith("msapplication:")){const c=n.startsWith("apple:")?"apple-":"msapplication-",f=n.replace(/^apple:|^msapplication:/,"");return p(`${c}${f}`,s,"name"),e}return p(n,s),e},['<meta charset="UTF-8">','<meta name="viewport" content="width=device-width, initial-scale=1">']).join(`
|
|
2
|
+
`)),O=i=>typeof i=="string"&&i.length>0&&!i.startsWith("/")&&!i.startsWith("http");function L(i,o){if(!o||typeof o!="object")return i;const r=n=>{if(!O(n))return n;const s=o[n];return s?.src?s.src:n},e={...i};for(const[n,s]of Object.entries(e))typeof s=="string"?e[n]=r(s):Array.isArray(s)&&(e[n]=s.map(p=>typeof p=="string"?r(p):p));return e}function y(i,o){if(!i||!o)return;const r=o.split(".");let e=i;for(const n of r){if(e==null||typeof e!="object")return;e=e[n]}return e}function S(i,o,r){const n=(o.config||o.settings||{}).polyglot||o.polyglot,s=r?.lang||n?.defaultLang||"en",d=(n?.translations||{})[s]||{},g=r?.state||{},c={...i};for(const[f,a]of Object.entries(c))typeof a!="string"||!a.includes("{{")||(c[f]=a.replace(/\{\{\s*([^|{}]+?)\s*(?:\|\s*(\w+)\s*)?\}\}/g,(t,u,m)=>{const l=u.trim();if(m==="polyglot")return d[l]??y(d,l)??t;if(m==="getLocalStateLang")return y(g,l+s)??t;const $=y(g,l);return $!==void 0?$:d[l]??y(d,l)??t}));return c}function j(i){const o={...i};for(const[r,e]of Object.entries(o))if(typeof e=="function"){const n=e.toString(),s=n.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(s){o[r]=`{{ ${s[1]} | getLocalStateLang }}`;continue}const p=n.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(p){o[r]=`{{ ${p[1]} | polyglot }}`;continue}const d=n.match(/s\.(\w+(?:\.\w+)+)/);if(d){o[r]=`{{ ${d[1]} }}`;continue}delete o[r]}else if(typeof e=="string"){const n=e.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(n){o[r]=`{{ ${n[1]} | getLocalStateLang }}`;continue}const s=e.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(s){o[r]=`{{ ${s[1]} | polyglot }}`;continue}if(e.includes("=>")&&e.includes("s.")){const p=e.match(/s\.(\w+(?:\.\w+)+)/);if(p){o[r]=`{{ ${p[1]} }}`;continue}}}return o}function E(i,o,r,{isProduction:e=!1,channel:n="production"}={}){const s=i.pages?.[o],p=M(s?.state)&&s?.state,d=s?.metadata||s?.helmet||p||{},g=j(d),c=new Set(Object.keys(g)),f=i.app?.metadata||{},a=j(f);let t={};if(i.integrations?.seo?t={...i.integrations.seo,...a,...g}:Object.keys(a).length?t={...a,...g}:t={...g},!t.title){const l=i.name||i.key;l?e?t.title=l:n==="development"?t.title=`${l} / dev:symbo.ls`:n==="staging"?t.title=`${l} / staging:symbo.ls`:t.title=`${l} / symbo.ls`:t.title="Symbols demo"}t=S(t,i,r),t.title&&(c.has("title")||!t["og:title"])&&(c.has("og:title")||(t["og:title"]=t.title)),t.description&&(c.has("description")||!t["og:description"])&&(c.has("og:description")||(t["og:description"]=t.description)),t.title&&!t["twitter:title"]&&(t["twitter:title"]=t.title),t.description&&!t["twitter:description"]&&(t["twitter:description"]=t.description);const u=r?.actualPathname||o;if(t["og:url"]||t.url){const l=(t["og:url"]||t.url||"").replace(/\/$/,"");if(l&&u&&u!=="/"){const $=u.startsWith("/")?u:"/"+u;t["og:url"]=l+$}}t=L(t,i.files);const m=i.name||i.app?.metadata?.title||i.app?.name||"";for(const[l,$]of Object.entries(t))if(typeof $=="string"&&$.includes("{{")){const b=$.replace(/\{\{[^}]*\}\}/g,"").trim();b?t[l]=b:l==="title"?t[l]=m:delete t[l]}return t}export{W as generateMetaTags,E as getPageMetadata};
|
package/metadata.js
CHANGED
|
@@ -142,7 +142,9 @@ export const generateMetaTags = (metadata, isProduction) => {
|
|
|
142
142
|
},
|
|
143
143
|
[
|
|
144
144
|
'<meta charset="UTF-8">',
|
|
145
|
-
|
|
145
|
+
// Never disable pinch-zoom by default (user-scalable=no / maximum-scale=1
|
|
146
|
+
// is a WCAG 1.4.4 violation); apps that truly need it can override.
|
|
147
|
+
'<meta name="viewport" content="width=device-width, initial-scale=1">'
|
|
146
148
|
]
|
|
147
149
|
)
|
|
148
150
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/utils",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.595",
|
|
4
4
|
"license": "CC-BY-NC-4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@symbo.ls/fetch": "^3.14.
|
|
50
|
+
"@symbo.ls/fetch": "^3.14.595"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"@symbo.ls/fetch": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@babel/core": "^7.
|
|
58
|
+
"@babel/core": "^7.29.7"
|
|
59
59
|
},
|
|
60
60
|
"browser": "./dist/esm/index.js",
|
|
61
61
|
"sideEffects": false,
|