Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.
TypeScript agentic-aiaiai-agentsai-videocompilerdslffmpeggenerative-aillmmarkup-languagemonorepoplugin-systemprogramming-languagetext-to-videotypescriptvideovideo-automationvideo-clonevideo-editingvideo-generation
fix(packaging): build public types within CI memory
kashorin4abc9b35c8a6
diff --git a/package.json b/package.jsonindex 3fb38f5a..1784f820 100644--- a/package.json+++ b/package.json@@ -135,7 +135,7 @@"test:image-opencv": "node test/run.mjs image-opencv","hypit": "node bin/hypit.mjs","studio": "pnpm --filter @hypit/studio exec node --import tsx start.ts",- "prepare": "npm run build:public-types"+ "prepack": "npm run build:public-types"},"engines": {"node": ">=22.12.0"@@ -229,7 +229,6 @@"@hypit/visual-ir": "workspace:*","@hypit/volcengine-matting": "workspace:*","@hypit/whisperx": "workspace:*",- "@rollup/plugin-node-resolve": "16.0.3","@types/node": "24.10.1","rollup": "4.62.4","rollup-plugin-dts": "6.2.3",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 7dbb7f12..15490c25 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -285,9 +285,6 @@ importers:'@hypit/whisperx':specifier: workspace:*version: link:packages/whisperx- '@rollup/plugin-node-resolve':- specifier: 16.0.3- version: 16.0.3([email protected])'@types/node':specifier: 24.10.1version: 24.10.1@@ -4823,24 +4820,6 @@ packages:'@rolldown/[email protected]':resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==}- '@rollup/[email protected]':- resolution: {integrity: sha512-lUYM3UBGuM93CnMPG1YocWu7X802BrNF3jW2zny5gQyLQgRFJhV1Sq0Zi74+dh/6NBx1DxFC4b4GXg9wUCG5Qg==}- engines: {node: '>=14.0.0'}- peerDependencies:- rollup: ^2.78.0||^3.0.0||^4.0.0- peerDependenciesMeta:- rollup:- optional: true-- '@rollup/[email protected]':- resolution: {integrity: sha512-MfPp06CjRLfXQ3wY0R8vJDYBy/MvVcc9OulEfR0B8Iv9ko+GCNaRZ+EpJYFl27LhKsZK0o420sYCRHCjfCgeUg==}- engines: {node: '>=14.0.0'}- peerDependencies:- rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0- peerDependenciesMeta:- rollup:- optional: true-'@rollup/[email protected]':resolution: {integrity: sha512-RrPokAb7dmbxFoeO3TloqHyOjgye8RkBhSqmp4aJMIex4c9r46ZstPnleDQOq1t46VOVjwIuwNogIqbodV1Vvg==}cpu: [arm]@@ -5058,9 +5037,6 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==}- '@types/[email protected]':- resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==}-'@types/[email protected]':resolution: {integrity: sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==}@@ -5369,10 +5345,6 @@ packages:supports-color:optional: true- resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==}- engines: {node: '>=0.10.0'}-resolution: {integrity: sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==}engines: {node: '>=18'}@@ -5559,9 +5531,6 @@ packages:engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}os: [darwin]- resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}-resolution: {integrity: sha512-RB5vLV+vvQeoFPCX4QMK6/hjVkbIamPp1QSUD0CiZcnj12qbpiL+pLbYtgD+oZkWl0tl9z+o2Utp+MpM3QRhBA==}engines: {node: '>=18'}@@ -5608,10 +5577,6 @@ packages:resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==}- resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==}- engines: {node: '>= 0.4'}-resolution: {integrity: sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==}@@ -5657,10 +5622,6 @@ packages:resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}- resolution: {integrity: sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==}- engines: {node: '>= 0.4'}-resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==}engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}@@ -5671,9 +5632,6 @@ packages:engines: {node: '>=14.16'}hasBin: true- resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==}-resolution: {integrity: sha512-oG7cgbmg5kLYae2N5IVd3jm2s+vldjxJzK1pcu9LfpGuQ93MQSzo0okvRna+7y5ifrD+20FE8FvjusyGaz14fw==}engines: {node: '>=18'}@@ -5890,9 +5848,6 @@ packages:resolution: {integrity: sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==}- resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}-resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==}@@ -5971,11 +5926,6 @@ packages:resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==}- resolution: {integrity: sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==}- engines: {node: '>= 0.4'}- hasBin: true-resolution: {integrity: sha512-gSfoiOEA0VPE6Tukkrr7I0RBdE0s7H1eFCDBk05l1KIQT1UIKNc5JZy6jdyW6eYH3aR3g5b3PuL77rq0hvwtAw==}@@ -6084,10 +6034,6 @@ packages:resolution: {integrity: sha512-H+ue8Zo4vJmV2nRjpx86P35lzwDT3nItnIsocgumgr0hHMQ+ZGq5vrERg9kJBo5AWGmxZDhzDo+WVIJqkB0cGA==}engines: {node: '>=16'}- resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}- engines: {node: '>= 0.4'}-resolution: {integrity: sha512-wieBHXygIm7OyQOu5hQlkk62/WyCFYGlWg7L6/ZCUZwx0o398Zkn4pVmMyfYhfMG8kGrj/Krt8eIk6UKC6VzwA==}@@ -7579,24 +7525,6 @@ snapshots:'@rolldown/[email protected]': {}- '@rollup/[email protected]([email protected])':- dependencies:- '@rollup/pluginutils': 5.4.0([email protected])- '@types/resolve': 1.20.2- deepmerge: 4.3.1- is-module: 1.0.0- resolve: 1.22.12- optionalDependencies:- rollup: 4.62.4-- '@rollup/[email protected]([email protected])':- dependencies:- '@types/estree': 1.0.9- estree-walker: 2.0.2- picomatch: 4.0.7- optionalDependencies:- rollup: 4.62.4-'@rollup/[email protected]':optional: true@@ -7782,8 +7710,6 @@ snapshots:dependencies:undici-types: 7.16.0- '@types/[email protected]': {}-'@types/[email protected]': {}'@types/[email protected]': {}@@ -8061,8 +7987,6 @@ snapshots:dependencies:ms: 2.1.3- [email protected]: {}-@@ -8307,8 +8231,6 @@ snapshots:optional: true- [email protected]: {}-dependencies:extend: 3.0.2@@ -8368,10 +8290,6 @@ snapshots:dependencies:es-define-property: 1.0.1- dependencies:- function-bind: 1.1.2-dependencies:'@types/hast': 3.0.5@@ -8457,18 +8375,12 @@ snapshots:- dependencies:- hasown: 2.0.4-dependencies:is-docker: 3.0.0- [email protected]: {}-@@ -8661,8 +8573,6 @@ snapshots:- [email protected]: {}-@@ -8767,13 +8677,6 @@ snapshots:- dependencies:- es-errors: 1.3.0- is-core-module: 2.16.2- path-parse: 1.0.7- supports-preserve-symlinks-flag: 1.0.0-@@ -8955,8 +8858,6 @@ snapshots:dependencies:copy-anything: 4.0.5- [email protected]: {}-diff --git a/scripts/build-public-type-entry.mjs b/scripts/build-public-type-entry.mjsnew file mode 100644index 00000000..b41c0570--- /dev/null+++ b/scripts/build-public-type-entry.mjs@@ -0,0 +1,48 @@+import { rollup } from "rollup";+import { dts } from "rollup-plugin-dts";+import { dirname, resolve } from "node:path";+import { fileURLToPath } from "node:url";++const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");+const declarationPackages = resolve(packageRoot, "dist/public-source/packages");++const serializedEntry = process.argv[2];+if (serializedEntry === undefined) {+ throw new Error("A serialized public type entry is required");+}++const entry = JSON.parse(serializedEntry);+if (entry === null || typeof entry !== "object"+ || typeof entry.name !== "string"+ || typeof entry.input !== "string"+ || typeof entry.output !== "string") {+ throw new Error("The public type entry is invalid");+}++const bundle = await rollup({+ input: entry.input,+ onwarn(warning, warn) {+ if (warning.code === "UNRESOLVED_IMPORT") {+ throw new Error(`${entry.name}: ${warning.message}`);+ }+ warn(warning);+ },+ plugins: [+ {+ name: "hypit-public-declarations",+ resolveId(source) {+ const match = /^@hypit\/([^/]+)$/.exec(source);+ return match === null+ ? null+ : resolve(declarationPackages, match[1], "src/index.d.ts");+ },+ },+ dts(),+ ],+});++try {+ await bundle.write({ file: entry.output, format: "es" });+} finally {+ await bundle.close();+}diff --git a/scripts/build-public-types.mjs b/scripts/build-public-types.mjsindex 88364ebc..d7905005 100644--- a/scripts/build-public-types.mjs+++ b/scripts/build-public-types.mjs@@ -1,14 +1,17 @@+import { spawn } from "node:child_process";import { mkdir, readFile, rm } from "node:fs/promises";import { dirname, isAbsolute, relative, resolve, sep } from "node:path";+import { createRequire } from "node:module";import { fileURLToPath } from "node:url";-import { nodeResolve } from "@rollup/plugin-node-resolve";-import { rollup } from "rollup";-import { dts } from "rollup-plugin-dts";-const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");const manifest = JSON.parse(await readFile(resolve(packageRoot, "package.json"), "utf8"));const outputRoot = resolve(packageRoot, "dist/public");+const declarationRoot = resolve(packageRoot, "dist/public-source");+const worker = resolve(packageRoot, "scripts/build-public-type-entry.mjs");+const publicTypeConfig = resolve(packageRoot, "scripts/tsconfig.public-types.json");+const require = createRequire(import.meta.url);+const typescriptCli = require.resolve("typescript/bin/tsc");function publicEntryTarget(name, declared) {if (typeof declared === "string") {@@ -35,29 +38,53 @@ const entries = Object.entries(manifest.exports ?? {}).map(([name, declared]) =>|| relativeOutput.startsWith(`..${sep}`) || isAbsolute(relativeOutput)) {throw new Error(`${name} writes outside dist/public`);}- return { name, input, output };+ const relativeInput = relative(packageRoot, input);+ if (relativeInput === "" || relativeInput === ".."+ || relativeInput.startsWith(`..${sep}`) || isAbsolute(relativeInput)+ || !relativeInput.endsWith(".ts")) {+ throw new Error(`${name} reads outside the Distribution TypeScript sources`);+ }+ const declarationInput = resolve(+ declarationRoot,+ `${relativeInput.slice(0, -3)}.d.ts`,+ );+ return { name, input: declarationInput, output };});+function run(label, executable, args) {+ return new Promise((fulfill, reject) => {+ const child = spawn(executable, args, {+ cwd: packageRoot,+ stdio: "inherit",+ });+ child.once("error", reject);+ child.once("exit", (code, signal) => {+ if (code === 0) {+ fulfill();+ return;+ }+ reject(new Error(+ signal === null+ ? `${label} exited with code ${String(code)}`+ : `${label} was terminated by ${signal}`,+ ));+ });+ });+}+await rm(outputRoot, { recursive: true, force: true });+await rm(declarationRoot, { recursive: true, force: true });await mkdir(outputRoot, { recursive: true });-for (const entry of entries) {- const bundle = await rollup({- input: entry.input,- onwarn(warning, warn) {- if (warning.code === "UNRESOLVED_IMPORT") {- throw new Error(`${entry.name}: ${warning.message}`);- }- warn(warning);- },- plugins: [- nodeResolve({ extensions: [".ts", ".d.ts", ".js"] }),- dts({ respectExternal: false }),- ],- });- try {- await bundle.write({ file: entry.output, format: "es" });- } finally {- await bundle.close();+try {+ await run("TypeScript declaration emit", process.execPath, [+ typescriptCli,+ "-p",+ publicTypeConfig,+ ]);+ for (const entry of entries) {+ await run(`${entry.name} type build`, process.execPath, [worker, JSON.stringify(entry)]);}+} finally {+ await rm(declarationRoot, { recursive: true, force: true });}diff --git a/scripts/tsconfig.public-types.json b/scripts/tsconfig.public-types.jsonnew file mode 100644index 00000000..f4aee740--- /dev/null+++ b/scripts/tsconfig.public-types.json@@ -0,0 +1,19 @@+{+ "extends": "../tsconfig.json",+ "compilerOptions": {+ "noEmit": false,+ "emitDeclarationOnly": true,+ "declaration": true,+ "declarationMap": false,+ "sourceMap": false,+ "rootDir": "..",+ "outDir": "../dist/public-source",+ "incremental": false+ },+ "include": [+ "../packages/*/src/**/*.ts"+ ],+ "exclude": [+ "../packages/*/test/**/*.ts"+ ]+}