build(inspector): publish @hyperframes/inspector to npm (#5530)

* build(inspector): publish @hyperframes/inspector to npm

* fix(inspector): drop prepack so pnpm pack --json stays parseable

* fix(inspector): add .js to published declaration imports for NodeNext

* fix(inspector): declare @hyperframes/parsers, which the published types import

* chore(fallow): ignore @hyperframes/parsers, which inspector's published types import
This commit is contained in:
Xuanru Li
2026-10-13 04:55:48 +00:00
committed by GitHub
parent 8e4de38be1
commit f31b3c982b
9 changed files with 91 additions and 7 deletions
+2
View File
@@ -453,6 +453,8 @@
"@hyperframes/core",
"@hyperframes/studio",
"@hyperframes/producer",
// Inspector's published declarations import it through the core sources they bundle.
"@hyperframes/parsers",
"@fontsource/archivo-black",
"@fontsource/eb-garamond",
"@fontsource/ibm-plex-mono",
+1
View File
@@ -153,6 +153,7 @@ jobs:
publish_pkg "@hyperframes/lint" "@hyperframes/lint"
publish_pkg "@hyperframes/studio-server" "@hyperframes/studio-server"
publish_pkg "@hyperframes/core" "@hyperframes/core"
publish_pkg "@hyperframes/inspector" "@hyperframes/inspector"
publish_pkg "@hyperframes/sdk" "@hyperframes/sdk"
publish_pkg "@hyperframes/engine" "@hyperframes/engine"
publish_pkg "@hyperframes/player" "@hyperframes/player"
+2 -1
View File
@@ -197,9 +197,10 @@
},
"packages/inspector": {
"name": "@hyperframes/inspector",
"version": "0.8.140",
"version": "0.8.150",
"dependencies": {
"@hyperframes/core": "workspace:*",
"@hyperframes/parsers": "workspace:*",
"@jridgewell/trace-mapping": "^0.3.29",
"acorn": "^8.17.0",
"esbuild": "^0.25.12",
+1 -1
View File
@@ -11,7 +11,7 @@
"type": "module",
"scripts": {
"dev": "bun run studio",
"build": "bun run --filter '@hyperframes/{parsers,lint,studio-server}' build && bun run --filter @hyperframes/core build && bun run --filter '@hyperframes/{engine,producer,player,studio,shader-transitions,aws-lambda,gcp-cloud-run,sdk}' build && bun run --filter @hyperframes/cli build && bun run --filter @hyperframes/sdk-playground build",
"build": "bun run --filter '@hyperframes/{parsers,lint,studio-server}' build && bun run --filter @hyperframes/core build && bun run --filter '@hyperframes/{engine,producer,player,studio,shader-transitions,aws-lambda,gcp-cloud-run,sdk,inspector}' build && bun run --filter @hyperframes/cli build && bun run --filter @hyperframes/sdk-playground build",
"build:producer": "bun run --filter @hyperframes/producer build",
"studio": "bun run --filter @hyperframes/studio dev",
"build:hyperframes-runtime": "bun run --filter @hyperframes/core build:hyperframes-runtime",
+34 -1
View File
@@ -1,7 +1,15 @@
// Builds the inspector for Node and for the page. Bun runs the TypeScript sources directly (package.json "bun").
import { execFileSync } from "node:child_process";
import { copyFileSync, readFileSync, rmSync } from "node:fs";
import {
copyFileSync,
existsSync,
readdirSync,
readFileSync,
rmSync,
writeFileSync,
} from "node:fs";
import { createRequire } from "node:module";
import { dirname, join } from "node:path";
import { build } from "esbuild";
const at = (path) => new URL(path, import.meta.url).pathname;
@@ -33,3 +41,28 @@ const tsc = createRequire(import.meta.url).resolve("typescript/bin/tsc");
execFileSync(process.execPath, [tsc, "-p", at("./tsconfig.types.json")], { stdio: "inherit" });
// tsc emits declarations for TypeScript only; the element map's JavaScript ships its own.
copyFileSync(at("./src/elementMap.d.ts"), at("./dist/types/inspector/src/elementMap.d.ts"));
addDeclarationExtensions(at("./dist/types"));
// NodeNext consumers reject extensionless relative imports, and tsc keeps the source's bundler-style ones.
function addDeclarationExtensions(dir) {
for (const entry of readdirSync(dir, { recursive: true })) {
const file = join(dir, entry);
if (!file.endsWith(".d.ts")) continue;
const source = readFileSync(file, "utf8");
const rewritten = source.replace(
/((?:from|import\()\s*["'])(\.{1,2}\/[^"']*)(["'])/g,
(whole, open, specifier, close) => {
const target = resolveDeclaration(dirname(file), specifier);
return target ? open + target + close : whole;
},
);
if (rewritten !== source) writeFileSync(file, rewritten);
}
}
function resolveDeclaration(from, specifier) {
if (/\.[cm]?js$/.test(specifier)) return undefined;
if (existsSync(join(from, `${specifier}.d.ts`))) return `${specifier}.js`;
if (existsSync(join(from, specifier, "index.d.ts"))) return `${specifier}/index.js`;
throw new Error(`No declaration for ${specifier} imported from ${from}`);
}
+20
View File
@@ -0,0 +1,20 @@
{
"package": "@hyperframes/inspector",
"subpaths": {
".": {
"source": "./src/service.ts",
"runtime": {
"default": "./dist/service.js"
},
"types": "./dist/types/inspector/src/service.d.ts",
"environments": ["bun", "node"]
},
"./live": {
"runtime": {
"default": "./dist/live.js"
},
"types": "./dist/types/inspector/src/live.d.ts",
"environments": ["node"]
}
}
}
+29 -4
View File
@@ -1,12 +1,24 @@
{
"name": "@hyperframes/inspector",
"version": "0.8.140",
"private": true,
"version": "0.8.150",
"repository": {
"type": "git",
"url": "https://github.com/heygen-com/hyperframes",
"directory": "packages/inspector"
},
"files": [
"dist/service.js",
"dist/live.js",
"dist/inspection.js",
"dist/types",
"README.md"
],
"type": "module",
"exports": {
".": {
"bun": "./src/service.ts",
"types": "./dist/types/inspector/src/service.d.ts",
"import": "./src/service.ts",
"types": "./src/service.ts",
"default": "./dist/service.js"
},
"./live": {
@@ -14,6 +26,19 @@
"default": "./dist/live.js"
}
},
"publishConfig": {
"access": "public",
"exports": {
".": {
"types": "./dist/types/inspector/src/service.d.ts",
"default": "./dist/service.js"
},
"./live": {
"types": "./dist/types/inspector/src/live.d.ts",
"default": "./dist/live.js"
}
}
},
"scripts": {
"build": "node build.mjs",
"test": "vitest run",
@@ -22,13 +47,13 @@
"mcp": "bun run build && bun src/mcp.ts",
"test:timeline": "bun tests/timeline.ts",
"test:timeline-compositions": "bun tests/timelineCompositions.ts",
"prepack": "node build.mjs",
"test:live": "bun run build && bun tests/live.ts",
"test:source-release": "bun tests/sourceRelease.ts",
"serve:node": "node dist/server.js"
},
"dependencies": {
"@hyperframes/core": "workspace:*",
"@hyperframes/parsers": "workspace:*",
"@jridgewell/trace-mapping": "^0.3.29",
"acorn": "^8.17.0",
"esbuild": "^0.25.12",
+1
View File
@@ -4,6 +4,7 @@
"@hyperframes/core": { "packed": 1636442, "unpacked": 3903211 },
"@hyperframes/engine": { "packed": 428347, "unpacked": 1436293 },
"@hyperframes/gcp-cloud-run": { "packed": 49412, "unpacked": 192672 },
"@hyperframes/inspector": { "packed": 808905, "unpacked": 3645432 },
"@hyperframes/lint": { "packed": 168745, "unpacked": 654607 },
"@hyperframes/parsers": { "packed": 190591, "unpacked": 831243 },
"@hyperframes/player": { "packed": 157145, "unpacked": 541601 },
+1
View File
@@ -25,6 +25,7 @@ const PACKAGES = [
"packages/lint",
"packages/studio-server",
"packages/core",
"packages/inspector",
"packages/engine",
"packages/player",
"packages/producer",