@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 +35 -38
- package/dist/compile.d.ts.map +1 -1
- package/dist/constants.d.ts +2 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -0
- package/dist/package.js +1 -1
- package/package.json +9 -8
package/dist/compile.d.ts
CHANGED
|
@@ -1,48 +1,45 @@
|
|
|
1
|
-
import { Target } from "./constants.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
32
|
-
|
|
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
|
-
|
|
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
|
package/dist/compile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","
|
|
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"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -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
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
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.
|
|
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": "^
|
|
33
|
-
"@babel/parser": "^
|
|
34
|
-
"@babel/traverse": "^
|
|
35
|
-
"@babel/types": "^
|
|
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.
|
|
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.
|
|
42
|
+
"@types/node": "^26.5.1",
|
|
43
43
|
"@types/semver": "^7.8.0",
|
|
44
|
-
"vitest": "^
|
|
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
|
}
|