@rohal12/spindle 0.64.1 → 0.64.3
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/README.md +1 -1
- package/dist/pkg/format.js +1 -1
- package/dist/pkg/headless.js +155 -315
- package/dist/pkg/play-worker.js +4 -8
- package/dist/pkg/play.js +4 -8
- package/dist/pkg/story-variables.js +268 -352
- package/package.json +4 -4
- package/src/completion-context.ts +0 -1
- package/src/components/macros/PassageDisplay.tsx +1 -1
- package/src/components/macros/WidgetInvocation.tsx +1 -1
- package/src/components/macros/arg-utils.ts +5 -0
- package/src/index.tsx +1 -5
- package/src/js-bindings.ts +2 -1
- package/src/story-variables.ts +2 -3
package/dist/pkg/play-worker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parentPort, workerData } from "node:worker_threads";
|
|
2
|
-
|
|
2
|
+
// src/utils/error-message.ts
|
|
3
3
|
/**
|
|
4
4
|
* The message to show for a caught value. Anything can be thrown, not only
|
|
5
5
|
* Errors: an Error gives its message, a string is its own message, and any
|
|
@@ -16,8 +16,7 @@ function errorMessage(err, fallback) {
|
|
|
16
16
|
return fallback ?? "Unprintable error";
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
//#region src/play/optional.ts
|
|
19
|
+
// src/play/optional.ts
|
|
21
20
|
var defaultImporter = (pkg) => import(pkg);
|
|
22
21
|
function isMissingPackage(err, pkg) {
|
|
23
22
|
return err instanceof Error && err.code === "ERR_MODULE_NOT_FOUND" && err.message.includes(`'${pkg}'`);
|
|
@@ -35,8 +34,7 @@ async function loadOptional(pkg, feature, importer = defaultImporter) {
|
|
|
35
34
|
throw err;
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
//#region src/play/window-events.ts
|
|
37
|
+
// src/play/window-events.ts
|
|
40
38
|
/** Expose the story's global window at the DOM event boundary. */
|
|
41
39
|
function installWindowEvents(window) {
|
|
42
40
|
const storyWindow = globalThis;
|
|
@@ -85,8 +83,7 @@ function installWindowEvents(window) {
|
|
|
85
83
|
return composedPath.call(this).map((target) => target === window ? storyWindow : target);
|
|
86
84
|
};
|
|
87
85
|
}
|
|
88
|
-
|
|
89
|
-
//#region src/play/worker.ts
|
|
86
|
+
// src/play/worker.ts
|
|
90
87
|
/**
|
|
91
88
|
* The worker thread of a play session: boots the story on happy-dom and
|
|
92
89
|
* answers the session handle's calls (see `protocol.ts`). Built to
|
|
@@ -266,4 +263,3 @@ start().catch((err) => {
|
|
|
266
263
|
});
|
|
267
264
|
process.exit(1);
|
|
268
265
|
});
|
|
269
|
-
//#endregion
|
package/dist/pkg/play.js
CHANGED
|
@@ -2,7 +2,7 @@ import { glob, readFile, stat } from "node:fs/promises";
|
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { Worker } from "node:worker_threads";
|
|
5
|
-
|
|
5
|
+
// src/utils/error-message.ts
|
|
6
6
|
/**
|
|
7
7
|
* The message to show for a caught value. Anything can be thrown, not only
|
|
8
8
|
* Errors: an Error gives its message, a string is its own message, and any
|
|
@@ -19,8 +19,7 @@ function errorMessage(err, fallback) {
|
|
|
19
19
|
return fallback ?? "Unprintable error";
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
//#region src/play/optional.ts
|
|
22
|
+
// src/play/optional.ts
|
|
24
23
|
var defaultImporter = (pkg) => import(pkg);
|
|
25
24
|
function isMissingPackage(err, pkg) {
|
|
26
25
|
return err instanceof Error && err.code === "ERR_MODULE_NOT_FOUND" && err.message.includes(`'${pkg}'`);
|
|
@@ -38,8 +37,7 @@ async function loadOptional(pkg, feature, importer = defaultImporter) {
|
|
|
38
37
|
throw err;
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
|
-
|
|
42
|
-
//#region src/play/resolve-story.ts
|
|
40
|
+
// src/play/resolve-story.ts
|
|
43
41
|
/**
|
|
44
42
|
* twee-ts takes a format ID to be the name of the folder holding format.js,
|
|
45
43
|
* not the name inside it. The package keeps its format in `dist/pkg/`, and
|
|
@@ -166,8 +164,7 @@ async function resolveStoryHtml(input) {
|
|
|
166
164
|
version
|
|
167
165
|
});
|
|
168
166
|
}
|
|
169
|
-
|
|
170
|
-
//#region src/play/session.ts
|
|
167
|
+
// src/play/session.ts
|
|
171
168
|
/**
|
|
172
169
|
* The main-thread handle of a play session. The story runs in its own worker
|
|
173
170
|
* thread (see `protocol.ts`); this file queues calls so they run one at a
|
|
@@ -350,5 +347,4 @@ function openPlaySessionWith(options, urls) {
|
|
|
350
347
|
worker.unref();
|
|
351
348
|
});
|
|
352
349
|
}
|
|
353
|
-
//#endregion
|
|
354
350
|
export { openPlaySession, resolveStoryHtml };
|