@d1vij/jassm 0.1.19 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -56,7 +56,10 @@ type GlobResult<T> = Record<string, T>;
56
56
  * Removes `.mdx` extension from a path
57
57
  */
58
58
  type StripExtension<T extends string> = T extends `${infer Rest}.mdx` ? Rest : T;
59
- type ResolveEmptyVirtual<Virtual extends string> = Virtual extends "/" ? "" : Virtual;
59
+ type JoinVirtual<
60
+ V extends string,
61
+ P extends string
62
+ > = V extends "" ? P : `${V}/${P}`;
60
63
  /**
61
64
  * Derives the route keys produced by the registry and
62
65
  * replace filesystem root with a virtual route prefix
@@ -73,7 +76,7 @@ type RouteKey<
73
76
  Modules extends Record<string, unknown>,
74
77
  Root extends string,
75
78
  Virtual extends string
76
- > = Extract<keyof Modules, `${Root}/${string}.mdx`> extends `${Root}/${infer Rest}.mdx` ? `${ResolveEmptyVirtual<Virtual>}/${Rest}` : never;
79
+ > = Extract<keyof Modules, `${Root}/${string}.mdx`> extends `${Root}/${infer Rest}.mdx` ? JoinVirtual<Virtual, Rest> : never;
77
80
  /**
78
81
  * Options passed to {@link generateRegistry}
79
82
  */
@@ -98,7 +101,7 @@ type RegistryOptions<
98
101
  /**
99
102
  * Virtual route mount point
100
103
  */
101
- virtual: PathCheck<Virtual>;
104
+ virtual: Virtual;
102
105
  };
