diff --git a/package.json b/package.json index 0c7b55d..5af174a 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,21 @@ "name": "@npm/types", "version": "1.0.2", "description": "Typescript definitions for npm registry content", - "types": "./src/index.d.ts", - "main": "", + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + } + }, "scripts": { "template-oss-apply": "template-oss-apply --force", "lintfix": "npm run lint -- --fix", @@ -48,5 +61,11 @@ "type": "module", "tap": { "typecheck": true + }, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } } } diff --git a/src/index.d.ts b/src/index.ts similarity index 100% rename from src/index.d.ts rename to src/index.ts diff --git a/test/test.ts b/test/test.ts index b9c1ddb..b813aec 100644 --- a/test/test.ts +++ b/test/test.ts @@ -3,7 +3,7 @@ import { join, dirname } from 'path' import { fileURLToPath } from 'url' import t from 'tap' -import type * as npm from '../src/index.d.ts' +import type * as npm from '../src/index.ts' t.test('types', async () => { const dir = dirname(fileURLToPath(import.meta.url))