@symbo.ls/mermaid 3.14.715 → 3.14.716
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 +13 -0
- package/dist/esm/src/render.js +16 -16
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @symbo.ls/mermaid
|
|
2
2
|
|
|
3
|
+
## 3.14.716
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Server renders run one at a time per process, and a page at /<lang>/… starts in that language.
|
|
8
|
+
|
|
9
|
+
- brender: `render()` (and `renderRoute` / `renderPage`) run one at a time per process; a per-render `timeout` (default 30 s, `0`/`false` turns it off) rejects with `BRENDER_RENDER_TIMEOUT`, puts the render's globals back and lets the next render start.
|
|
10
|
+
- brender + mermaid: before the app starts, the render stores the address's language (the first path segment, when it is one of the project's languages) under polyglot's key, so the fetch seed is recorded in the language the browser asks in; the served page's start-up script stores the page's language. One helper in utils (`polyglotAddressLang`, `polyglotStartupScript`).
|
|
11
|
+
- cli: the publish pre-render passes its route limit to brender's `timeout`; `symbols.json` `brender.timeout` sets each page's render limit for `smbls build` and `smbls brender`.
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @symbo.ls/utils@3.14.788
|
|
15
|
+
|
|
3
16
|
## 3.14.715
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/esm/src/render.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import S from"./utils/logger.js";import St from"./utils/vartranformer.js";import{getBundleScript as Et,getSmblsIife as vt,getSmblsRuntimeVersion as Tt}from"./bundle.js";import{deepDestringifyFunctions as _t,isStringTag as z,markRevived as $t}from"./utils/deepDestringify.js";import{transpile as U}from"./utils/funcql-transpile.js";import{normalizeRoute as Rt,resolvePageRoute as It}from"./route.js";import{generateMetaTags as Dt,getPageMetadata as wt,getImportMapScript as Ot,jsonForScript as xt,polyglotStartupScript as V}from"@symbo.ls/utils";import{getTapStyles as Bt,getTapRuntimeSnippet as Nt}from"@symbo.ls/tap";import{resolveDeployIdentity as At,deployIdentityScript as Mt}from"./deployIdentity.js";const Pt=(t,r)=>{const s=parseInt(t,16);if(Number.isNaN(s))return t;const e=d=>d>255?255:d<0?0:d,n=e((s>>16)+r),i=e((s>>8&255)+r);return((e((s&255)+r)|i<<8|n<<16)+16777216).toString(16).slice(1)},W=(t,r)=>{if(typeof t!="string")return;if(r&&typeof r[t]=="string")return r[t];if(/^(#|rgb|hsl|var\(|[a-z]+$)/i.test(t))return t;const s=t.match(/^([a-z][a-z0-9]*)(?:\.(\d+))?([+-]\d+)?$/i);if(s&&(s[2]||s[3])){const e=r&&r[s[1]],n=typeof e=="string"&&e.match(/^#?([0-9a-f]{6})$/i);if(n){let i=n[1];if(s[3]&&(i=Pt(i,parseInt(s[3],10))),s[2]){const p=parseFloat("0."+s[2]),d=parseInt(i,16);return`rgba(${d>>16&255},${d>>8&255},${d&255},${p})`}return"#"+i}}},kt=process.env.BRENDER!=="false";let $=null,J=null,K=null,x=null;if(kt)try{const t=await import("@symbo.ls/brender");$=t.renderRoute,J=t.generateSitemap,K=t.prefetchPageData,x=t.adoptionScripts||null}catch(t){S.debug(`[MERMAID] Brender not available: ${t.message}`)}const q=({fontLinks:t,globalCSS:r=[],css:s})=>{const e=[];t&&e.push(t);const n=r.filter(Boolean).join(`
|
|
2
2
|
`);return n&&e.push(`<style data-brender>${n}</style>`),s&&e.push(`<style data-emotion="smbls">${s}</style>`),e.join(`
|
|
3
|
-
`)},
|
|
3
|
+
`)},Lt=()=>{try{return(0,eval)("1"),!0}catch{return!1}},jt=`<!doctype html>
|
|
4
4
|
<html'\${{{ ROOT_ATTRS }}}'>
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8" />
|
|
7
7
|
'\${{{ HEAD_BOOT }}}'
|
|
8
8
|
'\${{{ META }}}'
|
|
9
9
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
10
|
-
<style id="smbls-tap-styles">${
|
|
11
|
-
<script>${
|
|
10
|
+
<style id="smbls-tap-styles">${Bt()}</style>
|
|
11
|
+
<script>${Nt()}<\/script>
|
|
12
12
|
'\${{{ IMPORTMAP }}}'
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
@@ -25,16 +25,16 @@ import v from"./utils/logger.js";import $t from"./utils/vartranformer.js";import
|
|
|
25
25
|
<\/script>
|
|
26
26
|
'\${{{ EDITOR }}}'
|
|
27
27
|
</body>
|
|
28
|
-
</html>`;function
|
|
29
|
-
`),o={metadata:
|
|
30
|
-
`),
|
|
31
|
-
`:`<!-- symbols | ${s} | ${i} | ${
|
|
32
|
-
`,
|
|
33
|
-
<meta name="color-scheme" content="light dark">`:"";let
|
|
34
|
-
`+
|
|
35
|
-
`+
|
|
36
|
-
`+
|
|
37
|
-
`+
|
|
28
|
+
</html>`;function B(t,r=Array.isArray(t)?[]:{}){for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;const e=t[s];if(typeof e=="string"){const n=e.trim();if(n.startsWith("(")&&n.includes("=>")||n.startsWith("function")||n.startsWith("async ")){const p=U(e);r[s]=p?p.schema:null}else r[s]=e}else z(e)?r[s]=e.value:Array.isArray(e)?r[s]=e.map(n=>{if(typeof n=="string"){const i=n.trim();if(i.startsWith("(")&&i.includes("=>")||i.startsWith("function")||i.startsWith("async ")){const d=U(n);return d?d.schema:null}}return z(n)?n.value:n&&typeof n=="object"?B(n):n}):e&&typeof e=="object"&&!Array.isArray(e)?r[s]=B(e):r[s]=e}return $t(r)}async function te(t,r={}){const{appkey:s,pathname:e="/",channel:n="production",userEnv:i=n,isProd:p=!1,req:d,query:Ct,userId:N,smblsIife:G,editorBundle:A,analyzedScript:Q="",indexHtml:X,ssrCache:c,deployChannel:Z,apiBaseUrl:tt,evalAvailable:M,ssrWithoutEval:et=process.env.BRENDER_WITHOUT_EVAL==="true",adoptDom:st=!1}=r;if(!t)return{html:"",status:404,contentType:"text/html"};const P=typeof M=="boolean"?M:Lt();if(typeof s=="string"&&s.includes("/")){const[a,u]=s.split("/");t.key||(t.key=u),t.owner||(t.owner=a)}const E=Rt(e),y=It(t.pages,e),v=i==="production"||i==="staging";let T="",R="",o=null,_=null,I="";if((c&&typeof c=="object"&&typeof c.html=="string"&&c.html?c:null)&&v){const a=t.__ssr&&typeof t.__ssr=="object"&&t.__ssr.__styles||{};T=(typeof a.sprite=="string"&&!/id="svgSprite"/.test(c.html)?a.sprite:"")+(c.html||"");const f=l=>c[l]!=null?c[l]:a[l];R=q({fontLinks:f("fontLinks"),globalCSS:[f("globalCSS"),f("resetCss")],css:f("css")});const m=[],h=V({polyglot:(t.config||t.settings||{}).polyglot||t.polyglot,translations:c.ssrTranslations,lang:c.activeLang,pathname:E});h&&m.push(h),m.push("<script>window.__BRENDER__=true<\/script>"),I=m.join(`
|
|
29
|
+
`),o={metadata:c.metadata,prefetchedState:c.prefetchedState,activeLang:c.activeLang}}else if($&&v&&!P&&!et)S.debug("[MERMAID] Brender skipped: eval is unavailable in this runtime (client render)");else if($&&v)try{const a=y?y.route:E;S.debug(`[MERMAID] Running brender for route: ${a}`);const u=P;if(_=u?_t(t):B(t),o=await $(_,{route:a,pathname:E}),o){T=o.html||"";const f=o.globalCSS||{};R=q({fontLinks:o.fontLinks,globalCSS:[f.rootRule,o.resetCss,f.keyframeRules],css:o.css});const m=[],h=V({polyglot:(_?.config||{}).polyglot||_?.polyglot,translations:o.ssrTranslations,lang:o.activeLang,pathname:E});if(h&&m.push(h),st&&u&&x){const l=x(o);l&&m.push(l)}else u&&o.brRegistry&&Object.keys(o.brRegistry).length&&m.push(`<script>window.__BR_REGISTRY__=${xt(o.brRegistry)}<\/script>`);m.push("<script>window.__BRENDER__=true<\/script>"),I=m.join(`
|
|
30
|
+
`),S.debug(`[MERMAID] Brender completed: body=${T.length}b, registry=${Object.keys(o.brRegistry||{}).length}`)}}catch(a){S.warn(`[MERMAID] Brender failed, falling back to client render: ${a.message}`)}const nt=Et(s,t,d),k=Tt(),rt=Ot(t,t?.settings?.cdnProvider||"symbols",{pin:k?{smbls:k}:void 0}),ot=t?.files&&t.files["index.html"],L=X||ot?.code||jt,it=At({deployChannel:Z,channel:n,userEnv:i,apiBaseUrl:tt}),j=Mt(it),lt=/\$\{\{\{\s*DEPLOY_IDENTITY\s*\}\}\}/.test(L),ct=N?`<script>window.__SYMBOLS_AUTH__=${JSON.stringify({userId:N})}<\/script>`:"",D=o?.prefetchedState,at=(t.config||t.settings||{}).polyglot||t.polyglot,pt=o?.activeLang||at?.defaultLang||"en",dt=D&&Object.keys(D).length?{state:D,lang:pt,actualPathname:e}:{actualPathname:e},mt=o?.metadata&&Object.keys(o.metadata).length?o.metadata:wt(t,y?y.route:E,dt,{isProduction:p,channel:n}),ht=Dt(mt,p),w=G||vt();if(!w)return S.error("[MERMAID] smbls IIFE bundle not available"),{html:"Internal Server Error: smbls bundle not found",status:500,contentType:"text/plain"};const ut=A&&!p?`<script defer type="text/javascript">${A}<\/script>`:"",ft=p?`<!-- built with symbols.app -->
|
|
31
|
+
`:`<!-- symbols | ${s} | ${i} | ${v?"ssr":"csr"} | noindex -->
|
|
32
|
+
`,O=t.useDocumentTheme!==!1,b=t.globalTheme&&t.globalTheme!=="auto"?String(t.globalTheme):null,C=t.themeStorageKey?String(t.themeStorageKey):"",gt=O&&b?' data-theme="'+b+'"':"",yt=O?"<script>(function(){try{var t=null;try{t=new URLSearchParams(location.search).get('globalTheme')}catch(e){}"+(C?"if(!t){try{t=localStorage.getItem("+JSON.stringify(C)+")}catch(e){}}":"")+"if(!t||t==='auto'){"+(b?"t="+JSON.stringify(b)+";":"try{t=window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light'}catch(e){}")+`}if(t&&t!=='auto')document.documentElement.setAttribute('data-theme',t);}catch(e){}})();<\/script>
|
|
33
|
+
<meta name="color-scheme" content="light dark">`:"";let F="";if(O){const a=t.designSystem||t.config&&t.config.designSystem||{},u=a.color||{},f=a.theme&&a.theme.document||{},m=l=>{const g=f["@"+l];if(!g)return null;const H=W(g.background,u),Y=W(g.color,u);return[H&&`background:${H}`,Y&&`color:${Y}`].filter(Boolean).join(";")||null},h=[];if(b){const l=m(b);l&&h.push(`html{${l}}`)}else{const l=m("dark"),g=m("light");l&&(h.push(`@media (prefers-color-scheme:dark){:root:not([data-theme]) html{${l}}}`),h.push(`[data-theme="dark"] html{${l}}`)),g&&(h.push(`@media (prefers-color-scheme:light){:root:not([data-theme]) html{${g}}}`),h.push(`[data-theme="light"] html{${g}}`))}h.length&&(F=`<style>${h.join("")}</style>`)}const bt=typeof t.__criticalCss=="string"&&t.__criticalCss.trim()?`<style>${t.__criticalCss}</style>`:"";return{html:St(ft+L,{ROOT_ATTRS:gt,HEAD_BOOT:yt+(bt||F),META:ht+`
|
|
34
|
+
`+R+`
|
|
35
|
+
`+I+`
|
|
36
|
+
`+ct,BUNDLE:nt,BODY:T,SMBLS_IIFE:lt?w:j+`
|
|
37
|
+
`+w,DEPLOY_IDENTITY:j,NODE_ENV:"'production'",IMPORTMAP:rt,EDITOR:ut+Q},{allowScript:!0}),status:y&&y.notFound?404:200,contentType:"text/html"}}function ee(t,r="production",s=null){const e=r!=="production"?` (${r})`:"",n=s==="not_public",i=n?"Site Not Yet Public":"Not Published",p=n?`This site isn't public yet${e}`:`This project hasn't been published yet${e}`;return`<!doctype html>
|
|
38
38
|
<html>
|
|
39
39
|
<head>
|
|
40
40
|
<meta charset="UTF-8">
|
|
@@ -55,9 +55,9 @@ import v from"./utils/logger.js";import $t from"./utils/vartranformer.js";import
|
|
|
55
55
|
</head>
|
|
56
56
|
<body>
|
|
57
57
|
<div class="container">
|
|
58
|
-
<h1>${
|
|
58
|
+
<h1>${p}</h1>
|
|
59
59
|
<p>${n?"The owner has connected this domain but the project's visibility is set to private. Once they switch it to public in the workspace settings, the site will appear here automatically.":'Run <code>smbls publish</code> to deploy your project, or visit <a href="https://symbols.app">symbols.app</a> to get started.'}</p>
|
|
60
60
|
<span class="env">${t}${e}</span>
|
|
61
61
|
</div>
|
|
62
62
|
</body>
|
|
63
|
-
</html>`}export{
|
|
63
|
+
</html>`}export{jt as DEFAULT_TEMPLATE_HTML,J as generateSitemap,K as prefetchPageData,ee as renderNotPublishedHtml,te as renderProjectHtml,B as transpileFunctionStrings};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/mermaid",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.716",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "CC-BY-NC-4.0",
|
|
6
6
|
"description": "Self-sustaining server runner for Symbols projects from JSON. Renders DOMQL projects to HTML with optional brender SSR.",
|
|
@@ -63,12 +63,12 @@
|
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@symbo.ls/channels": "^3.14.676",
|
|
65
65
|
"@symbo.ls/tap": "^3.14.612",
|
|
66
|
-
"@symbo.ls/utils": "^3.14.
|
|
66
|
+
"@symbo.ls/utils": "^3.14.788",
|
|
67
67
|
"cors": "^2.8.6",
|
|
68
68
|
"express": "^4.22.2"
|
|
69
69
|
},
|
|
70
70
|
"optionalDependencies": {
|
|
71
|
-
"@symbo.ls/brender": "^3.14.
|
|
71
|
+
"@symbo.ls/brender": "^3.14.667"
|
|
72
72
|
},
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|