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

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 (2) hide show
  1. package/README.md +48 -26
  2. package/package.json +36 -16
package/README.md CHANGED
@@ -18,40 +18,59 @@
18
18
 
19
19
  Protect your SvelteKit application with secure headers.
20
20
 
21
- ## Installation
21
+ - [npm package (`@nosecone/sveltekit`)](https://www.npmjs.com/package/@nosecone/sveltekit)
22
+ - [GitHub source code (`nosecone-sveltekit/` in `arcjet/arcjet-js`)](https://github.com/arcjet/arcjet-js/tree/main/nosecone-sveltekit)
22
23
 
23
- ```shell
24
- npm install -S @nosecone/sveltekit
24
+ ## What is this?
25
+
26
+ This is our adapter to integrate Nosecone into SvelteKit.
27
+ Nosecone makes it easy to add and configure security headers.
28
+ This package exists so that we can provide the best possible experience to
29
+ SvelteKit users.
30
+
31
+ ## When should I use this?
32
+
33
+ You can use this package with or without Arcjet to protect your app if you are
34
+ using SvelteKit.
35
+ Use [`@nosecone/next`][github-nosecone-next] if you use Next.js and
36
+ use [`nosecone`][github-nosecone] itself if you use a different framework.
37
+
38
+ ## Install
39
+
40
+ This package is ESM only.
41
+ Install with npm in Node.js:
42
+
43
+ ```sh
44
+ npm install @nosecone/sveltekit
25
45
  ```
26
46
 
27
47
  ## Example
28
48
 
29
- Update your `svelte.config.js` file for `csp`:
49
+ Configure `csp` from Nosecone in `svelte.config.js`:
30
50
 
31
51
  ```diff
32
- import adapter from "@sveltejs/adapter-auto";
33
- import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
34
- + import { csp } from "@nosecone/sveltekit"
35
-
36
- /** @type {import('@sveltejs/kit').Config} */
37
- const config = {
38
- // Consult https://kit.svelte.dev/docs/integrations#preprocessors
39
- // for more information about preprocessors
40
- preprocess: vitePreprocess(),
41
-
42
- kit: {
43
- + csp: csp(),
44
- // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
45
- // If your environment is not supported, or you settled on a specific environment, switch out the adapter.
46
- // See https://kit.svelte.dev/docs/adapters for more information about adapters.
47
- adapter: adapter(),
48
- },
49
- };
50
-
51
- export default config;
52
+ +import { csp } from "@nosecone/sveltekit"
53
+ import adapter from "@sveltejs/adapter-auto";
54
+ import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
55
+
56
+ /** @type {import('@sveltejs/kit').Config} */
57
+ const config = {
58
+ kit: {
59
+ // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
60
+ // If your environment is not supported, or you settled on a specific environment, switch out the adapter.
61
+ // See https://kit.svelte.dev/docs/adapters for more information about adapters.
62
+ adapter: adapter(),
63
+ + csp: csp(),
64
+ },
65
+ // Consult https://kit.svelte.dev/docs/integrations#preprocessors
66
+ // for more information about preprocessors
67
+ preprocess: vitePreprocess(),
68
+ };
69
+
70
+ export default config;
52
71
  ```
53
72
 
54
- Create a `src/hooks.server.ts` file with the contents:
73
+ …then use `createHook` from Nosecone in a `src/hooks.server.ts` file:
55
74
 
56
75
  ```ts
57
76
  import { createHook } from "@nosecone/sveltekit";
@@ -65,6 +84,9 @@ export const handle = sequence(
65
84
 
66
85
  ## License
67
86
 
68
- Licensed under the [Apache License, Version 2.0][apache-license].
87
+ [Apache License, Version 2.0][apache-license] © [Arcjet Labs, Inc.][arcjet]
69
88
 
70
89
  [apache-license]: http://www.apache.org/licenses/LICENSE-2.0
90
+ [arcjet]: https://arcjet.com
91
+ [github-nosecone-next]: https://github.com/arcjet/arcjet-js/tree/main/nosecone-next
92
+ [github-nosecone]: https://github.com/arcjet/arcjet-js/tree/main/nosecone
package/package.json CHANGED
@@ -1,7 +1,25 @@
1
1
  {
2
2
  "name": "@nosecone/sveltekit",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.10",
4
4
  "description": "Protect your SvelteKit application with secure headers",
5
+ "keywords": [
6
+ "arcjet",
7
+ "coep",
8
+ "coep",
9
+ "content-security-policy",
10
+ "coop",
11
+ "corp",
12
+ "cross-origin-embedder-policy",
13
+ "cross-origin-opener-policy",
14
+ "cross-origin-resource-policy",
15
+ "csp",
16
+ "header",
17
+ "http",
18
+ "nosecone",
19
+ "protect",
20
+ "sveltekit",
21
+ "svelte"
22
+ ],
5
23
  "license": "Apache-2.0",
6
24
  "homepage": "https://arcjet.com",
7
25
  "repository": {
@@ -25,33 +43,35 @@
25
43
  "main": "./index.js",
26
44
  "types": "./index.d.ts",
27
45
  "files": [
28
- "LICENSE",
29
- "README.md",
30
- "*.js",
31
- "*.d.ts",
32
- "!*.config.js"
46
+ "index.d.ts",
47
+ "index.js"
33
48
  ],
34
49
  "scripts": {
35
- "prepublishOnly": "npm run build",
36
50
  "build": "rollup --config rollup.config.js",
37
51
  "lint": "eslint .",
38
- "pretest": "npm run build",
39
- "test": "node --test"
52
+ "prepublishOnly": "npm run build",
53
+ "test-api": "node --test",
54
+ "test-coverage": "node --experimental-test-coverage --test",
55
+ "test": "npm run build && npm run lint && npm run test-coverage"
40
56
  },
41
57
  "dependencies": {
42
- "nosecone": "1.0.0-beta.1"
58
+ "nosecone": "1.0.0-beta.10"
43
59
  },
44
60
  "peerDependencies": {
45
61
  "@sveltejs/kit": ">=2"
46
62
  },
47
63
  "devDependencies": {
48
- "@arcjet/eslint-config": "1.0.0-beta.1",
49
- "@arcjet/rollup-config": "1.0.0-beta.1",
50
- "@arcjet/tsconfig": "1.0.0-beta.1",
51
- "@rollup/wasm-node": "4.30.1",
52
- "@sveltejs/kit": "^2.15.2",
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",
53
70
  "@types/node": "18.18.0",
54
- "typescript": "5.7.3"
71
+ "eslint": "9.32.0",
72
+ "svelte": "5.37.3",
73
+ "typescript": "5.9.2",
74
+ "vite": "7.0.6"
55
75
  },
56
76
  "publishConfig": {
57
77
  "access": "public",