Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Support moduleResolution: bundler #719

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/nuqs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"scripts": {
"dev": "tsup --watch",
"prebuild": "rm -rf dist",
"build": "tsup",
"build": "tsc --project tsconfig.build.json",
"postbuild": "size-limit --json > size.json",
"test": "pnpm run '/^test:/'",
"test:types": "tsd",
Expand Down
2 changes: 2 additions & 0 deletions packages/nuqs/src/adapters/custom.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

export { renderQueryString } from '../url-encoding'
export type {
AdapterInterface as unstable_AdapterInterface,
Expand Down
12 changes: 10 additions & 2 deletions packages/nuqs/src/adapters/internal.context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { createContext, createElement, useContext, type ReactNode } from 'react'
import {
createContext,
createElement,
useContext,
type FC,
type ReactNode
} from 'react'
import { error } from '../errors'
import type { UseAdapterHook } from './defs'

Expand All @@ -21,7 +27,9 @@ context.displayName = 'NuqsAdapterContext'
* @param useAdapter
* @returns
*/
export function createAdapterProvider(useAdapter: UseAdapterHook) {
export function createAdapterProvider(
useAdapter: UseAdapterHook
): FC<{ children: ReactNode }> {
return ({ children, ...props }: { children: ReactNode }) =>
createElement(
context.Provider,
Expand Down
2 changes: 2 additions & 0 deletions packages/nuqs/src/adapters/next.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import type { AdapterInterface } from './defs'
import { createAdapterProvider } from './internal.context'
import { useNuqsNextAppRouterAdapter } from './next/impl.app'
Expand Down
2 changes: 2 additions & 0 deletions packages/nuqs/src/adapters/next/app.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { createAdapterProvider } from '../internal.context'
import { useNuqsNextAppRouterAdapter } from './impl.app'

Expand Down
4 changes: 3 additions & 1 deletion packages/nuqs/src/adapters/next/impl.app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use client'

import { useRouter, useSearchParams } from 'next/navigation'
import { useCallback, useOptimistic, startTransition } from 'react'
import { startTransition, useCallback, useOptimistic } from 'react'
import { debug } from '../../debug'
import type { AdapterInterface, UpdateUrlFunction } from '../defs'
import { renderURL } from './shared'
Expand Down
2 changes: 2 additions & 0 deletions packages/nuqs/src/adapters/next/pages.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { createAdapterProvider } from '../internal.context'
import { useNuqsNextPagesRouterAdapter } from './impl.pages'

Expand Down
1 change: 1 addition & 0 deletions packages/nuqs/src/adapters/react-router.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Note: this default react-router adapter is for react-router v6.
// If you are using react-router v7, please import from `nuqs/adapters/react-router/v7`
'use client'

import { useNavigate, useSearchParams } from 'react-router-dom'
import { renderQueryString } from '../url-encoding'
Expand Down
2 changes: 2 additions & 0 deletions packages/nuqs/src/adapters/react.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import mitt from 'mitt'
import { useEffect, useState } from 'react'
import { renderQueryString } from '../url-encoding'
Expand Down
2 changes: 2 additions & 0 deletions packages/nuqs/src/adapters/remix.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { useNavigate, useSearchParams } from '@remix-run/react'
import { renderQueryString } from '../url-encoding'
import type { AdapterOptions } from './defs'
Expand Down
1 change: 1 addition & 0 deletions packages/nuqs/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client'
export type { HistoryOptions, Nullable, Options, SearchParams } from './defs'
export * from './parsers'
export { createSerializer } from './serializer'
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions packages/nuqs/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": false,
"outDir": "dist",
"declaration": true,
"declarationMap": false,
"incremental": false
},
"include": ["src/**/*.ts"],
"exclude": ["src/tests", "src/**/*.test.ts", "src/**/*.test.tsx"]
}
2 changes: 1 addition & 1 deletion packages/nuqs/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { defineConfig, type Options } from 'tsup'

const commonConfig = {
format: ['esm'],
experimentalDts: true,
dts: true,
outDir: 'dist',
external: [
'next',
Expand Down
Loading