Skip to content

The VS Code of video editing, built for agents.

TypeScript

Update package.json and README.md for improved build and documentation

konstantin-paulusc023aa9950d8
diff --git a/packages/jsx/README.md b/packages/jsx/README.md
index be30ebc3..59639593 100644
--- a/packages/jsx/README.md
+++ b/packages/jsx/README.md
@@ -1,31 +1,5 @@
# @diffusionstudio/jsx
-JSX runtime, types, and declarative generated assets for authoring
-[Diffusion Studio](https://diffusion.studio) compositions as code. Projects
-written against this package are compiled and mounted into the running editor
-with `dapi mount`; every JSX element becomes an editable node in the
-composition — there is no hidden DOM, no CSS resolution, and no measuring pass.
-
-```tsx
-import { generate } from "@diffusionstudio/jsx";
-
-const hero = generate.image({ prompt: "A neon city at night, cinematic" });
-
-export default function Project() {
- return (
- <rect scene="intro" name="Intro" width={1920} height={1080}>
- <image src={hero} />
- <text textAlign="center" textBaseline="middle" fontSize={128} fontWeight="bold">
- Hello World
- </text>
- <captions />
- </rect>
- );
-}
-```
-
-## Setup
-
The editor supplies the runtime when a project is mounted, so this package is
needed for **types and tooling** — IntelliSense, `tsc --noEmit`, and testing
components outside the editor.
@@ -44,35 +18,6 @@ npm install --save-dev @diffusionstudio/jsx solid-js
}
```
-## Generated assets
-
-A `generate.*` call is pure: it validates its options and returns an
-`AssetRef` value that is passed wherever a source is expected (`src`,
-`startFrame`, `endFrame`, `refs`). Nothing generates until the mounted tree
-commits; refs never used by a mounted element are dropped.
-
-## Documentation
-
-See the JSX API specification shipped with the Diffusion Studio CLI for the
-full element reference, timing model, media source resolution, and the
-`generate.*` declaration API.
-
-## Testing outside the editor
-
-`renderProject` renders a component into any `ProjectDocument` implementation,
-so a test can supply a lightweight in-memory document and assert on what the
-renderer wrote into it:
-
-```ts
-import { renderProject } from "@diffusionstudio/jsx";
-import type { ProjectDocument } from "@diffusionstudio/jsx";
-import Project from "./project";
-
-const document: ProjectDocument = /* your in-memory implementation */;
-const dispose = renderProject(Project, document);
-dispose();
-```
-
## License
[MPL-2.0](./LICENSE)
diff --git a/packages/jsx/package.json b/packages/jsx/package.json
index a86bbe34..907a0f1f 100644
--- a/packages/jsx/package.json
+++ b/packages/jsx/package.json
@@ -13,9 +13,15 @@
"./jsx-runtime": "./src/jsx-runtime.ts",
"./jsx-dev-runtime": "./src/jsx-runtime.ts"
},
+ "publishConfig": {
+ "access": "public"
+ },
"scripts": {
"build": "tsc -p tsconfig.build.json",
- "check": "tsc --noEmit"
+ "check": "tsc --noEmit",
+ "prepublishOnly": "npm run build",
+ "prepack": "node scripts/prepack.mjs",
+ "postpack": "node scripts/postpack.mjs"
},
"keywords": [
"diffusion-studio",
diff --git a/packages/jsx/scripts/postpack.mjs b/packages/jsx/scripts/postpack.mjs
new file mode 100644
index 00000000..ef8ad8f9
--- /dev/null
+++ b/packages/jsx/scripts/postpack.mjs
@@ -0,0 +1,6 @@
+import { renameSync } from "node:fs";
+
+renameSync(
+ new URL("../package.json.orig", import.meta.url),
+ new URL("../package.json", import.meta.url),
+);
diff --git a/packages/jsx/scripts/prepack.mjs b/packages/jsx/scripts/prepack.mjs
new file mode 100644
index 00000000..804c944b
--- /dev/null
+++ b/packages/jsx/scripts/prepack.mjs
@@ -0,0 +1,15 @@
+// npm ignores publishConfig field overrides, so the tarball's exports are
+// rewritten here to point at dist; postpack.mjs restores the src exports
+// that workspace consumers (Vite) rely on.
+import { copyFileSync, readFileSync, writeFileSync } from "node:fs";
+
+const pkgPath = new URL("../package.json", import.meta.url);
+copyFileSync(pkgPath, new URL("../package.json.orig", import.meta.url));
+
+const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
+pkg.exports = {
+ ".": { types: "./dist/index.d.ts", default: "./dist/index.js" },
+ "./jsx-runtime": { types: "./dist/jsx-runtime.d.ts", default: "./dist/jsx-runtime.js" },
+ "./jsx-dev-runtime": { types: "./dist/jsx-runtime.d.ts", default: "./dist/jsx-runtime.js" },
+};
+writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");