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 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,4 +1,4 @@
1
- import { r as CloudflareTunnel } from "./index-BjNI6nQt.js";
1
+ import { CloudflareTunnel } from "./index.mjs";
2
2
 
3
3
  //#region src/esbuild.d.ts
4
4
 
@@ -1,7 +1,12 @@
1
- import { t as CloudflareTunnel } from "./src-BC4MyCER.js";
1
+ import { CloudflareTunnel } from "./index.mjs";
2
2
 
3
3
  //#region src/esbuild.ts
4
4
  /**
5
+ * This entry file is for esbuild plugin.
6
+ *
7
+ * @module
8
+ */
9
+ /**
5
10
  * Esbuild plugin
6
11
  *
7
12
  * @example
@@ -1,4 +1,4 @@
1
- import { r as CloudflareTunnel } from "./index-BjNI6nQt.js";
1
+ import { CloudflareTunnel } from "./index.mjs";
2
2
 
3
3
  //#region src/farm.d.ts
4
4
 
@@ -1,7 +1,12 @@
1
- import { t as CloudflareTunnel } from "./src-BC4MyCER.js";
1
+ import { CloudflareTunnel } from "./index.mjs";
2
2
 
3
3
  //#region src/farm.ts
4
4
  /**
5
+ * This entry file is for Farm plugin.
6
+ *
7
+ * @module
8
+ */
9
+ /**
5
10
  * Farm plugin
6
11
  *
7
12
  * @example
@@ -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
- declare const CloudflareApiResponseSchema: z.ZodType<{
7
- success: boolean;
8
- errors?: Array<{
9
- code: number;
10
- message: string;
11
- }>;
12
- messages?: Array<string>;
13
- result: unknown;
14
- }>;
15
- declare const AccountSchema: z.ZodType<{
16
- id: string;
17
- name: string;
18
- }>;
19
- declare const ZoneSchema: z.ZodType<{
20
- id: string;
21
- name: string;
22
- }>;
23
- declare const TunnelSchema: z.ZodType<{
24
- id: string;
25
- name: string;
26
- account_tag: string;
27
- created_at: string;
28
- connections?: Array<unknown>;
29
- }>;
30
- declare const DNSRecordSchema: z.ZodType<{
31
- id: string;
32
- type: string;
33
- name: string;
34
- content: string;
35
- proxied: boolean;
36
- comment?: string | null;
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 { DNSRecord as a, CloudflareTunnelOptions as i, CloudflareApiResponse as n, Tunnel as o, CloudflareTunnel as r, Zone as s, Account as t };
167
+ export { Account, CloudflareApiResponse, CloudflareTunnel, CloudflareTunnel as default, CloudflareTunnelOptions, DNSRecord, Tunnel, Zone };