Skip to content

Commit

Permalink
ref: Move all other server exports under a single (explicit) path
Browse files Browse the repository at this point in the history
  • Loading branch information
franky47 committed Jan 1, 2025
1 parent 8d07519 commit 697736a
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 26 deletions.
11 changes: 3 additions & 8 deletions packages/nuqs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,9 @@
"import": "./dist/server/cache.js",
"require": "./esm-only.cjs"
},
"./server/serializer": {
"types": "./dist/server/serializer.d.ts",
"import": "./dist/server/serializer.js",
"require": "./esm-only.cjs"
},
"./server/parsers": {
"types": "./dist/server/parsers.d.ts",
"import": "./dist/server/parsers.js",
"./server/temporary-react-agnostic": {
"types": "./dist/server/temporary-react-agnostic.d.ts",
"import": "./dist/server/temporary-react-agnostic.js",
"require": "./esm-only.cjs"
},
"./adapters/react": {
Expand Down
4 changes: 2 additions & 2 deletions packages/nuqs/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Why just the cache here?
Those "top-level" .d.ts files are used to help projects with `moduleResolution: 'node'`
resolve the correct imports.

The other two imports under server, `nuqs/server/parsers` and `nuqs/server/serializer`
are temporary and will be removed in [email protected].
The other import under server, `nuqs/server/temporary-react-agnostic`
is temporary (as it says on the tin) and will be removed in [email protected].

Also, [email protected] will require a `moduleResolution: 'bundler' | 'nodeNext` setting in your tsconfig.json.
1 change: 0 additions & 1 deletion packages/nuqs/src/index.server.cache.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { createSearchParamsCache } from './cache'
export type { HistoryOptions, Nullable, Options, SearchParams } from './defs'
2 changes: 0 additions & 2 deletions packages/nuqs/src/index.server.parsers.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/nuqs/src/index.server.serializer.ts

This file was deleted.

24 changes: 16 additions & 8 deletions packages/nuqs/src/index.server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
/** @deprecated Import createSearchParamsCache from 'nuqs/server/cache' instead.
*
* This export will be removed from 'nuqs/server' in [email protected],
* to allow non-Next.js server code to use the parsers, serializeres and other
* server-side utilities without depending on React canary for the `cache` function.
*/
export { createSearchParamsCache } from './cache'
export type { HistoryOptions, Nullable, Options, SearchParams } from './defs'
export {
/** @deprecated Import createSearchParamsCache from 'nuqs/server/cache' instead.
*
* This export will be removed from 'nuqs/server' in [email protected],
* to allow non-Next.js server code to use the parsers, serializeres and other
* server-side utilities without depending on React canary for the `cache` function.
*/
createSearchParamsCache
} from './cache'
export type {
HistoryOptions,
Nullable,
Options,
SearchParams,
UrlKeys
} from './defs'
export {
createLoader,
type LoaderFunction,
Expand Down
15 changes: 15 additions & 0 deletions packages/nuqs/src/index.temporary-react-agnostic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export type {
HistoryOptions,
Nullable,
Options,
SearchParams,
UrlKeys
} from './defs'
export {
createLoader,
type LoaderFunction,
type LoaderInput,
type LoaderOptions
} from './loader'
export * from './parsers'
export { createSerializer } from './serializer'
8 changes: 7 additions & 1 deletion packages/nuqs/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
export type { HistoryOptions, Nullable, Options, SearchParams } from './defs'
export type {
HistoryOptions,
Nullable,
Options,
SearchParams,
UrlKeys
} from './defs'
export {
createLoader,
type LoaderFunction,
Expand Down
3 changes: 1 addition & 2 deletions packages/nuqs/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ const entrypoints = {
server: {
server: 'src/index.server.ts',
'server/cache': 'src/index.server.cache.ts',
'server/parsers': 'src/index.server.parsers.ts',
'server/serializer': 'src/index.server.serializer.ts'
'server/temporary-react-agnostic': 'src/index.temporary-react-agnostic.ts'
}
}

Expand Down

0 comments on commit 697736a

Please sign in to comment.