@designos/compiler-cli 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,69 @@
1
- # Temporary Holding Version
1
+ # DesignOS compiler CLI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The package exposes the `designos` command for build-time compilation. It reads either a version-1 IR project or a version-2 file-based TSX project, invokes the registered compiler for one target, writes generated modules and the target registry when one is registered, emits a neutral `manifests.json` map, then copies declared assets beneath a dedicated target directory in `dist`.
4
+
5
+ ```bash
6
+ pnpm --filter @designos/compiler-cli exec designos compile --target react
7
+ pnpm --filter @designos/compiler-cli exec designos compile --target vue --config designos.project.json --out-dir dist/designos/vue
8
+ ```
9
+
10
+ The command defaults to `designos.project.json` and `dist/designos/<target>`. `--out-dir` must be a dedicated subdirectory under the project’s `dist` directory. Existing generated files at matching paths are replaced; unrelated output files are left untouched. For version-1 projects, component `outputDirectory` values are relative to the target output root and default to `components`. For version-2 source projects, the default generated module directory follows the source file's relative directory, preserving relative imports. Declared asset `outputPath` values are relative to the target output root and default to their project-relative `source` path.
11
+
12
+ A minimal config has this shape:
13
+
14
+ ```json
15
+ {
16
+ "schemaVersion": "1",
17
+ "components": [
18
+ {
19
+ "manifest": { "type": "hero", "displayName": "Hero", "fields": [] },
20
+ "implementation": {
21
+ "kind": "ir",
22
+ "component": {
23
+ "version": "0.1",
24
+ "name": "Hero",
25
+ "imports": [],
26
+ "props": [],
27
+ "state": [],
28
+ "root": { "kind": "element", "tag": "section" }
29
+ }
30
+ },
31
+ "outputDirectory": "src/components",
32
+ "assets": [
33
+ { "source": "src/assets/hero-glow.png", "outputPath": "src/assets/hero-glow.png" }
34
+ ]
35
+ }
36
+ ]
37
+ }
38
+ ```
39
+
40
+ Project compilation currently emits a verified `components.ts` default-import registry for React and Vue. Other registered targets emit their target component artifacts and assets but no `components.ts` until their runtime module contract is verified. The compiler reports target semantic warnings; registration and code generation do not establish semantic parity.
41
+
42
+ ## Version-2 TSX source projects
43
+
44
+ Version `2` lets kit authors list TSX sources and JSON manifests instead of hand-authoring `ComponentIR` JSON. The compiler uses the repository-pinned Mitosis parser in TypeScript mode and retains its complete parsed component representation through target generation. DesignOS does not narrow away parser-supported Mitosis constructs such as state, events, lifecycle hooks, refs, context, subcomponents, slots, styles or target blocks. Target-specific capability gaps remain subject to diagnostics and the semantic audit.
45
+
46
+ Example `designos.project.json`:
47
+
48
+ ```json
49
+ {
50
+ "schemaVersion": "2",
51
+ "components": [
52
+ {
53
+ "source": "src/components/Banner.lite.tsx",
54
+ "exportName": "Banner",
55
+ "manifest": "src/components/Banner.designos.json",
56
+ "styles": [{ "source": "src/components/Banner.css" }],
57
+ "assets": [{ "source": "src/assets/banner-mark.svg" }]
58
+ }
59
+ ]
60
+ }
61
+ ```
62
+
63
+ The manifest path contains the DesignOS editor manifest (`type`, `displayName`, `fields`, `slots` and optional capabilities). The CLI emits these separately in `manifests.json`, keyed by stable component `type`; the target component registry remains a separate build-time module. TSX and Mitosis runtime behavior remain in the component source; neither is written into `PageDocument`. Paths are project-relative and the CLI rejects paths that escape the project root. Declared `styles` are copied and imported by the generated component entry module; `assets` are copied without automatic bundling or reference rewriting. Declare CSS under `styles` even when it is imported in source, because Mitosis does not necessarily retain stylesheet imports in generated targets. The consuming build environment remains responsible for installing third-party packages. Run the same command, for example `pnpm --filter @designos/compiler-cli exec designos compile --target react`, from the source-project root. A complete source-project sample is in [`examples/designos-source`](./examples/designos-source/). React is the editor's initial preview target; this does not imply that all targets preserve all Mitosis semantics.
64
+
65
+ The React and Vue renderer examples use `apps/shared-designos/designos.project.json` to compile their framework-specific maps, and import the same `apps/shared-designos/openpage-page.json` neutral page document. Their app scripts run `compile:designos` before typecheck/build/dev. Generated compiler modules stay in `dist/designos/<target>`; Vite writes the deployable app bundle separately to `dist/site`. Current Mitosis React TSX output is marked `@ts-nocheck` because the bridge does not yet preserve all prop and inferred callback types; the CLI diagnostics remain visible and this must not be read as semantic parity or a substitute for the remaining target audits.
66
+
67
+ The editor app demos use the `PagePublisher` interface through a localStorage-backed adapter for demonstration only. Production SaaS integrations should inject their own adapter; the editor does not call the component compiler at publish time, and publishing a page JSON snapshot does not itself compile or deploy framework code.
68
+
69
+ For local workspace use from a clean checkout, build the CLI and its transitive workspace dependencies with `pnpm exec turbo run build --filter=@designos/compiler-cli...`. Then run `pnpm --filter @designos/compiler-cli exec designos compile --target react` (or invoke the app-level `compile:designos` scripts). After the package is published, install it globally with `pnpm add --global @designos/compiler-cli`; its bin name is `designos`.