@promptbook/legacy-documents 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
|
@@ -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.
|
|
26
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.78.2';
|
|
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
|
|
@@ -3894,20 +3894,32 @@ function extractVariablesFromScript(script) {
|
|
|
3894
3894
|
if (!(error instanceof ReferenceError)) {
|
|
3895
3895
|
throw error;
|
|
3896
3896
|
}
|
|
3897
|
-
var undefinedName = error.message.split(' ')[0];
|
|
3898
3897
|
/*
|
|
3899
3898
|
Note: Parsing the error
|
|
3899
|
+
🌟 Most devices:
|
|
3900
3900
|
[PipelineUrlError: thing is not defined]
|
|
3901
|
+
|
|
3902
|
+
🍏 iPhone`s Safari:
|
|
3903
|
+
[PipelineUrlError: Can't find variable: thing]
|
|
3901
3904
|
*/
|
|
3902
|
-
|
|
3905
|
+
var variableName = undefined;
|
|
3906
|
+
if (error.message.startsWith("Can't")) {
|
|
3907
|
+
// 🍏 Case
|
|
3908
|
+
variableName = error.message.split(' ').pop();
|
|
3909
|
+
}
|
|
3910
|
+
else {
|
|
3911
|
+
// 🌟 Case
|
|
3912
|
+
variableName = error.message.split(' ').shift();
|
|
3913
|
+
}
|
|
3914
|
+
if (variableName === undefined) {
|
|
3903
3915
|
throw error;
|
|
3904
3916
|
}
|
|
3905
|
-
if (script.includes(
|
|
3906
|
-
script = "const ".concat(
|
|
3917
|
+
if (script.includes(variableName + '(')) {
|
|
3918
|
+
script = "const ".concat(variableName, " = ()=>'';") + script;
|
|
3907
3919
|
}
|
|
3908
3920
|
else {
|
|
3909
|
-
variables.add(
|
|
3910
|
-
script = "const ".concat(
|
|
3921
|
+
variables.add(variableName);
|
|
3922
|
+
script = "const ".concat(variableName, " = '';") + script;
|
|
3911
3923
|
}
|
|
3912
3924
|
}
|
|
3913
3925
|
}
|