Skip to content

Commit 75129d4

Browse files
huozhihimanshiLt
authored andcommitted
build: output mutation cjs bundle with named exports (vercel#1926)
1 parent 6895b99 commit 75129d4

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

mutation/index.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import {
1515
MutationFetcher
1616
} from './types'
1717

18-
const mutation =
19-
<Data, Error>() =>
18+
const mutation = (<Data, Error>() =>
2019
(
2120
key: Key,
2221
fetcher: MutationFetcher<Data>,
@@ -112,11 +111,8 @@ const mutation =
112111
return currentState.isMutating
113112
}
114113
}
115-
}
114+
}) as unknown as Middleware
116115

117-
export default withMiddleware(
118-
useSWR,
119-
mutation as unknown as Middleware
120-
) as unknown as SWRMutationHook
116+
export default withMiddleware(useSWR, mutation) as unknown as SWRMutationHook
121117

122-
export { SWRMutationConfiguration, SWRMutationResponse }
118+
export { SWRMutationConfiguration, SWRMutationResponse, SWRMutationHook }

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"@types/react": "17.0.20",
9999
"@typescript-eslint/eslint-plugin": "5.8.0",
100100
"@typescript-eslint/parser": "5.8.0",
101-
"bunchee": "1.8.2",
101+
"bunchee": "1.8.3",
102102
"eslint": "8.3.0",
103103
"eslint-config-prettier": "8.3.0",
104104
"eslint-plugin-jest-dom": "3.9.2",

yarn.lock

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,10 +2296,10 @@ builtin-modules@^3.1.0:
22962296
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.2.0.tgz#45d5db99e7ee5e6bc4f362e008bf917ab5049887"
22972297
integrity sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==
22982298

2299-
2300-
version "1.8.2"
2301-
resolved "https://registry.yarnpkg.com/bunchee/-/bunchee-1.8.2.tgz#7423e40de5635640c7c792322baf1089f51ca3e0"
2302-
integrity sha512-i8NfUIQcC7VIGbninHTzM/PnEHD+b0pkCcSMVKb5N8nAK6On32f2N3vHczzYk0FcwxuIt27r2zB0yTMErLTfSA==
2299+
2300+
version "1.8.3"
2301+
resolved "https://registry.yarnpkg.com/bunchee/-/bunchee-1.8.3.tgz#430f1c741b8d048ce158ee883e2f4389380b13f8"
2302+
integrity sha512-/kaA+TGhX75AUoGf5u/6KHqYIJjL8UEfCfnVS11cKjZB83NXWZGYMC2/vJhj1CkjBmr3xNoafuiDT6QY0WU7Kw==
23032303
dependencies:
23042304
"@rollup/plugin-babel" "5.2.1"
23052305
"@rollup/plugin-commonjs" "20.0.0"
@@ -6262,6 +6262,7 @@ supports-hyperlinks@^2.0.0:
62626262

62636263
"swr@link:.":
62646264
version "0.0.0"
6265+
uid ""
62656266

62666267
symbol-observable@^1.1.0:
62676268
version "1.2.0"

0 commit comments

Comments
 (0)