@promptbook/core 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
@@ -23,7 +23,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
23
23
  *
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- var PROMPTBOOK_ENGINE_VERSION = '0.78.1';
26
+ var PROMPTBOOK_ENGINE_VERSION = '0.78.3';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2691,20 +2691,32 @@ function extractVariablesFromScript(script) {
2691
2691
  if (!(error instanceof ReferenceError)) {
2692
2692
  throw error;
2693
2693
  }
2694
- var undefinedName = error.message.split(' ')[0];
2695
2694
  /*
2696
2695
  Note: Parsing the error
2696
+ 🌟 Most devices:
2697
2697
  [PipelineUrlError: thing is not defined]
2698
+
2699
+ 🍏 iPhone`s Safari:
2700
+ [PipelineUrlError: Can't find variable: thing]
2698
2701
  */
2699
- if (!undefinedName) {
2702
+ var variableName = undefined;
2703
+ if (error.message.startsWith("Can't")) {
2704
+ // 🍏 Case
2705
+ variableName = error.message.split(' ').pop();
2706
+ }
2707
+ else {
2708
+ // 🌟 Case
2709
+ variableName = error.message.split(' ').shift();
2710
+ }
2711
+ if (variableName === undefined) {
2700
2712
  throw error;
2701
2713
  }
2702
- if (script.includes(undefinedName + '(')) {
2703
- script = "const ".concat(undefinedName, " = ()=>'';") + script;
2714
+ if (script.includes(variableName + '(')) {
2715
+ script = "const ".concat(variableName, " = ()=>'';") + script;
2704
2716
  }
2705
2717
  else {
2706
- variables.add(undefinedName);
2707
- script = "const ".concat(undefinedName, " = '';") + script;
2718
+ variables.add(variableName);
2719
+ script = "const ".concat(variableName, " = '';") + script;
2708
2720
  }
2709
2721
  }
2710
2722
  }