@promptbook/cli 0.78.2 → 0.78.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/esm/index.es.js CHANGED
@@ -37,7 +37,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
37
37
  *
38
38
  * @see https://github.com/webgptorg/promptbook
39
39
  */
40
- var PROMPTBOOK_ENGINE_VERSION = '0.78.1';
40
+ var PROMPTBOOK_ENGINE_VERSION = '0.78.2';
41
41
  /**
42
42
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
43
43
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -3828,20 +3828,32 @@ function extractVariablesFromScript(script) {
3828
3828
  if (!(error instanceof ReferenceError)) {
3829
3829
  throw error;
3830
3830
  }
3831
- var undefinedName = error.message.split(' ')[0];
3832
3831
  /*
3833
3832
  Note: Parsing the error
3833
+ 🌟 Most devices:
3834
3834
  [PipelineUrlError: thing is not defined]
3835
+
3836
+ 🍏 iPhone`s Safari:
3837
+ [PipelineUrlError: Can't find variable: thing]
3835
3838
  */
3836
- if (!undefinedName) {
3839
+ var variableName = undefined;
3840
+ if (error.message.startsWith("Can't")) {
3841
+ // 🍏 Case
3842
+ variableName = error.message.split(' ').pop();
3843
+ }
3844
+ else {
3845
+ // 🌟 Case
3846
+ variableName = error.message.split(' ').shift();
3847
+ }
3848
+ if (variableName === undefined) {
3837
3849
  throw error;
3838
3850
  }
3839
- if (script.includes(undefinedName + '(')) {
3840
- script = "const ".concat(undefinedName, " = ()=>'';") + script;
3851
+ if (script.includes(variableName + '(')) {
3852
+ script = "const ".concat(variableName, " = ()=>'';") + script;
3841
3853
  }
3842
3854
  else {
3843
- variables.add(undefinedName);
3844
- script = "const ".concat(undefinedName, " = '';") + script;
3855
+ variables.add(variableName);
3856
+ script = "const ".concat(variableName, " = '';") + script;
3845
3857
  }
3846
3858
  }
3847
3859
  }