rockstar-strudel 1.0.6 → 1.0.7
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 +7 -0
- package/package.json +1 -1
- package/src/index.js +10 -0
package/README.md
CHANGED
|
@@ -51,6 +51,11 @@ const pro = await rockstar_pro`
|
|
|
51
51
|
// Fully stringified values for speech/text workflows
|
|
52
52
|
// pro.text_output === ["hello world", ["12", ["my dreams", "7"]]]
|
|
53
53
|
|
|
54
|
+
// Sanitized source tokens for Shaba/Shabda speech sample names
|
|
55
|
+
// pro.speech === ["say_hello_world", "shout__012_my_dreams_007_"]
|
|
56
|
+
// Use in Strudel as:
|
|
57
|
+
// samples('shabda/speech:'+pro.speech.join(','))
|
|
58
|
+
|
|
54
59
|
// Raw callback lines from WASM
|
|
55
60
|
// pro.raw_output keeps trailing newlines exactly as emitted
|
|
56
61
|
|
|
@@ -104,6 +109,8 @@ Tagged-template function with richer parallel output views:
|
|
|
104
109
|
- `output`: numeric-first values (`number` or nested numeric arrays).
|
|
105
110
|
- `mixed_output`: mixed typed values with words preserved.
|
|
106
111
|
- `text_output`: fully stringified values for text/speech use.
|
|
112
|
+
- `speech`: sanitized line tokens derived from source code for Shabda speech
|
|
113
|
+
sample lookup (for example `samples('shabda/speech:'+prog.speech.join(','))`).
|
|
107
114
|
- `templateValues`: the interpolation values used for this run.
|
|
108
115
|
- `rerun(...values)`: run the same template again, replacing interpolation
|
|
109
116
|
values positionally. Calling `rerun()` with no arguments repeats the same run.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rockstar-strudel",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Run Rockstar lang programs via the Starship WASM engine, returning output as a JS array. Designed for use in the strudel.cc live-coding REPL.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
package/src/index.js
CHANGED
|
@@ -482,6 +482,7 @@ export async function rockstar(strings, ...values) {
|
|
|
482
482
|
* output: Array<number|Array<unknown>>,
|
|
483
483
|
* mixed_output: Array<number|string|Array<unknown>>,
|
|
484
484
|
* text_output: Array<string|Array<unknown>>,
|
|
485
|
+
* speech: Array<string>, // samples('shabda/speech:'+prog.speech.join(','))
|
|
485
486
|
* rerun: (...values: Array<unknown>) => Promise<object>,
|
|
486
487
|
* getVariables: () => never,
|
|
487
488
|
* callFunction: (name: string, ...args: Array<unknown>) => never,
|
|
@@ -495,6 +496,14 @@ export async function rockstar_pro(strings, ...values) {
|
|
|
495
496
|
const output = [];
|
|
496
497
|
const mixed_output = [];
|
|
497
498
|
const text_output = [];
|
|
499
|
+
const lines = code.split('\n')
|
|
500
|
+
const speech = lines.map((x) => x.toLowerCase()
|
|
501
|
+
.trim()
|
|
502
|
+
.replaceAll(' ', '_')
|
|
503
|
+
.replace(/\W/g, ''))
|
|
504
|
+
.filter((x)=> x.length);
|
|
505
|
+
|
|
506
|
+
console.log(`samples('shabda/speech:'+prog.speech.join(','))`)
|
|
498
507
|
|
|
499
508
|
await runner.Run(
|
|
500
509
|
code,
|
|
@@ -526,6 +535,7 @@ export async function rockstar_pro(strings, ...values) {
|
|
|
526
535
|
output,
|
|
527
536
|
mixed_output,
|
|
528
537
|
text_output,
|
|
538
|
+
speech,
|
|
529
539
|
rerun: (...nextArgs) => {
|
|
530
540
|
const nextValues = resolveRerunValues(values, ...nextArgs);
|
|
531
541
|
return rockstar_pro(strings, ...nextValues);
|