unplugin-cloudflare-tunnel 0.0.0-alpha-1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.mts +50 -0
- package/dist/api.mjs +59 -0
- package/dist/{esbuild.d.ts → esbuild.d.mts} +1 -1
- package/dist/{esbuild.js → esbuild.mjs} +6 -1
- package/dist/{farm.d.ts → farm.d.mts} +1 -1
- package/dist/{farm.js → farm.mjs} +6 -1
- package/dist/{index-BjNI6nQt.d.ts → index.d.mts} +45 -35
- package/dist/{src-BC4MyCER.js → index.mjs} +393 -104
- package/dist/{rolldown.d.ts → rolldown.d.mts} +1 -1
- package/dist/{rolldown.js → rolldown.mjs} +6 -1
- package/dist/{rollup.d.ts → rollup.d.mts} +1 -1
- package/dist/{rollup.js → rollup.mjs} +6 -1
- package/dist/{rspack.d.ts → rspack.d.mts} +1 -1
- package/dist/{rspack.js → rspack.mjs} +6 -1
- package/dist/schemas-CwcXCIyR.mjs +941 -0
- package/dist/{vite.d.ts → vite.d.mts} +1 -1
- package/dist/{vite.js → vite.mjs} +6 -1
- package/dist/{webpack.d.ts → webpack.d.mts} +1 -1
- package/dist/{webpack.js → webpack.mjs} +6 -1
- package/package.json +48 -44
- package/dist/api.d.ts +0 -1
- package/dist/api.js +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -3
- /package/dist/{astro.d.ts → astro.d.mts} +0 -0
- /package/dist/{astro.js → astro.mjs} +0 -0
- /package/dist/{virtual.d.ts → virtual.d.mts} +0 -0
package/dist/api.d.mts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
|
|
3
|
+
//#region src/api.d.ts
|
|
4
|
+
declare const CloudflareErrorSchema: z.ZodMiniObject<{
|
|
5
|
+
code: z.ZodMiniNumber<number>;
|
|
6
|
+
message: z.ZodMiniString<string>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
declare const CloudflareApiResponseSchema: z.ZodMiniObject<{
|
|
9
|
+
success: z.ZodMiniBoolean<boolean>;
|
|
10
|
+
errors: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
11
|
+
code: z.ZodMiniNumber<number>;
|
|
12
|
+
message: z.ZodMiniString<string>;
|
|
13
|
+
}, z.core.$strip>>>;
|
|
14
|
+
messages: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
15
|
+
result: z.ZodMiniUnknown;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
declare const AccountSchema: z.ZodMiniObject<{
|
|
18
|
+
id: z.ZodMiniString<string>;
|
|
19
|
+
name: z.ZodMiniString<string>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
declare const ZoneSchema: z.ZodMiniObject<{
|
|
22
|
+
id: z.ZodMiniString<string>;
|
|
23
|
+
name: z.ZodMiniString<string>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
declare const TunnelSchema: z.ZodMiniObject<{
|
|
26
|
+
id: z.ZodMiniString<string>;
|
|
27
|
+
name: z.ZodMiniString<string>;
|
|
28
|
+
account_tag: z.ZodMiniString<string>;
|
|
29
|
+
created_at: z.ZodMiniString<string>;
|
|
30
|
+
connections: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnknown>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
declare const DNSRecordSchema: z.ZodMiniObject<{
|
|
33
|
+
id: z.ZodMiniString<string>;
|
|
34
|
+
type: z.ZodMiniString<string>;
|
|
35
|
+
name: z.ZodMiniString<string>;
|
|
36
|
+
content: z.ZodMiniString<string>;
|
|
37
|
+
proxied: z.ZodMiniBoolean<boolean>;
|
|
38
|
+
comment: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
declare function normalizeAddress(address: string | {
|
|
41
|
+
address?: string;
|
|
42
|
+
port?: number;
|
|
43
|
+
} | null | undefined): {
|
|
44
|
+
host: string;
|
|
45
|
+
port?: number;
|
|
46
|
+
};
|
|
47
|
+
declare function ensureCloudflaredBinary(binPath: string): Promise<void>;
|
|
48
|
+
declare function getLocalTarget(host: string, port: number): string;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { AccountSchema, CloudflareApiResponseSchema, CloudflareErrorSchema, DNSRecordSchema, TunnelSchema, ZoneSchema, ensureCloudflaredBinary, getLocalTarget, normalizeAddress };
|
package/dist/api.mjs
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { a as number, c as string, i as nullish, l as unknown, n as array, o as object, r as boolean, s as optional } from "./schemas-CwcXCIyR.mjs";
|
|
2
|
+
import NodeFS from "node:fs/promises";
|
|
3
|
+
import { install } from "cloudflared";
|
|
4
|
+
|
|
5
|
+
//#region src/api.ts
|
|
6
|
+
const CloudflareErrorSchema = object({
|
|
7
|
+
code: number(),
|
|
8
|
+
message: string()
|
|
9
|
+
});
|
|
10
|
+
const CloudflareApiResponseSchema = object({
|
|
11
|
+
success: boolean(),
|
|
12
|
+
errors: optional(array(CloudflareErrorSchema)),
|
|
13
|
+
messages: optional(array(string())),
|
|
14
|
+
result: unknown()
|
|
15
|
+
});
|
|
16
|
+
const AccountSchema = object({
|
|
17
|
+
id: string(),
|
|
18
|
+
name: string()
|
|
19
|
+
});
|
|
20
|
+
const ZoneSchema = object({
|
|
21
|
+
id: string(),
|
|
22
|
+
name: string()
|
|
23
|
+
});
|
|
24
|
+
const TunnelSchema = object({
|
|
25
|
+
id: string(),
|
|
26
|
+
name: string(),
|
|
27
|
+
account_tag: string(),
|
|
28
|
+
created_at: string(),
|
|
29
|
+
connections: optional(array(unknown()))
|
|
30
|
+
});
|
|
31
|
+
const DNSRecordSchema = object({
|
|
32
|
+
id: string(),
|
|
33
|
+
type: string(),
|
|
34
|
+
name: string(),
|
|
35
|
+
content: string(),
|
|
36
|
+
proxied: boolean(),
|
|
37
|
+
comment: nullish(string())
|
|
38
|
+
});
|
|
39
|
+
function normalizeAddress(address) {
|
|
40
|
+
if (address && typeof address === "object") return {
|
|
41
|
+
host: "address" in address && address.address ? address.address : "localhost",
|
|
42
|
+
port: "port" in address && typeof address.port === "number" ? address.port : void 0
|
|
43
|
+
};
|
|
44
|
+
return { host: "localhost" };
|
|
45
|
+
}
|
|
46
|
+
async function ensureCloudflaredBinary(binPath) {
|
|
47
|
+
try {
|
|
48
|
+
await NodeFS.access(binPath);
|
|
49
|
+
} catch {
|
|
50
|
+
console.log("[unplugin-cloudflare-tunnel] Installing cloudflared binary...");
|
|
51
|
+
await install(binPath);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function getLocalTarget(host, port) {
|
|
55
|
+
return `http://${host.includes(":") ? `[${host}]` : host}:${port}`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
export { AccountSchema, CloudflareApiResponseSchema, CloudflareErrorSchema, DNSRecordSchema, TunnelSchema, ZoneSchema, ensureCloudflaredBinary, getLocalTarget, normalizeAddress };
|
|
@@ -1,40 +1,50 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
1
|
import { UnpluginInstance } from "unplugin";
|
|
2
|
+
import * as z from "zod/mini";
|
|
3
3
|
|
|
4
4
|
//#region src/index.d.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview Cloudflare Tunnel Unplugin
|
|
7
|
+
*
|
|
8
|
+
* A cross-bundler plugin that automatically creates and manages
|
|
9
|
+
* Cloudflare tunnels for local development, providing instant HTTPS access
|
|
10
|
+
* to your local dev server from anywhere on the internet.
|
|
11
|
+
*
|
|
12
|
+
* @author Cloudflare Tunnel Plugin Contributors
|
|
13
|
+
* @version 1.0.0
|
|
14
|
+
* @license MIT
|
|
15
|
+
*/
|
|
16
|
+
declare const CloudflareApiResponseSchema: z.ZodMiniObject<{
|
|
17
|
+
success: z.ZodMiniBoolean<boolean>;
|
|
18
|
+
errors: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
19
|
+
code: z.ZodMiniNumber<number>;
|
|
20
|
+
message: z.ZodMiniString<string>;
|
|
21
|
+
}, z.core.$strip>>>;
|
|
22
|
+
messages: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
23
|
+
result: z.ZodMiniUnknown;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
declare const AccountSchema: z.ZodMiniObject<{
|
|
26
|
+
id: z.ZodMiniString<string>;
|
|
27
|
+
name: z.ZodMiniString<string>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
declare const ZoneSchema: z.ZodMiniObject<{
|
|
30
|
+
id: z.ZodMiniString<string>;
|
|
31
|
+
name: z.ZodMiniString<string>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
declare const TunnelSchema: z.ZodMiniObject<{
|
|
34
|
+
id: z.ZodMiniString<string>;
|
|
35
|
+
name: z.ZodMiniString<string>;
|
|
36
|
+
account_tag: z.ZodMiniString<string>;
|
|
37
|
+
created_at: z.ZodMiniString<string>;
|
|
38
|
+
connections: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnknown>>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
declare const DNSRecordSchema: z.ZodMiniObject<{
|
|
41
|
+
id: z.ZodMiniString<string>;
|
|
42
|
+
type: z.ZodMiniString<string>;
|
|
43
|
+
name: z.ZodMiniString<string>;
|
|
44
|
+
content: z.ZodMiniString<string>;
|
|
45
|
+
proxied: z.ZodMiniBoolean<boolean>;
|
|
46
|
+
comment: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
47
|
+
}, z.core.$strip>;
|
|
38
48
|
type CloudflareApiResponse<T = unknown> = z.infer<typeof CloudflareApiResponseSchema> & {
|
|
39
49
|
result: T;
|
|
40
50
|
};
|
|
@@ -154,4 +164,4 @@ interface QuickTunnelOptions extends BaseTunnelOptions {}
|
|
|
154
164
|
type CloudflareTunnelOptions = NamedTunnelOptions | QuickTunnelOptions;
|
|
155
165
|
declare const CloudflareTunnel: UnpluginInstance<CloudflareTunnelOptions | undefined, false>;
|
|
156
166
|
//#endregion
|
|
157
|
-
export {
|
|
167
|
+
export { Account, CloudflareApiResponse, CloudflareTunnel, CloudflareTunnel as default, CloudflareTunnelOptions, DNSRecord, Tunnel, Zone };
|