@publier/shell 0.5.2 → 0.5.3

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/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export{i as HASHED_ASSET_RE,t as docsShell,a as publierCacheControl}from"./integration-ta_sKGK0.mjs";
1
+ export{i as HASHED_ASSET_RE,t as docsShell,a as publierCacheControl}from"./integration-DaERrxR9.mjs";
@@ -4,7 +4,7 @@ import{remarkAsides as e,remarkDirectivesRestoration as t}from"./plugins/remark-
4
4
 
5
5
  `);k(i,`${e}\n${t}`,{encoding:`utf-8`,flag:`wx`}),s.fullWritten=!0}return s}function Pe(e,t,n){return n?ae(e,t.map(e=>e.pathname),n):0}function Fe(e,t,n){return n?ie(e,t.map(e=>e.pathname),n):0}const Ie={enabled:!1,full:!1,collections:[]},Le={enabled:!0,hotkey:`k`};function Re(e){let t=m(e),{config:n,errors:r}=JSON.parse(t);if(r.length>0){let e=r.map(e=>` - [${e.code}] ${e.path}: ${e.message}`);throw Error(`Invalid publier.config.yaml:\n${e.join(`
6
6
  `)}`)}return{...n,announcement:n.announcement??null,llms:n.llms??Ie,search:n.search??Le}}function ze(e){try{let{errors:t}=g(L(e));return t.filter(e=>e.code===`unknown-key`).map(e=>`[@publier/shell] publier.config.yaml \`${e.path}\` has no effect and is ignored. ${e.message}`)}catch{return[]}}function Be(e){let t=j.join(e,`publier.config.yaml`);if(!T(t))return null;try{return O(t,`utf-8`)}catch{return null}}function Ve(e){e.children&&=e.children.map(t=>t.type===`element`&&t.tagName===`table`?e.properties?.dataPublierTableScroll?t:{type:`element`,tagName:`publier-table-scroll`,properties:{className:[`publier-table-scroll`],dataPublierTableScroll:!0},children:[t]}:(Ve(t),t))}function He(){return Ve}function Ue(e,t){let n=p(import.meta.url);for(let t of[e,n])try{let e=t(`remark-math`),n=t(`rehype-katex`);return{remarkMath:e.default??e,rehypeKatex:n.default??n}}catch{}return t.warn("[@publier/shell] remark-math / rehype-katex unavailable in both project and shell. Reinstall node_modules, or set `docsShell({ math: false })` to opt out."),null}function We(e,t){let n=p(import.meta.url);for(let t of[e,n])try{let e=t(`@astrojs/markdown-remark`);if(typeof e.unified==`function`)return e.unified}catch{}return t.warn("[@publier/shell] @astrojs/markdown-remark is not resolvable. On Astro 7 (Sätteri is the default Markdown processor) this means callouts, {{vars}}, <Snippet>, and math will NOT render — add `@astrojs/markdown-remark` to your dependencies."),null}function Ge(i,a,o){let s=JSON.parse(i),c=[];for(let i of s)switch(i.id){case`remark-vars`:a&&c.push([r,a]);break;case`remark-directive`:c.push(ve);break;case`remark-asides`:c.push(e);break;case`remark-directives-restoration`:c.push(t);break;case`remark-snippets`:c.push([n,i.options]);break;case`remark-math`:o&&c.push(o.remarkMath)}return c}function Ke(e,t){let n=JSON.parse(e),r=[];for(let e of n)switch(e.id){case`rehype-tables`:r.push([He,e.options]);break;case`rehype-autolink-headings`:r.push([R,e.options]);break;case`rehype-external-links`:r.push([_e,e.options]);break;case`rehype-katex`:t&&r.push(t.rehypeKatex)}return r}async function qe(e,t,n,r){if(e.mermaid===!1||t.some(e=>e.name===`astro-mermaid`))return;let i=p(import.meta.url),a=i(`node:fs`),o=i(`node:path`),{pathToFileURL:s}=i(`node:url`),c=o.join(n,`node_modules/astro-mermaid`),l;try{let e=JSON.parse(a.readFileSync(o.join(c,`package.json`),`utf8`)),t=e.exports?.[`.`]?.import??e.main;if(!t)return;l=o.join(c,t)}catch{return}let u=Function(`url`,`return import(url)`),d;try{d=await u(s(l).href)}catch{return}r({integrations:[(d.default??d)({autoTheme:!0})]})}const Je=oe();function Ye({root:e,mathEnabled:t}){let n=p(import.meta.url),r=t=>{try{return j.dirname(n.resolve(`${t}/package.json`,{paths:[e]}))}catch{return null}},i=(e,t)=>{let n=r(e);return n?{abs_path:j.join(n,t).split(j.sep).join(`/`)}:null},a=[i(`@publier/shell`,`src/components`),i(`@publier/shell`,`src/components/ui`),i(`@publier/shell`,`src/routes`),i(`@publier/primitives`,`src/components`)].filter(e=>e!==null),o=null;if(t)try{o=n.resolve(`katex/dist/katex.min.css`).split(j.sep).join(`/`)}catch{o=null}let s=re(JSON.stringify(a),o??void 0),c=b(),l=j.join(e,`.astro`);if(c.length>0){T(l)||D(l,{recursive:!0});let e=j.join(l,`publier-class-safelist.html`),t=c.split(/\s+/).filter(Boolean),n=[];for(let e=0;e<t.length;e+=200)n.push(t.slice(e,e+200).join(` `));let r=n.map(e=>`<div class="${e}"></div>`).join(`
7
- `);k(e,r,`utf8`);let i=e.split(j.sep).join(`/`);s+=`@source "${i}";\n`}let u=j.join(l,`publier-tailwind-entry.css`);return(T(u)?O(u,`utf8`):``)!==s&&(D(l,{recursive:!0}),k(u,s)),u}function Xe(e,t,n){if(Ze(n))return[];try{let n=e(`@tailwindcss/vite`),r=typeof n==`function`?n:n.default;if(!r)return t.warn(`[@publier/shell] @tailwindcss/vite resolved but has no callable default export. Tailwind v4 + daisyUI utilities WILL NOT be emitted.`),[];let i=r();return Array.isArray(i)?i:[i]}catch{return t.warn('[@publier/shell] @tailwindcss/vite is not installed in this project. Tailwind v4 + daisyUI utilities WILL NOT be emitted — the site will render unstyled. Add `"@tailwindcss/vite": "^4"` to your package.json alongside `tailwindcss`.'),[]}}function Ze(e){for(let t of e){if(!t)continue;if(Array.isArray(t)){if(Ze(t))return!0;continue}let e=t.name;if(typeof e==`string`&&e.startsWith(`@tailwindcss/vite`))return!0}return!1}const Qe=[`light`,`dark`,`system`];function $e(e){return typeof e==`string`&&Qe.includes(e)}function et(e){let t=j.join(e,`theme.yaml`);if(!T(t))return{preset:`light`};let n;try{n=L(O(t,`utf8`))}catch{return{preset:`light`}}let r=n&&typeof n==`object`?n:{},i=typeof r.preset==`string`&&f.includes(r.preset)?r.preset:`light`,a=r.appearance?.default;return{preset:i,appearance:$e(a)?a:void 0}}function tt(e){if(e)try{let t=L(e)?.appearance?.default;return $e(t)?t:void 0}catch{return}}function nt(e,t,n){return n??t??l(e)}function rt(e,t=/* @__PURE__ */ new Set){let n=d[e],r=n?[...t.has(`heading`)?[]:[n.heading],...t.has(`body`)?[]:[n.body]]:t.has(`body`)?[]:[`inter`];return[...new Set(r)].map(e=>({id:e,cssVariable:u(e),name:c[e].family,weights:c[e].weights,fallbacks:c[e].serif?[`Georgia`,`serif`]:[`system-ui`,`sans-serif`],packageName:`@fontsource-variable/${e}`}))}function it(e){return{name:`publier-tailwind-entry-hmr-shim`,apply:`serve`,configureServer(t){let n=t.config.root,r=e.entryPath.startsWith(n)?e.entryPath.slice(n.length).split(j.sep).join(`/`):null;r&&t.middlewares.use(r,(e,t,n)=>{if((e.url??``).includes(`?`)||e.method!==`GET`&&e.method!==`HEAD`)return n();t.setHeader(`Content-Type`,`application/javascript`),t.setHeader(`Cache-Control`,`no-cache`),t.statusCode=200,t.end(`
7
+ `);k(e,r,`utf8`);let i=e.split(j.sep).join(`/`);s+=`@source "${i}";\n`}let u=j.join(l,`publier-tailwind-entry.css`);return(T(u)?O(u,`utf8`):``)!==s&&(D(l,{recursive:!0}),k(u,s)),u}function Xe(e,t,n){if(Ze(n))return[];try{let n=e(`@tailwindcss/vite`),r=typeof n==`function`?n:n.default;if(!r)return t.warn(`[@publier/shell] @tailwindcss/vite resolved but has no callable default export. Tailwind v4 + daisyUI utilities WILL NOT be emitted.`),[];let i=r();return Array.isArray(i)?i:[i]}catch{return t.warn('[@publier/shell] @tailwindcss/vite is not installed in this project. Tailwind v4 + daisyUI utilities WILL NOT be emitted — the site will render unstyled. Add `"@tailwindcss/vite": "^4"` to your package.json alongside `tailwindcss`.'),[]}}function Ze(e){for(let t of e){if(!t)continue;if(Array.isArray(t)){if(Ze(t))return!0;continue}let e=t.name;if(typeof e==`string`&&e.startsWith(`@tailwindcss/vite`))return!0}return!1}const Qe=[`light`,`dark`,`system`];function $e(e){return typeof e==`string`&&Qe.includes(e)}function et(e){let t=j.join(e,`theme.yaml`);if(!T(t))return{preset:`light`,typographySlots:[]};let n;try{n=L(O(t,`utf8`))}catch{return{preset:`light`,typographySlots:[]}}let r=n&&typeof n==`object`?n:{},i=typeof r.preset==`string`&&f.includes(r.preset)?r.preset:`light`,a=r.appearance?.default,o=r.typography??{},s=[`heading`,`body`].filter(e=>typeof o[e]==`string`&&o[e]!==``);return{preset:i,appearance:$e(a)?a:void 0,typographySlots:s}}function tt(e){if(e)try{let t=L(e)?.appearance?.default;return $e(t)?t:void 0}catch{return}}function nt(e,t,n){return n??t??l(e)}function rt(e,t=/* @__PURE__ */ new Set){let n=d[e],r=n?[...t.has(`heading`)?[]:[n.heading],...t.has(`body`)?[]:[n.body]]:t.has(`body`)?[]:[`inter`];return[...new Set(r)].map(e=>({id:e,cssVariable:u(e),name:c[e].family,weights:c[e].weights,fallbacks:c[e].serif?[`Georgia`,`serif`]:[`system-ui`,`sans-serif`],packageName:`@fontsource-variable/${e}`}))}function it(e){return{name:`publier-tailwind-entry-hmr-shim`,apply:`serve`,configureServer(t){let n=t.config.root,r=e.entryPath.startsWith(n)?e.entryPath.slice(n.length).split(j.sep).join(`/`):null;r&&t.middlewares.use(r,(e,t,n)=>{if((e.url??``).includes(`?`)||e.method!==`GET`&&e.method!==`HEAD`)return n();t.setHeader(`Content-Type`,`application/javascript`),t.setHeader(`Cache-Control`,`no-cache`),t.statusCode=200,t.end(`
8
8
  if (import.meta.hot) {
9
9
  import.meta.hot.accept();
10
10
  }
@@ -112,7 +112,7 @@ mdx.
112
112
  ]
113
113
 
114
114
  Missing:\n ${S.map(e=>e.pkg).join(`
115
- `)}\n`);let pe=dt.find(({pkg:e})=>e===`astro-pagefind`)?.aliases??[],C=c.integrations.findIndex(e=>e.name===i.name),w=c.integrations.findIndex(e=>pe.includes(e.name)),E=c.integrations[w];C>=0&&E&&w<C&&f.warn(`[@publier/shell] "${E.name}" is registered before docsShell() in integrations[]. Pagefind indexes dist/ in its own astro:build:done, before docsShell() removes noindex pages from the search index, so pages marked noindex stay in reader search. Fix: move docsShell() BEFORE pagefind() in astro.config.ts integrations[].`);let D=c.prefetch;ue(D===void 0?void 0:JSON.stringify(D),g)&&l({prefetch:{prefetchAll:!0,defaultStrategy:`viewport`}});let{entries:O,familyOnlyCss:he,slots:k}=re?ut(re,m):{entries:[],familyOnlyCss:``,slots:[]},A=et(m),N=nt(A.preset,A.appearance,tt(_)),P=rt(A.preset,new Set(k)),F=v.snippets??null,I=F==null?null:F===!1?`false`:JSON.stringify(F),L=de(g,I??void 0,T(j.join(m,`content/snippets`))),R=JSON.parse(L),_e={...e,snippets:R===null?void 0:R},ve=JSON.stringify(_e),z=e.math!==!1,B=z?Ue(h,f):null,ye=le(ve,!!(b&&Object.keys(b).length>0),R!==null&&R!==!1,z&&B!==null),be=ce(g,z&&B!==null),V=Ge(ye,b,B),H=Ke(be,B),U=We(h,f);await qe(e,c.integrations,m,l);let W=Ye({root:m,mathEnabled:z}),G=lt({searchEnabled:e.search!==!1,searchHotkey:v.search.hotkey}),K=JSON.stringify({docs:$(m,`docs`),blog:$(m,`blog`),changelog:$(m,`changelog`)}),q=JSON.parse(se(g,x,K)),J=q.filter(e=>e.pattern.endsWith(`/rss.xml`)).map(e=>({title:e.pattern===`/blog/rss.xml`?`Blog feed`:e.pattern===`/changelog/rss.xml`?`Changelog feed`:e.pattern,href:e.pattern}));if(U){let e=c.markdown?.processor,t=e?.options?.hastPlugins;e?.name!==`unified`&&Array.isArray(t)&&t.length>0&&f.warn(`[@publier/shell] docsShell() is replacing the configured "${e?.name}" Markdown processor, discarding ${t.length} HAST plugin(s) another integration already registered on it — typically astro-expressive-code >=0.43, which registers into the processor it finds at its own setup. Code fences will silently lose ALL processing (plain <pre><code>, no syntax highlighting). Fix: move docsShell() BEFORE expressiveCode() (and any other Markdown-processor-touching integration) in astro.config.ts integrations[] so they register into docsShell's unified() processor instead.`)}l({markdown:U?{processor:U({remarkPlugins:V,rehypePlugins:H})}:{remarkPlugins:[...V],rehypePlugins:[...H]},vite:{ssr:{noExternal:[`@publier/shell`],external:[`@publier/native`]},build:{rollupOptions:{external:[`@publier/native`]}},optimizeDeps:{exclude:[`@publier/shell`,`@publier/native`]},plugins:[...Xe(h,f,c.vite?.plugins??[]),s({root:m}),o({root:m}),Q(`virtual:publier-nav-config`,`navConfig`,ie),it({entryPath:W}),ot(),Q(`virtual:publier-announcement`,`announcement`,ae),Q(`virtual:publier-site`,`site`,y),Q(`virtual:publier-docs-config`,`docsConfig`,oe),Q(`virtual:publier-appearance`,`appearance`,{...v.appearance,default:N}),Q(`virtual:publier-feeds`,`feeds`,J),Q(`virtual:publier-fonts`,`fonts`,{slots:k,faces:P.map(e=>e.cssVariable)}),st()]}}),l({fonts:[...P.map(e=>({name:e.name,cssVariable:e.cssVariable,provider:M.npm({remote:!1}),fallbacks:e.fallbacks,weights:[e.weights],styles:[`normal`],subsets:[`latin`],options:{package:e.packageName}})),{name:`JetBrains Mono Variable`,cssVariable:`--publier-font-builtin-mono`,provider:M.npm({remote:!1}),fallbacks:[`monospace`],weights:[`100 800`],styles:[`normal`],subsets:[`latin`],options:{package:`@fontsource-variable/jetbrains-mono`}},...O]}),u(`page-ssr`,[`import ${JSON.stringify(W)};`,`import 'virtual:publier-theme-css';`,`import 'virtual:publier-custom-css';`,`import '@publier/shell/styles/base.css';`].join(`
115
+ `)}\n`);let pe=dt.find(({pkg:e})=>e===`astro-pagefind`)?.aliases??[],C=c.integrations.findIndex(e=>e.name===i.name),w=c.integrations.findIndex(e=>pe.includes(e.name)),E=c.integrations[w];C>=0&&E&&w<C&&f.warn(`[@publier/shell] "${E.name}" is registered before docsShell() in integrations[]. Pagefind indexes dist/ in its own astro:build:done, before docsShell() removes noindex pages from the search index, so pages marked noindex stay in reader search. Fix: move docsShell() BEFORE pagefind() in astro.config.ts integrations[].`);let D=c.prefetch;ue(D===void 0?void 0:JSON.stringify(D),g)&&l({prefetch:{prefetchAll:!0,defaultStrategy:`viewport`}});let{entries:O,familyOnlyCss:he,slots:k}=re?ut(re,m):{entries:[],familyOnlyCss:``,slots:[]},A=et(m),N=nt(A.preset,A.appearance,tt(_)),P=rt(A.preset,/* @__PURE__ */ new Set([...k,...A.typographySlots])),F=v.snippets??null,I=F==null?null:F===!1?`false`:JSON.stringify(F),L=de(g,I??void 0,T(j.join(m,`content/snippets`))),R=JSON.parse(L),_e={...e,snippets:R===null?void 0:R},ve=JSON.stringify(_e),z=e.math!==!1,B=z?Ue(h,f):null,ye=le(ve,!!(b&&Object.keys(b).length>0),R!==null&&R!==!1,z&&B!==null),be=ce(g,z&&B!==null),V=Ge(ye,b,B),H=Ke(be,B),U=We(h,f);await qe(e,c.integrations,m,l);let W=Ye({root:m,mathEnabled:z}),G=lt({searchEnabled:e.search!==!1,searchHotkey:v.search.hotkey}),K=JSON.stringify({docs:$(m,`docs`),blog:$(m,`blog`),changelog:$(m,`changelog`)}),q=JSON.parse(se(g,x,K)),J=q.filter(e=>e.pattern.endsWith(`/rss.xml`)).map(e=>({title:e.pattern===`/blog/rss.xml`?`Blog feed`:e.pattern===`/changelog/rss.xml`?`Changelog feed`:e.pattern,href:e.pattern}));if(U){let e=c.markdown?.processor,t=e?.options?.hastPlugins;e?.name!==`unified`&&Array.isArray(t)&&t.length>0&&f.warn(`[@publier/shell] docsShell() is replacing the configured "${e?.name}" Markdown processor, discarding ${t.length} HAST plugin(s) another integration already registered on it — typically astro-expressive-code >=0.43, which registers into the processor it finds at its own setup. Code fences will silently lose ALL processing (plain <pre><code>, no syntax highlighting). Fix: move docsShell() BEFORE expressiveCode() (and any other Markdown-processor-touching integration) in astro.config.ts integrations[] so they register into docsShell's unified() processor instead.`)}l({markdown:U?{processor:U({remarkPlugins:V,rehypePlugins:H})}:{remarkPlugins:[...V],rehypePlugins:[...H]},vite:{ssr:{noExternal:[`@publier/shell`],external:[`@publier/native`]},build:{rollupOptions:{external:[`@publier/native`]}},optimizeDeps:{exclude:[`@publier/shell`,`@publier/native`]},plugins:[...Xe(h,f,c.vite?.plugins??[]),s({root:m}),o({root:m}),Q(`virtual:publier-nav-config`,`navConfig`,ie),it({entryPath:W}),ot(),Q(`virtual:publier-announcement`,`announcement`,ae),Q(`virtual:publier-site`,`site`,y),Q(`virtual:publier-docs-config`,`docsConfig`,oe),Q(`virtual:publier-appearance`,`appearance`,{...v.appearance,default:N}),Q(`virtual:publier-feeds`,`feeds`,J),Q(`virtual:publier-fonts`,`fonts`,{slots:k,faces:P.map(e=>e.cssVariable)}),st()]}}),l({fonts:[...P.map(e=>({name:e.name,cssVariable:e.cssVariable,provider:M.npm({remote:!1}),fallbacks:e.fallbacks,weights:[e.weights],styles:[`normal`],subsets:[`latin`],options:{package:e.packageName}})),{name:`JetBrains Mono Variable`,cssVariable:`--publier-font-builtin-mono`,provider:M.npm({remote:!1}),fallbacks:[`monospace`],weights:[`100 800`],styles:[`normal`],subsets:[`latin`],options:{package:`@fontsource-variable/jetbrains-mono`}},...O]}),u(`page-ssr`,[`import ${JSON.stringify(W)};`,`import 'virtual:publier-theme-css';`,`import 'virtual:publier-custom-css';`,`import '@publier/shell/styles/base.css';`].join(`
116
116
  `)),u(`page`,G),u(`head-inline`,`(function(){
117
117
  if (typeof window === 'undefined' || !window.sessionStorage || !window.fetch) return;
118
118
  var store = window.sessionStorage;
@@ -1 +1 @@
1
- export{t as docsShell,n as hoistMediaOutOfUtilitiesLayer,r as publierCascadeHoistPlugin}from"./integration-ta_sKGK0.mjs";
1
+ export{t as docsShell,n as hoistMediaOutOfUtilitiesLayer,r as publierCascadeHoistPlugin}from"./integration-DaERrxR9.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@publier/shell",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Qwik + Astro docs layout for Publier sites.",
6
6
  "type": "module",