Skip to content

Commit de21ae1

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

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

nosecone-next/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ export const defaults = {
2727
},
2828
} as const;
2929

30-
// We export `nosecone` as the default so it can be used with `new Response()`
30+
export { nosecone };
31+
32+
/**
33+
* Create security headers.
34+
*
35+
* @deprecated
36+
* Use the named export `nosecone` instead.
37+
*/
3138
export default nosecone;
3239

3340
function nonce() {

nosecone-next/test/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ test("@nosecone/next", async function (t) {
55
await t.test("should expose the public api", async function () {
66
assert.deepEqual(Object.keys(await import("../index.js")).sort(), [
77
"createMiddleware",
8-
// TODO(@wooorm-arcjet): use named exports.
98
"default",
109
// TODO(@wooorm-arcjet): use a clearer name: defaults for what, function to generate them?
1110
"defaults",
11+
"nosecone",
1212
"withVercelToolbar",
1313
]);
1414
});

0 commit comments

Comments
 (0)