@publier/shell 3.4.0 → 3.4.1
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 +1 -1
- package/dist/integration-CtaVlGLq.mjs +103 -0
- package/dist/integration.mjs +1 -1
- package/package.json +1 -1
- package/dist/integration-CKHJHg7C.mjs +0 -103
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-CtaVlGLq.mjs";export{t as HASHED_ASSET_RE,n as docsShell,e as publierCacheControl};
|
|
@@ -0,0 +1,103 @@
|
|
|
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 S,shellTableOfContentsScript as C,verifyLicense as oe}from"@publier/native";import{existsSync as w,mkdirSync as T,readFileSync as E,readdirSync as D,writeFileSync as O}from"node:fs";import{writeFile as k}from"node:fs/promises";import A from"node:path";import{fileURLToPath as j}from"node:url";import{fontProviders as M}from"astro/config";import se from"rehype-autolink-headings";import ce from"rehype-external-links";import N from"remark-directive";const P=/^\/(?:_astro|assets|build)\//;function F(){return p()}function I(e){return m(e)}function L(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 R={"&":`&`,"<":`<`,">":`>`,""":`"`,"'":`'`,"'":`'`," ":` `};function z(e){return e.replace(/&(?:amp|lt|gt|quot|apos|nbsp|#39);/g,e=>R[e]??e)}function B(e,t){let n=t.exec(e);if(!n?.[1])return;let r=z(n[1]).replace(/\s+/g,` `).trim();return r.length>0?r:void 0}function V(e,t){let n=t.replace(/^\/+/,``).replace(/\/+$/,``);return(n?[A.join(e,n,`index.html`),A.join(e,`${n}.html`)]:[A.join(e,`index.html`)]).find(e=>w(e))}function H(e){let[t]=e.replace(/^\/+/,``).split(`/`);return t&&t.length>0?t:void 0}const U=new Set([`/404`,`/500`]);function W(e){return e.replace(/\/+$/,``)||`/`}function G(e){return/<meta[^>]+name=["']robots["'][^>]*noindex/i.test(e)}function K(e,t){let n=[],r=new Set;for(let{pathname:i}of t){let t=i.startsWith(`/`)?i:`/${i}`;if(r.has(t)||U.has(W(t)))continue;let a=V(e,i);if(!a)continue;let o;try{o=E(a,`utf-8`)}catch{continue}if(G(o))continue;let s=B(o,/<title[^>]*>([\s\S]*?)<\/title>/i);s&&(r.add(t),n.push({url:t,title:s,description:B(o,/<meta\s+name=["']description["']\s+content=["']([^"']*)["']/i)??B(o,/<meta\s+content=["']([^"']*)["']\s+name=["']description["']/i),collection:H(i)}))}return n.sort((e,t)=>e.url.localeCompare(t.url))}function q(e,t,n){let r=A.join(e,`llms.txt`);if(w(r))return{written:!1,pageCount:0,skipped:`existing-file`};let i=K(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 O(r,a,`utf-8`),{written:!0,pageCount:i.length}}function le(e,t){let n=t.map(e=>e.pathname),r=b(e,n);return{jsCount:r.jsCount,fontsCount:r.fontsCount,pagesRewritten:r.pagesRewritten}}const ue={enabled:!1,full:!1,collections:[]};function de(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??ue}}function fe(e){let t=A.join(e,`publier.config.yaml`);if(!w(t))return null;try{return E(t,`utf-8`)}catch{return null}}function pe(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 me(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 he(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(N);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 ge(e,t){let n=JSON.parse(e),r=[];for(let e of n)switch(e.id){case`rehype-autolink-headings`:r.push([se,e.options]);break;case`rehype-external-links`:r.push([ce,e.options]);break;case`rehype-katex`:t&&r.push(t.rehypeKatex)}return r}async function _e(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 ve=_();function ye({root:e,mathEnabled:t}){let n=c(import.meta.url),r=t=>{try{return A.dirname(n.resolve(`${t}/package.json`,{paths:[e]}))}catch{return null}},i=(e,t)=>{let n=r(e);return n?{abs_path:A.join(n,t).split(A.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(A.sep).join(`/`)}catch{o=null}let s=g(JSON.stringify(a),o??void 0),l=h(),u=A.join(e,`.astro`);if(l.length>0){w(u)||T(u,{recursive:!0});let e=A.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
|
+
`);O(e,r,`utf8`);let i=e.split(A.sep).join(`/`);s+=`@source "${i}";\n`}let d=A.join(u,`publier-tailwind-entry.css`);return(w(d)?E(d,`utf8`):``)!==s&&(T(u,{recursive:!0}),O(d,s)),d}function be(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 xe(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(A.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 Se=`import 'astro:scripts/page-ssr.js';
|
|
8
|
+
`;function Ce(){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(Se)?null:{code:Se+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 we(){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 Te(e,t=6){return e.length===0?`[]`:e.length<=t?`[${e.join(`, `)}]`:`[${e.slice(0,t).join(`, `)}, +${e.length-t} more]`}function Ee(e){let t=[ve,a,i,f(),v(),C()];return e.searchEnabled&&t.push(S(),x()),t.join(`
|
|
15
|
+
`)}function De(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:M.google(),fallbacks:c,weights:l,styles:u,subsets:[`latin`]}),r.push(a);else if(o.src){let e=A.isAbsolute(o.src)&&w(o.src)?o.src:A.join(t,`public`,o.src.replace(/^\/+/,``));n.push({name:o.family,cssVariable:s,provider:M.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 Oe=[{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=A.join(e,`src`,`content`,t);if(!w(n))return!1;try{return D(n,{recursive:!0}).some(e=>typeof e==`string`&&/\.mdx?$/.test(e))}catch{return!1}}function ke(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?j(n.root):process.cwd();try{oe()}catch(e){let t=e instanceof Error?e.message:String(e),n=ee(t);throw n?Error(n):e}let f=c(A.join(u,`package.json`)),p=JSON.stringify(e),m=de(fe(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 S=new Set(n.integrations.map(e=>e.name)),C=Oe.filter(({aliases:e})=>!e.some(e=>S.has(e)));C.length>0&&l.warn(`[@publier/shell] Required framework integrations are not registered in
|
|
16
|
+
astro.config.ts. As of @publier/shell@2.0.0, docsShell() no longer
|
|
17
|
+
auto-wires these. Add the following to your integrations[] array
|
|
18
|
+
(import statements + entries shown). Order matters: docsShell() must
|
|
19
|
+
come FIRST (astro-expressive-code >=0.43 registers into the Markdown
|
|
20
|
+
processor it finds at its own setup — docsShell's pinned unified()
|
|
21
|
+
processor must already be in place), and expressive-code must precede
|
|
22
|
+
mdx.
|
|
23
|
+
|
|
24
|
+
import expressiveCode from 'astro-expressive-code';
|
|
25
|
+
import mdx from '@astrojs/mdx';
|
|
26
|
+
import sitemap from '@astrojs/sitemap';
|
|
27
|
+
import pagefind from 'astro-pagefind';
|
|
28
|
+
import qwik from '@qwik.dev/astro';
|
|
29
|
+
|
|
30
|
+
integrations: [
|
|
31
|
+
docsShell({ /* options */ }),
|
|
32
|
+
expressiveCode(),
|
|
33
|
+
mdx(),
|
|
34
|
+
sitemap(),
|
|
35
|
+
pagefind(),
|
|
36
|
+
qwik({ clientRouter: true }),
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
Missing:\n ${C.map(e=>e.pkg).join(`
|
|
40
|
+
`)}\n`);let T=n.prefetch;ie(T===void 0?void 0:JSON.stringify(T),p)&&r({prefetch:{prefetchAll:!0,defaultStrategy:`viewport`}});let{entries:E,familyOnlyCss:D,slots:O}=_?De(_,u):{entries:[],familyOnlyCss:``,slots:[]},k=m.snippets??null,se=k==null?null:k===!1?`false`:JSON.stringify(k),ce=ae(p,se??void 0,w(A.join(u,`content/snippets`))),N=JSON.parse(ce),P={...e,snippets:N===null?void 0:N},F=JSON.stringify(P),I=e.math!==!1,L=I?pe(f,l):null,R=re(F,!!(g&&Object.keys(g).length>0),N!==null&&N!==!1,I&&L!==null),z=ne(p,I&&L!==null),B=he(R,g,L),V=ge(z,L),H=me(f,l);await _e(e,n.integrations,u,r);let U=ye({root:u,mathEnabled:I}),W=Ee({searchEnabled:e.search!==!1}),G=JSON.stringify({docs:$(u,`docs`),blog:$(u,`blog`),changelog:$(u,`changelog`)}),K=JSON.parse(te(p,x,G)),q=K.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(H){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:H?{processor:H({remarkPlugins:B,rehypePlugins:V})}:{remarkPlugins:[...B],rehypePlugins:[...V]},vite:{ssr:{noExternal:[`@publier/shell`,`@qwik.dev/core`,`@qwik.dev/astro`],external:[`@publier/native`]},build:{rollupOptions:{external:[`@publier/native`]}},optimizeDeps:{exclude:[`@publier/shell`,`@publier/native`]},plugins:[...be(f,l,n.vite?.plugins??[]),s({root:u}),o({root:u}),Q(`virtual:publier-nav-config`,`navConfig`,v),xe({entryPath:U}),Ce(),Q(`virtual:publier-announcement`,`announcement`,y),Q(`virtual:publier-site`,`site`,h),Q(`virtual:publier-docs-config`,`docsConfig`,b),Q(`virtual:publier-feeds`,`feeds`,q),Q(`virtual:publier-fonts`,`fonts`,{slots:O}),we()]}}),r({fonts:[{name:`Inter Variable`,cssVariable:`--publier-font-builtin-sans`,provider:M.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:M.npm({remote:!1}),fallbacks:[`monospace`],weights:[`100 800`],styles:[`normal`],subsets:[`latin`],options:{package:`@fontsource-variable/jetbrains-mono`}},...E]}),i(`page-ssr`,[`import ${JSON.stringify(U)};`,`import 'virtual:publier-theme-css';`,`import 'virtual:publier-custom-css';`,`import '@publier/shell/styles/base.css';`].join(`
|
|
41
|
+
`)),i(`page`,W),i(`head-inline`,`(function(){
|
|
42
|
+
if (typeof window === 'undefined' || !window.sessionStorage || !window.fetch) return;
|
|
43
|
+
var store = window.sessionStorage;
|
|
44
|
+
var ResponseCtor = window.Response;
|
|
45
|
+
var origFetch = window.fetch.bind(window);
|
|
46
|
+
var NS = 'publier:bg:';
|
|
47
|
+
var PATTERN = /^\\/(?:_astro|assets|build)\\/(?:[^\\/]*bundle-graph[^\\/]*\\.json|q-manifest[^\\/]*\\.json)(?:\\?.*)?$/;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
var inflight = Object.create(null);
|
|
53
|
+
function serve(body){
|
|
54
|
+
return new ResponseCtor(body, {
|
|
55
|
+
status: 200,
|
|
56
|
+
headers: { 'content-type': 'application/json' }
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
window.fetch = function(input, init){
|
|
60
|
+
var url = typeof input === 'string' ? input : (input && input.url) || '';
|
|
61
|
+
var method = (init && init.method) || (input && input.method) || 'GET';
|
|
62
|
+
if (!url || method !== 'GET' || !PATTERN.test(url)) {
|
|
63
|
+
return origFetch(input, init);
|
|
64
|
+
}
|
|
65
|
+
var key = NS + url;
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
var hit = store.getItem(key);
|
|
69
|
+
if (hit !== null) return Promise.resolve(serve(hit));
|
|
70
|
+
} catch (_) {}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
if (inflight[url]) return inflight[url].then(serve);
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
var pending = origFetch(input, init).then(function(res){
|
|
77
|
+
if (res && res.ok) {
|
|
78
|
+
return res.clone().text().then(function(body){
|
|
79
|
+
try { store.setItem(key, body); } catch (_) {}
|
|
80
|
+
delete inflight[url];
|
|
81
|
+
return res;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
delete inflight[url];
|
|
85
|
+
return res;
|
|
86
|
+
}, function(err){
|
|
87
|
+
delete inflight[url];
|
|
88
|
+
throw err;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
inflight[url] = pending.then(function(res){
|
|
92
|
+
return res && res.ok ? res.clone().text() : '';
|
|
93
|
+
});
|
|
94
|
+
return pending;
|
|
95
|
+
};
|
|
96
|
+
})();`),D&&i(`head-inline`,`
|
|
97
|
+
const _pFonts = document.createElement('style');
|
|
98
|
+
_pFonts.textContent = ${JSON.stringify(D)};
|
|
99
|
+
document.head.appendChild(_pFonts);
|
|
100
|
+
`);{let e=m.analytics;if(e){let t=d(e);t&&i(`head-inline`,`
|
|
101
|
+
const _pAnalytics = document.createRange().createContextualFragment(${JSON.stringify(t)});
|
|
102
|
+
document.head.appendChild(_pAnalytics);
|
|
103
|
+
`)}}for(let e of K)a({pattern:e.pattern,entrypoint:e.entrypoint,prerender:e.prerender});K.length>0&&l.info(`[@publier/shell] Injected default routes: ${K.map(e=>e.pattern).join(`, `)}.`),l.info(`[@publier/shell] Plugin pipeline wired.`)},"astro:build:done":async({dir:e,pages:n,logger:r})=>{let i=j(e),a=A.join(i,`_headers`);await k(a,F(),`utf-8`),r.info(`[@publier/shell] Wrote 5 header rules to dist/_headers.`);let o=L(i,n);o.pagesRewritten>0&&r.info(`[@publier/shell] Backfilled head tags on ${o.pagesRewritten} HTML file(s) (stylesheets=${Te(o.stylesheets)}, modules=${Te(o.modules)}).`);let s=le(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=q(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{I as a,P as i,Z as n,we as r,ke as t};
|
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-CtaVlGLq.mjs";export{n as docsShell,e as hoistMediaOutOfUtilitiesLayer,t as publierCascadeHoistPlugin};
|
package/package.json
CHANGED
|
@@ -1,103 +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 oe,shellSearchButtonScript as b,shellSearchDialogScript as x,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 A}from"node:url";import{fontProviders as j}from"astro/config";import ce from"rehype-autolink-headings";import le from"rehype-external-links";import M from"remark-directive";const N=/^\/(?:_astro|assets|build)\//;function P(){return p()}function F(e){return m(e)}function I(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 L={"&":`&`,"<":`<`,">":`>`,""":`"`,"'":`'`,"'":`'`," ":` `};function R(e){return e.replace(/&(?:amp|lt|gt|quot|apos|nbsp|#39);/g,e=>L[e]??e)}function z(e,t){let n=t.exec(e);if(!n?.[1])return;let r=R(n[1]).replace(/\s+/g,` `).trim();return r.length>0?r:void 0}function B(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 V(e){let[t]=e.replace(/^\/+/,``).split(`/`);return t&&t.length>0?t:void 0}function H(e,t){let n=[],r=new Set;for(let{pathname:i}of t){let t=i.startsWith(`/`)?i:`/${i}`;if(r.has(t))continue;let a=B(e,i);if(!a)continue;let o;try{o=T(a,`utf-8`)}catch{continue}let s=z(o,/<title[^>]*>([\s\S]*?)<\/title>/i);s&&(r.add(t),n.push({url:t,title:s,description:z(o,/<meta\s+name=["']description["']\s+content=["']([^"']*)["']/i)??z(o,/<meta\s+content=["']([^"']*)["']\s+name=["']description["']/i),collection:V(i)}))}return n.sort((e,t)=>e.url.localeCompare(t.url))}function U(e,t,n){let r=k.join(e,`llms.txt`);if(C(r))return{written:!1,pageCount:0,skipped:`existing-file`};let i=H(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 W(e,t){let n=t.map(e=>e.pathname),r=oe(e,n);return{jsCount:r.jsCount,fontsCount:r.fontsCount,pagesRewritten:r.pagesRewritten}}const G={enabled:!1,full:!1,collections:[]};function ue(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??G}}function de(e){let t=k.join(e,`publier.config.yaml`);if(!C(t))return null;try{return T(t,`utf-8`)}catch{return null}}function fe(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 pe(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 me(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(M);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 he(e,t){let n=JSON.parse(e),r=[];for(let e of n)switch(e.id){case`rehype-autolink-headings`:r.push([ce,e.options]);break;case`rehype-external-links`:r.push([le,e.options]);break;case`rehype-katex`:t&&r.push(t.rehypeKatex)}return r}async function ge(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 K=_();function _e({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 ve(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 ye(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 be(){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 xe(){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 Se(e,t=6){return e.length===0?`[]`:e.length<=t?`[${e.join(`, `)}]`:`[${e.slice(0,t).join(`, `)}, +${e.length-t} more]`}function Ce(e){let t=[K,a,i,f(),v(),S()];return e.searchEnabled&&t.push(x(),b()),t.join(`
|
|
15
|
-
`)}function we(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:j.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:j.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 Te=[{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 Ee(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?A(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=ue(de(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,oe=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=Te.filter(({aliases:e})=>!e.some(e=>x.has(e)));S.length>0&&l.warn(`[@publier/shell] Required framework integrations are not registered in
|
|
16
|
-
astro.config.ts. As of @publier/shell@2.0.0, docsShell() no longer
|
|
17
|
-
auto-wires these. Add the following to your integrations[] array
|
|
18
|
-
(import statements + entries shown). Order matters: docsShell() must
|
|
19
|
-
come FIRST (astro-expressive-code >=0.43 registers into the Markdown
|
|
20
|
-
processor it finds at its own setup — docsShell's pinned unified()
|
|
21
|
-
processor must already be in place), and expressive-code must precede
|
|
22
|
-
mdx.
|
|
23
|
-
|
|
24
|
-
import expressiveCode from 'astro-expressive-code';
|
|
25
|
-
import mdx from '@astrojs/mdx';
|
|
26
|
-
import sitemap from '@astrojs/sitemap';
|
|
27
|
-
import pagefind from 'astro-pagefind';
|
|
28
|
-
import qwik from '@qwik.dev/astro';
|
|
29
|
-
|
|
30
|
-
integrations: [
|
|
31
|
-
docsShell({ /* options */ }),
|
|
32
|
-
expressiveCode(),
|
|
33
|
-
mdx(),
|
|
34
|
-
sitemap(),
|
|
35
|
-
pagefind(),
|
|
36
|
-
qwik({ clientRouter: true }),
|
|
37
|
-
]
|
|
38
|
-
|
|
39
|
-
Missing:\n ${S.map(e=>e.pkg).join(`
|
|
40
|
-
`)}\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}=_?we(_,u):{entries:[],familyOnlyCss:``,slots:[]},O=m.snippets??null,ce=O==null?null:O===!1?`false`:JSON.stringify(O),le=ae(p,ce??void 0,C(k.join(u,`content/snippets`))),M=JSON.parse(le),N={...e,snippets:M===null?void 0:M},P=JSON.stringify(N),F=e.math!==!1,I=F?fe(f,l):null,L=re(P,!!(g&&Object.keys(g).length>0),M!==null&&M!==!1,F&&I!==null),R=ne(p,F&&I!==null),z=me(L,g,I),B=he(R,I),V=pe(f,l);await ge(e,n.integrations,u,r);let H=_e({root:u,mathEnabled:F}),U=Ce({searchEnabled:e.search!==!1}),W=JSON.stringify({docs:$(u,`docs`),blog:$(u,`blog`),changelog:$(u,`changelog`)}),G=JSON.parse(te(p,b,W)),K=G.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(V){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:V?{processor:V({remarkPlugins:z,rehypePlugins:B})}:{remarkPlugins:[...z],rehypePlugins:[...B]},vite:{ssr:{noExternal:[`@publier/shell`,`@qwik.dev/core`,`@qwik.dev/astro`],external:[`@publier/native`]},build:{rollupOptions:{external:[`@publier/native`]}},optimizeDeps:{exclude:[`@publier/shell`,`@publier/native`]},plugins:[...ve(f,l,n.vite?.plugins??[]),s({root:u}),o({root:u}),Q(`virtual:publier-nav-config`,`navConfig`,v),ye({entryPath:H}),be(),Q(`virtual:publier-announcement`,`announcement`,y),Q(`virtual:publier-site`,`site`,h),Q(`virtual:publier-docs-config`,`docsConfig`,oe),Q(`virtual:publier-feeds`,`feeds`,K),Q(`virtual:publier-fonts`,`fonts`,{slots:D}),xe()]}}),r({fonts:[{name:`Inter Variable`,cssVariable:`--publier-font-builtin-sans`,provider:j.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:j.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(H)};`,`import 'virtual:publier-theme-css';`,`import 'virtual:publier-custom-css';`,`import '@publier/shell/styles/base.css';`].join(`
|
|
41
|
-
`)),i(`page`,U),i(`head-inline`,`(function(){
|
|
42
|
-
if (typeof window === 'undefined' || !window.sessionStorage || !window.fetch) return;
|
|
43
|
-
var store = window.sessionStorage;
|
|
44
|
-
var ResponseCtor = window.Response;
|
|
45
|
-
var origFetch = window.fetch.bind(window);
|
|
46
|
-
var NS = 'publier:bg:';
|
|
47
|
-
var PATTERN = /^\\/(?:_astro|assets|build)\\/(?:[^\\/]*bundle-graph[^\\/]*\\.json|q-manifest[^\\/]*\\.json)(?:\\?.*)?$/;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var inflight = Object.create(null);
|
|
53
|
-
function serve(body){
|
|
54
|
-
return new ResponseCtor(body, {
|
|
55
|
-
status: 200,
|
|
56
|
-
headers: { 'content-type': 'application/json' }
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
window.fetch = function(input, init){
|
|
60
|
-
var url = typeof input === 'string' ? input : (input && input.url) || '';
|
|
61
|
-
var method = (init && init.method) || (input && input.method) || 'GET';
|
|
62
|
-
if (!url || method !== 'GET' || !PATTERN.test(url)) {
|
|
63
|
-
return origFetch(input, init);
|
|
64
|
-
}
|
|
65
|
-
var key = NS + url;
|
|
66
|
-
|
|
67
|
-
try {
|
|
68
|
-
var hit = store.getItem(key);
|
|
69
|
-
if (hit !== null) return Promise.resolve(serve(hit));
|
|
70
|
-
} catch (_) {}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (inflight[url]) return inflight[url].then(serve);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var pending = origFetch(input, init).then(function(res){
|
|
77
|
-
if (res && res.ok) {
|
|
78
|
-
return res.clone().text().then(function(body){
|
|
79
|
-
try { store.setItem(key, body); } catch (_) {}
|
|
80
|
-
delete inflight[url];
|
|
81
|
-
return res;
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
delete inflight[url];
|
|
85
|
-
return res;
|
|
86
|
-
}, function(err){
|
|
87
|
-
delete inflight[url];
|
|
88
|
-
throw err;
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
inflight[url] = pending.then(function(res){
|
|
92
|
-
return res && res.ok ? res.clone().text() : '';
|
|
93
|
-
});
|
|
94
|
-
return pending;
|
|
95
|
-
};
|
|
96
|
-
})();`),E&&i(`head-inline`,`
|
|
97
|
-
const _pFonts = document.createElement('style');
|
|
98
|
-
_pFonts.textContent = ${JSON.stringify(E)};
|
|
99
|
-
document.head.appendChild(_pFonts);
|
|
100
|
-
`);{let e=m.analytics;if(e){let t=d(e);t&&i(`head-inline`,`
|
|
101
|
-
const _pAnalytics = document.createRange().createContextualFragment(${JSON.stringify(t)});
|
|
102
|
-
document.head.appendChild(_pAnalytics);
|
|
103
|
-
`)}}for(let e of G)a({pattern:e.pattern,entrypoint:e.entrypoint,prerender:e.prerender});G.length>0&&l.info(`[@publier/shell] Injected default routes: ${G.map(e=>e.pattern).join(`, `)}.`),l.info(`[@publier/shell] Plugin pipeline wired.`)},"astro:build:done":async({dir:e,pages:n,logger:r})=>{let i=A(e),a=k.join(i,`_headers`);await O(a,P(),`utf-8`),r.info(`[@publier/shell] Wrote 5 header rules to dist/_headers.`);let o=I(i,n);o.pagesRewritten>0&&r.info(`[@publier/shell] Backfilled head tags on ${o.pagesRewritten} HTML file(s) (stylesheets=${Se(o.stylesheets)}, modules=${Se(o.modules)}).`);let s=W(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=U(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{F as a,N as i,Z as n,xe as r,Ee as t};
|