Skip to content

Commit 67c08e8

Browse files
committed
chore(nosecone): expose named export, deprecate default
This commit adds a named export for `nosecone`. The default export is still supported but deprecated. Related-to: GH-4860. Related-to: GH-4875. Related-to: GH-4876.
1 parent d427c39 commit 67c08e8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

nosecone/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ export function createXssProtection() {
943943
* @returns
944944
* `Headers` with the configured security headers.
945945
*/
946-
export default function nosecone(options?: Options | undefined) {
946+
export function nosecone(options?: Options | undefined) {
947947
let contentSecurityPolicy =
948948
options?.contentSecurityPolicy ?? defaults.contentSecurityPolicy;
949949
let crossOriginEmbedderPolicy =
@@ -1080,6 +1080,14 @@ export default function nosecone(options?: Options | undefined) {
10801080
return headers;
10811081
}
10821082

1083+
/**
1084+
* Create security headers.
1085+
*
1086+
* @deprecated
1087+
* Use the named export `nosecone` instead.
1088+
*/
1089+
export default nosecone;
1090+
10831091
/**
10841092
* Augment some Nosecone configuration with the values necessary for using the
10851093
* Vercel Toolbar.

nosecone/test/nosecone.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ test("nosecone", async function (t) {
4646
"createReferrerPolicy",
4747
"createStrictTransportSecurity",
4848
"createXssProtection",
49-
// TODO(@wooorm-arcjet): use named exports.
5049
"default",
5150
// TODO(@wooorm-arcjet): use a clearer name: defaults for what, function to generate them?
5251
"defaults",
52+
"nosecone",
5353
"withVercelToolbar",
5454
]);
5555
});

0 commit comments

Comments
 (0)