mirror of
https://github.com/hanzoai/frames.git
synced 2026-09-24 00:08:03 +00:00
The npm scope becomes @hanzo: the CLI is @hanzo/frame, every library is @hanzo/frame-<name>. Versions go to 0.7.82. Credentials come from Hanzo IAM. `hanzo login` runs the IAM device flow and writes ~/.hanzo/credentials.json; unattended runs read HANZO_API_KEY delivered from Hanzo KMS. src/api.ts is the one place that knows the base URL and the credential, replacing the OAuth client, PKCE flow, loopback server, token store, and ~/.heygen credential file. `frames auth` keeps only `status`, since this CLI no longer issues credentials. Publish and feedback post to api.hanzo.ai/v1 without the HeyGen routing header. The HeyGen-hosted `frames cloud` render target is gone; local, AWS Lambda, and Google Cloud Run remain. Voice resolves to Hanzo speech (POST /v1/audio/speech) before local Kokoro; music resolves to local MusicGen. No analytics project is configured, so the CLI and studio send no events — they previously reported to HeyGen's. Drops the HeyGen wordmark from the studio header and the HeyGen promo render fixture with its brand assets and fonts.
109 lines
3.4 KiB
JavaScript
109 lines
3.4 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { describe, it } from "node:test";
|
|
import {
|
|
descriptorFromManifest,
|
|
exportsFromDescriptor,
|
|
sourceAliasEntries,
|
|
} from "./package-subpaths.mjs";
|
|
|
|
describe("package subpath contracts", () => {
|
|
const descriptor = {
|
|
package: "@hanzo/frame-example",
|
|
subpaths: {
|
|
".": {
|
|
source: "./src/index.ts",
|
|
runtime: "./dist/index.js",
|
|
types: "./dist/index.d.ts",
|
|
environments: ["browser", "bun", "node"],
|
|
},
|
|
"./browser": {
|
|
source: "./src/browser.ts",
|
|
runtime: "./dist/browser.js",
|
|
types: "./dist/browser.d.ts",
|
|
environments: ["browser", "bun"],
|
|
},
|
|
"./package.json": {
|
|
source: "./package.json",
|
|
runtime: "./package.json",
|
|
types: null,
|
|
environments: ["browser", "bun", "node"],
|
|
},
|
|
"./prebuilt": {
|
|
source: "./dist/prebuilt.js",
|
|
runtime: {
|
|
import: "./dist/prebuilt.js",
|
|
require: "./dist/prebuilt.cjs",
|
|
script: "./dist/prebuilt.global.js",
|
|
},
|
|
types: "./dist/prebuilt.d.ts",
|
|
environments: ["browser", "bun", "node"],
|
|
},
|
|
},
|
|
};
|
|
|
|
it("generates local and published exports from one descriptor", () => {
|
|
assert.deepEqual(exportsFromDescriptor(descriptor), {
|
|
local: {
|
|
".": {
|
|
bun: "./src/index.ts",
|
|
import: "./src/index.ts",
|
|
types: "./src/index.ts",
|
|
},
|
|
"./browser": {
|
|
browser: "./src/browser.ts",
|
|
bun: "./src/browser.ts",
|
|
import: "./src/browser.ts",
|
|
types: "./src/browser.ts",
|
|
},
|
|
"./package.json": "./package.json",
|
|
"./prebuilt": {
|
|
types: "./dist/prebuilt.d.ts",
|
|
import: "./dist/prebuilt.js",
|
|
require: "./dist/prebuilt.cjs",
|
|
script: "./dist/prebuilt.global.js",
|
|
},
|
|
},
|
|
published: {
|
|
".": { import: "./dist/index.js", types: "./dist/index.d.ts" },
|
|
"./browser": { import: "./dist/browser.js", types: "./dist/browser.d.ts" },
|
|
"./package.json": "./package.json",
|
|
"./prebuilt": {
|
|
types: "./dist/prebuilt.d.ts",
|
|
import: "./dist/prebuilt.js",
|
|
require: "./dist/prebuilt.cjs",
|
|
script: "./dist/prebuilt.global.js",
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
it("derives exact build aliases from selected public subpaths", () => {
|
|
assert.deepEqual(sourceAliasEntries(descriptor, "/repo/packages/example", ["./browser"]), [
|
|
["@hanzo/frame-example/browser", "/repo/packages/example/src/browser.ts"],
|
|
]);
|
|
});
|
|
|
|
it("preserves packages that intentionally resolve local Node imports from dist", () => {
|
|
const nodeRuntimeDescriptor = { ...descriptor, localNodeRuntime: true };
|
|
const generated = exportsFromDescriptor(nodeRuntimeDescriptor);
|
|
assert.equal(generated.local["."].node, "./dist/index.js");
|
|
assert.equal(
|
|
descriptorFromManifest({
|
|
name: nodeRuntimeDescriptor.package,
|
|
exports: generated.local,
|
|
publishConfig: { exports: generated.published },
|
|
}).localNodeRuntime,
|
|
true,
|
|
);
|
|
});
|
|
|
|
it("round-trips an existing dual manifest into a descriptor", () => {
|
|
const manifest = {
|
|
name: "@hanzo/frame-example",
|
|
exports: exportsFromDescriptor(descriptor).local,
|
|
publishConfig: { exports: exportsFromDescriptor(descriptor).published },
|
|
};
|
|
assert.deepEqual(descriptorFromManifest(manifest), descriptor);
|
|
});
|
|
});
|