@nosecone/sveltekit 1.0.0-beta.10 → 1.0.0-beta.12

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.
Files changed (3) hide show
  1. package/index.d.ts +37 -8
  2. package/index.js +19 -6
  3. package/package.json +11 -12
package/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import nosecone from "nosecone";
2
- import type { CspDirectives, NoseconeOptions } from "nosecone";
2
+ import type { CspDirectives, Options } from "nosecone";
3
3
  import type { Handle, KitConfig } from "@sveltejs/kit";
4
- export { withVercelToolbar, type NoseconeOptions } from "nosecone";
4
+ export { withVercelToolbar, type Options, type NoseconeOptions, } from "nosecone";
5
+ /**
6
+ * Nosecone SvelteKit defaults.
7
+ */
5
8
  export declare const defaults: {
6
9
  readonly directives: {
7
10
  readonly scriptSrc: readonly ["'strict-dynamic'"];
@@ -70,17 +73,43 @@ export declare const defaults: {
70
73
  };
71
74
  readonly xXssProtection: true;
72
75
  };
76
+ export { nosecone };
77
+ /**
78
+ * Create security headers.
79
+ *
80
+ * @deprecated
81
+ * Use the named export `nosecone` instead.
82
+ */
73
83
  export default nosecone;
74
84
  /**
75
85
  * Create a SvelteKit hook that sets secure headers on every request.
76
86
  *
77
- * @param options: Configuration to provide to Nosecone
78
- * @returns A SvelteKit hook that sets secure headers
87
+ * @param options
88
+ * Configuration to provide to Nosecone.
89
+ * @returns
90
+ * SvelteKit hook that sets secure headers.
79
91
  */
80
- export declare function createHook(options?: NoseconeOptions): Handle;
92
+ export declare function createHook(options?: Options): Handle;
81
93
  type SvelteKitCsp = Exclude<KitConfig["csp"], undefined>;
94
+ /**
95
+ * Content Security Policy configuration for SvelteKit.
96
+ */
82
97
  export type ContentSecurityPolicyConfig = {
83
- mode?: SvelteKitCsp["mode"];
84
- directives?: CspDirectives;
98
+ /**
99
+ * Mode of the `Content-Security-Policy` header.
100
+ */
101
+ mode?: SvelteKitCsp["mode"] | undefined;
102
+ /**
103
+ * Directives to use in the `Content-Security-Policy` header.
104
+ */
105
+ directives?: CspDirectives | undefined;
85
106
  };
86
- export declare function csp(options?: ContentSecurityPolicyConfig): SvelteKitCsp;
107
+ /**
108
+ * Create a SvelteKit Content Security Policy configuration.
109
+ *
110
+ * @param options
111
+ * Configuration.
112
+ * @returns
113
+ * SvelteKit Content Security Policy configuration.
114
+ */
115
+ export declare function csp(options?: ContentSecurityPolicyConfig | undefined): SvelteKitCsp;
package/index.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import nosecone, { defaults as defaults$1, CONTENT_SECURITY_POLICY_DIRECTIVES, NoseconeValidationError, QUOTED } from 'nosecone';
2
- export { default, withVercelToolbar } from 'nosecone';
2
+ export { default, default as nosecone, withVercelToolbar } from 'nosecone';
3
3
 
4
+ /**
5
+ * Nosecone SvelteKit defaults.
6
+ */
4
7
  const defaults = {
5
8
  ...defaults$1,
6
9
  directives: {
@@ -11,8 +14,10 @@ const defaults = {
11
14
  /**
12
15
  * Create a SvelteKit hook that sets secure headers on every request.
13
16
  *
14
- * @param options: Configuration to provide to Nosecone
15
- * @returns A SvelteKit hook that sets secure headers
17
+ * @param options
18
+ * Configuration to provide to Nosecone.
19
+ * @returns
20
+ * SvelteKit hook that sets secure headers.
16
21
  */
17
22
  function createHook(options = defaults) {
18
23
  return async ({ event, resolve }) => {
@@ -73,10 +78,18 @@ function directivesToSvelteKitConfig(directives) {
73
78
  }
74
79
  return sveltekitDirectives;
75
80
  }
76
- function csp(options = { mode: "auto" }) {
81
+ /**
82
+ * Create a SvelteKit Content Security Policy configuration.
83
+ *
84
+ * @param options
85
+ * Configuration.
86
+ * @returns
87
+ * SvelteKit Content Security Policy configuration.
88
+ */
89
+ function csp(options) {
77
90
  return {
78
- mode: options.mode ? options.mode : "auto",
79
- directives: directivesToSvelteKitConfig(options.directives ?? defaults.contentSecurityPolicy.directives),
91
+ mode: options?.mode ? options.mode : "auto",
92
+ directives: directivesToSvelteKitConfig(options?.directives ?? defaults.contentSecurityPolicy.directives) || {},
80
93
  };
81
94
  }
82
95
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nosecone/sveltekit",
3
- "version": "1.0.0-beta.10",
3
+ "version": "1.0.0-beta.12",
4
4
  "description": "Protect your SvelteKit application with secure headers",
5
5
  "keywords": [
6
6
  "arcjet",
@@ -55,23 +55,22 @@
55
55
  "test": "npm run build && npm run lint && npm run test-coverage"
56
56
  },
57
57
  "dependencies": {
58
- "nosecone": "1.0.0-beta.10"
58
+ "nosecone": "1.0.0-beta.12"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@sveltejs/kit": ">=2"
62
62
  },
63
63
  "devDependencies": {
64
- "@arcjet/eslint-config": "1.0.0-beta.10",
65
- "@arcjet/rollup-config": "1.0.0-beta.10",
66
- "@arcjet/tsconfig": "1.0.0-beta.10",
67
- "@rollup/wasm-node": "4.46.2",
68
- "@sveltejs/kit": "2.27.0",
69
- "@sveltejs/vite-plugin-svelte": "6.1.0",
70
- "@types/node": "18.18.0",
71
- "eslint": "9.32.0",
72
- "svelte": "5.37.3",
64
+ "@arcjet/eslint-config": "1.0.0-beta.12",
65
+ "@arcjet/rollup-config": "1.0.0-beta.12",
66
+ "@rollup/wasm-node": "4.50.0",
67
+ "@sveltejs/kit": "2.37.0",
68
+ "@sveltejs/vite-plugin-svelte": "6.1.4",
69
+ "@types/node": "24.3.0",
70
+ "eslint": "9.34.0",
71
+ "svelte": "5.38.6",
73
72
  "typescript": "5.9.2",
74
- "vite": "7.0.6"
73
+ "vite": "7.1.4"
75
74
  },
76
75
  "publishConfig": {
77
76
  "access": "public",