@publier/shell 4.6.1 → 4.7.0
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.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{integration-BnK5Z5T8.d.mts → integration-B1mMNT__.d.mts} +1 -1
- package/dist/integration-Cr0RiYaz.mjs +142 -0
- package/dist/integration.d.mts +1 -1
- package/dist/integration.mjs +1 -1
- package/dist/plugins/remark-asides.mjs +1 -1
- package/package.json +5 -2
- package/src/routes/docs-slug.astro +2 -2
- package/dist/integration-CVZZLDAG.mjs +0 -138
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,t as n}from"./integration-
|
|
1
|
+
import{a as e,i as t,t as n}from"./integration-Cr0RiYaz.mjs";export{t as HASHED_ASSET_RE,n as docsShell,e as publierCacheControl};
|
|
@@ -160,7 +160,7 @@ interface DocsConfig {
|
|
|
160
160
|
/** `llms:` from publier.config.yaml — see `writeLlmsTxt`. */
|
|
161
161
|
interface LlmsConfig {
|
|
162
162
|
enabled: boolean;
|
|
163
|
-
/**
|
|
163
|
+
/** Opt in to per-page rendered Markdown and `llms-full.txt`. Requires enabled. */
|
|
164
164
|
full: boolean;
|
|
165
165
|
/** Restrict to these collections. Empty means every rendered collection. */
|
|
166
166
|
collections: string[];
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import{remarkAsides as e,remarkDirectivesRestoration as t}from"./plugins/remark-asides.mjs";import n from"./plugins/remark-snippets.mjs";import r from"./plugins/remark-vars.mjs";import{CODE_GROUP_SYNC_SCRIPT as i}from"./runtime/code-group-sync.mjs";import{TABS_SYNC_SCRIPT as a}from"./runtime/tabs-sync.mjs";import{publierCssPlugin as o,publierThemeCssPlugin as s}from"./tailwind/css-plugin.mjs";import{createRequire as c}from"node:module";import{configResolveShellConfig as l,contentGenerateLlmsTxt as u,generateAnalyticsScripts as d,shellAnnouncementBannerScript as f,shellBuildHeaders as p,shellBuildLicenseErrorMessage as ee,shellCacheControl as m,shellCollectTailwindClassTokens as h,shellComposeTailwindEntry as g,shellLazyUpgradeScript as _,shellOpenInAiScript as v,shellPlanDefaultRoutes as te,shellPlanRehypePlugins as ne,shellPlanRemarkPlugins as re,shellResolvePrefetch as ie,shellResolveSnippetsConfig as ae,shellRewriteHead as oe,shellRewriteModulepreload as y,shellSearchButtonScript as b,shellSearchDialogScript as x,shellTableOfContentsScript as S,verifyLicense as se}from"@publier/native";import{existsSync as C,lstatSync as w,mkdirSync as T,readFileSync as E,readdirSync as ce,writeFileSync as D}from"node:fs";import{writeFile as O}from"node:fs/promises";import k from"node:path";import{fileURLToPath as le}from"node:url";import{fontProviders as A}from"astro/config";import{fromHtml as ue}from"hast-util-from-html";import{toMdast as j}from"hast-util-to-mdast";import{gfmToMarkdown as M}from"mdast-util-gfm";import{toMarkdown as N}from"mdast-util-to-markdown";import P from"rehype-autolink-headings";import F from"rehype-external-links";import de from"remark-directive";const fe=/^\/(?:_astro|assets|build)\//;function I(){return p()}function L(e){return m(e)}function R(e,t){let n=t.map(e=>e.pathname),r=oe(e,n);return{stylesheetsCount:r.stylesheetsCount,modulesCount:r.modulesCount,pagesRewritten:r.pagesRewritten,stylesheets:r.stylesheets,modules:r.modules}}function z(e,t){for(let n of e.children){if(n.type!==`element`)continue;if(t(n))return n;let e=z(n,t);if(e)return e}}function B(e){return e.children.map(e=>e.type===`text`?e.value:e.type===`element`?B(e):``).join(``)}function V(e){let t=e.replace(/^\//,``).replace(/\/$/,``);if(!t)return`/`;for(let e of t.split(`/`)){let t;try{t=decodeURIComponent(e)}catch{return}if(!t||t===`.`||t===`..`||/[\\/?#]/.test(t)||[...t].some(e=>e.charCodeAt(0)<32||e.charCodeAt(0)===127))return}return`/${t}`}function H(e){try{return w(e),!0}catch(e){if(e.code===`ENOENT`)return!1;throw e}}function U(e,t){let n=k.resolve(e),r=k.resolve(n,t);if(!r.startsWith(`${n}${k.sep}`))throw Error(`Unsafe export path: ${t}`);let i=n;for(let e of k.relative(n,r).split(k.sep))if(i=k.join(i,e),H(i)&&w(i).isSymbolicLink())throw Error(`Symlink in export path: ${t}`);return r}function pe(e){return!!z(e,e=>e.tagName===`meta`&&String(e.properties.name).toLowerCase()===`robots`&&/(?:^|[\s,])(noindex|none)(?:$|[\s,])/i.test(String(e.properties.content)))}function W(e,t){let n=[],r=new Set;for(let{pathname:i}of t){let t=V(i);if(!t||r.has(t)||t===`/404`||t===`/500`)continue;let a=t.slice(1),o=(a?[`${a}/index.html`,`${a}.html`]:[`index.html`]).find(t=>H(U(e,t)));if(!o)continue;let s=U(e,o);if(!w(s).isFile())continue;let c=ue(E(s,`utf-8`));if(pe(c)||z(c,e=>e.tagName===`meta`&&String(e.properties.httpEquiv).toLowerCase()===`refresh`))continue;let l=z(c,e=>e.tagName===`title`),u=l&&B(l).replace(/\s+/g,` `).trim();if(!u)continue;let d=z(c,e=>e.tagName===`meta`&&String(e.properties.name).toLowerCase()===`description`),f=String(d?.properties.content??``).replace(/\s+/g,` `).trim()||void 0;r.add(t),n.push({url:t,title:u,description:f,collection:a.split(`/`)[0]||void 0,tree:c,directory:o===`index.html`||o.endsWith(`/index.html`)})}return n.sort((e,t)=>e.url.localeCompare(t.url))}function me(e,t){return W(e,t).map(({url:e,title:t,description:n,collection:r})=>({url:e,title:t,description:n,collection:r}))}function he(e,t,n){let r=U(e,`llms.txt`);if(H(r))return{written:!1,pageCount:0,skipped:`existing-file`};let i=me(e,t);if(i.length===0)return{written:!1,pageCount:0,skipped:`no-pages`};let a=u(JSON.stringify({siteName:n.siteName,siteDescription:n.siteDescription,pages:i,collections:n.collections}));return D(r,a,{encoding:`utf-8`,flag:`wx`}),{written:!0,pageCount:i.length}}function ge(e,t){let n=t.map(e=>e.pathname),r=y(e,n);return{jsCount:r.jsCount,fontsCount:r.fontsCount,pagesRewritten:r.pagesRewritten}}const _e=new Set([`nav`,`footer`,`script`,`style`,`noscript`,`template`,`button`,`input`,`select`,`textarea`,`form`,`svg`]),ve=new Set([`navigation`,`search`,`tablist`,`tab`,`button`,`menu`,`toolbar`]);function ye(e){return _e.has(e.tagName)||ve.has(String(e.properties.role))||`dataPagefindIgnore`in e.properties||`dataPublierMarkdownExclude`in e.properties||String(e.properties.dataMdast)===`ignore`}function G(e){e.children=e.children.filter(e=>e.type!==`comment`&&(e.type!==`element`||!ye(e)));for(let t of e.children)t.type===`element`&&G(t)}function K(e,t,n,r){delete e.properties.hidden,delete e.properties.ariaHidden,delete e.properties.style;for(let i of[`href`,`src`,`poster`]){let a=e.properties[i];if(typeof a!=`string`||!a)continue;let o=new URL(a,t);e.properties[i]=n||o.origin!==r?o.href:`${o.pathname}${o.search}${o.hash}`}if(e.tagName===`pre`){let t=z(e,e=>e.tagName===`code`);if(t){let n=[],r=e=>{for(let t of e.children)t.type===`element`&&(Array.isArray(t.properties.className)&&t.properties.className.includes(`ec-line`)?n.push(t):r(t))};r(t),n.length&&(t.children=[{type:`text`,value:n.map(e=>B(z(e,e=>Array.isArray(e.properties.className)&&e.properties.className.includes(`code`))??e)).join(`
|
|
2
|
+
`)}]);let i=e.properties.dataLanguage;typeof i==`string`&&(t.properties.className=[`language-${i}`])}}for(let i of e.children)i.type===`element`&&K(i,t,n,r)}function be(e,t){let n=structuredClone(e.tree);G(n);let r=z(n,e=>e.tagName===`main`)??z(n,e=>e.tagName===`article`);if(!r)return;let i=`${e.url}${e.directory&&e.url!==`/`?`/`:``}`,a=new URL(i,t||`https:`),o=a,s=z(e.tree,e=>e.tagName===`base`&&`href`in e.properties)?.properties.href;if(typeof s==`string`)try{let e=new URL(s,a);(e.protocol===`https:`||e.protocol===`http:`)&&(o=e)}catch{}K(r,o,!!t,a.origin);let c=N(j({type:`root`,children:[r]}),{fences:!0,extensions:[M()]});return c.trim()?c:void 0}function xe(e,t,n){let r=W(e,t).filter(e=>n.collections.length===0||n.collections.includes(e.collection??`pages`)).flatMap(e=>{let t=be(e,n.siteUrl);return t?[{page:e,markdown:t,relative:`${e.url===`/`?`index`:e.url.slice(1)}.md`}]:[]}),i=U(e,`llms-full.txt`),a=new Set,o=t=>{if(H(t)&&!w(t).isFile())throw Error(`Markdown export collision: ${k.relative(e,t)}`)};r.length&&(o(i),a.add(i));for(let t of r){let n=U(e,t.relative);if([...a].some(e=>n===e||n.startsWith(`${e}${k.sep}`)||e.startsWith(`${n}${k.sep}`)))throw Error(`Markdown export collision: ${t.relative}`);o(n),a.add(n)}let s={pageCount:r.length,written:0,existing:0,fullWritten:!1};for(let t of r){let n=U(e,t.relative);if(H(n)){s.existing++;continue}T(k.dirname(n),{recursive:!0}),D(n,t.markdown,{encoding:`utf-8`,flag:`wx`}),s.written++}if(r.length&&!H(i)){let e=N({type:`root`,children:[{type:`heading`,depth:1,children:[{type:`text`,value:n.siteName}]},...n.siteDescription?[{type:`blockquote`,children:[{type:`paragraph`,children:[{type:`text`,value:n.siteDescription}]}]}]:[]]}),t=r.map(({page:e,markdown:t})=>{let r=n.siteUrl?new URL(e.url,n.siteUrl).href:e.url;return`${N({type:`root`,children:[{type:`heading`,depth:2,children:[{type:`link`,url:r,children:[{type:`text`,value:e.title}]}]}]})}\n${t}`}).join(`
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
`);D(i,`${e}\n${t}`,{encoding:`utf-8`,flag:`wx`}),s.fullWritten=!0}return s}const Se={enabled:!1,full:!1,collections:[]};function Ce(e){let t=l(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
|
+
`)}`)}return{...n,announcement:n.announcement??null,llms:n.llms??Se}}function we(e){let t=k.join(e,`publier.config.yaml`);if(!C(t))return null;try{return E(t,`utf-8`)}catch{return null}}function q(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]}:(q(t),t))}function Te(){return q}function Ee(e,t){let n=c(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 De(e,t){let n=c(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 Oe(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(de);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([Te,e.options]);break;case`rehype-autolink-headings`:r.push([P,e.options]);break;case`rehype-external-links`:r.push([F,e.options]);break;case`rehype-katex`:t&&r.push(t.rehypeKatex)}return r}async function Ae(e,t,n,r){if(e.mermaid===!1||t.some(e=>e.name===`astro-mermaid`))return;let i=c(import.meta.url),a=i(`node:fs`),o=i(`node:path`),{pathToFileURL:s}=i(`node:url`),l=o.join(n,`node_modules/astro-mermaid`),u;try{let e=JSON.parse(a.readFileSync(o.join(l,`package.json`),`utf8`)),t=e.exports?.[`.`]?.import??e.main;if(!t)return;u=o.join(l,t)}catch{return}let d=Function(`url`,`return import(url)`),f;try{f=await d(s(u).href)}catch{return}r({integrations:[(f.default??f)({autoTheme:!0})]})}const je=_();function Me({root:e,mathEnabled:t}){let n=c(import.meta.url),r=t=>{try{return k.dirname(n.resolve(`${t}/package.json`,{paths:[e]}))}catch{return null}},i=(e,t)=>{let n=r(e);return n?{abs_path:k.join(n,t).split(k.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(k.sep).join(`/`)}catch{o=null}let s=g(JSON.stringify(a),o??void 0),l=h(),u=k.join(e,`.astro`);if(l.length>0){C(u)||T(u,{recursive:!0});let e=k.join(u,`publier-class-safelist.html`),t=l.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
|
+
`);D(e,r,`utf8`);let i=e.split(k.sep).join(`/`);s+=`@source "${i}";\n`}let d=k.join(u,`publier-tailwind-entry.css`);return(C(d)?E(d,`utf8`):``)!==s&&(T(u,{recursive:!0}),D(d,s)),d}function Ne(e,t,n){if(J(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 J(e){for(let t of e){if(!t)continue;if(Array.isArray(t)){if(J(t))return!0;continue}let e=t.name;if(typeof e==`string`&&e.startsWith(`@tailwindcss/vite`))return!0}return!1}function Pe(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(k.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
|
+
if (import.meta.hot) {
|
|
9
|
+
import.meta.hot.accept();
|
|
10
|
+
}
|
|
11
|
+
`)})}}}const Fe=`import 'astro:scripts/page-ssr.js';
|
|
12
|
+
`;function Ie(){return{name:`publier-dev-page-ssr-propagation`,apply:`serve`,enforce:`post`,transform(e,t){let n=t.split(`?`)[0];return!n.endsWith(`.astro`)||!n.includes(`/src/pages/`)||e.includes(Fe)?null:{code:Fe+e,map:null}}}}function Y(e,t){let n=e[t];if(n===`\\`&&t+1<e.length)return t+2;if(n===`"`||n===`'`){let r=n,i=t+1;for(;i<e.length&&e[i]!==r;)e[i]===`\\`&&i+1<e.length?i+=2:i++;return i+1}if(n===`/`&&e[t+1]===`*`){let n=e.indexOf(`*/`,t+2);return n===-1?e.length:n+2}return t}function X(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=Y(e,r);if(t!==r){r=t;continue}let i=e[r];i===`{`?n++:i===`}`&&n--,r++}return r}function Z(e){let t=[],n=(r,i)=>{let a=r,o=``,s=r;for(;a<i;){let r=Y(e,a);if(r!==a){a=r;continue}let c=e[a];if(c===`@`&&e.startsWith(`@media`,a)&&/[\s(]/.test(e[a+6]??``)){let n=e.indexOf(`{`,a);if(n===-1||n>=i){a++;continue}let r=X(e,n);o+=e.slice(s,a),t.push(e.slice(a,r)),a=r,s=a;continue}if(c===`{`){let t=X(e,a);if(t>i)break;let r=n(a+1,t-1);o+=e.slice(s,a+1)+r+`}`,a=t,s=a;continue}a++}return o+=e.slice(s,i),o},r=0,i=``;for(;r<e.length;){let t=Y(e,r);if(t!==r){r=t;continue}let a=e.indexOf(`@layer utilities`,r);if(a===-1){i+=e.slice(r);break}let o=e[a+16];if(o!==` `&&o!==` `&&o!==`
|
|
13
|
+
`&&o!==`\r`&&o!==`{`){r=a+16;continue}let s=r,c=!1;for(;s<a;){let t=Y(e,s);if(t!==s){if(t>a){c=!0,r=t;break}s=t}else s++}if(c)continue;let l=e.indexOf(`{`,a);if(l===-1){i+=e.slice(r);break}i+=e.slice(r,l+1);let u=X(e,l);i+=n(l+1,u-1),i+=`}`,r=u}return t.length>0&&(i.endsWith(`
|
|
14
|
+
`)||(i+=`
|
|
15
|
+
`),i+=t.join(`
|
|
16
|
+
`),i.endsWith(`
|
|
17
|
+
`)||(i+=`
|
|
18
|
+
`)),i}function Le(){return{name:`publier-cascade-hoist`,enforce:`post`,transform(e,t){if(!t.endsWith(`.css`)&&!t.includes(`.css?`))return null;let n=Z(e);return n===e?null:{code:n,map:null}},generateBundle(e,t){for(let e of Object.keys(t)){if(!e.endsWith(`.css`))continue;let n=t[e];if(!n||n.type!==`asset`)continue;let r=typeof n.source==`string`?n.source:new TextDecoder().decode(n.source),i=Z(r);i!==r&&(n.source=i)}}}}function Q(e,t,n){let r=`\0${e}`,i=`export const ${t} = ${JSON.stringify(n)};`;return{name:`publier-${e.replace(/^virtual:publier-/,``)}`,resolveId(t){if(t===e)return r},load(e){if(e===r)return i}}}function Re(e,t=6){return e.length===0?`[]`:e.length<=t?`[${e.join(`, `)}]`:`[${e.slice(0,t).join(`, `)}, +${e.length-t} more]`}function ze(e){let t=[`import '@publier/shell/runtime/marketing-nav';`,je,a,i,`
|
|
19
|
+
(() => {
|
|
20
|
+
if (customElements.get('publier-table-scroll')) return;
|
|
21
|
+
class PublierTableScroll extends HTMLElement {
|
|
22
|
+
observer;
|
|
23
|
+
frame;
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
|
|
26
|
+
this.frame = requestAnimationFrame(() => {
|
|
27
|
+
if (!this.isConnected) return;
|
|
28
|
+
this.observer = new ResizeObserver(() => this.update());
|
|
29
|
+
this.observer.observe(this);
|
|
30
|
+
const table = this.querySelector('table');
|
|
31
|
+
if (table) this.observer.observe(table);
|
|
32
|
+
this.update();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
disconnectedCallback() {
|
|
36
|
+
cancelAnimationFrame(this.frame);
|
|
37
|
+
this.observer?.disconnect();
|
|
38
|
+
}
|
|
39
|
+
update() {
|
|
40
|
+
if (this.clientWidth > 0 && this.scrollWidth > this.clientWidth) {
|
|
41
|
+
this.setAttribute('tabindex', '0');
|
|
42
|
+
this.setAttribute('role', 'region');
|
|
43
|
+
this.setAttribute('aria-label', this.querySelector('caption')?.textContent.trim() || 'Scrollable table');
|
|
44
|
+
} else {
|
|
45
|
+
this.removeAttribute('tabindex');
|
|
46
|
+
this.removeAttribute('role');
|
|
47
|
+
this.removeAttribute('aria-label');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
customElements.define('publier-table-scroll', PublierTableScroll);
|
|
52
|
+
})();
|
|
53
|
+
`,f(),v(),S()];return e.searchEnabled&&t.push(x(),b()),t.join(`
|
|
54
|
+
`)}function Be(e,t){let n=[],r=[],i=[];for(let a of[`heading`,`body`,`mono`]){let o=e[a];if(!o?.family)continue;let s=`--publier-font-${a}`,c=a===`mono`?[`monospace`]:[`system-ui`,`sans-serif`],l=[o.weight??`400`],u=[o.style??`normal`];if(o.googleFontsUrl)n.push({name:o.family,cssVariable:s,provider:A.google(),fallbacks:c,weights:l,styles:u,subsets:[`latin`]}),r.push(a);else if(o.src){let e=k.isAbsolute(o.src)&&C(o.src)?o.src:k.join(t,`public`,o.src.replace(/^\/+/,``));n.push({name:o.family,cssVariable:s,provider:A.local(),fallbacks:c,weights:l,styles:u,subsets:[`latin`],options:{variants:[{weight:l[0],style:u[0],src:[e]}]}}),r.push(a)}else i.push(`${s}:"${o.family}",${c.join(`,`)};`)}return{entries:n,familyOnlyCss:i.length?`:root{${i.join(``)}}`:``,slots:r}}const Ve=[{pkg:`astro-expressive-code`,aliases:[`astro-expressive-code`]},{pkg:`@astrojs/mdx`,aliases:[`@astrojs/mdx`]},{pkg:`@astrojs/sitemap`,aliases:[`@astrojs/sitemap`]},{pkg:`astro-pagefind`,aliases:[`astro-pagefind`,`pagefind`]},{pkg:`@qwik.dev/astro`,aliases:[`@qwik.dev/astro`]}];function $(e,t){let n=k.join(e,`src`,`content`,t);if(!C(n))return!1;try{return ce(n,{recursive:!0}).some(e=>typeof e==`string`&&/\.mdx?$/.test(e))}catch{return!1}}function He(e={}){let t=null;return{name:`@publier/shell`,hooks:{"astro:config:setup":async({config:n,updateConfig:r,injectScript:i,injectRoute:a,logger:l})=>{let u=n.root?le(n.root):process.cwd();try{se()}catch(e){let t=e instanceof Error?e.message:String(e),n=ee(t);throw n?Error(n):e}let f=c(k.join(u,`package.json`)),p=JSON.stringify(e),m=Ce(we(u)??``),h=m.site;t={llms:m.llms,siteName:h.name,siteUrl:h.url??void 0,siteDescription:h.description??void 0};let g=m.vars,_=m.fonts,v=m.nav,oe=m.announcement,y=m.docs,b=typeof h.url==`string`&&h.url.length>0;b&&!n.site&&r({site:h.url});let x=new Set(n.integrations.map(e=>e.name)),S=Ve.filter(({aliases:e})=>!e.some(e=>x.has(e)));S.length>0&&l.warn(`[@publier/shell] Required framework integrations are not registered in
|
|
55
|
+
astro.config.ts. As of @publier/shell@2.0.0, docsShell() no longer
|
|
56
|
+
auto-wires these. Add the following to your integrations[] array
|
|
57
|
+
(import statements + entries shown). Order matters: docsShell() must
|
|
58
|
+
come FIRST (astro-expressive-code >=0.43 registers into the Markdown
|
|
59
|
+
processor it finds at its own setup — docsShell's pinned unified()
|
|
60
|
+
processor must already be in place), and expressive-code must precede
|
|
61
|
+
mdx.
|
|
62
|
+
|
|
63
|
+
import expressiveCode from 'astro-expressive-code';
|
|
64
|
+
import mdx from '@astrojs/mdx';
|
|
65
|
+
import sitemap from '@astrojs/sitemap';
|
|
66
|
+
import pagefind from 'astro-pagefind';
|
|
67
|
+
import qwik from '@qwik.dev/astro';
|
|
68
|
+
|
|
69
|
+
integrations: [
|
|
70
|
+
docsShell({ /* options */ }),
|
|
71
|
+
expressiveCode(),
|
|
72
|
+
mdx(),
|
|
73
|
+
sitemap(),
|
|
74
|
+
pagefind(),
|
|
75
|
+
qwik({ clientRouter: true }),
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
Missing:\n ${S.map(e=>e.pkg).join(`
|
|
79
|
+
`)}\n`);let w=n.prefetch;ie(w===void 0?void 0:JSON.stringify(w),p)&&r({prefetch:{prefetchAll:!0,defaultStrategy:`viewport`}});let{entries:T,familyOnlyCss:E,slots:ce}=_?Be(_,u):{entries:[],familyOnlyCss:``,slots:[]},D=m.snippets??null,O=D==null?null:D===!1?`false`:JSON.stringify(D),ue=ae(p,O??void 0,C(k.join(u,`content/snippets`))),j=JSON.parse(ue),M={...e,snippets:j===null?void 0:j},N=JSON.stringify(M),P=e.math!==!1,F=P?Ee(f,l):null,de=re(N,!!(g&&Object.keys(g).length>0),j!==null&&j!==!1,P&&F!==null),fe=ne(p,P&&F!==null),I=Oe(de,g,F),L=ke(fe,F),R=De(f,l);await Ae(e,n.integrations,u,r);let z=Me({root:u,mathEnabled:P}),B=ze({searchEnabled:e.search!==!1}),V=JSON.stringify({docs:$(u,`docs`),blog:$(u,`blog`),changelog:$(u,`changelog`)}),H=JSON.parse(te(p,b,V)),U=H.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(R){let e=n.markdown?.processor,t=e?.options?.hastPlugins;e?.name!==`unified`&&Array.isArray(t)&&t.length>0&&l.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.`)}r({markdown:R?{processor:R({remarkPlugins:I,rehypePlugins:L})}:{remarkPlugins:[...I],rehypePlugins:[...L]},vite:{ssr:{noExternal:[`@publier/shell`],external:[`@publier/native`]},build:{rollupOptions:{external:[`@publier/native`]}},optimizeDeps:{exclude:[`@publier/shell`,`@publier/native`]},plugins:[...Ne(f,l,n.vite?.plugins??[]),s({root:u}),o({root:u}),Q(`virtual:publier-nav-config`,`navConfig`,v),Pe({entryPath:z}),Ie(),Q(`virtual:publier-announcement`,`announcement`,oe),Q(`virtual:publier-site`,`site`,h),Q(`virtual:publier-docs-config`,`docsConfig`,y),Q(`virtual:publier-appearance`,`appearance`,m.appearance),Q(`virtual:publier-feeds`,`feeds`,U),Q(`virtual:publier-fonts`,`fonts`,{slots:ce}),Le()]}}),r({fonts:[{name:`Inter Variable`,cssVariable:`--publier-font-builtin-sans`,provider:A.npm({remote:!1}),fallbacks:[`system-ui`,`sans-serif`],weights:[`100 900`],styles:[`normal`],subsets:[`latin`],options:{package:`@fontsource-variable/inter`}},{name:`JetBrains Mono Variable`,cssVariable:`--publier-font-builtin-mono`,provider:A.npm({remote:!1}),fallbacks:[`monospace`],weights:[`100 800`],styles:[`normal`],subsets:[`latin`],options:{package:`@fontsource-variable/jetbrains-mono`}},...T]}),i(`page-ssr`,[`import ${JSON.stringify(z)};`,`import 'virtual:publier-theme-css';`,`import 'virtual:publier-custom-css';`,`import '@publier/shell/styles/base.css';`].join(`
|
|
80
|
+
`)),i(`page`,B),i(`head-inline`,`(function(){
|
|
81
|
+
if (typeof window === 'undefined' || !window.sessionStorage || !window.fetch) return;
|
|
82
|
+
var store = window.sessionStorage;
|
|
83
|
+
var ResponseCtor = window.Response;
|
|
84
|
+
var origFetch = window.fetch.bind(window);
|
|
85
|
+
var NS = 'publier:bg:';
|
|
86
|
+
var PATTERN = /^\\/(?:_astro|assets|build)\\/(?:[^\\/]*bundle-graph[^\\/]*\\.json|q-manifest[^\\/]*\\.json)(?:\\?.*)?$/;
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
var inflight = Object.create(null);
|
|
92
|
+
function serve(body){
|
|
93
|
+
return new ResponseCtor(body, {
|
|
94
|
+
status: 200,
|
|
95
|
+
headers: { 'content-type': 'application/json' }
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
window.fetch = function(input, init){
|
|
99
|
+
var url = typeof input === 'string' ? input : (input && input.url) || '';
|
|
100
|
+
var method = (init && init.method) || (input && input.method) || 'GET';
|
|
101
|
+
if (!url || method !== 'GET' || !PATTERN.test(url)) {
|
|
102
|
+
return origFetch(input, init);
|
|
103
|
+
}
|
|
104
|
+
var key = NS + url;
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
|
+
var hit = store.getItem(key);
|
|
108
|
+
if (hit !== null) return Promise.resolve(serve(hit));
|
|
109
|
+
} catch (_) {}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
if (inflight[url]) return inflight[url].then(serve);
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
var pending = origFetch(input, init).then(function(res){
|
|
116
|
+
if (res && res.ok) {
|
|
117
|
+
return res.clone().text().then(function(body){
|
|
118
|
+
try { store.setItem(key, body); } catch (_) {}
|
|
119
|
+
delete inflight[url];
|
|
120
|
+
return res;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
delete inflight[url];
|
|
124
|
+
return res;
|
|
125
|
+
}, function(err){
|
|
126
|
+
delete inflight[url];
|
|
127
|
+
throw err;
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
inflight[url] = pending.then(function(res){
|
|
131
|
+
return res && res.ok ? res.clone().text() : '';
|
|
132
|
+
});
|
|
133
|
+
return pending;
|
|
134
|
+
};
|
|
135
|
+
})();`),E&&i(`head-inline`,`
|
|
136
|
+
const _pFonts = document.createElement('style');
|
|
137
|
+
_pFonts.textContent = ${JSON.stringify(E)};
|
|
138
|
+
document.head.appendChild(_pFonts);
|
|
139
|
+
`);{let e=m.analytics;if(e){let t=d(e);t&&i(`head-inline`,`
|
|
140
|
+
const _pAnalytics = document.createRange().createContextualFragment(${JSON.stringify(t)});
|
|
141
|
+
document.head.appendChild(_pAnalytics);
|
|
142
|
+
`)}}for(let e of H)a({pattern:e.pattern,entrypoint:e.entrypoint,prerender:e.prerender});H.length>0&&l.info(`[@publier/shell] Injected default routes: ${H.map(e=>e.pattern).join(`, `)}.`),l.info(`[@publier/shell] Plugin pipeline wired.`)},"astro:build:done":async({dir:e,pages:n,logger:r})=>{let i=le(e),a=k.join(i,`_headers`);await O(a,I(),`utf-8`),r.info(`[@publier/shell] Wrote 5 header rules to dist/_headers.`);let o=R(i,n);o.pagesRewritten>0&&r.info(`[@publier/shell] Backfilled head tags on ${o.pagesRewritten} HTML file(s) (stylesheets=${Re(o.stylesheets)}, modules=${Re(o.modules)}).`);let s=ge(i,n);if(s.pagesRewritten>0&&r.info(`[@publier/shell] Injected preload tags into ${s.pagesRewritten} HTML file(s) (js=${s.jsCount}, fonts=${s.fontsCount}).`),t?.llms.enabled){let e=he(i,n,{siteName:t.siteName,siteDescription:t.siteDescription,collections:t.llms.collections});if(e.written?r.info(`[@publier/shell] Wrote dist/llms.txt (${e.pageCount} page(s)).`):e.skipped===`existing-file`?r.info(`[@publier/shell] dist/llms.txt already exists — left as-is.`):r.warn(`[@publier/shell] llms.enabled is set but no page had a <title> to index; no llms.txt written.`),t.llms.full){let e=xe(i,n,{siteName:t.siteName,siteDescription:t.siteDescription,siteUrl:t.siteUrl,collections:t.llms.collections});r.info(`[@publier/shell] Markdown exports: ${e.written} written, ${e.existing} existing; llms-full.txt ${e.fullWritten?`written`:`unchanged`}.`)}}}}}}export{L as a,fe as i,Z as n,Le as r,He as t};
|
package/dist/integration.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as hoistMediaOutOfUtilitiesLayer, a as DocsSidebarMetaOverride, c as NavCta, d as NavPathRule, f as NavProduct, g as docsShell, h as SiteConfig, i as DocsShellOptions, l as NavItem, m as SidebarAnchorConfig, n as DocVersionConfig, o as LlmsConfig, p as NavVariant, r as DocsConfig, s as NavConfig, t as AnnouncementConfig, u as NavLink, v as publierCascadeHoistPlugin } from "./integration-
|
|
1
|
+
import { _ as hoistMediaOutOfUtilitiesLayer, a as DocsSidebarMetaOverride, c as NavCta, d as NavPathRule, f as NavProduct, g as docsShell, h as SiteConfig, i as DocsShellOptions, l as NavItem, m as SidebarAnchorConfig, n as DocVersionConfig, o as LlmsConfig, p as NavVariant, r as DocsConfig, s as NavConfig, t as AnnouncementConfig, u as NavLink, v as publierCascadeHoistPlugin } from "./integration-B1mMNT__.mjs";
|
|
2
2
|
export { AnnouncementConfig, DocVersionConfig, DocsConfig, DocsShellOptions, DocsSidebarMetaOverride, LlmsConfig, NavConfig, NavCta, NavItem, NavLink, NavPathRule, NavProduct, NavVariant, SidebarAnchorConfig, SiteConfig, docsShell, hoistMediaOutOfUtilitiesLayer, publierCascadeHoistPlugin };
|
package/dist/integration.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./integration-
|
|
1
|
+
import{n as e,r as t,t as n}from"./integration-Cr0RiYaz.mjs";export{n as docsShell,e as hoistMediaOutOfUtilitiesLayer,t as publierCascadeHoistPlugin};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"@publier/native";import{
|
|
1
|
+
import e from"@publier/native";import{toMarkdown as t}from"mdast-util-to-markdown";import{directiveToMarkdown as n}from"mdast-util-directive";import{visit as r}from"unist-util-visit";const i=()=>t=>{t.children=JSON.parse(e.remarkTransformAsides(JSON.stringify(t))).children};function a(e,r,i){let a=t(e,{extensions:[n()]});a.at(-1)===`
|
|
2
2
|
`&&(a=a.slice(0,-1));let o={type:`text`,value:a};e.type===`textDirective`?i.children[r]=o:i.children[r]={type:`paragraph`,children:[o]}}const o=()=>e=>{r(e,(e,t,n)=>{t!==void 0&&n&&(e.type===`textDirective`||e.type===`leafDirective`)&&e.data===void 0&&a(e,t,n)})};export{i as remarkAsides,o as remarkDirectivesRestoration};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@publier/shell",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "Qwik + Astro docs layout for Publier sites.",
|
|
6
6
|
"type": "module",
|
|
@@ -119,11 +119,14 @@
|
|
|
119
119
|
"@github/details-menu-element": "^1.0.13",
|
|
120
120
|
"@github/relative-time-element": "^5.3.1",
|
|
121
121
|
"@github/tab-container-element": "^4.9.0",
|
|
122
|
-
"@publier/native": "8.0.
|
|
122
|
+
"@publier/native": "8.0.3",
|
|
123
123
|
"@tailwindcss/typography": "^0.5.20",
|
|
124
124
|
"astro-pagefind": "^2.0.1",
|
|
125
125
|
"daisyui": "^5.7.22",
|
|
126
126
|
"hastscript": "^9.0.1",
|
|
127
|
+
"hast-util-from-html": "^2.0.3",
|
|
128
|
+
"hast-util-to-mdast": "^10.1.2",
|
|
129
|
+
"mdast-util-gfm": "^3.1.0",
|
|
127
130
|
"katex": "^0.18.4",
|
|
128
131
|
"mdast-util-directive": "^3.1.0",
|
|
129
132
|
"mdast-util-from-markdown": "^2.0.3",
|
|
@@ -9,11 +9,11 @@ import { navConfig, type NavVariant } from 'virtual:publier-nav-config';
|
|
|
9
9
|
import { site } from 'virtual:publier-site';
|
|
10
10
|
import '../styles/expressive-code.css';
|
|
11
11
|
export async function getStaticPaths() {
|
|
12
|
-
return (await getCollection('docs')).map((entry) => ({ params: { slug: entry.id.replace(/\.(mdx?|md)$/, '').replace(/\/index$/, '').replace(/^index$/, '') || undefined }, props: { entry } }));
|
|
12
|
+
return (await getCollection('docs', ({ data }) => import.meta.env.DEV || !data.draft)).map((entry) => ({ params: { slug: entry.id.replace(/\.(mdx?|md)$/, '').replace(/\/index$/, '').replace(/^index$/, '') || undefined }, props: { entry } }));
|
|
13
13
|
}
|
|
14
14
|
const { entry } = Astro.props;
|
|
15
15
|
const { Content, headings } = await render(entry);
|
|
16
|
-
const all = await getCollection('docs');
|
|
16
|
+
const all = await getCollection('docs', ({ data }) => import.meta.env.DEV || !data.draft);
|
|
17
17
|
const configuredNav = navConfig.variants.docs;
|
|
18
18
|
const tabSections = [...new Set([
|
|
19
19
|
...docsConfig.tabSections,
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import{remarkAsides as e,remarkDirectivesRestoration as t}from"./plugins/remark-asides.mjs";import n from"./plugins/remark-snippets.mjs";import r from"./plugins/remark-vars.mjs";import{CODE_GROUP_SYNC_SCRIPT as i}from"./runtime/code-group-sync.mjs";import{TABS_SYNC_SCRIPT as a}from"./runtime/tabs-sync.mjs";import{publierCssPlugin as o,publierThemeCssPlugin as s}from"./tailwind/css-plugin.mjs";import{createRequire as c}from"node:module";import{configResolveShellConfig as l,contentGenerateLlmsTxt as u,generateAnalyticsScripts as d,shellAnnouncementBannerScript as f,shellBuildHeaders as p,shellBuildLicenseErrorMessage as ee,shellCacheControl as m,shellCollectTailwindClassTokens as h,shellComposeTailwindEntry as g,shellLazyUpgradeScript as _,shellOpenInAiScript as v,shellPlanDefaultRoutes as te,shellPlanRehypePlugins as ne,shellPlanRemarkPlugins as re,shellResolvePrefetch as ie,shellResolveSnippetsConfig as ae,shellRewriteHead as y,shellRewriteModulepreload as b,shellSearchButtonScript as x,shellSearchDialogScript as oe,shellTableOfContentsScript as S,verifyLicense as se}from"@publier/native";import{existsSync as C,mkdirSync as w,readFileSync as T,readdirSync as E,writeFileSync as D}from"node:fs";import{writeFile as O}from"node:fs/promises";import k from"node:path";import{fileURLToPath as ce}from"node:url";import{fontProviders as A}from"astro/config";import le from"rehype-autolink-headings";import ue from"rehype-external-links";import j from"remark-directive";const M=/^\/(?:_astro|assets|build)\//;function N(){return p()}function P(e){return m(e)}function F(e,t){let n=t.map(e=>e.pathname),r=y(e,n);return{stylesheetsCount:r.stylesheetsCount,modulesCount:r.modulesCount,pagesRewritten:r.pagesRewritten,stylesheets:r.stylesheets,modules:r.modules}}const I={"&":`&`,"<":`<`,">":`>`,""":`"`,"'":`'`,"'":`'`," ":` `};function L(e){return e.replace(/&(?:amp|lt|gt|quot|apos|nbsp|#39);/g,e=>I[e]??e)}function R(e,t){let n=t.exec(e);if(!n?.[1])return;let r=L(n[1]).replace(/\s+/g,` `).trim();return r.length>0?r:void 0}function z(e,t){let n=t.replace(/^\/+/,``).replace(/\/+$/,``);return(n?[k.join(e,n,`index.html`),k.join(e,`${n}.html`)]:[k.join(e,`index.html`)]).find(e=>C(e))}function B(e){let[t]=e.replace(/^\/+/,``).split(`/`);return t&&t.length>0?t:void 0}const V=new Set([`/404`,`/500`]);function H(e){return e.replace(/\/+$/,``)||`/`}function U(e){return/<meta[^>]+name=["']robots["'][^>]*noindex/i.test(e)}function W(e,t){let n=[],r=new Set;for(let{pathname:i}of t){let t=i.startsWith(`/`)?i:`/${i}`;if(r.has(t)||V.has(H(t)))continue;let a=z(e,i);if(!a)continue;let o;try{o=T(a,`utf-8`)}catch{continue}if(U(o))continue;let s=R(o,/<title[^>]*>([\s\S]*?)<\/title>/i);s&&(r.add(t),n.push({url:t,title:s,description:R(o,/<meta\s+name=["']description["']\s+content=["']([^"']*)["']/i)??R(o,/<meta\s+content=["']([^"']*)["']\s+name=["']description["']/i),collection:B(i)}))}return n.sort((e,t)=>e.url.localeCompare(t.url))}function G(e,t,n){let r=k.join(e,`llms.txt`);if(C(r))return{written:!1,pageCount:0,skipped:`existing-file`};let i=W(e,t);if(i.length===0)return{written:!1,pageCount:0,skipped:`no-pages`};let a=u(JSON.stringify({siteName:n.siteName,siteDescription:n.siteDescription,pages:i,collections:n.collections}));return D(r,a,`utf-8`),{written:!0,pageCount:i.length}}function de(e,t){let n=t.map(e=>e.pathname),r=b(e,n);return{jsCount:r.jsCount,fontsCount:r.fontsCount,pagesRewritten:r.pagesRewritten}}const fe={enabled:!1,full:!1,collections:[]};function pe(e){let t=l(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(`
|
|
2
|
-
`)}`)}return{...n,announcement:n.announcement??null,llms:n.llms??fe}}function me(e){let t=k.join(e,`publier.config.yaml`);if(!C(t))return null;try{return T(t,`utf-8`)}catch{return null}}function K(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]}:(K(t),t))}function he(){return K}function ge(e,t){let n=c(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 _e(e,t){let n=c(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 ve(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(j);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 ye(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([le,e.options]);break;case`rehype-external-links`:r.push([ue,e.options]);break;case`rehype-katex`:t&&r.push(t.rehypeKatex)}return r}async function be(e,t,n,r){if(e.mermaid===!1||t.some(e=>e.name===`astro-mermaid`))return;let i=c(import.meta.url),a=i(`node:fs`),o=i(`node:path`),{pathToFileURL:s}=i(`node:url`),l=o.join(n,`node_modules/astro-mermaid`),u;try{let e=JSON.parse(a.readFileSync(o.join(l,`package.json`),`utf8`)),t=e.exports?.[`.`]?.import??e.main;if(!t)return;u=o.join(l,t)}catch{return}let d=Function(`url`,`return import(url)`),f;try{f=await d(s(u).href)}catch{return}r({integrations:[(f.default??f)({autoTheme:!0})]})}const xe=_();function Se({root:e,mathEnabled:t}){let n=c(import.meta.url),r=t=>{try{return k.dirname(n.resolve(`${t}/package.json`,{paths:[e]}))}catch{return null}},i=(e,t)=>{let n=r(e);return n?{abs_path:k.join(n,t).split(k.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(k.sep).join(`/`)}catch{o=null}let s=g(JSON.stringify(a),o??void 0),l=h(),u=k.join(e,`.astro`);if(l.length>0){C(u)||w(u,{recursive:!0});let e=k.join(u,`publier-class-safelist.html`),t=l.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(`
|
|
3
|
-
`);D(e,r,`utf8`);let i=e.split(k.sep).join(`/`);s+=`@source "${i}";\n`}let d=k.join(u,`publier-tailwind-entry.css`);return(C(d)?T(d,`utf8`):``)!==s&&(w(u,{recursive:!0}),D(d,s)),d}function Ce(e,t,n){if(q(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 q(e){for(let t of e){if(!t)continue;if(Array.isArray(t)){if(q(t))return!0;continue}let e=t.name;if(typeof e==`string`&&e.startsWith(`@tailwindcss/vite`))return!0}return!1}function we(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(k.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(`
|
|
4
|
-
if (import.meta.hot) {
|
|
5
|
-
import.meta.hot.accept();
|
|
6
|
-
}
|
|
7
|
-
`)})}}}const J=`import 'astro:scripts/page-ssr.js';
|
|
8
|
-
`;function Te(){return{name:`publier-dev-page-ssr-propagation`,apply:`serve`,enforce:`post`,transform(e,t){let n=t.split(`?`)[0];return!n.endsWith(`.astro`)||!n.includes(`/src/pages/`)||e.includes(J)?null:{code:J+e,map:null}}}}function Y(e,t){let n=e[t];if(n===`\\`&&t+1<e.length)return t+2;if(n===`"`||n===`'`){let r=n,i=t+1;for(;i<e.length&&e[i]!==r;)e[i]===`\\`&&i+1<e.length?i+=2:i++;return i+1}if(n===`/`&&e[t+1]===`*`){let n=e.indexOf(`*/`,t+2);return n===-1?e.length:n+2}return t}function X(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=Y(e,r);if(t!==r){r=t;continue}let i=e[r];i===`{`?n++:i===`}`&&n--,r++}return r}function Z(e){let t=[],n=(r,i)=>{let a=r,o=``,s=r;for(;a<i;){let r=Y(e,a);if(r!==a){a=r;continue}let c=e[a];if(c===`@`&&e.startsWith(`@media`,a)&&/[\s(]/.test(e[a+6]??``)){let n=e.indexOf(`{`,a);if(n===-1||n>=i){a++;continue}let r=X(e,n);o+=e.slice(s,a),t.push(e.slice(a,r)),a=r,s=a;continue}if(c===`{`){let t=X(e,a);if(t>i)break;let r=n(a+1,t-1);o+=e.slice(s,a+1)+r+`}`,a=t,s=a;continue}a++}return o+=e.slice(s,i),o},r=0,i=``;for(;r<e.length;){let t=Y(e,r);if(t!==r){r=t;continue}let a=e.indexOf(`@layer utilities`,r);if(a===-1){i+=e.slice(r);break}let o=e[a+16];if(o!==` `&&o!==` `&&o!==`
|
|
9
|
-
`&&o!==`\r`&&o!==`{`){r=a+16;continue}let s=r,c=!1;for(;s<a;){let t=Y(e,s);if(t!==s){if(t>a){c=!0,r=t;break}s=t}else s++}if(c)continue;let l=e.indexOf(`{`,a);if(l===-1){i+=e.slice(r);break}i+=e.slice(r,l+1);let u=X(e,l);i+=n(l+1,u-1),i+=`}`,r=u}return t.length>0&&(i.endsWith(`
|
|
10
|
-
`)||(i+=`
|
|
11
|
-
`),i+=t.join(`
|
|
12
|
-
`),i.endsWith(`
|
|
13
|
-
`)||(i+=`
|
|
14
|
-
`)),i}function Ee(){return{name:`publier-cascade-hoist`,enforce:`post`,transform(e,t){if(!t.endsWith(`.css`)&&!t.includes(`.css?`))return null;let n=Z(e);return n===e?null:{code:n,map:null}},generateBundle(e,t){for(let e of Object.keys(t)){if(!e.endsWith(`.css`))continue;let n=t[e];if(!n||n.type!==`asset`)continue;let r=typeof n.source==`string`?n.source:new TextDecoder().decode(n.source),i=Z(r);i!==r&&(n.source=i)}}}}function Q(e,t,n){let r=`\0${e}`,i=`export const ${t} = ${JSON.stringify(n)};`;return{name:`publier-${e.replace(/^virtual:publier-/,``)}`,resolveId(t){if(t===e)return r},load(e){if(e===r)return i}}}function De(e,t=6){return e.length===0?`[]`:e.length<=t?`[${e.join(`, `)}]`:`[${e.slice(0,t).join(`, `)}, +${e.length-t} more]`}function Oe(e){let t=[`import '@publier/shell/runtime/marketing-nav';`,xe,a,i,`
|
|
15
|
-
(() => {
|
|
16
|
-
if (customElements.get('publier-table-scroll')) return;
|
|
17
|
-
class PublierTableScroll extends HTMLElement {
|
|
18
|
-
observer;
|
|
19
|
-
frame;
|
|
20
|
-
connectedCallback() {
|
|
21
|
-
|
|
22
|
-
this.frame = requestAnimationFrame(() => {
|
|
23
|
-
if (!this.isConnected) return;
|
|
24
|
-
this.observer = new ResizeObserver(() => this.update());
|
|
25
|
-
this.observer.observe(this);
|
|
26
|
-
const table = this.querySelector('table');
|
|
27
|
-
if (table) this.observer.observe(table);
|
|
28
|
-
this.update();
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
disconnectedCallback() {
|
|
32
|
-
cancelAnimationFrame(this.frame);
|
|
33
|
-
this.observer?.disconnect();
|
|
34
|
-
}
|
|
35
|
-
update() {
|
|
36
|
-
if (this.clientWidth > 0 && this.scrollWidth > this.clientWidth) {
|
|
37
|
-
this.setAttribute('tabindex', '0');
|
|
38
|
-
this.setAttribute('role', 'region');
|
|
39
|
-
this.setAttribute('aria-label', this.querySelector('caption')?.textContent.trim() || 'Scrollable table');
|
|
40
|
-
} else {
|
|
41
|
-
this.removeAttribute('tabindex');
|
|
42
|
-
this.removeAttribute('role');
|
|
43
|
-
this.removeAttribute('aria-label');
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
customElements.define('publier-table-scroll', PublierTableScroll);
|
|
48
|
-
})();
|
|
49
|
-
`,f(),v(),S()];return e.searchEnabled&&t.push(oe(),x()),t.join(`
|
|
50
|
-
`)}function ke(e,t){let n=[],r=[],i=[];for(let a of[`heading`,`body`,`mono`]){let o=e[a];if(!o?.family)continue;let s=`--publier-font-${a}`,c=a===`mono`?[`monospace`]:[`system-ui`,`sans-serif`],l=[o.weight??`400`],u=[o.style??`normal`];if(o.googleFontsUrl)n.push({name:o.family,cssVariable:s,provider:A.google(),fallbacks:c,weights:l,styles:u,subsets:[`latin`]}),r.push(a);else if(o.src){let e=k.isAbsolute(o.src)&&C(o.src)?o.src:k.join(t,`public`,o.src.replace(/^\/+/,``));n.push({name:o.family,cssVariable:s,provider:A.local(),fallbacks:c,weights:l,styles:u,subsets:[`latin`],options:{variants:[{weight:l[0],style:u[0],src:[e]}]}}),r.push(a)}else i.push(`${s}:"${o.family}",${c.join(`,`)};`)}return{entries:n,familyOnlyCss:i.length?`:root{${i.join(``)}}`:``,slots:r}}const Ae=[{pkg:`astro-expressive-code`,aliases:[`astro-expressive-code`]},{pkg:`@astrojs/mdx`,aliases:[`@astrojs/mdx`]},{pkg:`@astrojs/sitemap`,aliases:[`@astrojs/sitemap`]},{pkg:`astro-pagefind`,aliases:[`astro-pagefind`,`pagefind`]},{pkg:`@qwik.dev/astro`,aliases:[`@qwik.dev/astro`]}];function $(e,t){let n=k.join(e,`src`,`content`,t);if(!C(n))return!1;try{return E(n,{recursive:!0}).some(e=>typeof e==`string`&&/\.mdx?$/.test(e))}catch{return!1}}function je(e={}){let t=null;return{name:`@publier/shell`,hooks:{"astro:config:setup":async({config:n,updateConfig:r,injectScript:i,injectRoute:a,logger:l})=>{let u=n.root?ce(n.root):process.cwd();try{se()}catch(e){let t=e instanceof Error?e.message:String(e),n=ee(t);throw n?Error(n):e}let f=c(k.join(u,`package.json`)),p=JSON.stringify(e),m=pe(me(u)??``),h=m.site;t={llms:m.llms,siteName:h.name,siteDescription:h.description??void 0};let g=m.vars,_=m.fonts,v=m.nav,y=m.announcement,b=m.docs,x=typeof h.url==`string`&&h.url.length>0;x&&!n.site&&r({site:h.url});let oe=new Set(n.integrations.map(e=>e.name)),S=Ae.filter(({aliases:e})=>!e.some(e=>oe.has(e)));S.length>0&&l.warn(`[@publier/shell] Required framework integrations are not registered in
|
|
51
|
-
astro.config.ts. As of @publier/shell@2.0.0, docsShell() no longer
|
|
52
|
-
auto-wires these. Add the following to your integrations[] array
|
|
53
|
-
(import statements + entries shown). Order matters: docsShell() must
|
|
54
|
-
come FIRST (astro-expressive-code >=0.43 registers into the Markdown
|
|
55
|
-
processor it finds at its own setup — docsShell's pinned unified()
|
|
56
|
-
processor must already be in place), and expressive-code must precede
|
|
57
|
-
mdx.
|
|
58
|
-
|
|
59
|
-
import expressiveCode from 'astro-expressive-code';
|
|
60
|
-
import mdx from '@astrojs/mdx';
|
|
61
|
-
import sitemap from '@astrojs/sitemap';
|
|
62
|
-
import pagefind from 'astro-pagefind';
|
|
63
|
-
import qwik from '@qwik.dev/astro';
|
|
64
|
-
|
|
65
|
-
integrations: [
|
|
66
|
-
docsShell({ /* options */ }),
|
|
67
|
-
expressiveCode(),
|
|
68
|
-
mdx(),
|
|
69
|
-
sitemap(),
|
|
70
|
-
pagefind(),
|
|
71
|
-
qwik({ clientRouter: true }),
|
|
72
|
-
]
|
|
73
|
-
|
|
74
|
-
Missing:\n ${S.map(e=>e.pkg).join(`
|
|
75
|
-
`)}\n`);let w=n.prefetch;ie(w===void 0?void 0:JSON.stringify(w),p)&&r({prefetch:{prefetchAll:!0,defaultStrategy:`viewport`}});let{entries:T,familyOnlyCss:E,slots:D}=_?ke(_,u):{entries:[],familyOnlyCss:``,slots:[]},O=m.snippets??null,le=O==null?null:O===!1?`false`:JSON.stringify(O),ue=ae(p,le??void 0,C(k.join(u,`content/snippets`))),j=JSON.parse(ue),M={...e,snippets:j===null?void 0:j},N=JSON.stringify(M),P=e.math!==!1,F=P?ge(f,l):null,I=re(N,!!(g&&Object.keys(g).length>0),j!==null&&j!==!1,P&&F!==null),L=ne(p,P&&F!==null),R=ve(I,g,F),z=ye(L,F),B=_e(f,l);await be(e,n.integrations,u,r);let V=Se({root:u,mathEnabled:P}),H=Oe({searchEnabled:e.search!==!1}),U=JSON.stringify({docs:$(u,`docs`),blog:$(u,`blog`),changelog:$(u,`changelog`)}),W=JSON.parse(te(p,x,U)),G=W.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(B){let e=n.markdown?.processor,t=e?.options?.hastPlugins;e?.name!==`unified`&&Array.isArray(t)&&t.length>0&&l.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.`)}r({markdown:B?{processor:B({remarkPlugins:R,rehypePlugins:z})}:{remarkPlugins:[...R],rehypePlugins:[...z]},vite:{ssr:{noExternal:[`@publier/shell`],external:[`@publier/native`]},build:{rollupOptions:{external:[`@publier/native`]}},optimizeDeps:{exclude:[`@publier/shell`,`@publier/native`]},plugins:[...Ce(f,l,n.vite?.plugins??[]),s({root:u}),o({root:u}),Q(`virtual:publier-nav-config`,`navConfig`,v),we({entryPath:V}),Te(),Q(`virtual:publier-announcement`,`announcement`,y),Q(`virtual:publier-site`,`site`,h),Q(`virtual:publier-docs-config`,`docsConfig`,b),Q(`virtual:publier-appearance`,`appearance`,m.appearance),Q(`virtual:publier-feeds`,`feeds`,G),Q(`virtual:publier-fonts`,`fonts`,{slots:D}),Ee()]}}),r({fonts:[{name:`Inter Variable`,cssVariable:`--publier-font-builtin-sans`,provider:A.npm({remote:!1}),fallbacks:[`system-ui`,`sans-serif`],weights:[`100 900`],styles:[`normal`],subsets:[`latin`],options:{package:`@fontsource-variable/inter`}},{name:`JetBrains Mono Variable`,cssVariable:`--publier-font-builtin-mono`,provider:A.npm({remote:!1}),fallbacks:[`monospace`],weights:[`100 800`],styles:[`normal`],subsets:[`latin`],options:{package:`@fontsource-variable/jetbrains-mono`}},...T]}),i(`page-ssr`,[`import ${JSON.stringify(V)};`,`import 'virtual:publier-theme-css';`,`import 'virtual:publier-custom-css';`,`import '@publier/shell/styles/base.css';`].join(`
|
|
76
|
-
`)),i(`page`,H),i(`head-inline`,`(function(){
|
|
77
|
-
if (typeof window === 'undefined' || !window.sessionStorage || !window.fetch) return;
|
|
78
|
-
var store = window.sessionStorage;
|
|
79
|
-
var ResponseCtor = window.Response;
|
|
80
|
-
var origFetch = window.fetch.bind(window);
|
|
81
|
-
var NS = 'publier:bg:';
|
|
82
|
-
var PATTERN = /^\\/(?:_astro|assets|build)\\/(?:[^\\/]*bundle-graph[^\\/]*\\.json|q-manifest[^\\/]*\\.json)(?:\\?.*)?$/;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
var inflight = Object.create(null);
|
|
88
|
-
function serve(body){
|
|
89
|
-
return new ResponseCtor(body, {
|
|
90
|
-
status: 200,
|
|
91
|
-
headers: { 'content-type': 'application/json' }
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
window.fetch = function(input, init){
|
|
95
|
-
var url = typeof input === 'string' ? input : (input && input.url) || '';
|
|
96
|
-
var method = (init && init.method) || (input && input.method) || 'GET';
|
|
97
|
-
if (!url || method !== 'GET' || !PATTERN.test(url)) {
|
|
98
|
-
return origFetch(input, init);
|
|
99
|
-
}
|
|
100
|
-
var key = NS + url;
|
|
101
|
-
|
|
102
|
-
try {
|
|
103
|
-
var hit = store.getItem(key);
|
|
104
|
-
if (hit !== null) return Promise.resolve(serve(hit));
|
|
105
|
-
} catch (_) {}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (inflight[url]) return inflight[url].then(serve);
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
var pending = origFetch(input, init).then(function(res){
|
|
112
|
-
if (res && res.ok) {
|
|
113
|
-
return res.clone().text().then(function(body){
|
|
114
|
-
try { store.setItem(key, body); } catch (_) {}
|
|
115
|
-
delete inflight[url];
|
|
116
|
-
return res;
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
delete inflight[url];
|
|
120
|
-
return res;
|
|
121
|
-
}, function(err){
|
|
122
|
-
delete inflight[url];
|
|
123
|
-
throw err;
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
inflight[url] = pending.then(function(res){
|
|
127
|
-
return res && res.ok ? res.clone().text() : '';
|
|
128
|
-
});
|
|
129
|
-
return pending;
|
|
130
|
-
};
|
|
131
|
-
})();`),E&&i(`head-inline`,`
|
|
132
|
-
const _pFonts = document.createElement('style');
|
|
133
|
-
_pFonts.textContent = ${JSON.stringify(E)};
|
|
134
|
-
document.head.appendChild(_pFonts);
|
|
135
|
-
`);{let e=m.analytics;if(e){let t=d(e);t&&i(`head-inline`,`
|
|
136
|
-
const _pAnalytics = document.createRange().createContextualFragment(${JSON.stringify(t)});
|
|
137
|
-
document.head.appendChild(_pAnalytics);
|
|
138
|
-
`)}}for(let e of W)a({pattern:e.pattern,entrypoint:e.entrypoint,prerender:e.prerender});W.length>0&&l.info(`[@publier/shell] Injected default routes: ${W.map(e=>e.pattern).join(`, `)}.`),l.info(`[@publier/shell] Plugin pipeline wired.`)},"astro:build:done":async({dir:e,pages:n,logger:r})=>{let i=ce(e),a=k.join(i,`_headers`);await O(a,N(),`utf-8`),r.info(`[@publier/shell] Wrote 5 header rules to dist/_headers.`);let o=F(i,n);o.pagesRewritten>0&&r.info(`[@publier/shell] Backfilled head tags on ${o.pagesRewritten} HTML file(s) (stylesheets=${De(o.stylesheets)}, modules=${De(o.modules)}).`);let s=de(i,n);if(s.pagesRewritten>0&&r.info(`[@publier/shell] Injected preload tags into ${s.pagesRewritten} HTML file(s) (js=${s.jsCount}, fonts=${s.fontsCount}).`),t?.llms.enabled){let e=G(i,n,{siteName:t.siteName,siteDescription:t.siteDescription,collections:t.llms.collections});e.written?r.info(`[@publier/shell] Wrote dist/llms.txt (${e.pageCount} page(s)).`):e.skipped===`existing-file`?r.info(`[@publier/shell] dist/llms.txt already exists — left as-is.`):r.warn(`[@publier/shell] llms.enabled is set but no page had a <title> to index; no llms.txt written.`),t.llms.full&&r.warn("[@publier/shell] llms.full is not implemented yet — llms-full.txt was NOT written. Only llms.txt is generated; unset `llms.full` to silence this.")}}}}}export{P as a,M as i,Z as n,Ee as r,je as t};
|