unplugin-cloudflare-tunnel 0.0.0-alpha-1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright © 2025-PRESENT Kevin Deng (https://github.com/sxzz)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/api.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/dist/api.js ADDED
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,25 @@
1
+ //#region src/astro.d.ts
2
+ /**
3
+ * This entry file is for Astro plugin.
4
+ *
5
+ * @module
6
+ */
7
+ /**
8
+ * TODO: figure out how to import the Astro plugin
9
+ */
10
+ /**
11
+ * Astro plugin
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * // astro.config.ts
16
+ * import CloudflareTunnel from 'unplugin-cloudflare-tunnel/astro'
17
+ *
18
+ * export default defineConfig({
19
+ * plugins: [CloudflareTunnel()],
20
+ * })
21
+ * ```
22
+ */
23
+ declare const astro: never;
24
+ //#endregion
25
+ export { astro as default, astro as "module.exports" };
package/dist/astro.js ADDED
@@ -0,0 +1,27 @@
1
+ //#region src/astro.ts
2
+ /**
3
+ * This entry file is for Astro plugin.
4
+ *
5
+ * @module
6
+ */
7
+ /**
8
+ * TODO: figure out how to import the Astro plugin
9
+ */
10
+ /**
11
+ * Astro plugin
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * // astro.config.ts
16
+ * import CloudflareTunnel from 'unplugin-cloudflare-tunnel/astro'
17
+ *
18
+ * export default defineConfig({
19
+ * plugins: [CloudflareTunnel()],
20
+ * })
21
+ * ```
22
+ */
23
+ const astro = {};
24
+ var astro_default = astro;
25
+
26
+ //#endregion
27
+ export { astro_default as default, astro as "module.exports" };
@@ -0,0 +1,18 @@
1
+ import { r as CloudflareTunnel } from "./index-BjNI6nQt.js";
2
+
3
+ //#region src/esbuild.d.ts
4
+
5
+ /**
6
+ * Esbuild plugin
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { build } from 'esbuild'
11
+ * import CloudflareTunnel from 'unplugin-cloudflare-tunnel/esbuild'
12
+ *
13
+ * build({ plugins: [Starter()] })
14
+ ```
15
+ */
16
+ declare const esbuild: typeof CloudflareTunnel.esbuild;
17
+ //#endregion
18
+ export { esbuild as default, esbuild as "module.exports" };
@@ -0,0 +1,19 @@
1
+ import { t as CloudflareTunnel } from "./src-BC4MyCER.js";
2
+
3
+ //#region src/esbuild.ts
4
+ /**
5
+ * Esbuild plugin
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { build } from 'esbuild'
10
+ * import CloudflareTunnel from 'unplugin-cloudflare-tunnel/esbuild'
11
+ *
12
+ * build({ plugins: [Starter()] })
13
+ ```
14
+ */
15
+ const esbuild = CloudflareTunnel.esbuild;
16
+ var esbuild_default = esbuild;
17
+
18
+ //#endregion
19
+ export { esbuild_default as default, esbuild as "module.exports" };
package/dist/farm.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ import { r as CloudflareTunnel } from "./index-BjNI6nQt.js";
2
+
3
+ //#region src/farm.d.ts
4
+
5
+ /**
6
+ * Farm plugin
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * // farm.config.js
11
+ * import CloudflareTunnel from 'unplugin-cloudflare-tunnel/farm'
12
+ *
13
+ * export default {
14
+ * plugins: [CloudflareTunnel()],
15
+ * }
16
+ * ```
17
+ */
18
+ declare const farm: typeof CloudflareTunnel.farm;
19
+ //#endregion
20
+ export { farm as default, farm as "module.exports" };
package/dist/farm.js ADDED
@@ -0,0 +1,21 @@
1
+ import { t as CloudflareTunnel } from "./src-BC4MyCER.js";
2
+
3
+ //#region src/farm.ts
4
+ /**
5
+ * Farm plugin
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * // farm.config.js
10
+ * import CloudflareTunnel from 'unplugin-cloudflare-tunnel/farm'
11
+ *
12
+ * export default {
13
+ * plugins: [CloudflareTunnel()],
14
+ * }
15
+ * ```
16
+ */
17
+ const farm = CloudflareTunnel.farm;
18
+ var farm_default = farm;
19
+
20
+ //#endregion
21
+ export { farm_default as default, farm as "module.exports" };
@@ -0,0 +1,157 @@
1
+ import { z } from "zod";
2
+ import { UnpluginInstance } from "unplugin";
3
+
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
+ }>;
38
+ type CloudflareApiResponse<T = unknown> = z.infer<typeof CloudflareApiResponseSchema> & {
39
+ result: T;
40
+ };
41
+ type Account = z.infer<typeof AccountSchema>;
42
+ type Zone = z.infer<typeof ZoneSchema>;
43
+ type Tunnel = z.infer<typeof TunnelSchema>;
44
+ type DNSRecord = z.infer<typeof DNSRecordSchema>;
45
+ /**
46
+ * Base configuration options shared between named and quick tunnel modes
47
+ */
48
+ interface BaseTunnelOptions {
49
+ /**
50
+ * Local port your dev server listens on
51
+ * If not specified, will automatically use the bundler's configured port
52
+ * @default undefined (auto-detect from bundler config)
53
+ */
54
+ port?: number;
55
+ /**
56
+ * Path to write cloudflared logs to a file
57
+ * Useful for debugging tunnel issues
58
+ */
59
+ logFile?: string;
60
+ /**
61
+ * Log level for cloudflared process
62
+ * @default undefined (uses cloudflared default)
63
+ */
64
+ logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'fatal';
65
+ /**
66
+ * Enable additional verbose logging for easier debugging.
67
+ * When true, the plugin will output extra information prefixed with
68
+ * `[cloudflare-tunnel:debug]`.
69
+ * @default false
70
+ */
71
+ debug?: boolean;
72
+ /**
73
+ * Enable or disable the tunnel plugin. When set to `false` the plugin is
74
+ * completely disabled — cloudflared will NOT be downloaded or started.
75
+ * @default true
76
+ */
77
+ enabled?: boolean;
78
+ }
79
+ /**
80
+ * Configuration options for named tunnel mode (requires hostname and API token)
81
+ */
82
+ interface NamedTunnelOptions extends BaseTunnelOptions {
83
+ /**
84
+ * Public hostname for the tunnel (e.g., "dev.example.com")
85
+ * Must be a domain in your Cloudflare account
86
+ */
87
+ hostname: string;
88
+ /**
89
+ * Cloudflare API token with required permissions:
90
+ * - Zone:Zone:Read
91
+ * - Zone:DNS:Edit
92
+ * - Account:Cloudflare Tunnel:Edit
93
+ *
94
+ * Fallback priority:
95
+ * 1. Provided apiToken option
96
+ * 2. CLOUDFLARE_API_KEY environment variable
97
+ */
98
+ apiToken?: string;
99
+ /**
100
+ * Cloudflare account ID
101
+ * If omitted, uses the first account associated with the API token
102
+ */
103
+ accountId?: string;
104
+ /**
105
+ * Cloudflare zone ID
106
+ * If omitted, automatically resolved from the hostname
107
+ */
108
+ zoneId?: string;
109
+ /**
110
+ * Name for the tunnel in your Cloudflare dashboard
111
+ * Must contain only letters, numbers, and hyphens. Cannot start or end with a hyphen.
112
+ * @default "dev-tunnel"
113
+ */
114
+ tunnelName?: string;
115
+ /**
116
+ * Wildcard DNS domain to ensure exists (e.g., "*.example.com").
117
+ * When provided the plugin will ensure both A and AAAA records exist.
118
+ */
119
+ dns?: string;
120
+ /**
121
+ * Wildcard SSL domain to ensure exists (e.g., "*.example.com").
122
+ * When provided the plugin will request/ensure a wildcard edge certificate.
123
+ * If omitted the plugin will attempt to detect an existing wildcard certificate
124
+ * or Total TLS; otherwise it will request a regular certificate for the provided hostname.
125
+ */
126
+ ssl?: string;
127
+ /**
128
+ * Cleanup configuration for managing orphaned resources
129
+ */
130
+ cleanup?: {
131
+ /**
132
+ * Whether to automatically clean up orphaned DNS records on startup
133
+ * @default true
134
+ */
135
+ autoCleanup?: boolean;
136
+ /**
137
+ * Array of tunnel names to preserve during cleanup (in addition to current tunnel)
138
+ * @default []
139
+ */
140
+ preserveTunnels?: Array<string>;
141
+ };
142
+ }
143
+ /**
144
+ * Configuration options for quick tunnel mode (no hostname required, generates random URL)
145
+ */
146
+ interface QuickTunnelOptions extends BaseTunnelOptions {}
147
+ /**
148
+ * Configuration options for the Cloudflare Tunnel plugin
149
+ *
150
+ * Two modes are supported:
151
+ * - Named tunnel mode: Provide `hostname` for a persistent tunnel with custom domain
152
+ * - Quick tunnel mode: Omit `hostname` for a temporary tunnel with random trycloudflare.com URL
153
+ */
154
+ type CloudflareTunnelOptions = NamedTunnelOptions | QuickTunnelOptions;
155
+ declare const CloudflareTunnel: UnpluginInstance<CloudflareTunnelOptions | undefined, false>;
156
+ //#endregion
157
+ export { DNSRecord as a, CloudflareTunnelOptions as i, CloudflareApiResponse as n, Tunnel as o, CloudflareTunnel as r, Zone as s, Account as t };
@@ -0,0 +1,2 @@
1
+ import { a as DNSRecord, i as CloudflareTunnelOptions, n as CloudflareApiResponse, o as Tunnel, r as CloudflareTunnel, s as Zone, t as Account } from "./index-BjNI6nQt.js";
2
+ export { Account, CloudflareApiResponse, CloudflareTunnel, CloudflareTunnel as default, CloudflareTunnelOptions, DNSRecord, Tunnel, Zone };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import { n as src_default, t as CloudflareTunnel } from "./src-BC4MyCER.js";
2
+
3
+ export { CloudflareTunnel, src_default as default };
@@ -0,0 +1,20 @@
1
+ import { r as CloudflareTunnel } from "./index-BjNI6nQt.js";
2
+
3
+ //#region src/rolldown.d.ts
4
+
5
+ /**
6
+ * Rolldown plugin
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * // rolldown.config.js
11
+ * import CloudflareTunnel from 'unplugin-cloudflare-tunnel/rolldown'
12
+ *
13
+ * export default {
14
+ * plugins: [CloudflareTunnel()],
15
+ * }
16
+ * ```
17
+ */
18
+ declare const rolldown: typeof CloudflareTunnel.rolldown;
19
+ //#endregion
20
+ export { rolldown as default, rolldown as "module.exports" };
@@ -0,0 +1,21 @@
1
+ import { t as CloudflareTunnel } from "./src-BC4MyCER.js";
2
+
3
+ //#region src/rolldown.ts
4
+ /**
5
+ * Rolldown plugin
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * // rolldown.config.js
10
+ * import CloudflareTunnel from 'unplugin-cloudflare-tunnel/rolldown'
11
+ *
12
+ * export default {
13
+ * plugins: [CloudflareTunnel()],
14
+ * }
15
+ * ```
16
+ */
17
+ const rolldown = CloudflareTunnel.rolldown;
18
+ var rolldown_default = rolldown;
19
+
20
+ //#endregion
21
+ export { rolldown_default as default, rolldown as "module.exports" };
@@ -0,0 +1,20 @@
1
+ import { r as CloudflareTunnel } from "./index-BjNI6nQt.js";
2
+
3
+ //#region src/rollup.d.ts
4
+
5
+ /**
6
+ * Rollup plugin
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * // rollup.config.js
11
+ * import CloudflareTunnel from 'unplugin-cloudflare-tunnel/rollup'
12
+ *
13
+ * export default {
14
+ * plugins: [CloudflareTunnel()],
15
+ * }
16
+ * ```
17
+ */
18
+ declare const rollup: typeof CloudflareTunnel.rollup;
19
+ //#endregion
20
+ export { rollup as default, rollup as "module.exports" };
package/dist/rollup.js ADDED
@@ -0,0 +1,21 @@
1
+ import { t as CloudflareTunnel } from "./src-BC4MyCER.js";
2
+
3
+ //#region src/rollup.ts
4
+ /**
5
+ * Rollup plugin
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * // rollup.config.js
10
+ * import CloudflareTunnel from 'unplugin-cloudflare-tunnel/rollup'
11
+ *
12
+ * export default {
13
+ * plugins: [CloudflareTunnel()],
14
+ * }
15
+ * ```
16
+ */
17
+ const rollup = CloudflareTunnel.rollup;
18
+ var rollup_default = rollup;
19
+
20
+ //#endregion
21
+ export { rollup_default as default, rollup as "module.exports" };
@@ -0,0 +1,20 @@
1
+ import { r as CloudflareTunnel } from "./index-BjNI6nQt.js";
2
+
3
+ //#region src/rspack.d.ts
4
+
5
+ /**
6
+ * Rspack plugin
7
+ *
8
+ * @example
9
+ * ```js
10
+ * // rspack.config.js
11
+ * import CloudflareTunnel from 'unplugin-cloudflare-tunnel/rspack'
12
+ *
13
+ * export default {
14
+ * plugins: [CloudflareTunnel()],
15
+ * }
16
+ * ```
17
+ */
18
+ declare const rspack: typeof CloudflareTunnel.rspack;
19
+ //#endregion
20
+ export { rspack as default, rspack as "module.exports" };
package/dist/rspack.js ADDED
@@ -0,0 +1,21 @@
1
+ import { t as CloudflareTunnel } from "./src-BC4MyCER.js";
2
+
3
+ //#region src/rspack.ts
4
+ /**
5
+ * Rspack plugin
6
+ *
7
+ * @example
8
+ * ```js
9
+ * // rspack.config.js
10
+ * import CloudflareTunnel from 'unplugin-cloudflare-tunnel/rspack'
11
+ *
12
+ * export default {
13
+ * plugins: [CloudflareTunnel()],
14
+ * }
15
+ * ```
16
+ */
17
+ const rspack = CloudflareTunnel.rspack;
18
+ var rspack_default = rspack;
19
+
20
+ //#endregion
21
+ export { rspack_default as default, rspack as "module.exports" };