@promptbook/markdown-utils 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
|
@@ -20,7 +20,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
20
20
|
*
|
|
21
21
|
* @see https://github.com/webgptorg/promptbook
|
|
22
22
|
*/
|
|
23
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.78.
|
|
23
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.78.2';
|
|
24
24
|
/**
|
|
25
25
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
26
26
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3795,20 +3795,32 @@ function extractVariablesFromScript(script) {
|
|
|
3795
3795
|
if (!(error instanceof ReferenceError)) {
|
|
3796
3796
|
throw error;
|
|
3797
3797
|
}
|
|
3798
|
-
var undefinedName = error.message.split(' ')[0];
|
|
3799
3798
|
/*
|
|
3800
3799
|
Note: Parsing the error
|
|
3800
|
+
🌟 Most devices:
|
|
3801
3801
|
[PipelineUrlError: thing is not defined]
|
|
3802
|
+
|
|
3803
|
+
🍏 iPhone`s Safari:
|
|
3804
|
+
[PipelineUrlError: Can't find variable: thing]
|
|
3802
3805
|
*/
|
|
3803
|
-
|
|
3806
|
+
var variableName = undefined;
|
|
3807
|
+
if (error.message.startsWith("Can't")) {
|
|
3808
|
+
// 🍏 Case
|
|
3809
|
+
variableName = error.message.split(' ').pop();
|
|
3810
|
+
}
|
|
3811
|
+
else {
|
|
3812
|
+
// 🌟 Case
|
|
3813
|
+
variableName = error.message.split(' ').shift();
|
|
3814
|
+
}
|
|
3815
|
+
if (variableName === undefined) {
|
|
3804
3816
|
throw error;
|
|
3805
3817
|
}
|
|
3806
|
-
if (script.includes(
|
|
3807
|
-
script = "const ".concat(
|
|
3818
|
+
if (script.includes(variableName + '(')) {
|
|
3819
|
+
script = "const ".concat(variableName, " = ()=>'';") + script;
|
|
3808
3820
|
}
|
|
3809
3821
|
else {
|
|
3810
|
-
variables.add(
|
|
3811
|
-
script = "const ".concat(
|
|
3822
|
+
variables.add(variableName);
|
|
3823
|
+
script = "const ".concat(variableName, " = '';") + script;
|
|
3812
3824
|
}
|
|
3813
3825
|
}
|
|
3814
3826
|
}
|