@elaraai/e3-ui-cli 1.0.28 → 1.0.29
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/app/assets/{engine-Daqj4eDD-BQb68g_1.js → engine-C0guBVPu-DwzrEvXk.js} +1 -1
- package/dist/app/assets/index-D6g123D4.js +2255 -0
- package/dist/app/index.html +1 -1
- package/dist/capture.d.ts +25 -0
- package/dist/capture.d.ts.map +1 -1
- package/dist/capture.js +46 -14
- package/dist/capture.js.map +1 -1
- package/dist/cli.js +15 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/shot.d.ts +1 -0
- package/dist/commands/shot.d.ts.map +1 -1
- package/dist/commands/shot.js +1 -0
- package/dist/commands/shot.js.map +1 -1
- package/dist/commands/shots.d.ts +18 -0
- package/dist/commands/shots.d.ts.map +1 -0
- package/dist/commands/shots.js +37 -0
- package/dist/commands/shots.js.map +1 -0
- package/dist/detect.d.ts +77 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/detect.js +187 -0
- package/dist/detect.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/load-source.d.ts +45 -0
- package/dist/load-source.d.ts.map +1 -1
- package/dist/load-source.js +44 -12
- package/dist/load-source.js.map +1 -1
- package/dist/render.d.ts +2 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +1 -0
- package/dist/render.js.map +1 -1
- package/dist/sweep.d.ts +81 -0
- package/dist/sweep.d.ts.map +1 -0
- package/dist/sweep.js +189 -0
- package/dist/sweep.js.map +1 -0
- package/package.json +10 -10
- package/dist/app/assets/index-30g1JIHt.js +0 -2255
package/dist/detect.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* IR-level renderability detection (#225): decide what an export IS from its
|
|
7
|
+
* East IR, never by duck-typed try-render-and-see.
|
|
8
|
+
*
|
|
9
|
+
* A render candidate is a **zero-input** East function whose declared output
|
|
10
|
+
* type is a subtype of `UIComponentType`, established with east's own type
|
|
11
|
+
* machinery (`isSubtypeValue` / `toEastTypeValue`). The function body is then
|
|
12
|
+
* walked (`walkIR`) for platform calls: workspace-backed calls (`data_*`,
|
|
13
|
+
* `func_*`, `record_*` — reads that need a deployed e3 workspace) make the
|
|
14
|
+
* export NOT standalone-renderable, while browser-local platforms (`state_*`,
|
|
15
|
+
* nav, overlays, …) render at initial state.
|
|
16
|
+
*
|
|
17
|
+
* Both `@elaraai/east` and `@elaraai/east-ui` are resolved **from the target
|
|
18
|
+
* project** (the swept source file), not from this CLI: the loaded module
|
|
19
|
+
* already runs against the project's own east instance (see
|
|
20
|
+
* `load-source.ts`'s externalize plugin), so the IR, the type values, and the
|
|
21
|
+
* comparison machinery all share one origin. Structural type comparison makes
|
|
22
|
+
* this safe even across duplicated east installs.
|
|
23
|
+
*
|
|
24
|
+
* @packageDocumentation
|
|
25
|
+
*/
|
|
26
|
+
import { createRequire } from 'node:module';
|
|
27
|
+
import { pathToFileURL } from 'node:url';
|
|
28
|
+
import * as path from 'node:path';
|
|
29
|
+
import { shapeOfExport } from './load-source.js';
|
|
30
|
+
/** Render a {@link SkipReason} as one human line (shared by sweep + shot). */
|
|
31
|
+
export function describeSkip(skip) {
|
|
32
|
+
switch (skip.kind) {
|
|
33
|
+
case 'not-a-component': return skip.detail;
|
|
34
|
+
case 'has-inputs': return `takes ${skip.count} input(s) — only zero-input functions render standalone`;
|
|
35
|
+
case 'wrong-output': return `output type is ${skip.output}, not UIComponentType`;
|
|
36
|
+
case 'parameterized-ui-task': return 'a ui() task with compute-time inputs — render it from a deployed workspace: e3-ui shot --from-task <ws.task> --repo <path>';
|
|
37
|
+
case 'workspace-bound': return `reads e3 workspace data (${skip.platforms.join(', ')}) — use --from-task against a deployed repo`;
|
|
38
|
+
case 'ir-error': return `could not analyze IR: ${skip.detail}`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** e3-ui platform-name prefixes that require a live e3 workspace. Everything
|
|
42
|
+
* else (`state_*`, `nav_*`, overlay/slice/clipboard/…) is browser-local and
|
|
43
|
+
* renders standalone at initial state. */
|
|
44
|
+
const WORKSPACE_PLATFORM_PREFIXES = ['data_', 'func_', 'record_'];
|
|
45
|
+
/** Import a package **from the target project's resolution scope** (the same
|
|
46
|
+
* single-instance trick `load-source.ts` plays for the loaded module). */
|
|
47
|
+
async function importFromProject(sourceFile, spec) {
|
|
48
|
+
try {
|
|
49
|
+
const req = createRequire(path.resolve(sourceFile));
|
|
50
|
+
const resolved = req.resolve(spec);
|
|
51
|
+
return await import(pathToFileURL(resolved).href);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Build the detection context for a source file, resolving `@elaraai/east` and
|
|
59
|
+
* `@elaraai/east-ui` from the project.
|
|
60
|
+
*
|
|
61
|
+
* @param sourceFile - A file inside the target project (resolution anchor)
|
|
62
|
+
* @returns The context, or null when the project has no resolvable `@elaraai/east`
|
|
63
|
+
*/
|
|
64
|
+
export async function detectContextFor(sourceFile) {
|
|
65
|
+
const east = await importFromProject(sourceFile, '@elaraai/east');
|
|
66
|
+
if (east === null)
|
|
67
|
+
return null;
|
|
68
|
+
const eastUi = await importFromProject(sourceFile, '@elaraai/east-ui');
|
|
69
|
+
const uiComponentType = eastUi?.['UIComponentType'];
|
|
70
|
+
const eastModule = east;
|
|
71
|
+
return {
|
|
72
|
+
east: eastModule,
|
|
73
|
+
uiComponentTypeValue: uiComponentType === undefined ? null : eastModule.toEastTypeValue(uiComponentType),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** The `Function` IR node's payload, extracted defensively (IR nodes are East
|
|
77
|
+
* variant containers: `{ type: tag, value }`). */
|
|
78
|
+
function functionIrPayload(ir) {
|
|
79
|
+
if (typeof ir !== 'object' || ir === null)
|
|
80
|
+
return null;
|
|
81
|
+
const node = ir;
|
|
82
|
+
if (node.type !== 'Function')
|
|
83
|
+
return null;
|
|
84
|
+
const value = node.value;
|
|
85
|
+
if (value === undefined || !Array.isArray(value.parameters))
|
|
86
|
+
return null;
|
|
87
|
+
return { parameters: value.parameters, typeValue: value.type };
|
|
88
|
+
}
|
|
89
|
+
/** The declared output `EastTypeValue` of a `Function` IR's `FunctionType`. */
|
|
90
|
+
function outputTypeValue(fnTypeValue) {
|
|
91
|
+
if (typeof fnTypeValue !== 'object' || fnTypeValue === null)
|
|
92
|
+
return undefined;
|
|
93
|
+
const t = fnTypeValue;
|
|
94
|
+
if (t.type !== 'Function')
|
|
95
|
+
return undefined;
|
|
96
|
+
return t.value?.output;
|
|
97
|
+
}
|
|
98
|
+
/** A short printable name for an `EastTypeValue` (its variant tag). */
|
|
99
|
+
function typeTag(typeValue) {
|
|
100
|
+
if (typeof typeValue === 'string')
|
|
101
|
+
return typeValue;
|
|
102
|
+
if (typeof typeValue === 'object' && typeValue !== null) {
|
|
103
|
+
const tag = typeValue.type;
|
|
104
|
+
if (typeof tag === 'string')
|
|
105
|
+
return tag;
|
|
106
|
+
}
|
|
107
|
+
return 'unknown';
|
|
108
|
+
}
|
|
109
|
+
/** Collect the platform-call names in a function IR via the project's `walkIR`. */
|
|
110
|
+
function platformCallNames(east, ir) {
|
|
111
|
+
const names = new Set();
|
|
112
|
+
east.walkIR(ir, (node) => {
|
|
113
|
+
const n = node;
|
|
114
|
+
if (n.type === 'Platform') {
|
|
115
|
+
const name = n.value?.name;
|
|
116
|
+
if (typeof name === 'string')
|
|
117
|
+
names.add(name);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
return [...names].sort();
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Classify ONE export value: shape, renderability, and (when renderable) its
|
|
124
|
+
* East function.
|
|
125
|
+
*
|
|
126
|
+
* @param name - The export name (for reporting)
|
|
127
|
+
* @param value - The exported value
|
|
128
|
+
* @param ctx - The project-resolved detection context
|
|
129
|
+
* @returns The classification (never throws — IR problems become `ir-error` skips)
|
|
130
|
+
*/
|
|
131
|
+
export function classifyExport(name, value, ctx) {
|
|
132
|
+
const shaped = shapeOfExport(value);
|
|
133
|
+
if (shaped === null) {
|
|
134
|
+
return { name, shape: null, renderable: false, skip: { kind: 'not-a-component', detail: 'not an East function, example(), or ui() task' } };
|
|
135
|
+
}
|
|
136
|
+
if (shaped.fn === null) {
|
|
137
|
+
return { name, shape: shaped.shape, renderable: false, skip: { kind: 'parameterized-ui-task' } };
|
|
138
|
+
}
|
|
139
|
+
let ir;
|
|
140
|
+
try {
|
|
141
|
+
const bundle = shaped.fn.toIR();
|
|
142
|
+
// `toIR()` yields an `EastIR` wrapper (its `.ir` is the Function node) —
|
|
143
|
+
// except the ui() task unwrap, whose stored bundle IS the wrapper too.
|
|
144
|
+
ir = typeof bundle === 'object' && bundle !== null && 'ir' in bundle ? bundle.ir : bundle;
|
|
145
|
+
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
return { name, shape: shaped.shape, renderable: false, skip: { kind: 'ir-error', detail: err instanceof Error ? err.message : String(err) } };
|
|
148
|
+
}
|
|
149
|
+
const fnIr = functionIrPayload(ir);
|
|
150
|
+
if (fnIr === null) {
|
|
151
|
+
return { name, shape: shaped.shape, renderable: false, skip: { kind: 'ir-error', detail: 'toIR() did not yield a (sync) Function IR' } };
|
|
152
|
+
}
|
|
153
|
+
if (fnIr.parameters.length > 0) {
|
|
154
|
+
return { name, shape: shaped.shape, renderable: false, skip: { kind: 'has-inputs', count: fnIr.parameters.length } };
|
|
155
|
+
}
|
|
156
|
+
const output = outputTypeValue(fnIr.typeValue);
|
|
157
|
+
if (ctx.uiComponentTypeValue === null) {
|
|
158
|
+
return { name, shape: shaped.shape, renderable: false, skip: { kind: 'wrong-output', output: `${typeTag(output)} (and the project does not depend on @elaraai/east-ui)` } };
|
|
159
|
+
}
|
|
160
|
+
let isUi;
|
|
161
|
+
try {
|
|
162
|
+
isUi = output !== undefined && ctx.east.isSubtypeValue(output, ctx.uiComponentTypeValue);
|
|
163
|
+
}
|
|
164
|
+
catch (err) {
|
|
165
|
+
return { name, shape: shaped.shape, renderable: false, skip: { kind: 'ir-error', detail: err instanceof Error ? err.message : String(err) } };
|
|
166
|
+
}
|
|
167
|
+
if (!isUi) {
|
|
168
|
+
return { name, shape: shaped.shape, renderable: false, skip: { kind: 'wrong-output', output: typeTag(output) } };
|
|
169
|
+
}
|
|
170
|
+
const workspaceBound = platformCallNames(ctx.east, ir)
|
|
171
|
+
.filter(n => WORKSPACE_PLATFORM_PREFIXES.some(p => n.startsWith(p)));
|
|
172
|
+
if (workspaceBound.length > 0) {
|
|
173
|
+
return { name, shape: shaped.shape, renderable: false, skip: { kind: 'workspace-bound', platforms: workspaceBound } };
|
|
174
|
+
}
|
|
175
|
+
return { name, shape: shaped.shape, renderable: true, fn: shaped.fn };
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Classify every export of a loaded module.
|
|
179
|
+
*
|
|
180
|
+
* @param moduleExports - The module's exports (from `loadSourceExports`)
|
|
181
|
+
* @param ctx - The project-resolved detection context
|
|
182
|
+
* @returns One classification per export, in export order
|
|
183
|
+
*/
|
|
184
|
+
export function classifyExports(moduleExports, ctx) {
|
|
185
|
+
return Object.entries(moduleExports).map(([name, value]) => classifyExport(name, value, ctx));
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.js","sourceRoot":"","sources":["../src/detect.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,O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,CAAC;IACrH,CAAC;IAED,MAAM,cAAc,GAAG,iBAAiB,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;SACjD,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzE,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,SAAS,EAAE,cAAc,EAAE,EAAE,CAAC;IAC1H,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;AAC1E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,aAAsC,EAAE,GAAkB;IACtF,OAAO,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AAClG,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export { renderToPng, renderTaskToPng, defaultAppDir, type RenderToPngOptions, type RenderTaskOptions } from './render.js';
|
|
12
12
|
export { buildPayload, detectFormat, type ShotInput, type ShotPayload, type ComponentPayload, type TaskPayload, type InputFormat, } from './payload.js';
|
|
13
|
-
export { capture, type CaptureOptions, type CaptureMode } from './capture.js';
|
|
14
|
-
export {
|
|
13
|
+
export { capture, openCaptureSession, type CaptureSession, type SessionCaptureOptions, type CaptureOptions, type CaptureMode } from './capture.js';
|
|
14
|
+
export { sweep, isSweepableSource, outputStemFor, type SweepOptions, type SweepResult, type SweepRendered, type SweepSkipped, type SweepFailed } from './sweep.js';
|
|
15
|
+
export { classifyExport, classifyExports, detectContextFor, describeSkip, type DetectContext, type ExportClassification, type SkipReason } from './detect.js';
|
|
16
|
+
export { loadComponentFromSource, loadSourceExports, shapeOfExport, type ExportShape, type EastFunctionLike } from './load-source.js';
|
|
15
17
|
export { startRepoServer, type RepoServerHandle } from './e3-server.js';
|
|
16
18
|
export { launchBrowser, installBrowser, doctor, type BrowserSource } from './browser.js';
|
|
17
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3H,OAAO,EACH,YAAY,EAAE,YAAY,EAC1B,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,GAC9F,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3H,OAAO,EACH,YAAY,EAAE,YAAY,EAC1B,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,GAC9F,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,KAAK,cAAc,EAAE,KAAK,qBAAqB,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACnJ,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AACnK,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9J,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtI,OAAO,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export { renderToPng, renderTaskToPng, defaultAppDir } from './render.js';
|
|
12
12
|
export { buildPayload, detectFormat, } from './payload.js';
|
|
13
|
-
export { capture } from './capture.js';
|
|
14
|
-
export {
|
|
13
|
+
export { capture, openCaptureSession } from './capture.js';
|
|
14
|
+
export { sweep, isSweepableSource, outputStemFor } from './sweep.js';
|
|
15
|
+
export { classifyExport, classifyExports, detectContextFor, describeSkip } from './detect.js';
|
|
16
|
+
export { loadComponentFromSource, loadSourceExports, shapeOfExport } from './load-source.js';
|
|
15
17
|
export { startRepoServer } from './e3-server.js';
|
|
16
18
|
export { launchBrowser, installBrowser, doctor } from './browser.js';
|
|
17
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAmD,MAAM,aAAa,CAAC;AAC3H,OAAO,EACH,YAAY,EAAE,YAAY,GAE7B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAmD,MAAM,aAAa,CAAC;AAC3H,OAAO,EACH,YAAY,EAAE,YAAY,GAE7B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAA0F,MAAM,cAAc,CAAC;AACnJ,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAgG,MAAM,YAAY,CAAC;AACnK,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,YAAY,EAAkE,MAAM,aAAa,CAAC;AAC9J,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,aAAa,EAA2C,MAAM,kBAAkB,CAAC;AACtI,OAAO,EAAE,eAAe,EAAyB,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAsB,MAAM,cAAc,CAAC"}
|
package/dist/load-source.d.ts
CHANGED
|
@@ -7,6 +7,50 @@
|
|
|
7
7
|
export interface EastFunctionLike {
|
|
8
8
|
toIR(): unknown;
|
|
9
9
|
}
|
|
10
|
+
/** An exported `example({ fn })` definition wrapping an East function. */
|
|
11
|
+
interface ExampleDefLike {
|
|
12
|
+
fn: EastFunctionLike;
|
|
13
|
+
}
|
|
14
|
+
/** Does `x` carry a `toIR()` (the minimal East-function contract)? */
|
|
15
|
+
export declare function hasToIR(x: unknown): x is EastFunctionLike;
|
|
16
|
+
/** Is `x` an `example({ fn })` definition wrapping an East function? */
|
|
17
|
+
export declare function isExampleDef(x: unknown): x is ExampleDefLike;
|
|
18
|
+
/** Structural shape of an e3 `ui()` task definition. The original East
|
|
19
|
+
* function is not retained on the TaskDef — `task()` eagerly stores
|
|
20
|
+
* `fn.toIR()` (the full EastIR bundle, source map included) as the default of
|
|
21
|
+
* its first input dataset, named `function_ir`. Purely structural so this
|
|
22
|
+
* package needs no runtime dependency on `@elaraai/e3` / `@elaraai/e3-ui`.
|
|
23
|
+
* `TaskDef.command` is ALSO an EastIR (the argv builder) — never unwrap that. */
|
|
24
|
+
interface UiTaskDefLike {
|
|
25
|
+
kind: 'task';
|
|
26
|
+
taskKind: 'ui';
|
|
27
|
+
inputs: Array<{
|
|
28
|
+
name?: unknown;
|
|
29
|
+
default?: unknown;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
/** Is `x` (structurally) an e3 `ui()` task definition? */
|
|
33
|
+
export declare function isUiTaskDef(x: unknown): x is UiTaskDefLike;
|
|
34
|
+
/** How an export carries its East function — the three renderable shapes. */
|
|
35
|
+
export type ExportShape = 'function' | 'example' | 'ui-task';
|
|
36
|
+
/** Identify an export's shape and pull out its East function, without judging
|
|
37
|
+
* renderability (that is `classifyExports`' job — IR-level, in `detect.ts`).
|
|
38
|
+
* A parameterized `ui()` task reports its shape with `fn: null`. */
|
|
39
|
+
export declare function shapeOfExport(value: unknown): {
|
|
40
|
+
shape: ExportShape;
|
|
41
|
+
fn: EastFunctionLike | null;
|
|
42
|
+
} | null;
|
|
43
|
+
/**
|
|
44
|
+
* Transpile and execute a `.ts`/`.tsx` source in memory, returning its module
|
|
45
|
+
* exports. **Runs the file and its imports as Node code** — only point it at
|
|
46
|
+
* code you trust. The building block under {@link loadComponentFromSource}
|
|
47
|
+
* (single export) and the `shots` sweep (all exports).
|
|
48
|
+
*
|
|
49
|
+
* @param filePath - Path to the source file
|
|
50
|
+
* @returns The executed module's exports
|
|
51
|
+
* @throws If the file does not exist, esbuild fails, or executing the module throws
|
|
52
|
+
*/
|
|
53
|
+
export declare function loadSourceExports(filePath: string): Promise<Record<string, unknown>>;
|
|
10
54
|
/**
|
|
11
55
|
* Transpile, execute, and extract an East UI function from a `.ts`/`.tsx` source.
|
|
12
56
|
*
|
|
@@ -18,4 +62,5 @@ export interface EastFunctionLike {
|
|
|
18
62
|
* or not renderable
|
|
19
63
|
*/
|
|
20
64
|
export declare function loadComponentFromSource(filePath: string, exportName?: string): Promise<EastFunctionLike>;
|
|
65
|
+
export {};
|
|
21
66
|
//# sourceMappingURL=load-source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-source.d.ts","sourceRoot":"","sources":["../src/load-source.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuBH;iFACiF;AACjF,MAAM,WAAW,gBAAgB;IAC7B,IAAI,IAAI,OAAO,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"load-source.d.ts","sourceRoot":"","sources":["../src/load-source.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuBH;iFACiF;AACjF,MAAM,WAAW,gBAAgB;IAC7B,IAAI,IAAI,OAAO,CAAC;CACnB;AAED,0EAA0E;AAC1E,UAAU,cAAc;IACpB,EAAE,EAAE,gBAAgB,CAAC;CACxB;AAED,sEAAsE;AACtE,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,gBAAgB,CAGzD;AAED,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,cAAc,CAE5D;AAED;;;;;kFAKkF;AAClF,UAAU,aAAa;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,IAAI,CAAC;IACf,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACxD;AAED,0DAA0D;AAC1D,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,aAAa,CAQ1D;AAED,6EAA6E;AAC7E,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAE7D;;qEAEqE;AACrE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,gBAAgB,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAWxG;AAgDD;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA+B1F;AAED;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CACzC,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,gBAAgB,CAAC,CAwC3B"}
|
package/dist/load-source.js
CHANGED
|
@@ -21,14 +21,17 @@ import { pathToFileURL } from 'node:url';
|
|
|
21
21
|
import * as path from 'node:path';
|
|
22
22
|
import * as fs from 'node:fs';
|
|
23
23
|
import * as esbuild from 'esbuild';
|
|
24
|
-
|
|
24
|
+
/** Does `x` carry a `toIR()` (the minimal East-function contract)? */
|
|
25
|
+
export function hasToIR(x) {
|
|
25
26
|
return (typeof x === 'function' || (typeof x === 'object' && x !== null))
|
|
26
27
|
&& typeof x.toIR === 'function';
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
/** Is `x` an `example({ fn })` definition wrapping an East function? */
|
|
30
|
+
export function isExampleDef(x) {
|
|
29
31
|
return typeof x === 'object' && x !== null && hasToIR(x.fn);
|
|
30
32
|
}
|
|
31
|
-
|
|
33
|
+
/** Is `x` (structurally) an e3 `ui()` task definition? */
|
|
34
|
+
export function isUiTaskDef(x) {
|
|
32
35
|
if (typeof x !== 'object' || x === null)
|
|
33
36
|
return false;
|
|
34
37
|
const t = x;
|
|
@@ -38,6 +41,23 @@ function isUiTaskDef(x) {
|
|
|
38
41
|
&& t.inputs[0]?.name === 'function_ir'
|
|
39
42
|
&& t.inputs[0].default != null;
|
|
40
43
|
}
|
|
44
|
+
/** Identify an export's shape and pull out its East function, without judging
|
|
45
|
+
* renderability (that is `classifyExports`' job — IR-level, in `detect.ts`).
|
|
46
|
+
* A parameterized `ui()` task reports its shape with `fn: null`. */
|
|
47
|
+
export function shapeOfExport(value) {
|
|
48
|
+
if (hasToIR(value))
|
|
49
|
+
return { shape: 'function', fn: value };
|
|
50
|
+
if (isExampleDef(value))
|
|
51
|
+
return { shape: 'example', fn: value.fn };
|
|
52
|
+
if (isUiTaskDef(value)) {
|
|
53
|
+
if (value.inputs.length === 1) {
|
|
54
|
+
const bundle = value.inputs[0].default;
|
|
55
|
+
return { shape: 'ui-task', fn: { toIR: () => bundle } };
|
|
56
|
+
}
|
|
57
|
+
return { shape: 'ui-task', fn: null };
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
41
61
|
const PARAMETERIZED_UI_TASK_MESSAGE = `it is a ui() task with compute-time inputs, which a standalone render cannot supply — ` +
|
|
42
62
|
`render it from a deployed workspace instead: e3-ui shot --from-task <workspace>.<task> --repo <path>`;
|
|
43
63
|
/**
|
|
@@ -87,16 +107,16 @@ const externalizeBareImports = {
|
|
|
87
107
|
},
|
|
88
108
|
};
|
|
89
109
|
/**
|
|
90
|
-
* Transpile
|
|
110
|
+
* Transpile and execute a `.ts`/`.tsx` source in memory, returning its module
|
|
111
|
+
* exports. **Runs the file and its imports as Node code** — only point it at
|
|
112
|
+
* code you trust. The building block under {@link loadComponentFromSource}
|
|
113
|
+
* (single export) and the `shots` sweep (all exports).
|
|
91
114
|
*
|
|
92
115
|
* @param filePath - Path to the source file
|
|
93
|
-
* @
|
|
94
|
-
*
|
|
95
|
-
* @returns The East function (carrying `toIR()`)
|
|
96
|
-
* @throws If the file produces no renderable export, or `exportName` is absent
|
|
97
|
-
* or not renderable
|
|
116
|
+
* @returns The executed module's exports
|
|
117
|
+
* @throws If the file does not exist, esbuild fails, or executing the module throws
|
|
98
118
|
*/
|
|
99
|
-
export async function
|
|
119
|
+
export async function loadSourceExports(filePath) {
|
|
100
120
|
const absolutePath = path.resolve(filePath);
|
|
101
121
|
if (!fs.existsSync(absolutePath)) {
|
|
102
122
|
throw new Error(`Source file not found: ${absolutePath}`);
|
|
@@ -116,14 +136,26 @@ export async function loadComponentFromSource(filePath, exportName) {
|
|
|
116
136
|
if (!code) {
|
|
117
137
|
throw new Error(`esbuild produced no output for ${filePath}`);
|
|
118
138
|
}
|
|
119
|
-
let moduleExports;
|
|
120
139
|
try {
|
|
121
140
|
const dataUrl = `data:text/javascript;base64,${Buffer.from(code).toString('base64')}`;
|
|
122
|
-
|
|
141
|
+
return await import(dataUrl);
|
|
123
142
|
}
|
|
124
143
|
catch (err) {
|
|
125
144
|
throw new Error(`Failed to execute ${path.basename(filePath)}: ${err instanceof Error ? err.message : String(err)}`);
|
|
126
145
|
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Transpile, execute, and extract an East UI function from a `.ts`/`.tsx` source.
|
|
149
|
+
*
|
|
150
|
+
* @param filePath - Path to the source file
|
|
151
|
+
* @param exportName - Named export to render; when omitted, falls back to the
|
|
152
|
+
* `default` export, then to the sole renderable export
|
|
153
|
+
* @returns The East function (carrying `toIR()`)
|
|
154
|
+
* @throws If the file produces no renderable export, or `exportName` is absent
|
|
155
|
+
* or not renderable
|
|
156
|
+
*/
|
|
157
|
+
export async function loadComponentFromSource(filePath, exportName) {
|
|
158
|
+
const moduleExports = await loadSourceExports(filePath);
|
|
127
159
|
if (exportName !== undefined) {
|
|
128
160
|
const fn = asEastFunction(moduleExports[exportName]);
|
|
129
161
|
if (!fn) {
|
package/dist/load-source.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-source.js","sourceRoot":"","sources":["../src/load-source.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAanC,
|
|
1
|
+
{"version":3,"file":"load-source.js","sourceRoot":"","sources":["../src/load-source.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAanC,sEAAsE;AACtE,MAAM,UAAU,OAAO,CAAC,CAAU;IAC9B,OAAO,CAAC,OAAO,CAAC,KAAK,UAAU,IAAI,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;WAClE,OAAQ,CAAwB,CAAC,IAAI,KAAK,UAAU,CAAC;AAChE,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,YAAY,CAAC,CAAU;IACnC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,OAAO,CAAE,CAAsB,CAAC,EAAE,CAAC,CAAC;AACtF,CAAC;AAcD,0DAA0D;AAC1D,MAAM,UAAU,WAAW,CAAC,CAAU;IAClC,IAAI,OAAO,CAAC,KAAK,Q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/render.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export interface RenderToPngOptions {
|
|
|
29
29
|
timeoutMs?: number | undefined;
|
|
30
30
|
/** Storage key prefix for persisted component state. */
|
|
31
31
|
storageKey?: string | undefined;
|
|
32
|
+
/** Component-frame mount width ('full' or a CSS width) — see CaptureOptions. */
|
|
33
|
+
frameWidth?: string | undefined;
|
|
32
34
|
}
|
|
33
35
|
/** Resolve the shipped prebuilt app directory (`dist/app`, sibling of this module). */
|
|
34
36
|
export declare function defaultAppDir(): string;
|
package/dist/render.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EAAgB,KAAK,SAAS,EAAoB,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAW,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAGzD,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IAC/B,+DAA+D;IAC/D,KAAK,EAAE,SAAS,CAAC;IACjB,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,yBAAyB;IACzB,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACzD,2BAA2B;IAC3B,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,eAAe;IACf,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,wDAAwD;IACx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G;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAezE;AAED,2CAA2C;AAC3C,MAAM,WAAW,iBAAiB;IAC9B,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,yBAAyB;IACzB,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACzD,2BAA2B;IAC3B,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,eAAe;IACf,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0B5E"}
|
package/dist/render.js
CHANGED
package/dist/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,YAAY,EAAoC,MAAM,cAAc,CAAC;AAC9E,OAA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C,CAAC;AACP,CAAC;AA4BD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAuB;IACzD,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChD,IAAI,CAAC;QACD,MAAM,OAAO,GAAgB;YACzB,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,IAAI,EAAE,IAAI,CAAC,IAAI;SAClB,CAAC;QACF,MAAM,OAAO,CAAC;YACV,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,aAAa,EAAE;YACtC,OAAO;YACP,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,IAAI;YAClB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,mEAAmE;YACnE,gEAAgE;YAChE,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,GAAG;YAC9B,SAAS,EAAE,IAAI,CAAC,SAAS;SAC5B,CAAC,CAAC;IACP,CAAC;YAAS,CAAC;QACP,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC;AACL,CAAC"}
|
package/dist/sweep.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { type SessionCaptureOptions } from './capture.js';
|
|
6
|
+
/** One rendered export. */
|
|
7
|
+
export interface SweepRendered {
|
|
8
|
+
file: string;
|
|
9
|
+
exportName: string;
|
|
10
|
+
png: string;
|
|
11
|
+
html?: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
/** One skipped export (or a whole file that failed to load/classify). */
|
|
14
|
+
export interface SweepSkipped {
|
|
15
|
+
file: string;
|
|
16
|
+
/** Absent for file-level skips (load errors, no detect context). */
|
|
17
|
+
exportName?: string | undefined;
|
|
18
|
+
reason: string;
|
|
19
|
+
}
|
|
20
|
+
/** One render FAILURE (a classified-renderable export whose capture threw). */
|
|
21
|
+
export interface SweepFailed {
|
|
22
|
+
file: string;
|
|
23
|
+
exportName: string;
|
|
24
|
+
error: string;
|
|
25
|
+
}
|
|
26
|
+
/** The sweep outcome. `failed.length > 0` should exit non-zero. */
|
|
27
|
+
export interface SweepResult {
|
|
28
|
+
rendered: SweepRendered[];
|
|
29
|
+
skipped: SweepSkipped[];
|
|
30
|
+
failed: SweepFailed[];
|
|
31
|
+
}
|
|
32
|
+
/** Options for {@link sweep}. */
|
|
33
|
+
export interface SweepOptions {
|
|
34
|
+
/** Files or directories to sweep (directories recurse). Default: `src`. */
|
|
35
|
+
paths?: string[];
|
|
36
|
+
/** Base directory for discovery + relative output layout. Default: cwd. */
|
|
37
|
+
cwd?: string;
|
|
38
|
+
/** Output directory. Default: `.shots`. */
|
|
39
|
+
outDir?: string;
|
|
40
|
+
/** Also write a standalone HTML beside each PNG. */
|
|
41
|
+
html?: boolean;
|
|
42
|
+
/** Also write `<outDir>/manifest.json` describing the sweep. */
|
|
43
|
+
json?: boolean;
|
|
44
|
+
/** Component-frame mount width. Default `'full'` — width-flexible
|
|
45
|
+
* components render faithfully; pass `undefined` explicitly via the CLI's
|
|
46
|
+
* `--frame-width none` for the historical shrink-to-fit crop. */
|
|
47
|
+
frameWidth?: string | undefined;
|
|
48
|
+
/** Chromium viewport. */
|
|
49
|
+
viewport?: {
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
} | undefined;
|
|
53
|
+
/** Device scale factor. */
|
|
54
|
+
deviceScaleFactor?: number | undefined;
|
|
55
|
+
/** Settle time after skeletons clear (ms). */
|
|
56
|
+
settleMs?: number | undefined;
|
|
57
|
+
/** Per-capture timeout (ms). */
|
|
58
|
+
timeoutMs?: number | undefined;
|
|
59
|
+
/** Override the prebuilt app directory. */
|
|
60
|
+
appDir?: string | undefined;
|
|
61
|
+
/** Progress/summary sink. Default `console.log`. */
|
|
62
|
+
log?: (line: string) => void;
|
|
63
|
+
/** Render override for tests: receives each candidate's capture options.
|
|
64
|
+
* When set, no browser session is opened. */
|
|
65
|
+
render?: (opts: SessionCaptureOptions) => Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
/** Is `file` a sweepable TS/TSX source (not a spec, not a declaration)? */
|
|
68
|
+
export declare function isSweepableSource(file: string): boolean;
|
|
69
|
+
/** The output basename (no extension) for a swept file, relative to `cwd` —
|
|
70
|
+
* `src/ui/index.tsx` → `src/ui/index`. Paths outside `cwd` fall back to a
|
|
71
|
+
* flattened basename. */
|
|
72
|
+
export declare function outputStemFor(file: string, cwd: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Sweep `paths` and render every renderable UI export.
|
|
75
|
+
*
|
|
76
|
+
* @param opts - Sweep options
|
|
77
|
+
* @returns The sweep outcome (rendered / skipped / failed)
|
|
78
|
+
* @throws If the browser session cannot be opened (no browser installed)
|
|
79
|
+
*/
|
|
80
|
+
export declare function sweep(opts?: SweepOptions): Promise<SweepResult>;
|
|
81
|
+
//# sourceMappingURL=sweep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sweep.d.ts","sourceRoot":"","sources":["../src/sweep.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwBH,OAAO,EAAsB,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAI9E,2BAA2B;AAC3B,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED,yEA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