@promptbook/node 0.78.2 → 0.78.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <!-- ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten -->
2
2
 
3
- # ![Promptbook logo - cube with letters P and B](./other/design/logo-h1.png) Promptbook
3
+ # Promptbook
4
4
 
5
5
 
6
6
 
@@ -14,7 +14,7 @@
14
14
 
15
15
 
16
16
 
17
- ## New Features
17
+ ## New Features
18
18
 
19
19
  - 💙 Working [the **Book** language v1.0.0](https://github.com/webgptorg/book)
20
20
  - 🖤 Run books from CLI - `npx ptbk run path/to/your/book`
package/esm/index.es.js CHANGED
@@ -26,7 +26,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
26
26
  *
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- var PROMPTBOOK_ENGINE_VERSION = '0.78.1';
29
+ var PROMPTBOOK_ENGINE_VERSION = '0.78.3';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2374,20 +2374,32 @@ function extractVariablesFromScript(script) {
2374
2374
  if (!(error instanceof ReferenceError)) {
2375
2375
  throw error;
2376
2376
  }
2377
- var undefinedName = error.message.split(' ')[0];
2378
2377
  /*
2379
2378
  Note: Parsing the error
2379
+ 🌟 Most devices:
2380
2380
  [PipelineUrlError: thing is not defined]
2381
+
2382
+ 🍏 iPhone`s Safari:
2383
+ [PipelineUrlError: Can't find variable: thing]
2381
2384
  */
2382
- if (!undefinedName) {
2385
+ var variableName = undefined;
2386
+ if (error.message.startsWith("Can't")) {
2387
+ // 🍏 Case
2388
+ variableName = error.message.split(' ').pop();
2389
+ }
2390
+ else {
2391
+ // 🌟 Case
2392
+ variableName = error.message.split(' ').shift();
2393
+ }
2394
+ if (variableName === undefined) {
2383
2395
  throw error;
2384
2396
  }
2385
- if (script.includes(undefinedName + '(')) {
2386
- script = "const ".concat(undefinedName, " = ()=>'';") + script;
2397
+ if (script.includes(variableName + '(')) {
2398
+ script = "const ".concat(variableName, " = ()=>'';") + script;
2387
2399
  }
2388
2400
  else {
2389
- variables.add(undefinedName);
2390
- script = "const ".concat(undefinedName, " = '';") + script;
2401
+ variables.add(variableName);
2402
+ script = "const ".concat(variableName, " = '';") + script;
2391
2403
  }
2392
2404
  }
2393
2405
  }