@jpmorganchase/mosaic-cli 0.1.0-beta.97 → 1.0.0-beta.99
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/CHANGELOG.md +1768 -0
- package/dist/build.mjs +1 -1
- package/dist/chunk-4YKZMY2L.mjs +1 -0
- package/dist/chunk-5FTIHMJH.mjs +1 -0
- package/dist/chunk-6VZ6ETYU.mjs +1 -0
- package/dist/chunk-C62I76OF.mjs +7 -0
- package/dist/chunk-JZTJ6KFK.mjs +1 -0
- package/dist/chunk-LBGQJ2IK.mjs +1 -0
- package/dist/chunk-LSSCO4BP.mjs +1 -0
- package/dist/chunk-O4CA7KYW.mjs +1 -0
- package/dist/chunk-S7JRZ4XU.mjs +1 -0
- package/dist/chunk-VGWN7S77.mjs +2 -0
- package/dist/chunk-XWU2QBWI.mjs +1 -0
- package/dist/chunk-YQNXGMWC.mjs +5 -0
- package/dist/chunk-ZOJ3LTWN.mjs +1 -0
- package/dist/env.d.ts +49 -0
- package/dist/env.mjs +1 -0
- package/dist/index.mjs +1 -1
- package/dist/plugins/bitbucketRepoUrl.d.ts +23 -0
- package/dist/plugins/bitbucketRepoUrl.mjs +1 -0
- package/dist/plugins/mosaicAdminPlugin.mjs +1 -1
- package/dist/plugins/mosaicFastifyPlugin.d.ts +1 -0
- package/dist/plugins/mosaicFastifyPlugin.mjs +1 -1
- package/dist/plugins/mosaicWebhooksPlugin.d.ts +16 -0
- package/dist/plugins/mosaicWebhooksPlugin.mjs +1 -0
- package/dist/plugins/mosaicWorkflowsPlugin.d.ts +9 -10
- package/dist/plugins/mosaicWorkflowsPlugin.mjs +1 -1
- package/dist/plugins/resolveRawSourcePath.d.ts +102 -0
- package/dist/plugins/resolveRawSourcePath.mjs +1 -0
- package/dist/plugins/security.d.ts +24 -0
- package/dist/plugins/security.mjs +1 -0
- package/dist/plugins/workflowJobs.d.ts +91 -0
- package/dist/plugins/workflowJobs.mjs +1 -0
- package/dist/revalidateNotifier.d.ts +50 -0
- package/dist/revalidateNotifier.mjs +1 -0
- package/dist/routeInventory.d.ts +15 -0
- package/dist/routeInventory.mjs +1 -0
- package/dist/serve.d.ts +2 -1
- package/dist/serve.mjs +1 -1
- package/fs.config.js +16 -1
- package/package.json +19 -21
- package/dist/chunk-4JWFWIG4.mjs +0 -1
- package/dist/chunk-5Q7PLJAC.mjs +0 -3
- package/dist/chunk-A623VBSD.mjs +0 -1
- package/dist/chunk-KX3ED265.mjs +0 -1
- package/dist/chunk-P3RXN7HU.mjs +0 -1
- package/dist/chunk-XMNLIWPG.mjs +0 -1
- package/dist/chunk-XZI6BLBY.mjs +0 -1
- package/dist/upload-s3-snapshot.d.ts +0 -1
- package/dist/upload-s3-snapshot.mjs +0 -1
- package/dist/vercel-snapshot.d.ts +0 -10
- package/dist/vercel-snapshot.mjs +0 -1
package/dist/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-YQNXGMWC.mjs";import"./chunk-5FTIHMJH.mjs";export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as E}from"./chunk-O4CA7KYW.mjs";import{a as b,b as k}from"./chunk-6VZ6ETYU.mjs";import{createHmac as B}from"node:crypto";import T from"fastify-plugin";var $="MOSAIC_BITBUCKET_WEBHOOK_SECRET",M=1024*1024,x=5e3,F="source-git-repo";function w(t){return t.replace(/^refs\/(heads|tags)\//,"")}function C(t,r,f){if(typeof r!="string")return!1;let i=/^sha256=([0-9a-f]{64})$/i.exec(r.trim());if(!i)return!1;let a=B("sha256",f).update(t).digest("hex");return k(i[1].toLowerCase(),a)}function I(t){let r;try{r=JSON.parse(t.toString("utf8"))}catch{return}let f=r?.repository?.project?.key,i=r?.repository?.slug;if(typeof f!="string"||typeof i!="string")return;let a=new Set;for(let o of Array.isArray(r.changes)?r.changes:[])if(!(!o||o.type==="DELETE"))for(let p of[o.ref?.displayId,o.ref?.id,o.refId])typeof p=="string"&&p!==""&&a.add(w(p));return{projectKey:f,repoSlug:i,refs:a}}function O(t,r,f){let{core:i}=t.mosaic,a=r.debounceMs??x,o=new Map;t.addContentTypeParser("application/json",{parseAs:"buffer",bodyLimit:M},(e,s,n)=>n(null,s)),t.addHook("onClose",(e,s)=>{o.forEach(n=>clearTimeout(n)),o.clear(),s()});let p=async e=>{try{await i.refreshSource(e)?console.log(`[Mosaic] Webhook: checked ${e} for changes.`):console.warn(`[Mosaic] Webhook: ${e} can't refresh on demand; it picks up the push at its next scheduled check.`)}catch(s){console.error(`[Mosaic] Webhook: refreshing ${e} failed.`,s)}},_=e=>{if(o.has(e))return!1;let s=setTimeout(()=>{o.delete(e),p(e)},a);return s.unref(),o.set(e,s),!0},v=async({projectKey:e,repoSlug:s,refs:n})=>{let m=e.toLowerCase(),h=s.toLowerCase();return(await i.listSources()).map(({name:d})=>d).filter(d=>{let g=i.getSourceDefinition(d);if(!g?.modulePath?.includes(F))return!1;let{repo:l,branch:y}=g.options??{};if(typeof l!="string"||typeof y!="string")return!1;let c=E(l);return c?.projectKey===m&&c.repoSlug===h&&n.has(w(y))})};t.post("/webhooks/bitbucket",{bodyLimit:M,onRequest:(e,s,n)=>{if(b($)){n();return}s.callNotFound()}},async(e,s)=>{let n=b($);if(!n)return s.callNotFound();let m=Buffer.isBuffer(e.body)?e.body:Buffer.alloc(0);if(!C(m,e.headers["x-hub-signature"],n))return s.code(401).send({message:"Missing or invalid X-Hub-Signature."});let h=e.headers["x-event-key"];if(h==="diagnostics:ping")return s.code(200).send({message:"Webhook is set up."});if(h!=="repo:refs_changed")return s.code(202).send({message:`Ignored event '${String(h)}'.`});let u=I(m);if(!u)return s.code(400).send({message:"Invalid repo:refs_changed payload."});let d=`${u.projectKey}/${u.repoSlug}`,g=Array.from(u.refs).join(", ")||"no refs",l=e.headers["x-request-id"],y=`push to ${d} (${g})${typeof l=="string"?` [${l}]`:""}`,c=await v(u);if(c.length===0)return console.log(`[Mosaic] Webhook: ${y} matches no source.`),s.code(202).send({message:`No git-repo source follows ${d} at ${g}.`,sources:c});for(let S of c){let R=_(S)?`refreshing in ${a}ms`:"refresh already scheduled";console.log(`[Mosaic] Webhook: ${y}: ${S} ${R}.`)}return s.code(202).send({message:`Refreshing ${c.length} source${c.length===1?"":"s"}.`,sources:c})}),f()}var A=T(O,{fastify:"5.x",name:"fastify-mosaic-webhooks",dependencies:["fastify-mosaic"],encapsulate:!0});export{A as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"node:fs/promises";import e from"node:path";var S=new Set(["mosaic-snapshot.json","mosaic-routes.json","shared-config.json","sidebar.json","sitemap.xml","search-records.json","markdown-pages.json","llms.txt","llms-full.txt"]),p=n=>n.startsWith("/")&&!n.includes("\\")&&!/[\x00-\x1f\x7f]/.test(n)&&(n==="/"||n.slice(1).split("/").every(a=>a&&!a.startsWith(".")));async function P({root:n,files:a,aliases:w,pageExtensions:x,ignorePages:y=[]}){let f=await r.realpath(n),d=t=>p(t)&&x.some(s=>t.endsWith(s))&&!y.some(s=>t.endsWith(s))&&!S.has(e.posix.basename(t)),l=t=>e.join(f,t),m=t=>{let s=e.relative(f,t);if(s===".."||s.startsWith(`..${e.sep}`)||e.isAbsolute(s))throw new Error(`Snapshot route resolves outside its output directory: ${t}`);return`/${s.split(e.sep).join("/")}`},i=new Set(a.filter(d)),g=async(t,s=new Set)=>{if(!p(t))return;let o;try{o=await r.realpath(l(t))}catch(h){throw new Error(`Snapshot alias '${t}' is dangling or cyclic`,{cause:h})}let c=m(o);if((await r.stat(o)).isDirectory()){if(s.has(o))throw new Error(`Snapshot directory alias '${t}' is cyclic`);let h=new Set(s).add(o);for(let E of await r.readdir(o))await g(`${t}/${E}`,h);i.add(t)}else d(c)&&i.add(t)};for(let t of w.filter(p))await g(t);for(let t of i)t.endsWith("/index.mdx")&&i.add(t.slice(0,-4));for(let t of[...i])for(let s=e.posix.dirname(t);i.add(s),s!=="/";s=e.posix.dirname(s));let u=[];for(let t of i){let s=l(t.endsWith("/index")?`${t}.mdx`:t);try{(await r.stat(s)).isDirectory()&&(s=e.join(s,"index"));let o=await r.realpath(s);if(!(await r.stat(o)).isFile())continue;let c=m(o);if(!d(c))continue;u.push({pathname:t.split("/").map(encodeURIComponent).join("/"),sourcePathname:c})}catch(o){if(o.code==="ENOENT")continue;throw o}}return u.sort((t,s)=>t.pathname<s.pathname?-1:t.pathname>s.pathname?1:0)}export{P as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{timingSafeEqual as f}from"node:crypto";var o=new Set(["local-dev-workflows-secret"]);function c(t){let n=process.env[t];if(n&&!(process.env.NODE_ENV!=="development"&&o.has(n)))return n}function l(t,n){let e=Buffer.from(t,"utf8"),r=Buffer.from(n,"utf8");return e.length!==r.length?!1:f(e,r)}function a(t,n){let e=t[n];if(typeof e=="string"&&e.length>0)return e;let r=t.authorization;if(typeof r!="string")return null;if(r.startsWith("Bearer "))return r.slice(7);if(r.startsWith("Basic ")){let i=Buffer.from(r.slice(6),"base64").toString("utf8"),s=i.indexOf(":");return s>=0&&s<i.length-1?i.slice(s+1):null}return null}function g(t,n=1024){return typeof t!="string"||t.length<2||t.length>n||!t.startsWith("/")||t.includes("\\")||/[\x00-\x1f\x7f]/.test(t)?!1:t.slice(1).split("/").every(e=>e!==""&&e!=="."&&e!=="..")}export{c as a,l as b,a as c,g as d};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{randomUUID as c}from"node:crypto";function w(r){return r%6e4===0?r===6e4?"1 minute":`${r/6e4} minutes`:r%1e3===0?r===1e3?"1 second":`${r/1e3} seconds`:`${r} ms`}var h=class{constructor(e,{maxEvents:t,timeoutMs:n,now:o}){this.userId=e;this.#r=Math.max(1,t),this.#o=o,n>0&&(this.#t=setTimeout(()=>this.fail(`The workflow did not finish within ${w(n)}. It may still finish. Check for its result before retrying.`),n),this.#t.unref?.())}userId;id=c();events=[];status="running";finishedAt;#e=new Set;#t;#r;#o;get done(){return this.status!=="running"}progress(e,t){this.done||this.events.length>=this.#r-1||this.#s("progress",{status:e,message:t})}succeed(e){this.#n("success",{status:"SUCCESS",message:e})}fail(e){this.#n("error",{status:"ERROR",message:e})}eventsAfter(e){return this.events.filter(t=>t.id>e)}subscribe(e){return this.done?()=>{}:(this.#e.add(e),()=>{this.#e.delete(e)})}#n(e,t){this.done||(clearTimeout(this.#t),this.status=e,this.finishedAt=this.#o(),this.#s("done",t),this.#e.clear())}#s(e,t){let n={id:this.events.length+1,event:e,data:t};this.events.push(n);for(let o of[...this.#e])o(n)}},b=class{#e=new Map;#t;#r;#o;#n;constructor({maxJobs:e=100,maxEventsPerJob:t=500,retentionMs:n=600*1e3,now:o=Date.now}={}){this.#t=e,this.#r=t,this.#o=n,this.#n=o}get size(){return this.#e.size}get capacity(){return this.#t}create(e,t){this.prune();for(let[o,s]of this.#e){if(this.#e.size<this.#t)break;s.done&&this.#e.delete(o)}if(this.#e.size>=this.#t)return;let n=new h(e,{maxEvents:this.#r,timeoutMs:t,now:this.#n});return this.#e.set(n.id,n),n}get(e){return this.prune(),this.#e.get(e)}prune(){let e=this.#n();for(let[t,n]of this.#e)n.finishedAt!==void 0&&e-n.finishedAt>=this.#o&&this.#e.delete(t)}};function v({id:r,event:e,data:t}){return`id: ${r}
|
|
2
|
+
event: ${e}
|
|
3
|
+
data: ${JSON.stringify(t)}
|
|
4
|
+
|
|
5
|
+
`}function p(r,e,{lastEventId:t=0,pingIntervalMs:n=15e3}={}){let o=!1,s=()=>{},l=setInterval(()=>{o||e.write(`: ping
|
|
6
|
+
|
|
7
|
+
`)},n);l.unref?.();let u=()=>{o||(o=!0,clearInterval(l),s(),e.off("close",u))},f=()=>{o||(u(),e.end())},d=i=>{o||(e.write(v(i)),i.event==="done"&&f())};e.on("close",u);let a=r.eventsAfter(t);r.done&&a.length===0&&(a=r.events.slice(-1));for(let i of a)d(i);return o||(s=r.subscribe(d)),f}export{h as a,b,v as c,p as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"node:path";import{getWorktreeDir as g}from"@jpmorganchase/mosaic-source-git-repo";var h="@jpmorganchase/mosaic-source-local-folder",D="@jpmorganchase/mosaic-source-git-repo",O=new Set(["@jpmorganchase/mosaic-source-http","@jpmorganchase/mosaic-source-figma","@jpmorganchase/mosaic-source-storybook","@jpmorganchase/mosaic-source-readme"]);function P(i){let s;try{s=decodeURIComponent(i.split(/[?#]/,1)[0])}catch{return}let r=`/${s}`.replace(/\/{2,}/g,"/").replace(/\/$/,"");return r===""?"/":r}function k(i,s){let r=P(i);if(r===void 0)return{kind:"no-matching-source",url:i};let a=[],p=[];for(let e of s){if(e.disabled)continue;(e.options??{}).prefixDir?a.push(e):p.push(e)}for(let e of[...a,...p]){let o=e.options??{},c=o.prefixDir?`/${o.prefixDir.replace(/^\//,"").replace(/\/$/,"")}`:"";if(c&&!r.startsWith(`${c}/`))continue;let u=c?r.slice(c.length).replace(/^\//,""):r.replace(/^\//,"");if(!u)continue;let n;if(e.modulePath===h)n=o.rootDir;else if(e.modulePath===D){if(o.repo&&o.branch&&o.subfolder)try{let m=g(o.repo,o.branch);n=t.join(m,o.subfolder)}catch{n=void 0}}else return{kind:"unsupported-source",modulePath:e.modulePath,namespace:e.namespace};if(!n)continue;let l=t.resolve(n,u),d=t.resolve(n),f=t.relative(d,l);return f.startsWith("..")||t.isAbsolute(f)?{kind:"no-matching-source",url:r}:{kind:"resolved",filePath:l,namespace:e.namespace,rootDir:d}}return{kind:"no-matching-source",url:r}}var S=O;export{P as a,k as b,S as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as u}from"./chunk-LSSCO4BP.mjs";import{a as d}from"./chunk-ZOJ3LTWN.mjs";import{d as c,e as m}from"./chunk-VGWN7S77.mjs";import{a as p}from"./chunk-FCNWFPGR.mjs";import{a as l}from"./chunk-XWU2QBWI.mjs";import{a as f}from"./chunk-S7JRZ4XU.mjs";import{a as g}from"./chunk-4YKZMY2L.mjs";import v from"fastify";import $ from"cors";import x from"@fastify/middie";var M="_mosaic_",o=v({logger:!1,pluginTimeout:2e4});async function E(r,t,s,e="localhost"){m(e);let i=c(),a=await p(r),y=d(a,i.revalidate);o.addHook("onClose",async()=>y.stop()),await o.register(x),await o.register(f,{config:r,scope:s,mosaic:a}),await o.register(u,{timeoutMs:i.workflowsTimeoutMs}),await o.register(l,{prefix:M,enableSourcePush:r.enableSourcePush}),await o.register(g,{prefix:`/${M}`}),o.get("/actuator/keepalive",async(n,w)=>w.code(200).send("OK")),i.corsOrigins.length>0&&o.use($({origin:i.corsOrigins})),await(async()=>{try{await o.listen({port:t,host:e}),console.log(`[Mosaic] Listening on ${e}:${t}${Array.isArray(s)?` (scoped to ${s.join(", ")})`:""}`)}catch(n){console.error(S(n,e,t)),process.exit(1)}})()}function S(r,t,s){let{code:e,message:i}=r??{},a=e==="EADDRINUSE"?"the port is already in use":i||String(r);return`[Mosaic] Unable to listen on ${t}:${s}: ${a}`}export{o as a,E as b,S as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as I,d as j}from"./chunk-C62I76OF.mjs";import{a as O,b as x,c as F,d as h}from"./chunk-6VZ6ETYU.mjs";import T from"fastify-plugin";import{workflowDefaultsSchema as J}from"@jpmorganchase/mosaic-schemas";import{validateCommitMessage as H}from"@jpmorganchase/mosaic-schemas/commitMessage";import L from"node:path";var U=5*1024*1024,K="x-mosaic-workflows-secret";function N(e){if(!e||typeof e!="object"||Array.isArray(e))return"Workflow request must be a JSON object";let r=e;if(typeof r.name!="string"||r.name==="")return"Workflow name is required";let n=r.user,i=n?.id??n?.sid;if(!n||typeof n!="object"||typeof i!="string"||i==="")return"Workflow must be run for a user";if(!h(r.route))return"Workflow route is invalid";if(r.targetRoute!==void 0&&!h(r.targetRoute))return"Workflow target route is invalid";if(r.isNewPage!==void 0&&typeof r.isNewPage!="boolean")return"Invalid new-page flag";if(r.commitMessage!==void 0){let u=H(r.commitMessage);if(u)return u}return r}function D(e){let r=Array.isArray(e)?e[0]:e;return typeof r=="string"&&/^\d{1,9}$/.test(r)?Number(r):0}async function b(e,r){let n=O("MOSAIC_WORKFLOWS_SECRET");if(!n)return r.code(503).send({error:"Workflows are disabled: MOSAIC_WORKFLOWS_SECRET is not configured."});let i=F(e.headers,K);if(!i||!x(i,n))return r.code(401).send({error:"Unauthorized."})}function E(e,r,n){let i=typeof e.statusCode=="number"&&e.statusCode>=400?e.statusCode:500;return i>=500&&console.error("[Mosaic] Workflow request failed",e),n.code(i).send({error:e.message||"Workflow request failed"})}async function z(e,r,n){let i,u=(a,d)=>{d==="ERROR"?e.fail(a):d==="COMPLETE"?i??={message:a}:e.progress(d,a)};try{await r(u)===!1?e.fail(`Workflow ${n} could not be run`):e.succeed(i?i.message:`Workflow ${n} finished`)}catch(a){console.error(`[Mosaic] Workflow ${n} failed`,a),e.fail(a instanceof Error?a.message:`Workflow ${n} failed`)}}async function B(e,{timeoutMs:r,jobs:n,pingIntervalMs:i}){let{fs:u,core:a,scope:d}=e.mosaic,p=d?{namespaces:d}:void 0,k=new I(n),l=new Set,y=new Set;e.addHook("preClose",async()=>{for(let o of y)o()});async function P(o,s){if(s){let f=/\.mdx?$/.test(o)?o:`${o}.mdx`;return await u.promises.exists(f)?{status:409,error:`${f} already exists`}:{pagePath:f}}if(!await u.promises.exists(o))return{status:404,error:`${o} not found`};let t=(await u.promises.stat(o)).isDirectory()?L.posix.join(o,"index"):o;return{pagePath:await u.promises.realpath(t)}}e.post("/workflows/defaults",{bodyLimit:16*1024,onRequest:b,errorHandler:E},async(o,s)=>{let t=N(o.body);if(typeof t=="string")return s.code(400).send({error:t});let f=await P(t.route,t.isNewPage===!0);if("error"in f)return s.code(f.status).send({error:f.error});try{let c=await a.prepareWorkflow(t.name,f.pagePath,{...t.isNewPage===!0?{isNewPage:!0}:{},...typeof t.targetRoute=="string"?{targetRoute:t.targetRoute}:{}},p);return s.header("Cache-Control","no-store").send(J.parse(c))}catch{return s.code(400).send({error:"Could not load workflow defaults."})}}),e.post("/workflows/jobs",{bodyLimit:U,onRequest:b,errorHandler:E},async(o,s)=>{let t=N(o.body);if(typeof t=="string")return s.code(400).send({error:t});let{type:f,token:c,channel:W,route:A,name:w,user:R,...v}=t,C=R.id??R.sid,_={user:R,...v},q=v.isNewPage===!0,g=await P(A,q);if("error"in g)return s.code(g.status).send({error:g.error});let{pagePath:M}=g,S=JSON.stringify([C,w,M]);if(l.has(S))return s.code(409).send({error:"Your previous workflow for this page is still running. Check for its result before retrying."});let m=l.size<k.capacity?k.create(C,r):void 0;return m?(l.add(S),m.progress("IN_PROGRESS",`Starting workflow ${w}`),z(m,$=>a.triggerWorkflow($,w,M,_,q?{...p,newPage:!0}:p),w).finally(()=>l.delete(S)),s.code(202).send({jobId:m.id})):s.code(503).header("Retry-After","30").send({error:"Too many workflows are running. Try again shortly."})}),e.get("/workflows/jobs/:id/events",{onRequest:b,errorHandler:E},async(o,s)=>{let t=k.get(o.params.id);if(!t||typeof o.query.user!="string"||o.query.user!==t.userId)return s.code(404).send({error:"Workflow job not found"});let f=D(o.headers["last-event-id"]??o.query.lastEventId);s.hijack();let c=s.raw;c.writeHead(200,{"Content-Type":"text/event-stream; charset=utf-8","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}),c.flushHeaders();let W=j(t,c,{lastEventId:f,pingIntervalMs:i});return y.add(W),c.once("close",()=>y.delete(W)),s})}var re=T(B,{fastify:"5.x",name:"fastify-mosaic-workflows",dependencies:["fastify-mosaic"]});export{re as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function u(t,o){let r=o?.replace(/\.git$/i,"");if(!(!t||!r))return{projectKey:t.toLowerCase(),repoSlug:r.toLowerCase()}}function f(t){try{return decodeURIComponent(t)}catch{return t}}function p(t){if(typeof t!="string")return;let o=t.trim(),r=/^[^/@:]+@[^/:]+:(?!\/)(.+)$/.exec(o),i,s;if(r)i="ssh:",s=`/${r[1]}`;else try{({protocol:i,pathname:s}=new URL(o))}catch{return}let e=s.split("/").filter(Boolean).map(f),c=e.findIndex((n,d)=>n==="projects"&&e[d+2]==="repos");if(c>=0)return u(e[c+1],e[c+3]);if(i==="http:"||i==="https:"){let n=e.lastIndexOf("scm");return n>=0&&e.length===n+3?u(e[n+1],e[n+2]):void 0}if(i==="ssh:"&&e.length===2)return u(e[0],e[1])}export{p as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as x,b as g}from"./chunk-JZTJ6KFK.mjs";import y from"fastify-plugin";import e from"node:path";import m from"node:fs";var h="/_mosaic-raw";async function C(d,w){let{config:M,scope:n,mosaic:r}=w,c=Array.isArray(n)?r.filesystem.scope(n):r.filesystem;d.decorate("mosaic",{config:M,core:r,fs:c,scope:n}),d.get(`${h}/*`,async(t,s)=>{let a=x(t.url.slice(h.length)||"/");if(a===void 0){s.header("X-Mosaic-Raw-Status","no-matching-source"),s.status(404).send();return}let f=await r.getSourceDefinitionForPath(a,n),R=f?[f]:(await r.listSources()).flatMap(({name:u})=>{let i=r.getSourceDefinition(u);return i&&(!Array.isArray(n)||n.includes(i.namespace))?[i]:[]}),o=g(t.url.slice(h.length),R);if(o.kind==="no-matching-source"){s.header("X-Mosaic-Raw-Status","no-matching-source"),s.status(404).send();return}if(o.kind==="unsupported-source"){s.header("X-Mosaic-Raw-Status","unsupported-source"),s.header("X-Mosaic-Raw-Module",o.modulePath),s.status(404).send();return}try{let[u,i]=await Promise.all([m.promises.realpath(o.rootDir),m.promises.realpath(o.filePath)]),l=e.relative(u,i);if(l===".."||l.startsWith(`..${e.sep}`)||e.isAbsolute(l)){s.header("X-Mosaic-Raw-Status","no-matching-source"),s.status(404).send();return}if(!(await m.promises.stat(i)).isFile()){s.header("X-Mosaic-Raw-Status","not-a-file"),s.status(404).send();return}let p=e.extname(o.filePath);p===".mdx"?s.header("Content-Type","text/mdx"):p===".json"?s.header("Content-Type","application/json"):p===".xml"&&s.header("Content-Type","application/xml"),s.header("X-Mosaic-Raw-Namespace",o.namespace);let F=await m.promises.readFile(i);s.send(F)}catch(u){if(u?.code==="ENOENT"){s.status(404).send();return}console.error("[Mosaic][raw]",u),s.status(500).send()}}),d.get("/*",async(t,s)=>{try{if(await c.promises.exists(t.url))if((await c.promises.stat(t.url)).isDirectory())await c.promises.exists(e.join(t.url,"index"))?(s.header("Content-Type","application/json"),s.status(302).send({redirect:e.posix.join(t.url,"index")})):s.status(404);else{let a=String(await c.promises.realpath(t.url));e.extname(a)===".mdx"?s.header("Content-Type","text/mdx"):e.extname(a)===".json"?s.header("Content-Type","application/json"):e.extname(a)===".xml"&&s.header("Content-Type","application/xml");let f=await c.promises.readFile(t.url);s.send(f)}else s.status(404)}catch(a){console.error(a),s.status(500)}})}var A=y(C,{fastify:"5.x",name:"fastify-mosaic"});export{A as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{z as d}from"zod";import{isIP as _}from"node:net";var a=class extends Error{problems;constructor(e){super(["Invalid configuration in environment variables:",...e.map(r=>` - ${r}`)].join(`
|
|
2
|
+
`)),this.name="InvalidEnvError",this.problems=e}},o=2**31-1,m=300*1e3,c=t=>t===void 0||t==="";function n(t){return d.string().optional().superRefine((e,r)=>{if(!c(e))for(let s of t(e))r.addIssue({code:"custom",message:s})})}var i=n(t=>t.trim()===""?["must not be blank"]:[]),E=n(t=>{try{if(["http:","https:"].includes(new URL(t).protocol))return[]}catch{}return["must be an absolute http(s) URL"]});function I(t){let e;try{e=new URL(t)}catch{return`"${t}" is not an origin (scheme://host[:port])`}let r=`${e.protocol}//${e.host}`;if(!(e.host!==""&&t===r))return e.host===""?`"${t}" is not an origin (scheme://host[:port])`:`"${t}" is not an origin (scheme://host[:port]); use "${r}"`}var p=n(t=>S(t).map(I).filter(e=>e!==void 0)),O=d.object({MOSAIC_ADMIN_SECRET:i,MOSAIC_WORKFLOWS_SECRET:i,MOSAIC_WORKFLOWS_TIMEOUT_MS:n(t=>/^\d+$/.test(t)&&Number(t)>=1&&Number(t)<=o?[]:[`must be an integer between 1 and ${o} (got "${t}")`]),MOSAIC_BITBUCKET_WEBHOOK_SECRET:i,MOSAIC_CORS_ORIGINS:p,MOSAIC_REVALIDATE_URL:E,MOSAIC_REVALIDATE_SECRET:i,MOSAIC_SOURCE_BOOT_TIMEOUT_MS:n(t=>/^\d+$/.test(t)&&Number(t)<=o?[]:[`must be a whole number of milliseconds up to ${o}, or 0 to wait forever (got "${t}")`]),BITBUCKET_API_URL:E}).superRefine((t,e)=>{!c(t.MOSAIC_REVALIDATE_URL)&&c(t.MOSAIC_REVALIDATE_SECRET)&&e.addIssue({code:"custom",path:["MOSAIC_REVALIDATE_SECRET"],message:"is required when MOSAIC_REVALIDATE_URL is set"})});function S(t){return(t??"").split(",").map(e=>e.trim()).filter(Boolean)}function f(t){let e=O.safeParse(t);return e.success?[]:e.error.issues.map(r=>`${r.path.map(String).join(".")}: ${r.message}`)}function A(t=process.env){let e=f(t);if(e.length>0)throw new a(e);let r=t.MOSAIC_REVALIDATE_URL,s=t.MOSAIC_REVALIDATE_SECRET,u=t.MOSAIC_WORKFLOWS_TIMEOUT_MS;return{corsOrigins:S(t.MOSAIC_CORS_ORIGINS),workflowsTimeoutMs:c(u)?m:Number(u),revalidate:r&&s?{url:r,secret:s}:void 0}}function R(t){let e=/^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\.?$/i;if(!_(t)&&!e.test(t))throw new Error("Invalid --host: expected a hostname or IP address without a scheme or port.");return t}export{a,O as b,f as c,A as d,R as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as l,b as y,c as h}from"./chunk-6VZ6ETYU.mjs";import g from"fastify-plugin";var R="@jpmorganchase/mosaic-source-git-repo";function S(n){let o=n?.options;if(o?.credentials&&n.modulePath===R){let[r]=o.credentials.split(":");return{...n,options:{...o,credentials:`${r}: ********`}}}return n}var E="x-mosaic-admin-secret";function A(){return!l("MOSAIC_ADMIN_SECRET")&&process.env.NODE_ENV==="development"}async function T(n,o){let r=l("MOSAIC_ADMIN_SECRET");if(!r)return process.env.NODE_ENV==="development"?void 0:o.code(403).header("Content-Type","application/text").send("The Mosaic admin API is disabled. Set MOSAIC_ADMIN_SECRET to enable it.");let s=h(n.headers,E);if(!s||!y(s,r))return o.code(401).header("WWW-Authenticate",'Basic realm="Mosaic admin", charset="UTF-8"').header("Content-Type","application/text").send("Unauthorized.")}function C(n,o,r){let{prefix:s}=o,{config:f,fs:m,core:u}=n.mosaic,c={preHandler:T};A()&&console.warn(`[Mosaic] Admin API /${s}/* is open: MOSAIC_ADMIN_SECRET is not set and NODE_ENV=development.`),n.get(`/${s}/config`,c,async(i,e)=>{e.header("Content-Type","application/json"),e.send({...f,sources:f.sources.map(S)})}),n.get(`/${s}/content/dump`,c,(i,e)=>{e.header("Content-Type","application/json"),e.send(m.toJSON())}),n.get(`/${s}/tags/list`,async(i,e)=>{e.header("Content-Type","application/json");try{if(!await m.promises.exists("/.tags")){e.send([]);return}let t=await m.promises.readdir("/.tags");e.send(t.slice().sort())}catch(t){console.error("[Mosaic][admin] /tags/list failed",t),e.send([])}}),n.get(`/${s}/sources/list`,c,async(i,e)=>{e.header("Content-Type","application/json");let a=(await u.listSources()).map(d=>{let p=f.sources[d.index];return{name:d.name,...p?S(p):{},pluginErrors:d.pluginErrors}});e.send(a)}),n.put(`/${s}/source/stop`,c,async(i,e)=>{e.header("Content-Type","application/text");let{name:t}=i.body;if(t)try{await u.stopSource(String(t)),e.send(`${t} stopped successfully.`)}catch(a){console.error(a),e.status(500).send(`${t} not stopped. Check you have the right name!`)}else e.status(500).send("No source name provided.")}),n.put(`/${s}/source/restart`,c,async(i,e)=>{e.header("Content-Type","application/text");let{name:t}=i.body;if(t)try{await u.restartSource(String(t)),e.send(`${t} restarted successfully.`)}catch(a){console.error(a),e.status(500).send(`${t} not restarted. Check you have the right name!`)}else e.status(500).send("No source name provided.")}),n.post(`/${s}/source/add`,c,async(i,e)=>{try{let{definition:t,isPreview:a=!0}=i.body;if(e.header("Content-Type","application/text"),!o.enableSourcePush)throw new Error("Source push is disabled.");if(!t)throw new Error("Source definition is required");if(a){let p=`preview-${t.namespace}`;t.namespace=p}let d=await u.addSource(t);e.send(d!==void 0?`Source ${d.id.description} added successfully`:"Unable to add source")}catch(t){console.error(t),e.status(500).send(t.message)}}),r()}var _=g(C,{fastify:"5.x",name:"fastify-mosaic-admin",dependencies:["fastify-mosaic"]});export{_ as a};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as j}from"./chunk-5FTIHMJH.mjs";import l from"node:fs";import s from"node:path";import{randomUUID as k}from"node:crypto";import I from"deepmerge";import T from"@jpmorganchase/mosaic-core";var v="mosaic-snapshot.json",E="mosaic-routes.json";async function J(n,f,w){let p=w.scope?.split(",").map(e=>e.trim()).filter(Boolean);if(p){let e=p.filter(m=>!n.sources.some(c=>c.namespace===m&&!c.disabled));if(p.length===0||e.length>0)throw new Error(`Snapshot scope must name enabled source namespaces. No enabled sources for: ${e.join(", ")||"(empty scope)"}`)}n={...n,plugins:n.plugins.filter(({runTimeOnly:e})=>!e),sources:n.sources.filter(e=>!p||p.includes(e.namespace)).map(e=>({...e,options:{...e.options,cache:!1}}))};let o=s.posix.join(f,w.name??new Date().toISOString()),d=s.relative(s.resolve(f),s.resolve(o));if(d===""||d===".."||d.startsWith(`..${s.sep}`)||s.isAbsolute(d))throw new Error(`Snapshot name '${w.name}' must be a folder inside the output directory '${f}', because that folder is emptied before the build.`);let u=new T(n);await l.promises.mkdir(o,{recursive:!0});let P=await l.promises.readdir(o);await Promise.all(P.map(e=>l.promises.rm(s.join(o,e),{recursive:!0,force:!0})));let h=n.sources.filter(e=>!e.disabled).length,S=new Set,y,x=new Promise(e=>{y=e,h===0&&e()}),F=u.onSourceUpdate((e,m)=>{S.add(m.id),S.size===h&&y()});try{await u.start(),await x;let e=(await u.listSources()).flatMap(t=>Object.entries(t.pluginErrors).flatMap(([r,a])=>a.map(i=>`Source '${t.name}', plugin '${i.pluginName||i.pluginModulePath}' (${r})${i.fullPath?` at '${i.fullPath}'`:""}: ${i.message??i.name}`)));if(e.length>0)throw new Error(`[Mosaic] Snapshot failed because plugins recorded errors:
|
|
2
|
+
${e.join(`
|
|
3
|
+
`)}`);let m=u.filesystem,c=m.symlinksToJSON(),g=await m.promises.glob("**",{cwd:"/",onlyFiles:!0});for(let t of[...g,...Object.keys(c)]){let r=s.posix.normalize(`/${String(t)}`).toLowerCase(),a=[v,E].find(i=>r===`/${i}`||r.startsWith(`/${i}/`));if(a)throw new Error(`Snapshot output '${t}' conflicts with reserved ${a}`)}for(let t of g){let r=await m.promises.readFile(String(t),{includeConflicts:!0}),a=r[0];if(r.length>1)if(s.posix.extname(String(t))===".json"){console.warn(`'${t}' returned multiple files at the same location. Since the files were JSON dot files, they were merged using \`deepmerge\`.`);let i=r.map(N=>JSON.parse(String(N)));a=Buffer.from(JSON.stringify(I.all(i)))}else throw new Error(`'${t}' returned multiple files at the same location, this will result in overwritten data in the output. Aborting build.
|
|
4
|
+
|
|
5
|
+
Try using \`--scope\` to just output certain namespaced sources, or adding a \`prefixDir\` to the source options to move the source files into a separate folder.`);await l.promises.mkdir(s.dirname(s.join(o,String(t))),{recursive:!0}),await l.promises.writeFile(s.join(o,String(t)),a)}let b=[];for(let t in c)if(!t.startsWith("/.tags"))for(let{target:r}of c[t]){if(r.startsWith("/.tags"))continue;let a=s.join(o,t),i=s.join(o,r);await l.promises.mkdir(s.dirname(a),{recursive:!0}),await l.promises.symlink(s.relative(s.dirname(a),i),a),b.push(t)}let $=k(),O=await j({root:o,files:g.map(String),aliases:b,pageExtensions:n.pageExtensions??[".mdx"],ignorePages:n.ignorePages});await l.promises.writeFile(s.join(o,E),JSON.stringify({version:1,snapshotId:$,routes:O}),{encoding:"utf8",flag:"wx"}),await l.promises.writeFile(s.join(o,v),JSON.stringify({version:1,id:$}),{encoding:"utf8",flag:"wx"}),console.log(`[Mosaic] filesystem for ${h} source(s) written to disk at '${o}'`)}finally{F(),await u.stop()}}export{J as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function h(E,g){if(!g)return console.log("[Mosaic] Revalidate notifier disabled (set MOSAIC_REVALIDATE_URL and MOSAIC_REVALIDATE_SECRET to enable)."),{stop(){}};let{url:s,secret:T}=g,e,t,i,n=!1,l=!1,c=0,f=0,u=-1/0,d=1e3,m=o=>{e=setTimeout(()=>{e=void 0,p()},o)},p=async()=>{if(n||l||f===c)return;l=!0,u=Date.now();let o=c;i=new AbortController;try{let r=new Promise((M,v)=>{t=setTimeout(()=>{i?.abort(),v(new Error("request timed out"))},1e4)}),a=await Promise.race([fetch(s,{method:"POST",headers:{"content-type":"application/json","x-mosaic-revalidate-secret":T},signal:i.signal}),r]);if(a.body?.cancel().catch(()=>{}),!a.ok)throw new Error(`HTTP ${a.status}`);f=o,d=1e3,console.log(`[Mosaic] Revalidated site cache at ${s}`)}catch(r){if(!n){let a=r instanceof Error?r.message:String(r);console.warn(`[Mosaic] Revalidate POST to ${s} failed: ${a}; retrying.`),m(d),d=Math.min(d*2,3e4)}}finally{t&&clearTimeout(t),t=void 0,i=void 0,l=!1,!n&&!e&&f!==c&&m(Math.max(0,500-(Date.now()-u)))}},S=()=>{if(n||(c++,l||e))return;let o=500-(Date.now()-u);o>0?m(o):p()};return E.onSourceUpdate(S),console.log(`[Mosaic] Revalidate notifier active \u2014 will POST ${s} on source updates.`),{stop(){n=!0,i?.abort(),t&&clearTimeout(t),e&&(clearTimeout(e),e=void 0)}}}export{h as a};
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment variables read by `mosaic serve`, checked once when it starts
|
|
3
|
+
* so a bad value stops the server with every problem listed, instead of
|
|
4
|
+
* surfacing later as a feature that silently does nothing.
|
|
5
|
+
*
|
|
6
|
+
* Secrets keep `readSecret()`'s semantics (see `plugins/security.ts`): the
|
|
7
|
+
* public development placeholder counts as unset unless
|
|
8
|
+
* `NODE_ENV=development`. The admin and workflow plugins still read their
|
|
9
|
+
* secrets on each request.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
export type CliEnv = Record<string, string | undefined>;
|
|
13
|
+
export interface ServeEnv {
|
|
14
|
+
/** `MOSAIC_CORS_ORIGINS`, split and trimmed. Empty: no CORS headers. */
|
|
15
|
+
corsOrigins: string[];
|
|
16
|
+
/** Maximum workflow job duration, in milliseconds. Default: 5 minutes. */
|
|
17
|
+
workflowsTimeoutMs: number;
|
|
18
|
+
/** Set when `MOSAIC_REVALIDATE_URL` and `MOSAIC_REVALIDATE_SECRET` are. */
|
|
19
|
+
revalidate: {
|
|
20
|
+
url: string;
|
|
21
|
+
secret: string;
|
|
22
|
+
} | undefined;
|
|
23
|
+
}
|
|
24
|
+
/** Thrown by `validateServeEnv()`; the message lists every problem. */
|
|
25
|
+
export declare class InvalidEnvError extends Error {
|
|
26
|
+
readonly problems: string[];
|
|
27
|
+
constructor(problems: string[]);
|
|
28
|
+
}
|
|
29
|
+
/** Every rule, keyed by variable. Unknown variables are ignored. */
|
|
30
|
+
export declare const serveEnvSchema: z.ZodObject<{
|
|
31
|
+
MOSAIC_ADMIN_SECRET: z.ZodOptional<z.ZodString>;
|
|
32
|
+
MOSAIC_WORKFLOWS_SECRET: z.ZodOptional<z.ZodString>;
|
|
33
|
+
MOSAIC_WORKFLOWS_TIMEOUT_MS: z.ZodOptional<z.ZodString>;
|
|
34
|
+
MOSAIC_BITBUCKET_WEBHOOK_SECRET: z.ZodOptional<z.ZodString>;
|
|
35
|
+
MOSAIC_CORS_ORIGINS: z.ZodOptional<z.ZodString>;
|
|
36
|
+
MOSAIC_REVALIDATE_URL: z.ZodOptional<z.ZodString>;
|
|
37
|
+
MOSAIC_REVALIDATE_SECRET: z.ZodOptional<z.ZodString>;
|
|
38
|
+
MOSAIC_SOURCE_BOOT_TIMEOUT_MS: z.ZodOptional<z.ZodString>;
|
|
39
|
+
BITBUCKET_API_URL: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
/** Every problem with `env`, as `NAME: reason`. Empty when it is valid. */
|
|
42
|
+
export declare function checkServeEnv(env: CliEnv): string[];
|
|
43
|
+
/**
|
|
44
|
+
* Checks `env` (the process env by default) and returns the values `serve`
|
|
45
|
+
* uses. Throws `InvalidEnvError` listing every problem when it is invalid.
|
|
46
|
+
*/
|
|
47
|
+
export declare function validateServeEnv(env?: CliEnv): ServeEnv;
|
|
48
|
+
/** Validate the CLI bind address before booting sources. */
|
|
49
|
+
export declare function validateHost(host: string): string;
|
package/dist/env.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e}from"./chunk-VGWN7S77.mjs";export{a as InvalidEnvError,c as checkServeEnv,b as serveEnvSchema,e as validateHost,d as validateServeEnv};
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{b as p}from"./chunk-LBGQJ2IK.mjs";import"./chunk-LSSCO4BP.mjs";import"./chunk-C62I76OF.mjs";import"./chunk-ZOJ3LTWN.mjs";import{a as n}from"./chunk-YQNXGMWC.mjs";import"./chunk-5FTIHMJH.mjs";import{a as e}from"./chunk-VGWN7S77.mjs";import"./chunk-FCNWFPGR.mjs";import"./chunk-XWU2QBWI.mjs";import"./chunk-S7JRZ4XU.mjs";import"./chunk-JZTJ6KFK.mjs";import"./chunk-4YKZMY2L.mjs";import"./chunk-O4CA7KYW.mjs";import"./chunk-6VZ6ETYU.mjs";import{program as t}from"commander";import s from"node:path";import{pathToFileURL as f}from"node:url";t.option("-c, --config <string>","Config path").option("-o, --out <string>","Output directory",".tmp/.mosaic-build").option("-s, --scope <strings>","Command separated namespaces").option("-p, --port <number>","Port to serve on","8080").option("--host <string>","Host or IP address to bind to","localhost").option("-n, --name <string>","Snapshot name");t.parse();var o=t.opts(),i;if(o.config!==void 0){if(i=await import(f(s.resolve(process.cwd(),o.config)).toString()),!i)throw new Error(`[Mosaic] could not find config file at ${s.resolve(process.cwd(),o.config)}.`)}else throw new Error("[Mosaic] no config file provided");function c(a){a.catch(r=>{console.error("[Mosaic][CLI]",r instanceof e?r.message:r),process.exit(1)})}t.args[0]==="build"&&c(n(i.default,s.resolve(process.cwd(),o.out),o));t.args[0]==="serve"&&c(p(i.default,o.port,o.scope&&o.scope.split(","),o.host));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Bitbucket Data Center repository, identified the way its webhook
|
|
3
|
+
* payloads identify it. Both parts are lower-cased: Bitbucket matches
|
|
4
|
+
* project keys and repository slugs case-insensitively.
|
|
5
|
+
*/
|
|
6
|
+
export interface BitbucketRepo {
|
|
7
|
+
projectKey: string;
|
|
8
|
+
repoSlug: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Reads the project key and repository slug from a Bitbucket Data Center
|
|
12
|
+
* repository URL, or returns `undefined` for anything else:
|
|
13
|
+
*
|
|
14
|
+
* - HTTP(S) clone URLs: `https://host[/context]/scm/PROJ/repo.git`
|
|
15
|
+
* - SSH clone URLs: `ssh://git@host:7999/PROJ/repo.git` and `git@host:PROJ/repo.git`
|
|
16
|
+
* - Browse URLs: `https://host[/context]/projects/PROJ/repos/repo[/browse]`
|
|
17
|
+
*
|
|
18
|
+
* Personal repositories keep their `~user` project key. Credentials in the
|
|
19
|
+
* URL are ignored. HTTP(S) URLs without `/scm/` or `/projects/…/repos/` (such
|
|
20
|
+
* as GitHub's) are not Bitbucket clone URLs and return `undefined`; SSH URLs
|
|
21
|
+
* carry no such marker, so any `PROJ/repo` path is accepted.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseBitbucketRepoUrl(url: string): BitbucketRepo | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../chunk-O4CA7KYW.mjs";export{a as parseBitbucketRepoUrl};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-XWU2QBWI.mjs";import"../chunk-6VZ6ETYU.mjs";export{a as default};
|
|
@@ -10,6 +10,7 @@ export interface FastifyMosaic {
|
|
|
10
10
|
config: MosaicConfig;
|
|
11
11
|
core: MosaicCore;
|
|
12
12
|
fs: IUnionVolume;
|
|
13
|
+
scope?: string[];
|
|
13
14
|
}
|
|
14
15
|
declare function fastifyMosaic(fastify: FastifyInstance, options: FastifyMosaicPluginOptions): Promise<void>;
|
|
15
16
|
declare module 'fastify' {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-S7JRZ4XU.mjs";import"../chunk-JZTJ6KFK.mjs";export{a as default};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FastifyInstance } from 'fastify';
|
|
2
|
+
export interface FastifyMosaicWebhooksPluginOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Pushes that reach the same source within this many milliseconds are
|
|
5
|
+
* coalesced into one refresh, which runs at the end of the window.
|
|
6
|
+
*/
|
|
7
|
+
debounceMs?: number;
|
|
8
|
+
}
|
|
9
|
+
declare function mosaicWebhooks(fastify: FastifyInstance, options: FastifyMosaicWebhooksPluginOptions, next: (err?: Error) => void): void;
|
|
10
|
+
/**
|
|
11
|
+
* Fastify plugin that lets Bitbucket Data Center push webhooks refresh
|
|
12
|
+
* git-repo sources immediately.
|
|
13
|
+
* https://mosaic-mosaic-dev-team.vercel.app/mosaic/configure/sources/git-repo-source
|
|
14
|
+
*/
|
|
15
|
+
declare const _default: typeof mosaicWebhooks;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../chunk-4YKZMY2L.mjs";import"../chunk-O4CA7KYW.mjs";import"../chunk-6VZ6ETYU.mjs";export{a as default};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { FastifyInstance } from 'fastify';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { type WorkflowJobStoreOptions } from './workflowJobs.js';
|
|
3
|
+
export interface FastifyMosaicWorkflowsPluginOptions {
|
|
4
|
+
/** Maximum job duration, validated once by `mosaic serve` at startup. */
|
|
5
|
+
timeoutMs: number;
|
|
6
|
+
/** Limits of the in-memory job store. */
|
|
7
|
+
jobs?: WorkflowJobStoreOptions;
|
|
8
|
+
/** Interval between `: ping` comments on an events stream. Default 15 seconds. */
|
|
9
|
+
pingIntervalMs?: number;
|
|
5
10
|
}
|
|
6
|
-
|
|
7
|
-
user: string;
|
|
8
|
-
route: string;
|
|
9
|
-
markdown: string;
|
|
10
|
-
name: string;
|
|
11
|
-
}
|
|
12
|
-
declare function mosaicWorkflows(fastify: FastifyInstance, _options: any): Promise<void>;
|
|
11
|
+
declare function mosaicWorkflows(fastify: FastifyInstance, { timeoutMs, jobs: jobOptions, pingIntervalMs }: FastifyMosaicWorkflowsPluginOptions): Promise<void>;
|
|
13
12
|
/**
|
|
14
13
|
* Fastify plugin that adds support for the Mosaic Workflows
|
|
15
14
|
* https://mosaic-mosaic-dev-team.vercel.app/mosaic/configure/admin/index
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-LSSCO4BP.mjs";import"../chunk-C62I76OF.mjs";import"../chunk-6VZ6ETYU.mjs";export{a as default};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a Mosaic page URL to its **raw on-disk source path**.
|
|
3
|
+
*
|
|
4
|
+
* Why this exists
|
|
5
|
+
* ---------------
|
|
6
|
+
* The Mosaic content server serves the *post-plugin* view of every
|
|
7
|
+
* page: source plugins deserialise the raw `.mdx`/`.json`, then a
|
|
8
|
+
* chain of build plugins enriches each page (`sidebar`,
|
|
9
|
+
* `breadcrumbs`, `tableOfContents`, `sharedConfig`, `readingTime`,
|
|
10
|
+
* plus whatever a host's custom plugins inject) before the page
|
|
11
|
+
* lands in the union volume. The bytes the editor reads via the
|
|
12
|
+
* existing `GET /*` route therefore look nothing like what an
|
|
13
|
+
* author would see if they opened the file in their IDE.
|
|
14
|
+
*
|
|
15
|
+
* For the in-browser editor's Frontmatter tab to be safely
|
|
16
|
+
* editable (without polluting the source repo with regenerated
|
|
17
|
+
* plugin data), it needs to load the *original* file as the
|
|
18
|
+
* author committed it. That's what this resolver — and the
|
|
19
|
+
* `/_mosaic-raw/*` route built on it — provides.
|
|
20
|
+
*
|
|
21
|
+
* Supported sources
|
|
22
|
+
* -----------------
|
|
23
|
+
* Two source kinds resolve to an on-disk file today:
|
|
24
|
+
*
|
|
25
|
+
* - `@jpmorganchase/mosaic-source-local-folder` — trivial:
|
|
26
|
+
* `options.rootDir + options.prefixDir` give us a complete
|
|
27
|
+
* URL → file mapping with zero IPC.
|
|
28
|
+
* - `@jpmorganchase/mosaic-source-git-repo` — the source's
|
|
29
|
+
* worker clones the repo into a deterministic location
|
|
30
|
+
* (`<cwd>/.tmp/.cloned_docs/<project>/<repo>/.mosaic-worktrees/<branch>`)
|
|
31
|
+
* before emitting pages. We re-derive that path here via
|
|
32
|
+
* the source's exported `getWorktreeDir(repoUrl, branch)`
|
|
33
|
+
* helper — same formula as the worker, so no IPC is
|
|
34
|
+
* needed. Combined with `options.subfolder` (the docs root
|
|
35
|
+
* inside the repo) the lookup matches the worker's view of
|
|
36
|
+
* the filesystem byte-for-byte.
|
|
37
|
+
*
|
|
38
|
+
* Other source kinds (`source-http`, `source-figma`,
|
|
39
|
+
* `source-storybook`, …) remain in `KNOWN_UNSUPPORTED` — they
|
|
40
|
+
* need either a recursive raw fetch to an upstream (http) or
|
|
41
|
+
* don't have a meaningful "on-disk source" concept (figma,
|
|
42
|
+
* storybook). The resolver returns `unsupported-source` for
|
|
43
|
+
* them so the editor degrades to read-only gracefully.
|
|
44
|
+
*
|
|
45
|
+
* Race against worker init
|
|
46
|
+
* ------------------------
|
|
47
|
+
* The git-repo source's worker clones + checks out the worktree
|
|
48
|
+
* asynchronously after the CLI boots. A raw fetch that lands
|
|
49
|
+
* before the worktree exists hits `ENOENT` on
|
|
50
|
+
* `fs.promises.stat`, which the Fastify handler maps to a plain
|
|
51
|
+
* 404. The editor's `MdxRawSourceResult` already treats that as
|
|
52
|
+
* `not-found` and shows the user a "the source file couldn't be
|
|
53
|
+
* found" banner — same UX as a real mid-rename race. No special
|
|
54
|
+
* handling needed in the resolver itself.
|
|
55
|
+
*
|
|
56
|
+
* The "first match wins, prefixed sources beat unprefixed" rule
|
|
57
|
+
* resolves ambiguity when a config has multiple sources: an
|
|
58
|
+
* explicit `prefixDir` is a stronger claim on a URL space than
|
|
59
|
+
* an unprefixed source, so we prefer it. Within the same
|
|
60
|
+
* prefixedness class we honour declaration order. This fallback is used
|
|
61
|
+
* only when no published owner is available. Published paths are resolved
|
|
62
|
+
* by the caller against the mounted volumes.
|
|
63
|
+
*/
|
|
64
|
+
import type { SourceModuleDefinition } from '@jpmorganchase/mosaic-types';
|
|
65
|
+
export type RawSourceResolution = {
|
|
66
|
+
kind: 'resolved';
|
|
67
|
+
filePath: string;
|
|
68
|
+
namespace: string;
|
|
69
|
+
rootDir: string;
|
|
70
|
+
} | {
|
|
71
|
+
kind: 'no-matching-source';
|
|
72
|
+
url: string;
|
|
73
|
+
} | {
|
|
74
|
+
kind: 'unsupported-source';
|
|
75
|
+
modulePath: string;
|
|
76
|
+
namespace: string;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Normalise an incoming URL into the comparison form used by the
|
|
80
|
+
* `prefixDir` match: leading slash, no trailing slash, no double
|
|
81
|
+
* slashes. Empty / root requests collapse to `/`.
|
|
82
|
+
*/
|
|
83
|
+
export declare function normaliseRawSourceUrl(url: string): string | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Resolve a Mosaic page URL (e.g. `/mosaic/index.mdx`) into the
|
|
86
|
+
* filesystem path of the raw source file, given a Mosaic config.
|
|
87
|
+
*
|
|
88
|
+
* Returns a discriminated result so the caller can give the
|
|
89
|
+
* editor (and future debugging tooling) a precise reason for
|
|
90
|
+
* any non-resolved outcome — `no-matching-source` vs.
|
|
91
|
+
* `unsupported-source` map to different UX in the editor (the
|
|
92
|
+
* latter can point at the offending source kind so the author
|
|
93
|
+
* knows whether to switch to a supported source or just accept
|
|
94
|
+
* the read-only frontmatter view).
|
|
95
|
+
*/
|
|
96
|
+
export declare function resolveRawSourcePath(url: string, sources: SourceModuleDefinition[]): RawSourceResolution;
|
|
97
|
+
/**
|
|
98
|
+
* Exposed so future callers (e.g. a debug endpoint, or richer
|
|
99
|
+
* error messages) can introspect the resolver's vocabulary
|
|
100
|
+
* without redeclaring the constants.
|
|
101
|
+
*/
|
|
102
|
+
export declare const KNOWN_RAW_UNSUPPORTED_MODULES: Set<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c}from"../chunk-JZTJ6KFK.mjs";export{c as KNOWN_RAW_UNSUPPORTED_MODULES,a as normaliseRawSourceUrl,b as resolveRawSourcePath};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IncomingHttpHeaders } from 'node:http';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the configured secret, or `undefined` if it is unset, or a
|
|
4
|
+
* placeholder outside development.
|
|
5
|
+
*/
|
|
6
|
+
export declare function readSecret(name: string): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Constant-time string comparison for shared secrets. Different lengths
|
|
9
|
+
* are rejected up front because `timingSafeEqual` throws on them; the
|
|
10
|
+
* length of a secret isn't sensitive, its bytes are.
|
|
11
|
+
*/
|
|
12
|
+
export declare function secretsMatch(provided: string, expected: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Reads a shared secret from a dedicated header (e.g. `x-mosaic-admin-secret`),
|
|
15
|
+
* an `Authorization: Bearer <secret>` header, or the password of an
|
|
16
|
+
* `Authorization: Basic` header (what a browser sends after its login prompt).
|
|
17
|
+
*/
|
|
18
|
+
export declare function extractSecret(headers: IncomingHttpHeaders, headerName: string): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* `true` when `route` is a plain absolute POSIX route that can't escape
|
|
21
|
+
* the directory it is resolved against: leading `/`, no `.`/`..` or empty
|
|
22
|
+
* segments, no backslashes and no control characters.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isSafeRoute(route: unknown, maxLength?: number): route is string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d}from"../chunk-6VZ6ETYU.mjs";export{c as extractSecret,d as isSafeRoute,a as readSecret,b as secretsMatch};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-memory store for workflow jobs started over HTTP and followed over
|
|
3
|
+
* Server-Sent Events.
|
|
4
|
+
*
|
|
5
|
+
* Jobs only live in this process: they are lost when the CLI restarts,
|
|
6
|
+
* and when several CLI instances sit behind a load balancer the events
|
|
7
|
+
* request must reach the instance that started the job (sticky routing).
|
|
8
|
+
*/
|
|
9
|
+
export type WorkflowJobStatus = 'running' | 'success' | 'error';
|
|
10
|
+
export interface WorkflowJobEventData {
|
|
11
|
+
status: string;
|
|
12
|
+
message: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface WorkflowJobEvent {
|
|
15
|
+
/** Sequence number, starting at 1. Sent as the SSE `id`. */
|
|
16
|
+
id: number;
|
|
17
|
+
event: 'progress' | 'done';
|
|
18
|
+
data: WorkflowJobEventData;
|
|
19
|
+
}
|
|
20
|
+
type Listener = (event: WorkflowJobEvent) => void;
|
|
21
|
+
export interface WorkflowJobOptions {
|
|
22
|
+
/** Most events kept per job; later progress events are dropped. */
|
|
23
|
+
maxEvents: number;
|
|
24
|
+
/** Fails the job when it hasn't finished after this long. `0` disables. */
|
|
25
|
+
timeoutMs: number;
|
|
26
|
+
now: () => number;
|
|
27
|
+
}
|
|
28
|
+
export declare class WorkflowJob {
|
|
29
|
+
#private;
|
|
30
|
+
readonly userId: string;
|
|
31
|
+
readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
32
|
+
readonly events: WorkflowJobEvent[];
|
|
33
|
+
status: WorkflowJobStatus;
|
|
34
|
+
finishedAt: number | undefined;
|
|
35
|
+
constructor(userId: string, { maxEvents, timeoutMs, now }: WorkflowJobOptions);
|
|
36
|
+
get done(): boolean;
|
|
37
|
+
progress(status: string, message: unknown): void;
|
|
38
|
+
succeed(message: unknown): void;
|
|
39
|
+
fail(message: unknown): void;
|
|
40
|
+
/** Events after `lastEventId`, for a client that is (re)connecting. */
|
|
41
|
+
eventsAfter(lastEventId: number): WorkflowJobEvent[];
|
|
42
|
+
/** Calls `listener` for each new event; returns an unsubscribe function. */
|
|
43
|
+
subscribe(listener: Listener): () => void;
|
|
44
|
+
}
|
|
45
|
+
export interface WorkflowJobStoreOptions {
|
|
46
|
+
/** Most jobs held at once. Default 100. */
|
|
47
|
+
maxJobs?: number;
|
|
48
|
+
/** Most events kept per job. Default 500. */
|
|
49
|
+
maxEventsPerJob?: number;
|
|
50
|
+
/** How long a finished job can still be replayed. Default 10 minutes. */
|
|
51
|
+
retentionMs?: number;
|
|
52
|
+
now?: () => number;
|
|
53
|
+
}
|
|
54
|
+
export declare class WorkflowJobStore {
|
|
55
|
+
#private;
|
|
56
|
+
constructor({ maxJobs, maxEventsPerJob, retentionMs, now }?: WorkflowJobStoreOptions);
|
|
57
|
+
get size(): number;
|
|
58
|
+
get capacity(): number;
|
|
59
|
+
/**
|
|
60
|
+
* Creates a job for `userId`, evicting the oldest finished jobs when the
|
|
61
|
+
* store is full. Returns `undefined` when every slot holds a running job.
|
|
62
|
+
*/
|
|
63
|
+
create(userId: string, timeoutMs: number): WorkflowJob | undefined;
|
|
64
|
+
get(id: string): WorkflowJob | undefined;
|
|
65
|
+
/** Drops jobs that finished more than `retentionMs` ago. */
|
|
66
|
+
prune(): void;
|
|
67
|
+
}
|
|
68
|
+
/** Formats one job event as an SSE message. */
|
|
69
|
+
export declare function formatSseEvent({ id, event, data }: WorkflowJobEvent): string;
|
|
70
|
+
/** The parts of `http.ServerResponse` the stream writer uses. */
|
|
71
|
+
export interface SseResponse {
|
|
72
|
+
write(chunk: string): unknown;
|
|
73
|
+
end(): unknown;
|
|
74
|
+
on(event: 'close', listener: () => void): unknown;
|
|
75
|
+
off(event: 'close', listener: () => void): unknown;
|
|
76
|
+
}
|
|
77
|
+
export interface StreamJobEventsOptions {
|
|
78
|
+
/** Replay events after this id (from `Last-Event-ID`). Default 0. */
|
|
79
|
+
lastEventId?: number;
|
|
80
|
+
/** Interval between `: ping` comments. Default 15 seconds. */
|
|
81
|
+
pingIntervalMs?: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Writes `job`'s events to `res` as SSE: the events after `lastEventId`,
|
|
85
|
+
* then new ones as they happen, ending the response after `done`. Sends a
|
|
86
|
+
* `: ping` comment every `pingIntervalMs` so proxies don't close an idle
|
|
87
|
+
* stream. Returns a function that stops streaming and ends the response;
|
|
88
|
+
* timers and listeners are also released when the client disconnects.
|
|
89
|
+
*/
|
|
90
|
+
export declare function streamJobEvents(job: WorkflowJob, res: SseResponse, { lastEventId, pingIntervalMs }?: StreamJobEventsOptions): () => void;
|
|
91
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d}from"../chunk-C62I76OF.mjs";export{a as WorkflowJob,b as WorkflowJobStore,c as formatSseEvent,d as streamJobEvents};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notifies a downstream Next.js site to revalidate its content cache
|
|
3
|
+
* whenever a Mosaic source emits an update.
|
|
4
|
+
*
|
|
5
|
+
* Pairs with `packages/site/src/app/api/revalidate/route.ts` and the
|
|
6
|
+
* tagged `cache()` + `unstable_cache()` layer in
|
|
7
|
+
* `packages/site-middleware/src/cachedLoaders.ts`. The site keeps
|
|
8
|
+
* cached snapshot reads valid indefinitely (no `revalidate` window) and
|
|
9
|
+
* relies on this notifier to flush them when underlying content
|
|
10
|
+
* changes — which means content updates propagate to the site without
|
|
11
|
+
* a restart and without per-request round-trips.
|
|
12
|
+
*
|
|
13
|
+
* Configuration (env vars on the **CLI process**, not the site, checked
|
|
14
|
+
* by `validateServeEnv()` in `env.ts`):
|
|
15
|
+
*
|
|
16
|
+
* - `MOSAIC_REVALIDATE_URL` — full URL of the site's revalidate
|
|
17
|
+
* endpoint, e.g.
|
|
18
|
+
* `http://localhost:3000/api/revalidate`.
|
|
19
|
+
* - `MOSAIC_REVALIDATE_SECRET` — shared secret matching the value
|
|
20
|
+
* the site reads from its own env.
|
|
21
|
+
*
|
|
22
|
+
* Set both to enable notifications; `mosaic serve` refuses to start when
|
|
23
|
+
* the URL is set without a secret. Without the URL, the notifier is a
|
|
24
|
+
* no-op (logs once on startup so the operator knows).
|
|
25
|
+
*
|
|
26
|
+
* Debounce: source updates can fire in bursts (e.g. multiple sources
|
|
27
|
+
* settle within a few hundred ms of each other on startup). The first
|
|
28
|
+
* event in a burst fires immediately (leading edge) so a single save
|
|
29
|
+
* isn't delayed; any further events arriving inside the
|
|
30
|
+
* `DEBOUNCE_MS` window are coalesced into one trailing flush so the
|
|
31
|
+
* site sees at most two cache flushes per burst regardless of N. Failed
|
|
32
|
+
* deliveries stay pending and retry with bounded backoff; requests have a
|
|
33
|
+
* ten-second deadline and only one request may be active at a time.
|
|
34
|
+
*/
|
|
35
|
+
import type MosaicCore from '@jpmorganchase/mosaic-core';
|
|
36
|
+
interface Notifier {
|
|
37
|
+
/** Stop watching for source updates. */
|
|
38
|
+
stop(): void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Subscribe to source updates on a running Mosaic core and POST a
|
|
42
|
+
* revalidation request to the configured site for each (debounced)
|
|
43
|
+
* batch. Returns a handle so callers can detach on shutdown; the
|
|
44
|
+
* notifier is otherwise self-contained.
|
|
45
|
+
*/
|
|
46
|
+
export declare function startRevalidateNotifier(mosaic: MosaicCore, target: {
|
|
47
|
+
url: string;
|
|
48
|
+
secret: string;
|
|
49
|
+
} | undefined): Notifier;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-ZOJ3LTWN.mjs";export{a as startRevalidateNotifier};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SnapshotRoute } from '@jpmorganchase/mosaic-types';
|
|
2
|
+
interface RouteInventoryOptions {
|
|
3
|
+
root: string;
|
|
4
|
+
files: string[];
|
|
5
|
+
aliases: string[];
|
|
6
|
+
pageExtensions: string[];
|
|
7
|
+
ignorePages?: string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Enumerate the completed output, not frontmatter or the SEO sitemap. Reading
|
|
11
|
+
* the exported files also observes the CLI's JSON merges and alias collisions.
|
|
12
|
+
* No file contents are parsed and no source ordering is inferred here.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildRouteInventory({ root, files, aliases, pageExtensions, ignorePages }: RouteInventoryOptions): Promise<SnapshotRoute[]>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-5FTIHMJH.mjs";export{a as buildRouteInventory};
|
package/dist/serve.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ import { MosaicConfig } from '@jpmorganchase/mosaic-types';
|
|
|
3
3
|
export declare const server: Fastify.FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, Fastify.FastifyBaseLogger, Fastify.FastifyTypeProviderDefault> & PromiseLike<Fastify.FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, Fastify.FastifyBaseLogger, Fastify.FastifyTypeProviderDefault>> & {
|
|
4
4
|
__linterBrands: "SafePromiseLike";
|
|
5
5
|
};
|
|
6
|
-
export default function serve(config: MosaicConfig, port: number, scope?: string[]): Promise<void>;
|
|
6
|
+
export default function serve(config: MosaicConfig, port: number, scope?: string[], host?: string): Promise<void>;
|
|
7
|
+
export declare function listenErrorMessage(err: unknown, host: string, port: number): string;
|
package/dist/serve.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b,c}from"./chunk-LBGQJ2IK.mjs";import"./chunk-LSSCO4BP.mjs";import"./chunk-C62I76OF.mjs";import"./chunk-ZOJ3LTWN.mjs";import"./chunk-VGWN7S77.mjs";import"./chunk-FCNWFPGR.mjs";import"./chunk-XWU2QBWI.mjs";import"./chunk-S7JRZ4XU.mjs";import"./chunk-JZTJ6KFK.mjs";import"./chunk-4YKZMY2L.mjs";import"./chunk-O4CA7KYW.mjs";import"./chunk-6VZ6ETYU.mjs";export{b as default,c as listenErrorMessage,a as server};
|