@donotdev/core 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/functions/index.d.ts +99 -10
- package/functions/index.js +20 -18
- package/i18n/flags/af.svg +1 -0
- package/i18n/flags/al.svg +1 -0
- package/i18n/flags/am.svg +1 -0
- package/i18n/flags/ar.svg +1 -0
- package/i18n/flags/at.svg +1 -0
- package/i18n/flags/au.svg +1 -0
- package/i18n/flags/az.svg +1 -0
- package/i18n/flags/ba.svg +1 -0
- package/i18n/flags/bd.svg +1 -0
- package/i18n/flags/be.svg +1 -0
- package/i18n/flags/bg.svg +1 -0
- package/i18n/flags/bn.svg +1 -0
- package/i18n/flags/br.svg +1 -0
- package/i18n/flags/bs.svg +1 -0
- package/i18n/flags/by.svg +1 -0
- package/i18n/flags/bzh.svg +1 -0
- package/i18n/flags/ca.svg +1 -0
- package/i18n/flags/ch.svg +1 -0
- package/i18n/flags/co.svg +1 -0
- package/i18n/flags/cs.svg +1 -0
- package/i18n/flags/cy.svg +1 -0
- package/i18n/flags/da.svg +1 -0
- package/i18n/flags/de.svg +1 -0
- package/i18n/flags/dz.svg +1 -0
- package/i18n/flags/ee.svg +1 -0
- package/i18n/flags/el.svg +1 -0
- package/i18n/flags/en.svg +1 -0
- package/i18n/flags/es.svg +1 -0
- package/i18n/flags/et.svg +1 -0
- package/i18n/flags/eu.svg +1 -0
- package/i18n/flags/fa.svg +1 -0
- package/i18n/flags/fi.svg +1 -0
- package/i18n/flags/fr-cor.svg +1 -0
- package/i18n/flags/fr.svg +1 -0
- package/i18n/flags/ga.svg +1 -0
- package/i18n/flags/gb-sct.svg +1 -0
- package/i18n/flags/gb.svg +1 -0
- package/i18n/flags/gd.svg +1 -0
- package/i18n/flags/ge.svg +1 -0
- package/i18n/flags/gl.svg +1 -0
- package/i18n/flags/gu.svg +1 -0
- package/i18n/flags/he.svg +1 -0
- package/i18n/flags/hi.svg +1 -0
- package/i18n/flags/hr.svg +1 -0
- package/i18n/flags/hu.svg +1 -0
- package/i18n/flags/hy.svg +1 -0
- package/i18n/flags/id.svg +1 -0
- package/i18n/flags/ie.svg +1 -0
- package/i18n/flags/in.svg +1 -0
- package/i18n/flags/ir.svg +1 -0
- package/i18n/flags/is.svg +1 -0
- package/i18n/flags/it.svg +1 -0
- package/i18n/flags/ja.svg +1 -0
- package/i18n/flags/ke.svg +1 -0
- package/i18n/flags/kg.svg +1 -0
- package/i18n/flags/kh.svg +1 -0
- package/i18n/flags/kk.svg +1 -0
- package/i18n/flags/km.svg +1 -0
- package/i18n/flags/kn.svg +1 -0
- package/i18n/flags/ko.svg +1 -0
- package/i18n/flags/kz.svg +1 -0
- package/i18n/flags/la.svg +1 -0
- package/i18n/flags/lb.svg +1 -0
- package/i18n/flags/lk.svg +1 -0
- package/i18n/flags/lt.svg +1 -0
- package/i18n/flags/lv.svg +1 -0
- package/i18n/flags/ly.svg +1 -0
- package/i18n/flags/ma.svg +1 -0
- package/i18n/flags/md.svg +1 -0
- package/i18n/flags/mk.svg +1 -0
- package/i18n/flags/ml.svg +1 -0
- package/i18n/flags/mm.svg +1 -0
- package/i18n/flags/mn.svg +1 -0
- package/i18n/flags/mr.svg +1 -0
- package/i18n/flags/ms.svg +1 -0
- package/i18n/flags/mt.svg +1 -0
- package/i18n/flags/mx.svg +1 -0
- package/i18n/flags/my.svg +1 -0
- package/i18n/flags/ne.svg +1 -0
- package/i18n/flags/nl.svg +1 -0
- package/i18n/flags/no.svg +1 -0
- package/i18n/flags/np.svg +1 -0
- package/i18n/flags/oc.svg +1 -0
- package/i18n/flags/pa.svg +1 -0
- package/i18n/flags/pk.svg +1 -0
- package/i18n/flags/pl.svg +1 -0
- package/i18n/flags/ps.svg +1 -0
- package/i18n/flags/pt.svg +1 -0
- package/i18n/flags/rm.svg +1 -0
- package/i18n/flags/ro.svg +1 -0
- package/i18n/flags/ru.svg +1 -0
- package/i18n/flags/sa.svg +1 -0
- package/i18n/flags/si.svg +1 -0
- package/i18n/flags/sk.svg +1 -0
- package/i18n/flags/sl.svg +1 -0
- package/i18n/flags/sr.svg +1 -0
- package/i18n/flags/sv.svg +1 -0
- package/i18n/flags/sw.svg +1 -0
- package/i18n/flags/ta.svg +1 -0
- package/i18n/flags/te.svg +1 -0
- package/i18n/flags/th.svg +1 -0
- package/i18n/flags/tj.svg +1 -0
- package/i18n/flags/tl.svg +1 -0
- package/i18n/flags/tn.svg +1 -0
- package/i18n/flags/tr.svg +1 -0
- package/i18n/flags/ua.svg +1 -0
- package/i18n/flags/ur.svg +1 -0
- package/i18n/flags/us.svg +1 -0
- package/i18n/flags/uz.svg +1 -0
- package/i18n/flags/vi.svg +1 -0
- package/i18n/flags/za.svg +1 -0
- package/i18n/flags/zh.svg +1 -0
- package/i18n/locales/eager/dndev_ar.json +2 -1
- package/i18n/locales/eager/dndev_da.json +2 -1
- package/i18n/locales/eager/dndev_de.json +2 -1
- package/i18n/locales/eager/dndev_en.json +2 -1
- package/i18n/locales/eager/dndev_es.json +2 -1
- package/i18n/locales/eager/dndev_fr.json +2 -1
- package/i18n/locales/eager/dndev_it.json +2 -1
- package/i18n/locales/eager/dndev_ja.json +2 -1
- package/i18n/locales/eager/dndev_ko.json +2 -1
- package/i18n/locales/eager/dndev_nl.json +2 -1
- package/i18n/locales/eager/dndev_pl.json +2 -1
- package/i18n/locales/eager/dndev_pt.json +2 -1
- package/i18n/locales/eager/dndev_zh.json +2 -1
- package/i18n/locales/lazy/auth_ar.json +19 -2
- package/i18n/locales/lazy/auth_da.json +22 -2
- package/i18n/locales/lazy/auth_de.json +19 -2
- package/i18n/locales/lazy/auth_en.json +19 -2
- package/i18n/locales/lazy/auth_es.json +19 -2
- package/i18n/locales/lazy/auth_fr.json +19 -2
- package/i18n/locales/lazy/auth_it.json +19 -2
- package/i18n/locales/lazy/auth_ja.json +19 -2
- package/i18n/locales/lazy/auth_ko.json +19 -2
- package/i18n/locales/lazy/auth_nl.json +22 -2
- package/i18n/locales/lazy/auth_pl.json +19 -2
- package/i18n/locales/lazy/auth_pt.json +19 -2
- package/i18n/locales/lazy/auth_zh.json +19 -2
- package/i18n/locales/lazy/crud_ar.json +3 -1
- package/i18n/locales/lazy/crud_da.json +3 -1
- package/i18n/locales/lazy/crud_de.json +3 -1
- package/i18n/locales/lazy/crud_en.json +3 -1
- package/i18n/locales/lazy/crud_es.json +3 -1
- package/i18n/locales/lazy/crud_fr.json +3 -1
- package/i18n/locales/lazy/crud_it.json +3 -1
- package/i18n/locales/lazy/crud_ja.json +3 -1
- package/i18n/locales/lazy/crud_ko.json +3 -1
- package/i18n/locales/lazy/crud_nl.json +3 -1
- package/i18n/locales/lazy/crud_pl.json +3 -1
- package/i18n/locales/lazy/crud_pt.json +3 -1
- package/i18n/locales/lazy/crud_zh.json +3 -1
- package/index.d.ts +6927 -6153
- package/index.js +3 -3
- package/next/index.d.ts +250 -23
- package/next/index.js +556 -594
- package/next/runtime.js +3 -3
- package/package.json +4 -3
- package/server.d.ts +6950 -6153
- package/shared.js +2 -1
- package/symbol-index.json +1 -1
- package/vite/index.d.ts +85 -10
- package/vite/index.js +152 -152
- package/chunks/FlagBase-IQILJTOA.js +0 -1
- package/chunks/chunk-I6HT4XNS.js +0 -1
- package/chunks/chunk-PX544BGJ.js +0 -1
- package/chunks/flagAF-JHV34XMS.js +0 -1
- package/chunks/flagAL-UH6NKHXO.js +0 -1
- package/chunks/flagAM-7XYXA6G6.js +0 -1
- package/chunks/flagAR-LO3YLUZF.js +0 -1
- package/chunks/flagAT-6SWWBNVY.js +0 -1
- package/chunks/flagAU-FIJG7J4T.js +0 -1
- package/chunks/flagAZ-6AIO4DNL.js +0 -1
- package/chunks/flagBA-PIQRWY42.js +0 -1
- package/chunks/flagBD-7PXOE6GM.js +0 -1
- package/chunks/flagBE-2ZP6HCIM.js +0 -1
- package/chunks/flagBG-4XSHCVYH.js +0 -1
- package/chunks/flagBN-OF5XRA5N.js +0 -1
- package/chunks/flagBR-Y2266PSZ.js +0 -1
- package/chunks/flagBS-UV5PVKWJ.js +0 -1
- package/chunks/flagBY-MNAFXBA6.js +0 -1
- package/chunks/flagBZH-AOCZVEVI.js +0 -1
- package/chunks/flagCA-VR6MSBTS.js +0 -1
- package/chunks/flagCH-Q7MV5SPV.js +0 -1
- package/chunks/flagCO-C2YBOMO2.js +0 -1
- package/chunks/flagCS-5BC7NJX6.js +0 -1
- package/chunks/flagCY-PPAUTJGB.js +0 -1
- package/chunks/flagDA-LPI2JRTO.js +0 -1
- package/chunks/flagDE-MQDJAEWL.js +0 -1
- package/chunks/flagDZ-M6NVCF3D.js +0 -1
- package/chunks/flagEE-LY2JJ44X.js +0 -1
- package/chunks/flagEL-PP2HZIV7.js +0 -1
- package/chunks/flagEN-TGFHJYK7.js +0 -1
- package/chunks/flagES-C3H6SSSI.js +0 -1
- package/chunks/flagET-GEZLWRTF.js +0 -1
- package/chunks/flagEU-YJF5577W.js +0 -1
- package/chunks/flagFA-QCQKNEUZ.js +0 -1
- package/chunks/flagFI-LN5ICHNF.js +0 -1
- package/chunks/flagFR-5JPZSUVS.js +0 -1
- package/chunks/flagFR-COR-KPRNU2U6.js +0 -1
- package/chunks/flagGA-PUAQ7VY3.js +0 -1
- package/chunks/flagGB-SCT-RJGHRDJP.js +0 -1
- package/chunks/flagGB-XD2JB7EC.js +0 -1
- package/chunks/flagGD-ABOZBNKE.js +0 -1
- package/chunks/flagGE-N7C2KHVA.js +0 -1
- package/chunks/flagGL-AO2LC4XU.js +0 -1
- package/chunks/flagGU-RNGQ3TIY.js +0 -1
- package/chunks/flagHE-QUAWLF43.js +0 -1
- package/chunks/flagHI-JOOJFNKB.js +0 -1
- package/chunks/flagHR-2U7YEA7P.js +0 -1
- package/chunks/flagHU-6SPEV3OO.js +0 -1
- package/chunks/flagHY-L62LW6BP.js +0 -1
- package/chunks/flagID-LV75M4R3.js +0 -1
- package/chunks/flagIE-LBTC7LCK.js +0 -1
- package/chunks/flagIN-3UWOJ2S3.js +0 -1
- package/chunks/flagIR-44N33GFX.js +0 -1
- package/chunks/flagIS-VCPTXPLZ.js +0 -1
- package/chunks/flagIT-KB4NWTBO.js +0 -1
- package/chunks/flagJA-KLHM6VYH.js +0 -1
- package/chunks/flagKE-MZONPGAJ.js +0 -1
- package/chunks/flagKG-VF3T4E3E.js +0 -1
- package/chunks/flagKH-K5ZXX3DS.js +0 -1
- package/chunks/flagKK-ZZTJKPMR.js +0 -1
- package/chunks/flagKM-Y3XA6HXW.js +0 -1
- package/chunks/flagKN-OMVHGIUS.js +0 -1
- package/chunks/flagKO-UBLOXGRF.js +0 -1
- package/chunks/flagKZ-PYOALOB6.js +0 -1
- package/chunks/flagLA-4ONTEYIB.js +0 -1
- package/chunks/flagLB-FGOBUCL4.js +0 -1
- package/chunks/flagLK-BEVYO56P.js +0 -1
- package/chunks/flagLT-TYWQGIIQ.js +0 -1
- package/chunks/flagLV-S34SVWJJ.js +0 -1
- package/chunks/flagLY-AVR5B6N3.js +0 -1
- package/chunks/flagMA-KHTPMDTL.js +0 -1
- package/chunks/flagMD-TQMYMRQI.js +0 -1
- package/chunks/flagMK-C4CIIAUH.js +0 -1
- package/chunks/flagML-JEE5UGDD.js +0 -1
- package/chunks/flagMM-M72A7CHZ.js +0 -1
- package/chunks/flagMN-34CH7Q43.js +0 -1
- package/chunks/flagMR-KIJ2BPCC.js +0 -1
- package/chunks/flagMS-6COZCDLY.js +0 -1
- package/chunks/flagMT-HDBP7BED.js +0 -1
- package/chunks/flagMX-3XBPZTP5.js +0 -1
- package/chunks/flagMY-Y7C3QGRG.js +0 -1
- package/chunks/flagNE-LCWCYEQW.js +0 -1
- package/chunks/flagNL-3RFQSLLH.js +0 -1
- package/chunks/flagNO-RNDXHKBT.js +0 -1
- package/chunks/flagNP-IKVTRWFR.js +0 -1
- package/chunks/flagOC-JWCST6MI.js +0 -1
- package/chunks/flagPA-5SGZJRNZ.js +0 -1
- package/chunks/flagPK-KQ674PEZ.js +0 -1
- package/chunks/flagPL-V2ITOKFK.js +0 -1
- package/chunks/flagPS-WBOKI4MV.js +0 -1
- package/chunks/flagPT-PFIUVBWR.js +0 -1
- package/chunks/flagRM-MEV6U4AJ.js +0 -1
- package/chunks/flagRO-JPMXEGLK.js +0 -1
- package/chunks/flagRU-3BBKEK34.js +0 -1
- package/chunks/flagSA-N7OI2M6Y.js +0 -1
- package/chunks/flagSI-UTODFLQZ.js +0 -1
- package/chunks/flagSK-EV5JZ2DI.js +0 -1
- package/chunks/flagSL-Y4LHIV2J.js +0 -1
- package/chunks/flagSR-MTRWQPJ5.js +0 -1
- package/chunks/flagSV-LYVDSSJ4.js +0 -1
- package/chunks/flagSW-GJO5P4HE.js +0 -1
- package/chunks/flagTA-CDT3KYEB.js +0 -1
- package/chunks/flagTE-5EXMXH6E.js +0 -1
- package/chunks/flagTH-ODJA4CWB.js +0 -1
- package/chunks/flagTJ-CE5SV6V4.js +0 -1
- package/chunks/flagTL-TRVUF3XO.js +0 -1
- package/chunks/flagTN-G6ERYSZ3.js +0 -1
- package/chunks/flagTR-33VFGL2S.js +0 -1
- package/chunks/flagUA-HESNDKQJ.js +0 -1
- package/chunks/flagUR-ECIZZCDG.js +0 -1
- package/chunks/flagUS-M7R4WRRU.js +0 -1
- package/chunks/flagUZ-YW54WCES.js +0 -1
- package/chunks/flagVI-K3DF2THA.js +0 -1
- package/chunks/flagZA-5UIOKDJH.js +0 -1
- package/chunks/flagZH-5IE3RZVQ.js +0 -1
package/next/runtime.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{readFileSync as
|
|
2
|
-
`)}import
|
|
3
|
-
`)}function
|
|
1
|
+
import{readFileSync as D,existsSync as I}from"node:fs";import{join as N}from"node:path";var w=null,R=0,F=6e4;function q(){let t=Date.now();if(w&&t-R<F)return w;try{let e=N(process.cwd(),"public","metadata-manifest.json");if(!I(e))return null;let n=D(e,"utf-8");return w=JSON.parse(n),R=t,w}catch{return null}}function V(t,e,n){let o=q(),a={title:n?.siteName||"Site"};if(!o)return a;let i=t.startsWith("/")?t:`/${t}`,l=o[i];if(!l)return a;let p=e||l.defaultLocale||"en",r=l.locales[p]||l.locales[l.defaultLocale]||Object.values(l.locales)[0];if(!r)return a;let s=process.env.NEXT_PUBLIC_APP_URL,c={title:r.title,...s&&{metadataBase:new URL(s)}};return r.description&&(c.description=r.description),r.keywords&&(c.keywords=r.keywords),c.openGraph={title:r.title,type:r.type||"website",...r.description&&{description:r.description},...r.image&&{images:[r.image]},...n?.siteName&&{siteName:n.siteName}},c.twitter={card:"summary_large_image",title:r.title,...r.description&&{description:r.description},...r.image&&{images:[r.image]}},r.robots&&(c.robots={index:!1,...r.robots==="noindex, nofollow"&&{follow:!1}}),c}function B(){w=null,R=0}function h(t){return t.split("/").filter(e=>e.startsWith(":")).map(e=>e.slice(1))}function x(t,e){let n=e&&Object.hasOwn(e,t.collection)?e[t.collection]:void 0;if(!n)throw new Error(`[dndev] Route "${t.path}" reads "${t.collection}" records but no read schema was given for that collection (entityReadSchemas of the app's entities).`);return n}async function P(t,e,n,o){let a=h(t.path),i=a[0];if(a.length!==1||!t.collection||!i)throw new Error(`[dndev] Cannot list the public URLs of route "${t.path}". Only single-param routes of an entity collection are expanded. Mark the page \`seo: { noindex: true }\` to keep it out of the sitemap and llms.txt.`);if(!e)throw new Error(`[dndev] Route "${t.path}" lists "${t.collection}" records but no server CRUD reader was given.`);let l=x(t,o),p;try{p=await e.query(t.collection,{where:[{field:"status",operator:"not-in",value:[...n]}],limit:1e3},l)}catch(s){let c=s?.details?.originalMessage??s?.message??String(s);throw new Error(`[dndev] Route "${t.path}" could not read its public "${t.collection}" records (signed-out visitor: RLS / Security Rules must allow it): ${c}`,{cause:s})}let r=[];for(let s of p.items){let c=s[i];typeof c!="string"&&typeof c!="number"||r.push({param:i,value:String(c),record:s})}return r}async function S(t,e,n,o){let a=[];for(let i of t){if(h(i.path).length===0){a.push({route:i,path:i.path});continue}for(let{param:l,value:p,record:r}of await P(i,e,n,o))a.push({route:i,path:i.path.replace(`:${l}`,encodeURIComponent(p)),record:r})}return a}async function H(t,e,n,o){return(await P(t,e,n,o)).map(({param:a,value:i})=>({[a]:i}))}function $(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function X(t,{baseUrl:e,routing:n,trailingSlash:o,crud:a,readSchemas:i,languageUrls:l,hiddenStatuses:p}){let r=[],s=(c,u)=>{let d=l(c,e,n,o),f=n.languages.length>1?{alternates:{languages:d}}:{};for(let y of n.languages)r.push({url:d[y],...u,...f})};for(let{route:c,path:u,record:d}of await S(t,a,p,i)){if(!d){s(u,{changeFrequency:c.changeFrequency??"weekly",priority:c.priority??(u==="/"?1:.8),...c.lastModified&&{lastModified:c.lastModified}});continue}let f=d.updatedAt instanceof Date?d.updatedAt.toISOString():d.updatedAt;s(u,{changeFrequency:c.changeFrequency??"weekly",priority:c.priority??.7,...typeof f=="string"&&{lastModified:f}})}return r}function z(t){let n=['<?xml version="1.0" encoding="UTF-8"?>',`<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${t.some(o=>o.alternates)?' xmlns:xhtml="http://www.w3.org/1999/xhtml"':""}>`];for(let o of t){n.push(" <url>",` <loc>${$(o.url)}</loc>`);for(let[a,i]of Object.entries(o.alternates?.languages??{}))n.push(` <xhtml:link rel="alternate" hreflang="${$(a)}" href="${$(i)}" />`);o.lastModified&&n.push(` <lastmod>${$(o.lastModified)}</lastmod>`),o.changeFrequency&&n.push(` <changefreq>${o.changeFrequency}</changefreq>`),o.priority!==void 0&&n.push(` <priority>${o.priority}</priority>`),n.push(" </url>")}return n.push("</urlset>",""),n.join(`
|
|
2
|
+
`)}import G from"i18next";function T(t,e){return t.startsWith("/")?`${e}${t}`:t}function v(t){return typeof t=="object"&&t!==null&&"collection"in t&&"fields"in t}function L(t,e,n){for(let o of Object.values(t))if(v(o)&&o.collection===e)return o;throw new Error(`[dndev] Entity page "${n}": no entity definition for collection "${e}". Export it from the app's \`entities\` package, or mark the page \`seo: { noindex: true }\`.`)}function W(t,e,n){let o=Object.create(null);for(let a of e)!a.collection||Object.hasOwn(o,a.collection)||(o[a.collection]=n(L(t,a.collection,a.path)).get);return Object.freeze(o)}function _(t,e){let{route:n,value:o,language:a,baseUrl:i,siteName:l,type:p}=e,r=L(e.entities,n.collection,n.path),s=e.deriveEntitySeo(r,t,{t:e.translate([r.namespace,"crud"]),locale:a}),c=h(n.path)[0],u=n.path.replace(`:${c}`,encodeURIComponent(o)),d=g=>e.languageUrl(g,a,i,e.routing,e.trailingSlash),f=d(u),y=s.title?`${s.title} | ${l}`:l,m=T(s.image||e.defaultImage,i),b=p==="product"?e.buildProductJsonLd({...s,images:[...new Set(s.images.map(g=>T(g,i)))]},f):null;return{url:f,title:y,...s.description&&{description:s.description},image:m,type:p,jsonLd:b,breadcrumb:s.title?e.buildBreadcrumbJsonLd(u,l,d,s.title):null}}function E(t){return t.replace(/\s+/g," ").trim()}function A(t){let e=[`# ${E(t.name)}`,""];t.summary&&e.push(`> ${E(t.summary)}`,"");for(let n of t.sections)if(n.links.length!==0){e.push(`## ${E(n.heading)}`,"");for(let o of n.links){let a=`- [${E(o.title)}](${o.url})`;e.push(o.description?`${a}: ${E(o.description)}`:a)}e.push("")}return e.join(`
|
|
3
|
+
`)}function J(t){let e=new Map;for(let n of Object.values(t))v(n)&&e.set(n.collection,n);return e}function Y(t,e){let n=G.createInstance();return n.init({lng:t,resources:{[t]:e},ns:Object.keys(e),interpolation:{escapeValue:!1},initAsync:!1}),o=>n.getFixedT(t,[o,"crud"])}async function K(t){let{crud:e,readSchemas:n,deriveEntitySeo:o,hiddenStatuses:a,formatTrailingSlash:i,trailingSlash:l}=t,p=J(t.entities),r,s=new Map,c=u=>{let d=s.get(u);return d||(d={heading:u,links:[]},s.set(u,d)),d};c(t.pagesHeading);for(let{route:u,path:d,record:f}of await S(t.routes,e,a,n)){let y=`${t.baseUrl}${i(d,l)}`;if(!f){if(!u.title)throw new Error(`[dndev] llms.txt: source route "${u.path}" has no title (getLlmsTxtSource gives every static page one).`);c(u.section??t.pagesHeading).links.push({title:u.title,url:y,...u.description&&{description:u.description}});continue}let m=p.get(u.collection);if(!m)throw new Error(`[dndev] llms.txt: no entity definition for collection "${u.collection}" (route "${u.path}"). Export it from the app's \`entities\` package.`);let b=u.section??(m.namespace?t.entityHeadings[m.namespace]:void 0);if(!b)throw new Error(`[dndev] llms.txt: no heading for route "${u.path}". Add "namePlural" to the ${m.namespace??`entity-${m.name.toLowerCase()}`} translations.`);if(!r){if(!t.language||!t.translations)throw new Error("[dndev] llms.txt: source has no language/translations (getLlmsTxtSource writes them).");r=Y(t.language,t.translations)}let g=o(m,f,{t:r(m.namespace),locale:t.language});c(b).links.push({title:g.title||t.name,url:y,...g.description&&{description:g.description}})}return A({name:t.name,...t.summary&&{summary:t.summary},sections:[...s.values()]})}function Q(t){let e=(t??"").trim().replace(/\/+$/,"");return e?/^https?:\/\//i.test(e)?e:`https://${e}`:null}function Z(t){let e=Q(t);if(!e)throw new Error("[dndev] Set NEXT_PUBLIC_APP_URL: the sitemap and llms.txt publish absolute URLs.");return e}var U=new Set(["website","article"]);async function tt(t,e,n,o,a){let i=h(t.path),l=i[0];if(i.length!==1||!t.collection||!l)throw new Error(`[dndev] Entity page "${t.path}": only single-param routes of an entity collection read a record.`);if(!n)throw new Error(`[dndev] Entity page "${t.path}" reads a "${t.collection}" record but no server CRUD reader was given.`);let p=x(t,a),r;try{r=await n.query(t.collection,{where:[{field:l,operator:"==",value:e},{field:"status",operator:"not-in",value:[...o]}],limit:1},p)}catch(s){let c=s?.details?.originalMessage??s?.message??String(s);throw new Error(`[dndev] Entity page "${t.path}" could not read its public "${t.collection}" record (signed-out visitor: RLS / Security Rules must allow it): ${c}`,{cause:s})}return r.items[0]??null}function et(t,e){let{title:n,description:o,image:a,type:i,jsonLd:l,breadcrumb:p}=_(t,e);return{metadata:{title:{absolute:n},...o&&{description:o},openGraph:{title:{absolute:n},...o&&{description:o},...U.has(i)&&{type:i},images:[a]},twitter:{card:"summary_large_image",title:{absolute:n},...o&&{description:o},images:[a]}},ogType:U.has(i)?null:i,jsonLd:l,breadcrumb:p}}function nt(t){return JSON.stringify(t).replace(/</g,"\\u003c")}import{createHash as ot,timingSafeEqual as rt}from"node:crypto";var j="DNDEV_REVALIDATE_SECRET",M="/api/dndev/revalidate",C=32,O="public",at=["/sitemap.xml","/llms.txt"];function it(t){return t.replace(/[/#?\\]|%(2f|23|3f|5c)/gi,e=>encodeURIComponent(e))}function st(t,e){return e.languages.length<2?[t]:e.languages.map(n=>`/${n}${t==="/"?"":t}`)}function k(t,e,n){let o=new Set,a=new Set;for(let i of t){let l=h(i.path);if(l.length===0){o.add(i.path);continue}let[p]=l;if(!(l.length!==1||!p||i.collection!==e.table)){for(let r of[e.record,e.oldRecord]){let s=r?.[p];typeof s!="string"&&typeof s!="number"||o.add(i.path.replace(`:${p}`,it(String(s))))}for(let r of at)a.add(r)}}for(let i of o)for(let l of st(i,n))a.add(l);return[...a].sort()}function lt(t,e){let n=/^Bearer (.+)$/.exec(t??"");if(!n)return!1;let o=a=>ot("sha256").update(a).digest();return rt(o(n[1]),o(e))}async function ct(t,{secret:e,routes:n,routing:o,readChange:a,revalidatePath:i}){if(!e||e.length<C)throw new Error(`[dndev] Set ${j} to a random secret of at least ${C} characters: the revalidation webhook (${M}) authenticates with it.`);if(!lt(t.headers.get("authorization"),e))return Response.json({error:"Unauthorized"},{status:401});let l;try{l=a(await t.json())}catch(r){if(!(r instanceof Error))throw r;return Response.json({error:r.message},{status:400})}if(l.schema!==O)return Response.json({error:`Table "${l.schema}.${l.table}" is not in the "${O}" schema: only public content tables are revalidated.`},{status:400});let p=k(n,l,o);for(let r of p)i(r);return Response.json({revalidated:p})}export{M as REVALIDATE_ROUTE_PATH,j as REVALIDATE_SECRET_ENV,Z as appBaseUrl,K as buildLlmsTxt,X as buildSitemap,B as clearMetadataCache,et as entityPageSeo,W as entityReadSchemas,z as formatSitemapXml,V as getMetadataForPath,ct as handleRevalidationWebhook,nt as jsonLdScript,H as listStaticParams,tt as readEntityPageRecord,k as revalidationPaths};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@donotdev/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -59,11 +59,12 @@
|
|
|
59
59
|
"vite",
|
|
60
60
|
"next",
|
|
61
61
|
"functions",
|
|
62
|
-
"i18n/locales"
|
|
62
|
+
"i18n/locales",
|
|
63
|
+
"i18n/flags"
|
|
63
64
|
],
|
|
64
65
|
"sideEffects": false,
|
|
65
66
|
"peerDependencies": {
|
|
66
|
-
"@donotdev/components": "^0.3.
|
|
67
|
+
"@donotdev/components": "^0.3.4",
|
|
67
68
|
"@sentry/react": "^10.39.0",
|
|
68
69
|
"i18next": "^26.7.2",
|
|
69
70
|
"i18next-browser-languagedetector": "^8.3.0",
|