@publier/shell 2.1.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/README.md +1 -0
- package/dist/build-integration.d.mts +7 -0
- package/dist/build-integration.mjs +1 -0
- package/dist/index-DWtFsw7E.d.mts +1033 -0
- package/dist/index.d.mts +33 -0
- package/dist/index.mjs +1 -0
- package/dist/integration-BIJIcnAT.mjs +99 -0
- package/dist/integration-CKjtSkwa.d.mts +183 -0
- package/dist/integration.d.mts +2 -0
- package/dist/integration.mjs +1 -0
- package/dist/loaders/index.d.mts +54 -0
- package/dist/loaders/index.mjs +1 -0
- package/dist/plugins/remark-asides.d.mts +8 -0
- package/dist/plugins/remark-asides.mjs +2 -0
- package/dist/plugins/remark-snippets.d.mts +11 -0
- package/dist/plugins/remark-snippets.mjs +1 -0
- package/dist/plugins/remark-structure.d.mts +13 -0
- package/dist/plugins/remark-structure.mjs +1 -0
- package/dist/plugins/remark-vars.d.mts +7 -0
- package/dist/plugins/remark-vars.mjs +1 -0
- package/dist/presets-C7z73xlB.d.mts +16 -0
- package/dist/presets-DL0qjtya.mjs +1 -0
- package/dist/runtime/code-group-sync.d.mts +30 -0
- package/dist/runtime/code-group-sync.mjs +103 -0
- package/dist/runtime/lazy-upgrade-registry.d.mts +29 -0
- package/dist/runtime/lazy-upgrade-registry.mjs +1 -0
- package/dist/runtime/tabs-sync.d.mts +25 -0
- package/dist/runtime/tabs-sync.mjs +106 -0
- package/dist/search/index.d.mts +92 -0
- package/dist/search/index.mjs +1 -0
- package/dist/tailwind/css-plugin.d.mts +16 -0
- package/dist/tailwind/css-plugin.mjs +1 -0
- package/dist/tailwind/index.d.mts +6 -0
- package/dist/tailwind/index.mjs +1 -0
- package/dist/tailwind/loader.d.mts +94 -0
- package/dist/tailwind/loader.mjs +2 -0
- package/dist/theme-toggle-element-DzFjxwpS.mjs +1 -0
- package/dist/themes/almond.css +115 -0
- package/dist/themes/aspen.css +95 -0
- package/dist/themes/catppuccin.css +98 -0
- package/dist/themes/dark.css +98 -0
- package/dist/themes/dusk.css +98 -0
- package/dist/themes/emerald.css +95 -0
- package/dist/themes/light.css +95 -0
- package/dist/themes/maple.css +119 -0
- package/dist/themes/neutral.css +73 -0
- package/dist/themes/ocean.css +98 -0
- package/dist/themes/purple.css +95 -0
- package/dist/themes/ruby.css +95 -0
- package/dist/themes/solar.css +98 -0
- package/dist/themes/vitepress.css +95 -0
- package/package.json +189 -0
- package/publier-gate +0 -0
- package/src/astro-modules.d.ts +20 -0
- package/src/components/LastModified.astro +25 -0
- package/src/components/announcement-banner.astro +25 -0
- package/src/components/aside.astro +17 -0
- package/src/components/ask-ai.tsx +146 -0
- package/src/components/badge.astro +18 -0
- package/src/components/breadcrumbs.astro +23 -0
- package/src/components/callouts/caution.astro +13 -0
- package/src/components/callouts/check.astro +13 -0
- package/src/components/callouts/danger.astro +13 -0
- package/src/components/callouts/info.astro +13 -0
- package/src/components/callouts/note.astro +13 -0
- package/src/components/callouts/tip.astro +13 -0
- package/src/components/callouts/warning.astro +13 -0
- package/src/components/card-grid.astro +14 -0
- package/src/components/card.astro +18 -0
- package/src/components/code-group.astro +55 -0
- package/src/components/columns.astro +18 -0
- package/src/components/docs-layout.astro +25 -0
- package/src/components/file-tree-node.astro +13 -0
- package/src/components/file-tree.astro +9 -0
- package/src/components/icon.astro +18 -0
- package/src/components/index.ts +155 -0
- package/src/components/link-button.astro +21 -0
- package/src/components/link-card.astro +21 -0
- package/src/components/open-in-ai.astro +13 -0
- package/src/components/package-install.astro +17 -0
- package/src/components/panels.astro +16 -0
- package/src/components/search-button.astro +21 -0
- package/src/components/sidebar.astro +12 -0
- package/src/components/skip-link.astro +12 -0
- package/src/components/steps.astro +13 -0
- package/src/components/table-of-contents.astro +22 -0
- package/src/components/tabs.astro +17 -0
- package/src/components/theme-storage.ts +5 -0
- package/src/components/theme-toggle-element.ts +85 -0
- package/src/components/theme-toggle.astro +25 -0
- package/src/components/tile-grid.astro +13 -0
- package/src/components/tile.astro +17 -0
- package/src/components/top-nav-mobile.astro +11 -0
- package/src/components/top-nav.astro +20 -0
- package/src/components/types.ts +510 -0
- package/src/components/ui/blur-image.astro +60 -0
- package/src/components/ui/changelog-entry.astro +56 -0
- package/src/components/ui/cta-band.astro +30 -0
- package/src/components/ui/feature-grid.astro +38 -0
- package/src/components/ui/feature-section.astro +85 -0
- package/src/components/ui/frame.astro +52 -0
- package/src/components/ui/hero.astro +47 -0
- package/src/components/ui/jobs-list.astro +53 -0
- package/src/components/ui/logo-cloud.astro +68 -0
- package/src/components/ui/press-gallery.astro +52 -0
- package/src/components/ui/pricing-comparison-table.astro +73 -0
- package/src/components/ui/pricing-section.astro +113 -0
- package/src/components/ui/pricing-table.astro +54 -0
- package/src/components/ui/status-indicator.astro +38 -0
- package/src/components/ui/team-grid.astro +63 -0
- package/src/components/ui/testimonial-card.astro +42 -0
- package/src/components/ui/types.ts +323 -0
- package/src/components/update-badge.astro +15 -0
- package/src/components/version-switcher.astro +20 -0
- package/src/icons/index.tsx +246 -0
- package/src/icons/resolve.tsx +45 -0
- package/src/layouts/base-layout.astro +63 -0
- package/src/qwik.ts +3 -0
- package/src/routes/blog-index.astro +20 -0
- package/src/routes/blog-rss.xml.ts +40 -0
- package/src/routes/blog-slug.astro +32 -0
- package/src/routes/changelog-index.astro +25 -0
- package/src/routes/changelog-rss.xml.ts +47 -0
- package/src/routes/docs-slug.astro +31 -0
- package/src/routes/not-found.astro +14 -0
- package/src/runtime/banner-init.ts +9 -0
- package/src/runtime/lazy-upgrade-init.ts +5 -0
- package/src/runtime/sidebar-scroll-init.ts +3 -0
- package/src/runtime/theme-init.ts +16 -0
- package/src/schemas/blog.ts +37 -0
- package/src/schemas/changelog.ts +28 -0
- package/src/schemas/common.ts +82 -0
- package/src/schemas/docs.ts +101 -0
- package/src/schemas/index.ts +14 -0
- package/src/schemas/pages.ts +22 -0
- package/src/styles/base.css +627 -0
- package/src/styles/expressive-code.css +41 -0
- package/src/styles/rules.css +66 -0
- package/src/styles/tailwind-sources.css +17 -0
- package/src/tailwind/preset.css +193 -0
- package/src/virtual-modules.d.ts +164 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { i as DocsShellOptions, p as docsShell } from "./integration-CKjtSkwa.mjs";
|
|
2
|
+
//#region src/build/headers.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Cache-control + security headers emitted by `docsShell()` during
|
|
5
|
+
* `astro:build:done`. Writes `dist/_headers` in the Netlify / Cloudflare
|
|
6
|
+
* Pages native format; both platforms interpret it identically (longest
|
|
7
|
+
* path match wins, same-named headers override less-specific rules,
|
|
8
|
+
* different-named headers merge).
|
|
9
|
+
*
|
|
10
|
+
* The same rule table is also exposed via `publierCacheControl(path)` for
|
|
11
|
+
* customers self-hosting with a Node / Bun / Deno server who want to
|
|
12
|
+
* apply identical response-header policy at the runtime layer. The regex
|
|
13
|
+
* is the authoritative definition; the `_headers` globs mirror it.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Hashed-asset path prefixes. Files under these dirs are content-addressed
|
|
17
|
+
* (filename changes on rebuild), so they are safe to mark immutable for a
|
|
18
|
+
* year. Keep in sync with the Rust `HASHED_PREFIXES` constant in
|
|
19
|
+
* `native/src/build_hooks/headers.rs`.
|
|
20
|
+
*/
|
|
21
|
+
declare const HASHED_ASSET_RE: RegExp;
|
|
22
|
+
/**
|
|
23
|
+
* Runtime helper for customers self-hosting with a Node/Bun/Deno server:
|
|
24
|
+
*
|
|
25
|
+
* import { publierCacheControl } from '@publier/shell';
|
|
26
|
+
* response.headers.set('Cache-Control', publierCacheControl(url.pathname));
|
|
27
|
+
*
|
|
28
|
+
* Returns the same policy the `_headers` file encodes, so CDN-hosted and
|
|
29
|
+
* self-hosted Publier sites behave identically.
|
|
30
|
+
*/
|
|
31
|
+
declare function publierCacheControl(path: string): string;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { type DocsShellOptions, HASHED_ASSET_RE, docsShell, publierCacheControl };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e,f as t,t as n}from"./integration-BIJIcnAT.mjs";export{e as HASHED_ASSET_RE,n as docsShell,t as publierCacheControl};
|
|
@@ -0,0 +1,99 @@
|
|
|
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{generateAnalyticsScripts as l,shellAnnouncementBannerScript as u,shellBuildHeaders as d,shellBuildLicenseErrorMessage as f,shellCacheControl as p,shellCollectTailwindClassTokens as m,shellComposeTailwindEntry as h,shellExtractAnalyticsFromYaml as g,shellExtractAnnouncementFromYaml as ee,shellExtractDocsConfigFromYaml as _,shellExtractFontsFromYaml as v,shellExtractNavFromYaml as y,shellExtractSiteFromYaml as b,shellExtractSnippetsFromYaml as te,shellExtractVarsFromYaml as x,shellLazyUpgradeScript as ne,shellOpenInAiScript as S,shellPlanDefaultRoutes as re,shellPlanRehypePlugins as ie,shellPlanRemarkPlugins as ae,shellResolvePrefetch as oe,shellResolveSnippetsConfig as se,shellRewriteHead as C,shellRewriteModulepreload as w,shellSearchButtonScript as T,shellSearchDialogScript as ce,shellTableOfContentsScript as E,verifyLicense as le}from"@publier/native";import{existsSync as D,mkdirSync as O,readFileSync as k,readdirSync as A,writeFileSync as j}from"node:fs";import{writeFile as M}from"node:fs/promises";import N from"node:path";import{fileURLToPath as P}from"node:url";import{fontProviders as F}from"astro/config";import I from"rehype-autolink-headings";import L from"rehype-external-links";import R from"remark-directive";const z=/^\/(?:_astro|assets|build)\//;function B(){return d()}function V(e){return p(e)}function H(e,t){let n=C(e,t.map(e=>e.pathname));return{stylesheetsCount:n.stylesheetsCount,modulesCount:n.modulesCount,pagesRewritten:n.pagesRewritten,stylesheets:n.stylesheets,modules:n.modules}}function U(e,t){let n=w(e,t.map(e=>e.pathname));return{jsCount:n.jsCount,fontsCount:n.fontsCount,pagesRewritten:n.pagesRewritten}}function W(e){let t=x(e);return t?JSON.parse(t):void 0}function G(e){let t=v(e);return t?JSON.parse(t):void 0}function ue(e){let t=g(e);return t?JSON.parse(t):void 0}function K(e){let t=ee(e);return t?JSON.parse(t):null}function q(e){let t=te(e);if(t)return t===`false`?!1:JSON.parse(t)}function de(e){return JSON.parse(b(e))}function fe(e){return JSON.parse(_(e))}function pe(e){return JSON.parse(y(e))}function me(e){let t=N.join(e,`publier.config.yaml`);if(!D(t))return null;try{return k(t,`utf-8`)}catch{return null}}function he(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 ge(i,a,o){let s=JSON.parse(i),c=[];for(let i of s)switch(i.id){case`remark-vars`:a&&c.push([r,a]);break;case`remark-directive`:c.push(R);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);break}return c}function _e(e,t){let n=JSON.parse(e),r=[];for(let e of n)switch(e.id){case`rehype-autolink-headings`:r.push([I,e.options]);break;case`rehype-external-links`:r.push([L,e.options]);break;case`rehype-katex`:t&&r.push(t.rehypeKatex);break}return r}async function ve(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 ye=ne();function be({root:e,mathEnabled:t}){let n=c(import.meta.url),r=t=>{try{return N.dirname(n.resolve(`${t}/package.json`,{paths:[e]}))}catch{return null}},i=(e,t)=>{let n=r(e);return n?{abs_path:N.join(n,t).split(N.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(N.sep).join(`/`)}catch{o=null}let s=h(JSON.stringify(a),o??void 0),l=m(),u=N.join(e,`.astro`);if(l.length>0){D(u)||O(u,{recursive:!0});let e=N.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(` `));j(e,n.map(e=>`<div class="${e}"></div>`).join(`
|
|
2
|
+
`),`utf8`);let r=e.split(N.sep).join(`/`);s+=`@source "${r}";\n`}let d=N.join(u,`publier-tailwind-entry.css`);return(D(d)?k(d,`utf8`):``)!==s&&(O(u,{recursive:!0}),j(d,s)),d}function xe(e,t,n){if(Se(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 Se(e){for(let t of e){if(!t)continue;if(Array.isArray(t)){if(Se(t))return!0;continue}let e=t.name;if(typeof e==`string`&&e.startsWith(`@tailwindcss/vite`))return!0}return!1}function Ce(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(N.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(`
|
|
3
|
+
if (import.meta.hot) {
|
|
4
|
+
import.meta.hot.accept();
|
|
5
|
+
}
|
|
6
|
+
`)})}}}const we=`import 'astro:scripts/page-ssr.js';
|
|
7
|
+
`;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(we)?null:{code:we+e,map:null}}}}function J(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 Y(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=J(e,r);if(t!==r){r=t;continue}let i=e[r];i===`{`?n++:i===`}`&&n--,r++}return r}function X(e){let t=[],n=(r,i)=>{let a=r,o=``,s=r;for(;a<i;){let r=J(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=Y(e,n);o+=e.slice(s,a),t.push(e.slice(a,r)),a=r,s=a;continue}if(c===`{`){let t=Y(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=J(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!==`
|
|
8
|
+
`&&o!==`\r`&&o!==`{`){r=a+16;continue}let s=r,c=!1;for(;s<a;){let t=J(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=Y(e,l);i+=n(l+1,u-1),i+=`}`,r=u}return t.length>0&&(i.endsWith(`
|
|
9
|
+
`)||(i+=`
|
|
10
|
+
`),i+=t.join(`
|
|
11
|
+
`),i.endsWith(`
|
|
12
|
+
`)||(i+=`
|
|
13
|
+
`)),i}function Z(){return{name:`publier-cascade-hoist`,enforce:`post`,transform(e,t){if(!t.endsWith(`.css`)&&!t.includes(`.css?`))return null;let n=X(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=X(r);i!==r&&(n.source=i)}}}}const Ee=`virtual:publier-nav-config`,De=`\0${Ee}`;function Oe(e){let t=`export const navConfig = ${JSON.stringify(e)};`;return{name:`publier-nav-config`,resolveId(e){if(e===Ee)return De},load(e){if(e===De)return t}}}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 ke(e,t=6){return e.length===0?`[]`:e.length<=t?`[${e.join(`, `)}]`:`[${e.slice(0,t).join(`, `)}, +${e.length-t} more]`}function Ae(e){let t=[ye,a,i,u(),S(),E()];return e.searchEnabled&&t.push(ce(),T()),t.join(`
|
|
14
|
+
`)}function je(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:F.google(),fallbacks:c,weights:l,styles:u,subsets:[`latin`]}),r.push(a);else if(o.src){let e=N.isAbsolute(o.src)&&D(o.src)?o.src:N.join(t,`public`,o.src.replace(/^\/+/,``));n.push({name:o.family,cssVariable:s,provider:F.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 Me=[{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=N.join(e,`src`,`content`,t);if(!D(n))return!1;try{return A(n,{recursive:!0}).some(e=>typeof e==`string`&&/\.mdx?$/.test(e))}catch{return!1}}function Ne(e={}){return{name:`@publier/shell`,hooks:{"astro:config:setup":async({config:t,updateConfig:n,injectScript:r,injectRoute:i,logger:a})=>{let u=t.root?P(t.root):process.cwd();try{le()}catch(e){let t=f(e instanceof Error?e.message:String(e));throw t?Error(t):e}let d=c(N.join(u,`package.json`)),p=JSON.stringify(e),m=me(u),h=m?de(m):{name:``,url:null,description:null,logo:null,favicon:null,footer:null,serviceWorker:!1},g=typeof h.url==`string`&&h.url.length>0;g&&!t.site&&n({site:h.url});let ee=new Set(t.integrations.map(e=>e.name)),_=Me.filter(({aliases:e})=>!e.some(e=>ee.has(e)));_.length>0&&a.warn(`[@publier/shell] Required framework integrations are not registered in
|
|
15
|
+
astro.config.ts. As of @publier/shell@2.0.0, docsShell() no longer
|
|
16
|
+
auto-wires these. Add the following to your integrations[] array
|
|
17
|
+
(import statements + entries shown). Order matters: expressive-code
|
|
18
|
+
must precede mdx.
|
|
19
|
+
|
|
20
|
+
import expressiveCode from 'astro-expressive-code';
|
|
21
|
+
import mdx from '@astrojs/mdx';
|
|
22
|
+
import sitemap from '@astrojs/sitemap';
|
|
23
|
+
import pagefind from 'astro-pagefind';
|
|
24
|
+
import qwik from '@qwik.dev/astro';
|
|
25
|
+
|
|
26
|
+
integrations: [
|
|
27
|
+
expressiveCode(),
|
|
28
|
+
mdx(),
|
|
29
|
+
sitemap(),
|
|
30
|
+
pagefind(),
|
|
31
|
+
qwik({ clientRouter: true }),
|
|
32
|
+
docsShell({ /* options */ }),
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
Missing:\n ${_.map(e=>e.pkg).join(`
|
|
36
|
+
`)}\n`);let v=t.prefetch;oe(v===void 0?void 0:JSON.stringify(v),p)&&n({prefetch:{prefetchAll:!0,defaultStrategy:`viewport`}});let y=m?W(m):void 0,b=m?G(m):void 0,{entries:te,familyOnlyCss:x,slots:ne}=b?je(b,u):{entries:[],familyOnlyCss:``,slots:[]},S=m?pe(m):{variants:{},pathRules:[],defaultVariant:`default`,searchEnabled:!0},C=m?K(m):null,w=m?fe(m):{tabSections:[],sidebarMeta:{},versions:[],anchors:[]},T=m?q(m):null,ce=se(p,(T==null?null:T===!1?`false`:JSON.stringify(T))??void 0,D(N.join(u,`content/snippets`))),E=JSON.parse(ce),O={...e,snippets:E===null?void 0:E},k=JSON.stringify(O),A=e.math!==!1,j=A?he(d,a):null,M=ae(k,!!(y&&Object.keys(y).length>0),E!==null&&E!==!1,A&&j!==null),I=ie(p,A&&j!==null),L=ge(M,y,j),R=_e(I,j);await ve(e,t.integrations,u,n);let z=be({root:u,mathEnabled:A}),B=Ae({searchEnabled:e.search!==!1}),V=JSON.stringify({docs:$(u,`docs`),blog:$(u,`blog`),changelog:$(u,`changelog`)}),H=JSON.parse(re(p,g,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(n({markdown:{remarkPlugins:[...L],rehypePlugins:[...R]},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:[...xe(d,a,t.vite?.plugins??[]),s({root:u}),o({root:u}),Oe(S),Ce({entryPath:z}),Te(),Q(`virtual:publier-announcement`,`announcement`,C),Q(`virtual:publier-site`,`site`,h),Q(`virtual:publier-docs-config`,`docsConfig`,w),Q(`virtual:publier-feeds`,`feeds`,U),Q(`virtual:publier-fonts`,`fonts`,{slots:ne}),Z()]}}),n({fonts:[{name:`Inter Variable`,cssVariable:`--publier-font-builtin-sans`,provider:F.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:F.npm({remote:!1}),fallbacks:[`monospace`],weights:[`100 800`],styles:[`normal`],subsets:[`latin`],options:{package:`@fontsource-variable/jetbrains-mono`}},...te]}),r(`page-ssr`,[`import ${JSON.stringify(z)};`,`import 'virtual:publier-theme-css';`,`import 'virtual:publier-custom-css';`,`import '@publier/shell/styles/base.css';`].join(`
|
|
37
|
+
`)),r(`page`,B),r(`head-inline`,`(function(){
|
|
38
|
+
if (typeof window === 'undefined' || !window.sessionStorage || !window.fetch) return;
|
|
39
|
+
var store = window.sessionStorage;
|
|
40
|
+
var ResponseCtor = window.Response;
|
|
41
|
+
var origFetch = window.fetch.bind(window);
|
|
42
|
+
var NS = 'publier:bg:';
|
|
43
|
+
var PATTERN = /^\\/(?:_astro|assets|build)\\/(?:[^\\/]*bundle-graph[^\\/]*\\.json|q-manifest[^\\/]*\\.json)(?:\\?.*)?$/;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
var inflight = Object.create(null);
|
|
49
|
+
function serve(body){
|
|
50
|
+
return new ResponseCtor(body, {
|
|
51
|
+
status: 200,
|
|
52
|
+
headers: { 'content-type': 'application/json' }
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
window.fetch = function(input, init){
|
|
56
|
+
var url = typeof input === 'string' ? input : (input && input.url) || '';
|
|
57
|
+
var method = (init && init.method) || (input && input.method) || 'GET';
|
|
58
|
+
if (!url || method !== 'GET' || !PATTERN.test(url)) {
|
|
59
|
+
return origFetch(input, init);
|
|
60
|
+
}
|
|
61
|
+
var key = NS + url;
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
var hit = store.getItem(key);
|
|
65
|
+
if (hit !== null) return Promise.resolve(serve(hit));
|
|
66
|
+
} catch (_) {}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
if (inflight[url]) return inflight[url].then(serve);
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
var pending = origFetch(input, init).then(function(res){
|
|
73
|
+
if (res && res.ok) {
|
|
74
|
+
return res.clone().text().then(function(body){
|
|
75
|
+
try { store.setItem(key, body); } catch (_) {}
|
|
76
|
+
delete inflight[url];
|
|
77
|
+
return res;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
delete inflight[url];
|
|
81
|
+
return res;
|
|
82
|
+
}, function(err){
|
|
83
|
+
delete inflight[url];
|
|
84
|
+
throw err;
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
inflight[url] = pending.then(function(res){
|
|
88
|
+
return res && res.ok ? res.clone().text() : '';
|
|
89
|
+
});
|
|
90
|
+
return pending;
|
|
91
|
+
};
|
|
92
|
+
})();`),x&&r(`head-inline`,`
|
|
93
|
+
const _pFonts = document.createElement('style');
|
|
94
|
+
_pFonts.textContent = ${JSON.stringify(x)};
|
|
95
|
+
document.head.appendChild(_pFonts);
|
|
96
|
+
`),m){let e=ue(m);if(e){let t=l(e);t&&r(`head-inline`,`
|
|
97
|
+
const _pAnalytics = document.createRange().createContextualFragment(${JSON.stringify(t)});
|
|
98
|
+
document.head.appendChild(_pAnalytics);
|
|
99
|
+
`)}}for(let e of H)i({pattern:e.pattern,entrypoint:e.entrypoint,prerender:e.prerender});H.length>0&&a.info(`[@publier/shell] Injected default routes: ${H.map(e=>e.pattern).join(`, `)}.`),a.info(`[@publier/shell] Plugin pipeline wired.`)},"astro:build:done":async({dir:e,pages:t,logger:n})=>{let r=P(e);await M(N.join(r,`_headers`),B(),`utf-8`),n.info(`[@publier/shell] Wrote 5 header rules to dist/_headers.`);let i=H(r,t);i.pagesRewritten>0&&n.info(`[@publier/shell] Backfilled head tags on ${i.pagesRewritten} HTML file(s) (stylesheets=${ke(i.stylesheets)}, modules=${ke(i.modules)}).`);let a=U(r,t);a.pagesRewritten>0&&n.info(`[@publier/shell] Injected preload tags into ${a.pagesRewritten} HTML file(s) (js=${a.jsCount}, fonts=${a.fontsCount}).`)}}}}export{fe as a,de as c,z as d,V as f,K as i,q as l,X as n,G as o,Z as r,pe as s,Ne as t,W as u};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { FontsConfig } from "@publier/native";
|
|
2
|
+
import { AstroIntegration } from "astro";
|
|
3
|
+
import { Plugin } from "vite";
|
|
4
|
+
|
|
5
|
+
//#region src/config/yaml-extract.d.ts
|
|
6
|
+
declare function extractVarsFromYaml(yaml: string): Record<string, string> | undefined;
|
|
7
|
+
declare function extractFontsFromYaml(yaml: string): FontsConfig | undefined;
|
|
8
|
+
declare function extractAnnouncementFromYaml(yaml: string): AnnouncementConfig | null;
|
|
9
|
+
declare function extractSnippetsFromYaml(yaml: string): false | {
|
|
10
|
+
directory?: string;
|
|
11
|
+
} | undefined;
|
|
12
|
+
declare function extractSiteFromYaml(yaml: string): SiteConfig;
|
|
13
|
+
declare function extractDocsConfigFromYaml(yaml: string): DocsConfig;
|
|
14
|
+
declare function extractNavFromYaml(yaml: string): NavConfig;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/vite/css-chain.d.ts
|
|
17
|
+
/**
|
|
18
|
+
* Move every `@media` block found anywhere inside an outer `@layer utilities`
|
|
19
|
+
* (including arbitrarily nested `@layer x.y.z`, `@supports`, etc.) into
|
|
20
|
+
* unlayered position at the end of the stylesheet. Pure string transform;
|
|
21
|
+
* brace-balanced and string-/comment-safe.
|
|
22
|
+
*
|
|
23
|
+
* Why: Vite 8 (Rolldown) + @tailwindcss/vite emits unprefixed utilities after
|
|
24
|
+
* their responsive variants inside the same `@layer utilities` block, which
|
|
25
|
+
* drops same-specificity variants in source order. Verified against
|
|
26
|
+
* rolldown-vite@7.3.1 and Vite 8.0.x (no upstream fix as of 2026-04-30).
|
|
27
|
+
* Track: vitejs/vite#21826, vitejs/vite#21903. Hoisting responsive media
|
|
28
|
+
* queries out of the layer makes them unlayered — and per CSS Cascade
|
|
29
|
+
* Layers, unlayered beats layered unconditionally.
|
|
30
|
+
*
|
|
31
|
+
* **Why recursive**: daisyUI v5 nests rules under sub-layers like
|
|
32
|
+
* `@layer utilities { @layer daisyui.l1.l2.l3 { @media (...) { ... } } }`.
|
|
33
|
+
* A non-recursive scan that only sees direct children of `@layer utilities`
|
|
34
|
+
* would miss the nested `@media` and the layer-ordering bug stays live.
|
|
35
|
+
* The recursive walk extracts every `@media` regardless of depth.
|
|
36
|
+
*
|
|
37
|
+
* Exported for unit tests; used by `publierCascadeHoistPlugin` on every CSS
|
|
38
|
+
* module that flows through Vite's `transform` pipeline AND every CSS asset
|
|
39
|
+
* in the final bundle.
|
|
40
|
+
*/
|
|
41
|
+
declare function hoistMediaOutOfUtilitiesLayer(css: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Vite plugin that runs `hoistMediaOutOfUtilitiesLayer` against every CSS
|
|
44
|
+
* stream Vite handles. Registered via `docsShell()`'s
|
|
45
|
+
* `updateConfig({ vite: ... })` so it runs in BOTH `astro dev` (HMR — where
|
|
46
|
+
* the `astro:build:done` hook never fires) and `astro build`.
|
|
47
|
+
*
|
|
48
|
+
* The plugin hooks two stages:
|
|
49
|
+
*
|
|
50
|
+
* 1. `transform(code, id)` (`enforce: 'post'`) — runs after
|
|
51
|
+
* `@tailwindcss/vite` for any CSS module that flows through Vite's
|
|
52
|
+
* transform pipeline. Covers `astro dev` HMR and most build paths.
|
|
53
|
+
*
|
|
54
|
+
* 2. `generateBundle(_, bundle)` — sweeps the final bundled assets and
|
|
55
|
+
* rewrites any `.css` chunk that still contains `@media` inside
|
|
56
|
+
* `@layer utilities`. Belt-and-suspenders for the build path: when
|
|
57
|
+
* `@tailwindcss/vite` is registered before docsShell (e.g. a
|
|
58
|
+
* consumer manually adds `tailwind()` in their own
|
|
59
|
+
* `vite.plugins`), the post-transform ordering can put us BEFORE
|
|
60
|
+
* Tailwind's emitter for the final concatenated chunk. The bundle
|
|
61
|
+
* sweep guarantees the output is hoisted regardless.
|
|
62
|
+
*
|
|
63
|
+
* Zero runtime cost in either stage: when the marker is absent the pure
|
|
64
|
+
* function returns its input unchanged and the hook short-circuits.
|
|
65
|
+
*/
|
|
66
|
+
declare function publierCascadeHoistPlugin(): Plugin;
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/integration.d.ts
|
|
69
|
+
interface DocsShellOptions {
|
|
70
|
+
/** Enable `<Snippet file="..." />` resolution. */
|
|
71
|
+
snippets?: false | {
|
|
72
|
+
directory?: string;
|
|
73
|
+
};
|
|
74
|
+
/** Enable math via remark-math + rehype-katex + katex.min.css. Default: true. */
|
|
75
|
+
math?: boolean;
|
|
76
|
+
/** Enable astro-mermaid. Default: auto-detected. */
|
|
77
|
+
mermaid?: boolean;
|
|
78
|
+
/** Apply Publier's prefetch defaults. Default: true. */
|
|
79
|
+
prefetch?: boolean;
|
|
80
|
+
/** Wire rehype-autolink-headings. Default: true. */
|
|
81
|
+
autolinkHeadings?: boolean;
|
|
82
|
+
/** Wire rehype-external-links — adds `target="_blank"` + `rel="noopener noreferrer"` to outbound http(s) links. Default: true. */
|
|
83
|
+
externalLinks?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Site-wide search backend. Default: `'pagefind'`.
|
|
86
|
+
*
|
|
87
|
+
* Set to `false` to skip injecting the search-button and search-dialog
|
|
88
|
+
* client scripts from the page bundle. The shell does NOT register
|
|
89
|
+
* `astro-pagefind` itself — register it explicitly in
|
|
90
|
+
* `integrations: [pagefind(), docsShell()]` to enable Pagefind-driven
|
|
91
|
+
* search.
|
|
92
|
+
*/
|
|
93
|
+
search?: 'pagefind' | false;
|
|
94
|
+
/**
|
|
95
|
+
* Default-route injection. Default: all enabled — but routes whose
|
|
96
|
+
* matching `src/content/<name>/` directory is absent are skipped.
|
|
97
|
+
*
|
|
98
|
+
* `rss` controls the `/blog/rss.xml` + `/changelog/rss.xml` feed routes;
|
|
99
|
+
* they're only injected when `publier.config.yaml#site.url` is set
|
|
100
|
+
* (`@astrojs/rss` requires `context.site` to emit absolute URLs).
|
|
101
|
+
*/
|
|
102
|
+
routes?: false | {
|
|
103
|
+
docs?: boolean;
|
|
104
|
+
blog?: boolean;
|
|
105
|
+
changelog?: boolean;
|
|
106
|
+
notFound?: boolean;
|
|
107
|
+
rss?: boolean;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
interface AnnouncementConfig {
|
|
111
|
+
message: string;
|
|
112
|
+
href?: string;
|
|
113
|
+
variant?: 'info' | 'warning' | 'success';
|
|
114
|
+
storageKey?: string;
|
|
115
|
+
}
|
|
116
|
+
interface SiteConfig {
|
|
117
|
+
name: string;
|
|
118
|
+
url: string | null;
|
|
119
|
+
description: string | null;
|
|
120
|
+
logo: {
|
|
121
|
+
light?: string;
|
|
122
|
+
dark?: string;
|
|
123
|
+
} | null;
|
|
124
|
+
favicon: string | null;
|
|
125
|
+
footer: string | null;
|
|
126
|
+
serviceWorker: boolean;
|
|
127
|
+
}
|
|
128
|
+
interface DocsSidebarMetaOverride {
|
|
129
|
+
label?: string;
|
|
130
|
+
collapsed?: boolean;
|
|
131
|
+
order?: number;
|
|
132
|
+
}
|
|
133
|
+
interface DocVersionConfig {
|
|
134
|
+
label: string;
|
|
135
|
+
path: string;
|
|
136
|
+
badge?: string;
|
|
137
|
+
default?: boolean;
|
|
138
|
+
}
|
|
139
|
+
interface SidebarAnchorConfig {
|
|
140
|
+
label: string;
|
|
141
|
+
href: string;
|
|
142
|
+
icon?: string;
|
|
143
|
+
target?: string;
|
|
144
|
+
badge?: string;
|
|
145
|
+
}
|
|
146
|
+
interface DocsConfig {
|
|
147
|
+
tabSections: string[];
|
|
148
|
+
sidebarMeta: Record<string, DocsSidebarMetaOverride>;
|
|
149
|
+
versions: DocVersionConfig[];
|
|
150
|
+
anchors: SidebarAnchorConfig[];
|
|
151
|
+
}
|
|
152
|
+
interface NavLink {
|
|
153
|
+
label: string;
|
|
154
|
+
href: string;
|
|
155
|
+
external?: boolean;
|
|
156
|
+
}
|
|
157
|
+
interface NavCta {
|
|
158
|
+
label: string;
|
|
159
|
+
href: string;
|
|
160
|
+
}
|
|
161
|
+
interface NavVariant {
|
|
162
|
+
brand: string;
|
|
163
|
+
logo: {
|
|
164
|
+
light?: string;
|
|
165
|
+
dark?: string;
|
|
166
|
+
} | null;
|
|
167
|
+
tabs: NavLink[];
|
|
168
|
+
links: NavLink[];
|
|
169
|
+
cta: NavCta | null;
|
|
170
|
+
}
|
|
171
|
+
interface NavPathRule {
|
|
172
|
+
path: string;
|
|
173
|
+
variant: string | false;
|
|
174
|
+
}
|
|
175
|
+
interface NavConfig {
|
|
176
|
+
variants: Record<string, NavVariant>;
|
|
177
|
+
pathRules: NavPathRule[];
|
|
178
|
+
defaultVariant: string;
|
|
179
|
+
searchEnabled: boolean;
|
|
180
|
+
}
|
|
181
|
+
declare function docsShell(options?: DocsShellOptions): AstroIntegration;
|
|
182
|
+
//#endregion
|
|
183
|
+
export { extractVarsFromYaml as S, extractDocsConfigFromYaml as _, DocsSidebarMetaOverride as a, extractSiteFromYaml as b, NavLink as c, SidebarAnchorConfig as d, SiteConfig as f, extractAnnouncementFromYaml as g, publierCascadeHoistPlugin as h, DocsShellOptions as i, NavPathRule as l, hoistMediaOutOfUtilitiesLayer as m, DocVersionConfig as n, NavConfig as o, docsShell as p, DocsConfig as r, NavCta as s, AnnouncementConfig as t, NavVariant as u, extractFontsFromYaml as v, extractSnippetsFromYaml as x, extractNavFromYaml as y };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { S as extractVarsFromYaml, _ as extractDocsConfigFromYaml, a as DocsSidebarMetaOverride, b as extractSiteFromYaml, c as NavLink, d as SidebarAnchorConfig, f as SiteConfig, g as extractAnnouncementFromYaml, h as publierCascadeHoistPlugin, i as DocsShellOptions, l as NavPathRule, m as hoistMediaOutOfUtilitiesLayer, n as DocVersionConfig, o as NavConfig, p as docsShell, r as DocsConfig, s as NavCta, t as AnnouncementConfig, u as NavVariant, v as extractFontsFromYaml, x as extractSnippetsFromYaml, y as extractNavFromYaml } from "./integration-CKjtSkwa.mjs";
|
|
2
|
+
export { AnnouncementConfig, DocVersionConfig, DocsConfig, DocsShellOptions, DocsSidebarMetaOverride, NavConfig, NavCta, NavLink, NavPathRule, NavVariant, SidebarAnchorConfig, SiteConfig, docsShell, extractAnnouncementFromYaml, extractDocsConfigFromYaml, extractFontsFromYaml, extractNavFromYaml, extractSiteFromYaml, extractSnippetsFromYaml, extractVarsFromYaml, hoistMediaOutOfUtilitiesLayer, publierCascadeHoistPlugin };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c,u as l}from"./integration-BIJIcnAT.mjs";export{c as docsShell,n as extractAnnouncementFromYaml,e as extractDocsConfigFromYaml,a as extractFontsFromYaml,s as extractNavFromYaml,t as extractSiteFromYaml,r as extractSnippetsFromYaml,l as extractVarsFromYaml,i as hoistMediaOutOfUtilitiesLayer,o as publierCascadeHoistPlugin};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as _$astro_loaders0 from "astro/loaders";
|
|
2
|
+
|
|
3
|
+
//#region src/loaders/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Astro content-collection loaders for Publier.
|
|
6
|
+
*
|
|
7
|
+
* The customer's `content.config.ts` wires these into collection definitions:
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { defineCollection } from 'astro:content';
|
|
11
|
+
* import { docsLoader, blogLoader, pagesLoader } from '@publier/shell/loaders';
|
|
12
|
+
* import { docsSchema, blogSchema, pagesSchema } from '@publier/shell/schemas';
|
|
13
|
+
*
|
|
14
|
+
* export const collections = {
|
|
15
|
+
* docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
|
|
16
|
+
* blog: defineCollection({ loader: blogLoader(), schema: blogSchema }),
|
|
17
|
+
* pages: defineCollection({ loader: pagesLoader(), schema: pagesSchema }),
|
|
18
|
+
* };
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* ID generation and glob-pattern construction live in `@publier/native`; this
|
|
22
|
+
* module is the thin shim that wires them into Astro's `glob()` loader protocol.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Content loader for Publier's `docs` collection.
|
|
26
|
+
*/
|
|
27
|
+
declare function docsLoader(options?: {
|
|
28
|
+
base?: string;
|
|
29
|
+
pattern?: string;
|
|
30
|
+
}): _$astro_loaders0.Loader;
|
|
31
|
+
/**
|
|
32
|
+
* Content loader for the `blog` collection.
|
|
33
|
+
*/
|
|
34
|
+
declare function blogLoader(options?: {
|
|
35
|
+
base?: string;
|
|
36
|
+
pattern?: string;
|
|
37
|
+
}): _$astro_loaders0.Loader;
|
|
38
|
+
/**
|
|
39
|
+
* Content loader for the `pages` collection.
|
|
40
|
+
*/
|
|
41
|
+
declare function pagesLoader(options?: {
|
|
42
|
+
base?: string;
|
|
43
|
+
pattern?: string;
|
|
44
|
+
}): _$astro_loaders0.Loader;
|
|
45
|
+
/**
|
|
46
|
+
* Generic content loader for any MDX collection (changelog, recipes, press,
|
|
47
|
+
* careers, etc.).
|
|
48
|
+
*/
|
|
49
|
+
declare function contentLoader(options: {
|
|
50
|
+
base: string;
|
|
51
|
+
pattern?: string;
|
|
52
|
+
}): _$astro_loaders0.Loader;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { blogLoader, contentLoader, docsLoader, pagesLoader };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{shellBuildGlobPattern as e,shellGenerateId as t}from"@publier/native";import{glob as n}from"astro/loaders";function r({entry:e}){return t(e)}function i(t){return e(t)}function a(e){return n({base:e?.base??`./src/content/docs`,pattern:e?.pattern??i(`docs`),generateId:r})}function o(e){return n({base:e?.base??`./src/content/blog`,pattern:e?.pattern??i(`blog`),generateId:r})}function s(e){return n({base:e?.base??`./src/content/pages`,pattern:e?.pattern??i(`pages`),generateId:r})}function c(e){return n({base:e.base,pattern:e.pattern??i(`content`),generateId:r})}export{o as blogLoader,c as contentLoader,a as docsLoader,s as pagesLoader};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as Root } from "../index-DWtFsw7E.mjs";
|
|
2
|
+
import { Plugin } from "unified";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/remark-asides.d.ts
|
|
5
|
+
declare const remarkAsides: Plugin<[], Root>;
|
|
6
|
+
declare const remarkDirectivesRestoration: Plugin<[], Root>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { remarkAsides, remarkDirectivesRestoration };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e from"@publier/native";import{directiveToMarkdown as t}from"mdast-util-directive";import{toMarkdown as n}from"mdast-util-to-markdown";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=n(e,{extensions:[t()]});a.at(-1)===`
|
|
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};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { t as Root } from "../index-DWtFsw7E.mjs";
|
|
2
|
+
import { Plugin } from "unified";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/remark-snippets.d.ts
|
|
5
|
+
interface SnippetOptions {
|
|
6
|
+
directory?: string;
|
|
7
|
+
contentRoot?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const remarkSnippets: Plugin<[SnippetOptions?], Root>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { remarkSnippets as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"@publier/native";import{resolve as t}from"node:path";import{fromMarkdown as n}from"mdast-util-from-markdown";function r(e){return typeof e==`object`&&!!e&&e.type===`mdxJsxFlowElement`}const i=i=>a=>{let o=t(i?.contentRoot??`.`,i?.directory??`content/snippets`),s=a.children;for(let t=0;t<s.length;t++){let i=s[t];if(!r(i)||i.name!==`Snippet`)continue;let a=i,c={};for(let e of a.attributes??[])e.type===`mdxJsxAttribute`&&typeof e.value==`string`&&(c[e.name]=e.value);let l=c.file;if(!l)continue;let u;try{u=e.remarkResolveSnippet(o,l,JSON.stringify(c))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`[remark-snippets] Failed to resolve "${l}" from "${o}": ${t}`)}if(u==null)continue;let d=n(u);s.splice(t,1,...d.children),t+=d.children.length-1}};export{i as default};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as Root } from "../index-DWtFsw7E.mjs";
|
|
2
|
+
import { StructuredSection } from "@publier/native";
|
|
3
|
+
import { Plugin } from "unified";
|
|
4
|
+
|
|
5
|
+
//#region src/plugins/remark-structure.d.ts
|
|
6
|
+
declare module 'vfile' {
|
|
7
|
+
interface DataMap {
|
|
8
|
+
structuredData: StructuredSection[];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
declare const remarkStructure: Plugin<[], Root>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { remarkStructure as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"@publier/native";import{toString as t}from"mdast-util-to-string";const n=process.env.PUBLIER_NATIVE_REMARK!==`off`;function r(e){let n=[],r=``,i=[],a=()=>{let e=i.map(e=>t(e)).join(` `).replace(/\s+/g,` `).trim();(e||r)&&n.push({heading:r,content:e}),i=[]};for(let n of e.children)n.type===`heading`?(a(),r=t(n)):i.push(n);return a(),n}const i=()=>(t,i)=>{i.data.structuredData=n?JSON.parse(e.remarkCollectSections(JSON.stringify(t))):r(t)};export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"@publier/native";const t=t=>n=>{!t||Object.keys(t).length===0||(n.children=JSON.parse(e.remarkVarsSubstitute(JSON.stringify(n),JSON.stringify(t))).children)};export{t as default};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/tailwind/presets.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Browser-safe preset catalogue. Contains no Node-only imports so it can be
|
|
4
|
+
* imported from Astro integrations, Qwik components, or the CLI alike.
|
|
5
|
+
*
|
|
6
|
+
* Node-side introspection (reading CSS files, computing contrast) lives in
|
|
7
|
+
* `./loader.ts` to keep `node:fs` out of the browser bundle path.
|
|
8
|
+
*/
|
|
9
|
+
declare const AVAILABLE_THEMES: readonly ["almond", "aspen", "catppuccin", "dark", "dusk", "emerald", "light", "maple", "neutral", "ocean", "purple", "ruby", "solar", "vitepress"];
|
|
10
|
+
type ThemePreset = (typeof AVAILABLE_THEMES)[number];
|
|
11
|
+
/** Return a read-only copy of the built-in preset list. */
|
|
12
|
+
declare function listPresets(): readonly ThemePreset[];
|
|
13
|
+
/** Narrow an arbitrary string to a known preset name. */
|
|
14
|
+
declare function isValidPreset(name: string): name is ThemePreset;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { listPresets as i, ThemePreset as n, isValidPreset as r, AVAILABLE_THEMES as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=[`almond`,`aspen`,`catppuccin`,`dark`,`dusk`,`emerald`,`light`,`maple`,`neutral`,`ocean`,`purple`,`ruby`,`solar`,`vitepress`];function t(){return e}function n(t){return e.includes(t)}export{n,t as r,e as t};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/runtime/code-group-sync-runtime.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* CodeGroup sync — cross-peer + cross-tab activation for shell's CodeGroup
|
|
4
|
+
* tabs.
|
|
5
|
+
*
|
|
6
|
+
* Injected globally by `docsShell()` via
|
|
7
|
+
* `injectScript('page', CODE_GROUP_SYNC_SCRIPT)`. Stored as a string constant
|
|
8
|
+
* (same pattern as `TABS_SYNC_SCRIPT` / `LAZY_UPGRADE_SCRIPT`) because
|
|
9
|
+
* Rolldown-vite tree-shakes plain side-effect module imports inside an
|
|
10
|
+
* injected page stage — wrapping as a literal string keeps the code out of
|
|
11
|
+
* the import graph entirely and lands it verbatim in the page bundle.
|
|
12
|
+
*
|
|
13
|
+
* Click + keyboard activation is owned by `<tab-container>` itself once the
|
|
14
|
+
* lazy-upgrade bootstrap (`runtime/lazy-upgrade-init.ts`) defines it. This script
|
|
15
|
+
* only layers peer / storage sync on top.
|
|
16
|
+
*
|
|
17
|
+
* Mirrors `tabs-sync-runtime.ts`:
|
|
18
|
+
* - listens for `tab-container-changed` (past tense, after-state) — the
|
|
19
|
+
* `tab-container-change` (no -d) event is the cancelable pre-state phase
|
|
20
|
+
* and listening to it loops infinitely with the idempotence guard.
|
|
21
|
+
* - reads `ev.tab` directly — `ev.detail` is deprecated upstream and
|
|
22
|
+
* returns the PANEL (not the tab button) behind a `console.warn`.
|
|
23
|
+
* - aria-selected is the SINGLE source of truth — daisyUI v5 styles
|
|
24
|
+
* `[aria-selected=true]` directly, so the pre-upgrade fallback does NOT
|
|
25
|
+
* toggle a `tab-active` class (would leave a stale highlight once
|
|
26
|
+
* `<tab-container>` upgrades and starts managing aria-selected alone).
|
|
27
|
+
*/
|
|
28
|
+
declare const CODE_GROUP_SYNC_SCRIPT = "\n(() => {\n\tconst SYNC_PREFIX = 'publier-code-group-sync:';\n\n\tconst activateByLabel = (root, label) => {\n\t\tconst tabs = Array.from(root.querySelectorAll('[role=\"tab\"]'));\n\t\tconst index = tabs.findIndex((t) => t.dataset.tabLabel === label);\n\t\tif (index < 0) return;\n\t\tconst target = tabs[index];\n\t\t// Idempotence guard: tab-container fires 'tab-container-changed'\n\t\t// unconditionally when selectTab runs, even when the index doesn't\n\t\t// change. Without this check, peer sync loops: root 0 syncs peer 1\n\t\t// \u2192 peer 1 fires changed \u2192 peer 1 syncs peers including root 0 \u2192\n\t\t// stack-overflow. Skip if already on the requested label.\n\t\tif (target.getAttribute('aria-selected') === 'true') return;\n\t\t// tab-container-element's selectTab(index) expects a NUMBER, not an\n\t\t// element. Passing the tab button directly silently no-ops (coerces\n\t\t// to NaN). Pass the resolved index instead.\n\t\tif (typeof root.selectTab === 'function') {\n\t\t\troot.selectTab(index);\n\t\t\treturn;\n\t\t}\n\t\t// Pre-upgrade fallback: toggle ARIA + panel visibility manually so\n\t\t// SSR state stays coherent while the custom element is still loading.\n\t\t// aria-selected is the SINGLE source of truth here \u2014 daisyUI v5\n\t\t// styles `[aria-selected=true]` directly, so we deliberately do NOT\n\t\t// touch a `tab-active` class.\n\t\tconst panels = Array.from(root.querySelectorAll('[role=\"tabpanel\"]'));\n\t\tfor (const tab of tabs) {\n\t\t\tconst isActive = tab === target;\n\t\t\ttab.setAttribute('aria-selected', isActive ? 'true' : 'false');\n\t\t\ttab.setAttribute('tabindex', isActive ? '0' : '-1');\n\t\t}\n\t\tconst activeId = target.getAttribute('aria-controls');\n\t\tfor (const panel of panels) {\n\t\t\tpanel.hidden = panel.id !== activeId;\n\t\t}\n\t};\n\n\tconst wire = () => {\n\t\tfor (const root of document.querySelectorAll('[data-publier-cg]')) {\n\t\t\tif (root.dataset.wired === '1') continue;\n\t\t\troot.dataset.wired = '1';\n\n\t\t\tconst syncKey = root.dataset.syncKey || null;\n\t\t\tconst storageKey = syncKey ? SYNC_PREFIX + syncKey : null;\n\n\t\t\tif (storageKey) {\n\t\t\t\ttry {\n\t\t\t\t\tconst saved = localStorage.getItem(storageKey);\n\t\t\t\t\tif (saved) activateByLabel(root, saved);\n\t\t\t\t} catch {}\n\t\t\t}\n\n\t\t\t// Listen for 'tab-container-changed' (past tense), NOT\n\t\t\t// 'tab-container-change'. The former fires AFTER the state is\n\t\t\t// applied; the latter fires BEFORE (it's the cancelable phase),\n\t\t\t// so the idempotence guard in activateByLabel reads stale\n\t\t\t// aria-selected and ends up looping infinitely.\n\t\t\troot.addEventListener('tab-container-changed', (ev) => {\n\t\t\t\t// tab-container-element exposes a typed 'tab' getter on the event;\n\t\t\t\t// 'ev.detail' is deprecated upstream and returns the PANEL (not\n\t\t\t\t// the tab button) behind a console.warn. Read '.tab' directly.\n\t\t\t\tconst tab = ev.tab;\n\t\t\t\tconst label = tab && tab.dataset ? tab.dataset.tabLabel : null;\n\t\t\t\tif (!label) return;\n\t\t\t\tif (storageKey) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlocalStorage.setItem(storageKey, label);\n\t\t\t\t\t} catch {}\n\t\t\t\t}\n\t\t\t\tif (syncKey) {\n\t\t\t\t\tconst peers = document.querySelectorAll(\n\t\t\t\t\t\t'[data-publier-cg][data-sync-key=\"' + syncKey + '\"]',\n\t\t\t\t\t);\n\t\t\t\t\tfor (const peer of peers) {\n\t\t\t\t\t\tif (peer === root) continue;\n\t\t\t\t\t\tactivateByLabel(peer, label);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n\n\tif (!window.__publierCgStorageWired) {\n\t\twindow.__publierCgStorageWired = true;\n\t\twindow.addEventListener('storage', (ev) => {\n\t\t\tif (!ev.key || ev.key.indexOf(SYNC_PREFIX) !== 0 || ev.newValue == null) return;\n\t\t\tconst syncKey = ev.key.slice(SYNC_PREFIX.length);\n\t\t\tconst label = ev.newValue;\n\t\t\tconst peers = document.querySelectorAll(\n\t\t\t\t'[data-publier-cg][data-sync-key=\"' + syncKey + '\"]',\n\t\t\t);\n\t\t\tfor (const root of peers) {\n\t\t\t\tactivateByLabel(root, label);\n\t\t\t}\n\t\t});\n\t}\n\n\twire();\n\tdocument.addEventListener('astro:page-load', wire);\n})();\n";
|
|
29
|
+
//#endregion
|
|
30
|
+
export { CODE_GROUP_SYNC_SCRIPT };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const e=`
|
|
2
|
+
(() => {
|
|
3
|
+
const SYNC_PREFIX = 'publier-code-group-sync:';
|
|
4
|
+
|
|
5
|
+
const activateByLabel = (root, label) => {
|
|
6
|
+
const tabs = Array.from(root.querySelectorAll('[role="tab"]'));
|
|
7
|
+
const index = tabs.findIndex((t) => t.dataset.tabLabel === label);
|
|
8
|
+
if (index < 0) return;
|
|
9
|
+
const target = tabs[index];
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
if (target.getAttribute('aria-selected') === 'true') return;
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
if (typeof root.selectTab === 'function') {
|
|
20
|
+
root.selectTab(index);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const panels = Array.from(root.querySelectorAll('[role="tabpanel"]'));
|
|
29
|
+
for (const tab of tabs) {
|
|
30
|
+
const isActive = tab === target;
|
|
31
|
+
tab.setAttribute('aria-selected', isActive ? 'true' : 'false');
|
|
32
|
+
tab.setAttribute('tabindex', isActive ? '0' : '-1');
|
|
33
|
+
}
|
|
34
|
+
const activeId = target.getAttribute('aria-controls');
|
|
35
|
+
for (const panel of panels) {
|
|
36
|
+
panel.hidden = panel.id !== activeId;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const wire = () => {
|
|
41
|
+
for (const root of document.querySelectorAll('[data-publier-cg]')) {
|
|
42
|
+
if (root.dataset.wired === '1') continue;
|
|
43
|
+
root.dataset.wired = '1';
|
|
44
|
+
|
|
45
|
+
const syncKey = root.dataset.syncKey || null;
|
|
46
|
+
const storageKey = syncKey ? SYNC_PREFIX + syncKey : null;
|
|
47
|
+
|
|
48
|
+
if (storageKey) {
|
|
49
|
+
try {
|
|
50
|
+
const saved = localStorage.getItem(storageKey);
|
|
51
|
+
if (saved) activateByLabel(root, saved);
|
|
52
|
+
} catch {}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
root.addEventListener('tab-container-changed', (ev) => {
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
const tab = ev.tab;
|
|
65
|
+
const label = tab && tab.dataset ? tab.dataset.tabLabel : null;
|
|
66
|
+
if (!label) return;
|
|
67
|
+
if (storageKey) {
|
|
68
|
+
try {
|
|
69
|
+
localStorage.setItem(storageKey, label);
|
|
70
|
+
} catch {}
|
|
71
|
+
}
|
|
72
|
+
if (syncKey) {
|
|
73
|
+
const peers = document.querySelectorAll(
|
|
74
|
+
'[data-publier-cg][data-sync-key="' + syncKey + '"]',
|
|
75
|
+
);
|
|
76
|
+
for (const peer of peers) {
|
|
77
|
+
if (peer === root) continue;
|
|
78
|
+
activateByLabel(peer, label);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
if (!window.__publierCgStorageWired) {
|
|
86
|
+
window.__publierCgStorageWired = true;
|
|
87
|
+
window.addEventListener('storage', (ev) => {
|
|
88
|
+
if (!ev.key || ev.key.indexOf(SYNC_PREFIX) !== 0 || ev.newValue == null) return;
|
|
89
|
+
const syncKey = ev.key.slice(SYNC_PREFIX.length);
|
|
90
|
+
const label = ev.newValue;
|
|
91
|
+
const peers = document.querySelectorAll(
|
|
92
|
+
'[data-publier-cg][data-sync-key="' + syncKey + '"]',
|
|
93
|
+
);
|
|
94
|
+
for (const root of peers) {
|
|
95
|
+
activateByLabel(root, label);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
wire();
|
|
101
|
+
document.addEventListener('astro:page-load', wire);
|
|
102
|
+
})();
|
|
103
|
+
`;export{e as CODE_GROUP_SYNC_SCRIPT};
|