@sverka/playground 0.2.11 → 0.2.13
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/index.d.mts +64 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1154 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -4
package/dist/index.d.mts
CHANGED
|
@@ -144,5 +144,68 @@ export declare function encodeShareLink(run: ShareableRun, base?: string): strin
|
|
|
144
144
|
* default template. */
|
|
145
145
|
export declare function decodeShareLink(hash: string): ShareableRun;
|
|
146
146
|
//#endregion
|
|
147
|
-
|
|
147
|
+
//#region src/embed.d.ts
|
|
148
|
+
interface MountRunnerOptions {
|
|
149
|
+
/** Initial editor source. Defaults to the playground template. */
|
|
150
|
+
readonly code?: string;
|
|
151
|
+
/** Render the source as a fixed listing instead of an editable field. */
|
|
152
|
+
readonly readonly?: boolean;
|
|
153
|
+
/** Run `code` immediately on mount. Defaults to false — embed code may
|
|
154
|
+
* come from a share link or CMS, so mounting never executes it unless
|
|
155
|
+
* the embedder opts in or the user clicks Run. */
|
|
156
|
+
readonly autoRun?: boolean;
|
|
157
|
+
/** Called once per completed run. */
|
|
158
|
+
readonly onRun?: (result: PipelineResult) => void;
|
|
159
|
+
}
|
|
160
|
+
interface MountedRunner {
|
|
161
|
+
/** Remove the runner's DOM and listeners. */
|
|
162
|
+
dispose(): void;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Mount a self-contained runner inside `el`. `dispose()` tears the mount
|
|
166
|
+
* down. With `autoRun: true` the runner executes `code` once on mount;
|
|
167
|
+
* otherwise it waits for the Run button — embeds never auto-execute code
|
|
168
|
+
* the embedder didn't explicitly allow.
|
|
169
|
+
*/
|
|
170
|
+
export declare function mountRunner(el: HTMLElement, opts?: MountRunnerOptions): MountedRunner;
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/engine.d.ts
|
|
173
|
+
/** Default template shown in the editor. */
|
|
174
|
+
export declare const DEFAULT_CODE: string;
|
|
175
|
+
/**
|
|
176
|
+
* Evaluate user code and return the Project.
|
|
177
|
+
*
|
|
178
|
+
* SECURITY: This uses `new Function()` to execute user-provided code.
|
|
179
|
+
* This is intentional — the playground is a local development tool where
|
|
180
|
+
* the user writes and runs their own pipeline code. The code runs in the
|
|
181
|
+
* browser's main page context (not a sandboxed iframe or worker) because
|
|
182
|
+
* the playground needs to support synchronous FunctionStep execution and
|
|
183
|
+
* direct access to the pipeline constructs. This is the same trust model
|
|
184
|
+
* as a local REPL or `node -e`.
|
|
185
|
+
*/
|
|
186
|
+
export declare function evaluateUserCode(code: string): Project;
|
|
187
|
+
/**
|
|
188
|
+
* Run a pipeline with a timeout. If a step returns a never-resolving
|
|
189
|
+
* promise, the timeout ensures the UI recovers instead of staying
|
|
190
|
+
* stuck in "Running" state forever.
|
|
191
|
+
*/
|
|
192
|
+
export declare function runPipelineWithTimeout(project: Project, timeoutMs: number): Promise<Awaited<ReturnType<typeof runPipeline>>>;
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/transpile.d.ts
|
|
195
|
+
/**
|
|
196
|
+
* Transpile playground source into `sverka.config.ts`.
|
|
197
|
+
*
|
|
198
|
+
* Rewrites the `@sverka/playground` import to `@sverka/workflow` and each
|
|
199
|
+
* `new FunctionStep(scope, "id", { fn, dependencies })` into a ShellStep
|
|
200
|
+
* whose command echoes a placeholder — the function body has no shell
|
|
201
|
+
* equivalent.
|
|
202
|
+
* `dependencies` maps onto `dependsOn`. Aliased FunctionStep imports
|
|
203
|
+
* (`FunctionStep as Fn`) are followed too.
|
|
204
|
+
*
|
|
205
|
+
* Throws `PlaygroundError(TRANSPILE_FAILED)` naming the offending step when
|
|
206
|
+
* a FunctionStep cannot be parsed — a half-converted file is never emitted.
|
|
207
|
+
*/
|
|
208
|
+
export declare function toSverkaConfig(source: string): string;
|
|
209
|
+
//#endregion
|
|
210
|
+
export type { Construct, Finding, FindingSource, MountRunnerOptions, MountedRunner, PipelineResult, PlaygroundErrorCode, PlaygroundFinding, Severity, ShareableRun, Step, StepResult };
|
|
148
211
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/pipeline.ts","../src/runner.ts","../src/share.ts"],"mappings":";;KAGY;;UAGK;EACf;EACA;EACA;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;;;;UAKe;EACf;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;;;UAIe;EACf;EACA;EACA,UAAU;EACV;EACA;;;UAIe;EACf,OAAO;EACP,UAAU;EACV;EACA;;;;;uBCrDoB;WACX;WACA,OAAO;EAEJ,YAAA,OAAO,kBAAkB;;MAMjC;;;qBASO,gBAAgB;WAClB,WAAW;EAER,YAAA;;EAKZ,YAAY,UAAU;;;qBAMX,iBAAiB;WACnB,OAAO;WACP,SAAS;EAEN,YAAA,SAAS,SAAS;;EAM9B,QAAQ,MAAM;;EAKd,SAAS,OAAO;;;uBAMI,aAAa;WACxB;EAEG,YAAA,UAAU,UAAU,YAAY;;WAOnC,WAAW,QAAQ,uBAAuB;;;qBAIxC,qBAAqB;WACvB,UAAU,QAAQ,uBAAuB;EAGhD,YAAA,UAAU,UACV,YACA;IACE,UAAU,QAAQ,uBAAuB;IACzC;;EAOJ,WAAW,QAAQ,uBAAuB;;;qBAM/B;WACF,UAAU;WACV;WACA;IAAW;;WACX;EAGP,YAAA,UAAU,UACV,YACA;IAAW;MAAW;;IAAgB;;;;;;;;;;;;;wBCtBpB,YAAY,SAAS,UAAU,QAAQ;;;UC3E5C;WACN;WACA;WACA,oBAAoB;;KAGnB;qBAGC,wBAAwB;WAC1B,MAAM;EACH,YAAA,MAAM,qBAAqB;;;qBAQ5B;;;wBAkFG,gBAAgB,KAAK,cAAc;;;;wBAkCnC,gBAAgB,eAAe"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/pipeline.ts","../src/runner.ts","../src/share.ts","../src/embed.ts","../src/engine.ts","../src/transpile.ts"],"mappings":";;KAGY;;UAGK;EACf;EACA;EACA;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;;;;UAKe;EACf;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;;;UAIe;EACf;EACA;EACA,UAAU;EACV;EACA;;;UAIe;EACf,OAAO;EACP,UAAU;EACV;EACA;;;;;uBCrDoB;WACX;WACA,OAAO;EAEJ,YAAA,OAAO,kBAAkB;;MAMjC;;;qBASO,gBAAgB;WAClB,WAAW;EAER,YAAA;;EAKZ,YAAY,UAAU;;;qBAMX,iBAAiB;WACnB,OAAO;WACP,SAAS;EAEN,YAAA,SAAS,SAAS;;EAM9B,QAAQ,MAAM;;EAKd,SAAS,OAAO;;;uBAMI,aAAa;WACxB;EAEG,YAAA,UAAU,UAAU,YAAY;;WAOnC,WAAW,QAAQ,uBAAuB;;;qBAIxC,qBAAqB;WACvB,UAAU,QAAQ,uBAAuB;EAGhD,YAAA,UAAU,UACV,YACA;IACE,UAAU,QAAQ,uBAAuB;IACzC;;EAOJ,WAAW,QAAQ,uBAAuB;;;qBAM/B;WACF,UAAU;WACV;WACA;IAAW;;WACX;EAGP,YAAA,UAAU,UACV,YACA;IAAW;MAAW;;IAAgB;;;;;;;;;;;;;wBCtBpB,YAAY,SAAS,UAAU,QAAQ;;;UC3E5C;WACN;WACA;WACA,oBAAoB;;KAGnB;qBAGC,wBAAwB;WAC1B,MAAM;EACH,YAAA,MAAM,qBAAqB;;;qBAQ5B;;;wBAkFG,gBAAgB,KAAK,cAAc;;;;wBAkCnC,gBAAgB,eAAe;;;UC/H9B;;WAEN;;WAEA;;;;WAIA;;WAEA,SAAS,QAAQ;;UAGX;;EAEf;;;;;;;;wBAkKc,YACd,IAAI,aACJ,OAAM,qBACL;;;;qBC9KU;;;;;;;;;;;;wBAmWG,iBAAiB,eAAe;;;;;;wBAqB1B,uBACpB,SAAS,SACT,oBACC,QAAQ,QAAQ,kBAAkB;;;;;;;;;;;;;;;;wBCqCrB,eAAe"}
|