@assistant-ui/x-generative-compiler 0.0.17 → 0.0.19

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/dist/compile.d.ts CHANGED
@@ -1,48 +1,45 @@
1
- import { Target } from "./constants.js";
2
- //#region src/compile.d.ts
3
- type ToolType = "frontend" | "backend" | "human" | "provider";
4
- interface CompileOptions {
5
- /** Which build target to emit. */
6
- target: Target;
7
- /** Source filename, used for error messages and source maps. */
8
- filename?: string;
9
- /** Emit a source map alongside the code. */
10
- sourceMaps?: boolean;
11
- /**
12
- * Whether the `server` target prepends `import "server-only"` when it keeps a
13
- * backend `execute`. Defaults to `true` (the Next.js/RSC convention, where the
14
- * guard fires via the `react-server` condition). Set `false` for bundlers
15
- * without a `react-server` layer (e.g. a Vite/TanStack Start `ssr` build),
16
- * where the split is already structural and importing `server-only` would
17
- * throw — see the Vite integration.
18
- */
19
- injectServerOnly?: boolean;
20
- /**
21
- * No backend of the app imports this module's server build (e.g. cloud-hosted
22
- * runs), so the client is the only place the model can learn the schemas
23
- * from. The `client` target then keeps frontend/human tool schemas
24
- * uploadable — no `unstable_backendDefault` marker is stamped — and local
25
- * `new JSONGenerativeUI({ ... })` instances are constructed with
26
- * `backendless: true` so their `present`/`prompt_user` schemas upload too.
27
- */
28
- backendless?: boolean;
1
+ import { type Target } from "./constants.js";
2
+ export type ToolType = "frontend" | "backend" | "human" | "provider";
3
+ export interface CompileOptions {
4
+ /** Which build target to emit. */
5
+ target: Target;
6
+ /** Source filename, used for error messages and source maps. */
7
+ filename?: string;
8
+ /** Emit a source map alongside the code. */
9
+ sourceMaps?: boolean;
10
+ /**
11
+ * Whether the `server` target prepends `import "server-only"` when it keeps a
12
+ * backend `execute`. Defaults to `true` (the Next.js/RSC convention, where the
13
+ * guard fires via the `react-server` condition). Set `false` for bundlers
14
+ * without a `react-server` layer (e.g. a Vite/TanStack Start `ssr` build),
15
+ * where the split is already structural and importing `server-only` would
16
+ * throw — see the Vite integration.
17
+ */
18
+ injectServerOnly?: boolean;
19
+ /**
20
+ * No backend of the app imports this module's server build (e.g. cloud-hosted
21
+ * runs), so the client is the only place the model can learn the schemas
22
+ * from. The `client` target then keeps frontend/human tool schemas
23
+ * uploadable — no `unstable_backendDefault` marker is stamped — and local
24
+ * `new JSONGenerativeUI({ ... })` instances are constructed with
25
+ * `backendless: true` so their `present`/`prompt_user` schemas upload too.
26
+ */
27
+ backendless?: boolean;
29
28
  }
30
- interface CompileResult {
31
- code: string;
32
- map?: object | null;
29
+ export interface CompileResult {
30
+ code: string;
31
+ map?: object | null;
33
32
  }
34
33
  /** Thrown when a `"use generative"` file violates an authoring constraint. */
35
- declare class GenerativeCompileError extends Error {
36
- constructor(message: string, filename?: string);
34
+ export declare class GenerativeCompileError extends Error {
35
+ constructor(message: string, filename?: string);
37
36
  }
38
37
  /** Whether a source string opts into generative compilation via the directive. */
39
- declare function isGenerativeModule(code: string): boolean;
40
- declare const isGenerativeSource: (filename: string, source: string) => boolean;
38
+ export declare function isGenerativeModule(code: string): boolean;
39
+ export declare const isGenerativeSource: (filename: string, source: string) => boolean;
41
40
  /**
42
41
  * Rewrites a `"use generative"` module for a single build target, keeping only the
43
42
  * regions that target needs and pruning the imports the dropped regions used.
44
43
  */
45
- declare function compileGenerative(code: string, options: CompileOptions): CompileResult;
46
- //#endregion
47
- export { CompileOptions, CompileResult, GenerativeCompileError, ToolType, compileGenerative, isGenerativeModule, isGenerativeSource };
44
+ export declare function compileGenerative(code: string, options: CompileOptions): CompileResult;
48
45
  //# sourceMappingURL=compile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile.d.ts","names":[],"sources":["../src/compile.ts"],"mappings":";;KA2BY;UA2CK;;EAEf,QAAQ;;EAER;;EAEA;;;;;;;;;EASA;;;;;;;;;EASA;;UAGe;EACf;EACA;;;cAIW,+BAA+B;EAC9B,YAAA,iBAAiB;;;iBASf,mBAAmB;cAgCtB,qBAAsB,kBAAkB;;;;;iBAkHrC,kBACd,cACA,SAAS,iBACR"}
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AASA,OAAO,EAAa,KAAK,MAAM,EAAE,uBAAoB;AAkBrD,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;AA2CrE,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,8EAA8E;AAC9E,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;CAM/C;AAED,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CA8BxD;AAED,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,EAAE,QAAQ,MAAM,KAAG,OACN,CAAC;AA6GjE;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,GACtB,aAAa,CAiHf"}
@@ -1,8 +1,5 @@
1
- //#region src/constants.d.ts
2
1
  /** The directive a module uses to opt into generative compilation. */
3
- declare const DIRECTIVE = "use generative";
2
+ export declare const DIRECTIVE = "use generative";
4
3
  /** Build target a generative module is compiled for. */
5
- type Target = "client" | "server";
6
- //#endregion
7
- export { DIRECTIVE, Target };
4
+ export type Target = "client" | "server";
8
5
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","names":[],"sources":["../src/constants.ts"],"mappings":";;cACa;;KAGD"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,eAAO,MAAM,SAAS,mBAAmB,CAAC;AAE1C,wDAAwD;AACxD,MAAM,MAAM,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { DIRECTIVE, Target } from "./constants.js";
2
- import { CompileOptions, CompileResult, GenerativeCompileError, ToolType, compileGenerative, isGenerativeModule, isGenerativeSource } from "./compile.js";
3
- export { type CompileOptions, type CompileResult, DIRECTIVE, GenerativeCompileError, type Target, type ToolType, compileGenerative, isGenerativeModule, isGenerativeSource };
1
+ export { compileGenerative, isGenerativeModule, isGenerativeSource, GenerativeCompileError, type ToolType, type CompileOptions, type CompileResult, } from "./compile.js";
2
+ export { DIRECTIVE, type Target } from "./constants.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,qBAAkB;AACnB,OAAO,EAAE,SAAS,EAAE,KAAK,MAAM,EAAE,uBAAoB"}
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.0.17";
2
+ var version = "0.0.19";
3
3
  //#endregion
4
4
  export { version };
5
5
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@assistant-ui/x-generative-compiler",
3
3
  "private": false,
4
- "version": "0.0.17",
4
+ "version": "0.0.19",
5
5
  "description": "Internal: the framework-agnostic \"use generative\" compiler that splits a colocated tool (schema + server-only execute + client-only render) into per-target builds. Shared by @assistant-ui/next and @assistant-ui/vite.",
6
6
  "keywords": [
7
7
  "assistant-ui",
@@ -29,19 +29,19 @@
29
29
  ],
30
30
  "sideEffects": false,
31
31
  "dependencies": {
32
- "@babel/generator": "^8.0.0",
33
- "@babel/parser": "^8.0.4",
34
- "@babel/traverse": "^8.0.4",
35
- "@babel/types": "^8.0.4",
32
+ "@babel/generator": "^7.29.7",
33
+ "@babel/parser": "^7.29.7",
34
+ "@babel/traverse": "^7.29.7",
35
+ "@babel/types": "^7.29.7",
36
36
  "semver": "^7.8.5"
37
37
  },
38
38
  "devDependencies": {
39
- "@assistant-ui/x-buildutils": "0.0.26",
39
+ "@assistant-ui/x-buildutils": "0.0.29",
40
40
  "@types/babel__generator": "^7.27.0",
41
41
  "@types/babel__traverse": "^7.28.0",
42
- "@types/node": "^26.4.1",
42
+ "@types/node": "^26.5.1",
43
43
  "@types/semver": "^7.8.0",
44
- "vitest": "^4.1.11"
44
+ "vitest": "^5.0.1"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public",
@@ -59,6 +59,7 @@
59
59
  "scripts": {
60
60
  "build": "aui-build",
61
61
  "test": "vitest run",
62
+ "typecheck": "tsc --noEmit",
62
63
  "test:watch": "vitest"
63
64
  }
64
65
  }