Skip to content

Write HTML. Render video. Built for agents.

chore(lambda): publish-readiness for @hyperframes/aws-lambda

James405189953300
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 6b01b164be..9f9fd2a823 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -130,6 +130,7 @@ jobs:
publish_pkg "@hyperframes/producer" "@hyperframes/producer"
publish_pkg "@hyperframes/shader-transitions" "@hyperframes/shader-transitions"
publish_pkg "@hyperframes/studio" "@hyperframes/studio"
+ publish_pkg "@hyperframes/aws-lambda" "@hyperframes/aws-lambda"
# CLI is @hyperframes/cli in the monorepo but published as unscoped "hyperframes" on npm.
# Rewrite the name in package.json before publishing, then use npm publish directly
diff --git a/package.json b/package.json
index 916af0bde9..11ac3ade0b 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
"type": "module",
"scripts": {
"dev": "bun run studio",
- "build": "bun run --filter @hyperframes/core build && bun run --filter '@hyperframes/{core,engine,producer,player,studio,shader-transitions}' build && bun run --filter @hyperframes/cli build",
+ "build": "bun run --filter @hyperframes/core build && bun run --filter '@hyperframes/{core,engine,producer,player,studio,shader-transitions,aws-lambda}' build && bun run --filter @hyperframes/cli 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",
diff --git a/packages/aws-lambda/build.mjs b/packages/aws-lambda/build.mjs
new file mode 100644
index 0000000000..f6918a2480
--- /dev/null
+++ b/packages/aws-lambda/build.mjs
@@ -0,0 +1,62 @@
+#!/usr/bin/env node
+/**
+ * Build script for @hyperframes/aws-lambda (public OSS package).
+ *
+ * Bundles each subpath barrel via esbuild → dist/, then emits .d.ts via tsc.
+ *
+ * Subpaths (each gets its own dist entry so adopters that import one path
+ * don't load the others' transitive graphs at module-load time):
+ *
+ * . (the umbrella barrel: handler + sdk + cdk types re-exported)
+ * ./handler (the Lambda runtime entry — what `scripts/build-zip.ts` ZIPs)
+ * ./sdk (client-side helpers — AWS-SDK only, no chromium/puppeteer)
+ * ./cdk (CDK L2 construct — aws-cdk-lib is a peer dep)
+ *
+ * All production deps and peer deps are kept external so consumers resolve
+ * them via their own node_modules.
+ */
+
+import { build } from "esbuild";
+import { execSync } from "node:child_process";
+import { mkdirSync, rmSync } from "node:fs";
+
+rmSync("dist", { recursive: true, force: true });
+mkdirSync("dist", { recursive: true });
+
+const sharedOpts = {
+ bundle: true,
+ platform: "node",
+ target: "node22",
+ format: "esm",
+ minify: false,
+ sourcemap: true,
+ external: [
+ "@aws-sdk/client-s3",
+ "@aws-sdk/client-sfn",
+ "@hyperframes/producer",
+ "@hyperframes/producer/distributed",
+ "@sparticuz/chromium",
+ "aws-cdk-lib",
+ "constructs",
+ "ffmpeg-static",
+ "ffprobe-static",
+ "puppeteer-core",
+ "tar",
+ ],
+};
+
+await Promise.all([
+ build({ ...sharedOpts, entryPoints: ["src/index.ts"], outfile: "dist/index.js" }),
+ build({ ...sharedOpts, entryPoints: ["src/handler.ts"], outfile: "dist/handler.js" }),
+ build({ ...sharedOpts, entryPoints: ["src/sdk/index.ts"], outfile: "dist/sdk/index.js" }),
+ build({ ...sharedOpts, entryPoints: ["src/cdk/index.ts"], outfile: "dist/cdk/index.js" }),
+]);
+
+// esbuild doesn't emit .d.ts. tsc does, with a build-only tsconfig that
+// drops the workspace `paths` overrides so `@hyperframes/producer` resolves
+// through node_modules to the sibling package's already-built `dist/`
+// types instead of pulling its full source tree into emit (which would
+// violate rootDir).
+execSync("tsc -p tsconfig.build.json --emitDeclarationOnly", { stdio: "inherit" });
+
+console.log("[Build] Complete: dist/{index,handler,sdk/index,cdk/index}.js + .d.ts");
diff --git a/packages/aws-lambda/package.json b/packages/aws-lambda/package.json
index a94e096249..c027624e77 100644
--- a/packages/aws-lambda/package.json
+++ b/packages/aws-lambda/package.json
@@ -1,6 +1,6 @@
{
"name": "@hyperframes/aws-lambda",
- "version": "0.0.1",
+ "version": "0.6.18",
"description": "AWS Lambda adapter for HyperFrames distributed rendering — handler, client-side SDK, and CDK construct.",
"repository": {
"type": "git",
@@ -8,25 +8,37 @@
"directory": "packages/aws-lambda"
},
"files": [
- "src/",
+ "dist/",
"scripts/",
"README.md"
],
"type": "module",
- "main": "./src/index.ts",
- "types": "./src/index.ts",
+ "main": "./dist/index.js",
+ "types": "./dist/index.d.ts",
"exports": {
- ".": "./src/index.ts",
- "./handler": "./src/handler.ts",
- "./sdk": "./src/sdk/index.ts",
- "./cdk": "./src/cdk/index.ts"
+ ".": {
+ "import": "./dist/index.js",
+ "types": "./dist/index.d.ts"
+ },
+ "./handler": {
+ "import": "./dist/handler.js",
+ "types": "./dist/handler.d.ts"
+ },
+ "./sdk": {
+ "import": "./dist/sdk/index.js",
+ "types": "./dist/sdk/index.d.ts"
+ },
+ "./cdk": {
+ "import": "./dist/cdk/index.js",
+ "types": "./dist/cdk/index.d.ts"
+ }
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"scripts": {
- "build": "tsc --noEmit",
+ "build": "node build.mjs",
"build:zip": "tsx scripts/build-zip.ts",
"probe:beginframe": "tsx scripts/probe-beginframe.ts",
"probe:beginframe:docker": "docker build -f scripts/probe-beginframe.dockerfile -t hyperframes-lambda-probe:local ../.. && docker run --rm hyperframes-lambda-probe:local",
diff --git a/packages/aws-lambda/tsconfig.build.json b/packages/aws-lambda/tsconfig.build.json
new file mode 100644
index 0000000000..c93bd474e6
--- /dev/null
+++ b/packages/aws-lambda/tsconfig.build.json
@@ -0,0 +1,12 @@
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "paths": {},
+ "noEmit": false,
+ "outDir": "./dist",
+ "rootDir": "./src",
+ "declaration": true,
+ "declarationMap": true,
+ "sourceMap": true
+ }
+}
diff --git a/packages/aws-lambda/tsconfig.json b/packages/aws-lambda/tsconfig.json
index faa4cf6d78..b15c984cb9 100644
--- a/packages/aws-lambda/tsconfig.json
+++ b/packages/aws-lambda/tsconfig.json
@@ -15,5 +15,5 @@
}
},
"include": ["src/**/*"],
- "exclude": ["node_modules", "dist", "src/**/*.test.ts", "scripts"]
+ "exclude": ["node_modules", "dist", "src/**/*.test.ts", "src/**/__fixtures__/**", "scripts"]
}