yukey

testkit: explicit exports, .js import suffix, shorter description

commit 50823648d1cf15325f352a637c589437de6e61ec · parent 1fba87a472 · browse this tree
Ximianth, 2026-10-10 05:41:57 UTC

One exports entry per module instead of the ./* wildcard, so the map is the
source of truth for what the package contains (and .map/.d.ts paths stop
resolving as import specifiers).

The relative import now says .js, and rewriteRelativeImportExtensions is gone:
with the flag, declaration emit kept the .ts suffix in dist/*.d.ts, which
worked but was a trap for the next reader of dist/.  Checked: dist/checks.d.ts
now says ./cdp.js.

prepack cleans before building; a stale dist/gallery.* from an earlier build
was otherwise still in the tarball.
diff --git a/packages/yukey-testkit/package.json b/packages/yukey-testkit/package.json
index b9ec65b..d81f38c 100644
--- a/packages/yukey-testkit/package.json
+++ b/packages/yukey-testkit/package.json
@@ -1,14 +1,24 @@
 {
 	"name": "yukey-testkit",
 	"version": "0.0.0",
-	"description": "a dependency-free CDP client for driving a page with trusted input and reading state between steps; built for testing yukey apps, usable on any page",
+	"description": "a dependency-free CDP client for driving a page with trusted input and reading state between steps",
 	"license": "Apache-2.0 OR MIT",
 	"type": "module",
 	"exports": {
-		"./*": {
-			"yukey-source": "./src/*.ts",
-			"types": "./dist/*.d.ts",
-			"default": "./dist/*.js"
+		"./cdp": {
+			"yukey-source": "./src/cdp.ts",
+			"types": "./dist/cdp.d.ts",
+			"default": "./dist/cdp.js"
+		},
+		"./checks": {
+			"yukey-source": "./src/checks.ts",
+			"types": "./dist/checks.d.ts",
+			"default": "./dist/checks.js"
+		},
+		"./sleep": {
+			"yukey-source": "./src/sleep.ts",
+			"types": "./dist/sleep.d.ts",
+			"default": "./dist/sleep.js"
 		}
 	},
 	"files": [
@@ -22,7 +32,7 @@
 		"build": "tsc -p tsconfig.build.json",
 		"check": "tsc --noEmit",
 		"clean": "rm -rf dist",
-		"prepack": "npm run build"
+		"prepack": "npm run clean && npm run build"
 	},
 	"engines": {
 		"node": ">=22"
diff --git a/packages/yukey-testkit/src/checks.ts b/packages/yukey-testkit/src/checks.ts
index 261bb60..3a632e8 100644
--- a/packages/yukey-testkit/src/checks.ts
+++ b/packages/yukey-testkit/src/checks.ts
@@ -4,7 +4,7 @@
 
 import { mkdirSync, writeFileSync } from "node:fs";
 import { join } from "node:path";
-import type { Cdp } from "./cdp.ts";
+import type { Cdp } from "./cdp.js";
 
 export interface ScenarioContext {
 	cdp: Cdp;
diff --git a/packages/yukey-testkit/tsconfig.json b/packages/yukey-testkit/tsconfig.json
index b97fee7..d991313 100644
--- a/packages/yukey-testkit/tsconfig.json
+++ b/packages/yukey-testkit/tsconfig.json
@@ -7,7 +7,6 @@
 		"types": ["node"],
 		"strict": true,
 		"noUncheckedIndexedAccess": true,
-		"rewriteRelativeImportExtensions": true,
 		"noEmit": true
 	},
 	"include": ["src"]