diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 55db153..7ce6044 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,6 +45,8 @@ jobs: npm run build:esm echo '{"type": "commonjs"}' > dist/commonjs/package.json echo '{"type": "module"}' > dist/module/package.json + npm i --no-save dts-bundle-generator + npx dts-bundle-generator -o dist/index.d.ts src/index.ts mkdir dest npm pack --pack-destination=dest - name: Typedoc diff --git a/package.json b/package.json index 351b279..5e5dd1e 100644 --- a/package.json +++ b/package.json @@ -13,10 +13,18 @@ "homepage": "https://github.com/malthe/ts-postgres", "author": "Malthe Borch ", "main": "./dist/module/index.js", - "types": "./dist/module/index.d.ts", + "types": "./dist/index.d.ts", "exports": { - "require": "./dist/commonjs/index.js", - "import": "./dist/module/index.js" + ".": { + "require": { + "types": "./dist/index.d.ts", + "default": "./dist/commonjs/index.js" + }, + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/module/index.js" + } + } }, "files": [ "/dist" @@ -58,6 +66,7 @@ "@typescript-eslint/eslint-plugin": "^6", "@typescript-eslint/parser": "^6", "colors": "^1", + "dts-bundle-generator": "^9.3.1", "eslint": "^8", "eslint-config-standard": "^17", "eslint-plugin-import": "^2", diff --git a/src/client.ts b/src/client.ts index 8f67431..dfefd5a 100644 --- a/src/client.ts +++ b/src/client.ts @@ -40,7 +40,6 @@ import { } from './protocol.js'; import { - BufferEncoding, DataFormat, DataType, ValueTypeReader, diff --git a/src/index.ts b/src/index.ts index 44a5488..1a3c217 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,7 +14,6 @@ import type { Configuration } from './client.js'; export { DataFormat, DataType, - type BufferEncoding, type Point, type ValueTypeReader, } from './types.js'; diff --git a/src/protocol.ts b/src/protocol.ts index 6d0b150..3d835d6 100644 --- a/src/protocol.ts +++ b/src/protocol.ts @@ -8,7 +8,6 @@ import { sum } from './utils.js'; import { arrayDataTypeMapping, isPoint, - BufferEncoding, DataFormat, DataType, ValueTypeReader, diff --git a/src/types.ts b/src/types.ts index 7a9bf9a..56cfedb 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,10 +1,5 @@ import { Buffer } from 'node:buffer'; -// This type isn't really exposed, but we can tease it out using some type gymnastics. -export type BufferEncoding = NonNullable< - Required[0]> ->; - export const enum DataType { Bool = 16, Bytea = 17, diff --git a/tsconfig.json b/tsconfig.json index e9585db..f5dab63 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,7 @@ "strict": true, "sourceMap": true, "inlineSourceMap": false, - "declaration": true, + "declaration": false, "noImplicitAny": true, "isolatedModules": true, "noUnusedParameters": true,