@rohal12/spindle 0.61.2 → 0.61.4
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/pkg/format.js +1 -1
- package/dist/pkg/headless.js +609 -335
- package/dist/pkg/play.js +2 -0
- package/dist/pkg/story-variables.js +486 -225
- package/package.json +1 -1
- package/src/automation/runner.ts +24 -3
- package/src/define-macro.ts +36 -2
- package/src/format/format-passage.ts +33 -7
- package/src/format/{fenced-code.ts → markdown-lines.ts} +22 -8
- package/src/format/placeholders.ts +1 -1
- package/src/format/source-lines.ts +17 -0
- package/src/js-lexer.ts +18 -0
- package/src/markup/spindle.peggy +6 -0
- package/src/observe/observable-text.ts +19 -7
- package/src/observe/observe.ts +30 -5
- package/src/play/session.ts +10 -0
- package/src/saves/format.ts +15 -4
- package/src/story-context-passage.ts +2 -1
- package/src/utils/element-visibility.ts +15 -10
- package/types/index.d.ts +13 -2
- package/types/play.d.ts +5 -0
package/dist/pkg/play.js
CHANGED
|
@@ -241,6 +241,7 @@ function workerExecArgv(execArgv) {
|
|
|
241
241
|
* Opens a session that runs the story in a worker. There `window` is
|
|
242
242
|
* happy-dom's window, not `globalThis`: story code sees `Story` and the DOM
|
|
243
243
|
* globals, but `window.foo = 1` does not make a bare global `foo`.
|
|
244
|
+
* Requires `trusted: true`: story code has unrestricted host Node access.
|
|
244
245
|
*/
|
|
245
246
|
function openPlaySession(options) {
|
|
246
247
|
return openPlaySessionWith(options, {
|
|
@@ -258,6 +259,7 @@ function openPlaySession(options) {
|
|
|
258
259
|
}
|
|
259
260
|
/** Internal: `openPlaySession` with the worker and headless URLs given (for tests). */
|
|
260
261
|
function openPlaySessionWith(options, urls) {
|
|
262
|
+
if (options.trusted !== true) return Promise.reject(/* @__PURE__ */ new Error("spindle: openPlaySession() requires trusted: true; story JavaScript has unrestricted access to host Node APIs, files and environment. Only run code you trust."));
|
|
261
263
|
const stepTimeoutMs = options.stepTimeoutMs ?? DEFAULT_STEP_TIMEOUT_MS;
|
|
262
264
|
if (typeof stepTimeoutMs !== "number" || !Number.isFinite(stepTimeoutMs) || stepTimeoutMs <= 0 || stepTimeoutMs > MAX_TIMEOUT_MS) return Promise.reject(/* @__PURE__ */ new Error(`spindle: openPlaySession(): "stepTimeoutMs" must be a positive number of milliseconds, got ${String(stepTimeoutMs)}`));
|
|
263
265
|
const timeoutMessage = `spindle: play session timed out after ${stepTimeoutMs} ms (the story may be stuck in a loop)`;
|