turnstile-svelte 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/LICENSE +21 -0
- package/README.md +116 -0
- package/dist/actions/action.d.ts +22 -0
- package/dist/actions/action.js +70 -0
- package/dist/components/TurnstileWidget.svelte +79 -0
- package/dist/components/TurnstileWidget.svelte.d.ts +13 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/types/types.d.ts +52 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
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/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# turnstile-svelte
|
|
2
|
+
|
|
3
|
+
A highly flexible and reactive [Cloudflare Turnstile](https://developers.cloudflare.com/turnstile/) component and action tailored specifically for **Svelte 5**.
|
|
4
|
+
|
|
5
|
+
This library allows you to seamlessly integrate Cloudflare's privacy-preserving CAPTCHA alternative into your Svelte applications. It provides two methods of usage depending on your needs: a drop-in Component (`<TurnstileWidget>`) or a Svelte Action (`use:turnstileAction`) for advanced custom integrations.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Install the library using your preferred package manager:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install turnstile-svelte
|
|
13
|
+
# or
|
|
14
|
+
pnpm add turnstile-svelte
|
|
15
|
+
# or
|
|
16
|
+
yarn add turnstile-svelte
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
- 🚀 **Svelte 5 Ready**: Built with Svelte 5 Runes in mind.
|
|
21
|
+
- 🔌 **Plug and Play**: The widget component takes care of injecting the Cloudflare Turnstile script into the document dynamically if it isn't already present.
|
|
22
|
+
- 🔄 **Reactive Options**: Options like `theme`, `size`, or your custom callbacks are fully reactive. Changing them will automatically re-render the widget gracefully without memory leaks.
|
|
23
|
+
- 🛡️ **Fully Typed**: Includes comprehensive TypeScript definitions matching the official Cloudflare Turnstile API.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### 1. Using the Component (Recommended)
|
|
28
|
+
|
|
29
|
+
The easiest way to use the library is by importing the `TurnstileWidget` component.
|
|
30
|
+
|
|
31
|
+
```svelte
|
|
32
|
+
<script lang="ts">
|
|
33
|
+
import { TurnstileWidget } from 'turnstile-svelte';
|
|
34
|
+
|
|
35
|
+
// Your Cloudflare Turnstile Sitekey
|
|
36
|
+
const SITE_KEY = '1x00000000000000000000AA';
|
|
37
|
+
|
|
38
|
+
let token = $state<string | null>(null);
|
|
39
|
+
|
|
40
|
+
function handleToken(t: string) {
|
|
41
|
+
console.log('Successfully verified. Token:', t);
|
|
42
|
+
token = t;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function handleError(errorCode: string) {
|
|
46
|
+
console.error('Turnstile verification failed:', errorCode);
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<TurnstileWidget
|
|
51
|
+
sitekey={SITE_KEY}
|
|
52
|
+
theme="auto"
|
|
53
|
+
ontoken={handleToken}
|
|
54
|
+
onerror={handleError}
|
|
55
|
+
/>
|
|
56
|
+
|
|
57
|
+
{#if token}
|
|
58
|
+
<p>Success! Form can now be submitted.</p>
|
|
59
|
+
{/if}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 2. Using the Svelte Action (Advanced)
|
|
63
|
+
|
|
64
|
+
If you need full control over the wrapper DOM element, you can use the Svelte Action directly on any HTML element.
|
|
65
|
+
|
|
66
|
+
```svelte
|
|
67
|
+
<script lang="ts">
|
|
68
|
+
import { turnstileAction } from 'turnstile-svelte';
|
|
69
|
+
import type { TurnstileOptions } from 'turnstile-svelte';
|
|
70
|
+
|
|
71
|
+
const options: TurnstileOptions = {
|
|
72
|
+
sitekey: '1x00000000000000000000AA',
|
|
73
|
+
theme: 'dark',
|
|
74
|
+
callback: (token) => {
|
|
75
|
+
console.log("Token obtained:", token);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<!-- The widget will be injected into this div -->
|
|
81
|
+
<div use:turnstileAction={options} class="my-custom-wrapper"></div>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Props / API Reference
|
|
85
|
+
|
|
86
|
+
The `TurnstileWidget` component accepts all standard Cloudflare Turnstile parameters as props, with the hyphenated callback names converted to standard Svelte-style event handlers.
|
|
87
|
+
|
|
88
|
+
| Prop | Type | Description |
|
|
89
|
+
|---|---|---|
|
|
90
|
+
| `sitekey` | `string` | **Required.** Your Cloudflare Turnstile sitekey. |
|
|
91
|
+
| `theme` | `"auto" \| "light" \| "dark"` | The widget theme. (Default: `"auto"`) |
|
|
92
|
+
| `size` | `"normal" \| "flexible" \| "compact"` | The widget size. |
|
|
93
|
+
| `action` | `string` | Customer value used to differentiate widgets under the same sitekey. |
|
|
94
|
+
| `cData` | `string` | Customer payload that can be attached to the challenge. |
|
|
95
|
+
| `language` | `string` | ISO 639-1 language code (e.g. `"en-US"`). (Default: `"auto"`) |
|
|
96
|
+
| `retry` | `"auto" \| "never"` | Controls auto-retry behavior. |
|
|
97
|
+
| `retryInterval` | `number` | Time between retry attempts in ms. (Default: `8000`) |
|
|
98
|
+
| `execution` | `"render" \| "execute"` | When to obtain the token. |
|
|
99
|
+
| `appearance` | `"always" \| "execute" \| "interaction-only"` | When the widget should be visible. |
|
|
100
|
+
|
|
101
|
+
### Callbacks (Events)
|
|
102
|
+
|
|
103
|
+
| Prop | Turnstile Equivalent | Description |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| `ontoken` | `callback` | Invoked upon successful completion. Receives the `token`. |
|
|
106
|
+
| `onerror` | `error-callback` | Invoked on error (e.g. network error). Receives the `errorCode`. |
|
|
107
|
+
| `onexpire` | `expired-callback` | Invoked when the token expires. |
|
|
108
|
+
| `ontimeout` | `timeout-callback` | Invoked when an interactive challenge times out. |
|
|
109
|
+
| `onbeforeinteractive`| `before-interactive-callback`| Invoked before an interactive challenge is shown. |
|
|
110
|
+
| `onafterinteractive` | `after-interactive-callback` | Invoked after an interactive challenge has been completed or failed. |
|
|
111
|
+
| `onunsupported` | `unsupported-callback` | Invoked when the client browser is not supported. |
|
|
112
|
+
|
|
113
|
+
For a detailed explanation of all options, refer to the [Cloudflare Turnstile Documentation](https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/widget-configurations/).
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
MIT
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TurnstileOptions } from "../types/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Svelte Action to initialize and manage a Cloudflare Turnstile widget on a DOM node.
|
|
4
|
+
*
|
|
5
|
+
* @param node - The HTML element where the Turnstile widget will be injected.
|
|
6
|
+
* @param options - Configuration options for the Turnstile widget.
|
|
7
|
+
* @returns An object with `update` and `destroy` methods for the Svelte action lifecycle.
|
|
8
|
+
*/
|
|
9
|
+
export declare function turnstileAction(node: HTMLElement, options: TurnstileOptions): {
|
|
10
|
+
/**
|
|
11
|
+
* Called by Svelte whenever the options passed to the action change.
|
|
12
|
+
* Removes the existing widget and re-initializes it with the new options.
|
|
13
|
+
*
|
|
14
|
+
* @param newOptions - The updated Turnstile configuration options.
|
|
15
|
+
*/
|
|
16
|
+
update(newOptions: TurnstileOptions): void;
|
|
17
|
+
/**
|
|
18
|
+
* Called by Svelte when the DOM node is removed.
|
|
19
|
+
* Cleans up the polling interval and removes the Turnstile widget to prevent memory leaks.
|
|
20
|
+
*/
|
|
21
|
+
destroy(): void;
|
|
22
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const TURNSTILE_SCRIPT_ID = "cf-turnstile-script";
|
|
2
|
+
const TURNSTILE_SRC = "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit";
|
|
3
|
+
/**
|
|
4
|
+
* Svelte Action to initialize and manage a Cloudflare Turnstile widget on a DOM node.
|
|
5
|
+
*
|
|
6
|
+
* @param node - The HTML element where the Turnstile widget will be injected.
|
|
7
|
+
* @param options - Configuration options for the Turnstile widget.
|
|
8
|
+
* @returns An object with `update` and `destroy` methods for the Svelte action lifecycle.
|
|
9
|
+
*/
|
|
10
|
+
export function turnstileAction(node, options) {
|
|
11
|
+
let widgetId = null;
|
|
12
|
+
let renderInterval;
|
|
13
|
+
/**
|
|
14
|
+
* Attempts to render the Turnstile widget.
|
|
15
|
+
* If the global `window.turnstile` object is available, it clears the polling interval
|
|
16
|
+
* and initializes the widget with the provided options.
|
|
17
|
+
*/
|
|
18
|
+
function renderWidget() {
|
|
19
|
+
if (window.turnstile) {
|
|
20
|
+
clearInterval(renderInterval);
|
|
21
|
+
widgetId = window.turnstile.render(node, options);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Injects the Cloudflare Turnstile script into the document if it hasn't been loaded yet.
|
|
26
|
+
* Starts a polling interval to wait for the `window.turnstile` object to be ready.
|
|
27
|
+
*/
|
|
28
|
+
function loadScript() {
|
|
29
|
+
if (document.getElementById(TURNSTILE_SCRIPT_ID) || window.turnstile) {
|
|
30
|
+
// Script is already injected or loaded. Wait for window.turnstile to be fully ready
|
|
31
|
+
renderInterval = setInterval(renderWidget, 50);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const script = document.createElement("script");
|
|
35
|
+
script.id = TURNSTILE_SCRIPT_ID;
|
|
36
|
+
script.src = TURNSTILE_SRC;
|
|
37
|
+
script.async = true;
|
|
38
|
+
script.defer = true;
|
|
39
|
+
document.head.appendChild(script);
|
|
40
|
+
renderInterval = setInterval(renderWidget, 50);
|
|
41
|
+
}
|
|
42
|
+
loadScript();
|
|
43
|
+
return {
|
|
44
|
+
/**
|
|
45
|
+
* Called by Svelte whenever the options passed to the action change.
|
|
46
|
+
* Removes the existing widget and re-initializes it with the new options.
|
|
47
|
+
*
|
|
48
|
+
* @param newOptions - The updated Turnstile configuration options.
|
|
49
|
+
*/
|
|
50
|
+
update(newOptions) {
|
|
51
|
+
clearInterval(renderInterval);
|
|
52
|
+
if (widgetId !== null && window.turnstile) {
|
|
53
|
+
window.turnstile.remove(widgetId);
|
|
54
|
+
widgetId = null;
|
|
55
|
+
}
|
|
56
|
+
options = newOptions;
|
|
57
|
+
loadScript();
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* Called by Svelte when the DOM node is removed.
|
|
61
|
+
* Cleans up the polling interval and removes the Turnstile widget to prevent memory leaks.
|
|
62
|
+
*/
|
|
63
|
+
destroy() {
|
|
64
|
+
clearInterval(renderInterval);
|
|
65
|
+
if (widgetId !== null && window.turnstile) {
|
|
66
|
+
window.turnstile.remove(widgetId);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { turnstileAction } from '../actions/action.js';
|
|
3
|
+
import type { TurnstileOptions } from '../types/types.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
sitekey,
|
|
7
|
+
action,
|
|
8
|
+
cData,
|
|
9
|
+
theme,
|
|
10
|
+
language,
|
|
11
|
+
tabindex,
|
|
12
|
+
retry,
|
|
13
|
+
"retry-interval": retryInterval,
|
|
14
|
+
size,
|
|
15
|
+
"response-field": responseField,
|
|
16
|
+
"response-field-name": responseFieldName,
|
|
17
|
+
appearance,
|
|
18
|
+
execution,
|
|
19
|
+
"refresh-expired": refreshExpired,
|
|
20
|
+
"refresh-timeout": refreshTimeout,
|
|
21
|
+
"feedback-enabled": feedbackEnabled,
|
|
22
|
+
"offlabel-show-privacy": offlabelShowPrivacy,
|
|
23
|
+
"offlabel-show-help": offlabelShowHelp,
|
|
24
|
+
ontoken,
|
|
25
|
+
onerror,
|
|
26
|
+
onexpire,
|
|
27
|
+
ontimeout,
|
|
28
|
+
onbeforeinteractive,
|
|
29
|
+
onafterinteractive,
|
|
30
|
+
onunsupported
|
|
31
|
+
}: Omit<
|
|
32
|
+
TurnstileOptions,
|
|
33
|
+
| 'callback'
|
|
34
|
+
| 'error-callback'
|
|
35
|
+
| 'expired-callback'
|
|
36
|
+
| 'timeout-callback'
|
|
37
|
+
| 'before-interactive-callback'
|
|
38
|
+
| 'after-interactive-callback'
|
|
39
|
+
| 'unsupported-callback'
|
|
40
|
+
> & {
|
|
41
|
+
ontoken?: (token: string) => void;
|
|
42
|
+
onerror?: (errorCode: string) => void;
|
|
43
|
+
onexpire?: () => void;
|
|
44
|
+
ontimeout?: () => void;
|
|
45
|
+
onbeforeinteractive?: () => void;
|
|
46
|
+
onafterinteractive?: () => void;
|
|
47
|
+
onunsupported?: () => void;
|
|
48
|
+
} = $props();
|
|
49
|
+
|
|
50
|
+
let options = $derived({
|
|
51
|
+
sitekey,
|
|
52
|
+
action,
|
|
53
|
+
cData,
|
|
54
|
+
theme,
|
|
55
|
+
language,
|
|
56
|
+
tabindex,
|
|
57
|
+
retry,
|
|
58
|
+
'retry-interval': retryInterval,
|
|
59
|
+
size,
|
|
60
|
+
'response-field': responseField,
|
|
61
|
+
'response-field-name': responseFieldName,
|
|
62
|
+
appearance,
|
|
63
|
+
execution,
|
|
64
|
+
'refresh-expired': refreshExpired,
|
|
65
|
+
'refresh-timeout': refreshTimeout,
|
|
66
|
+
'feedback-enabled': feedbackEnabled,
|
|
67
|
+
'offlabel-show-privacy': offlabelShowPrivacy,
|
|
68
|
+
'offlabel-show-help': offlabelShowHelp,
|
|
69
|
+
callback: ontoken,
|
|
70
|
+
'error-callback': onerror,
|
|
71
|
+
'expired-callback': onexpire,
|
|
72
|
+
'timeout-callback': ontimeout,
|
|
73
|
+
'before-interactive-callback': onbeforeinteractive,
|
|
74
|
+
'after-interactive-callback': onafterinteractive,
|
|
75
|
+
'unsupported-callback': onunsupported
|
|
76
|
+
} as TurnstileOptions);
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<div use:turnstileAction={options}></div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TurnstileOptions } from '../types/types.js';
|
|
2
|
+
type $$ComponentProps = Omit<TurnstileOptions, 'callback' | 'error-callback' | 'expired-callback' | 'timeout-callback' | 'before-interactive-callback' | 'after-interactive-callback' | 'unsupported-callback'> & {
|
|
3
|
+
ontoken?: (token: string) => void;
|
|
4
|
+
onerror?: (errorCode: string) => void;
|
|
5
|
+
onexpire?: () => void;
|
|
6
|
+
ontimeout?: () => void;
|
|
7
|
+
onbeforeinteractive?: () => void;
|
|
8
|
+
onafterinteractive?: () => void;
|
|
9
|
+
onunsupported?: () => void;
|
|
10
|
+
};
|
|
11
|
+
declare const TurnstileWidget: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
12
|
+
type TurnstileWidget = ReturnType<typeof TurnstileWidget>;
|
|
13
|
+
export default TurnstileWidget;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface TurnstileOptions {
|
|
2
|
+
/** Every widget has a sitekey. This sitekey is associated with the corresponding widget configuration and is created upon the widget creation. */
|
|
3
|
+
sitekey: string;
|
|
4
|
+
/** A customer value that can be used to differentiate widgets under the same sitekey in analytics and which is returned upon validation. This can only contain up to 32 alphanumeric characters including _ and -. */
|
|
5
|
+
action?: string;
|
|
6
|
+
/** A customer payload that can be used to attach customer data to the challenge throughout its issuance and which is returned upon validation. This can only contain up to 255 alphanumeric characters including _ and -. */
|
|
7
|
+
cData?: string;
|
|
8
|
+
/** Callback invoked upon successful completion of the challenge. The token is passed as an argument. */
|
|
9
|
+
callback?: (token: string) => void;
|
|
10
|
+
/** Callback invoked when there is an error (e.g. network error, challenge failed). */
|
|
11
|
+
"error-callback"?: (errorCode: string) => void;
|
|
12
|
+
/** Execution controls when to obtain the token of the widget and can be on "render" (default) or on "execute". */
|
|
13
|
+
execution?: "render" | "execute";
|
|
14
|
+
/** Callback invoked when the token expires and does not reset the widget. */
|
|
15
|
+
"expired-callback"?: () => void;
|
|
16
|
+
/** Callback invoked when an interactive challenge times out. */
|
|
17
|
+
"timeout-callback"?: () => void;
|
|
18
|
+
/** Callback invoked before an interactive challenge is shown. */
|
|
19
|
+
"before-interactive-callback"?: () => void;
|
|
20
|
+
/** Callback invoked after an interactive challenge has been completed or failed. */
|
|
21
|
+
"after-interactive-callback"?: () => void;
|
|
22
|
+
/** Callback invoked when a given client/browser is not supported by Turnstile. */
|
|
23
|
+
"unsupported-callback"?: () => void;
|
|
24
|
+
/** The widget theme. Can take the following values: "light", "dark", "auto". */
|
|
25
|
+
theme?: "auto" | "light" | "dark";
|
|
26
|
+
/** Language to display, must be either: "auto" (default) or an ISO 639-1 two-letter language code (e.g. "en") or language and country code (e.g. "en-US"). */
|
|
27
|
+
language?: "auto" | string;
|
|
28
|
+
/** The tabindex of Turnstile's iframe for accessibility purposes. The default value is 0. */
|
|
29
|
+
tabindex?: number;
|
|
30
|
+
/** Controls whether the widget should automatically retry to obtain a token if it did not succeed. Can take "auto" or "never". */
|
|
31
|
+
retry?: "auto" | "never";
|
|
32
|
+
/** When retry is set to "auto", retry-interval controls the time between retry attempts in milliseconds. Value must be a positive integer less than 900000, defaults to 8000. */
|
|
33
|
+
"retry-interval"?: number;
|
|
34
|
+
/** The widget size. Can take the following values: "normal", "flexible", "compact". */
|
|
35
|
+
size?: "normal" | "flexible" | "compact";
|
|
36
|
+
/** A boolean that controls if an input element with the response token should be created, defaults to true. */
|
|
37
|
+
"response-field"?: boolean;
|
|
38
|
+
/** Name of the input element field, defaults to "cf-turnstile-response". */
|
|
39
|
+
"response-field-name"?: string;
|
|
40
|
+
/** Appearance controls when the widget is visible. It can be "always", "execute", or "interaction-only". */
|
|
41
|
+
appearance?: "always" | "execute" | "interaction-only";
|
|
42
|
+
/** Controls the behavior when the token of a Turnstile widget expires. Can be "auto", "manual", or "never". */
|
|
43
|
+
"refresh-expired"?: "auto" | "manual" | "never";
|
|
44
|
+
/** Controls the behavior when an interactive challenge times out. Can be "auto", "manual", or "never". */
|
|
45
|
+
"refresh-timeout"?: "auto" | "manual" | "never";
|
|
46
|
+
/** Enables the feedback button. */
|
|
47
|
+
"feedback-enabled"?: boolean;
|
|
48
|
+
/** (Offlabel) Shows the privacy policy link. */
|
|
49
|
+
"offlabel-show-privacy"?: boolean;
|
|
50
|
+
/** (Offlabel) Shows the help link. */
|
|
51
|
+
"offlabel-show-help"?: boolean;
|
|
52
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "turnstile-svelte",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A Cloudflare Turnstile component and action for Svelte 5",
|
|
5
|
+
"author": "nstdev0",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": ""
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "vite dev",
|
|
13
|
+
"build": "vite build && npm run prepack",
|
|
14
|
+
"preview": "vite preview",
|
|
15
|
+
"prepare": "svelte-kit sync || echo ''",
|
|
16
|
+
"prepack": "svelte-kit sync && svelte-package && publint",
|
|
17
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
18
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"!dist/**/*.test.*",
|
|
23
|
+
"!dist/**/*.spec.*"
|
|
24
|
+
],
|
|
25
|
+
"sideEffects": [
|
|
26
|
+
"**/*.css"
|
|
27
|
+
],
|
|
28
|
+
"svelte": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"type": "module",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"svelte": "./dist/index.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"svelte": "^5.0.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@sveltejs/adapter-auto": "^7.0.1",
|
|
42
|
+
"@sveltejs/kit": "^2.63.0",
|
|
43
|
+
"@sveltejs/package": "^2.5.8",
|
|
44
|
+
"@sveltejs/vite-plugin-svelte": "^7.1.2",
|
|
45
|
+
"publint": "^0.3.21",
|
|
46
|
+
"svelte": "^5.56.1",
|
|
47
|
+
"svelte-check": "^4.6.0",
|
|
48
|
+
"typescript": "^6.0.3",
|
|
49
|
+
"vite": "^8.0.16"
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"svelte",
|
|
53
|
+
"svelte-5",
|
|
54
|
+
"cloudflare",
|
|
55
|
+
"turnstile",
|
|
56
|
+
"captcha",
|
|
57
|
+
"component",
|
|
58
|
+
"action"
|
|
59
|
+
]
|
|
60
|
+
}
|