@promptbook/website-crawler 0.75.2 → 0.75.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 +23 -16
- package/esm/index.es.js.map +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +23 -16
- package/umd/index.umd.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/website-crawler",
|
|
3
|
-
"version": "0.75.
|
|
3
|
+
"version": "0.75.3",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"--note-0": " <- [🐊]",
|
|
6
6
|
"private": false,
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"module": "./esm/index.es.js",
|
|
55
55
|
"typings": "./esm/typings/src/_packages/website-crawler.index.d.ts",
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@promptbook/core": "0.75.
|
|
57
|
+
"@promptbook/core": "0.75.3"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@mozilla/readability": "0.5.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.75.
|
|
25
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.2';
|
|
26
26
|
/**
|
|
27
27
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
28
28
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2976,16 +2976,16 @@
|
|
|
2976
2976
|
* Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
|
|
2977
2977
|
*/
|
|
2978
2978
|
var all = [];
|
|
2979
|
-
var _loop_1 = function (packageName, className) {
|
|
2979
|
+
var _loop_1 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
|
|
2980
2980
|
if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
|
|
2981
2981
|
return "continue";
|
|
2982
2982
|
}
|
|
2983
|
-
all.push({ packageName: packageName, className: className });
|
|
2983
|
+
all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
|
|
2984
2984
|
};
|
|
2985
2985
|
try {
|
|
2986
2986
|
for (var _c = __values($scrapersMetadataRegister.list()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
2987
|
-
var _e = _d.value, packageName = _e.packageName, className = _e.className;
|
|
2988
|
-
_loop_1(packageName, className);
|
|
2987
|
+
var _e = _d.value, packageName = _e.packageName, className = _e.className, mimeTypes = _e.mimeTypes, documentationUrl = _e.documentationUrl, isAvilableInBrowser = _e.isAvilableInBrowser;
|
|
2988
|
+
_loop_1(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
|
|
2989
2989
|
}
|
|
2990
2990
|
}
|
|
2991
2991
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -2995,16 +2995,16 @@
|
|
|
2995
2995
|
}
|
|
2996
2996
|
finally { if (e_1) throw e_1.error; }
|
|
2997
2997
|
}
|
|
2998
|
-
var _loop_2 = function (packageName, className) {
|
|
2998
|
+
var _loop_2 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
|
|
2999
2999
|
if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
|
|
3000
3000
|
return "continue";
|
|
3001
3001
|
}
|
|
3002
|
-
all.push({ packageName: packageName, className: className });
|
|
3002
|
+
all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
|
|
3003
3003
|
};
|
|
3004
3004
|
try {
|
|
3005
3005
|
for (var _f = __values($scrapersRegister.list()), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
3006
|
-
var _h = _g.value, packageName = _h.packageName, className = _h.className;
|
|
3007
|
-
_loop_2(packageName, className);
|
|
3006
|
+
var _h = _g.value, packageName = _h.packageName, className = _h.className, mimeTypes = _h.mimeTypes, documentationUrl = _h.documentationUrl, isAvilableInBrowser = _h.isAvilableInBrowser;
|
|
3007
|
+
_loop_2(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
|
|
3008
3008
|
}
|
|
3009
3009
|
}
|
|
3010
3010
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -3034,29 +3034,33 @@
|
|
|
3034
3034
|
}
|
|
3035
3035
|
return spaceTrim__default["default"](function (block) { return "\n Available scrapers are:\n ".concat(block(metadata
|
|
3036
3036
|
.map(function (_a, i) {
|
|
3037
|
-
var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled;
|
|
3037
|
+
var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled, mimeTypes = _a.mimeTypes, isAvilableInBrowser = _a.isAvilableInBrowser;
|
|
3038
3038
|
var more;
|
|
3039
|
+
// TODO: Use documentationUrl
|
|
3039
3040
|
if (just(false)) {
|
|
3040
3041
|
more = '';
|
|
3041
3042
|
}
|
|
3042
3043
|
else if (!isMetadataAviailable && !isInstalled) {
|
|
3043
3044
|
// TODO: [�][�] Maybe do allow to do auto-install if package not registered and not found
|
|
3044
|
-
more = "(not installed and no metadata, looks like a unexpected behavior)";
|
|
3045
|
+
more = "*(not installed and no metadata, looks like a unexpected behavior)*";
|
|
3045
3046
|
}
|
|
3046
3047
|
else if (isMetadataAviailable && !isInstalled) {
|
|
3047
3048
|
// TODO: [�][�]
|
|
3048
|
-
more = "(not installed)";
|
|
3049
|
+
more = "*(not installed)*";
|
|
3049
3050
|
}
|
|
3050
3051
|
else if (!isMetadataAviailable && isInstalled) {
|
|
3051
|
-
more = "(no metadata, looks like a unexpected behavior)";
|
|
3052
|
+
more = "*(no metadata, looks like a unexpected behavior)*";
|
|
3052
3053
|
}
|
|
3053
3054
|
else if (isMetadataAviailable && isInstalled) {
|
|
3054
3055
|
more = "(installed)";
|
|
3055
3056
|
}
|
|
3056
3057
|
else {
|
|
3057
|
-
more = "(unknown state, looks like a unexpected behavior)";
|
|
3058
|
+
more = "*(unknown state, looks like a unexpected behavior)*";
|
|
3058
3059
|
}
|
|
3059
|
-
|
|
3060
|
+
if (!isAvilableInBrowser) {
|
|
3061
|
+
more += " *(not available in browser)*";
|
|
3062
|
+
}
|
|
3063
|
+
return "".concat(i + 1, ") `").concat(className, "` from `").concat(packageName, "` compatible to scrape ").concat(mimeTypes.join(', '), " ").concat(more);
|
|
3060
3064
|
})
|
|
3061
3065
|
.join('\n')), "\n "); });
|
|
3062
3066
|
}
|
|
@@ -3353,7 +3357,10 @@
|
|
|
3353
3357
|
return [7 /*endfinally*/];
|
|
3354
3358
|
case 9:
|
|
3355
3359
|
if (partialPieces === null) {
|
|
3356
|
-
throw new KnowledgeScrapeError(spaceTrim__default["default"](function (block) { return "\n Cannot scrape knowledge from source
|
|
3360
|
+
throw new KnowledgeScrapeError(spaceTrim__default["default"](function (block) { return "\n Cannot scrape knowledge from source:\n \n > ".concat(block(knowledgeSource.sourceContent
|
|
3361
|
+
.split('\n')
|
|
3362
|
+
.map(function (line) { return "> ".concat(line); })
|
|
3363
|
+
.join('\n')), "\n\n No scraper found for the mime type \"").concat(sourceHandler.mimeType, "\"\n\n ").concat(block($registeredScrapersMessage()), "\n\n\n "); }));
|
|
3357
3364
|
}
|
|
3358
3365
|
pieces = partialPieces.map(function (partialPiece) { return (__assign(__assign({}, partialPiece), { sources: [
|
|
3359
3366
|
{
|