From ebc7ff2467a29a114781d19da756130a9815b4e9 Mon Sep 17 00:00:00 2001 From: Francois Best Date: Sun, 17 Nov 2024 08:37:13 +0100 Subject: [PATCH] chore: Unbundle & let tsc transpile the output --- packages/nuqs/package.json | 2 +- packages/nuqs/src/adapters/custom.ts | 2 ++ packages/nuqs/src/adapters/next.ts | 2 ++ packages/nuqs/src/adapters/next/app.ts | 2 ++ packages/nuqs/src/adapters/next/impl.app.ts | 4 +++- packages/nuqs/src/adapters/next/pages.ts | 2 ++ packages/nuqs/src/adapters/react-router.ts | 1 + packages/nuqs/src/adapters/react.ts | 2 ++ packages/nuqs/src/adapters/remix.ts | 2 ++ packages/nuqs/src/index.ts | 1 + packages/nuqs/src/{index.server.ts => server.ts} | 0 packages/nuqs/tsconfig.build.json | 7 +++++++ 12 files changed, 25 insertions(+), 2 deletions(-) rename packages/nuqs/src/{index.server.ts => server.ts} (100%) diff --git a/packages/nuqs/package.json b/packages/nuqs/package.json index 2aa246d17..512f4dd22 100644 --- a/packages/nuqs/package.json +++ b/packages/nuqs/package.json @@ -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", diff --git a/packages/nuqs/src/adapters/custom.ts b/packages/nuqs/src/adapters/custom.ts index 80664974f..52b9eb2da 100644 --- a/packages/nuqs/src/adapters/custom.ts +++ b/packages/nuqs/src/adapters/custom.ts @@ -1,3 +1,5 @@ +'use client' + export { renderQueryString } from '../url-encoding' export type { AdapterInterface as unstable_AdapterInterface, diff --git a/packages/nuqs/src/adapters/next.ts b/packages/nuqs/src/adapters/next.ts index 62bfa2c6f..5a53606e3 100644 --- a/packages/nuqs/src/adapters/next.ts +++ b/packages/nuqs/src/adapters/next.ts @@ -1,3 +1,5 @@ +'use client' + import type { AdapterInterface } from './defs' import { createAdapterProvider } from './internal.context' import { useNuqsNextAppRouterAdapter } from './next/impl.app' diff --git a/packages/nuqs/src/adapters/next/app.ts b/packages/nuqs/src/adapters/next/app.ts index 68910ca42..eb28f5458 100644 --- a/packages/nuqs/src/adapters/next/app.ts +++ b/packages/nuqs/src/adapters/next/app.ts @@ -1,3 +1,5 @@ +'use client' + import { createAdapterProvider } from '../internal.context' import { useNuqsNextAppRouterAdapter } from './impl.app' diff --git a/packages/nuqs/src/adapters/next/impl.app.ts b/packages/nuqs/src/adapters/next/impl.app.ts index eee281e3c..3be7e4b47 100644 --- a/packages/nuqs/src/adapters/next/impl.app.ts +++ b/packages/nuqs/src/adapters/next/impl.app.ts @@ -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' diff --git a/packages/nuqs/src/adapters/next/pages.ts b/packages/nuqs/src/adapters/next/pages.ts index 4e1e17634..5148850bf 100644 --- a/packages/nuqs/src/adapters/next/pages.ts +++ b/packages/nuqs/src/adapters/next/pages.ts @@ -1,3 +1,5 @@ +'use client' + import { createAdapterProvider } from '../internal.context' import { useNuqsNextPagesRouterAdapter } from './impl.pages' diff --git a/packages/nuqs/src/adapters/react-router.ts b/packages/nuqs/src/adapters/react-router.ts index a2c9041d8..ca9caffca 100644 --- a/packages/nuqs/src/adapters/react-router.ts +++ b/packages/nuqs/src/adapters/react-router.ts @@ -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' diff --git a/packages/nuqs/src/adapters/react.ts b/packages/nuqs/src/adapters/react.ts index b35818eba..7afa63c6a 100644 --- a/packages/nuqs/src/adapters/react.ts +++ b/packages/nuqs/src/adapters/react.ts @@ -1,3 +1,5 @@ +'use client' + import mitt from 'mitt' import { useEffect, useState } from 'react' import { renderQueryString } from '../url-encoding' diff --git a/packages/nuqs/src/adapters/remix.ts b/packages/nuqs/src/adapters/remix.ts index 4598c3417..fc4e09dec 100644 --- a/packages/nuqs/src/adapters/remix.ts +++ b/packages/nuqs/src/adapters/remix.ts @@ -1,3 +1,5 @@ +'use client' + import { useNavigate, useSearchParams } from '@remix-run/react' import { renderQueryString } from '../url-encoding' import type { AdapterOptions } from './defs' diff --git a/packages/nuqs/src/index.ts b/packages/nuqs/src/index.ts index b8bc6f515..055299c62 100644 --- a/packages/nuqs/src/index.ts +++ b/packages/nuqs/src/index.ts @@ -1,3 +1,4 @@ +'use client' export type { HistoryOptions, Nullable, Options, SearchParams } from './defs' export * from './parsers' export { createSerializer } from './serializer' diff --git a/packages/nuqs/src/index.server.ts b/packages/nuqs/src/server.ts similarity index 100% rename from packages/nuqs/src/index.server.ts rename to packages/nuqs/src/server.ts diff --git a/packages/nuqs/tsconfig.build.json b/packages/nuqs/tsconfig.build.json index 3a6aa7974..6b5f6c05a 100644 --- a/packages/nuqs/tsconfig.build.json +++ b/packages/nuqs/tsconfig.build.json @@ -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"] }