acrylblends 0.11.0 → 1.0.0
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 +131 -53
- package/dist/index.d.ts +29 -2
- package/dist/index.js +450 -69
- package/dist/index.js.map +1 -1
- package/docs/framework/README.md +5 -3
- package/docs/framework/agents/index.md +1 -1
- package/docs/framework/api/acryl.md +5 -17
- package/docs/framework/api/context.md +12 -61
- package/docs/framework/api/presets.md +1 -1
- package/docs/framework/api/request.md +3 -3
- package/docs/framework/api/summary.md +1 -1
- package/docs/framework/concepts/web-standard.md +6 -16
- package/docs/framework/cordis/acryl-in-a-cordis-app.md +13 -8
- package/docs/framework/cordis/migration-from-0-4.md +1 -1
- package/docs/framework/cordis/migration-to-1-0.md +45 -0
- package/docs/framework/cordis/node-server.md +2 -2
- package/docs/framework/getting-started/basic.md +15 -10
- package/docs/framework/getting-started/desktop.md +1 -1
- package/docs/framework/getting-started/other-runtimes.md +10 -14
- package/docs/framework/guides/create-acrylblends.md +4 -2
- package/docs/framework/guides/data.md +1 -1
- package/docs/framework/guides/faq.md +1 -1
- package/docs/framework/guides/jsx-dom.md +1 -1
- package/docs/framework/guides/production.md +43 -0
- package/docs/framework/guides/rpc.md +3 -11
- package/docs/framework/helpers/adapter.md +13 -43
- package/docs/framework/helpers/conninfo.md +1 -36
- package/docs/framework/helpers/streaming.md +1 -1
- package/docs/framework/helpers/websocket.md +4 -11
- package/docs/framework/middleware/builtin/basic-auth.md +1 -1
- package/docs/framework/middleware/builtin/cache.md +2 -22
- package/docs/framework/middleware/builtin/compress.md +1 -1
- package/docs/framework/middleware/builtin/context-storage.md +10 -14
- package/docs/framework/middleware/builtin/cors.md +1 -2
- package/docs/framework/middleware/builtin/ip-restriction.md +1 -1
- package/docs/framework/middleware/builtin/jsx-renderer.md +1 -1
- package/docs/framework/middleware/builtin/logger.md +1 -1
- package/docs/framework/middleware/builtin/loopback-only.md +1 -1
- package/docs/framework/middleware/builtin/mount.md +1 -1
- package/docs/framework/middleware/builtin/request-id.md +13 -20
- package/docs/framework/middleware/builtin/timing.md +1 -2
- package/lib/cordis/door.d.ts +5 -0
- package/lib/cordis/door.js +8 -4
- package/lib/cordis/inspect.js +1 -1
- package/lib/cordis/router-http.js +1 -1
- package/lib/cordis/router.d.ts +1 -2
- package/lib/cordis/router.js +2 -3
- package/lib/cordis/state.js +1 -1
- package/lib/door/host.js +1 -1
- package/lib/drivers.d.ts +66 -0
- package/lib/drivers.js +16 -0
- package/lib/index.d.ts +1 -2
- package/lib/index.js +1 -2
- package/lib/{snapshot-text-yaWlezbd.js → snapshot-text-DmE0YfeZ.js} +2 -2
- package/lib/{src-DNzw0Qsb.js → src-2Z4mJg0x.js} +0 -1
- package/package.json +5 -121
- package/plugins/acryl-door/src/index.ts +8 -0
- package/plugins/acryl-router/src/index.ts +0 -1
- package/plugins/agent-panel/drivers.ts +1 -16
- package/plugins/agent-panel/index.ts +1 -1
- package/plugins/agent-panel/registry.ts +16 -0
- package/plugins/driver-acp/README.md +53 -0
- package/plugins/driver-acp/chat.ts +258 -0
- package/plugins/driver-acp/connection.ts +239 -0
- package/plugins/driver-acp/index.ts +65 -0
- package/plugins/driver-acp/plugin.json +12 -0
- package/plugins/driver-acp/provenance.json +20 -0
- package/plugins/driver-pty/index.ts +1 -0
- package/shared/library-history.json +464 -0
- package/docs/framework/getting-started/aws-lambda.md +0 -115
- package/docs/framework/getting-started/cloudflare-pages.md +0 -53
- package/docs/framework/getting-started/cloudflare-workers.md +0 -67
- package/docs/framework/getting-started/lambda-edge.md +0 -41
- package/docs/framework/getting-started/netlify.md +0 -25
- package/docs/framework/getting-started/service-worker.md +0 -33
- package/docs/framework/getting-started/vercel.md +0 -28
- package/lib/aws-lambda.d.ts +0 -324
- package/lib/aws-lambda.js +0 -357
- package/lib/cloudflare-pages.d.ts +0 -58
- package/lib/cloudflare-pages.js +0 -78
- package/lib/cloudflare-workers.d.ts +0 -21
- package/lib/cloudflare-workers.js +0 -80
- package/lib/deprecated-BP4fPt38.js +0 -10
- package/lib/deprecated-CTy4N7ng.d.ts +0 -12
- package/lib/lambda-edge.d.ts +0 -92
- package/lib/lambda-edge.js +0 -105
- package/lib/netlify.d.ts +0 -29
- package/lib/netlify.js +0 -30
- package/lib/service-worker.d.ts +0 -48
- package/lib/service-worker.js +0 -38
- package/lib/vercel.d.ts +0 -10
- package/lib/vercel.js +0 -9
- package/plugins/acryl-router/src/deprecated.ts +0 -15
package/lib/lambda-edge.d.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { r as GetConnInfo } from "./types-Dv_nV2cv.js";
|
|
2
|
-
import { t as Acryl } from "./app-D8riatvv.js";
|
|
3
|
-
|
|
4
|
-
//#region ../../plugins/acryl-router/src/core/adapter/lambda-edge/handler.d.ts
|
|
5
|
-
interface CloudFrontHeader {
|
|
6
|
-
key: string;
|
|
7
|
-
value: string;
|
|
8
|
-
}
|
|
9
|
-
interface CloudFrontHeaders {
|
|
10
|
-
[name: string]: CloudFrontHeader[];
|
|
11
|
-
}
|
|
12
|
-
interface CloudFrontCustomOrigin {
|
|
13
|
-
customHeaders: CloudFrontHeaders;
|
|
14
|
-
domainName: string;
|
|
15
|
-
keepaliveTimeout: number;
|
|
16
|
-
path: string;
|
|
17
|
-
port: number;
|
|
18
|
-
protocol: string;
|
|
19
|
-
readTimeout: number;
|
|
20
|
-
sslProtocols: string[];
|
|
21
|
-
}
|
|
22
|
-
interface CloudFrontS3Origin {
|
|
23
|
-
authMethod: 'origin-access-identity' | 'none';
|
|
24
|
-
customHeaders: CloudFrontHeaders;
|
|
25
|
-
domainName: string;
|
|
26
|
-
path: string;
|
|
27
|
-
region: string;
|
|
28
|
-
}
|
|
29
|
-
type CloudFrontOrigin = {
|
|
30
|
-
s3: CloudFrontS3Origin;
|
|
31
|
-
custom?: never;
|
|
32
|
-
} | {
|
|
33
|
-
custom: CloudFrontCustomOrigin;
|
|
34
|
-
s3?: never;
|
|
35
|
-
};
|
|
36
|
-
interface CloudFrontRequest {
|
|
37
|
-
clientIp: string;
|
|
38
|
-
headers: CloudFrontHeaders;
|
|
39
|
-
method: string;
|
|
40
|
-
querystring: string;
|
|
41
|
-
uri: string;
|
|
42
|
-
body?: {
|
|
43
|
-
inputTruncated: boolean;
|
|
44
|
-
action: string;
|
|
45
|
-
encoding: string;
|
|
46
|
-
data: string;
|
|
47
|
-
};
|
|
48
|
-
origin?: CloudFrontOrigin;
|
|
49
|
-
}
|
|
50
|
-
interface CloudFrontResponse {
|
|
51
|
-
headers: CloudFrontHeaders;
|
|
52
|
-
status: string;
|
|
53
|
-
statusDescription?: string;
|
|
54
|
-
}
|
|
55
|
-
interface CloudFrontConfig {
|
|
56
|
-
distributionDomainName: string;
|
|
57
|
-
distributionId: string;
|
|
58
|
-
eventType: string;
|
|
59
|
-
requestId: string;
|
|
60
|
-
}
|
|
61
|
-
interface CloudFrontEvent {
|
|
62
|
-
cf: {
|
|
63
|
-
config: CloudFrontConfig;
|
|
64
|
-
request: CloudFrontRequest;
|
|
65
|
-
response?: CloudFrontResponse;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
interface CloudFrontEdgeEvent {
|
|
69
|
-
Records: CloudFrontEvent[];
|
|
70
|
-
}
|
|
71
|
-
type CloudFrontContext = {};
|
|
72
|
-
interface Callback {
|
|
73
|
-
(err: Error | null, result?: CloudFrontRequest | CloudFrontResult): void;
|
|
74
|
-
}
|
|
75
|
-
interface CloudFrontResult {
|
|
76
|
-
status: string;
|
|
77
|
-
statusDescription?: string;
|
|
78
|
-
headers?: {
|
|
79
|
-
[header: string]: {
|
|
80
|
-
key: string;
|
|
81
|
-
value: string;
|
|
82
|
-
}[];
|
|
83
|
-
};
|
|
84
|
-
body?: string;
|
|
85
|
-
bodyEncoding?: 'text' | 'base64';
|
|
86
|
-
}
|
|
87
|
-
declare const handle: (app: Acryl<any>) => ((event: CloudFrontEdgeEvent, context?: CloudFrontContext, callback?: Callback) => Promise<CloudFrontResult | CloudFrontRequest>);
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region ../../plugins/acryl-router/src/core/adapter/lambda-edge/conninfo.d.ts
|
|
90
|
-
declare const getConnInfo: GetConnInfo;
|
|
91
|
-
//#endregion
|
|
92
|
-
export { type Callback, type CloudFrontConfig, type CloudFrontEdgeEvent, type CloudFrontRequest, type CloudFrontResponse, getConnInfo, handle };
|
package/lib/lambda-edge.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { decodeBase64, encodeBase64 } from "./utils/encode.js";
|
|
2
|
-
import crypto from "node:crypto";
|
|
3
|
-
//#region ../../plugins/acryl-router/src/core/adapter/lambda-edge/handler.ts
|
|
4
|
-
globalThis.crypto ??= crypto;
|
|
5
|
-
/**
|
|
6
|
-
* Accepts events from 'Lambda@Edge' event
|
|
7
|
-
* https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html
|
|
8
|
-
*/
|
|
9
|
-
const convertHeaders = (headers) => {
|
|
10
|
-
const cfHeaders = {};
|
|
11
|
-
headers.forEach((value, key) => {
|
|
12
|
-
cfHeaders[key.toLowerCase()] = [...cfHeaders[key.toLowerCase()] || [], {
|
|
13
|
-
key: key.toLowerCase(),
|
|
14
|
-
value
|
|
15
|
-
}];
|
|
16
|
-
});
|
|
17
|
-
return cfHeaders;
|
|
18
|
-
};
|
|
19
|
-
const handle = (app) => {
|
|
20
|
-
return async (event, ...args) => {
|
|
21
|
-
const [context, callback] = args;
|
|
22
|
-
let callbackError = null;
|
|
23
|
-
let callbackResult;
|
|
24
|
-
const cf = getCloudFrontRecord(event);
|
|
25
|
-
const res = await app.fetch(createRequest(cf), {
|
|
26
|
-
event,
|
|
27
|
-
context,
|
|
28
|
-
callback: (err, result) => {
|
|
29
|
-
if (!callbackError && !callbackResult) {
|
|
30
|
-
callbackError = err;
|
|
31
|
-
callbackResult = result;
|
|
32
|
-
}
|
|
33
|
-
callback?.(err, result);
|
|
34
|
-
},
|
|
35
|
-
config: cf.config,
|
|
36
|
-
request: cf.request,
|
|
37
|
-
response: cf.response
|
|
38
|
-
});
|
|
39
|
-
if (callbackError) throw callbackError;
|
|
40
|
-
return callbackResult ?? createResult(res);
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
const createResult = async (res) => {
|
|
44
|
-
const contentEncoding = res.headers.get("content-encoding");
|
|
45
|
-
const isBase64Encoded = isContentTypeBinary(res.headers.get("content-type") || "") || !!contentEncoding && !/^identity$/i.test(contentEncoding);
|
|
46
|
-
const body = isBase64Encoded ? encodeBase64(await res.arrayBuffer()) : await res.text();
|
|
47
|
-
return {
|
|
48
|
-
status: res.status.toString(),
|
|
49
|
-
headers: convertHeaders(res.headers),
|
|
50
|
-
body,
|
|
51
|
-
...isBase64Encoded && { bodyEncoding: "base64" }
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Reads the CloudFront record out of a Lambda@Edge event.
|
|
56
|
-
*
|
|
57
|
-
* The event is supplied by the runtime, so a malformed one means the function
|
|
58
|
-
* was invoked with something other than a Lambda@Edge event. Fail with a
|
|
59
|
-
* message naming the adapter and the missing field, rather than letting an
|
|
60
|
-
* unattributable property access error escape.
|
|
61
|
-
*/
|
|
62
|
-
const getCloudFrontRecord = (event) => {
|
|
63
|
-
const cf = event?.Records?.[0]?.cf;
|
|
64
|
-
if (!cf?.request) throw new TypeError("Unable to map the CloudFront event to a Request: expected `Records[0].cf.request` in the Lambda@Edge event.");
|
|
65
|
-
return cf;
|
|
66
|
-
};
|
|
67
|
-
const createRequest = (cf) => {
|
|
68
|
-
const request = cf.request;
|
|
69
|
-
const queryString = request.querystring;
|
|
70
|
-
const urlPath = `https://${request.headers?.host?.[0]?.value || cf.config?.distributionDomainName}${request.uri}`;
|
|
71
|
-
const url = queryString ? `${urlPath}?${queryString}` : urlPath;
|
|
72
|
-
const headers = new Headers();
|
|
73
|
-
Object.entries(request.headers ?? {}).forEach(([k, v]) => {
|
|
74
|
-
v.forEach((header) => headers.append(k, header.value));
|
|
75
|
-
});
|
|
76
|
-
const requestBody = request.body;
|
|
77
|
-
const method = request.method;
|
|
78
|
-
const rawBody = createBody(method, requestBody);
|
|
79
|
-
let body = rawBody;
|
|
80
|
-
if (rawBody !== void 0) {
|
|
81
|
-
const bytes = typeof rawBody === "string" ? new TextEncoder().encode(rawBody) : rawBody;
|
|
82
|
-
body = bytes;
|
|
83
|
-
headers.set("content-length", bytes.length.toString());
|
|
84
|
-
}
|
|
85
|
-
return new Request(url, {
|
|
86
|
-
headers,
|
|
87
|
-
method,
|
|
88
|
-
body
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
const createBody = (method, requestBody) => {
|
|
92
|
-
if (!requestBody || !requestBody.data) return;
|
|
93
|
-
if (method === "GET" || method === "HEAD") return;
|
|
94
|
-
if (requestBody.encoding === "base64") return decodeBase64(requestBody.data);
|
|
95
|
-
return requestBody.data;
|
|
96
|
-
};
|
|
97
|
-
const isContentTypeBinary = (contentType) => {
|
|
98
|
-
if (/^application\/vnd\.(?:apple\.installer|mozilla\.xul)\+xml\s*(?:;|$)/i.test(contentType)) return true;
|
|
99
|
-
return !/^text\/(?:plain|html|css|javascript|csv)|(?:\/|\+)(?:json|xml)\s*(?:;|$)/i.test(contentType);
|
|
100
|
-
};
|
|
101
|
-
//#endregion
|
|
102
|
-
//#region ../../plugins/acryl-router/src/core/adapter/lambda-edge/conninfo.ts
|
|
103
|
-
const getConnInfo = (c) => ({ remote: { address: c.env.event.Records[0].cf.request.clientIp } });
|
|
104
|
-
//#endregion
|
|
105
|
-
export { getConnInfo, handle };
|
package/lib/netlify.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { r as GetConnInfo } from "./types-Dv_nV2cv.js";
|
|
2
|
-
import { t as Acryl } from "./app-D8riatvv.js";
|
|
3
|
-
|
|
4
|
-
//#region ../../plugins/acryl-router/src/core/adapter/netlify/handler.d.ts
|
|
5
|
-
declare const handle: (app: Acryl<any, any>) => ((req: Request, context: any) => Response | Promise<Response>);
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region ../../plugins/acryl-router/src/core/adapter/netlify/conninfo.d.ts
|
|
8
|
-
/**
|
|
9
|
-
* Get connection information from Netlify
|
|
10
|
-
* @param c - Context
|
|
11
|
-
* @returns Connection information including remote address
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* import { Acryl } from 'acrylblends'
|
|
15
|
-
* import { handle, getConnInfo } from 'acrylblends/netlify'
|
|
16
|
-
*
|
|
17
|
-
* const app = new Acryl()
|
|
18
|
-
*
|
|
19
|
-
* app.get('/', (c) => {
|
|
20
|
-
* const info = getConnInfo(c)
|
|
21
|
-
* return c.text(`Your IP: ${info.remote.address}`)
|
|
22
|
-
* })
|
|
23
|
-
*
|
|
24
|
-
* export default handle(app)
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
declare const getConnInfo: GetConnInfo;
|
|
28
|
-
//#endregion
|
|
29
|
-
export { getConnInfo, handle };
|
package/lib/netlify.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
//#region ../../plugins/acryl-router/src/core/adapter/netlify/handler.ts
|
|
2
|
-
const handle = (app) => {
|
|
3
|
-
return (req, context) => {
|
|
4
|
-
return app.fetch(req, { context });
|
|
5
|
-
};
|
|
6
|
-
};
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region ../../plugins/acryl-router/src/core/adapter/netlify/conninfo.ts
|
|
9
|
-
/**
|
|
10
|
-
* Get connection information from Netlify
|
|
11
|
-
* @param c - Context
|
|
12
|
-
* @returns Connection information including remote address
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* import { Acryl } from 'acrylblends'
|
|
16
|
-
* import { handle, getConnInfo } from 'acrylblends/netlify'
|
|
17
|
-
*
|
|
18
|
-
* const app = new Acryl()
|
|
19
|
-
*
|
|
20
|
-
* app.get('/', (c) => {
|
|
21
|
-
* const info = getConnInfo(c)
|
|
22
|
-
* return c.text(`Your IP: ${info.remote.address}`)
|
|
23
|
-
* })
|
|
24
|
-
*
|
|
25
|
-
* export default handle(app)
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
const getConnInfo = (c) => ({ remote: { address: c.env.context?.ip } });
|
|
29
|
-
//#endregion
|
|
30
|
-
export { getConnInfo, handle };
|
package/lib/service-worker.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Y as Schema, v as Env } from "./context-DS3fYyG-.js";
|
|
2
|
-
import { t as Acryl } from "./app-D8riatvv.js";
|
|
3
|
-
|
|
4
|
-
//#region ../../plugins/acryl-router/src/core/adapter/service-worker/types.d.ts
|
|
5
|
-
interface ExtendableEvent extends Event {
|
|
6
|
-
waitUntil(f: Promise<any>): void;
|
|
7
|
-
}
|
|
8
|
-
interface FetchEvent extends ExtendableEvent {
|
|
9
|
-
readonly clientId: string;
|
|
10
|
-
readonly handled: Promise<void>;
|
|
11
|
-
readonly preloadResponse: Promise<any>;
|
|
12
|
-
readonly request: Request;
|
|
13
|
-
readonly resultingClientId: string;
|
|
14
|
-
respondWith(r: Response | PromiseLike<Response>): void;
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region ../../plugins/acryl-router/src/core/adapter/service-worker/handler.d.ts
|
|
18
|
-
type Handler = (evt: FetchEvent) => void;
|
|
19
|
-
type HandleOptions = {
|
|
20
|
-
fetch?: typeof fetch;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Adapter for Service Worker
|
|
24
|
-
*/
|
|
25
|
-
declare const handle: <E extends Env, S extends Schema, BasePath extends string>(app: Acryl<E, S, BasePath>, opts?: HandleOptions) => Handler;
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region ../../plugins/acryl-router/src/core/adapter/service-worker/index.d.ts
|
|
28
|
-
/**
|
|
29
|
-
* Registers a Acryl app to handle fetch events in a service worker.
|
|
30
|
-
* This sets up `addEventListener('fetch', handle(app, options))` for the provided app.
|
|
31
|
-
*
|
|
32
|
-
* @param app - The Acryl application instance
|
|
33
|
-
* @param options - Options for handling requests (fetch defaults to undefined)
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* import { Acryl } from 'acrylblends'
|
|
37
|
-
* import { fire } from 'acrylblends/service-worker'
|
|
38
|
-
*
|
|
39
|
-
* const app = new Acryl()
|
|
40
|
-
*
|
|
41
|
-
* app.get('/', (c) => c.text('Hi'))
|
|
42
|
-
*
|
|
43
|
-
* fire(app)
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
declare const fire: <E extends Env, S extends Schema, BasePath extends string>(app: Acryl<E, S, BasePath>, options?: HandleOptions) => void;
|
|
47
|
-
//#endregion
|
|
48
|
-
export { fire, handle };
|
package/lib/service-worker.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
//#region ../../plugins/acryl-router/src/core/adapter/service-worker/handler.ts
|
|
2
|
-
/**
|
|
3
|
-
* Adapter for Service Worker
|
|
4
|
-
*/
|
|
5
|
-
const handle = (app, opts = { fetch: globalThis.fetch.bind(globalThis) }) => {
|
|
6
|
-
return (evt) => {
|
|
7
|
-
evt.respondWith((async () => {
|
|
8
|
-
const res = await app.fetch(evt.request, {}, evt);
|
|
9
|
-
if (opts.fetch && res.status === 404) return await opts.fetch(evt.request);
|
|
10
|
-
return res;
|
|
11
|
-
})());
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region ../../plugins/acryl-router/src/core/adapter/service-worker/index.ts
|
|
16
|
-
/**
|
|
17
|
-
* Registers a Acryl app to handle fetch events in a service worker.
|
|
18
|
-
* This sets up `addEventListener('fetch', handle(app, options))` for the provided app.
|
|
19
|
-
*
|
|
20
|
-
* @param app - The Acryl application instance
|
|
21
|
-
* @param options - Options for handling requests (fetch defaults to undefined)
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* import { Acryl } from 'acrylblends'
|
|
25
|
-
* import { fire } from 'acrylblends/service-worker'
|
|
26
|
-
*
|
|
27
|
-
* const app = new Acryl()
|
|
28
|
-
*
|
|
29
|
-
* app.get('/', (c) => c.text('Hi'))
|
|
30
|
-
*
|
|
31
|
-
* fire(app)
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
const fire = (app, options) => {
|
|
35
|
-
addEventListener("fetch", handle(app, options));
|
|
36
|
-
};
|
|
37
|
-
//#endregion
|
|
38
|
-
export { fire, handle };
|
package/lib/vercel.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { r as GetConnInfo } from "./types-Dv_nV2cv.js";
|
|
2
|
-
import { t as Acryl } from "./app-D8riatvv.js";
|
|
3
|
-
|
|
4
|
-
//#region ../../plugins/acryl-router/src/core/adapter/vercel/handler.d.ts
|
|
5
|
-
declare const handle: (app: Acryl<any, any, any>) => (req: Request) => Response | Promise<Response>;
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region ../../plugins/acryl-router/src/core/adapter/vercel/conninfo.d.ts
|
|
8
|
-
declare const getConnInfo: GetConnInfo;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { getConnInfo, handle };
|
package/lib/vercel.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
//#region ../../plugins/acryl-router/src/core/adapter/vercel/handler.ts
|
|
2
|
-
const handle = (app) => (req) => {
|
|
3
|
-
return app.fetch(req);
|
|
4
|
-
};
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region ../../plugins/acryl-router/src/core/adapter/vercel/conninfo.ts
|
|
7
|
-
const getConnInfo = (c) => ({ remote: { address: c.req.header("x-real-ip") } });
|
|
8
|
-
//#endregion
|
|
9
|
-
export { getConnInfo, handle };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The 0.4 names, kept for one release so code written against them keeps working: `App` is now `Acryl` and `AppRequest` is now `AcrylRequest`,
|
|
3
|
-
* the upstream names with the project renamed. Not part of the ported core; both the plugin's root and the public package's root export these.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { Acryl } from './core/app.ts'
|
|
7
|
-
import type { AcrylRequest } from './core/request.ts'
|
|
8
|
-
import type { BlankEnv, BlankSchema, Env, Input, Schema } from './core/types.ts'
|
|
9
|
-
|
|
10
|
-
/** @deprecated Use `Acryl` (`new Acryl()`); `App` is the 0.4 name and goes away in the next release. */
|
|
11
|
-
export const App = Acryl
|
|
12
|
-
/** @deprecated Use `Acryl`; `App` is the 0.4 name and goes away in the next release. */
|
|
13
|
-
export type App<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = '/'> = Acryl<E, S, BasePath>
|
|
14
|
-
/** @deprecated Use `AcrylRequest`; `AppRequest` is the 0.4 name and goes away in the next release. */
|
|
15
|
-
export type AppRequest<P extends string = '/', I extends Input['out'] = {}> = AcrylRequest<P, I>
|