renku 0.0.1 → 0.0.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/README.md +16 -9
- package/dist/auth-DivcgvqR.js +1 -0
- package/dist/auth.d.ts +6 -0
- package/dist/auth.js +1 -0
- package/dist/bash-complete.d.ts +1 -0
- package/dist/bash-complete.js +2 -0
- package/dist/bun.d.ts +33 -0
- package/dist/bun.js +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +2 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +1 -0
- package/dist/cloudflare-Dfzl7gGy.js +2 -0
- package/dist/cloudflare.d.ts +5 -0
- package/dist/cloudflare.js +1 -0
- package/dist/cloudflare.worker.d.ts +78 -0
- package/dist/cloudflare.worker.js +1 -0
- package/dist/context-Dt3VbTFK.js +23 -0
- package/dist/create-computed-D9oVNGZ6.js +1 -0
- package/dist/data.d.ts +216 -0
- package/dist/data.js +1 -0
- package/dist/dom.d.ts +13 -0
- package/dist/dom.js +1 -0
- package/dist/effect-hmzj-Jig.js +1 -0
- package/dist/fragment-Chv9FEhP.js +1 -0
- package/dist/fragment-CpqsWP0m.d.ts +6 -0
- package/dist/get-route-B1JNCPoL.js +1 -0
- package/dist/impl-CQ7GTRH2-BsAKEI_H.js +5 -0
- package/dist/impl-CRQorzAF.js +1 -0
- package/dist/impl-O61EKx7J.js +31 -0
- package/dist/impl-vRmneAi-.js +1 -0
- package/dist/index-BpyLKbnR.d.ts +28 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +1 -0
- package/dist/jsx-dev-runtime.d.ts +11 -0
- package/dist/jsx-dev-runtime.js +1 -0
- package/dist/jsx-runtime-DvEc5zft.js +1 -0
- package/dist/jsx-runtime.d.ts +10 -0
- package/dist/jsx-runtime.js +1 -0
- package/dist/register-server-function-DQl0uL7w.js +1 -0
- package/dist/register-server-function-DoOVejlg.d.ts +10 -0
- package/dist/rsc-from-markup-SQg4fJ0z.js +14 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.js +1 -0
- package/dist/signal-store-0zk-69gB.js +1 -0
- package/dist/tsconfig.base.json +29 -0
- package/dist/types-BStlw_FH.d.ts +11 -0
- package/dist/types-DA3_gaOB.d.ts +38 -0
- package/dist/types-DazdXa4I.d.ts +31 -0
- package/dist/types-J6ZDxAIC.d.ts +18 -0
- package/dist/ui.d.ts +6 -0
- package/dist/ui.js +1 -0
- package/dist/update-dom-node-DnDA0pqF.js +1 -0
- package/dist/virtual-from-jsx-BgQUXZ4d.js +1 -0
- package/dist/vite.d.ts +6 -0
- package/dist/vite.js +7 -0
- package/package.json +106 -4
- package/index.ts +0 -1
package/README.md
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Renku
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Getting started
|
|
4
4
|
|
|
5
|
-
```
|
|
6
|
-
bun
|
|
5
|
+
```sh
|
|
6
|
+
bun create github.com/renkudev/template-bun
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
bun run index.ts
|
|
9
|
+
```sh
|
|
10
|
+
bun create github.com/renkudev/template-vite
|
|
13
11
|
```
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
## CSS Classes
|
|
14
|
+
|
|
15
|
+
Renku uses the `class` prop to apply CSS classes to its components (as opposed to `className` in React). Using `className` will still work though. The prop accespts either a string or an array of strings.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
<ul>
|
|
19
|
+
<li><a href="/about" class={["link", "active"]}>About</a></li>
|
|
20
|
+
<li><a href="/contact" class="link">Contact</a></li>
|
|
21
|
+
</ul>
|
|
22
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AsyncLocalStorage as e}from"node:async_hooks";const t=new e,n=()=>({sessionId:null,userId:null}),r=()=>{let e=t.getStore();if(e)return e;let r=n();return t.enterWith(r),r},i=e=>t.run(n(),e),a=()=>r();export{r as n,i as r,a as t};
|
package/dist/auth.d.ts
ADDED
package/dist/auth.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./auth-DivcgvqR.js";export{e as auth};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/bun.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import "./types-BStlw_FH.js";
|
|
2
|
+
import "./types-DA3_gaOB.js";
|
|
3
|
+
import { n as PathToParams, t as AugmentedRequest } from "./types-DazdXa4I.js";
|
|
4
|
+
import { RouteMetadata } from "bun:app";
|
|
5
|
+
import { BunPlugin, Serve } from "bun";
|
|
6
|
+
|
|
7
|
+
//#region src/bun/render.d.ts
|
|
8
|
+
declare const render: (request: Request, routeMetadata: RouteMetadata) => Promise<Response>;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/bun/types.d.ts
|
|
11
|
+
type Route<T extends Record<string, string>> = {
|
|
12
|
+
GET?: (request: AugmentedRequest<T>) => Response | Promise<Response>;
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/bun/renku.d.ts
|
|
16
|
+
/**
|
|
17
|
+
* @todo fix types
|
|
18
|
+
*/
|
|
19
|
+
declare const renku: <T, R extends { [K in keyof R]: Route<PathToParams<K & string>> }>({
|
|
20
|
+
routes,
|
|
21
|
+
bake,
|
|
22
|
+
plugins
|
|
23
|
+
}: {
|
|
24
|
+
routes: R;
|
|
25
|
+
bake?: never;
|
|
26
|
+
plugins?: BunPlugin[];
|
|
27
|
+
} | {
|
|
28
|
+
routes?: never;
|
|
29
|
+
bake: true;
|
|
30
|
+
plugins?: BunPlugin[];
|
|
31
|
+
}) => Serve.Options<T, any>;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { render, renku };
|
package/dist/bun.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./rsc-from-markup-SQg4fJ0z.js";import"./virtual-from-jsx-BgQUXZ4d.js";import"./signal-store-0zk-69gB.js";import"./effect-hmzj-Jig.js";const r=async(r,i)=>{let{styles:a,modules:o,pageModule:s,layouts:c}=i,l=s.default();for(let e of c)l=e.default({children:[l],_renku:{styles:a,modules:o}});let u=e(l);if(r.headers.get(`Accept`)===`text/x-component`){let e=n(u);return new Response(e,{headers:{"Content-Type":`text/x-component`}})}let d=t(u);return new Response(d,{headers:{"Content-Type":`text/html`}})},i=({routes:e,bake:t,plugins:n})=>t?{app:{framework:{fileSystemRouterTypes:[{root:`./pages`,serverEntryPoint:`renku/bun`,clientEntryPoint:`renku/client`,style:`nextjs-pages`,layouts:!0,extensions:[`ts`,`tsx`,`mdx`]}],serverComponents:{separateSSRGraph:!1,serverRuntimeImportSource:`renku/server`},plugins:n}},fetch:()=>new Response}:{routes:e,development:!0};export{r as render,i as renku};
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/cli.js
ADDED
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/client.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./virtual-from-jsx-BgQUXZ4d.js";import"./signal-store-0zk-69gB.js";import"./effect-hmzj-Jig.js";import{n as t,r as n,t as r}from"./update-dom-node-DnDA0pqF.js";const i=e=>Array.isArray(e)&&e[0]===`A`,a=e=>Array.isArray(e)&&e[0]===`C`,o=e=>Array.isArray(e)&&e[0]===`E`,s=e=>{if(o(e)){let t=[],{children:n,...r}=e[3];if(n)for(let e of n)t.push(s(e));return{type:`element`,value:e[1],key:e[2],props:r,children:t}}return i(e)?{type:`async`,key:e[1],index:e[2]}:a(e)?{type:`client`,key:e[1],path:e[2],name:e[3],props:e[4]}:typeof e==`string`||typeof e==`number`?{type:`text`,value:String(e)}:null},c={virtualNode:void 0},l=async e=>{let t=await fetch(e.pathname,{headers:{Accept:`text/x-component`}});if(t.body&&c.virtualNode){let e=s(await t.json());r({domNode:document.documentElement,oldVirtualNode:c.virtualNode,newVirtualNode:e}),c.virtualNode=e;return}console.error(`No body`)},u=e=>!e.canIntercept||e.hashChange||!!e.downloadRequest||!!e.formData,d=()=>{window.navigation.addEventListener(`navigate`,e=>{if(u(e))return;let t=new URL(e.destination.url);e.intercept({async handler(){await l(t)}})})},f=(r,i)=>{if(i?.type===`element`&&i.value.toLowerCase()===r.tagName.toLowerCase()){i.domNode=r;for(let[a,o]of i.children.entries()){let s=r.childNodes[a];if(s)if(o?.type===`element`)s instanceof HTMLElement&&f(s,o);else if(o?.type===`text`){if(s.textContent===o.value)o.domNode=s;else if(s.nodeType===Node.TEXT_NODE){let e=``;for(let t of i.children)if(t?.type===`text`)e+=t.value;else if(t?.type===`signal`)e+=String(t.value.get());else if(t?.type===`element`)break;s.textContent===e&&(o.domNode=s)}}else o?.type===`signal`?s.textContent===String(o.value.get())&&(o.domNode=s):o?.type===`async`?s.nodeType===Node.COMMENT_NODE&&(o.domNode=s):o?.type===`client`&&s.nodeType===Node.COMMENT_NODE&&(o.domNode=s,import(o.path).then(r=>{let i=e({fn:r[o.name],key:o.key,props:o.props,asyncComponents:[],clientComponents:[]});Array.isArray(i)?n({domNode:s,virtualNode:i,replace:!0}):t({domNode:s,virtualNode:i,replace:!0})}))}}},p=e=>{try{let t=JSON.parse(e);if(o(t)){let e=s(t);f(document.documentElement,e),c.virtualNode=e}else console.warn(`Unhandled: Not RSC Element`)}catch(e){console.error(`Failed to parse RSC chunk:`,e)}};d(),window.__RSC||=[];for(let e of window.__RSC)p(e);window.__RSC.push=e=>(console.log(`streamed rsc line`,e),window.__RSC.length);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./auth-DivcgvqR.js";import{n as r,r as i,t as a}from"./rsc-from-markup-SQg4fJ0z.js";import{t as o}from"./get-route-B1JNCPoL.js";import{newWorkersRpcResponse as s}from"capnweb";import{clientEntry as c}from"virtual:renku";const l=({namespace:e,name:t,ws:n})=>async(r,i)=>{if(console.log(`🔥`,`DO handler`,typeof t),n){let e=r.headers.get(`Upgrade`);if(!e||e!==`websocket`)return new Response(`Durable Object expected Upgrade: websocket`,{status:426})}if(typeof t==`function`){let e=r.clone();t=await t(e)}return i[e].getByName(t).fetch(r)},u=({rpName:e,sessionExpiryInMinutes:t})=>{t??=60;let r=e=>e*60*1e3;return{"/validate-session":{GET:async(e,t,r)=>n().sessionId?Response.json({isAuthenticated:!0}):Response.json({isAuthenticated:!1})},"/logout":{POST:async(e,t,i)=>{let a=n();a.sessionId&&await t.AUTH_DO.getByName(`session:${a.sessionId}`).logout();let o=new Date(Date.now()-r(10)).toUTCString();return new Response(null,{headers:{"Set-Cookie":`sessionId=; Path=/; SameSite=Strict; Secure; Expires=${o}`}})},GET:async(e,t,i)=>{let a=n();a.sessionId&&await t.AUTH_DO.getByName(`session:${a.sessionId}`).logout();let o=new Date(Date.now()-r(10)).toUTCString();return new Response(null,{status:302,headers:{Location:`/`,"Set-Cookie":`sessionId=; Path=/; SameSite=Strict; Secure; Expires=${o}`}})}},"/creation-options":{POST:async(t,n,r)=>{let{email:i}=await t.json(),a=crypto.randomUUID(),o=n.AUTH_DO.getByName(`user:${a}`),s=new URL(t.url).hostname,c=await o.creationOptions({id:a,email:i,rpId:s,rpName:e});return Response.json(c)}},"/validate-creation":{POST:async(e,t,n)=>{let{name:r,credential:i}=await e.json();return await t.AUTH_DO.getByName(`user:${r}`).validateCreation({name:r,credential:i}),Response.json({ok:!0})}},"/request-options":{POST:async(e,t,n)=>{let r=new URL(e.url).hostname,i=crypto.randomUUID(),a=await t.AUTH_DO.getByName(`challenge:${i}`).requestOptions({rpId:r});return Response.json({id:i,options:a})}},"/validate-request":{POST:async(e,n,i)=>{let{id:a,credential:o}=await e.json(),s=await n.AUTH_DO.getByName(`challenge:${a}`).validateRequest({credential:o,sessionExpiryInMinutes:t});if(s){let e=new Date(Date.now()+r(t)).toUTCString();return Response.json({success:!0},{headers:{"Set-Cookie":`sessionId=${s}; Path=/; SameSite=Strict; Secure; Expires=${e}`}})}return Response.json({error:!0})}}}},d=e=>{let t={};if(!e)return t;let n=e.split(`;`);for(let e of n){let n=e.indexOf(`=`);if(n===-1)continue;let r=e.slice(0,n).trim(),i=e.slice(n+1).trim();r&&(t[r]=i)}return t},f=async({request:t,env:n,authFn:r})=>{let i=e(),a=d(t.headers.get(`cookie`));if(`sessionId`in a&&a.sessionId){if(i.sessionId=a.sessionId,n?.AUTH_DO){let e=await n.AUTH_DO.getByName(`session:${i.sessionId}`).validateSession({sessionExpiryInMinutes:1440});e&&(i.userId=e.userId)}}else i.sessionId=null;return r?r({request:t,authContext:i}):!0},p=new TextEncoder,m=e=>{let t=e[Symbol.asyncIterator]();return new ReadableStream({async pull(e){let{value:n,done:r}=await t.next();if(r)e.close();else{let t=typeof n==`object`?JSON.stringify(n).concat(`
|
|
2
|
+
`):n;e.enqueue(p.encode(t))}}})},h=[`favicon.ico`,`.well-known`],g=({routes:e})=>async(n,l,u)=>t(async()=>{let t=new URL(n.url).pathname.split(`/`),d=t[1];if(d&&h.includes(d))return new Response(null,{status:404});let p=o({request:n,routes:e}),g=await f({request:n,env:l,authFn:p?p.auth:null});if(g!==!0)return g||new Response(null,{status:401});if(d===`@renku`){if(t[2]===`rpc`&&t[3]&&t[4]){let e=decodeURIComponent(t[3]),r=decodeURIComponent(t[4]);import.meta.env.DEV||(e=`./functions/${e}.js`),console.log(`☎️ Server function was called:`,e,r);let i=(await import(e))[r];return s(n,i)}return new Response(null,{status:404})}if(!p)return console.warn(`No routing result`),new Response(null,{status:404});if(p.api){let e=Object.assign(n,{params:p.params});return p.api(e,l,u)}let _=null;if(p.route instanceof Promise)_=await(await p.route).default(p.params);else if(p.route&&`default`in p.route&&typeof p.route.default==`function`)_=await p.route.default(p.params);else if(typeof p.route==`function`)_=await p.route(p.params);else return new Response(null,{status:404});let v={styles:[],modules:[]};import.meta.env.DEV?(v.modules.push(`/@vite/client`),v.modules.push(`/@renku/client`)):c&&v.modules.push(c);for(let e of p.layouts)e instanceof Promise?_=await(await e).default({children:_,_renku:v}):`default`in e&&typeof e.default==`function`?_=await e.default({children:_,_renku:v}):typeof e==`function`&&(_=await e({children:_,_renku:v}));let y=r(_);if(n.headers.get(`Accept`)===`text/x-component`){let e=m(a(y));return new Response(e,{headers:{"Content-Type":`text/x-component`}})}let b=m(i(y));return new Response(b,{headers:{"Content-Type":`text/html`}})}),_=({routes:e})=>({fetch:g({routes:e})});export{u as n,l as r,_ as t};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "./types-BStlw_FH.js";
|
|
2
|
+
import "./types-DA3_gaOB.js";
|
|
3
|
+
import { r as Routes } from "./types-DazdXa4I.js";
|
|
4
|
+
import { n as getAuthRoutes, r as durableObjectHandler, t as renku } from "./index-BpyLKbnR.js";
|
|
5
|
+
export { Routes, durableObjectHandler, getAuthRoutes, renku };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./auth-DivcgvqR.js";import"./rsc-from-markup-SQg4fJ0z.js";import"./virtual-from-jsx-BgQUXZ4d.js";import"./signal-store-0zk-69gB.js";import"./effect-hmzj-Jig.js";import{n as e,r as t,t as n}from"./cloudflare-Dfzl7gGy.js";import"./get-route-B1JNCPoL.js";export{t as durableObjectHandler,e as getAuthRoutes,n as renku};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import "./types-BStlw_FH.js";
|
|
2
|
+
import "./types-DA3_gaOB.js";
|
|
3
|
+
import { r as Routes } from "./types-DazdXa4I.js";
|
|
4
|
+
import { n as getAuthRoutes, r as durableObjectHandler, t as renku } from "./index-BpyLKbnR.js";
|
|
5
|
+
import { DurableObject } from "cloudflare:workers";
|
|
6
|
+
|
|
7
|
+
//#region src/cloudflare/durable-objects/auth.d.ts
|
|
8
|
+
declare class AuthDO extends DurableObject<Env> {
|
|
9
|
+
challenge: string | null;
|
|
10
|
+
constructor(ctx: DurableObjectState, env: Env);
|
|
11
|
+
private createChallenge;
|
|
12
|
+
creationOptions({
|
|
13
|
+
id,
|
|
14
|
+
email,
|
|
15
|
+
rpId,
|
|
16
|
+
rpName
|
|
17
|
+
}: {
|
|
18
|
+
id: string;
|
|
19
|
+
email: string;
|
|
20
|
+
rpId: string;
|
|
21
|
+
rpName: string;
|
|
22
|
+
}): PublicKeyCredentialCreationOptionsJSON;
|
|
23
|
+
validateCreation({
|
|
24
|
+
name,
|
|
25
|
+
credential
|
|
26
|
+
}: {
|
|
27
|
+
name: string;
|
|
28
|
+
credential: PublicKeyCredentialJSON;
|
|
29
|
+
}): Promise<boolean>;
|
|
30
|
+
storeCredential({
|
|
31
|
+
name,
|
|
32
|
+
credential
|
|
33
|
+
}: {
|
|
34
|
+
name: string;
|
|
35
|
+
credential: PublicKeyCredentialJSON;
|
|
36
|
+
}): void;
|
|
37
|
+
getChallenge(): string | null;
|
|
38
|
+
requestOptions({
|
|
39
|
+
rpId
|
|
40
|
+
}: {
|
|
41
|
+
rpId: string;
|
|
42
|
+
}): PublicKeyCredentialRequestOptionsJSON;
|
|
43
|
+
validateRequest({
|
|
44
|
+
credential,
|
|
45
|
+
sessionExpiryInMinutes
|
|
46
|
+
}: {
|
|
47
|
+
credential: PublicKeyCredentialJSON;
|
|
48
|
+
sessionExpiryInMinutes: number;
|
|
49
|
+
}): Promise<string | false>;
|
|
50
|
+
validateCredential({
|
|
51
|
+
challenge,
|
|
52
|
+
credential,
|
|
53
|
+
sessionExpiryInMinutes
|
|
54
|
+
}: {
|
|
55
|
+
challenge: string;
|
|
56
|
+
credential: PublicKeyCredentialJSON;
|
|
57
|
+
sessionExpiryInMinutes: number;
|
|
58
|
+
}): Promise<string | false>;
|
|
59
|
+
private setExpiry;
|
|
60
|
+
createSession({
|
|
61
|
+
userId,
|
|
62
|
+
sessionExpiryInMinutes
|
|
63
|
+
}: {
|
|
64
|
+
userId: string;
|
|
65
|
+
sessionExpiryInMinutes: number;
|
|
66
|
+
}): void;
|
|
67
|
+
getUserId(): string;
|
|
68
|
+
validateSession({
|
|
69
|
+
sessionExpiryInMinutes
|
|
70
|
+
}: {
|
|
71
|
+
sessionExpiryInMinutes: number;
|
|
72
|
+
}): false | {
|
|
73
|
+
userId: string;
|
|
74
|
+
};
|
|
75
|
+
logout(): void;
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { AuthDO, Routes, durableObjectHandler, getAuthRoutes, renku };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./auth-DivcgvqR.js";import"./rsc-from-markup-SQg4fJ0z.js";import"./virtual-from-jsx-BgQUXZ4d.js";import"./signal-store-0zk-69gB.js";import"./effect-hmzj-Jig.js";import{n as e,r as t,t as n}from"./cloudflare-Dfzl7gGy.js";import"./get-route-B1JNCPoL.js";import{DurableObject as r}from"cloudflare:workers";const i=e=>{let t=e.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(Math.ceil(e.length/4)*4,`=`),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r},a=e=>btoa(String.fromCharCode(...e)).replace(/=/g,``).replace(/\+/g,`-`).replace(/\//g,`_`);var o=class extends r{challenge=null;constructor(e,t){super(e,t)}createChallenge(){let e=new Uint8Array(16);return self.crypto.getRandomValues(e),this.challenge=a(e),this.challenge}creationOptions({id:e,email:t,rpId:n,rpName:r}){let i=this.createChallenge();return{user:{id:e,name:t,displayName:t},challenge:i,rp:{id:n,name:r},pubKeyCredParams:[{type:`public-key`,alg:-7},{type:`public-key`,alg:-257}]}}async validateCreation({name:e,credential:t}){console.log(`validate`,t);let n=new TextDecoder,r=i(t.response.clientDataJSON),a=JSON.parse(n.decode(r));return a.type===`webauthn.create`&&this.challenge===a.challenge?(this.ctx.storage.kv.put(`credential:${t.id}`,t),this.ctx.storage.kv.put(`name`,e),await this.env.AUTH_DO.getByName(`credential:${t.id}`).storeCredential({name:e,credential:t}),!0):!1}storeCredential({name:e,credential:t}){this.ctx.storage.kv.put(`name`,e),this.ctx.storage.kv.put(`credential`,t)}getChallenge(){return this.challenge}requestOptions({rpId:e}){return{challenge:this.createChallenge(),rpId:e}}async validateRequest({credential:e,sessionExpiryInMinutes:t}){return this.challenge?this.env.AUTH_DO.getByName(`credential:${e.id}`).validateCredential({challenge:this.challenge,credential:e,sessionExpiryInMinutes:t}):!1}async validateCredential({challenge:e,credential:t,sessionExpiryInMinutes:n}){let r=new TextDecoder,a=this.ctx.storage.kv.get(`name`),o=this.ctx.storage.kv.get(`credential`),s=i(t.response.clientDataJSON),c=JSON.parse(r.decode(s));if(console.log(`validateCredential`,{challenge:e,credential:t,clientData:c,storedCredential:o,name:a}),a&&e===c.challenge){let e=crypto.randomUUID();return await this.env.AUTH_DO.getByName(`session:${e}`).createSession({userId:a,sessionExpiryInMinutes:n}),e}return!1}setExpiry(e){this.ctx.storage.kv.put(`expiry`,Date.now()+e*60*1e3)}createSession({userId:e,sessionExpiryInMinutes:t}){this.ctx.storage.kv.put(`userId`,e),this.setExpiry(t)}getUserId(){let e=this.ctx.storage.kv.get(`userId`);return e||(e=crypto.randomUUID(),this.ctx.storage.kv.put(`userId`,e)),e}validateSession({sessionExpiryInMinutes:e}){let t=this.ctx.storage.kv.get(`expiry`),n=this.ctx.storage.kv.get(`userId`);return n&&t&&Date.now()<t?(this.setExpiry(e),{userId:n}):!1}logout(){this.ctx.storage.kv.delete(`userId`)}};export{o as AuthDO,t as durableObjectHandler,e as getAuthRoutes,n as renku};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import e from"node:fs";import t from"node:os";import n from"node:path";function r(e,t){let n=e.env?.[t];return typeof n==`string`&&n!==`0`}var i={UnknownCommand:-5,InvalidArgument:-4,ContextLoadError:-3,CommandLoadError:-2,InternalError:-1,Success:0,CommandRunError:1};function a(e){return e.replace(/-./g,e=>e[1].toUpperCase())}function o(e){return Array.from(e).map((e,t)=>{let n=e.toUpperCase(),r=e.toLowerCase();return t===0||n!==e||n===r?e:`-${r}`}).join(``)}function s(e){let t=new Map;return{get:(...n)=>t.get(n.join(`,`))??e,set:(e,...n)=>{t.set(n.join(`,`),e)}}}function c(e,t,n){let{threshold:r,weights:i}=n;if(e===t)return 0;let a=Math.abs(e.length-t.length);if(typeof r==`number`&&a>r)return 1/0;let o=s(1/0);o.set(0,-1,-1);for(let e=0;e<t.length;++e)o.set((e+1)*i.insertion,-1,e);for(let t=0;t<e.length;++t)o.set((t+1)*i.deletion,t,-1);let c=-1/0;for(let n=0;n<e.length;++n){let a=1/0;for(let r=0;r<=t.length-1;++r){let s=e[n]===t[r]?0:1,c=[o.get(n-1,r)+i.deletion,o.get(n,r-1)+i.insertion,o.get(n-1,r-1)+s*i.substitution];e[n]===t[r-1]&&e[n-1]===t[r]&&c.push(o.get(n-2,r-2)+s*i.transposition);let l=Math.min(...c);o.set(l,n,r),l<a&&(a=l)}if(a>r){if(c>r)return 1/0;c=a}else c=-1/0}let l=o.get(e.length-1,t.length-1);return l>r?1/0:l}function l(e,t,n){let r=e[1]-t[1];if(r!==0)return r;let i=e[0].startsWith(n),a=t[0].startsWith(n);return i&&!a?-1:!i&&a?1:e[0].localeCompare(t[0])}function u(e,t,n){let r=t.map(t=>[t,c(e,t,n)]).filter(([,e])=>e<=n.threshold),i=Math.min(...r.map(([,e])=>e));return r.filter(([,e])=>e===i).sort((t,n)=>l(t,n,e)).map(([e])=>e)}var d=class extends Error{};function f(e){return e instanceof Error?e.stack??String(e):String(e)}function p(e,t){let n=[],r=Math.max(e.length,t.length);for(let i=0;i<r;++i)n[i]=Math.max(e[i],t[i]);return n}function m(e,t){if(e.length===0)return[];let n=Array(Math.max(...e.map(e=>e.length))).fill(0,0),r=e.reduce((e,t)=>p(e,t.map(e=>e.length)),n);return e.map(e=>{let n=(e[0]??``).padEnd(r[0]);return e.slice(1).reduce((e,n,i,a)=>{let o=a.length===i+1?n:n.padEnd(r[i+1]);return[...e,t?.[i]??` `,o]},[n]).join(``).trimEnd()})}function h(e,t){if(e.length<=1)return e[0]??``;if(e.length===2)return e.join(` ${t.conjunction} `);let n=e.slice(0,e.length-1).join(`, `);return t.serialComma&&(n+=`,`),[n,t.conjunction,e[e.length-1]].join(` `)}function ee(e,t){return e.reduce((e,n)=>{let r=t(n),i=e[r]??[];return i.push(n),e[r]=i,e},{})}function te(e,t){return ee(e,e=>e[t])}async function g(e){let t=te(await Promise.allSettled(e),`status`);return t.rejected&&t.rejected.length>0?{status:`rejected`,reasons:t.rejected.map(e=>e.reason)}:{status:`fulfilled`,value:t.fulfilled?.map(e=>e.value)??[]}}var ne=new Set([`true`,`t`,`yes`,`y`,`on`,`1`]),re=new Set([`false`,`f`,`no`,`n`,`off`,`0`]),ie=e=>{let t=e.toLowerCase();if(ne.has(t))return!0;if(re.has(t))return!1;throw SyntaxError(`Cannot convert ${e} to a boolean`)},ae=e=>{let t=Number(e);if(Number.isNaN(t))throw SyntaxError(`Cannot convert ${e} to a number`);return t},_=class extends d{_brand};function oe(e,t){let n=t[e.constructor.name];return n?n(e):e.message}function se(e,t,n){return Object.fromEntries(Object.entries(t).map(([t,r])=>{let i=r,a=e[i];if(!a)throw new v(x(i,n),[],t);return[t,[i,a]]}))}var v=class extends _{input;corrections;aliasName;constructor(e,t,n){let r=`No flag registered for --${e}`;if(n)r+=` (aliased from -${n})`;else if(t.length>0){let e=h(t.map(e=>`--${e}`),{kind:`conjunctive`,conjunction:`or`,serialComma:!0});r+=`, did you mean ${e}?`}super(r),this.input=e,this.corrections=t,this.aliasName=n}},y=class extends _{input;constructor(e){super(`No alias registered for -${e}`),this.input=e}};function b(e,t){return e.placeholder?e.placeholder:typeof t==`number`?`arg${t}`:`args`}function x(e,t){return t===`allow-kebab-for-camel`?o(e):e}var S=class extends _{externalFlagNameOrPlaceholder;input;exception;constructor(e,t,n){super(`Failed to parse "${t}" for ${e}: ${n instanceof Error?n.message:String(n)}`),this.externalFlagNameOrPlaceholder=e,this.input=t,this.exception=n}};function C(e,t,n,r){try{return t.parse.call(r,n)}catch(t){throw new S(e,n,t)}}var w=class extends _{externalFlagName;input;values;constructor(e,t,n,r){let i=`Expected "${t}" to be one of (${n.join(`|`)})`;if(r.length>0){let e=h(r.map(e=>`"${e}"`),{kind:`conjunctive`,conjunction:`or`,serialComma:!0});i+=`, did you mean ${e}?`}super(i),this.externalFlagName=e,this.input=t,this.values=n}},T=class extends _{externalFlagName;nextFlagName;constructor(e,t){let n=`Expected input for flag --${e}`;t&&(n+=` but encountered --${t} instead`),super(n),this.externalFlagName=e,this.nextFlagName=t}},E=class extends _{expectedCount;input;constructor(e,t){super(`Too many arguments, expected ${e} but encountered "${t}"`),this.expectedCount=e,this.input=t}},D=class extends _{placeholder;limit;constructor(e,t){let n;t?(n=`Expected at least ${t[0]} argument(s) for ${e}`,t[1]===0?n+=` but found none`:n+=` but only found ${t[1]}`):n=`Expected argument for ${e}`,super(n),this.placeholder=e,this.limit=t}};function O(e){if(e.startsWith(`no`)&&e.length>2){if(e[2]===`-`)return e.slice(4);let t=e[2];return t===t.toUpperCase()?t.toLowerCase()+e.slice(3):void 0}}function k(e,t,n){let r=e,i=t[r];if(!i){let e=O(r);if(e&&(i=t[e],i&&i.kind==`boolean`))return{namedFlag:[e,i],negated:!0}}let s=a(e);if(n.caseStyle===`allow-kebab-for-camel`&&!i){if(i=t[s],i)return{namedFlag:[s,i]};let e=O(s);if(e&&(i=t[e],i&&i.kind==`boolean`))return{namedFlag:[e,i],negated:!0}}if(!i){if(s in t)throw new v(e,[s]);let i=o(e);throw i in t?new v(e,[i]):new v(e,u(r,Object.keys(t),n.distanceOptions))}return{namedFlag:[r,i]}}function A(e){return e.namedFlag[1].kind===`boolean`||e.namedFlag[1].kind===`counter`}var j=/^-([a-z]+)$/i,ce=/^--([a-z][a-z-.\d_]+)$/i;function le(e,t,n,r){let i=j.exec(e);if(i){let e=i[1];return Array.from(e).map(e=>{let t=e,r=n[t];if(!r)throw new y(t);return{namedFlag:r}})}let a=ce.exec(e);if(a){let e=a[1];return[k(e,t,r)]}return[]}var ue=/^--([a-z][a-z-.\d_]+)=(.+)$/i,de=/^-([a-z])=(.+)$/i,fe=class extends _{externalFlagName;valueText;constructor(e,t){super(`Cannot negate flag --${e} and pass "${t}" as value`),this.externalFlagName=e,this.valueText=t}};function pe(e,t,n,r){let i=ue.exec(e);if(i){let e=i[1],{namedFlag:n,negated:a}=k(e,t,r),o=i[2];if(a)throw new fe(e,o);return[n,o]}let a=de.exec(e);if(a){let e=a[1],t=n[e];if(!t)throw new y(e);return[t,a[2]]}}async function me(e,t,n,r,i){if(!n){if(`default`in t&&typeof t.default<`u`)return t.kind===`boolean`||t.kind===`enum`?t.default:C(e,t,t.default,i);if(t.optional)return;if(t.kind===`boolean`)return!1;if(t.kind===`counter`)return 0;throw new T(e)}if(t.kind===`counter`)return n.reduce((t,n)=>{try{return t+ae.call(i,n)}catch(t){throw new S(e,n,t)}},0);if(`variadic`in t&&t.variadic){if(t.kind===`enum`){for(let i of n)if(!t.values.includes(i)){let n=u(i,t.values,r.distanceOptions);throw new w(e,i,t.values,n)}return n}return Promise.all(n.map(n=>C(e,t,n,i)))}let a=n[0];if(t.kind===`boolean`)try{return ie.call(i,a)}catch(t){throw new S(e,a,t)}if(t.kind===`enum`){if(!t.values.includes(a)){let n=u(a,t.values,r.distanceOptions);throw new w(e,a,t.values,n)}return a}return C(e,t,a,i)}var he=class extends _{externalFlagName;previousInput;input;constructor(e,t,n){super(`Too many arguments for --${e}, encountered "${n}" after "${t}"`),this.externalFlagName=e,this.previousInput=t,this.input=n}};function M(e){return e.kind===`counter`?!0:`variadic`in e?!!e.variadic:!1}function N(e,t,[n,r],i){let a=e.get(n)??[];if(a.length>0&&!M(r))throw new he(x(n,t),a[0],i);if(`variadic`in r&&typeof r.variadic==`string`){let t=i.split(r.variadic);e.set(n,[...a,...t])}else e.set(n,[...a,i])}function P(e,t,n){if(t.get(n)){let t=e[n];return!M(t)}return!1}function F(e,t){let{flags:n={},aliases:r={},positional:i={kind:`tuple`,parameters:[]}}=e,a=se(n,r,t.caseStyle),s=[],c=new Map,l=0,u,f=!1;return{next:e=>{if(!f&&t.allowArgumentEscapeSequence&&e===`--`){if(u)if(u[1].kind===`parsed`&&u[1].inferEmpty)N(c,t.caseStyle,u,``),u=void 0;else throw new T(x(u[0],t.caseStyle));f=!0;return}if(!f){let r=pe(e,n,a,t);if(r){if(u)if(u[1].kind===`parsed`&&u[1].inferEmpty)N(c,t.caseStyle,u,``),u=void 0;else throw new T(x(u[0],t.caseStyle),x(r[0][0],t.caseStyle));N(c,t.caseStyle,...r);return}let i=le(e,n,a,t);if(i.length>0){if(u)if(u[1].kind===`parsed`&&u[1].inferEmpty)N(c,t.caseStyle,u,``),u=void 0;else throw new T(x(u[0],t.caseStyle),x(i[0].namedFlag[0],t.caseStyle));if(i.every(A))for(let e of i)e.namedFlag[1].kind===`boolean`?N(c,t.caseStyle,e.namedFlag,e.negated?`false`:`true`):N(c,t.caseStyle,e.namedFlag,`1`);else if(i.length>1)throw new T(x(i.find(e=>!A(e)).namedFlag[0],t.caseStyle));else u=i[0].namedFlag;return}}if(u)N(c,t.caseStyle,u,e),u=void 0;else{if(i.kind===`tuple`){if(l>=i.parameters.length)throw new E(i.parameters.length,e)}else if(typeof i.maximum==`number`&&l>=i.maximum)throw new E(i.maximum,e);s[l]=e,++l}},parseArguments:async e=>{let r=[],a;i.kind===`array`?(typeof i.minimum==`number`&&l<i.minimum&&r.push(new D(b(i.parameter),[i.minimum,l])),a=g(s.map(async(t,n)=>C(b(i.parameter,n+1),i.parameter,t,e)))):a=g(i.parameters.map(async(t,n)=>{let r=b(t,n+1),i=s[n];if(typeof i!=`string`){if(typeof t.default==`string`)return C(r,t,t.default,e);if(t.optional)return;throw new D(r)}return C(r,t,i,e)})),u&&u[1].kind===`parsed`&&u[1].inferEmpty&&(N(c,t.caseStyle,u,``),u=void 0);let o=g(Object.entries(n).map(async n=>{let[r,i]=n,a=x(r,t.caseStyle);if(u&&u[0]===r)throw new T(a);return[r,await me(a,i,c.get(r),t,e)]})),[f,p]=await Promise.all([a,o]);if(f.status===`rejected`)for(let e of f.reasons)r.push(e);if(p.status===`rejected`)for(let e of p.reasons)r.push(e);if(r.length>0)return{success:!1,errors:r};if(f.status===`rejected`)throw new d(`Unknown failure while scanning positional arguments`);if(p.status===`rejected`)throw new d(`Unknown failure while scanning flag arguments`);return{success:!0,arguments:[Object.fromEntries(p.value),...f.value]}},proposeCompletions:async({partial:e,completionConfig:s,text:d,context:p,includeVersionFlag:m})=>{if(u)return I(u[1],p,e);let h=[];if(!f){let i=j.exec(e);if(s.includeAliases){if(e===``||e===`-`){let e=Object.entries(r).filter(e=>!P(n,c,e[1]));for(let[t]of e){let e=a[t];e&&h.push({kind:`argument:flag`,completion:`-${t}`,brief:e[1].brief})}}else if(i){let o=Array.from(i[1]);if(o.includes(`h`)||m&&o.includes(`v`))return[];let s=new Map(c);for(let e of o){let n=a[e];if(!n)throw new y(e);N(s,t.caseStyle,n,n[1].kind===`boolean`?`true`:`1`)}let l=o[o.length-1];if(l){let t=a[l];t&&h.push({kind:`argument:flag`,completion:e,brief:t[1].brief})}let u=Object.entries(r).filter(e=>!P(n,s,e[1]));for(let[t]of u){let n=a[t];n&&h.push({kind:`argument:flag`,completion:`${e}${t}`,brief:n[1].brief})}}}if(e===``||e===`-`||e.startsWith(`--`)){t.allowArgumentEscapeSequence&&h.push({kind:`argument:flag`,completion:`--`,brief:d.briefs.argumentEscapeSequence});let r=Object.entries(n).filter(([e])=>!P(n,c,e));t.caseStyle===`allow-kebab-for-camel`&&(r=r.map(([e,t])=>[o(e),t]));let i=r.map(([e,t])=>[`--${e}`,t]).filter(([t])=>t.startsWith(e));h.push(...i.map(([e,t])=>({kind:`argument:flag`,completion:e,brief:t.brief})))}}if(i.kind===`array`){if(i.parameter.proposeCompletions&&(typeof i.maximum!=`number`||l<i.maximum)){let t=await i.parameter.proposeCompletions.call(p,e);h.push(...t.map(e=>({kind:`argument:value`,completion:e,brief:i.parameter.brief})))}}else{let t=i.parameters[l];if(t?.proposeCompletions){let n=await t.proposeCompletions.call(p,e);h.push(...n.map(e=>({kind:`argument:value`,completion:e,brief:t.brief})))}}return h.filter(({completion:t})=>t.startsWith(e))}}}async function I(e,t,n){if(typeof e.variadic==`string`&&n.endsWith(e.variadic))return I(e,t,``);let r;return r=e.kind===`enum`?e.values:e.proposeCompletions?await e.proposeCompletions.call(t,n):[],r.map(t=>({kind:`argument:value`,completion:t,brief:e.brief})).filter(({completion:e})=>e.startsWith(n))}function ge(e,t,n){let r=t===`allow-kebab-for-camel`?`convert-camel-to-kebab`:t,i=e.getAllEntries();return n.includeHiddenRoutes||(i=i.filter(e=>!e.hidden)),i.flatMap(e=>{let t=e.name[r];return n.includeAliases?[t,...e.aliases]:[t]})}var _e={headers:{usage:`USAGE`,aliases:`ALIASES`,commands:`COMMANDS`,flags:`FLAGS`,arguments:`ARGUMENTS`},keywords:{default:`default =`,separator:`separator =`},briefs:{help:`Print help information and exit`,helpAll:`Print help information (including hidden commands/flags) and exit`,version:`Print version information and exit`,argumentEscapeSequence:`All subsequent inputs should be interpreted as arguments`},noCommandRegisteredForInput:({input:e,corrections:t})=>{let n=`No command registered for \`${e}\``;return t.length>0?`${n}, did you mean ${h(t,{kind:`conjunctive`,conjunction:`or`,serialComma:!0})}?`:n},noTextAvailableForLocale:({requestedLocale:e,defaultLocale:t})=>`Application does not support "${e}" locale, defaulting to "${t}"`,exceptionWhileParsingArguments:e=>e instanceof _?oe(e,{}):`Unable to parse arguments, ${f(e)}`,exceptionWhileLoadingCommandFunction:e=>`Unable to load command function, ${f(e)}`,exceptionWhileLoadingCommandContext:e=>`Unable to load command context, ${f(e)}`,exceptionWhileRunningCommand:e=>`Command failed, ${f(e)}`,commandErrorResult:e=>e.message,currentVersionIsNotLatest:({currentVersion:e,latestVersion:t,upgradeCommand:n})=>n?`Latest available version is ${t} (currently running ${e}), upgrade with "${n}"`:`Latest available version is ${t} (currently running ${e})`};function ve(e){if(e.startsWith(`en`))return _e}function L(e,t,n){return!n.disableAnsiColor&&!r(e,`STRICLI_NO_COLOR`)&&(t.getColorDepth?.(e.env)??1)>=4}async function ye({loader:e,parameters:t},{context:n,inputs:r,scannerConfig:a,errorFormatting:o,documentationConfig:s,determineExitCode:c}){let l=e(),u;try{let e=F(t,a);for(let t of r)e.next(t);let c=await e.parseArguments(n);if(c.success)u=c.arguments;else{let e=L(n.process,n.process.stderr,s);for(let t of c.errors){let r=o.exceptionWhileParsingArguments(t,e);n.process.stderr.write(e?`\x1B[1m\x1B[31m${r}\x1B[39m\x1B[22m
|
|
2
|
+
`:`${r}
|
|
3
|
+
`)}return i.InvalidArgument}}catch(e){let t=L(n.process,n.process.stderr,s),r=o.exceptionWhileParsingArguments(e,t);return n.process.stderr.write(t?`\x1B[1m\x1B[31m${r}\x1B[39m\x1B[22m
|
|
4
|
+
`:`${r}
|
|
5
|
+
`),i.InvalidArgument}let d;try{let e=await l;d=typeof e==`function`?e:e.default}catch(e){let t=L(n.process,n.process.stderr,s),r=o.exceptionWhileLoadingCommandFunction(e,t);return n.process.stderr.write(t?`\x1B[1m\x1B[31m${r}\x1B[39m\x1B[22m
|
|
6
|
+
`:`${r}
|
|
7
|
+
`),i.CommandLoadError}try{let e=await d.call(n,...u);if(e instanceof Error){let t=L(n.process,n.process.stderr,s),r=o.commandErrorResult(e,t);return n.process.stderr.write(t?`\x1B[1m\x1B[31m${r}\x1B[39m\x1B[22m
|
|
8
|
+
`:`${r}
|
|
9
|
+
`),c?c(e):i.CommandRunError}}catch(e){let t=L(n.process,n.process.stderr,s),r=o.exceptionWhileRunningCommand(e,t);return n.process.stderr.write(t?`\x1B[1m\x1B[31m${r}\x1B[39m\x1B[22m
|
|
10
|
+
`:`${r}
|
|
11
|
+
`),c?c(e):i.CommandRunError}return i.Success}var R=Symbol(`RouteMap`),z=Symbol(`Command`);function B(e,t,n){let r=[...n],i=[],o,s=e,c,l=!0,u=!1;return{next:e=>{if(e===`--help`||e===`-h`){u=!0,c||=s;return}else if(e===`--helpAll`||e===`--help-all`||e===`-H`){u=`all`,c||=s;return}if(c){i.push(e);return}if(s.kind===z){c=s,i.push(e);return}let n=a(e),d=e,f=s.getRoutingTargetForInput(d);if(t.caseStyle===`allow-kebab-for-camel`&&!f&&(f=s.getRoutingTargetForInput(n),f&&(d=n)),!f){let t=s.getDefaultCommand();if(t){l=!1,o=[s,``],i.push(e),s=t;return}return{input:e,routeMap:s}}l=!1,o=[s,e],s=f,r.push(e)},finish:()=>{if(c??=s,c.kind===R&&!u){let e=c.getDefaultCommand();e&&(o=[c,``],c=e,l=!1)}let e=o?o[0].getOtherAliasesForInput(o[1],t.caseStyle):{original:[],"convert-camel-to-kebab":[]};return{target:c,unprocessedInputs:i,helpRequested:u,prefix:r,rootLevel:l,aliases:e}}}}async function be({root:e,defaultText:t,config:n},a,o){let s=t;if(o.locale){let e=n.localization.loadText(o.locale);if(e)s=e;else{let e=L(o.process,o.process.stderr,n.documentation),t=s.noTextAvailableForLocale({requestedLocale:o.locale,defaultLocale:n.localization.defaultLocale,ansiColor:e});o.process.stderr.write(e?`\x1B[1m\x1B[33m${t}\x1B[39m\x1B[22m
|
|
12
|
+
`:`${t}
|
|
13
|
+
`)}}if(n.versionInfo?.getLatestVersion&&!r(o.process,`STRICLI_SKIP_VERSION_CHECK`)){let e;e=`currentVersion`in n.versionInfo?n.versionInfo.currentVersion:await n.versionInfo.getCurrentVersion.call(o);let t=await n.versionInfo.getLatestVersion.call(o,e);if(t&&e!==t){let r=L(o.process,o.process.stderr,n.documentation),i=s.currentVersionIsNotLatest({currentVersion:e,latestVersion:t,upgradeCommand:n.versionInfo.upgradeCommand,ansiColor:r});o.process.stderr.write(r?`\x1B[1m\x1B[33m${i}\x1B[39m\x1B[22m
|
|
14
|
+
`:`${i}
|
|
15
|
+
`)}}let c=a.slice();if(n.versionInfo&&(c[0]===`--version`||c[0]===`-v`)){let e;return e=`currentVersion`in n.versionInfo?n.versionInfo.currentVersion:await n.versionInfo.getCurrentVersion.call(o),o.process.stdout.write(e+`
|
|
16
|
+
`),i.Success}let l=B(e,n.scanner,[n.name]),d;for(;c.length>0&&!d;){let e=c.shift();d=l.next(e)}if(d){let e=ge(d.routeMap,n.scanner.caseStyle,n.completion),t=u(d.input,e,n.scanner.distanceOptions).map(e=>`\`${e}\``),r=L(o.process,o.process.stderr,n.documentation),a=s.noCommandRegisteredForInput({input:d.input,corrections:t,ansiColor:r});return o.process.stderr.write(r?`\x1B[1m\x1B[31m${a}\x1B[39m\x1B[22m
|
|
17
|
+
`:`${a}
|
|
18
|
+
`),i.UnknownCommand}let f=l.finish();if(f.helpRequested||f.target.kind===R){let e=L(o.process,o.process.stdout,n.documentation);return o.process.stdout.write(f.target.formatHelp({prefix:f.prefix,includeVersionFlag:!!n.versionInfo&&f.rootLevel,includeArgumentEscapeSequenceFlag:n.scanner.allowArgumentEscapeSequence,includeHelpAllFlag:f.helpRequested===`all`||n.documentation.alwaysShowHelpAllFlag,includeHidden:f.helpRequested===`all`,config:n.documentation,aliases:f.aliases[n.documentation.caseStyle],text:s,ansiColor:e})),i.Success}let p;if(`forCommand`in o)try{p=await o.forCommand({prefix:f.prefix})}catch(e){let t=L(o.process,o.process.stderr,n.documentation),r=s.exceptionWhileLoadingCommandContext(e,t);return o.process.stderr.write(t?`\x1B[1m\x1B[31m${r}\x1B[39m\x1B[22m`:r),i.ContextLoadError}else p=o;return ye(f.target,{context:p,inputs:f.unprocessedInputs,scannerConfig:n.scanner,documentationConfig:n.documentation,errorFormatting:s,determineExitCode:n.determineExitCode})}function V(e,t){return t===`convert-camel-to-kebab`?o(e):e}function xe(e,t){return t===`convert-camel-to-kebab`?`no-${o(e)}`:`no${e[0].toUpperCase()}${e.slice(1)}`}function Se(e){let t=e.scanner?.caseStyle??`original`,n;if(e.documentation?.caseStyle){if(t===`original`&&e.documentation.caseStyle===`convert-camel-to-kebab`)throw new d(`Cannot convert route and flag names on display but scan as original`);n=e.documentation.caseStyle}else n=t===`allow-kebab-for-camel`?`convert-camel-to-kebab`:t;let r={caseStyle:t,allowArgumentEscapeSequence:e.scanner?.allowArgumentEscapeSequence??!1,distanceOptions:e.scanner?.distanceOptions??{threshold:7,weights:{insertion:1,deletion:3,substitution:2,transposition:0}}},i={alwaysShowHelpAllFlag:e.documentation?.alwaysShowHelpAllFlag??!1,useAliasInUsageLine:e.documentation?.useAliasInUsageLine??!1,onlyRequiredInUsageLine:e.documentation?.onlyRequiredInUsageLine??!1,caseStyle:n,disableAnsiColor:e.documentation?.disableAnsiColor??!1},a={includeAliases:e.completion?.includeAliases??i.useAliasInUsageLine,includeHiddenRoutes:e.completion?.includeHiddenRoutes??!1,...e.completion};return{...e,scanner:r,completion:a,documentation:i,localization:{defaultLocale:`en`,loadText:ve,...e.localization}}}function Ce(e,t){let n=Se(t);if(e.kind===z&&n.versionInfo){if(e.usesFlag(`version`))throw new d(`Unable to use command with flag --version as root when version info is supplied`);if(e.usesFlag(`v`))throw new d(`Unable to use command with alias -v as root when version info is supplied`)}let r=n.localization.loadText(n.localization.defaultLocale);if(!r)throw new d(`No text available for the default locale "${n.localization.defaultLocale}"`);return{root:e,config:n,defaultText:r}}async function we({parameters:e},t){try{let n=F(e,t.scannerConfig);for(let e of t.inputs)n.next(e);return await n.proposeCompletions(t)}catch{return[]}}async function Te(e,{partial:t,scannerConfig:n,completionConfig:r}){let i=e.getAllEntries();r.includeHiddenRoutes||(i=i.filter(e=>!e.hidden));let a=n.caseStyle===`allow-kebab-for-camel`?`convert-camel-to-kebab`:n.caseStyle;return i.flatMap(e=>{let t=e.target.kind===z?`routing-target:command`:`routing-target:route-map`,n=e.target.brief,i={kind:t,completion:e.name[a],brief:n};return r.includeAliases?[i,...e.aliases.map(e=>({kind:t,completion:e,brief:n}))]:[i]}).filter(({completion:e})=>e.startsWith(t))}async function Ee({root:e,config:t,defaultText:n},r,i){if(r.length===0)return[];let a=B(e,t.scanner,[]),o=r.slice(0,-1),s;for(;o.length>0&&!s;){let e=o.shift();s=a.next(e)}if(s)return[];let c=a.finish();if(c.helpRequested)return[];let l;if(`forCommand`in i)try{l=await i.forCommand({prefix:c.prefix})}catch{return[]}else l=i;let u=r[r.length-1];return c.target.kind===R?Te(c.target,{context:l,partial:u,scannerConfig:t.scanner,completionConfig:t.completion}):we(c.target,{context:l,inputs:c.unprocessedInputs,partial:u,scannerConfig:t.scanner,completionConfig:t.completion,text:n,includeVersionFlag:!!t.versionInfo&&c.rootLevel})}function H(e){return`default`in e&&typeof e.default<`u`}function U(e){return e.optional??H(e)}function W(e){return`(${e})`}function G(e){return`[${e}]`}function K(e){return`${e}...`}function De(e){return`<${e}>`}function Oe(e){return`[<${e}>]`}function ke(e){return`<${e}>...`}function q(e,t){let n=Object.entries(e.flags??{}).filter(([,e])=>!(e.hidden||t.config.onlyRequiredInUsageLine&&U(e))).map(([n,r])=>{let i=t.config.caseStyle===`convert-camel-to-kebab`?`--${o(n)}`:`--${n}`;if(e.aliases&&t.config.useAliasInUsageLine){let t=Object.entries(e.aliases).filter(e=>e[1]===n);t.length===1&&t[0]&&(i=`-${t[0][0]}`)}if(r.kind===`boolean`)return[r,i];if(r.kind===`enum`&&typeof r.placeholder!=`string`)return[r,`${i} ${r.values.join(`|`)}`];let a=r.placeholder??`value`;return[r,`${i} ${a}`]}).map(([e,t])=>e.kind===`parsed`&&e.variadic?U(e)?K(G(t)):K(W(t)):U(e)?G(t):W(t)),r=[],i=e.positional;if(i)if(i.kind===`array`)r=[ke(i.parameter.placeholder??`args`)];else{let e=i.parameters;t.config.onlyRequiredInUsageLine&&(e=e.filter(e=>!e.optional&&typeof e.default>`u`)),r=e.map((e,t)=>{let n=e.placeholder??`arg${t+1}`;return e.optional||typeof e.default<`u`?Oe(n):De(n)})}return[...t.prefix,...n,...r].join(` `)}function J(e,t,n){let{keywords:r,briefs:i}=n.text,a=Object.entries(e).filter(([,e])=>!(e.hidden&&!n.includeHidden)),o=a.some(([,e])=>U(e)),s=a.map(([e,i])=>{let a=Object.entries(t).filter(t=>t[1]===e).map(([e])=>`-${e}`),s=`--`+V(e,n.config.caseStyle);if(i.kind===`boolean`&&i.default!==!1){let t=xe(e,n.config.caseStyle);s=`${s}/--${t}`}U(i)?s=`[${s}]`:o&&(s=` ${s}`),i.kind===`parsed`&&i.variadic&&(s=`${s}...`);let c=[];if(i.kind===`enum`){let e=i.values.join(`|`);c.push(e)}if(H(i)){let e=n.ansiColor?`\x1B[90m${r.default}\x1B[39m`:r.default;c.push(`${e} ${i.default===``?`""`:String(i.default)}`)}if(`variadic`in i&&typeof i.variadic==`string`){let e=n.ansiColor?`\x1B[90m${r.separator}\x1B[39m`:r.separator;c.push(`${e} ${i.variadic}`)}let l=c.length>0?`[${c.join(`, `)}]`:void 0;return{aliases:a.join(` `),flagName:s,brief:i.brief,suffix:l,hidden:i.hidden}});if(s.push({aliases:`-h`,flagName:o?` --help`:`--help`,brief:i.help}),n.includeHelpAllFlag){let e=V(`helpAll`,n.config.caseStyle);s.push({aliases:`-H`,flagName:o?` --${e}`:`--${e}`,brief:i.helpAll,hidden:!n.config.alwaysShowHelpAllFlag})}return n.includeVersionFlag&&s.push({aliases:`-v`,flagName:o?` --version`:`--version`,brief:i.version}),n.includeArgumentEscapeSequenceFlag&&s.push({aliases:``,flagName:o?` --`:`--`,brief:i.argumentEscapeSequence}),m(s.map(e=>n.ansiColor?[e.hidden?`\x1B[90m${e.aliases}\x1B[39m`:`\x1B[97m${e.aliases}\x1B[39m`,e.hidden?`\x1B[90m${e.flagName}\x1B[39m`:`\x1B[97m${e.flagName}\x1B[39m`,e.hidden?`\x1B[90m${e.brief}\x1B[39m`:`\x1B[03m${e.brief}\x1B[23m`,e.suffix??``]:[e.aliases,e.flagName,e.brief,e.suffix??``]),[` `,` `,` `])}function*Y(e){if(yield e.config.useAliasInUsageLine?`-h`:`--help`,e.includeHelpAllFlag){let t=V(`helpAll`,e.config.caseStyle);yield e.config.useAliasInUsageLine?`-H`:`--${t}`}e.includeVersionFlag&&(yield e.config.useAliasInUsageLine?`-v`:`--version`)}function Ae(e,t){if(e.kind===`array`){let n=e.parameter.placeholder??`args`;return m([[t.ansiColor?`\x1B[97m${n}...\x1B[39m`:`${n}...`,t.ansiColor?`\x1B[3m${e.parameter.brief}\x1B[23m`:e.parameter.brief]],[` `])}let{keywords:n}=t.text,r=e.parameters.some(e=>e.optional);return m(e.parameters.map((e,i)=>{let a=e.placeholder??`arg${i+1}`,o;return e.optional?a=`[${a}]`:r&&(a=` ${a}`),e.default&&(o=`[${t.ansiColor?`\x1B[90m${n.default}\x1B[39m`:n.default} ${e.default}]`),[t.ansiColor?`\x1B[97m${a}\x1B[39m`:a,t.ansiColor?`\x1B[3m${e.brief}\x1B[23m`:e.brief,o??``]}),[` `,` `])}function*je(e,t,n){let{brief:r,fullDescription:i,customUsage:a}=t,{headers:o}=n.text,s=n.prefix.join(` `);if(yield n.ansiColor?`\x1B[1m${o.usage}\x1B[22m`:o.usage,a)for(let e of a)if(typeof e==`string`)yield` ${s} ${e}`;else{let t=n.ansiColor?`\x1B[3m${e.brief}\x1B[23m`:e.brief;yield` ${s} ${e.input}
|
|
19
|
+
${t}`}else yield` ${q(e,n)}`;for(let e of Y(n))yield` ${s} ${e}`;if(yield``,yield i??r,n.aliases&&n.aliases.length>0){let e=n.prefix.slice(0,-1).join(` `);yield``,yield n.ansiColor?`\x1B[1m${o.aliases}\x1B[22m`:o.aliases;for(let t of n.aliases)yield` ${e} ${t}`}yield``,yield n.ansiColor?`\x1B[1m${o.flags}\x1B[22m`:o.flags;for(let t of J(e.flags??{},e.aliases??{},n))yield` ${t}`;let c=e.positional??{kind:`tuple`,parameters:[]};if(c.kind===`array`||c.parameters.length>0){yield``,yield n.ansiColor?`\x1B[1m${o.arguments}\x1B[22m`:o.arguments;for(let e of Ae(c,n))yield` ${e}`}}function Me(e,t){for(let n of t)if(n in e)throw new d(`Unable to use reserved flag --${n}`)}function Ne(e,t){for(let n of t)if(n in e)throw new d(`Unable to use reserved alias -${n}`)}function*Pe(e){yield`no-${o(e)}`,yield`no${e[0].toUpperCase()}${e.slice(1)}`}function Fe(e){let t=Object.entries(e).filter(([,e])=>e.kind===`boolean`&&!e.optional);for(let[n]of t)for(let t of Pe(n))if(t in e)throw new d(`Unable to allow negation for --${n} as it conflicts with --${t}`)}function Ie(e){for(let[t,n]of Object.entries(e))if(`variadic`in n&&typeof n.variadic==`string`){if(n.variadic.length<1)throw new d(`Unable to use "" as variadic separator for --${t} as it is empty`);if(/\s/.test(n.variadic))throw new d(`Unable to use "${n.variadic}" as variadic separator for --${t} as it contains whitespace`)}}function X(e){let{flags:t={},aliases:n={}}=e.parameters;Me(t,[`help`,`helpAll`,`help-all`]),Ne(n,[`h`,`H`]),Fe(t),Ie(t);let r;return r=`func`in e?async()=>e.func:e.loader,{kind:z,loader:r,parameters:e.parameters,get brief(){return e.docs.brief},formatUsageLine:t=>q(e.parameters,t),formatHelp:t=>[...je(e.parameters,e.docs,t)].join(`
|
|
20
|
+
`)+`
|
|
21
|
+
`,usesFlag:e=>e in t||e in n}}function*Le(e,t,n){let{brief:r,fullDescription:i,hideRoute:a}=t,{headers:s}=n.text;yield n.ansiColor?`\x1B[1m${s.usage}\x1B[22m`:s.usage;for(let[t,r]of Object.entries(e))if(!a||!a[t]||n.includeHidden){let e=n.config.caseStyle===`convert-camel-to-kebab`?o(t):t;yield` ${r.formatUsageLine({...n,prefix:[...n.prefix,e]})}`}let c=n.prefix.join(` `);for(let e of Y(n))yield` ${c} ${e}`;if(yield``,yield i??r,n.aliases&&n.aliases.length>0){let e=n.prefix.slice(0,-1).join(` `);yield``,yield n.ansiColor?`\x1B[1m${s.aliases}\x1B[22m`:s.aliases;for(let t of n.aliases)yield` ${e} ${t}`}yield``,yield n.ansiColor?`\x1B[1m${s.flags}\x1B[22m`:s.flags;for(let e of J({},{},n))yield` ${e}`;yield``,yield n.ansiColor?`\x1B[1m${s.commands}\x1B[22m`:s.commands;let l=m(Object.entries(e).filter(([e])=>!a||!a[e]||n.includeHidden).map(([e,t])=>({routeName:V(e,n.config.caseStyle),brief:t.brief,hidden:a&&a[e]})).map(e=>n.ansiColor?[e.hidden?`\x1B[90m${e.routeName}\x1B[39m`:`\x1B[97m${e.routeName}\x1B[39m`,e.hidden?`\x1B[90m${e.brief}\x1B[39m`:`\x1B[03m${e.brief}\x1B[23m`]:[e.routeName,e.brief]),[` `]);for(let e of l)yield` ${e}`}function Z({routes:e,defaultCommand:t,docs:n,aliases:r}){if(Object.entries(e).length===0)throw new d(`Route map must contain at least one route`);let i=r??{},s=new Map;for(let[t,n]of Object.entries(i)){if(t in e)throw new d(`Cannot use "${t}" as an alias when a route with that name already exists`);let r=s.get(n)??[];s.set(n,[...r,t])}let c=t?e[t]:void 0;if(c&&c.kind===R)throw new d(`Cannot use "${t}" as the default command because it is not a Command`);let l=t=>{if(t in i)return i[t];if(t in e)return t};return{kind:R,get brief(){return n.brief},formatUsageLine(e){let t=this.getAllEntries().filter(e=>!e.hidden).map(t=>t.name[e.config.caseStyle]);return`${e.prefix.join(` `)} ${t.join(`|`)} ...`},formatHelp:t=>[...Le(e,n,t)].join(`
|
|
22
|
+
`)+`
|
|
23
|
+
`,getDefaultCommand:()=>c,getOtherAliasesForInput:(e,n)=>{if(t){if(e===t)return{original:[``],"convert-camel-to-kebab":[``]};if(e===``)return{original:[t],"convert-camel-to-kebab":[t]}}let r=a(e),i=l(e);if(!i&&n===`allow-kebab-for-camel`&&(i=l(r)),!i)return{original:[],"convert-camel-to-kebab":[]};let c=[i,...s.get(i)??[]].filter(t=>t!==e&&t!==r);return{original:c,"convert-camel-to-kebab":c.map(o)}},getRoutingTargetForInput:t=>e[t in i?i[t]:t],getAllEntries(){let t=n.hideRoute;return Object.entries(e).map(([e,n])=>({name:{original:e,"convert-camel-to-kebab":o(e)},target:n,aliases:s.get(e)??[],hidden:t?.[e]??!1}))}}}async function Re(e,t,n){let r=await be(e,t,n);n.process.exitCode=r}function Q(e,t){if(e.length<=1)return e[0]??``;if(e.length===2)return e.join(` ${t.conjunction} `);let n=e.slice(0,e.length-1).join(`, `);return t.serialComma&&(n+=`,`),[n,t.conjunction,e[e.length-1]].join(` `)}var $={parse:String,brief:`Target command run by user`,placeholder:`targetCommand`};X({loader:async()=>{let{install:e}=await import(`./impl-CQ7GTRH2-BsAKEI_H.js`);return e},parameters:{flags:{bash:{kind:`parsed`,brief:`Command executed by bash to generate completion proposals`,parse:String,optional:!0,placeholder:`command`}},positional:{kind:`tuple`,parameters:[$]}},docs:{brief:`Installs autocomplete support for target command on all provided shell types`}});function ze(e,t){return X({loader:async()=>{let{install:n}=await import(`./impl-CQ7GTRH2-BsAKEI_H.js`);return function(){return n.call(this,t,e)}},parameters:{},docs:{brief:`Installs ${Q(Object.keys(t),{conjunction:`and`,serialComma:!0})} autocomplete support for ${e}`}})}X({loader:async()=>{let{uninstall:e}=await import(`./impl-CQ7GTRH2-BsAKEI_H.js`);return e},parameters:{flags:{bash:{kind:`boolean`,brief:`Uninstall autocompletion for bash`,optional:!0}},positional:{kind:`tuple`,parameters:[$]}},docs:{brief:`Uninstalls autocomplete support for target command on all selected shell types`}});function Be(e,t){return X({loader:async()=>{let{uninstall:n}=await import(`./impl-CQ7GTRH2-BsAKEI_H.js`);return function(){return n.call(this,t,e)}},parameters:{},docs:{brief:`Uninstalls ${Q(Object.entries(t).filter(([,e])=>e).map(([e])=>e),{conjunction:`and`,serialComma:!0})} autocomplete support for ${e}`}})}var Ve=`renku`,He=`Renku`,Ue=`0.0.3`;const We=Z({routes:{ios:X({loader:async()=>{let{ios:e}=await import(`./impl-O61EKx7J.js`);return e},parameters:{positional:{kind:`tuple`,parameters:[]},flags:{foo:{kind:`parsed`,optional:!0,parse:String,brief:`Foo`}}},docs:{brief:`Nested ios command`}}),android:X({loader:async()=>{let{android:e}=await import(`./impl-O61EKx7J.js`);return e},parameters:{positional:{kind:`tuple`,parameters:[]},flags:{foo:{kind:`parsed`,optional:!0,parse:String,brief:`Foo`}}},docs:{brief:`Nested android command`}})},docs:{brief:`Native app generation`}}),Ge=Z({routes:{foo:X({loader:async()=>{let{foo:e}=await import(`./impl-vRmneAi-.js`);return e},parameters:{positional:{kind:`tuple`,parameters:[]},flags:{foo:{kind:`parsed`,optional:!0,parse:String,brief:`Foo`}}},docs:{brief:`Nested foo command`}}),bar:X({loader:async()=>{let{bar:e}=await import(`./impl-vRmneAi-.js`);return e},parameters:{positional:{kind:`tuple`,parameters:[]},flags:{foo:{kind:`parsed`,optional:!0,parse:String,brief:`Foo`}}},docs:{brief:`Nested bar command`}})},docs:{brief:`Nested commands`}}),Ke=Ce(Z({routes:{subdir:X({loader:async()=>import(`./impl-CRQorzAF.js`),parameters:{positional:{kind:`tuple`,parameters:[]},flags:{foo:{kind:`parsed`,optional:!0,parse:String,brief:`Foo`}}},docs:{brief:`Command in subdirectory`}}),nested:Ge,native:We,install:ze(`my-app`,{bash:`__my-app_bash_complete`}),uninstall:Be(`my-app`,{bash:!0})},docs:{brief:He,hideRoute:{install:!0,uninstall:!0}}}),{name:Ve,versionInfo:{currentVersion:Ue}});function qe(r){return{process:r,os:t,fs:e,path:n}}export{Ee as i,Ke as n,Re as r,qe as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./signal-store-0zk-69gB.js";const n=e=>t.get(e);function r(e,t){let r=n({status:`loading`,error:!1,data:null});return r.get().status===`loading`&&e().then(async e=>{if(!t)r.set({status:`success`,error:!1,data:e});else{let n=t(e),i=n instanceof Promise?await n:n;r.set({status:`success`,error:!1,data:i})}}).catch(e=>r.set({status:`error`,error:e,data:null})),r}const i=t=>new e.Computed(t);export{r as n,n as r,i as t};
|
package/dist/data.d.ts
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { n as Signal, t as Loader } from "./types-J6ZDxAIC.js";
|
|
2
|
+
import { RpcStub, RpcTarget } from "capnweb";
|
|
3
|
+
|
|
4
|
+
//#region src/data/schema/types.d.ts
|
|
5
|
+
interface Schema {
|
|
6
|
+
[key: string]: ObjectSchema;
|
|
7
|
+
}
|
|
8
|
+
interface ObjectSchema {
|
|
9
|
+
id: IdSchema;
|
|
10
|
+
[key: string]: PropertySchema;
|
|
11
|
+
}
|
|
12
|
+
type PropertySchema = IdSchema | StringSchema | NumberSchema | BooleanSchema;
|
|
13
|
+
interface IdSchema extends PropertyBaseSchema {
|
|
14
|
+
type: "string";
|
|
15
|
+
required: true;
|
|
16
|
+
unique: true;
|
|
17
|
+
mock?: () => string;
|
|
18
|
+
}
|
|
19
|
+
interface StringSchema extends PropertyBaseSchema {
|
|
20
|
+
type: "string";
|
|
21
|
+
mock?: () => string;
|
|
22
|
+
}
|
|
23
|
+
interface NumberSchema extends PropertyBaseSchema {
|
|
24
|
+
type: "number";
|
|
25
|
+
mock?: () => number;
|
|
26
|
+
}
|
|
27
|
+
interface BooleanSchema extends PropertyBaseSchema {
|
|
28
|
+
type: "boolean";
|
|
29
|
+
mock?: () => boolean;
|
|
30
|
+
}
|
|
31
|
+
type PropertyType = "string" | "number" | "boolean";
|
|
32
|
+
interface PropertyBaseSchema {
|
|
33
|
+
type: PropertyType;
|
|
34
|
+
required?: boolean;
|
|
35
|
+
unique?: boolean;
|
|
36
|
+
mock?: () => string | number | boolean;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/data/db/types.d.ts
|
|
40
|
+
type Binding = string | number;
|
|
41
|
+
interface Database {
|
|
42
|
+
exec: (sql: string, ...bind: Binding[]) => void;
|
|
43
|
+
query: <T = unknown>(sql: string, ...bindings: unknown[]) => T[];
|
|
44
|
+
transaction: (callback: (db: Database) => void) => void;
|
|
45
|
+
clientId: string;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/data/sync/types.d.ts
|
|
49
|
+
interface SyncMessage {
|
|
50
|
+
id: string;
|
|
51
|
+
timestamp: string;
|
|
52
|
+
client: string;
|
|
53
|
+
object: string;
|
|
54
|
+
item: string;
|
|
55
|
+
updates: string;
|
|
56
|
+
}
|
|
57
|
+
type MessageQueueSubscriber = (message: SyncMessage) => void | Promise<void>;
|
|
58
|
+
type Subscription = {
|
|
59
|
+
subscriber: MessageQueueSubscriber;
|
|
60
|
+
filter?: (message: SyncMessage) => boolean;
|
|
61
|
+
label?: string;
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/data/sync/message-queue.d.ts
|
|
65
|
+
declare class MessageQueue {
|
|
66
|
+
#private;
|
|
67
|
+
subscribe(subscription: Subscription): () => void;
|
|
68
|
+
add(message: SyncMessage): void;
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/data/collection/collection.d.ts
|
|
72
|
+
declare class Collection<T extends Schema, K$1 extends keyof T> {
|
|
73
|
+
#private;
|
|
74
|
+
constructor({
|
|
75
|
+
name,
|
|
76
|
+
obj,
|
|
77
|
+
clientId,
|
|
78
|
+
messageQueue,
|
|
79
|
+
db
|
|
80
|
+
}: {
|
|
81
|
+
name: string;
|
|
82
|
+
obj: T[K$1];
|
|
83
|
+
clientId: string;
|
|
84
|
+
messageQueue: MessageQueue;
|
|
85
|
+
db?: Database;
|
|
86
|
+
});
|
|
87
|
+
mock(): Item<T[K$1]>;
|
|
88
|
+
get items(): Signal.State<Item<T[K$1]>[]>;
|
|
89
|
+
query({
|
|
90
|
+
filter,
|
|
91
|
+
limit,
|
|
92
|
+
first
|
|
93
|
+
}?: QueryParams<T, K$1>): Signal.Computed<Item<T[K$1]>[]>;
|
|
94
|
+
first(params?: Omit<QueryParams<T, K$1>, "single" | "limit">): Signal.Computed<Item<T[K$1]> | undefined>;
|
|
95
|
+
all(): Signal.Computed<Item<T[K$1]>[]>;
|
|
96
|
+
add(item: Item<T[K$1]>): Item<T[K$1]>;
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/data/collection/remote-collection.d.ts
|
|
100
|
+
declare class RemoteCollection<T extends Schema, K$1 extends keyof T> extends RpcTarget {
|
|
101
|
+
#private;
|
|
102
|
+
constructor(collection: Collection<T, K$1>);
|
|
103
|
+
get items(): Item<T[K$1]>[];
|
|
104
|
+
query(params?: QueryParams<T, K$1>): Item<T[K$1]>[];
|
|
105
|
+
first(params?: Omit<QueryParams<T, K$1>, "single" | "limit">): Item<T[K$1]> | undefined;
|
|
106
|
+
all(): Item<T[K$1]>[];
|
|
107
|
+
add(item: Item<T[K$1]>): void;
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/data/collection/types.d.ts
|
|
111
|
+
type Property<T extends PropertySchema> = T extends {
|
|
112
|
+
type: "string";
|
|
113
|
+
} ? string : T extends {
|
|
114
|
+
type: "number";
|
|
115
|
+
} ? number : T extends {
|
|
116
|
+
type: "boolean";
|
|
117
|
+
} ? boolean : never;
|
|
118
|
+
type Item<T extends ObjectSchema> = { [K in keyof T as T[K] extends {
|
|
119
|
+
required: true;
|
|
120
|
+
} ? K : never]: Property<T[K]> } & { [K in keyof T as T[K] extends {
|
|
121
|
+
required: true;
|
|
122
|
+
} ? never : K]?: Property<T[K]> } & {
|
|
123
|
+
id: string;
|
|
124
|
+
};
|
|
125
|
+
type Collections<T extends Schema> = { [K in keyof T]: Collection<T, K> };
|
|
126
|
+
type RemoteCollections<T extends Schema> = { [K in keyof T]: RemoteCollection<T, K> };
|
|
127
|
+
type QueryParams<T extends Schema, K$1 extends keyof T> = {
|
|
128
|
+
filter?: (item: Item<T[K$1]>) => boolean;
|
|
129
|
+
limit?: number;
|
|
130
|
+
first?: boolean;
|
|
131
|
+
};
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/data/data/data.d.ts
|
|
134
|
+
declare class Data<T extends Schema> extends RpcTarget {
|
|
135
|
+
#private;
|
|
136
|
+
messageQueue: MessageQueue;
|
|
137
|
+
constructor({
|
|
138
|
+
schema,
|
|
139
|
+
db
|
|
140
|
+
}: {
|
|
141
|
+
schema: T;
|
|
142
|
+
db?: Database | false;
|
|
143
|
+
});
|
|
144
|
+
protected get _collections(): Collections<T>;
|
|
145
|
+
protected get _remoteCollections(): RemoteCollections<T>;
|
|
146
|
+
get schema(): T;
|
|
147
|
+
get clientId(): string;
|
|
148
|
+
ingest(message: SyncMessage): void;
|
|
149
|
+
[Symbol.dispose](): Promise<void>;
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/data/data/server-data.d.ts
|
|
153
|
+
declare class ServerData<T extends Schema> extends Data<T> {
|
|
154
|
+
constructor({
|
|
155
|
+
schema,
|
|
156
|
+
db
|
|
157
|
+
}: {
|
|
158
|
+
schema: T;
|
|
159
|
+
db?: Database | false;
|
|
160
|
+
});
|
|
161
|
+
static durableObject<T extends Schema>({
|
|
162
|
+
schema,
|
|
163
|
+
storage
|
|
164
|
+
}: {
|
|
165
|
+
schema: T;
|
|
166
|
+
storage: DurableObjectStorage;
|
|
167
|
+
}): ServerData<T>;
|
|
168
|
+
get collections(): RemoteCollections<T>;
|
|
169
|
+
load(): Promise<string>;
|
|
170
|
+
connect({
|
|
171
|
+
clientId,
|
|
172
|
+
ingest
|
|
173
|
+
}: {
|
|
174
|
+
clientId: string;
|
|
175
|
+
ingest: RpcStub<(message: SyncMessage) => void>;
|
|
176
|
+
}): Promise<() => void>;
|
|
177
|
+
}
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/data/data/client-data.d.ts
|
|
180
|
+
declare class ClientData<T extends Schema> extends Data<T> {
|
|
181
|
+
#private;
|
|
182
|
+
constructor({
|
|
183
|
+
schema,
|
|
184
|
+
db,
|
|
185
|
+
remote
|
|
186
|
+
}: {
|
|
187
|
+
schema: T;
|
|
188
|
+
db?: Database | false;
|
|
189
|
+
remote?: RpcStub<ServerData<T>>;
|
|
190
|
+
});
|
|
191
|
+
static client<T extends Schema>({
|
|
192
|
+
schema,
|
|
193
|
+
remote
|
|
194
|
+
}: {
|
|
195
|
+
schema: T;
|
|
196
|
+
remote?: RpcStub<ServerData<T>> | (() => Promise<RpcStub<ServerData<T>>>);
|
|
197
|
+
}): Promise<ClientData<T>>;
|
|
198
|
+
static signal<T extends Schema>({
|
|
199
|
+
schema,
|
|
200
|
+
remote
|
|
201
|
+
}: {
|
|
202
|
+
schema: T;
|
|
203
|
+
remote?: RpcStub<ServerData<T>>;
|
|
204
|
+
}): Signal.State<Loader<ClientData<T>>>;
|
|
205
|
+
get collections(): Collections<T>;
|
|
206
|
+
load(): Promise<void>;
|
|
207
|
+
[Symbol.dispose](): Promise<void>;
|
|
208
|
+
}
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/data/schema/schema.d.ts
|
|
211
|
+
declare const schema$1: <T extends Schema>(schema: T) => T;
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/data/schema/id.d.ts
|
|
214
|
+
declare const id: IdSchema;
|
|
215
|
+
//#endregion
|
|
216
|
+
export { ClientData, type IdSchema, type Item, type Schema, ServerData, id, schema$1 as schema };
|
package/dist/data.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./signal-store-0zk-69gB.js";import{n as e,r as t,t as n}from"./create-computed-D9oVNGZ6.js";import{RpcStub as r,RpcTarget as i}from"capnweb";import"@sqlite.org/sqlite-wasm";const a=({client:e,object:t,item:n})=>{let{id:r,...i}=n;return{id:crypto.randomUUID(),timestamp:Date.now().toString(),client:e,object:t,item:r,updates:JSON.stringify(i)}};var o=class{#e=new Set;subscribe(e){return this.#e.add(e),()=>{this.#e.delete(e)}}#t(e){console.log(`this.#subscriptions`,this.#e);for(let t of this.#e){if(t.filter&&!t.filter(e))continue;console.log(`✉️`,`Dispatching`,t.label);let n=t.subscriber(e);n instanceof Promise&&n.catch(e=>{console.error(`MessageQueue subscriber failed.`,e)})}}add(e){this.#t(e)}},s=class{#e;#t;#n;#r=t([]);#i;#a;constructor({name:e,obj:t,clientId:n,messageQueue:r,db:i}){this.#a=i,this.#e=n,this.#t=e,this.#n=t,this.#i=r,this.#i.subscribe({subscriber:e=>this.#o(e),filter:e=>e.object===this.#t,label:`Collection: ${this.#t}`})}mock(){return Object.entries(this.#n).reduce((e,[t,n])=>(e[t]=n.mock?n.mock():void 0,e),{})}#o(e){console.log(e);let t={id:e.item,...JSON.parse(e.updates)};this.#r.set(this.#r.get().concat(t))}#s(){if(this.#a){let e=`SELECT * FROM obj_${this.#t}`;this.#r.set(this.#a.query(e))}}get items(){return this.#s(),this.#r}query({filter:e,limit:t,first:r}={}){return n(()=>{let n=this.#r.get().filter(e||(()=>!0));return(t||r)&&(n=n.slice(0,r?1:t)),n})}first(e={}){return e.first=!0,n(()=>{let t=this.query(e).get();return t.length>0?t[0]:void 0})}all(){return this.query()}add(e){let t=a({client:this.#e,object:this.#t,item:e});return this.#i.add(t),e}};const c=({schema:e,clientId:t,messageQueue:n,db:r})=>Object.entries(e).reduce((e,[i,a])=>{let o=i;return e[o]=new s({name:i,obj:a,clientId:t,messageQueue:n,db:r}),e},{}),l=e=>t=>{e.transaction(e=>{if(e.exec(`INSERT INTO __crdt (id, timestamp, client, object, item, updates) VALUES (?, ?, ?, ?, ?, ?);`,t.id,t.timestamp,t.client,t.object,t.item,t.updates),t.updates===`DELETE`)e.exec(`DELETE FROM obj_${t.object} WHERE id = ?;`,t.item);else{let n=[t.item],r=JSON.parse(t.updates),i=[`id`].concat(Object.keys(r));n.push(...Object.values(r));let a=`INSERT INTO obj_${t.object} (${i.join(`, `)}) VALUES (${n.map(()=>`?`).join(`, `)});`;e.exec(a,...n)}})};var u=class extends i{#e;constructor(e){super(),this.#e=e}get items(){return this.#e.items.get()}query(e={}){return this.#e.query(e).get()}first(e={}){return this.#e.first(e).get()}all(){return this.query()}add(e){this.#e.add(e)}};const d=e=>{let t=Object.entries(e).reduce((e,[t,n])=>{let r=t;return e[r]=new u(n),e},{});return console.log(`remoteCollections:`,t),t};var f=class extends i{#e;#t;#n;messageQueue=new o;#r;#i;constructor({schema:e,db:t}){super(),this.#e=e,t?(this.#n=t,this.#t=this.#n.clientId,this.messageQueue.subscribe({subscriber:l(this.#n),label:`Local database (Client ID: ${this.#t})`})):this.#t=crypto.randomUUID(),this.#r=c({schema:this.#e,clientId:this.#t,messageQueue:this.messageQueue,db:this.#n}),this.#i=d(this.#r)}get _collections(){return this.#r}get _remoteCollections(){return this.#i}get schema(){return this.#e}get clientId(){return this.#t}ingest(e){console.log(`📳📳📳`,`Ingest`,e),this.messageQueue.add(e)}async[Symbol.dispose](){console.log(`🗑️🗑️🗑️`,`Data RPC disposing (Client ID: ${this.clientId})`)}};const p=e=>{switch(e){case`string`:return`TEXT`;case`number`:return`INTEGER`;case`boolean`:return`INTEGER`;default:throw Error(`Unsupported type: ${String(e)}`)}},m=e=>{let t=``;for(let[n,r]of Object.entries(e)){let e=Object.entries(r).map(([e,t])=>`${e} ${p(t.type)}`).join(`, `);e&&(t+=`CREATE TABLE IF NOT EXISTS obj_${n} (${e});`)}return t+=`CREATE TABLE IF NOT EXISTS __renku (id TEXT NOT NULL PRIMARY KEY, value TEXT NOT NULL);`,t+=`INSERT INTO __renku (id, value) VALUES ('client_id', '${crypto.randomUUID()}') ON CONFLICT (id) DO NOTHING;`,t+=`CREATE TABLE IF NOT EXISTS __crdt (id TEXT NOT NULL PRIMARY KEY, timestamp TEXT NOT NULL, client TEXT NOT NULL, object TEXT NOT NULL, item TEXT NOT NULL, updates TEXT);`,t},h=({db:e,schema:t})=>{let n=m(t);e.exec(n);let r=e.query(`SELECT value FROM __renku WHERE id = 'client_id' LIMIT 1`);if(!r[0])throw Error(`Client ID not found`);e.clientId=r[0].value};var g=class t extends f{#e;#t;constructor({schema:e,db:t,remote:n}){if(super({schema:e,db:t}),this.#e=n,this.#e){this.#e.connect({clientId:this.clientId,ingest:this.ingest.bind(this)}).then(e=>{console.log(`📳📳📳`,`Remote is connected`,e),this.#t=e}).catch(e=>{console.error(`Remote connect failed:`,e)});let e=this.messageQueue.subscribe({subscriber:async e=>{await this.#e?.ingest(e),console.log(`Send to remote`,e)},filter:e=>e.client===this.clientId,label:`Remote`});this.#e.onRpcBroken(()=>{console.log(`Remote connection broken, unsubscribing ...`),e()})}}static async client({schema:e,remote:n}){return typeof n==`function`&&(n=await n()),new t({schema:e,db:!1,remote:n})}static signal({schema:t,remote:n}){return e(()=>this.client({schema:t,remote:n}))}get collections(){return this._collections}async load(){console.log(`Loading data ...`,this.#e);let e=await this.#e?.load();console.log(`Loaded data:`,e)}async[Symbol.dispose](){console.log(`🗑️ Client Data RPC disposing (CID: ${this.clientId})`),this.#t&&await this.#t()}};const _=e=>{let t={exec:(t,...n)=>e.sql.exec(t,...n),query:(t,...n)=>e.sql.exec(t,...n).toArray(),transaction:n=>e.transactionSync(()=>n(t))};return t};var v=class e extends f{constructor({schema:e,db:t}){super({schema:e,db:t})}static durableObject({schema:t,storage:n}){let r=_(n);return h({db:r,schema:t}),new e({schema:t,db:r})}get collections(){return this._remoteCollections}async load(){return`Test loaded data`}async connect({clientId:e,ingest:t}){console.log(`📳📳📳`,`connect from`,e,t),t.onRpcBroken(()=>{console.log(`📳📳📳`,e,`Ingest RPC broken`)});let n=t.dup();console.log(`Subscribing client`,e);let r=this.messageQueue.subscribe({subscriber:async e=>await n({...e,id:`${e.id}-CONNECT-${crypto.randomUUID()}`}),filter:t=>t.client!==e,label:`Client: ${e}`});return console.log(`Sending test message to client`),console.log(`📳📳📳`,e,`End of connect`),new Promise((e,n)=>{t.onRpcBroken(e=>{r(),n(e)})})}};const y=e=>e,b={type:`string`,required:!0,unique:!0,mock:()=>crypto.randomUUID().toString()};export{g as ClientData,v as ServerData,b as id,y as schema};
|
package/dist/dom.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "./types-BStlw_FH.js";
|
|
2
|
+
import { o as RenkuNode, r as FunctionComponent } from "./types-DA3_gaOB.js";
|
|
3
|
+
import { r as Routes } from "./types-DazdXa4I.js";
|
|
4
|
+
|
|
5
|
+
//#region src/router/Router.d.ts
|
|
6
|
+
declare const Router: FunctionComponent<{
|
|
7
|
+
routes: Routes<any>;
|
|
8
|
+
}>;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/dom/render.d.ts
|
|
11
|
+
declare const render: (element: RenkuNode, domNode: HTMLElement) => void;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Router, type Routes, render };
|
package/dist/dom.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./virtual-from-jsx-BgQUXZ4d.js";import"./signal-store-0zk-69gB.js";import"./effect-hmzj-Jig.js";import{n as t,r as n}from"./update-dom-node-DnDA0pqF.js";import{t as r}from"./get-route-B1JNCPoL.js";import"./fragment-Chv9FEhP.js";import{n as i}from"./jsx-runtime-DvEc5zft.js";const a=async({routes:e})=>{let t=r({request:new Request(window.location.href),routes:e}),n=null;if(!t||t.api)return i(`div`,{children:`Not Found`});if(t.route instanceof Promise)n=await(await t.route).default(t.params);else if(typeof t.route==`function`)n=t.route(t.params);else return i(`div`,{children:`Not Found`});for(let e of t.layouts)e instanceof Promise?n=await(await e).default({children:n}):typeof e==`function`&&(n=await e({children:n}));return n},o=(r,i)=>{let a=e({node:r});i.replaceChildren(),Array.isArray(a)?n({domNode:i,virtualNode:a}):t({domNode:i,virtualNode:a})};export{a as Router,o as render};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./signal-store-0zk-69gB.js";let t=!0;const n=new e.subtle.Watcher(()=>{t&&(t=!1,queueMicrotask(r))});function r(){t=!0;for(let e of n.getPending())e.get();n.watch()}const i=t=>{let r,i=new e.Computed(()=>{typeof r==`function`&&r();let e=t();r=typeof e==`function`?e:void 0});return n.watch(i),i.get(),()=>{n.unwatch(i),typeof r==`function`&&r(),r=void 0}};export{i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>e.children;export{e as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=({request:e,routes:t})=>{let n=new URL(e.url).pathname,r=e.method.toUpperCase(),i=n.split(`/`).filter(Boolean),a=t.layout?[t.layout]:[],o={},s=null;if(i.length===0)return t.index?{layouts:a,route:t.index,params:o,auth:s}:typeof t[`/`]==`object`&&`index`in t[`/`]?(t[`/`].layout&&a.unshift(t[`/`].layout),{layouts:a,route:t[`/`].index,params:o,auth:s}):!1;let c=t;for(let[e,t]of i.entries()){let n=`/${t}`,l=c[n],u=e=>Object.keys(e).find(e=>e.startsWith(`/:`));if(!l){let e=u(c);if(!e&&c[`/`]&&typeof c[`/`]==`object`){let t=c[`/`];l=t[n],typeof t==`object`&&t.layout&&a.unshift(t.layout),l||(e=u(t))}if(e){let n=e.slice(2);o[n]=t,l=c[e]}}if(typeof l==`function`||l instanceof Promise)return{layouts:a,route:l,params:o,auth:s};if(typeof l==`object`){let t=l;if(t.auth&&!s&&(s=t.auth),t.layout&&a.unshift(t.layout),e===i.length-1)if(typeof t.index==`object`&&r in t.index){let e=t.index;if(e[r])return typeof e[r]==`function`?{api:e[r],params:o,auth:s}:{layouts:a,route:e[r],params:o,auth:s}}else if(t.index)return{layouts:a,route:t.index,params:o,auth:s};else{let e=t;if(e[r])return typeof e[r]==`function`?{api:e[r],params:o,auth:s}:{layouts:a,route:e[r],params:o,auth:s}}c=t}}return!1};export{e as t};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import e from"node:fs";import t from"node:os";import n from"node:path";function r(e){return`# @stricli/auto-complete START [${e}]`}var i=`# @stricli/auto-complete END`;async function a(a){let{os:o=t,fs:s=e,path:c=n}=a;if(!a.process.env.SHELL?.includes(`bash`)){a.process.stderr.write(`Skipping bash as shell was not detected.
|
|
2
|
+
`);return}let l=o.homedir(),u=c.join(l,`.bashrc`),d;try{d=(await s.promises.readFile(u)).toString().split(/\n/)}catch{a.process.stderr.write(`Expected to edit ~/.bashrc but file was not found.
|
|
3
|
+
`);return}return{install:async(e,t)=>{let n=r(e),o=d.indexOf(n),c=`__${e}_complete`,l=[n,`${c}() { export COMP_LINE; COMPREPLY=( $(${t} $COMP_LINE) ); return 0; }`,`complete -o default -o nospace -F ${c} ${e}`,i];if(o>=0){let e=d.indexOf(i,o);d.splice(o,e-o+1,...l)}else d.push(...l);await s.promises.writeFile(u,d.join(`
|
|
4
|
+
`)),a.process.stdout.write("Restart bash shell or run `source ~/.bashrc` to load changes.\n")},uninstall:async e=>{let t=r(e),n=d.indexOf(t);if(n>=0){let e=d.indexOf(i,n);d.splice(n,e-n+1)}await s.promises.writeFile(u,d.join(`
|
|
5
|
+
`)),a.process.stdout.write("Restart bash shell or run `source ~/.bashrc` to load changes.\n")}}}async function o(e,t){e.bash&&await(await a(this))?.install(t,e.bash)}async function s(e,t){e.bash&&await(await a(this))?.uninstall(t)}export{o as install,s as uninstall};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
async function e(e){}export{e as default};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var e=`import SwiftUI
|
|
2
|
+
|
|
3
|
+
@main
|
|
4
|
+
struct RenkuApp: App {
|
|
5
|
+
var body: some Scene {
|
|
6
|
+
WindowGroup {
|
|
7
|
+
ContentView()
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
`,t=`import SwiftUI
|
|
12
|
+
|
|
13
|
+
struct ContentView: View {
|
|
14
|
+
var body: some View {
|
|
15
|
+
VStack {
|
|
16
|
+
Image(systemName: "globe")
|
|
17
|
+
.imageScale(.large)
|
|
18
|
+
.foregroundStyle(.tint)
|
|
19
|
+
Text("Hello, world!")
|
|
20
|
+
}
|
|
21
|
+
.padding()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#Preview {
|
|
26
|
+
ContentView()
|
|
27
|
+
}
|
|
28
|
+
`;const n=e=>/^[a-zA-Z0-9_.]+$/.test(e),r=e=>typeof e==`object`&&`toStr`in e,i=(e,t)=>{let a=e=>` `.repeat(t+e),o=`{`,s=(e,t=0)=>{o+=`\n${a(t)}${e}`};for(let[o,c]of Object.entries(e)){let e=``;if(typeof c==`string`||typeof c==`number`)e=typeof c==`string`&&!n(c)?`"${String(c)}"`:String(c);else if(c instanceof Set){let t=Array.from(c);e+=`(
|
|
29
|
+
`;for(let r of t)e+=a(2),e+=n(r)?String(r):`"${String(r)}"`,e+=`,
|
|
30
|
+
`;e+=`${a(1)})`}else Array.isArray(c)?e=i(c.reduce((e,t)=>(e[t.id]=t.props,e),{}),t+1):typeof c==`object`&&(e=r(c)?c.toStr(t+1):i(c,t+1));e!==``&&s(`${o} = ${e};`,1)}return s(`}`),o},a=(e,{path:t})=>{let n={isa:`PBXFileReference`,explicitFileType:`wrapper.application`,includeInIndex:0,path:t,sourceTree:`BUILT_PRODUCTS_DIR`};return{id:e,props:n,toStr:e=>i(n,e)}},o=(e,{path:t})=>{let n={isa:`PBXFileSystemSynchronizedRootGroup`,path:t,sourceTree:`<group>`};return{id:e,props:n,toStr:e=>i(n,e)}},s=e=>{let t={isa:`PBXFrameworksBuildPhase`,buildActionMask:2147483647,files:new Set,runOnlyForDeploymentPostprocessing:0};return{id:e,props:t,toStr:e=>i(t,e)}},c=(e,{children:t,name:n})=>{let r={isa:`PBXGroup`,children:t,name:n,sourceTree:`<group>`};return{id:e,props:r,toStr:e=>i(r,e)}},l=(e,{buildConfigurationList:t,buildPhases:n,buildRules:r,dependencies:a,fileSystemSynchronizedGroups:o,name:s,packageProductDependencies:c,productName:l,productReference:u})=>{let d={isa:`PBXNativeTarget`,buildConfigurationList:t,buildPhases:n,buildRules:r,dependencies:a,fileSystemSynchronizedGroups:o,name:s,packageProductDependencies:c,productName:l,productReference:u,productType:`com.apple.product-type.application`};return{id:e,props:d,toStr:e=>i(d,e)}},u=(e,{attributes:t,buildConfigurationList:n,mainGroup:r,productRefGroup:a,targets:o})=>{let s={isa:`PBXProject`,attributes:t,buildConfigurationList:n,developmentRegion:`en`,hasScannedForEncodings:0,knownRegions:new Set([`en`,`Base`]),mainGroup:r,minimizedProjectReferenceProxies:1,preferredProjectObjectVersion:77,productRefGroup:a,projectDirPath:``,projectRoot:``,targets:o};return{id:e,props:s,toStr:e=>i(s,e)}},d=e=>{let t={isa:`PBXResourcesBuildPhase`,buildActionMask:2147483647,files:new Set,runOnlyForDeploymentPostprocessing:0};return{id:e,props:t,toStr:e=>i(t,e)}},f=e=>{let t={isa:`PBXSourcesBuildPhase`,buildActionMask:2147483647,files:new Set,runOnlyForDeploymentPostprocessing:0};return{id:e,props:t,toStr:e=>i(t,e)}},p=(e=!1)=>({ALWAYS_SEARCH_USER_PATHS:`NO`,ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS:`YES`,CLANG_ANALYZER_NONNULL:`YES`,CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION:`YES_AGGRESSIVE`,CLANG_CXX_LANGUAGE_STANDARD:`gnu++20`,CLANG_ENABLE_MODULES:`YES`,CLANG_ENABLE_OBJC_ARC:`YES`,CLANG_ENABLE_OBJC_WEAK:`YES`,CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING:`YES`,CLANG_WARN_BOOL_CONVERSION:`YES`,CLANG_WARN_COMMA:`YES`,CLANG_WARN_CONSTANT_CONVERSION:`YES`,CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS:`YES`,CLANG_WARN_DIRECT_OBJC_ISA_USAGE:`YES_ERROR`,CLANG_WARN_DOCUMENTATION_COMMENTS:`YES`,CLANG_WARN_EMPTY_BODY:`YES`,CLANG_WARN_ENUM_CONVERSION:`YES`,CLANG_WARN_INFINITE_RECURSION:`YES`,CLANG_WARN_INT_CONVERSION:`YES`,CLANG_WARN_NON_LITERAL_NULL_CONVERSION:`YES`,CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF:`YES`,CLANG_WARN_OBJC_LITERAL_CONVERSION:`YES`,CLANG_WARN_OBJC_ROOT_CLASS:`YES_ERROR`,CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER:`YES`,CLANG_WARN_RANGE_LOOP_ANALYSIS:`YES`,CLANG_WARN_STRICT_PROTOTYPES:`YES`,CLANG_WARN_SUSPICIOUS_MOVE:`YES`,CLANG_WARN_UNGUARDED_AVAILABILITY:`YES_AGGRESSIVE`,CLANG_WARN_UNREACHABLE_CODE:`YES`,CLANG_WARN__DUPLICATE_METHOD_MATCH:`YES`,COPY_PHASE_STRIP:`NO`,DEBUG_INFORMATION_FORMAT:e?`dwarf`:`dwarf-with-dsym`,DEVELOPMENT_TEAM:`G76836P2D4`,ENABLE_NS_ASSERTIONS:e?void 0:`NO`,ENABLE_STRICT_OBJC_MSGSEND:`YES`,ENABLE_TESTABILITY:e?`YES`:void 0,ENABLE_USER_SCRIPT_SANDBOXING:`YES`,GCC_C_LANGUAGE_STANDARD:`gnu17`,GCC_DYNAMIC_NO_PIC:e?`NO`:void 0,GCC_NO_COMMON_BLOCKS:`YES`,GCC_OPTIMIZATION_LEVEL:e?0:void 0,GCC_PREPROCESSOR_DEFINITIONS:e?new Set([`DEBUG=1`,`$(inherited)`]):void 0,GCC_WARN_64_TO_32_BIT_CONVERSION:`YES`,GCC_WARN_ABOUT_RETURN_TYPE:`YES_ERROR`,GCC_WARN_UNDECLARED_SELECTOR:`YES`,GCC_WARN_UNINITIALIZED_AUTOS:`YES_AGGRESSIVE`,GCC_WARN_UNUSED_FUNCTION:`YES`,GCC_WARN_UNUSED_VARIABLE:`YES`,IPHONEOS_DEPLOYMENT_TARGET:`26.0`,LOCALIZATION_PREFERS_STRING_CATALOGS:`YES`,MTL_ENABLE_DEBUG_INFO:e?`INCLUDE_SOURCE`:`NO`,MTL_FAST_MATH:`YES`,ONLY_ACTIVE_ARCH:e?`YES`:void 0,SDKROOT:`iphoneos`,SWIFT_ACTIVE_COMPILATION_CONDITIONS:e?`DEBUG $(inherited)`:void 0,SWIFT_OPTIMIZATION_LEVEL:e?`-Onone`:void 0,SWIFT_COMPILATION_MODE:e?void 0:`wholemodule`,VALIDATE_PRODUCT:e?void 0:`YES`}),m=()=>({ASSETCATALOG_COMPILER_APPICON_NAME:`AppIcon`,ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME:`AccentColor`,CODE_SIGN_STYLE:`Automatic`,CURRENT_PROJECT_VERSION:1,DEVELOPMENT_TEAM:`G76836P2D4`,ENABLE_PREVIEWS:`YES`,GENERATE_INFOPLIST_FILE:`YES`,INFOPLIST_KEY_UIApplicationSceneManifest_Generation:`YES`,INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents:`YES`,INFOPLIST_KEY_UILaunchScreen_Generation:`YES`,INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad:`UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight`,INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone:`UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight`,LD_RUNPATH_SEARCH_PATHS:new Set([`$(inherited)`,`@executable_path/Frameworks`]),MARKETING_VERSION:`1.0`,PRODUCT_BUNDLE_IDENTIFIER:`dev.renku.Renku`,PRODUCT_NAME:`$(TARGET_NAME)`,STRING_CATALOG_GENERATE_SYMBOLS:`YES`,SWIFT_DEFAULT_ACTOR_ISOLATION:`MainActor`,SWIFT_EMIT_LOC_STRINGS:`YES`,SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY:`YES`,SWIFT_VERSION:`5.0`,TARGETED_DEVICE_FAMILY:`1,2`}),h=(e,{name:t,buildSettings:n})=>{let r={isa:`XCBuildConfiguration`,buildSettings:n,name:t};return{id:e,props:r,toStr:e=>i(r,e)}},g=(e,{buildConfigurations:t})=>{let n={isa:`XCConfigurationList`,buildConfigurations:t,defaultConfigurationIsVisible:0,defaultConfigurationName:`Release`};return{id:e,props:n,toStr:e=>i(n,e)}},_=()=>{let e=a(`985D8FC72DF8ACD10087D51B`,{path:`Renku.app`}),t=o(`985D8FC92DF8ACD10087D51B`,{path:`Renku`}),n=s(`985D8FC42DF8ACD10087D51B`),r=c(`985D8FC82DF8ACD10087D51B`,{name:`Products`,children:new Set([e.id])}),_=c(`985D8FBE2DF8ACD10087D51B`,{children:new Set([t.id,r.id])}),v=d(`985D8FC52DF8ACD10087D51B`),y=f(`985D8FC32DF8ACD10087D51B`),b=h(`985D8FD02DF8ACD20087D51B`,{name:`Debug`,buildSettings:p(!0)}),x=h(`985D8FD12DF8ACD20087D51B`,{name:`Release`,buildSettings:p()}),S=h(`985D8FD32DF8ACD20087D51B`,{name:`Debug`,buildSettings:m()}),C=h(`985D8FD42DF8ACD20087D51B`,{name:`Release`,buildSettings:m()}),w=g(`985D8FC22DF8ACD10087D51B`,{buildConfigurations:new Set([b.id,x.id])}),T=g(`985D8FD22DF8ACD20087D51B`,{buildConfigurations:new Set([S.id,C.id])}),E=l(`985D8FC62DF8ACD10087D51B`,{buildConfigurationList:T.id,buildPhases:new Set([y.id,n.id,v.id]),buildRules:new Set,dependencies:new Set,fileSystemSynchronizedGroups:new Set([t.id]),name:`Renku`,packageProductDependencies:new Set,productName:`Renku`,productReference:e.id}),D=u(`985D8FBF2DF8ACD10087D51B`,{attributes:{BuildIndependentTargetsInParallel:1,LastSwiftUpdateCheck:2600,LastUpgradeCheck:2600,TargetAttributes:{"985D8FC62DF8ACD10087D51B":{CreatedOnToolsVersion:`26.0`}}},buildConfigurationList:T.id,mainGroup:_.id,productRefGroup:r.id,targets:new Set([E.id])}),O={archiveVersion:1,classes:{},objectVersion:77,objects:[e,t,n,_,r,E,D,v,y,b,x,S,C,w,T],rootObject:D.id};return{props:O,toStr:()=>{let e=`// !$*UTF8*$!
|
|
31
|
+
`;return e+=i(O,0),e}}},v=async()=>{console.log(`Creating Xcode project ...`);let n=_().toStr();await Bun.write(`./project.pbxproj`,n),await Bun.write(`./Renku/Assets.xcassets/AccentColor.colorset/Contents.json`,JSON.stringify({colors:[{idiom:`universal`}],info:{author:`xcode`,version:1}}),{createPath:!0}),await Bun.write(`./Renku/Assets.xcassets/AppIcon.appiconset/Contents.json`,JSON.stringify({images:[{idiom:`universal`,platform:`ios`,size:`1024x1024`},{appearances:[{appearance:`luminosity`,value:`dark`}],idiom:`universal`,platform:`ios`,size:`1024x1024`},{appearances:[{appearance:`luminosity`,value:`tinted`}],idiom:`universal`,platform:`ios`,size:`1024x1024`}],info:{author:`xcode`,version:1}}),{createPath:!0}),await Bun.write(`./Renku/App.swift`,e,{createPath:!0}),await Bun.write(`./Renku/ContentView.swift`,t,{createPath:!0})};async function y(e){await v()}async function b(e){}export{b as android,y as ios};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
async function e(e){}async function t(e){}export{t as bar,e as foo};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { r as Routes } from "./types-DazdXa4I.js";
|
|
2
|
+
|
|
3
|
+
//#region src/cloudflare/durable-object-handler.d.ts
|
|
4
|
+
declare const durableObjectHandler: ({
|
|
5
|
+
namespace,
|
|
6
|
+
name,
|
|
7
|
+
ws
|
|
8
|
+
}: {
|
|
9
|
+
namespace: keyof Env;
|
|
10
|
+
name: string | ((request: Request) => string | Promise<string>);
|
|
11
|
+
ws?: boolean;
|
|
12
|
+
}) => ((request: Request, env: Env) => Response | Promise<Response>);
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/cloudflare/get-auth-routes.d.ts
|
|
15
|
+
interface AuthOptions {
|
|
16
|
+
rpName: string;
|
|
17
|
+
sessionExpiryInMinutes?: number;
|
|
18
|
+
}
|
|
19
|
+
declare const getAuthRoutes: (options: AuthOptions) => Routes<Env>;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/cloudflare/renku.d.ts
|
|
22
|
+
declare const renku: <Env$1 = unknown, ExecutionContext = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown>({
|
|
23
|
+
routes
|
|
24
|
+
}: {
|
|
25
|
+
routes: Routes<Env$1, ExecutionContext>;
|
|
26
|
+
}) => ExportedHandler<Env$1, QueueHandlerMessage, CfHostMetadata>;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { getAuthRoutes as n, durableObjectHandler as r, renku as t };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import "./types-BStlw_FH.js";
|
|
2
|
+
import { a as LayoutComponent, r as FunctionComponent } from "./types-DA3_gaOB.js";
|
|
3
|
+
import { r as Routes } from "./types-DazdXa4I.js";
|
|
4
|
+
import { n as Signal, t as Loader } from "./types-J6ZDxAIC.js";
|
|
5
|
+
import { t as registerServerFunction } from "./register-server-function-DoOVejlg.js";
|
|
6
|
+
import { RpcStub, RpcStub as RpcStub$1, RpcTarget, RpcTarget as RpcTarget$1 } from "capnweb";
|
|
7
|
+
|
|
8
|
+
//#region src/reactivity/create-computed.d.ts
|
|
9
|
+
declare const createComputed: <T>(fn: () => T) => Signal.Computed<T>;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/reactivity/create-fetched.d.ts
|
|
12
|
+
declare const createFetched: <T>(path: string, fn: (res: Response) => Promise<T> | T) => Signal.State<Loader<T>>;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/reactivity/create-remote-signal.d.ts
|
|
15
|
+
declare const createRemoteSignal: <T>(fn: () => Promise<any>) => Promise<Signal.State<T>>;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/reactivity/remote-signal.d.ts
|
|
18
|
+
declare class RemoteSignal<T extends number | string | undefined> extends RpcTarget$1 {
|
|
19
|
+
#private;
|
|
20
|
+
constructor(initialValues: T);
|
|
21
|
+
get(): T;
|
|
22
|
+
set(value: T): Promise<void>;
|
|
23
|
+
subscribe(callback: RpcStub$1<(value: T) => void>): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/reactivity/create-loader.d.ts
|
|
27
|
+
declare function createLoader<P>(promise: () => Promise<P>): Signal.State<Loader<P>>;
|
|
28
|
+
declare function createLoader<P, R, T extends (res: P) => R | Promise<R>>(promise: () => Promise<P>, transform: T): Signal.State<Loader<R>>;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/reactivity/create-signal.d.ts
|
|
31
|
+
declare const createSignal: <T>(initialValue: T) => Signal.State<T>;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/reactivity/effect.d.ts
|
|
34
|
+
declare const effect: (callback: (() => () => void) | (() => void)) => (() => void);
|
|
35
|
+
//#endregion
|
|
36
|
+
export { type FunctionComponent, type LayoutComponent, RemoteSignal, type Routes, RpcStub, RpcTarget, Signal, createComputed, createFetched, createLoader, createRemoteSignal, createSignal, effect, registerServerFunction };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./signal-store-0zk-69gB.js";import{t}from"./effect-hmzj-Jig.js";import{n,r,t as i}from"./create-computed-D9oVNGZ6.js";import{t as a}from"./register-server-function-DQl0uL7w.js";import{RpcStub as o,RpcStub as s,RpcTarget as c,RpcTarget as l}from"capnweb";const u=(e,t)=>n(()=>fetch(e).then(async e=>await t(e))),d=async e=>{let n=await e(),i=r(await n.get());return n.subscribe(e=>i.set(e)),i.set(await n.get()),t(()=>{n.set(i.get())}),i.set(await n.get()),i};var f=class extends l{#e;#t=new Set;constructor(e){super(),this.#e=e}get(){return this.#e}async set(e){this.#e=e;for(let t of this.#t)try{await t(e)}catch(e){console.error(`Error in subscriber:`,e),this.#t.delete(t)}}async subscribe(e){return this.#t.add(e.dup()),new Promise((t,n)=>{e.onRpcBroken(t=>{this.#t.delete(e),n(t)})})}};export{f as RemoteSignal,o as RpcStub,c as RpcTarget,e as Signal,i as createComputed,u as createFetched,n as createLoader,d as createRemoteSignal,r as createSignal,t as effect,a as registerServerFunction};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { i as JSX } from "./types-DA3_gaOB.js";
|
|
2
|
+
import { t as Fragment } from "./fragment-CpqsWP0m.js";
|
|
3
|
+
|
|
4
|
+
//#region src/jsx/jsx-dev.d.ts
|
|
5
|
+
declare const jsxDEV: (type: JSX.ElementType, props: any, key: string | null | undefined, _isStaticChildren: boolean, _source: {
|
|
6
|
+
fileName: string;
|
|
7
|
+
lineNumber: number;
|
|
8
|
+
columnNumber: number;
|
|
9
|
+
}, _self: unknown | undefined) => JSX.Element;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Fragment, type JSX, jsxDEV };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./fragment-Chv9FEhP.js";const t=(e,t,n,r,i,a)=>({type:e,props:t,key:n});export{e as Fragment,t as jsxDEV};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=(e,t,n)=>({type:e,props:t,key:n}),t=(e,t,n)=>({type:e,props:t,key:n});export{e as n,t};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { i as JSX } from "./types-DA3_gaOB.js";
|
|
2
|
+
import { t as Fragment } from "./fragment-CpqsWP0m.js";
|
|
3
|
+
|
|
4
|
+
//#region src/jsx/jsx.d.ts
|
|
5
|
+
declare const jsx: (type: JSX.ElementType, props: any, key: string | null | undefined) => JSX.Element;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/jsx/jsxs.d.ts
|
|
8
|
+
declare const jsxs: (type: JSX.ElementType, props: any, key: string | null | undefined) => JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { Fragment, type JSX, jsx, jsxs };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./fragment-Chv9FEhP.js";import{n as t,t as n}from"./jsx-runtime-DvEc5zft.js";export{e as Fragment,t as jsx,n as jsxs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{newWebSocketRpcSession as e}from"capnweb";const t=(t,n)=>{console.log(`☎️`,`Registering server function:`,t,n);let r=`/@renku/rpc/${encodeURIComponent(t)}/${encodeURIComponent(n)}`;return(...i)=>{let a=e(r);return console.log(`☎️`,`Calling server function:`,t,n,i),a(...i)}};export{t};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RpcStub, RpcTarget } from "capnweb";
|
|
2
|
+
|
|
3
|
+
//#region src/server/types.d.ts
|
|
4
|
+
|
|
5
|
+
type ServerFunction = (...args: unknown[]) => RpcStub<RpcTarget>;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/server/register-server-function.d.ts
|
|
8
|
+
declare const registerServerFunction: (path: string, name: string) => ServerFunction;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { registerServerFunction as t };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{t as e}from"./virtual-from-jsx-BgQUXZ4d.js";import{n as t}from"./signal-store-0zk-69gB.js";async function*n(e){yield`<!DOCTYPE html>`;for await(let t of e)t[1]&&(yield t[1])}async function*r(t){let n=new Set(t.map(t=>t.then(({index:t,node:n})=>({index:t,virtualNode:e({node:n,asyncComponents:[]})})).catch(e=>({error:e}))));for(;n.size>0;){let e=await Promise.race(n);for(let t of n)t.then(r=>{r===e&&n.delete(t)}).catch(r=>{r===e&&n.delete(t)});`virtualNode`in e&&(yield e)}}async function*i({key:e,val:n,trailingComma:r,output:i}){if(typeof n==`string`||typeof n==`number`){e===`className`&&(e=`class`);let t=typeof n==`number`?String(n):`"${String(n)}"`;return yield i(`${r?`,`:``}"${e}":${t}`,` ${e}="${String(n)}"`),!0}if(n instanceof t.State||n instanceof t.Computed)return yield i(`${r?`,`:``}"${e}":"${String(n.get())}"`,` ${e}="${String(n.get())}"`),!0;if(Array.isArray(n)){let a=n.map(e=>e instanceof t.State||e instanceof t.Computed?String(e.get()):String(e)).join(` `);return yield i(`${r?`,`:``}"${e}":"${a}"`,` ${e}="${a}"`),!0}}const a=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]);async function*o({virtualNode:e,asyncVirtualNodes:t,leadingComma:n=!1,rscBuffer:r=[]}){let s=(e,t)=>(e&&r.push(e),[e,t]),c=(e,t)=>s(e,null);if(Array.isArray(e))for(let i of e)yield*o({virtualNode:i,asyncVirtualNodes:t,leadingComma:n,rscBuffer:r}),n=!0;else if(e?.type===`element`){yield s(`${n?`,`:``}["E","${e.value}",${e.key?`"${e.key}"`:`null`},{`,`<${e.value}`);let c=!0;for(let[t,n]of Object.entries(e.props))t!==`children`&&(yield*i({key:t,val:n,trailingComma:!c,output:s}))&&(c=!1);if(yield s(null,a.has(e.value)?` />`:`>`),e.children.length>0){let n=!0;yield s(`${c?``:`,`}"children":[`,null);for(let i of e.children)(yield*o({virtualNode:i,asyncVirtualNodes:t,leadingComma:!n,rscBuffer:r}))&&(n=!1);e.value!==`html`&&(yield s(`]`,null))}if(e.value===`body`){if(r.length>0){let e=r.join(``);r.length=0,yield[null,`<script>(self.__RSC||=[]).push(\`${e}}]]}]\`);<\/script>`]}yield[`}]]}]`,null];for await(let e of t){let n=[];yield[`
|
|
2
|
+
`,`<template data-id="async-template-${e.index}">`],yield*o({virtualNode:e.virtualNode,asyncVirtualNodes:t,leadingComma:!1,rscBuffer:n}),yield[null,`</template>`],yield[null,`<script>(self.__RSC||=[]).push(\`${n.join(``)}\`);<\/script>`],yield[null,`<script>
|
|
3
|
+
(() => {
|
|
4
|
+
const placeholder = document.querySelector(\`${`template[data-id="async-placeholder-${e.index}"]`}\`);
|
|
5
|
+
// console.log("placeholder",placeholder);
|
|
6
|
+
if(placeholder) {
|
|
7
|
+
const template = document.querySelector(\`${`template[data-id="async-template-${e.index}"]`}\`);
|
|
8
|
+
// console.log("template",template);
|
|
9
|
+
// const clone = template.content.cloneNode(true);
|
|
10
|
+
template && placeholder.parentNode.replaceChild(template.content, placeholder);
|
|
11
|
+
}
|
|
12
|
+
})();
|
|
13
|
+
<\/script>`]}}return a.has(e.value)?yield s(`}]`,null):e.value!==`html`&&e.value!==`body`?yield s(`}]`,`</${e.value}>`):yield s(null,`</${e.value}>`),!0}else if(e?.type===`text`||e?.type===`signal`){let t=e?.type===`signal`?String(e.value.get()):e.value;return yield s(`${n?`,`:``}"${t.replaceAll(`"`,`\\\\"`).replaceAll(`
|
|
14
|
+
`,`\\\\n`)}"`,t),!0}else if(e?.type===`async`)return yield s(`${n?`,`:``}["A",${e.key?`"${e.key}"`:`null`},${e.index}]`,`<template data-id="async-placeholder-${e.index}"></template>`),!0;else if(e?.type===`client`){yield s(`${n?`,`:``}["C",${e.key?`"${e.key}"`:`null`},"${e.path}","${e.name}",{`,`<!-- CLIENT -->`);let t=!0;for(let[n,r]of Object.entries(e.props))n!==`children`&&(yield*i({key:n,val:r,trailingComma:!t,output:c}))&&(t=!1);return yield s(`}]`,null),!0}else if(e?.type===`effect`)return yield*o({virtualNode:e.value,asyncVirtualNodes:t,leadingComma:n,rscBuffer:r})}const s=t=>{let n=[];return o({virtualNode:e({node:t,asyncComponents:n}),asyncVirtualNodes:r(n)})};async function*c(e){for await(let t of e)t[0]&&(yield t[0])}export{s as n,n as r,c as t};
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { t as ClientComponent } from "./types-DA3_gaOB.js";
|
|
2
|
+
import { t as registerServerFunction } from "./register-server-function-DoOVejlg.js";
|
|
3
|
+
|
|
4
|
+
//#region src/server/register-client-reference.d.ts
|
|
5
|
+
declare const registerClientReference: (_fn: () => void, path: string, name: string) => ClientComponent;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { registerClientReference, registerServerFunction };
|
package/dist/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./register-server-function-DQl0uL7w.js";const t=(e,t,n)=>({type:`client`,path:t,name:n});export{t as registerClientReference,e as registerServerFunction};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Signal as e}from"signal-polyfill";const t={stack:void 0,index:0,set(e){this.stack=e,this.index=0},add(e){this.stack&&this.stack.push(e)},get(t){let n=this.stack?.[this.index];return n||(n=new e.State(t),this.add(n)),this.index++,n}};export{e as n,t};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": ["ESNext", "DOM"],
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"module": "Preserve",
|
|
6
|
+
"moduleDetection": "force",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"jsxImportSource": "renku",
|
|
9
|
+
"allowJs": false,
|
|
10
|
+
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
|
|
16
|
+
"strict": true,
|
|
17
|
+
"skipLibCheck": true,
|
|
18
|
+
"noFallthroughCasesInSwitch": true,
|
|
19
|
+
"noUncheckedIndexedAccess": true,
|
|
20
|
+
"noImplicitOverride": true,
|
|
21
|
+
|
|
22
|
+
"noUnusedLocals": true,
|
|
23
|
+
"noUnusedParameters": true,
|
|
24
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
25
|
+
|
|
26
|
+
"declaration": true,
|
|
27
|
+
"emitDeclarationOnly": true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/auth/types.d.ts
|
|
2
|
+
interface AuthContext {
|
|
3
|
+
sessionId: string | null;
|
|
4
|
+
userId: string | null;
|
|
5
|
+
}
|
|
6
|
+
type AuthFn = (props: {
|
|
7
|
+
authContext: AuthContext;
|
|
8
|
+
request: Request;
|
|
9
|
+
}) => Response | boolean;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { AuthFn as n, AuthContext as t };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region src/jsx/types.d.ts
|
|
2
|
+
declare namespace JSX {
|
|
3
|
+
type ElementType = (keyof IntrinsicElements & string) | FunctionComponent<any> | ClientComponent | FragmentComponent;
|
|
4
|
+
interface IntrinsicElements {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
a: {
|
|
7
|
+
href: "/page1" | "/page2" | `https://${string}`;
|
|
8
|
+
children?: RenkuNode | RenkuNode[];
|
|
9
|
+
class?: string | string[];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
type Element<T extends ElementType = ElementType> = {
|
|
13
|
+
type: T;
|
|
14
|
+
props: any;
|
|
15
|
+
key: string | null | undefined;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
type RenkuNode = null | number | string | JSX.Element | RenkuNode[];
|
|
19
|
+
type ClientComponent = {
|
|
20
|
+
type: "client";
|
|
21
|
+
path: string;
|
|
22
|
+
name: string;
|
|
23
|
+
};
|
|
24
|
+
type FunctionComponent<T = Record<string, any>> = (props: T & {
|
|
25
|
+
children?: RenkuNode | RenkuNode[];
|
|
26
|
+
key?: string | null | undefined;
|
|
27
|
+
}) => RenkuNode | Promise<RenkuNode>;
|
|
28
|
+
type LayoutComponent = FunctionComponent<{
|
|
29
|
+
_renku: {
|
|
30
|
+
styles: string[];
|
|
31
|
+
modules: string[];
|
|
32
|
+
};
|
|
33
|
+
}>;
|
|
34
|
+
type FragmentComponent = (props: {
|
|
35
|
+
children: JSX.Element[];
|
|
36
|
+
}) => JSX.Element[];
|
|
37
|
+
//#endregion
|
|
38
|
+
export { LayoutComponent as a, JSX as i, FragmentComponent as n, RenkuNode as o, FunctionComponent as r, ClientComponent as t };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { n as AuthFn } from "./types-BStlw_FH.js";
|
|
2
|
+
import { r as FunctionComponent } from "./types-DA3_gaOB.js";
|
|
3
|
+
|
|
4
|
+
//#region src/router/types.d.ts
|
|
5
|
+
type Path = `/${string}`;
|
|
6
|
+
type ExtractPathParams<T extends string> = T extends `${string}:${infer Param}/${infer Rest}` ? Param | ExtractPathParams<`/${Rest}`> : T extends `${string}:${infer Param}` ? Param : never;
|
|
7
|
+
type ParamsObj<Keys extends string> = [Keys] extends [never] ? Record<string, never> : { [K in Keys]: string };
|
|
8
|
+
type PathToParams<T extends string> = ParamsObj<ExtractPathParams<T>>;
|
|
9
|
+
type AugmentedRequest<Params extends ParamsBase> = Request & {
|
|
10
|
+
params: Partial<Params>;
|
|
11
|
+
};
|
|
12
|
+
type ParamsBase = Record<string, string>;
|
|
13
|
+
type ApiHandler<Params extends ParamsBase, Env = unknown, ExecutionContext = unknown> = (request: AugmentedRequest<Params>, env: Env, ctx: ExecutionContext) => Response | Promise<Response>;
|
|
14
|
+
type ApiRoute<Params extends ParamsBase, Env = unknown, ExecutionContext = unknown> = {
|
|
15
|
+
GET?: ApiHandler<Params, Env, ExecutionContext> | RouteModule<Params>;
|
|
16
|
+
POST?: ApiHandler<Params, Env, ExecutionContext>;
|
|
17
|
+
};
|
|
18
|
+
type RouteModule<Params> = Promise<{
|
|
19
|
+
default: FunctionComponent<Params>;
|
|
20
|
+
}> | {
|
|
21
|
+
default: FunctionComponent<Params>;
|
|
22
|
+
};
|
|
23
|
+
type Route<Params extends ParamsBase = any, Env = unknown, ExecutionContext = unknown> = FunctionComponent<Params> | RouteModule<Params> | ApiRoute<Params, Env, ExecutionContext>;
|
|
24
|
+
interface Routes<Env = unknown, ExecutionContext = unknown> {
|
|
25
|
+
auth?: AuthFn;
|
|
26
|
+
layout?: Route<any, Env, ExecutionContext>;
|
|
27
|
+
index?: Route<any, Env, ExecutionContext>;
|
|
28
|
+
[path: Path]: Routes<Env, ExecutionContext> | Route<PathToParams<typeof path>, Env, ExecutionContext>;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { PathToParams as n, Routes as r, AugmentedRequest as t };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Signal } from "signal-polyfill";
|
|
2
|
+
|
|
3
|
+
//#region src/reactivity/types.d.ts
|
|
4
|
+
type Loader<T> = {
|
|
5
|
+
status: "loading";
|
|
6
|
+
error: false;
|
|
7
|
+
data: null;
|
|
8
|
+
} | {
|
|
9
|
+
status: "success";
|
|
10
|
+
error: false;
|
|
11
|
+
data: T;
|
|
12
|
+
} | {
|
|
13
|
+
status: "error";
|
|
14
|
+
error: any;
|
|
15
|
+
data: null;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Signal as n, Loader as t };
|
package/dist/ui.d.ts
ADDED
package/dist/ui.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./fragment-Chv9FEhP.js";import{n as e}from"./jsx-runtime-DvEc5zft.js";const t=({children:t})=>e(`div`,{class:[`bg-red-500`],children:t});export{t as Badge};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./virtual-from-jsx-BgQUXZ4d.js";import{n as t}from"./signal-store-0zk-69gB.js";import{t as n}from"./effect-hmzj-Jig.js";function r({domNode:e,virtualNode:t,replace:n=!1}){let r=[];for(let i of t){let t=a({domNode:e,virtualNode:i,replace:n});n=!1,r.push(t)}return r}const i=({element:e,key:r,val:i})=>{typeof i==`function`?r.startsWith(`on`)&&e.addEventListener(r.slice(2),i):typeof i==`string`||typeof i==`number`?(r===`className`&&(r=`class`),e.setAttribute(r,String(i))):i instanceof t.State||i instanceof t.Computed?n(()=>{e.setAttribute(r,String(i.get()))}):Array.isArray(i)?n(()=>{let n=i.map(e=>e instanceof t.State||e instanceof t.Computed?String(e.get()):String(e)).join(` `);e.setAttribute(r,n)}):typeof i==`boolean`&&(i?e.setAttribute(r,``):e.removeAttribute(r))};function a({domNode:t,virtualNode:s,replace:c=!1}){if(!s)return null;let l=[`svg`,`path`,`circle`];if(s.type===`element`){let e=l.includes(s.value)?document.createElementNS(`http://www.w3.org/2000/svg`,s.value):document.createElement(s.value);if(s.domNode=e,s.props.ref){let e=s.props.ref;console.log(`has ref`,e.get()),e.set(s.domNode),console.log(`assigned ref`,s.domNode),console.log(`has ref`,e.get())}for(let[t,n]of Object.entries(s.props))t!==`children`&&t!==`key`&&t!==`ref`&&i({element:e,key:t,val:n});if(s.children)for(let t of s.children)a({domNode:e,virtualNode:t});return t===document.documentElement?document.documentElement.replaceWith(e):c&&t.parentElement?t.parentElement.replaceChild(e,t):t.appendChild(e),e}if(s.type===`async`){let n=document.createElement(`template`);return s.domNode=n,t.appendChild(n),s.promise?.then(t=>{let i=e({node:t});Array.isArray(i)?r({domNode:n,virtualNode:i,replace:!0}):a({domNode:n,virtualNode:i,replace:!0})}),n}if(s.type===`text`){let e=document.createTextNode(s.value);return s.domNode=e,t.appendChild(e),e}if(s.type===`signal`){let e=s.value,r=document.createTextNode(``);return s.domNode=r,n(()=>{r.textContent=String(e.get())}),t.appendChild(r),r}if(s.type===`effect`){let e=s.value,n=null,r=null,i=e=>{Array.isArray(e)?console.warn(`EFFECT virtual node is array`):n?(n=o({domNode:n,newVirtualNode:e,oldVirtualNode:r}),r=e):(n=a({domNode:t,virtualNode:e,replace:c}),r=e,e=null)};s.addCallback(i),i(e)}return null}const o=({domNode:e,newVirtualNode:t,oldVirtualNode:n})=>{if(t&&n)if(t.type===n.type)if(t.type===`element`&&n.type===`element`)if(t.value===n.value){let r=e,s=n.props?Object.keys(n.props).filter(e=>!(e in t.props)):[];s.length&&s.map(e=>r.removeAttribute(e));for(let[e,a]of Object.entries(t.props))if(e!==`children`&&e!==`key`)if(n.props&&e in n.props){let t=n.props[e];typeof a==`function`||(Array.isArray(a)&&Array.isArray(t)?JSON.stringify(a)!==JSON.stringify(t)&&i({element:r,key:e,val:a}):n.props[e]!==a&&i({element:r,key:e,val:a}))}else i({element:r,key:e,val:a});if(t.children.length){let e=0;for(let i=0;i<t.children.length;i++){let s=t.children[i];if(s){let t=n.children?n.children[i-e]:void 0;if(t?.domNode)if(s.key===t.key)s.domNode=t.domNode,o({domNode:t.domNode,newVirtualNode:s,oldVirtualNode:t});else{let i=n.children.findIndex(e=>e?.key===s.key),a=i>-1?n.children[i]:null;a?.domNode&&(r.moveBefore(a.domNode,t.domNode),s.domNode=a.domNode,e++,o({domNode:a.domNode,newVirtualNode:s,oldVirtualNode:a}),n.children.splice(i,1))}else s.type!==`effect`&&a({domNode:r,virtualNode:s});n.children[i-e]=null}}if(n.children.length+e>t.children.length)for(let i=t.children.length;i<n.children.length+e;i++){let t=n.children[i-e]?.domNode;t&&r.removeChild(t)}}else n.children?.length&&r.replaceChildren()}else console.log(`Different node types`),n.domNode&&a({domNode:n.domNode,virtualNode:t,replace:!0});else t.type===`text`&&n.type===`text`&&t.value!==n.value&&(t.domNode=n.domNode,t.domNode.nodeValue=t.value);else console.warn(`Different node types`),n.domNode&&a({domNode:n.domNode,virtualNode:t,replace:!0});else console.warn(`Old or new node is null`);return e};export{a as n,r,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./signal-store-0zk-69gB.js";import{t as n}from"./effect-hmzj-Jig.js";const r=e=>!Array.isArray(e)&&typeof e==`object`&&!!e&&typeof e.type==`function`&&e.type.name===`Fragment`,i=({node:e,asyncComponents:t=[],clientComponents:n=[]})=>{let a=[];if(Array.isArray(e))for(let r of e)a.push(...i({node:r,asyncComponents:t,clientComponents:n}));else if(e)if(r(e)){let r=e.type(e.props);a.push(...i({node:r,asyncComponents:t,clientComponents:n}))}else{let r=o({node:e,asyncComponents:t,clientComponents:n});Array.isArray(r)?a.push(...r):a.push(r)}return a},a=({fn:e,key:r,props:i,asyncComponents:a,clientComponents:s})=>{let c=null,l=null,u=e=>{c=e,l&&l(e)},d=[];return n(()=>{t.set(d);let n=e(i);if(n instanceof Promise){let e=s.length+a.length+1;a.push(new Promise(t=>{n.then(n=>{t({index:e,node:n})})})),u({type:`async`,key:r,promise:n,index:e})}else u(o({node:n,asyncComponents:a,clientComponents:s}))}),{type:`effect`,value:c,addCallback:e=>{l=e}}},o=({node:t,asyncComponents:n=[],clientComponents:o=[]})=>{if(Array.isArray(t))return i({node:t,asyncComponents:n,clientComponents:o});if(t===null)return null;if(typeof t==`string`||typeof t==`number`)return{type:`text`,value:String(t)};if(t instanceof e.Computed||t instanceof e.State)return{type:`signal`,value:t};if(typeof t==`object`&&typeof t.type==`function`&&!r(t)&&typeof t.type==`function`)return a({fn:t.type,key:t.key,props:t.props,asyncComponents:n,clientComponents:o});if(typeof t==`object`&&typeof t.type==`object`&&t.type.type===`client`)return o.push({path:t.type.path,name:t.type.name}),{type:`client`,key:t.key,props:t.props,path:t.type.path,name:t.type.name};if(typeof t==`object`&&typeof t.type==`string`){let e=i({node:t.props.children,asyncComponents:n,clientComponents:o});return{type:`element`,key:t.key,value:t.type,props:t.props,children:e}}return console.warn(`Unhandled node type`,t),null};export{a as n,o as t};
|
package/dist/vite.d.ts
ADDED
package/dist/vite.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from"node:fs";import t from"node:path";const n=new TextEncoder,r=async e=>{let t=n.encode(e),r=await crypto.subtle.digest(`SHA-1`,t);return Array.from(new Uint8Array(r)).map(e=>e.toString(16).padStart(2,`0`)).join(``)},i=`virtual:renku`,a=`\0${i}`;async function o(){let n,o=new Set,s=new Map,c=new Set,l=null,u=new Map;return{name:`renku`,sharedDuringBuild:!0,configResolved(e){n=e},resolveId(e){if(e===i)return a},load(e){if(e===a)return`export const clientEntry = ${JSON.stringify(l)}`},async transform(e,i){let a=this.environment.mode===`dev`,c=this.environment.name===`client`,l=e=>{let t=this.parse(e).body.filter(e=>e.type===`ExportNamedDeclaration`),n=[];for(let e of t)if(e.declaration?.type===`VariableDeclaration`)for(let t of e.declaration.declarations)t.id.type===`Identifier`&&n.push(t.id.name);return n};if(!c&&e.startsWith(`"use client"`)){let r=n.base.concat(t.relative(n.root,i));o.add(r);let a=l(e),s=`import { registerClientReference } from "renku/server";
|
|
2
|
+
`,c=u.get(r);for(let e of a)s=s.concat(`export const ${e} = await registerClientReference(
|
|
3
|
+
() => {},
|
|
4
|
+
"${c||r}",
|
|
5
|
+
"${e}"
|
|
6
|
+
);\n`);return{code:s}}else if(e.startsWith(`"use server"`)){let t=l(e),n=`import { registerServerFunction } from "renku";
|
|
7
|
+
`,o=a?i:await r(i);s.set(o,i);for(let e of t)c&&(n=n.concat(`export const ${e} = await registerServerFunction("${o}", "${e}");\n`));return c?{code:n}:void 0}},async buildStart(){if(n.mode===`production`){if(this.environment.name===`client`)for(let e of o)this.emitFile({type:`chunk`,id:e,preserveSignature:`exports-only`});else if(this.environment.name===`ssr`)for(let[e,n]of s){let r=t.join(`functions`,e);this.emitFile({type:`chunk`,id:n,name:r})}}},generateBundle(e,r){if(this.environment.name===`ssr`){for(let[e,i]of Object.entries(r))if(i.type===`asset`){let e=t.resolve(n.root,this.environment.config.build.outDir,i.fileName);c.add(e)}}else if(this.environment.name===`client`){for(let[e,i]of Object.entries(r))if(i.type===`chunk`&&i.isEntry&&((i.name===`main`||l===null)&&(l=n.base.concat(i.fileName)),i.facadeModuleId)){let e=n.base.concat(t.relative(n.root,i.facadeModuleId));o.has(e)&&u.set(e,n.base.concat(i.fileName))}}},config(){return{builder:{buildApp:async n=>{let r=[`ssr`,`client`,`ssr`],i=!1;for(let e of r)if(e in n.environments&&n.environments[e]){let t=n.environments[e];t.config.build.write=i,await n.build(t),i=!0}for(let n of c){let r=n.replace(`/ssr/`,`/client/`);console.log(`Moving asset from`,n,`to`,r);let i=t.dirname(r);e.mkdirSync(i,{recursive:!0}),e.renameSync(n,r)}}},build:{manifest:!0},resolve:{alias:{"/@renku/client":import.meta.resolve(`renku/client`)}},environments:{client:{build:{rollupOptions:{input:{main:`renku/client`}}}}}}}}}export{o as default};
|
package/package.json
CHANGED
|
@@ -1,10 +1,112 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "renku",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"private": false,
|
|
3
|
+
"description": "Renku",
|
|
4
|
+
"version": "0.0.3",
|
|
6
5
|
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"homepage": "https://renku.dev",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/renkudev/renku/issues"
|
|
10
|
+
},
|
|
11
|
+
"author": {
|
|
12
|
+
"name": "Benedikt Müller",
|
|
13
|
+
"email": "ben@renku.dev",
|
|
14
|
+
"url": "http://bndkt.com"
|
|
15
|
+
},
|
|
16
|
+
"repository": "github:renkudev/renku",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"package.json",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "tsdown --watch",
|
|
24
|
+
"lint": "oxlint",
|
|
25
|
+
"tsc": "tsc",
|
|
26
|
+
"build": "PREVIEW=true tsdown",
|
|
27
|
+
"pub": "bun run build && bun publish --dry-run",
|
|
28
|
+
"generate-types": "wrangler -c src/cloudflare/wrangler.jsonc types src/cloudflare/worker-configuration.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"imports": {
|
|
31
|
+
"#renku/jsx-dev-runtime": "./src/jsx/jsx-dev-runtime.ts",
|
|
32
|
+
"#renku/jsx-runtime": "./src/jsx/jsx-runtime.ts"
|
|
33
|
+
},
|
|
34
|
+
"bin": {
|
|
35
|
+
"renku": "./dist/cli.js",
|
|
36
|
+
"__renku_bash_complete": "./dist/bash-complete.js"
|
|
37
|
+
},
|
|
38
|
+
"exports": {
|
|
39
|
+
".": {
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
41
|
+
"import": "./dist/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./auth": {
|
|
44
|
+
"types": "./dist/auth.d.ts",
|
|
45
|
+
"import": "./dist/auth.js"
|
|
46
|
+
},
|
|
47
|
+
"./bun": {
|
|
48
|
+
"types": "./dist/bun.d.ts",
|
|
49
|
+
"import": "./dist/bun.js"
|
|
50
|
+
},
|
|
51
|
+
"./client": {
|
|
52
|
+
"types": "./dist/client.d.ts",
|
|
53
|
+
"import": "./dist/client.js"
|
|
54
|
+
},
|
|
55
|
+
"./cloudflare": {
|
|
56
|
+
"types": "./dist/cloudflare.d.ts",
|
|
57
|
+
"import": "./dist/cloudflare.js"
|
|
58
|
+
},
|
|
59
|
+
"./cloudflare/worker": {
|
|
60
|
+
"types": "./dist/cloudflare.worker.d.ts",
|
|
61
|
+
"import": "./dist/cloudflare.worker.js"
|
|
62
|
+
},
|
|
63
|
+
"./data": {
|
|
64
|
+
"types": "./dist/data.d.ts",
|
|
65
|
+
"import": "./dist/data.js"
|
|
66
|
+
},
|
|
67
|
+
"./dom": {
|
|
68
|
+
"types": "./dist/dom.d.ts",
|
|
69
|
+
"import": "./dist/dom.js"
|
|
70
|
+
},
|
|
71
|
+
"./jsx-dev-runtime": {
|
|
72
|
+
"types": "./dist/jsx-dev-runtime.d.ts",
|
|
73
|
+
"import": "./dist/jsx-dev-runtime.js"
|
|
74
|
+
},
|
|
75
|
+
"./jsx-runtime": {
|
|
76
|
+
"types": "./dist/jsx-runtime.d.ts",
|
|
77
|
+
"import": "./dist/jsx-runtime.js"
|
|
78
|
+
},
|
|
79
|
+
"./ui": {
|
|
80
|
+
"types": "./dist/ui.d.ts",
|
|
81
|
+
"import": "./dist/ui.js"
|
|
82
|
+
},
|
|
83
|
+
"./server": {
|
|
84
|
+
"types": "./dist/server.d.ts",
|
|
85
|
+
"import": "./dist/server.js"
|
|
86
|
+
},
|
|
87
|
+
"./server-functions": {
|
|
88
|
+
"types": "./dist/server-functions.d.ts",
|
|
89
|
+
"import": "./dist/server-functions.js"
|
|
90
|
+
},
|
|
91
|
+
"./tsconfig": "./tsconfig.base.json",
|
|
92
|
+
"./vite": {
|
|
93
|
+
"types": "./dist/vite.d.ts",
|
|
94
|
+
"import": "./dist/vite.js"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"dependencies": {
|
|
98
|
+
"@sqlite.org/sqlite-wasm": "3.51.1-build1",
|
|
99
|
+
"@standard-schema/spec": "1.0.0",
|
|
100
|
+
"capnweb": "0.2.0",
|
|
101
|
+
"signal-polyfill": "0.2.2"
|
|
102
|
+
},
|
|
7
103
|
"devDependencies": {
|
|
8
|
-
"@
|
|
104
|
+
"@stricli/auto-complete": "1.2.4",
|
|
105
|
+
"@stricli/core": "1.2.4",
|
|
106
|
+
"@types/bun": "1.3.3",
|
|
107
|
+
"tsdown": "0.17.0-beta.4",
|
|
108
|
+
"typescript": "5.9.3",
|
|
109
|
+
"vite": "7.2.4",
|
|
110
|
+
"wrangler": "4.51.0"
|
|
9
111
|
}
|
|
10
112
|
}
|
package/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
console.log("Hello via Bun!");
|