@promptbook/website-crawler 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
|
@@ -24,7 +24,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
24
24
|
*
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.78.
|
|
27
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.78.2';
|
|
28
28
|
/**
|
|
29
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
30
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3751,20 +3751,32 @@ function extractVariablesFromScript(script) {
|
|
|
3751
3751
|
if (!(error instanceof ReferenceError)) {
|
|
3752
3752
|
throw error;
|
|
3753
3753
|
}
|
|
3754
|
-
var undefinedName = error.message.split(' ')[0];
|
|
3755
3754
|
/*
|
|
3756
3755
|
Note: Parsing the error
|
|
3756
|
+
🌟 Most devices:
|
|
3757
3757
|
[PipelineUrlError: thing is not defined]
|
|
3758
|
+
|
|
3759
|
+
🍏 iPhone`s Safari:
|
|
3760
|
+
[PipelineUrlError: Can't find variable: thing]
|
|
3758
3761
|
*/
|
|
3759
|
-
|
|
3762
|
+
var variableName = undefined;
|
|
3763
|
+
if (error.message.startsWith("Can't")) {
|
|
3764
|
+
// 🍏 Case
|
|
3765
|
+
variableName = error.message.split(' ').pop();
|
|
3766
|
+
}
|
|
3767
|
+
else {
|
|
3768
|
+
// 🌟 Case
|
|
3769
|
+
variableName = error.message.split(' ').shift();
|
|
3770
|
+
}
|
|
3771
|
+
if (variableName === undefined) {
|
|
3760
3772
|
throw error;
|
|
3761
3773
|
}
|
|
3762
|
-
if (script.includes(
|
|
3763
|
-
script = "const ".concat(
|
|
3774
|
+
if (script.includes(variableName + '(')) {
|
|
3775
|
+
script = "const ".concat(variableName, " = ()=>'';") + script;
|
|
3764
3776
|
}
|
|
3765
3777
|
else {
|
|
3766
|
-
variables.add(
|
|
3767
|
-
script = "const ".concat(
|
|
3778
|
+
variables.add(variableName);
|
|
3779
|
+
script = "const ".concat(variableName, " = '';") + script;
|
|
3768
3780
|
}
|
|
3769
3781
|
}
|
|
3770
3782
|
}
|