103
106
  /**
104
107
  * Internal function used by {@link Registry}.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import{cn as Z}from"@d1vij/shit-i-always-use";import{useMemo as R,useState as G}
2
2
  `);return[t,r].join(`
3
3
  `)}function Ao(o){let t=o.headings.map((n)=>`<th>${n}</th>`).join(""),r=o.rows.map((n)=>{return`<tr>${n.map((l)=>`<td>${l.content}</td>`).join("")}</tr>`});return["<table>","<thead>",`<tr>${t}</tr>`,"</thead>","<tbody>",...r,"</tbody>","</table>"].join(`
4
4
  `)}function Ho(o){let t=`|${o.headings.join("|")}|`,r=`|${o.headings.map(()=>"-----").join("|")}|`,n=o.rows.map((s)=>`|${s.map((l)=>l.content).join("|")}|`);return[t,r,...n].join(`
5
- `)}function Q(o){let t=e(),r=I(null),n=I(null),[s,l]=wo(!1),{copy:m}=So();go(()=>{let c=n.current;if(!c)return;function f(){l(!1)}function i(){l(!0)}return c.addEventListener("mouseenter",i),c.addEventListener("mouseleave",f),()=>{c.removeEventListener("mouseenter",i),c.removeEventListener("mouseleave",f)}},[]);let a=Xo((c)=>{return async()=>{let f=r.current;if(!f)return;let i=No(f),d;switch(c){case"html":d=Ao(i);break;case"csv":d=Lo(i);break;case"markdown":d=Ho(i);break;case"json":d=JSON.stringify(i,null,4);break;default:return}await m(d)}},[m]);return z("div",{className:u(t.table_container),children:[p("table",{ref:r,className:u(t.table),children:o.children}),z("details",{ref:n,className:u(t.table_action_buttons_details),open:s,children:[p("summary",{className:u(t.table_action_buttons_summary),children:"Copy"}),p(y,{setOpen:l,label:"HTML",onClick:a("html")}),p(y,{setOpen:l,label:"CSV",onClick:a("csv")}),p(y,{setOpen:l,label:"Json",onClick:a("json")}),p(y,{setOpen:l,label:"Markdown",onClick:a("markdown")})]})]})}function D(o){let t=e();return p("thead",{className:u(t.table_head),children:o.children})}function U(o){let t=e();return p("tbody",{className:u(t.table_body),children:o.children})}function V(o){let t=e();return p("tr",{className:u(t.table_row),children:o.children})}function F(o){let t=e();return p("th",{className:u(t.table_head_cell),children:o.children})}function K(o){let t=e();return p("td",{className:u(t.table_data),children:o.children})}var jt=["h1","h2","h3","h4","h5","h6","a","em","del","strong","code","blockquote","pre","p","hr","ol","ul","li","img","table","thead","tbody","th","tr","td"],T={h1:(o)=>h({...o,level:1}),h2:(o)=>h({...o,level:2}),h3:(o)=>h({...o,level:3}),h4:(o)=>h({...o,level:4}),h5:(o)=>h({...o,level:5}),h6:(o)=>h({...o,level:6}),a:H,em:O,del:k,strong:_,code:P,blockquote:E,pre:g,p:$,hr:S,ol:(o)=>b({...o,type:"ordered"}),ul:(o)=>b({...o,type:"unordered"}),li:C,img:X,table:Q,thead:D,tbody:U,th:F,tr:V,td:K};import{Suspense as qo}from"react";function ne(o,t=!0){if(t)return{...T,...o};else return{...o}}import{lazy as _o}from"react";function vo({modulesGlob:o,metadataGlob:t,root:r,virtual:n}){let s=Object.keys(o),l=[],m=[],a=[],c=[],f=n==="/"||n===""?"":n;for(let i of s){let d=i.replace(r,f).replace(".mdx",""),L=o[i];l.push(d),m.push([d,_o(L)]),a.push([d,L()]);let A=t[i.replace(".mdx",".meta.ts")];console.log(typeof A),c.push([d,A])}return{keys:l,components:Object.fromEntries(m),exports:Object.fromEntries(a),metadata:Object.fromEntries(c)}}class w{diffKeys(){let o=new Set(this.keys),t=new Set(Object.keys(this.exports)),r=new Set(Object.keys(this.metadata)),n=o.symmetricDifference(t),s=o.symmetricDifference(r),l=[],m={inComponentsButNotInExports:void 0,inComponentsButNotInMetadata:void 0,inExportsButNotInComponents:void 0,inMetadataButNotInComponents:void 0};if(n.size!==0)m.inComponentsButNotInExports=Array.from(o.difference(t)),m.inExportsButNotInComponents=Array.from(t.difference(o)),l.push(`Exports Registry and Component Registry have ${n.size} key mismatches.
5
+ `)}function Q(o){let t=e(),r=I(null),n=I(null),[s,l]=wo(!1),{copy:m}=So();go(()=>{let c=n.current;if(!c)return;function f(){l(!1)}function i(){l(!0)}return c.addEventListener("mouseenter",i),c.addEventListener("mouseleave",f),()=>{c.removeEventListener("mouseenter",i),c.removeEventListener("mouseleave",f)}},[]);let a=Xo((c)=>{return async()=>{let f=r.current;if(!f)return;let i=No(f),d;switch(c){case"html":d=Ao(i);break;case"csv":d=Lo(i);break;case"markdown":d=Ho(i);break;case"json":d=JSON.stringify(i,null,4);break;default:return}await m(d)}},[m]);return z("div",{className:u(t.table_container),children:[p("table",{ref:r,className:u(t.table),children:o.children}),z("details",{ref:n,className:u(t.table_action_buttons_details),open:s,children:[p("summary",{className:u(t.table_action_buttons_summary),children:"Copy"}),p(y,{setOpen:l,label:"HTML",onClick:a("html")}),p(y,{setOpen:l,label:"CSV",onClick:a("csv")}),p(y,{setOpen:l,label:"Json",onClick:a("json")}),p(y,{setOpen:l,label:"Markdown",onClick:a("markdown")})]})]})}function D(o){let t=e();return p("thead",{className:u(t.table_head),children:o.children})}function U(o){let t=e();return p("tbody",{className:u(t.table_body),children:o.children})}function V(o){let t=e();return p("tr",{className:u(t.table_row),children:o.children})}function F(o){let t=e();return p("th",{className:u(t.table_head_cell),children:o.children})}function K(o){let t=e();return p("td",{className:u(t.table_data),children:o.children})}var jt=["h1","h2","h3","h4","h5","h6","a","em","del","strong","code","blockquote","pre","p","hr","ol","ul","li","img","table","thead","tbody","th","tr","td"],T={h1:(o)=>h({...o,level:1}),h2:(o)=>h({...o,level:2}),h3:(o)=>h({...o,level:3}),h4:(o)=>h({...o,level:4}),h5:(o)=>h({...o,level:5}),h6:(o)=>h({...o,level:6}),a:H,em:O,del:k,strong:_,code:P,blockquote:E,pre:g,p:$,hr:S,ol:(o)=>b({...o,type:"ordered"}),ul:(o)=>b({...o,type:"unordered"}),li:C,img:X,table:Q,thead:D,tbody:U,th:F,tr:V,td:K};import{Suspense as qo}from"react";function ne(o,t=!0){if(t)return{...T,...o};else return{...o}}import{lazy as _o}from"react";function vo({modulesGlob:o,metadataGlob:t,root:r,virtual:n}){let s=Object.keys(o),l=[],m=[],a=[],c=[],f=n==="/"||n===""?"":n;console.log("virtual",f);for(let i of s){let d=i.replace(`${r}/`,f).replace(".mdx","");console.log(d);let L=o[i];l.push(d),m.push([d,_o(L)]),a.push([d,L()]);let A=t[i.replace(".mdx",".meta.ts")];console.log(typeof A),c.push([d,A])}return{keys:l,components:Object.fromEntries(m),exports:Object.fromEntries(a),metadata:Object.fromEntries(c)}}class w{diffKeys(){let o=new Set(this.keys),t=new Set(Object.keys(this.exports)),r=new Set(Object.keys(this.metadata)),n=o.symmetricDifference(t),s=o.symmetricDifference(r),l=[],m={inComponentsButNotInExports:void 0,inComponentsButNotInMetadata:void 0,inExportsButNotInComponents:void 0,inMetadataButNotInComponents:void 0};if(n.size!==0)m.inComponentsButNotInExports=Array.from(o.difference(t)),m.inExportsButNotInComponents=Array.from(t.difference(o)),l.push(`Exports Registry and Component Registry have ${n.size} key mismatches.
6
6
  Keys which are present in Component map but not in Exports
7
7
  ${m.inComponentsButNotInExports.join(`
8
8
  `)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d1vij/jassm",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "Just another static site maker. Create simple content driven sites using MDX and React along with Typescript safety.",
5
5
  "homepage": "https://github.com/d1vij/jassm",
6
6
  "license": "MIT",