mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-10-30 17:27:09 +00:00
* fix(build): ship NodeNext-resolvable declarations from every package tsc copies relative specifiers verbatim, so packages whose sources use bundler-style extensionless imports (core, inspector) published .d.ts files that a module/moduleResolution nodenext consumer cannot resolve. Core already rewrote its emitted JavaScript for this, but not its declarations. Move that rewrite to scripts/rewrite-relative-import-extensions.mjs, make it cover .d.ts too (adding .js or /index.js, and failing the build when a declaration import has no declaration), and run it after every tsc emit: core, engine, sdk, producer, aws-lambda, gcp-cloud-run and inspector. verify:packed-manifests now typechecks the clean packed consumer with skipLibCheck false and type-only imports of every typed subpath, so an unresolvable import inside a published declaration fails the gate and is attributed to its package. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * chore(ci): allow the moved core rewrite-esm-extensions script deletion Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * ci: rebuild the edit-accuracy bench when the import-extension rewriter changes The package builds now run scripts/rewrite-relative-import-extensions.mjs, so main's edit_accuracy paths filter has to include it (check-edit-accuracy-filter test). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
65 lines
2.2 KiB
JavaScript
65 lines
2.2 KiB
JavaScript
#!/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,
|
|
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 && node ../../scripts/rewrite-relative-import-extensions.mjs dist",
|
|
{ stdio: "inherit" },
|
|
);
|
|
|
|
console.log("[Build] Complete: dist/{index,handler,sdk/index,cdk/index}.js + .d.ts");
|